Skip to content

AVM: Add box_splice and box_resize opcodes#5750

Merged
jannotti merged 3 commits intoalgorand:masterfrom
jannotti:box-splice
Dec 4, 2023
Merged

AVM: Add box_splice and box_resize opcodes#5750
jannotti merged 3 commits intoalgorand:masterfrom
jannotti:box-splice

Conversation

@jannotti
Copy link
Copy Markdown
Contributor

These opcodes simplify working with large boxes. There are simple combinations of existing codes to do the equivalent on boxes smaller than 4k. But they require moving box content into AVM values that cannot exceed 4k. So, for big boxes it is useful to have these operations.

Both opcodes seem convenient, but not quite necessary, for smaller boxes.

Comment thread data/transactions/logic/README.md Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 21, 2023

Codecov Report

Attention: 11 lines in your changes are missing coverage. Please review.

Comparison is base (ae133b8) 55.86% compared to head (ba9abf9) 55.91%.

Files Patch % Lines
data/transactions/logic/opcodeExplain.go 0.00% 6 Missing ⚠️
data/transactions/logic/box.go 94.11% 2 Missing and 2 partials ⚠️
data/transactions/logic/eval.go 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5750      +/-   ##
==========================================
+ Coverage   55.86%   55.91%   +0.05%     
==========================================
  Files         477      477              
  Lines       67259    67333      +74     
==========================================
+ Hits        37576    37652      +76     
+ Misses      27133    27127       -6     
- Partials     2550     2554       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@d13co
Copy link
Copy Markdown

d13co commented Sep 22, 2023

Big fan of this! Working with a 16KB box for the Exa shuffle was a bit of a pain, having to iterate 4KB chunks and do careful arithmetic. Doable, but tedious and kind of unnecessary.

@jannotti jannotti marked this pull request as ready for review November 20, 2023 18:27
@jannotti jannotti requested a review from jasonpaulos November 20, 2023 18:27
jasonpaulos
jasonpaulos previously approved these changes Nov 20, 2023
Copy link
Copy Markdown
Contributor

@jasonpaulos jasonpaulos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes and tests look good to me, just one small docs question

Comment thread data/transactions/logic/doc.go Outdated
These opcodes simplify working with large boxes. There are simple
combinations of existing codes to do the equivalent on boxes smaller
than 4k. But they require moving box content into AVM values that
cannot exceed 4k. So, for big boxes it is useful to have these
operations. (box_splice may also be a nice convenience, even for small
boxes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants