Skip to content

fix: Address association tests and runtime benchmarks should use the same genesis utxo #873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions toolkit/address-associations/pallet/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ mod benchmarks {
let stake_public_key = StakePublicKey(hex!(
"2bebcb7fbc74a6e0fd6e00a311698b047b7b659f0e047ff5349dbd984aefc52c"
));
// Alice
// Alice (hex: d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d)
let pc_address = T::PartnerChainAddress::from_ss58check(
"5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
)
.unwrap();
let signature = StakeKeySignature(hex!(
"1aa8c1b363a207ddadf0c6242a0632f5a557690a327d0245f9d473b983b3d8e1c95a3dd804cab41123c36ddbcb7137b8261c35d5c8ef04ce9d0f8d5c4b3ca607"
"36aabd5267699b01c01fb6892f9888ab82a0b853a21dcd863b8241c3049d85163ddf350cbbc8ba724abe7b22d5ae03a7b1429f4cc37fb11afcce041fac1cdd05"
));

// Create an account and fund it with sufficient balance
Expand Down
4 changes: 2 additions & 2 deletions toolkit/address-associations/pallet/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ pub(crate) fn pc_address() -> AccountId32 {
}

pub(crate) const VALID_SIGNATURE: [u8; 64] = hex!(
"1aa8c1b363a207ddadf0c6242a0632f5a557690a327d0245f9d473b983b3d8e1c95a3dd804cab41123c36ddbcb7137b8261c35d5c8ef04ce9d0f8d5c4b3ca607"
"36aabd5267699b01c01fb6892f9888ab82a0b853a21dcd863b8241c3049d85163ddf350cbbc8ba724abe7b22d5ae03a7b1429f4cc37fb11afcce041fac1cdd05"
);

impl crate::pallet::Config for Test {
type WeightInfo = ();
type PartnerChainAddress = PartnerChainAddress;
fn genesis_utxo() -> UtxoId {
UtxoId::new(hex!("59104061ffa0d66f9ba0135d6fc6a884a395b10f8ae9cb276fc2c3bfdfedc260"), 1)
UtxoId::new(hex!("0000000000000000000000000000000000000000000000000000000000000000"), 0)
}
type Currency = Balances;
type BurnAmount = AssociationFeeBurn;
Expand Down
40 changes: 22 additions & 18 deletions toolkit/address-associations/pallet/src/weights.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

//! Autogenerated weights for pallet_address_associations
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 46.0.0
//! DATE: 2025-02-11, STEPS: `500`, REPEAT: `200`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 47.0.0
//! DATE: 2025-06-24, STEPS: `500`, REPEAT: `200`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `Nikolaoss-MacBook-Pro.local`, CPU: `<UNKNOWN>`
//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
Expand All @@ -13,7 +13,7 @@
// benchmark
// pallet
// --runtime
// target/release/wbuild/sidechain-runtime/sidechain_runtime.compact.compressed.wasm
// target/release/wbuild/partner-chains-demo-runtime/partner_chains_demo_runtime.compact.compressed.wasm
// --pallet
// pallet_address_associations
// --extrinsic
Expand All @@ -22,7 +22,7 @@
// --repeat=200
// --wasm-execution=compiled
// --output
// toolkit/pallets/address-associations/src/weights.rs
// toolkit/address-associations/pallet/src/weights.rs
// --template
// .maintain/frame-weight-template.hbs

Expand All @@ -45,15 +45,17 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// Storage: `Sidechain::GenesisUtxo` (r:1 w:0)
/// Proof: `Sidechain::GenesisUtxo` (`max_values`: Some(1), `max_size`: Some(34), added: 529, mode: `MaxEncodedLen`)
/// Storage: `AddressAssociations::AddressAssociations` (r:1 w:1)
/// Proof: `AddressAssociations::AddressAssociations` (`max_values`: None, `max_size`: Some(170), added: 2645, mode: `MaxEncodedLen`)
/// Proof: `AddressAssociations::AddressAssociations` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn associate_address() -> Weight {
// Proof Size summary in bytes:
// Measured: `96`
// Estimated: `3635`
// Minimum execution time: 45_000_000 picoseconds.
Weight::from_parts(47_000_000, 3635)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
// Measured: `197`
// Estimated: `3593`
// Minimum execution time: 84_000_000 picoseconds.
Weight::from_parts(85_000_000, 3593)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
}

Expand All @@ -62,14 +64,16 @@ impl WeightInfo for () {
/// Storage: `Sidechain::GenesisUtxo` (r:1 w:0)
/// Proof: `Sidechain::GenesisUtxo` (`max_values`: Some(1), `max_size`: Some(34), added: 529, mode: `MaxEncodedLen`)
/// Storage: `AddressAssociations::AddressAssociations` (r:1 w:1)
/// Proof: `AddressAssociations::AddressAssociations` (`max_values`: None, `max_size`: Some(170), added: 2645, mode: `MaxEncodedLen`)
/// Proof: `AddressAssociations::AddressAssociations` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn associate_address() -> Weight {
// Proof Size summary in bytes:
// Measured: `96`
// Estimated: `3635`
// Minimum execution time: 45_000_000 picoseconds.
Weight::from_parts(47_000_000, 3635)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
// Measured: `197`
// Estimated: `3593`
// Minimum execution time: 84_000_000 picoseconds.
Weight::from_parts(85_000_000, 3593)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
}
Loading