soysor
05/10/2023, 6:34 AMgreenhat
05/10/2023, 7:52 AMSELF.getReg(i)
method. @morphic Does it work?morphic
05/10/2023, 12:16 PMgreenhat
05/10/2023, 12:42 PMBoolToSigmaProp(SigmaOr(pk1, pk2))
. I believe it should crash on evaluation since BoolSigmaProp
should only accept bool. Am I right? Or does sigmastate skip BoolToSigmaProp
evaluation in such case?morphic
05/10/2023, 1:17 PMgreenhat
05/10/2023, 1:41 PMmorphic
05/10/2023, 2:37 PMmorphic
05/10/2023, 2:38 PMgreenhat
05/10/2023, 2:40 PMgreenhat
05/10/2023, 2:47 PMmorphic
05/10/2023, 3:07 PMgreenhat
05/10/2023, 3:12 PMsoysor
05/11/2023, 4:49 AMval actualValue = map.get(expectedKey, proof).get
Which ultimately seems to be failing here during eval of `SAvlTree.get`: https://github.com/input-output-hk/scrypto/blob/d925f9357d3a3f2ee2b3f1be5d7b82f1eb8f8b54/shared/src/main/scala/scorex/crypto/authds/avltree/batch/BatchAVLVerifier.scala#L249
with topNode == None
Am I misunderstanding something about how to use AVL trees or not doing the insert correctly or something else? I can use PlasmaMap.lookUp
offchain and can see the value exists offchain at leastsoysor
05/11/2023, 4:57 AMCheese Enthusiast
05/11/2023, 5:05 AM.get
method in your contract. .get
requires a lookup proof. Changing the context var to this fixes the problem:
scala
.withContextVars(new ContextVar(0.toByte, expectedValueResult.proof.ergoValue))
Cheese Enthusiast
05/11/2023, 5:11 AM.insert
method.soysor
05/11/2023, 5:14 AMColl()
?
Thanks a lot for the helpCheese Enthusiast
05/11/2023, 5:27 AMinsertion.proof.ergoValue
which is what you have written already. The error you're getting is likely happening because you are placing the already modified AVL Tree into the register of the UTXO. You're then calling .insert
on this AVL Tree while providing an insertion proof that was built when the AVL Tree had nothing inside of it.
Fixing the issue simply requires you re-arrange your code.
scala
val tb = ctx.newTxBuilder()
// This AVL Tree is currently empty
val map = new PlasmaMap[String, String](AvlTreeFlags.AllOperationsAllowed, PlasmaParameters.default)
var inBox =
tb
.outBoxBuilder
.value(100000000000000000L)
.registers(map.ergoValue) // Empty AVL Tree is used in register
.contract(ctx.compileContract(ConstantsBuilder.empty(), script))
.build()
.convertToInputWith("f9e5ce5aa0d95f5d54a7bc89c46730d9662397067250aa18a0039631c0f5b807", 1)
val insertion = map.insert(("40e9e6112fc16e191e69d042890945b97a3eb30bccd3f39d5a07ee5e91b5fbbc", "01")) // Insertion is performed on the AVL Tree
// thereby modifying it's contents/digest
inBox = inBox.withContextVars(new ContextVar(0.toByte, insertion.proof.ergoValue)) // Providing proof for insertion onto an empty tree
Cheese Enthusiast
05/11/2023, 5:29 AMsoysor
05/11/2023, 5:34 AMdΣathgripson
05/24/2023, 9:33 PM"additionalRegisters": {
"R4": "0e200fe3ac722831c0e09e54f55ec842654d70ab97557af2758b598acfb802b7a7a0",
"R5": "0e2062f2807734a96f9d7a6620043c9c687891723c3003d16a32741533da17148f05",
"R6": "070224fd451e88b9ce0ec33e6fcba78689add93310922d950e66517fdf5b7e744bb8",
"R7": "0702a16aca13b7072c1608209b6d8d1dd96be2b6912db9d998e49504f800905ea9f3"
},
MGpai
05/24/2023, 11:12 PMMGpai
05/24/2023, 11:12 PMdΣathgripson
05/24/2023, 11:15 PMblockchain/transaction/byAddress
i just separated the registers section from the whole txdΣathgripson
05/25/2023, 1:44 AMMGpai
05/25/2023, 3:57 AMMGpai
05/25/2023, 3:57 AMlgd
05/26/2023, 2:21 AMdΣathgripson
05/26/2023, 2:21 AM