git.delta.rocks / unique-network / refs/commits / f9fbba6aa97a

difftreelog

Merge pull request #162 from usetech-llc/feature/disable-contracts

Greg Zaitsev2021-07-08parents: #3fb6236 #53f6567.patch.diff
in: master
Temporary disable contracts

9 files changed

modifiedCargo.lockdiffbeforeafterboth
before · Cargo.lock
959 packageslockfile v3
modifiedREADME.mddiffbeforeafterboth
--- a/README.md
+++ b/README.md
@@ -250,4 +250,88 @@
 ### Check code style in tests
 ```bash
 cd tests && yarn eslint --ext .ts,.js src/
-```
\ No newline at end of file
+```
+
+## Re-Enabling Ink! Contracts
+
+Uncomment following lies:
+1. In node/rpc/Cargo.toml
+```
+# pallet-contracts-rpc = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+```
+
+2. In node/rpc/src/lib.rs
+```
+// C::Api: pallet_contracts_rpc::ContractsRuntimeApi<Block, AccountId, Balance, BlockNumber, Hash>,
+...
+// use pallet_contracts_rpc::{Contracts, ContractsApi};
+...
+// io.extend_with(ContractsApi::to_delegate(Contracts::new(client.clone())));
+
+```
+
+3. In runtime/Cargo.toml
+```
+    # 'pallet-contracts/std',
+    # 'pallet-contracts-primitives/std',
+    # 'pallet-contracts-rpc-runtime-api/std',
+    # 'pallet-contract-helpers/std',
+...
+    # [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-rpc-runtime-api]
+    # git = 'https://github.com/paritytech/substrate.git'
+    # default-features = false
+    # branch = 'polkadot-v0.9.7'
+    # version = '3.0.0'
+...
+    # pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
+```
+
+4. runtime/src/lib.rs
+```
+// use pallet_contracts::weights::WeightInfo;
+...
+// use pallet_contracts::chain_extension::UncheckedFrom;
+...
+// pub use pallet_timestamp::Call as TimestampCall;
+...
+// mod chain_extension;
+// use crate::chain_extension::{NFTExtension, Imbalance};
+...
+/*
+parameter_types! {
+	pub TombstoneDeposit: Balance = deposit(
+  ...
+}
+*/
+...
+//pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,
+...
+// impl pallet_contract_helpers::Config for Runtime {}
+...
+// Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>},
+...
+// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage},
+...
+//pallet_contract_helpers::ContractHelpersExtension<Runtime>,
+...
+/*
+	impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>
+		for Runtime
+	{
+    ...
+	}
+*/
+
+```
modifiednode/cli/Cargo.tomldiffbeforeafterboth
--- a/node/cli/Cargo.toml
+++ b/node/cli/Cargo.toml
@@ -193,17 +193,6 @@
 branch = 'polkadot-v0.9.7'
 version = '3.0.0'
 
-[dependencies.pallet-contracts]
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.7'
-version = '3.0.0'
-
-[dependencies.pallet-contracts-rpc]
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.7'
-version = '3.0.0'
-
-
 [dependencies.sc-network]
 git = 'https://github.com/paritytech/substrate.git'
 branch = 'polkadot-v0.9.7'
modifiednode/rpc/Cargo.tomldiffbeforeafterboth
--- a/node/rpc/Cargo.toml
+++ b/node/rpc/Cargo.toml
@@ -13,7 +13,7 @@
 futures = { version = "0.3.1", features = ["compat"] }
 jsonrpc-core = "15.0.0"
 jsonrpc-pubsub = "15.0.0"
-pallet-contracts-rpc = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
+# pallet-contracts-rpc = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
 pallet-transaction-payment-rpc = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
 pallet-transaction-payment-rpc-runtime-api = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
 sc-client-api = { version = "3.0", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
modifiednode/rpc/src/lib.rsdiffbeforeafterboth
--- a/node/rpc/src/lib.rs
+++ b/node/rpc/src/lib.rs
@@ -121,7 +121,7 @@
 	C: BlockchainEvents<Block>,
 	C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>,
 	C::Api: BlockBuilder<Block>,
-	C::Api: pallet_contracts_rpc::ContractsRuntimeApi<Block, AccountId, Balance, BlockNumber, Hash>,
+	// C::Api: pallet_contracts_rpc::ContractsRuntimeApi<Block, AccountId, Balance, BlockNumber, Hash>,
 	C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
 	C::Api: fp_rpc::EthereumRuntimeRPCApi<Block>,
 	C::Api: pallet_nft::NftApi<Block>,
@@ -135,7 +135,7 @@
 		EthPubSubApiServer, EthSigner, HexEncodedIdProvider, NetApi, NetApiServer, Web3Api,
 		Web3ApiServer,
 	};
-	use pallet_contracts_rpc::{Contracts, ContractsApi};
+	// use pallet_contracts_rpc::{Contracts, ContractsApi};
 	use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
 	use substrate_frame_rpc_system::{FullSystem, SystemApi};
 
@@ -164,7 +164,7 @@
 		client.clone(),
 	)));
 
-	io.extend_with(ContractsApi::to_delegate(Contracts::new(client.clone())));
+	// io.extend_with(ContractsApi::to_delegate(Contracts::new(client.clone())));
 
 	let mut signers = Vec::new();
 	if enable_dev_signer {
modifiedpallets/nft/Cargo.tomldiffbeforeafterboth
--- a/pallets/nft/Cargo.toml
+++ b/pallets/nft/Cargo.toml
@@ -25,7 +25,6 @@
     'pallet-balances/std',
     'pallet-evm/std',
     'pallet-timestamp/std',
-    'pallet-contracts/std',
     'pallet-randomness-collective-flip/std',
     'pallet-transaction-payment/std',
     'fp-evm/std',
@@ -90,12 +89,6 @@
 version = '3.0.0'
 
 [dependencies.sp-std]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.7'
-version = '3.0.0'
-
-[dependencies.pallet-contracts]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
 branch = 'polkadot-v0.9.7'
modifiedprimitives/nft/Cargo.tomldiffbeforeafterboth
--- a/primitives/nft/Cargo.toml
+++ b/primitives/nft/Cargo.toml
@@ -13,7 +13,6 @@
 serde = { version = "1.0.119", features = ['derive'], default-features = false }
 frame-support = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
 frame-system = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
-pallet-contracts = { default-features = false, version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
 sp-core = { version = "3.0.0", default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
 sp-runtime = { version = "3.0.0", default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.7' }
 
@@ -26,5 +25,4 @@
   "frame-support/std",
   "sp-runtime/std",
   "sp-core/std",
-  "pallet-contracts/std",
 ]
\ No newline at end of file
modifiedruntime/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' }
 
modifiedruntime/src/lib.rsdiffbeforeafterboth
--- 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,17 +91,8 @@
 };
 use xcm_executor::{Config, XcmExecutor};
 
-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::*;
+// mod chain_extension;
+// use crate::chain_extension::{NFTExtension, Imbalance};
 
 /// 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<Self>;
 	type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;
 	type ChainExtension = NFTExtension;
 	type DeletionQueueDepth = DeletionQueueDepth;
 	type DeletionWeightLimit = DeletionWeightLimit;
-	// type MaxCodeSize = MaxCodeSize;
 	type Schedule = Schedule;
 	type CallStack = [pallet_contracts::Frame<Self>; 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<AccountId>
 	where
 		Call: Dispatchable<Info = DispatchInfo>,
-		Call: IsSubType<pallet_nft::Call<Runtime>>,
-		Call: IsSubType<pallet_contracts::Call<Runtime>>,
 		AccountId: AsRef<[u8]>,
-		AccountId: UncheckedFrom<Hash>,
 	{
 		pallet_nft_transaction_payment::Module::<Runtime>::withdraw_type(who, call)
 	}
@@ -735,7 +722,7 @@
 
 type SponsorshipHandler = (
 	pallet_nft::NftSponsorshipHandler<Runtime>,
-	pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,
+	//pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,
 );
 
 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<T>, Event<T>} = 30,
-		Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>},
+		// Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>},
 		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<T>},
 		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<Runtime>,
 	system::CheckWeight<Runtime>,
 	pallet_nft_charge_transaction::ChargeTransactionPayment<Runtime>,
-	pallet_contract_helpers::ContractHelpersExtension<Runtime>,
+	//pallet_contract_helpers::ContractHelpersExtension<Runtime>,
 );
 /// Unchecked extrinsic type as expected by this runtime.
 pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
@@ -1087,6 +1074,7 @@
 		}
 	}
 
+	/*
 	impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>
 		for Runtime
 	{
@@ -1125,6 +1113,7 @@
 			Contracts::rent_projection(address)
 		}
 	}
+	*/
 
 	#[cfg(feature = "runtime-benchmarks")]
 	impl frame_benchmarking::Benchmark<Block> for Runtime {
@@ -1177,7 +1166,7 @@
 			.create_inherent_data()
 			.expect("Could not create the timestamp inherent data");
 
-		inherent_data.check_extrinsics(&block)
+		inherent_data.check_extrinsics(block)
 	}
 }