@nomicfoundation/edr 0.12.0-alpha.0 → 0.12.0-next.0
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/Cargo.toml +47 -16
- package/LICENSE +5 -1
- package/index.d.ts +773 -104
- package/index.js +31 -1
- package/package.json +20 -17
- package/src/account.rs +102 -55
- package/src/block.rs +2 -103
- package/src/call_override.rs +8 -8
- package/src/cast.rs +7 -29
- package/src/chains/generic.rs +1 -1
- package/src/chains/l1.rs +20 -18
- package/src/chains/op.rs +95 -38
- package/src/config.rs +305 -161
- package/src/context.rs +260 -21
- package/src/debug_trace.rs +2 -2
- package/src/instrument.rs +109 -0
- package/src/lib.rs +10 -0
- package/src/log.rs +12 -14
- package/src/logger.rs +28 -30
- package/src/mock.rs +68 -0
- package/src/precompile.rs +50 -0
- package/src/provider/response.rs +8 -5
- package/src/provider.rs +14 -8
- package/src/result.rs +18 -27
- package/src/scenarios.rs +2 -2
- package/src/serde.rs +57 -0
- package/src/solidity_tests/artifact.rs +184 -0
- package/src/solidity_tests/config.rs +725 -0
- package/src/solidity_tests/factory.rs +22 -0
- package/src/solidity_tests/l1.rs +68 -0
- package/src/solidity_tests/op.rs +69 -0
- package/src/solidity_tests/runner.rs +51 -0
- package/src/solidity_tests/test_results.rs +668 -0
- package/src/solidity_tests.rs +56 -0
- package/src/subscription.rs +1 -1
- package/src/trace/debug.rs +1 -1
- package/src/trace/exit.rs +4 -4
- package/src/trace/library_utils.rs +7 -2
- package/src/trace/return_data.rs +10 -10
- package/src/trace/solidity_stack_trace.rs +7 -5
- package/src/trace.rs +29 -38
- package/src/withdrawal.rs +3 -3
package/index.d.ts
CHANGED
|
@@ -3,18 +3,22 @@
|
|
|
3
3
|
|
|
4
4
|
/* auto-generated by NAPI-RS */
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
export interface
|
|
6
|
+
/** Specification of overrides for an account and its storage. */
|
|
7
|
+
export interface AccountOverride {
|
|
8
8
|
/** The account's address */
|
|
9
9
|
address: Uint8Array
|
|
10
|
-
/**
|
|
11
|
-
balance
|
|
12
|
-
/**
|
|
13
|
-
nonce
|
|
14
|
-
/**
|
|
10
|
+
/** If present, the overwriting balance. */
|
|
11
|
+
balance?: bigint
|
|
12
|
+
/** If present, the overwriting nonce. */
|
|
13
|
+
nonce?: bigint
|
|
14
|
+
/** If present, the overwriting code. */
|
|
15
15
|
code?: Uint8Array
|
|
16
|
-
/**
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* BEWARE: This field is not supported yet. See <https://github.com/NomicFoundation/edr/issues/911>
|
|
18
|
+
*
|
|
19
|
+
* If present, the overwriting storage.
|
|
20
|
+
*/
|
|
21
|
+
storage?: Array<StorageSlot>
|
|
18
22
|
}
|
|
19
23
|
/** A description of a storage slot's state. */
|
|
20
24
|
export interface StorageSlot {
|
|
@@ -23,55 +27,6 @@ export interface StorageSlot {
|
|
|
23
27
|
/** The storage slot's value */
|
|
24
28
|
value: bigint
|
|
25
29
|
}
|
|
26
|
-
/**
|
|
27
|
-
* An owned account, for which the secret key is known, and its desired genesis
|
|
28
|
-
* balance.
|
|
29
|
-
*/
|
|
30
|
-
export interface OwnedAccount {
|
|
31
|
-
/** Account secret key */
|
|
32
|
-
secretKey: string
|
|
33
|
-
/** Account balance */
|
|
34
|
-
balance: bigint
|
|
35
|
-
}
|
|
36
|
-
export interface BlockOptions {
|
|
37
|
-
/** The parent block's hash */
|
|
38
|
-
parentHash?: Buffer
|
|
39
|
-
/** The block's beneficiary */
|
|
40
|
-
beneficiary?: Buffer
|
|
41
|
-
/** The state's root hash */
|
|
42
|
-
stateRoot?: Buffer
|
|
43
|
-
/** The block's difficulty */
|
|
44
|
-
difficulty?: bigint
|
|
45
|
-
/** The block's number */
|
|
46
|
-
number?: bigint
|
|
47
|
-
/** The block's gas limit */
|
|
48
|
-
gasLimit?: bigint
|
|
49
|
-
/** The block's timestamp */
|
|
50
|
-
timestamp?: bigint
|
|
51
|
-
/** The block's extra data */
|
|
52
|
-
extraData?: Buffer
|
|
53
|
-
/** The block's mix hash (or prevrandao) */
|
|
54
|
-
mixHash?: Buffer
|
|
55
|
-
/** The block's nonce */
|
|
56
|
-
nonce?: Buffer
|
|
57
|
-
/** The block's base gas fee */
|
|
58
|
-
baseFee?: bigint
|
|
59
|
-
/** The block's withdrawals */
|
|
60
|
-
withdrawals?: Array<Withdrawal>
|
|
61
|
-
/** Blob gas was added by EIP-4844 and is ignored in older headers. */
|
|
62
|
-
blobGas?: BlobGas
|
|
63
|
-
/**
|
|
64
|
-
* The hash tree root of the parent beacon block for the given execution
|
|
65
|
-
* block (EIP-4788).
|
|
66
|
-
*/
|
|
67
|
-
parentBeaconBlockRoot?: Buffer
|
|
68
|
-
/**
|
|
69
|
-
* The commitment hash calculated for a list of [EIP-7685] data requests.
|
|
70
|
-
*
|
|
71
|
-
* [EIP-7685]: https://eips.ethereum.org/EIPS/eip-7685
|
|
72
|
-
*/
|
|
73
|
-
requestsHash?: Buffer
|
|
74
|
-
}
|
|
75
30
|
/** Information about the blob gas used in a block. */
|
|
76
31
|
export interface BlobGas {
|
|
77
32
|
/**
|
|
@@ -89,13 +44,13 @@ export interface BlobGas {
|
|
|
89
44
|
}
|
|
90
45
|
/** The result of executing a call override. */
|
|
91
46
|
export interface CallOverrideResult {
|
|
92
|
-
result:
|
|
47
|
+
result: Uint8Array
|
|
93
48
|
shouldRevert: boolean
|
|
94
49
|
}
|
|
95
50
|
export const GENERIC_CHAIN_TYPE: string
|
|
96
51
|
export declare function genericChainProviderFactory(): ProviderFactory
|
|
97
52
|
export const L1_CHAIN_TYPE: string
|
|
98
|
-
export declare function l1GenesisState(hardfork: SpecId): Array<
|
|
53
|
+
export declare function l1GenesisState(hardfork: SpecId): Array<AccountOverride>
|
|
99
54
|
export declare function l1ProviderFactory(): ProviderFactory
|
|
100
55
|
/** Identifier for the Ethereum spec. */
|
|
101
56
|
export enum SpecId {
|
|
@@ -170,24 +125,80 @@ export const MERGE: string
|
|
|
170
125
|
export const SHANGHAI: string
|
|
171
126
|
export const CANCUN: string
|
|
172
127
|
export const PRAGUE: string
|
|
173
|
-
/**
|
|
174
|
-
export
|
|
128
|
+
/** Enumeration of supported OP hardforks. */
|
|
129
|
+
export enum OpHardfork {
|
|
130
|
+
Bedrock = 100,
|
|
131
|
+
Regolith = 101,
|
|
132
|
+
Canyon = 102,
|
|
133
|
+
Ecotone = 103,
|
|
134
|
+
Fjord = 104,
|
|
135
|
+
Granite = 105,
|
|
136
|
+
Holocene = 106,
|
|
137
|
+
Isthmus = 107
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Tries to parse the provided string to create an [`OpHardfork`]
|
|
141
|
+
* instance.
|
|
142
|
+
*
|
|
143
|
+
* Returns an error if the string does not match any known hardfork.
|
|
144
|
+
*/
|
|
145
|
+
export declare function opHardforkFromString(hardfork: string): OpHardfork
|
|
146
|
+
/** Returns the string representation of the provided OP hardfork. */
|
|
147
|
+
export declare function opHardforkToString(hardfork: OpHardfork): string
|
|
148
|
+
/**
|
|
149
|
+
* Returns the latest supported OP hardfork.
|
|
150
|
+
*
|
|
151
|
+
* The returned value will be updated after each network upgrade.
|
|
152
|
+
*/
|
|
153
|
+
export declare function opLatestHardfork(): OpHardfork
|
|
154
|
+
export const OP_CHAIN_TYPE: string
|
|
155
|
+
export declare function opGenesisState(hardfork: OpHardfork): Array<AccountOverride>
|
|
156
|
+
export declare function opProviderFactory(): ProviderFactory
|
|
157
|
+
export const BEDROCK: string
|
|
158
|
+
export const REGOLITH: string
|
|
159
|
+
export const CANYON: string
|
|
160
|
+
export const ECOTONE: string
|
|
161
|
+
export const FJORD: string
|
|
162
|
+
export const GRANITE: string
|
|
163
|
+
export const HOLOCENE: string
|
|
164
|
+
export const ISTHMUS: string
|
|
165
|
+
/** Specification of a chain with possible overrides. */
|
|
166
|
+
export interface ChainOverride {
|
|
175
167
|
/** The chain ID */
|
|
176
168
|
chainId: bigint
|
|
177
|
-
/** The chain's
|
|
178
|
-
|
|
169
|
+
/** The chain's name */
|
|
170
|
+
name: string
|
|
171
|
+
/** If present, overrides for the chain's supported hardforks */
|
|
172
|
+
hardforkActivationOverrides?: Array<HardforkActivation>
|
|
173
|
+
}
|
|
174
|
+
/** Configuration for a code coverage reporter. */
|
|
175
|
+
export interface CodeCoverageConfig {
|
|
176
|
+
/**
|
|
177
|
+
* The callback to be called when coverage has been collected.
|
|
178
|
+
*
|
|
179
|
+
* The callback receives an array of unique coverage hit markers (i.e. no
|
|
180
|
+
* repetition) per transaction.
|
|
181
|
+
*
|
|
182
|
+
* Exceptions thrown in the callback will be propagated to the original
|
|
183
|
+
* caller.
|
|
184
|
+
*/
|
|
185
|
+
onCollectedCoverageCallback: (coverageHits: Uint8Array[]) => Promise<void>
|
|
179
186
|
}
|
|
180
187
|
/** Configuration for forking a blockchain */
|
|
181
188
|
export interface ForkConfig {
|
|
182
|
-
/** The URL of the JSON-RPC endpoint to fork from */
|
|
183
|
-
jsonRpcUrl: string
|
|
184
189
|
/**
|
|
185
190
|
* The block number to fork from. If not provided, the latest safe block is
|
|
186
191
|
* used.
|
|
187
192
|
*/
|
|
188
193
|
blockNumber?: bigint
|
|
194
|
+
/** The directory to cache remote JSON-RPC responses */
|
|
195
|
+
cacheDir?: string
|
|
196
|
+
/** Overrides for the configuration of chains. */
|
|
197
|
+
chainOverrides?: Array<ChainOverride>
|
|
189
198
|
/** The HTTP headers to use when making requests to the JSON-RPC endpoint */
|
|
190
199
|
httpHeaders?: Array<HttpHeader>
|
|
200
|
+
/** The URL of the JSON-RPC endpoint to fork from */
|
|
201
|
+
url: string
|
|
191
202
|
}
|
|
192
203
|
export interface HttpHeader {
|
|
193
204
|
name: string
|
|
@@ -195,10 +206,18 @@ export interface HttpHeader {
|
|
|
195
206
|
}
|
|
196
207
|
/** Configuration for a hardfork activation */
|
|
197
208
|
export interface HardforkActivation {
|
|
209
|
+
/** The condition for the hardfork activation */
|
|
210
|
+
condition: HardforkActivationByBlockNumber | HardforkActivationByTimestamp
|
|
211
|
+
/** The activated hardfork */
|
|
212
|
+
hardfork: string
|
|
213
|
+
}
|
|
214
|
+
export interface HardforkActivationByBlockNumber {
|
|
198
215
|
/** The block number at which the hardfork is activated */
|
|
199
216
|
blockNumber: bigint
|
|
200
|
-
|
|
201
|
-
|
|
217
|
+
}
|
|
218
|
+
export interface HardforkActivationByTimestamp {
|
|
219
|
+
/** The timestamp at which the hardfork is activated */
|
|
220
|
+
timestamp: bigint
|
|
202
221
|
}
|
|
203
222
|
/**The type of ordering to use when selecting blocks to mine. */
|
|
204
223
|
export enum MineOrdering {
|
|
@@ -221,6 +240,11 @@ export interface MiningConfig {
|
|
|
221
240
|
interval?: bigint | IntervalRange
|
|
222
241
|
memPool: MemPoolConfig
|
|
223
242
|
}
|
|
243
|
+
/** Configuration for runtime observability. */
|
|
244
|
+
export interface ObservabilityConfig {
|
|
245
|
+
/** If present, configures runtime observability to collect code coverage. */
|
|
246
|
+
codeCoverage?: CodeCoverageConfig
|
|
247
|
+
}
|
|
224
248
|
/** Configuration for a provider */
|
|
225
249
|
export interface ProviderConfig {
|
|
226
250
|
/** Whether to allow blocks with the same timestamp */
|
|
@@ -233,23 +257,17 @@ export interface ProviderConfig {
|
|
|
233
257
|
bailOnTransactionFailure: boolean
|
|
234
258
|
/** The gas limit of each block */
|
|
235
259
|
blockGasLimit: bigint
|
|
236
|
-
/** The directory to cache remote JSON-RPC responses */
|
|
237
|
-
cacheDir?: string
|
|
238
260
|
/** The chain ID of the blockchain */
|
|
239
261
|
chainId: bigint
|
|
240
|
-
/** The configuration for chains */
|
|
241
|
-
chains: Array<ChainConfig>
|
|
242
262
|
/** The address of the coinbase */
|
|
243
|
-
coinbase:
|
|
244
|
-
/** Enables RIP-7212 */
|
|
245
|
-
enableRip7212: boolean
|
|
263
|
+
coinbase: Uint8Array
|
|
246
264
|
/**
|
|
247
265
|
* The configuration for forking a blockchain. If not provided, a local
|
|
248
266
|
* blockchain will be created
|
|
249
267
|
*/
|
|
250
268
|
fork?: ForkConfig
|
|
251
269
|
/** The genesis state of the blockchain */
|
|
252
|
-
genesisState: Array<
|
|
270
|
+
genesisState: Array<AccountOverride>
|
|
253
271
|
/** The hardfork of the blockchain */
|
|
254
272
|
hardfork: string
|
|
255
273
|
/**
|
|
@@ -265,15 +283,19 @@ export interface ProviderConfig {
|
|
|
265
283
|
* The initial parent beacon block root of the blockchain. Required for
|
|
266
284
|
* EIP-4788
|
|
267
285
|
*/
|
|
268
|
-
initialParentBeaconBlockRoot?:
|
|
286
|
+
initialParentBeaconBlockRoot?: Uint8Array
|
|
269
287
|
/** The minimum gas price of the next block. */
|
|
270
288
|
minGasPrice: bigint
|
|
271
289
|
/** The configuration for the miner */
|
|
272
290
|
mining: MiningConfig
|
|
273
291
|
/** The network ID of the blockchain */
|
|
274
292
|
networkId: bigint
|
|
275
|
-
/**
|
|
276
|
-
|
|
293
|
+
/** The configuration for the provider's observability */
|
|
294
|
+
observability: ObservabilityConfig
|
|
295
|
+
/** Secret keys of owned accounts */
|
|
296
|
+
ownedAccounts: Array<string>
|
|
297
|
+
/** Overrides for precompiles */
|
|
298
|
+
precompileOverrides: Array<Precompile>
|
|
277
299
|
}
|
|
278
300
|
/** Tracing config for Solidity stack trace generation. */
|
|
279
301
|
export interface TracingConfigWithBuffers {
|
|
@@ -299,7 +321,7 @@ export interface BuildInfoAndOutput {
|
|
|
299
321
|
export interface DebugTraceResult {
|
|
300
322
|
pass: boolean
|
|
301
323
|
gasUsed: bigint
|
|
302
|
-
output?:
|
|
324
|
+
output?: Uint8Array
|
|
303
325
|
structLogs: Array<DebugTraceLogItem>
|
|
304
326
|
}
|
|
305
327
|
export interface DebugTraceLogItem {
|
|
@@ -325,24 +347,57 @@ export interface DebugTraceLogItem {
|
|
|
325
347
|
/** Map of all stored values with keys and values encoded as hex strings. */
|
|
326
348
|
storage?: Record<string, string>
|
|
327
349
|
}
|
|
350
|
+
export interface InstrumentationResult {
|
|
351
|
+
/** The generated source code with coverage instrumentation. */
|
|
352
|
+
readonly source: string
|
|
353
|
+
/** The metadata for each instrumented code segment. */
|
|
354
|
+
readonly metadata: Array<InstrumentationMetadata>
|
|
355
|
+
}
|
|
356
|
+
export interface InstrumentationMetadata {
|
|
357
|
+
/**
|
|
358
|
+
* The tag that identifies the instrumented code. Tags are
|
|
359
|
+
* deterministically generated from the source code, source id, and
|
|
360
|
+
* Solidity version.
|
|
361
|
+
*/
|
|
362
|
+
readonly tag: Uint8Array
|
|
363
|
+
/**
|
|
364
|
+
* The kind of instrumented code. Currently, the only supported kind
|
|
365
|
+
* is "statement".
|
|
366
|
+
*/
|
|
367
|
+
readonly kind: string
|
|
368
|
+
/**
|
|
369
|
+
* The starting position of the instrumented code - including trivia such
|
|
370
|
+
* as whitespace - in the source code, in UTF-16 code units.
|
|
371
|
+
*/
|
|
372
|
+
readonly startUtf16: number
|
|
373
|
+
/**
|
|
374
|
+
* The ending position of the instrumented code - including trivia such as
|
|
375
|
+
* whitespace - in the source code, in UTF-16 code units.
|
|
376
|
+
*/
|
|
377
|
+
readonly endUtf16: number
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Adds per-statement coverage instrumentation to the given Solidity source
|
|
381
|
+
* code.
|
|
382
|
+
*/
|
|
383
|
+
export declare function addStatementCoverageInstrumentation(sourceCode: string, sourceId: string, solidityVersion: string, coverageLibraryPath: string): InstrumentationResult
|
|
328
384
|
/** Ethereum execution log. */
|
|
329
385
|
export interface ExecutionLog {
|
|
330
|
-
address:
|
|
331
|
-
topics: Array<
|
|
332
|
-
data:
|
|
333
|
-
}
|
|
334
|
-
export interface ContractAndFunctionName {
|
|
335
|
-
/** The contract name. */
|
|
336
|
-
contractName: string
|
|
337
|
-
/** The function name. Only present for calls. */
|
|
338
|
-
functionName?: string
|
|
386
|
+
address: Uint8Array
|
|
387
|
+
topics: Array<Uint8Array>
|
|
388
|
+
data: Uint8Array
|
|
339
389
|
}
|
|
340
390
|
export interface LoggerConfig {
|
|
341
391
|
/** Whether to enable the logger. */
|
|
342
392
|
enable: boolean
|
|
343
|
-
decodeConsoleLogInputsCallback: (inputs:
|
|
393
|
+
decodeConsoleLogInputsCallback: (inputs: ArrayBuffer[]) => string[]
|
|
344
394
|
printLineCallback: (message: string, replace: boolean) => void
|
|
345
395
|
}
|
|
396
|
+
/**
|
|
397
|
+
* [RIP-7212](https://github.com/ethereum/RIPs/blob/master/RIPS/rip-7212.md#specification)
|
|
398
|
+
* secp256r1 precompile.
|
|
399
|
+
*/
|
|
400
|
+
export declare function precompileP256Verify(): Precompile
|
|
346
401
|
/** The possible reasons for successful termination of the EVM. */
|
|
347
402
|
export enum SuccessReason {
|
|
348
403
|
/** The opcode `STOP` was called */
|
|
@@ -355,13 +410,13 @@ export enum SuccessReason {
|
|
|
355
410
|
}
|
|
356
411
|
export interface CallOutput {
|
|
357
412
|
/** Return value */
|
|
358
|
-
returnValue:
|
|
413
|
+
returnValue: Uint8Array
|
|
359
414
|
}
|
|
360
415
|
export interface CreateOutput {
|
|
361
416
|
/** Return value */
|
|
362
|
-
returnValue:
|
|
417
|
+
returnValue: Uint8Array
|
|
363
418
|
/** Optionally, a 160-bit address */
|
|
364
|
-
address?:
|
|
419
|
+
address?: Uint8Array
|
|
365
420
|
}
|
|
366
421
|
/** The result when the EVM terminates successfully. */
|
|
367
422
|
export interface SuccessResult {
|
|
@@ -381,7 +436,7 @@ export interface RevertResult {
|
|
|
381
436
|
/** The amount of gas used */
|
|
382
437
|
gasUsed: bigint
|
|
383
438
|
/** The transaction output */
|
|
384
|
-
output:
|
|
439
|
+
output: Uint8Array
|
|
385
440
|
}
|
|
386
441
|
/**
|
|
387
442
|
* Indicates that the EVM has experienced an exceptional halt. This causes
|
|
@@ -429,7 +484,558 @@ export interface ExecutionResult {
|
|
|
429
484
|
/** The transaction result */
|
|
430
485
|
result: SuccessResult | RevertResult | HaltResult
|
|
431
486
|
/** Optional contract address if the transaction created a new contract. */
|
|
432
|
-
contractAddress?:
|
|
487
|
+
contractAddress?: Uint8Array
|
|
488
|
+
}
|
|
489
|
+
/** A compilation artifact. */
|
|
490
|
+
export interface Artifact {
|
|
491
|
+
/** The identifier of the artifact. */
|
|
492
|
+
id: ArtifactId
|
|
493
|
+
/** The test contract. */
|
|
494
|
+
contract: ContractData
|
|
495
|
+
}
|
|
496
|
+
/** The identifier of a Solidity contract. */
|
|
497
|
+
export interface ArtifactId {
|
|
498
|
+
/** The name of the contract. */
|
|
499
|
+
name: string
|
|
500
|
+
/** Original source file path. */
|
|
501
|
+
source: string
|
|
502
|
+
/** The solc semver string. */
|
|
503
|
+
solcVersion: string
|
|
504
|
+
}
|
|
505
|
+
/** A test contract to execute. */
|
|
506
|
+
export interface ContractData {
|
|
507
|
+
/** Contract ABI as json string. */
|
|
508
|
+
abi: string
|
|
509
|
+
/**
|
|
510
|
+
* Contract creation code as hex string. It can be missing if the contract
|
|
511
|
+
* is ABI only.
|
|
512
|
+
*/
|
|
513
|
+
bytecode?: string
|
|
514
|
+
/** The link references of the deployment bytecode. */
|
|
515
|
+
linkReferences?: Record<string, Record<string, Array<LinkReference>>>
|
|
516
|
+
/**
|
|
517
|
+
* Contract runtime code as hex string. It can be missing if the contract
|
|
518
|
+
* is ABI only.
|
|
519
|
+
*/
|
|
520
|
+
deployedBytecode?: string
|
|
521
|
+
/** The link references of the deployed bytecode. */
|
|
522
|
+
deployedLinkReferences?: Record<string, Record<string, Array<LinkReference>>>
|
|
523
|
+
}
|
|
524
|
+
export interface LinkReference {
|
|
525
|
+
start: number
|
|
526
|
+
length: number
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Solidity test runner configuration arguments exposed through the ffi.
|
|
530
|
+
* Docs based on <https://book.getfoundry.sh/reference/config/testing>.
|
|
531
|
+
*/
|
|
532
|
+
export interface SolidityTestRunnerConfigArgs {
|
|
533
|
+
/**
|
|
534
|
+
* The absolute path to the project root directory.
|
|
535
|
+
* Relative paths in cheat codes are resolved against this path.
|
|
536
|
+
*/
|
|
537
|
+
projectRoot: string
|
|
538
|
+
/** Configures the permissions of cheat codes that access the file system. */
|
|
539
|
+
fsPermissions?: Array<PathPermission>
|
|
540
|
+
/** Whether to support the `testFail` prefix. Defaults to false. */
|
|
541
|
+
testFail?: boolean
|
|
542
|
+
/** Address labels for traces. Defaults to none. */
|
|
543
|
+
labels?: Array<AddressLabel>
|
|
544
|
+
/**
|
|
545
|
+
* Whether to enable isolation of calls. In isolation mode all top-level
|
|
546
|
+
* calls are executed as a separate transaction in a separate EVM
|
|
547
|
+
* context, enabling more precise gas accounting and transaction state
|
|
548
|
+
* changes.
|
|
549
|
+
* Defaults to false.
|
|
550
|
+
*/
|
|
551
|
+
isolate?: boolean
|
|
552
|
+
/**
|
|
553
|
+
* Whether or not to enable the ffi cheatcode.
|
|
554
|
+
* Warning: Enabling this cheatcode has security implications, as it allows
|
|
555
|
+
* tests to execute arbitrary programs on your computer.
|
|
556
|
+
* Defaults to false.
|
|
557
|
+
*/
|
|
558
|
+
ffi?: boolean
|
|
559
|
+
/**
|
|
560
|
+
* Allow expecting reverts with `expectRevert` at the same callstack depth
|
|
561
|
+
* as the test. Defaults to false.
|
|
562
|
+
*/
|
|
563
|
+
allowInternalExpectRevert?: boolean
|
|
564
|
+
/**
|
|
565
|
+
* The value of `msg.sender` in tests as hex string.
|
|
566
|
+
* Defaults to `0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38`.
|
|
567
|
+
*/
|
|
568
|
+
sender?: Uint8Array
|
|
569
|
+
/**
|
|
570
|
+
* The value of `tx.origin` in tests as hex string.
|
|
571
|
+
* Defaults to `0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38`.
|
|
572
|
+
*/
|
|
573
|
+
txOrigin?: Uint8Array
|
|
574
|
+
/**
|
|
575
|
+
* The initial balance of the sender in tests.
|
|
576
|
+
* Defaults to `0xffffffffffffffffffffffff`.
|
|
577
|
+
*/
|
|
578
|
+
initialBalance?: bigint
|
|
579
|
+
/**
|
|
580
|
+
* The value of `block.number` in tests.
|
|
581
|
+
* Defaults to `1`.
|
|
582
|
+
*/
|
|
583
|
+
blockNumber?: bigint
|
|
584
|
+
/**
|
|
585
|
+
* The value of the `chainid` opcode in tests.
|
|
586
|
+
* Defaults to `31337`.
|
|
587
|
+
*/
|
|
588
|
+
chainId?: bigint
|
|
589
|
+
/**
|
|
590
|
+
* The gas limit for each test case.
|
|
591
|
+
* Defaults to `9_223_372_036_854_775_807` (`i64::MAX`).
|
|
592
|
+
*/
|
|
593
|
+
gasLimit?: bigint
|
|
594
|
+
/**
|
|
595
|
+
* The price of gas (in wei) in tests.
|
|
596
|
+
* Defaults to `0`.
|
|
597
|
+
*/
|
|
598
|
+
gasPrice?: bigint
|
|
599
|
+
/**
|
|
600
|
+
* The base fee per gas (in wei) in tests.
|
|
601
|
+
* Defaults to `0`.
|
|
602
|
+
*/
|
|
603
|
+
blockBaseFeePerGas?: bigint
|
|
604
|
+
/**
|
|
605
|
+
* The value of `block.coinbase` in tests.
|
|
606
|
+
* Defaults to `0x0000000000000000000000000000000000000000`.
|
|
607
|
+
*/
|
|
608
|
+
blockCoinbase?: Uint8Array
|
|
609
|
+
/**
|
|
610
|
+
* The value of `block.timestamp` in tests.
|
|
611
|
+
* Defaults to 1.
|
|
612
|
+
*/
|
|
613
|
+
blockTimestamp?: bigint
|
|
614
|
+
/**
|
|
615
|
+
* The value of `block.difficulty` in tests.
|
|
616
|
+
* Defaults to 0.
|
|
617
|
+
*/
|
|
618
|
+
blockDifficulty?: bigint
|
|
619
|
+
/**
|
|
620
|
+
* The `block.gaslimit` value during EVM execution.
|
|
621
|
+
* Defaults to none.
|
|
622
|
+
*/
|
|
623
|
+
blockGasLimit?: bigint
|
|
624
|
+
/**
|
|
625
|
+
* Whether to disable the block gas limit.
|
|
626
|
+
* Defaults to false.
|
|
627
|
+
*/
|
|
628
|
+
disableBlockGasLimit?: boolean
|
|
629
|
+
/**
|
|
630
|
+
* The memory limit of the EVM in bytes.
|
|
631
|
+
* Defaults to 33_554_432 (2^25 = 32MiB).
|
|
632
|
+
*/
|
|
633
|
+
memoryLimit?: bigint
|
|
634
|
+
/**
|
|
635
|
+
* The predeploys applied in local mode. Defaults to no predeploys.
|
|
636
|
+
* These should match the predeploys of the network in fork mode, so they
|
|
637
|
+
* aren't set in fork mode.
|
|
638
|
+
* The code must be set and non-empty. The nonce and the balance default to
|
|
639
|
+
* zero and storage defaults to empty.
|
|
640
|
+
*/
|
|
641
|
+
localPredeploys?: Array<AccountOverride>
|
|
642
|
+
/**
|
|
643
|
+
* If set, all tests are run in fork mode using this url or remote name.
|
|
644
|
+
* Defaults to none.
|
|
645
|
+
*/
|
|
646
|
+
ethRpcUrl?: string
|
|
647
|
+
/** Pins the block number for the global state fork. */
|
|
648
|
+
forkBlockNumber?: bigint
|
|
649
|
+
/**
|
|
650
|
+
* Map of RPC endpoints from chain name to RPC urls for fork cheat codes,
|
|
651
|
+
* e.g. `{ "optimism": "https://optimism.alchemyapi.io/v2/..." }`
|
|
652
|
+
*/
|
|
653
|
+
rpcEndpoints?: Record<string, string>
|
|
654
|
+
/**
|
|
655
|
+
* Optional RPC cache path. If this is none, then no RPC calls will be
|
|
656
|
+
* cached, otherwise data is cached to `<rpc_cache_path>/<chain
|
|
657
|
+
* id>/<block number>`. Caching can be disabled for specific chains
|
|
658
|
+
* with `rpc_storage_caching`.
|
|
659
|
+
*/
|
|
660
|
+
rpcCachePath?: string
|
|
661
|
+
/** What RPC endpoints are cached. Defaults to all. */
|
|
662
|
+
rpcStorageCaching?: StorageCachingConfig
|
|
663
|
+
/**
|
|
664
|
+
* The number of seconds to wait before `vm.prompt` reverts with a timeout.
|
|
665
|
+
* Defaults to 120.
|
|
666
|
+
*/
|
|
667
|
+
promptTimeout?: number
|
|
668
|
+
/** Fuzz testing configuration. */
|
|
669
|
+
fuzz?: FuzzConfigArgs
|
|
670
|
+
/**
|
|
671
|
+
* Invariant testing configuration.
|
|
672
|
+
* If an invariant config setting is not set, but a corresponding fuzz
|
|
673
|
+
* config value is set, then the fuzz config value will be used.
|
|
674
|
+
*/
|
|
675
|
+
invariant?: InvariantConfigArgs
|
|
676
|
+
/**
|
|
677
|
+
* Controls which test results should include execution traces. Defaults to
|
|
678
|
+
* None.
|
|
679
|
+
*/
|
|
680
|
+
includeTraces?: IncludeTraces
|
|
681
|
+
/** The configuration for the Solidity test runner's observability */
|
|
682
|
+
observability?: ObservabilityConfig
|
|
683
|
+
/**
|
|
684
|
+
* A regex pattern to filter tests. If provided, only test methods that
|
|
685
|
+
* match the pattern will be executed and reported as a test result.
|
|
686
|
+
*/
|
|
687
|
+
testPattern?: string
|
|
688
|
+
}
|
|
689
|
+
/** Fuzz testing configuration */
|
|
690
|
+
export interface FuzzConfigArgs {
|
|
691
|
+
/** Path where fuzz failures are recorded and replayed if set. */
|
|
692
|
+
failurePersistDir?: string
|
|
693
|
+
/** Name of the file to record fuzz failures, defaults to `failures`. */
|
|
694
|
+
failurePersistFile?: string
|
|
695
|
+
/**
|
|
696
|
+
* The amount of fuzz runs to perform for each fuzz test case. Higher
|
|
697
|
+
* values gives more confidence in results at the cost of testing
|
|
698
|
+
* speed.
|
|
699
|
+
* Defaults to 256.
|
|
700
|
+
*/
|
|
701
|
+
runs?: number
|
|
702
|
+
/**
|
|
703
|
+
* The maximum number of combined inputs that may be rejected before the
|
|
704
|
+
* test as a whole aborts. “Global” filters apply to the whole test
|
|
705
|
+
* case. If the test case is rejected, the whole thing is regenerated.
|
|
706
|
+
* Defaults to 65536.
|
|
707
|
+
*/
|
|
708
|
+
maxTestRejects?: number
|
|
709
|
+
/**
|
|
710
|
+
* Hexadecimal string.
|
|
711
|
+
* Optional seed for the fuzzing RNG algorithm.
|
|
712
|
+
* Defaults to None.
|
|
713
|
+
*/
|
|
714
|
+
seed?: string
|
|
715
|
+
/**
|
|
716
|
+
* Integer between 0 and 100.
|
|
717
|
+
* The weight of the dictionary. A higher dictionary weight will bias the
|
|
718
|
+
* fuzz inputs towards “interesting” values, e.g. boundary values like
|
|
719
|
+
* type(uint256).max or contract addresses from your environment.
|
|
720
|
+
* Defaults to 40.
|
|
721
|
+
*/
|
|
722
|
+
dictionaryWeight?: number
|
|
723
|
+
/**
|
|
724
|
+
* The flag indicating whether to include values from storage.
|
|
725
|
+
* Defaults to true.
|
|
726
|
+
*/
|
|
727
|
+
includeStorage?: boolean
|
|
728
|
+
/**
|
|
729
|
+
* The flag indicating whether to include push bytes values.
|
|
730
|
+
* Defaults to true.
|
|
731
|
+
*/
|
|
732
|
+
includePushBytes?: boolean
|
|
733
|
+
}
|
|
734
|
+
/** Invariant testing configuration. */
|
|
735
|
+
export interface InvariantConfigArgs {
|
|
736
|
+
/** Path where invariant failures are recorded and replayed if set. */
|
|
737
|
+
failurePersistDir?: string
|
|
738
|
+
/**
|
|
739
|
+
* The number of runs that must execute for each invariant test group.
|
|
740
|
+
* Defaults to 256.
|
|
741
|
+
*/
|
|
742
|
+
runs?: number
|
|
743
|
+
/**
|
|
744
|
+
* The number of calls executed to attempt to break invariants in one run.
|
|
745
|
+
* Defaults to 500.
|
|
746
|
+
*/
|
|
747
|
+
depth?: number
|
|
748
|
+
/**
|
|
749
|
+
* Fails the invariant fuzzing if a revert occurs.
|
|
750
|
+
* Defaults to false.
|
|
751
|
+
*/
|
|
752
|
+
failOnRevert?: boolean
|
|
753
|
+
/**
|
|
754
|
+
* Overrides unsafe external calls when running invariant tests, useful for
|
|
755
|
+
* e.g. performing reentrancy checks.
|
|
756
|
+
* Defaults to false.
|
|
757
|
+
*/
|
|
758
|
+
callOverride?: boolean
|
|
759
|
+
/**
|
|
760
|
+
* Integer between 0 and 100.
|
|
761
|
+
* The weight of the dictionary. A higher dictionary weight will bias the
|
|
762
|
+
* fuzz inputs towards “interesting” values, e.g. boundary values like
|
|
763
|
+
* type(uint256).max or contract addresses from your environment.
|
|
764
|
+
* Defaults to 40.
|
|
765
|
+
*/
|
|
766
|
+
dictionaryWeight?: number
|
|
767
|
+
/**
|
|
768
|
+
* The flag indicating whether to include values from storage.
|
|
769
|
+
* Defaults to true.
|
|
770
|
+
*/
|
|
771
|
+
includeStorage?: boolean
|
|
772
|
+
/**
|
|
773
|
+
* The flag indicating whether to include push bytes values.
|
|
774
|
+
* Defaults to true.
|
|
775
|
+
*/
|
|
776
|
+
includePushBytes?: boolean
|
|
777
|
+
/**
|
|
778
|
+
* The maximum number of attempts to shrink a failed the sequence. Shrink
|
|
779
|
+
* process is disabled if set to 0.
|
|
780
|
+
* Defaults to 5000.
|
|
781
|
+
*/
|
|
782
|
+
shrinkRunLimit?: number
|
|
783
|
+
}
|
|
784
|
+
/** Settings to configure caching of remote RPC endpoints. */
|
|
785
|
+
export interface StorageCachingConfig {
|
|
786
|
+
/**
|
|
787
|
+
* Chains to cache. Either all or none or a list of chain names, e.g.
|
|
788
|
+
* ["optimism", "mainnet"].
|
|
789
|
+
*/
|
|
790
|
+
chains: CachedChains | Array<string>
|
|
791
|
+
/** Endpoints to cache. Either all or remote or a regex. */
|
|
792
|
+
endpoints: CachedEndpoints | string
|
|
793
|
+
}
|
|
794
|
+
/** What chains to cache */
|
|
795
|
+
export enum CachedChains {
|
|
796
|
+
/** Cache all chains */
|
|
797
|
+
All = 0,
|
|
798
|
+
/** Don't cache anything */
|
|
799
|
+
None = 1
|
|
800
|
+
}
|
|
801
|
+
/** What endpoints to enable caching for */
|
|
802
|
+
export enum CachedEndpoints {
|
|
803
|
+
/** Cache all endpoints */
|
|
804
|
+
All = 0,
|
|
805
|
+
/** Only cache non-local host endpoints */
|
|
806
|
+
Remote = 1
|
|
807
|
+
}
|
|
808
|
+
/** Represents an access permission to a single path */
|
|
809
|
+
export interface PathPermission {
|
|
810
|
+
/** Permission level to access the `path` */
|
|
811
|
+
access: FsAccessPermission
|
|
812
|
+
/** The targeted path guarded by the permission */
|
|
813
|
+
path: string
|
|
814
|
+
}
|
|
815
|
+
/** Determines the status of file system access */
|
|
816
|
+
export enum FsAccessPermission {
|
|
817
|
+
/** FS access is allowed with `read` + `write` permission */
|
|
818
|
+
ReadWrite = 0,
|
|
819
|
+
/** Only reading is allowed */
|
|
820
|
+
Read = 1,
|
|
821
|
+
/** Only writing is allowed */
|
|
822
|
+
Write = 2
|
|
823
|
+
}
|
|
824
|
+
export interface AddressLabel {
|
|
825
|
+
/** The address to label */
|
|
826
|
+
address: Uint8Array
|
|
827
|
+
/** The label to assign to the address */
|
|
828
|
+
label: string
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* Configuration for [`SolidityTestRunnerConfigArgs::include_traces`] that
|
|
832
|
+
* controls execution trace decoding and inclusion in test results.
|
|
833
|
+
*/
|
|
834
|
+
export enum IncludeTraces {
|
|
835
|
+
/** No traces will be included in any test result. */
|
|
836
|
+
None = 0,
|
|
837
|
+
/** Traces will be included only on the results of failed tests. */
|
|
838
|
+
Failing = 1,
|
|
839
|
+
/** Traces will be included in all test results. */
|
|
840
|
+
All = 2
|
|
841
|
+
}
|
|
842
|
+
export declare function l1SolidityTestRunnerFactory(): SolidityTestRunnerFactory
|
|
843
|
+
export declare function opSolidityTestRunnerFactory(): SolidityTestRunnerFactory
|
|
844
|
+
/** The stack trace result */
|
|
845
|
+
export interface StackTrace {
|
|
846
|
+
/** Enum tag for JS. */
|
|
847
|
+
kind: "StackTrace"
|
|
848
|
+
/** The stack trace entries */
|
|
849
|
+
entries: Array<SolidityStackTraceEntry>
|
|
850
|
+
}
|
|
851
|
+
/** We couldn't generate stack traces, because an unexpected error occurred. */
|
|
852
|
+
export interface UnexpectedError {
|
|
853
|
+
/** Enum tag for JS. */
|
|
854
|
+
kind: "UnexpectedError"
|
|
855
|
+
/** The error message from the unexpected error. */
|
|
856
|
+
errorMessage: string
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* We couldn't generate stack traces, because the stack trace generation
|
|
860
|
+
* heuristics failed due to an unknown reason.
|
|
861
|
+
*/
|
|
862
|
+
export interface HeuristicFailed {
|
|
863
|
+
/** Enum tag for JS. */
|
|
864
|
+
kind: "HeuristicFailed"
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* We couldn't generate stack traces, because the test execution is unsafe to
|
|
868
|
+
* replay due to indeterminism. This can be caused by either specifying a fork
|
|
869
|
+
* url without a fork block number in the test runner config or using impure
|
|
870
|
+
* cheatcodes.
|
|
871
|
+
*/
|
|
872
|
+
export interface UnsafeToReplay {
|
|
873
|
+
/** Enum tag for JS. */
|
|
874
|
+
kind: "UnsafeToReplay"
|
|
875
|
+
/**
|
|
876
|
+
* Indeterminism due to specifying a fork url without a fork block number
|
|
877
|
+
* in the test runner config.
|
|
878
|
+
*/
|
|
879
|
+
globalForkLatest: boolean
|
|
880
|
+
/**
|
|
881
|
+
* The list of executed impure cheatcode signatures. We collect function
|
|
882
|
+
* signatures instead of function names as whether a cheatcode is impure
|
|
883
|
+
* can depend on the arguments it takes (e.g. `createFork` without a second
|
|
884
|
+
* argument means implicitly fork from “latest”). Example signature:
|
|
885
|
+
* `function createSelectFork(string calldata urlOrAlias) external returns
|
|
886
|
+
* (uint256 forkId);`.
|
|
887
|
+
*/
|
|
888
|
+
impureCheatcodes: Array<string>
|
|
889
|
+
}
|
|
890
|
+
/**The result of a test execution. */
|
|
891
|
+
export enum TestStatus {
|
|
892
|
+
/**Test success */
|
|
893
|
+
Success = 'Success',
|
|
894
|
+
/**Test failure */
|
|
895
|
+
Failure = 'Failure',
|
|
896
|
+
/**Test skipped */
|
|
897
|
+
Skipped = 'Skipped'
|
|
898
|
+
}
|
|
899
|
+
/** See [edr_solidity_tests::result::TestKind::Standard] */
|
|
900
|
+
export interface StandardTestKind {
|
|
901
|
+
/** The gas consumed by the test. */
|
|
902
|
+
readonly consumedGas: bigint
|
|
903
|
+
}
|
|
904
|
+
/** See [edr_solidity_tests::result::TestKind::Fuzz] */
|
|
905
|
+
export interface FuzzTestKind {
|
|
906
|
+
/** See [edr_solidity_tests::result::TestKind::Fuzz] */
|
|
907
|
+
readonly runs: bigint
|
|
908
|
+
/** See [edr_solidity_tests::result::TestKind::Fuzz] */
|
|
909
|
+
readonly meanGas: bigint
|
|
910
|
+
/** See [edr_solidity_tests::result::TestKind::Fuzz] */
|
|
911
|
+
readonly medianGas: bigint
|
|
912
|
+
}
|
|
913
|
+
/** See [edr_solidity_tests::fuzz::FuzzCase] */
|
|
914
|
+
export interface FuzzCase {
|
|
915
|
+
/** The calldata used for this fuzz test */
|
|
916
|
+
readonly calldata: Uint8Array
|
|
917
|
+
/** Consumed gas */
|
|
918
|
+
readonly gas: bigint
|
|
919
|
+
/** The initial gas stipend for the transaction */
|
|
920
|
+
readonly stipend: bigint
|
|
921
|
+
}
|
|
922
|
+
/** See [edr_solidity_tests::result::TestKind::Invariant] */
|
|
923
|
+
export interface InvariantTestKind {
|
|
924
|
+
/** See [edr_solidity_tests::result::TestKind::Invariant] */
|
|
925
|
+
readonly runs: bigint
|
|
926
|
+
/** See [edr_solidity_tests::result::TestKind::Invariant] */
|
|
927
|
+
readonly calls: bigint
|
|
928
|
+
/** See [edr_solidity_tests::result::TestKind::Invariant] */
|
|
929
|
+
readonly reverts: bigint
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* Original sequence size and sequence of calls used as a counter example
|
|
933
|
+
* for invariant tests.
|
|
934
|
+
*/
|
|
935
|
+
export interface CounterExampleSequence {
|
|
936
|
+
/** The original sequence size before shrinking. */
|
|
937
|
+
originalSequenceSize: bigint
|
|
938
|
+
/** The shrunk counterexample sequence. */
|
|
939
|
+
sequence: Array<BaseCounterExample>
|
|
940
|
+
}
|
|
941
|
+
/** See [edr_solidity_tests::fuzz::BaseCounterExample] */
|
|
942
|
+
export interface BaseCounterExample {
|
|
943
|
+
/** See [edr_solidity_tests::fuzz::BaseCounterExample::sender] */
|
|
944
|
+
readonly sender?: Uint8Array
|
|
945
|
+
/** See [edr_solidity_tests::fuzz::BaseCounterExample::addr] */
|
|
946
|
+
readonly address?: Uint8Array
|
|
947
|
+
/** See [edr_solidity_tests::fuzz::BaseCounterExample::calldata] */
|
|
948
|
+
readonly calldata: Uint8Array
|
|
949
|
+
/** See [edr_solidity_tests::fuzz::BaseCounterExample::contract_name] */
|
|
950
|
+
readonly contractName?: string
|
|
951
|
+
/** See [edr_solidity_tests::fuzz::BaseCounterExample::signature] */
|
|
952
|
+
readonly signature?: string
|
|
953
|
+
/** See [edr_solidity_tests::fuzz::BaseCounterExample::args] */
|
|
954
|
+
readonly args?: string
|
|
955
|
+
}
|
|
956
|
+
/**
|
|
957
|
+
* Object representing a call in an execution trace, including contract
|
|
958
|
+
* creation.
|
|
959
|
+
*/
|
|
960
|
+
export interface CallTrace {
|
|
961
|
+
/** The kind of call or contract creation this represents. */
|
|
962
|
+
kind: CallKind
|
|
963
|
+
/** Whether the call succeeded or reverted. */
|
|
964
|
+
success: boolean
|
|
965
|
+
/** Whether the call is a cheatcode. */
|
|
966
|
+
isCheatcode: boolean
|
|
967
|
+
/** The amount of gas that was consumed. */
|
|
968
|
+
gasUsed: bigint
|
|
969
|
+
/** The amount of native token that was included with the call. */
|
|
970
|
+
value: bigint
|
|
971
|
+
/**
|
|
972
|
+
* The target of the call. Provided as a contract name if known, otherwise
|
|
973
|
+
* a checksum address.
|
|
974
|
+
*/
|
|
975
|
+
contract: string
|
|
976
|
+
/**
|
|
977
|
+
* The input (calldata) to the call. If it encodes a known function call,
|
|
978
|
+
* it will be decoded into the function name and a list of arguments.
|
|
979
|
+
* For example, `{ name: "ownerOf", arguments: ["1"] }`. Note that the
|
|
980
|
+
* function name may also be any of the special `fallback` and `receive`
|
|
981
|
+
* functions. Otherwise, it will be provided as a raw byte array.
|
|
982
|
+
*/
|
|
983
|
+
inputs: DecodedTraceParameters | Uint8Array
|
|
984
|
+
/**
|
|
985
|
+
* The output of the call. This will be a decoded human-readable
|
|
986
|
+
* representation of the value if the function is known, otherwise a
|
|
987
|
+
* raw byte array.
|
|
988
|
+
*/
|
|
989
|
+
outputs: string | Uint8Array
|
|
990
|
+
/**
|
|
991
|
+
* Interleaved subcalls and event logs. Use `kind` to check if each member
|
|
992
|
+
* of the array is a call or log trace.
|
|
993
|
+
*/
|
|
994
|
+
children: Array<CallTrace | LogTrace>
|
|
995
|
+
}
|
|
996
|
+
/** Object representing an event log in an execution trace. */
|
|
997
|
+
export interface LogTrace {
|
|
998
|
+
/** A constant to help discriminate the union `CallTrace | LogTrace`. */
|
|
999
|
+
kind: LogKind
|
|
1000
|
+
/**
|
|
1001
|
+
* If the log is a known event (based on its first topic), it will be
|
|
1002
|
+
* decoded into the event name and list of named parameters. For
|
|
1003
|
+
* example, `{ name: "Log", arguments: ["value: 1"] }`. Otherwise, it
|
|
1004
|
+
* will be provided as an array where all but the last element are the
|
|
1005
|
+
* log topics, and the last element is the log data.
|
|
1006
|
+
*/
|
|
1007
|
+
parameters: DecodedTraceParameters | Array<Uint8Array>
|
|
1008
|
+
}
|
|
1009
|
+
/** The various kinds of call frames possible in the EVM. */
|
|
1010
|
+
export enum CallKind {
|
|
1011
|
+
/** Regular call that may change state. */
|
|
1012
|
+
Call = 0,
|
|
1013
|
+
/**
|
|
1014
|
+
* Variant of `DelegateCall` that doesn't preserve sender or value in the
|
|
1015
|
+
* frame.
|
|
1016
|
+
*/
|
|
1017
|
+
CallCode = 1,
|
|
1018
|
+
/** Call that executes the code of the target in the context of the caller. */
|
|
1019
|
+
DelegateCall = 2,
|
|
1020
|
+
/** Regular call that may not change state. */
|
|
1021
|
+
StaticCall = 3,
|
|
1022
|
+
/** Contract creation. */
|
|
1023
|
+
Create = 4
|
|
1024
|
+
}
|
|
1025
|
+
/** Kind marker for log traces. */
|
|
1026
|
+
export enum LogKind {
|
|
1027
|
+
/** Single kind of log. */
|
|
1028
|
+
Log = 5
|
|
1029
|
+
}
|
|
1030
|
+
/** Decoded function call or event. */
|
|
1031
|
+
export interface DecodedTraceParameters {
|
|
1032
|
+
/** The name of a function or an event. */
|
|
1033
|
+
name: string
|
|
1034
|
+
/**
|
|
1035
|
+
* The arguments of the function call or the event, in their human-readable
|
|
1036
|
+
* representations.
|
|
1037
|
+
*/
|
|
1038
|
+
arguments: Array<string>
|
|
433
1039
|
}
|
|
434
1040
|
/** Configuration for subscriptions. */
|
|
435
1041
|
export interface SubscriptionConfig {
|
|
@@ -628,9 +1234,9 @@ export interface ContractCallRunOutOfGasError {
|
|
|
628
1234
|
}
|
|
629
1235
|
export interface TracingMessage {
|
|
630
1236
|
/** Sender address */
|
|
631
|
-
readonly caller:
|
|
1237
|
+
readonly caller: Uint8Array
|
|
632
1238
|
/** Recipient address. None if it is a Create message. */
|
|
633
|
-
readonly to?:
|
|
1239
|
+
readonly to?: Uint8Array
|
|
634
1240
|
/** Whether it's a static call */
|
|
635
1241
|
readonly isStaticCall: boolean
|
|
636
1242
|
/** Transaction gas limit */
|
|
@@ -638,16 +1244,16 @@ export interface TracingMessage {
|
|
|
638
1244
|
/** Depth of the message */
|
|
639
1245
|
readonly depth: number
|
|
640
1246
|
/** Input data of the message */
|
|
641
|
-
readonly data:
|
|
1247
|
+
readonly data: Uint8Array
|
|
642
1248
|
/** Value sent in the message */
|
|
643
1249
|
readonly value: bigint
|
|
644
1250
|
/**
|
|
645
1251
|
* Address of the code that is being executed. Can be different from `to`
|
|
646
1252
|
* if a delegate call is being done.
|
|
647
1253
|
*/
|
|
648
|
-
readonly codeAddress?:
|
|
1254
|
+
readonly codeAddress?: Uint8Array
|
|
649
1255
|
/** Code of the contract that is being executed. */
|
|
650
|
-
readonly code?:
|
|
1256
|
+
readonly code?: Uint8Array
|
|
651
1257
|
}
|
|
652
1258
|
export interface TracingStep {
|
|
653
1259
|
/** Call depth */
|
|
@@ -663,7 +1269,7 @@ export interface TracingStep {
|
|
|
663
1269
|
*/
|
|
664
1270
|
readonly stack: Array<bigint>
|
|
665
1271
|
/** The memory at the step. None if verbose tracing is disabled. */
|
|
666
|
-
readonly memory?:
|
|
1272
|
+
readonly memory?: Uint8Array
|
|
667
1273
|
}
|
|
668
1274
|
export interface TracingMessageResult {
|
|
669
1275
|
/** Execution result */
|
|
@@ -680,7 +1286,7 @@ export interface Withdrawal {
|
|
|
680
1286
|
/** The index of the validator that generated the withdrawal */
|
|
681
1287
|
validatorIndex: bigint
|
|
682
1288
|
/** The recipient address for withdrawal value */
|
|
683
|
-
address:
|
|
1289
|
+
address: Uint8Array
|
|
684
1290
|
/** The value contained in withdrawal */
|
|
685
1291
|
amount: bigint
|
|
686
1292
|
}
|
|
@@ -691,6 +1297,20 @@ export declare class EdrContext {
|
|
|
691
1297
|
createProvider(chainType: string, providerConfig: ProviderConfig, loggerConfig: LoggerConfig, subscriptionConfig: SubscriptionConfig, tracingConfig: TracingConfigWithBuffers): Promise<Provider>
|
|
692
1298
|
/**Registers a new provider factory for the provided chain type. */
|
|
693
1299
|
registerProviderFactory(chainType: string, factory: ProviderFactory): Promise<void>
|
|
1300
|
+
registerSolidityTestRunnerFactory(chainType: string, factory: SolidityTestRunnerFactory): Promise<void>
|
|
1301
|
+
/**
|
|
1302
|
+
*Executes Solidity tests.
|
|
1303
|
+
*
|
|
1304
|
+
*The function will return as soon as test execution is started.
|
|
1305
|
+
*The progress callback will be called with the results of each test
|
|
1306
|
+
*suite. It is up to the caller to track how many times the callback
|
|
1307
|
+
*is called to know when all tests are done.
|
|
1308
|
+
*/
|
|
1309
|
+
runSolidityTests(chainType: string, artifacts: Array<Artifact>, testSuites: Array<ArtifactId>, configArgs: SolidityTestRunnerConfigArgs, tracingConfig: TracingConfigWithBuffers, onTestSuiteCompletedCallback: (result: SuiteResult) => void): Promise<void>
|
|
1310
|
+
}
|
|
1311
|
+
export declare class Precompile {
|
|
1312
|
+
/** Returns the address of the precompile. */
|
|
1313
|
+
get address(): Uint8Array
|
|
694
1314
|
}
|
|
695
1315
|
export declare class ProviderFactory { }
|
|
696
1316
|
export declare class Response {
|
|
@@ -705,7 +1325,7 @@ export declare class Response {
|
|
|
705
1325
|
export declare class Provider {
|
|
706
1326
|
/**Handles a JSON-RPC request and returns a JSON-RPC response. */
|
|
707
1327
|
handleRequest(request: string): Promise<Response>
|
|
708
|
-
setCallOverrideCallback(callOverrideCallback: (contract_address:
|
|
1328
|
+
setCallOverrideCallback(callOverrideCallback: (contract_address: ArrayBuffer, data: ArrayBuffer) => Promise<CallOverrideResult | undefined>): Promise<void>
|
|
709
1329
|
/**
|
|
710
1330
|
* Set to `true` to make the traces returned with `eth_call`,
|
|
711
1331
|
* `eth_estimateGas`, `eth_sendRawTransaction`, `eth_sendTransaction`,
|
|
@@ -714,6 +1334,55 @@ export declare class Provider {
|
|
|
714
1334
|
*/
|
|
715
1335
|
setVerboseTracing(verboseTracing: boolean): Promise<void>
|
|
716
1336
|
}
|
|
1337
|
+
export declare class SolidityTestRunnerFactory { }
|
|
1338
|
+
/** See [edr_solidity_tests::result::SuiteResult] */
|
|
1339
|
+
export declare class SuiteResult {
|
|
1340
|
+
/**
|
|
1341
|
+
* The artifact id can be used to match input to result in the progress
|
|
1342
|
+
* callback
|
|
1343
|
+
*/
|
|
1344
|
+
readonly id: ArtifactId
|
|
1345
|
+
/** See [edr_solidity_tests::result::SuiteResult::duration] */
|
|
1346
|
+
readonly durationNs: bigint
|
|
1347
|
+
/** See [edr_solidity_tests::result::SuiteResult::test_results] */
|
|
1348
|
+
readonly testResults: Array<TestResult>
|
|
1349
|
+
/** See [edr_solidity_tests::result::SuiteResult::warnings] */
|
|
1350
|
+
readonly warnings: Array<string>
|
|
1351
|
+
}
|
|
1352
|
+
/** See [edr_solidity_tests::result::TestResult] */
|
|
1353
|
+
export declare class TestResult {
|
|
1354
|
+
/** The name of the test. */
|
|
1355
|
+
readonly name: string
|
|
1356
|
+
/** See [edr_solidity_tests::result::TestResult::status] */
|
|
1357
|
+
readonly status: TestStatus
|
|
1358
|
+
/** See [edr_solidity_tests::result::TestResult::reason] */
|
|
1359
|
+
readonly reason?: string
|
|
1360
|
+
/** See [edr_solidity_tests::result::TestResult::counterexample] */
|
|
1361
|
+
readonly counterexample?: BaseCounterExample | CounterExampleSequence
|
|
1362
|
+
/** See [edr_solidity_tests::result::TestResult::decoded_logs] */
|
|
1363
|
+
readonly decodedLogs: Array<string>
|
|
1364
|
+
/** See [edr_solidity_tests::result::TestResult::kind] */
|
|
1365
|
+
readonly kind: StandardTestKind | FuzzTestKind | InvariantTestKind
|
|
1366
|
+
/** See [edr_solidity_tests::result::TestResult::duration] */
|
|
1367
|
+
readonly durationNs: bigint
|
|
1368
|
+
/**
|
|
1369
|
+
* Compute the error stack trace.
|
|
1370
|
+
* The result is either the stack trace or the reason why we couldn't
|
|
1371
|
+
* generate the stack trace.
|
|
1372
|
+
* Returns null if the test status is succeeded or skipped.
|
|
1373
|
+
* Cannot throw.
|
|
1374
|
+
*/
|
|
1375
|
+
stackTrace(): StackTrace | UnexpectedError | HeuristicFailed | UnsafeToReplay | null
|
|
1376
|
+
/**
|
|
1377
|
+
* Constructs the execution traces for the test. Returns an empty array if
|
|
1378
|
+
* traces for this test were not requested according to
|
|
1379
|
+
* [`crate::solidity_tests::config::SolidityTestRunnerConfigArgs::include_traces`]. Otherwise, returns
|
|
1380
|
+
* an array of the root calls of the trace, which always includes the test
|
|
1381
|
+
* call itself and may also include the setup call if there is one
|
|
1382
|
+
* (identified by the function name `setUp`).
|
|
1383
|
+
*/
|
|
1384
|
+
callTraces(): Array<CallTrace>
|
|
1385
|
+
}
|
|
717
1386
|
export declare class Exit {
|
|
718
1387
|
get kind(): ExitCode
|
|
719
1388
|
isError(): boolean
|
|
@@ -734,5 +1403,5 @@ export declare class ReturnData {
|
|
|
734
1403
|
decodePanic(): bigint
|
|
735
1404
|
}
|
|
736
1405
|
export declare class RawTrace {
|
|
737
|
-
trace(): Array<TracingMessage | TracingStep | TracingMessageResult>
|
|
1406
|
+
get trace(): Array<TracingMessage | TracingStep | TracingMessageResult>
|
|
738
1407
|
}
|