Skip to content

Conversation

@fjl
Copy link
Collaborator

@fjl fjl commented Sep 30, 2024

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.

Copy link
Contributor

@mkalinin mkalinin left a 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]
Copy link
Member

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

@fjl fjl Sep 30, 2024

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.

Copy link
Member

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.

Copy link
Collaborator Author

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.

@marioevz
Copy link
Member

marioevz commented Oct 2, 2024

Do we want this as part of Devnet-4?

@mkalinin
Copy link
Contributor

mkalinin commented Oct 3, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants