Skip to content

feat: land the store-free admission composite - #902

Merged
mfw78 merged 1 commit into
mainfrom
feat/835-admission-composite
Aug 26, 2026
Merged

feat: land the store-free admission composite#902
mfw78 merged 1 commit into
mainfrom
feat/835-admission-composite

Conversation

@mfw78

@mfw78 mfw78 commented Aug 26, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Rewrite the stamp validator against the callers that exist: a store-free admission composite, the canonical gate a node's reserve runs against an already-loaded batch, shipped where the security core belongs in the proving lane.

Changes

  • Add AdmissionValidator in crates/postage-primitives/src/admission.rs: the admission composite, store-free by design, gating a stamped chunk against a loaded batch in a fixed order: the batch the stamp claims, the usability gate, the expiry gate, the index bounds, the bucket match, the owner signature.
  • Add AdmissionError to the crate error home: one variant per denial, #[non_exhaustive], the Stamp wrap carrying its #[from] source, and is_context_dependent as the retryability predicate.
  • Guard the classification with an exhaustive classification test and a source-chain test in the crate's house pattern.
  • Re-export both names at the nectar-postage facade.
  • Cover the composite with generated-stamp tests: accept, the identity gate, the threshold, the expiry, a foreign owner, the geometry wraps and the signature wrap.

Breaking changes

None. Additive. The trait this replaces, StampValidator, was deleted in M1 with zero implementors.

Testing

  • Unit tests pass: 333 green across the four postage crates, including the nine new admission and error tests
  • cargo clippy --all-targets -- -D warnings clean, including the nectar-postage-primitives serde, parallel and arbitrary feature paths; the reinvention gate, fmt and the doc build under -D rustdoc::broken_intra_doc_links clean
  • Manual testing completed: the surface is type-level; the tests are the check
  • Documentation updated

Related issues

  • The M1 inputs document (docs/restructure/m1-trait-redesign-inputs.md) holds the locked decisions this lands: the leaf predicate (D2), the store-level context gates (D3) and the one canonical composite (D4), with the node's standalone admission implementation as the design input.
  • The nectar-postage-api car (api: create the tier-two trait crates with noop implementations #812) moves this surface into the fresh crate.

AI assistance disclosure

AI assistance: Claude Code (opencode) used for the design research, the implementation and this body.

Notes for reviewers

  • The gate order is fixed and leading: the batch-identity check first, a gate the node's design input lacked, because a foreign-batch stamp signed by the same owner would otherwise clear the signature check.
  • UnknownBatch is the caller's own load-miss variant; the store-free composite never yields it, and no store-coupled path ships in this car.
  • The test stamps are signed at run time by nectar's own signing path over the deterministic EIP-191 key bee's signer tests pin; the module doc states the fixed inputs and why no upstream vector exists for the composite's answers.

Checklist

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

Closes

@mfw78
mfw78 merged commit 4fe0f61 into main Aug 26, 2026
41 checks passed
@mfw78
mfw78 deleted the feat/835-admission-composite branch August 26, 2026 05:12
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 26, 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-api: rewrite the stamp validator against its real caller

1 participant