-
Notifications
You must be signed in to change notification settings - Fork 140
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
Fix callee onchain balance #535
base: master
Are you sure you want to change the base?
Conversation
e46790f
to
684a4bd
Compare
Found: 17
|
Found out that this is not a good solution, since middleware is cloned meaning balance cache is not preserved. Will think how to use the same instance of middleware. |
f1f28cf
to
f9052c6
Compare
Did more debugging, the balance for the call target is actually fetched in src/evm/onchain/mod.rs when handling
Now the issue should be fixed. |
f9052c6
to
fb1907f
Compare
Found: 11
|
Found: 3
|
Hello, this pull request fixes a problem with initial balance when making a call.
self.next_slot
will contain the actual balance of thereceiver
address only if there was a prior execution of theBALANCE
opcode. In thecall()
handler the balance of the never seenreceiver
address is not initialized (self.next_slot
is 0). In this patch if the address' balance was never queried we obtain the balance usingOnchain
middleware. This fixed a reentrancy test case for me. Not sure if this way of calling the middleware is elegant enough though.