From 8def008a5054cb8d809b20a17bbed362d5d94b29 Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Thu, 08 Jul 2021 11:52:17 +0000 Subject: [PATCH] refactor: disable contracts in runtime --- --- 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' } --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -55,7 +55,7 @@ }, }; use nft_data_structs::*; -use pallet_contracts::weights::WeightInfo; +// use pallet_contracts::weights::WeightInfo; // #[cfg(any(feature = "std", test))] use frame_system::{ self as system, EnsureRoot, EnsureSigned, @@ -72,9 +72,9 @@ use sp_runtime::{ traits::{Dispatchable}, }; -use pallet_contracts::chain_extension::UncheckedFrom; +// use pallet_contracts::chain_extension::UncheckedFrom; -pub use pallet_timestamp::Call as TimestampCall; +// pub use pallet_timestamp::Call as TimestampCall; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; // Polkadot imports @@ -91,18 +91,9 @@ }; use xcm_executor::{Config, XcmExecutor}; -mod chain_extension; -use crate::chain_extension::{NFTExtension, Imbalance}; +// mod chain_extension; +// use crate::chain_extension::{NFTExtension, Imbalance}; -/// Re-export a nft pallet -/// TODO: Check this re-export. Is this safe and good style? -// extern crate pallet_nft; -// pub use pallet_nft::*; - -/// Reimport pallet inflation -// extern crate pallet_inflation; -// pub use pallet_inflation::*; - /// An index to a block. pub type BlockNumber = u32; @@ -379,6 +370,7 @@ items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE } +/* parameter_types! { pub TombstoneDeposit: Balance = deposit( 1, @@ -418,17 +410,15 @@ type DepositPerStorageItem = DepositPerStorageItem; type RentFraction = RentFraction; type SurchargeReward = SurchargeReward; - // type MaxDepth = MaxDepth; - // type MaxValueSize = MaxValueSize; type WeightPrice = pallet_transaction_payment::Module; type WeightInfo = pallet_contracts::weights::SubstrateWeight; type ChainExtension = NFTExtension; type DeletionQueueDepth = DeletionQueueDepth; type DeletionWeightLimit = DeletionWeightLimit; - // type MaxCodeSize = MaxCodeSize; type Schedule = Schedule; type CallStack = [pallet_contracts::Frame; 31]; } +*/ parameter_types! { pub const TransactionByteFee: Balance = 501 * MICROUNIQUE; // Targeting 0.1 Unique per NFT transfer @@ -724,10 +714,7 @@ fn resolve(who: &AccountId, call: &Call) -> Option where Call: Dispatchable, - Call: IsSubType>, - Call: IsSubType>, AccountId: AsRef<[u8]>, - AccountId: UncheckedFrom, { pallet_nft_transaction_payment::Module::::withdraw_type(who, call) } @@ -735,7 +722,7 @@ type SponsorshipHandler = ( pallet_nft::NftSponsorshipHandler, - pallet_contract_helpers::ContractSponsorshipHandler, + //pallet_contract_helpers::ContractSponsorshipHandler, ); impl pallet_scheduler::Config for Runtime { @@ -756,7 +743,7 @@ impl pallet_nft_charge_transaction::Config for Runtime {} -impl pallet_contract_helpers::Config for Runtime {} +// impl pallet_contract_helpers::Config for Runtime {} construct_runtime!( pub enum Runtime where @@ -765,7 +752,7 @@ UncheckedExtrinsic = UncheckedExtrinsic { Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 30, - Contracts: pallet_contracts::{Pallet, Call, Storage, Event}, + // Contracts: pallet_contracts::{Pallet, Call, Storage, Event}, RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage}, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, TransactionPayment: pallet_transaction_payment::{Pallet, Storage}, @@ -797,7 +784,7 @@ Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event}, NftPayment: pallet_nft_transaction_payment::{Pallet, Call, Storage}, Charging: pallet_nft_charge_transaction::{Pallet, Call, Storage }, - ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage}, + // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage}, } ); @@ -844,7 +831,7 @@ system::CheckNonce, system::CheckWeight, pallet_nft_charge_transaction::ChargeTransactionPayment, - pallet_contract_helpers::ContractHelpersExtension, + //pallet_contract_helpers::ContractHelpersExtension, ); /// Unchecked extrinsic type as expected by this runtime. pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; @@ -1087,6 +1074,7 @@ } } + /* impl pallet_contracts_rpc_runtime_api::ContractsApi for Runtime { @@ -1125,6 +1113,7 @@ Contracts::rent_projection(address) } } + */ #[cfg(feature = "runtime-benchmarks")] impl frame_benchmarking::Benchmark for Runtime { -- gitstuff