@nomicfoundation/edr 0.12.0-next.3 → 0.12.0-next.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +368 -75
- package/index.js +7 -2
- package/package.json +11 -11
- package/src/account.rs +7 -6
- package/src/block.rs +1 -1
- package/src/call_override.rs +1 -1
- package/src/cast.rs +1 -1
- package/src/chains/generic.rs +23 -18
- package/src/chains/l1.rs +92 -80
- package/src/chains/op.rs +139 -115
- package/src/config.rs +193 -14
- package/src/context.rs +71 -75
- package/src/contract_decoder.rs +60 -0
- package/src/debug_trace.rs +2 -0
- package/src/gas_report.rs +100 -0
- package/src/instrument.rs +6 -0
- package/src/lib.rs +3 -0
- package/src/log.rs +2 -2
- package/src/logger.rs +1 -1
- package/src/mock/time.rs +58 -55
- package/src/mock.rs +4 -18
- package/src/precompile.rs +7 -7
- package/src/provider/response.rs +45 -43
- package/src/provider.rs +31 -10
- package/src/result.rs +42 -83
- package/src/serde.rs +1 -1
- package/src/solidity_tests/artifact.rs +5 -5
- package/src/solidity_tests/cheatcode_errors.rs +37 -0
- package/src/solidity_tests/config.rs +319 -35
- package/src/solidity_tests/l1.rs +12 -8
- package/src/solidity_tests/op.rs +12 -9
- package/src/solidity_tests/runner.rs +8 -5
- package/src/solidity_tests/test_results.rs +161 -67
- package/src/solidity_tests.rs +2 -1
- package/src/trace/debug.rs +3 -1
- package/src/trace/exit.rs +9 -8
- package/src/trace/return_data.rs +19 -7
- package/src/trace/solidity_stack_trace.rs +231 -186
- package/src/trace.rs +11 -17
- package/src/withdrawal.rs +5 -5
package/index.d.ts
CHANGED
|
@@ -91,7 +91,9 @@ export enum SpecId {
|
|
|
91
91
|
/** Cancun */
|
|
92
92
|
Cancun = 17,
|
|
93
93
|
/** Prague */
|
|
94
|
-
Prague = 18
|
|
94
|
+
Prague = 18,
|
|
95
|
+
/** Osaka */
|
|
96
|
+
Osaka = 19
|
|
95
97
|
}
|
|
96
98
|
/**
|
|
97
99
|
* Tries to parse the provided string to create a [`SpecId`] instance.
|
|
@@ -125,6 +127,7 @@ export const MERGE: string
|
|
|
125
127
|
export const SHANGHAI: string
|
|
126
128
|
export const CANCUN: string
|
|
127
129
|
export const PRAGUE: string
|
|
130
|
+
export const OSAKA: string
|
|
128
131
|
/** Enumeration of supported OP hardforks. */
|
|
129
132
|
export enum OpHardfork {
|
|
130
133
|
Bedrock = 100,
|
|
@@ -162,6 +165,20 @@ export const FJORD: string
|
|
|
162
165
|
export const GRANITE: string
|
|
163
166
|
export const HOLOCENE: string
|
|
164
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
|
|
173
|
+
}
|
|
174
|
+
export interface BaseFeeActivationByBlockNumber {
|
|
175
|
+
/** The block number at which the `base_fee_params` is activated */
|
|
176
|
+
blockNumber: bigint
|
|
177
|
+
}
|
|
178
|
+
export interface BaseFeeActivationByHardfork {
|
|
179
|
+
/** The hardfork at which the `base_fee_params` is activated */
|
|
180
|
+
hardfork: string
|
|
181
|
+
}
|
|
165
182
|
/** Specification of a chain with possible overrides. */
|
|
166
183
|
export interface ChainOverride {
|
|
167
184
|
/** The chain ID */
|
|
@@ -184,6 +201,16 @@ export interface CodeCoverageConfig {
|
|
|
184
201
|
*/
|
|
185
202
|
onCollectedCoverageCallback: (coverageHits: Uint8Array[]) => Promise<void>
|
|
186
203
|
}
|
|
204
|
+
export interface GasReportConfig {
|
|
205
|
+
/**
|
|
206
|
+
* Gas reports are collected after a block is mined or `eth_call` is
|
|
207
|
+
* executed.
|
|
208
|
+
*
|
|
209
|
+
* Exceptions thrown in the callback will be propagated to the original
|
|
210
|
+
* caller.
|
|
211
|
+
*/
|
|
212
|
+
onCollectedGasReportCallback: (gasReport: GasReport) => Promise<void>
|
|
213
|
+
}
|
|
187
214
|
/** Configuration for forking a blockchain */
|
|
188
215
|
export interface ForkConfig {
|
|
189
216
|
/**
|
|
@@ -244,6 +271,15 @@ export interface MiningConfig {
|
|
|
244
271
|
export interface ObservabilityConfig {
|
|
245
272
|
/** If present, configures runtime observability to collect code coverage. */
|
|
246
273
|
codeCoverage?: CodeCoverageConfig
|
|
274
|
+
/** If present, configures runtime observability to collect gas reports. */
|
|
275
|
+
gasReport?: GasReportConfig
|
|
276
|
+
/**
|
|
277
|
+
* Controls when to include call traces in the results of transaction
|
|
278
|
+
* execution.
|
|
279
|
+
*
|
|
280
|
+
* Defaults to `IncludeTraces.None`.
|
|
281
|
+
*/
|
|
282
|
+
includeCallTraces?: IncludeTraces
|
|
247
283
|
}
|
|
248
284
|
/** Configuration for a provider */
|
|
249
285
|
export interface ProviderConfig {
|
|
@@ -255,6 +291,17 @@ export interface ProviderConfig {
|
|
|
255
291
|
bailOnCallFailure: boolean
|
|
256
292
|
/** Whether to return an `Err` when a `eth_sendTransaction` fails */
|
|
257
293
|
bailOnTransactionFailure: boolean
|
|
294
|
+
/**
|
|
295
|
+
* EIP-1559 base fee parameters activations to be used to calculate the
|
|
296
|
+
* block base fee.
|
|
297
|
+
*
|
|
298
|
+
* Provide an ordered list of `base_fee_params` to be
|
|
299
|
+
* used starting from the specified activation point (hardfork or block
|
|
300
|
+
* number).
|
|
301
|
+
* If not provided, the default values from the chain spec
|
|
302
|
+
* will be used.
|
|
303
|
+
*/
|
|
304
|
+
baseFeeConfig?: Array<BaseFeeParamActivation>
|
|
258
305
|
/** The gas limit of each block */
|
|
259
306
|
blockGasLimit: bigint
|
|
260
307
|
/** The chain ID of the blockchain */
|
|
@@ -296,6 +343,14 @@ export interface ProviderConfig {
|
|
|
296
343
|
ownedAccounts: Array<string>
|
|
297
344
|
/** Overrides for precompiles */
|
|
298
345
|
precompileOverrides: Array<Precompile>
|
|
346
|
+
/**
|
|
347
|
+
* Transaction gas cap, introduced in [EIP-7825].
|
|
348
|
+
*
|
|
349
|
+
* When not set, will default to value defined by the used hardfork
|
|
350
|
+
*
|
|
351
|
+
* [EIP-7825]: https://eips.ethereum.org/EIPS/eip-7825
|
|
352
|
+
*/
|
|
353
|
+
transactionGasCap?: bigint
|
|
299
354
|
}
|
|
300
355
|
/** Tracing config for Solidity stack trace generation. */
|
|
301
356
|
export interface TracingConfigWithBuffers {
|
|
@@ -347,6 +402,35 @@ export interface DebugTraceLogItem {
|
|
|
347
402
|
/** Map of all stored values with keys and values encoded as hex strings. */
|
|
348
403
|
storage?: Record<string, string>
|
|
349
404
|
}
|
|
405
|
+
export interface GasReport {
|
|
406
|
+
contracts: Record<string, ContractGasReport>
|
|
407
|
+
}
|
|
408
|
+
export interface ContractGasReport {
|
|
409
|
+
deployments: Array<DeploymentGasReport>
|
|
410
|
+
functions: Record<string, Array<FunctionGasReport>>
|
|
411
|
+
}
|
|
412
|
+
export enum GasReportExecutionStatus {
|
|
413
|
+
Success = 0,
|
|
414
|
+
Revert = 1,
|
|
415
|
+
Halt = 2
|
|
416
|
+
}
|
|
417
|
+
export interface DeploymentGasReport {
|
|
418
|
+
gas: bigint
|
|
419
|
+
size: bigint
|
|
420
|
+
runtimeSize: bigint
|
|
421
|
+
status: GasReportExecutionStatus
|
|
422
|
+
}
|
|
423
|
+
export interface FunctionGasReport {
|
|
424
|
+
gas: bigint
|
|
425
|
+
status: GasReportExecutionStatus
|
|
426
|
+
/**
|
|
427
|
+
* The proxy delegation chain for this call, if the called contract is a
|
|
428
|
+
* proxy. Contains contract identifiers from outermost proxy to final
|
|
429
|
+
* implementation, e.g. `["Proxy", "Implementation"]`.
|
|
430
|
+
* Empty if the call is not through a proxy.
|
|
431
|
+
*/
|
|
432
|
+
proxyChain: Array<string>
|
|
433
|
+
}
|
|
350
434
|
export interface InstrumentationResult {
|
|
351
435
|
/** The generated source code with coverage instrumentation. */
|
|
352
436
|
readonly source: string
|
|
@@ -381,6 +465,8 @@ export interface InstrumentationMetadata {
|
|
|
381
465
|
* code.
|
|
382
466
|
*/
|
|
383
467
|
export declare function addStatementCoverageInstrumentation(sourceCode: string, sourceId: string, solidityVersion: string, coverageLibraryPath: string): InstrumentationResult
|
|
468
|
+
/** Retrieves the latest version of `Solidity` supported for instrumentation. */
|
|
469
|
+
export declare function latestSupportedSolidityVersion(): string
|
|
384
470
|
/** Ethereum execution log. */
|
|
385
471
|
export interface ExecutionLog {
|
|
386
472
|
address: Uint8Array
|
|
@@ -405,8 +491,7 @@ export enum SuccessReason {
|
|
|
405
491
|
/** The opcode `RETURN` was called */
|
|
406
492
|
Return = 1,
|
|
407
493
|
/** The opcode `SELFDESTRUCT` was called */
|
|
408
|
-
SelfDestruct = 2
|
|
409
|
-
EofReturnContract = 3
|
|
494
|
+
SelfDestruct = 2
|
|
410
495
|
}
|
|
411
496
|
export interface CallOutput {
|
|
412
497
|
/** Return value */
|
|
@@ -459,15 +544,7 @@ export enum ExceptionalHalt {
|
|
|
459
544
|
/** Error on created contract that begins with EF */
|
|
460
545
|
CreateContractStartingWithEF = 12,
|
|
461
546
|
/** EIP-3860: Limit and meter initcode. Initcode size limit exceeded. */
|
|
462
|
-
CreateInitCodeSizeLimit = 13
|
|
463
|
-
/** Aux data overflow, new aux data is larger tha u16 max size. */
|
|
464
|
-
EofAuxDataOverflow = 14,
|
|
465
|
-
/** Aud data is smaller then already present data size. */
|
|
466
|
-
EofAuxDataTooSmall = 15,
|
|
467
|
-
/** EOF Subroutine stack overflow */
|
|
468
|
-
SubRoutineStackOverflow = 16,
|
|
469
|
-
/** Check for target address validity is only done inside subcall. */
|
|
470
|
-
InvalidEXTCALLTarget = 17
|
|
547
|
+
CreateInitCodeSizeLimit = 13
|
|
471
548
|
}
|
|
472
549
|
/** The result when the EVM terminates due to an exceptional halt. */
|
|
473
550
|
export interface HaltResult {
|
|
@@ -525,6 +602,20 @@ export interface LinkReference {
|
|
|
525
602
|
start: number
|
|
526
603
|
length: number
|
|
527
604
|
}
|
|
605
|
+
/**Error codes that can be returned by cheatcodes in Solidity tests. */
|
|
606
|
+
export enum CheatcodeErrorCode {
|
|
607
|
+
/**The specified cheatcode is not supported. */
|
|
608
|
+
UnsupportedCheatcode = 'UnsupportedCheatcode',
|
|
609
|
+
/**The specified cheatcode is missing. */
|
|
610
|
+
MissingCheatcode = 'MissingCheatcode'
|
|
611
|
+
}
|
|
612
|
+
/**Error returned by a cheatcode in Solidity tests. */
|
|
613
|
+
export interface CheatcodeErrorDetails {
|
|
614
|
+
/**The error code representing the type of cheatcode error. */
|
|
615
|
+
code: CheatcodeErrorCode
|
|
616
|
+
/**The name of the cheatcode that caused the error. */
|
|
617
|
+
cheatcode: string
|
|
618
|
+
}
|
|
528
619
|
/**
|
|
529
620
|
* Solidity test runner configuration arguments exposed through the ffi.
|
|
530
621
|
* Docs based on <https://book.getfoundry.sh/reference/config/testing>.
|
|
@@ -537,8 +628,6 @@ export interface SolidityTestRunnerConfigArgs {
|
|
|
537
628
|
projectRoot: string
|
|
538
629
|
/** Configures the permissions of cheat codes that access the file system. */
|
|
539
630
|
fsPermissions?: Array<PathPermission>
|
|
540
|
-
/** Whether to support the `testFail` prefix. Defaults to false. */
|
|
541
|
-
testFail?: boolean
|
|
542
631
|
/** Address labels for traces. Defaults to none. */
|
|
543
632
|
labels?: Array<AddressLabel>
|
|
544
633
|
/**
|
|
@@ -586,6 +675,8 @@ export interface SolidityTestRunnerConfigArgs {
|
|
|
586
675
|
* Defaults to `31337`.
|
|
587
676
|
*/
|
|
588
677
|
chainId?: bigint
|
|
678
|
+
/** The hardfork to use for EVM execution. */
|
|
679
|
+
hardfork: string
|
|
589
680
|
/**
|
|
590
681
|
* The gas limit for each test case.
|
|
591
682
|
* Defaults to `9_223_372_036_854_775_807` (`i64::MAX`).
|
|
@@ -626,9 +717,14 @@ export interface SolidityTestRunnerConfigArgs {
|
|
|
626
717
|
* Defaults to false.
|
|
627
718
|
*/
|
|
628
719
|
disableBlockGasLimit?: boolean
|
|
720
|
+
/**
|
|
721
|
+
* Whether to enable the EIP-7825 (Osaka) transaction gas limit cap.
|
|
722
|
+
* Defaults to false.
|
|
723
|
+
*/
|
|
724
|
+
enableTxGasLimitCap?: boolean
|
|
629
725
|
/**
|
|
630
726
|
* The memory limit of the EVM in bytes.
|
|
631
|
-
* Defaults to 33_554_432 (2^25 = 32MiB).
|
|
727
|
+
* Defaults to `33_554_432` (2^25 = 32MiB).
|
|
632
728
|
*/
|
|
633
729
|
memoryLimit?: bigint
|
|
634
730
|
/**
|
|
@@ -673,6 +769,8 @@ export interface SolidityTestRunnerConfigArgs {
|
|
|
673
769
|
* config value is set, then the fuzz config value will be used.
|
|
674
770
|
*/
|
|
675
771
|
invariant?: InvariantConfigArgs
|
|
772
|
+
/** Whether to collect stack traces. */
|
|
773
|
+
collectStackTraces?: CollectStackTraces
|
|
676
774
|
/**
|
|
677
775
|
* Controls which test results should include execution traces. Defaults to
|
|
678
776
|
* None.
|
|
@@ -685,6 +783,18 @@ export interface SolidityTestRunnerConfigArgs {
|
|
|
685
783
|
* match the pattern will be executed and reported as a test result.
|
|
686
784
|
*/
|
|
687
785
|
testPattern?: string
|
|
786
|
+
/**
|
|
787
|
+
* Controls whether to generate a gas report after running the tests.
|
|
788
|
+
* Enabling this also enables collection of all traces and EVM isolation
|
|
789
|
+
* mode.
|
|
790
|
+
* Defaults to false.
|
|
791
|
+
*/
|
|
792
|
+
generateGasReport?: boolean
|
|
793
|
+
/**
|
|
794
|
+
* Test function level config overrides.
|
|
795
|
+
* Defaults to none.
|
|
796
|
+
*/
|
|
797
|
+
testFunctionOverrides?: Array<TestFunctionOverride>
|
|
688
798
|
}
|
|
689
799
|
/** Fuzz testing configuration */
|
|
690
800
|
export interface FuzzConfigArgs {
|
|
@@ -730,6 +840,16 @@ export interface FuzzConfigArgs {
|
|
|
730
840
|
* Defaults to true.
|
|
731
841
|
*/
|
|
732
842
|
includePushBytes?: boolean
|
|
843
|
+
/**
|
|
844
|
+
* Show `console.log` in fuzz test.
|
|
845
|
+
* Defaults to false.
|
|
846
|
+
*/
|
|
847
|
+
showLogs?: boolean
|
|
848
|
+
/**
|
|
849
|
+
* Optional timeout (in seconds) for each property test.
|
|
850
|
+
* Defaults to none (no timeout).
|
|
851
|
+
*/
|
|
852
|
+
timeout?: number
|
|
733
853
|
}
|
|
734
854
|
/** Invariant testing configuration. */
|
|
735
855
|
export interface InvariantConfigArgs {
|
|
@@ -780,6 +900,17 @@ export interface InvariantConfigArgs {
|
|
|
780
900
|
* Defaults to 5000.
|
|
781
901
|
*/
|
|
782
902
|
shrinkRunLimit?: number
|
|
903
|
+
/**
|
|
904
|
+
* The maximum number of rejects via `vm.assume` which can be encountered
|
|
905
|
+
* during a single invariant run.
|
|
906
|
+
* Defaults to 65536.
|
|
907
|
+
*/
|
|
908
|
+
maxAssumeRejects?: number
|
|
909
|
+
/**
|
|
910
|
+
* Optional timeout (in seconds) for each invariant test.
|
|
911
|
+
* Defaults to none (no timeout).
|
|
912
|
+
*/
|
|
913
|
+
timeout?: number
|
|
783
914
|
}
|
|
784
915
|
/** Settings to configure caching of remote RPC endpoints. */
|
|
785
916
|
export interface StorageCachingConfig {
|
|
@@ -812,14 +943,36 @@ export interface PathPermission {
|
|
|
812
943
|
/** The targeted path guarded by the permission */
|
|
813
944
|
path: string
|
|
814
945
|
}
|
|
815
|
-
/**
|
|
946
|
+
/**
|
|
947
|
+
* Determines the level of file system access for the given path.
|
|
948
|
+
*
|
|
949
|
+
* Exact path matching is used for file permissions. Prefix matching is used
|
|
950
|
+
* for directory permissions.
|
|
951
|
+
*
|
|
952
|
+
* Giving write access to configuration files, source files or executables
|
|
953
|
+
* in a project is considered dangerous, because it can be used by malicious
|
|
954
|
+
* Solidity dependencies to escape the EVM sandbox. It is therefore
|
|
955
|
+
* recommended to give write access to specific safe files only. If write
|
|
956
|
+
* access to a directory is needed, please make sure that it doesn't contain
|
|
957
|
+
* configuration files, source files or executables neither in the top level
|
|
958
|
+
* directory, nor in any subdirectories.
|
|
959
|
+
*/
|
|
816
960
|
export enum FsAccessPermission {
|
|
817
|
-
/**
|
|
818
|
-
|
|
819
|
-
/** Only reading
|
|
820
|
-
|
|
821
|
-
/** Only writing
|
|
822
|
-
|
|
961
|
+
/** Allows reading and writing the file */
|
|
962
|
+
ReadWriteFile = 0,
|
|
963
|
+
/** Only allows reading the file */
|
|
964
|
+
ReadFile = 1,
|
|
965
|
+
/** Only allows writing the file */
|
|
966
|
+
WriteFile = 2,
|
|
967
|
+
/**
|
|
968
|
+
* Allows reading and writing all files in the directory and its
|
|
969
|
+
* subdirectories
|
|
970
|
+
*/
|
|
971
|
+
DangerouslyReadWriteDirectory = 3,
|
|
972
|
+
/** Allows reading all files in the directory and its subdirectories */
|
|
973
|
+
ReadDirectory = 4,
|
|
974
|
+
/** Allows writing all files in the directory and its subdirectories */
|
|
975
|
+
DangerouslyWriteDirectory = 5
|
|
823
976
|
}
|
|
824
977
|
export interface AddressLabel {
|
|
825
978
|
/** The address to label */
|
|
@@ -827,18 +980,118 @@ export interface AddressLabel {
|
|
|
827
980
|
/** The label to assign to the address */
|
|
828
981
|
label: string
|
|
829
982
|
}
|
|
983
|
+
/** A type that controls when stack traces are collected. */
|
|
984
|
+
export enum CollectStackTraces {
|
|
985
|
+
/** Always collects stack traces, adding performance overhead. */
|
|
986
|
+
Always = 0,
|
|
987
|
+
/**
|
|
988
|
+
* Only collects stack traces upon failure, re-executing the test. This
|
|
989
|
+
* minimizes performance overhead.
|
|
990
|
+
*
|
|
991
|
+
* Not all tests can be re-executed since certain cheatcodes contain
|
|
992
|
+
* non-deterministic side-effects.
|
|
993
|
+
*/
|
|
994
|
+
OnFailure = 1
|
|
995
|
+
}
|
|
830
996
|
/**
|
|
831
|
-
* Configuration
|
|
832
|
-
*
|
|
997
|
+
* Configuration that controls whether execution traces are decoded and
|
|
998
|
+
* included in results.
|
|
999
|
+
*
|
|
1000
|
+
* This can either be for Solidity test results or provider transaction
|
|
1001
|
+
* execution results.
|
|
833
1002
|
*/
|
|
834
1003
|
export enum IncludeTraces {
|
|
835
|
-
/** No traces will be included
|
|
1004
|
+
/** No traces will be included at all. */
|
|
836
1005
|
None = 0,
|
|
837
|
-
/**
|
|
1006
|
+
/**
|
|
1007
|
+
* Traces will be included only on the results of failed tests or
|
|
1008
|
+
* execution.
|
|
1009
|
+
*/
|
|
838
1010
|
Failing = 1,
|
|
839
|
-
/** Traces will be included
|
|
1011
|
+
/** Traces will be included for all test results or executed transactions. */
|
|
840
1012
|
All = 2
|
|
841
1013
|
}
|
|
1014
|
+
/** Test function level config override. */
|
|
1015
|
+
export interface TestFunctionConfigOverride {
|
|
1016
|
+
/**
|
|
1017
|
+
* Allow expecting reverts with `expectRevert` at the same callstack depth
|
|
1018
|
+
* as the test.
|
|
1019
|
+
*/
|
|
1020
|
+
allowInternalExpectRevert?: boolean
|
|
1021
|
+
/**
|
|
1022
|
+
* Whether to enable isolation of calls for the test. In isolation mode all
|
|
1023
|
+
* top-level calls are executed as a separate transaction in a separate
|
|
1024
|
+
* EVM context, enabling more precise gas accounting and transaction
|
|
1025
|
+
* state changes.
|
|
1026
|
+
* Ignored when gas reporting is enabled, as isolation is required for
|
|
1027
|
+
* accurate gas measurements.
|
|
1028
|
+
*/
|
|
1029
|
+
isolate?: boolean
|
|
1030
|
+
/**
|
|
1031
|
+
* The EVM version to use for this test, e.g. "Cancun". This will override
|
|
1032
|
+
* the global EVM version.
|
|
1033
|
+
*/
|
|
1034
|
+
evmVersion?: string
|
|
1035
|
+
/** Configuration override for fuzz testing. */
|
|
1036
|
+
fuzz?: FuzzConfigOverride
|
|
1037
|
+
/** Configuration override for invariant testing. */
|
|
1038
|
+
invariant?: InvariantConfigOverride
|
|
1039
|
+
}
|
|
1040
|
+
/** Test function override configuration. */
|
|
1041
|
+
export interface TestFunctionOverride {
|
|
1042
|
+
/** The test function identifier. */
|
|
1043
|
+
identifier: TestFunctionIdentifier
|
|
1044
|
+
/** The configuration override. */
|
|
1045
|
+
config: TestFunctionConfigOverride
|
|
1046
|
+
}
|
|
1047
|
+
/** Test function identifier. */
|
|
1048
|
+
export interface TestFunctionIdentifier {
|
|
1049
|
+
/** The contract artifact id. */
|
|
1050
|
+
contractArtifact: ArtifactId
|
|
1051
|
+
/** The function selector as hex string. */
|
|
1052
|
+
functionSelector: string
|
|
1053
|
+
}
|
|
1054
|
+
/**
|
|
1055
|
+
* Timeout configuration.
|
|
1056
|
+
* Note: This wrapper is needed to avoid ambiguity with NAPI conversion.
|
|
1057
|
+
*/
|
|
1058
|
+
export interface TimeoutConfig {
|
|
1059
|
+
/** Optional timeout (in seconds). */
|
|
1060
|
+
time?: number
|
|
1061
|
+
}
|
|
1062
|
+
/** Test function or test contract level fuzz config override. */
|
|
1063
|
+
export interface FuzzConfigOverride {
|
|
1064
|
+
/** The number of test cases that must execute for each property test. */
|
|
1065
|
+
runs?: number
|
|
1066
|
+
/**
|
|
1067
|
+
* The maximum number of test case rejections allowed by proptest, to be
|
|
1068
|
+
* encountered during usage of `vm.assume` cheatcode. This will be used
|
|
1069
|
+
* to set the `max_global_rejects` value in proptest test runner config.
|
|
1070
|
+
* `max_local_rejects` option isn't exposed here since we're not using
|
|
1071
|
+
* `prop_filter`.
|
|
1072
|
+
*/
|
|
1073
|
+
maxTestRejects?: number
|
|
1074
|
+
/** show `console.log` in fuzz test, defaults to `false`. */
|
|
1075
|
+
showLogs?: boolean
|
|
1076
|
+
/** Optional timeout (in seconds) for each property test. */
|
|
1077
|
+
timeout?: TimeoutConfig
|
|
1078
|
+
}
|
|
1079
|
+
/** Test function or test contract level invariant config override. */
|
|
1080
|
+
export interface InvariantConfigOverride {
|
|
1081
|
+
/** The number of runs that must execute for each invariant test group. */
|
|
1082
|
+
runs?: number
|
|
1083
|
+
/** The number of calls executed to attempt to break invariants in one run. */
|
|
1084
|
+
depth?: number
|
|
1085
|
+
/** Fails the invariant fuzzing if a revert occurs. */
|
|
1086
|
+
failOnRevert?: boolean
|
|
1087
|
+
/**
|
|
1088
|
+
* Allows overriding an unsafe external call when running invariant tests.
|
|
1089
|
+
* eg. reentrancy checks
|
|
1090
|
+
*/
|
|
1091
|
+
callOverride?: boolean
|
|
1092
|
+
/** Optional timeout (in seconds) for each invariant test. */
|
|
1093
|
+
timeout?: TimeoutConfig
|
|
1094
|
+
}
|
|
842
1095
|
export declare function l1SolidityTestRunnerFactory(): SolidityTestRunnerFactory
|
|
843
1096
|
export declare function opSolidityTestRunnerFactory(): SolidityTestRunnerFactory
|
|
844
1097
|
/** A grouping of value snapshot entries for a test. */
|
|
@@ -910,21 +1163,21 @@ export enum TestStatus {
|
|
|
910
1163
|
/**Test skipped */
|
|
911
1164
|
Skipped = 'Skipped'
|
|
912
1165
|
}
|
|
913
|
-
/** See [edr_solidity_tests::result::TestKind::
|
|
1166
|
+
/** See [`edr_solidity_tests::result::TestKind::Unit`] */
|
|
914
1167
|
export interface StandardTestKind {
|
|
915
1168
|
/** The gas consumed by the test. */
|
|
916
1169
|
readonly consumedGas: bigint
|
|
917
1170
|
}
|
|
918
|
-
/** See [edr_solidity_tests::result::TestKind::Fuzz] */
|
|
1171
|
+
/** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
|
|
919
1172
|
export interface FuzzTestKind {
|
|
920
|
-
/** See [edr_solidity_tests::result::TestKind::Fuzz] */
|
|
1173
|
+
/** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
|
|
921
1174
|
readonly runs: bigint
|
|
922
|
-
/** See [edr_solidity_tests::result::TestKind::Fuzz] */
|
|
1175
|
+
/** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
|
|
923
1176
|
readonly meanGas: bigint
|
|
924
|
-
/** See [edr_solidity_tests::result::TestKind::Fuzz] */
|
|
1177
|
+
/** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
|
|
925
1178
|
readonly medianGas: bigint
|
|
926
1179
|
}
|
|
927
|
-
/** See [edr_solidity_tests::fuzz::FuzzCase] */
|
|
1180
|
+
/** See [`edr_solidity_tests::fuzz::FuzzCase`] */
|
|
928
1181
|
export interface FuzzCase {
|
|
929
1182
|
/** The calldata used for this fuzz test */
|
|
930
1183
|
readonly calldata: Uint8Array
|
|
@@ -933,14 +1186,24 @@ export interface FuzzCase {
|
|
|
933
1186
|
/** The initial gas stipend for the transaction */
|
|
934
1187
|
readonly stipend: bigint
|
|
935
1188
|
}
|
|
936
|
-
/** See [edr_solidity_tests::result::TestKind::Invariant] */
|
|
1189
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
937
1190
|
export interface InvariantTestKind {
|
|
938
|
-
/** See [edr_solidity_tests::result::TestKind::Invariant] */
|
|
1191
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
939
1192
|
readonly runs: bigint
|
|
940
|
-
/** See [edr_solidity_tests::result::TestKind::Invariant] */
|
|
1193
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
941
1194
|
readonly calls: bigint
|
|
942
|
-
/** See [edr_solidity_tests::result::TestKind::Invariant] */
|
|
1195
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
943
1196
|
readonly reverts: bigint
|
|
1197
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
1198
|
+
readonly metrics: Record<string, InvariantMetrics>
|
|
1199
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
1200
|
+
readonly failedCorpusReplays: bigint
|
|
1201
|
+
}
|
|
1202
|
+
/** See [`edr_solidity_tests::result::InvariantMetrics`] */
|
|
1203
|
+
export interface InvariantMetrics {
|
|
1204
|
+
readonly calls: bigint
|
|
1205
|
+
readonly reverts: bigint
|
|
1206
|
+
readonly discards: bigint
|
|
944
1207
|
}
|
|
945
1208
|
/**
|
|
946
1209
|
* Original sequence size and sequence of calls used as a counter example
|
|
@@ -952,19 +1215,19 @@ export interface CounterExampleSequence {
|
|
|
952
1215
|
/** The shrunk counterexample sequence. */
|
|
953
1216
|
sequence: Array<BaseCounterExample>
|
|
954
1217
|
}
|
|
955
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample] */
|
|
1218
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample`] */
|
|
956
1219
|
export interface BaseCounterExample {
|
|
957
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::sender] */
|
|
1220
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::sender`] */
|
|
958
1221
|
readonly sender?: Uint8Array
|
|
959
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::addr] */
|
|
1222
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::addr`] */
|
|
960
1223
|
readonly address?: Uint8Array
|
|
961
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::calldata] */
|
|
1224
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::calldata`] */
|
|
962
1225
|
readonly calldata: Uint8Array
|
|
963
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::contract_name] */
|
|
1226
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::contract_name`] */
|
|
964
1227
|
readonly contractName?: string
|
|
965
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::signature] */
|
|
1228
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::signature`] */
|
|
966
1229
|
readonly signature?: string
|
|
967
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::args] */
|
|
1230
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::args`] */
|
|
968
1231
|
readonly args?: string
|
|
969
1232
|
}
|
|
970
1233
|
/**
|
|
@@ -1050,6 +1313,11 @@ export interface DecodedTraceParameters {
|
|
|
1050
1313
|
*/
|
|
1051
1314
|
arguments: Array<string>
|
|
1052
1315
|
}
|
|
1316
|
+
/** The result of a Solidity test run. */
|
|
1317
|
+
export interface SolidityTestResult {
|
|
1318
|
+
/** Gas report, if it was generated. */
|
|
1319
|
+
readonly gasReport?: GasReport
|
|
1320
|
+
}
|
|
1053
1321
|
/** Configuration for subscriptions. */
|
|
1054
1322
|
export interface SubscriptionConfig {
|
|
1055
1323
|
/** Callback to be called when a new event is received. */
|
|
@@ -1250,6 +1518,7 @@ export interface CheatcodeErrorStackTraceEntry {
|
|
|
1250
1518
|
type: StackTraceEntryType.CHEATCODE_ERROR
|
|
1251
1519
|
message: string
|
|
1252
1520
|
sourceReference: SourceReference
|
|
1521
|
+
details?: CheatcodeErrorDetails
|
|
1253
1522
|
}
|
|
1254
1523
|
export interface TracingMessage {
|
|
1255
1524
|
/** Sender address */
|
|
@@ -1294,11 +1563,6 @@ export interface TracingMessageResult {
|
|
|
1294
1563
|
/** Execution result */
|
|
1295
1564
|
readonly executionResult: ExecutionResult
|
|
1296
1565
|
}
|
|
1297
|
-
/**
|
|
1298
|
-
* Returns the latest version of solc that EDR officially
|
|
1299
|
-
* supports and is tested against.
|
|
1300
|
-
*/
|
|
1301
|
-
export declare function getLatestSupportedSolcVersion(): string
|
|
1302
1566
|
export interface Withdrawal {
|
|
1303
1567
|
/** The index of withdrawal */
|
|
1304
1568
|
index: bigint
|
|
@@ -1310,22 +1574,43 @@ export interface Withdrawal {
|
|
|
1310
1574
|
amount: bigint
|
|
1311
1575
|
}
|
|
1312
1576
|
export declare class EdrContext {
|
|
1313
|
-
/**Creates a new [`EdrContext`] instance. Should only be called once! */
|
|
1577
|
+
/** Creates a new [`EdrContext`] instance. Should only be called once! */
|
|
1314
1578
|
constructor()
|
|
1315
|
-
/**Constructs a new provider with the provided configuration. */
|
|
1316
|
-
createProvider(chainType: string, providerConfig: ProviderConfig, loggerConfig: LoggerConfig, subscriptionConfig: SubscriptionConfig,
|
|
1317
|
-
/**Registers a new provider factory for the provided chain type. */
|
|
1579
|
+
/** Constructs a new provider with the provided configuration. */
|
|
1580
|
+
createProvider(chainType: string, providerConfig: ProviderConfig, loggerConfig: LoggerConfig, subscriptionConfig: SubscriptionConfig, contractDecoder: ContractDecoder): Promise<Provider>
|
|
1581
|
+
/** Registers a new provider factory for the provided chain type. */
|
|
1318
1582
|
registerProviderFactory(chainType: string, factory: ProviderFactory): Promise<void>
|
|
1319
1583
|
registerSolidityTestRunnerFactory(chainType: string, factory: SolidityTestRunnerFactory): Promise<void>
|
|
1320
1584
|
/**
|
|
1321
|
-
*Executes Solidity tests
|
|
1585
|
+
* Executes Solidity tests
|
|
1322
1586
|
*
|
|
1323
|
-
*The function will return
|
|
1324
|
-
*
|
|
1325
|
-
*
|
|
1326
|
-
*
|
|
1327
|
-
|
|
1328
|
-
|
|
1587
|
+
* The function will return a promise that resolves to a
|
|
1588
|
+
* [`SolidityTestResult`].
|
|
1589
|
+
*
|
|
1590
|
+
* Arguments:
|
|
1591
|
+
* - `chainType`: the same chain type that was passed to
|
|
1592
|
+
* `registerProviderFactory`.
|
|
1593
|
+
* - `artifacts`: the project's compilation output artifacts. It's
|
|
1594
|
+
* important to include include all artifacts here, otherwise cheatcodes
|
|
1595
|
+
* that access artifacts and other functionality (e.g. auto-linking, gas
|
|
1596
|
+
* reports) can break.
|
|
1597
|
+
* - `testSuites`: the test suite ids that specify which test suites to
|
|
1598
|
+
* execute. The test suite artifacts must be present in `artifacts`.
|
|
1599
|
+
* - `configArgs`: solidity test runner configuration. See the struct docs
|
|
1600
|
+
* for details.
|
|
1601
|
+
* - `tracingConfig`: the build infos used for stack trace generation.
|
|
1602
|
+
* These are lazily parsed and it's important that they're passed as
|
|
1603
|
+
* Uint8 arrays for performance.
|
|
1604
|
+
* - `onTestSuiteCompletedCallback`: The progress callback will be called
|
|
1605
|
+
* with the results of each test suite as soon as it finished executing.
|
|
1606
|
+
*/
|
|
1607
|
+
runSolidityTests(chainType: string, artifacts: Array<Artifact>, testSuites: Array<ArtifactId>, configArgs: SolidityTestRunnerConfigArgs, tracingConfig: TracingConfigWithBuffers, onTestSuiteCompletedCallback: (result: SuiteResult) => void): Promise<SolidityTestResult>
|
|
1608
|
+
}
|
|
1609
|
+
export declare class ContractDecoder {
|
|
1610
|
+
/**Creates an empty instance. */
|
|
1611
|
+
constructor()
|
|
1612
|
+
/**Creates a new instance with the provided configuration. */
|
|
1613
|
+
static withContracts(config: TracingConfigWithBuffers): ContractDecoder
|
|
1329
1614
|
}
|
|
1330
1615
|
export declare class Precompile {
|
|
1331
1616
|
/** Returns the address of the precompile. */
|
|
@@ -1336,9 +1621,15 @@ export declare class Response {
|
|
|
1336
1621
|
/**Returns the response data as a JSON string or a JSON object. */
|
|
1337
1622
|
get data(): string | any
|
|
1338
1623
|
/**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. */
|
|
1339
|
-
stackTrace():
|
|
1340
|
-
/**
|
|
1341
|
-
|
|
1624
|
+
stackTrace(): StackTrace | UnexpectedError | HeuristicFailed | null
|
|
1625
|
+
/**
|
|
1626
|
+
* Constructs the execution traces for the request. Returns an empty array
|
|
1627
|
+
* if traces are not enabled for this provider according to
|
|
1628
|
+
* [`crate::solidity_tests::config::SolidityTestRunnerConfigArgs::include_traces`]. Otherwise, returns
|
|
1629
|
+
* an array of the root calls of the trace, which always includes the
|
|
1630
|
+
* request's call itself.
|
|
1631
|
+
*/
|
|
1632
|
+
callTraces(): Array<CallTrace>
|
|
1342
1633
|
}
|
|
1343
1634
|
/** A JSON-RPC provider for Ethereum. */
|
|
1344
1635
|
export declare class Provider {
|
|
@@ -1347,7 +1638,9 @@ export declare class Provider {
|
|
|
1347
1638
|
*
|
|
1348
1639
|
*For internal use only. Support for this method may be removed in the future.
|
|
1349
1640
|
*/
|
|
1350
|
-
addCompilationResult(solcVersion: string, compilerInput: any, compilerOutput: any): Promise<
|
|
1641
|
+
addCompilationResult(solcVersion: string, compilerInput: any, compilerOutput: any): Promise<void>
|
|
1642
|
+
/**Retrieves the instance's contract decoder. */
|
|
1643
|
+
contractDecoder(): ContractDecoder
|
|
1351
1644
|
/**Handles a JSON-RPC request and returns a JSON-RPC response. */
|
|
1352
1645
|
handleRequest(request: string): Promise<Response>
|
|
1353
1646
|
setCallOverrideCallback(callOverrideCallback: (contract_address: ArrayBuffer, data: ArrayBuffer) => Promise<CallOverrideResult | undefined>): Promise<void>
|
|
@@ -1360,35 +1653,35 @@ export declare class Provider {
|
|
|
1360
1653
|
setVerboseTracing(verboseTracing: boolean): Promise<void>
|
|
1361
1654
|
}
|
|
1362
1655
|
export declare class SolidityTestRunnerFactory { }
|
|
1363
|
-
/** See [edr_solidity_tests::result::SuiteResult] */
|
|
1656
|
+
/** See [`edr_solidity_tests::result::SuiteResult`] */
|
|
1364
1657
|
export declare class SuiteResult {
|
|
1365
1658
|
/**
|
|
1366
1659
|
* The artifact id can be used to match input to result in the progress
|
|
1367
1660
|
* callback
|
|
1368
1661
|
*/
|
|
1369
1662
|
readonly id: ArtifactId
|
|
1370
|
-
/** See [edr_solidity_tests::result::SuiteResult::duration] */
|
|
1663
|
+
/** See [`edr_solidity_tests::result::SuiteResult::duration`] */
|
|
1371
1664
|
readonly durationNs: bigint
|
|
1372
|
-
/** See [edr_solidity_tests::result::SuiteResult::test_results] */
|
|
1665
|
+
/** See [`edr_solidity_tests::result::SuiteResult::test_results`] */
|
|
1373
1666
|
readonly testResults: Array<TestResult>
|
|
1374
|
-
/** See [edr_solidity_tests::result::SuiteResult::warnings] */
|
|
1667
|
+
/** See [`edr_solidity_tests::result::SuiteResult::warnings`] */
|
|
1375
1668
|
readonly warnings: Array<string>
|
|
1376
1669
|
}
|
|
1377
|
-
/** See [edr_solidity_tests::result::TestResult] */
|
|
1670
|
+
/** See [`edr_solidity_tests::result::TestResult`] */
|
|
1378
1671
|
export declare class TestResult {
|
|
1379
1672
|
/** The name of the test. */
|
|
1380
1673
|
readonly name: string
|
|
1381
|
-
/** See [edr_solidity_tests::result::TestResult::status] */
|
|
1674
|
+
/** See [`edr_solidity_tests::result::TestResult::status`] */
|
|
1382
1675
|
readonly status: TestStatus
|
|
1383
|
-
/** See [edr_solidity_tests::result::TestResult::reason] */
|
|
1676
|
+
/** See [`edr_solidity_tests::result::TestResult::reason`] */
|
|
1384
1677
|
readonly reason?: string
|
|
1385
|
-
/** See [edr_solidity_tests::result::TestResult::counterexample] */
|
|
1678
|
+
/** See [`edr_solidity_tests::result::TestResult::counterexample`] */
|
|
1386
1679
|
readonly counterexample?: BaseCounterExample | CounterExampleSequence
|
|
1387
|
-
/** See [edr_solidity_tests::result::TestResult::decoded_logs] */
|
|
1680
|
+
/** See [`edr_solidity_tests::result::TestResult::decoded_logs`] */
|
|
1388
1681
|
readonly decodedLogs: Array<string>
|
|
1389
|
-
/** See [edr_solidity_tests::result::TestResult::kind] */
|
|
1682
|
+
/** See [`edr_solidity_tests::result::TestResult::kind`] */
|
|
1390
1683
|
readonly kind: StandardTestKind | FuzzTestKind | InvariantTestKind
|
|
1391
|
-
/** See [edr_solidity_tests::result::TestResult::duration] */
|
|
1684
|
+
/** See [`edr_solidity_tests::result::TestResult::duration`] */
|
|
1392
1685
|
readonly durationNs: bigint
|
|
1393
1686
|
/**
|
|
1394
1687
|
* Groups of value snapshot entries (incl. gas).
|