Open aslesarenko opened 1 year ago
Could be replaced with Global.deserialize[AvlTree] from #979 , with hardcoded bytes provided , and then CreateAvlTree opcode can be reused in future
Could be replaced with Global.deserialize[AvlTree]
Yes, in principle, but it will be less usable and less powerful, because all the parameters will be hidden under hex and also fixed as constants.
As a side note, the better way to introduce object creation is through constructors like
val tree = AvlTree()
where every type works like a name of the constructor (same as in Scala3).
With that said, this issue can be closed, as it can be covered by #981
You can construct bytes avl tree data bytes in the script as well, so they are not necessarily constant
The main point is to reduce new nodes / opcodes / complexity
The main point is to reduce new nodes / opcodes / complexity
Yes, that is why this issue can be closed regardless of what we decide about NewObject operation. I.e. it is better to add NewObject opcode, which will serve many usecases, instead of just this CreateAvlTree.
This new operation will allow creating AvlTree instances from parameters (which is not possible in v5.x)
Details https://github.com/ScorexFoundation/sigmastate-interpreter/blob/2b72f2fddcd9ceedd84aa6bb225d6717c04c4f48/interpreter/shared/src/main/scala/sigmastate/trees.scala#L207