Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 7c8a9ff

Browse files
atheiKiChjang
andauthored
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 <[email protected]>
1 parent 8f67d0d commit 7c8a9ff

File tree

13 files changed

+295
-291
lines changed

13 files changed

+295
-291
lines changed

Cargo.lock

Lines changed: 276 additions & 274 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parachain-template/runtime/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5);
217217
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
218218

219219
/// We allow for 0.5 of a second of compute with a 12 second average block time.
220-
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2);
220+
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2)
221+
.set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64);
221222

222223
/// The version information used to identify this runtime when compiled natively.
223224
#[cfg(feature = "std")]

parachains/common/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ mod constants {
9292
pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
9393

9494
/// We allow for 0.5 seconds of compute with a 6 second average block time.
95-
pub const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2);
95+
pub const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2)
96+
.set_proof_size(polkadot_primitives::v2::MAX_POV_SIZE as u64);
9697
}
9798

9899
/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know

parachains/runtimes/contracts/contracts-rococo/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pallet-utility = { git = "https://github.com/paritytech/substrate", default-feat
4949
pallet-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
5050
pallet-contracts = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
5151
pallet-contracts-primitives = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
52-
pallet-contracts-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
52+
pallet-contracts-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
5353

5454
# Polkadot
5555
kusama-runtime-constants = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
@@ -93,7 +93,7 @@ std = [
9393
"pallet-balances/std",
9494
"pallet-collator-selection/std",
9595
"pallet-contracts-primitives/std",
96-
"pallet-contracts-rpc-runtime-api/std",
96+
"pallet-contracts-runtime-api/std",
9797
"pallet-contracts/std",
9898
"pallet-multisig/std",
9999
"pallet-randomness-collective-flip/std",

parachains/runtimes/contracts/contracts-rococo/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ impl_runtime_apis! {
505505
}
506506
}
507507

508-
impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>
508+
impl pallet_contracts_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>
509509
for Runtime
510510
{
511511
fn call(

parachains/runtimes/starters/seedling/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
8585
/// by Operational extrinsics.
8686
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
8787
/// We allow for .5 seconds of compute with a 12 second average block time.
88-
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2);
88+
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2)
89+
.set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64);
8990

9091
parameter_types! {
9192
pub const BlockHashCount: BlockNumber = 250;

parachains/runtimes/starters/shell/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
9292
/// by Operational extrinsics.
9393
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
9494
/// We allow for .5 seconds of compute with a 12 second average block time.
95-
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2);
95+
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2)
96+
.set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64);
9697

9798
parameter_types! {
9899
pub const BlockHashCount: BlockNumber = 250;

parachains/runtimes/testing/penpal/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5);
230230
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
231231

232232
/// We allow for 0.5 of a second of compute with a 12 second average block time.
233-
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2);
233+
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2)
234+
.set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64);
234235

235236
/// The version information used to identify this runtime when compiled natively.
236237
#[cfg(feature = "std")]

parachains/runtimes/testing/rococo-parachain/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
134134
/// by Operational extrinsics.
135135
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
136136
/// We allow for .5 seconds of compute with a 12 second average block time.
137-
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2);
137+
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2)
138+
.set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64);
138139

139140
parameter_types! {
140141
pub const BlockHashCount: BlockNumber = 250;

polkadot-parachain/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "m
6464
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
6565
frame-rpc-system = { package = "substrate-frame-rpc-system", git = "https://github.com/paritytech/substrate", branch = "master" }
6666
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
67-
pallet-contracts-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
6867

6968
# Polkadot
7069
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master" }

polkadot-parachain/src/rpc.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
use std::sync::Arc;
2222

23-
use parachains_common::{AccountId, Balance, Block, BlockNumber, Hash, Index as Nonce};
23+
use parachains_common::{AccountId, Balance, Block, Index as Nonce};
2424
use sc_client_api::AuxStore;
2525
pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor};
2626
use sc_transaction_pool_api::TransactionPool;
@@ -85,12 +85,10 @@ where
8585
+ 'static,
8686
C::Api: frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
8787
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
88-
C::Api: pallet_contracts_rpc::ContractsRuntimeApi<Block, AccountId, Balance, BlockNumber, Hash>,
8988
C::Api: BlockBuilder<Block>,
9089
P: TransactionPool + Sync + Send + 'static,
9190
{
9291
use frame_rpc_system::{System, SystemApiServer};
93-
use pallet_contracts_rpc::{Contracts, ContractsApiServer};
9492
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
9593
use sc_rpc::dev::{Dev, DevApiServer};
9694

@@ -99,7 +97,6 @@ where
9997

10098
module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
10199
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
102-
module.merge(Contracts::new(client.clone()).into_rpc())?;
103100
module.merge(Dev::new(client, deny_unsafe).into_rpc())?;
104101

105102
Ok(module)

polkadot-parachain/src/service.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,8 +1325,7 @@ where
13251325
+ sp_block_builder::BlockBuilder<Block>
13261326
+ cumulus_primitives_core::CollectCollationInfo<Block>
13271327
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>
1328-
+ frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>
1329-
+ pallet_contracts_rpc::ContractsRuntimeApi<Block, AccountId, Balance, BlockNumber, Hash>,
1328+
+ frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
13301329
sc_client_api::StateBackendFor<TFullBackend<Block>, Block>: sp_api::StateBackend<BlakeTwo256>,
13311330
RB: Fn(
13321331
Arc<TFullClient<Block, RuntimeApi, WasmExecutor<HostFunctions>>>,

test/runtime/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
140140
/// by Operational extrinsics.
141141
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
142142
/// We allow for .5 seconds of compute with a 12 second average block time.
143-
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2);
143+
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_div(2)
144+
.set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64);
144145

145146
parameter_types! {
146147
pub const BlockHashCount: BlockNumber = 250;

0 commit comments

Comments
 (0)