Skip to content

Commit aa545be

Browse files
committed
Update UtxoAccumulator script
1 parent ded4f44 commit aa545be

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

.vscode/settings.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"haskell.manageHLS": "GHCup",
33
"haskell.toolchain": {
4-
"hls": "2.9.0.1",
4+
"hls": "2.10.0.0",
55
"cabal": "3.14.2.0",
6-
"ghc": "9.6.6",
6+
"ghc": "9.6.7",
77
"stack": null
8-
},
8+
},
99
"haskell.formattingProvider": "stylish-haskell"
1010
}

zkfold-cardano-scripts/src/ZkFold/Cardano/UPLC/UtxoAccumulator.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
module ZkFold.Cardano.UPLC.UtxoAccumulator where
99

1010
import GHC.Generics (Generic)
11+
import PlutusLedgerApi.V1.Value (geq)
1112
import PlutusLedgerApi.V3 (Address, Datum (..), OutputDatum (NoOutputDatum, OutputDatum),
1213
Redeemer (..), ScriptContext (..), ToData (..), TxInInfo (..),
1314
TxInfo (..), TxOut (..), Value)
@@ -75,10 +76,12 @@ utxoAccumulator accumulationValue (RemoveUtxo addr l proof dat') ctx =
7576
v' = v - accumulationValue
7677

7778
outputAcc = head $ txInfoOutputs $ scriptContextTxInfo ctx
78-
outputUser = head $ tail $ txInfoOutputs $ scriptContextTxInfo ctx
79+
TxOut outputAddr outputValue NoOutputDatum Nothing =
80+
head $ tail $ txInfoOutputs $ scriptContextTxInfo ctx
7981
in
8082
outputAcc == TxOut ownAddr v' (OutputDatum (Datum d')) Nothing
81-
&& outputUser == TxOut addr accumulationValue NoOutputDatum Nothing
83+
&& outputAddr == addr
84+
&& outputValue `geq` accumulationValue
8285
&& verify @PlonkupPlutus setup [] proof
8386
&& nextDatumHash == blake2b_224 (serialiseData $ toBuiltinData dat')
8487

0 commit comments

Comments
 (0)