Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v6.0] Implement new CreateAvlTree operation #907

Open
aslesarenko opened this issue Aug 19, 2023 · 5 comments
Open

[v6.0] Implement new CreateAvlTree operation #907

aslesarenko opened this issue Aug 19, 2023 · 5 comments
Labels
A-consensus Area: Code used in consensus (i.e. transaction validation) C-feature Category: Feature request or PR
Milestone

Comments

@aslesarenko
Copy link
Member

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

@aslesarenko aslesarenko added A-consensus Area: Code used in consensus (i.e. transaction validation) C-feature Category: Feature request or PR labels Aug 19, 2023
@aslesarenko aslesarenko added this to the v6.0 milestone Aug 19, 2023
@kushti
Copy link
Member

kushti commented May 13, 2024

Could be replaced with Global.deserialize[AvlTree] from #979 , with hardcoded bytes provided , and then CreateAvlTree opcode can be reused in future

@aslesarenko
Copy link
Member Author

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

@kushti
Copy link
Member

kushti commented May 13, 2024

You can construct bytes avl tree data bytes in the script as well, so they are not necessarily constant

@kushti
Copy link
Member

kushti commented May 13, 2024

The main point is to reduce new nodes / opcodes / complexity

@aslesarenko
Copy link
Member Author

aslesarenko commented May 13, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-consensus Area: Code used in consensus (i.e. transaction validation) C-feature Category: Feature request or PR
Projects
None yet
Development

No branches or pull requests

2 participants