@nomicfoundation/edr 0.12.0-next.6 → 0.12.0-next.8
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 +127 -44
- package/index.js +4 -1
- package/package.json +1 -10
- package/src/account.rs +6 -5
- package/src/block.rs +1 -1
- package/src/call_override.rs +1 -1
- package/src/cast.rs +1 -1
- package/src/chains/op.rs +11 -20
- package/src/config.rs +75 -23
- package/src/context.rs +32 -17
- package/src/contract_decoder.rs +57 -0
- package/src/debug_trace.rs +2 -0
- package/src/gas_report.rs +92 -0
- package/src/lib.rs +3 -0
- package/src/logger.rs +1 -1
- package/src/mock/time.rs +7 -7
- package/src/mock.rs +0 -9
- package/src/precompile.rs +1 -1
- package/src/provider.rs +28 -7
- package/src/result.rs +11 -11
- package/src/serde.rs +1 -1
- package/src/solidity_tests/config.rs +39 -2
- package/src/solidity_tests/l1.rs +1 -1
- package/src/solidity_tests/op.rs +1 -1
- package/src/solidity_tests/test_results.rs +63 -32
- package/src/solidity_tests.rs +1 -1
- package/src/trace/debug.rs +3 -1
- package/src/trace/return_data.rs +3 -5
- package/src/trace/solidity_stack_trace.rs +3 -2
- package/src/trace.rs +2 -2
- package/src/withdrawal.rs +5 -5
package/index.d.ts
CHANGED
|
@@ -169,11 +169,11 @@ export interface BaseFeeParamActivation {
|
|
|
169
169
|
elasticityMultiplier: bigint
|
|
170
170
|
}
|
|
171
171
|
export interface BaseFeeActivationByBlockNumber {
|
|
172
|
-
/** The block number at which the base_fee_params is activated */
|
|
172
|
+
/** The block number at which the `base_fee_params` is activated */
|
|
173
173
|
blockNumber: bigint
|
|
174
174
|
}
|
|
175
175
|
export interface BaseFeeActivationByHardfork {
|
|
176
|
-
/** The hardfork at which the base_fee_params is activated */
|
|
176
|
+
/** The hardfork at which the `base_fee_params` is activated */
|
|
177
177
|
hardfork: string
|
|
178
178
|
}
|
|
179
179
|
/** Specification of a chain with possible overrides. */
|
|
@@ -198,6 +198,16 @@ export interface CodeCoverageConfig {
|
|
|
198
198
|
*/
|
|
199
199
|
onCollectedCoverageCallback: (coverageHits: Uint8Array[]) => Promise<void>
|
|
200
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
|
+
}
|
|
201
211
|
/** Configuration for forking a blockchain */
|
|
202
212
|
export interface ForkConfig {
|
|
203
213
|
/**
|
|
@@ -258,6 +268,8 @@ export interface MiningConfig {
|
|
|
258
268
|
export interface ObservabilityConfig {
|
|
259
269
|
/** If present, configures runtime observability to collect code coverage. */
|
|
260
270
|
codeCoverage?: CodeCoverageConfig
|
|
271
|
+
/** If present, configures runtime observability to collect gas reports. */
|
|
272
|
+
gasReport?: GasReportConfig
|
|
261
273
|
}
|
|
262
274
|
/** Configuration for a provider */
|
|
263
275
|
export interface ProviderConfig {
|
|
@@ -273,7 +285,7 @@ export interface ProviderConfig {
|
|
|
273
285
|
* EIP-1559 base fee parameters activations to be used to calculate the
|
|
274
286
|
* block base fee.
|
|
275
287
|
*
|
|
276
|
-
* Provide an ordered list of base_fee_params to be
|
|
288
|
+
* Provide an ordered list of `base_fee_params` to be
|
|
277
289
|
* used starting from the specified activation point (hardfork or block
|
|
278
290
|
* number).
|
|
279
291
|
* If not provided, the default values from the chain spec
|
|
@@ -372,6 +384,27 @@ export interface DebugTraceLogItem {
|
|
|
372
384
|
/** Map of all stored values with keys and values encoded as hex strings. */
|
|
373
385
|
storage?: Record<string, string>
|
|
374
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
|
+
}
|
|
375
408
|
export interface InstrumentationResult {
|
|
376
409
|
/** The generated source code with coverage instrumentation. */
|
|
377
410
|
readonly source: string
|
|
@@ -644,7 +677,7 @@ export interface SolidityTestRunnerConfigArgs {
|
|
|
644
677
|
disableBlockGasLimit?: boolean
|
|
645
678
|
/**
|
|
646
679
|
* The memory limit of the EVM in bytes.
|
|
647
|
-
* Defaults to 33_554_432 (2^25 = 32MiB).
|
|
680
|
+
* Defaults to `33_554_432` (2^25 = 32MiB).
|
|
648
681
|
*/
|
|
649
682
|
memoryLimit?: bigint
|
|
650
683
|
/**
|
|
@@ -689,6 +722,8 @@ export interface SolidityTestRunnerConfigArgs {
|
|
|
689
722
|
* config value is set, then the fuzz config value will be used.
|
|
690
723
|
*/
|
|
691
724
|
invariant?: InvariantConfigArgs
|
|
725
|
+
/** Whether to collect stack traces. */
|
|
726
|
+
collectStackTraces?: CollectStackTraces
|
|
692
727
|
/**
|
|
693
728
|
* Controls which test results should include execution traces. Defaults to
|
|
694
729
|
* None.
|
|
@@ -701,6 +736,13 @@ export interface SolidityTestRunnerConfigArgs {
|
|
|
701
736
|
* match the pattern will be executed and reported as a test result.
|
|
702
737
|
*/
|
|
703
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
|
|
704
746
|
}
|
|
705
747
|
/** Fuzz testing configuration */
|
|
706
748
|
export interface FuzzConfigArgs {
|
|
@@ -865,6 +907,19 @@ export interface AddressLabel {
|
|
|
865
907
|
/** The label to assign to the address */
|
|
866
908
|
label: string
|
|
867
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
|
+
}
|
|
868
923
|
/**
|
|
869
924
|
* Configuration for [`SolidityTestRunnerConfigArgs::include_traces`] that
|
|
870
925
|
* controls execution trace decoding and inclusion in test results.
|
|
@@ -948,21 +1003,21 @@ export enum TestStatus {
|
|
|
948
1003
|
/**Test skipped */
|
|
949
1004
|
Skipped = 'Skipped'
|
|
950
1005
|
}
|
|
951
|
-
/** See [edr_solidity_tests::result::TestKind::Standard] */
|
|
1006
|
+
/** See [`edr_solidity_tests::result::TestKind::Standard`] */
|
|
952
1007
|
export interface StandardTestKind {
|
|
953
1008
|
/** The gas consumed by the test. */
|
|
954
1009
|
readonly consumedGas: bigint
|
|
955
1010
|
}
|
|
956
|
-
/** See [edr_solidity_tests::result::TestKind::Fuzz] */
|
|
1011
|
+
/** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
|
|
957
1012
|
export interface FuzzTestKind {
|
|
958
|
-
/** See [edr_solidity_tests::result::TestKind::Fuzz] */
|
|
1013
|
+
/** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
|
|
959
1014
|
readonly runs: bigint
|
|
960
|
-
/** See [edr_solidity_tests::result::TestKind::Fuzz] */
|
|
1015
|
+
/** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
|
|
961
1016
|
readonly meanGas: bigint
|
|
962
|
-
/** See [edr_solidity_tests::result::TestKind::Fuzz] */
|
|
1017
|
+
/** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
|
|
963
1018
|
readonly medianGas: bigint
|
|
964
1019
|
}
|
|
965
|
-
/** See [edr_solidity_tests::fuzz::FuzzCase] */
|
|
1020
|
+
/** See [`edr_solidity_tests::fuzz::FuzzCase`] */
|
|
966
1021
|
export interface FuzzCase {
|
|
967
1022
|
/** The calldata used for this fuzz test */
|
|
968
1023
|
readonly calldata: Uint8Array
|
|
@@ -971,13 +1026,13 @@ export interface FuzzCase {
|
|
|
971
1026
|
/** The initial gas stipend for the transaction */
|
|
972
1027
|
readonly stipend: bigint
|
|
973
1028
|
}
|
|
974
|
-
/** See [edr_solidity_tests::result::TestKind::Invariant] */
|
|
1029
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
975
1030
|
export interface InvariantTestKind {
|
|
976
|
-
/** See [edr_solidity_tests::result::TestKind::Invariant] */
|
|
1031
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
977
1032
|
readonly runs: bigint
|
|
978
|
-
/** See [edr_solidity_tests::result::TestKind::Invariant] */
|
|
1033
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
979
1034
|
readonly calls: bigint
|
|
980
|
-
/** See [edr_solidity_tests::result::TestKind::Invariant] */
|
|
1035
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
981
1036
|
readonly reverts: bigint
|
|
982
1037
|
}
|
|
983
1038
|
/**
|
|
@@ -990,19 +1045,19 @@ export interface CounterExampleSequence {
|
|
|
990
1045
|
/** The shrunk counterexample sequence. */
|
|
991
1046
|
sequence: Array<BaseCounterExample>
|
|
992
1047
|
}
|
|
993
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample] */
|
|
1048
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample`] */
|
|
994
1049
|
export interface BaseCounterExample {
|
|
995
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::sender] */
|
|
1050
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::sender`] */
|
|
996
1051
|
readonly sender?: Uint8Array
|
|
997
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::addr] */
|
|
1052
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::addr`] */
|
|
998
1053
|
readonly address?: Uint8Array
|
|
999
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::calldata] */
|
|
1054
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::calldata`] */
|
|
1000
1055
|
readonly calldata: Uint8Array
|
|
1001
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::contract_name] */
|
|
1056
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::contract_name`] */
|
|
1002
1057
|
readonly contractName?: string
|
|
1003
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::signature] */
|
|
1058
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::signature`] */
|
|
1004
1059
|
readonly signature?: string
|
|
1005
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::args] */
|
|
1060
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::args`] */
|
|
1006
1061
|
readonly args?: string
|
|
1007
1062
|
}
|
|
1008
1063
|
/**
|
|
@@ -1088,6 +1143,11 @@ export interface DecodedTraceParameters {
|
|
|
1088
1143
|
*/
|
|
1089
1144
|
arguments: Array<string>
|
|
1090
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
|
+
}
|
|
1091
1151
|
/** Configuration for subscriptions. */
|
|
1092
1152
|
export interface SubscriptionConfig {
|
|
1093
1153
|
/** Callback to be called when a new event is received. */
|
|
@@ -1348,22 +1408,43 @@ export interface Withdrawal {
|
|
|
1348
1408
|
amount: bigint
|
|
1349
1409
|
}
|
|
1350
1410
|
export declare class EdrContext {
|
|
1351
|
-
/**Creates a new [`EdrContext`] instance. Should only be called once! */
|
|
1411
|
+
/** Creates a new [`EdrContext`] instance. Should only be called once! */
|
|
1352
1412
|
constructor()
|
|
1353
|
-
/**Constructs a new provider with the provided configuration. */
|
|
1354
|
-
createProvider(chainType: string, providerConfig: ProviderConfig, loggerConfig: LoggerConfig, subscriptionConfig: SubscriptionConfig,
|
|
1355
|
-
/**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. */
|
|
1356
1416
|
registerProviderFactory(chainType: string, factory: ProviderFactory): Promise<void>
|
|
1357
1417
|
registerSolidityTestRunnerFactory(chainType: string, factory: SolidityTestRunnerFactory): Promise<void>
|
|
1358
1418
|
/**
|
|
1359
|
-
*Executes Solidity tests
|
|
1419
|
+
* Executes Solidity tests
|
|
1360
1420
|
*
|
|
1361
|
-
*The function will return
|
|
1362
|
-
*
|
|
1363
|
-
*
|
|
1364
|
-
*
|
|
1365
|
-
|
|
1366
|
-
|
|
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
|
|
1367
1448
|
}
|
|
1368
1449
|
export declare class Precompile {
|
|
1369
1450
|
/** Returns the address of the precompile. */
|
|
@@ -1385,7 +1466,9 @@ export declare class Provider {
|
|
|
1385
1466
|
*
|
|
1386
1467
|
*For internal use only. Support for this method may be removed in the future.
|
|
1387
1468
|
*/
|
|
1388
|
-
addCompilationResult(solcVersion: string, compilerInput: any, compilerOutput: any): Promise<
|
|
1469
|
+
addCompilationResult(solcVersion: string, compilerInput: any, compilerOutput: any): Promise<void>
|
|
1470
|
+
/**Retrieves the instance's contract decoder. */
|
|
1471
|
+
contractDecoder(): ContractDecoder
|
|
1389
1472
|
/**Handles a JSON-RPC request and returns a JSON-RPC response. */
|
|
1390
1473
|
handleRequest(request: string): Promise<Response>
|
|
1391
1474
|
setCallOverrideCallback(callOverrideCallback: (contract_address: ArrayBuffer, data: ArrayBuffer) => Promise<CallOverrideResult | undefined>): Promise<void>
|
|
@@ -1398,35 +1481,35 @@ export declare class Provider {
|
|
|
1398
1481
|
setVerboseTracing(verboseTracing: boolean): Promise<void>
|
|
1399
1482
|
}
|
|
1400
1483
|
export declare class SolidityTestRunnerFactory { }
|
|
1401
|
-
/** See [edr_solidity_tests::result::SuiteResult] */
|
|
1484
|
+
/** See [`edr_solidity_tests::result::SuiteResult`] */
|
|
1402
1485
|
export declare class SuiteResult {
|
|
1403
1486
|
/**
|
|
1404
1487
|
* The artifact id can be used to match input to result in the progress
|
|
1405
1488
|
* callback
|
|
1406
1489
|
*/
|
|
1407
1490
|
readonly id: ArtifactId
|
|
1408
|
-
/** See [edr_solidity_tests::result::SuiteResult::duration] */
|
|
1491
|
+
/** See [`edr_solidity_tests::result::SuiteResult::duration`] */
|
|
1409
1492
|
readonly durationNs: bigint
|
|
1410
|
-
/** See [edr_solidity_tests::result::SuiteResult::test_results] */
|
|
1493
|
+
/** See [`edr_solidity_tests::result::SuiteResult::test_results`] */
|
|
1411
1494
|
readonly testResults: Array<TestResult>
|
|
1412
|
-
/** See [edr_solidity_tests::result::SuiteResult::warnings] */
|
|
1495
|
+
/** See [`edr_solidity_tests::result::SuiteResult::warnings`] */
|
|
1413
1496
|
readonly warnings: Array<string>
|
|
1414
1497
|
}
|
|
1415
|
-
/** See [edr_solidity_tests::result::TestResult] */
|
|
1498
|
+
/** See [`edr_solidity_tests::result::TestResult`] */
|
|
1416
1499
|
export declare class TestResult {
|
|
1417
1500
|
/** The name of the test. */
|
|
1418
1501
|
readonly name: string
|
|
1419
|
-
/** See [edr_solidity_tests::result::TestResult::status] */
|
|
1502
|
+
/** See [`edr_solidity_tests::result::TestResult::status`] */
|
|
1420
1503
|
readonly status: TestStatus
|
|
1421
|
-
/** See [edr_solidity_tests::result::TestResult::reason] */
|
|
1504
|
+
/** See [`edr_solidity_tests::result::TestResult::reason`] */
|
|
1422
1505
|
readonly reason?: string
|
|
1423
|
-
/** See [edr_solidity_tests::result::TestResult::counterexample] */
|
|
1506
|
+
/** See [`edr_solidity_tests::result::TestResult::counterexample`] */
|
|
1424
1507
|
readonly counterexample?: BaseCounterExample | CounterExampleSequence
|
|
1425
|
-
/** See [edr_solidity_tests::result::TestResult::decoded_logs] */
|
|
1508
|
+
/** See [`edr_solidity_tests::result::TestResult::decoded_logs`] */
|
|
1426
1509
|
readonly decodedLogs: Array<string>
|
|
1427
|
-
/** See [edr_solidity_tests::result::TestResult::kind] */
|
|
1510
|
+
/** See [`edr_solidity_tests::result::TestResult::kind`] */
|
|
1428
1511
|
readonly kind: StandardTestKind | FuzzTestKind | InvariantTestKind
|
|
1429
|
-
/** See [edr_solidity_tests::result::TestResult::duration] */
|
|
1512
|
+
/** See [`edr_solidity_tests::result::TestResult::duration`] */
|
|
1430
1513
|
readonly durationNs: bigint
|
|
1431
1514
|
/**
|
|
1432
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nomicfoundation/edr",
|
|
3
|
-
"version": "0.12.0-next.
|
|
3
|
+
"version": "0.12.0-next.8",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"@napi-rs/cli": "^2.18.4",
|
|
6
6
|
"@nomicfoundation/ethereumjs-util": "^9.0.4",
|
|
@@ -58,15 +58,6 @@
|
|
|
58
58
|
},
|
|
59
59
|
"repository": "NomicFoundation/edr.git",
|
|
60
60
|
"types": "index.d.ts",
|
|
61
|
-
"optionalDependencies": {
|
|
62
|
-
"@nomicfoundation/edr-darwin-arm64": "0.12.0-next.6",
|
|
63
|
-
"@nomicfoundation/edr-darwin-x64": "0.12.0-next.6",
|
|
64
|
-
"@nomicfoundation/edr-linux-arm64-gnu": "0.12.0-next.6",
|
|
65
|
-
"@nomicfoundation/edr-linux-arm64-musl": "0.12.0-next.6",
|
|
66
|
-
"@nomicfoundation/edr-linux-x64-gnu": "0.12.0-next.6",
|
|
67
|
-
"@nomicfoundation/edr-linux-x64-musl": "0.12.0-next.6",
|
|
68
|
-
"@nomicfoundation/edr-win32-x64-msvc": "0.12.0-next.6"
|
|
69
|
-
},
|
|
70
61
|
"scripts": {
|
|
71
62
|
"artifacts": "napi artifacts",
|
|
72
63
|
"build": "pnpm run build:publish",
|
package/src/account.rs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
use derive_more::Debug;
|
|
2
|
-
use
|
|
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 (
|
|
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 =
|
|
57
|
+
let slot = EvmStorageSlot::new(value, 0);
|
|
57
58
|
|
|
58
|
-
let index:
|
|
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:
|
|
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
|
|
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> {
|
package/src/call_override.rs
CHANGED
package/src/cast.rs
CHANGED
package/src/chains/op.rs
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
use std::{str::FromStr, sync::Arc};
|
|
2
2
|
|
|
3
|
-
use edr_eth::hex;
|
|
4
3
|
use edr_napi_core::{
|
|
5
4
|
logger::Logger,
|
|
6
5
|
provider::{SyncProvider, SyncProviderFactory},
|
|
7
6
|
subscription::subscriber_callback_for_chain_spec,
|
|
8
7
|
};
|
|
9
|
-
use edr_op::{
|
|
8
|
+
use edr_op::{
|
|
9
|
+
predeploys::{
|
|
10
|
+
gas_price_oracle_code_ecotone, gas_price_oracle_code_fjord, gas_price_oracle_code_isthmus,
|
|
11
|
+
GAS_PRICE_ORACLE_ADDRESS,
|
|
12
|
+
},
|
|
13
|
+
OpChainSpec,
|
|
14
|
+
};
|
|
15
|
+
use edr_primitives::hex;
|
|
10
16
|
use edr_provider::time::CurrentTime;
|
|
11
17
|
use edr_solidity::contract_decoder::ContractDecoder;
|
|
12
18
|
use napi::{
|
|
@@ -347,16 +353,11 @@ fn gas_price_oracle_override(hardfork: edr_op::Hardfork) -> AccountOverride {
|
|
|
347
353
|
}
|
|
348
354
|
|
|
349
355
|
fn gas_price_oracle_ecotone() -> AccountOverride {
|
|
350
|
-
let gas_price_oracle_code = hex::decode(include_str!(
|
|
351
|
-
"../../data/op/predeploys/gas_price_oracle/ecotone.txt"
|
|
352
|
-
))
|
|
353
|
-
.expect("The bytecode for the GasPriceOracle predeploy should be a valid hex string");
|
|
354
|
-
|
|
355
356
|
AccountOverride {
|
|
356
357
|
address: Uint8Array::with_data_copied(GAS_PRICE_ORACLE_ADDRESS),
|
|
357
358
|
balance: None,
|
|
358
359
|
nonce: None,
|
|
359
|
-
code: Some(
|
|
360
|
+
code: Some(gas_price_oracle_code_ecotone().into()),
|
|
360
361
|
storage: Some(vec![StorageSlot {
|
|
361
362
|
index: BigInt::from(0u64),
|
|
362
363
|
// bool isEcotone = true
|
|
@@ -368,16 +369,11 @@ fn gas_price_oracle_ecotone() -> AccountOverride {
|
|
|
368
369
|
}
|
|
369
370
|
|
|
370
371
|
fn gas_price_oracle_fjord() -> AccountOverride {
|
|
371
|
-
let gas_price_oracle_code = hex::decode(include_str!(
|
|
372
|
-
"../../data/op/predeploys/gas_price_oracle/fjord.txt"
|
|
373
|
-
))
|
|
374
|
-
.expect("The bytecode for the GasPriceOracle predeploy should be a valid hex string");
|
|
375
|
-
|
|
376
372
|
AccountOverride {
|
|
377
373
|
address: Uint8Array::with_data_copied(GAS_PRICE_ORACLE_ADDRESS),
|
|
378
374
|
balance: None,
|
|
379
375
|
nonce: None,
|
|
380
|
-
code: Some(
|
|
376
|
+
code: Some(gas_price_oracle_code_fjord().into()),
|
|
381
377
|
storage: Some(vec![StorageSlot {
|
|
382
378
|
index: BigInt::from(0u64),
|
|
383
379
|
// bool isEcotone = true
|
|
@@ -390,16 +386,11 @@ fn gas_price_oracle_fjord() -> AccountOverride {
|
|
|
390
386
|
}
|
|
391
387
|
|
|
392
388
|
fn gas_price_oracle_isthmus() -> AccountOverride {
|
|
393
|
-
let gas_price_oracle_code = hex::decode(include_str!(
|
|
394
|
-
"../../data/op/predeploys/gas_price_oracle/isthmus.txt"
|
|
395
|
-
))
|
|
396
|
-
.expect("The bytecode for the GasPriceOracle predeploy should be a valid hex string");
|
|
397
|
-
|
|
398
389
|
AccountOverride {
|
|
399
390
|
address: Uint8Array::with_data_copied(GAS_PRICE_ORACLE_ADDRESS),
|
|
400
391
|
balance: None,
|
|
401
392
|
nonce: None,
|
|
402
|
-
code: Some(
|
|
393
|
+
code: Some(gas_price_oracle_code_isthmus().into()),
|
|
403
394
|
storage: Some(vec![StorageSlot {
|
|
404
395
|
index: BigInt::from(0u64),
|
|
405
396
|
// bool isEcotone = true
|