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

Conversation

adamegyed
Copy link
Contributor

Motivation

For accurate gas benchmarking, we shouldn't be deploying re-compiled EntryPoint code (via new EntryPoint()), we should use the actual EntryPoint 0.7.0 code.

Solution

Commit the binary + hex representations of EntryPoint 0.7.0 and its associated contract SenderCreator.

Add these to the setup step of OptimizedTest, and use this function in AccountTestBase.

Add a small verification test to ensure the codehash of these contracts is what we expect.

For future reference, the command used to generate the .bytecode files is xxd -r -p name.hex > name.bytecode.

Also renames the test file ReferenceModularAccount.t.sol -> ModularAccount.t.sol.

@adamegyed adamegyed requested a review from a team September 6, 2024 19:29
Copy link

github-actions bot commented Sep 6, 2024

Contract sizes:

| Contract                     | Size (B) | Margin (B) |
|------------------------------|----------|------------|
| AccountFactory               |    4,763 |     19,813 |
| ERC1967Proxy                 |      104 |     24,472 |
| ModularAccount               |   23,929 |        647 |
| SemiModularAccount           |   25,019 |       -443 |
| SingleSignerValidationModule |    3,444 |     21,132 |
| TokenReceiverModule          |    2,189 |     22,387 |

Code coverage:

File % Lines % Statements % Branches % Funcs
src/account/AccountExecutor.sol 75.00% (3/4) 75.00% (3/4) 0.00% (0/1) 100.00% (1/1)
src/account/AccountFactory.sol 33.33% (10/30) 35.71% (15/42) 50.00% (1/2) 18.18% (2/11)
src/account/AccountStorageInitializable.sol 84.21% (16/19) 84.62% (22/26) 60.00% (3/5) 100.00% (2/2)
src/account/ModularAccount.sol 45.89% (95/207) 48.93% (137/280) 22.86% (8/35) 77.14% (27/35)
src/account/ModularAccountView.sol 37.93% (11/29) 42.86% (18/42) 50.00% (1/2) 50.00% (1/2)
src/account/ModuleManagerInternals.sol 50.79% (64/126) 49.11% (83/169) 21.43% (3/14) 81.82% (9/11)
src/account/SemiModularAccount.sol 0.00% (0/51) 0.00% (0/68) 0.00% (0/9) 0.00% (0/18)
src/helpers/HookConfigLib.sol 5.88% (1/17) 6.25% (2/32) 100.00% (0/0) 8.33% (1/12)
src/helpers/KnownSelectors.sol 100.00% (27/27) 100.00% (60/60) 100.00% (0/0) 100.00% (3/3)
src/helpers/ModuleEntityLib.sol 50.00% (4/8) 30.00% (6/20) 100.00% (0/0) 33.33% (2/6)
src/helpers/SparseCalldataSegmentLib.sol 43.48% (10/23) 48.28% (14/29) 0.00% (0/5) 66.67% (4/6)
src/helpers/ValidationConfigLib.sol 38.89% (7/18) 47.37% (18/38) 100.00% (0/0) 53.85% (7/13)
src/modules/BaseModule.sol 9.09% (1/11) 26.67% (4/15) 0.00% (0/1) 50.00% (1/2)
src/modules/ModuleEIP712.sol 100.00% (1/1) 100.00% (2/2) 100.00% (0/0) 100.00% (1/1)
src/modules/ReplaySafeWrapper.sol 100.00% (6/6) 100.00% (7/7) 100.00% (0/0) 100.00% (2/2)
src/modules/TokenReceiverModule.sol 69.23% (9/13) 69.23% (9/13) 100.00% (0/0) 28.57% (2/7)
src/modules/validation/SingleSignerValidationModule.sol 66.67% (14/21) 65.22% (15/23) 66.67% (2/3) 77.78% (7/9)
Total 45.66% (279/611) 47.70% (415/870) 23.38% (18/77) 51.06% (72/141)

@adamegyed adamegyed merged commit c9bb981 into develop Sep 6, 2024
4 checks passed
@adamegyed adamegyed deleted the adam/use-real-ep branch September 6, 2024 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants