feat: emit compact PiecesAddedV2 events - #300
Open
Kubuxu wants to merge 3 commits into
Open
Conversation
Signed-off-by: Jakub Sztandera <oss@kubuxu.com>
Signed-off-by: Jakub Sztandera <oss@kubuxu.com>
Signed-off-by: Jakub Sztandera <oss@kubuxu.com>
Kubuxu
force-pushed
the
issue-295-compact-pieces-added
branch
from
August 14, 2026 23:47
4f3fe9e to
b043537
Compare
Kubuxu
marked this pull request as ready for review
August 14, 2026 23:48
4 tasks
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.
Closes #295
Summary
Adds a compact, ABI-decodable event for piece additions:
Piece IDs derive from
firstPieceId + arrayIndex. CIDs are reconstructed by stripping the leading zero padding fromheaderand appendingroot.Events are limited to 125 pieces. Larger calls emit multiple events with adjusted
firstPieceIdvalues.BREAKING (!!): event consumers must upgrade
The legacy
PiecesAddedevent remains in the contract ABI but is no longer emitted. New additions emit onlyPiecesAddedV2.Indexers and all other event consumers must support
PiecesAddedV2before the contract rollout.Historical
PiecesAddedlogs remain decodable. TheaddPiecesfunction ABI and listener callbacks are unchanged.Size
PiecesAddedPiecesAddedV2A 125-piece event consumes 8,160 bytes, below FEVM’s 8,192-byte limit.
Gas
Measured with this PR applied, using the prior batch sizes of 41 pieces with one metadata pair and 61 pieces without metadata as baselines.
Dependency
Relies on #292 enforcing canonical PieceCIDv2 encodings so splitting a CID into
headerandrootpreserves it exactly.Validation