Skip to content

[WIP] Finality config changes#1898

Draft
RensR wants to merge 10 commits intomainfrom
finality
Draft

[WIP] Finality config changes#1898
RensR wants to merge 10 commits intomainfrom
finality

Conversation

@RensR
Copy link
Collaborator

@RensR RensR commented Mar 24, 2026

No description provided.

Comment on lines +8 to +26
/// @dev Bit layout of the `bytes2` finality value (16 bits, MSB on the left):
///
/// Bit: 15 14 13 12 11 10 | 9 8 7 6 5 4 3 2 1 0
/// +----+----+----+----+----+---+----+----+----+----+----+----+----+----+----+----+
/// | R | R | R | R | R | S | block depth (10 bits) |
/// +----+----+----+----+----+---+----+----+----+----+----+----+----+----+----+----+
/// \____________________ ____/ \________________________ _____________________/
/// \/ \/
/// flags (6 bits) depth (10 bits)
/// max = 1023 (0x3FF)
///
/// S (bit 10) = WAIT_FOR_SAFE_FLAG — wait for the `safe` tag instead of a block count.
/// R (bits 11-15) = Reserved for future flags (currently unassigned; accepted on the wire).
/// Reserved bits may be assigned in the future, read the docs for the latest bit definitions.
///
/// Special values:
/// 0x0000 WAIT_FOR_FINALITY_FLAG — wait for full finality (safest, default).
/// 0x0400 WAIT_FOR_SAFE_FLAG — wait for the `safe` head (bit 10 set, no depth).
/// 0x0001..0x03FF — wait for N confirmation blocks (depth only, no flags).
Copy link

@andrevmatos andrevmatos Mar 24, 2026

Choose a reason for hiding this comment

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

10 bits is only up to 1024 blocks depth, which is less than certain rollups finalization;
From the way I see it, block depth is exclusive with any other flag.

So why not have a bit to specify this exclusively? e.g.

  • If highest bit (15) is unset, then bits 0..14 are interpreted as block depth (so, 15 bits for block depth, ~32k max)
    • We can even keep the 0 value special as finalized tag
    • Easy to calculate, as it's just a modulo
  • If highest bit is set, then this allows enabling any of the 15 other bits as flags.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For sending you want exactly one signal, but for the pools, CCVs, executor and receiver you likely want to signal broader support. Our executor will for sure support multiple of these values, including a block depth AND the safe tag.

@github-actions
Copy link

Metric finality main
Coverage 70.1% 69.8%

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