Error using InvestorSettlementTrigger

Hey DAMLer’s, Happy New Year (especially to those already celebrating on the other side of world)!

I was testing the digital-asset/ ex-bond-issuance and came across an error during investor settlement step.

The issued Bond, approved by CSD:

Issue Sze: 100000
Issue Date: 01/01/2020
Maturity Date: 01/01/2028
Currency: USD
Denomination: 100
Coupon Rate: 0.05

The auction specs:

Start Date: 12/26/2019
End Date: 01/01/2020
Minimum Price: 98
Size: 100000

In the auction I placed six total bids, 2 each by Bank1, Bank2, and Bank3.

Bank1 Bids: (Price: 105, Quantity: 40000), (Price: 105.5, Quantity: 41000)
Bank2 Bids: (Price: 103, Quantity: 25000), (Price: 101, Quantity: 24000)
Bank3 Bids: (Price: 104, Quantity: 45000), (Price: 99, Quantity: 10000)

Based on the above, I would expect the price to settle @ 104 with Bank1 receiving 81,000 units, Bank2 receiving no units, and Bank3 receiving 19,000 units.

I have no trouble settling as Bank2 (receives no allocation, and unlocks bid cash) and Bank3 (receives 19,000 units, and excess cash is unlocked and returned).

However, when I settle as Bank1, the AuctionSettleRequest contract is consumed (it disappears), but the exchange of assets never occurs. All cash remains locked and no assets appear in their balance (I’d expect to see a small amount of cash, and 81,000 units of the bond). This is the error from the console where the triggers were running:

Command failed: Command interpretation error in LF-DAMLe: Interpretation error: Error: User abort: Locked cash should be sufficient to finalize settlement. Details: Last location: [DA.Internal.Assert:19], partial transaction: root node NodeId(14): NodeFetch(ContractId(00e05448b860a4afe01b6e3820bf663101ba409b37304a3b293c46ce85c8adf754),e8750bc69d5e0ecaebbaffb8cdd927015674be6753aa1c9e6a390d7ae68ff8cd:DA.Finance.Fact.Asset:AssetDeposit,Some(Location(5894d748a7e97b8fd49ca4dab20543066ad2fcfb4435ae2062cbc335bbb69734,DA.Internal.Prelude,$u002b$u002b,(380,25),(380,27))),Some(TreeSet(Bank1)),TreeSet(CentralBank),TreeSet(Bank1, CentralBank),None,false), root node NodeId(17): NodeCreate(ContractId(00c724cfb7753a38322d0b4ee145b5500baaaf2a94d74e1173a7bfafb15c38c74f),ContractInst(e8750bc69d5e0ecaebbaffb8cdd927015674be6753aa1c9e6a390d7ae68ff8cd:DA.Finance.Rule.Asset:AssetSettlementChain,ValueRecord(Some(e8750bc69d5e0ecaebbaffb8cdd927015674be6753aa1c9e6a390d7ae68ff8cd:DA.Finance.Rule.Asset:AssetSettlementChain),ImmArray((Some(masterAgreement),ValueRecord(Some(e8750bc69d5e0ecaebbaffb8cdd927015674be6753aa1c9e6a390d7ae68ff8cd:DA.Finance.Types:MasterAgreement),ImmArray((Some(id),ValueRecord(Some(e8750bc69d5e0ecaebbaffb8cdd927015674be6753aa1c9e6a390d7ae68ff8cd:DA.Finance.Types:Id),ImmArray((Some(signatories),ValueRecord(Some(5894d748a7e97b8fd49ca4dab20543066ad2fcfb4435ae2062cbc335bbb69734:DA.Next.Set:Set),ImmArray((Some(textMap),ValueTextMap(SortedLookupList((AuctionAgent,ValueUnit))))))),(Some(label),ValueText(DvPMasterSettleAuctionMaster)),(Some(version),ValueInt64(0))))),(Some(party1),ValueParty(Bank1)),(Some(party2),ValueParty(Issuer))))),(Some(tradeId),ValueRecord(Some(e8750bc69d5e0ecaebbaffb8cdd927015674be6753aa1c9e6a390d7ae68ff8cd:DA.Finance.Types:Id),ImmArray((Some(signatories),ValueRecord(Some(5894d748a7e97b8fd49ca4dab20543066ad2fcfb4435ae2062cbc335bbb69734:DA.Next.Set:Set),ImmArray((Some(textMap),ValueTextMap(SortedLookupList((Bank1,ValueUnit),(Issuer,ValueUnit))))))),(Some(label),ValueText(DvPMasterSettleAuctionTrade)),(Some(version),ValueInt64(0))))),(Some(asset),ValueRecord(Some(e8750bc69d5e0ecaebbaffb8cdd927015674be6753aa1c9e6a390d7ae68ff8cd:DA.Finance.Types:Asset),ImmArray((Some(id),ValueRecord(Some(e8750bc69d5e0ecaebbaffb8cdd927015674be6753aa1c9e6a390d7ae68ff8cd:DA.Finance.Types:Id),ImmArray((Some(signatories),ValueRecord(Some(5894d748a7e97b8fd49ca4dab20543066ad2fcfb4435ae2062cbc335bbb69734:DA.Next.Set:Set),ImmArray((Some(textMap),ValueTextMap(SortedLookupList((CentralBank,ValueUnit))))))),(Some(label),ValueText(USD)),(Some(version),ValueInt64(0))))),(Some(quantity),ValueNumeric(4264000.0000000000))))),(Some(steps),ValueList(FrontStack(ValueRecord(Some(e8750bc69d5e0ecaebbaffb8cdd927015674be6753aa1c9e6a390d7ae68ff8cd:DA.Finance.Rule.Asset:AssetSettlementStep),ImmArray((Some(sender),ValueParty(Bank1)),(Some(receiver),ValueParty(Issuer)),(Some(depositCid),ValueOptional(None)),(Some(creditSettlementCid),ValueContractId(ContractId(007c0c776bc3bfb3cfc47873ffc8b67cb9f41d6a41772c6e7f7a1ad9f3f52a7667))),(Some(debitSettlementCid),ValueContractId(ContractId(006414c7edb756eca47225a90c5dcd296e8b44e25ce2ac216896eaef5b9d22aa4e)))))))),(Some(observers),ValueRecord(Some(5894d748a7e97b8fd49ca4dab20543066ad2fcfb4435ae2062cbc335bbb69734:DA.Next.Set:Set),ImmArray((Some(textMap),ValueTextMap(SortedLookupList((Regulator,ValueUnit))))))))),),Some(Location(5894d748a7e97b8fd49ca4dab20543066ad2fcfb4435ae2062cbc335bbb69734,DA.Internal.Prelude,$u002b$u002b,(380,25),(380,27))),TreeSet(AuctionAgent),TreeSet(AuctionAgent, Bank1, Issuer, Regulator),None), root node NodeId(47): NodeExercises(ContractId(007b0e65f898a013fcccc043f3330e24d6c99ad086347010f9e755f3cff0983e68),e8750bc69d5e0ecaebbaffb8cdd927015674be6753aa1c9e6a390d7ae68ff8cd:DA.Finance.Rule.Asset:AssetFungible,AssetFungible_Merge,Some(Location(5894d748a7e97b8fd49ca4dab20543066ad2fcfb4435ae2062cbc335bbb69734,DA.Internal.Prelude,$u002b$u002b,(380,25),(380,27))),false,TreeSet(Bank1),ValueRecord(Some(e8750bc69d5e0ecaebbaffb8cdd927015674be6753aa1c9e6a390d7ae68ff8cd:DA.Finance.Rule.Asset:AssetFungible_Merge),ImmArray((S..., code: 3 (context: {triggerDefinition=170c25c1822e97ba83d08d4fcf443be21fcd7cc305f37659d8c9ba6aab2c6842:DA.RefApps.Bond.Triggers.InvestorSettlementTrigger:investorSettlementTrigger})

It seems like all of the locked cash (for both successful bids) is trying to be returned to the bidder after recognizing the first successful bid, not leaving any locked cash to account for the second successful bid.

Has anyone else observed this error?

1 Like

Hi @jamesljaworski85, and happy new year!

I’m having a look at this now and I am having a similar issue - not quite the same.

Sorry if I’m asking you to repeat yourself, but I want to make sure the behaviour I’m observing is different from your case:

  • After pressing the ‘settle’ button, can you see the cash adjustment under the ‘balances’ tab, or do you still see the original cash balance?
  • Can you just re-confirm you don’t see a line for the new bond, under the cash?
  • You said the AuctionSettleRequest disappears. There should be two of these; one for each bond. Are they both archived, or just one?
  • Can you see any active LockedCash contracts (you can check through the navigator on localhost:7500).
  • Can you confirm whether the sandbox goes into an infinite loop, retrying the transaction constantly? Or do you just see the error message once?
  • Can you tell me what version (git hash) you are using, and whether you adjusted the code in any way?

Finally, you said:

I’d expect to see a small amount of cash

Can you expand on ‘a small amount’? When running the example, Bank1 starts off with $50m in their account; the nominal of the bonds is a fraction off this, so there should be ‘a lot’ of cash left?

So just for posterity, I’m seeing a similar case, but:

  • The cash is being adjusted.
  • The AuctionSettleRequest contracts are still active.
  • No bond deposit is created
  • The sandbox log keeps printing the aforementioned error continuously.

Hey @Luciano! Thanks for working through this with me :grinning:. It looks like we are observing largely the same behavior. I clarify a few of your questions below.

1-4. I made a small mistake when describing the error for Bank1.
There are 2 AuctionSettleRequest contracts as expected and there is 1 AuctionParticipantSettleRequest (where a list of the AuctionSettleRequest contracts are packaged in the settleRequestCids field). Here is the view of the balance tab and the settle tab prior to executing the 'Settle` choice.

And now after executing the settle choice:

Similar to previous, Bank2 (placing 1 winning bid, and 1 losing bid) and Bank3 (placing 0 winning bids, 2 losing bids) are able to settle completely. I can see the bond deposited in the bond account and the unlocked cash returned from each situation. The error only seems to occur when a bidder has at two winning bids.

5. I observe the infinite error loop.

6. I did not adjust the daml model in any way. I downloaded the most recent zip file as of 12/31 from the ex-bond-issuance repo. I also did not change any of the ui (except for adding the additional contract views shown above).

And for the second piece…

The only thing I am not observing is the cash being adjusted (for Bank1, the party placing two winning bids).

I can see the cash adjustment for Bank2 (1 winning bid, 1 losing bid) and Bank3 (0 winning bids, 2 losing bids).

1 Like

Hey James, we’ve identified the problem and I’m tracking it here


Awesome. You all rock!