@pimlico/alto 0.0.0-main.20240607T104359 → 0.0.0-staging.20240606T093925

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.
Files changed (238) hide show
  1. package/lib/cli/index.d.ts +0 -1
  2. package/lib/cli/index.js +0 -1
  3. package/lib/cli/index.js.map +1 -1
  4. package/lib/executor/executor.js +0 -6
  5. package/lib/executor/executor.js.map +1 -1
  6. package/lib/executor/executorManager.js +0 -1
  7. package/lib/executor/executorManager.js.map +1 -1
  8. package/lib/executor/utils.js +1 -3
  9. package/lib/executor/utils.js.map +1 -1
  10. package/lib/index.d.ts +5 -1
  11. package/lib/index.js +120 -1
  12. package/lib/index.js.map +1 -1
  13. package/lib/rpc/server.js +1 -2
  14. package/lib/rpc/server.js.map +1 -1
  15. package/lib/types/mempool.d.ts +1 -2
  16. package/package.json +67 -70
  17. package/esm/cli/alto.d.ts +0 -6
  18. package/esm/cli/alto.js +0 -92
  19. package/esm/cli/alto.js.map +0 -1
  20. package/esm/cli/config/bundler.d.ts +0 -391
  21. package/esm/cli/config/bundler.js +0 -132
  22. package/esm/cli/config/bundler.js.map +0 -1
  23. package/esm/cli/config/index.d.ts +0 -3
  24. package/esm/cli/config/index.js +0 -3
  25. package/esm/cli/config/index.js.map +0 -1
  26. package/esm/cli/config/options.d.ts +0 -11
  27. package/esm/cli/config/options.js +0 -336
  28. package/esm/cli/config/options.js.map +0 -1
  29. package/esm/cli/customTransport.d.ts +0 -14
  30. package/esm/cli/customTransport.js +0 -53
  31. package/esm/cli/customTransport.js.map +0 -1
  32. package/esm/cli/handler.d.ts +0 -3
  33. package/esm/cli/handler.js +0 -116
  34. package/esm/cli/handler.js.map +0 -1
  35. package/esm/cli/index.d.ts +0 -4
  36. package/esm/cli/index.js +0 -4
  37. package/esm/cli/index.js.map +0 -1
  38. package/esm/cli/instrumentation.d.ts +0 -2
  39. package/esm/cli/instrumentation.js +0 -39
  40. package/esm/cli/instrumentation.js.map +0 -1
  41. package/esm/cli/setupServer.d.ts +0 -17
  42. package/esm/cli/setupServer.js +0 -155
  43. package/esm/cli/setupServer.js.map +0 -1
  44. package/esm/cli/util.d.ts +0 -22
  45. package/esm/cli/util.js +0 -30
  46. package/esm/cli/util.js.map +0 -1
  47. package/esm/executor/executor.d.ts +0 -54
  48. package/esm/executor/executor.js +0 -643
  49. package/esm/executor/executor.js.map +0 -1
  50. package/esm/executor/executorManager.d.ts +0 -34
  51. package/esm/executor/executorManager.js +0 -402
  52. package/esm/executor/executorManager.js.map +0 -1
  53. package/esm/executor/index.d.ts +0 -5
  54. package/esm/executor/index.js +0 -5
  55. package/esm/executor/index.js.map +0 -1
  56. package/esm/executor/senderManager.d.ts +0 -17
  57. package/esm/executor/senderManager.js +0 -160
  58. package/esm/executor/senderManager.js.map +0 -1
  59. package/esm/executor/test/utils.d.ts +0 -13
  60. package/esm/executor/test/utils.js +0 -75
  61. package/esm/executor/test/utils.js.map +0 -1
  62. package/esm/executor/utils.d.ts +0 -32
  63. package/esm/executor/utils.js +0 -241
  64. package/esm/executor/utils.js.map +0 -1
  65. package/esm/index.d.ts +0 -2
  66. package/esm/index.js +0 -2
  67. package/esm/index.js.map +0 -1
  68. package/esm/mempool/index.d.ts +0 -5
  69. package/esm/mempool/index.js +0 -5
  70. package/esm/mempool/index.js.map +0 -1
  71. package/esm/mempool/mempool.d.ts +0 -64
  72. package/esm/mempool/mempool.js +0 -489
  73. package/esm/mempool/mempool.js.map +0 -1
  74. package/esm/mempool/monitoring.d.ts +0 -10
  75. package/esm/mempool/monitoring.js +0 -34
  76. package/esm/mempool/monitoring.js.map +0 -1
  77. package/esm/mempool/nullMempool.d.ts +0 -15
  78. package/esm/mempool/nullMempool.js +0 -36
  79. package/esm/mempool/nullMempool.js.map +0 -1
  80. package/esm/mempool/reputationManager.d.ts +0 -115
  81. package/esm/mempool/reputationManager.js +0 -397
  82. package/esm/mempool/reputationManager.js.map +0 -1
  83. package/esm/mempool/store.d.ts +0 -22
  84. package/esm/mempool/store.js +0 -123
  85. package/esm/mempool/store.js.map +0 -1
  86. package/esm/rpc/EntryPointSimulationsV07.d.ts +0 -58
  87. package/esm/rpc/EntryPointSimulationsV07.js +0 -407
  88. package/esm/rpc/EntryPointSimulationsV07.js.map +0 -1
  89. package/esm/rpc/ExecuteSimulator.d.ts +0 -37
  90. package/esm/rpc/ExecuteSimulator.js +0 -48
  91. package/esm/rpc/ExecuteSimulator.js.map +0 -1
  92. package/esm/rpc/gasEstimation.d.ts +0 -17
  93. package/esm/rpc/gasEstimation.js +0 -410
  94. package/esm/rpc/gasEstimation.js.map +0 -1
  95. package/esm/rpc/index.d.ts +0 -5
  96. package/esm/rpc/index.js +0 -5
  97. package/esm/rpc/index.js.map +0 -1
  98. package/esm/rpc/nonceQueuer.d.ts +0 -25
  99. package/esm/rpc/nonceQueuer.js +0 -135
  100. package/esm/rpc/nonceQueuer.js.map +0 -1
  101. package/esm/rpc/rpcHandler.d.ts +0 -64
  102. package/esm/rpc/rpcHandler.js +0 -727
  103. package/esm/rpc/rpcHandler.js.map +0 -1
  104. package/esm/rpc/server.d.ts +0 -31
  105. package/esm/rpc/server.js +0 -239
  106. package/esm/rpc/server.js.map +0 -1
  107. package/esm/rpc/validation/BundlerCollectorTracerV06.d.ts +0 -102
  108. package/esm/rpc/validation/BundlerCollectorTracerV06.js +0 -255
  109. package/esm/rpc/validation/BundlerCollectorTracerV06.js.map +0 -1
  110. package/esm/rpc/validation/BundlerCollectorTracerV07.d.ts +0 -102
  111. package/esm/rpc/validation/BundlerCollectorTracerV07.js +0 -254
  112. package/esm/rpc/validation/BundlerCollectorTracerV07.js.map +0 -1
  113. package/esm/rpc/validation/SafeValidator.d.ts +0 -35
  114. package/esm/rpc/validation/SafeValidator.js +0 -487
  115. package/esm/rpc/validation/SafeValidator.js.map +0 -1
  116. package/esm/rpc/validation/TracerResultParserV06.d.ts +0 -13
  117. package/esm/rpc/validation/TracerResultParserV06.js +0 -578
  118. package/esm/rpc/validation/TracerResultParserV06.js.map +0 -1
  119. package/esm/rpc/validation/TracerResultParserV07.d.ts +0 -33
  120. package/esm/rpc/validation/TracerResultParserV07.js +0 -557
  121. package/esm/rpc/validation/TracerResultParserV07.js.map +0 -1
  122. package/esm/rpc/validation/UnsafeValidator.d.ts +0 -63
  123. package/esm/rpc/validation/UnsafeValidator.js +0 -257
  124. package/esm/rpc/validation/UnsafeValidator.js.map +0 -1
  125. package/esm/rpc/validation/index.d.ts +0 -3
  126. package/esm/rpc/validation/index.js +0 -3
  127. package/esm/rpc/validation/index.js.map +0 -1
  128. package/esm/rpc/validation/tracer.d.ts +0 -122
  129. package/esm/rpc/validation/tracer.js +0 -82
  130. package/esm/rpc/validation/tracer.js.map +0 -1
  131. package/esm/types/contracts/BundleBulker.d.ts +0 -120
  132. package/esm/types/contracts/BundleBulker.js +0 -157
  133. package/esm/types/contracts/BundleBulker.js.map +0 -1
  134. package/esm/types/contracts/CallEngine.d.ts +0 -28
  135. package/esm/types/contracts/CallEngine.js +0 -37
  136. package/esm/types/contracts/CallEngine.js.map +0 -1
  137. package/esm/types/contracts/CodeHashGetter.d.ts +0 -37
  138. package/esm/types/contracts/CodeHashGetter.js +0 -45
  139. package/esm/types/contracts/CodeHashGetter.js.map +0 -1
  140. package/esm/types/contracts/EntryPoint.d.ts +0 -1789
  141. package/esm/types/contracts/EntryPoint.js +0 -2304
  142. package/esm/types/contracts/EntryPoint.js.map +0 -1
  143. package/esm/types/contracts/EntryPointSimulations.d.ts +0 -153
  144. package/esm/types/contracts/EntryPointSimulations.js +0 -15
  145. package/esm/types/contracts/EntryPointSimulations.js.map +0 -1
  146. package/esm/types/contracts/IOpInflator.d.ts +0 -61
  147. package/esm/types/contracts/IOpInflator.js +0 -80
  148. package/esm/types/contracts/IOpInflator.js.map +0 -1
  149. package/esm/types/contracts/IPaymaster.d.ts +0 -3
  150. package/esm/types/contracts/IPaymaster.js +0 -117
  151. package/esm/types/contracts/IPaymaster.js.map +0 -1
  152. package/esm/types/contracts/Inflator.d.ts +0 -65
  153. package/esm/types/contracts/Inflator.js +0 -84
  154. package/esm/types/contracts/Inflator.js.map +0 -1
  155. package/esm/types/contracts/PerOpInflator.d.ts +0 -176
  156. package/esm/types/contracts/PerOpInflator.js +0 -229
  157. package/esm/types/contracts/PerOpInflator.js.map +0 -1
  158. package/esm/types/contracts/PimlicoEntryPointSimulations.d.ts +0 -23
  159. package/esm/types/contracts/PimlicoEntryPointSimulations.js +0 -33
  160. package/esm/types/contracts/PimlicoEntryPointSimulations.js.map +0 -1
  161. package/esm/types/contracts/SenderCreator.d.ts +0 -4
  162. package/esm/types/contracts/SenderCreator.js +0 -23
  163. package/esm/types/contracts/SenderCreator.js.map +0 -1
  164. package/esm/types/contracts/SimpleAccountFactory.d.ts +0 -57
  165. package/esm/types/contracts/SimpleAccountFactory.js +0 -76
  166. package/esm/types/contracts/SimpleAccountFactory.js.map +0 -1
  167. package/esm/types/contracts/TestOpcodesAccount.d.ts +0 -4
  168. package/esm/types/contracts/TestOpcodesAccount.js +0 -281
  169. package/esm/types/contracts/TestOpcodesAccount.js.map +0 -1
  170. package/esm/types/contracts/TestOpcodesAccountFactory.d.ts +0 -4
  171. package/esm/types/contracts/TestOpcodesAccountFactory.js +0 -23
  172. package/esm/types/contracts/TestOpcodesAccountFactory.js.map +0 -1
  173. package/esm/types/contracts/TestStorageAccount.d.ts +0 -4
  174. package/esm/types/contracts/TestStorageAccount.js +0 -313
  175. package/esm/types/contracts/TestStorageAccount.js.map +0 -1
  176. package/esm/types/contracts/index.d.ts +0 -17
  177. package/esm/types/contracts/index.js +0 -17
  178. package/esm/types/contracts/index.js.map +0 -1
  179. package/esm/types/gasPrice.d.ts +0 -110
  180. package/esm/types/gasPrice.js +0 -52
  181. package/esm/types/gasPrice.js.map +0 -1
  182. package/esm/types/index.d.ts +0 -11
  183. package/esm/types/index.js +0 -11
  184. package/esm/types/index.js.map +0 -1
  185. package/esm/types/interfaces.d.ts +0 -26
  186. package/esm/types/interfaces.js +0 -2
  187. package/esm/types/interfaces.js.map +0 -1
  188. package/esm/types/mempool.d.ts +0 -79
  189. package/esm/types/mempool.js +0 -16
  190. package/esm/types/mempool.js.map +0 -1
  191. package/esm/types/schemas.d.ts +0 -4791
  192. package/esm/types/schemas.js +0 -497
  193. package/esm/types/schemas.js.map +0 -1
  194. package/esm/types/test/validationTestErrors.d.ts +0 -3
  195. package/esm/types/test/validationTestErrors.js +0 -229
  196. package/esm/types/test/validationTestErrors.js.map +0 -1
  197. package/esm/types/utils.d.ts +0 -24
  198. package/esm/types/utils.js +0 -30
  199. package/esm/types/utils.js.map +0 -1
  200. package/esm/types/validation.d.ts +0 -14327
  201. package/esm/types/validation.js +0 -304
  202. package/esm/types/validation.js.map +0 -1
  203. package/esm/utils/bigInt.d.ts +0 -3
  204. package/esm/utils/bigInt.js +0 -9
  205. package/esm/utils/bigInt.js.map +0 -1
  206. package/esm/utils/compressionHandler.d.ts +0 -11
  207. package/esm/utils/compressionHandler.js +0 -39
  208. package/esm/utils/compressionHandler.js.map +0 -1
  209. package/esm/utils/gasPriceManager.d.ts +0 -34
  210. package/esm/utils/gasPriceManager.js +0 -338
  211. package/esm/utils/gasPriceManager.js.map +0 -1
  212. package/esm/utils/helpers.d.ts +0 -4
  213. package/esm/utils/helpers.js +0 -13
  214. package/esm/utils/helpers.js.map +0 -1
  215. package/esm/utils/index.d.ts +0 -11
  216. package/esm/utils/index.js +0 -10
  217. package/esm/utils/index.js.map +0 -1
  218. package/esm/utils/logger.d.ts +0 -6
  219. package/esm/utils/logger.js +0 -76
  220. package/esm/utils/logger.js.map +0 -1
  221. package/esm/utils/metrics.d.ts +0 -22
  222. package/esm/utils/metrics.js +0 -150
  223. package/esm/utils/metrics.js.map +0 -1
  224. package/esm/utils/rpc-reply.d.ts +0 -17
  225. package/esm/utils/rpc-reply.js +0 -41
  226. package/esm/utils/rpc-reply.js.map +0 -1
  227. package/esm/utils/test.d.ts +0 -17
  228. package/esm/utils/test.js +0 -130
  229. package/esm/utils/test.js.map +0 -1
  230. package/esm/utils/userop.d.ts +0 -49
  231. package/esm/utils/userop.js +0 -408
  232. package/esm/utils/userop.js.map +0 -1
  233. package/esm/utils/validation.d.ts +0 -65
  234. package/esm/utils/validation.js +0 -461
  235. package/esm/utils/validation.js.map +0 -1
  236. package/lib/cli/alto.d.ts +0 -6
  237. package/lib/cli/alto.js +0 -123
  238. package/lib/cli/alto.js.map +0 -1
@@ -1,255 +0,0 @@
1
- // javascript code of tracer function
2
- // NOTE: we process this locally for hardhat, but send to geth for remote tracing.
3
- // should NOT "require" anything, or use logs.
4
- // see LogTrace for valid types (but alas, this one must be javascript, not typescript).
5
- /**
6
- * tracer to collect data for opcode banning.
7
- * this method is passed as the "tracer" for eth_traceCall (note, the function itself)
8
- *
9
- * returned data:
10
- * numberLevels: opcodes and memory access, split on execution of "number" opcode.
11
- * keccak: input data of keccak opcode.
12
- * calls: for each call, an array of [type, from, to, value]
13
- * slots: accessed slots (on any address)
14
- */
15
- export function bundlerCollectorTracer() {
16
- return {
17
- callsFromEntryPoint: [],
18
- // biome-ignore lint/suspicious/noExplicitAny: it's a generic type
19
- currentLevel: null,
20
- keccak: [],
21
- calls: [],
22
- logs: [],
23
- debug: [],
24
- lastOp: "",
25
- lastThreeOpcodes: [],
26
- // event sent after all validations are done: keccak("BeforeExecution()")
27
- stopCollectingTopic: "bb47ee3e183a558b1a2ff0874b079f3fc5478b7454eacf2bfc5af2ff5878f972",
28
- stopCollecting: false,
29
- topLevelCallCounter: 0,
30
- fault(log, _db) {
31
- this.debug.push(JSON.stringify({
32
- type: "fault",
33
- depth: log.getDepth(),
34
- gas: log.getGas(),
35
- cost: log.getCost(),
36
- err: log.getError()
37
- }));
38
- },
39
- result(_ctx, _db) {
40
- return {
41
- callsFromEntryPoint: this.callsFromEntryPoint,
42
- keccak: this.keccak,
43
- logs: this.logs,
44
- calls: this.calls,
45
- debug: this.debug // for internal debugging.
46
- };
47
- },
48
- enter(frame) {
49
- if (this.stopCollecting) {
50
- return;
51
- }
52
- this.calls.push({
53
- type: frame.getType(),
54
- from: toHex(frame.getFrom()),
55
- to: toHex(frame.getTo()),
56
- method: toHex(frame.getInput()).slice(0, 10),
57
- gas: frame.getGas(),
58
- value: frame.getValue()
59
- });
60
- },
61
- exit(frame) {
62
- if (this.stopCollecting) {
63
- return;
64
- }
65
- this.calls.push({
66
- type: frame.getError() != null ? "REVERT" : "RETURN",
67
- gasUsed: frame.getGasUsed(),
68
- data: toHex(frame.getOutput()).slice(0, 4000)
69
- });
70
- },
71
- // increment the "key" in the list. if the key is not defined yet, then set it to "1"
72
- // biome-ignore lint/suspicious/noExplicitAny: it's a generic type
73
- countSlot(list, key) {
74
- if (list[key]) {
75
- // @ts-ignore
76
- list[key] += 1;
77
- }
78
- else {
79
- list[key] = 1;
80
- }
81
- },
82
- // biome-ignore lint/suspicious/noExplicitAny: it's a generic type
83
- step(log, db) {
84
- if (this.stopCollecting) {
85
- return;
86
- }
87
- const opcode = log.op.toString();
88
- const stackSize = log.stack.length();
89
- const stackTop3 = [];
90
- for (let i = 0; i < 3 && i < stackSize; i++) {
91
- stackTop3.push(log.stack.peek(i));
92
- }
93
- this.lastThreeOpcodes.push({ opcode, stackTop3 });
94
- if (this.lastThreeOpcodes.length > 3) {
95
- this.lastThreeOpcodes.shift();
96
- }
97
- if (log.getGas() < log.getCost() ||
98
- // special rule for SSTORE with gas metering
99
- (opcode === "SSTORE" && log.getGas() < 2300)) {
100
- this.currentLevel.oog = true;
101
- }
102
- if (opcode === "REVERT" || opcode === "RETURN") {
103
- if (log.getDepth() === 1) {
104
- // exit() is not called on top-level return/revent, so we reconstruct it
105
- // from opcode
106
- const ofs = Number.parseInt(log.stack.peek(0).toString());
107
- const len = Number.parseInt(log.stack.peek(1).toString());
108
- const data = toHex(log.memory.slice(ofs, ofs + len)).slice(0, 4000);
109
- // this.debug.push(opcode + ' ' + data)
110
- this.calls.push({
111
- type: opcode,
112
- gasUsed: 0,
113
- data
114
- });
115
- }
116
- // NOTE: flushing all history after RETURN
117
- this.lastThreeOpcodes = [];
118
- }
119
- if (log.getDepth() === 1) {
120
- if (opcode === "CALL" || opcode === "STATICCALL") {
121
- // stack.peek(0) - gas
122
- const addr = toAddress(log.stack.peek(1).toString(16));
123
- const topLevelTargetAddress = toHex(addr);
124
- // stack.peek(2) - value
125
- const ofs = Number.parseInt(log.stack.peek(3).toString());
126
- // stack.peek(4) - len
127
- const topLevelMethodSig = toHex(log.memory.slice(ofs, ofs + 4));
128
- this.currentLevel = this.callsFromEntryPoint[this.topLevelCallCounter] = {
129
- topLevelMethodSig,
130
- topLevelTargetAddress,
131
- access: {},
132
- opcodes: {},
133
- extCodeAccessInfo: {},
134
- contractSize: {}
135
- };
136
- this.topLevelCallCounter++;
137
- }
138
- else if (opcode === "LOG1") {
139
- // ignore log data ofs, len
140
- const topic = log.stack.peek(2).toString(16);
141
- if (topic === this.stopCollectingTopic) {
142
- this.stopCollecting = true;
143
- }
144
- }
145
- this.lastOp = "";
146
- return;
147
- }
148
- const lastOpInfo = this.lastThreeOpcodes[this.lastThreeOpcodes.length - 2];
149
- // store all addresses touched by EXTCODE* opcodes
150
- if (lastOpInfo &&
151
- lastOpInfo.opcode &&
152
- lastOpInfo.opcode.match(/^(EXT.*)$/) != null) {
153
- const addr = toAddress(lastOpInfo.stackTop3[0].toString(16));
154
- const addrHex = toHex(addr);
155
- // [OP-051]
156
- if (!(this.lastThreeOpcodes[0].opcode.match(/\w+/) !== null &&
157
- this.lastThreeOpcodes[1].opcode === "EXTCODESIZE" &&
158
- this.lastThreeOpcodes[2].opcode === "ISZERO")) {
159
- this.currentLevel.extCodeAccessInfo[addrHex] = opcode;
160
- }
161
- // this.debug.push({
162
- // last3opcodes: JSON.stringify(this.lastThreeOpcodes.map(x => x.opcode)),
163
- // extCodeAccessInfo: this.currentLevel.extCodeAccessInfo
164
- // })
165
- }
166
- // not using 'isPrecompiled' to only allow the ones defined by the ERC-4337 as stateless precompiles
167
- // [OP-062]
168
- // biome-ignore lint/suspicious/noExplicitAny: it's a generic type
169
- const isAllowedPrecompiled = (address) => {
170
- const addrHex = toHex(address);
171
- const addressInt = Number.parseInt(addrHex);
172
- // this.debug.push(`isPrecompiled address=${addrHex} addressInt=${addressInt}`)
173
- return addressInt > 0 && addressInt < 10;
174
- };
175
- // [OP-041]
176
- if (opcode.match(/^(EXT.*|CALL|CALLCODE|DELEGATECALL|STATICCALL)$/) != null) {
177
- const idx = opcode.startsWith("EXT") ? 0 : 1;
178
- const addr = toAddress(log.stack.peek(idx).toString(16));
179
- const addrHex = toHex(addr);
180
- // this.debug.push('op=' + opcode + ' last=' + this.lastOp + ' stacksize=' + log.stack.length() + ' addr=' + addrHex)
181
- if (this.currentLevel.contractSize[addrHex] == null &&
182
- !isAllowedPrecompiled(addr)) {
183
- this.currentLevel.contractSize[addrHex] = {
184
- contractSize: db.getCode(addr).length,
185
- opcode
186
- };
187
- }
188
- }
189
- // [OP-012]
190
- if (this.lastOp === "GAS" && !opcode.includes("CALL")) {
191
- // count "GAS" opcode only if not followed by "CALL"
192
- this.countSlot(this.currentLevel.opcodes, "GAS");
193
- }
194
- if (opcode !== "GAS") {
195
- // ignore "unimportant" opcodes:
196
- if (opcode.match(/^(DUP\d+|PUSH\d+|SWAP\d+|POP|ADD|SUB|MUL|DIV|EQ|LTE?|S?GTE?|SLT|SH[LR]|AND|OR|NOT|ISZERO)$/) == null) {
197
- this.countSlot(this.currentLevel.opcodes, opcode);
198
- }
199
- }
200
- this.lastOp = opcode;
201
- if (opcode === "SLOAD" || opcode === "SSTORE") {
202
- const slot = toWord(log.stack.peek(0).toString(16));
203
- const slotHex = toHex(slot);
204
- const addr = log.contract.getAddress();
205
- const addrHex = toHex(addr);
206
- let access = this.currentLevel.access[addrHex];
207
- if (access == null) {
208
- access = {
209
- reads: {},
210
- writes: {}
211
- };
212
- this.currentLevel.access[addrHex] = access;
213
- }
214
- if (opcode === "SLOAD") {
215
- // read slot values before this UserOp was created
216
- // (so saving it if it was written before the first read)
217
- if (access.reads[slotHex] == null &&
218
- access.writes[slotHex] == null) {
219
- access.reads[slotHex] = toHex(db.getState(addr, slot));
220
- }
221
- }
222
- else {
223
- this.countSlot(access.writes, slotHex);
224
- }
225
- }
226
- if (opcode === "KECCAK256") {
227
- // collect keccak on 64-byte blocks
228
- const ofs = Number.parseInt(log.stack.peek(0).toString());
229
- const len = Number.parseInt(log.stack.peek(1).toString());
230
- // currently, solidity uses only 2-word (6-byte) for a key. this might change..
231
- // still, no need to return too much
232
- if (len > 20 && len < 512) {
233
- // if (len === 64) {
234
- this.keccak.push(toHex(log.memory.slice(ofs, ofs + len)));
235
- }
236
- }
237
- else if (opcode.startsWith("LOG")) {
238
- const count = Number.parseInt(opcode.substring(3));
239
- const ofs = Number.parseInt(log.stack.peek(0).toString());
240
- const len = Number.parseInt(log.stack.peek(1).toString());
241
- const topics = [];
242
- for (let i = 0; i < count; i++) {
243
- // eslint-disable-next-line @typescript-eslint/restrict-plus-operands
244
- topics.push("0x" + log.stack.peek(2 + i).toString(16));
245
- }
246
- const data = toHex(log.memory.slice(ofs, ofs + len));
247
- this.logs.push({
248
- topics,
249
- data
250
- });
251
- }
252
- }
253
- };
254
- }
255
- //# sourceMappingURL=BundlerCollectorTracerV06.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BundlerCollectorTracerV06.js","sourceRoot":"","sources":["../../../rpc/validation/BundlerCollectorTracerV06.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,kFAAkF;AAClF,8CAA8C;AAC9C,wFAAwF;AAkHxF;;;;;;;;;GASG;AACH,MAAM,UAAU,sBAAsB;IAClC,OAAO;QACH,mBAAmB,EAAE,EAAE;QACvB,kEAAkE;QAClE,YAAY,EAAE,IAAW;QACzB,MAAM,EAAE,EAAE;QACV,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,EAAE;QACR,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,gBAAgB,EAAE,EAAE;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AC,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC,CAAA;gBACpD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;oBACX,MAAM;oBACN,IAAI;iBACP,CAAC,CAAA;YACN,CAAC;QACL,CAAC;KACJ,CAAA;AACL,CAAC"}
@@ -1,102 +0,0 @@
1
- import type { Address, Hex } from "viem";
2
- import type { LogTracer } from "./tracer.js";
3
- /**
4
- * return type of our BundlerCollectorTracer.
5
- * collect access and opcodes, split into "levels" based on NUMBER opcode
6
- * keccak, calls and logs are collected globally, since the levels are unimportant for them.
7
- */
8
- export interface BundlerTracerResult {
9
- /**
10
- * storage and opcode info, collected on top-level calls from EntryPoint
11
- */
12
- callsFromEntryPoint: TopLevelCallInfo[];
13
- /**
14
- * values passed into KECCAK opcode
15
- */
16
- keccak: Hex[];
17
- calls: Array<ExitInfo | MethodInfo>;
18
- logs: LogInfo[];
19
- debug: any[];
20
- }
21
- export interface MethodInfo {
22
- type: string;
23
- from: Address;
24
- to: Address;
25
- method: string;
26
- value: bigint;
27
- gas: number;
28
- }
29
- export interface ExitInfo {
30
- type: "REVERT" | "RETURN";
31
- gasUsed: number;
32
- data: Hex;
33
- }
34
- export interface TopLevelCallInfo {
35
- topLevelMethodSig: Hex;
36
- topLevelTargetAddress: Address;
37
- opcodes: {
38
- [opcode: string]: number;
39
- };
40
- access: {
41
- [address: string]: AccessInfo;
42
- };
43
- contractSize: {
44
- [addr: string]: ContractSizeInfo;
45
- };
46
- extCodeAccessInfo: {
47
- [addr: string]: string;
48
- };
49
- oog?: boolean;
50
- }
51
- /**
52
- * It is illegal to access contracts with no code in validation even if it gets deployed later.
53
- * This means we need to store the {@link contractSize} of accessed addresses at the time of access.
54
- */
55
- export interface ContractSizeInfo {
56
- opcode: string;
57
- contractSize: number;
58
- }
59
- export interface AccessInfo {
60
- reads: {
61
- [slot: string]: string;
62
- };
63
- writes: {
64
- [slot: string]: number;
65
- };
66
- }
67
- export interface LogInfo {
68
- topics: string[];
69
- data: string;
70
- }
71
- interface RelevantStepData {
72
- opcode: string;
73
- stackTop3: any[];
74
- }
75
- /**
76
- * type-safe local storage of our collector. contains all return-value properties.
77
- * (also defines all "trace-local" variables and functions)
78
- */
79
- interface BundlerCollectorTracer extends LogTracer, BundlerTracerResult {
80
- lastOp: string;
81
- lastThreeOpcodes: RelevantStepData[];
82
- stopCollectingTopic: string;
83
- stopCollecting: boolean;
84
- currentLevel: TopLevelCallInfo;
85
- topLevelCallCounter: number;
86
- countSlot: (list: {
87
- [key: string]: number | undefined;
88
- }, key: any) => void;
89
- }
90
- /**
91
- * tracer to collect data for opcode banning.
92
- * this method is passed as the "tracer" for eth_traceCall (note, the function itself)
93
- *
94
- * returned data:
95
- * numberLevels: opcodes and memory access, split on execution of "number" opcode.
96
- * keccak: input data of keccak opcode.
97
- * calls: for each call, an array of [type, from, to, value]
98
- * slots: accessed slots (on any address)
99
- */
100
- export declare function bundlerCollectorTracer(): BundlerCollectorTracer;
101
- export {};
102
- //# sourceMappingURL=BundlerCollectorTracerV07.d.ts.map
@@ -1,254 +0,0 @@
1
- // javascript code of tracer function
2
- // NOTE: we process this locally for hardhat, but send to geth for remote tracing.
3
- // should NOT "require" anything, or use logs.
4
- // see LogTrace for valid types (but alas, this one must be javascript, not typescript).
5
- /**
6
- * tracer to collect data for opcode banning.
7
- * this method is passed as the "tracer" for eth_traceCall (note, the function itself)
8
- *
9
- * returned data:
10
- * numberLevels: opcodes and memory access, split on execution of "number" opcode.
11
- * keccak: input data of keccak opcode.
12
- * calls: for each call, an array of [type, from, to, value]
13
- * slots: accessed slots (on any address)
14
- */
15
- export function bundlerCollectorTracer() {
16
- return {
17
- callsFromEntryPoint: [],
18
- // biome-ignore lint/suspicious/noExplicitAny: it's a generic type
19
- currentLevel: null,
20
- keccak: [],
21
- calls: [],
22
- logs: [],
23
- debug: [],
24
- lastOp: "",
25
- lastThreeOpcodes: [],
26
- // event sent after all validations are done: keccak("BeforeExecution()")
27
- stopCollectingTopic: "bb47ee3e183a558b1a2ff0874b079f3fc5478b7454eacf2bfc5af2ff5878f972",
28
- stopCollecting: false,
29
- topLevelCallCounter: 0,
30
- fault(log, _db) {
31
- this.debug.push(JSON.stringify({
32
- type: "fault",
33
- depth: log.getDepth(),
34
- gas: log.getGas(),
35
- cost: log.getCost(),
36
- err: log.getError()
37
- }));
38
- },
39
- result(_ctx, _db) {
40
- return {
41
- callsFromEntryPoint: this.callsFromEntryPoint,
42
- keccak: this.keccak,
43
- logs: this.logs,
44
- calls: this.calls,
45
- debug: this.debug // for internal debugging.
46
- };
47
- },
48
- enter(frame) {
49
- if (this.stopCollecting) {
50
- return;
51
- }
52
- this.calls.push({
53
- type: frame.getType(),
54
- from: toHex(frame.getFrom()),
55
- to: toHex(frame.getTo()),
56
- method: toHex(frame.getInput()).slice(0, 10),
57
- gas: frame.getGas(),
58
- value: frame.getValue()
59
- });
60
- },
61
- exit(frame) {
62
- if (this.stopCollecting) {
63
- return;
64
- }
65
- this.calls.push({
66
- type: frame.getError() != null ? "REVERT" : "RETURN",
67
- gasUsed: frame.getGasUsed(),
68
- data: toHex(frame.getOutput()).slice(0, 4000)
69
- });
70
- },
71
- // increment the "key" in the list. if the key is not defined yet, then set it to "1"
72
- // biome-ignore lint/suspicious/noExplicitAny: it's a generic type
73
- countSlot(list, key) {
74
- if (list[key]) {
75
- // @ts-ignore
76
- list[key] += 1;
77
- }
78
- else {
79
- list[key] = 1;
80
- }
81
- },
82
- // biome-ignore lint/suspicious/noExplicitAny: it's a generic type
83
- step(log, db) {
84
- if (log.getDepth() < 3) {
85
- return;
86
- }
87
- if (this.stopCollecting) {
88
- return;
89
- }
90
- const opcode = log.op.toString();
91
- const stackSize = log.stack.length();
92
- const stackTop3 = [];
93
- for (let i = 0; i < 3 && i < stackSize; i++) {
94
- stackTop3.push(log.stack.peek(i));
95
- }
96
- this.lastThreeOpcodes.push({ opcode, stackTop3 });
97
- if (this.lastThreeOpcodes.length > 3) {
98
- this.lastThreeOpcodes.shift();
99
- }
100
- if (log.getGas() < log.getCost() ||
101
- // special rule for SSTORE with gas metering
102
- (opcode === "SSTORE" && log.getGas() < 2300)) {
103
- this.currentLevel.oog = true;
104
- }
105
- if (opcode === "REVERT" || opcode === "RETURN") {
106
- if (log.getDepth() === 3) {
107
- // exit() is not called on top-level return/revent, so we reconstruct it
108
- // from opcode
109
- const ofs = Number.parseInt(log.stack.peek(0).toString());
110
- const len = Number.parseInt(log.stack.peek(1).toString());
111
- const data = toHex(log.memory.slice(ofs, ofs + len)).slice(0, 4000);
112
- // this.debug.push(opcode + ' ' + data)
113
- this.calls.push({
114
- type: opcode,
115
- gasUsed: 0,
116
- data
117
- });
118
- }
119
- // NOTE: flushing all history after RETURN
120
- this.lastThreeOpcodes = [];
121
- }
122
- if (log.getDepth() === 3) {
123
- if (opcode === "CALL" || opcode === "STATICCALL") {
124
- // stack.peek(0) - gas
125
- const addr = toAddress(log.stack.peek(1).toString(16));
126
- const topLevelTargetAddress = toHex(addr);
127
- // stack.peek(2) - value
128
- const ofs = Number.parseInt(log.stack.peek(3).toString());
129
- // stack.peek(4) - len
130
- const topLevelMethodSig = toHex(log.memory.slice(ofs, ofs + 4));
131
- this.currentLevel = this.callsFromEntryPoint[this.topLevelCallCounter] = {
132
- topLevelMethodSig,
133
- topLevelTargetAddress,
134
- access: {},
135
- opcodes: {},
136
- extCodeAccessInfo: {},
137
- contractSize: {}
138
- };
139
- this.topLevelCallCounter++;
140
- }
141
- else if (opcode === "LOG1") {
142
- // ignore log data ofs, len
143
- const topic = log.stack.peek(2).toString(16);
144
- if (topic === this.stopCollectingTopic) {
145
- this.stopCollecting = true;
146
- }
147
- }
148
- this.lastOp = "";
149
- return;
150
- }
151
- const lastOpInfo = this.lastThreeOpcodes[this.lastThreeOpcodes.length - 2];
152
- // store all addresses touched by EXTCODE* opcodes
153
- if (lastOpInfo &&
154
- lastOpInfo.opcode &&
155
- lastOpInfo.opcode.match(/^(EXT.*)$/) != null) {
156
- const addr = toAddress(lastOpInfo.stackTop3[0].toString(16));
157
- const addrHex = toHex(addr);
158
- // [OP-051]
159
- if (!(this.lastThreeOpcodes[0].opcode.match(/\w+/) !== null &&
160
- this.lastThreeOpcodes[1].opcode === "EXTCODESIZE" &&
161
- this.lastThreeOpcodes[2].opcode === "ISZERO")) {
162
- this.currentLevel.extCodeAccessInfo[addrHex] = opcode;
163
- }
164
- }
165
- // not using 'isPrecompiled' to only allow the ones defined by the ERC-4337 as stateless precompiles
166
- // [OP-062]
167
- // biome-ignore lint/suspicious/noExplicitAny: it's a generic type
168
- const isAllowedPrecompiled = (address) => {
169
- const addrHex = toHex(address);
170
- const addressInt = Number.parseInt(addrHex);
171
- // this.debug.push(`isPrecompiled address=${addrHex} addressInt=${addressInt}`)
172
- return addressInt > 0 && addressInt < 10;
173
- };
174
- // [OP-041]
175
- if (opcode.match(/^(EXT.*|CALL|CALLCODE|DELEGATECALL|STATICCALL)$/) != null) {
176
- const idx = opcode.startsWith("EXT") ? 0 : 1;
177
- const addr = toAddress(log.stack.peek(idx).toString(16));
178
- const addrHex = toHex(addr);
179
- // this.debug.push('op=' + opcode + ' last=' + this.lastOp + ' stacksize=' + log.stack.length() + ' addr=' + addrHex)
180
- if (this.currentLevel.contractSize[addrHex] == null &&
181
- !isAllowedPrecompiled(addr)) {
182
- this.currentLevel.contractSize[addrHex] = {
183
- contractSize: db.getCode(addr).length,
184
- opcode
185
- };
186
- }
187
- }
188
- // [OP-012]
189
- if (this.lastOp === "GAS" && !opcode.includes("CALL")) {
190
- // count "GAS" opcode only if not followed by "CALL"
191
- this.countSlot(this.currentLevel.opcodes, "GAS");
192
- }
193
- if (opcode !== "GAS") {
194
- // ignore "unimportant" opcodes:
195
- if (opcode.match(/^(DUP\d+|PUSH\d+|SWAP\d+|POP|ADD|SUB|MUL|DIV|EQ|LTE?|S?GTE?|SLT|SH[LR]|AND|OR|NOT|ISZERO)$/) == null) {
196
- this.countSlot(this.currentLevel.opcodes, opcode);
197
- }
198
- }
199
- this.lastOp = opcode;
200
- if (opcode === "SLOAD" || opcode === "SSTORE") {
201
- const slot = toWord(log.stack.peek(0).toString(16));
202
- const slotHex = toHex(slot);
203
- const addr = log.contract.getAddress();
204
- const addrHex = toHex(addr);
205
- let access = this.currentLevel.access[addrHex];
206
- if (access == null) {
207
- access = {
208
- reads: {},
209
- writes: {}
210
- };
211
- this.currentLevel.access[addrHex] = access;
212
- }
213
- if (opcode === "SLOAD") {
214
- // read slot values before this UserOp was created
215
- // (so saving it if it was written before the first read)
216
- if (access.reads[slotHex] == null &&
217
- access.writes[slotHex] == null) {
218
- access.reads[slotHex] = toHex(db.getState(addr, slot));
219
- }
220
- }
221
- else {
222
- this.countSlot(access.writes, slotHex);
223
- }
224
- }
225
- if (opcode === "KECCAK256") {
226
- // collect keccak on 64-byte blocks
227
- const ofs = Number.parseInt(log.stack.peek(0).toString());
228
- const len = Number.parseInt(log.stack.peek(1).toString());
229
- // currently, solidity uses only 2-word (6-byte) for a key. this might change..
230
- // still, no need to return too much
231
- if (len > 20 && len < 512) {
232
- // if (len === 64) {
233
- this.keccak.push(toHex(log.memory.slice(ofs, ofs + len)));
234
- }
235
- }
236
- else if (opcode.startsWith("LOG")) {
237
- const count = Number.parseInt(opcode.substring(3));
238
- const ofs = Number.parseInt(log.stack.peek(0).toString());
239
- const len = Number.parseInt(log.stack.peek(1).toString());
240
- const topics = [];
241
- for (let i = 0; i < count; i++) {
242
- // eslint-disable-next-line @typescript-eslint/restrict-plus-operands
243
- topics.push(`0x${log.stack.peek(2 + i).toString(16)}`);
244
- }
245
- const data = toHex(log.memory.slice(ofs, ofs + len));
246
- this.logs.push({
247
- topics,
248
- data
249
- });
250
- }
251
- }
252
- };
253
- }
254
- //# sourceMappingURL=BundlerCollectorTracerV07.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BundlerCollectorTracerV07.js","sourceRoot":"","sources":["../../../rpc/validation/BundlerCollectorTracerV07.ts"],"names":[],"mappings":"AAAA,qC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