Skip to content

feat: update scroll consensus #314

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

Open
wants to merge 9 commits into
base: scroll
Choose a base branch
from

Conversation

greged93
Copy link
Collaborator

@greged93 greged93 commented Aug 8, 2025

Updates the scroll consensus checks based on the l2geth clique and system config consensus. Successfully synced to block 18663346 on Mainnet with the consensus updates.
Resolves #290.
Resolves #296.

Note: Clique consensus signer verification isn't performed. I don't see any issues with skipping it, but do tell me if I'm wrong. This check would require some work to save signer snapshots.

greged93 and others added 5 commits August 8, 2025 10:50
Signed-off-by: Gregory Edison <[email protected]>
Signed-off-by: Gregory Edison <[email protected]>
Signed-off-by: Gregory Edison <[email protected]>
* feat: update execute_with_state_closure closure

Signed-off-by: Gregory Edison <[email protected]>

* feat: LoadWithdrawRoot

Signed-off-by: Gregory Edison <[email protected]>

* chore: fix clippy docs (paradigmxyz#17726)

Co-authored-by: Alexey Shekhirin <[email protected]>

* fix: clippy

Signed-off-by: Gregory Edison <[email protected]>

---------

Signed-off-by: Gregory Edison <[email protected]>
Co-authored-by: Matthias Seitz <[email protected]>
Co-authored-by: Alexey Shekhirin <[email protected]>
Copy link

codspeed-hq bot commented Aug 8, 2025

CodSpeed Performance Report

Merging #314 will not alter performance

Comparing feat/update-scroll-consensus (436b8cc) with scroll (40affdf)

Summary

✅ 77 untouched benchmarks

Signed-off-by: Gregory Edison <[email protected]>
frisitano
frisitano previously approved these changes Aug 8, 2025
@frisitano
Copy link
Collaborator

Rust logic looks sound, deferring to the subject matter experts for consnsus logic review.

Comment on lines 352 to 355
// Check if the block contains L1 messages.
if !txs.iter().any(ScrollTransaction::is_l1_message) {
return Ok(())
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this check ultimately imply that if there is an L1 message present in the block, then we end up iterating transactions twice? Is there any value in this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes can remove this, it added it because l2geth has it, but it makes sense for them since they also have some db access, whereas here we just iterate.

colinlyguo
colinlyguo previously approved these changes Aug 11, 2025
parent: &H,
) -> Result<(), ConsensusError> {
let diff = header.gas_limit().abs_diff(parent.gas_limit());
let limit = parent.gas_limit().saturating_div(GAS_LIMIT_BOUND_DIVISOR);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May checked_div be better here?

Copy link
Collaborator Author

@greged93 greged93 Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I replaced it with plain div /, saturating div here wasn't useful and checked_div returns None if the divisor is 0, which is guaranteed not to be the case here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I can even just use plain div, checked will return None if the divisor is 0, which in this case it wouldn't be.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea.

Signed-off-by: Gregory Edison <[email protected]>
// Check index is strictly increasing.
if tx.is_l1_message() {
let tx_queue_index = tx.queue_index().expect("is_l1_message");
if tx_queue_index < queue_index {
Copy link
Member

@yiweichi yiweichi Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From EuclidV2 onwards there can't be any skipped L1 messages, so l1 message indexes after EuclidV2 should be consecutive. I guess here we only make sure it's increasing rather than consecutively increasing?

some context here: https://github.com/scroll-tech/go-ethereum/blob/8bee78a76ca728cc37dd65d3b5e76e7f6386e2f6/core/block_validator.go#L150

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right, will check that we don't skip any for EuclidV2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants