Conversation
deliver inserted one envelopes row per operator, outpost and epoch, billed to sysio, and nothing ever erased one: ~457 B per row, about 0.77 MB a day per outpost at the defaults. After each insert, deliver now erases up to four rows older than the previous epoch, oldest first. Ids are assigned in epoch order and the newest row always survives, so the walk stops at the first retained row. Every reader touches only the current epoch; resolvedisp's epoch cannot move while its dispute holds the pause. A late confirmation of an accepted winner no longer stores its payload; acceptance is already recorded, so nothing decodes those bytes again. Drop the unread bybatchop index, 28% of every row. Removing it before launch avoids migrating a populated table later.
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.
sysio.msgch::deliverrecords oneenvelopesrow per batch operator, outpost and epoch, billed tosysio, and nothing ever erased one. Consensus only clearedraw_data, so every delivery left about 457 B behind for good: roughly 0.77 MB a day per outpost at the default 7 operators and 6-minute epochs.Bounded prune in
deliverAfter each insert,
delivererases up to four rows older than the previous epoch, oldest first. Row ids come fromavailable_primary_key(),deliveraccepts only current-epoch envelopes, and rows only ever leave from the head, so primary-key order is epoch order: the walk stops at the first retained row and each call is O(budget). The prune runs after the insert, so the newest id always survives and ids never restart.Every reader of the table touches only the current epoch:
deliver's duplicate check andevalcons.sysio.epoch::advance, which classifies the expiring epoch before incrementing it.resolvedisp, whose epoch cannot move while its dispute is open:opendisputepauses advancement until the last dispute resolves.has_delivered_envelope, which queries its cached epoch; keeping the previous epoch as well covers a cache that lags by one.Each delivery adds one row and can erase four, so the table settles at about two epochs of rows, roughly 5-7 KB per outpost, and an epoch with few deliveries after a full one still clears.
Late confirmations
A delivery byte-identical to an already-accepted winner is recorded without re-validation so
advancecan classify it, but it also kept its payload (up to 32 KiB):apply_consensus's idempotency guard returns before the cleanup that clears the other rows. Acceptance is already recorded onoutpcons, so nothing decodes those bytes again; the row now keeps only the metadata.bybatchopThe index had no reader on-chain or off-chain and cost 128 B, 28% of every row. It goes now, before launch, while dropping an index does not yet mean migrating a populated table.
Notes
sysio.msgch.wasmand.abiare rebuilt; the ABI change is only the removed index.sysio.epochandsysio.reservinclude the msgch header and rebuild byte-identical, so they are unchanged.sysio_msgch_chain_testscases drive realdeliver -> chkcons -> advancecycles to check the retention window (including its lower edge, id order and orphaned index entries), the per-delivery budget, and dispute resolution and slashing with the prune live. The late-confirmation test now checks the stored payload.