Skip to content

feat: implement sequencer recovery for stale batches#12

Draft
GCdePaula wants to merge 17 commits intomainfrom
feature/recovery
Draft

feat: implement sequencer recovery for stale batches#12
GCdePaula wants to merge 17 commits intomainfrom
feature/recovery

Conversation

@GCdePaula
Copy link
Copy Markdown
Collaborator

No description provided.

Extract DangerDetector as its own worker; submitter is pure submission.
Unify SchedulerRules + RecoveryParams into one ProtocolConfig in core.
Pure decide_submit_start + decide_startup_action with exhaustive tests.
DangerZone is a deliberate RunError variant, not a BatchSubmitterError.
Transactions use read/write closures; 11 manual sites collapsed.
internals.rs split into convert/queries/mutations; drop load_ prefix.
pending_batches now bakes the authoritative nonce into wire bytes.
Extract 2000-line test block from recovery.rs into a sibling file.
Improve flusher error handling
Copy link
Copy Markdown
Collaborator

@stephenctw stephenctw left a comment

Choose a reason for hiding this comment

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

Looks great! I've left a few minor comments.

});
}
Ok(_) => {} // verified
Err(e) => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could we fail startup if get_chain_id() errors here? Right now we warn+continue, which can skip chain-id validation on transient RPC issues.

/// zero would make preemptive recovery indistinguishable from hard
/// staleness. Callers should catch this at startup.
pub fn danger_threshold(&self) -> u64 {
assert!(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this assert! panics on invalid operator config. Would you consider returning a typed startup config error instead (still fail-fast, just cleaner)?

batch_submitter_address = %l1_config.batch_submitter_address,
max_wait_blocks = protocol.max_wait_blocks,
preemptive_margin_blocks = protocol.preemptive_margin_blocks,
danger_threshold = protocol.danger_threshold(),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Related to above: calling danger_threshold() in startup logging means invalid config panics before structured error handling. Maybe validate once up front and return a typed error.

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