@nomicfoundation/edr 0.12.0-next.3 → 0.12.0-next.30
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 +354 -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 +307 -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,104 @@ 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
|
+
/** Configuration override for fuzz testing. */
|
|
1022
|
+
fuzz?: FuzzConfigOverride
|
|
1023
|
+
/** Configuration override for invariant testing. */
|
|
1024
|
+
invariant?: InvariantConfigOverride
|
|
1025
|
+
}
|
|
1026
|
+
/** Test function override configuration. */
|
|
1027
|
+
export interface TestFunctionOverride {
|
|
1028
|
+
/** The test function identifier. */
|
|
1029
|
+
identifier: TestFunctionIdentifier
|
|
1030
|
+
/** The configuration override. */
|
|
1031
|
+
config: TestFunctionConfigOverride
|
|
1032
|
+
}
|
|
1033
|
+
/** Test function identifier. */
|
|
1034
|
+
export interface TestFunctionIdentifier {
|
|
1035
|
+
/** The contract artifact id. */
|
|
1036
|
+
contractArtifact: ArtifactId
|
|
1037
|
+
/** The function selector as hex string. */
|
|
1038
|
+
functionSelector: string
|
|
1039
|
+
}
|
|
1040
|
+
/**
|
|
1041
|
+
* Timeout configuration.
|
|
1042
|
+
* Note: This wrapper is needed to avoid ambiguity with NAPI conversion.
|
|
1043
|
+
*/
|
|
1044
|
+
export interface TimeoutConfig {
|
|
1045
|
+
/** Optional timeout (in seconds). */
|
|
1046
|
+
time?: number
|
|
1047
|
+
}
|
|
1048
|
+
/** Test function or test contract level fuzz config override. */
|
|
1049
|
+
export interface FuzzConfigOverride {
|
|
1050
|
+
/** The number of test cases that must execute for each property test. */
|
|
1051
|
+
runs?: number
|
|
1052
|
+
/**
|
|
1053
|
+
* The maximum number of test case rejections allowed by proptest, to be
|
|
1054
|
+
* encountered during usage of `vm.assume` cheatcode. This will be used
|
|
1055
|
+
* to set the `max_global_rejects` value in proptest test runner config.
|
|
1056
|
+
* `max_local_rejects` option isn't exposed here since we're not using
|
|
1057
|
+
* `prop_filter`.
|
|
1058
|
+
*/
|
|
1059
|
+
maxTestRejects?: number
|
|
1060
|
+
/** show `console.log` in fuzz test, defaults to `false`. */
|
|
1061
|
+
showLogs?: boolean
|
|
1062
|
+
/** Optional timeout (in seconds) for each property test. */
|
|
1063
|
+
timeout?: TimeoutConfig
|
|
1064
|
+
}
|
|
1065
|
+
/** Test function or test contract level invariant config override. */
|
|
1066
|
+
export interface InvariantConfigOverride {
|
|
1067
|
+
/** The number of runs that must execute for each invariant test group. */
|
|
1068
|
+
runs?: number
|
|
1069
|
+
/** The number of calls executed to attempt to break invariants in one run. */
|
|
1070
|
+
depth?: number
|
|
1071
|
+
/** Fails the invariant fuzzing if a revert occurs. */
|
|
1072
|
+
failOnRevert?: boolean
|
|
1073
|
+
/**
|
|
1074
|
+
* Allows overriding an unsafe external call when running invariant tests.
|
|
1075
|
+
* eg. reentrancy checks
|
|
1076
|
+
*/
|
|
1077
|
+
callOverride?: boolean
|
|
1078
|
+
/** Optional timeout (in seconds) for each invariant test. */
|
|
1079
|
+
timeout?: TimeoutConfig
|
|
1080
|
+
}
|
|
842
1081
|
export declare function l1SolidityTestRunnerFactory(): SolidityTestRunnerFactory
|
|
843
1082
|
export declare function opSolidityTestRunnerFactory(): SolidityTestRunnerFactory
|
|
844
1083
|
/** A grouping of value snapshot entries for a test. */
|
|
@@ -910,21 +1149,21 @@ export enum TestStatus {
|
|
|
910
1149
|
/**Test skipped */
|
|
911
1150
|
Skipped = 'Skipped'
|
|
912
1151
|
}
|
|
913
|
-
/** See [edr_solidity_tests::result::TestKind::
|
|
1152
|
+
/** See [`edr_solidity_tests::result::TestKind::Unit`] */
|
|
914
1153
|
export interface StandardTestKind {
|
|
915
1154
|
/** The gas consumed by the test. */
|
|
916
1155
|
readonly consumedGas: bigint
|
|
917
1156
|
}
|
|
918
|
-
/** See [edr_solidity_tests::result::TestKind::Fuzz] */
|
|
1157
|
+
/** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
|
|
919
1158
|
export interface FuzzTestKind {
|
|
920
|
-
/** See [edr_solidity_tests::result::TestKind::Fuzz] */
|
|
1159
|
+
/** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
|
|
921
1160
|
readonly runs: bigint
|
|
922
|
-
/** See [edr_solidity_tests::result::TestKind::Fuzz] */
|
|
1161
|
+
/** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
|
|
923
1162
|
readonly meanGas: bigint
|
|
924
|
-
/** See [edr_solidity_tests::result::TestKind::Fuzz] */
|
|
1163
|
+
/** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
|
|
925
1164
|
readonly medianGas: bigint
|
|
926
1165
|
}
|
|
927
|
-
/** See [edr_solidity_tests::fuzz::FuzzCase] */
|
|
1166
|
+
/** See [`edr_solidity_tests::fuzz::FuzzCase`] */
|
|
928
1167
|
export interface FuzzCase {
|
|
929
1168
|
/** The calldata used for this fuzz test */
|
|
930
1169
|
readonly calldata: Uint8Array
|
|
@@ -933,14 +1172,24 @@ export interface FuzzCase {
|
|
|
933
1172
|
/** The initial gas stipend for the transaction */
|
|
934
1173
|
readonly stipend: bigint
|
|
935
1174
|
}
|
|
936
|
-
/** See [edr_solidity_tests::result::TestKind::Invariant] */
|
|
1175
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
937
1176
|
export interface InvariantTestKind {
|
|
938
|
-
/** See [edr_solidity_tests::result::TestKind::Invariant] */
|
|
1177
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
939
1178
|
readonly runs: bigint
|
|
940
|
-
/** See [edr_solidity_tests::result::TestKind::Invariant] */
|
|
1179
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
1180
|
+
readonly calls: bigint
|
|
1181
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
1182
|
+
readonly reverts: bigint
|
|
1183
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
1184
|
+
readonly metrics: Record<string, InvariantMetrics>
|
|
1185
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
1186
|
+
readonly failedCorpusReplays: bigint
|
|
1187
|
+
}
|
|
1188
|
+
/** See [`edr_solidity_tests::result::InvariantMetrics`] */
|
|
1189
|
+
export interface InvariantMetrics {
|
|
941
1190
|
readonly calls: bigint
|
|
942
|
-
/** See [edr_solidity_tests::result::TestKind::Invariant] */
|
|
943
1191
|
readonly reverts: bigint
|
|
1192
|
+
readonly discards: bigint
|
|
944
1193
|
}
|
|
945
1194
|
/**
|
|
946
1195
|
* Original sequence size and sequence of calls used as a counter example
|
|
@@ -952,19 +1201,19 @@ export interface CounterExampleSequence {
|
|
|
952
1201
|
/** The shrunk counterexample sequence. */
|
|
953
1202
|
sequence: Array<BaseCounterExample>
|
|
954
1203
|
}
|
|
955
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample] */
|
|
1204
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample`] */
|
|
956
1205
|
export interface BaseCounterExample {
|
|
957
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::sender] */
|
|
1206
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::sender`] */
|
|
958
1207
|
readonly sender?: Uint8Array
|
|
959
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::addr] */
|
|
1208
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::addr`] */
|
|
960
1209
|
readonly address?: Uint8Array
|
|
961
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::calldata] */
|
|
1210
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::calldata`] */
|
|
962
1211
|
readonly calldata: Uint8Array
|
|
963
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::contract_name] */
|
|
1212
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::contract_name`] */
|
|
964
1213
|
readonly contractName?: string
|
|
965
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::signature] */
|
|
1214
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::signature`] */
|
|
966
1215
|
readonly signature?: string
|
|
967
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::args] */
|
|
1216
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::args`] */
|
|
968
1217
|
readonly args?: string
|
|
969
1218
|
}
|
|
970
1219
|
/**
|
|
@@ -1050,6 +1299,11 @@ export interface DecodedTraceParameters {
|
|
|
1050
1299
|
*/
|
|
1051
1300
|
arguments: Array<string>
|
|
1052
1301
|
}
|
|
1302
|
+
/** The result of a Solidity test run. */
|
|
1303
|
+
export interface SolidityTestResult {
|
|
1304
|
+
/** Gas report, if it was generated. */
|
|
1305
|
+
readonly gasReport?: GasReport
|
|
1306
|
+
}
|
|
1053
1307
|
/** Configuration for subscriptions. */
|
|
1054
1308
|
export interface SubscriptionConfig {
|
|
1055
1309
|
/** Callback to be called when a new event is received. */
|
|
@@ -1250,6 +1504,7 @@ export interface CheatcodeErrorStackTraceEntry {
|
|
|
1250
1504
|
type: StackTraceEntryType.CHEATCODE_ERROR
|
|
1251
1505
|
message: string
|
|
1252
1506
|
sourceReference: SourceReference
|
|
1507
|
+
details?: CheatcodeErrorDetails
|
|
1253
1508
|
}
|
|
1254
1509
|
export interface TracingMessage {
|
|
1255
1510
|
/** Sender address */
|
|
@@ -1294,11 +1549,6 @@ export interface TracingMessageResult {
|
|
|
1294
1549
|
/** Execution result */
|
|
1295
1550
|
readonly executionResult: ExecutionResult
|
|
1296
1551
|
}
|
|
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
1552
|
export interface Withdrawal {
|
|
1303
1553
|
/** The index of withdrawal */
|
|
1304
1554
|
index: bigint
|
|
@@ -1310,22 +1560,43 @@ export interface Withdrawal {
|
|
|
1310
1560
|
amount: bigint
|
|
1311
1561
|
}
|
|
1312
1562
|
export declare class EdrContext {
|
|
1313
|
-
/**Creates a new [`EdrContext`] instance. Should only be called once! */
|
|
1563
|
+
/** Creates a new [`EdrContext`] instance. Should only be called once! */
|
|
1314
1564
|
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. */
|
|
1565
|
+
/** Constructs a new provider with the provided configuration. */
|
|
1566
|
+
createProvider(chainType: string, providerConfig: ProviderConfig, loggerConfig: LoggerConfig, subscriptionConfig: SubscriptionConfig, contractDecoder: ContractDecoder): Promise<Provider>
|
|
1567
|
+
/** Registers a new provider factory for the provided chain type. */
|
|
1318
1568
|
registerProviderFactory(chainType: string, factory: ProviderFactory): Promise<void>
|
|
1319
1569
|
registerSolidityTestRunnerFactory(chainType: string, factory: SolidityTestRunnerFactory): Promise<void>
|
|
1320
1570
|
/**
|
|
1321
|
-
*Executes Solidity tests
|
|
1571
|
+
* Executes Solidity tests
|
|
1322
1572
|
*
|
|
1323
|
-
*The function will return
|
|
1324
|
-
*
|
|
1325
|
-
*
|
|
1326
|
-
*
|
|
1327
|
-
|
|
1328
|
-
|
|
1573
|
+
* The function will return a promise that resolves to a
|
|
1574
|
+
* [`SolidityTestResult`].
|
|
1575
|
+
*
|
|
1576
|
+
* Arguments:
|
|
1577
|
+
* - `chainType`: the same chain type that was passed to
|
|
1578
|
+
* `registerProviderFactory`.
|
|
1579
|
+
* - `artifacts`: the project's compilation output artifacts. It's
|
|
1580
|
+
* important to include include all artifacts here, otherwise cheatcodes
|
|
1581
|
+
* that access artifacts and other functionality (e.g. auto-linking, gas
|
|
1582
|
+
* reports) can break.
|
|
1583
|
+
* - `testSuites`: the test suite ids that specify which test suites to
|
|
1584
|
+
* execute. The test suite artifacts must be present in `artifacts`.
|
|
1585
|
+
* - `configArgs`: solidity test runner configuration. See the struct docs
|
|
1586
|
+
* for details.
|
|
1587
|
+
* - `tracingConfig`: the build infos used for stack trace generation.
|
|
1588
|
+
* These are lazily parsed and it's important that they're passed as
|
|
1589
|
+
* Uint8 arrays for performance.
|
|
1590
|
+
* - `onTestSuiteCompletedCallback`: The progress callback will be called
|
|
1591
|
+
* with the results of each test suite as soon as it finished executing.
|
|
1592
|
+
*/
|
|
1593
|
+
runSolidityTests(chainType: string, artifacts: Array<Artifact>, testSuites: Array<ArtifactId>, configArgs: SolidityTestRunnerConfigArgs, tracingConfig: TracingConfigWithBuffers, onTestSuiteCompletedCallback: (result: SuiteResult) => void): Promise<SolidityTestResult>
|
|
1594
|
+
}
|
|
1595
|
+
export declare class ContractDecoder {
|
|
1596
|
+
/**Creates an empty instance. */
|
|
1597
|
+
constructor()
|
|
1598
|
+
/**Creates a new instance with the provided configuration. */
|
|
1599
|
+
static withContracts(config: TracingConfigWithBuffers): ContractDecoder
|
|
1329
1600
|
}
|
|
1330
1601
|
export declare class Precompile {
|
|
1331
1602
|
/** Returns the address of the precompile. */
|
|
@@ -1336,9 +1607,15 @@ export declare class Response {
|
|
|
1336
1607
|
/**Returns the response data as a JSON string or a JSON object. */
|
|
1337
1608
|
get data(): string | any
|
|
1338
1609
|
/**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
|
-
|
|
1610
|
+
stackTrace(): StackTrace | UnexpectedError | HeuristicFailed | null
|
|
1611
|
+
/**
|
|
1612
|
+
* Constructs the execution traces for the request. Returns an empty array
|
|
1613
|
+
* if traces are not enabled for this provider according to
|
|
1614
|
+
* [`crate::solidity_tests::config::SolidityTestRunnerConfigArgs::include_traces`]. Otherwise, returns
|
|
1615
|
+
* an array of the root calls of the trace, which always includes the
|
|
1616
|
+
* request's call itself.
|
|
1617
|
+
*/
|
|
1618
|
+
callTraces(): Array<CallTrace>
|
|
1342
1619
|
}
|
|
1343
1620
|
/** A JSON-RPC provider for Ethereum. */
|
|
1344
1621
|
export declare class Provider {
|
|
@@ -1347,7 +1624,9 @@ export declare class Provider {
|
|
|
1347
1624
|
*
|
|
1348
1625
|
*For internal use only. Support for this method may be removed in the future.
|
|
1349
1626
|
*/
|
|
1350
|
-
addCompilationResult(solcVersion: string, compilerInput: any, compilerOutput: any): Promise<
|
|
1627
|
+
addCompilationResult(solcVersion: string, compilerInput: any, compilerOutput: any): Promise<void>
|
|
1628
|
+
/**Retrieves the instance's contract decoder. */
|
|
1629
|
+
contractDecoder(): ContractDecoder
|
|
1351
1630
|
/**Handles a JSON-RPC request and returns a JSON-RPC response. */
|
|
1352
1631
|
handleRequest(request: string): Promise<Response>
|
|
1353
1632
|
setCallOverrideCallback(callOverrideCallback: (contract_address: ArrayBuffer, data: ArrayBuffer) => Promise<CallOverrideResult | undefined>): Promise<void>
|
|
@@ -1360,35 +1639,35 @@ export declare class Provider {
|
|
|
1360
1639
|
setVerboseTracing(verboseTracing: boolean): Promise<void>
|
|
1361
1640
|
}
|
|
1362
1641
|
export declare class SolidityTestRunnerFactory { }
|
|
1363
|
-
/** See [edr_solidity_tests::result::SuiteResult] */
|
|
1642
|
+
/** See [`edr_solidity_tests::result::SuiteResult`] */
|
|
1364
1643
|
export declare class SuiteResult {
|
|
1365
1644
|
/**
|
|
1366
1645
|
* The artifact id can be used to match input to result in the progress
|
|
1367
1646
|
* callback
|
|
1368
1647
|
*/
|
|
1369
1648
|
readonly id: ArtifactId
|
|
1370
|
-
/** See [edr_solidity_tests::result::SuiteResult::duration] */
|
|
1649
|
+
/** See [`edr_solidity_tests::result::SuiteResult::duration`] */
|
|
1371
1650
|
readonly durationNs: bigint
|
|
1372
|
-
/** See [edr_solidity_tests::result::SuiteResult::test_results] */
|
|
1651
|
+
/** See [`edr_solidity_tests::result::SuiteResult::test_results`] */
|
|
1373
1652
|
readonly testResults: Array<TestResult>
|
|
1374
|
-
/** See [edr_solidity_tests::result::SuiteResult::warnings] */
|
|
1653
|
+
/** See [`edr_solidity_tests::result::SuiteResult::warnings`] */
|
|
1375
1654
|
readonly warnings: Array<string>
|
|
1376
1655
|
}
|
|
1377
|
-
/** See [edr_solidity_tests::result::TestResult] */
|
|
1656
|
+
/** See [`edr_solidity_tests::result::TestResult`] */
|
|
1378
1657
|
export declare class TestResult {
|
|
1379
1658
|
/** The name of the test. */
|
|
1380
1659
|
readonly name: string
|
|
1381
|
-
/** See [edr_solidity_tests::result::TestResult::status] */
|
|
1660
|
+
/** See [`edr_solidity_tests::result::TestResult::status`] */
|
|
1382
1661
|
readonly status: TestStatus
|
|
1383
|
-
/** See [edr_solidity_tests::result::TestResult::reason] */
|
|
1662
|
+
/** See [`edr_solidity_tests::result::TestResult::reason`] */
|
|
1384
1663
|
readonly reason?: string
|
|
1385
|
-
/** See [edr_solidity_tests::result::TestResult::counterexample] */
|
|
1664
|
+
/** See [`edr_solidity_tests::result::TestResult::counterexample`] */
|
|
1386
1665
|
readonly counterexample?: BaseCounterExample | CounterExampleSequence
|
|
1387
|
-
/** See [edr_solidity_tests::result::TestResult::decoded_logs] */
|
|
1666
|
+
/** See [`edr_solidity_tests::result::TestResult::decoded_logs`] */
|
|
1388
1667
|
readonly decodedLogs: Array<string>
|
|
1389
|
-
/** See [edr_solidity_tests::result::TestResult::kind] */
|
|
1668
|
+
/** See [`edr_solidity_tests::result::TestResult::kind`] */
|
|
1390
1669
|
readonly kind: StandardTestKind | FuzzTestKind | InvariantTestKind
|
|
1391
|
-
/** See [edr_solidity_tests::result::TestResult::duration] */
|
|
1670
|
+
/** See [`edr_solidity_tests::result::TestResult::duration`] */
|
|
1392
1671
|
readonly durationNs: bigint
|
|
1393
1672
|
/**
|
|
1394
1673
|
* Groups of value snapshot entries (incl. gas).
|