Marlowe Pioneer
 
w0802_cbg
220220924

Issue, as posted on discord under the title “Coupon Bond Guaranteed”

Has anybody tried to implement the example “Coupon Bond Guaranteed” on the testnet ? (how to get this example contract: open blockly in the marlowe playground -> open example -> choose “Coupon Bond Guaranteed” as “blockly”)

I’ve tried to implement it using marlowe-cli and cardano-cli on the 1567 testnet, and I kept on failing on the step where the last installment is paid, which is script 402 in following list:

    102_create_contract.sh
    104_lender_funds_contract.sh
    106_guarantor_deposit.sh
    108_lender_deposit.sh
    110_borrower_withdraws.sh
    202_borrower_pays_installment1.sh
    204_lender_withdraws.sh
    206_guarantor_withdraws.sh
    302_borrower_pays_installment2.sh
    304_lender_withdraws.sh
    306_guarantor_withdraws.sh
!!  402_borrower_pays_installment3.sh --> FAILS EVERY TIME !!!
    404_lender_withdraws.sh
    406_guarantor_withdraws.sh 

The error I kept running into: TxBodyScriptExecutionError [(ScriptWitnessIndexTxIn 0,ScriptErrorEvaluationFailed (CekError An error has occurred: User error: The provided Plutus code called ‘error’.) [“R”,“PT5”])]

The problem in step 402 is that 2 separate payments are made to the lender: the principal+instalment AND the minimum_ada (the latter is the amount used to fund the contract).

After lots of experimentation I managed to change the contract such that it succeeds, but I don’t know if this is a desired modification. The included screenshot explains best what I did to get it to work (note: the screenshot only shows the relevant part of the contract).

For ref: cardano-cli 1.34.1 | marlowe-cli 0.0.4.4 | MAGIC=1567

End of message posted on discord

Transcript of both runs

  • For transcript of the run with the modified contract, see w0802s_cbg, this is the one that succeeded.
  • For transcript of the run with the original contract, see w0802f_cbg, this is the one that failed.

Note: the amounts (principal, installment, fund_amount) for the above have been changed, ie. the amounts in the above diagram do not reflect the transcripts.

Update: add another role

Later on in the weekend I discovered that the original contract can be successfully run when introducing another party/role, eg ‘patron’ that funds the contract.

  • The transcript of this run (with the original contract), is here: w0802t_cbg. To confirm: yes this one succeeds.
 
Notes by wmoco. Generated on momo:/home/willem/sync/20220806_wmoco_pubcoms/20220806_marlowe_pioneer at 2023-06-14 18:32