@nomicfoundation/edr 0.12.0-next.2 → 0.12.0-next.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -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,8 @@ 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
247
276
  }
248
277
  /** Configuration for a provider */
249
278
  export interface ProviderConfig {
@@ -255,6 +284,17 @@ export interface ProviderConfig {
255
284
  bailOnCallFailure: boolean
256
285
  /** Whether to return an `Err` when a `eth_sendTransaction` fails */
257
286
  bailOnTransactionFailure: boolean
287
+ /**
288
+ * EIP-1559 base fee parameters activations to be used to calculate the
289
+ * block base fee.
290
+ *
291
+ * Provide an ordered list of `base_fee_params` to be
292
+ * used starting from the specified activation point (hardfork or block
293
+ * number).
294
+ * If not provided, the default values from the chain spec
295
+ * will be used.
296
+ */
297
+ baseFeeConfig?: Array<BaseFeeParamActivation>
258
298
  /** The gas limit of each block */
259
299
  blockGasLimit: bigint
260
300
  /** The chain ID of the blockchain */
@@ -296,6 +336,14 @@ export interface ProviderConfig {
296
336
  ownedAccounts: Array<string>
297
337
  /** Overrides for precompiles */
298
338
  precompileOverrides: Array<Precompile>
339
+ /**
340
+ * Transaction gas cap, introduced in [EIP-7825].
341
+ *
342
+ * When not set, will default to value defined by the used hardfork
343
+ *
344
+ * [EIP-7825]: https://eips.ethereum.org/EIPS/eip-7825
345
+ */
346
+ transactionGasCap?: bigint
299
347
  }
300
348
  /** Tracing config for Solidity stack trace generation. */
301
349
  export interface TracingConfigWithBuffers {
@@ -347,6 +395,27 @@ export interface DebugTraceLogItem {
347
395
  /** Map of all stored values with keys and values encoded as hex strings. */
348
396
  storage?: Record<string, string>
349
397
  }
398
+ export interface GasReport {
399
+ contracts: Record<string, ContractGasReport>
400
+ }
401
+ export interface ContractGasReport {
402
+ deployments: Array<DeploymentGasReport>
403
+ functions: Record<string, Array<FunctionGasReport>>
404
+ }
405
+ export enum GasReportExecutionStatus {
406
+ Success = 0,
407
+ Revert = 1,
408
+ Halt = 2
409
+ }
410
+ export interface DeploymentGasReport {
411
+ gas: bigint
412
+ size: bigint
413
+ status: GasReportExecutionStatus
414
+ }
415
+ export interface FunctionGasReport {
416
+ gas: bigint
417
+ status: GasReportExecutionStatus
418
+ }
350
419
  export interface InstrumentationResult {
351
420
  /** The generated source code with coverage instrumentation. */
352
421
  readonly source: string
@@ -405,8 +474,7 @@ export enum SuccessReason {
405
474
  /** The opcode `RETURN` was called */
406
475
  Return = 1,
407
476
  /** The opcode `SELFDESTRUCT` was called */
408
- SelfDestruct = 2,
409
- EofReturnContract = 3
477
+ SelfDestruct = 2
410
478
  }
411
479
  export interface CallOutput {
412
480
  /** Return value */
@@ -459,15 +527,7 @@ export enum ExceptionalHalt {
459
527
  /** Error on created contract that begins with EF */
460
528
  CreateContractStartingWithEF = 12,
461
529
  /** 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
530
+ CreateInitCodeSizeLimit = 13
471
531
  }
472
532
  /** The result when the EVM terminates due to an exceptional halt. */
473
533
  export interface HaltResult {
@@ -537,8 +597,6 @@ export interface SolidityTestRunnerConfigArgs {
537
597
  projectRoot: string
538
598
  /** Configures the permissions of cheat codes that access the file system. */
539
599
  fsPermissions?: Array<PathPermission>
540
- /** Whether to support the `testFail` prefix. Defaults to false. */
541
- testFail?: boolean
542
600
  /** Address labels for traces. Defaults to none. */
543
601
  labels?: Array<AddressLabel>
544
602
  /**
@@ -628,7 +686,7 @@ export interface SolidityTestRunnerConfigArgs {
628
686
  disableBlockGasLimit?: boolean
629
687
  /**
630
688
  * The memory limit of the EVM in bytes.
631
- * Defaults to 33_554_432 (2^25 = 32MiB).
689
+ * Defaults to `33_554_432` (2^25 = 32MiB).
632
690
  */
633
691
  memoryLimit?: bigint
634
692
  /**
@@ -673,6 +731,8 @@ export interface SolidityTestRunnerConfigArgs {
673
731
  * config value is set, then the fuzz config value will be used.
674
732
  */
675
733
  invariant?: InvariantConfigArgs
734
+ /** Whether to collect stack traces. */
735
+ collectStackTraces?: CollectStackTraces
676
736
  /**
677
737
  * Controls which test results should include execution traces. Defaults to
678
738
  * None.
@@ -685,6 +745,13 @@ export interface SolidityTestRunnerConfigArgs {
685
745
  * match the pattern will be executed and reported as a test result.
686
746
  */
687
747
  testPattern?: string
748
+ /**
749
+ * Controls whether to generate a gas report after running the tests.
750
+ * Enabling this also enables collection of all traces and EVM isolation
751
+ * mode.
752
+ * Defaults to false.
753
+ */
754
+ generateGasReport?: boolean
688
755
  }
689
756
  /** Fuzz testing configuration */
690
757
  export interface FuzzConfigArgs {
@@ -780,6 +847,12 @@ export interface InvariantConfigArgs {
780
847
  * Defaults to 5000.
781
848
  */
782
849
  shrinkRunLimit?: number
850
+ /**
851
+ * The maximum number of rejects via `vm.assume` which can be encountered
852
+ * during a single invariant run.
853
+ * Defaults to 65536.
854
+ */
855
+ maxAssumeRejects?: number
783
856
  }
784
857
  /** Settings to configure caching of remote RPC endpoints. */
785
858
  export interface StorageCachingConfig {
@@ -812,14 +885,36 @@ export interface PathPermission {
812
885
  /** The targeted path guarded by the permission */
813
886
  path: string
814
887
  }
815
- /** Determines the status of file system access */
888
+ /**
889
+ * Determines the level of file system access for the given path.
890
+ *
891
+ * Exact path matching is used for file permissions. Prefix matching is used
892
+ * for directory permissions.
893
+ *
894
+ * Giving write access to configuration files, source files or executables
895
+ * in a project is considered dangerous, because it can be used by malicious
896
+ * Solidity dependencies to escape the EVM sandbox. It is therefore
897
+ * recommended to give write access to specific safe files only. If write
898
+ * access to a directory is needed, please make sure that it doesn't contain
899
+ * configuration files, source files or executables neither in the top level
900
+ * directory, nor in any subdirectories.
901
+ */
816
902
  export enum FsAccessPermission {
817
- /** FS access is allowed with `read` + `write` permission */
818
- ReadWrite = 0,
819
- /** Only reading is allowed */
820
- Read = 1,
821
- /** Only writing is allowed */
822
- Write = 2
903
+ /** Allows reading and writing the file */
904
+ ReadWriteFile = 0,
905
+ /** Only allows reading the file */
906
+ ReadFile = 1,
907
+ /** Only allows writing the file */
908
+ WriteFile = 2,
909
+ /**
910
+ * Allows reading and writing all files in the directory and its
911
+ * subdirectories
912
+ */
913
+ DangerouslyReadWriteDirectory = 3,
914
+ /** Allows reading all files in the directory and its subdirectories */
915
+ ReadDirectory = 4,
916
+ /** Allows writing all files in the directory and its subdirectories */
917
+ DangerouslyWriteDirectory = 5
823
918
  }
824
919
  export interface AddressLabel {
825
920
  /** The address to label */
@@ -827,6 +922,19 @@ export interface AddressLabel {
827
922
  /** The label to assign to the address */
828
923
  label: string
829
924
  }
925
+ /** A type that controls when stack traces are collected. */
926
+ export enum CollectStackTraces {
927
+ /** Always collects stack traces, adding performance overhead. */
928
+ Always = 0,
929
+ /**
930
+ * Only collects stack traces upon failure, re-executing the test. This
931
+ * minimizes performance overhead.
932
+ *
933
+ * Not all tests can be re-executed since certain cheatcodes contain
934
+ * non-deterministic side-effects.
935
+ */
936
+ OnFailure = 1
937
+ }
830
938
  /**
831
939
  * Configuration for [`SolidityTestRunnerConfigArgs::include_traces`] that
832
940
  * controls execution trace decoding and inclusion in test results.
@@ -910,21 +1018,21 @@ export enum TestStatus {
910
1018
  /**Test skipped */
911
1019
  Skipped = 'Skipped'
912
1020
  }
913
- /** See [edr_solidity_tests::result::TestKind::Standard] */
1021
+ /** See [`edr_solidity_tests::result::TestKind::Unit`] */
914
1022
  export interface StandardTestKind {
915
1023
  /** The gas consumed by the test. */
916
1024
  readonly consumedGas: bigint
917
1025
  }
918
- /** See [edr_solidity_tests::result::TestKind::Fuzz] */
1026
+ /** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
919
1027
  export interface FuzzTestKind {
920
- /** See [edr_solidity_tests::result::TestKind::Fuzz] */
1028
+ /** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
921
1029
  readonly runs: bigint
922
- /** See [edr_solidity_tests::result::TestKind::Fuzz] */
1030
+ /** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
923
1031
  readonly meanGas: bigint
924
- /** See [edr_solidity_tests::result::TestKind::Fuzz] */
1032
+ /** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
925
1033
  readonly medianGas: bigint
926
1034
  }
927
- /** See [edr_solidity_tests::fuzz::FuzzCase] */
1035
+ /** See [`edr_solidity_tests::fuzz::FuzzCase`] */
928
1036
  export interface FuzzCase {
929
1037
  /** The calldata used for this fuzz test */
930
1038
  readonly calldata: Uint8Array
@@ -933,14 +1041,24 @@ export interface FuzzCase {
933
1041
  /** The initial gas stipend for the transaction */
934
1042
  readonly stipend: bigint
935
1043
  }
936
- /** See [edr_solidity_tests::result::TestKind::Invariant] */
1044
+ /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
937
1045
  export interface InvariantTestKind {
938
- /** See [edr_solidity_tests::result::TestKind::Invariant] */
1046
+ /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
939
1047
  readonly runs: bigint
940
- /** See [edr_solidity_tests::result::TestKind::Invariant] */
1048
+ /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
1049
+ readonly calls: bigint
1050
+ /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
1051
+ readonly reverts: bigint
1052
+ /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
1053
+ readonly metrics: Record<string, InvariantMetrics>
1054
+ /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
1055
+ readonly failedCorpusReplays: bigint
1056
+ }
1057
+ /** See [`edr_solidity_tests::result::InvariantMetrics`] */
1058
+ export interface InvariantMetrics {
941
1059
  readonly calls: bigint
942
- /** See [edr_solidity_tests::result::TestKind::Invariant] */
943
1060
  readonly reverts: bigint
1061
+ readonly discards: bigint
944
1062
  }
945
1063
  /**
946
1064
  * Original sequence size and sequence of calls used as a counter example
@@ -952,19 +1070,19 @@ export interface CounterExampleSequence {
952
1070
  /** The shrunk counterexample sequence. */
953
1071
  sequence: Array<BaseCounterExample>
954
1072
  }
955
- /** See [edr_solidity_tests::fuzz::BaseCounterExample] */
1073
+ /** See [`edr_solidity_tests::fuzz::BaseCounterExample`] */
956
1074
  export interface BaseCounterExample {
957
- /** See [edr_solidity_tests::fuzz::BaseCounterExample::sender] */
1075
+ /** See [`edr_solidity_tests::fuzz::BaseCounterExample::sender`] */
958
1076
  readonly sender?: Uint8Array
959
- /** See [edr_solidity_tests::fuzz::BaseCounterExample::addr] */
1077
+ /** See [`edr_solidity_tests::fuzz::BaseCounterExample::addr`] */
960
1078
  readonly address?: Uint8Array
961
- /** See [edr_solidity_tests::fuzz::BaseCounterExample::calldata] */
1079
+ /** See [`edr_solidity_tests::fuzz::BaseCounterExample::calldata`] */
962
1080
  readonly calldata: Uint8Array
963
- /** See [edr_solidity_tests::fuzz::BaseCounterExample::contract_name] */
1081
+ /** See [`edr_solidity_tests::fuzz::BaseCounterExample::contract_name`] */
964
1082
  readonly contractName?: string
965
- /** See [edr_solidity_tests::fuzz::BaseCounterExample::signature] */
1083
+ /** See [`edr_solidity_tests::fuzz::BaseCounterExample::signature`] */
966
1084
  readonly signature?: string
967
- /** See [edr_solidity_tests::fuzz::BaseCounterExample::args] */
1085
+ /** See [`edr_solidity_tests::fuzz::BaseCounterExample::args`] */
968
1086
  readonly args?: string
969
1087
  }
970
1088
  /**
@@ -1050,6 +1168,11 @@ export interface DecodedTraceParameters {
1050
1168
  */
1051
1169
  arguments: Array<string>
1052
1170
  }
1171
+ /** The result of a Solidity test run. */
1172
+ export interface SolidityTestResult {
1173
+ /** Gas report, if it was generated. */
1174
+ readonly gasReport?: GasReport
1175
+ }
1053
1176
  /** Configuration for subscriptions. */
1054
1177
  export interface SubscriptionConfig {
1055
1178
  /** Callback to be called when a new event is received. */
@@ -1115,7 +1238,8 @@ export enum StackTraceEntryType {
1115
1238
  UNMAPPED_SOLC_0_6_3_REVERT_ERROR = 20,
1116
1239
  CONTRACT_TOO_LARGE_ERROR = 21,
1117
1240
  INTERNAL_FUNCTION_CALLSTACK_ENTRY = 22,
1118
- CONTRACT_CALL_RUN_OUT_OF_GAS_ERROR = 23
1241
+ CONTRACT_CALL_RUN_OUT_OF_GAS_ERROR = 23,
1242
+ CHEATCODE_ERROR = 24
1119
1243
  }
1120
1244
  export declare function stackTraceEntryTypeToString(val: StackTraceEntryType): string
1121
1245
  export const FALLBACK_FUNCTION_NAME: string
@@ -1245,6 +1369,11 @@ export interface ContractCallRunOutOfGasError {
1245
1369
  type: StackTraceEntryType.CONTRACT_CALL_RUN_OUT_OF_GAS_ERROR
1246
1370
  sourceReference?: SourceReference
1247
1371
  }
1372
+ export interface CheatcodeErrorStackTraceEntry {
1373
+ type: StackTraceEntryType.CHEATCODE_ERROR
1374
+ message: string
1375
+ sourceReference: SourceReference
1376
+ }
1248
1377
  export interface TracingMessage {
1249
1378
  /** Sender address */
1250
1379
  readonly caller: Uint8Array
@@ -1304,22 +1433,43 @@ export interface Withdrawal {
1304
1433
  amount: bigint
1305
1434
  }
1306
1435
  export declare class EdrContext {
1307
- /**Creates a new [`EdrContext`] instance. Should only be called once! */
1436
+ /** Creates a new [`EdrContext`] instance. Should only be called once! */
1308
1437
  constructor()
1309
- /**Constructs a new provider with the provided configuration. */
1310
- createProvider(chainType: string, providerConfig: ProviderConfig, loggerConfig: LoggerConfig, subscriptionConfig: SubscriptionConfig, tracingConfig: TracingConfigWithBuffers): Promise<Provider>
1311
- /**Registers a new provider factory for the provided chain type. */
1438
+ /** Constructs a new provider with the provided configuration. */
1439
+ createProvider(chainType: string, providerConfig: ProviderConfig, loggerConfig: LoggerConfig, subscriptionConfig: SubscriptionConfig, contractDecoder: ContractDecoder): Promise<Provider>
1440
+ /** Registers a new provider factory for the provided chain type. */
1312
1441
  registerProviderFactory(chainType: string, factory: ProviderFactory): Promise<void>
1313
1442
  registerSolidityTestRunnerFactory(chainType: string, factory: SolidityTestRunnerFactory): Promise<void>
1314
1443
  /**
1315
- *Executes Solidity tests.
1444
+ * Executes Solidity tests
1316
1445
  *
1317
- *The function will return as soon as test execution is started.
1318
- *The progress callback will be called with the results of each test
1319
- *suite. It is up to the caller to track how many times the callback
1320
- *is called to know when all tests are done.
1321
- */
1322
- runSolidityTests(chainType: string, artifacts: Array<Artifact>, testSuites: Array<ArtifactId>, configArgs: SolidityTestRunnerConfigArgs, tracingConfig: TracingConfigWithBuffers, onTestSuiteCompletedCallback: (result: SuiteResult) => void): Promise<void>
1446
+ * The function will return a promise that resolves to a
1447
+ * [`SolidityTestResult`].
1448
+ *
1449
+ * Arguments:
1450
+ * - `chainType`: the same chain type that was passed to
1451
+ * `registerProviderFactory`.
1452
+ * - `artifacts`: the project's compilation output artifacts. It's
1453
+ * important to include include all artifacts here, otherwise cheatcodes
1454
+ * that access artifacts and other functionality (e.g. auto-linking, gas
1455
+ * reports) can break.
1456
+ * - `testSuites`: the test suite ids that specify which test suites to
1457
+ * execute. The test suite artifacts must be present in `artifacts`.
1458
+ * - `configArgs`: solidity test runner configuration. See the struct docs
1459
+ * for details.
1460
+ * - `tracingConfig`: the build infos used for stack trace generation.
1461
+ * These are lazily parsed and it's important that they're passed as
1462
+ * Uint8 arrays for performance.
1463
+ * - `onTestSuiteCompletedCallback`: The progress callback will be called
1464
+ * with the results of each test suite as soon as it finished executing.
1465
+ */
1466
+ runSolidityTests(chainType: string, artifacts: Array<Artifact>, testSuites: Array<ArtifactId>, configArgs: SolidityTestRunnerConfigArgs, tracingConfig: TracingConfigWithBuffers, onTestSuiteCompletedCallback: (result: SuiteResult) => void): Promise<SolidityTestResult>
1467
+ }
1468
+ export declare class ContractDecoder {
1469
+ /**Creates an empty instance. */
1470
+ constructor()
1471
+ /**Creates a new instance with the provided configuration. */
1472
+ static withContracts(config: TracingConfigWithBuffers): ContractDecoder
1323
1473
  }
1324
1474
  export declare class Precompile {
1325
1475
  /** Returns the address of the precompile. */
@@ -1336,6 +1486,14 @@ export declare class Response {
1336
1486
  }
1337
1487
  /** A JSON-RPC provider for Ethereum. */
1338
1488
  export declare class Provider {
1489
+ /**
1490
+ *Adds a compilation result to the instance.
1491
+ *
1492
+ *For internal use only. Support for this method may be removed in the future.
1493
+ */
1494
+ addCompilationResult(solcVersion: string, compilerInput: any, compilerOutput: any): Promise<void>
1495
+ /**Retrieves the instance's contract decoder. */
1496
+ contractDecoder(): ContractDecoder
1339
1497
  /**Handles a JSON-RPC request and returns a JSON-RPC response. */
1340
1498
  handleRequest(request: string): Promise<Response>
1341
1499
  setCallOverrideCallback(callOverrideCallback: (contract_address: ArrayBuffer, data: ArrayBuffer) => Promise<CallOverrideResult | undefined>): Promise<void>
@@ -1348,35 +1506,35 @@ export declare class Provider {
1348
1506
  setVerboseTracing(verboseTracing: boolean): Promise<void>
1349
1507
  }
1350
1508
  export declare class SolidityTestRunnerFactory { }
1351
- /** See [edr_solidity_tests::result::SuiteResult] */
1509
+ /** See [`edr_solidity_tests::result::SuiteResult`] */
1352
1510
  export declare class SuiteResult {
1353
1511
  /**
1354
1512
  * The artifact id can be used to match input to result in the progress
1355
1513
  * callback
1356
1514
  */
1357
1515
  readonly id: ArtifactId
1358
- /** See [edr_solidity_tests::result::SuiteResult::duration] */
1516
+ /** See [`edr_solidity_tests::result::SuiteResult::duration`] */
1359
1517
  readonly durationNs: bigint
1360
- /** See [edr_solidity_tests::result::SuiteResult::test_results] */
1518
+ /** See [`edr_solidity_tests::result::SuiteResult::test_results`] */
1361
1519
  readonly testResults: Array<TestResult>
1362
- /** See [edr_solidity_tests::result::SuiteResult::warnings] */
1520
+ /** See [`edr_solidity_tests::result::SuiteResult::warnings`] */
1363
1521
  readonly warnings: Array<string>
1364
1522
  }
1365
- /** See [edr_solidity_tests::result::TestResult] */
1523
+ /** See [`edr_solidity_tests::result::TestResult`] */
1366
1524
  export declare class TestResult {
1367
1525
  /** The name of the test. */
1368
1526
  readonly name: string
1369
- /** See [edr_solidity_tests::result::TestResult::status] */
1527
+ /** See [`edr_solidity_tests::result::TestResult::status`] */
1370
1528
  readonly status: TestStatus
1371
- /** See [edr_solidity_tests::result::TestResult::reason] */
1529
+ /** See [`edr_solidity_tests::result::TestResult::reason`] */
1372
1530
  readonly reason?: string
1373
- /** See [edr_solidity_tests::result::TestResult::counterexample] */
1531
+ /** See [`edr_solidity_tests::result::TestResult::counterexample`] */
1374
1532
  readonly counterexample?: BaseCounterExample | CounterExampleSequence
1375
- /** See [edr_solidity_tests::result::TestResult::decoded_logs] */
1533
+ /** See [`edr_solidity_tests::result::TestResult::decoded_logs`] */
1376
1534
  readonly decodedLogs: Array<string>
1377
- /** See [edr_solidity_tests::result::TestResult::kind] */
1535
+ /** See [`edr_solidity_tests::result::TestResult::kind`] */
1378
1536
  readonly kind: StandardTestKind | FuzzTestKind | InvariantTestKind
1379
- /** See [edr_solidity_tests::result::TestResult::duration] */
1537
+ /** See [`edr_solidity_tests::result::TestResult::duration`] */
1380
1538
  readonly durationNs: bigint
1381
1539
  /**
1382
1540
  * Groups of value snapshot entries (incl. gas).
package/index.js CHANGED
@@ -310,7 +310,7 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { GENERIC_CHAIN_TYPE, genericChainProviderFactory, L1_CHAIN_TYPE, l1GenesisState, l1ProviderFactory, SpecId, l1HardforkFromString, l1HardforkToString, l1HardforkLatest, FRONTIER, FRONTIER_THAWING, HOMESTEAD, DAO_FORK, TANGERINE, SPURIOUS_DRAGON, BYZANTIUM, CONSTANTINOPLE, PETERSBURG, ISTANBUL, MUIR_GLACIER, BERLIN, LONDON, ARROW_GLACIER, GRAY_GLACIER, MERGE, SHANGHAI, CANCUN, PRAGUE, OpHardfork, opHardforkFromString, opHardforkToString, opLatestHardfork, OP_CHAIN_TYPE, opGenesisState, opProviderFactory, BEDROCK, REGOLITH, CANYON, ECOTONE, FJORD, GRANITE, HOLOCENE, ISTHMUS, MineOrdering, EdrContext, addStatementCoverageInstrumentation, Precompile, precompileP256Verify, ProviderFactory, Response, Provider, SuccessReason, ExceptionalHalt, CachedChains, CachedEndpoints, FsAccessPermission, IncludeTraces, SolidityTestRunnerFactory, l1SolidityTestRunnerFactory, opSolidityTestRunnerFactory, SuiteResult, TestResult, TestStatus, CallKind, LogKind, linkHexStringBytecode, printStackTrace, Exit, ExitCode, BytecodeWrapper, ContractFunctionType, ReturnData, StackTraceEntryType, stackTraceEntryTypeToString, FALLBACK_FUNCTION_NAME, RECEIVE_FUNCTION_NAME, CONSTRUCTOR_FUNCTION_NAME, UNRECOGNIZED_FUNCTION_NAME, UNKNOWN_FUNCTION_NAME, PRECOMPILE_FUNCTION_NAME, UNRECOGNIZED_CONTRACT_NAME, RawTrace, getLatestSupportedSolcVersion } = nativeBinding
313
+ const { GENERIC_CHAIN_TYPE, genericChainProviderFactory, L1_CHAIN_TYPE, l1GenesisState, l1ProviderFactory, SpecId, l1HardforkFromString, l1HardforkToString, l1HardforkLatest, FRONTIER, FRONTIER_THAWING, HOMESTEAD, DAO_FORK, TANGERINE, SPURIOUS_DRAGON, BYZANTIUM, CONSTANTINOPLE, PETERSBURG, ISTANBUL, MUIR_GLACIER, BERLIN, LONDON, ARROW_GLACIER, GRAY_GLACIER, MERGE, SHANGHAI, CANCUN, PRAGUE, OSAKA, OpHardfork, opHardforkFromString, opHardforkToString, opLatestHardfork, OP_CHAIN_TYPE, opGenesisState, opProviderFactory, BEDROCK, REGOLITH, CANYON, ECOTONE, FJORD, GRANITE, HOLOCENE, ISTHMUS, MineOrdering, EdrContext, ContractDecoder, GasReportExecutionStatus, addStatementCoverageInstrumentation, Precompile, precompileP256Verify, ProviderFactory, Response, Provider, SuccessReason, ExceptionalHalt, CachedChains, CachedEndpoints, FsAccessPermission, CollectStackTraces, IncludeTraces, SolidityTestRunnerFactory, l1SolidityTestRunnerFactory, opSolidityTestRunnerFactory, SuiteResult, TestResult, TestStatus, CallKind, LogKind, linkHexStringBytecode, printStackTrace, Exit, ExitCode, BytecodeWrapper, ContractFunctionType, ReturnData, StackTraceEntryType, stackTraceEntryTypeToString, FALLBACK_FUNCTION_NAME, RECEIVE_FUNCTION_NAME, CONSTRUCTOR_FUNCTION_NAME, UNRECOGNIZED_FUNCTION_NAME, UNKNOWN_FUNCTION_NAME, PRECOMPILE_FUNCTION_NAME, UNRECOGNIZED_CONTRACT_NAME, RawTrace, getLatestSupportedSolcVersion } = nativeBinding
314
314
 
315
315
  module.exports.GENERIC_CHAIN_TYPE = GENERIC_CHAIN_TYPE
316
316
  module.exports.genericChainProviderFactory = genericChainProviderFactory
@@ -340,6 +340,7 @@ module.exports.MERGE = MERGE
340
340
  module.exports.SHANGHAI = SHANGHAI
341
341
  module.exports.CANCUN = CANCUN
342
342
  module.exports.PRAGUE = PRAGUE
343
+ module.exports.OSAKA = OSAKA
343
344
  module.exports.OpHardfork = OpHardfork
344
345
  module.exports.opHardforkFromString = opHardforkFromString
345
346
  module.exports.opHardforkToString = opHardforkToString
@@ -357,6 +358,8 @@ module.exports.HOLOCENE = HOLOCENE
357
358
  module.exports.ISTHMUS = ISTHMUS
358
359
  module.exports.MineOrdering = MineOrdering
359
360
  module.exports.EdrContext = EdrContext
361
+ module.exports.ContractDecoder = ContractDecoder
362
+ module.exports.GasReportExecutionStatus = GasReportExecutionStatus
360
363
  module.exports.addStatementCoverageInstrumentation = addStatementCoverageInstrumentation
361
364
  module.exports.Precompile = Precompile
362
365
  module.exports.precompileP256Verify = precompileP256Verify
@@ -368,6 +371,7 @@ module.exports.ExceptionalHalt = ExceptionalHalt
368
371
  module.exports.CachedChains = CachedChains
369
372
  module.exports.CachedEndpoints = CachedEndpoints
370
373
  module.exports.FsAccessPermission = FsAccessPermission
374
+ module.exports.CollectStackTraces = CollectStackTraces
371
375
  module.exports.IncludeTraces = IncludeTraces
372
376
  module.exports.SolidityTestRunnerFactory = SolidityTestRunnerFactory
373
377
  module.exports.l1SolidityTestRunnerFactory = l1SolidityTestRunnerFactory
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nomicfoundation/edr",
3
- "version": "0.12.0-next.2",
3
+ "version": "0.12.0-next.20",
4
4
  "devDependencies": {
5
5
  "@napi-rs/cli": "^2.18.4",
6
6
  "@nomicfoundation/ethereumjs-util": "^9.0.4",
@@ -13,6 +13,7 @@
13
13
  "@typescript-eslint/parser": "5.61.0",
14
14
  "chai": "^4.3.6",
15
15
  "chai-as-promised": "^7.1.1",
16
+ "chalk": "^2.4.2",
16
17
  "eslint": "^8.44.0",
17
18
  "eslint-config-prettier": "9.1.0",
18
19
  "eslint-plugin-import": "2.27.5",
@@ -35,8 +36,7 @@
35
36
  "files": [
36
37
  "index.js",
37
38
  "index.d.ts",
38
- "src/",
39
- "dist/src/"
39
+ "src/"
40
40
  ],
41
41
  "license": "MIT",
42
42
  "main": "index.js",
@@ -57,14 +57,14 @@
57
57
  },
58
58
  "repository": "NomicFoundation/edr.git",
59
59
  "types": "index.d.ts",
60
- "optionalDependencies": {
61
- "@nomicfoundation/edr-darwin-arm64": "0.12.0-next.2",
62
- "@nomicfoundation/edr-darwin-x64": "0.12.0-next.2",
63
- "@nomicfoundation/edr-linux-arm64-gnu": "0.12.0-next.2",
64
- "@nomicfoundation/edr-linux-arm64-musl": "0.12.0-next.2",
65
- "@nomicfoundation/edr-linux-x64-gnu": "0.12.0-next.2",
66
- "@nomicfoundation/edr-linux-x64-musl": "0.12.0-next.2",
67
- "@nomicfoundation/edr-win32-x64-msvc": "0.12.0-next.2"
60
+ "dependencies": {
61
+ "@nomicfoundation/edr-darwin-arm64": "0.12.0-next.20",
62
+ "@nomicfoundation/edr-darwin-x64": "0.12.0-next.20",
63
+ "@nomicfoundation/edr-linux-arm64-gnu": "0.12.0-next.20",
64
+ "@nomicfoundation/edr-linux-arm64-musl": "0.12.0-next.20",
65
+ "@nomicfoundation/edr-linux-x64-gnu": "0.12.0-next.20",
66
+ "@nomicfoundation/edr-linux-x64-musl": "0.12.0-next.20",
67
+ "@nomicfoundation/edr-win32-x64-msvc": "0.12.0-next.20"
68
68
  },
69
69
  "scripts": {
70
70
  "artifacts": "napi artifacts",
@@ -82,7 +82,7 @@
82
82
  "pretest": "pnpm build:dev",
83
83
  "prettier": "prettier --check \"test/**.ts\"",
84
84
  "test": "node --max-old-space-size=8192 node_modules/mocha/bin/_mocha --recursive \"test/**/*.ts\"",
85
- "testNoBuild": "node --max-old-space-size=8192 node_modules/mocha/bin/_mocha --recursive \"test/**/{,!(mock)}.ts\"",
85
+ "testNoBuild": "node --max-old-space-size=8192 node_modules/mocha/bin/_mocha --recursive \"test/**/{,!(logs|mock)}.ts\"",
86
86
  "universal": "napi universal",
87
87
  "version": "napi version"
88
88
  }
package/src/account.rs CHANGED
@@ -1,6 +1,7 @@
1
1
  use derive_more::Debug;
2
- use edr_eth::{hex, HashMap, U256};
2
+ use edr_primitives::{hex, Address, HashMap, U256};
3
3
  use edr_solidity_tests::{backend::Predeploy, revm::state::AccountInfo};
4
+ use edr_state_api::EvmStorageSlot;
4
5
  use napi::bindgen_prelude::{BigInt, Uint8Array};
5
6
  use napi_derive::napi;
6
7
 
@@ -36,7 +37,7 @@ pub struct AccountOverride {
36
37
  pub storage: Option<Vec<StorageSlot>>,
37
38
  }
38
39
 
39
- impl TryFrom<AccountOverride> for (edr_eth::Address, edr_provider::AccountOverride) {
40
+ impl TryFrom<AccountOverride> for (Address, edr_provider::AccountOverride) {
40
41
  type Error = napi::Error;
41
42
 
42
43
  fn try_from(value: AccountOverride) -> Result<Self, Self::Error> {
@@ -53,9 +54,9 @@ impl TryFrom<AccountOverride> for (edr_eth::Address, edr_provider::AccountOverri
53
54
  .into_iter()
54
55
  .map(|StorageSlot { index, value }| {
55
56
  let value = value.try_cast()?;
56
- let slot = edr_evm::state::EvmStorageSlot::new(value);
57
+ let slot = EvmStorageSlot::new(value, 0);
57
58
 
58
- let index: edr_eth::U256 = index.try_cast()?;
59
+ let index: U256 = index.try_cast()?;
59
60
  Ok((index, slot))
60
61
  })
61
62
  .collect::<napi::Result<_>>()
@@ -69,7 +70,7 @@ impl TryFrom<AccountOverride> for (edr_eth::Address, edr_provider::AccountOverri
69
70
  storage,
70
71
  };
71
72
 
72
- let address: edr_eth::Address = address.try_cast()?;
73
+ let address: Address = address.try_cast()?;
73
74
 
74
75
  Ok((address, account_override))
75
76
  }
@@ -81,7 +82,7 @@ impl TryFrom<AccountOverride> for Predeploy {
81
82
  fn try_from(value: AccountOverride) -> Result<Self, Self::Error> {
82
83
  let (address, account_override) = value.try_into()?;
83
84
 
84
- let storage = account_override.storage.unwrap_or_else(HashMap::new);
85
+ let storage = account_override.storage.unwrap_or_else(HashMap::default);
85
86
  let balance = account_override.balance.unwrap_or(U256::ZERO);
86
87
  let nonce = account_override.nonce.unwrap_or(0);
87
88
  let code = account_override.code.ok_or_else(|| {
package/src/block.rs CHANGED
@@ -16,7 +16,7 @@ pub struct BlobGas {
16
16
  pub excess_gas: BigInt,
17
17
  }
18
18
 
19
- impl TryFrom<BlobGas> for edr_eth::block::BlobGas {
19
+ impl TryFrom<BlobGas> for edr_block_header::BlobGas {
20
20
  type Error = napi::Error;
21
21
 
22
22
  fn try_from(value: BlobGas) -> Result<Self, Self::Error> {
@@ -1,6 +1,6 @@
1
1
  use std::sync::mpsc::channel;
2
2
 
3
- use edr_eth::{Address, Bytes};
3
+ use edr_primitives::{Address, Bytes};
4
4
  use napi::{
5
5
  bindgen_prelude::{Promise, Uint8Array},
6
6
  threadsafe_function::{
package/src/cast.rs CHANGED
@@ -1,4 +1,4 @@
1
- use edr_eth::{Address, Bytecode, Bytes, B256, B64, U256};
1
+ use edr_primitives::{Address, Bytecode, Bytes, B256, B64, U256};
2
2
  use napi::{
3
3
  bindgen_prelude::{BigInt, Uint8Array},
4
4
  Status,