Check for correct rollback of init code with side effects#844
Check for correct rollback of init code with side effects#844winsvega merged 1 commit intoethereum:developfrom
Conversation
| ":raw 0x32ff", | ||
| ":label invalid_first_byte_ef :raw 0xef" | ||
| ":label invalid_first_byte_ef :raw 0xef", | ||
| ":label side_effects_invalid_opcode :yul { pop(call(50000, 0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b, 0, 0, 0, 0, 0)) invalid() }" |
There was a problem hiding this comment.
here is tricky to know that the call worked.
if its not requred to call revert directly in transaction init data field.
the way to do it is to go subcall.
transaction init -> call -> do smth. revert. | continue execution. sstore smth.
this way revert should cause only a subcall going oog and we can confirtm that execution happend by putting a sstore at the end of transaction init code.
There was a problem hiding this comment.
or you can have a control transaction with exactly the same data, but this time without invalid() instruction at the end.
so we check that the call (50000, ... worked as at some point 50000 might be not enough and it will just go OOG not testing what we wanted
There was a problem hiding this comment.
I don't want to test here reverts inside subcalls, becasue this file is all about init code in the creation transaction.
(Although other similar tests to check reverts inside CREATEs might be useful.)
So I prefer to add another similar transaction with the same side effect, but without revert.
69d0a7d to
eac7125
Compare
| ":raw 0x32ff", | ||
| ":label invalid_first_byte_ef :raw 0xef" | ||
| ":label invalid_first_byte_ef :raw 0xef", | ||
| ":label side_effects :yul { pop(call(50000, 0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b, 0, 0, 0, 0, 0)) }" |
There was a problem hiding this comment.
This was missing a comma in the end of the line, how did it work and didn't complain? @winsvega
Did it consider this a concatenation of two strings?
There was a problem hiding this comment.
this PR however fails on master geth. which version did you fill it with?
There was a problem hiding this comment.
this PR however fails on master geth. which version did you fill it with?
It was this commit according to generated test
ethereum/go-ethereum@addd882
There was a problem hiding this comment.
The current develop version of this test passes for me with latest geth ethereum/go-ethereum@017cf71
This adds a test that checks that exceptional abort during init code correctly rolls back side effects.
The transaction
CALLs a contract thatSSTOREs0 -> 1, then transaction ends withINVALID. Storage change in a contract is expected to be rolled back.(In #835 I'm adding a similar test that rolls back after exceptional abort due to trying to deploy
0xefbyte in London.)