Skip to content

L-05: Split consumeHolding into fund, deliver and return operations - #116

Open
haseebrabbani wants to merge 2 commits into
mainfrom
audit-m1-02-l05
Open

haseebrabbani wants to merge 2 commits into
mainfrom
audit-m1-02-l05

Conversation

@haseebrabbani

Copy link
Copy Markdown
Collaborator

Closes #90. Addresses L-05 and N-10.

Changes

  • Replaced HoldingOps.consumeHolding with fundHolding (factory inputs), deliverHolding (accept, settle) and returnHolding (reject, withdraw, expire, allocation withdraw, cancel). Each takes the exercising choice's ChoiceContext and the holding id.
  • Every workflow body passes its extraArgs.context to the operation it calls. transferExpireImpl and executeTransfer gain a context parameter. The v1 and custom expire choices pass emptyChoiceContext because their operations read none; CIP112: settleBatchImpl: forward each authorizer's own context to its Allocation_Settle #82 threads a real one.
  • Added holdingOpsFor @t createHolding withEventLog eventObservers, which sets all three operations to consumeByArchive @t. defaultHoldingOps and the custom myOps use it.
  • Custom example: fundHolding and deliverHolding exercise MyHolding_Spend; returnHolding stays the pinned archive.
  • Docs: per-operation paths and laws, liftable-rule and context-reading guidance, the empty batch-settlement context, whole-batch expiry failure, and owner unlock running outside the operations, in HoldingOps, the utils README.md, the custom example and CHANGELOG.md.

Notes

@0xNeshi 0xNeshi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Change requests applied in: https://github.com/OpenZeppelin/canton-contracts/pull/134/changes, to be merged into this branch

Replace HoldingOps.consumeHolding with fundHolding (caller-supplied inputs),
deliverHolding (locked funding paid out on accept and settle) and
returnHolding (locked funding returned on reject, withdraw, expire, cancel).
Each takes the exercising choice's ChoiceContext, so a spend rule runs only
on its own paths and can read the submitter's context (N-10).

Add holdingOpsFor @t and build the default operations with it. The custom
example exercises MyHolding_Spend on funding and delivery and archives on
returns, so a freeze never holds back locked funds returning to their owner.

Closes #90
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.

[M1: Audit 2: L-05]: Split consumeHolding into a fund, deliver and returns hooks

2 participants