foundry-rs / foundry-rs/forge-std

bug(StdCheats): deal() hangs on reflection tokens

Open
#740 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Solidity
Stars
1.1k
Forks
520
Avg merge
3d 13h
Merged PRs (30d)
9

Description

Dears

Thanks for the amazing efforts you put into this. I detected a bug in deal function when used with reflection tokens. the bug is in v1.9.2 (v1.9.1 doesnt have it). The bug is the deal function just hangs and never returns in v1.9.2 vs it throws in v1.9.1 (expected as this is a reflection token).

test to run:

```sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;

import {Test, console} from "forge-std/Test.sol";
contract MyTest is Test {
function testThingy() public {
vm.createSelectFork("wss://bsc-rpc.publicnode.com"); // A BSC RPC Node. You might want to change this
vm.writeLine("./log.txt", "start");
deal(0xc748673057861a797275CD8A068AbB95A902e8de, address(this), 1 ether);
vm.writeLine("./log.txt", "end");
}
}
```

`foundry.toml`:
```
[profile.default]
src = "Foundry/src"
out = "out"
libs = ["Foundry/lib"]
test = "Foundry/test"
optimizer = true
optimizer_runs = 20000
viaIR = true
evm_version = "cancun"
gas_limit = "18446744073709551615"
solc = "0.8.25"
fs_permissions = [{ access = "write", path = "./"}]
```

I do `vm.writeLine` instead of `console.log` cause when it hangs you do not get the `console.log`s

I tried on multiple versions and I was able to zero in on the version where this bug happens which is `v1.9.2`. So for me `v1.9.1` it didnt hang (it failed but didnt hang). `v1.9.2` it hanged.

Related to: https://github.com/foundry-rs/forge-std/issues/409

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.