@nomicfoundation/edr 0.13.0 → 0.14.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.
Files changed (3) hide show
  1. package/index.d.ts +1642 -1419
  2. package/index.js +620 -345
  3. package/package.json +32 -32
package/index.d.ts CHANGED
@@ -1,7 +1,165 @@
1
- /* tslint:disable */
1
+ /* auto-generated by NAPI-RS */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Opaque handle to the `Bytecode` struct.
5
+ * Only used on the JS side by the `VmTraceDecoder` class.
6
+ */
7
+ export declare class BytecodeWrapper {
3
8
 
4
- /* auto-generated by NAPI-RS */
9
+ }
10
+
11
+ export declare class ContractDecoder {
12
+ /** Creates an empty instance. */
13
+ constructor()
14
+ /** Creates a new instance with the provided configuration. */
15
+ static withContracts(config: TracingConfigWithBuffers): ContractDecoder
16
+ }
17
+
18
+ export declare class EdrContext {
19
+ /** Creates a new [`EdrContext`] instance. Should only be called once! */
20
+ constructor()
21
+ /** Constructs a new provider with the provided configuration. */
22
+ createProvider(chainType: string, providerConfig: ProviderConfig, loggerConfig: LoggerConfig, subscriptionConfig: SubscriptionConfig, contractDecoder: ContractDecoder): Promise<Provider>
23
+ /** Registers a new provider factory for the provided chain type. */
24
+ registerProviderFactory(chainType: string, factory: ProviderFactory): Promise<void>
25
+ registerSolidityTestRunnerFactory(chainType: string, factory: SolidityTestRunnerFactory): Promise<void>
26
+ /**
27
+ * Executes Solidity tests
28
+ *
29
+ * The function will return a promise that resolves to a
30
+ * [`SolidityTestResult`].
31
+ *
32
+ * Arguments:
33
+ * - `chainType`: the same chain type that was passed to
34
+ * `registerProviderFactory`.
35
+ * - `artifacts`: the project's compilation output artifacts. It's
36
+ * important to include include all artifacts here, otherwise cheatcodes
37
+ * that access artifacts and other functionality (e.g. auto-linking, gas
38
+ * reports) can break.
39
+ * - `testSuites`: the test suite ids that specify which test suites to
40
+ * execute. The test suite artifacts must be present in `artifacts`.
41
+ * - `configArgs`: solidity test runner configuration. See the struct docs
42
+ * for details.
43
+ * - `tracingConfig`: the build infos used for stack trace generation.
44
+ * These are lazily parsed and it's important that they're passed as
45
+ * Uint8 arrays for performance.
46
+ * - `onTestSuiteCompletedCallback`: The progress callback will be called
47
+ * with the results of each test suite as soon as it finished executing.
48
+ */
49
+ runSolidityTests(chainType: string, artifacts: Array<Artifact>, testSuites: Array<ArtifactId>, configArgs: SolidityTestRunnerConfigArgs, tracingConfig: TracingConfigWithBuffers, onTestSuiteCompletedCallback: (arg: SuiteResult) => void): Promise<SolidityTestResult>
50
+ }
51
+
52
+ export declare class Exit {
53
+ get kind(): ExitCode
54
+ isError(): boolean
55
+ getReason(): string
56
+ }
57
+
58
+ export declare class Precompile {
59
+ /** Returns the address of the precompile. */
60
+ get address(): Uint8Array
61
+ }
62
+
63
+ /** A JSON-RPC provider for Ethereum. */
64
+ export declare class Provider {
65
+ /**
66
+ * Adds a compilation result to the instance.
67
+ *
68
+ * For internal use only. Support for this method may be removed in the future.
69
+ */
70
+ addCompilationResult(solcVersion: string, compilerInput: any, compilerOutput: any): Promise<void>
71
+ /** Retrieves the instance's contract decoder. */
72
+ contractDecoder(): ContractDecoder
73
+ /** Handles a JSON-RPC request and returns a JSON-RPC response. */
74
+ handleRequest(request: string): Promise<Response>
75
+ setCallOverrideCallback(callOverrideCallback: (contract_address: ArrayBuffer, data: ArrayBuffer) => Promise<CallOverrideResult | undefined>): Promise<void>
76
+ /**
77
+ * Set to `true` to make the traces returned with `eth_call`,
78
+ * `eth_estimateGas`, `eth_sendRawTransaction`, `eth_sendTransaction`,
79
+ * `evm_mine`, `hardhat_mine` include the full stack and memory. Set to
80
+ * `false` to disable this.
81
+ */
82
+ setVerboseTracing(verboseTracing: boolean): Promise<void>
83
+ }
84
+
85
+ export declare class ProviderFactory {
86
+
87
+ }
88
+
89
+ export declare class RawTrace {
90
+ get trace(): Array<TracingMessage | TracingStep | TracingMessageResult>
91
+ }
92
+
93
+ export declare class Response {
94
+ /** Returns the response data as a JSON string or a JSON object. */
95
+ get data(): string | any
96
+ /** Compute the error stack trace. Return the stack trace if it can be decoded, otherwise returns none. Throws if there was an error computing the stack trace. */
97
+ stackTrace(): StackTrace | UnexpectedError | HeuristicFailed | null
98
+ /**
99
+ * Constructs the execution traces for the request. Returns an empty array
100
+ * if traces are not enabled for this provider according to
101
+ * [`crate::solidity_tests::config::SolidityTestRunnerConfigArgs::include_traces`]. Otherwise, returns
102
+ * an array of the root calls of the trace, which always includes the
103
+ * request's call itself.
104
+ */
105
+ callTraces(): Array<CallTrace>
106
+ }
107
+
108
+ export declare class ReturnData {
109
+ readonly value: Uint8Array
110
+ constructor(value: Uint8Array)
111
+ isEmpty(): boolean
112
+ isErrorReturnData(): boolean
113
+ isPanicReturnData(): boolean
114
+ decodeError(): string
115
+ decodePanic(): bigint
116
+ }
117
+
118
+ export declare class SolidityTestRunnerFactory {
119
+
120
+ }
121
+
122
+ /** See [`edr_solidity_tests::result::TestResult`] */
123
+ export declare class TestResult {
124
+ /** The name of the test. */
125
+ get name(): string
126
+ /** See [`edr_solidity_tests::result::TestResult::status`] */
127
+ get status(): TestStatus
128
+ /** See [`edr_solidity_tests::result::TestResult::reason`] */
129
+ get reason(): string | undefined
130
+ /** See [`edr_solidity_tests::result::TestResult::counterexample`] */
131
+ get counterexample(): BaseCounterExample | CounterExampleSequence | undefined
132
+ /** See [`edr_solidity_tests::result::TestResult::decoded_logs`] */
133
+ get decodedLogs(): Array<string>
134
+ /** See [`edr_solidity_tests::result::TestResult::kind`] */
135
+ get kind(): StandardTestKind | FuzzTestKind | InvariantTestKind
136
+ /** See [`edr_solidity_tests::result::TestResult::duration`] */
137
+ get durationNs(): bigint
138
+ /**
139
+ * Groups of value snapshot entries (incl. gas).
140
+ *
141
+ * Only present if the test runner collected scoped snapshots. Currently,
142
+ * this is always the case.
143
+ */
144
+ get valueSnapshotGroups(): Array<ValueSnapshotGroup> | undefined
145
+ /**
146
+ * Compute the error stack trace.
147
+ * The result is either the stack trace or the reason why we couldn't
148
+ * generate the stack trace.
149
+ * Returns null if the test status is succeeded or skipped.
150
+ * Cannot throw.
151
+ */
152
+ stackTrace(): StackTrace | UnexpectedError | HeuristicFailed | UnsafeToReplay | null
153
+ /**
154
+ * Constructs the execution traces for the test. Returns an empty array if
155
+ * traces for this test were not requested according to
156
+ * [`crate::solidity_tests::config::SolidityTestRunnerConfigArgs::include_traces`]. Otherwise, returns
157
+ * an array of the root calls of the trace, which always includes the test
158
+ * call itself and may also include the setup call if there is one
159
+ * (identified by the function name `setUp`).
160
+ */
161
+ callTraces(): Array<CallTrace>
162
+ }
5
163
 
6
164
  /** Specification of overrides for an account and its storage. */
7
165
  export interface AccountOverride {
@@ -20,13 +178,79 @@ export interface AccountOverride {
20
178
  */
21
179
  storage?: Array<StorageSlot>
22
180
  }
23
- /** A description of a storage slot's state. */
24
- export interface StorageSlot {
25
- /** The storage slot's index */
26
- index: bigint
27
- /** The storage slot's value */
28
- value: bigint
181
+
182
+ export interface AddressLabel {
183
+ /** The address to label */
184
+ address: Uint8Array
185
+ /** The label to assign to the address */
186
+ label: string
187
+ }
188
+
189
+ /**
190
+ * Adds per-statement coverage instrumentation to the given Solidity source
191
+ * code.
192
+ */
193
+ export declare function addStatementCoverageInstrumentation(sourceCode: string, sourceId: string, solidityVersion: string): InstrumentationResult
194
+
195
+ export const AMSTERDAM: string
196
+
197
+ export const ARROW_GLACIER: string
198
+
199
+ /** A compilation artifact. */
200
+ export interface Artifact {
201
+ /** The identifier of the artifact. */
202
+ id: ArtifactId
203
+ /** The test contract. */
204
+ contract: ContractData
205
+ }
206
+
207
+ /** The identifier of a Solidity contract. */
208
+ export interface ArtifactId {
209
+ /** The name of the contract. */
210
+ name: string
211
+ /** Original source file path. */
212
+ source: string
213
+ /** The solc semver string. */
214
+ solcVersion: string
215
+ }
216
+
217
+ /** See [`edr_solidity_tests::fuzz::BaseCounterExample`] */
218
+ export interface BaseCounterExample {
219
+ /** See [`edr_solidity_tests::fuzz::BaseCounterExample::sender`] */
220
+ readonly sender?: Uint8Array
221
+ /** See [`edr_solidity_tests::fuzz::BaseCounterExample::addr`] */
222
+ readonly address?: Uint8Array
223
+ /** See [`edr_solidity_tests::fuzz::BaseCounterExample::calldata`] */
224
+ readonly calldata: Uint8Array
225
+ /** See [`edr_solidity_tests::fuzz::BaseCounterExample::contract_name`] */
226
+ readonly contractName?: string
227
+ /** See [`edr_solidity_tests::fuzz::BaseCounterExample::signature`] */
228
+ readonly signature?: string
229
+ /** See [`edr_solidity_tests::fuzz::BaseCounterExample::args`] */
230
+ readonly args?: string
231
+ }
232
+
233
+ export interface BaseFeeActivationByBlockNumber {
234
+ /** The block number at which the `base_fee_params` is activated */
235
+ blockNumber: bigint
236
+ }
237
+
238
+ export interface BaseFeeActivationByHardfork {
239
+ /** The hardfork at which the `base_fee_params` is activated */
240
+ hardfork: string
241
+ }
242
+
243
+ /** Configuration for EIP-1559 parameters */
244
+ export interface BaseFeeParamActivation {
245
+ activation: BaseFeeActivationByBlockNumber | BaseFeeActivationByHardfork
246
+ maxChangeDenominator: bigint
247
+ elasticityMultiplier: bigint
29
248
  }
249
+
250
+ export const BEDROCK: string
251
+
252
+ export const BERLIN: string
253
+
30
254
  /** Information about the blob gas used in a block. */
31
255
  export interface BlobGas {
32
256
  /**
@@ -42,143 +266,119 @@ export interface BlobGas {
42
266
  */
43
267
  excessGas: bigint
44
268
  }
45
- /** The result of executing a call override. */
46
- export interface CallOverrideResult {
47
- result: Uint8Array
48
- shouldRevert: boolean
269
+
270
+ /**
271
+ * Hardhat V3 build info where the compiler output is not part of the build
272
+ * info file.
273
+ */
274
+ export interface BuildInfoAndOutput {
275
+ /** The build info input file */
276
+ buildInfo: Uint8Array
277
+ /** The build info output file */
278
+ output: Uint8Array
49
279
  }
50
- export const GENERIC_CHAIN_TYPE: string
51
- export declare function genericChainProviderFactory(): ProviderFactory
52
- export const L1_CHAIN_TYPE: string
53
- export declare function l1GenesisState(hardfork: SpecId): Array<AccountOverride>
54
- export declare function l1ProviderFactory(): ProviderFactory
55
- /** Identifier for the Ethereum spec. */
56
- export enum SpecId {
57
- /** Frontier */
58
- Frontier = 0,
59
- /** Frontier Thawing */
60
- FrontierThawing = 1,
61
- /** Homestead */
62
- Homestead = 2,
63
- /** DAO Fork */
64
- DaoFork = 3,
65
- /** Tangerine */
66
- Tangerine = 4,
67
- /** Spurious Dragon */
68
- SpuriousDragon = 5,
69
- /** Byzantium */
70
- Byzantium = 6,
71
- /** Constantinople */
72
- Constantinople = 7,
73
- /** Petersburg */
74
- Petersburg = 8,
75
- /** Istanbul */
76
- Istanbul = 9,
77
- /** Muir Glacier */
78
- MuirGlacier = 10,
79
- /** Berlin */
80
- Berlin = 11,
81
- /** London */
82
- London = 12,
83
- /** Arrow Glacier */
84
- ArrowGlacier = 13,
85
- /** Gray Glacier */
86
- GrayGlacier = 14,
87
- /** Merge */
88
- Merge = 15,
89
- /** Shanghai */
90
- Shanghai = 16,
91
- /** Cancun */
92
- Cancun = 17,
93
- /** Prague */
94
- Prague = 18,
95
- /** Osaka */
96
- Osaka = 19
97
- }
98
- /**
99
- * Tries to parse the provided string to create a [`SpecId`] instance.
100
- *
101
- * Returns an error if the string does not match any known hardfork.
102
- */
103
- export declare function l1HardforkFromString(hardfork: string): SpecId
104
- export declare function l1HardforkToString(harfork: SpecId): string
105
- /**
106
- * Returns the latest supported OP hardfork.
107
- *
108
- * The returned value will be updated after each network upgrade.
109
- */
110
- export declare function l1HardforkLatest(): SpecId
111
- export const FRONTIER: string
112
- export const FRONTIER_THAWING: string
113
- export const HOMESTEAD: string
114
- export const DAO_FORK: string
115
- export const TANGERINE: string
116
- export const SPURIOUS_DRAGON: string
280
+
117
281
  export const BYZANTIUM: string
118
- export const CONSTANTINOPLE: string
119
- export const PETERSBURG: string
120
- export const ISTANBUL: string
121
- export const MUIR_GLACIER: string
122
- export const BERLIN: string
123
- export const LONDON: string
124
- export const ARROW_GLACIER: string
125
- export const GRAY_GLACIER: string
126
- export const MERGE: string
127
- export const SHANGHAI: string
128
- export const CANCUN: string
129
- export const PRAGUE: string
130
- export const OSAKA: string
131
- /** Enumeration of supported OP hardforks. */
132
- export enum OpHardfork {
133
- Bedrock = 100,
134
- Regolith = 101,
135
- Canyon = 102,
136
- Ecotone = 103,
137
- Fjord = 104,
138
- Granite = 105,
139
- Holocene = 106,
140
- Isthmus = 107
282
+
283
+ /** What chains to cache */
284
+ export declare enum CachedChains {
285
+ /** Cache all chains */
286
+ All = 0,
287
+ /** Don't cache anything */
288
+ None = 1
141
289
  }
142
- /**
143
- * Tries to parse the provided string to create an [`OpHardfork`]
144
- * instance.
145
- *
146
- * Returns an error if the string does not match any known hardfork.
147
- */
148
- export declare function opHardforkFromString(hardfork: string): OpHardfork
149
- /** Returns the string representation of the provided OP hardfork. */
150
- export declare function opHardforkToString(hardfork: OpHardfork): string
151
- /**
152
- * Returns the latest supported OP hardfork.
153
- *
154
- * The returned value will be updated after each network upgrade.
155
- */
156
- export declare function opLatestHardfork(): OpHardfork
157
- export const OP_CHAIN_TYPE: string
158
- export declare function opGenesisState(hardfork: OpHardfork): Array<AccountOverride>
159
- export declare function opProviderFactory(): ProviderFactory
160
- export const BEDROCK: string
161
- export const REGOLITH: string
162
- export const CANYON: string
163
- export const ECOTONE: string
164
- export const FJORD: string
165
- export const GRANITE: string
166
- export const HOLOCENE: string
167
- export const ISTHMUS: string
168
- /** Configuration for EIP-1559 parameters */
169
- export interface BaseFeeParamActivation {
170
- activation: BaseFeeActivationByBlockNumber | BaseFeeActivationByHardfork
171
- maxChangeDenominator: bigint
172
- elasticityMultiplier: bigint
290
+
291
+ /** What endpoints to enable caching for */
292
+ export declare enum CachedEndpoints {
293
+ /** Cache all endpoints */
294
+ All = 0,
295
+ /** Only cache non-local host endpoints */
296
+ Remote = 1
173
297
  }
174
- export interface BaseFeeActivationByBlockNumber {
175
- /** The block number at which the `base_fee_params` is activated */
176
- blockNumber: bigint
298
+
299
+ export interface CallFailedErrorStackTraceEntry {
300
+ type: StackTraceEntryType.CALL_FAILED_ERROR
301
+ sourceReference: SourceReference
177
302
  }
178
- export interface BaseFeeActivationByHardfork {
179
- /** The hardfork at which the `base_fee_params` is activated */
180
- hardfork: string
303
+
304
+ /** The various kinds of call frames possible in the EVM. */
305
+ export declare enum CallKind {
306
+ /** Regular call that may change state. */
307
+ Call = 0,
308
+ /**
309
+ * Variant of `DelegateCall` that doesn't preserve sender or value in the
310
+ * frame.
311
+ */
312
+ CallCode = 1,
313
+ /** Call that executes the code of the target in the context of the caller. */
314
+ DelegateCall = 2,
315
+ /** Regular call that may not change state. */
316
+ StaticCall = 3,
317
+ /** Contract creation. */
318
+ Create = 4
319
+ }
320
+
321
+ export interface CallOutput {
322
+ /** Return value */
323
+ returnValue: Uint8Array
324
+ }
325
+
326
+ /** The result of executing a call override. */
327
+ export interface CallOverrideResult {
328
+ result: Uint8Array
329
+ shouldRevert: boolean
330
+ }
331
+
332
+ export interface CallstackEntryStackTraceEntry {
333
+ type: StackTraceEntryType.CALLSTACK_ENTRY
334
+ sourceReference: SourceReference
335
+ functionType: ContractFunctionType
336
+ }
337
+
338
+ /**
339
+ * Object representing a call in an execution trace, including contract
340
+ * creation.
341
+ */
342
+ export interface CallTrace {
343
+ /** The kind of call or contract creation this represents. */
344
+ kind: CallKind
345
+ /** Whether the call succeeded or reverted. */
346
+ success: boolean
347
+ /** Whether the call is a cheatcode. */
348
+ isCheatcode: boolean
349
+ /** The amount of gas that was consumed. */
350
+ gasUsed: bigint
351
+ /** The amount of native token that was included with the call. */
352
+ value: bigint
353
+ /** The target address of the call. */
354
+ address: string
355
+ /** The name of the contract that is the target of the call, if known. */
356
+ contract?: string
357
+ /**
358
+ * The input (calldata) to the call. If it encodes a known function call,
359
+ * it will be decoded into the function name and a list of arguments.
360
+ * For example, `{ name: "ownerOf", arguments: ["1"] }`. Note that the
361
+ * function name may also be any of the special `fallback` and `receive`
362
+ * functions. Otherwise, it will be provided as a raw byte array.
363
+ */
364
+ inputs: DecodedTraceParameters | Uint8Array
365
+ /**
366
+ * The output of the call. This will be a decoded human-readable
367
+ * representation of the value if the function is known, otherwise a
368
+ * raw byte array.
369
+ */
370
+ outputs: string | Uint8Array
371
+ /**
372
+ * Interleaved subcalls and event logs. Use `kind` to check if each member
373
+ * of the array is a call or log trace.
374
+ */
375
+ children: Array<CallTrace | LogTrace>
181
376
  }
377
+
378
+ export const CANCUN: string
379
+
380
+ export const CANYON: string
381
+
182
382
  /** Specification of a chain with possible overrides. */
183
383
  export interface ChainOverride {
184
384
  /** The chain ID */
@@ -188,6 +388,30 @@ export interface ChainOverride {
188
388
  /** If present, overrides for the chain's supported hardforks */
189
389
  hardforkActivationOverrides?: Array<HardforkActivation>
190
390
  }
391
+
392
+ /** Error codes that can be returned by cheatcodes in Solidity tests. */
393
+ export declare enum CheatcodeErrorCode {
394
+ /** The specified cheatcode is not supported. */
395
+ UnsupportedCheatcode = 'UnsupportedCheatcode',
396
+ /** The specified cheatcode is missing. */
397
+ MissingCheatcode = 'MissingCheatcode'
398
+ }
399
+
400
+ /** Error returned by a cheatcode in Solidity tests. */
401
+ export interface CheatcodeErrorDetails {
402
+ /** The error code representing the type of cheatcode error. */
403
+ code: CheatcodeErrorCode
404
+ /** The name of the cheatcode that caused the error. */
405
+ cheatcode: string
406
+ }
407
+
408
+ export interface CheatcodeErrorStackTraceEntry {
409
+ type: StackTraceEntryType.CHEATCODE_ERROR
410
+ message: string
411
+ sourceReference: SourceReference
412
+ details?: CheatcodeErrorDetails
413
+ }
414
+
191
415
  /** Configuration for a code coverage reporter. */
192
416
  export interface CodeCoverageConfig {
193
417
  /**
@@ -201,221 +425,99 @@ export interface CodeCoverageConfig {
201
425
  */
202
426
  onCollectedCoverageCallback: (coverageHits: Uint8Array[]) => Promise<void>
203
427
  }
204
- export interface GasReportConfig {
428
+
429
+ /** A type that controls when stack traces are collected. */
430
+ export declare enum CollectStackTraces {
431
+ /** Always collects stack traces, adding performance overhead. */
432
+ Always = 0,
205
433
  /**
206
- * Gas reports are collected after a block is mined or `eth_call` is
207
- * executed.
434
+ * Only collects stack traces upon failure, re-executing the test. This
435
+ * minimizes performance overhead.
208
436
  *
209
- * Exceptions thrown in the callback will be propagated to the original
210
- * caller.
437
+ * Not all tests can be re-executed since certain cheatcodes contain
438
+ * non-deterministic side-effects.
211
439
  */
212
- onCollectedGasReportCallback: (gasReport: GasReport) => Promise<void>
440
+ OnFailure = 1
213
441
  }
214
- /** Configuration for forking a blockchain */
215
- export interface ForkConfig {
442
+
443
+ export const CONSTANTINOPLE: string
444
+
445
+ export const CONSTRUCTOR_FUNCTION_NAME: string
446
+
447
+ export interface ContractCallRunOutOfGasError {
448
+ type: StackTraceEntryType.CONTRACT_CALL_RUN_OUT_OF_GAS_ERROR
449
+ sourceReference?: SourceReference
450
+ }
451
+
452
+ /** A test contract to execute. */
453
+ export interface ContractData {
454
+ /** Contract ABI as json string. */
455
+ abi: string
216
456
  /**
217
- * The block number to fork from. If not provided, the latest safe block is
218
- * used.
457
+ * Contract creation code as hex string. It can be missing if the contract
458
+ * is ABI only.
219
459
  */
220
- blockNumber?: bigint
221
- /** The directory to cache remote JSON-RPC responses */
222
- cacheDir?: string
223
- /** Overrides for the configuration of chains. */
224
- chainOverrides?: Array<ChainOverride>
225
- /** The HTTP headers to use when making requests to the JSON-RPC endpoint */
226
- httpHeaders?: Array<HttpHeader>
227
- /** The URL of the JSON-RPC endpoint to fork from */
228
- url: string
229
- }
230
- export interface HttpHeader {
231
- name: string
232
- value: string
233
- }
234
- /** Configuration for a hardfork activation */
235
- export interface HardforkActivation {
236
- /** The condition for the hardfork activation */
237
- condition: HardforkActivationByBlockNumber | HardforkActivationByTimestamp
238
- /** The activated hardfork */
239
- hardfork: string
240
- }
241
- export interface HardforkActivationByBlockNumber {
242
- /** The block number at which the hardfork is activated */
243
- blockNumber: bigint
244
- }
245
- export interface HardforkActivationByTimestamp {
246
- /** The timestamp at which the hardfork is activated */
247
- timestamp: bigint
248
- }
249
- /** Controls the gas estimation strategy used by `eth_estimateGas`. */
250
- export enum GasEstimationMode {
251
- /** Estimates the minimum gas required for the top-level call to succeed. */
252
- TopLevelSuccess = 0,
253
- /**
254
- * Estimates the minimum gas required for the top-level call to succeed
255
- * without any internal sub-call running out of gas.
256
- */
257
- NoInternalOutOfGas = 1
258
- }
259
- /**The type of ordering to use when selecting blocks to mine. */
260
- export enum MineOrdering {
261
- /**Insertion order */
262
- Fifo = 'Fifo',
263
- /**Effective miner fee */
264
- Priority = 'Priority'
265
- }
266
- /** Configuration for the provider's mempool. */
267
- export interface MemPoolConfig {
268
- order: MineOrdering
269
- }
270
- export interface IntervalRange {
271
- min: bigint
272
- max: bigint
273
- }
274
- /** Configuration for the provider's miner. */
275
- export interface MiningConfig {
276
- autoMine: boolean
277
- /**
278
- * The block gas limit to use for mining a block.
279
- *
280
- * When not set, enforcement of the block gas limit is disabled in the mem
281
- * pool, miner, and REVM.
282
- */
283
- blockGasLimit?: bigint
284
- interval?: bigint | IntervalRange
285
- memPool: MemPoolConfig
286
- }
287
- /** Configuration for a locally mined blockchain. */
288
- export interface LocalConfig {
460
+ bytecode?: string
461
+ /** The link references of the deployment bytecode. */
462
+ linkReferences?: Record<string, Record<string, Array<LinkReference>>>
289
463
  /**
290
- * The blob gas used for the genesis block, introduced in [EIP-4844].
291
- *
292
- * [EIP-4844]: https://eips.ethereum.org/EIPS/eip-4844
464
+ * Contract runtime code as hex string. It can be missing if the contract
465
+ * is ABI only.
293
466
  */
294
- genesisBlobGas?: BlobGas
295
- /** The block gas limit of the genesis block. */
296
- genesisBlockGasLimit: bigint
297
- /** The date, in seconds since the Unix epoch, of the genesis block. */
298
- genesisBlockTime?: bigint
467
+ deployedBytecode?: string
468
+ /** The link references of the deployed bytecode. */
469
+ deployedLinkReferences?: Record<string, Record<string, Array<LinkReference>>>
299
470
  }
300
- /** Configuration for runtime observability. */
301
- export interface ObservabilityConfig {
302
- /** If present, configures runtime observability to collect code coverage. */
303
- codeCoverage?: CodeCoverageConfig
304
- /** If present, configures runtime observability to collect gas reports. */
305
- gasReport?: GasReportConfig
306
- /**
307
- * Controls when to include call traces in the results of transaction
308
- * execution.
309
- *
310
- * Defaults to `IncludeTraces.None`.
311
- */
312
- includeCallTraces?: IncludeTraces
471
+
472
+ export declare enum ContractFunctionType {
473
+ CONSTRUCTOR = 0,
474
+ FUNCTION = 1,
475
+ FALLBACK = 2,
476
+ RECEIVE = 3,
477
+ GETTER = 4,
478
+ MODIFIER = 5,
479
+ FREE_FUNCTION = 6
313
480
  }
314
- /** Configuration for a provider */
315
- export interface ProviderConfig {
316
- /** Whether to allow blocks with the same timestamp */
317
- allowBlocksWithSameTimestamp: boolean
318
- /** Whether to allow unlimited contract size */
319
- allowUnlimitedContractSize: boolean
320
- /** Whether to return an `Err` when `eth_call` fails */
321
- bailOnCallFailure: boolean
322
- /** Whether to return an `Err` when a `eth_sendTransaction` fails */
323
- bailOnTransactionFailure: boolean
324
- /**
325
- * EIP-1559 base fee parameters activations to be used to calculate the
326
- * block base fee.
327
- *
328
- * Provide an ordered list of `base_fee_params` to be
329
- * used starting from the specified activation point (hardfork or block
330
- * number).
331
- * If not provided, the default values from the chain spec
332
- * will be used.
333
- */
334
- baseFeeConfig?: Array<BaseFeeParamActivation>
335
- /** The chain ID of the blockchain */
336
- chainId: bigint
337
- /** The address of the coinbase */
338
- coinbase: Uint8Array
339
- /**
340
- * The default transaction gas limit to use for RPC call and transaction
341
- * requests that do not specify a `gas` value.
342
- */
343
- defaultTransactionGasLimit: bigint
344
- /**
345
- * The gas estimation mode to use for `eth_estimateGas`. Defaults to
346
- * `GasEstimationMode::TopLevelSuccess` if not set.
347
- */
348
- gasEstimationMode?: GasEstimationMode
349
- /** The genesis state of the blockchain */
350
- genesisState: Array<AccountOverride>
351
- /** The hardfork of the blockchain */
352
- hardfork: string
353
- /**
354
- * The initial base fee per gas of the blockchain. Required for EIP-1559
355
- * transactions and later
356
- */
357
- initialBaseFeePerGas?: bigint
358
- /**
359
- * The initial parent beacon block root of the blockchain. Required for
360
- * EIP-4788
361
- */
362
- initialParentBeaconBlockRoot?: Uint8Array
363
- /** The minimum gas price of the next block. */
364
- minGasPrice: bigint
365
- /** The configuration for the miner */
366
- mining: MiningConfig
367
- /** The network configuration for the provider. */
368
- network: ForkConfig | LocalConfig
369
- /** The network ID of the blockchain */
370
- networkId: bigint
371
- /** The configuration for the provider's observability */
372
- observability: ObservabilityConfig
373
- /** Secret keys of owned accounts */
374
- ownedAccounts: Array<string>
375
- /** Overrides for precompiles */
376
- precompileOverrides: Array<Precompile>
377
- /**
378
- * Transaction gas cap, introduced in [EIP-7825].
379
- *
380
- * Integer values should be larger than zero.
381
- *
382
- * When `false`, enforcement of the transaction gas cap is disabled and
383
- * transactions with any `gas` value are accepted by the mempool and
384
- * executed without REVM's transaction gas cap check.
385
- *
386
- * When not set, a hardfork-specific default value will be used.
387
- *
388
- * [EIP-7825]: https://eips.ethereum.org/EIPS/eip-7825
389
- */
390
- transactionGasCap?: bigint | false
481
+
482
+ export interface ContractGasReport {
483
+ deployments: Array<DeploymentGasReport>
484
+ functions: Record<string, Array<FunctionGasReport>>
391
485
  }
392
- /** Tracing config for Solidity stack trace generation. */
393
- export interface TracingConfigWithBuffers {
394
- /**
395
- * Build information to use for decoding contracts. Either a Hardhat v2
396
- * build info file that contains both input and output or a Hardhat v3
397
- * build info file that doesn't contain output and a separate output file.
398
- */
399
- buildInfos?: Array<Uint8Array> | Array<BuildInfoAndOutput>
400
- /** Whether to ignore contracts whose name starts with "Ignored". */
401
- ignoreContracts?: boolean
486
+
487
+ export interface ContractTooLargeErrorStackTraceEntry {
488
+ type: StackTraceEntryType.CONTRACT_TOO_LARGE_ERROR
489
+ sourceReference?: SourceReference
402
490
  }
491
+
403
492
  /**
404
- * Hardhat V3 build info where the compiler output is not part of the build
405
- * info file.
493
+ * Original sequence size and sequence of calls used as a counter example
494
+ * for invariant tests.
406
495
  */
407
- export interface BuildInfoAndOutput {
408
- /** The build info input file */
409
- buildInfo: Uint8Array
410
- /** The build info output file */
411
- output: Uint8Array
496
+ export interface CounterExampleSequence {
497
+ /** The original sequence size before shrinking. */
498
+ originalSequenceSize: bigint
499
+ /** The shrunk counterexample sequence. */
500
+ sequence: Array<BaseCounterExample>
412
501
  }
413
- export interface DebugTraceResult {
414
- pass: boolean
415
- gasUsed: bigint
416
- output?: Uint8Array
417
- structLogs: Array<DebugTraceLogItem>
502
+
503
+ /** The instrumentation coverage library file name. */
504
+ export const COVERAGE_LIBRARY_FILE_NAME: string
505
+
506
+ export interface CreateOutput {
507
+ /** Return value */
508
+ returnValue: Uint8Array
509
+ /** Optionally, a 160-bit address */
510
+ address?: Uint8Array
511
+ }
512
+
513
+ export interface CustomErrorStackTraceEntry {
514
+ type: StackTraceEntryType.CUSTOM_ERROR
515
+ message: string
516
+ sourceReference: SourceReference
418
517
  }
518
+
519
+ export const DAO_FORK: string
520
+
419
521
  export interface DebugTraceLogItem {
420
522
  /** Program Counter */
421
523
  pc: bigint
@@ -439,136 +541,44 @@ export interface DebugTraceLogItem {
439
541
  /** Map of all stored values with keys and values encoded as hex strings. */
440
542
  storage?: Record<string, string>
441
543
  }
442
- export interface GasReport {
443
- contracts: Record<string, ContractGasReport>
444
- }
445
- export interface ContractGasReport {
446
- deployments: Array<DeploymentGasReport>
447
- functions: Record<string, Array<FunctionGasReport>>
544
+
545
+ export interface DebugTraceResult {
546
+ pass: boolean
547
+ gasUsed: bigint
548
+ output?: Uint8Array
549
+ structLogs: Array<DebugTraceLogItem>
448
550
  }
449
- export enum GasReportExecutionStatus {
450
- Success = 0,
451
- Revert = 1,
452
- Halt = 2
551
+
552
+ /** Decoded function call or event. */
553
+ export interface DecodedTraceParameters {
554
+ /** The name of a function or an event. */
555
+ name: string
556
+ /**
557
+ * The arguments of the function call or the event, in their human-readable
558
+ * representations.
559
+ */
560
+ arguments: Array<string>
453
561
  }
562
+
454
563
  export interface DeploymentGasReport {
455
564
  gas: bigint
456
565
  size: bigint
457
566
  runtimeSize: bigint
458
567
  status: GasReportExecutionStatus
459
568
  }
460
- export interface FunctionGasReport {
461
- gas: bigint
462
- status: GasReportExecutionStatus
463
- /**
464
- * The proxy delegation chain for this call, if the called contract is a
465
- * proxy. Contains contract identifiers from outermost proxy to final
466
- * implementation, e.g. `["Proxy", "Implementation"]`.
467
- * Empty if the call is not through a proxy.
468
- */
469
- proxyChain: Array<string>
470
- }
471
- export interface InstrumentationResult {
472
- /** The generated source code with coverage instrumentation. */
473
- readonly source: string
474
- /** The metadata for each instrumented code segment. */
475
- readonly metadata: Array<InstrumentationMetadata>
476
- }
477
- export interface InstrumentationMetadata {
478
- /**
479
- * The tag that identifies the instrumented code. Tags are
480
- * deterministically generated from the source code, source id, and
481
- * Solidity version.
482
- */
483
- readonly tag: Uint8Array
484
- /**
485
- * The kind of instrumented code. Currently, the only supported kind
486
- * is "statement".
487
- */
488
- readonly kind: string
489
- /**
490
- * The starting position of the instrumented code - including trivia such
491
- * as whitespace - in the source code, in UTF-16 code units.
492
- */
493
- readonly startUtf16: number
494
- /**
495
- * The ending position of the instrumented code - including trivia such as
496
- * whitespace - in the source code, in UTF-16 code units.
497
- */
498
- readonly endUtf16: number
499
- }
500
- /** The instrumentation coverage library file name. */
501
- export const COVERAGE_LIBRARY_FILE_NAME: string
502
- /**
503
- * Adds per-statement coverage instrumentation to the given Solidity source
504
- * code.
505
- */
506
- export declare function addStatementCoverageInstrumentation(sourceCode: string, sourceId: string, solidityVersion: string): InstrumentationResult
507
- /** Retrieves the latest version of `Solidity` supported for instrumentation. */
508
- export declare function latestSupportedSolidityVersion(): string
509
- /** Ethereum execution log. */
510
- export interface ExecutionLog {
511
- address: Uint8Array
512
- topics: Array<Uint8Array>
513
- data: Uint8Array
514
- }
515
- export interface LoggerConfig {
516
- /** Whether to enable the logger. */
517
- enable: boolean
518
- decodeConsoleLogInputsCallback: (inputs: ArrayBuffer[]) => string[]
519
- printLineCallback: (message: string, replace: boolean) => void
520
- }
521
- /**
522
- * [RIP-7212](https://github.com/ethereum/RIPs/blob/master/RIPS/rip-7212.md#specification)
523
- * secp256r1 precompile.
524
- */
525
- export declare function precompileP256Verify(): Precompile
526
- /** The possible reasons for successful termination of the EVM. */
527
- export enum SuccessReason {
528
- /** The opcode `STOP` was called */
529
- Stop = 0,
530
- /** The opcode `RETURN` was called */
531
- Return = 1,
532
- /** The opcode `SELFDESTRUCT` was called */
533
- SelfDestruct = 2
534
- }
535
- export interface CallOutput {
536
- /** Return value */
537
- returnValue: Uint8Array
538
- }
539
- export interface CreateOutput {
540
- /** Return value */
541
- returnValue: Uint8Array
542
- /** Optionally, a 160-bit address */
543
- address?: Uint8Array
544
- }
545
- /** The result when the EVM terminates successfully. */
546
- export interface SuccessResult {
547
- /** The reason for termination */
548
- reason: SuccessReason
549
- /** The amount of gas used */
550
- gasUsed: bigint
551
- /** The amount of gas refunded */
552
- gasRefunded: bigint
553
- /** The logs */
554
- logs: Array<ExecutionLog>
555
- /** The transaction output */
556
- output: CallOutput | CreateOutput
557
- }
558
- /** The result when the EVM terminates due to a revert. */
559
- export interface RevertResult {
560
- /** The amount of gas used */
561
- gasUsed: bigint
562
- /** The logs */
563
- logs: Array<ExecutionLog>
564
- /** The transaction output */
565
- output: Uint8Array
569
+
570
+ export interface DirectLibraryCallErrorStackTraceEntry {
571
+ type: StackTraceEntryType.DIRECT_LIBRARY_CALL_ERROR
572
+ sourceReference: SourceReference
566
573
  }
574
+
575
+ export const ECOTONE: string
576
+
567
577
  /**
568
578
  * Indicates that the EVM has experienced an exceptional halt. This causes
569
579
  * execution to immediately end with all gas being consumed.
570
580
  */
571
- export enum ExceptionalHalt {
581
+ export declare enum ExceptionalHalt {
572
582
  OutOfGas = 0,
573
583
  OpcodeNotFound = 1,
574
584
  InvalidFEOpcode = 2,
@@ -587,18 +597,14 @@ export enum ExceptionalHalt {
587
597
  /** EIP-3860: Limit and meter initcode. Initcode size limit exceeded. */
588
598
  CreateInitCodeSizeLimit = 13
589
599
  }
590
- /** The result when the EVM terminates due to an exceptional halt. */
591
- export interface HaltResult {
592
- /** The exceptional halt that occurred */
593
- reason: ExceptionalHalt
594
- /**
595
- * Halting will spend all the gas and will thus be equal to the specified
596
- * gas limit
597
- */
598
- gasUsed: bigint
599
- /** The logs */
600
- logs: Array<ExecutionLog>
600
+
601
+ /** Ethereum execution log. */
602
+ export interface ExecutionLog {
603
+ address: Uint8Array
604
+ topics: Array<Uint8Array>
605
+ data: Uint8Array
601
606
  }
607
+
602
608
  /** The result of executing a transaction. */
603
609
  export interface ExecutionResult {
604
610
  /** The transaction result */
@@ -606,289 +612,125 @@ export interface ExecutionResult {
606
612
  /** Optional contract address if the transaction created a new contract. */
607
613
  contractAddress?: Uint8Array
608
614
  }
609
- /** A compilation artifact. */
610
- export interface Artifact {
611
- /** The identifier of the artifact. */
612
- id: ArtifactId
613
- /** The test contract. */
614
- contract: ContractData
615
+
616
+ /** Represents the exit code of the EVM. */
617
+ export declare enum ExitCode {
618
+ /** Execution was successful. */
619
+ SUCCESS = 0,
620
+ /** Execution was reverted. */
621
+ REVERT = 1,
622
+ /** Execution ran out of gas. */
623
+ OUT_OF_GAS = 2,
624
+ /** Execution encountered an internal error. */
625
+ INTERNAL_ERROR = 3,
626
+ /** Execution encountered an invalid opcode. */
627
+ INVALID_OPCODE = 4,
628
+ /** Execution encountered a stack underflow. */
629
+ STACK_UNDERFLOW = 5,
630
+ /** Create init code size exceeds limit (runtime). */
631
+ CODESIZE_EXCEEDS_MAXIMUM = 6,
632
+ /** Create collision. */
633
+ CREATE_COLLISION = 7,
634
+ /** Unknown halt reason. */
635
+ UNKNOWN_HALT_REASON = 8
615
636
  }
616
- /** The identifier of a Solidity contract. */
617
- export interface ArtifactId {
618
- /** The name of the contract. */
619
- name: string
620
- /** Original source file path. */
621
- source: string
622
- /** The solc semver string. */
623
- solcVersion: string
637
+
638
+ export const FALLBACK_FUNCTION_NAME: string
639
+
640
+ export interface FallbackNotPayableAndNoReceiveErrorStackTraceEntry {
641
+ type: StackTraceEntryType.FALLBACK_NOT_PAYABLE_AND_NO_RECEIVE_ERROR
642
+ value: bigint
643
+ sourceReference: SourceReference
624
644
  }
625
- /** A test contract to execute. */
626
- export interface ContractData {
627
- /** Contract ABI as json string. */
628
- abi: string
645
+
646
+ export interface FallbackNotPayableErrorStackTraceEntry {
647
+ type: StackTraceEntryType.FALLBACK_NOT_PAYABLE_ERROR
648
+ value: bigint
649
+ sourceReference: SourceReference
650
+ }
651
+
652
+ export const FJORD: string
653
+
654
+ /** Configuration for forking a blockchain */
655
+ export interface ForkConfig {
629
656
  /**
630
- * Contract creation code as hex string. It can be missing if the contract
631
- * is ABI only.
657
+ * The block number to fork from. If not provided, the latest safe block is
658
+ * used.
632
659
  */
633
- bytecode?: string
634
- /** The link references of the deployment bytecode. */
635
- linkReferences?: Record<string, Record<string, Array<LinkReference>>>
660
+ blockNumber?: bigint
661
+ /** The directory to cache remote JSON-RPC responses */
662
+ cacheDir?: string
663
+ /** Overrides for the configuration of chains. */
664
+ chainOverrides?: Array<ChainOverride>
665
+ /** The HTTP headers to use when making requests to the JSON-RPC endpoint */
666
+ httpHeaders?: Array<HttpHeader>
667
+ /** The URL of the JSON-RPC endpoint to fork from */
668
+ url: string
669
+ }
670
+
671
+ export const FRONTIER: string
672
+
673
+ export const FRONTIER_THAWING: string
674
+
675
+ /** * Determines the level of file system access for the given path.
676
+ *
677
+ * Exact path matching is used for file permissions. Prefix matching is used
678
+ * for directory permissions.
679
+ *
680
+ * Giving write access to configuration files, source files or executables
681
+ * in a project is considered dangerous, because it can be used by malicious
682
+ * Solidity dependencies to escape the EVM sandbox. It is therefore
683
+ * recommended to give write access to specific safe files only. If write
684
+ * access to a directory is needed, please make sure that it doesn't contain
685
+ * configuration files, source files or executables neither in the top level
686
+ * directory, nor in any subdirectories.
687
+ */
688
+ export declare enum FsAccessPermission {
689
+ /** Allows reading and writing the file */
690
+ ReadWriteFile = 0,
691
+ /** Only allows reading the file */
692
+ ReadFile = 1,
693
+ /** Only allows writing the file */
694
+ WriteFile = 2,
636
695
  /**
637
- * Contract runtime code as hex string. It can be missing if the contract
638
- * is ABI only.
696
+ * Allows reading and writing all files in the directory and its
697
+ * subdirectories
639
698
  */
640
- deployedBytecode?: string
641
- /** The link references of the deployed bytecode. */
642
- deployedLinkReferences?: Record<string, Record<string, Array<LinkReference>>>
643
- }
644
- export interface LinkReference {
645
- start: number
646
- length: number
647
- }
648
- /**Error codes that can be returned by cheatcodes in Solidity tests. */
649
- export enum CheatcodeErrorCode {
650
- /**The specified cheatcode is not supported. */
651
- UnsupportedCheatcode = 'UnsupportedCheatcode',
652
- /**The specified cheatcode is missing. */
653
- MissingCheatcode = 'MissingCheatcode'
654
- }
655
- /**Error returned by a cheatcode in Solidity tests. */
656
- export interface CheatcodeErrorDetails {
657
- /**The error code representing the type of cheatcode error. */
658
- code: CheatcodeErrorCode
659
- /**The name of the cheatcode that caused the error. */
660
- cheatcode: string
699
+ DangerouslyReadWriteDirectory = 3,
700
+ /** Allows reading all files in the directory and its subdirectories */
701
+ ReadDirectory = 4,
702
+ /** Allows writing all files in the directory and its subdirectories */
703
+ DangerouslyWriteDirectory = 5
661
704
  }
662
- /**
663
- * Solidity test runner configuration arguments exposed through the ffi.
664
- * Docs based on <https://book.getfoundry.sh/reference/config/testing>.
665
- */
666
- export interface SolidityTestRunnerConfigArgs {
705
+
706
+ export interface FunctionGasReport {
707
+ gas: bigint
708
+ status: GasReportExecutionStatus
667
709
  /**
668
- * The absolute path to the project root directory.
669
- * Relative paths in cheat codes are resolved against this path.
710
+ * The proxy delegation chain for this call, if the called contract is a
711
+ * proxy. Contains contract identifiers from outermost proxy to final
712
+ * implementation, e.g. `["Proxy", "Implementation"]`.
713
+ * Empty if the call is not through a proxy.
670
714
  */
671
- projectRoot: string
672
- /** Configures the permissions of cheat codes that access the file system. */
673
- fsPermissions?: Array<PathPermission>
674
- /** Address labels for traces. Defaults to none. */
675
- labels?: Array<AddressLabel>
676
- /**
677
- * Whether to enable isolation of calls. In isolation mode all top-level
678
- * calls are executed as a separate transaction in a separate EVM
679
- * context, enabling more precise gas accounting and transaction state
680
- * changes.
681
- * Defaults to false.
682
- */
683
- isolate?: boolean
684
- /**
685
- * Whether or not to enable the ffi cheatcode.
686
- * Warning: Enabling this cheatcode has security implications, as it allows
687
- * tests to execute arbitrary programs on your computer.
688
- * Defaults to false.
689
- */
690
- ffi?: boolean
691
- /**
692
- * Allow expecting reverts with `expectRevert` at the same callstack depth
693
- * as the test. Defaults to false.
694
- */
695
- allowInternalExpectRevert?: boolean
696
- /**
697
- * The value of `msg.sender` in tests as hex string.
698
- * Defaults to `0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38`.
699
- */
700
- sender?: Uint8Array
701
- /**
702
- * The value of `tx.origin` in tests as hex string.
703
- * Defaults to `0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38`.
704
- */
705
- txOrigin?: Uint8Array
706
- /**
707
- * The initial balance of the sender in tests.
708
- * Defaults to `0xffffffffffffffffffffffff`.
709
- */
710
- initialBalance?: bigint
711
- /**
712
- * The value of `block.number` in tests.
713
- * Defaults to `1`.
714
- */
715
- blockNumber?: bigint
716
- /**
717
- * The value of the `chainid` opcode in tests.
718
- * Defaults to `31337`.
719
- */
720
- chainId?: bigint
721
- /** The hardfork to use for EVM execution. */
722
- hardfork: string
723
- /**
724
- * The gas limit for each test case.
725
- * Defaults to `9_223_372_036_854_775_807` (`i64::MAX`).
726
- */
727
- gasLimit?: bigint
728
- /**
729
- * The price of gas (in wei) in tests.
730
- * Defaults to `0`.
731
- */
732
- gasPrice?: bigint
733
- /**
734
- * The base fee per gas (in wei) in tests.
735
- * Defaults to `0`.
736
- */
737
- blockBaseFeePerGas?: bigint
738
- /**
739
- * The value of `block.coinbase` in tests.
740
- * Defaults to `0x0000000000000000000000000000000000000000`.
741
- */
742
- blockCoinbase?: Uint8Array
743
- /**
744
- * The value of `block.timestamp` in tests.
745
- * Defaults to 1.
746
- */
747
- blockTimestamp?: bigint
748
- /**
749
- * The value of `block.difficulty` in tests.
750
- * Defaults to 0.
751
- */
752
- blockDifficulty?: bigint
753
- /**
754
- * The `block.gaslimit` value during EVM execution.
755
- * Defaults to none.
756
- */
757
- blockGasLimit?: bigint
758
- /**
759
- * Whether to disable the block gas limit.
760
- * Defaults to false.
761
- */
762
- disableBlockGasLimit?: boolean
763
- /**
764
- * Transaction gas cap, introduced in [EIP-7825].
765
- *
766
- * When not set, defaults to the value defined by the used hardfork.
767
- *
768
- * [EIP-7825]: https://eips.ethereum.org/EIPS/eip-7825
769
- */
770
- transactionGasCap?: bigint
771
- /**
772
- * Whether to disable the [EIP-7825] transaction gas cap.
773
- * Defaults to false.
774
- *
775
- * [EIP-7825]: https://eips.ethereum.org/EIPS/eip-7825
776
- */
777
- disableTransactionGasCap?: boolean
778
- /**
779
- * The memory limit of the EVM in bytes.
780
- * Defaults to `33_554_432` (2^25 = 32MiB).
781
- */
782
- memoryLimit?: bigint
783
- /**
784
- * The predeploys applied in local mode. Defaults to no predeploys.
785
- * These should match the predeploys of the network in fork mode, so they
786
- * aren't set in fork mode.
787
- * The code must be set and non-empty. The nonce and the balance default to
788
- * zero and storage defaults to empty.
789
- */
790
- localPredeploys?: Array<AccountOverride>
791
- /**
792
- * If set, all tests are run in fork mode using this url or remote name.
793
- * Defaults to none.
794
- */
795
- ethRpcUrl?: string
796
- /** Pins the block number for the global state fork. */
797
- forkBlockNumber?: bigint
798
- /**
799
- * Map of RPC endpoints from chain name to RPC urls for fork cheat codes,
800
- * e.g. `{ "optimism": "https://optimism.alchemyapi.io/v2/..." }`
801
- */
802
- rpcEndpoints?: Record<string, string>
803
- /**
804
- * Optional RPC cache path. If this is none, then no RPC calls will be
805
- * cached, otherwise data is cached to `<rpc_cache_path>/<chain
806
- * id>/<block number>`. Caching can be disabled for specific chains
807
- * with `rpc_storage_caching`.
808
- */
809
- rpcCachePath?: string
810
- /** What RPC endpoints are cached. Defaults to all. */
811
- rpcStorageCaching?: StorageCachingConfig
812
- /**
813
- * The number of seconds to wait before `vm.prompt` reverts with a timeout.
814
- * Defaults to 120.
815
- */
816
- promptTimeout?: number
817
- /** Fuzz testing configuration. */
818
- fuzz?: FuzzConfigArgs
819
- /**
820
- * Invariant testing configuration.
821
- * If an invariant config setting is not set, but a corresponding fuzz
822
- * config value is set, then the fuzz config value will be used.
823
- */
824
- invariant?: InvariantConfigArgs
825
- /** Whether to collect stack traces. */
826
- collectStackTraces?: CollectStackTraces
827
- /**
828
- * Controls which test results should include execution traces. Defaults to
829
- * None.
830
- */
831
- includeTraces?: IncludeTraces
832
- /** The configuration for the Solidity test runner's observability */
833
- observability?: ObservabilityConfig
834
- /**
835
- * A regex pattern to filter tests. If provided, only test methods that
836
- * match the pattern will be executed and reported as a test result.
837
- */
838
- testPattern?: string
839
- /**
840
- * A regex pattern to exclude tests. If provided, test methods that match
841
- * the pattern will not be executed or reported as a test result. Applied
842
- * after `test_pattern`.
843
- */
844
- excludeTestPattern?: string
845
- /**
846
- * Controls whether to generate a gas report after running the tests.
847
- * Enabling this also enables collection of all traces and EVM isolation
848
- * mode.
849
- * Defaults to false.
850
- */
851
- generateGasReport?: boolean
852
- /**
853
- * Test function level config overrides.
854
- * Defaults to none.
855
- */
856
- testFunctionOverrides?: Array<TestFunctionOverride>
857
- /**
858
- * A list of EIP-712 canonical type definitions that can be referenced by
859
- * type name in the `eip712HashType` and `eip712HashStruct` cheatcodes.
860
- *
861
- * Each entry is an independent, self-contained type definition. A
862
- * definition that references nested struct types must inline those
863
- * struct definitions, per the EIP-712 `encodeType` spec.
864
- *
865
- * Only the primary (leftmost) type of each entry is registered by name.
866
- * Nested struct types referenced inside an entry are *not* registered
867
- * under their own names. To look up a nested struct by name from a
868
- * cheatcode, add it as a separate top-level entry whose primary type
869
- * is the nested struct.
870
- *
871
- * The type of a struct is encoded as:
872
- *
873
- * `name ‖ "(" ‖ member₁ ‖ "," ‖ member₂ ‖ "," ‖ … ‖ memberₙ ")"`
874
- *
875
- * where each member is written as `type ‖ " " ‖ name`.
876
- *
877
- * Entries that fail to parse cause a startup error listing every bad
878
- * entry.
879
- *
880
- * Example — to make both `Mail` and `Person` reachable by name:
881
- *
882
- * ```text
883
- * "Mail(Person from,Person to,string contents)Person(address wallet,string name)"
884
- * "Person(address wallet,string name)"
885
- * ```
886
- *
887
- * With *only* the first entry, `vm.eip712HashType("Mail")` works but
888
- * `vm.eip712HashType("Person")` fails with an unknown-type error.
889
- */
890
- eip712CanonicalTypes?: Array<string>
715
+ proxyChain: Array<string>
716
+ }
717
+
718
+ export interface FunctionNotPayableErrorStackTraceEntry {
719
+ type: StackTraceEntryType.FUNCTION_NOT_PAYABLE_ERROR
720
+ value: bigint
721
+ sourceReference: SourceReference
722
+ }
723
+
724
+ /** See [`edr_solidity_tests::fuzz::FuzzCase`] */
725
+ export interface FuzzCase {
726
+ /** The calldata used for this fuzz test */
727
+ readonly calldata: Uint8Array
728
+ /** Consumed gas */
729
+ readonly gas: bigint
730
+ /** The initial gas stipend for the transaction */
731
+ readonly stipend: bigint
891
732
  }
733
+
892
734
  /** Fuzz testing configuration */
893
735
  export interface FuzzConfigArgs {
894
736
  /** Path where fuzz failures are recorded and replayed if set. */
@@ -944,22 +786,207 @@ export interface FuzzConfigArgs {
944
786
  */
945
787
  timeout?: number
946
788
  }
947
- /** Invariant testing configuration. */
948
- export interface InvariantConfigArgs {
949
- /** Path where invariant failures are recorded and replayed if set. */
950
- failurePersistDir?: string
951
- /**
952
- * The number of runs that must execute for each invariant test group.
953
- * Defaults to 256.
954
- */
789
+
790
+ /** Test function or test contract level fuzz config override. */
791
+ export interface FuzzConfigOverride {
792
+ /** The number of test cases that must execute for each property test. */
955
793
  runs?: number
956
794
  /**
957
- * The number of calls executed to attempt to break invariants in one run.
958
- * Defaults to 500.
959
- */
960
- depth?: number
961
- /**
962
- * Fails the invariant fuzzing if a revert occurs.
795
+ * The maximum number of test case rejections allowed by proptest, to be
796
+ * encountered during usage of `vm.assume` cheatcode. This will be used
797
+ * to set the `max_global_rejects` value in proptest test runner config.
798
+ * `max_local_rejects` option isn't exposed here since we're not using
799
+ * `prop_filter`.
800
+ */
801
+ maxTestRejects?: number
802
+ /** show `console.log` in fuzz test, defaults to `false`. */
803
+ showLogs?: boolean
804
+ /** Optional timeout (in seconds) for each property test. */
805
+ timeout?: TimeoutConfig
806
+ }
807
+
808
+ /** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
809
+ export interface FuzzTestKind {
810
+ /** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
811
+ readonly runs: bigint
812
+ /** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
813
+ readonly meanGas: bigint
814
+ /** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
815
+ readonly medianGas: bigint
816
+ }
817
+
818
+ /** Controls the gas estimation strategy used by `eth_estimateGas`. */
819
+ export declare enum GasEstimationMode {
820
+ /** Estimates the minimum gas required for the top-level call to succeed. */
821
+ TopLevelSuccess = 0,
822
+ /**
823
+ * Estimates the minimum gas required for the top-level call to succeed
824
+ * without any internal sub-call running out of gas.
825
+ */
826
+ NoInternalOutOfGas = 1
827
+ }
828
+
829
+ export interface GasReport {
830
+ contracts: Record<string, ContractGasReport>
831
+ }
832
+
833
+ /** Configuration for gas report collection. */
834
+ export interface GasReportConfig {
835
+ /**
836
+ * Gas reports are collected after a block is mined or `eth_call` is
837
+ * executed.
838
+ *
839
+ * Exceptions thrown in the callback will be propagated to the original
840
+ * caller.
841
+ */
842
+ onCollectedGasReportCallback: (gasReport: GasReport) => Promise<void>
843
+ }
844
+
845
+ export declare enum GasReportExecutionStatus {
846
+ Success = 0,
847
+ Revert = 1,
848
+ Halt = 2
849
+ }
850
+
851
+ export const GENERIC_CHAIN_TYPE: string
852
+
853
+ export declare function genericChainProviderFactory(): ProviderFactory
854
+
855
+ export const GRANITE: string
856
+
857
+ export const GRAY_GLACIER: string
858
+
859
+ /** The result when the EVM terminates due to an exceptional halt. */
860
+ export interface HaltResult {
861
+ /** The exceptional halt that occurred */
862
+ reason: ExceptionalHalt
863
+ /**
864
+ * Halting will spend all the gas and will thus be equal to the specified
865
+ * gas limit
866
+ */
867
+ gasUsed: bigint
868
+ /** The logs */
869
+ logs: Array<ExecutionLog>
870
+ }
871
+
872
+ /** Configuration for a hardfork activation */
873
+ export interface HardforkActivation {
874
+ /** The condition for the hardfork activation */
875
+ condition: HardforkActivationByBlockNumber | HardforkActivationByTimestamp
876
+ /** The activated hardfork */
877
+ hardfork: string
878
+ }
879
+
880
+ export interface HardforkActivationByBlockNumber {
881
+ /** The block number at which the hardfork is activated */
882
+ blockNumber: bigint
883
+ }
884
+
885
+ export interface HardforkActivationByTimestamp {
886
+ /** The timestamp at which the hardfork is activated */
887
+ timestamp: bigint
888
+ }
889
+
890
+ /**
891
+ * We couldn't generate stack traces, because the stack trace generation
892
+ * heuristics failed due to an unknown reason.
893
+ */
894
+ export interface HeuristicFailed {
895
+ /** Enum tag for JS. */
896
+ kind: "HeuristicFailed"
897
+ }
898
+
899
+ export const HOLOCENE: string
900
+
901
+ export const HOMESTEAD: string
902
+
903
+ export interface HttpHeader {
904
+ name: string
905
+ value: string
906
+ }
907
+
908
+ /**
909
+ * Configuration that controls whether execution traces are decoded and
910
+ * included in results.
911
+ *
912
+ * This can either be for Solidity test results or provider transaction
913
+ * execution results.
914
+ */
915
+ export declare enum IncludeTraces {
916
+ /** No traces will be included at all. */
917
+ None = 0,
918
+ /**
919
+ * Traces will be included only on the results of failed tests or
920
+ * execution.
921
+ */
922
+ Failing = 1,
923
+ /** Traces will be included for all test results or executed transactions. */
924
+ All = 2
925
+ }
926
+
927
+ export interface InstrumentationMetadata {
928
+ /**
929
+ * The tag that identifies the instrumented code. Tags are
930
+ * deterministically generated from the source code, source id, and
931
+ * Solidity version.
932
+ */
933
+ readonly tag: Uint8Array
934
+ /**
935
+ * The kind of instrumented code. Currently, the only supported kind
936
+ * is "statement".
937
+ */
938
+ readonly kind: string
939
+ /**
940
+ * The starting position of the instrumented code - including trivia such
941
+ * as whitespace - in the source code, in UTF-16 code units.
942
+ */
943
+ readonly startUtf16: number
944
+ /**
945
+ * The ending position of the instrumented code - including trivia such as
946
+ * whitespace - in the source code, in UTF-16 code units.
947
+ */
948
+ readonly endUtf16: number
949
+ }
950
+
951
+ export interface InstrumentationResult {
952
+ /** The generated source code with coverage instrumentation. */
953
+ readonly source: string
954
+ /** The metadata for each instrumented code segment. */
955
+ readonly metadata: Array<InstrumentationMetadata>
956
+ }
957
+
958
+ export interface InternalFunctionCallStackEntry {
959
+ type: StackTraceEntryType.INTERNAL_FUNCTION_CALLSTACK_ENTRY
960
+ pc: number
961
+ sourceReference: SourceReference
962
+ }
963
+
964
+ export interface IntervalRange {
965
+ min: bigint
966
+ max: bigint
967
+ }
968
+
969
+ export interface InvalidParamsErrorStackTraceEntry {
970
+ type: StackTraceEntryType.INVALID_PARAMS_ERROR
971
+ sourceReference: SourceReference
972
+ }
973
+
974
+ /** Invariant testing configuration. */
975
+ export interface InvariantConfigArgs {
976
+ /** Path where invariant failures are recorded and replayed if set. */
977
+ failurePersistDir?: string
978
+ /**
979
+ * The number of runs that must execute for each invariant test group.
980
+ * Defaults to 256.
981
+ */
982
+ runs?: number
983
+ /**
984
+ * The number of calls executed to attempt to break invariants in one run.
985
+ * Defaults to 500.
986
+ */
987
+ depth?: number
988
+ /**
989
+ * Fails the invariant fuzzing if a revert occurs.
963
990
  * Defaults to false.
964
991
  */
965
992
  failOnRevert?: boolean
@@ -1005,454 +1032,678 @@ export interface InvariantConfigArgs {
1005
1032
  */
1006
1033
  timeout?: number
1007
1034
  }
1008
- /** Settings to configure caching of remote RPC endpoints. */
1009
- export interface StorageCachingConfig {
1035
+
1036
+ /** Test function or test contract level invariant config override. */
1037
+ export interface InvariantConfigOverride {
1038
+ /** The number of runs that must execute for each invariant test group. */
1039
+ runs?: number
1040
+ /** The number of calls executed to attempt to break invariants in one run. */
1041
+ depth?: number
1042
+ /** Fails the invariant fuzzing if a revert occurs. */
1043
+ failOnRevert?: boolean
1010
1044
  /**
1011
- * Chains to cache. Either all or none or a list of chain names, e.g.
1012
- * ["optimism", "mainnet"].
1045
+ * Allows overriding an unsafe external call when running invariant tests.
1046
+ * eg. reentrancy checks
1013
1047
  */
1014
- chains: CachedChains | Array<string>
1015
- /** Endpoints to cache. Either all or remote or a regex. */
1016
- endpoints: CachedEndpoints | string
1017
- }
1018
- /** What chains to cache */
1019
- export enum CachedChains {
1020
- /** Cache all chains */
1021
- All = 0,
1022
- /** Don't cache anything */
1023
- None = 1
1048
+ callOverride?: boolean
1049
+ /** Optional timeout (in seconds) for each invariant test. */
1050
+ timeout?: TimeoutConfig
1024
1051
  }
1025
- /** What endpoints to enable caching for */
1026
- export enum CachedEndpoints {
1027
- /** Cache all endpoints */
1028
- All = 0,
1029
- /** Only cache non-local host endpoints */
1030
- Remote = 1
1052
+
1053
+ /** See [`edr_solidity_tests::result::InvariantMetrics`] */
1054
+ export interface InvariantMetrics {
1055
+ readonly calls: bigint
1056
+ readonly reverts: bigint
1057
+ readonly discards: bigint
1031
1058
  }
1032
- /** Represents an access permission to a single path */
1033
- export interface PathPermission {
1034
- /** Permission level to access the `path` */
1035
- access: FsAccessPermission
1036
- /** The targeted path guarded by the permission */
1037
- path: string
1038
- }
1039
- /**
1040
- * Determines the level of file system access for the given path.
1041
- *
1042
- * Exact path matching is used for file permissions. Prefix matching is used
1043
- * for directory permissions.
1044
- *
1045
- * Giving write access to configuration files, source files or executables
1046
- * in a project is considered dangerous, because it can be used by malicious
1047
- * Solidity dependencies to escape the EVM sandbox. It is therefore
1048
- * recommended to give write access to specific safe files only. If write
1049
- * access to a directory is needed, please make sure that it doesn't contain
1050
- * configuration files, source files or executables neither in the top level
1051
- * directory, nor in any subdirectories.
1052
- */
1053
- export enum FsAccessPermission {
1054
- /** Allows reading and writing the file */
1055
- ReadWriteFile = 0,
1056
- /** Only allows reading the file */
1057
- ReadFile = 1,
1058
- /** Only allows writing the file */
1059
- WriteFile = 2,
1060
- /**
1061
- * Allows reading and writing all files in the directory and its
1062
- * subdirectories
1063
- */
1064
- DangerouslyReadWriteDirectory = 3,
1065
- /** Allows reading all files in the directory and its subdirectories */
1066
- ReadDirectory = 4,
1067
- /** Allows writing all files in the directory and its subdirectories */
1068
- DangerouslyWriteDirectory = 5
1069
- }
1070
- export interface AddressLabel {
1071
- /** The address to label */
1072
- address: Uint8Array
1073
- /** The label to assign to the address */
1074
- label: string
1075
- }
1076
- /** A type that controls when stack traces are collected. */
1077
- export enum CollectStackTraces {
1078
- /** Always collects stack traces, adding performance overhead. */
1079
- Always = 0,
1080
- /**
1081
- * Only collects stack traces upon failure, re-executing the test. This
1082
- * minimizes performance overhead.
1083
- *
1084
- * Not all tests can be re-executed since certain cheatcodes contain
1085
- * non-deterministic side-effects.
1086
- */
1087
- OnFailure = 1
1059
+
1060
+ /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
1061
+ export interface InvariantTestKind {
1062
+ /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
1063
+ readonly runs: bigint
1064
+ /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
1065
+ readonly calls: bigint
1066
+ /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
1067
+ readonly reverts: bigint
1068
+ /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
1069
+ readonly metrics: Record<string, InvariantMetrics>
1070
+ /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
1071
+ readonly failedCorpusReplays: bigint
1088
1072
  }
1073
+
1074
+ export const ISTANBUL: string
1075
+
1076
+ export const ISTHMUS: string
1077
+
1078
+ export const L1_CHAIN_TYPE: string
1079
+
1080
+ export declare function l1GenesisState(hardfork: SpecId): Array<AccountOverride>
1081
+
1089
1082
  /**
1090
- * Configuration that controls whether execution traces are decoded and
1091
- * included in results.
1083
+ * Tries to parse the provided string to create a [`SpecId`] instance.
1092
1084
  *
1093
- * This can either be for Solidity test results or provider transaction
1094
- * execution results.
1085
+ * Returns an error if the string does not match any known hardfork.
1095
1086
  */
1096
- export enum IncludeTraces {
1097
- /** No traces will be included at all. */
1098
- None = 0,
1099
- /**
1100
- * Traces will be included only on the results of failed tests or
1101
- * execution.
1102
- */
1103
- Failing = 1,
1104
- /** Traces will be included for all test results or executed transactions. */
1105
- All = 2
1087
+ export declare function l1HardforkFromString(hardfork: string): SpecId
1088
+
1089
+ /**
1090
+ * Returns the latest supported OP hardfork.
1091
+ *
1092
+ * The returned value will be updated after each network upgrade.
1093
+ */
1094
+ export declare function l1HardforkLatest(): SpecId
1095
+
1096
+ export declare function l1HardforkToString(hardfork: SpecId): string
1097
+
1098
+ export declare function l1ProviderFactory(): ProviderFactory
1099
+
1100
+ export declare function l1SolidityTestRunnerFactory(): SolidityTestRunnerFactory
1101
+
1102
+ /** Retrieves the latest version of `Solidity` supported for instrumentation. */
1103
+ export declare function latestSupportedSolidityVersion(): string
1104
+
1105
+ export declare function linkHexStringBytecode(code: string, address: string, position: number): string
1106
+
1107
+ export interface LinkReference {
1108
+ start: number
1109
+ length: number
1106
1110
  }
1107
- /** Test function level config override. */
1108
- export interface TestFunctionConfigOverride {
1109
- /**
1110
- * Allow expecting reverts with `expectRevert` at the same callstack depth
1111
- * as the test.
1112
- */
1113
- allowInternalExpectRevert?: boolean
1114
- /**
1115
- * Whether to enable isolation of calls for the test. In isolation mode all
1116
- * top-level calls are executed as a separate transaction in a separate
1117
- * EVM context, enabling more precise gas accounting and transaction
1118
- * state changes.
1119
- * Ignored when gas reporting is enabled, as isolation is required for
1120
- * accurate gas measurements.
1121
- */
1122
- isolate?: boolean
1111
+
1112
+ /** Configuration for a locally mined blockchain. */
1113
+ export interface LocalConfig {
1123
1114
  /**
1124
- * The EVM version to use for this test, e.g. "Cancun". This will override
1125
- * the global EVM version.
1115
+ * The blob gas used for the genesis block, introduced in [EIP-4844].
1116
+ *
1117
+ * [EIP-4844]: https://eips.ethereum.org/EIPS/eip-4844
1126
1118
  */
1127
- evmVersion?: string
1128
- /** Configuration override for fuzz testing. */
1129
- fuzz?: FuzzConfigOverride
1130
- /** Configuration override for invariant testing. */
1131
- invariant?: InvariantConfigOverride
1132
- }
1133
- /** Test function override configuration. */
1134
- export interface TestFunctionOverride {
1135
- /** The test function identifier. */
1136
- identifier: TestFunctionIdentifier
1137
- /** The configuration override. */
1138
- config: TestFunctionConfigOverride
1119
+ genesisBlobGas?: BlobGas
1120
+ /** The block gas limit of the genesis block. */
1121
+ genesisBlockGasLimit: bigint
1122
+ /** The date, in seconds since the Unix epoch, of the genesis block. */
1123
+ genesisBlockTime?: bigint
1139
1124
  }
1140
- /** Test function identifier. */
1141
- export interface TestFunctionIdentifier {
1142
- /** The contract artifact id. */
1143
- contractArtifact: ArtifactId
1144
- /** The function selector as hex string. */
1145
- functionSelector: string
1125
+
1126
+ /** Configuration for the provider's logger. */
1127
+ export interface LoggerConfig {
1128
+ /** Whether to enable the logger. */
1129
+ enable: boolean
1130
+ decodeConsoleLogInputsCallback: (inputs: ArrayBuffer[]) => string[]
1131
+ printLineCallback: (message: string, replace: boolean) => void
1146
1132
  }
1147
- /**
1148
- * Timeout configuration.
1149
- * Note: This wrapper is needed to avoid ambiguity with NAPI conversion.
1150
- */
1151
- export interface TimeoutConfig {
1152
- /** Optional timeout (in seconds). */
1153
- time?: number
1133
+
1134
+ /** Kind marker for log traces. */
1135
+ export declare enum LogKind {
1136
+ /** Single kind of log. */
1137
+ Log = 5
1154
1138
  }
1155
- /** Test function or test contract level fuzz config override. */
1156
- export interface FuzzConfigOverride {
1157
- /** The number of test cases that must execute for each property test. */
1158
- runs?: number
1139
+
1140
+ /** Object representing an event log in an execution trace. */
1141
+ export interface LogTrace {
1142
+ /** A constant to help discriminate the union `CallTrace | LogTrace`. */
1143
+ kind: LogKind
1159
1144
  /**
1160
- * The maximum number of test case rejections allowed by proptest, to be
1161
- * encountered during usage of `vm.assume` cheatcode. This will be used
1162
- * to set the `max_global_rejects` value in proptest test runner config.
1163
- * `max_local_rejects` option isn't exposed here since we're not using
1164
- * `prop_filter`.
1145
+ * If the log is a known event (based on its first topic), it will be
1146
+ * decoded into the event name and list of named parameters. For
1147
+ * example, `{ name: "Log", arguments: ["value: 1"] }`. Otherwise, it
1148
+ * will be provided as an array where all but the last element are the
1149
+ * log topics, and the last element is the log data.
1165
1150
  */
1166
- maxTestRejects?: number
1167
- /** show `console.log` in fuzz test, defaults to `false`. */
1168
- showLogs?: boolean
1169
- /** Optional timeout (in seconds) for each property test. */
1170
- timeout?: TimeoutConfig
1151
+ parameters: DecodedTraceParameters | Array<Uint8Array>
1171
1152
  }
1172
- /** Test function or test contract level invariant config override. */
1173
- export interface InvariantConfigOverride {
1174
- /** The number of runs that must execute for each invariant test group. */
1175
- runs?: number
1176
- /** The number of calls executed to attempt to break invariants in one run. */
1177
- depth?: number
1178
- /** Fails the invariant fuzzing if a revert occurs. */
1179
- failOnRevert?: boolean
1153
+
1154
+ export const LONDON: string
1155
+
1156
+ /** Configuration for the provider's mempool. */
1157
+ export interface MemPoolConfig {
1158
+ order: MineOrdering
1159
+ }
1160
+
1161
+ export const MERGE: string
1162
+
1163
+ /** The type of ordering to use when selecting blocks to mine. */
1164
+ export declare enum MineOrdering {
1165
+ /** Insertion order */
1166
+ Fifo = 'Fifo',
1167
+ /** Effective miner fee */
1168
+ Priority = 'Priority'
1169
+ }
1170
+
1171
+ /** Configuration for the provider's miner. */
1172
+ export interface MiningConfig {
1173
+ autoMine: boolean
1180
1174
  /**
1181
- * Allows overriding an unsafe external call when running invariant tests.
1182
- * eg. reentrancy checks
1175
+ * The block gas limit to use for mining a block.
1176
+ *
1177
+ * When not set, enforcement of the block gas limit is disabled in the mem
1178
+ * pool, miner, and REVM.
1183
1179
  */
1184
- callOverride?: boolean
1185
- /** Optional timeout (in seconds) for each invariant test. */
1186
- timeout?: TimeoutConfig
1180
+ blockGasLimit?: bigint
1181
+ interval?: bigint | IntervalRange
1182
+ memPool: MemPoolConfig
1187
1183
  }
1188
- export declare function l1SolidityTestRunnerFactory(): SolidityTestRunnerFactory
1189
- export declare function opSolidityTestRunnerFactory(): SolidityTestRunnerFactory
1190
- /** A grouping of value snapshot entries for a test. */
1191
- export interface ValueSnapshotGroup {
1192
- /** The group name. */
1193
- name: string
1194
- /** The entries in the group. */
1195
- entries: Array<ValueSnapshotEntry>
1184
+
1185
+ export interface MissingFallbackOrReceiveErrorStackTraceEntry {
1186
+ type: StackTraceEntryType.MISSING_FALLBACK_OR_RECEIVE_ERROR
1187
+ sourceReference: SourceReference
1196
1188
  }
1197
- /** An entry in a value snapshot group. */
1198
- export interface ValueSnapshotEntry {
1199
- /** The name of the entry. */
1200
- name: string
1201
- /** The value of the entry. */
1202
- value: string
1189
+
1190
+ export const MUIR_GLACIER: string
1191
+
1192
+ export interface NonContractAccountCalledErrorStackTraceEntry {
1193
+ type: StackTraceEntryType.NONCONTRACT_ACCOUNT_CALLED_ERROR
1194
+ sourceReference: SourceReference
1203
1195
  }
1204
- /** The stack trace result */
1205
- export interface StackTrace {
1206
- /** Enum tag for JS. */
1207
- kind: "StackTrace"
1208
- /** The stack trace entries */
1209
- entries: Array<SolidityStackTraceEntry>
1196
+
1197
+ /** Configuration for runtime observability. */
1198
+ export interface ObservabilityConfig {
1199
+ /** If present, configures runtime observability to collect code coverage. */
1200
+ codeCoverage?: CodeCoverageConfig
1201
+ /** If present, configures runtime observability to collect gas reports. */
1202
+ gasReport?: GasReportConfig
1203
+ /**
1204
+ * Controls when to include call traces in the results of transaction
1205
+ * execution.
1206
+ *
1207
+ * Defaults to `IncludeTraces.None`.
1208
+ */
1209
+ includeCallTraces?: IncludeTraces
1210
1210
  }
1211
- /** We couldn't generate stack traces, because an unexpected error occurred. */
1212
- export interface UnexpectedError {
1213
- /** Enum tag for JS. */
1214
- kind: "UnexpectedError"
1215
- /** The error message from the unexpected error. */
1216
- errorMessage: string
1211
+
1212
+ export const OP_CHAIN_TYPE: string
1213
+
1214
+ export declare function opGenesisState(hardfork: OpHardfork): Array<AccountOverride>
1215
+
1216
+ /** Enumeration of supported OP hardforks. */
1217
+ export declare enum OpHardfork {
1218
+ Bedrock = 100,
1219
+ Regolith = 101,
1220
+ Canyon = 102,
1221
+ Ecotone = 103,
1222
+ Fjord = 104,
1223
+ Granite = 105,
1224
+ Holocene = 106,
1225
+ Isthmus = 107
1217
1226
  }
1227
+
1218
1228
  /**
1219
- * We couldn't generate stack traces, because the stack trace generation
1220
- * heuristics failed due to an unknown reason.
1229
+ * Tries to parse the provided string to create an [`OpHardfork`]
1230
+ * instance.
1231
+ *
1232
+ * Returns an error if the string does not match any known hardfork.
1221
1233
  */
1222
- export interface HeuristicFailed {
1223
- /** Enum tag for JS. */
1224
- kind: "HeuristicFailed"
1225
- }
1234
+ export declare function opHardforkFromString(hardfork: string): OpHardfork
1235
+
1236
+ /** Returns the string representation of the provided OP hardfork. */
1237
+ export declare function opHardforkToString(hardfork: OpHardfork): string
1238
+
1226
1239
  /**
1227
- * We couldn't generate stack traces, because the test execution is unsafe to
1228
- * replay due to indeterminism. This can be caused by either specifying a fork
1229
- * url without a fork block number in the test runner config or using impure
1230
- * cheatcodes.
1240
+ * Returns the latest supported OP hardfork.
1241
+ *
1242
+ * The returned value will be updated after each network upgrade.
1231
1243
  */
1232
- export interface UnsafeToReplay {
1233
- /** Enum tag for JS. */
1234
- kind: "UnsafeToReplay"
1235
- /**
1236
- * Indeterminism due to specifying a fork url without a fork block number
1237
- * in the test runner config.
1238
- */
1239
- globalForkLatest: boolean
1240
- /**
1241
- * The list of executed impure cheatcode signatures. We collect function
1242
- * signatures instead of function names as whether a cheatcode is impure
1243
- * can depend on the arguments it takes (e.g. `createFork` without a second
1244
- * argument means implicitly fork from “latest”). Example signature:
1245
- * `function createSelectFork(string calldata urlOrAlias) external returns
1246
- * (uint256 forkId);`.
1247
- */
1248
- impureCheatcodes: Array<string>
1249
- }
1250
- /**The result of a test execution. */
1251
- export enum TestStatus {
1252
- /**Test success */
1253
- Success = 'Success',
1254
- /**Test failure */
1255
- Failure = 'Failure',
1256
- /**Test skipped */
1257
- Skipped = 'Skipped'
1258
- }
1259
- /** See [`edr_solidity_tests::result::TestKind::Unit`] */
1260
- export interface StandardTestKind {
1261
- /** The gas consumed by the test. */
1262
- readonly consumedGas: bigint
1263
- }
1264
- /** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
1265
- export interface FuzzTestKind {
1266
- /** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
1267
- readonly runs: bigint
1268
- /** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
1269
- readonly meanGas: bigint
1270
- /** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
1271
- readonly medianGas: bigint
1272
- }
1273
- /** See [`edr_solidity_tests::fuzz::FuzzCase`] */
1274
- export interface FuzzCase {
1275
- /** The calldata used for this fuzz test */
1276
- readonly calldata: Uint8Array
1277
- /** Consumed gas */
1278
- readonly gas: bigint
1279
- /** The initial gas stipend for the transaction */
1280
- readonly stipend: bigint
1281
- }
1282
- /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
1283
- export interface InvariantTestKind {
1284
- /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
1285
- readonly runs: bigint
1286
- /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
1287
- readonly calls: bigint
1288
- /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
1289
- readonly reverts: bigint
1290
- /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
1291
- readonly metrics: Record<string, InvariantMetrics>
1292
- /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
1293
- readonly failedCorpusReplays: bigint
1244
+ export declare function opLatestHardfork(): OpHardfork
1245
+
1246
+ export declare function opProviderFactory(): ProviderFactory
1247
+
1248
+ export declare function opSolidityTestRunnerFactory(): SolidityTestRunnerFactory
1249
+
1250
+ export const OSAKA: string
1251
+
1252
+ export interface OtherExecutionErrorStackTraceEntry {
1253
+ type: StackTraceEntryType.OTHER_EXECUTION_ERROR
1254
+ sourceReference?: SourceReference
1294
1255
  }
1295
- /** See [`edr_solidity_tests::result::InvariantMetrics`] */
1296
- export interface InvariantMetrics {
1297
- readonly calls: bigint
1298
- readonly reverts: bigint
1299
- readonly discards: bigint
1256
+
1257
+ export interface PanicErrorStackTraceEntry {
1258
+ type: StackTraceEntryType.PANIC_ERROR
1259
+ errorCode: bigint
1260
+ sourceReference?: SourceReference
1300
1261
  }
1301
- /**
1302
- * Original sequence size and sequence of calls used as a counter example
1303
- * for invariant tests.
1304
- */
1305
- export interface CounterExampleSequence {
1306
- /** The original sequence size before shrinking. */
1307
- originalSequenceSize: bigint
1308
- /** The shrunk counterexample sequence. */
1309
- sequence: Array<BaseCounterExample>
1262
+
1263
+ /** Represents an access permission to a single path */
1264
+ export interface PathPermission {
1265
+ /** Permission level to access the `path` */
1266
+ access: FsAccessPermission
1267
+ /** The targeted path guarded by the permission */
1268
+ path: string
1310
1269
  }
1311
- /** See [`edr_solidity_tests::fuzz::BaseCounterExample`] */
1312
- export interface BaseCounterExample {
1313
- /** See [`edr_solidity_tests::fuzz::BaseCounterExample::sender`] */
1314
- readonly sender?: Uint8Array
1315
- /** See [`edr_solidity_tests::fuzz::BaseCounterExample::addr`] */
1316
- readonly address?: Uint8Array
1317
- /** See [`edr_solidity_tests::fuzz::BaseCounterExample::calldata`] */
1318
- readonly calldata: Uint8Array
1319
- /** See [`edr_solidity_tests::fuzz::BaseCounterExample::contract_name`] */
1320
- readonly contractName?: string
1321
- /** See [`edr_solidity_tests::fuzz::BaseCounterExample::signature`] */
1322
- readonly signature?: string
1323
- /** See [`edr_solidity_tests::fuzz::BaseCounterExample::args`] */
1324
- readonly args?: string
1270
+
1271
+ export const PETERSBURG: string
1272
+
1273
+ export const PRAGUE: string
1274
+
1275
+ export const PRECOMPILE_FUNCTION_NAME: string
1276
+
1277
+ export interface PrecompileErrorStackTraceEntry {
1278
+ type: StackTraceEntryType.PRECOMPILE_ERROR
1279
+ precompile: number
1280
+ sourceReference?: undefined
1325
1281
  }
1282
+
1326
1283
  /**
1327
- * Object representing a call in an execution trace, including contract
1328
- * creation.
1284
+ * [RIP-7212](https://github.com/ethereum/RIPs/blob/master/RIPS/rip-7212.md#specification)
1285
+ * secp256r1 precompile.
1329
1286
  */
1330
- export interface CallTrace {
1331
- /** The kind of call or contract creation this represents. */
1332
- kind: CallKind
1333
- /** Whether the call succeeded or reverted. */
1334
- success: boolean
1335
- /** Whether the call is a cheatcode. */
1336
- isCheatcode: boolean
1337
- /** The amount of gas that was consumed. */
1338
- gasUsed: bigint
1339
- /** The amount of native token that was included with the call. */
1340
- value: bigint
1341
- /** The target address of the call. */
1342
- address: string
1343
- /** The name of the contract that is the target of the call, if known. */
1344
- contract?: string
1287
+ export declare function precompileP256Verify(): Precompile
1288
+
1289
+ export declare function printStackTrace(trace: SolidityStackTrace): void
1290
+
1291
+ /** Configuration for a provider. */
1292
+ export interface ProviderConfig {
1293
+ /** Whether to allow blocks with the same timestamp */
1294
+ allowBlocksWithSameTimestamp: boolean
1295
+ /** Whether to allow unlimited contract size */
1296
+ allowUnlimitedContractSize: boolean
1297
+ /** Whether to return an `Err` when `eth_call` fails */
1298
+ bailOnCallFailure: boolean
1299
+ /** Whether to return an `Err` when a `eth_sendTransaction` fails */
1300
+ bailOnTransactionFailure: boolean
1345
1301
  /**
1346
- * The input (calldata) to the call. If it encodes a known function call,
1347
- * it will be decoded into the function name and a list of arguments.
1348
- * For example, `{ name: "ownerOf", arguments: ["1"] }`. Note that the
1349
- * function name may also be any of the special `fallback` and `receive`
1350
- * functions. Otherwise, it will be provided as a raw byte array.
1302
+ * EIP-1559 base fee parameters activations to be used to calculate the
1303
+ * block base fee.
1304
+ *
1305
+ * Provide an ordered list of `base_fee_params` to be
1306
+ * used starting from the specified activation point (hardfork or block
1307
+ * number).
1308
+ * If not provided, the default values from the chain spec
1309
+ * will be used.
1351
1310
  */
1352
- inputs: DecodedTraceParameters | Uint8Array
1311
+ baseFeeConfig?: Array<BaseFeeParamActivation>
1312
+ /** The chain ID of the blockchain */
1313
+ chainId: bigint
1314
+ /** The address of the coinbase */
1315
+ coinbase: Uint8Array
1353
1316
  /**
1354
- * The output of the call. This will be a decoded human-readable
1355
- * representation of the value if the function is known, otherwise a
1356
- * raw byte array.
1317
+ * The default transaction gas limit to use for RPC call and transaction
1318
+ * requests that do not specify a `gas` value.
1357
1319
  */
1358
- outputs: string | Uint8Array
1320
+ defaultTransactionGasLimit: bigint
1359
1321
  /**
1360
- * Interleaved subcalls and event logs. Use `kind` to check if each member
1361
- * of the array is a call or log trace.
1322
+ * The gas estimation mode to use for `eth_estimateGas`. Defaults to
1323
+ * `GasEstimationMode::TopLevelSuccess` if not set.
1362
1324
  */
1363
- children: Array<CallTrace | LogTrace>
1364
- }
1365
- /** Object representing an event log in an execution trace. */
1366
- export interface LogTrace {
1367
- /** A constant to help discriminate the union `CallTrace | LogTrace`. */
1368
- kind: LogKind
1325
+ gasEstimationMode?: GasEstimationMode
1326
+ /** The genesis state of the blockchain */
1327
+ genesisState: Array<AccountOverride>
1328
+ /** The hardfork of the blockchain */
1329
+ hardfork: string
1369
1330
  /**
1370
- * If the log is a known event (based on its first topic), it will be
1371
- * decoded into the event name and list of named parameters. For
1372
- * example, `{ name: "Log", arguments: ["value: 1"] }`. Otherwise, it
1373
- * will be provided as an array where all but the last element are the
1374
- * log topics, and the last element is the log data.
1331
+ * The initial base fee per gas of the blockchain. Required for EIP-1559
1332
+ * transactions and later
1375
1333
  */
1376
- parameters: DecodedTraceParameters | Array<Uint8Array>
1377
- }
1378
- /** The various kinds of call frames possible in the EVM. */
1379
- export enum CallKind {
1380
- /** Regular call that may change state. */
1381
- Call = 0,
1334
+ initialBaseFeePerGas?: bigint
1382
1335
  /**
1383
- * Variant of `DelegateCall` that doesn't preserve sender or value in the
1384
- * frame.
1336
+ * The initial parent beacon block root of the blockchain. Required for
1337
+ * EIP-4788
1385
1338
  */
1386
- CallCode = 1,
1387
- /** Call that executes the code of the target in the context of the caller. */
1388
- DelegateCall = 2,
1389
- /** Regular call that may not change state. */
1390
- StaticCall = 3,
1391
- /** Contract creation. */
1392
- Create = 4
1393
- }
1394
- /** Kind marker for log traces. */
1395
- export enum LogKind {
1396
- /** Single kind of log. */
1397
- Log = 5
1398
- }
1399
- /** Decoded function call or event. */
1400
- export interface DecodedTraceParameters {
1401
- /** The name of a function or an event. */
1402
- name: string
1339
+ initialParentBeaconBlockRoot?: Uint8Array
1340
+ /** The minimum gas price of the next block. */
1341
+ minGasPrice: bigint
1342
+ /** The configuration for the miner */
1343
+ mining: MiningConfig
1344
+ /** The network configuration for the provider. */
1345
+ network: ForkConfig | LocalConfig
1346
+ /** The network ID of the blockchain */
1347
+ networkId: bigint
1348
+ /** The configuration for the provider's observability */
1349
+ observability: ObservabilityConfig
1350
+ /** Secret keys of owned accounts */
1351
+ ownedAccounts: Array<string>
1352
+ /** Overrides for precompiles */
1353
+ precompileOverrides: Array<Precompile>
1403
1354
  /**
1404
- * The arguments of the function call or the event, in their human-readable
1405
- * representations.
1355
+ * Transaction gas cap, introduced in [EIP-7825].
1356
+ *
1357
+ * Integer values should be larger than zero.
1358
+ *
1359
+ * When `false`, enforcement of the transaction gas cap is disabled and
1360
+ * transactions with any `gas` value are accepted by the mempool and
1361
+ * executed without REVM's transaction gas cap check.
1362
+ *
1363
+ * When not set, a hardfork-specific default value will be used.
1364
+ *
1365
+ * [EIP-7825]: https://eips.ethereum.org/EIPS/eip-7825
1406
1366
  */
1407
- arguments: Array<string>
1367
+ transactionGasCap?: bigint | false
1368
+ }
1369
+
1370
+ export const RECEIVE_FUNCTION_NAME: string
1371
+
1372
+ export const REGOLITH: string
1373
+
1374
+ export interface ReturndataSizeErrorStackTraceEntry {
1375
+ type: StackTraceEntryType.RETURNDATA_SIZE_ERROR
1376
+ sourceReference: SourceReference
1377
+ }
1378
+
1379
+ export interface RevertErrorStackTraceEntry {
1380
+ type: StackTraceEntryType.REVERT_ERROR
1381
+ returnData: Uint8Array
1382
+ sourceReference: SourceReference
1383
+ isInvalidOpcodeError: boolean
1408
1384
  }
1385
+
1386
+ /** The result when the EVM terminates due to a revert. */
1387
+ export interface RevertResult {
1388
+ /** The amount of gas used */
1389
+ gasUsed: bigint
1390
+ /** The logs */
1391
+ logs: Array<ExecutionLog>
1392
+ /** The transaction output */
1393
+ output: Uint8Array
1394
+ }
1395
+
1396
+ export const SHANGHAI: string
1397
+
1398
+ export type SolidityStackTrace =
1399
+ Array<SolidityStackTraceEntry>
1400
+
1401
+ export type SolidityStackTraceEntry =
1402
+ CallstackEntryStackTraceEntry | UnrecognizedCreateCallstackEntryStackTraceEntry | UnrecognizedContractCallstackEntryStackTraceEntry | PrecompileErrorStackTraceEntry | RevertErrorStackTraceEntry | PanicErrorStackTraceEntry | CustomErrorStackTraceEntry | FunctionNotPayableErrorStackTraceEntry | InvalidParamsErrorStackTraceEntry | FallbackNotPayableErrorStackTraceEntry | FallbackNotPayableAndNoReceiveErrorStackTraceEntry | UnrecognizedFunctionWithoutFallbackErrorStackTraceEntry | MissingFallbackOrReceiveErrorStackTraceEntry | ReturndataSizeErrorStackTraceEntry | NonContractAccountCalledErrorStackTraceEntry | CallFailedErrorStackTraceEntry | DirectLibraryCallErrorStackTraceEntry | UnrecognizedCreateErrorStackTraceEntry | UnrecognizedContractErrorStackTraceEntry | OtherExecutionErrorStackTraceEntry | UnmappedSolc063RevertErrorStackTraceEntry | ContractTooLargeErrorStackTraceEntry | InternalFunctionCallStackEntry | ContractCallRunOutOfGasError | CheatcodeErrorStackTraceEntry
1403
+
1409
1404
  /** The result of a Solidity test run. */
1410
1405
  export interface SolidityTestResult {
1411
1406
  /** Gas report, if it was generated. */
1412
1407
  readonly gasReport?: GasReport
1413
1408
  }
1414
- /** Configuration for subscriptions. */
1415
- export interface SubscriptionConfig {
1416
- /** Callback to be called when a new event is received. */
1417
- subscriptionCallback: (event: SubscriptionEvent) => void
1409
+
1410
+ /**
1411
+ * Solidity test runner configuration arguments exposed through the ffi.
1412
+ * Docs based on <https://book.getfoundry.sh/reference/config/testing>.
1413
+ */
1414
+ export interface SolidityTestRunnerConfigArgs {
1415
+ /**
1416
+ * The absolute path to the project root directory.
1417
+ * Relative paths in cheat codes are resolved against this path.
1418
+ */
1419
+ projectRoot: string
1420
+ /** Configures the permissions of cheat codes that access the file system. */
1421
+ fsPermissions?: Array<PathPermission>
1422
+ /** Address labels for traces. Defaults to none. */
1423
+ labels?: Array<AddressLabel>
1424
+ /**
1425
+ * Whether to enable isolation of calls. In isolation mode all top-level
1426
+ * calls are executed as a separate transaction in a separate EVM
1427
+ * context, enabling more precise gas accounting and transaction state
1428
+ * changes.
1429
+ * Defaults to false.
1430
+ */
1431
+ isolate?: boolean
1432
+ /**
1433
+ * Whether or not to enable the ffi cheatcode.
1434
+ * Warning: Enabling this cheatcode has security implications, as it allows
1435
+ * tests to execute arbitrary programs on your computer.
1436
+ * Defaults to false.
1437
+ */
1438
+ ffi?: boolean
1439
+ /**
1440
+ * Allow expecting reverts with `expectRevert` at the same callstack depth
1441
+ * as the test. Defaults to false.
1442
+ */
1443
+ allowInternalExpectRevert?: boolean
1444
+ /**
1445
+ * The value of `msg.sender` in tests as hex string.
1446
+ * Defaults to `0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38`.
1447
+ */
1448
+ sender?: Uint8Array
1449
+ /**
1450
+ * The value of `tx.origin` in tests as hex string.
1451
+ * Defaults to `0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38`.
1452
+ */
1453
+ txOrigin?: Uint8Array
1454
+ /**
1455
+ * The initial balance of the sender in tests.
1456
+ * Defaults to `0xffffffffffffffffffffffff`.
1457
+ */
1458
+ initialBalance?: bigint
1459
+ /**
1460
+ * The value of `block.number` in tests.
1461
+ * Defaults to `1`.
1462
+ */
1463
+ blockNumber?: bigint
1464
+ /**
1465
+ * The value of the `chainid` opcode in tests.
1466
+ * Defaults to `31337`.
1467
+ */
1468
+ chainId?: bigint
1469
+ /** The hardfork to use for EVM execution. */
1470
+ hardfork: string
1471
+ /**
1472
+ * The gas limit for each test case.
1473
+ * Defaults to `9_223_372_036_854_775_807` (`i64::MAX`).
1474
+ */
1475
+ gasLimit?: bigint
1476
+ /**
1477
+ * The price of gas (in wei) in tests.
1478
+ * Defaults to `0`.
1479
+ */
1480
+ gasPrice?: bigint
1481
+ /**
1482
+ * The base fee per gas (in wei) in tests.
1483
+ * Defaults to `0`.
1484
+ */
1485
+ blockBaseFeePerGas?: bigint
1486
+ /**
1487
+ * The value of `block.coinbase` in tests.
1488
+ * Defaults to `0x0000000000000000000000000000000000000000`.
1489
+ */
1490
+ blockCoinbase?: Uint8Array
1491
+ /**
1492
+ * The value of `block.timestamp` in tests.
1493
+ * Defaults to 1.
1494
+ */
1495
+ blockTimestamp?: bigint
1496
+ /**
1497
+ * The value of `block.difficulty` in tests.
1498
+ * Defaults to 0.
1499
+ */
1500
+ blockDifficulty?: bigint
1501
+ /**
1502
+ * The `block.gaslimit` value during EVM execution.
1503
+ * Defaults to none.
1504
+ */
1505
+ blockGasLimit?: bigint
1506
+ /**
1507
+ * Whether to disable the block gas limit.
1508
+ * Defaults to false.
1509
+ */
1510
+ disableBlockGasLimit?: boolean
1511
+ /**
1512
+ * Transaction gas cap, introduced in [EIP-7825].
1513
+ *
1514
+ * When not set, defaults to the value defined by the used hardfork.
1515
+ *
1516
+ * [EIP-7825]: https://eips.ethereum.org/EIPS/eip-7825
1517
+ */
1518
+ transactionGasCap?: bigint
1519
+ /**
1520
+ * Whether to disable the [EIP-7825] transaction gas cap.
1521
+ * Defaults to false.
1522
+ *
1523
+ * [EIP-7825]: https://eips.ethereum.org/EIPS/eip-7825
1524
+ */
1525
+ disableTransactionGasCap?: boolean
1526
+ /**
1527
+ * The memory limit of the EVM in bytes.
1528
+ * Defaults to `33_554_432` (2^25 = 32MiB).
1529
+ */
1530
+ memoryLimit?: bigint
1531
+ /**
1532
+ * The predeploys applied in local mode. Defaults to no predeploys.
1533
+ * These should match the predeploys of the network in fork mode, so they
1534
+ * aren't set in fork mode.
1535
+ * The code must be set and non-empty. The nonce and the balance default to
1536
+ * zero and storage defaults to empty.
1537
+ */
1538
+ localPredeploys?: Array<AccountOverride>
1539
+ /**
1540
+ * If set, all tests are run in fork mode using this url or remote name.
1541
+ * Defaults to none.
1542
+ */
1543
+ ethRpcUrl?: string
1544
+ /** Pins the block number for the global state fork. */
1545
+ forkBlockNumber?: bigint
1546
+ /**
1547
+ * Map of RPC endpoints from chain name to RPC urls for fork cheat codes,
1548
+ * e.g. `{ "optimism": "https://optimism.alchemyapi.io/v2/..." }`
1549
+ */
1550
+ rpcEndpoints?: Record<string, string>
1551
+ /**
1552
+ * Optional RPC cache path. If this is none, then no RPC calls will be
1553
+ * cached, otherwise data is cached to `<rpc_cache_path>/<chain
1554
+ * id>/<block number>`. Caching can be disabled for specific chains
1555
+ * with `rpc_storage_caching`.
1556
+ */
1557
+ rpcCachePath?: string
1558
+ /** What RPC endpoints are cached. Defaults to all. */
1559
+ rpcStorageCaching?: StorageCachingConfig
1560
+ /**
1561
+ * The number of seconds to wait before `vm.prompt` reverts with a timeout.
1562
+ * Defaults to 120.
1563
+ */
1564
+ promptTimeout?: number
1565
+ /** Fuzz testing configuration. */
1566
+ fuzz?: FuzzConfigArgs
1567
+ /**
1568
+ * Invariant testing configuration.
1569
+ * If an invariant config setting is not set, but a corresponding fuzz
1570
+ * config value is set, then the fuzz config value will be used.
1571
+ */
1572
+ invariant?: InvariantConfigArgs
1573
+ /** Whether to collect stack traces. */
1574
+ collectStackTraces?: CollectStackTraces
1575
+ /**
1576
+ * Controls which test results should include execution traces. Defaults to
1577
+ * None.
1578
+ */
1579
+ includeTraces?: IncludeTraces
1580
+ /** The configuration for the Solidity test runner's observability */
1581
+ observability?: ObservabilityConfig
1582
+ /**
1583
+ * A regex pattern to filter tests. If provided, only test methods that
1584
+ * match the pattern will be executed and reported as a test result.
1585
+ */
1586
+ testPattern?: string
1587
+ /**
1588
+ * A regex pattern to exclude tests. If provided, test methods that match
1589
+ * the pattern will not be executed or reported as a test result. Applied
1590
+ * after `test_pattern`.
1591
+ */
1592
+ excludeTestPattern?: string
1593
+ /**
1594
+ * Controls whether to generate a gas report after running the tests.
1595
+ * Enabling this also enables collection of all traces and EVM isolation
1596
+ * mode.
1597
+ * Defaults to false.
1598
+ */
1599
+ generateGasReport?: boolean
1600
+ /**
1601
+ * Test function level config overrides.
1602
+ * Defaults to none.
1603
+ */
1604
+ testFunctionOverrides?: Array<TestFunctionOverride>
1605
+ /**
1606
+ * A list of EIP-712 canonical type definitions that can be referenced by
1607
+ * type name in the `eip712HashType` and `eip712HashStruct` cheatcodes.
1608
+ *
1609
+ * Each entry is an independent, self-contained type definition. A
1610
+ * definition that references nested struct types must inline those
1611
+ * struct definitions, per the EIP-712 `encodeType` spec.
1612
+ *
1613
+ * Only the primary (leftmost) type of each entry is registered by name.
1614
+ * Nested struct types referenced inside an entry are *not* registered
1615
+ * under their own names. To look up a nested struct by name from a
1616
+ * cheatcode, add it as a separate top-level entry whose primary type
1617
+ * is the nested struct.
1618
+ *
1619
+ * The type of a struct is encoded as:
1620
+ *
1621
+ * `name ‖ "(" ‖ member₁ ‖ "," ‖ member₂ ‖ "," ‖ … ‖ memberₙ ")"`
1622
+ *
1623
+ * where each member is written as `type ‖ " " ‖ name`.
1624
+ *
1625
+ * Entries that fail to parse cause a startup error listing every bad
1626
+ * entry.
1627
+ *
1628
+ * Example — to make both `Mail` and `Person` reachable by name:
1629
+ *
1630
+ * ```text
1631
+ * "Mail(Person from,Person to,string contents)Person(address wallet,string name)"
1632
+ * "Person(address wallet,string name)"
1633
+ * ```
1634
+ *
1635
+ * With *only* the first entry, `vm.eip712HashType("Mail")` works but
1636
+ * `vm.eip712HashType("Person")` fails with an unknown-type error.
1637
+ */
1638
+ eip712CanonicalTypes?: Array<string>
1418
1639
  }
1419
- export interface SubscriptionEvent {
1420
- filterId: bigint
1421
- result: any
1640
+
1641
+ export interface SourceReference {
1642
+ sourceName: string
1643
+ sourceContent: string
1644
+ contract?: string
1645
+ function?: string
1646
+ line: number
1647
+ range: Array<number>
1422
1648
  }
1423
- export declare function linkHexStringBytecode(code: string, address: string, position: number): string
1424
- export declare function printStackTrace(trace: SolidityStackTrace): void
1425
- /** Represents the exit code of the EVM. */
1426
- export enum ExitCode {
1427
- /** Execution was successful. */
1428
- SUCCESS = 0,
1429
- /** Execution was reverted. */
1430
- REVERT = 1,
1431
- /** Execution ran out of gas. */
1432
- OUT_OF_GAS = 2,
1433
- /** Execution encountered an internal error. */
1434
- INTERNAL_ERROR = 3,
1435
- /** Execution encountered an invalid opcode. */
1436
- INVALID_OPCODE = 4,
1437
- /** Execution encountered a stack underflow. */
1438
- STACK_UNDERFLOW = 5,
1439
- /** Create init code size exceeds limit (runtime). */
1440
- CODESIZE_EXCEEDS_MAXIMUM = 6,
1441
- /** Create collision. */
1442
- CREATE_COLLISION = 7,
1443
- /** Unknown halt reason. */
1444
- UNKNOWN_HALT_REASON = 8
1649
+
1650
+ /** Identifier for the Ethereum spec. */
1651
+ export declare enum SpecId {
1652
+ /** Frontier */
1653
+ Frontier = 0,
1654
+ /** Frontier Thawing */
1655
+ FrontierThawing = 1,
1656
+ /** Homestead */
1657
+ Homestead = 2,
1658
+ /** DAO Fork */
1659
+ DaoFork = 3,
1660
+ /** Tangerine */
1661
+ Tangerine = 4,
1662
+ /** Spurious Dragon */
1663
+ SpuriousDragon = 5,
1664
+ /** Byzantium */
1665
+ Byzantium = 6,
1666
+ /** Constantinople */
1667
+ Constantinople = 7,
1668
+ /** Petersburg */
1669
+ Petersburg = 8,
1670
+ /** Istanbul */
1671
+ Istanbul = 9,
1672
+ /** Muir Glacier */
1673
+ MuirGlacier = 10,
1674
+ /** Berlin */
1675
+ Berlin = 11,
1676
+ /** London */
1677
+ London = 12,
1678
+ /** Arrow Glacier */
1679
+ ArrowGlacier = 13,
1680
+ /** Gray Glacier */
1681
+ GrayGlacier = 14,
1682
+ /** Merge */
1683
+ Merge = 15,
1684
+ /** Shanghai */
1685
+ Shanghai = 16,
1686
+ /** Cancun */
1687
+ Cancun = 17,
1688
+ /** Prague */
1689
+ Prague = 18,
1690
+ /** Osaka */
1691
+ Osaka = 19,
1692
+ /** Amsterdam */
1693
+ Amsterdam = 20
1445
1694
  }
1446
- export enum ContractFunctionType {
1447
- CONSTRUCTOR = 0,
1448
- FUNCTION = 1,
1449
- FALLBACK = 2,
1450
- RECEIVE = 3,
1451
- GETTER = 4,
1452
- MODIFIER = 5,
1453
- FREE_FUNCTION = 6
1695
+
1696
+ export const SPURIOUS_DRAGON: string
1697
+
1698
+ /** The stack trace result */
1699
+ export interface StackTrace {
1700
+ /** Enum tag for JS. */
1701
+ kind: "StackTrace"
1702
+ /** The stack trace entries */
1703
+ entries: Array<SolidityStackTraceEntry>
1454
1704
  }
1455
- export enum StackTraceEntryType {
1705
+
1706
+ export declare enum StackTraceEntryType {
1456
1707
  CALLSTACK_ENTRY = 0,
1457
1708
  UNRECOGNIZED_CREATE_CALLSTACK_ENTRY = 1,
1458
1709
  UNRECOGNIZED_CONTRACT_CALLSTACK_ENTRY = 2,
@@ -1479,140 +1730,175 @@ export enum StackTraceEntryType {
1479
1730
  CONTRACT_CALL_RUN_OUT_OF_GAS_ERROR = 23,
1480
1731
  CHEATCODE_ERROR = 24
1481
1732
  }
1733
+
1482
1734
  export declare function stackTraceEntryTypeToString(val: StackTraceEntryType): string
1483
- export const FALLBACK_FUNCTION_NAME: string
1484
- export const RECEIVE_FUNCTION_NAME: string
1485
- export const CONSTRUCTOR_FUNCTION_NAME: string
1486
- export const UNRECOGNIZED_FUNCTION_NAME: string
1487
- export const UNKNOWN_FUNCTION_NAME: string
1488
- export const PRECOMPILE_FUNCTION_NAME: string
1489
- export const UNRECOGNIZED_CONTRACT_NAME: string
1490
- export interface SourceReference {
1491
- sourceName: string
1492
- sourceContent: string
1493
- contract?: string
1494
- function?: string
1495
- line: number
1496
- range: Array<number>
1497
- }
1498
- export interface CallstackEntryStackTraceEntry {
1499
- type: StackTraceEntryType.CALLSTACK_ENTRY
1500
- sourceReference: SourceReference
1501
- functionType: ContractFunctionType
1502
- }
1503
- export interface UnrecognizedCreateCallstackEntryStackTraceEntry {
1504
- type: StackTraceEntryType.UNRECOGNIZED_CREATE_CALLSTACK_ENTRY
1505
- sourceReference?: undefined
1506
- }
1507
- export interface UnrecognizedContractCallstackEntryStackTraceEntry {
1508
- type: StackTraceEntryType.UNRECOGNIZED_CONTRACT_CALLSTACK_ENTRY
1509
- address: Uint8Array
1510
- sourceReference?: undefined
1511
- }
1512
- export interface PrecompileErrorStackTraceEntry {
1513
- type: StackTraceEntryType.PRECOMPILE_ERROR
1514
- precompile: number
1515
- sourceReference?: undefined
1516
- }
1517
- export interface RevertErrorStackTraceEntry {
1518
- type: StackTraceEntryType.REVERT_ERROR
1519
- returnData: Uint8Array
1520
- sourceReference: SourceReference
1521
- isInvalidOpcodeError: boolean
1522
- }
1523
- export interface PanicErrorStackTraceEntry {
1524
- type: StackTraceEntryType.PANIC_ERROR
1525
- errorCode: bigint
1526
- sourceReference?: SourceReference
1527
- }
1528
- export interface CustomErrorStackTraceEntry {
1529
- type: StackTraceEntryType.CUSTOM_ERROR
1530
- message: string
1531
- sourceReference: SourceReference
1532
- }
1533
- export interface FunctionNotPayableErrorStackTraceEntry {
1534
- type: StackTraceEntryType.FUNCTION_NOT_PAYABLE_ERROR
1535
- value: bigint
1536
- sourceReference: SourceReference
1537
- }
1538
- export interface InvalidParamsErrorStackTraceEntry {
1539
- type: StackTraceEntryType.INVALID_PARAMS_ERROR
1540
- sourceReference: SourceReference
1735
+
1736
+ /** See [`edr_solidity_tests::result::TestKind::Unit`] */
1737
+ export interface StandardTestKind {
1738
+ /** The gas consumed by the test. */
1739
+ readonly consumedGas: bigint
1541
1740
  }
1542
- export interface FallbackNotPayableErrorStackTraceEntry {
1543
- type: StackTraceEntryType.FALLBACK_NOT_PAYABLE_ERROR
1544
- value: bigint
1545
- sourceReference: SourceReference
1741
+
1742
+ /** Settings to configure caching of remote RPC endpoints. */
1743
+ export interface StorageCachingConfig {
1744
+ /**
1745
+ * Chains to cache. Either all or none or a list of chain names, e.g.
1746
+ * ["optimism", "mainnet"].
1747
+ */
1748
+ chains: CachedChains | Array<string>
1749
+ /** Endpoints to cache. Either all or remote or a regex. */
1750
+ endpoints: CachedEndpoints | string
1546
1751
  }
1547
- export interface FallbackNotPayableAndNoReceiveErrorStackTraceEntry {
1548
- type: StackTraceEntryType.FALLBACK_NOT_PAYABLE_AND_NO_RECEIVE_ERROR
1752
+
1753
+ /** A description of a storage slot's state. */
1754
+ export interface StorageSlot {
1755
+ /** The storage slot's index */
1756
+ index: bigint
1757
+ /** The storage slot's value */
1549
1758
  value: bigint
1550
- sourceReference: SourceReference
1551
- }
1552
- export interface UnrecognizedFunctionWithoutFallbackErrorStackTraceEntry {
1553
- type: StackTraceEntryType.UNRECOGNIZED_FUNCTION_WITHOUT_FALLBACK_ERROR
1554
- sourceReference: SourceReference
1555
- }
1556
- export interface MissingFallbackOrReceiveErrorStackTraceEntry {
1557
- type: StackTraceEntryType.MISSING_FALLBACK_OR_RECEIVE_ERROR
1558
- sourceReference: SourceReference
1559
- }
1560
- export interface ReturndataSizeErrorStackTraceEntry {
1561
- type: StackTraceEntryType.RETURNDATA_SIZE_ERROR
1562
- sourceReference: SourceReference
1563
1759
  }
1564
- export interface NonContractAccountCalledErrorStackTraceEntry {
1565
- type: StackTraceEntryType.NONCONTRACT_ACCOUNT_CALLED_ERROR
1566
- sourceReference: SourceReference
1760
+
1761
+ /** Configuration for subscriptions. */
1762
+ export interface SubscriptionConfig {
1763
+ /** Callback to be called when a new event is received. */
1764
+ subscriptionCallback: (arg: SubscriptionEvent) => void
1567
1765
  }
1568
- export interface CallFailedErrorStackTraceEntry {
1569
- type: StackTraceEntryType.CALL_FAILED_ERROR
1570
- sourceReference: SourceReference
1766
+
1767
+ export interface SubscriptionEvent {
1768
+ filterId: bigint
1769
+ result: unknown
1571
1770
  }
1572
- export interface DirectLibraryCallErrorStackTraceEntry {
1573
- type: StackTraceEntryType.DIRECT_LIBRARY_CALL_ERROR
1574
- sourceReference: SourceReference
1771
+
1772
+ /** The possible reasons for successful termination of the EVM. */
1773
+ export declare enum SuccessReason {
1774
+ /** The opcode `STOP` was called */
1775
+ Stop = 0,
1776
+ /** The opcode `RETURN` was called */
1777
+ Return = 1,
1778
+ /** The opcode `SELFDESTRUCT` was called */
1779
+ SelfDestruct = 2
1575
1780
  }
1576
- export interface UnrecognizedCreateErrorStackTraceEntry {
1577
- type: StackTraceEntryType.UNRECOGNIZED_CREATE_ERROR
1578
- returnData: Uint8Array
1579
- sourceReference?: undefined
1580
- isInvalidOpcodeError: boolean
1781
+
1782
+ /** The result when the EVM terminates successfully. */
1783
+ export interface SuccessResult {
1784
+ /** The reason for termination */
1785
+ reason: SuccessReason
1786
+ /** The amount of gas used */
1787
+ gasUsed: bigint
1788
+ /** The amount of gas refunded */
1789
+ gasRefunded: bigint
1790
+ /** The logs */
1791
+ logs: Array<ExecutionLog>
1792
+ /** The transaction output */
1793
+ output: CallOutput | CreateOutput
1581
1794
  }
1582
- export interface UnrecognizedContractErrorStackTraceEntry {
1583
- type: StackTraceEntryType.UNRECOGNIZED_CONTRACT_ERROR
1584
- address: Uint8Array
1585
- returnData: Uint8Array
1586
- sourceReference?: undefined
1587
- isInvalidOpcodeError: boolean
1795
+
1796
+ /**
1797
+ * See [`edr_solidity_tests::result::SuiteResult`]
1798
+ *
1799
+ * `#[napi(object)]` (POJO) rather than `#[napi]` class because there are no
1800
+ * methods, and consumers (e.g. Hardhat's solidity-test reporter) read
1801
+ * `.testResults` multiple times per suite. As a class, each read would
1802
+ * re-clone the entire `Vec<TestResult>`; as an object, the data is serialized
1803
+ * to a plain JS object once when the suite-completion TSFN fires.
1804
+ *
1805
+ * `object_from_js = false`: napi-derive's default for `#[napi(object)]` emits
1806
+ * both `ToNapiValue` and `FromNapiValue`. We never receive a `SuiteResult`
1807
+ * from JS (it's only ever constructed Rust-side and pushed through the
1808
+ * progress TSFN), and the `Vec<TestResult>` field can't satisfy
1809
+ * `FromNapiValue` because `TestResult` is a `#[napi]` class and not a POJO.
1810
+ * Disabling the from-JS direction lets the to-JS direction compile cleanly.
1811
+ */
1812
+ export interface SuiteResult {
1813
+ /**
1814
+ * The artifact id can be used to match input to result in the progress
1815
+ * callback.
1816
+ */
1817
+ id: ArtifactId
1818
+ /** See [`edr_solidity_tests::result::SuiteResult::duration`]. */
1819
+ durationNs: bigint
1820
+ /** See [`edr_solidity_tests::result::SuiteResult::test_results`]. */
1821
+ testResults: Array<TestResult>
1822
+ /** See [`edr_solidity_tests::result::SuiteResult::warnings`]. */
1823
+ warnings: Array<string>
1588
1824
  }
1589
- export interface OtherExecutionErrorStackTraceEntry {
1590
- type: StackTraceEntryType.OTHER_EXECUTION_ERROR
1591
- sourceReference?: SourceReference
1825
+
1826
+ export const TANGERINE: string
1827
+
1828
+ /** Test function level config override. */
1829
+ export interface TestFunctionConfigOverride {
1830
+ /**
1831
+ * Allow expecting reverts with `expectRevert` at the same callstack depth
1832
+ * as the test.
1833
+ */
1834
+ allowInternalExpectRevert?: boolean
1835
+ /**
1836
+ * Whether to enable isolation of calls for the test. In isolation mode all
1837
+ * top-level calls are executed as a separate transaction in a separate
1838
+ * EVM context, enabling more precise gas accounting and transaction
1839
+ * state changes.
1840
+ * Ignored when gas reporting is enabled, as isolation is required for
1841
+ * accurate gas measurements.
1842
+ */
1843
+ isolate?: boolean
1844
+ /**
1845
+ * The EVM version to use for this test, e.g. "Cancun". This will override
1846
+ * the global EVM version.
1847
+ */
1848
+ evmVersion?: string
1849
+ /** Configuration override for fuzz testing. */
1850
+ fuzz?: FuzzConfigOverride
1851
+ /** Configuration override for invariant testing. */
1852
+ invariant?: InvariantConfigOverride
1592
1853
  }
1593
- export interface UnmappedSolc063RevertErrorStackTraceEntry {
1594
- type: StackTraceEntryType.UNMAPPED_SOLC_0_6_3_REVERT_ERROR
1595
- sourceReference?: SourceReference
1854
+
1855
+ /** Test function identifier. */
1856
+ export interface TestFunctionIdentifier {
1857
+ /** The contract artifact id. */
1858
+ contractArtifact: ArtifactId
1859
+ /** The function selector as hex string. */
1860
+ functionSelector: string
1596
1861
  }
1597
- export interface ContractTooLargeErrorStackTraceEntry {
1598
- type: StackTraceEntryType.CONTRACT_TOO_LARGE_ERROR
1599
- sourceReference?: SourceReference
1862
+
1863
+ /** Test function override configuration. */
1864
+ export interface TestFunctionOverride {
1865
+ /** The test function identifier. */
1866
+ identifier: TestFunctionIdentifier
1867
+ /** The configuration override. */
1868
+ config: TestFunctionConfigOverride
1600
1869
  }
1601
- export interface InternalFunctionCallStackEntry {
1602
- type: StackTraceEntryType.INTERNAL_FUNCTION_CALLSTACK_ENTRY
1603
- pc: number
1604
- sourceReference: SourceReference
1870
+
1871
+ /** The result of a test execution. */
1872
+ export declare enum TestStatus {
1873
+ /** Test success */
1874
+ Success = 'Success',
1875
+ /** Test failure */
1876
+ Failure = 'Failure',
1877
+ /** Test skipped */
1878
+ Skipped = 'Skipped'
1605
1879
  }
1606
- export interface ContractCallRunOutOfGasError {
1607
- type: StackTraceEntryType.CONTRACT_CALL_RUN_OUT_OF_GAS_ERROR
1608
- sourceReference?: SourceReference
1880
+
1881
+ /**
1882
+ * Timeout configuration.
1883
+ * Note: This wrapper is needed to avoid ambiguity with NAPI conversion.
1884
+ */
1885
+ export interface TimeoutConfig {
1886
+ /** Optional timeout (in seconds). */
1887
+ time?: number
1609
1888
  }
1610
- export interface CheatcodeErrorStackTraceEntry {
1611
- type: StackTraceEntryType.CHEATCODE_ERROR
1612
- message: string
1613
- sourceReference: SourceReference
1614
- details?: CheatcodeErrorDetails
1889
+
1890
+ /** Tracing config for Solidity stack trace generation. */
1891
+ export interface TracingConfigWithBuffers {
1892
+ /**
1893
+ * Build information to use for decoding contracts. Either a Hardhat v2
1894
+ * build info file that contains both input and output or a Hardhat v3
1895
+ * build info file that doesn't contain output and a separate output file.
1896
+ */
1897
+ buildInfos?: Array<Uint8Array> | Array<BuildInfoAndOutput>
1898
+ /** Whether to ignore contracts whose name starts with "Ignored". */
1899
+ ignoreContracts?: boolean
1615
1900
  }
1901
+
1616
1902
  export interface TracingMessage {
1617
1903
  /** Sender address */
1618
1904
  readonly caller: Uint8Array
@@ -1636,6 +1922,12 @@ export interface TracingMessage {
1636
1922
  /** Code of the contract that is being executed. */
1637
1923
  readonly code?: Uint8Array
1638
1924
  }
1925
+
1926
+ export interface TracingMessageResult {
1927
+ /** Execution result */
1928
+ readonly executionResult: ExecutionResult
1929
+ }
1930
+
1639
1931
  export interface TracingStep {
1640
1932
  /** Call depth */
1641
1933
  readonly depth: number
@@ -1652,174 +1944,105 @@ export interface TracingStep {
1652
1944
  /** The memory at the step. None if verbose tracing is disabled. */
1653
1945
  readonly memory?: Uint8Array
1654
1946
  }
1655
- export interface TracingMessageResult {
1656
- /** Execution result */
1657
- readonly executionResult: ExecutionResult
1658
- }
1659
- export interface Withdrawal {
1660
- /** The index of withdrawal */
1661
- index: bigint
1662
- /** The index of the validator that generated the withdrawal */
1663
- validatorIndex: bigint
1664
- /** The recipient address for withdrawal value */
1665
- address: Uint8Array
1666
- /** The value contained in withdrawal */
1667
- amount: bigint
1947
+
1948
+ /** We couldn't generate stack traces, because an unexpected error occurred. */
1949
+ export interface UnexpectedError {
1950
+ /** Enum tag for JS. */
1951
+ kind: "UnexpectedError"
1952
+ /** The error message from the unexpected error. */
1953
+ errorMessage: string
1668
1954
  }
1669
- export declare class EdrContext {
1670
- /** Creates a new [`EdrContext`] instance. Should only be called once! */
1671
- constructor()
1672
- /** Constructs a new provider with the provided configuration. */
1673
- createProvider(chainType: string, providerConfig: ProviderConfig, loggerConfig: LoggerConfig, subscriptionConfig: SubscriptionConfig, contractDecoder: ContractDecoder): Promise<Provider>
1674
- /** Registers a new provider factory for the provided chain type. */
1675
- registerProviderFactory(chainType: string, factory: ProviderFactory): Promise<void>
1676
- registerSolidityTestRunnerFactory(chainType: string, factory: SolidityTestRunnerFactory): Promise<void>
1677
- /**
1678
- * Executes Solidity tests
1679
- *
1680
- * The function will return a promise that resolves to a
1681
- * [`SolidityTestResult`].
1682
- *
1683
- * Arguments:
1684
- * - `chainType`: the same chain type that was passed to
1685
- * `registerProviderFactory`.
1686
- * - `artifacts`: the project's compilation output artifacts. It's
1687
- * important to include include all artifacts here, otherwise cheatcodes
1688
- * that access artifacts and other functionality (e.g. auto-linking, gas
1689
- * reports) can break.
1690
- * - `testSuites`: the test suite ids that specify which test suites to
1691
- * execute. The test suite artifacts must be present in `artifacts`.
1692
- * - `configArgs`: solidity test runner configuration. See the struct docs
1693
- * for details.
1694
- * - `tracingConfig`: the build infos used for stack trace generation.
1695
- * These are lazily parsed and it's important that they're passed as
1696
- * Uint8 arrays for performance.
1697
- * - `onTestSuiteCompletedCallback`: The progress callback will be called
1698
- * with the results of each test suite as soon as it finished executing.
1699
- */
1700
- runSolidityTests(chainType: string, artifacts: Array<Artifact>, testSuites: Array<ArtifactId>, configArgs: SolidityTestRunnerConfigArgs, tracingConfig: TracingConfigWithBuffers, onTestSuiteCompletedCallback: (result: SuiteResult) => void): Promise<SolidityTestResult>
1955
+
1956
+ export const UNKNOWN_FUNCTION_NAME: string
1957
+
1958
+ export interface UnmappedSolc063RevertErrorStackTraceEntry {
1959
+ type: StackTraceEntryType.UNMAPPED_SOLC_0_6_3_REVERT_ERROR
1960
+ sourceReference?: SourceReference
1701
1961
  }
1702
- export declare class ContractDecoder {
1703
- /**Creates an empty instance. */
1704
- constructor()
1705
- /**Creates a new instance with the provided configuration. */
1706
- static withContracts(config: TracingConfigWithBuffers): ContractDecoder
1962
+
1963
+ export const UNRECOGNIZED_CONTRACT_NAME: string
1964
+
1965
+ export const UNRECOGNIZED_FUNCTION_NAME: string
1966
+
1967
+ export interface UnrecognizedContractCallstackEntryStackTraceEntry {
1968
+ type: StackTraceEntryType.UNRECOGNIZED_CONTRACT_CALLSTACK_ENTRY
1969
+ address: Uint8Array
1970
+ sourceReference?: undefined
1707
1971
  }
1708
- export declare class Precompile {
1709
- /** Returns the address of the precompile. */
1710
- get address(): Uint8Array
1972
+
1973
+ export interface UnrecognizedContractErrorStackTraceEntry {
1974
+ type: StackTraceEntryType.UNRECOGNIZED_CONTRACT_ERROR
1975
+ address: Uint8Array
1976
+ returnData: Uint8Array
1977
+ sourceReference?: undefined
1978
+ isInvalidOpcodeError: boolean
1711
1979
  }
1712
- export declare class ProviderFactory { }
1713
- export declare class Response {
1714
- /**Returns the response data as a JSON string or a JSON object. */
1715
- get data(): string | any
1716
- /**Compute the error stack trace. Return the stack trace if it can be decoded, otherwise returns none. Throws if there was an error computing the stack trace. */
1717
- stackTrace(): StackTrace | UnexpectedError | HeuristicFailed | null
1718
- /**
1719
- * Constructs the execution traces for the request. Returns an empty array
1720
- * if traces are not enabled for this provider according to
1721
- * [`crate::solidity_tests::config::SolidityTestRunnerConfigArgs::include_traces`]. Otherwise, returns
1722
- * an array of the root calls of the trace, which always includes the
1723
- * request's call itself.
1724
- */
1725
- callTraces(): Array<CallTrace>
1980
+
1981
+ export interface UnrecognizedCreateCallstackEntryStackTraceEntry {
1982
+ type: StackTraceEntryType.UNRECOGNIZED_CREATE_CALLSTACK_ENTRY
1983
+ sourceReference?: undefined
1726
1984
  }
1727
- /** A JSON-RPC provider for Ethereum. */
1728
- export declare class Provider {
1729
- /**
1730
- *Adds a compilation result to the instance.
1731
- *
1732
- *For internal use only. Support for this method may be removed in the future.
1733
- */
1734
- addCompilationResult(solcVersion: string, compilerInput: any, compilerOutput: any): Promise<void>
1735
- /**Retrieves the instance's contract decoder. */
1736
- contractDecoder(): ContractDecoder
1737
- /**Handles a JSON-RPC request and returns a JSON-RPC response. */
1738
- handleRequest(request: string): Promise<Response>
1739
- setCallOverrideCallback(callOverrideCallback: (contract_address: ArrayBuffer, data: ArrayBuffer) => Promise<CallOverrideResult | undefined>): Promise<void>
1740
- /**
1741
- * Set to `true` to make the traces returned with `eth_call`,
1742
- * `eth_estimateGas`, `eth_sendRawTransaction`, `eth_sendTransaction`,
1743
- * `evm_mine`, `hardhat_mine` include the full stack and memory. Set to
1744
- * `false` to disable this.
1745
- */
1746
- setVerboseTracing(verboseTracing: boolean): Promise<void>
1985
+
1986
+ export interface UnrecognizedCreateErrorStackTraceEntry {
1987
+ type: StackTraceEntryType.UNRECOGNIZED_CREATE_ERROR
1988
+ returnData: Uint8Array
1989
+ sourceReference?: undefined
1990
+ isInvalidOpcodeError: boolean
1747
1991
  }
1748
- export declare class SolidityTestRunnerFactory { }
1749
- /** See [`edr_solidity_tests::result::SuiteResult`] */
1750
- export declare class SuiteResult {
1751
- /**
1752
- * The artifact id can be used to match input to result in the progress
1753
- * callback
1754
- */
1755
- readonly id: ArtifactId
1756
- /** See [`edr_solidity_tests::result::SuiteResult::duration`] */
1757
- readonly durationNs: bigint
1758
- /** See [`edr_solidity_tests::result::SuiteResult::test_results`] */
1759
- readonly testResults: Array<TestResult>
1760
- /** See [`edr_solidity_tests::result::SuiteResult::warnings`] */
1761
- readonly warnings: Array<string>
1992
+
1993
+ export interface UnrecognizedFunctionWithoutFallbackErrorStackTraceEntry {
1994
+ type: StackTraceEntryType.UNRECOGNIZED_FUNCTION_WITHOUT_FALLBACK_ERROR
1995
+ sourceReference: SourceReference
1762
1996
  }
1763
- /** See [`edr_solidity_tests::result::TestResult`] */
1764
- export declare class TestResult {
1765
- /** The name of the test. */
1766
- readonly name: string
1767
- /** See [`edr_solidity_tests::result::TestResult::status`] */
1768
- readonly status: TestStatus
1769
- /** See [`edr_solidity_tests::result::TestResult::reason`] */
1770
- readonly reason?: string
1771
- /** See [`edr_solidity_tests::result::TestResult::counterexample`] */
1772
- readonly counterexample?: BaseCounterExample | CounterExampleSequence
1773
- /** See [`edr_solidity_tests::result::TestResult::decoded_logs`] */
1774
- readonly decodedLogs: Array<string>
1775
- /** See [`edr_solidity_tests::result::TestResult::kind`] */
1776
- readonly kind: StandardTestKind | FuzzTestKind | InvariantTestKind
1777
- /** See [`edr_solidity_tests::result::TestResult::duration`] */
1778
- readonly durationNs: bigint
1779
- /**
1780
- * Groups of value snapshot entries (incl. gas).
1781
- *
1782
- * Only present if the test runner collected scoped snapshots. Currently,
1783
- * this is always the case.
1784
- */
1785
- readonly valueSnapshotGroups?: Array<ValueSnapshotGroup>
1997
+
1998
+ /**
1999
+ * We couldn't generate stack traces, because the test execution is unsafe to
2000
+ * replay due to indeterminism. This can be caused by either specifying a fork
2001
+ * url without a fork block number in the test runner config or using impure
2002
+ * cheatcodes.
2003
+ */
2004
+ export interface UnsafeToReplay {
2005
+ /** Enum tag for JS. */
2006
+ kind: "UnsafeToReplay"
1786
2007
  /**
1787
- * Compute the error stack trace.
1788
- * The result is either the stack trace or the reason why we couldn't
1789
- * generate the stack trace.
1790
- * Returns null if the test status is succeeded or skipped.
1791
- * Cannot throw.
2008
+ * Indeterminism due to specifying a fork url without a fork block number
2009
+ * in the test runner config.
1792
2010
  */
1793
- stackTrace(): StackTrace | UnexpectedError | HeuristicFailed | UnsafeToReplay | null
2011
+ globalForkLatest: boolean
1794
2012
  /**
1795
- * Constructs the execution traces for the test. Returns an empty array if
1796
- * traces for this test were not requested according to
1797
- * [`crate::solidity_tests::config::SolidityTestRunnerConfigArgs::include_traces`]. Otherwise, returns
1798
- * an array of the root calls of the trace, which always includes the test
1799
- * call itself and may also include the setup call if there is one
1800
- * (identified by the function name `setUp`).
2013
+ * The list of executed impure cheatcode signatures. We collect function
2014
+ * signatures instead of function names as whether a cheatcode is impure
2015
+ * can depend on the arguments it takes (e.g. `createFork` without a second
2016
+ * argument means implicitly fork from “latest”). Example signature:
2017
+ * `function createSelectFork(string calldata urlOrAlias) external returns
2018
+ * (uint256 forkId);`.
1801
2019
  */
1802
- callTraces(): Array<CallTrace>
2020
+ impureCheatcodes: Array<string>
1803
2021
  }
1804
- export declare class Exit {
1805
- get kind(): ExitCode
1806
- isError(): boolean
1807
- getReason(): string
2022
+
2023
+ /** An entry in a value snapshot group. */
2024
+ export interface ValueSnapshotEntry {
2025
+ /** The name of the entry. */
2026
+ name: string
2027
+ /** The value of the entry. */
2028
+ value: string
1808
2029
  }
1809
- /**
1810
- * Opaque handle to the `Bytecode` struct.
1811
- * Only used on the JS side by the `VmTraceDecoder` class.
1812
- */
1813
- export declare class BytecodeWrapper { }
1814
- export declare class ReturnData {
1815
- readonly value: Uint8Array
1816
- constructor(value: Uint8Array)
1817
- isEmpty(): boolean
1818
- isErrorReturnData(): boolean
1819
- isPanicReturnData(): boolean
1820
- decodeError(): string
1821
- decodePanic(): bigint
2030
+
2031
+ /** A grouping of value snapshot entries for a test. */
2032
+ export interface ValueSnapshotGroup {
2033
+ /** The group name. */
2034
+ name: string
2035
+ /** The entries in the group. */
2036
+ entries: Array<ValueSnapshotEntry>
1822
2037
  }
1823
- export declare class RawTrace {
1824
- get trace(): Array<TracingMessage | TracingStep | TracingMessageResult>
2038
+
2039
+ export interface Withdrawal {
2040
+ /** The index of withdrawal */
2041
+ index: bigint
2042
+ /** The index of the validator that generated the withdrawal */
2043
+ validatorIndex: bigint
2044
+ /** The recipient address for withdrawal value */
2045
+ address: Uint8Array
2046
+ /** The value contained in withdrawal */
2047
+ amount: bigint
1825
2048
  }