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

Remove subroutine tests #793

Closed
wants to merge 7 commits into from

Conversation

lightclient
Copy link
Member

This PR will remove tests for EIP-2315: Simple Subroutines. It also inverts the simple, valid case to ensure that client hasn't accidentally forgotten to disable the EIP.

This is my first contribution to this repository, so please forgive me for not knowing the process. I tested this change against a version of geth with 2315 included in Berlin (ethereum/go-ethereum@19d7a37) and one with it omitted (ethereum/go-ethereum#22414). This test failed with 2315 included and passed with it omitted.

The badOpcodes tests passes for both clients, but for different failure reasons (invalid semantics vs. unknown ops). I'm not sure if there is better way to capture that.

@qbzzt
Copy link
Collaborator

qbzzt commented Mar 3, 2021

This PR will remove tests for EIP-2315: Simple Subroutines. It also inverts the simple, valid case to ensure that client
hasn't accidentally forgotten to disable the EIP.

Has EIP-2315 been removed from Berlin? Do you have a cite to that effect?

The badOpcodes tests passes for both clients, but for different failure reasons (invalid semantics vs. unknown ops).
I'm not sure if there is better way to capture that.

Considering the EVM behaves the same in both cases (reverts the transaction), I don't think there is a way to check this.

@holgerd77
Copy link
Contributor

There is a suggestion to remove ethereum/pm#263. Let's please wait how this plays out until we proceed here.

@shemnon
Copy link
Contributor

shemnon commented Mar 4, 2021

This formulation only tests a EIP-2315 conformant usage of the opcodes, only triggering an invalid opcode at JUMPSUB (0x5c), and not checking JUMPDEST (0x5e) or RETSUB (0x5c). The other two opcodes are illegal to encounter without first encountering the JUMPSUB instruction. One by rule (you cannot increment into a JUMPDEST operation) and the next because the return stack is empty (RETSUB).

Should we keep the fillers for subroutineShallowReturnStackFiller.json and shouldErrorWhenSubroutineEnteredViaBeginSubFiller.json as those test are ones that test encountering those opcodes first? Are the failures observably different?

@shemnon
Copy link
Contributor

shemnon commented Mar 4, 2021

  • Blockchain tests with the EIP are still in place. Those need to be re-filled.
  • src/BlockchainTestsFiller/ValidBlocks/bcStateTests/testOpcodesFiller.yml needs to be updated for 5c, 5d, and 5e. This would address my concerns two comments above. src/BlockchainTestsFiller/ValidBlocks/bcStateTests/testOpcodesGen.js is what needs to be run
  • Filled tests that had their filler removed were not removed. Those need to be deleted

@shemnon
Copy link
Contributor

shemnon commented Mar 5, 2021

Still need to refill https://github.com/ethereum/tests/tree/develop/BlockchainTests/GeneralStateTests/stSubroutine. One more file change and 10 more file deletes.

Other than that Besu passes these tests when using this version - shemnon/besu@a577fe8

@lightclient
Copy link
Member Author

Thanks for the feedback @shemnon.

@lightclient
Copy link
Member Author

lightclient commented Mar 5, 2021

I believe I've made all the changes @shemnon recommended - please let me know if any other changes should be made. Thanks!

edit: given the CI is passing with what I assume to be a client with 2315 still enabled - something must be wrong somewhere with my changes. Any ideas? At minimum stSubroutine/simpleSubroutine should fail?

edit 2: I confirmed that geth t8n tool fails this test with 2315 enabled, so not sure what's going on in CI. The opcodeTest passes for both enabled and disabled version, so I am also not sure what is wrong with that.

@winsvega
Copy link
Collaborator

winsvega commented Mar 5, 2021

the test repo check is a little semantic check and that all tests are regenerated up to date with the fillers.
you need to run locally using geth t8ntool

"//code" : "This should jump into a subroutine, back out and stop.",
"code" : "(asm 0x04 JUMPSUB STOP BEGINSUB RETURNSUB)",
"//code" : "This should jump into a subroutine, store 0x01 at 0x00, back out and stop.",
"code" : "(asm 0x04 JUMPSUB STOP BEGINSUB 0x01 0x00 SSTORE RETURNSUB)",
Copy link
Collaborator

Choose a reason for hiding this comment

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

if there wouls be no subroutine opcodes I think those codes will be used for something else.
we can't really use beginsub returnsub anymore ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I can replace with :raw code?

Copy link
Member Author

Choose a reason for hiding this comment

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

I went with this approach in b38f7bd. Easy to remove if you prefer a different approach.

@winsvega
Copy link
Collaborator

winsvega commented Mar 5, 2021

I would make one PR removeingn the existing subroutine tests.
and another changing the opcode test files.

@lightclient
Copy link
Member Author

@winsvega updated to remove the opcode test file changes in this PR and moved them to #796.

@qbzzt
Copy link
Collaborator

qbzzt commented Mar 6, 2021

I'm sorry, but my git skills aren't up to grafting into this tree what I think it should have. I'll open another pull request.

@qbzzt qbzzt closed this Mar 6, 2021
@qbzzt qbzzt mentioned this pull request Mar 6, 2021
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.

5 participants