Companion for pallet-mmr: generate historical proofs (#6061)

* BEEFY: generate historical proofs

Signed-off-by: Serban Iorga <serban@parity.io>

* cargo update -p sp-io

* Properly set max proof size for runtimes

* Properly set max proof size for mocks

* cargo fmt

* Set appropriate UMP service total proof size weight

* Disable zombienet-tests-parachains-disputes CI

* Add comment explaining weight math

* Use MAX_POV_SIZE for max proof size

* Cast to u64

* Remove comment

Signed-off-by: Serban Iorga <serban@parity.io>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
Serban Iorga
2022-10-02 12:42:24 +03:00
committed by GitHub
parent f45a8de8ae
commit 5458406927
18 changed files with 256 additions and 197 deletions
+3 -1
View File
@@ -82,7 +82,9 @@ where
parameter_types! {
pub const BlockHashCount: u32 = 250;
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(Weight::from_ref_time(4 * 1024 * 1024));
frame_system::limits::BlockWeights::simple_max(
Weight::from_ref_time(4 * 1024 * 1024).set_proof_size(u64::MAX),
);
}
pub type AccountId = u64;
+4 -1
View File
@@ -524,7 +524,10 @@ impl<T: Config> Pallet<T> {
let max_weight = if weight_used == Weight::zero() {
// we increase the amount of weight that we're allowed to use on the first message to try to prevent
// the possibility of blockage of the queue.
config.ump_service_total_weight * T::FirstMessageFactorPercent::get() / 100
config
.ump_service_total_weight
.saturating_mul(T::FirstMessageFactorPercent::get()) /
100
} else {
config.ump_service_total_weight - weight_used
};
@@ -117,7 +117,7 @@ frame_benchmarking::benchmarks! {
let msg = create_message_overweight::<T>();
// This just makes sure that 0 is not a valid index and we can use it later on.
let _ = Ump::<T>::service_overweight(RawOrigin::Root.into(), 0, Weight::from_ref_time(1000));
let _ = Ump::<T>::service_overweight(RawOrigin::Root.into(), 0, Weight::from_ref_time(1000).set_proof_size(u64::MAX));
// Start with the block number 1. This is needed because should an event be
// emitted during the genesis block they will be implicitly wiped.
frame_system::Pallet::<T>::set_block_number(1u32.into());
+8 -8
View File
@@ -38,8 +38,8 @@ impl Default for GenesisConfigBuilder {
max_upward_message_num_per_candidate: 2,
max_upward_queue_count: 4,
max_upward_queue_size: 64,
ump_service_total_weight: Weight::from_ref_time(1000),
ump_max_individual_weight: Weight::from_ref_time(100),
ump_service_total_weight: Weight::from_ref_time(1000).set_proof_size(1000),
ump_max_individual_weight: Weight::from_ref_time(100).set_proof_size(100),
}
}
}
@@ -156,7 +156,7 @@ fn dispatch_resume_after_exceeding_dispatch_stage_weight() {
new_test_ext(
GenesisConfigBuilder {
ump_service_total_weight: Weight::from_ref_time(500),
ump_service_total_weight: Weight::from_ref_time(500).set_proof_size(500),
..Default::default()
}
.build(),
@@ -203,8 +203,8 @@ fn dispatch_keeps_message_after_weight_exhausted() {
new_test_ext(
GenesisConfigBuilder {
ump_service_total_weight: Weight::from_ref_time(500),
ump_max_individual_weight: Weight::from_ref_time(300),
ump_service_total_weight: Weight::from_ref_time(500).set_proof_size(500),
ump_max_individual_weight: Weight::from_ref_time(300).set_proof_size(300),
..Default::default()
}
.build(),
@@ -243,7 +243,7 @@ fn dispatch_correctly_handle_remove_of_latest() {
new_test_ext(
GenesisConfigBuilder {
ump_service_total_weight: Weight::from_ref_time(900),
ump_service_total_weight: Weight::from_ref_time(900).set_proof_size(900),
..Default::default()
}
.build(),
@@ -312,8 +312,8 @@ fn overweight_queue_works() {
new_test_ext(
GenesisConfigBuilder {
ump_service_total_weight: Weight::from_ref_time(900),
ump_max_individual_weight: Weight::from_ref_time(300),
ump_service_total_weight: Weight::from_ref_time(900).set_proof_size(900),
ump_max_individual_weight: Weight::from_ref_time(300).set_proof_size(300),
..Default::default()
}
.build(),