@nomicfoundation/edr 0.12.0-next.1 → 0.12.0-next.10

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
@@ -162,6 +162,20 @@ export const FJORD: string
162
162
  export const GRANITE: string
163
163
  export const HOLOCENE: string
164
164
  export const ISTHMUS: string
165
+ /** Configuration for EIP-1559 parameters */
166
+ export interface BaseFeeParamActivation {
167
+ activation: BaseFeeActivationByBlockNumber | BaseFeeActivationByHardfork
168
+ maxChangeDenominator: bigint
169
+ elasticityMultiplier: bigint
170
+ }
171
+ export interface BaseFeeActivationByBlockNumber {
172
+ /** The block number at which the `base_fee_params` is activated */
173
+ blockNumber: bigint
174
+ }
175
+ export interface BaseFeeActivationByHardfork {
176
+ /** The hardfork at which the `base_fee_params` is activated */
177
+ hardfork: string
178
+ }
165
179
  /** Specification of a chain with possible overrides. */
166
180
  export interface ChainOverride {
167
181
  /** The chain ID */
@@ -184,6 +198,16 @@ export interface CodeCoverageConfig {
184
198
  */
185
199
  onCollectedCoverageCallback: (coverageHits: Uint8Array[]) => Promise<void>
186
200
  }
201
+ export interface GasReportConfig {
202
+ /**
203
+ * Gas reports are collected after a block is mined or `eth_call` is
204
+ * executed.
205
+ *
206
+ * Exceptions thrown in the callback will be propagated to the original
207
+ * caller.
208
+ */
209
+ onCollectedGasReportCallback: (gasReport: GasReport) => Promise<void>
210
+ }
187
211
  /** Configuration for forking a blockchain */
188
212
  export interface ForkConfig {
189
213
  /**
@@ -244,6 +268,8 @@ export interface MiningConfig {
244
268
  export interface ObservabilityConfig {
245
269
  /** If present, configures runtime observability to collect code coverage. */
246
270
  codeCoverage?: CodeCoverageConfig
271
+ /** If present, configures runtime observability to collect gas reports. */
272
+ gasReport?: GasReportConfig
247
273
  }
248
274
  /** Configuration for a provider */
249
275
  export interface ProviderConfig {
@@ -255,6 +281,17 @@ export interface ProviderConfig {
255
281
  bailOnCallFailure: boolean
256
282
  /** Whether to return an `Err` when a `eth_sendTransaction` fails */
257
283
  bailOnTransactionFailure: boolean
284
+ /**
285
+ * EIP-1559 base fee parameters activations to be used to calculate the
286
+ * block base fee.
287
+ *
288
+ * Provide an ordered list of `base_fee_params` to be
289
+ * used starting from the specified activation point (hardfork or block
290
+ * number).
291
+ * If not provided, the default values from the chain spec
292
+ * will be used.
293
+ */
294
+ baseFeeConfig?: Array<BaseFeeParamActivation>
258
295
  /** The gas limit of each block */
259
296
  blockGasLimit: bigint
260
297
  /** The chain ID of the blockchain */
@@ -347,6 +384,27 @@ export interface DebugTraceLogItem {
347
384
  /** Map of all stored values with keys and values encoded as hex strings. */
348
385
  storage?: Record<string, string>
349
386
  }
387
+ export interface GasReport {
388
+ contracts: Record<string, ContractGasReport>
389
+ }
390
+ export interface ContractGasReport {
391
+ deployments: Array<DeploymentGasReport>
392
+ functions: Record<string, Array<FunctionGasReport>>
393
+ }
394
+ export enum GasReportExecutionStatus {
395
+ Success = 0,
396
+ Revert = 1,
397
+ Halt = 2
398
+ }
399
+ export interface DeploymentGasReport {
400
+ gas: bigint
401
+ size: bigint
402
+ status: GasReportExecutionStatus
403
+ }
404
+ export interface FunctionGasReport {
405
+ gas: bigint
406
+ status: GasReportExecutionStatus
407
+ }
350
408
  export interface InstrumentationResult {
351
409
  /** The generated source code with coverage instrumentation. */
352
410
  readonly source: string
@@ -405,8 +463,7 @@ export enum SuccessReason {
405
463
  /** The opcode `RETURN` was called */
406
464
  Return = 1,
407
465
  /** The opcode `SELFDESTRUCT` was called */
408
- SelfDestruct = 2,
409
- EofReturnContract = 3
466
+ SelfDestruct = 2
410
467
  }
411
468
  export interface CallOutput {
412
469
  /** Return value */
@@ -459,15 +516,7 @@ export enum ExceptionalHalt {
459
516
  /** Error on created contract that begins with EF */
460
517
  CreateContractStartingWithEF = 12,
461
518
  /** 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
519
+ CreateInitCodeSizeLimit = 13
471
520
  }
472
521
  /** The result when the EVM terminates due to an exceptional halt. */
473
522
  export interface HaltResult {
@@ -628,7 +677,7 @@ export interface SolidityTestRunnerConfigArgs {
628
677
  disableBlockGasLimit?: boolean
629
678
  /**
630
679
  * The memory limit of the EVM in bytes.
631
- * Defaults to 33_554_432 (2^25 = 32MiB).
680
+ * Defaults to `33_554_432` (2^25 = 32MiB).
632
681
  */
633
682
  memoryLimit?: bigint
634
683
  /**
@@ -673,6 +722,8 @@ export interface SolidityTestRunnerConfigArgs {
673
722
  * config value is set, then the fuzz config value will be used.
674
723
  */
675
724
  invariant?: InvariantConfigArgs
725
+ /** Whether to collect stack traces. */
726
+ collectStackTraces?: CollectStackTraces
676
727
  /**
677
728
  * Controls which test results should include execution traces. Defaults to
678
729
  * None.
@@ -685,6 +736,13 @@ export interface SolidityTestRunnerConfigArgs {
685
736
  * match the pattern will be executed and reported as a test result.
686
737
  */
687
738
  testPattern?: string
739
+ /**
740
+ * Controls whether to generate a gas report after running the tests.
741
+ * Enabling this also enables collection of all traces and EVM isolation
742
+ * mode.
743
+ * Defaults to false.
744
+ */
745
+ generateGasReport?: boolean
688
746
  }
689
747
  /** Fuzz testing configuration */
690
748
  export interface FuzzConfigArgs {
@@ -812,14 +870,36 @@ export interface PathPermission {
812
870
  /** The targeted path guarded by the permission */
813
871
  path: string
814
872
  }
815
- /** Determines the status of file system access */
873
+ /**
874
+ * Determines the level of file system access for the given path.
875
+ *
876
+ * Exact path matching is used for file permissions. Prefix matching is used
877
+ * for directory permissions.
878
+ *
879
+ * Giving write access to configuration files, source files or executables
880
+ * in a project is considered dangerous, because it can be used by malicious
881
+ * Solidity dependencies to escape the EVM sandbox. It is therefore
882
+ * recommended to give write access to specific safe files only. If write
883
+ * access to a directory is needed, please make sure that it doesn't contain
884
+ * configuration files, source files or executables neither in the top level
885
+ * directory, nor in any subdirectories.
886
+ */
816
887
  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
888
+ /** Allows reading and writing the file */
889
+ ReadWriteFile = 0,
890
+ /** Only allows reading the file */
891
+ ReadFile = 1,
892
+ /** Only allows writing the file */
893
+ WriteFile = 2,
894
+ /**
895
+ * Allows reading and writing all files in the directory and its
896
+ * subdirectories
897
+ */
898
+ DangerouslyReadWriteDirectory = 3,
899
+ /** Allows reading all files in the directory and its subdirectories */
900
+ ReadDirectory = 4,
901
+ /** Allows writing all files in the directory and its subdirectories */
902
+ DangerouslyWriteDirectory = 5
823
903
  }
824
904
  export interface AddressLabel {
825
905
  /** The address to label */
@@ -827,6 +907,19 @@ export interface AddressLabel {
827
907
  /** The label to assign to the address */
828
908
  label: string
829
909
  }
910
+ /** A type that controls when stack traces are collected. */
911
+ export enum CollectStackTraces {
912
+ /** Always collects stack traces, adding performance overhead. */
913
+ Always = 0,
914
+ /**
915
+ * Only collects stack traces upon failure, re-executing the test. This
916
+ * minimizes performance overhead.
917
+ *
918
+ * Not all tests can be re-executed since certain cheatcodes contain
919
+ * non-deterministic side-effects.
920
+ */
921
+ OnFailure = 1
922
+ }
830
923
  /**
831
924
  * Configuration for [`SolidityTestRunnerConfigArgs::include_traces`] that
832
925
  * controls execution trace decoding and inclusion in test results.
@@ -910,21 +1003,21 @@ export enum TestStatus {
910
1003
  /**Test skipped */
911
1004
  Skipped = 'Skipped'
912
1005
  }
913
- /** See [edr_solidity_tests::result::TestKind::Standard] */
1006
+ /** See [`edr_solidity_tests::result::TestKind::Standard`] */
914
1007
  export interface StandardTestKind {
915
1008
  /** The gas consumed by the test. */
916
1009
  readonly consumedGas: bigint
917
1010
  }
918
- /** See [edr_solidity_tests::result::TestKind::Fuzz] */
1011
+ /** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
919
1012
  export interface FuzzTestKind {
920
- /** See [edr_solidity_tests::result::TestKind::Fuzz] */
1013
+ /** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
921
1014
  readonly runs: bigint
922
- /** See [edr_solidity_tests::result::TestKind::Fuzz] */
1015
+ /** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
923
1016
  readonly meanGas: bigint
924
- /** See [edr_solidity_tests::result::TestKind::Fuzz] */
1017
+ /** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
925
1018
  readonly medianGas: bigint
926
1019
  }
927
- /** See [edr_solidity_tests::fuzz::FuzzCase] */
1020
+ /** See [`edr_solidity_tests::fuzz::FuzzCase`] */
928
1021
  export interface FuzzCase {
929
1022
  /** The calldata used for this fuzz test */
930
1023
  readonly calldata: Uint8Array
@@ -933,13 +1026,13 @@ export interface FuzzCase {
933
1026
  /** The initial gas stipend for the transaction */
934
1027
  readonly stipend: bigint
935
1028
  }
936
- /** See [edr_solidity_tests::result::TestKind::Invariant] */
1029
+ /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
937
1030
  export interface InvariantTestKind {
938
- /** See [edr_solidity_tests::result::TestKind::Invariant] */
1031
+ /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
939
1032
  readonly runs: bigint
940
- /** See [edr_solidity_tests::result::TestKind::Invariant] */
1033
+ /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
941
1034
  readonly calls: bigint
942
- /** See [edr_solidity_tests::result::TestKind::Invariant] */
1035
+ /** See [`edr_solidity_tests::result::TestKind::Invariant`] */
943
1036
  readonly reverts: bigint
944
1037
  }
945
1038
  /**
@@ -952,19 +1045,19 @@ export interface CounterExampleSequence {
952
1045
  /** The shrunk counterexample sequence. */
953
1046
  sequence: Array<BaseCounterExample>
954
1047
  }
955
- /** See [edr_solidity_tests::fuzz::BaseCounterExample] */
1048
+ /** See [`edr_solidity_tests::fuzz::BaseCounterExample`] */
956
1049
  export interface BaseCounterExample {
957
- /** See [edr_solidity_tests::fuzz::BaseCounterExample::sender] */
1050
+ /** See [`edr_solidity_tests::fuzz::BaseCounterExample::sender`] */
958
1051
  readonly sender?: Uint8Array
959
- /** See [edr_solidity_tests::fuzz::BaseCounterExample::addr] */
1052
+ /** See [`edr_solidity_tests::fuzz::BaseCounterExample::addr`] */
960
1053
  readonly address?: Uint8Array
961
- /** See [edr_solidity_tests::fuzz::BaseCounterExample::calldata] */
1054
+ /** See [`edr_solidity_tests::fuzz::BaseCounterExample::calldata`] */
962
1055
  readonly calldata: Uint8Array
963
- /** See [edr_solidity_tests::fuzz::BaseCounterExample::contract_name] */
1056
+ /** See [`edr_solidity_tests::fuzz::BaseCounterExample::contract_name`] */
964
1057
  readonly contractName?: string
965
- /** See [edr_solidity_tests::fuzz::BaseCounterExample::signature] */
1058
+ /** See [`edr_solidity_tests::fuzz::BaseCounterExample::signature`] */
966
1059
  readonly signature?: string
967
- /** See [edr_solidity_tests::fuzz::BaseCounterExample::args] */
1060
+ /** See [`edr_solidity_tests::fuzz::BaseCounterExample::args`] */
968
1061
  readonly args?: string
969
1062
  }
970
1063
  /**
@@ -982,11 +1075,10 @@ export interface CallTrace {
982
1075
  gasUsed: bigint
983
1076
  /** The amount of native token that was included with the call. */
984
1077
  value: bigint
985
- /**
986
- * The target of the call. Provided as a contract name if known, otherwise
987
- * a checksum address.
988
- */
989
- contract: string
1078
+ /** The target address of the call. */
1079
+ address: string
1080
+ /** The name of the contract that is the target of the call, if known. */
1081
+ contract?: string
990
1082
  /**
991
1083
  * The input (calldata) to the call. If it encodes a known function call,
992
1084
  * it will be decoded into the function name and a list of arguments.
@@ -1051,6 +1143,11 @@ export interface DecodedTraceParameters {
1051
1143
  */
1052
1144
  arguments: Array<string>
1053
1145
  }
1146
+ /** The result of a Solidity test run. */
1147
+ export interface SolidityTestResult {
1148
+ /** Gas report, if it was generated. */
1149
+ readonly gasReport?: GasReport
1150
+ }
1054
1151
  /** Configuration for subscriptions. */
1055
1152
  export interface SubscriptionConfig {
1056
1153
  /** Callback to be called when a new event is received. */
@@ -1116,7 +1213,8 @@ export enum StackTraceEntryType {
1116
1213
  UNMAPPED_SOLC_0_6_3_REVERT_ERROR = 20,
1117
1214
  CONTRACT_TOO_LARGE_ERROR = 21,
1118
1215
  INTERNAL_FUNCTION_CALLSTACK_ENTRY = 22,
1119
- CONTRACT_CALL_RUN_OUT_OF_GAS_ERROR = 23
1216
+ CONTRACT_CALL_RUN_OUT_OF_GAS_ERROR = 23,
1217
+ CHEATCODE_ERROR = 24
1120
1218
  }
1121
1219
  export declare function stackTraceEntryTypeToString(val: StackTraceEntryType): string
1122
1220
  export const FALLBACK_FUNCTION_NAME: string
@@ -1246,6 +1344,11 @@ export interface ContractCallRunOutOfGasError {
1246
1344
  type: StackTraceEntryType.CONTRACT_CALL_RUN_OUT_OF_GAS_ERROR
1247
1345
  sourceReference?: SourceReference
1248
1346
  }
1347
+ export interface CheatcodeErrorStackTraceEntry {
1348
+ type: StackTraceEntryType.CHEATCODE_ERROR
1349
+ message: string
1350
+ sourceReference: SourceReference
1351
+ }
1249
1352
  export interface TracingMessage {
1250
1353
  /** Sender address */
1251
1354
  readonly caller: Uint8Array
@@ -1305,22 +1408,43 @@ export interface Withdrawal {
1305
1408
  amount: bigint
1306
1409
  }
1307
1410
  export declare class EdrContext {
1308
- /**Creates a new [`EdrContext`] instance. Should only be called once! */
1411
+ /** Creates a new [`EdrContext`] instance. Should only be called once! */
1309
1412
  constructor()
1310
- /**Constructs a new provider with the provided configuration. */
1311
- createProvider(chainType: string, providerConfig: ProviderConfig, loggerConfig: LoggerConfig, subscriptionConfig: SubscriptionConfig, tracingConfig: TracingConfigWithBuffers): Promise<Provider>
1312
- /**Registers a new provider factory for the provided chain type. */
1413
+ /** Constructs a new provider with the provided configuration. */
1414
+ createProvider(chainType: string, providerConfig: ProviderConfig, loggerConfig: LoggerConfig, subscriptionConfig: SubscriptionConfig, contractDecoder: ContractDecoder): Promise<Provider>
1415
+ /** Registers a new provider factory for the provided chain type. */
1313
1416
  registerProviderFactory(chainType: string, factory: ProviderFactory): Promise<void>
1314
1417
  registerSolidityTestRunnerFactory(chainType: string, factory: SolidityTestRunnerFactory): Promise<void>
1315
1418
  /**
1316
- *Executes Solidity tests.
1419
+ * Executes Solidity tests
1317
1420
  *
1318
- *The function will return as soon as test execution is started.
1319
- *The progress callback will be called with the results of each test
1320
- *suite. It is up to the caller to track how many times the callback
1321
- *is called to know when all tests are done.
1322
- */
1323
- runSolidityTests(chainType: string, artifacts: Array<Artifact>, testSuites: Array<ArtifactId>, configArgs: SolidityTestRunnerConfigArgs, tracingConfig: TracingConfigWithBuffers, onTestSuiteCompletedCallback: (result: SuiteResult) => void): Promise<void>
1421
+ * The function will return a promise that resolves to a
1422
+ * [`SolidityTestResult`].
1423
+ *
1424
+ * Arguments:
1425
+ * - `chainType`: the same chain type that was passed to
1426
+ * `registerProviderFactory`.
1427
+ * - `artifacts`: the project's compilation output artifacts. It's
1428
+ * important to include include all artifacts here, otherwise cheatcodes
1429
+ * that access artifacts and other functionality (e.g. auto-linking, gas
1430
+ * reports) can break.
1431
+ * - `testSuites`: the test suite ids that specify which test suites to
1432
+ * execute. The test suite artifacts must be present in `artifacts`.
1433
+ * - `configArgs`: solidity test runner configuration. See the struct docs
1434
+ * for details.
1435
+ * - `tracingConfig`: the build infos used for stack trace generation.
1436
+ * These are lazily parsed and it's important that they're passed as
1437
+ * Uint8 arrays for performance.
1438
+ * - `onTestSuiteCompletedCallback`: The progress callback will be called
1439
+ * with the results of each test suite as soon as it finished executing.
1440
+ */
1441
+ runSolidityTests(chainType: string, artifacts: Array<Artifact>, testSuites: Array<ArtifactId>, configArgs: SolidityTestRunnerConfigArgs, tracingConfig: TracingConfigWithBuffers, onTestSuiteCompletedCallback: (result: SuiteResult) => void): Promise<SolidityTestResult>
1442
+ }
1443
+ export declare class ContractDecoder {
1444
+ /**Creates an empty instance. */
1445
+ constructor()
1446
+ /**Creates a new instance with the provided configuration. */
1447
+ static withContracts(config: TracingConfigWithBuffers): ContractDecoder
1324
1448
  }
1325
1449
  export declare class Precompile {
1326
1450
  /** Returns the address of the precompile. */
@@ -1337,6 +1461,14 @@ export declare class Response {
1337
1461
  }
1338
1462
  /** A JSON-RPC provider for Ethereum. */
1339
1463
  export declare class Provider {
1464
+ /**
1465
+ *Adds a compilation result to the instance.
1466
+ *
1467
+ *For internal use only. Support for this method may be removed in the future.
1468
+ */
1469
+ addCompilationResult(solcVersion: string, compilerInput: any, compilerOutput: any): Promise<void>
1470
+ /**Retrieves the instance's contract decoder. */
1471
+ contractDecoder(): ContractDecoder
1340
1472
  /**Handles a JSON-RPC request and returns a JSON-RPC response. */
1341
1473
  handleRequest(request: string): Promise<Response>
1342
1474
  setCallOverrideCallback(callOverrideCallback: (contract_address: ArrayBuffer, data: ArrayBuffer) => Promise<CallOverrideResult | undefined>): Promise<void>
@@ -1349,35 +1481,35 @@ export declare class Provider {
1349
1481
  setVerboseTracing(verboseTracing: boolean): Promise<void>
1350
1482
  }
1351
1483
  export declare class SolidityTestRunnerFactory { }
1352
- /** See [edr_solidity_tests::result::SuiteResult] */
1484
+ /** See [`edr_solidity_tests::result::SuiteResult`] */
1353
1485
  export declare class SuiteResult {
1354
1486
  /**
1355
1487
  * The artifact id can be used to match input to result in the progress
1356
1488
  * callback
1357
1489
  */
1358
1490
  readonly id: ArtifactId
1359
- /** See [edr_solidity_tests::result::SuiteResult::duration] */
1491
+ /** See [`edr_solidity_tests::result::SuiteResult::duration`] */
1360
1492
  readonly durationNs: bigint
1361
- /** See [edr_solidity_tests::result::SuiteResult::test_results] */
1493
+ /** See [`edr_solidity_tests::result::SuiteResult::test_results`] */
1362
1494
  readonly testResults: Array<TestResult>
1363
- /** See [edr_solidity_tests::result::SuiteResult::warnings] */
1495
+ /** See [`edr_solidity_tests::result::SuiteResult::warnings`] */
1364
1496
  readonly warnings: Array<string>
1365
1497
  }
1366
- /** See [edr_solidity_tests::result::TestResult] */
1498
+ /** See [`edr_solidity_tests::result::TestResult`] */
1367
1499
  export declare class TestResult {
1368
1500
  /** The name of the test. */
1369
1501
  readonly name: string
1370
- /** See [edr_solidity_tests::result::TestResult::status] */
1502
+ /** See [`edr_solidity_tests::result::TestResult::status`] */
1371
1503
  readonly status: TestStatus
1372
- /** See [edr_solidity_tests::result::TestResult::reason] */
1504
+ /** See [`edr_solidity_tests::result::TestResult::reason`] */
1373
1505
  readonly reason?: string
1374
- /** See [edr_solidity_tests::result::TestResult::counterexample] */
1506
+ /** See [`edr_solidity_tests::result::TestResult::counterexample`] */
1375
1507
  readonly counterexample?: BaseCounterExample | CounterExampleSequence
1376
- /** See [edr_solidity_tests::result::TestResult::decoded_logs] */
1508
+ /** See [`edr_solidity_tests::result::TestResult::decoded_logs`] */
1377
1509
  readonly decodedLogs: Array<string>
1378
- /** See [edr_solidity_tests::result::TestResult::kind] */
1510
+ /** See [`edr_solidity_tests::result::TestResult::kind`] */
1379
1511
  readonly kind: StandardTestKind | FuzzTestKind | InvariantTestKind
1380
- /** See [edr_solidity_tests::result::TestResult::duration] */
1512
+ /** See [`edr_solidity_tests::result::TestResult::duration`] */
1381
1513
  readonly durationNs: bigint
1382
1514
  /**
1383
1515
  * 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, 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
@@ -357,6 +357,8 @@ module.exports.HOLOCENE = HOLOCENE
357
357
  module.exports.ISTHMUS = ISTHMUS
358
358
  module.exports.MineOrdering = MineOrdering
359
359
  module.exports.EdrContext = EdrContext
360
+ module.exports.ContractDecoder = ContractDecoder
361
+ module.exports.GasReportExecutionStatus = GasReportExecutionStatus
360
362
  module.exports.addStatementCoverageInstrumentation = addStatementCoverageInstrumentation
361
363
  module.exports.Precompile = Precompile
362
364
  module.exports.precompileP256Verify = precompileP256Verify
@@ -368,6 +370,7 @@ module.exports.ExceptionalHalt = ExceptionalHalt
368
370
  module.exports.CachedChains = CachedChains
369
371
  module.exports.CachedEndpoints = CachedEndpoints
370
372
  module.exports.FsAccessPermission = FsAccessPermission
373
+ module.exports.CollectStackTraces = CollectStackTraces
371
374
  module.exports.IncludeTraces = IncludeTraces
372
375
  module.exports.SolidityTestRunnerFactory = SolidityTestRunnerFactory
373
376
  module.exports.l1SolidityTestRunnerFactory = l1SolidityTestRunnerFactory
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@nomicfoundation/edr",
3
- "version": "0.12.0-next.1",
3
+ "version": "0.12.0-next.10",
4
4
  "devDependencies": {
5
5
  "@napi-rs/cli": "^2.18.4",
6
6
  "@nomicfoundation/ethereumjs-util": "^9.0.4",
7
+ "@tsconfig/node20": "^20.1.6",
7
8
  "@types/chai": "^4.2.0",
8
9
  "@types/chai-as-promised": "^7.1.8",
9
10
  "@types/mocha": ">=9.1.0",
@@ -12,6 +13,7 @@
12
13
  "@typescript-eslint/parser": "5.61.0",
13
14
  "chai": "^4.3.6",
14
15
  "chai-as-promised": "^7.1.1",
16
+ "chalk": "^2.4.2",
15
17
  "eslint": "^8.44.0",
16
18
  "eslint-config-prettier": "9.1.0",
17
19
  "eslint-plugin-import": "2.27.5",
@@ -25,14 +27,17 @@
25
27
  "typescript": "~5.8.2"
26
28
  },
27
29
  "engines": {
28
- "node": ">= 18"
30
+ "node": ">= 20"
31
+ },
32
+ "exports": {
33
+ ".": "./index.js",
34
+ "./solidity-tests": "./dist/src/ts/solidity_tests.js"
29
35
  },
30
36
  "files": [
31
37
  "index.js",
32
38
  "index.d.ts",
33
- "Cargo.toml",
34
- "build.rs",
35
- "src/"
39
+ "src/",
40
+ "dist/src/"
36
41
  ],
37
42
  "license": "MIT",
38
43
  "main": "index.js",
@@ -53,32 +58,32 @@
53
58
  },
54
59
  "repository": "NomicFoundation/edr.git",
55
60
  "types": "index.d.ts",
56
- "optionalDependencies": {
57
- "@nomicfoundation/edr-darwin-arm64": "0.12.0-next.1",
58
- "@nomicfoundation/edr-darwin-x64": "0.12.0-next.1",
59
- "@nomicfoundation/edr-linux-arm64-gnu": "0.12.0-next.1",
60
- "@nomicfoundation/edr-linux-arm64-musl": "0.12.0-next.1",
61
- "@nomicfoundation/edr-linux-x64-gnu": "0.12.0-next.1",
62
- "@nomicfoundation/edr-linux-x64-musl": "0.12.0-next.1",
63
- "@nomicfoundation/edr-win32-x64-msvc": "0.12.0-next.1"
61
+ "dependencies": {
62
+ "@nomicfoundation/edr-darwin-arm64": "0.12.0-next.10",
63
+ "@nomicfoundation/edr-darwin-x64": "0.12.0-next.10",
64
+ "@nomicfoundation/edr-linux-arm64-gnu": "0.12.0-next.10",
65
+ "@nomicfoundation/edr-linux-arm64-musl": "0.12.0-next.10",
66
+ "@nomicfoundation/edr-linux-x64-gnu": "0.12.0-next.10",
67
+ "@nomicfoundation/edr-linux-x64-musl": "0.12.0-next.10",
68
+ "@nomicfoundation/edr-win32-x64-msvc": "0.12.0-next.10"
64
69
  },
65
70
  "scripts": {
66
71
  "artifacts": "napi artifacts",
67
72
  "build": "pnpm run build:publish",
68
- "build:debug": "napi build --platform --no-const-enum --features op",
69
- "build:dev": "napi build --platform --release --no-const-enum --features op,test-mock",
70
- "build:publish": "napi build --platform --profile napi-publish --no-const-enum --features op",
71
- "build:scenarios": "napi build --platform --release --no-const-enum --features op,scenarios",
72
- "build:tracing": "napi build --platform --release --no-const-enum --features op,tracing",
73
- "build:typingFile": "napi build --platform --no-const-enum --features op",
73
+ "build:debug": "bash ../../scripts/build_edr_napi.sh --features op",
74
+ "build:dev": "bash ../../scripts/build_edr_napi.sh --release --features op,test-mock",
75
+ "build:publish": "bash ../../scripts/build_edr_napi.sh --profile napi-publish --features op",
76
+ "build:scenarios": "bash ../../scripts/build_edr_napi.sh --release --features op,scenarios",
77
+ "build:tracing": "bash ../../scripts/build_edr_napi.sh --release --features op,tracing",
78
+ "build:typingFile": "bash ../../scripts/build_edr_napi.sh --features op",
74
79
  "clean": "rm -rf @nomicfoundation/edr.node",
75
80
  "eslint": "eslint 'test/**/*.ts'",
76
81
  "lint": "pnpm run prettier && pnpm run eslint",
77
82
  "lint:fix": "pnpm run prettier --write",
78
83
  "pretest": "pnpm build:dev",
79
84
  "prettier": "prettier --check \"test/**.ts\"",
80
- "test": "pnpm tsc && node --max-old-space-size=8192 node_modules/mocha/bin/_mocha --recursive \"test/**/*.ts\"",
81
- "testNoBuild": "pnpm tsc && node --max-old-space-size=8192 node_modules/mocha/bin/_mocha --recursive \"test/**/{,!(mock)}.ts\"",
85
+ "test": "node --max-old-space-size=8192 node_modules/mocha/bin/_mocha --recursive \"test/**/*.ts\"",
86
+ "testNoBuild": "node --max-old-space-size=8192 node_modules/mocha/bin/_mocha --recursive \"test/**/{,!(logs|mock)}.ts\"",
82
87
  "universal": "napi universal",
83
88
  "version": "napi version"
84
89
  }
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
  }
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,