Closed sebastianmontero closed 5 months ago
can read runtime version from runtime.wasm. you need to use compressed one
@ermalkaleci so do I need to use the wasm-override parameter?
yes
to be clear. I thought you're trying custom wasm runtime. are you trying to use chopsticks for wss://c1md5.hashed.live?
you have the same issue. https://github.com/AcalaNetwork/chopsticks/issues/564
Thanks @ermalkaleci! Yes for wss://c1md5.hashed.live, but md5 is using polkadot v1.3.0, from what I understand from the issue is that they are using an old version, correct?
yes, there're using old version but in your case it seems smoldot can find version from your wasm runtime
Ok, I'll try using the branch mentioned in the issue, thanks!
@ermalkaleci I'm getting this error when building the wasm on that branch:
error[E0432]: unresolved imports `smoldot::executor::runtime_host`, `smoldot::executor::runtime_host`, `smoldot::verify::body_only::LogEmitInfo`
--> src/task.rs:7:9
|
7 | runtime_host::{self, OffchainContext, RuntimeHostVm},
| ^^^^^^^^^^^^ ^^^^ no `runtime_host` in `executor`
| |
| could not find `runtime_host` in `executor`
| help: a similar name exists in the module: `runtime_call`
...
17 | verify::body_only::LogEmitInfo,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `LogEmitInfo` in `verify::body_only`
|
= help: consider importing this enum instead:
smoldot::executor::runtime_call::LogEmitInfo
error[E0599]: no variant or associated item named `Oneshot` found for enum `ExecHint` in the current scope
--> src/task.rs:409:53
|
409 | exec_hint: smoldot::executor::vm::ExecHint::Oneshot,
| ^^^^^^^ variant or associated item not found in `ExecHint`
error[E0599]: no variant or associated item named `Oneshot` found for enum `ExecHint` in the current scope
--> src/task.rs:130:53
|
130 | exec_hint: smoldot::executor::vm::ExecHint::Oneshot,
| ^^^^^^^ variant or associated item not found in `ExecHint`
error[E0599]: no method named `iter` found for struct `EntryKeyIter` in the current scope
--> src/proof.rs:66:37
|
66 | trie.node(entry_key.key.iter().map(|x| x.to_owned()))
| ^^^^ method not found in `EntryKeyIter<'_, Vec<u8>>`
Some errors have detailed explanations: E0432, E0599.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `chopsticks-executor` (lib) due to 4 previous errors
Error: Compiling your crate to WebAssembly failed
Caused by: Compiling your crate to WebAssembly failed
Caused by: failed to execute `cargo build`: exited with exit status: 101
full command: cd "/home/sebastian/vsc-workspace/chopsticks/executor" && "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown"
Do you know why this might be?
I started debugging smoldot to see if there was any problem and turns out the your problem is stateVersion: 5
the old version is 0 and new trie version is 1.
Thanks @ermalkaleci! Changing the stateVersion to 1, and overriding the wasm solved that issue. But now I'm getting the following error:
called `Result::unwrap()` on an `Err` value: VirtualMachine(UnresolvedFunctionImport { function: "ext_transaction_index_index_version_1", module_name: "env" })
Stack:
Error
at imports.wbg.__wbg_new_abda76e883ba8a5f (/home/sebastian/.npm/_npx/84d26c864c64a94e/node_modules/@acala-network/chopsticks-executor/dist/cjs/chopsticks_executor.js:748:19)
at wasm://wasm/00966b66:wasm-function[701]:0x1269bf
at wasm://wasm/00966b66:wasm-function[866]:0x130a13
at wasm://wasm/00966b66:wasm-function[795]:0x12b783
at wasm://wasm/00966b66:wasm-function[105]:0xa7664
at wasm://wasm/00966b66:wasm-function[380]:0x10eb7c
at wasm://wasm/00966b66:wasm-function[917]:0x1312f9
at __wbg_adapter_48 (/home/sebastian/.npm/_npx/84d26c864c64a94e/node_modules/@acala-network/chopsticks-executor/dist/cjs/chopsticks_executor.js:410:10)
at real (/home/sebastian/.npm/_npx/84d26c864c64a94e/node_modules/@acala-network/chopsticks-executor/dist/cjs/chopsticks_executor.js:394:22)
at node:internal/process/task_queues:140:7
node:internal/event_target:1010
process.nextTick(() => { throw err; });
^
Error [RuntimeError]: unreachable
at wasm://wasm/00966b66:wasm-function[701]:0x126ad5
at wasm://wasm/00966b66:wasm-function[866]:0x130a13
at wasm://wasm/00966b66:wasm-function[795]:0x12b783
at wasm://wasm/00966b66:wasm-function[105]:0xa7664
at wasm://wasm/00966b66:wasm-function[380]:0x10eb7c
at wasm://wasm/00966b66:wasm-function[917]:0x1312f9
at __wbg_adapter_48 (/home/sebastian/.npm/_npx/84d26c864c64a94e/node_modules/@acala-network/chopsticks-executor/dist/cjs/chopsticks_executor.js:410:10)
at real (/home/sebastian/.npm/_npx/84d26c864c64a94e/node_modules/@acala-network/chopsticks-executor/dist/cjs/chopsticks_executor.js:394:22)
at node:internal/process/task_queues:140:7
at AsyncResource.runInAsyncScope (node:async_hooks:204:9)
Emitted 'error' event on Worker instance at:
at [kOnErrorMessage] (node:internal/worker:290:10)
at [kOnMessage] (node:internal/worker:301:37)
at MessagePort.<anonymous> (node:internal/worker:202:57)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:735:20)
at exports.emitMessage (node:internal/per_context/messageport:23:28)
That means your runtime has methods unrecognized by smoldot. Try with allow-unresolved-imports: true
That worked, but I guess it won't work until I upgrade the on chain runtime with the correct state version, because now it runs, but when I go into polkadotjs app, it crashes and I get the RuntimeVersion(RuntimeVersionDecode) error, is this correct?
It should work with both wasm-override and allow-unresolved-imports.
It runs:
But when I go to the polkadotjsapp it throws the error:
how do you override wasm?
if you upload your custom wasm with correct trie version number I can give it a try
This is my config file:
endpoint: wss://c1md5.hashed.live
mock-signature-host: true
block: ${env.MD5_BLOCK_NUMBER}
db: ./md5.rococo.db.sqlite
allow-unresolved-imports: true
wasm-override: ../hashed-substrate-parachain/target/release/wbuild/hashed-parachain-runtime/hashed_parachain_runtime.compact.compressed.wasm
import-storage:
Sudo:
Key: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice
System:
Account:
-
-
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- providers: 1
data:
free: "100000000000000000000000"
Here is the wasm Thanks!
ok the problem is this. we're overriding wasm and it works for that block but as soon at it loads parent, it will fail because trie is invalid
I did modify vendor/smoldot to parse your version 5 as 1 but it will end up calling unknown host function ext_transaction_index_index_version_1
. This function is not implemented in smoldot
Thanks for looking into it @ermalkaleci! So for it to work I need to update the on chain runtime with the correct state version?
I think that won't be enough. Your runtime has a host function unimplemented in smoldot.
So I won't be able to use chopsticks? How can I know which is the function that is not implemented?
the unimplemented method is ext_transaction_index_index_version_1
which seems to be used by those 2 pallet https://github.com/search?q=repo%3Aparitytech%2Fpolkadot-sdk%20sp_io%3A%3Atransaction_index%3A%3Aindex&type=code
I added an empty implementation of ext_transaction_index_index_version_1
and it appears to work
Great! Thanks! are you using the latest beta?
no, PR was rejected. we can't add the implementation to smoldot. If you wish you can fork and build your custom version with above implementation
@ermalkaleci thank you for all your help! I've forked the chopsticks repo and changed smoldot submodule to use the pr you created. But I still have the same issue, chopstick runs initially but when I go to the polkadotjs app it fails with the RuntimeVersionDecode error. Do I need to do anything else?
I did modify vendor/smoldot to parse your version 5 as 1 but it will end up calling unknown host function
ext_transaction_index_index_version_1
. This function is not implemented in smoldot
You need this as well
Thanks @ermalkaleci! That worked!
I'm trying to test for the md5 rococo parachain but I get the following error:
This is the config file I'm using:
Why might this be?