You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(benchmark): enhance CREATE2 factory deployment and testing
- Updated the deploy_create2_factory_refactored.py script to improve the deployment of a CREATE2 factory with an initcode template, allowing for dynamic contract address generation.
- Modified test_bloatnet.py to support on-the-fly CREATE2 address generation, optimizing gas costs and improving test accuracy.
- Adjusted gas cost calculations in the README to reflect the new deployment approach, ensuring accurate benchmarks for BloatNet tests.
Copy file name to clipboardExpand all lines: tests/benchmark/bloatnet/README.md
+67-60Lines changed: 67 additions & 60 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,29 +2,31 @@
2
2
3
3
## Overview
4
4
5
-
The Bloatnet benchmarks work on the following fashion:
6
-
1. They usually require a previously-deployed state (usually quite large) which the benchmarks
7
-
will interact with.
8
-
2. The deployment script helpers help deploying the required bytecode for the specific tests.
9
-
3. The outputs of the deployment scripts get hardcoded into the codebase such that the benchmarks can interact with them.
5
+
This README pretends to be a guide for any user that wants to run the bloatnet test/benchmark suite in any network.
6
+
BloatNet bench cases can be seen in: https://hackmd.io/9icZeLN7R0Sk5mIjKlZAHQ.
7
+
The idea of all these tests is to stress client implementations to find out where the limits of processing are focusing specifically on state-related operations.
8
+
9
+
In this document you will find a guide that will help you deploy all the setup contracts required by the benchmarks in `/benchmarks/bloatnet`.
10
10
11
11
## Gas Cost Constants
12
12
13
13
### BALANCE + EXTCODESIZE Pattern
14
-
**Gas per contract: 2,707**
15
-
-`PUSH20` (address): 3 gas
14
+
**Gas per contract: ~2,772**
15
+
-`SHA3` (CREATE2 address generation): 30 gas (static) + 18 gas (dynamic for 85 bytes)
16
16
-`BALANCE` (cold access): 2,600 gas
17
17
-`POP`: 2 gas
18
18
-`EXTCODESIZE` (warm): 100 gas
19
19
-`POP`: 2 gas
20
+
- Memory operations and loop overhead: ~20 gas
20
21
21
-
### BALANCE + EXTCODECOPY(single-byte) Pattern
22
-
**Gas per contract: ~2,710**
23
-
-`PUSH20` (address): 3 gas
22
+
### BALANCE + EXTCODECOPY(single-byte) Pattern
23
+
**Gas per contract: ~2,775**
24
+
-`SHA3` (CREATE2 address generation): 30 gas (static) + 18 gas (dynamic for 85 bytes)
24
25
-`BALANCE` (cold access): 2,600 gas
25
26
-`POP`: 2 gas
26
27
-`EXTCODECOPY` (warm, 1 byte): 100 gas (base) + 3 gas (copy 1 byte)
27
-
-`POP`: 2 gas
28
+
- Memory operations: 4 gas
29
+
- Loop overhead: ~20 gas
28
30
29
31
Note: Reading just 1 byte (specifically the last byte at offset 24575) forces the client
30
32
to load the entire 24KB contract from disk while minimizing gas cost. This allows
@@ -35,103 +37,108 @@ targeting nearly as many contracts as the EXTCODESIZE pattern while forcing maxi
0 commit comments