Skip to content
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

Reject update that doesnt provide new info #844

Merged
merged 5 commits into from
Nov 30, 2024
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
2 changes: 1 addition & 1 deletion pallets/rolldown/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1472,7 +1472,7 @@ impl<T: Config> Pallet<T> {
Error::<T>::WrongRequestId
);

let last_id = lowest_id +
let last_id = lowest_id.saturating_sub(1u128) +
(update.pendingDeposits.len() as u128) +
(update.pendingCancelResolutions.len() as u128);

Expand Down
25 changes: 25 additions & 0 deletions pallets/rolldown/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,31 @@ fn reject_update_with_invalid_too_high_request_id() {
});
}

#[test]
#[serial]
fn reject_update_without_new_updates() {
ExtBuilder::new().execute_with_default_mocks(|| {
forward_to_block::<Test>(10);

let deposit_update = L1UpdateBuilder::default()
.with_requests(vec![L1UpdateRequest::Deposit(Default::default())])
.with_offset(1u128)
.build();

Rolldown::update_l2_from_l1_unsafe(RuntimeOrigin::signed(ALICE), deposit_update.clone())
.unwrap();
assert_eq!(LastProcessedRequestOnL2::<Test>::get(consts::CHAIN), 0u128.into());

forward_to_block::<Test>(16);
assert_eq!(LastProcessedRequestOnL2::<Test>::get(consts::CHAIN), 1u128.into());

assert_err!(
Rolldown::update_l2_from_l1_unsafe(RuntimeOrigin::signed(ALICE), deposit_update),
Error::<Test>::WrongRequestId
);
});
}

#[test]
#[serial]
fn reject_second_update_in_the_same_block() {
Expand Down
30 changes: 14 additions & 16 deletions rollup/runtime/src/weights/block_weights.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2024-01-09 (Y/M/D)
//! HOSTNAME: `af2cb189db8d`, CPU: `AMD EPYC 7B13`
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-11-29 (Y/M/D)
//! HOSTNAME: `98ec9bd8ef1f`, CPU: `AMD EPYC 7B13`
//!
//! SHORT-NAME: `block`, LONG-NAME: `BlockExecution`, RUNTIME: `Mangata Kusama Local`
//! SHORT-NAME: `block`, LONG-NAME: `BlockExecution`, RUNTIME: `Rollup Local`
//! WARMUPS: `10`, REPEAT: `100`
//! WEIGHT-PATH: ``
//! WEIGHT-METRIC: `Average`, WEIGHT-MUL: `1.0`, WEIGHT-ADD: `0`

// Executed Command:
// target/release/mangata-node
// target/release/rollup-node
// benchmark
// overhead
// --execution
// native
// --chain
// mangata-kusama-local
// rollup-local
// -lblock_builder=debug
// --max-ext-per-block
// 50000
Expand All @@ -29,17 +27,17 @@ parameter_types! {
/// Calculated by multiplying the *Average* with `1.0` and adding `0`.
///
/// Stats nanoseconds:
/// Min, Max: 26_916_778, 31_638_388
/// Average: 28_489_486
/// Median: 28_464_418
/// Std-Dev: 976072.11
/// Min, Max: 30_924_759, 36_916_389
/// Average: 31_490_935
/// Median: 31_336_589
/// Std-Dev: 697753.75
///
/// Percentiles nanoseconds:
/// 99th: 31_225_878
/// 95th: 30_092_347
/// 75th: 29_178_298
/// 99th: 33_779_619
/// 95th: 32_274_600
/// 75th: 31_631_190
pub const BlockExecutionWeight: Weight =
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(28_489_486), 0);
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(31_490_935), 0);
}

#[cfg(test)]
Expand Down
30 changes: 14 additions & 16 deletions rollup/runtime/src/weights/extrinsic_weights.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2024-01-09 (Y/M/D)
//! HOSTNAME: `af2cb189db8d`, CPU: `AMD EPYC 7B13`
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-11-29 (Y/M/D)
//! HOSTNAME: `98ec9bd8ef1f`, CPU: `AMD EPYC 7B13`
//!
//! SHORT-NAME: `extrinsic`, LONG-NAME: `ExtrinsicBase`, RUNTIME: `Mangata Kusama Local`
//! SHORT-NAME: `extrinsic`, LONG-NAME: `ExtrinsicBase`, RUNTIME: `Rollup Local`
//! WARMUPS: `10`, REPEAT: `100`
//! WEIGHT-PATH: ``
//! WEIGHT-METRIC: `Average`, WEIGHT-MUL: `1.0`, WEIGHT-ADD: `0`

// Executed Command:
// target/release/mangata-node
// target/release/rollup-node
// benchmark
// overhead
// --execution
// native
// --chain
// mangata-kusama-local
// rollup-local
// -lblock_builder=debug
// --max-ext-per-block
// 50000
Expand All @@ -29,17 +27,17 @@ parameter_types! {
/// Calculated by multiplying the *Average* with `1.0` and adding `0`.
///
/// Stats nanoseconds:
/// Min, Max: 181_689, 199_921
/// Average: 187_355
/// Median: 186_772
/// Std-Dev: 3058.03
/// Min, Max: 208_592, 256_940
/// Average: 212_669
/// Median: 211_383
/// Std-Dev: 5780.19
///
/// Percentiles nanoseconds:
/// 99th: 195_738
/// 95th: 192_306
/// 75th: 188_874
/// 99th: 242_190
/// 95th: 217_274
/// 75th: 212_527
pub const ExtrinsicBaseWeight: Weight =
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(187_355), 0);
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(212_669), 0);
}

#[cfg(test)]
Expand Down
Loading
Loading