Skip to content

feat(venue): add postage venue adapter - #62

Open
mfw78 wants to merge 3 commits into
feat/value-flow-service-assetfrom
feat/postage-venue-adapter
Open

feat(venue): add postage venue adapter#62
mfw78 wants to merge 3 commits into
feat/value-flow-service-assetfrom
feat/postage-venue-adapter

Conversation

@mfw78

@mfw78 mfw78 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

What

Adds postage-venue, a new venue module implementing the postage stamp batch purchase flow over the blessed #[videre_sdk::venue] path with the logging capability.

  • IntentBody schema PostageBody::V1 (owner, initial_balance_per_chunk, depth, bucket_depth, nonce, immutable) via borsh.
  • derive_header computes the enforceable BZZ erc20 total (per-chunk balance shifted left by depth, checked for EVM-word overflow) and exposes the display-grade chunk capacity as the service asset case.
  • quote mirrors the legs with a zero fee.
  • submit returns a requires-signing(unsigned-tx) response carrying locally sol!-encoded createBatch calldata targeting the Gnosis postage stamp contract, with empty value since BZZ moves by allowance.
  • The two-transaction settlement shape (erc20 approve then createBatch) is documented in the crate docs; only the purchase leg is returned, and the multi-tx wire decision is left open.

Also adds videre-test/src/signer.rs (mock signer, typed tx hash as b256), goldens/vectors for the postage header and body, and wires the new crate into Cargo.toml/Cargo.lock, CI, justfile, AGENTS.md, and README.md.

Why

Closes #28

Testing

Independent CI-parity gate, fresh clone of nullislabs/videre-nexum-module at detached origin/feat/postage-venue-adapter (b30852d), toolchain rustc 1.94.0 / cargo 1.94.0. Nothing was fixed or pushed in that pass, the branch passed as-is.

  • cargo metadata --locked clean, so Cargo.lock is committed in sync with the manifests; git status stayed empty after every build (no lock churn).
  • RUSTFLAGS=-D warnings cargo clippy -p postage-venue -p videre-test --all-targets --all-features --locked -- -D warnings clean, zero warnings.
  • cargo test --doc -p postage-venue -p videre-test --all-features --locked passed.

A prior red-team pass on 2f2149d found the createBatch unsigned tx had zero independent coverage: the settlement test re-derived every assertion from the same sol! declaration and POSTAGE_STAMP constant it was meant to check. Transposing uint8 depth and uint8 bucketDepth in the sol! block exposed this; three real defects were found and fixed, pushed as e47c16c and b30852d.

AI Assistance

Implementation by claude-fable-5, red-team review by claude-opus-5, PR authored by claude-sonnet-5.

mfw78 added 3 commits August 7, 2026 05:28
The Swarm postage batch purchase as the second genuine venue: a
policy-legible header (enforceable BZZ erc20 gives, display-grade
chunk-capacity service want), an indicative quote, and submit answering
requires-signing over the createBatch transaction on Gnosis. The
conformance kit gains the missing signer mock in MockTransport, playing
the host's signing role with teeth on the unsigned-tx wire contract,
and the venue publishes its header goldens and body codec vectors.

Settlement is two transactions (erc20 approve, then createBatch); the
adapter records the shape in its docs, returns the purchase leg only,
and leaves the multi-transaction wire decision open. The createBatch
calldata is encoded locally via alloy-sol-types, already in the
workspace dependency table.
The submit test derived every expectation from the same `sol!` block it
was checking, so transposing the two `uint8` parameters left the
signature string, the selector and an `abi_decode` round trip all
unchanged and the suite green while the host would have been handed a
batch with depth and bucket depth swapped. Pin the calldata and the
target address as literals instead, covering `immutableFlag` on the
second batch since it has no footprint in the header.

Answer `status` with `unsupported` rather than `unavailable`: the
adapter declares no chain capability, so the verb is permanently
unimplementable here and `retry_action` folds `unavailable` into an
unbounded try-next-block. Refuse a zero per-chunk balance, which
`createBatch` always reverts and which would otherwise derive a header
reporting the purchase to policy as free.
`keccak256` already answers a `B256`; widening it to `Vec<u8>` forced
callers to assert the length back.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant