Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

try-runtime: Use configured wasm execution method #13694

Merged
merged 3 commits into from
Mar 24, 2023

Conversation

bkchr
Copy link
Member

@bkchr bkchr commented Mar 23, 2023

Closes: #13692

@bkchr bkchr added A2-insubstantial Pull request requires no code review (e.g., a sub-repository hash update). B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit labels Mar 23, 2023
@bkchr bkchr requested review from kianenigma and ggwpez March 23, 2023 12:04
Copy link
Member

@ggwpez ggwpez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, was just about to pull out the debugger before I saw that issue 😆

@ggwpez
Copy link
Member

ggwpez commented Mar 23, 2023

@kianenigma was there a good reason to prefer Interpreted here?

Copy link
Contributor

@crystalin crystalin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it (edit: the shared.wasm_method) needs to be converted first

@bkchr
Copy link
Member Author

bkchr commented Mar 23, 2023

I think it (edit: the shared.wasm_method) needs to be converted first

Good point! I didn't compile the crate with the try-runtime feature locally and thus, don't have seen the error.

Copy link
Contributor

@kianenigma kianenigma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded interpreted was indeed an oversight, thanks for fixing!

@crystalin
Copy link
Contributor

Now that it is using the wasm compiler, I can do the debugging , but unfortunately, it crashes (which is not the case when debugging the runtime when running the node (not try-runtime))
To add the debugger, I added config.debug_info(true); to the wasmtime fn common_config

Here is the panic. I'm digging into it:

   0: sp_panic_handler::panic_hook
             at /home/crystalin/projects/substrate/primitives/panic-handler/src/lib.rs:166:18
      sp_panic_handler::set::{{closure}}
             at /home/crystalin/projects/substrate/primitives/panic-handler/src/lib.rs:62:12
   1: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/alloc/src/boxed.rs:2032:9
      std::panicking::rust_panic_with_hook
             at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/std/src/panicking.rs:692:13
   2: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/std/src/panicking.rs:577:13
   3: std::sys_common::backtrace::__rust_end_short_backtrace
             at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/std/src/sys_common/backtrace.rs:137:18
   4: rust_begin_unwind
             at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/std/src/panicking.rs:575:5
   5: core::panicking::panic_fmt
             at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/core/src/panicking.rs:65:14
   6: core::panicking::panic
             at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/core/src/panicking.rs:115:5
   7: wasmtime_cranelift::debug::transform::expression::ValueLabelRangesBuilder::process_label
             at /home/crystalin/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-cranelift-1.0.1/src/debug/transform/expression.rs:689:13
   8: wasmtime_cranelift::debug::transform::expression::CompiledExpression::build_with_locals
   9: wasmtime_cranelift::debug::transform::simulate::generate_vars
             at /home/crystalin/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-cranelift-1.0.1/src/debug/transform/simulate.rs:230:28
      wasmtime_cranelift::debug::transform::simulate::generate_simulated_dwarf
             at /home/crystalin/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-cranelift-1.0.1/src/debug/transform/simulate.rs:395:13
      wasmtime_cranelift::debug::transform::transform_dwarf
             at /home/crystalin/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-cranelift-1.0.1/src/debug/transform/mod.rs:108:5
  10: wasmtime_cranelift::debug::write_debuginfo::emit_dwarf
             at /home/crystalin/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-cranelift-1.0.1/src/debug/write_debuginfo.rs:166:17
  11: wasmtime_cranelift::compiler::Compiler::append_dwarf
             at /home/crystalin/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-cranelift-1.0.1/src/compiler.rs:886:13
      <wasmtime_cranelift::compiler::Compiler as wasmtime_environ::compilation::Compiler>::emit_obj
             at /home/crystalin/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-cranelift-1.0.1/src/compiler.rs:403:9
  12: wasmtime::module::Module::compile_functions
             at /home/crystalin/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-1.0.1/src/module.rs:415:13
      wasmtime::module::Module::build_artifacts
             at /home/crystalin/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-1.0.1/src/module.rs:362:28
  13: wasmtime::module::Module::from_binary::{{closure}}
             at /home/crystalin/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-1.0.1/src/module.rs:299:38
      core::ops::function::FnOnce::call_once
             at /rustc/e631891f7ad40eac3ef58ec3c2b57ecd81e40615/library/core/src/ops/function.rs:510:5
  14: wasmtime_cache::ModuleCacheEntry::get_data_raw
             at /home/crystalin/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-cache-1.0.1/src/lib.rs:82:28
  15: wasmtime::module::Module::from_binary
             at /home/crystalin/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-1.0.1/src/module.rs:291:43
  16: wasmtime::module::Module::new
             at /home/crystalin/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-1.0.1/src/module.rs:197:9
      sc_executor_wasmtime::runtime::do_create_runtime
             at /home/crystalin/projects/substrate/client/executor/wasmtime/src/runtime.rs:638:17
      sc_executor_wasmtime::runtime::create_runtime
             at /home/crystalin/projects/substrate/client/executor/wasmtime/src/runtime.rs:578:11
  17: sc_executor::wasm_runtime::create_wasm_runtime_with_code
             at /home/crystalin/projects/substrate/client/executor/src/wasm_runtime.rs:317:4
  18: sc_executor::wasm_runtime::create_versioned_wasm_runtime
             at /home/crystalin/projects/substrate/client/executor/src/wasm_runtime.rs:413:16
  19: sc_executor::wasm_runtime::RuntimeCache::with_instance
             at /home/crystalin/projects/substrate/client/executor/src/wasm_runtime.rs:250:17
  ...

@crystalin
Copy link
Contributor

Oh I think it is because of the StripDrawf from the wasm-builder :/ I'll work on that

@bkchr
Copy link
Member Author

bkchr commented Mar 24, 2023

bot merge

@paritytech-processbot
Copy link

Waiting for commit status.

@paritytech-processbot paritytech-processbot bot merged commit d0449fd into master Mar 24, 2023
@paritytech-processbot paritytech-processbot bot deleted the bkchr-try-runtime-executor branch March 24, 2023 17:50
breathx pushed a commit to gear-tech/substrate that referenced this pull request Apr 22, 2023
* try-runtime: Use configured wasm execution method

* Fix compilation
ekovalev pushed a commit to ekovalev/substrate that referenced this pull request Jul 3, 2023
* try-runtime: Use configured wasm execution method

* Fix compilation

(cherry picked from commit d0449fd)
nathanwhit pushed a commit to nathanwhit/substrate that referenced this pull request Jul 19, 2023
* try-runtime: Use configured wasm execution method

* Fix compilation
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A2-insubstantial Pull request requires no code review (e.g., a sub-repository hash update). B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

try-runtime is executing Wasm Interpreter even with --wasm-execution compiled
4 participants