Skip to content

fix(compliance): extend new modules and bound tokens when created - #299

Open
hpmaxi wants to merge 5 commits into
docs/design-notesfrom
fix/compliance-ttl-on-creation
Open

hpmaxi wants to merge 5 commits into
docs/design-notesfrom
fix/compliance-ttl-on-creation

Conversation

@hpmaxi

@hpmaxi hpmaxi commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #330

The compliance stub's bind_token and add_module_to, and the applied BindToken and AddModule changes, created persistent entries at the network's minimum lifetime, about seven days on testnet. OpenZeppelin extends these entries only when it reads them, so the next call that read them, such as a mint, transfer or burn through the token's hooks, paid to extend them. #276 made the share token read back what it creates; the kit spec named the stub as the one exception.

Now the stub reads back the bound tokens and the hook's modules after each of these calls, through OpenZeppelin's own reads. Each new entry reaches its extend target in the transaction that creates it, and the spec lists no exception.

Changes

  • bind_token and an applied BindToken change read back the bound tokens: the count and every bucket, including the one that holds the new token
  • add_module_to and an applied AddModule change read back that hook's modules
  • The read-backs call OpenZeppelin's own reads (linked_tokens, get_modules_for_hook), so its 30-day target and threshold apply unchanged
  • 5 new tests set the ledger's minimum lifetime to testnet's (120,960 ledgers) and read each new entry's TTL from inside the contract, during setup and through the timelock; one binds a 101st token, which opens a second bucket
  • The kit spec's TTL policy lists the stub's read-backs instead of the exception, and the testing guide lists the new tests

Deviations

  • The spec no longer says which later calls renew the stub's modules and bound tokens. That sentence explained the exception; the general rule that a read extends an entry covers it.

Acceptance criteria

  • bind_token, add_module_to and their applied changes leave each new entry at its extend target, tested with testnet's minimum lifetime
  • The kit spec's TTL policy no longer lists the stub as an exception, and no other doc names it

Test plan

Automated tests

  1. SOROBAN_SDK_BUILD_SYSTEM_SUPPORTS_SPEC_SHAKING_V2=1 cargo test --locked: 720 passed, 0 failed (446 vault, 101 oracle, 97 token, 41 compliance, 7 identity verifier, 19 timelock, 6 storage, 1 spec-doc check, 2 doctests). 5 are new. Before the fix all five fail, each new entry at 120,959 ledgers (the testnet minimum) against a target of 518,400.
  2. cargo clippy --locked --all-targets -p compliance -- -D warnings: clean.
  3. cargo fmt --all -- --check: clean.

Manual verification

  1. Run stellar contract build on the base and on this branch.
  2. You should see compliance.wasm grow from 30,667 to 30,713 bytes (+46). The vault, token, oracle and identity verifier Wasm files keep their hashes.

Breaking changes

None. No entrypoint, argument, event or error changes. Fees move: on testnet, the call that binds a token or adds a module now pays for 30 days instead of about 7, and the next call that reads the entry no longer pays the difference. The compliance Wasm hash changes.

Checklist

  • Self-reviewed my own diff
  • Tests added or updated
  • Docs updated (if applicable)
  • No unrelated changes bundled in

Screenshots

None.

OpenZeppelin extends a module list or a bound-token entry when it reads
it, not when it creates it, so a new one started at the network's
minimum lifetime. bind_token, add_module_to and the applied BindToken
and AddModule changes now read back what they wrote through
OpenZeppelin's own reads, so each new entry reaches its target in the
transaction that creates it.
The stub now reads back its modules and bound tokens when it writes
them. The kit spec lists those read-backs instead of naming the stub as
the one exception, and the testing guide lists the new tests.
@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
strata-vault-kit-app Ready Ready Preview Oct 22, 2026 5:46pm UTC

Request Review

@hpmaxi
hpmaxi marked this pull request as ready for review October 22, 2026 12:34

This branch was successfully deployed

1 active deployment
Preview — 23e68841 Deployed Oct 22, 2026 by vercel[bot]
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