Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/anvil/src/eth/backend/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ use eyre::{Context, Result};
use flate2::{Compression, read::GzDecoder, write::GzEncoder};
use foundry_evm::{
backend::{DatabaseError, DatabaseResult, RevertStateSnapshotAction},
constants::DEFAULT_CREATE2_DEPLOYER_RUNTIME_CODE,
constants::DEFAULT_CREATE2_DEPLOYER_BYTECODE,
decode::RevertDecoder,
inspectors::AccessListInspector,
traces::{CallTraceDecoder, TracingInspectorConfig},
Expand Down Expand Up @@ -392,7 +392,7 @@ impl Backend {

/// Writes the CREATE2 deployer code directly to the database at the address provided.
pub async fn set_create2_deployer(&self, address: Address) -> DatabaseResult<()> {
self.set_code(address, Bytes::from_static(DEFAULT_CREATE2_DEPLOYER_RUNTIME_CODE)).await?;
self.set_code(address, Bytes::from_static(DEFAULT_CREATE2_DEPLOYER_BYTECODE)).await?;

Ok(())
}
Expand Down
501 changes: 500 additions & 1 deletion crates/anvil/test-data/state-dump-legacy-stress.json

Large diffs are not rendered by default.

198 changes: 197 additions & 1 deletion crates/anvil/test-data/state-dump-legacy.json

Large diffs are not rendered by default.

312 changes: 311 additions & 1 deletion crates/anvil/test-data/state-dump.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions crates/anvil/tests/it/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,9 @@ async fn can_get_code_by_hash() {
let (api, _) =
spawn(NodeConfig::test().with_eth_rpc_url(Some(rpc::next_http_archive_rpc_url()))).await;

// The code hash for DEFAULT_CREATE2_DEPLOYER_RUNTIME_CODE
// The code hash for DEFAULT_CREATE2_DEPLOYER_BYTECODE
let code_hash = b256!("2fa86add0aed31f33a762c9d88e807c475bd51d0f52bd0955754b2608f7e4989");

let code = api.debug_code_by_hash(code_hash, None).await.unwrap();
assert_eq!(&code.unwrap(), foundry_evm::constants::DEFAULT_CREATE2_DEPLOYER_RUNTIME_CODE);
assert_eq!(&code.unwrap(), foundry_evm::constants::DEFAULT_CREATE2_DEPLOYER_BYTECODE);
}
4 changes: 2 additions & 2 deletions crates/anvil/tests/it/otterscan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ async fn ots_get_internal_operations_contract_create2() {
sol!(
#[sol(rpc, bytecode = "60808060405234601557610147908161001a8239f35b5f80fdfe6080600436101561000e575f80fd5b5f3560e01c636cd5c39b14610021575f80fd5b346100d0575f3660031901126100d0575f602082810191825282526001600160401b03916040810191838311828410176100d4578261008960405f959486958252606081019486865281518091608084015e81018660808201520360208101845201826100ee565b519082734e59b44847b379578588920ca78fbf26c0b4956c5af1903d156100e8573d9081116100d4576040516100c991601f01601f1916602001906100ee565b156100d057005b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b506100c9565b601f909101601f19168101906001600160401b038211908210176100d45760405256fea2646970667358221220f76968e121fc002b537029df51a2aecca0793282491baf84b872ffbfbfb1c9d764736f6c63430008190033")]
contract Contract {
address constant CREATE2_DEPLOYER = 0x4e59b44847b379578588920cA78FbF26c0B4956C;
address constant CREATE2_DEPLOYER = 0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed;

function deployContract() public {
uint256 salt = 0;
Expand All @@ -106,7 +106,7 @@ async fn ots_get_internal_operations_contract_create2() {
res,
[InternalOperation {
r#type: OperationType::OpCreate2,
from: address!("0x4e59b44847b379578588920cA78FbF26c0B4956C"),
from: address!("0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed"),
to: address!("0x347bcdad821abc09b8c275881b368de36476b62c"),
value: U256::from(0),
}],
Expand Down
4 changes: 2 additions & 2 deletions crates/anvil/tests/it/state.rs

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions crates/cast/src/cmd/create2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use std::{
time::Instant,
};

// https://etherscan.io/address/0x4e59b44847b379578588920ca78fbf26c0b4956c#code
const DEPLOYER: &str = "0x4e59b44847b379578588920ca78fbf26c0b4956c";
// https://etherscan.io/address/0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed#code
const DEPLOYER: &str = "0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed";

/// CLI arguments for `cast create2`.
#[derive(Clone, Debug, Parser)]
Expand Down Expand Up @@ -402,10 +402,10 @@ mod tests {
"-j1",
]);
let out = args.run().unwrap();
assert_eq!(out.address, address!("0x00614b3D65ac4a09A376a264fE1aE5E5E12A6C43"));
assert_eq!(out.address, address!("0x00fc4592f3369d6a39d5bad30183ac4960395a90"));
assert_eq!(
out.salt,
b256!("0x322113f523203e2c0eb00bbc8e69208b0eb0c8dad0eaac7b01d64ff016edb40d"),
b256!("0x322113f523203e2c0eb00bbc8e69208b0eb0c8dad0eaac7b61d64ff016edb40d"),
);
}

Expand All @@ -419,10 +419,10 @@ mod tests {
"-j1",
]);
let out = args.run().unwrap();
assert_eq!(out.address, address!("0x00bF495b8b42fdFeb91c8bCEB42CA4eE7186AEd2"));
assert_eq!(out.address, address!("0x005d19a9896afceb18abeb5bfd044809aa91f354"));
assert_eq!(
out.salt,
b256!("0x000000000000000000000000000000000000000000000000df00000000000000"),
b256!("0x000000000000000000000000000000000000000000000000cb01000000000000"),
);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ impl Config {

/// Default create2 deployer
pub const DEFAULT_CREATE2_DEPLOYER: Address =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we're here can we use this constant everywhere?

address!("0x4e59b44847b379578588920ca78fbf26c0b4956c");
address!("0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed");

/// Loads the `Config` from the current directory.
///
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/core/src/backend/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub enum BackendError {
#[error("failed to fetch account info for {0}")]
MissingAccount(Address),
#[error(
"CREATE2 Deployer (0x4e59b44847b379578588920ca78fbf26c0b4956c) not present on this chain.\n\
"CREATE2 Deployer (0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed) not present on this chain.\n\
For a production environment, you can deploy it using the pre-signed transaction from \
https://github.com/Arachnid/deterministic-deployment-proxy.\n\
For a test environment, you can use `etch` to place the required bytecode at that address."
Expand Down
32 changes: 14 additions & 18 deletions crates/evm/core/src/constants.rs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions crates/evm/evm/src/executors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use foundry_evm_core::{
backend::{Backend, BackendError, BackendResult, CowBackend, DatabaseExt, GLOBAL_FAIL_SLOT},
constants::{
CALLER, CHEATCODE_ADDRESS, CHEATCODE_CONTRACT_HASH, DEFAULT_CREATE2_DEPLOYER,
DEFAULT_CREATE2_DEPLOYER_CODE, DEFAULT_CREATE2_DEPLOYER_DEPLOYER,
DEFAULT_CREATE2_DEPLOYER_DEPLOYER, DEFAULT_CREATE2_DEPLOYER_INITCODE,
},
decode::{RevertDecoder, SkipReason},
utils::StateChangeset,
Expand Down Expand Up @@ -230,7 +230,7 @@ impl Executor {
self.set_balance(creator, U256::MAX)?;

let res =
self.deploy(creator, DEFAULT_CREATE2_DEPLOYER_CODE.into(), U256::ZERO, None)?;
self.deploy(creator, DEFAULT_CREATE2_DEPLOYER_INITCODE.into(), U256::ZERO, None)?;
trace!(create2=?res.address, "deployed local create2 deployer");

self.set_balance(creator, initial_balance)?;
Expand Down
4 changes: 2 additions & 2 deletions crates/forge/tests/cli/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ unchecked_cheatcode_artifacts = false
create2_library_salt = "0x0000000000000000000000000000000000000000000000000000000000000000"
create2_deployer = "0x4e59b44847b379578588920ca78fbf26c0b4956c"
assertions_revert = true
legacy_assertions = false
legacy_assertions = 0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed
odyssey = false
transaction_timeout = 120
additional_compiler_profiles = []
Expand Down Expand Up @@ -1345,7 +1345,7 @@ exclude = []
"create2_deployer": "0x4e59b44847b379578588920ca78fbf26c0b4956c",
"vyper": {},
"dependencies": null,
"soldeer": null,
"soldeer": null,0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed
"assertions_revert": true,
"legacy_assertions": false,
"odyssey": false,
Expand Down
10 changes: 5 additions & 5 deletions crates/forge/tests/cli/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ forgetest_async!(can_deploy_with_create2, |prj, cmd| {
// Prepare CREATE2 Deployer
api.anvil_set_code(
foundry_evm::constants::DEFAULT_CREATE2_DEPLOYER,
Bytes::from_static(foundry_evm::constants::DEFAULT_CREATE2_DEPLOYER_RUNTIME_CODE),
Bytes::from_static(foundry_evm::constants::DEFAULT_CREATE2_DEPLOYER_BYTECODE),
)
.await
.unwrap();
Expand All @@ -896,7 +896,7 @@ forgetest_async!(can_deploy_with_custom_create2, |prj, cmd| {
// Prepare CREATE2 Deployer
api.anvil_set_code(
create2,
Bytes::from_static(foundry_evm::constants::DEFAULT_CREATE2_DEPLOYER_RUNTIME_CODE),
Bytes::from_static(foundry_evm::constants::DEFAULT_CREATE2_DEPLOYER_BYTECODE),
)
.await
.unwrap();
Expand Down Expand Up @@ -1010,7 +1010,7 @@ forgetest_async!(check_broadcast_log, |prj, cmd| {
let mut tester = ScriptTester::new_broadcast(cmd, &handle.http_endpoint(), prj.root());

// Prepare CREATE2 Deployer
let addr = address!("0x4e59b44847b379578588920ca78fbf26c0b4956c");
let addr = address!("0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed");
let code = hex::decode("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3").expect("Could not decode create2 deployer init_code").into();
api.anvil_set_code(addr, code).await.unwrap();

Expand Down Expand Up @@ -2099,7 +2099,7 @@ contract SimpleScript is Script {
]);

cmd.assert_failure().stderr_eq(str![[r#"
Error: script failed: missing CREATE2 deployer: 0x4e59b44847b379578588920cA78FbF26c0B4956C
Error: script failed: missing CREATE2 deployer: 0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed

"#]]);
});
Expand Down Expand Up @@ -2281,7 +2281,7 @@ ONCHAIN EXECUTION COMPLETE & SUCCESSFUL.
"#]]);

assert!(
!api.get_code(address!("0x4e59b44847b379578588920cA78FbF26c0B4956C"), Default::default())
!api.get_code(address!("0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed"), Default::default())
.await
.unwrap()
.is_empty()
Expand Down
4 changes: 2 additions & 2 deletions crates/forge/tests/cli/test_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ contract PrecompileLabelsTest is Test {
function testPrecompileLabels() public {
vm.deal(address(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D), 1 ether);
vm.deal(address(0x000000000000000000636F6e736F6c652e6c6f67), 1 ether);
vm.deal(address(0x4e59b44847b379578588920cA78FbF26c0B4956C), 1 ether);
vm.deal(address(0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed), 1 ether);
vm.deal(address(0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38), 1 ether);
vm.deal(address(0xb4c79daB8f259C7Aee6E5b2Aa729821864227e84), 1 ether);
vm.deal(address(1), 1 ether);
Expand Down Expand Up @@ -1002,7 +1002,7 @@ Traces:
│ └─ ← [Return]
├─ [0] VM::deal(console: [0x000000000000000000636F6e736F6c652e6c6f67], 1000000000000000000 [1e18])
│ └─ ← [Return]
├─ [0] VM::deal(Create2Deployer: [0x4e59b44847b379578588920cA78FbF26c0B4956C], 1000000000000000000 [1e18])
├─ [0] VM::deal(Create2Deployer: [0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed], 1000000000000000000 [1e18])
│ └─ ← [Return]
├─ [0] VM::deal(DefaultSender: [0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38], 1000000000000000000 [1e18])
│ └─ ← [Return]
Expand Down
4 changes: 2 additions & 2 deletions crates/script/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ mod tests {
"foundry-cli",
"Contract.sol",
"--sender",
"0x4e59b44847b379578588920ca78fbf26c0b4956c",
"0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed",
"--unlocked",
]);
assert!(args.unlocked);
Expand All @@ -711,7 +711,7 @@ mod tests {
"foundry-cli",
"Contract.sol",
"--sender",
"0x4e59b44847b379578588920ca78fbf26c0b4956c",
"0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed",
"--unlocked",
"--private-key",
key.to_string().as_str(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ contract InvariantSenders {
function checkSender() external {
require(msg.sender != 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D, "sender cannot be cheatcode address");
require(msg.sender != 0x000000000000000000636F6e736F6c652e6c6f67, "sender cannot be console address");
require(msg.sender != 0x4e59b44847b379578588920cA78FbF26c0B4956C, "sender cannot be CREATE2 deployer");
require(msg.sender != 0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed, "sender cannot be CREATE2 deployer");
}
}

Expand Down
4 changes: 2 additions & 2 deletions testdata/default/repros/Issue3708.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import "cheats/Vm.sol";

// https://github.com/foundry-rs/foundry/issues/3708
contract Issue3708Test is DSTest {
// https://optimistic.etherscan.io/address/0x4e59b44847b379578588920ca78fbf26c0b4956c#code
address constant CREATE2_DEPLOYER = 0x4e59b44847b379578588920cA78FbF26c0B4956C;
// https://optimistic.etherscan.io/address/0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed#code
address constant CREATE2_DEPLOYER = 0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed;
Vm constant vm = Vm(HEVM_ADDRESS);

function setUp() public {
Expand Down
2 changes: 1 addition & 1 deletion testdata/default/repros/Issue5529.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ contract Issue5529Test is DSTest {
Vm constant vm = Vm(HEVM_ADDRESS);

Counter public counter;
address public constant default_create2_factory = 0x4e59b44847b379578588920cA78FbF26c0B4956C;
address public constant default_create2_factory = 0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed;

function testCreate2FactoryUsedInTests() public {
address a = vm.computeCreate2Address(0, keccak256(type(Counter).creationCode), address(default_create2_factory));
Expand Down
6 changes: 3 additions & 3 deletions testdata/default/repros/Issue6634.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ contract Issue6634Test is DSTest {
Vm constant vm = Vm(HEVM_ADDRESS);

function test_Create2FactoryCallRecordedInStandardTest() public {
address CREATE2_DEPLOYER = 0x4e59b44847b379578588920cA78FbF26c0B4956C;
address CREATE2_DEPLOYER = 0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed;

vm.startStateDiffRecording();
Box a = new Box{salt: 0}(1);
Expand All @@ -42,7 +42,7 @@ contract Issue6634Test is DSTest {
}

function test_Create2FactoryCallRecordedWhenPranking() public {
address CREATE2_DEPLOYER = 0x4e59b44847b379578588920cA78FbF26c0B4956C;
address CREATE2_DEPLOYER = 0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed;
address accessor = address(0x5555);

vm.startPrank(accessor);
Expand All @@ -68,7 +68,7 @@ contract Issue6634Test is DSTest {
}

function test_Create2FactoryCallRecordedWhenBroadcasting() public {
address CREATE2_DEPLOYER = 0x4e59b44847b379578588920cA78FbF26c0B4956C;
address CREATE2_DEPLOYER = 0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed;
address accessor = address(0x5555);

vm.startBroadcast(accessor);
Expand Down
Loading