I am running call_runtime
from ink. It builds successfully, but when trying to upload contract, It gives system.ExtrinsicFailed contracts.CodeRejected
error. Someone please advice what I am doing wrong?
1 Answer
The error above is most likely because contracts
pallet on Aleph Zero is not configured to support call_runtime
.
Aleph Zero configuration
impl pallet_contracts::Config for Runtime {
type Time = Timestamp;
type Randomness = RandomnessCollectiveFlip;
type Currency = Balances;
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
// The safest default is to allow no calls at all. This is unsafe experimental feature with no support in ink!
type CallFilter = 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>; 16];
type DepositPerByte = DepositPerByte;
type DefaultDepositLimit = ConstU128<{ u128::MAX }>;
type DepositPerItem = DepositPerItem;
type AddressGenerator = pallet_contracts::DefaultAddressGenerator;
type MaxCodeLen = ConstU32<{ 128 * 1024 }>;
type MaxStorageKeyLen = ConstU32<128>;
type UnsafeUnstableInterface = ConstBool<false>;
type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>;
}
To be able to use call_runtime
, CallFilter
and UnsafeUnstableInterface
should be configured as below:
// In your node's runtime configuration file (runtime.rs)
impl pallet_contracts::Config for Runtime {
…
// `Everything` or anything that will allow for the `Balances::transfer` extrinsic.
type CallFilter = frame_support::traits::Everything;
type UnsafeUnstableInterface = ConstBool<true>;
…
}