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

AVM: Add box_splice and box_resize opcodes #5750

Merged
merged 3 commits into from Dec 4, 2023

Conversation

jannotti
Copy link
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.

@codecov
Copy link

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

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.

jasonpaulos
jasonpaulos previously approved these changes Nov 20, 2023
Copy link
Member

@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

data/transactions/logic/doc.go Show resolved Hide resolved
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)
@jannotti jannotti merged commit ed278b8 into algorand:master Dec 4, 2023
18 checks passed
@jannotti jannotti deleted the box-splice branch December 4, 2023 20:27
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.

None yet

6 participants