Companion: Remove contracts RPC (#1685)

* Remove contracts RPC

* update lockfile for {"polkadot", "substrate"}

* Remove unused imports

* Properly set a max proof size for cumulus test runtime

* Properly set a max proof size for common runtimes

* Properly set the max proof size for all runtimes

Co-authored-by: parity-processbot <>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
Alexander Theißen
2022-10-03 14:49:15 +02:00
committed by GitHub
parent 4a0ea59c85
commit f00417b906
13 changed files with 295 additions and 291 deletions
+276 -274
View File
File diff suppressed because it is too large Load Diff
@@ -217,7 +217,8 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5);
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// We allow for 0.5 of a second of compute with a 12 second average block time. /// We allow for 0.5 of a second of compute with a 12 second average block time.
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2); const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2)
.set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64);
/// The version information used to identify this runtime when compiled natively. /// The version information used to identify this runtime when compiled natively.
#[cfg(feature = "std")] #[cfg(feature = "std")]
+2 -1
View File
@@ -92,7 +92,8 @@ mod constants {
pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// We allow for 0.5 seconds of compute with a 6 second average block time. /// We allow for 0.5 seconds of compute with a 6 second average block time.
pub const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2); pub const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2)
.set_proof_size(polkadot_primitives::v2::MAX_POV_SIZE as u64);
} }
/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
@@ -49,7 +49,7 @@ pallet-utility = { git = "https://github.com/paritytech/substrate", default-feat
pallet-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-contracts = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-contracts = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-contracts-primitives = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-contracts-primitives = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-contracts-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-contracts-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
# Polkadot # Polkadot
kusama-runtime-constants = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } kusama-runtime-constants = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
@@ -93,7 +93,7 @@ std = [
"pallet-balances/std", "pallet-balances/std",
"pallet-collator-selection/std", "pallet-collator-selection/std",
"pallet-contracts-primitives/std", "pallet-contracts-primitives/std",
"pallet-contracts-rpc-runtime-api/std", "pallet-contracts-runtime-api/std",
"pallet-contracts/std", "pallet-contracts/std",
"pallet-multisig/std", "pallet-multisig/std",
"pallet-randomness-collective-flip/std", "pallet-randomness-collective-flip/std",
@@ -505,7 +505,7 @@ impl_runtime_apis! {
} }
} }
impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash> impl pallet_contracts_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>
for Runtime for Runtime
{ {
fn call( fn call(
@@ -85,7 +85,8 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
/// by Operational extrinsics. /// by Operational extrinsics.
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// We allow for .5 seconds of compute with a 12 second average block time. /// We allow for .5 seconds of compute with a 12 second average block time.
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2); const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2)
.set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64);
parameter_types! { parameter_types! {
pub const BlockHashCount: BlockNumber = 250; pub const BlockHashCount: BlockNumber = 250;
@@ -92,7 +92,8 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
/// by Operational extrinsics. /// by Operational extrinsics.
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// We allow for .5 seconds of compute with a 12 second average block time. /// We allow for .5 seconds of compute with a 12 second average block time.
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2); const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2)
.set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64);
parameter_types! { parameter_types! {
pub const BlockHashCount: BlockNumber = 250; pub const BlockHashCount: BlockNumber = 250;
@@ -230,7 +230,8 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5);
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// We allow for 0.5 of a second of compute with a 12 second average block time. /// We allow for 0.5 of a second of compute with a 12 second average block time.
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2); const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2)
.set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64);
/// The version information used to identify this runtime when compiled natively. /// The version information used to identify this runtime when compiled natively.
#[cfg(feature = "std")] #[cfg(feature = "std")]
@@ -134,7 +134,8 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
/// by Operational extrinsics. /// by Operational extrinsics.
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// We allow for .5 seconds of compute with a 12 second average block time. /// We allow for .5 seconds of compute with a 12 second average block time.
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2); const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2)
.set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64);
parameter_types! { parameter_types! {
pub const BlockHashCount: BlockNumber = 250; pub const BlockHashCount: BlockNumber = 250;
-1
View File
@@ -64,7 +64,6 @@ try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "m
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
frame-rpc-system = { package = "substrate-frame-rpc-system", git = "https://github.com/paritytech/substrate", branch = "master" } frame-rpc-system = { package = "substrate-frame-rpc-system", git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" } pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-contracts-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
# Polkadot # Polkadot
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master" }
+1 -4
View File
@@ -20,7 +20,7 @@
use std::sync::Arc; use std::sync::Arc;
use parachains_common::{AccountId, Balance, Block, BlockNumber, Hash, Index as Nonce}; use parachains_common::{AccountId, Balance, Block, Index as Nonce};
use sc_client_api::AuxStore; use sc_client_api::AuxStore;
pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor}; pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor};
use sc_transaction_pool_api::TransactionPool; use sc_transaction_pool_api::TransactionPool;
@@ -85,12 +85,10 @@ where
+ 'static, + 'static,
C::Api: frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>, C::Api: frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>, C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
C::Api: pallet_contracts_rpc::ContractsRuntimeApi<Block, AccountId, Balance, BlockNumber, Hash>,
C::Api: BlockBuilder<Block>, C::Api: BlockBuilder<Block>,
P: TransactionPool + Sync + Send + 'static, P: TransactionPool + Sync + Send + 'static,
{ {
use frame_rpc_system::{System, SystemApiServer}; use frame_rpc_system::{System, SystemApiServer};
use pallet_contracts_rpc::{Contracts, ContractsApiServer};
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
use sc_rpc::dev::{Dev, DevApiServer}; use sc_rpc::dev::{Dev, DevApiServer};
@@ -99,7 +97,6 @@ where
module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?; module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
module.merge(TransactionPayment::new(client.clone()).into_rpc())?; module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
module.merge(Contracts::new(client.clone()).into_rpc())?;
module.merge(Dev::new(client, deny_unsafe).into_rpc())?; module.merge(Dev::new(client, deny_unsafe).into_rpc())?;
Ok(module) Ok(module)
+1 -2
View File
@@ -1325,8 +1325,7 @@ where
+ sp_block_builder::BlockBuilder<Block> + sp_block_builder::BlockBuilder<Block>
+ cumulus_primitives_core::CollectCollationInfo<Block> + cumulus_primitives_core::CollectCollationInfo<Block>
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance> + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>
+ frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce> + frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
+ pallet_contracts_rpc::ContractsRuntimeApi<Block, AccountId, Balance, BlockNumber, Hash>,
sc_client_api::StateBackendFor<TFullBackend<Block>, Block>: sp_api::StateBackend<BlakeTwo256>, sc_client_api::StateBackendFor<TFullBackend<Block>, Block>: sp_api::StateBackend<BlakeTwo256>,
RB: Fn( RB: Fn(
Arc<TFullClient<Block, RuntimeApi, WasmExecutor<HostFunctions>>>, Arc<TFullClient<Block, RuntimeApi, WasmExecutor<HostFunctions>>>,
+2 -1
View File
@@ -140,7 +140,8 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
/// by Operational extrinsics. /// by Operational extrinsics.
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// We allow for .5 seconds of compute with a 12 second average block time. /// We allow for .5 seconds of compute with a 12 second average block time.
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2); const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2)
.set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64);
parameter_types! { parameter_types! {
pub const BlockHashCount: BlockNumber = 250; pub const BlockHashCount: BlockNumber = 250;