-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
T-bugType: bugType: bug
Description
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 (b83b316 2023-01-25T00:12:19.890671Z)
What command(s) is the bug in?
forge script ./script/MyScript.s.sol --rpc-url --private-key -vvvv;
Operating System
macOS (Apple Silicon)
Describe the bug
Context:
I'm using the run-latest.json
files to extract informations using jq
but noticed that in some cases, for transactionType
"CREATE", the contractName
field was undefined. So, I tried to reproduce the bug with the simplest example I could.
Script:
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import "forge-std/Script.sol";
import "/MyContract.sol";
contract MyScript is Script {
function run() public {
vm.startBroadcast();
new MyContract(
address(0),
address(0),
address(0),
0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f,
0x82aF49447D8a07e3bd95BD0d56f35241523fBab1
);
vm.stopBroadcast();
}
}
Contract:
contract MyContract {
address public immutable var1;
address public immutable var2;
address public immutable var3;
address public immutable var4;
address public immutable var5;
constructor(
address _var1,
address _var2,
address _var3,
address _var4,
address _var5
) {
var1 = _var1;
var2 = _var2;
var3 = _var3;
var4 = _var4;
var5 = _var5;
}
}
Command:
forge script ./script/MyScript.s.sol --rpc-url <rpc> --private-key <pk> -vvvv;
Output:
[⠒] Compiling...
[⠑] Compiling 1 files with 0.8.16
[⠃] Solc 0.8.16 finished in 534.70ms
Compiler run successful
Traces:
[131496] MyScript::run()
├─ [0] VM::startBroadcast()
│ └─ ← ()
├─ [74726] → new <Unknown>@0xcF4f8E9A113433046B990980ebce5c3fA883067f
│ └─ ← 369 bytes of code
├─ [0] VM::stopBroadcast()
│ └─ ← ()
└─ ← ()
Script ran successfully.
## Setting up (1) EVMs.
==========================
Simulated On-chain Traces:
[136778] → new <Unknown>@0xcF4f8E9A113433046B990980ebce5c3fA883067f
└─ ← 369 bytes of code
==========================
Chain 42161
Estimated gas price: 0.1 gwei
Estimated total gas used for script: 1841715
Estimated amount required: 0.0001841715 ETH
==========================
SIMULATION COMPLETE. To broadcast these transactions, add --broadcast and wallet configuration(s) to the previous command. See forge script --help for more.
But if I change the script to:
pragma solidity ^0.8.13;
import "forge-std/Script.sol";
import "/MyContract.sol";
contract MyScript is Script {
function run() public {
vm.startBroadcast();
new MyContract(
address(0),
address(0),
address(0),
address(0),
0x82aF49447D8a07e3bd95BD0d56f35241523fBab1
);
vm.stopBroadcast();
}
}
The deployed contract name is resolved:
## Setting up (1) EVMs.
==========================
Simulated On-chain Traces:
[136538] → new MyContract@0xcF4f8E9A113433046B990980ebce5c3fA883067f
└─ ← 369 bytes of code
==========================
Expectation:
It should show new MyContract@0xcF4f8E9A113433046B990980ebce5c3fA883067f
instead of new <Unknown>@0xcF4f8E9A113433046B990980ebce5c3fA883067f
Metadata
Metadata
Assignees
Labels
T-bugType: bugType: bug