mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-24 18:21:08 +00:00
Benchmark Ethereum Pallet (#149)
* Add skeleton for worst case import_unsigned_header * Fix a typo * Add benchmark test for best case unsigned header import * Add finality verification to worst case bench * Move `insert_header()` from mock to test_utils Allows the benchmarking code to use this without having to pull it in from the mock. * Add a rough bench to test a finalizing a "long" chain * Try to use complexity parameter for finality bench * Improve long finality bench * Remove stray dot file * Remove old "worst" case bench * Scribble some ideas down for pruning bench * Prune headers during benchmarking * Clean up some comments * Make finality bench work for entire range of complexity parameter * Place initialization code into a function * Add bench for block finalization with caching * First attempt at bench with receipts * Try and trigger validator set change * Perform a validator set change during benchmarking * Move `validators_change_receipt()` to shared location Allows unit tests and benchmarks to access the same helper function and const * Extract a test receipt root into a constant * Clean up description of pruning bench * Fix cache and pruning tests * Remove unecessary `build_custom_header` usage * Get rid of warnings * Remove code duplication comment I don't think its entirely worth it to split out so few lines of code. The benches aren't particularly hard to read anyways. * Increase the range of the complexity parameter * Use dynamic number of receipts while benchmarking As part of this change we have removed the hardcoded TEST_RECEIPT_ROOT and instead chose to calculate the receipt root on the fly. This will make tests and benches less fragile. * Prune a dynamic number of headers
This commit is contained in:
committed by
Bastian Köcher
parent
1cd7be9214
commit
002e18a47c
@@ -463,7 +463,7 @@ decl_storage! {
|
||||
// the initial blocks should be selected so that:
|
||||
// 1) it doesn't signal validators changes;
|
||||
// 2) there are no scheduled validators changes from previous blocks;
|
||||
// 3) (implied) all direct children of initial block are authred by the same validators set.
|
||||
// 3) (implied) all direct children of initial block are authored by the same validators set.
|
||||
|
||||
assert!(
|
||||
!config.initial_validators.is_empty(),
|
||||
@@ -563,6 +563,7 @@ impl<T: Trait> BridgeStorage<T> {
|
||||
// start pruning blocks
|
||||
let begin = new_pruning_range.oldest_unpruned_block;
|
||||
let end = new_pruning_range.oldest_block_to_keep;
|
||||
frame_support::debug::trace!(target: "runtime", "Pruning blocks in range [{}..{})", begin, end);
|
||||
for number in begin..end {
|
||||
// if we can't prune anything => break
|
||||
if max_blocks_to_prune == 0 {
|
||||
@@ -588,6 +589,11 @@ impl<T: Trait> BridgeStorage<T> {
|
||||
|
||||
// we have pruned all headers at number
|
||||
new_pruning_range.oldest_unpruned_block = number + 1;
|
||||
frame_support::debug::trace!(
|
||||
target: "runtime",
|
||||
"Oldest unpruned PoA header is now: {}",
|
||||
new_pruning_range.oldest_unpruned_block,
|
||||
);
|
||||
}
|
||||
|
||||
// update pruning range in storage
|
||||
|
||||
Reference in New Issue
Block a user