-
Notifications
You must be signed in to change notification settings - Fork 17
consolidations, withdrawals: return type byte at start of output #25
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
| mul ;; [record_offset, i, count, head_idx, tail_idx] | ||
| mul ;; [offset, i, count, head_idx, tail_idx] | ||
| push 1 ;; [1, offset, i, count, head_idx, tail_idx] | ||
| add ;; [record_offset, i, count, head_idx, tail_idx] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it is better to add a loop-level item record_offset and just add RECORD_SIZE during each iteration. Feels weird to +1 every calculation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, so that would work as well. Let me know if you prefer this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I even thought about turning the whole thing around to keep the offset permanently near the stack top and increment after every store. But then we'd need to find a clean way to hoist up the items from below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh looking into this more, this is pretty straightforward and understandable implementation. I think we can merge as-is and decide later if it makes sense to optimize it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's less about optimizing and more about correctness. The advantage of a rolling offset is that we only need to add the length of the current item after writing the item. It removes the hard-coded offsets. But I can look into this as a refactoring after this PR is in.
eb0fccb to
7371e59
Compare
|
Do we want this as part of Devnet-4? |
Yes, I believe we want requests design to be settled down with its latest version becoming a part of devnet-4 |
This is an alternative to #22. It is better to return the request type only once, at the start of return data, to avoid the theoretical possibility where a contract could return multiple different event types.