Skip to content

Commit

Permalink
feat: add createX preinstall
Browse files Browse the repository at this point in the history
  • Loading branch information
agusduha committed Aug 21, 2024
1 parent 185fb80 commit 3e363ad
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/contracts-bedrock/scripts/L2Genesis.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ contract L2Genesis is Deployer {
_setPreinstallCode(Preinstalls.SenderCreator_v070); // ERC 4337 v0.7.0
_setPreinstallCode(Preinstalls.EntryPoint_v070); // ERC 4337 v0.7.0
_setPreinstallCode(Preinstalls.BeaconBlockRoots);
_setPreinstallCode(Preinstalls.CreateXDeployer);
// 4788 sender nonce must be incremented, since it's part of later upgrade-transactions.
// For the upgrade-tx to not create a contract that conflicts with an already-existing copy,
// the nonce must be bumped.
Expand Down
8 changes: 8 additions & 0 deletions packages/contracts-bedrock/src/libraries/Preinstalls.sol

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/contracts-bedrock/test/L2Genesis.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ contract L2GenesisTest is Test {
expected += 2048 - 2; // predeploy proxies
expected += 21; // predeploy implementations (excl. legacy erc20-style eth and legacy message sender)
expected += 256; // precompiles
expected += 12; // preinstalls
expected += 13; // preinstalls
expected += 1; // 4788 deployer account
// 16 prefunded dev accounts are excluded
assertEq(expected, getJSONKeyCount(_path), "key count check");
Expand Down
4 changes: 4 additions & 0 deletions packages/contracts-bedrock/test/Preinstalls.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,8 @@ contract PreinstallsTest is CommonTest {
assertPreinstall(Preinstalls.BeaconBlockRoots, Preinstalls.BeaconBlockRootsCode);
assertEq(vm.getNonce(Preinstalls.BeaconBlockRootsSender), 1, "4788 sender must have nonce=1");
}

function test_preinstall_createXDeployer_succeeds() external view {
assertPreinstall(Preinstalls.CreateXDeployer, Preinstalls.CreateXDeployerCode);
}
}
1 change: 1 addition & 0 deletions packages/contracts-bedrock/test/setup/Setup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ contract Setup {
labelPreinstall(Preinstalls.SenderCreator_v070);
labelPreinstall(Preinstalls.EntryPoint_v070);
labelPreinstall(Preinstalls.BeaconBlockRoots);
labelPreinstall(Preinstalls.CreateXDeployer);

console.log("Setup: completed L2 genesis");
}
Expand Down

0 comments on commit 3e363ad

Please sign in to comment.