Skip to content

feat: carry the PostageStamp batch events from the wire to the domain - #848

Merged
mfw78 merged 1 commit into
mainfrom
feat/791-sol-events
Aug 21, 2026
Merged

feat: carry the PostageStamp batch events from the wire to the domain#848
mfw78 merged 1 commit into
mainfrom
feat/791-sol-events

Conversation

@mfw78

@mfw78 mfw78 commented Aug 21, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Carry the PostageStamp batch events (BatchCreated, BatchTopUp, BatchDepthIncrease) from the contract wire into the domain BatchEvent, and give the issuer the translation.

Changes

  • crates/contracts: sol! declares the three events on IPostageStamp, with field names, order and types matching ethersphere/storage-incentives (master c8686806) and the IPostageStamp events pinned in go-storage-incentives-abi v0.9.4. Two vector tests guard the topic hashes and the decoder field shapes.
  • crates/postage: BatchEvent carries the normalised balance (new_value) for TopUp and DepthIncrease and the mined-in block for DepthIncrease; each variant documents where its fields come from and which event body fields are intentionally not carried (totalAmount, topupAmount).
  • crates/postage-issuer: a new std-only translation module (created, top_up, depth_increase, expired plus the permanent EventError) converts the decoded logs to BatchEvent, and the crate takes an optional nectar-contracts dependency under std.

Breaking changes

The domain BatchEvent variants change shape (struct variants, new new_value and block fields). nectar is pre-1.0 and the variants were internal to this tree.

Testing

  • Unit tests pass: 283/283 across nectar-postage, nectar-contracts and nectar-postage-issuer (nextest)
  • clippy --all-targets clean for the default, parallel and sign-parallel feature shapes, fmt clean, doctests clean
  • cargo check --locked --no-default-features builds on riscv64imac-unknown-none-elf and wasm32-unknown-unknown (the ci no_std targets) with no new warnings
  • Manual testing completed
  • Documentation updated (if needed)

Related issues

AI assistance disclosure

AI Assistance: opencode (qwen3.8) used for the implementation and verification.

Notes for reviewers

  • Placement: the domain shape stays in nectar-postage (no_std), and the translation from the decoded logs lives in nectar-postage-issuer (std only, where the nectar-contracts generated events are already the consumer).
  • Vector provenance: upstream publishes no topic or log vectors for these events, so the vectors are generated. The declarations were checked against both the .sol source (master c8686806) and the pinned v0.9.4 ABI, and the headers in the tests state that.

Checklist

  • Code follows project style
  • Self-review completed
  • Tests added/updated
  • No console.logs or debug code left behind
  • PR title is descriptive

Closes

sol! declares BatchCreated, BatchTopUp and BatchDepthIncrease on
IPostageStamp, matching the field names, order and types of upstream
ethersphere/storage-incentives (master c8686806) and of the IPostageStamp
events pinned in go-storage-incentives-abi v0.9.4; the topic hashes and
the decoder field shapes are guarded by vectors in crates/contracts. The
domain BatchEvent carries the normalised balance (new_value) and, for
depth increases, the mined-in block. nectar-postage-issuer (std only)
translates the decoded logs to BatchEvent and classifies the validation
failures as the permanent EventError.

AI Assistance: opencode (qwen3.8) used for the implementation and verification.

Signed-off-by: mfw78 <mfw78@nxm.rs>
@mfw78
mfw78 force-pushed the feat/791-sol-events branch from 5f8f491 to 92b04dc Compare August 21, 2026 10:57
@mfw78
mfw78 merged commit 4b1eea8 into main Aug 21, 2026
17 checks passed
@mfw78
mfw78 deleted the feat/791-sol-events branch August 21, 2026 10:58
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

postage, contracts: generate the batch events with sol! instead of hand-writing them

1 participant