-
Notifications
You must be signed in to change notification settings - Fork 48
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
ReadWord
equivalence bug
#401
Comments
Another one to trigger a variation of this:
This was another issue I added, accidentally. Also, another issue, #399 that is the same (marking that as duplicate:
Likely culprint is |
(note, some version of the fix of this bug is exposable via: Some info regarding the geth implementation:
func calcMemSize64WithUint(off *uint256.Int, length64 uint64) (uint64, bool) func memoryMLoad(stack *Stack) (uint64, bool) { And: func (in *EVMInterpreter) Run(contract *Contract, input []byte, readOnly bool) (ret []byte, err error) {
[...]
if operation.memorySize != nil {
[see code here] Together mean that geth simply does NOT define what happens with large memory offsets. Its definition of what happens with large offsets is 100% fully dependent on gas when offset is large. The execution phase of geth is essentially undefined/incorrect(?) when offset is >64b. One fix we discussed is to limit memory to 64b. I think 32b would make more sense. But either way, it's not easy, I think. My thoughts:
|
One potential approach would be to change the type of In general I'm actually quite ok with modifying our fuzzers to not generate this kind of annoying edge case and leaving this as a known issue for now. It's a rather uninteresting edge case, and one that seems extremely hard to fix. A cex in this particular case will always represent a false positive (because a write to memory at this index will always be unexecutable in the real world due to gas overflow), so having a very good and correct semantics at this edge case brings us basically nothing. As a final point, since geth doesn't define a behaviour here, it's not really possible for us to be unsound in this case since the real semantics (geth) actually doesn't proscribe a correct behaviour. |
Apparently, The fuzzer has been modified to not generate such expressions: #598. |
The result of simplifying the following expression is reported as non-equivalent by the smt solver:
To reproduce add the following as a top level function to test.hs and call it from the repl:
The text was updated successfully, but these errors were encountered: