Skip to content

feat: add disclosure_uri and disclosure_hash to offering metadata#504

Open
bbjiggy wants to merge 4 commits into
RevoraOrg:masterfrom
oss-dw:feat/encrypted-disclosure-metadata
Open

feat: add disclosure_uri and disclosure_hash to offering metadata#504
bbjiggy wants to merge 4 commits into
RevoraOrg:masterfrom
oss-dw:feat/encrypted-disclosure-metadata

Conversation

@bbjiggy

@bbjiggy bbjiggy commented Jun 29, 2026

Copy link
Copy Markdown

Summary

  • Add DisclosureMeta struct (uri: Bytes, hash: BytesN<32>) stored per-offering under DataKey2::DisclosureMeta
  • Introduce update_disclosure(issuer, namespace, token, uri, hash) — issuer-only, auth-gated — validates URI ≤ 256 bytes, rejects empty-URI/non-zero-hash, persists the binding, and emits disc_upd event
  • Add get_disclosure read-only accessor
  • New error codes: DisclosureUriTooLong = 51, InconsistentDisclosure = 52

Test plan

  • Happy path: set URI + hash, retrieve via get_disclosure — values round-trip
  • URI exactly 256 bytes — accepted (boundary)
  • URI 257 bytes — DisclosureUriTooLong
  • Empty URI with non-zero hash — InconsistentDisclosure
  • Empty URI with zero hash — accepted (clears disclosure)
  • Overwrite existing disclosure — latest values stored
  • Unknown offering — OfferingNotFound
  • Wrong issuer caller — OfferingNotFound
  • Event emitted on success — at least one new event after update_disclosure

Closes #485

Add `DisclosureMeta` struct with `uri: Bytes` (max 256 bytes) and
`hash: BytesN<32>` fields, stored per-offering under `DataKey2::DisclosureMeta`.

Introduce `update_disclosure` (issuer-only, auth-gated) that validates URI
length and rejects incoherent empty-URI/non-zero-hash pairs, then persists
the binding and emits `disc_upd`. Add `get_disclosure` read-only accessor.

New error codes: `DisclosureUriTooLong = 51`, `InconsistentDisclosure = 52`.
Test coverage: happy path, boundary (256 B), oversize (257 B), empty-URI
variants, overwrite, unknown/wrong-issuer rejection, event emission.

Closes RevoraOrg#485
@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@bbjiggy Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

bbjiggy added 3 commits June 29, 2026 14:17
- Cargo.toml: declare cfg(kani) as known so clippy does not flag unexpected_cfgs
- lib.rs: use .clamp() instead of .max().min() chain, .is_empty() instead of
  .len() == 0, remove blank line after orphaned doc-comment section header
- test_claim_transfer_fail.rs: fix sibling-offering test — deploy token_b via
  deploy_failing_token, add missing payout_asset/payment_token args to
  register_offering and deposit_revenue
- test_compute_share_invariants.rs: add &[] so for &bps in &[...] pattern
  compiles (u32 ref destructure)
- test_event_indexed_v2.rs: replace deprecated register_stellar_asset_contract
  with register_stellar_asset_contract_v2, remove redundant as u32 casts
- vesting.rs: Vec::new(env) not Vec::new(&env), collapse nested if into &&
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.

Add encrypted-metadata pointer field so issuers can attach off-chain disclosures with hash binding

1 participant