@nomicfoundation/edr 0.12.1 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.d.ts +1641 -1412
  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,283 +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
- * Controls whether to generate a gas report after running the tests.
841
- * Enabling this also enables collection of all traces and EVM isolation
842
- * mode.
843
- * Defaults to false.
844
- */
845
- generateGasReport?: boolean
846
- /**
847
- * Test function level config overrides.
848
- * Defaults to none.
849
- */
850
- testFunctionOverrides?: Array<TestFunctionOverride>
851
- /**
852
- * A list of EIP-712 canonical type definitions that can be referenced by
853
- * type name in the `eip712HashType` and `eip712HashStruct` cheatcodes.
854
- *
855
- * Each entry is an independent, self-contained type definition. A
856
- * definition that references nested struct types must inline those
857
- * struct definitions, per the EIP-712 `encodeType` spec.
858
- *
859
- * Only the primary (leftmost) type of each entry is registered by name.
860
- * Nested struct types referenced inside an entry are *not* registered
861
- * under their own names. To look up a nested struct by name from a
862
- * cheatcode, add it as a separate top-level entry whose primary type
863
- * is the nested struct.
864
- *
865
- * The type of a struct is encoded as:
866
- *
867
- * `name ‖ "(" ‖ member₁ ‖ "," ‖ member₂ ‖ "," ‖ … ‖ memberₙ ")"`
868
- *
869
- * where each member is written as `type ‖ " " ‖ name`.
870
- *
871
- * Entries that fail to parse cause a startup error listing every bad
872
- * entry.
873
- *
874
- * Example — to make both `Mail` and `Person` reachable by name:
875
- *
876
- * ```text
877
- * "Mail(Person from,Person to,string contents)Person(address wallet,string name)"
878
- * "Person(address wallet,string name)"
879
- * ```
880
- *
881
- * With *only* the first entry, `vm.eip712HashType("Mail")` works but
882
- * `vm.eip712HashType("Person")` fails with an unknown-type error.
883
- */
884
- 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
885
732
  }
733
+
886
734
  /** Fuzz testing configuration */
887
735
  export interface FuzzConfigArgs {
888
736
  /** Path where fuzz failures are recorded and replayed if set. */
@@ -938,23 +786,208 @@ export interface FuzzConfigArgs {
938
786
  */
939
787
  timeout?: number
940
788
  }
941
- /** Invariant testing configuration. */
942
- export interface InvariantConfigArgs {
943
- /** Path where invariant failures are recorded and replayed if set. */
944
- failurePersistDir?: string
945
- /**
946
- * The number of runs that must execute for each invariant test group.
947
- * Defaults to 256.
948
- */
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. */
949
793
  runs?: number
950
794
  /**
951
- * The number of calls executed to attempt to break invariants in one run.
952
- * Defaults to 500.
953
- */
954
- depth?: number
955
- /**
956
- * Fails the invariant fuzzing if a revert occurs.
957
- * Defaults to false.
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.
990
+ * Defaults to false.
958
991
  */
959
992
  failOnRevert?: boolean
960
993
  /**
@@ -999,454 +1032,678 @@ export interface InvariantConfigArgs {
999
1032
  */
1000
1033
  timeout?: number
1001
1034
  }
1002
- /** Settings to configure caching of remote RPC endpoints. */
1003
- 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
1004
1044
  /**
1005
- * Chains to cache. Either all or none or a list of chain names, e.g.
1006
- * ["optimism", "mainnet"].
1045
+ * Allows overriding an unsafe external call when running invariant tests.
1046
+ * eg. reentrancy checks
1007
1047
  */
1008
- chains: CachedChains | Array<string>
1009
- /** Endpoints to cache. Either all or remote or a regex. */
1010
- endpoints: CachedEndpoints | string
1011
- }
1012
- /** What chains to cache */
1013
- export enum CachedChains {
1014
- /** Cache all chains */
1015
- All = 0,
1016
- /** Don't cache anything */
1017
- None = 1
1048
+ callOverride?: boolean
1049
+ /** Optional timeout (in seconds) for each invariant test. */
1050
+ timeout?: TimeoutConfig
1018
1051
  }
1019
- /** What endpoints to enable caching for */
1020
- export enum CachedEndpoints {
1021
- /** Cache all endpoints */
1022
- All = 0,
1023
- /** Only cache non-local host endpoints */
1024
- 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
1025
1058
  }
1026
- /** Represents an access permission to a single path */
1027
- export interface PathPermission {
1028
- /** Permission level to access the `path` */
1029
- access: FsAccessPermission
1030
- /** The targeted path guarded by the permission */
1031
- path: string
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
1032
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
+
1033
1082
  /**
1034
- * Determines the level of file system access for the given path.
1083
+ * Tries to parse the provided string to create a [`SpecId`] instance.
1035
1084
  *
1036
- * Exact path matching is used for file permissions. Prefix matching is used
1037
- * for directory permissions.
1085
+ * Returns an error if the string does not match any known hardfork.
1086
+ */
1087
+ export declare function l1HardforkFromString(hardfork: string): SpecId
1088
+
1089
+ /**
1090
+ * Returns the latest supported OP hardfork.
1038
1091
  *
1039
- * Giving write access to configuration files, source files or executables
1040
- * in a project is considered dangerous, because it can be used by malicious
1041
- * Solidity dependencies to escape the EVM sandbox. It is therefore
1042
- * recommended to give write access to specific safe files only. If write
1043
- * access to a directory is needed, please make sure that it doesn't contain
1044
- * configuration files, source files or executables neither in the top level
1045
- * directory, nor in any subdirectories.
1046
- */
1047
- export enum FsAccessPermission {
1048
- /** Allows reading and writing the file */
1049
- ReadWriteFile = 0,
1050
- /** Only allows reading the file */
1051
- ReadFile = 1,
1052
- /** Only allows writing the file */
1053
- WriteFile = 2,
1054
- /**
1055
- * Allows reading and writing all files in the directory and its
1056
- * subdirectories
1057
- */
1058
- DangerouslyReadWriteDirectory = 3,
1059
- /** Allows reading all files in the directory and its subdirectories */
1060
- ReadDirectory = 4,
1061
- /** Allows writing all files in the directory and its subdirectories */
1062
- DangerouslyWriteDirectory = 5
1063
- }
1064
- export interface AddressLabel {
1065
- /** The address to label */
1066
- address: Uint8Array
1067
- /** The label to assign to the address */
1068
- label: string
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
1069
1110
  }
1070
- /** A type that controls when stack traces are collected. */
1071
- export enum CollectStackTraces {
1072
- /** Always collects stack traces, adding performance overhead. */
1073
- Always = 0,
1111
+
1112
+ /** Configuration for a locally mined blockchain. */
1113
+ export interface LocalConfig {
1074
1114
  /**
1075
- * Only collects stack traces upon failure, re-executing the test. This
1076
- * minimizes performance overhead.
1115
+ * The blob gas used for the genesis block, introduced in [EIP-4844].
1077
1116
  *
1078
- * Not all tests can be re-executed since certain cheatcodes contain
1079
- * non-deterministic side-effects.
1117
+ * [EIP-4844]: https://eips.ethereum.org/EIPS/eip-4844
1080
1118
  */
1081
- OnFailure = 1
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
1082
1124
  }
1083
- /**
1084
- * Configuration that controls whether execution traces are decoded and
1085
- * included in results.
1086
- *
1087
- * This can either be for Solidity test results or provider transaction
1088
- * execution results.
1089
- */
1090
- export enum IncludeTraces {
1091
- /** No traces will be included at all. */
1092
- None = 0,
1093
- /**
1094
- * Traces will be included only on the results of failed tests or
1095
- * execution.
1096
- */
1097
- Failing = 1,
1098
- /** Traces will be included for all test results or executed transactions. */
1099
- All = 2
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
1100
1132
  }
1101
- /** Test function level config override. */
1102
- export interface TestFunctionConfigOverride {
1103
- /**
1104
- * Allow expecting reverts with `expectRevert` at the same callstack depth
1105
- * as the test.
1106
- */
1107
- allowInternalExpectRevert?: boolean
1108
- /**
1109
- * Whether to enable isolation of calls for the test. In isolation mode all
1110
- * top-level calls are executed as a separate transaction in a separate
1111
- * EVM context, enabling more precise gas accounting and transaction
1112
- * state changes.
1113
- * Ignored when gas reporting is enabled, as isolation is required for
1114
- * accurate gas measurements.
1115
- */
1116
- isolate?: boolean
1133
+
1134
+ /** Kind marker for log traces. */
1135
+ export declare enum LogKind {
1136
+ /** Single kind of log. */
1137
+ Log = 5
1138
+ }
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
1117
1144
  /**
1118
- * The EVM version to use for this test, e.g. "Cancun". This will override
1119
- * the global EVM version.
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.
1120
1150
  */
1121
- evmVersion?: string
1122
- /** Configuration override for fuzz testing. */
1123
- fuzz?: FuzzConfigOverride
1124
- /** Configuration override for invariant testing. */
1125
- invariant?: InvariantConfigOverride
1126
- }
1127
- /** Test function override configuration. */
1128
- export interface TestFunctionOverride {
1129
- /** The test function identifier. */
1130
- identifier: TestFunctionIdentifier
1131
- /** The configuration override. */
1132
- config: TestFunctionConfigOverride
1151
+ parameters: DecodedTraceParameters | Array<Uint8Array>
1133
1152
  }
1134
- /** Test function identifier. */
1135
- export interface TestFunctionIdentifier {
1136
- /** The contract artifact id. */
1137
- contractArtifact: ArtifactId
1138
- /** The function selector as hex string. */
1139
- functionSelector: string
1153
+
1154
+ export const LONDON: string
1155
+
1156
+ /** Configuration for the provider's mempool. */
1157
+ export interface MemPoolConfig {
1158
+ order: MineOrdering
1140
1159
  }
1141
- /**
1142
- * Timeout configuration.
1143
- * Note: This wrapper is needed to avoid ambiguity with NAPI conversion.
1144
- */
1145
- export interface TimeoutConfig {
1146
- /** Optional timeout (in seconds). */
1147
- time?: number
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'
1148
1169
  }
1149
- /** Test function or test contract level fuzz config override. */
1150
- export interface FuzzConfigOverride {
1151
- /** The number of test cases that must execute for each property test. */
1152
- runs?: number
1170
+
1171
+ /** Configuration for the provider's miner. */
1172
+ export interface MiningConfig {
1173
+ autoMine: boolean
1153
1174
  /**
1154
- * The maximum number of test case rejections allowed by proptest, to be
1155
- * encountered during usage of `vm.assume` cheatcode. This will be used
1156
- * to set the `max_global_rejects` value in proptest test runner config.
1157
- * `max_local_rejects` option isn't exposed here since we're not using
1158
- * `prop_filter`.
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.
1159
1179
  */
1160
- maxTestRejects?: number
1161
- /** show `console.log` in fuzz test, defaults to `false`. */
1162
- showLogs?: boolean
1163
- /** Optional timeout (in seconds) for each property test. */
1164
- timeout?: TimeoutConfig
1180
+ blockGasLimit?: bigint
1181
+ interval?: bigint | IntervalRange
1182
+ memPool: MemPoolConfig
1165
1183
  }
1166
- /** Test function or test contract level invariant config override. */
1167
- export interface InvariantConfigOverride {
1168
- /** The number of runs that must execute for each invariant test group. */
1169
- runs?: number
1170
- /** The number of calls executed to attempt to break invariants in one run. */
1171
- depth?: number
1172
- /** Fails the invariant fuzzing if a revert occurs. */
1173
- failOnRevert?: boolean
1184
+
1185
+ export interface MissingFallbackOrReceiveErrorStackTraceEntry {
1186
+ type: StackTraceEntryType.MISSING_FALLBACK_OR_RECEIVE_ERROR
1187
+ sourceReference: SourceReference
1188
+ }
1189
+
1190
+ export const MUIR_GLACIER: string
1191
+
1192
+ export interface NonContractAccountCalledErrorStackTraceEntry {
1193
+ type: StackTraceEntryType.NONCONTRACT_ACCOUNT_CALLED_ERROR
1194
+ sourceReference: SourceReference
1195
+ }
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
1174
1203
  /**
1175
- * Allows overriding an unsafe external call when running invariant tests.
1176
- * eg. reentrancy checks
1204
+ * Controls when to include call traces in the results of transaction
1205
+ * execution.
1206
+ *
1207
+ * Defaults to `IncludeTraces.None`.
1177
1208
  */
1178
- callOverride?: boolean
1179
- /** Optional timeout (in seconds) for each invariant test. */
1180
- timeout?: TimeoutConfig
1181
- }
1182
- export declare function l1SolidityTestRunnerFactory(): SolidityTestRunnerFactory
1183
- export declare function opSolidityTestRunnerFactory(): SolidityTestRunnerFactory
1184
- /** A grouping of value snapshot entries for a test. */
1185
- export interface ValueSnapshotGroup {
1186
- /** The group name. */
1187
- name: string
1188
- /** The entries in the group. */
1189
- entries: Array<ValueSnapshotEntry>
1209
+ includeCallTraces?: IncludeTraces
1190
1210
  }
1191
- /** An entry in a value snapshot group. */
1192
- export interface ValueSnapshotEntry {
1193
- /** The name of the entry. */
1194
- name: string
1195
- /** The value of the entry. */
1196
- value: string
1197
- }
1198
- /** The stack trace result */
1199
- export interface StackTrace {
1200
- /** Enum tag for JS. */
1201
- kind: "StackTrace"
1202
- /** The stack trace entries */
1203
- entries: Array<SolidityStackTraceEntry>
1204
- }
1205
- /** We couldn't generate stack traces, because an unexpected error occurred. */
1206
- export interface UnexpectedError {
1207
- /** Enum tag for JS. */
1208
- kind: "UnexpectedError"
1209
- /** The error message from the unexpected error. */
1210
- 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
1211
1226
  }
1227
+
1212
1228
  /**
1213
- * We couldn't generate stack traces, because the stack trace generation
1214
- * 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.
1215
1233
  */
1216
- export interface HeuristicFailed {
1217
- /** Enum tag for JS. */
1218
- kind: "HeuristicFailed"
1219
- }
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
+
1220
1239
  /**
1221
- * We couldn't generate stack traces, because the test execution is unsafe to
1222
- * replay due to indeterminism. This can be caused by either specifying a fork
1223
- * url without a fork block number in the test runner config or using impure
1224
- * cheatcodes.
1240
+ * Returns the latest supported OP hardfork.
1241
+ *
1242
+ * The returned value will be updated after each network upgrade.
1225
1243
  */
1226
- export interface UnsafeToReplay {
1227
- /** Enum tag for JS. */
1228
- kind: "UnsafeToReplay"
1229
- /**
1230
- * Indeterminism due to specifying a fork url without a fork block number
1231
- * in the test runner config.
1232
- */
1233
- globalForkLatest: boolean
1234
- /**
1235
- * The list of executed impure cheatcode signatures. We collect function
1236
- * signatures instead of function names as whether a cheatcode is impure
1237
- * can depend on the arguments it takes (e.g. `createFork` without a second
1238
- * argument means implicitly fork from “latest”). Example signature:
1239
- * `function createSelectFork(string calldata urlOrAlias) external returns
1240
- * (uint256 forkId);`.
1241
- */
1242
- impureCheatcodes: Array<string>
1243
- }
1244
- /**The result of a test execution. */
1245
- export enum TestStatus {
1246
- /**Test success */
1247
- Success = 'Success',
1248
- /**Test failure */
1249
- Failure = 'Failure',
1250
- /**Test skipped */
1251
- Skipped = 'Skipped'
1252
- }
1253
- /** See [`edr_solidity_tests::result::TestKind::Unit`] */
1254
- export interface StandardTestKind {
1255
- /** The gas consumed by the test. */
1256
- readonly consumedGas: bigint
1257
- }
1258
- /** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
1259
- export interface FuzzTestKind {
1260
- /** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
1261
- readonly runs: bigint
1262
- /** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
1263
- readonly meanGas: bigint
1264
- /** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
1265
- readonly medianGas: bigint
1266
- }
1267
- /** See [`edr_solidity_tests::fuzz::FuzzCase`] */
1268
- export interface FuzzCase {
1269
- /** The calldata used for this fuzz test */
1270
- readonly calldata: Uint8Array
1271
- /** Consumed gas */
1272
- readonly gas: bigint
1273
- /** The initial gas stipend for the transaction */
1274
- readonly stipend: bigint
1275
- }
1276
- /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
1277
- export interface InvariantTestKind {
1278
- /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
1279
- readonly runs: bigint
1280
- /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
1281
- readonly calls: bigint
1282
- /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
1283
- readonly reverts: bigint
1284
- /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
1285
- readonly metrics: Record<string, InvariantMetrics>
1286
- /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
1287
- 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
1288
1255
  }
1289
- /** See [`edr_solidity_tests::result::InvariantMetrics`] */
1290
- export interface InvariantMetrics {
1291
- readonly calls: bigint
1292
- readonly reverts: bigint
1293
- readonly discards: bigint
1256
+
1257
+ export interface PanicErrorStackTraceEntry {
1258
+ type: StackTraceEntryType.PANIC_ERROR
1259
+ errorCode: bigint
1260
+ sourceReference?: SourceReference
1294
1261
  }
1295
- /**
1296
- * Original sequence size and sequence of calls used as a counter example
1297
- * for invariant tests.
1298
- */
1299
- export interface CounterExampleSequence {
1300
- /** The original sequence size before shrinking. */
1301
- originalSequenceSize: bigint
1302
- /** The shrunk counterexample sequence. */
1303
- 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
1304
1269
  }
1305
- /** See [`edr_solidity_tests::fuzz::BaseCounterExample`] */
1306
- export interface BaseCounterExample {
1307
- /** See [`edr_solidity_tests::fuzz::BaseCounterExample::sender`] */
1308
- readonly sender?: Uint8Array
1309
- /** See [`edr_solidity_tests::fuzz::BaseCounterExample::addr`] */
1310
- readonly address?: Uint8Array
1311
- /** See [`edr_solidity_tests::fuzz::BaseCounterExample::calldata`] */
1312
- readonly calldata: Uint8Array
1313
- /** See [`edr_solidity_tests::fuzz::BaseCounterExample::contract_name`] */
1314
- readonly contractName?: string
1315
- /** See [`edr_solidity_tests::fuzz::BaseCounterExample::signature`] */
1316
- readonly signature?: string
1317
- /** See [`edr_solidity_tests::fuzz::BaseCounterExample::args`] */
1318
- 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
1319
1281
  }
1282
+
1320
1283
  /**
1321
- * Object representing a call in an execution trace, including contract
1322
- * creation.
1284
+ * [RIP-7212](https://github.com/ethereum/RIPs/blob/master/RIPS/rip-7212.md#specification)
1285
+ * secp256r1 precompile.
1323
1286
  */
1324
- export interface CallTrace {
1325
- /** The kind of call or contract creation this represents. */
1326
- kind: CallKind
1327
- /** Whether the call succeeded or reverted. */
1328
- success: boolean
1329
- /** Whether the call is a cheatcode. */
1330
- isCheatcode: boolean
1331
- /** The amount of gas that was consumed. */
1332
- gasUsed: bigint
1333
- /** The amount of native token that was included with the call. */
1334
- value: bigint
1335
- /** The target address of the call. */
1336
- address: string
1337
- /** The name of the contract that is the target of the call, if known. */
1338
- 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
1339
1301
  /**
1340
- * The input (calldata) to the call. If it encodes a known function call,
1341
- * it will be decoded into the function name and a list of arguments.
1342
- * For example, `{ name: "ownerOf", arguments: ["1"] }`. Note that the
1343
- * function name may also be any of the special `fallback` and `receive`
1344
- * 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.
1345
1310
  */
1346
- 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
1347
1316
  /**
1348
- * The output of the call. This will be a decoded human-readable
1349
- * representation of the value if the function is known, otherwise a
1350
- * 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.
1351
1319
  */
1352
- outputs: string | Uint8Array
1320
+ defaultTransactionGasLimit: bigint
1353
1321
  /**
1354
- * Interleaved subcalls and event logs. Use `kind` to check if each member
1355
- * 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.
1356
1324
  */
1357
- children: Array<CallTrace | LogTrace>
1358
- }
1359
- /** Object representing an event log in an execution trace. */
1360
- export interface LogTrace {
1361
- /** A constant to help discriminate the union `CallTrace | LogTrace`. */
1362
- 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
1363
1330
  /**
1364
- * If the log is a known event (based on its first topic), it will be
1365
- * decoded into the event name and list of named parameters. For
1366
- * example, `{ name: "Log", arguments: ["value: 1"] }`. Otherwise, it
1367
- * will be provided as an array where all but the last element are the
1368
- * 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
1369
1333
  */
1370
- parameters: DecodedTraceParameters | Array<Uint8Array>
1371
- }
1372
- /** The various kinds of call frames possible in the EVM. */
1373
- export enum CallKind {
1374
- /** Regular call that may change state. */
1375
- Call = 0,
1334
+ initialBaseFeePerGas?: bigint
1376
1335
  /**
1377
- * Variant of `DelegateCall` that doesn't preserve sender or value in the
1378
- * frame.
1336
+ * The initial parent beacon block root of the blockchain. Required for
1337
+ * EIP-4788
1379
1338
  */
1380
- CallCode = 1,
1381
- /** Call that executes the code of the target in the context of the caller. */
1382
- DelegateCall = 2,
1383
- /** Regular call that may not change state. */
1384
- StaticCall = 3,
1385
- /** Contract creation. */
1386
- Create = 4
1387
- }
1388
- /** Kind marker for log traces. */
1389
- export enum LogKind {
1390
- /** Single kind of log. */
1391
- Log = 5
1392
- }
1393
- /** Decoded function call or event. */
1394
- export interface DecodedTraceParameters {
1395
- /** The name of a function or an event. */
1396
- 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>
1397
1354
  /**
1398
- * The arguments of the function call or the event, in their human-readable
1399
- * 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
1400
1366
  */
1401
- 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
1402
1377
  }
1378
+
1379
+ export interface RevertErrorStackTraceEntry {
1380
+ type: StackTraceEntryType.REVERT_ERROR
1381
+ returnData: Uint8Array
1382
+ sourceReference: SourceReference
1383
+ isInvalidOpcodeError: boolean
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
+
1403
1404
  /** The result of a Solidity test run. */
1404
1405
  export interface SolidityTestResult {
1405
1406
  /** Gas report, if it was generated. */
1406
1407
  readonly gasReport?: GasReport
1407
1408
  }
1408
- /** Configuration for subscriptions. */
1409
- export interface SubscriptionConfig {
1410
- /** Callback to be called when a new event is received. */
1411
- 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>
1412
1639
  }
1413
- export interface SubscriptionEvent {
1414
- filterId: bigint
1415
- 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>
1416
1648
  }
1417
- export declare function linkHexStringBytecode(code: string, address: string, position: number): string
1418
- export declare function printStackTrace(trace: SolidityStackTrace): void
1419
- /** Represents the exit code of the EVM. */
1420
- export enum ExitCode {
1421
- /** Execution was successful. */
1422
- SUCCESS = 0,
1423
- /** Execution was reverted. */
1424
- REVERT = 1,
1425
- /** Execution ran out of gas. */
1426
- OUT_OF_GAS = 2,
1427
- /** Execution encountered an internal error. */
1428
- INTERNAL_ERROR = 3,
1429
- /** Execution encountered an invalid opcode. */
1430
- INVALID_OPCODE = 4,
1431
- /** Execution encountered a stack underflow. */
1432
- STACK_UNDERFLOW = 5,
1433
- /** Create init code size exceeds limit (runtime). */
1434
- CODESIZE_EXCEEDS_MAXIMUM = 6,
1435
- /** Create collision. */
1436
- CREATE_COLLISION = 7,
1437
- /** Unknown halt reason. */
1438
- 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
1439
1694
  }
1440
- export enum ContractFunctionType {
1441
- CONSTRUCTOR = 0,
1442
- FUNCTION = 1,
1443
- FALLBACK = 2,
1444
- RECEIVE = 3,
1445
- GETTER = 4,
1446
- MODIFIER = 5,
1447
- 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>
1448
1704
  }
1449
- export enum StackTraceEntryType {
1705
+
1706
+ export declare enum StackTraceEntryType {
1450
1707
  CALLSTACK_ENTRY = 0,
1451
1708
  UNRECOGNIZED_CREATE_CALLSTACK_ENTRY = 1,
1452
1709
  UNRECOGNIZED_CONTRACT_CALLSTACK_ENTRY = 2,
@@ -1473,140 +1730,175 @@ export enum StackTraceEntryType {
1473
1730
  CONTRACT_CALL_RUN_OUT_OF_GAS_ERROR = 23,
1474
1731
  CHEATCODE_ERROR = 24
1475
1732
  }
1733
+
1476
1734
  export declare function stackTraceEntryTypeToString(val: StackTraceEntryType): string
1477
- export const FALLBACK_FUNCTION_NAME: string
1478
- export const RECEIVE_FUNCTION_NAME: string
1479
- export const CONSTRUCTOR_FUNCTION_NAME: string
1480
- export const UNRECOGNIZED_FUNCTION_NAME: string
1481
- export const UNKNOWN_FUNCTION_NAME: string
1482
- export const PRECOMPILE_FUNCTION_NAME: string
1483
- export const UNRECOGNIZED_CONTRACT_NAME: string
1484
- export interface SourceReference {
1485
- sourceName: string
1486
- sourceContent: string
1487
- contract?: string
1488
- function?: string
1489
- line: number
1490
- range: Array<number>
1491
- }
1492
- export interface CallstackEntryStackTraceEntry {
1493
- type: StackTraceEntryType.CALLSTACK_ENTRY
1494
- sourceReference: SourceReference
1495
- functionType: ContractFunctionType
1496
- }
1497
- export interface UnrecognizedCreateCallstackEntryStackTraceEntry {
1498
- type: StackTraceEntryType.UNRECOGNIZED_CREATE_CALLSTACK_ENTRY
1499
- sourceReference?: undefined
1500
- }
1501
- export interface UnrecognizedContractCallstackEntryStackTraceEntry {
1502
- type: StackTraceEntryType.UNRECOGNIZED_CONTRACT_CALLSTACK_ENTRY
1503
- address: Uint8Array
1504
- sourceReference?: undefined
1505
- }
1506
- export interface PrecompileErrorStackTraceEntry {
1507
- type: StackTraceEntryType.PRECOMPILE_ERROR
1508
- precompile: number
1509
- sourceReference?: undefined
1510
- }
1511
- export interface RevertErrorStackTraceEntry {
1512
- type: StackTraceEntryType.REVERT_ERROR
1513
- returnData: Uint8Array
1514
- sourceReference: SourceReference
1515
- isInvalidOpcodeError: boolean
1516
- }
1517
- export interface PanicErrorStackTraceEntry {
1518
- type: StackTraceEntryType.PANIC_ERROR
1519
- errorCode: bigint
1520
- sourceReference?: SourceReference
1521
- }
1522
- export interface CustomErrorStackTraceEntry {
1523
- type: StackTraceEntryType.CUSTOM_ERROR
1524
- message: string
1525
- sourceReference: SourceReference
1526
- }
1527
- export interface FunctionNotPayableErrorStackTraceEntry {
1528
- type: StackTraceEntryType.FUNCTION_NOT_PAYABLE_ERROR
1529
- value: bigint
1530
- sourceReference: SourceReference
1531
- }
1532
- export interface InvalidParamsErrorStackTraceEntry {
1533
- type: StackTraceEntryType.INVALID_PARAMS_ERROR
1534
- 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
1535
1740
  }
1536
- export interface FallbackNotPayableErrorStackTraceEntry {
1537
- type: StackTraceEntryType.FALLBACK_NOT_PAYABLE_ERROR
1538
- value: bigint
1539
- 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
1540
1751
  }
1541
- export interface FallbackNotPayableAndNoReceiveErrorStackTraceEntry {
1542
- 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 */
1543
1758
  value: bigint
1544
- sourceReference: SourceReference
1545
- }
1546
- export interface UnrecognizedFunctionWithoutFallbackErrorStackTraceEntry {
1547
- type: StackTraceEntryType.UNRECOGNIZED_FUNCTION_WITHOUT_FALLBACK_ERROR
1548
- sourceReference: SourceReference
1549
- }
1550
- export interface MissingFallbackOrReceiveErrorStackTraceEntry {
1551
- type: StackTraceEntryType.MISSING_FALLBACK_OR_RECEIVE_ERROR
1552
- sourceReference: SourceReference
1553
- }
1554
- export interface ReturndataSizeErrorStackTraceEntry {
1555
- type: StackTraceEntryType.RETURNDATA_SIZE_ERROR
1556
- sourceReference: SourceReference
1557
1759
  }
1558
- export interface NonContractAccountCalledErrorStackTraceEntry {
1559
- type: StackTraceEntryType.NONCONTRACT_ACCOUNT_CALLED_ERROR
1560
- 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
1561
1765
  }
1562
- export interface CallFailedErrorStackTraceEntry {
1563
- type: StackTraceEntryType.CALL_FAILED_ERROR
1564
- sourceReference: SourceReference
1766
+
1767
+ export interface SubscriptionEvent {
1768
+ filterId: bigint
1769
+ result: unknown
1565
1770
  }
1566
- export interface DirectLibraryCallErrorStackTraceEntry {
1567
- type: StackTraceEntryType.DIRECT_LIBRARY_CALL_ERROR
1568
- 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
1569
1780
  }
1570
- export interface UnrecognizedCreateErrorStackTraceEntry {
1571
- type: StackTraceEntryType.UNRECOGNIZED_CREATE_ERROR
1572
- returnData: Uint8Array
1573
- sourceReference?: undefined
1574
- 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
1575
1794
  }
1576
- export interface UnrecognizedContractErrorStackTraceEntry {
1577
- type: StackTraceEntryType.UNRECOGNIZED_CONTRACT_ERROR
1578
- address: Uint8Array
1579
- returnData: Uint8Array
1580
- sourceReference?: undefined
1581
- 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>
1582
1824
  }
1583
- export interface OtherExecutionErrorStackTraceEntry {
1584
- type: StackTraceEntryType.OTHER_EXECUTION_ERROR
1585
- 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
1586
1853
  }
1587
- export interface UnmappedSolc063RevertErrorStackTraceEntry {
1588
- type: StackTraceEntryType.UNMAPPED_SOLC_0_6_3_REVERT_ERROR
1589
- 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
1590
1861
  }
1591
- export interface ContractTooLargeErrorStackTraceEntry {
1592
- type: StackTraceEntryType.CONTRACT_TOO_LARGE_ERROR
1593
- 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
1594
1869
  }
1595
- export interface InternalFunctionCallStackEntry {
1596
- type: StackTraceEntryType.INTERNAL_FUNCTION_CALLSTACK_ENTRY
1597
- pc: number
1598
- 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'
1599
1879
  }
1600
- export interface ContractCallRunOutOfGasError {
1601
- type: StackTraceEntryType.CONTRACT_CALL_RUN_OUT_OF_GAS_ERROR
1602
- 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
1603
1888
  }
1604
- export interface CheatcodeErrorStackTraceEntry {
1605
- type: StackTraceEntryType.CHEATCODE_ERROR
1606
- message: string
1607
- sourceReference: SourceReference
1608
- 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
1609
1900
  }
1901
+
1610
1902
  export interface TracingMessage {
1611
1903
  /** Sender address */
1612
1904
  readonly caller: Uint8Array
@@ -1630,6 +1922,12 @@ export interface TracingMessage {
1630
1922
  /** Code of the contract that is being executed. */
1631
1923
  readonly code?: Uint8Array
1632
1924
  }
1925
+
1926
+ export interface TracingMessageResult {
1927
+ /** Execution result */
1928
+ readonly executionResult: ExecutionResult
1929
+ }
1930
+
1633
1931
  export interface TracingStep {
1634
1932
  /** Call depth */
1635
1933
  readonly depth: number
@@ -1646,174 +1944,105 @@ export interface TracingStep {
1646
1944
  /** The memory at the step. None if verbose tracing is disabled. */
1647
1945
  readonly memory?: Uint8Array
1648
1946
  }
1649
- export interface TracingMessageResult {
1650
- /** Execution result */
1651
- readonly executionResult: ExecutionResult
1652
- }
1653
- export interface Withdrawal {
1654
- /** The index of withdrawal */
1655
- index: bigint
1656
- /** The index of the validator that generated the withdrawal */
1657
- validatorIndex: bigint
1658
- /** The recipient address for withdrawal value */
1659
- address: Uint8Array
1660
- /** The value contained in withdrawal */
1661
- 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
1662
1954
  }
1663
- export declare class EdrContext {
1664
- /** Creates a new [`EdrContext`] instance. Should only be called once! */
1665
- constructor()
1666
- /** Constructs a new provider with the provided configuration. */
1667
- createProvider(chainType: string, providerConfig: ProviderConfig, loggerConfig: LoggerConfig, subscriptionConfig: SubscriptionConfig, contractDecoder: ContractDecoder): Promise<Provider>
1668
- /** Registers a new provider factory for the provided chain type. */
1669
- registerProviderFactory(chainType: string, factory: ProviderFactory): Promise<void>
1670
- registerSolidityTestRunnerFactory(chainType: string, factory: SolidityTestRunnerFactory): Promise<void>
1671
- /**
1672
- * Executes Solidity tests
1673
- *
1674
- * The function will return a promise that resolves to a
1675
- * [`SolidityTestResult`].
1676
- *
1677
- * Arguments:
1678
- * - `chainType`: the same chain type that was passed to
1679
- * `registerProviderFactory`.
1680
- * - `artifacts`: the project's compilation output artifacts. It's
1681
- * important to include include all artifacts here, otherwise cheatcodes
1682
- * that access artifacts and other functionality (e.g. auto-linking, gas
1683
- * reports) can break.
1684
- * - `testSuites`: the test suite ids that specify which test suites to
1685
- * execute. The test suite artifacts must be present in `artifacts`.
1686
- * - `configArgs`: solidity test runner configuration. See the struct docs
1687
- * for details.
1688
- * - `tracingConfig`: the build infos used for stack trace generation.
1689
- * These are lazily parsed and it's important that they're passed as
1690
- * Uint8 arrays for performance.
1691
- * - `onTestSuiteCompletedCallback`: The progress callback will be called
1692
- * with the results of each test suite as soon as it finished executing.
1693
- */
1694
- 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
1695
1961
  }
1696
- export declare class ContractDecoder {
1697
- /**Creates an empty instance. */
1698
- constructor()
1699
- /**Creates a new instance with the provided configuration. */
1700
- 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
1701
1971
  }
1702
- export declare class Precompile {
1703
- /** Returns the address of the precompile. */
1704
- 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
1705
1979
  }
1706
- export declare class ProviderFactory { }
1707
- export declare class Response {
1708
- /**Returns the response data as a JSON string or a JSON object. */
1709
- get data(): string | any
1710
- /**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. */
1711
- stackTrace(): StackTrace | UnexpectedError | HeuristicFailed | null
1712
- /**
1713
- * Constructs the execution traces for the request. Returns an empty array
1714
- * if traces are not enabled for this provider according to
1715
- * [`crate::solidity_tests::config::SolidityTestRunnerConfigArgs::include_traces`]. Otherwise, returns
1716
- * an array of the root calls of the trace, which always includes the
1717
- * request's call itself.
1718
- */
1719
- callTraces(): Array<CallTrace>
1980
+
1981
+ export interface UnrecognizedCreateCallstackEntryStackTraceEntry {
1982
+ type: StackTraceEntryType.UNRECOGNIZED_CREATE_CALLSTACK_ENTRY
1983
+ sourceReference?: undefined
1720
1984
  }
1721
- /** A JSON-RPC provider for Ethereum. */
1722
- export declare class Provider {
1723
- /**
1724
- *Adds a compilation result to the instance.
1725
- *
1726
- *For internal use only. Support for this method may be removed in the future.
1727
- */
1728
- addCompilationResult(solcVersion: string, compilerInput: any, compilerOutput: any): Promise<void>
1729
- /**Retrieves the instance's contract decoder. */
1730
- contractDecoder(): ContractDecoder
1731
- /**Handles a JSON-RPC request and returns a JSON-RPC response. */
1732
- handleRequest(request: string): Promise<Response>
1733
- setCallOverrideCallback(callOverrideCallback: (contract_address: ArrayBuffer, data: ArrayBuffer) => Promise<CallOverrideResult | undefined>): Promise<void>
1734
- /**
1735
- * Set to `true` to make the traces returned with `eth_call`,
1736
- * `eth_estimateGas`, `eth_sendRawTransaction`, `eth_sendTransaction`,
1737
- * `evm_mine`, `hardhat_mine` include the full stack and memory. Set to
1738
- * `false` to disable this.
1739
- */
1740
- 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
1741
1991
  }
1742
- export declare class SolidityTestRunnerFactory { }
1743
- /** See [`edr_solidity_tests::result::SuiteResult`] */
1744
- export declare class SuiteResult {
1745
- /**
1746
- * The artifact id can be used to match input to result in the progress
1747
- * callback
1748
- */
1749
- readonly id: ArtifactId
1750
- /** See [`edr_solidity_tests::result::SuiteResult::duration`] */
1751
- readonly durationNs: bigint
1752
- /** See [`edr_solidity_tests::result::SuiteResult::test_results`] */
1753
- readonly testResults: Array<TestResult>
1754
- /** See [`edr_solidity_tests::result::SuiteResult::warnings`] */
1755
- readonly warnings: Array<string>
1992
+
1993
+ export interface UnrecognizedFunctionWithoutFallbackErrorStackTraceEntry {
1994
+ type: StackTraceEntryType.UNRECOGNIZED_FUNCTION_WITHOUT_FALLBACK_ERROR
1995
+ sourceReference: SourceReference
1756
1996
  }
1757
- /** See [`edr_solidity_tests::result::TestResult`] */
1758
- export declare class TestResult {
1759
- /** The name of the test. */
1760
- readonly name: string
1761
- /** See [`edr_solidity_tests::result::TestResult::status`] */
1762
- readonly status: TestStatus
1763
- /** See [`edr_solidity_tests::result::TestResult::reason`] */
1764
- readonly reason?: string
1765
- /** See [`edr_solidity_tests::result::TestResult::counterexample`] */
1766
- readonly counterexample?: BaseCounterExample | CounterExampleSequence
1767
- /** See [`edr_solidity_tests::result::TestResult::decoded_logs`] */
1768
- readonly decodedLogs: Array<string>
1769
- /** See [`edr_solidity_tests::result::TestResult::kind`] */
1770
- readonly kind: StandardTestKind | FuzzTestKind | InvariantTestKind
1771
- /** See [`edr_solidity_tests::result::TestResult::duration`] */
1772
- readonly durationNs: bigint
1773
- /**
1774
- * Groups of value snapshot entries (incl. gas).
1775
- *
1776
- * Only present if the test runner collected scoped snapshots. Currently,
1777
- * this is always the case.
1778
- */
1779
- 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"
1780
2007
  /**
1781
- * Compute the error stack trace.
1782
- * The result is either the stack trace or the reason why we couldn't
1783
- * generate the stack trace.
1784
- * Returns null if the test status is succeeded or skipped.
1785
- * Cannot throw.
2008
+ * Indeterminism due to specifying a fork url without a fork block number
2009
+ * in the test runner config.
1786
2010
  */
1787
- stackTrace(): StackTrace | UnexpectedError | HeuristicFailed | UnsafeToReplay | null
2011
+ globalForkLatest: boolean
1788
2012
  /**
1789
- * Constructs the execution traces for the test. Returns an empty array if
1790
- * traces for this test were not requested according to
1791
- * [`crate::solidity_tests::config::SolidityTestRunnerConfigArgs::include_traces`]. Otherwise, returns
1792
- * an array of the root calls of the trace, which always includes the test
1793
- * call itself and may also include the setup call if there is one
1794
- * (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);`.
1795
2019
  */
1796
- callTraces(): Array<CallTrace>
2020
+ impureCheatcodes: Array<string>
1797
2021
  }
1798
- export declare class Exit {
1799
- get kind(): ExitCode
1800
- isError(): boolean
1801
- 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
1802
2029
  }
1803
- /**
1804
- * Opaque handle to the `Bytecode` struct.
1805
- * Only used on the JS side by the `VmTraceDecoder` class.
1806
- */
1807
- export declare class BytecodeWrapper { }
1808
- export declare class ReturnData {
1809
- readonly value: Uint8Array
1810
- constructor(value: Uint8Array)
1811
- isEmpty(): boolean
1812
- isErrorReturnData(): boolean
1813
- isPanicReturnData(): boolean
1814
- decodeError(): string
1815
- 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>
1816
2037
  }
1817
- export declare class RawTrace {
1818
- 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
1819
2048
  }