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

Fix/seq dies #853

Merged
merged 3 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions pallets/rolldown/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1496,7 +1496,7 @@ impl<T: Config> Pallet<T> {
(update.pendingDeposits.len() as u128) +
(update.pendingCancelResolutions.len() as u128);

ensure!(last_id > LastProcessedRequestOnL2::<T>::get(l1), Error::<T>::WrongRequestId);
ensure!(last_id >= LastProcessedRequestOnL2::<T>::get(l1), Error::<T>::WrongRequestId);

let mut deposit_it = update.pendingDeposits.iter();
let mut cancel_it = update.pendingCancelResolutions.iter();
Expand All @@ -1521,8 +1521,8 @@ impl<T: Config> Pallet<T> {
update_hash: update.abi_encode_hash(),
update_size: update.pendingDeposits.len() as u128 +
update.pendingCancelResolutions.len() as u128,
max_id: lowest_id,
min_id: last_id,
min_id: lowest_id,
max_id: last_id,
})
}

Expand Down
10 changes: 6 additions & 4 deletions pallets/rolldown/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,10 @@ fn reject_update_with_invalid_too_high_request_id() {

#[test]
#[serial]
fn reject_update_without_new_updates() {
// changed to accept
// seq gets the rights BEFORE LastProcessedRequestOnL2 is updated
// a single request would be duplicated, extrinsic fail and break seq
fn accept_update_without_new_updates() {
ExtBuilder::new().execute_with_default_mocks(|| {
forward_to_block::<Test>(10);

Expand All @@ -1044,9 +1047,8 @@ fn reject_update_without_new_updates() {
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
assert_ok!(
Rolldown::update_l2_from_l1_unsafe(RuntimeOrigin::signed(ALICE), deposit_update)
);
});
}
Expand Down
Loading