@aztec/end-to-end 0.0.0-test.1 → 0.0.1-commit.b655e406
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bench/client_flows/benchmark.d.ts +61 -0
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/benchmark.js +261 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +73 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/client_flows_benchmark.js +311 -0
- package/dest/bench/client_flows/config.d.ts +14 -0
- package/dest/bench/client_flows/config.d.ts.map +1 -0
- package/dest/bench/client_flows/config.js +106 -0
- package/dest/bench/client_flows/data_extractor.d.ts +2 -0
- package/dest/bench/client_flows/data_extractor.d.ts.map +1 -0
- package/dest/bench/client_flows/data_extractor.js +99 -0
- package/dest/bench/utils.d.ts +10 -36
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +26 -66
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +20 -12
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +85 -57
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +18 -24
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +48 -69
- package/dest/e2e_deploy_contract/deploy_test.d.ts +14 -6
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +13 -19
- package/dest/e2e_epochs/epochs_test.d.ts +58 -17
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +224 -43
- package/dest/e2e_fees/bridging_race.notest.d.ts +2 -0
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +1 -0
- package/dest/e2e_fees/bridging_race.notest.js +63 -0
- package/dest/e2e_fees/fees_test.d.ts +20 -9
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +98 -107
- package/dest/e2e_l1_publisher/write_json.d.ts +10 -0
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -0
- package/dest/e2e_l1_publisher/write_json.js +57 -0
- package/dest/e2e_multi_validator/utils.d.ts +12 -0
- package/dest/e2e_multi_validator/utils.d.ts.map +1 -0
- package/dest/e2e_multi_validator/utils.js +214 -0
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +9 -6
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +22 -19
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +31 -0
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
- package/dest/e2e_p2p/inactivity_slash_test.js +135 -0
- package/dest/e2e_p2p/p2p_network.d.ts +69 -22
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +180 -129
- package/dest/e2e_p2p/shared.d.ts +41 -5
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +163 -19
- package/dest/e2e_token_contract/token_contract_test.d.ts +11 -5
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +50 -26
- package/dest/{e2e_prover → fixtures}/e2e_prover_test.d.ts +14 -9
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
- package/dest/{e2e_prover → fixtures}/e2e_prover_test.js +95 -100
- package/dest/fixtures/fixtures.d.ts +5 -6
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +4 -3
- package/dest/fixtures/get_acvm_config.d.ts +1 -1
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
- package/dest/fixtures/get_acvm_config.js +2 -14
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +10 -17
- package/dest/fixtures/l1_to_l2_messaging.d.ts +8 -5
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +44 -18
- package/dest/fixtures/setup_l1_contracts.d.ts +3 -3
- package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
- package/dest/fixtures/setup_l1_contracts.js +4 -4
- package/dest/fixtures/setup_p2p_test.d.ts +14 -13
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +73 -21
- package/dest/fixtures/snapshot_manager.d.ts +15 -7
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +147 -121
- package/dest/fixtures/token_utils.d.ts +6 -3
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +23 -10
- package/dest/fixtures/utils.d.ts +76 -37
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +464 -368
- package/dest/fixtures/web3signer.d.ts +5 -0
- package/dest/fixtures/web3signer.d.ts.map +1 -0
- package/dest/fixtures/web3signer.js +53 -0
- package/dest/quality_of_service/alert_checker.d.ts +1 -1
- package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts +41 -25
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +104 -50
- package/dest/shared/gas_portal_test_harness.d.ts +32 -24
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +50 -29
- package/dest/shared/jest_setup.js +1 -1
- package/dest/shared/submit-transactions.d.ts +5 -3
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +8 -7
- package/dest/shared/uniswap_l1_l2.d.ts +13 -11
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +138 -108
- package/dest/simulators/lending_simulator.d.ts +6 -6
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +13 -16
- package/dest/simulators/token_simulator.d.ts +5 -2
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +16 -13
- package/dest/spartan/setup_test_wallets.d.ts +23 -10
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +167 -58
- package/dest/spartan/utils.d.ts +106 -303
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +434 -130
- package/package.json +61 -56
- package/src/bench/client_flows/benchmark.ts +341 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +402 -0
- package/src/bench/client_flows/config.ts +61 -0
- package/src/bench/client_flows/data_extractor.ts +111 -0
- package/src/bench/utils.ts +22 -76
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +80 -77
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +63 -105
- package/src/e2e_deploy_contract/deploy_test.ts +23 -38
- package/src/e2e_epochs/epochs_test.ts +274 -54
- package/src/e2e_fees/bridging_race.notest.ts +80 -0
- package/src/e2e_fees/fees_test.ts +137 -136
- package/src/e2e_l1_publisher/write_json.ts +76 -0
- package/src/e2e_multi_validator/utils.ts +258 -0
- package/src/e2e_nested_contract/nested_contract_test.ts +27 -18
- package/src/e2e_p2p/inactivity_slash_test.ts +178 -0
- package/src/e2e_p2p/p2p_network.ts +272 -166
- package/src/e2e_p2p/shared.ts +244 -29
- package/src/e2e_token_contract/token_contract_test.ts +43 -39
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/{e2e_prover → fixtures}/e2e_prover_test.ts +101 -145
- package/src/fixtures/fixtures.ts +4 -3
- package/src/fixtures/get_acvm_config.ts +3 -11
- package/src/fixtures/get_bb_config.ts +18 -13
- package/src/fixtures/l1_to_l2_messaging.ts +53 -23
- package/src/fixtures/setup_l1_contracts.ts +6 -7
- package/src/fixtures/setup_p2p_test.ts +112 -38
- package/src/fixtures/snapshot_manager.ts +187 -139
- package/src/fixtures/token_utils.ts +29 -12
- package/src/fixtures/utils.ts +552 -425
- package/src/fixtures/web3signer.ts +63 -0
- package/src/guides/up_quick_start.sh +6 -14
- package/src/quality_of_service/alert_checker.ts +1 -1
- package/src/shared/cross_chain_test_harness.ts +108 -79
- package/src/shared/gas_portal_test_harness.ts +58 -49
- package/src/shared/jest_setup.ts +1 -1
- package/src/shared/submit-transactions.ts +12 -8
- package/src/shared/uniswap_l1_l2.ts +173 -176
- package/src/simulators/lending_simulator.ts +12 -15
- package/src/simulators/token_simulator.ts +21 -13
- package/src/spartan/DEVELOP.md +121 -0
- package/src/spartan/setup_test_wallets.ts +215 -93
- package/src/spartan/utils.ts +490 -130
- package/dest/e2e_prover/e2e_prover_test.d.ts.map +0 -1
- package/dest/sample-dapp/connect.js +0 -12
- package/dest/sample-dapp/contracts.js +0 -10
- package/dest/sample-dapp/deploy.js +0 -35
- package/dest/sample-dapp/index.js +0 -98
- package/src/sample-dapp/connect.mjs +0 -16
- package/src/sample-dapp/contracts.mjs +0 -14
- package/src/sample-dapp/deploy.mjs +0 -40
- package/src/sample-dapp/index.mjs +0 -128
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/end-to-end",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1-commit.b655e406",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"inherits": [
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"build": "yarn clean && tsc -b",
|
|
12
12
|
"build:dev": "tsc -b --watch",
|
|
13
13
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
14
|
-
"formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
|
|
15
14
|
"test:with-alerts": "./scripts/test-with-alerts.sh",
|
|
16
15
|
"test:e2e": "LOG_LEVEL=${LOG_LEVEL:-verbose} NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=300000 --forceExit",
|
|
17
16
|
"test:e2e-docker": "./scripts/run_test.sh simple",
|
|
@@ -26,89 +25,93 @@
|
|
|
26
25
|
"formatting": "run -T prettier --check ./src && run -T eslint ./src"
|
|
27
26
|
},
|
|
28
27
|
"dependencies": {
|
|
29
|
-
"@aztec/accounts": "0.0.
|
|
30
|
-
"@aztec/archiver": "0.0.
|
|
31
|
-
"@aztec/aztec": "0.0.
|
|
32
|
-
"@aztec/aztec-node": "0.0.
|
|
33
|
-
"@aztec/aztec.js": "0.0.
|
|
34
|
-
"@aztec/bb-prover": "0.0.
|
|
35
|
-
"@aztec/blob-lib": "0.0.
|
|
36
|
-
"@aztec/blob-sink": "0.0.
|
|
37
|
-
"@aztec/bot": "0.0.
|
|
38
|
-
"@aztec/
|
|
39
|
-
"@aztec/
|
|
40
|
-
"@aztec/
|
|
41
|
-
"@aztec/
|
|
42
|
-
"@aztec/
|
|
43
|
-
"@aztec/
|
|
44
|
-
"@aztec/
|
|
45
|
-
"@aztec/
|
|
46
|
-
"@aztec/
|
|
47
|
-
"@aztec/
|
|
48
|
-
"@aztec/
|
|
49
|
-
"@aztec/
|
|
50
|
-
"@aztec/
|
|
51
|
-
"@aztec/
|
|
52
|
-
"@aztec/
|
|
53
|
-
"@aztec/
|
|
54
|
-
"@aztec/
|
|
55
|
-
"@aztec/
|
|
56
|
-
"@aztec/
|
|
57
|
-
"@aztec/
|
|
58
|
-
"@aztec/
|
|
28
|
+
"@aztec/accounts": "0.0.1-commit.b655e406",
|
|
29
|
+
"@aztec/archiver": "0.0.1-commit.b655e406",
|
|
30
|
+
"@aztec/aztec": "0.0.1-commit.b655e406",
|
|
31
|
+
"@aztec/aztec-node": "0.0.1-commit.b655e406",
|
|
32
|
+
"@aztec/aztec.js": "0.0.1-commit.b655e406",
|
|
33
|
+
"@aztec/bb-prover": "0.0.1-commit.b655e406",
|
|
34
|
+
"@aztec/blob-lib": "0.0.1-commit.b655e406",
|
|
35
|
+
"@aztec/blob-sink": "0.0.1-commit.b655e406",
|
|
36
|
+
"@aztec/bot": "0.0.1-commit.b655e406",
|
|
37
|
+
"@aztec/cli": "0.0.1-commit.b655e406",
|
|
38
|
+
"@aztec/constants": "0.0.1-commit.b655e406",
|
|
39
|
+
"@aztec/entrypoints": "0.0.1-commit.b655e406",
|
|
40
|
+
"@aztec/epoch-cache": "0.0.1-commit.b655e406",
|
|
41
|
+
"@aztec/ethereum": "0.0.1-commit.b655e406",
|
|
42
|
+
"@aztec/foundation": "0.0.1-commit.b655e406",
|
|
43
|
+
"@aztec/kv-store": "0.0.1-commit.b655e406",
|
|
44
|
+
"@aztec/l1-artifacts": "0.0.1-commit.b655e406",
|
|
45
|
+
"@aztec/merkle-tree": "0.0.1-commit.b655e406",
|
|
46
|
+
"@aztec/node-keystore": "0.0.1-commit.b655e406",
|
|
47
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.b655e406",
|
|
48
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.b655e406",
|
|
49
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.b655e406",
|
|
50
|
+
"@aztec/noir-test-contracts.js": "0.0.1-commit.b655e406",
|
|
51
|
+
"@aztec/p2p": "0.0.1-commit.b655e406",
|
|
52
|
+
"@aztec/protocol-contracts": "0.0.1-commit.b655e406",
|
|
53
|
+
"@aztec/prover-client": "0.0.1-commit.b655e406",
|
|
54
|
+
"@aztec/prover-node": "0.0.1-commit.b655e406",
|
|
55
|
+
"@aztec/pxe": "0.0.1-commit.b655e406",
|
|
56
|
+
"@aztec/sequencer-client": "0.0.1-commit.b655e406",
|
|
57
|
+
"@aztec/simulator": "0.0.1-commit.b655e406",
|
|
58
|
+
"@aztec/slasher": "0.0.1-commit.b655e406",
|
|
59
|
+
"@aztec/stdlib": "0.0.1-commit.b655e406",
|
|
60
|
+
"@aztec/telemetry-client": "0.0.1-commit.b655e406",
|
|
61
|
+
"@aztec/test-wallet": "0.0.1-commit.b655e406",
|
|
62
|
+
"@aztec/validator-client": "0.0.1-commit.b655e406",
|
|
63
|
+
"@aztec/world-state": "0.0.1-commit.b655e406",
|
|
59
64
|
"@iarna/toml": "^2.2.5",
|
|
60
|
-
"@jest/globals": "^
|
|
61
|
-
"@noble/curves": "
|
|
65
|
+
"@jest/globals": "^30.0.0",
|
|
66
|
+
"@noble/curves": "=1.0.0",
|
|
62
67
|
"@swc/core": "^1.4.11",
|
|
63
68
|
"@swc/jest": "^0.2.36",
|
|
64
69
|
"@types/fs-extra": "^11.0.2",
|
|
65
|
-
"@types/jest": "^
|
|
66
|
-
"@types/koa": "^2.
|
|
70
|
+
"@types/jest": "^30.0.0",
|
|
71
|
+
"@types/koa": "^2.15.0",
|
|
67
72
|
"@types/koa-static": "^4.0.2",
|
|
68
|
-
"@types/levelup": "^5.1.2",
|
|
69
73
|
"@types/lodash.every": "^4.6.7",
|
|
70
|
-
"@types/
|
|
71
|
-
"@types/node": "^18.7.23",
|
|
74
|
+
"@types/node": "^22.15.17",
|
|
72
75
|
"@viem/anvil": "^0.0.9",
|
|
73
76
|
"buffer": "^6.0.3",
|
|
74
|
-
"crypto-browserify": "^3.12.
|
|
77
|
+
"crypto-browserify": "^3.12.1",
|
|
75
78
|
"fs-extra": "^11.2.0",
|
|
76
79
|
"get-port": "^7.1.0",
|
|
77
80
|
"glob": "^10.3.10",
|
|
78
|
-
"jest": "^
|
|
79
|
-
"jest-extended": "^
|
|
80
|
-
"jest-mock-extended": "^
|
|
81
|
-
"koa": "^2.
|
|
81
|
+
"jest": "^30.0.0",
|
|
82
|
+
"jest-extended": "^6.0.0",
|
|
83
|
+
"jest-mock-extended": "^4.0.0",
|
|
84
|
+
"koa": "^2.16.1",
|
|
82
85
|
"koa-static": "^5.0.0",
|
|
83
|
-
"levelup": "^5.1.1",
|
|
84
86
|
"lodash.chunk": "^4.2.0",
|
|
85
87
|
"lodash.compact": "^3.0.1",
|
|
86
88
|
"lodash.every": "^4.6.0",
|
|
87
89
|
"lodash.omit": "^4.5.0",
|
|
88
|
-
"
|
|
90
|
+
"msgpackr": "^1.11.2",
|
|
89
91
|
"process": "^0.11.10",
|
|
92
|
+
"snappy": "^7.2.2",
|
|
90
93
|
"stream-browserify": "^3.0.0",
|
|
91
94
|
"string-argv": "^0.3.2",
|
|
92
|
-
"ts-loader": "^9.
|
|
95
|
+
"ts-loader": "^9.5.4",
|
|
93
96
|
"ts-node": "^10.9.1",
|
|
94
97
|
"tslib": "^2.4.0",
|
|
95
|
-
"typescript": "^5.
|
|
98
|
+
"typescript": "^5.3.3",
|
|
96
99
|
"util": "^0.12.5",
|
|
97
|
-
"viem": "2.
|
|
100
|
+
"viem": "npm:@spalladino/viem@2.38.2-eip7594.0",
|
|
98
101
|
"zod": "^3.23.8"
|
|
99
102
|
},
|
|
100
103
|
"devDependencies": {
|
|
101
104
|
"0x": "^5.7.0",
|
|
102
|
-
"@jest/globals": "^
|
|
103
|
-
"@types/jest": "^
|
|
105
|
+
"@jest/globals": "^30.0.0",
|
|
106
|
+
"@types/jest": "^30.0.0",
|
|
104
107
|
"@types/js-yaml": "^4.0.9",
|
|
105
108
|
"@types/lodash.chunk": "^4.2.9",
|
|
106
109
|
"concurrently": "^7.6.0",
|
|
107
|
-
"jest": "^
|
|
108
|
-
"jest-extended": "^
|
|
110
|
+
"jest": "^30.0.0",
|
|
111
|
+
"jest-extended": "^6.0.0",
|
|
109
112
|
"js-yaml": "^4.1.0",
|
|
110
113
|
"ts-node": "^10.9.1",
|
|
111
|
-
"typescript": "^5.
|
|
114
|
+
"typescript": "^5.3.3"
|
|
112
115
|
},
|
|
113
116
|
"files": [
|
|
114
117
|
"dest",
|
|
@@ -117,11 +120,12 @@
|
|
|
117
120
|
],
|
|
118
121
|
"types": "./dest/index.d.ts",
|
|
119
122
|
"engines": {
|
|
120
|
-
"node": ">=
|
|
123
|
+
"node": ">=20.10"
|
|
121
124
|
},
|
|
122
125
|
"jest": {
|
|
123
126
|
"slowTestThreshold": 300,
|
|
124
127
|
"setupFilesAfterEnv": [
|
|
128
|
+
"../../foundation/src/jest/setupAfterEnv.mjs",
|
|
125
129
|
"jest-extended/all",
|
|
126
130
|
"./shared/jest_setup.ts"
|
|
127
131
|
],
|
|
@@ -155,6 +159,7 @@
|
|
|
155
159
|
"testTimeout": 120000,
|
|
156
160
|
"setupFiles": [
|
|
157
161
|
"../../foundation/src/jest/setup.mjs"
|
|
158
|
-
]
|
|
162
|
+
],
|
|
163
|
+
"testEnvironment": "../../foundation/src/jest/env.mjs"
|
|
159
164
|
}
|
|
160
165
|
}
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ContractFunctionInteraction,
|
|
3
|
+
DeployMethod,
|
|
4
|
+
type DeployOptions,
|
|
5
|
+
type ProfileInteractionOptions,
|
|
6
|
+
} from '@aztec/aztec.js/contracts';
|
|
7
|
+
import type { Logger } from '@aztec/aztec.js/log';
|
|
8
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
9
|
+
import { type PrivateExecutionStep, serializePrivateExecutionSteps } from '@aztec/stdlib/kernel';
|
|
10
|
+
import type { ProvingStats, ProvingTimings, SimulationStats, SimulationTimings } from '@aztec/stdlib/tx';
|
|
11
|
+
|
|
12
|
+
import assert from 'node:assert';
|
|
13
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
14
|
+
import { join } from 'node:path';
|
|
15
|
+
|
|
16
|
+
import type { GithubActionBenchmarkResult } from '../utils.js';
|
|
17
|
+
|
|
18
|
+
const logger = createLogger('bench:profile_capture');
|
|
19
|
+
|
|
20
|
+
const logLevel = ['silent', 'fatal', 'error', 'warn', 'info', 'verbose', 'debug', 'trace'] as const;
|
|
21
|
+
type LogLevel = (typeof logLevel)[number];
|
|
22
|
+
|
|
23
|
+
export type Log = {
|
|
24
|
+
type: LogLevel;
|
|
25
|
+
timestamp: number;
|
|
26
|
+
prefix: string;
|
|
27
|
+
message: string;
|
|
28
|
+
data: any;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const GATE_TYPES = [
|
|
32
|
+
'ecc_op',
|
|
33
|
+
'busread',
|
|
34
|
+
'lookup',
|
|
35
|
+
'pub_inputs',
|
|
36
|
+
'arithmetic',
|
|
37
|
+
'delta_range',
|
|
38
|
+
'elliptic',
|
|
39
|
+
'memory',
|
|
40
|
+
'nnf',
|
|
41
|
+
'poseidon2_external',
|
|
42
|
+
'poseidon2_internal',
|
|
43
|
+
'overflow',
|
|
44
|
+
] as const;
|
|
45
|
+
|
|
46
|
+
type GateType = (typeof GATE_TYPES)[number];
|
|
47
|
+
|
|
48
|
+
type StructuredTrace = {
|
|
49
|
+
[k in GateType]: number;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export class ProxyLogger {
|
|
53
|
+
private static instance: ProxyLogger;
|
|
54
|
+
private logs: Log[] = [];
|
|
55
|
+
|
|
56
|
+
private constructor() {}
|
|
57
|
+
|
|
58
|
+
static create() {
|
|
59
|
+
ProxyLogger.instance = new ProxyLogger();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static getInstance() {
|
|
63
|
+
return ProxyLogger.instance;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
createLogger(prefix: string): Logger {
|
|
67
|
+
return new Proxy(createLogger(prefix), {
|
|
68
|
+
get: (target: Logger, prop: keyof Logger) => {
|
|
69
|
+
if (logLevel.includes(prop as (typeof logLevel)[number])) {
|
|
70
|
+
return function (this: Logger, ...data: Parameters<Logger[LogLevel]>) {
|
|
71
|
+
const loggingFn = prop as LogLevel;
|
|
72
|
+
const args = [loggingFn, prefix, ...data] as Parameters<ProxyLogger['handleLog']>;
|
|
73
|
+
ProxyLogger.getInstance().handleLog(...args);
|
|
74
|
+
target[loggingFn].call(this, ...[data[0], data[1]]);
|
|
75
|
+
};
|
|
76
|
+
} else {
|
|
77
|
+
return target[prop];
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
private handleLog(type: (typeof logLevel)[number], prefix: string, message: string, data: any) {
|
|
84
|
+
this.logs.unshift({ type, prefix, message, data, timestamp: Date.now() });
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
public flushLogs() {
|
|
88
|
+
this.logs = [];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
public getLogs() {
|
|
92
|
+
return this.logs;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export type ProverType = 'wasm' | 'native';
|
|
97
|
+
|
|
98
|
+
type CallRecording = {
|
|
99
|
+
// Number of times the function has been called
|
|
100
|
+
calls: number;
|
|
101
|
+
// Maximum time taken by the function (in ms)
|
|
102
|
+
max: number;
|
|
103
|
+
// Minimum time taken by the function (in ms)
|
|
104
|
+
min: number;
|
|
105
|
+
// Average time taken by the function (in ms)
|
|
106
|
+
avg: number;
|
|
107
|
+
// Total time spent in the function, computed as sum of all calls (in ms)
|
|
108
|
+
total: number;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
type Step = Pick<PrivateExecutionStep, 'functionName' | 'gateCount'> & {
|
|
112
|
+
time: number;
|
|
113
|
+
accGateCount?: number;
|
|
114
|
+
oracles: Record<string, CallRecording>;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
type ClientFlowBenchmark = {
|
|
118
|
+
name: string;
|
|
119
|
+
timings: Omit<ProvingTimings & SimulationTimings, 'perFunction'> & { witgen: number };
|
|
120
|
+
maxMemory: number;
|
|
121
|
+
rpc: Record<string, CallRecording>;
|
|
122
|
+
proverType: ProverType;
|
|
123
|
+
minimumTrace: StructuredTrace;
|
|
124
|
+
totalGateCount: number;
|
|
125
|
+
steps: Step[];
|
|
126
|
+
error: string | undefined;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
function getMinimumTrace(logs: Log[]): StructuredTrace {
|
|
130
|
+
const LOG_MESSAGE_CANDIDATE_PADDING = 5;
|
|
131
|
+
const minimumMessage = 'Minimum required block sizes for structured trace';
|
|
132
|
+
const minimumMessageIndex = logs.findIndex(log => log.message.includes(minimumMessage));
|
|
133
|
+
const candidateLogs = logs.slice(
|
|
134
|
+
minimumMessageIndex - GATE_TYPES.length,
|
|
135
|
+
minimumMessageIndex + LOG_MESSAGE_CANDIDATE_PADDING,
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
const traceLogs = candidateLogs
|
|
139
|
+
.filter(log => GATE_TYPES.some(type => log.message.includes(type)))
|
|
140
|
+
.map(log => log.message.split(/\t|\n/))
|
|
141
|
+
.flat()
|
|
142
|
+
.map(log => log.replace(/\(mem: .*\)/, '').trim())
|
|
143
|
+
.filter(Boolean);
|
|
144
|
+
|
|
145
|
+
const traceSizes = traceLogs.map(log => {
|
|
146
|
+
const [gateType, gateSizeStr] = log
|
|
147
|
+
.replace(/\n.*\)$/, '')
|
|
148
|
+
.replace(/bb - /, '')
|
|
149
|
+
.split(':')
|
|
150
|
+
.map(s => s.trim());
|
|
151
|
+
const gateSize = parseInt(gateSizeStr);
|
|
152
|
+
assert(GATE_TYPES.includes(gateType as GateType), `Gate type ${gateType} is not recognized`);
|
|
153
|
+
return { [gateType]: gateSize };
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
assert(traceSizes.length === GATE_TYPES.length, 'Decoded trace sizes do not match expected amount of gate types');
|
|
157
|
+
return traceSizes.reduce((acc, curr) => ({ ...acc, ...curr }), {}) as StructuredTrace;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function getMaxMemory(logs: Log[]): number {
|
|
161
|
+
const candidateLogs = logs.slice(0, 100).filter(log => /\(mem: .*MiB\)/.test(log.message));
|
|
162
|
+
const usage = candidateLogs.map(log => {
|
|
163
|
+
const memStr = log ? log.message.slice(log.message.indexOf('(mem: ') + 6, log.message.indexOf('MiB') - 3) : '';
|
|
164
|
+
return memStr ? parseInt(memStr) : 0;
|
|
165
|
+
});
|
|
166
|
+
return Math.max(...usage);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export function generateBenchmark(
|
|
170
|
+
flow: string,
|
|
171
|
+
logs: Log[],
|
|
172
|
+
stats: ProvingStats | SimulationStats,
|
|
173
|
+
privateExecutionSteps: PrivateExecutionStep[],
|
|
174
|
+
proverType: ProverType,
|
|
175
|
+
error: string | undefined,
|
|
176
|
+
): ClientFlowBenchmark {
|
|
177
|
+
let maxMemory = 0;
|
|
178
|
+
let minimumTrace: StructuredTrace;
|
|
179
|
+
try {
|
|
180
|
+
minimumTrace = getMinimumTrace(logs);
|
|
181
|
+
maxMemory = getMaxMemory(logs);
|
|
182
|
+
} catch {
|
|
183
|
+
logger.warn(`Failed obtain minimum trace and max memory for ${flow}. Did you run with REAL_PROOFS=1?`);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const steps = privateExecutionSteps.reduce<Step[]>((acc, step, i) => {
|
|
187
|
+
const previousAccGateCount = i === 0 ? 0 : acc[i - 1].accGateCount!;
|
|
188
|
+
return [
|
|
189
|
+
...acc,
|
|
190
|
+
{
|
|
191
|
+
functionName: step.functionName,
|
|
192
|
+
gateCount: step.gateCount,
|
|
193
|
+
accGateCount: previousAccGateCount + step.gateCount!,
|
|
194
|
+
time: step.timings.witgen,
|
|
195
|
+
oracles: Object.entries(step.timings.oracles ?? {}).reduce(
|
|
196
|
+
(acc, [oracleName, oracleData]) => {
|
|
197
|
+
const total = oracleData.times.reduce((sum, time) => sum + time, 0);
|
|
198
|
+
const calls = oracleData.times.length;
|
|
199
|
+
acc[oracleName] = {
|
|
200
|
+
calls,
|
|
201
|
+
max: Math.max(...oracleData.times),
|
|
202
|
+
min: Math.min(...oracleData.times),
|
|
203
|
+
total,
|
|
204
|
+
avg: total / calls,
|
|
205
|
+
};
|
|
206
|
+
return acc;
|
|
207
|
+
},
|
|
208
|
+
{} as Record<string, CallRecording>,
|
|
209
|
+
),
|
|
210
|
+
},
|
|
211
|
+
];
|
|
212
|
+
}, []);
|
|
213
|
+
const timings = stats.timings;
|
|
214
|
+
const totalGateCount = steps[steps.length - 1].accGateCount;
|
|
215
|
+
return {
|
|
216
|
+
name: flow,
|
|
217
|
+
timings: {
|
|
218
|
+
total: timings.total,
|
|
219
|
+
sync: timings.sync!,
|
|
220
|
+
proving: (timings as ProvingTimings).proving,
|
|
221
|
+
unaccounted: timings.unaccounted,
|
|
222
|
+
witgen: timings.perFunction.reduce((acc, fn) => acc + fn.time, 0),
|
|
223
|
+
},
|
|
224
|
+
rpc: Object.entries(stats.nodeRPCCalls ?? {}).reduce(
|
|
225
|
+
(acc, [RPCName, RPCCalls]) => {
|
|
226
|
+
const total = RPCCalls.times.reduce((sum, time) => sum + time, 0);
|
|
227
|
+
const calls = RPCCalls.times.length;
|
|
228
|
+
acc[RPCName] = {
|
|
229
|
+
calls,
|
|
230
|
+
max: Math.max(...RPCCalls.times),
|
|
231
|
+
min: Math.min(...RPCCalls.times),
|
|
232
|
+
total,
|
|
233
|
+
avg: total / calls,
|
|
234
|
+
};
|
|
235
|
+
return acc;
|
|
236
|
+
},
|
|
237
|
+
{} as Record<string, CallRecording>,
|
|
238
|
+
),
|
|
239
|
+
maxMemory,
|
|
240
|
+
proverType,
|
|
241
|
+
minimumTrace: minimumTrace!,
|
|
242
|
+
totalGateCount: totalGateCount!,
|
|
243
|
+
steps,
|
|
244
|
+
error,
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export function convertProfileToGHBenchmark(benchmark: ClientFlowBenchmark): GithubActionBenchmarkResult[] {
|
|
249
|
+
const totalRPCCalls = Object.values(benchmark.rpc).reduce((acc, call) => acc + call.calls, 0);
|
|
250
|
+
const benches = [
|
|
251
|
+
{
|
|
252
|
+
name: `${benchmark.name}/witgen`,
|
|
253
|
+
value: benchmark.timings.witgen,
|
|
254
|
+
unit: 'ms',
|
|
255
|
+
},
|
|
256
|
+
|
|
257
|
+
{
|
|
258
|
+
name: `${benchmark.name}/total`,
|
|
259
|
+
value: benchmark.timings.total,
|
|
260
|
+
unit: 'ms',
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
name: `${benchmark.name}/sync`,
|
|
264
|
+
value: benchmark.timings.sync!,
|
|
265
|
+
unit: 'ms',
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
name: `${benchmark.name}/unaccounted`,
|
|
269
|
+
value: benchmark.timings.unaccounted,
|
|
270
|
+
unit: 'ms',
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
{
|
|
274
|
+
name: `${benchmark.name}/total_gate_count`,
|
|
275
|
+
value: benchmark.totalGateCount,
|
|
276
|
+
unit: 'gates',
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
name: `${benchmark.name}/rpc`,
|
|
280
|
+
value: totalRPCCalls,
|
|
281
|
+
unit: 'calls',
|
|
282
|
+
},
|
|
283
|
+
];
|
|
284
|
+
if (benchmark.timings.proving) {
|
|
285
|
+
benches.push({
|
|
286
|
+
name: `${benchmark.name}/proving`,
|
|
287
|
+
value: benchmark.timings.proving,
|
|
288
|
+
unit: 'ms',
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
if (benchmark.maxMemory) {
|
|
292
|
+
benches.push({
|
|
293
|
+
name: `${benchmark.name}/max_memory`,
|
|
294
|
+
value: benchmark.maxMemory,
|
|
295
|
+
unit: 'MiB',
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
return benches;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export async function captureProfile(
|
|
302
|
+
label: string,
|
|
303
|
+
interaction: ContractFunctionInteraction | DeployMethod,
|
|
304
|
+
opts: Omit<ProfileInteractionOptions & DeployOptions, 'profileMode'>,
|
|
305
|
+
expectedSteps?: number,
|
|
306
|
+
) {
|
|
307
|
+
// Make sure the proxy logger starts from a clean slate
|
|
308
|
+
ProxyLogger.getInstance().flushLogs();
|
|
309
|
+
const result = await interaction.profile({ ...opts, profileMode: 'full', skipProofGeneration: false });
|
|
310
|
+
const logs = ProxyLogger.getInstance().getLogs();
|
|
311
|
+
if (expectedSteps !== undefined && result.executionSteps.length !== expectedSteps) {
|
|
312
|
+
throw new Error(`Expected ${expectedSteps} execution steps, got ${result.executionSteps.length}`);
|
|
313
|
+
}
|
|
314
|
+
const benchmark = generateBenchmark(label, logs, result.stats, result.executionSteps, 'wasm', undefined);
|
|
315
|
+
|
|
316
|
+
const ivcFolder = process.env.CAPTURE_IVC_FOLDER;
|
|
317
|
+
if (ivcFolder) {
|
|
318
|
+
logger.info(`Capturing chonk execution profile for ${label}`);
|
|
319
|
+
|
|
320
|
+
const resultsDirectory = join(ivcFolder, label);
|
|
321
|
+
logger.info(`Writing private execution steps to ${resultsDirectory}`);
|
|
322
|
+
await mkdir(resultsDirectory, { recursive: true });
|
|
323
|
+
// Write the chonk files read by the prover.
|
|
324
|
+
const ivcInputsPath = join(resultsDirectory, 'ivc-inputs.msgpack');
|
|
325
|
+
await writeFile(ivcInputsPath, serializePrivateExecutionSteps(result.executionSteps));
|
|
326
|
+
await writeFile(join(resultsDirectory, 'logs.json'), JSON.stringify(logs, null, 2));
|
|
327
|
+
await writeFile(join(resultsDirectory, 'benchmark.json'), JSON.stringify(benchmark, null, 2));
|
|
328
|
+
logger.info(`Wrote private execution steps to ${resultsDirectory}`);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const benchOutput = process.env.BENCH_OUTPUT;
|
|
332
|
+
if (benchOutput) {
|
|
333
|
+
await mkdir(benchOutput, { recursive: true });
|
|
334
|
+
const ghBenchmark = convertProfileToGHBenchmark(benchmark);
|
|
335
|
+
const benchFile = join(benchOutput, `${label}.bench.json`);
|
|
336
|
+
await writeFile(benchFile, JSON.stringify(ghBenchmark));
|
|
337
|
+
logger.info(`Wrote benchmark to ${benchFile}`);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
return result;
|
|
341
|
+
}
|