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

bug: invariant test chooses contract senders which are rejected due to EIP-3607 #2963

Closed
2 tasks
mds1 opened this issue Aug 26, 2022 · 7 comments
Closed
2 tasks
Labels
A-testing Area: testing C-forge Command: forge T-bug Type: bug

Comments

@mds1
Copy link
Collaborator

mds1 commented Aug 26, 2022

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (56dc746 2022-08-26T00:07:43.474069Z)

What command(s) is the bug in?

forge test

Operating System

No response

Describe the bug

Using the same test contract as #2962, sometimes the sender will be a contract chosen from the dictionary. In that case the call reverts with [FAIL. Reason: EvmError: RejectCallerWithCode] due to EIP-3607, similar to #2090

IMO the ideal solution here is to bypass 3607 since the msg.sender can have code, and this is referring to the fact that tx.origin cannot have code which isn't too relevant for invariant tests.

@mds1 mds1 added the T-bug Type: bug label Aug 26, 2022
@gakonst gakonst added this to Foundry Aug 26, 2022
@gakonst gakonst moved this to Todo in Foundry Aug 26, 2022
@gakonst
Copy link
Member

gakonst commented Aug 26, 2022

Yeah implementing the same fix as #2090 here makes sense.

@rkrasiuk rkrasiuk added A-testing Area: testing C-forge Command: forge labels Aug 29, 2022
@gakonst
Copy link
Member

gakonst commented Nov 3, 2022

@mattsse can you pls take a look tomorrow on this? should be simple fix and apparently a big issue for invariant users

@PaulRBerg
Copy link
Contributor

PaulRBerg commented Jan 25, 2023

Can confirm that this is a big pain when testing invariants.

What is the fix until this issue gets fixed? Exclude all known contracts with excludeSender?

Update: the solution is to use targetSender, as Lucas Manuel does in his example-invariants repo.

Though I am not quite sure why this works. Does targetSender act as an allowlist? I have opened an issue in forge-std to document the functions available in InvariantTest.

@PaulRBerg
Copy link
Contributor

PaulRBerg commented Jan 27, 2023

Looks like #4181 has been merged. Should this issue be closed now?

Update: no, we shouldn't close this issue just yet. I updated Forge via foundryup and removed my targetSender calls, but I am still getting this error:

FAIL. Reason: EvmError: RejectCallerWithCode

@mattsse
Copy link
Member

mattsse commented Jan 27, 2023

it's not on foundryup yet, but I'm cutting a release now manually

@PaulRBerg
Copy link
Contributor

Oh, I see, thanks.

@PaulRBerg
Copy link
Contributor

@mattsse looks like this is fixed now. I updated via foundryup recently, removed my targetSender call, and my invariant tests passed.

@mattsse mattsse closed this as completed Jan 31, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in Foundry Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testing Area: testing C-forge Command: forge T-bug Type: bug
Projects
Archived in project
Development

No branches or pull requests

5 participants