Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Audit items M33, M37, M38, with L56 and I08. Open against
dev.One header archive (M33). Every header-chain proof was published with a
.blockssidecar holding every header from Genesis to its last block, and the sidecars were never removed. The chain gets one proof per Bitcoin block, and on mainnet each sidecar is about 74 MB, so the disk grew by about 10 GB a day. Once it was full the header chain stopped, and the operator and watchtower proofs with it.Proven headers are now kept once, in
headers.blocksnext to the header-chain proofs:.blockssidecar..blockssidecar in the directory whose last header matches the archive at the same height is deleted.0-*seed sidecars are kept, and nothing else ending in.blocksis touched.proof_builder::headers, a host-only crate. The guest crates are untouched, so the program ids do not change.Header continuity (L56). A newly fetched header was not checked against the one before it. Now:
Commit-chain restart (M37). With
init_input = true, which is what the example config sets, every restart proved the commit chain from Genesis again and deleted every stored commit-chain proof. The loop now resumes from stored progress first, as the header chain already did.init_inputonly applies while nothing is stored. Restarting the chain on purpose now requires clearing its rows.State-chain batch reset (M38). Before, a batch whose proof failed fatally was retried forever with the same frozen
.args/.ctxsnapshot. Wrong block data from the configured Goat RPC therefore stopped the state chain for good, and once the backlog filled up, operator tasks needing a higher state-chain height could not be prepared. Now:proof_attempts{type="state-chain"}withoutcome="batch_reset"andoutcome="stalled".I08. Not changed. The stale migration names are only in a comment of an applied migration. Editing that file changes its checksum, which sqlx refuses on every existing database.
Review notes
headers.blocksmust be in the header-chain proof directory. The shipped configs already keep each chain in its own directory.block_headers) still exists. The archive differs from it in holding only proven headers, so a proof's prefix never changes.Tests: the archive grows by batch, survives a torn tail and refuses a changed or broken chain; a proof reads its own prefix or its seed sidecar and refuses another chain's archive; only covered sidecars are deleted; a header that does not extend the chain is refetched inside the batch and refused at the batch start; a state-chain reset drops the unproven batches and their snapshots and the builder restarts after the last proven batch; the store's reset delete only touches unproven rows of its own chain.
The test coverage and validation notes above are from the zkm PR notes. Branch scope and diff formatting were checked locally; builds and tests were not rerun during publication.