Skip to content

feat: vote-hash supermajority engine with skip-path solver#219

Open
7layermagik wants to merge 3 commits intodevfrom
7layer/fork-choice-supermajority-engine
Open

feat: vote-hash supermajority engine with skip-path solver#219
7layermagik wants to merge 3 commits intodevfrom
7layer/fork-choice-supermajority-engine

Conversation

@7layermagik
Copy link

@7layermagik 7layermagik commented Mar 19, 2026

Summary

  • Vote-hash supermajority engine — accumulates vote-transaction stake per bankhash per slot, detects 2/3+1 confirmation with early-exit and timeout semantics
  • Skip-path solver — BFS solver that finds a valid sequence of block/skip decisions chaining from a parent bankhash to the vote-confirmed target hash, with hash-dedup to prevent state explosion
  • Consensus coordinator — bridges the supermajority engine and skip-path solver; queries confirmed hashes, runs the solver, returns per-slot UseBlock decisions
  • Replay integration — wires the coordinator into the replay loop with bankhash mismatch detection, chain verification, enriched diagnostic artifacts (written to per-run log directory), and configurable halt/warn policy
  • Epoch boundary handling — snapshots epoch data at SubmitBlock time for consistent stake views, refreshes authorized voters cache at epoch transitions

Key design decisions

  • Post-execution confirmation only (solver requires bankhashes which are post-execution, so pre-execution path selection is not possible)
  • VoteConfirmationTimeoutSlots = 32 — slots without supermajority after timeout yield NoSupermajority
  • Early confirmation: if supermajority is reached before timeout, returns immediately without waiting
  • Fail-closed: missing authorized voters returns NeedWait, not silent skip

Commits

  1. 35d6fb1 — Core engine: supermajority accumulator, skip-path solver, consensus coordinator
  2. e349ddf — Replay integration: wiring, diagnostic artifacts, config, epoch boundary handling
  3. fe9fdea — Test coverage: 25 tests across all components

🤖 Generated with Claude Code

7layermagik and others added 3 commits March 18, 2026 19:53
Adds the core fork choice engine:
- Vote-hash supermajority accumulator with 2/3+1 stake detection,
  early-exit confirmation, and configurable timeout (32 slots)
- BFS skip-path solver that finds valid block/skip decision sequences
  from a parent bankhash to the vote-confirmed target hash
- Consensus coordinator bridging the engine and solver

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Integrates the supermajority engine into the replay loop:
- Bankhash mismatch detection with enriched JSON artifacts
- Chain verification failure detection and logging
- Epoch boundary handling with authorized voters refresh
- Configurable halt/warn policy via config.toml
- Artifacts written to per-run log directory

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
25 tests covering:
- Supermajority detection (early confirm, timeout, partial votes)
- IsBankhashCorrect and GetSupermajorityHash query semantics
- Skip-path solver (single/multi block, empty, depth, mismatch)
- Consensus coordinator (resolve range, wait, no-path, policy)
- Vote stake accumulator (threshold, dedup, multi-hash)
- Epoch data snapshot consistency at SubmitBlock time

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@7layermagik 7layermagik force-pushed the 7layer/fork-choice-supermajority-engine branch from 9297e88 to fe9fdea Compare March 19, 2026 00:53
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.

1 participant