Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default Instruction implementation allows invalid CreditReceiver allocation #1247

Open
kindofdev opened this issue Nov 16, 2024 · 0 comments

Comments

@kindofdev
Copy link

Hello, I think there's an issue on CreditReceiver allocation.
The way is implemented allows the following scenario:

-- 
--  INSTRUCTION:
-- 
--            bank
--  sender ---------> receiver
--
--
--  ACCOUNTS:
-- 
--              bank
--           /         \
--    sender         receiver
--
--  bank allocates with CreditReceiver
--  
--

For instance:

-- Allocate instruction
  (cashInstructionCid, _) <- submit bank do
    exerciseCmd cashInstructionCid Instruction.Allocate with
      actors = Set.singleton bank; allocation = CreditReceiver

  -- Approve instruction
  cashInstructionCid <- submit receiver do
    exerciseCmd cashInstructionCid Instruction.Approve with
      actors = Set.singleton receiver; approval = TakeDelivery receiverAccount

  -- Settle batch
  submitMultiMustFail [bank] [publicParty] do
    exerciseCmd batchCid Batch.Settle with actors = Set.singleton bank

 CreditReceiver -> do
   allMustAuthorize $ Set.singleton routedStep.custodian
   pure allocation

I would say that the code bellow might fix the issue:

 CreditReceiver -> do
   allMustAuthorize $ Set.singleton routedStep.custodian
   mustBe this Custodian routedStep.sender
   pure allocation
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

No branches or pull requests

1 participant