Skip to content

feat(consensus): Add consensus check for block sequencing #231

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 3 commits into
base: main
Choose a base branch
from

Conversation

frisitano
Copy link
Collaborator

Overview

This PR introduces a should_sequence_block on the Consensus trait such that the manager can asses if the sequencer is authorized to sign a new block for a specific slot.

colinlyguo
colinlyguo previously approved these changes Aug 4, 2025
Copy link
Member

@colinlyguo colinlyguo left a comment

Choose a reason for hiding this comment

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

LGTM. After this PR, is an L1 node (with system contract slot correctly initialized) needed for local running?


/// The optional authorized signer for system contract consensus.
#[arg(long = "consensus.authorized-signer", value_name = "ADDRESS")]
pub authorized_signer: Option<Address>,
Copy link
Member

Choose a reason for hiding this comment

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

Would it be purer to only fetch authorized_signer based on the system contract's slot? But let me ask the rationale of adding this config first.

Copy link
Collaborator Author

@frisitano frisitano Aug 4, 2025

Choose a reason for hiding this comment

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

This is primarily for testing purposes, such that we can run unit tests and set the initial signer without an L1 provider. I agree with the general sentiment. How about we put this behind a test-utils feature flag?

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.

@frisitano
Copy link
Collaborator Author

LGTM. After this PR, is an L1 node (with system contract slot correctly initialized) needed for local running?

Not needed, you just have to be specific about how you configure the node. There are 2 ways you can configure the nodes such that L1 provider isn't needed:

  1. Set the consensus algorithm to be noop (--consensus.algorithm=noop)
  2. Set the consensus algorithm to be system-contract (this is default so no cli arguments requied) and then also set the authorized signer address --consensus.authorized-signer=ADDRESS)

@@ -9,4 +9,5 @@ exec rollup-node node --chain dev --datadir=/l2reth --metrics=0.0.0.0:6060 --net
--txpool.pending-max-count=1000 \
--builder.gaslimit=20000000 \
--rpc.max-connections=5000 \
--trusted-peers enode://3983278a7cab48862d9ab3187278edf376a0736a7deb55472a5650592f6922ce626a1ea7d74b77b9a679694b343f5e93ea97d5d60a9db4e4b51bb0c23a36d01b@rollup-node-sequencer:30303
--trusted-peers enode://3983278a7cab48862d9ab3187278edf376a0736a7deb55472a5650592f6922ce626a1ea7d74b77b9a679694b343f5e93ea97d5d60a9db4e4b51bb0c23a36d01b@rollup-node-sequencer:30303 \
--consensus.algorithm=noop
Copy link
Collaborator Author

@frisitano frisitano Aug 4, 2025

Choose a reason for hiding this comment

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

@colinlyguo I am setting the consensus algorithm to noop for this PR which is the same behaviour as we previously had from use of the --test flag. However, I think it would be good to migrate to system-contract consensus once we have anvil introduced from your open PR.

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

Successfully merging this pull request may close these issues.

2 participants