2

Executing build command: "rustup" "run" "nightly" "cargo" "rustc" "--target=wasm32-unknown-unknown" "--manifest-path=/home/briza/Desktop/substrate-node-template/target/release/wbuild/node-template-runtime/Cargo.toml" "--color=always" "--profile" "release" Using rustc version: rustc 1.67.0-nightly (c97b539e4 2022-11-30)

I followed this doc: https://docs.substrate.io/tutorials/work-with-pallets/contracts-pallet/ , and when I worked in this step "Implement the Contracts configuration trait", and I use th cargo check -p node-template-runtime --release

the terminal showed that

error[E0432]: unresolved import pallet_contracts::DefaultContractAccessWeight

more information below:

Information that should be included in a bug report. Executing build command: "rustup" "run" "nightly" "cargo" "rustc" "--target=wasm32-unknown-unknown" "--manifest-path=/home/briza/Desktop/substrate-node-template/target/release/wbuild/node-template-runtime/Cargo.toml" "--color=always" "--profile" "release" Using rustc version: rustc 1.67.0-nightly (c97b539e4 2022-11-30) --- stderr Compiling node-template-runtime v4.0.0-dev (/home/briza/Desktop/substrate-node-template/runtime) error[E0432]: unresolved import pallet_contracts::DefaultContractAccessWeight --> /home/briza/Desktop/substrate-node-template/runtime/src/lib.rs:47:5 | 47 | use pallet_contracts::DefaultContractAccessWeight; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no DefaultContractAccessWeight in the root error[E0437]: type ContractAccessWeight is not a member of trait pallet_contracts::Config --> /home/briza/Desktop/substrate-node-template/runtime/src/lib.rs:167:3 | 167 | type ContractAccessWeight = DefaultContractAccessWeight; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait pallet_contracts::Config error[E0437]: type RelaxedMaxCodeLen is not a member of trait pallet_contracts::Config --> /home/briza/Desktop/substrate-node-template/runtime/src/lib.rs:169:3 | 169 | type RelaxedMaxCodeLen = ConstU32<{ 512 * 1024 }>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait pallet_contracts::Config Some errors have detailed explanations: E0432, E0437. For more information about an error, try rustc --explain E0432.

enter image description here

1
  • Were you able to resolve this? I am getting a similar error.
    – chomprrr
    Dec 15, 2022 at 18:56

1 Answer 1

0

I faced the same issue. The following steps helped me resolve it.

First, I removed the import of pallet_contracts::DefaultContractAccessWeight

I added this line pub const DeletionQueueDepth: u32 = 128; to parameter_types!. So your new block should look something like this

parameter_types! {
    pub const DepositPerItem: Balance = deposit(1, 0);
    pub const DepositPerByte: Balance = deposit(0, 1);
    pub const DeletionQueueDepth: u32 = 128;
    pub const UnsafeUnstableInterface: bool = false;
    pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO * BlockWeights::get().max_block;
    pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();
}

Finally I changed the arguments Config. The final code looks like

impl pallet_contracts::Config for Runtime {
    type Time = Timestamp;
    type Randomness = RandomnessCollectiveFlip;
    type Currency = Balances;
    type RuntimeEvent = RuntimeEvent;
    type RuntimeCall = RuntimeCall;
    type CallFilter = frame_support::traits::Nothing;
    type WeightPrice = pallet_transaction_payment::Pallet<Self>;
    type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;
    type ChainExtension = ();
    type Schedule = Schedule;
    type CallStack = [pallet_contracts::Frame<Self>; 31];
    type DeletionQueueDepth = DeletionQueueDepth;
    type DeletionWeightLimit = DeletionWeightLimit;
    type DepositPerByte = DepositPerByte;
    type DepositPerItem = DepositPerItem;
    type AddressGenerator = pallet_contracts::DefaultAddressGenerator;
    type MaxCodeLen = ConstU32<{ 256 * 1024 }>;
    type MaxStorageKeyLen = ConstU32<{ 512 * 1024 }>;
    type UnsafeUnstableInterface = UnsafeUnstableInterface;
    type MaxDebugBufferLen = ConstU32<{ 256 * 1024 }>;
}

It is possible that this code may not work in the future. All you need to do is the go the source code of the pallet_contracts and add/remove the argument according to the code. Use dummy argument. The compiler's debugger will do a good job in directing you to the right code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.