Skip to content

fix(dkg): defer dispatch by one block at phase boundaries - #725

Open
jannikluhn wants to merge 1 commit into
on-chain-dkgfrom
delay-phase-messages
Open

fix(dkg): defer dispatch by one block at phase boundaries#725
jannikluhn wants to merge 1 commit into
on-chain-dkgfrom
delay-phase-messages

Conversation

@jannikluhn

Copy link
Copy Markdown
Contributor

Gas estimation races the phase boundary: an RPC node can announce block N via newHead while eth_estimateGas still executes against the state of N-1. A message enqueued on the boundary block then reverts with WrongPhase during estimation, which txsender classifies as non-transient and marks failed. Since the dkg_sent_actions marker is written atomically with the outbox row, the keyper never retries the action and sits out the whole phase.

Add DispatchPhaseAt, which matches PhaseAt except on the first block of each phase window, and route processDKG through it. The contract window is unchanged, so with phaseLength L the remaining L-1 blocks are ample for inclusion.

Windows with phaseLength <= 2 are exempt: they have no block that is both past the boundary and still has an in-window successor, since a transaction triggered by block B is included at B+1 at the earliest.

Gas estimation races the phase boundary: an RPC node can announce block N
via newHead while eth_estimateGas still executes against the state of
N-1. A message enqueued on the boundary block then reverts with
WrongPhase during estimation, which txsender classifies as non-transient
and marks failed. Since the dkg_sent_actions marker is written atomically
with the outbox row, the keyper never retries the action and sits out the
whole phase.

Add DispatchPhaseAt, which matches PhaseAt except on the first block of
each phase window, and route processDKG through it. The contract window
is unchanged, so with phaseLength L the remaining L-1 blocks are ample
for inclusion.

Windows with phaseLength <= 2 are exempt: they have no block that is both
past the boundary and still has an in-window successor, since a
transaction triggered by block B is included at B+1 at the earliest.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jannikluhn

Copy link
Copy Markdown
Contributor Author

Closes #721

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