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

eip-2315: updated spec and examples #2576

Merged
merged 5 commits into from
Apr 3, 2020
Merged

Conversation

holiman
Copy link
Contributor

@holiman holiman commented Mar 30, 2020

This PR changes 2315. I've had some discussions with @gcolvin about this, and he asked me to take co-authorship over 2315 and try to get the spec in order.
This PR changes a couple of things:

  • More strict definition of the opcodes,
  • Spec-level introduction of return_stack,
  • More examples,
  • Removal of that end-of-stack prefilled item on the return_stack

EIPS/eip-2315.md Show resolved Hide resolved
EIPS/eip-2315.md Outdated Show resolved Hide resolved
|-------|-------------|------|-----------|-----------|
| 0 | PUSH1 | 3 | [] | [] |
| 2 | JUMPSUB | 8 | [4] | [] |
| 4 | BEGINSUB | 1 | [] | [ 2] |
Copy link
Member

Choose a reason for hiding this comment

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

Should it not be [3] on RStack here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, right. So the geth-implementation currently pushes the pc, and then jumps to +1 from there. Which is not what the spec says.

|-------|-------------|------|-----------|-----------|
| 0 | PUSH9 | 3 | [] | [] |
| 10 | JUMPSUB | 8 | [12] | [] |
| 12 | BEGINSUB | 1 | [] | [10] |
Copy link
Member

Choose a reason for hiding this comment

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

and [11] here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. These were all generated by the actual geth evm, so I'll regenerate them when I update the code

6 7 RETURNSUB [] [1]
7 5 BEGINSUB [] [1]
8 6 RETURNSUB [] [1]
Error: at pc=0, op=RETURNSUB: evm: invalid retsub
Copy link
Member

Choose a reason for hiding this comment

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

I know there is no firm convention around EVM errors yet (even though that would be nice!), but I would probably call this a stack underflow instead of invalid retsub.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We already have a stack underflow, so I wanted a different message. However, it's an implementation detail in geth

Copy link
Member

Choose a reason for hiding this comment

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

okok, if the intention is to make a new error msg, then that seems appropriate.

EIPS/eip-2315.md Outdated Show resolved Hide resolved
EIPS/eip-2315.md Outdated Show resolved Hide resolved
@holiman holiman merged commit 8203a9d into ethereum:master Apr 3, 2020
pizzarob pushed a commit to pizzarob/EIPs that referenced this pull request Jun 12, 2020
* eip-2315: updated spec and examples

* eip-2315: formatting nits

* Update EIPS/eip-2315.md

* Update EIPS/eip-2315.md

Co-Authored-By: Andrei Maiboroda <[email protected]>

* Update EIPS/eip-2315.md

Co-Authored-By: MrChico <[email protected]>

Co-authored-by: Andrei Maiboroda <[email protected]>
Co-authored-by: MrChico <[email protected]>
tkstanczak pushed a commit to tkstanczak/EIPs that referenced this pull request Nov 7, 2020
* eip-2315: updated spec and examples

* eip-2315: formatting nits

* Update EIPS/eip-2315.md

* Update EIPS/eip-2315.md

Co-Authored-By: Andrei Maiboroda <[email protected]>

* Update EIPS/eip-2315.md

Co-Authored-By: MrChico <[email protected]>

Co-authored-by: Andrei Maiboroda <[email protected]>
Co-authored-by: MrChico <[email protected]>
Arachnid pushed a commit to Arachnid/EIPs that referenced this pull request Mar 6, 2021
* eip-2315: updated spec and examples

* eip-2315: formatting nits

* Update EIPS/eip-2315.md

* Update EIPS/eip-2315.md

Co-Authored-By: Andrei Maiboroda <[email protected]>

* Update EIPS/eip-2315.md

Co-Authored-By: MrChico <[email protected]>

Co-authored-by: Andrei Maiboroda <[email protected]>
Co-authored-by: MrChico <[email protected]>
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