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

feat: use real entrypoint bytecode in tests #174

Merged
merged 1 commit into from
Sep 6, 2024
Merged
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
3 changes: 2 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ auto_detect_solc = false
bytecode_hash = "none"
auto_detect_remappings = false
fs_permissions = [
{ access = "read", path = "./out-optimized" }
{ access = "read", path = "./out-optimized" },
{ access = "read", path = "./test/bin" },
]

[fuzz]
Expand Down
Binary file added test/bin/EntryPoint070.bytecode
Binary file not shown.
1 change: 1 addition & 0 deletions test/bin/EntryPoint070.hex

Large diffs are not rendered by default.

Binary file added test/bin/SenderCreator070.bytecode
Binary file not shown.
1 change: 1 addition & 0 deletions test/bin/SenderCreator070.hex
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0x6080600436101561000f57600080fd5b6000803560e01c63570e1a361461002557600080fd5b3461018a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261018a576004359167ffffffffffffffff9081841161018657366023850112156101865783600401358281116101825736602482870101116101825780601411610182577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec810192808411610155577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f81600b8501160116830190838210908211176101555792846024819482600c60209a968b9960405286845289840196603889018837830101525193013560601c5af1908051911561014d575b5073ffffffffffffffffffffffffffffffffffffffff60405191168152f35b90503861012e565b6024857f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b8380fd5b8280fd5b80fdfea26469706673582212207adef8895ad3393b02fab10a111d85ea80ff35366aa43995f4ea20e67f29200664736f6c63430008170033
2 changes: 1 addition & 1 deletion test/utils/AccountTestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ abstract contract AccountTestBase is OptimizedTest {
}

constructor() {
entryPoint = new EntryPoint();
entryPoint = _deployEntryPoint070();
(owner1, owner1Key) = makeAddrAndKey("owner1");
factoryOwner = makeAddr("factoryOwner");
beneficiary = payable(makeAddr("beneficiary"));
Expand Down
11 changes: 11 additions & 0 deletions test/utils/OptimizedTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity ^0.8.26;

import {Test} from "forge-std/Test.sol";

import {EntryPoint} from "@eth-infinitism/account-abstraction/core/EntryPoint.sol";
import {IEntryPoint} from "@eth-infinitism/account-abstraction/interfaces/IEntryPoint.sol";

import {ModularAccount} from "../../src/account/ModularAccount.sol";
Expand Down Expand Up @@ -61,4 +62,14 @@ abstract contract OptimizedTest is Test {
)
: new SingleSignerValidationModule();
}

function _deployEntryPoint070() internal returns (EntryPoint) {
address deployedEntryPointAddr = 0x0000000071727De22E5E9d8BAf0edAc6f37da032;
address deployedSenderCreatorAddr = 0xEFC2c1444eBCC4Db75e7613d20C6a62fF67A167C;
bytes memory bytecode = vm.readFileBinary("test/bin/EntryPoint070.bytecode");
vm.etch(deployedEntryPointAddr, bytecode);
bytecode = vm.readFileBinary("test/bin/SenderCreator070.bytecode");
vm.etch(deployedSenderCreatorAddr, bytecode);
return EntryPoint(payable(deployedEntryPointAddr));
}
}
16 changes: 16 additions & 0 deletions test/utils/ValidateSetup.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;

import {OptimizedTest} from "./OptimizedTest.sol";

contract ValidateSetupTest is OptimizedTest {
function test_deployedEntryPoint() public {
_deployEntryPoint070();

address entryPoint = 0x0000000071727De22E5E9d8BAf0edAc6f37da032;
address senderCreator = 0xEFC2c1444eBCC4Db75e7613d20C6a62fF67A167C;

assertEq(entryPoint.codehash, 0x8db5ff695839d655407cc8490bb7a5d82337a86a6b39c3f0258aa6c3b582fc58);
assertEq(senderCreator.codehash, 0x283c9d14378f5f4c4e24045b87d621d48443fa5b4af7dd7180a599b3756a7689);
}
}
Loading