Skip to content

L-05, N-10: Correct the HoldingOps docs and test the return-path checks - #134

Merged
0xNeshi merged 14 commits into
audit-m1-02-l05from
audit-m1-02-l05-review-fixes
Nov 19, 2026
Merged

0xNeshi merged 14 commits into
audit-m1-02-l05from
audit-m1-02-l05-review-fixes

Conversation

@0xNeshi

@0xNeshi 0xNeshi commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

Review fixes for #116

Towards #90

@0xNeshi 0xNeshi self-assigned this Nov 19, 2026
Copilot AI balanced review requested due to automatic review settings November 19, 2026 10:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 unlockHoldings tests rejecting holdings with a mismatched administrator, mismatched account, or no lock.
  • Aligns the test module declaration with Operations.daml and 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

Copilot AI balanced review requested due to automatic review settings November 19, 2026 10:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the contract clarifications and added return-path validation tests.

No open issues 🎉

Review effort: Balanced

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
0xNeshi force-pushed the audit-m1-02-l05-review-fixes branch from ee6d8f4 to 37585bb Compare November 19, 2026 10:41
Copilot AI balanced review requested due to automatic review settings November 19, 2026 10:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the documentation clarifications and added unlock-validation tests.

No open issues 🎉

Review effort: Balanced

@0xNeshi
0xNeshi merged commit 7496f3d into audit-m1-02-l05 Nov 19, 2026
8 checks passed
@0xNeshi
0xNeshi deleted the audit-m1-02-l05-review-fixes branch November 19, 2026 12:38
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.

3 participants