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

[DRAFT] Fixing prank: no longer override the sender on lower frames #609

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

msooseth
Copy link
Collaborator

@msooseth msooseth commented Nov 28, 2024

Description

As per #608 there is an issue with prank. It keeps overriding the sender on lower frames as well. This should not happen.

Checklist

  • tested locally
  • added automated tests
  • updated the docs
  • updated the changelog

Related to #608
@msooseth msooseth changed the title [DRAFT] Potential fix for prank issue [DRAFT] Fixing prank: no longer override the sender on lower frames Nov 28, 2024
@msooseth
Copy link
Collaborator Author

@elopez could you maybe review? Maybe it'd be useful to add more tests in tests.hs, perhaps you could have a go at that?

src/EVM.hs Outdated Show resolved Hide resolved
Copy link
Contributor

@elopez elopez left a comment

Choose a reason for hiding this comment

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

Overall it looks good to me! I left you a few suggestions to make resetCaller state more consistent

src/EVM.hs Outdated Show resolved Hide resolved
src/EVM.hs Show resolved Hide resolved
src/EVM.hs Show resolved Hide resolved
src/EVM.hs Show resolved Hide resolved
let from = fromMaybe vm.state.contract vm.config.overrideCaller
let from = fromMaybe vm.state.contract vm.state.overrideCaller
resetCaller <- use $ #state % #resetCaller
when resetCaller $ assign (#state % #overrideCaller) Nothing
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably also set resetCaller to False at the same time

Copy link
Contributor

Choose a reason for hiding this comment

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

having this on callChecks feels a bit odd to me, should it maybe live on delegateCall instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmmm... yeah, we could set resetCaller in delegateCall. However, the let from = .. needs to be here of course. Wanna have a go at putting it in delegateCall? Just create a PR on top of this PR :)

src/EVM.hs Show resolved Hide resolved
src/EVM.hs Show resolved Hide resolved
src/EVM.hs Show resolved Hide resolved
msooseth and others added 8 commits November 29, 2024 10:08
Co-authored-by: Emilio López <2642849+elopez@users.noreply.github.com>
Co-authored-by: Emilio López <2642849+elopez@users.noreply.github.com>
Co-authored-by: Emilio López <2642849+elopez@users.noreply.github.com>
Co-authored-by: Emilio López <2642849+elopez@users.noreply.github.com>
Co-authored-by: Emilio López <2642849+elopez@users.noreply.github.com>
Co-authored-by: Emilio López <2642849+elopez@users.noreply.github.com>
Co-authored-by: Emilio López <2642849+elopez@users.noreply.github.com>
@msooseth msooseth marked this pull request as ready for review November 29, 2024 09:18
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