Repository navigation
L-05, N-10: Correct the HoldingOps docs and test the return-path checks - #134
Merged
Merged
Conversation
0xNeshi
requested review from
ericnordelo,
igingu and
pepebndc
as code owners
November 19, 2026 10:12
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the documentation clarifications and added return-path validation tests.
No open issues 🎉
What changed in this PR
This follow-up to #116 clarifies the CIP-0112 token utilities’ HoldingOps documentation and adds return-path validation tests for L-05 and N-10, without changing production logic.
Changes:
- Clarifies operation-specific restrictions, recovery after lock expiry, and requirements for context-supplied policy contracts.
- Adds
unlockHoldingstests rejecting holdings with a mismatched administrator, mismatched account, or no lock. - Aligns the test module declaration with
Operations.damland updates its documentation reference.
| File | Description |
|---|---|
test/token-cip112-utils-test/daml/OpenZeppelin/Token/Cip112/Utils/Test/Operations.daml |
Corrects the module declaration to match the filename. |
test/token-cip112-utils-test/daml/OpenZeppelin/Token/Cip112/Utils/Test.daml |
Adds a return-path test harness and three validation tests; updates the module reference in a comment. |
packages/token/token-cip112-utils/README.md |
Clarifies operation restrictions and recovery options after lock expiry. |
packages/token/token-cip112-utils/daml/OpenZeppelin/Token/Cip112/Utils/Registry.daml |
Streamlines the batch-settlement privacy comment. |
packages/token/token-cip112-utils/daml/OpenZeppelin/Token/Cip112/Utils/Holding.daml |
Refines documentation for operation behavior, policy contracts, and expired-lock inputs. |
CHANGELOG.md |
Clarifies that each holding rule applies only to its operation’s paths. |
Review effort: Balanced
0xNeshi
force-pushed
the
audit-m1-02-l05
branch
from
November 19, 2026 10:37
20f5b0c to
56d7cac
Compare
The comment said that only the owner-unlock choice recovers refused locked funding once the lock expires. consumeUnlockedHolding also accepts an expired-lock holding as a factory input, which runs fundHolding. A refusal in one of deliverHolding and returnHolding also leaves the other operation's paths open.
The trust boundary repeated the claim that only the owner-unlock choice recovers refused locked funding once the lock expires. State the factory route through fundHolding and that a refusal in one operation leaves the other operation's paths open.
The submitter writes the choice context and is often the party the rule restrains. State that an operation reading a policy contract from the context fails when the entry is missing, and that the contract's presence is what permits the spend.
unlockHoldings used to reach the admin, account and lock checks through consumeLockedHolding, so the harness scripts for that function covered the return path too. It calls checkLockedHolding itself since the split, and no script reached that call. Add a harness choice for unlockHoldings and one script per check.
The comment said each operation takes the context the submitter passed. settleBatchImpl gives every Allocation_Settle an empty context, and the expiry choices of the default and example templates pass emptyChoiceContext.
The HoldingOps bullet said each operation receives the context the submitter passed, which is false for batch settlement and for the expiry choices.
State that an input may be a holding whose lock has expired, which is how the funding of an instruction or allocation that never completed reaches fundHolding. Drop the sentence that restated transaction atomicity.
The deliverHolding and returnHolding comments restated which paths a refusal blocks, which the record comment states once. The sentence on expireAllocationsImpl was a third copy of a rule that the function's own comment and the README trust boundary state.
The inline comment repeated the doc comment of settleBatchImpl: each deliverHolding call receives an empty context on batch settlement.
"So a spend rule runs only on its own paths" did not say whose paths. State it as its own sentence.
A rule that must hold funds after the lock expires is needed in the owner-unlock choice and in fundHolding, because the factories accept an input whose lock has expired. Say so where the README covers owner unlock, and drop the shorter copy from the refusal bullet.
The submitter chooses which policy contract the context carries. If the registry leaves an older contract active next to its replacement, the submitter passes whichever one permits the spend.
The HoldingOps comment, both READMEs and CHANGELOG.md call fundHolding, deliverHolding and returnHolding operations. The test module was the only place that called them hooks.
0xNeshi
force-pushed
the
audit-m1-02-l05-review-fixes
branch
from
November 19, 2026 10:41
ee6d8f4 to
37585bb
Compare
haseebrabbani
approved these changes
Nov 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Review fixes for #116
Towards #90