Skip to content
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
57 changes: 29 additions & 28 deletions runtime/moonbase/src/weights/db/rocksdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,40 @@
// You should have received a copy of the GNU General Public License
// along with Moonbeam. If not, see <http://www.gnu.org/licenses/>.

//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-04-27 (Y/M/D)
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 48.0.0
//! DATE: 2025-09-22 (Y/M/D)
//! HOSTNAME: `ip-10-0-0-176`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//!
//! DATABASE: `RocksDb`, RUNTIME: `Moonbeam`
//! BLOCK-NUM: `BlockId::Number(5962022)`
//! BLOCK-NUM: `BlockId::Number(12630729)`
//! SKIP-WRITE: `false`, SKIP-READ: `false`, WARMUPS: `1`
//! STATE-VERSION: `V0`, STATE-CACHE-SIZE: ``
//! WEIGHT-PATH: `/home/ubuntu/projects/moonbeam/weights-rocksdb-moonbeam.rs`
//! STATE-VERSION: `V1`, STATE-CACHE-SIZE: ``
//! WEIGHT-PATH: `./benchmarks/storage/20250922-082315/disk-weights-rocksdb-moonbeam.rs`
//! METRIC: `Average`, WEIGHT-MUL: `1.1`, WEIGHT-ADD: `0`

// Executed Command:
// /home/ubuntu/projects/moonbeam/target/release/moonbeam
// ./moonbeam
// benchmark
// storage
// --db=rocksdb
// --state-version=0
// --state-version=1
// --mul=1.1
// --weight-path
// /home/ubuntu/projects/moonbeam/weights-rocksdb-moonbeam.rs
// ./benchmarks/storage/20250922-082315/disk-weights-rocksdb-moonbeam.rs
// --chain
// moonbeam
// --base-path
// /var/lib/rocksdb-moonbeam-data
// /mnt/disk3-6000-256/rocksdb-moonbeam-data
// --keys-limit
// 10000000
// 50000000
// --random-seed
// 1024

/// Storage DB weights for the `Moonbeam` runtime and `RocksDb`.
pub mod constants {
use frame_support::weights::{constants, RuntimeDbWeight};
use frame_support::weights::constants;
use sp_core::parameter_types;
use sp_weights::RuntimeDbWeight;

parameter_types! {
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
Expand All @@ -56,38 +57,38 @@ pub mod constants {
// Calculated by multiplying the *Average* of all values with `1.1` and adding `0`.
//
// Stats nanoseconds:
// Min, Max: 2_300, 2_841_169
// Average: 37_947
// Median: 38_669
// Std-Dev: 7331.86
// Min, Max: 1_774, 4_131_758
// Average: 53_833
// Median: 47_991
// Std-Dev: 44586.1
//
// Percentiles nanoseconds:
// 99th: 55_974
// 95th: 49_824
// 75th: 42_570
read: 41_742 * constants::WEIGHT_REF_TIME_PER_NANOS,
// 99th: 236_090
// 95th: 67_897
// 75th: 54_501
read: 59_217 * constants::WEIGHT_REF_TIME_PER_NANOS,

// Time to write one storage item.
// Calculated by multiplying the *Average* of all values with `1.1` and adding `0`.
//
// Stats nanoseconds:
// Min, Max: 18_981, 16_772_373
// Average: 73_893
// Median: 72_807
// Std-Dev: 24543.58
// Min, Max: 10_807, 13_782_646
// Average: 87_559
// Median: 73_293
// Std-Dev: 191482.81
//
// Percentiles nanoseconds:
// 99th: 97_152
// 95th: 85_751
// 75th: 77_392
write: 81_283 * constants::WEIGHT_REF_TIME_PER_NANOS,
// 99th: 212_681
// 95th: 111_877
// 75th: 82_079
write: 96_315 * constants::WEIGHT_REF_TIME_PER_NANOS,
};
}

#[cfg(test)]
mod test_db_weights {
use super::constants::RocksDbWeight as W;
use frame_support::weights::constants;
use sp_weights::constants;

/// Checks that all weights exist and have sane values.
// NOTE: If this test fails but you are sure that the generated values are fine,
Expand Down
79 changes: 59 additions & 20 deletions runtime/moonbase/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ use moonbase_runtime::{
EvmForeignAssets, Executive, OpenTechCommitteeCollective, ParachainStaking, PolkadotXcm,
Precompiles, Runtime, RuntimeBlockWeights, RuntimeCall, RuntimeEvent, System,
TransactionPayment, TransactionPaymentAsGasPrice, Treasury, TreasuryCouncilCollective,
XcmTransactor, FOREIGN_ASSET_PRECOMPILE_ADDRESS_PREFIX, WEEKS,
XcmTransactor, FOREIGN_ASSET_PRECOMPILE_ADDRESS_PREFIX, WEEKS, WEIGHT_PER_GAS,
};
use polkadot_parachain::primitives::Sibling;
use precompile_utils::testing::MockHandle;
Expand Down Expand Up @@ -1078,7 +1078,12 @@ fn is_contributor_via_precompile() {
contributor: Address(BOB.into()),
},
)
.expect_cost(3338)
.expect_cost(
<Runtime as frame_system::Config>::DbWeight::get()
.read
.saturating_div(WEIGHT_PER_GAS)
.saturating_mul(2),
)
.expect_no_logs()
.execute_returns(false);

Expand All @@ -1091,7 +1096,12 @@ fn is_contributor_via_precompile() {
contributor: Address(CHARLIE.into()),
},
)
.expect_cost(3338)
.expect_cost(
<Runtime as frame_system::Config>::DbWeight::get()
.read
.saturating_div(WEIGHT_PER_GAS)
.saturating_mul(2),
)
.expect_no_logs()
.execute_returns(true);
})
Expand Down Expand Up @@ -1162,7 +1172,12 @@ fn reward_info_via_precompile() {
contributor: Address(AccountId::from(CHARLIE).into()),
},
)
.expect_cost(3338)
.expect_cost(
<Runtime as frame_system::Config>::DbWeight::get()
.read
.saturating_div(WEIGHT_PER_GAS)
.saturating_mul(2),
)
.expect_no_logs()
.execute_returns((expected_total, expected_claimed));
})
Expand Down Expand Up @@ -1609,7 +1624,7 @@ fn xtokens_precompiles_transfer() {
weight: 4_000_000,
},
)
.expect_cost(238472)
.expect_cost(262854)
.expect_no_logs()
// We expect an evm subcall ERC20.burnFrom
.with_subcall_handle(move |subcall| {
Expand Down Expand Up @@ -1700,7 +1715,7 @@ fn xtokens_precompiles_transfer_multiasset() {
weight: 4_000_000,
},
)
.expect_cost(238472)
.expect_cost(262854)
.expect_no_logs()
// We expect an evm subcall ERC20.burnFrom
.with_subcall_handle(move |subcall| {
Expand Down Expand Up @@ -1784,7 +1799,7 @@ fn xtokens_precompiles_transfer_native() {
weight: 4_000_000,
},
)
.expect_cost(86872)
.expect_cost(111254)
.expect_no_logs()
.execute_returns(());
})
Expand Down Expand Up @@ -1908,7 +1923,7 @@ fn initial_gas_fee_is_correct() {
TransactionPaymentAsGasPrice::min_gas_price(),
(
2_500_000_000u128.into(),
Weight::from_parts(41_742_000u64, 0)
Weight::from_parts(<Runtime as frame_system::Config>::DbWeight::get().read, 0)
)
);
});
Expand Down Expand Up @@ -2360,7 +2375,7 @@ fn transact_through_signed_precompile_works_v1() {
call: bytes.into(),
},
)
.expect_cost(23418)
.expect_cost(30911)
.expect_no_logs()
.execute_returns(());
});
Expand Down Expand Up @@ -2400,7 +2415,7 @@ fn transact_through_signed_precompile_works_v2() {
overall_weight: total_weight,
},
)
.expect_cost(23418)
.expect_cost(30911)
.expect_no_logs()
.execute_returns(());
});
Expand Down Expand Up @@ -2482,7 +2497,7 @@ fn author_mapping_precompile_associate_update_and_clear() {
nimbus_id: [1u8; 32].into(),
},
)
.expect_cost(16017)
.expect_cost(19918)
.expect_no_logs()
.execute_returns(());

Expand All @@ -2504,7 +2519,7 @@ fn author_mapping_precompile_associate_update_and_clear() {
new_nimbus_id: [2u8; 32].into(),
},
)
.expect_cost(15532)
.expect_cost(19433)
.expect_no_logs()
.execute_returns(());

Expand All @@ -2525,7 +2540,7 @@ fn author_mapping_precompile_associate_update_and_clear() {
nimbus_id: [2u8; 32].into(),
},
)
.expect_cost(16037)
.expect_cost(19938)
.expect_no_logs()
.execute_returns(());

Expand Down Expand Up @@ -2568,7 +2583,7 @@ fn author_mapping_register_and_set_keys() {
.into(),
},
)
.expect_cost(17820)
.expect_cost(22420)
.expect_no_logs()
.execute_returns(());

Expand All @@ -2593,7 +2608,7 @@ fn author_mapping_register_and_set_keys() {
.into(),
},
)
.expect_cost(17820)
.expect_cost(22420)
.expect_no_logs()
.execute_returns(());

Expand Down Expand Up @@ -2624,7 +2639,12 @@ fn test_xcm_utils_ml_tp_account() {
location: Location::parent(),
},
)
.expect_cost(3338)
.expect_cost(
<Runtime as frame_system::Config>::DbWeight::get()
.read
.saturating_div(WEIGHT_PER_GAS)
.saturating_mul(2),
)
.expect_no_logs()
.execute_returns(Address(expected_address_parent));

Expand All @@ -2644,7 +2664,12 @@ fn test_xcm_utils_ml_tp_account() {
location: parachain_2000_multilocation,
},
)
.expect_cost(3338)
.expect_cost(
<Runtime as frame_system::Config>::DbWeight::get()
.read
.saturating_div(WEIGHT_PER_GAS)
.saturating_mul(2),
)
.expect_no_logs()
.execute_returns(Address(expected_address_parachain));

Expand Down Expand Up @@ -2674,7 +2699,12 @@ fn test_xcm_utils_ml_tp_account() {
location: alice_in_parachain_2000_multilocation,
},
)
.expect_cost(3338)
.expect_cost(
<Runtime as frame_system::Config>::DbWeight::get()
.read
.saturating_div(WEIGHT_PER_GAS)
.saturating_mul(2),
)
.expect_no_logs()
.execute_returns(Address(expected_address_alice_in_parachain_2000));
});
Expand Down Expand Up @@ -2732,7 +2762,11 @@ fn test_xcm_utils_weight_message() {

Precompiles::new()
.prepare_test(ALICE, xcm_utils_precompile_address, input)
.expect_cost(1669)
.expect_cost(
<Runtime as frame_system::Config>::DbWeight::get()
.read
.saturating_div(WEIGHT_PER_GAS),
)
.expect_no_logs()
.execute_returns(expected_weight);
});
Expand All @@ -2751,7 +2785,12 @@ fn test_xcm_utils_get_units_per_second() {

Precompiles::new()
.prepare_test(ALICE, xcm_utils_precompile_address, input)
.expect_cost(3338)
.expect_cost(
<Runtime as frame_system::Config>::DbWeight::get()
.read
.saturating_div(WEIGHT_PER_GAS)
.saturating_mul(2),
)
.expect_no_logs()
.execute_returns(expected_units);
});
Expand Down
Loading
Loading