Skip to content

Commit

Permalink
Update Substrate/Polkadot/Cumulus dependencies + weights v2 (parityte…
Browse files Browse the repository at this point in the history
…ch#1850)

* cargo update

* weights v2

* clippy

* no spellcheck for weights.rs

* fix proof_size component in MAXIMUM_BLOCK_WEIGHT  constants

* "fix" proof_size in select_delivery_transaction_limits_works

* spellcheck
  • Loading branch information
svyatonik authored and serban300 committed Apr 8, 2024
1 parent a051f77 commit 31fb04e
Show file tree
Hide file tree
Showing 19 changed files with 807 additions and 133 deletions.
2 changes: 1 addition & 1 deletion bridges/bin/millau/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ fn testnet_genesis(
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 50)).collect(),
},
aura: AuraConfig { authorities: Vec::new() },
beefy: BeefyConfig { authorities: Vec::new() },
beefy: BeefyConfig { authorities: Vec::new(), genesis_block: Some(0) },
grandpa: GrandpaConfig { authorities: Vec::new() },
sudo: SudoConfig { key: Some(root_key) },
session: SessionConfig {
Expand Down
1 change: 1 addition & 0 deletions bridges/bin/millau/node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub struct Cli {

/// Possible subcommands of the main binary.
#[derive(Debug, Parser)]
#[allow(clippy::large_enum_variant)]
pub enum Subcommand {
/// Key management CLI utilities
#[clap(subcommand)]
Expand Down
2 changes: 1 addition & 1 deletion bridges/bin/millau/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ pub fn new_partial(

let (grandpa_block_import, grandpa_link) = sc_finality_grandpa::block_import(
client.clone(),
&(client.clone() as Arc<_>),
&client,
select_chain.clone(),
telemetry.as_ref().map(|x| x.handle()),
)?;
Expand Down
15 changes: 14 additions & 1 deletion bridges/bin/millau/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ pub use frame_support::{
construct_runtime,
dispatch::DispatchClass,
parameter_types,
traits::{ConstU32, ConstU8, Currency, ExistenceRequirement, Imbalance, KeyOwnerProofSystem},
traits::{
ConstU32, ConstU64, ConstU8, Currency, ExistenceRequirement, Imbalance, KeyOwnerProofSystem,
},
weights::{
constants::WEIGHT_REF_TIME_PER_SECOND, ConstantMultiplier, IdentityFee, RuntimeDbWeight,
Weight,
Expand Down Expand Up @@ -240,6 +242,7 @@ impl pallet_grandpa::Config for Runtime {
// TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78)
type WeightInfo = ();
type MaxAuthorities = ConstU32<10>;
type MaxSetIdSessionEntries = ConstU64<0>;
}

/// MMR helper types.
Expand Down Expand Up @@ -752,6 +755,12 @@ impl_runtime_apis! {
fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {
TransactionPayment::query_fee_details(uxt, len)
}
fn query_weight_to_fee(weight: Weight) -> Balance {
TransactionPayment::weight_to_fee(weight)
}
fn query_length_to_fee(length: u32) -> Balance {
TransactionPayment::length_to_fee(length)
}
}

impl sp_session::SessionKeys<Block> for Runtime {
Expand All @@ -767,6 +776,10 @@ impl_runtime_apis! {
}

impl sp_beefy::BeefyApi<Block> for Runtime {
fn beefy_genesis() -> Option<BlockNumber> {
Beefy::genesis_block()
}

fn validator_set() -> Option<ValidatorSet<BeefyId>> {
Beefy::validator_set()
}
Expand Down
6 changes: 6 additions & 0 deletions bridges/bin/rialto-parachain/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,12 @@ impl_runtime_apis! {
) -> pallet_transaction_payment::FeeDetails<Balance> {
TransactionPayment::query_fee_details(uxt, len)
}
fn query_weight_to_fee(weight: Weight) -> Balance {
TransactionPayment::weight_to_fee(weight)
}
fn query_length_to_fee(length: u32) -> Balance {
TransactionPayment::length_to_fee(length)
}
}

impl bp_millau::MillauFinalityApi<Block> for Runtime {
Expand Down
2 changes: 1 addition & 1 deletion bridges/bin/rialto/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ fn testnet_genesis(
authorities: Vec::new(),
epoch_config: Some(rialto_runtime::BABE_GENESIS_EPOCH_CONFIG),
},
beefy: BeefyConfig { authorities: Vec::new() },
beefy: BeefyConfig { authorities: Vec::new(), genesis_block: Some(0) },
grandpa: GrandpaConfig { authorities: Vec::new() },
sudo: SudoConfig { key: Some(root_key) },
session: SessionConfig {
Expand Down
1 change: 1 addition & 0 deletions bridges/bin/rialto/node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub struct Cli {

/// Possible subcommands of the main binary.
#[derive(Debug, Parser)]
#[allow(clippy::large_enum_variant)]
pub enum Subcommand {
/// Key management CLI utilities
#[clap(subcommand)]
Expand Down
15 changes: 14 additions & 1 deletion bridges/bin/rialto/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ pub use frame_support::{
construct_runtime,
dispatch::DispatchClass,
parameter_types,
traits::{ConstU32, ConstU8, Currency, ExistenceRequirement, Imbalance, KeyOwnerProofSystem},
traits::{
ConstU32, ConstU64, ConstU8, Currency, ExistenceRequirement, Imbalance, KeyOwnerProofSystem,
},
weights::{constants::WEIGHT_REF_TIME_PER_SECOND, IdentityFee, RuntimeDbWeight, Weight},
StorageValue,
};
Expand Down Expand Up @@ -263,6 +265,7 @@ impl pallet_grandpa::Config for Runtime {
type HandleEquivocation = ();
// TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78)
type WeightInfo = ();
type MaxSetIdSessionEntries = ConstU64<0>;
}

impl pallet_mmr::Config for Runtime {
Expand Down Expand Up @@ -626,6 +629,10 @@ impl_runtime_apis! {
}

impl sp_beefy::BeefyApi<Block> for Runtime {
fn beefy_genesis() -> Option<BlockNumber> {
Beefy::genesis_block()
}

fn validator_set() -> Option<ValidatorSet<BeefyId>> {
Beefy::validator_set()
}
Expand Down Expand Up @@ -864,6 +871,12 @@ impl_runtime_apis! {
fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {
TransactionPayment::query_fee_details(uxt, len)
}
fn query_weight_to_fee(weight: Weight) -> Balance {
TransactionPayment::weight_to_fee(weight)
}
fn query_length_to_fee(length: u32) -> Balance {
TransactionPayment::length_to_fee(length)
}
}

impl sp_session::SessionKeys<Block> for Runtime {
Expand Down
120 changes: 104 additions & 16 deletions bridges/modules/grandpa/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.

//! Autogenerated weights for `pallet_bridge_grandpa`
//! Autogenerated weights for pallet_bridge_grandpa
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-12-21, STEPS: 50, REPEAT: 20
//! LOW RANGE: [], HIGH RANGE: []
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled
//! CHAIN: Some("dev"), DB CACHE: 1024
//! DATE: 2023-02-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `covid`, CPU: `11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024

// Executed Command:
// target/release/millau-bridge-node
Expand Down Expand Up @@ -48,7 +48,7 @@ use frame_support::{
};
use sp_std::marker::PhantomData;

/// Weight functions needed for `pallet_bridge_grandpa`.
/// Weight functions needed for pallet_bridge_grandpa.
pub trait WeightInfo {
fn submit_finality_proof(p: u32, v: u32) -> Weight;
}
Expand All @@ -58,22 +58,110 @@ pub trait WeightInfo {
/// Those weights are test only and must never be used in production.
pub struct BridgeWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
/// Storage: BridgeRialtoGrandpa PalletOperatingMode (r:1 w:0)
///
/// Proof: BridgeRialtoGrandpa PalletOperatingMode (max_values: Some(1), max_size: Some(1),
/// added: 496, mode: MaxEncodedLen)
///
/// Storage: BridgeRialtoGrandpa RequestCount (r:1 w:1)
///
/// Proof: BridgeRialtoGrandpa RequestCount (max_values: Some(1), max_size: Some(4), added: 499,
/// mode: MaxEncodedLen)
///
/// Storage: BridgeRialtoGrandpa BestFinalized (r:1 w:1)
///
/// Proof: BridgeRialtoGrandpa BestFinalized (max_values: Some(1), max_size: Some(36), added:
/// 531, mode: MaxEncodedLen)
///
/// Storage: BridgeRialtoGrandpa CurrentAuthoritySet (r:1 w:0)
///
/// Proof: BridgeRialtoGrandpa CurrentAuthoritySet (max_values: Some(1), max_size: Some(40970),
/// added: 41465, mode: MaxEncodedLen)
///
/// Storage: BridgeRialtoGrandpa ImportedHashesPointer (r:1 w:1)
///
/// Proof: BridgeRialtoGrandpa ImportedHashesPointer (max_values: Some(1), max_size: Some(4),
/// added: 499, mode: MaxEncodedLen)
///
/// Storage: BridgeRialtoGrandpa ImportedHashes (r:1 w:1)
///
/// Proof: BridgeRialtoGrandpa ImportedHashes (max_values: None, max_size: Some(36), added:
/// 2511, mode: MaxEncodedLen)
///
/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:0 w:2)
///
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: None, max_size: Some(68), added:
/// 2543, mode: MaxEncodedLen)
///
/// The range of component `p` is `[51, 102]`.
///
/// The range of component `v` is `[50, 100]`.
fn submit_finality_proof(p: u32, v: u32) -> Weight {
Weight::from_ref_time(192_130_822 as u64)
.saturating_add(Weight::from_ref_time(39_781_096 as u64).saturating_mul(p as u64))
.saturating_add(Weight::from_ref_time(1_365_108 as u64).saturating_mul(v as u64))
.saturating_add(T::DbWeight::get().reads(6 as u64))
.saturating_add(T::DbWeight::get().writes(6 as u64))
// Proof Size summary in bytes:
// Measured: `2524 + p * (40 ±0)`
// Estimated: `46001`
// Minimum execution time: 2_282_140 nanoseconds.
Weight::from_parts(142_496_714, 46001)
// Standard Error: 32_796
.saturating_add(Weight::from_ref_time(40_232_935).saturating_mul(p.into()))
// Standard Error: 33_574
.saturating_add(Weight::from_ref_time(1_185_407).saturating_mul(v.into()))
.saturating_add(T::DbWeight::get().reads(6_u64))
.saturating_add(T::DbWeight::get().writes(6_u64))
}
}

// For backwards compatibility and tests
impl WeightInfo for () {
/// Storage: BridgeRialtoGrandpa PalletOperatingMode (r:1 w:0)
///
/// Proof: BridgeRialtoGrandpa PalletOperatingMode (max_values: Some(1), max_size: Some(1),
/// added: 496, mode: MaxEncodedLen)
///
/// Storage: BridgeRialtoGrandpa RequestCount (r:1 w:1)
///
/// Proof: BridgeRialtoGrandpa RequestCount (max_values: Some(1), max_size: Some(4), added: 499,
/// mode: MaxEncodedLen)
///
/// Storage: BridgeRialtoGrandpa BestFinalized (r:1 w:1)
///
/// Proof: BridgeRialtoGrandpa BestFinalized (max_values: Some(1), max_size: Some(36), added:
/// 531, mode: MaxEncodedLen)
///
/// Storage: BridgeRialtoGrandpa CurrentAuthoritySet (r:1 w:0)
///
/// Proof: BridgeRialtoGrandpa CurrentAuthoritySet (max_values: Some(1), max_size: Some(40970),
/// added: 41465, mode: MaxEncodedLen)
///
/// Storage: BridgeRialtoGrandpa ImportedHashesPointer (r:1 w:1)
///
/// Proof: BridgeRialtoGrandpa ImportedHashesPointer (max_values: Some(1), max_size: Some(4),
/// added: 499, mode: MaxEncodedLen)
///
/// Storage: BridgeRialtoGrandpa ImportedHashes (r:1 w:1)
///
/// Proof: BridgeRialtoGrandpa ImportedHashes (max_values: None, max_size: Some(36), added:
/// 2511, mode: MaxEncodedLen)
///
/// Storage: BridgeRialtoGrandpa ImportedHeaders (r:0 w:2)
///
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: None, max_size: Some(68), added:
/// 2543, mode: MaxEncodedLen)
///
/// The range of component `p` is `[51, 102]`.
///
/// The range of component `v` is `[50, 100]`.
fn submit_finality_proof(p: u32, v: u32) -> Weight {
Weight::from_ref_time(192_130_822 as u64)
.saturating_add(Weight::from_ref_time(39_781_096 as u64).saturating_mul(p as u64))
.saturating_add(Weight::from_ref_time(1_365_108 as u64).saturating_mul(v as u64))
.saturating_add(RocksDbWeight::get().reads(6 as u64))
.saturating_add(RocksDbWeight::get().writes(6 as u64))
// Proof Size summary in bytes:
// Measured: `2524 + p * (40 ±0)`
// Estimated: `46001`
// Minimum execution time: 2_282_140 nanoseconds.
Weight::from_parts(142_496_714, 46001)
// Standard Error: 32_796
.saturating_add(Weight::from_ref_time(40_232_935).saturating_mul(p.into()))
// Standard Error: 33_574
.saturating_add(Weight::from_ref_time(1_185_407).saturating_mul(v.into()))
.saturating_add(RocksDbWeight::get().reads(6_u64))
.saturating_add(RocksDbWeight::get().writes(6_u64))
}
}
Loading

0 comments on commit 31fb04e

Please sign in to comment.