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

Update EIP 3074 AUTHCALL #1867

Merged
merged 6 commits into from
Jun 3, 2022
Merged

Update EIP 3074 AUTHCALL #1867

merged 6 commits into from
Jun 3, 2022

Conversation

jochem-brouwer
Copy link
Member

@jochem-brouwer jochem-brouwer commented Apr 26, 2022

This updates the AUTHCALL EIP. Changes were made: ethereum/EIPs#4967

@codecov
Copy link

codecov bot commented Apr 27, 2022

Codecov Report

Merging #1867 (41d3e25) into develop (d62b7f4) will decrease coverage by 0.05%.
The diff coverage is 81.81%.

Impacted file tree graph

Flag Coverage Δ
block 86.15% <ø> (ø)
blockchain 82.42% <ø> (ø)
client 77.72% <ø> (ø)
common 95.01% <ø> (ø)
devp2p 82.50% <ø> (-0.14%) ⬇️
ethash 90.81% <ø> (ø)
statemanager 84.87% <ø> (ø)
trie 80.19% <ø> (-0.50%) ⬇️
tx 92.13% <ø> (ø)
util 87.29% <ø> (ø)
vm 80.35% <81.81%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@ryanio
Copy link
Contributor

ryanio commented Apr 29, 2022

looks good. is it possible to add code coverage for the newly added/missed lines? just for completeness sake

@holgerd77
Copy link
Member

This would need a cherry-picked re-submission against the latest rebased develop from #1873.

@jochem-brouwer
Copy link
Member Author

When writing tests, I found that the new spec is not entirely clear regarding the gas schedule, so have to wait on the remarks on that. I will expand the test suite to cover the new lines.

@jochem-brouwer
Copy link
Member Author

Clarified: ethereum/EIPs#5093

This is also what we do at this point.

@holgerd77
Copy link
Member

Clarified: ethereum/EIPs#5093

This is also what we do at this point.

Thanks for the update, so just to make sure we are on the same page: do you still plan to write additional tests here (as announced above) or is the PR now ready and just needs a final branch/conflict update?

@jochem-brouwer
Copy link
Member Author

Yes, there need to be a few more tests added to cover the new EIP rules 😄 👍

@holgerd77
Copy link
Member

Let's maybe wait here on merging until the initial EVM/VM refactor PR #1862 is settled and merge to not complicate any further over there. This one already needed so many patient reworks that we really should prioritize over there. 🙂

@holgerd77
Copy link
Member

(given this a "Blocked" label for now for this reason, can be removed once the above PR is merged into develop)

@jochem-brouwer
Copy link
Member Author

I can remove blocked label now right @holgerd77 ?

@holgerd77
Copy link
Member

Thanks, yes, rebased this via UI (locally tested) and will review. 🙂

@holgerd77
Copy link
Member

@SamWilsn would it eventually be possible for you to do a review here?

@holgerd77
Copy link
Member

Rebased via UI after local test rebase.

Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

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

A bit more superficial review than I would have wished, but I think I got the essence of it and this should be sufficient.

Great, thanks Jochem, will merge!

const yParity = bufferToBigInt(mem[31])
const r = mem.slice(32, 64)
const s = mem.slice(64, 96)
const commit = mem.slice(96, 128)
Copy link
Member

Choose a reason for hiding this comment

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

Ok, so this is this new authority + signature in memory change.

let mem = runState.memory.read(Number(memOffset), Number(memLength))
if (mem.length < 128) {
mem = setLengthRight(mem, 128)
}
Copy link
Member

Choose a reason for hiding this comment

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

"If length is greater than 128, the extra bytes are ignored. Bytes outside the range (in the event length is less than 128) are treated as if they had been zeroes."

👍

PUSH32,
addressBuffer,
AUTH,
])
Copy link
Member

Choose a reason for hiding this comment

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

I will trust the PR author that these test updates are correct. 😅 😀

const result = await vm.runTx({ tx, block })
const buf = result.execResult.returnValue
st.ok(buf.equals(zeros(32)), 'auth puts 0')
})
Copy link
Member

Choose a reason for hiding this comment

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

Nice additional test cases! 👍

@holgerd77 holgerd77 merged commit a7b1648 into develop Jun 3, 2022
@holgerd77 holgerd77 deleted the eip-3074-updated branch June 3, 2022 09:37
g11tech pushed a commit that referenced this pull request Jun 3, 2022
* vm: update eip 3074

* vm: eip3074 test fixes start

* vm: fix eip3074 tests

* vm: expand eip3074 tests

* vm: add eip 3074 tests

* vm: address 128n -> BigInt(128)
mem = setLengthRight(mem, 128)
}

const yParity = BigInt(mem[31])
Copy link

Choose a reason for hiding this comment

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

Hm, I don't think this line is correct. EIP-3074 says that:

memory[offset : offset+32 ] - yParity

So yParity could, in theory, be larger than one byte. As specified, signature verification would fail in that case, but with this implementation, it looks like the higher bytes are ignored?

Copy link
Member

Choose a reason for hiding this comment

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

@jochem-brouwer could you have a look?

holgerd77 pushed a commit that referenced this pull request Jun 8, 2022
* vm: update eip 3074

* vm: eip3074 test fixes start

* vm: fix eip3074 tests

* vm: expand eip3074 tests

* vm: add eip 3074 tests

* vm: address 128n -> BigInt(128)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants