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

Potential discrepancy in error generation for some opcodes #210

Closed
msooseth opened this issue Feb 28, 2023 · 2 comments
Closed

Potential discrepancy in error generation for some opcodes #210

msooseth opened this issue Feb 28, 2023 · 2 comments

Comments

@msooseth
Copy link
Collaborator

msooseth commented Feb 28, 2023

As per instructions.go in go-ethereum, the instructions CALLDATACOPY, CODECOPY, EXTCODECOPY, and RETURNDATACOPY may to do something other than what we do? In particular, they try to force the offset for these copy operations to be 64b and if they overflow, they set it to 0xffffffffffffffff, i.e. the largest 64b value and continue (and potentially fail later).

For go-ethereum behaviour see instructions.go line here: https://github.com/ethereum/go-ethereum/blob/master/core/vm/instructions.go#L307

@msooseth
Copy link
Collaborator Author

msooseth commented Jul 19, 2023

So for all these opcodes: CALLDATACOPY, CODECOPY, EXTCODECOPY

The spec says: For out of bound bytes, 0s will be copied.

But... the data offset is actually incorrect. It should not wrap around. It simply trucates it to maxW64 and then writes 0s.

Still can't trigger it but Tracing.hs now has a few test cases exercising CALLDATACOPY

@msooseth
Copy link
Collaborator Author

msooseth commented Jan 2, 2024

Nope, geth is basically incomplete, and that code is not meant to be executed with larger than 64b values, hence the roll-around. This issue is better tracked here: #401

@msooseth msooseth closed this as completed Jan 2, 2024
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

No branches or pull requests

1 participant