-
Notifications
You must be signed in to change notification settings - Fork 146
Closed
Description
Error:
DEBUG tokio-runtime-worker runtime::contracts: New code rejected on validation: Module uses chain extensions but chain extensions are disabled
Reproduce
runtime/src/lib.rs
// -- snip
pub mod extension;
impl pallet_contracts::Config for Runtime {
// -- snip
type ChainExtension = extension::Example;
}
// -- snipruntime/src/extension.rs
#[derive(Default)]
pub struct Example;
impl ChainExtension<Runtime> for Example {
fn call<E: Ext>(&mut self, env: Environment<E, InitState>) -> Result<RetVal, DispatchError>
where
E: Ext<T = Runtime>,
{
panic!("Hey");
}
fn enabled() -> bool {
log::info!("[info] Yes it's enabled");
true
}
}But when I upload a ink! contract using the chain extension, it throws error:
CodeRejected
The contract's code was found to be invalid during validation.The most likely cause of this is that an API was used which is not supported by thenode. This happens if an older node is used with a new version of ink!. Try updatingyour node to the newest available version.A more detailed error can be found on the node console if debug messages are enabledby supplying `-lruntime::contracts=debug`.
Module uses chain extensions but chain extensions are disabled
Also:
#[cfg(test)]
#[test]
fn runtime_test() {
use pallet_contracts::chain_extension::ChainExtension;
assert!( <Runtime as pallet_contracts::Config>::ChainExtension::enabled() );
}Output:
running 1 test
test runtime_test ... ok
Version:
└──╼ $cargo contract --version
cargo-contract-contract 3.0.1-unknown-x86_64-unknown-linux-gnu
sp-api = { git = "https://github.com/paritytech/substrate", package = "sp-api", branch = "polkadot-v1.0.0" }
ink = { version = "4.2.0", default-features = false }
ink_env = { version = "4.2.1", default-features = false }
Metadata
Metadata
Assignees
Labels
No labels