difftreelog
refactor disable contracts in runtime
in: master
2 files changed
runtime/Cargo.tomldiffbeforeafterboth--- a/runtime/Cargo.toml
+++ b/runtime/Cargo.toml
@@ -43,10 +43,10 @@
'frame-system-rpc-runtime-api/std',
'pallet-aura/std',
'pallet-balances/std',
- 'pallet-contracts/std',
- 'pallet-contracts-primitives/std',
- 'pallet-contracts-rpc-runtime-api/std',
- 'pallet-contract-helpers/std',
+ # 'pallet-contracts/std',
+ # 'pallet-contracts-primitives/std',
+ # 'pallet-contracts-rpc-runtime-api/std',
+ # 'pallet-contract-helpers/std',
'pallet-randomness-collective-flip/std',
'pallet-sudo/std',
'pallet-timestamp/std',
@@ -152,23 +152,23 @@
version = '3.0.0'
# Contracts specific packages
-[dependencies.pallet-contracts]
-git = 'https://github.com/paritytech/substrate.git'
-default-features = false
-branch = 'polkadot-v0.9.7'
-version = '3.0.0'
+# [dependencies.pallet-contracts]
+# git = 'https://github.com/paritytech/substrate.git'
+# default-features = false
+# branch = 'polkadot-v0.9.7'
+# version = '3.0.0'
-[dependencies.pallet-contracts-primitives]
-git = 'https://github.com/paritytech/substrate.git'
-default-features = false
-branch = 'polkadot-v0.9.7'
-version = '3.0.0'
+# [dependencies.pallet-contracts-primitives]
+# git = 'https://github.com/paritytech/substrate.git'
+# default-features = false
+# branch = 'polkadot-v0.9.7'
+# version = '3.0.0'
-[dependencies.pallet-contracts-rpc-runtime-api]
-git = 'https://github.com/paritytech/substrate.git'
-default-features = false
-branch = 'polkadot-v0.9.7'
-version = '3.0.0'
+# [dependencies.pallet-contracts-rpc-runtime-api]
+# git = 'https://github.com/paritytech/substrate.git'
+# default-features = false
+# branch = 'polkadot-v0.9.7'
+# version = '3.0.0'
[dependencies.pallet-randomness-collective-flip]
default-features = false
@@ -380,7 +380,7 @@
pallet-inflation = { path = '../pallets/inflation', default-features = false, version = '3.0.0' }
nft-data-structs = { path = '../primitives/nft', default-features = false, version = '0.9.0' }
pallet-scheduler = { path = '../pallets/scheduler', default-features = false, version = '3.0.0' }
-pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
+# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
pallet-nft-transaction-payment = { path = '../pallets/nft-transaction-payment', default-features = false, version = '3.0.0' }
pallet-nft-charge-transaction = { path = '../pallets/nft-charge-transaction', default-features = false, version = '3.0.0' }
runtime/src/lib.rsdiffbeforeafterboth55 },55 },56};56};57use nft_data_structs::*;57use nft_data_structs::*;58use pallet_contracts::weights::WeightInfo;58// use pallet_contracts::weights::WeightInfo;59// #[cfg(any(feature = "std", test))]59// #[cfg(any(feature = "std", test))]60use frame_system::{60use frame_system::{61 self as system, EnsureRoot, EnsureSigned,61 self as system, EnsureRoot, EnsureSigned,72use sp_runtime::{72use sp_runtime::{73 traits::{Dispatchable},73 traits::{Dispatchable},74};74};75use pallet_contracts::chain_extension::UncheckedFrom;75// use pallet_contracts::chain_extension::UncheckedFrom;767677pub use pallet_timestamp::Call as TimestampCall;77// pub use pallet_timestamp::Call as TimestampCall;78pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;78pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;797980// Polkadot imports80// Polkadot imports91};91};92use xcm_executor::{Config, XcmExecutor};92use xcm_executor::{Config, XcmExecutor};939394mod chain_extension;94// mod chain_extension;95use crate::chain_extension::{NFTExtension, Imbalance};95// use crate::chain_extension::{NFTExtension, Imbalance};9697/// Re-export a nft pallet98/// TODO: Check this re-export. Is this safe and good style?99// extern crate pallet_nft;100// pub use pallet_nft::*;101102/// Reimport pallet inflation103// extern crate pallet_inflation;104// pub use pallet_inflation::*;10596106/// An index to a block.97/// An index to a block.107pub type BlockNumber = u32;98pub type BlockNumber = u32;379 items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE370 items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE380}371}381372382parameter_types! {373/*383 pub TombstoneDeposit: Balance = deposit(374parameter_types! {384 1,375 pub TombstoneDeposit: Balance = deposit(385 sp_std::mem::size_of::<pallet_contracts::Pallet<Runtime>> as u32,376 1,386 );377 sp_std::mem::size_of::<pallet_contracts::Pallet<Runtime>> as u32,387 pub DepositPerContract: Balance = TombstoneDeposit::get();378 );388 pub const DepositPerStorageByte: Balance = deposit(0, 1);379 pub DepositPerContract: Balance = TombstoneDeposit::get();389 pub const DepositPerStorageItem: Balance = deposit(1, 0);380 pub const DepositPerStorageByte: Balance = deposit(0, 1);390 pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);381 pub const DepositPerStorageItem: Balance = deposit(1, 0);391 pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;382 pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);392 pub const SignedClaimHandicap: u32 = 2;383 pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;393 pub const MaxDepth: u32 = 32;384 pub const SignedClaimHandicap: u32 = 2;394 pub const MaxValueSize: u32 = 16 * 1024;385 pub const MaxDepth: u32 = 32;395 pub const MaxCodeSize: u32 = 1024 * 1024 * 25; // 25 Mb386 pub const MaxValueSize: u32 = 16 * 1024;396 // The lazy deletion runs inside on_initialize.387 pub const MaxCodeSize: u32 = 1024 * 1024 * 25; // 25 Mb397 pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *388 // The lazy deletion runs inside on_initialize.398 RuntimeBlockWeights::get().max_block;389 pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *399 // The weight needed for decoding the queue should be less or equal than a fifth390 RuntimeBlockWeights::get().max_block;400 // of the overall weight dedicated to the lazy deletion.391 // The weight needed for decoding the queue should be less or equal than a fifth401 pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (392 // of the overall weight dedicated to the lazy deletion.402 <Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -393 pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (403 <Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)394 <Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -404 )) / 5) as u32;395 <Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)405 pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();396 )) / 5) as u32;406}397 pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();407398}408impl pallet_contracts::Config for Runtime {399409 type Time = Timestamp;400impl pallet_contracts::Config for Runtime {410 type Randomness = RandomnessCollectiveFlip;401 type Time = Timestamp;411 type Currency = Balances;402 type Randomness = RandomnessCollectiveFlip;412 type Event = Event;403 type Currency = Balances;413 type RentPayment = ();404 type Event = Event;414 type SignedClaimHandicap = SignedClaimHandicap;405 type RentPayment = ();415 type TombstoneDeposit = TombstoneDeposit;406 type SignedClaimHandicap = SignedClaimHandicap;416 type DepositPerContract = DepositPerContract;407 type TombstoneDeposit = TombstoneDeposit;417 type DepositPerStorageByte = DepositPerStorageByte;408 type DepositPerContract = DepositPerContract;418 type DepositPerStorageItem = DepositPerStorageItem;409 type DepositPerStorageByte = DepositPerStorageByte;419 type RentFraction = RentFraction;410 type DepositPerStorageItem = DepositPerStorageItem;420 type SurchargeReward = SurchargeReward;411 type RentFraction = RentFraction;421 // type MaxDepth = MaxDepth;412 type SurchargeReward = SurchargeReward;422 // type MaxValueSize = MaxValueSize;413 type WeightPrice = pallet_transaction_payment::Module<Self>;423 type WeightPrice = pallet_transaction_payment::Module<Self>;414 type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;424 type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;415 type ChainExtension = NFTExtension;425 type ChainExtension = NFTExtension;416 type DeletionQueueDepth = DeletionQueueDepth;426 type DeletionQueueDepth = DeletionQueueDepth;417 type DeletionWeightLimit = DeletionWeightLimit;427 type DeletionWeightLimit = DeletionWeightLimit;418 type Schedule = Schedule;428 // type MaxCodeSize = MaxCodeSize;419 type CallStack = [pallet_contracts::Frame<Self>; 31];429 type Schedule = Schedule;420}430 type CallStack = [pallet_contracts::Frame<Self>; 31];421*/431}432422433parameter_types! {423parameter_types! {434 pub const TransactionByteFee: Balance = 501 * MICROUNIQUE; // Targeting 0.1 Unique per NFT transfer424 pub const TransactionByteFee: Balance = 501 * MICROUNIQUE; // Targeting 0.1 Unique per NFT transfer724 fn resolve(who: &AccountId, call: &Call) -> Option<AccountId>714 fn resolve(who: &AccountId, call: &Call) -> Option<AccountId>725 where715 where726 Call: Dispatchable<Info = DispatchInfo>,716 Call: Dispatchable<Info = DispatchInfo>,727 Call: IsSubType<pallet_nft::Call<Runtime>>,728 Call: IsSubType<pallet_contracts::Call<Runtime>>,729 AccountId: AsRef<[u8]>,717 AccountId: AsRef<[u8]>,730 AccountId: UncheckedFrom<Hash>,731 {718 {732 pallet_nft_transaction_payment::Module::<Runtime>::withdraw_type(who, call)719 pallet_nft_transaction_payment::Module::<Runtime>::withdraw_type(who, call)733 }720 }734}721}735722736type SponsorshipHandler = (723type SponsorshipHandler = (737 pallet_nft::NftSponsorshipHandler<Runtime>,724 pallet_nft::NftSponsorshipHandler<Runtime>,738 pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,725 //pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,739);726);740727741impl pallet_scheduler::Config for Runtime {728impl pallet_scheduler::Config for Runtime {756743757impl pallet_nft_charge_transaction::Config for Runtime {}744impl pallet_nft_charge_transaction::Config for Runtime {}758745759impl pallet_contract_helpers::Config for Runtime {}746// impl pallet_contract_helpers::Config for Runtime {}760747761construct_runtime!(748construct_runtime!(762 pub enum Runtime where749 pub enum Runtime where765 UncheckedExtrinsic = UncheckedExtrinsic752 UncheckedExtrinsic = UncheckedExtrinsic766 {753 {767 Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,754 Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,768 Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>},755 // Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>},769 RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage},756 RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage},770 Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},757 Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},771 TransactionPayment: pallet_transaction_payment::{Pallet, Storage},758 TransactionPayment: pallet_transaction_payment::{Pallet, Storage},797 Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>},784 Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>},798 NftPayment: pallet_nft_transaction_payment::{Pallet, Call, Storage},785 NftPayment: pallet_nft_transaction_payment::{Pallet, Call, Storage},799 Charging: pallet_nft_charge_transaction::{Pallet, Call, Storage },786 Charging: pallet_nft_charge_transaction::{Pallet, Call, Storage },800 ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage},787 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage},801 }788 }802);789);803790844 system::CheckNonce<Runtime>,831 system::CheckNonce<Runtime>,845 system::CheckWeight<Runtime>,832 system::CheckWeight<Runtime>,846 pallet_nft_charge_transaction::ChargeTransactionPayment<Runtime>,833 pallet_nft_charge_transaction::ChargeTransactionPayment<Runtime>,847 pallet_contract_helpers::ContractHelpersExtension<Runtime>,834 //pallet_contract_helpers::ContractHelpersExtension<Runtime>,848);835);849/// Unchecked extrinsic type as expected by this runtime.836/// Unchecked extrinsic type as expected by this runtime.850pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;837pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;1087 }1074 }1088 }1075 }108910761090 impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>1077 /*1091 for Runtime1078 impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>1092 {1079 for Runtime1093 fn call(1080 {1094 origin: AccountId,1081 fn call(1095 dest: AccountId,1082 origin: AccountId,1096 value: Balance,1083 dest: AccountId,1097 gas_limit: u64,1084 value: Balance,1098 input_data: Vec<u8>,1085 gas_limit: u64,1099 ) -> pallet_contracts_primitives::ContractExecResult {1086 input_data: Vec<u8>,1100 Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)1087 ) -> pallet_contracts_primitives::ContractExecResult {1101 }1088 Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)11021089 }1103 fn instantiate(10901104 origin: AccountId,1091 fn instantiate(1105 endowment: Balance,1092 origin: AccountId,1106 gas_limit: u64,1093 endowment: Balance,1107 code: pallet_contracts_primitives::Code<Hash>,1094 gas_limit: u64,1108 data: Vec<u8>,1095 code: pallet_contracts_primitives::Code<Hash>,1109 salt: Vec<u8>,1096 data: Vec<u8>,1110 ) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>1097 salt: Vec<u8>,1111 {1098 ) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>1112 Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)1099 {1113 }1100 Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)11141101 }1115 fn get_storage(11021116 address: AccountId,1103 fn get_storage(1117 key: [u8; 32],1104 address: AccountId,1118 ) -> pallet_contracts_primitives::GetStorageResult {1105 key: [u8; 32],1119 Contracts::get_storage(address, key)1106 ) -> pallet_contracts_primitives::GetStorageResult {1120 }1107 Contracts::get_storage(address, key)11211108 }1122 fn rent_projection(11091123 address: AccountId,1110 fn rent_projection(1124 ) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {1111 address: AccountId,1125 Contracts::rent_projection(address)1112 ) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {1126 }1113 Contracts::rent_projection(address)1127 }1114 }1115 }1116 */112811171129 #[cfg(feature = "runtime-benchmarks")]1118 #[cfg(feature = "runtime-benchmarks")]1130 impl frame_benchmarking::Benchmark<Block> for Runtime {1119 impl frame_benchmarking::Benchmark<Block> for Runtime {