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

State Persisting from Local Simulation inside Script File #7894

Open
2 tasks done
danieljoseph18 opened this issue May 8, 2024 · 0 comments
Open
2 tasks done

State Persisting from Local Simulation inside Script File #7894

danieljoseph18 opened this issue May 8, 2024 · 0 comments
Labels
T-bug Type: bug

Comments

@danieljoseph18
Copy link

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

What command(s) is the bug in?

forge script

Operating System

macOS (Apple Silicon)

Describe the bug

I'm storing the output of a function call in memory, for use as an argument to another function call within my script.

However, the value from the local simulation is being persisted, and used as the argument to the equivalent function call within the context of the onchain simulation too, instead of being thrown to use the new output from the onchain simulation.

For example:

Contract contract = Contract(0xABC);

function run() public {
    vm.startBroadcast();
    bytes32 a = contract.doSomething();
    contract.doSomethingElse(a);
    vm.stopBroadcast();
}

The local simulation is running successfully.

When it comes to the onchain simulation, the value of a === the previous value of a within the local simulation.

a is not being updated with the new value in the context of the onchain simulation.

Traces:

  • a = 0x12345...
  • contract.doSomething(0x12345...)

Simulated On-chain Traces:

  • a = 0x456789...
  • contract.doSomething(0x12345...)`
  • REVERT (expected 0x456789...)
@danieljoseph18 danieljoseph18 added the T-bug Type: bug label May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
None yet
Development

No branches or pull requests

1 participant