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

internal error: entered unreachable code: We should never have decoded calldata for contract creations #6139

Closed
2 tasks done
pcaversaccio opened this issue Oct 27, 2023 · 12 comments
Labels
T-bug Type: bug

Comments

@pcaversaccio
Copy link
Contributor

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 (93f64c7 2023-10-27T00:24:49.496418315Z)

What command(s) is the bug in?

forge test

Operating System

Linux

Describe the bug

Multiple times during CI runs I face the following error (example)

Running 1 test for test/invariants/CreateX_Invariants.t.sol:CreateX_Invariants
[PASS] statefulFuzz_EtherBalance() (runs: 5000, calls: 75000, reverts: 74998)
The application panicked (crashed).
Message:  internal error: entered unreachable code: We should never have decoded calldata for contract creations
Location: crates/evm/traces/src/lib.rs:262

I'm doing an invariant test on my create factory here. The issue as it seems is that for certain initCode inputs (i.e. decoded calldata) it panics. It's getting pretty annoying lately tbh. Any way to disable this in my test environment?

@pcaversaccio pcaversaccio added the T-bug Type: bug label Oct 27, 2023
@gakonst gakonst added this to Foundry Oct 27, 2023
@github-project-automation github-project-automation bot moved this to Todo in Foundry Oct 27, 2023
@mattsse
Copy link
Member

mattsse commented Oct 27, 2023

@Evalir what changed with trace decoding?

unreachable!("We should never have decoded calldata for contract creations");

this unreachable doesn't look sound to me

@Evalir
Copy link
Member

Evalir commented Oct 27, 2023

@mattsse we'll have to triage—this unreachable was already there from the previous implementation. Possible that the issue might come from another place

@mattsse
Copy link
Member

mattsse commented Oct 27, 2023

looks like we're decoding init code now, so I'm removing the unreachable for now

#6141

this shouldn't be there anyway

@mattsse
Copy link
Member

mattsse commented Oct 27, 2023

any other issues we need to fix asap @pcaversaccio ? :)

sorry for the inconveniences lately, lots of moving parts atm -.-

@mattsse
Copy link
Member

mattsse commented Oct 27, 2023

triggering new release once merged

@pcaversaccio
Copy link
Contributor Author

any other issues we need to fix asap @pcaversaccio ? :)

sorry for the inconveniences lately, lots of moving parts atm -.-

Well you might look at a similar issue I reported some months ago: #5629. Very weird behaviour.

@pcaversaccio
Copy link
Contributor Author

pcaversaccio commented Oct 27, 2023

any other issues we need to fix asap @pcaversaccio ? :)
sorry for the inconveniences lately, lots of moving parts atm -.-

Well you might look at a similar issue I reported some months ago: #5629. Very weird behaviour.

See the debugging info I added there:

If I replace hex"01" with abi.encode(hex"01") it will run successfully (if I use abi.encodePacked instead it will revert; the function deployCreate uses bytes as input for the argument, which is the init code). So two questions @Evalir: why is this throwing only if I use the ci profile and why is there an issue with the hex/abi.encodePacked instruction?

@mattsse
Copy link
Member

mattsse commented Oct 27, 2023

okay that's the same bug, yeah.

so the bug here is actually pretty simple that we just didn't handle the case where we were able to decode the constructor calldata

this panic is now removed with #5629, so no more crashes here

@pcaversaccio
Copy link
Contributor Author

okay that's the same bug, yeah.

so the bug here is actually pretty simple that we just didn't handle the case where we were able to decode the constructor calldata

this panic is now removed with #5629, so no more crashes here

you mean #6141

@Evalir
Copy link
Member

Evalir commented Oct 27, 2023

Amazing! Is this closeable @pcaversaccio ?

@pcaversaccio
Copy link
Contributor Author

Amazing! Is this closeable @pcaversaccio ?

one sec -currently running my CI with the latest release

@pcaversaccio
Copy link
Contributor Author

LGTM - thx for fixing.

@github-project-automation github-project-automation bot moved this from Todo to Done in Foundry Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
Archived in project
Development

No branches or pull requests

3 participants