@nomicfoundation/edr 0.12.0-alpha.0 → 0.12.0-next.1

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/index.d.ts CHANGED
@@ -3,18 +3,22 @@
3
3
 
4
4
  /* auto-generated by NAPI-RS */
5
5
 
6
- /** A description of an account's state. */
7
- export interface Account {
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
- /** The account's balance */
11
- balance: bigint
12
- /** The account's nonce */
13
- nonce: bigint
14
- /** The account's code */
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
- /** The account's storage */
17
- storage: Array<StorageSlot>
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: Buffer
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<Account>
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
- /** Configuration for a chain */
174
- export interface ChainConfig {
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 supported hardforks */
178
- hardforks: Array<HardforkActivation>
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
- /** The activated hardfork */
201
- specId: string
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: Buffer
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<Account>
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?: Buffer
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
- /** Owned accounts, for which the secret key is known */
276
- ownedAccounts: Array<OwnedAccount>
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?: Buffer
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: Buffer
331
- topics: Array<Buffer>
332
- data: Buffer
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: Buffer[]) => string[]
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: Buffer
413
+ returnValue: Uint8Array
359
414
  }
360
415
  export interface CreateOutput {
361
416
  /** Return value */
362
- returnValue: Buffer
417
+ returnValue: Uint8Array
363
418
  /** Optionally, a 160-bit address */
364
- address?: Buffer
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: Buffer
439
+ output: Uint8Array
385
440
  }
386
441
  /**
387
442
  * Indicates that the EVM has experienced an exceptional halt. This causes
@@ -429,7 +484,572 @@ 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?: Buffer
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
+ /** A grouping of value snapshot entries for a test. */
845
+ export interface ValueSnapshotGroup {
846
+ /** The group name. */
847
+ name: string
848
+ /** The entries in the group. */
849
+ entries: Array<ValueSnapshotEntry>
850
+ }
851
+ /** An entry in a value snapshot group. */
852
+ export interface ValueSnapshotEntry {
853
+ /** The name of the entry. */
854
+ name: string
855
+ /** The value of the entry. */
856
+ value: string
857
+ }
858
+ /** The stack trace result */
859
+ export interface StackTrace {
860
+ /** Enum tag for JS. */
861
+ kind: "StackTrace"
862
+ /** The stack trace entries */
863
+ entries: Array<SolidityStackTraceEntry>
864
+ }
865
+ /** We couldn't generate stack traces, because an unexpected error occurred. */
866
+ export interface UnexpectedError {
867
+ /** Enum tag for JS. */
868
+ kind: "UnexpectedError"
869
+ /** The error message from the unexpected error. */
870
+ errorMessage: string
871
+ }
872
+ /**
873
+ * We couldn't generate stack traces, because the stack trace generation
874
+ * heuristics failed due to an unknown reason.
875
+ */
876
+ export interface HeuristicFailed {
877
+ /** Enum tag for JS. */
878
+ kind: "HeuristicFailed"
879
+ }
880
+ /**
881
+ * We couldn't generate stack traces, because the test execution is unsafe to
882
+ * replay due to indeterminism. This can be caused by either specifying a fork
883
+ * url without a fork block number in the test runner config or using impure
884
+ * cheatcodes.
885
+ */
886
+ export interface UnsafeToReplay {
887
+ /** Enum tag for JS. */
888
+ kind: "UnsafeToReplay"
889
+ /**
890
+ * Indeterminism due to specifying a fork url without a fork block number
891
+ * in the test runner config.
892
+ */
893
+ globalForkLatest: boolean
894
+ /**
895
+ * The list of executed impure cheatcode signatures. We collect function
896
+ * signatures instead of function names as whether a cheatcode is impure
897
+ * can depend on the arguments it takes (e.g. `createFork` without a second
898
+ * argument means implicitly fork from “latest”). Example signature:
899
+ * `function createSelectFork(string calldata urlOrAlias) external returns
900
+ * (uint256 forkId);`.
901
+ */
902
+ impureCheatcodes: Array<string>
903
+ }
904
+ /**The result of a test execution. */
905
+ export enum TestStatus {
906
+ /**Test success */
907
+ Success = 'Success',
908
+ /**Test failure */
909
+ Failure = 'Failure',
910
+ /**Test skipped */
911
+ Skipped = 'Skipped'
912
+ }
913
+ /** See [edr_solidity_tests::result::TestKind::Standard] */
914
+ export interface StandardTestKind {
915
+ /** The gas consumed by the test. */
916
+ readonly consumedGas: bigint
917
+ }
918
+ /** See [edr_solidity_tests::result::TestKind::Fuzz] */
919
+ export interface FuzzTestKind {
920
+ /** See [edr_solidity_tests::result::TestKind::Fuzz] */
921
+ readonly runs: bigint
922
+ /** See [edr_solidity_tests::result::TestKind::Fuzz] */
923
+ readonly meanGas: bigint
924
+ /** See [edr_solidity_tests::result::TestKind::Fuzz] */
925
+ readonly medianGas: bigint
926
+ }
927
+ /** See [edr_solidity_tests::fuzz::FuzzCase] */
928
+ export interface FuzzCase {
929
+ /** The calldata used for this fuzz test */
930
+ readonly calldata: Uint8Array
931
+ /** Consumed gas */
932
+ readonly gas: bigint
933
+ /** The initial gas stipend for the transaction */
934
+ readonly stipend: bigint
935
+ }
936
+ /** See [edr_solidity_tests::result::TestKind::Invariant] */
937
+ export interface InvariantTestKind {
938
+ /** See [edr_solidity_tests::result::TestKind::Invariant] */
939
+ readonly runs: bigint
940
+ /** See [edr_solidity_tests::result::TestKind::Invariant] */
941
+ readonly calls: bigint
942
+ /** See [edr_solidity_tests::result::TestKind::Invariant] */
943
+ readonly reverts: bigint
944
+ }
945
+ /**
946
+ * Original sequence size and sequence of calls used as a counter example
947
+ * for invariant tests.
948
+ */
949
+ export interface CounterExampleSequence {
950
+ /** The original sequence size before shrinking. */
951
+ originalSequenceSize: bigint
952
+ /** The shrunk counterexample sequence. */
953
+ sequence: Array<BaseCounterExample>
954
+ }
955
+ /** See [edr_solidity_tests::fuzz::BaseCounterExample] */
956
+ export interface BaseCounterExample {
957
+ /** See [edr_solidity_tests::fuzz::BaseCounterExample::sender] */
958
+ readonly sender?: Uint8Array
959
+ /** See [edr_solidity_tests::fuzz::BaseCounterExample::addr] */
960
+ readonly address?: Uint8Array
961
+ /** See [edr_solidity_tests::fuzz::BaseCounterExample::calldata] */
962
+ readonly calldata: Uint8Array
963
+ /** See [edr_solidity_tests::fuzz::BaseCounterExample::contract_name] */
964
+ readonly contractName?: string
965
+ /** See [edr_solidity_tests::fuzz::BaseCounterExample::signature] */
966
+ readonly signature?: string
967
+ /** See [edr_solidity_tests::fuzz::BaseCounterExample::args] */
968
+ readonly args?: string
969
+ }
970
+ /**
971
+ * Object representing a call in an execution trace, including contract
972
+ * creation.
973
+ */
974
+ export interface CallTrace {
975
+ /** The kind of call or contract creation this represents. */
976
+ kind: CallKind
977
+ /** Whether the call succeeded or reverted. */
978
+ success: boolean
979
+ /** Whether the call is a cheatcode. */
980
+ isCheatcode: boolean
981
+ /** The amount of gas that was consumed. */
982
+ gasUsed: bigint
983
+ /** The amount of native token that was included with the call. */
984
+ value: bigint
985
+ /**
986
+ * The target of the call. Provided as a contract name if known, otherwise
987
+ * a checksum address.
988
+ */
989
+ contract: string
990
+ /**
991
+ * The input (calldata) to the call. If it encodes a known function call,
992
+ * it will be decoded into the function name and a list of arguments.
993
+ * For example, `{ name: "ownerOf", arguments: ["1"] }`. Note that the
994
+ * function name may also be any of the special `fallback` and `receive`
995
+ * functions. Otherwise, it will be provided as a raw byte array.
996
+ */
997
+ inputs: DecodedTraceParameters | Uint8Array
998
+ /**
999
+ * The output of the call. This will be a decoded human-readable
1000
+ * representation of the value if the function is known, otherwise a
1001
+ * raw byte array.
1002
+ */
1003
+ outputs: string | Uint8Array
1004
+ /**
1005
+ * Interleaved subcalls and event logs. Use `kind` to check if each member
1006
+ * of the array is a call or log trace.
1007
+ */
1008
+ children: Array<CallTrace | LogTrace>
1009
+ }
1010
+ /** Object representing an event log in an execution trace. */
1011
+ export interface LogTrace {
1012
+ /** A constant to help discriminate the union `CallTrace | LogTrace`. */
1013
+ kind: LogKind
1014
+ /**
1015
+ * If the log is a known event (based on its first topic), it will be
1016
+ * decoded into the event name and list of named parameters. For
1017
+ * example, `{ name: "Log", arguments: ["value: 1"] }`. Otherwise, it
1018
+ * will be provided as an array where all but the last element are the
1019
+ * log topics, and the last element is the log data.
1020
+ */
1021
+ parameters: DecodedTraceParameters | Array<Uint8Array>
1022
+ }
1023
+ /** The various kinds of call frames possible in the EVM. */
1024
+ export enum CallKind {
1025
+ /** Regular call that may change state. */
1026
+ Call = 0,
1027
+ /**
1028
+ * Variant of `DelegateCall` that doesn't preserve sender or value in the
1029
+ * frame.
1030
+ */
1031
+ CallCode = 1,
1032
+ /** Call that executes the code of the target in the context of the caller. */
1033
+ DelegateCall = 2,
1034
+ /** Regular call that may not change state. */
1035
+ StaticCall = 3,
1036
+ /** Contract creation. */
1037
+ Create = 4
1038
+ }
1039
+ /** Kind marker for log traces. */
1040
+ export enum LogKind {
1041
+ /** Single kind of log. */
1042
+ Log = 5
1043
+ }
1044
+ /** Decoded function call or event. */
1045
+ export interface DecodedTraceParameters {
1046
+ /** The name of a function or an event. */
1047
+ name: string
1048
+ /**
1049
+ * The arguments of the function call or the event, in their human-readable
1050
+ * representations.
1051
+ */
1052
+ arguments: Array<string>
433
1053
  }
434
1054
  /** Configuration for subscriptions. */
435
1055
  export interface SubscriptionConfig {
@@ -628,9 +1248,9 @@ export interface ContractCallRunOutOfGasError {
628
1248
  }
629
1249
  export interface TracingMessage {
630
1250
  /** Sender address */
631
- readonly caller: Buffer
1251
+ readonly caller: Uint8Array
632
1252
  /** Recipient address. None if it is a Create message. */
633
- readonly to?: Buffer
1253
+ readonly to?: Uint8Array
634
1254
  /** Whether it's a static call */
635
1255
  readonly isStaticCall: boolean
636
1256
  /** Transaction gas limit */
@@ -638,16 +1258,16 @@ export interface TracingMessage {
638
1258
  /** Depth of the message */
639
1259
  readonly depth: number
640
1260
  /** Input data of the message */
641
- readonly data: Buffer
1261
+ readonly data: Uint8Array
642
1262
  /** Value sent in the message */
643
1263
  readonly value: bigint
644
1264
  /**
645
1265
  * Address of the code that is being executed. Can be different from `to`
646
1266
  * if a delegate call is being done.
647
1267
  */
648
- readonly codeAddress?: Buffer
1268
+ readonly codeAddress?: Uint8Array
649
1269
  /** Code of the contract that is being executed. */
650
- readonly code?: Buffer
1270
+ readonly code?: Uint8Array
651
1271
  }
652
1272
  export interface TracingStep {
653
1273
  /** Call depth */
@@ -663,7 +1283,7 @@ export interface TracingStep {
663
1283
  */
664
1284
  readonly stack: Array<bigint>
665
1285
  /** The memory at the step. None if verbose tracing is disabled. */
666
- readonly memory?: Buffer
1286
+ readonly memory?: Uint8Array
667
1287
  }
668
1288
  export interface TracingMessageResult {
669
1289
  /** Execution result */
@@ -680,7 +1300,7 @@ export interface Withdrawal {
680
1300
  /** The index of the validator that generated the withdrawal */
681
1301
  validatorIndex: bigint
682
1302
  /** The recipient address for withdrawal value */
683
- address: Buffer
1303
+ address: Uint8Array
684
1304
  /** The value contained in withdrawal */
685
1305
  amount: bigint
686
1306
  }
@@ -691,6 +1311,20 @@ export declare class EdrContext {
691
1311
  createProvider(chainType: string, providerConfig: ProviderConfig, loggerConfig: LoggerConfig, subscriptionConfig: SubscriptionConfig, tracingConfig: TracingConfigWithBuffers): Promise<Provider>
692
1312
  /**Registers a new provider factory for the provided chain type. */
693
1313
  registerProviderFactory(chainType: string, factory: ProviderFactory): Promise<void>
1314
+ registerSolidityTestRunnerFactory(chainType: string, factory: SolidityTestRunnerFactory): Promise<void>
1315
+ /**
1316
+ *Executes Solidity tests.
1317
+ *
1318
+ *The function will return as soon as test execution is started.
1319
+ *The progress callback will be called with the results of each test
1320
+ *suite. It is up to the caller to track how many times the callback
1321
+ *is called to know when all tests are done.
1322
+ */
1323
+ runSolidityTests(chainType: string, artifacts: Array<Artifact>, testSuites: Array<ArtifactId>, configArgs: SolidityTestRunnerConfigArgs, tracingConfig: TracingConfigWithBuffers, onTestSuiteCompletedCallback: (result: SuiteResult) => void): Promise<void>
1324
+ }
1325
+ export declare class Precompile {
1326
+ /** Returns the address of the precompile. */
1327
+ get address(): Uint8Array
694
1328
  }
695
1329
  export declare class ProviderFactory { }
696
1330
  export declare class Response {
@@ -705,7 +1339,7 @@ export declare class Response {
705
1339
  export declare class Provider {
706
1340
  /**Handles a JSON-RPC request and returns a JSON-RPC response. */
707
1341
  handleRequest(request: string): Promise<Response>
708
- setCallOverrideCallback(callOverrideCallback: (contract_address: Buffer, data: Buffer) => Promise<CallOverrideResult | undefined>): Promise<void>
1342
+ setCallOverrideCallback(callOverrideCallback: (contract_address: ArrayBuffer, data: ArrayBuffer) => Promise<CallOverrideResult | undefined>): Promise<void>
709
1343
  /**
710
1344
  * Set to `true` to make the traces returned with `eth_call`,
711
1345
  * `eth_estimateGas`, `eth_sendRawTransaction`, `eth_sendTransaction`,
@@ -714,6 +1348,62 @@ export declare class Provider {
714
1348
  */
715
1349
  setVerboseTracing(verboseTracing: boolean): Promise<void>
716
1350
  }
1351
+ export declare class SolidityTestRunnerFactory { }
1352
+ /** See [edr_solidity_tests::result::SuiteResult] */
1353
+ export declare class SuiteResult {
1354
+ /**
1355
+ * The artifact id can be used to match input to result in the progress
1356
+ * callback
1357
+ */
1358
+ readonly id: ArtifactId
1359
+ /** See [edr_solidity_tests::result::SuiteResult::duration] */
1360
+ readonly durationNs: bigint
1361
+ /** See [edr_solidity_tests::result::SuiteResult::test_results] */
1362
+ readonly testResults: Array<TestResult>
1363
+ /** See [edr_solidity_tests::result::SuiteResult::warnings] */
1364
+ readonly warnings: Array<string>
1365
+ }
1366
+ /** See [edr_solidity_tests::result::TestResult] */
1367
+ export declare class TestResult {
1368
+ /** The name of the test. */
1369
+ readonly name: string
1370
+ /** See [edr_solidity_tests::result::TestResult::status] */
1371
+ readonly status: TestStatus
1372
+ /** See [edr_solidity_tests::result::TestResult::reason] */
1373
+ readonly reason?: string
1374
+ /** See [edr_solidity_tests::result::TestResult::counterexample] */
1375
+ readonly counterexample?: BaseCounterExample | CounterExampleSequence
1376
+ /** See [edr_solidity_tests::result::TestResult::decoded_logs] */
1377
+ readonly decodedLogs: Array<string>
1378
+ /** See [edr_solidity_tests::result::TestResult::kind] */
1379
+ readonly kind: StandardTestKind | FuzzTestKind | InvariantTestKind
1380
+ /** See [edr_solidity_tests::result::TestResult::duration] */
1381
+ readonly durationNs: bigint
1382
+ /**
1383
+ * Groups of value snapshot entries (incl. gas).
1384
+ *
1385
+ * Only present if the test runner collected scoped snapshots. Currently,
1386
+ * this is always the case.
1387
+ */
1388
+ readonly valueSnapshotGroups?: Array<ValueSnapshotGroup>
1389
+ /**
1390
+ * Compute the error stack trace.
1391
+ * The result is either the stack trace or the reason why we couldn't
1392
+ * generate the stack trace.
1393
+ * Returns null if the test status is succeeded or skipped.
1394
+ * Cannot throw.
1395
+ */
1396
+ stackTrace(): StackTrace | UnexpectedError | HeuristicFailed | UnsafeToReplay | null
1397
+ /**
1398
+ * Constructs the execution traces for the test. Returns an empty array if
1399
+ * traces for this test were not requested according to
1400
+ * [`crate::solidity_tests::config::SolidityTestRunnerConfigArgs::include_traces`]. Otherwise, returns
1401
+ * an array of the root calls of the trace, which always includes the test
1402
+ * call itself and may also include the setup call if there is one
1403
+ * (identified by the function name `setUp`).
1404
+ */
1405
+ callTraces(): Array<CallTrace>
1406
+ }
717
1407
  export declare class Exit {
718
1408
  get kind(): ExitCode
719
1409
  isError(): boolean
@@ -734,5 +1424,5 @@ export declare class ReturnData {
734
1424
  decodePanic(): bigint
735
1425
  }
736
1426
  export declare class RawTrace {
737
- trace(): Array<TracingMessage | TracingStep | TracingMessageResult>
1427
+ get trace(): Array<TracingMessage | TracingStep | TracingMessageResult>
738
1428
  }