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

core/vm: implement eof opcodes #30511

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

MariusVanDerWijden
Copy link
Member

@MariusVanDerWijden MariusVanDerWijden commented Sep 26, 2024

based on #30418
rework of #29518

I could not test this properly yet, as the validity of the blockchain tests depend on the prague spec. In order to test this correctly, we need to upstream 6110 and 7002

Unfortunately I couldn't preserve the authorship, I think by using the coauthored tag, people will receive their due credit once this is merged.

Co-authored-by: lightclient [email protected]
Co-authored-by: shemnon [email protected]
Co-authored-by: holiman [email protected]

@holiman
Copy link
Contributor

holiman commented Oct 2, 2024

Merged eof-validation, rebase time :)

@MariusVanDerWijden
Copy link
Member Author

Rebased, looks like I broke some verkle stuff, will fix later

cmd/evm/internal/t8ntool/transition.go Outdated Show resolved Hide resolved
cmd/evm/internal/t8ntool/transition.go Outdated Show resolved Hide resolved
core/genesis.go Outdated Show resolved Hide resolved
codeHash := st.state.GetCodeHash(msg.From)
if codeHash != (common.Hash{}) && codeHash != types.EmptyCodeHash {
code := st.state.GetCode(msg.From)
if 0 < len(code) && !bytes.HasPrefix(code, []byte{0xef, 0x01, 0x00}) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this? Previously, we entered here if codehash told is it was "non-empty-code".
Now, we enter here if length of code is >0, ok, but why check against ef, 01, 00?
And that's not even the eof-prefix+version, which is ef, 00,01.

Also please don't do if 0 < foo, do if foo > 0. We're not testing the 0, we're testing the foo.

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 have no idea where that code came from, I am very certain that I didn't write it^^

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 think its fine to just revert back to the codelength check

core/state_transition.go Outdated Show resolved Hide resolved
@@ -439,15 +441,25 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
// - reset transient storage(eip 1153)
st.state.Prepare(rules, msg.From, st.evm.Context.Coinbase, msg.To, vm.ActivePrecompiles(rules), msg.AccessList)

if !contractCreation {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you move this here?

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 think this is an artifact from the whole special casing when the eof initcode is invalid. I will revert it

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.

2 participants