Skip to content

Tests for EIP-3541#835

Merged
winsvega merged 7 commits intoethereum:developfrom
ewasm:eip-3541
May 22, 2021
Merged

Tests for EIP-3541#835
winsvega merged 7 commits intoethereum:developfrom
ewasm:eip-3541

Conversation

@gumb0
Copy link
Copy Markdown
Member

@gumb0 gumb0 commented Apr 29, 2021

Reject new contracts starting with the 0xEF byte https://eips.ethereum.org/EIPS/eip-3541

Imlementation is merged in geth ethereum/go-ethereum#22809

gas: !!int -1
value: !!int -1
network:
- 'Berlin'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would this work?

Suggested change
- 'Berlin'
- '<=Berlin'

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Nonce for created accounts was 0 before state-clearing fork, so we would need either make tests a bit more complicated with another nonce expectation for old forks, or remove nonce expectation, or list only forks starting from SpuriousDragon.

But it looks usual in new tests to check only new behaviour and maximum of one previous fork, not caring about repeating it for old forks with the same rules. @winsvega can correct me if it's not ok approach.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes because we have copy of the tests in legacy with old forks expect section. However new tests are targeting only recent forks (as also pointed out by Alexy Akhunov)

Since we already have client consensus with existing tests, no really need to cover previous forks.

You can use a sstore operation and check that it worked (instead of nonce)

Another issue when having tests with 5 or more forks it takes more time to generate and run it. So I plan to archive tests from time to time refreshing the expect section to the most recent fork only.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

for full node implementation IMHO it is good to have tests that check that new changes does not break anything in the past. so if you really think we should check it here we can make an exception.

transaction:
data:
#- ':yul { mstore8(0, 0xef) return(0, 1) }'
- ':label deploying_0xef :raw 0x60ef60005360016000f3'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yul didn't work?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It did, I just wanted to show raw code here, maybe include it in EIP text.

@gumb0 gumb0 force-pushed the eip-3541 branch 2 times, most recently from 156db28 to 22be707 Compare May 3, 2021 14:41
Comment thread src/GeneralStateTestsFiller/stTransactionTest/Opcodes_TransactionInitFiller.json Outdated
@gumb0
Copy link
Copy Markdown
Member Author

gumb0 commented May 4, 2021

@winsvega On the last ACD call EIP-3541 was "accepted for London unless anyone objects on the next call", so I think it would be ok to start reviewing it.

I will keep PR in draft until EIP is accepted.

@gumb0 gumb0 requested a review from winsvega May 4, 2021 16:49
@axic
Copy link
Copy Markdown
Member

axic commented May 4, 2021

I will keep PR in draft until EIP is accepted.

Just to shrink the size, do you think it makes sense splitting this and merging the non-London specific tests? i.e. would that just mean a test creating a contract with every single starting byte from 0x00 to 0xff?

@gumb0
Copy link
Copy Markdown
Member Author

gumb0 commented May 4, 2021

I will keep PR in draft until EIP is accepted.

Just to shrink the size, do you think it makes sense splitting this and merging the non-London specific tests? i.e. would that just mean a test creating a contract with every single starting byte from 0x00 to 0xff?

Everything could be merged if we remove London expectations.
But I guess tests that deploy 0xef00...00 contracts would not be very interesting for Berlin.
Tests that deploy all possible starting bytes might be.
And the test undefinedOpcodeFirstByte which checks already deployed contracts behaviour is kind of independent.

I would leave for @winsvega to decide how it would be convenient to split this, if needed.

@winsvega
Copy link
Copy Markdown

winsvega commented May 4, 2021

If there is no London specific logic we can keep the test under any name. Tests fork configs are now translatable with clients configs in retesteth config dir

@winsvega
Copy link
Copy Markdown

winsvega commented May 4, 2021

Is this eip enabled in Aleut?

@gumb0
Copy link
Copy Markdown
Member Author

gumb0 commented May 10, 2021

@gumb0 gumb0 force-pushed the eip-3541 branch 2 times, most recently from 0a94b64 to 6fdc1e5 Compare May 19, 2021 12:20
@gumb0
Copy link
Copy Markdown
Member Author

gumb0 commented May 19, 2021

@winsvega I have added currentBaseFee required by the latest change in test format and regenerated tests with the latest geth and retesteth. I think this is ready for review.

The commit Generate London cases for stTransactionTest/Opcodes_TransactionInit is separate only to make simpler the diff for the last commit Init code failing to deploy EF byte and rolling back the side effects.

@gumb0 gumb0 marked this pull request as ready for review May 19, 2021 12:27
Comment thread src/GeneralStateTestsFiller/stTransactionTest/Opcodes_TransactionInitFiller.json Outdated
Copy link
Copy Markdown

@winsvega winsvega left a comment

Choose a reason for hiding this comment

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

I think this looks really good now.
It is great to have contributions from EIP developers finaly.
Great thanks to Ori and his documentation.

@winsvega winsvega added the ready-to-merge PR is ready to merge and not WIP label May 19, 2021
@winsvega winsvega requested a review from axic May 19, 2021 21:28
@winsvega winsvega merged commit b0ef527 into ethereum:develop May 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge PR is ready to merge and not WIP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants