@nomicfoundation/edr 0.12.0-next.5 → 0.12.0-next.7
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 +79 -31
- package/index.js +3 -1
- package/package.json +8 -8
- package/src/chains/generic.rs +1 -2
- package/src/chains/l1.rs +62 -62
- package/src/chains/op.rs +15 -14
- package/src/config.rs +62 -21
- package/src/context.rs +3 -3
- package/src/contract_decoder.rs +57 -0
- package/src/debug_trace.rs +2 -0
- package/src/lib.rs +2 -0
- package/src/log.rs +2 -2
- package/src/mock/time.rs +8 -7
- package/src/mock.rs +2 -10
- package/src/provider/response.rs +4 -4
- package/src/provider.rs +28 -7
- package/src/result.rs +24 -48
- package/src/solidity_tests/config.rs +31 -1
- package/src/solidity_tests/l1.rs +6 -6
- package/src/solidity_tests/op.rs +4 -4
- package/src/solidity_tests/runner.rs +1 -1
- package/src/solidity_tests/test_results.rs +46 -32
- package/src/trace/debug.rs +3 -1
- package/src/trace/exit.rs +9 -8
- package/src/trace/return_data.rs +3 -5
- package/src/trace.rs +5 -4
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 */
|
|
@@ -255,6 +269,17 @@ export interface ProviderConfig {
|
|
|
255
269
|
bailOnCallFailure: boolean
|
|
256
270
|
/** Whether to return an `Err` when a `eth_sendTransaction` fails */
|
|
257
271
|
bailOnTransactionFailure: boolean
|
|
272
|
+
/**
|
|
273
|
+
* EIP-1559 base fee parameters activations to be used to calculate the
|
|
274
|
+
* block base fee.
|
|
275
|
+
*
|
|
276
|
+
* Provide an ordered list of `base_fee_params` to be
|
|
277
|
+
* used starting from the specified activation point (hardfork or block
|
|
278
|
+
* number).
|
|
279
|
+
* If not provided, the default values from the chain spec
|
|
280
|
+
* will be used.
|
|
281
|
+
*/
|
|
282
|
+
baseFeeConfig?: Array<BaseFeeParamActivation>
|
|
258
283
|
/** The gas limit of each block */
|
|
259
284
|
blockGasLimit: bigint
|
|
260
285
|
/** The chain ID of the blockchain */
|
|
@@ -619,7 +644,7 @@ export interface SolidityTestRunnerConfigArgs {
|
|
|
619
644
|
disableBlockGasLimit?: boolean
|
|
620
645
|
/**
|
|
621
646
|
* The memory limit of the EVM in bytes.
|
|
622
|
-
* Defaults to 33_554_432 (2^25 = 32MiB).
|
|
647
|
+
* Defaults to `33_554_432` (2^25 = 32MiB).
|
|
623
648
|
*/
|
|
624
649
|
memoryLimit?: bigint
|
|
625
650
|
/**
|
|
@@ -664,6 +689,8 @@ export interface SolidityTestRunnerConfigArgs {
|
|
|
664
689
|
* config value is set, then the fuzz config value will be used.
|
|
665
690
|
*/
|
|
666
691
|
invariant?: InvariantConfigArgs
|
|
692
|
+
/** Whether to collect stack traces. */
|
|
693
|
+
collectStackTraces?: CollectStackTraces
|
|
667
694
|
/**
|
|
668
695
|
* Controls which test results should include execution traces. Defaults to
|
|
669
696
|
* None.
|
|
@@ -840,6 +867,19 @@ export interface AddressLabel {
|
|
|
840
867
|
/** The label to assign to the address */
|
|
841
868
|
label: string
|
|
842
869
|
}
|
|
870
|
+
/** A type that controls when stack traces are collected. */
|
|
871
|
+
export enum CollectStackTraces {
|
|
872
|
+
/** Always collects stack traces, adding performance overhead. */
|
|
873
|
+
Always = 0,
|
|
874
|
+
/**
|
|
875
|
+
* Only collects stack traces upon failure, re-executing the test. This
|
|
876
|
+
* minimizes performance overhead.
|
|
877
|
+
*
|
|
878
|
+
* Not all tests can be re-executed since certain cheatcodes contain
|
|
879
|
+
* non-deterministic side-effects.
|
|
880
|
+
*/
|
|
881
|
+
OnFailure = 1
|
|
882
|
+
}
|
|
843
883
|
/**
|
|
844
884
|
* Configuration for [`SolidityTestRunnerConfigArgs::include_traces`] that
|
|
845
885
|
* controls execution trace decoding and inclusion in test results.
|
|
@@ -923,21 +963,21 @@ export enum TestStatus {
|
|
|
923
963
|
/**Test skipped */
|
|
924
964
|
Skipped = 'Skipped'
|
|
925
965
|
}
|
|
926
|
-
/** See [edr_solidity_tests::result::TestKind::Standard] */
|
|
966
|
+
/** See [`edr_solidity_tests::result::TestKind::Standard`] */
|
|
927
967
|
export interface StandardTestKind {
|
|
928
968
|
/** The gas consumed by the test. */
|
|
929
969
|
readonly consumedGas: bigint
|
|
930
970
|
}
|
|
931
|
-
/** See [edr_solidity_tests::result::TestKind::Fuzz] */
|
|
971
|
+
/** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
|
|
932
972
|
export interface FuzzTestKind {
|
|
933
|
-
/** See [edr_solidity_tests::result::TestKind::Fuzz] */
|
|
973
|
+
/** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
|
|
934
974
|
readonly runs: bigint
|
|
935
|
-
/** See [edr_solidity_tests::result::TestKind::Fuzz] */
|
|
975
|
+
/** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
|
|
936
976
|
readonly meanGas: bigint
|
|
937
|
-
/** See [edr_solidity_tests::result::TestKind::Fuzz] */
|
|
977
|
+
/** See [`edr_solidity_tests::result::TestKind::Fuzz`] */
|
|
938
978
|
readonly medianGas: bigint
|
|
939
979
|
}
|
|
940
|
-
/** See [edr_solidity_tests::fuzz::FuzzCase] */
|
|
980
|
+
/** See [`edr_solidity_tests::fuzz::FuzzCase`] */
|
|
941
981
|
export interface FuzzCase {
|
|
942
982
|
/** The calldata used for this fuzz test */
|
|
943
983
|
readonly calldata: Uint8Array
|
|
@@ -946,13 +986,13 @@ export interface FuzzCase {
|
|
|
946
986
|
/** The initial gas stipend for the transaction */
|
|
947
987
|
readonly stipend: bigint
|
|
948
988
|
}
|
|
949
|
-
/** See [edr_solidity_tests::result::TestKind::Invariant] */
|
|
989
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
950
990
|
export interface InvariantTestKind {
|
|
951
|
-
/** See [edr_solidity_tests::result::TestKind::Invariant] */
|
|
991
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
952
992
|
readonly runs: bigint
|
|
953
|
-
/** See [edr_solidity_tests::result::TestKind::Invariant] */
|
|
993
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
954
994
|
readonly calls: bigint
|
|
955
|
-
/** See [edr_solidity_tests::result::TestKind::Invariant] */
|
|
995
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
956
996
|
readonly reverts: bigint
|
|
957
997
|
}
|
|
958
998
|
/**
|
|
@@ -965,19 +1005,19 @@ export interface CounterExampleSequence {
|
|
|
965
1005
|
/** The shrunk counterexample sequence. */
|
|
966
1006
|
sequence: Array<BaseCounterExample>
|
|
967
1007
|
}
|
|
968
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample] */
|
|
1008
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample`] */
|
|
969
1009
|
export interface BaseCounterExample {
|
|
970
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::sender] */
|
|
1010
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::sender`] */
|
|
971
1011
|
readonly sender?: Uint8Array
|
|
972
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::addr] */
|
|
1012
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::addr`] */
|
|
973
1013
|
readonly address?: Uint8Array
|
|
974
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::calldata] */
|
|
1014
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::calldata`] */
|
|
975
1015
|
readonly calldata: Uint8Array
|
|
976
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::contract_name] */
|
|
1016
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::contract_name`] */
|
|
977
1017
|
readonly contractName?: string
|
|
978
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::signature] */
|
|
1018
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::signature`] */
|
|
979
1019
|
readonly signature?: string
|
|
980
|
-
/** See [edr_solidity_tests::fuzz::BaseCounterExample::args] */
|
|
1020
|
+
/** See [`edr_solidity_tests::fuzz::BaseCounterExample::args`] */
|
|
981
1021
|
readonly args?: string
|
|
982
1022
|
}
|
|
983
1023
|
/**
|
|
@@ -1326,7 +1366,7 @@ export declare class EdrContext {
|
|
|
1326
1366
|
/**Creates a new [`EdrContext`] instance. Should only be called once! */
|
|
1327
1367
|
constructor()
|
|
1328
1368
|
/**Constructs a new provider with the provided configuration. */
|
|
1329
|
-
createProvider(chainType: string, providerConfig: ProviderConfig, loggerConfig: LoggerConfig, subscriptionConfig: SubscriptionConfig,
|
|
1369
|
+
createProvider(chainType: string, providerConfig: ProviderConfig, loggerConfig: LoggerConfig, subscriptionConfig: SubscriptionConfig, contractDecoder: ContractDecoder): Promise<Provider>
|
|
1330
1370
|
/**Registers a new provider factory for the provided chain type. */
|
|
1331
1371
|
registerProviderFactory(chainType: string, factory: ProviderFactory): Promise<void>
|
|
1332
1372
|
registerSolidityTestRunnerFactory(chainType: string, factory: SolidityTestRunnerFactory): Promise<void>
|
|
@@ -1340,6 +1380,12 @@ export declare class EdrContext {
|
|
|
1340
1380
|
*/
|
|
1341
1381
|
runSolidityTests(chainType: string, artifacts: Array<Artifact>, testSuites: Array<ArtifactId>, configArgs: SolidityTestRunnerConfigArgs, tracingConfig: TracingConfigWithBuffers, onTestSuiteCompletedCallback: (result: SuiteResult) => void): Promise<void>
|
|
1342
1382
|
}
|
|
1383
|
+
export declare class ContractDecoder {
|
|
1384
|
+
/**Creates an empty instance. */
|
|
1385
|
+
constructor()
|
|
1386
|
+
/**Creates a new instance with the provided configuration. */
|
|
1387
|
+
static withContracts(config: TracingConfigWithBuffers): ContractDecoder
|
|
1388
|
+
}
|
|
1343
1389
|
export declare class Precompile {
|
|
1344
1390
|
/** Returns the address of the precompile. */
|
|
1345
1391
|
get address(): Uint8Array
|
|
@@ -1360,7 +1406,9 @@ export declare class Provider {
|
|
|
1360
1406
|
*
|
|
1361
1407
|
*For internal use only. Support for this method may be removed in the future.
|
|
1362
1408
|
*/
|
|
1363
|
-
addCompilationResult(solcVersion: string, compilerInput: any, compilerOutput: any): Promise<
|
|
1409
|
+
addCompilationResult(solcVersion: string, compilerInput: any, compilerOutput: any): Promise<void>
|
|
1410
|
+
/**Retrieves the instance's contract decoder. */
|
|
1411
|
+
contractDecoder(): ContractDecoder
|
|
1364
1412
|
/**Handles a JSON-RPC request and returns a JSON-RPC response. */
|
|
1365
1413
|
handleRequest(request: string): Promise<Response>
|
|
1366
1414
|
setCallOverrideCallback(callOverrideCallback: (contract_address: ArrayBuffer, data: ArrayBuffer) => Promise<CallOverrideResult | undefined>): Promise<void>
|
|
@@ -1373,35 +1421,35 @@ export declare class Provider {
|
|
|
1373
1421
|
setVerboseTracing(verboseTracing: boolean): Promise<void>
|
|
1374
1422
|
}
|
|
1375
1423
|
export declare class SolidityTestRunnerFactory { }
|
|
1376
|
-
/** See [edr_solidity_tests::result::SuiteResult] */
|
|
1424
|
+
/** See [`edr_solidity_tests::result::SuiteResult`] */
|
|
1377
1425
|
export declare class SuiteResult {
|
|
1378
1426
|
/**
|
|
1379
1427
|
* The artifact id can be used to match input to result in the progress
|
|
1380
1428
|
* callback
|
|
1381
1429
|
*/
|
|
1382
1430
|
readonly id: ArtifactId
|
|
1383
|
-
/** See [edr_solidity_tests::result::SuiteResult::duration] */
|
|
1431
|
+
/** See [`edr_solidity_tests::result::SuiteResult::duration`] */
|
|
1384
1432
|
readonly durationNs: bigint
|
|
1385
|
-
/** See [edr_solidity_tests::result::SuiteResult::test_results] */
|
|
1433
|
+
/** See [`edr_solidity_tests::result::SuiteResult::test_results`] */
|
|
1386
1434
|
readonly testResults: Array<TestResult>
|
|
1387
|
-
/** See [edr_solidity_tests::result::SuiteResult::warnings] */
|
|
1435
|
+
/** See [`edr_solidity_tests::result::SuiteResult::warnings`] */
|
|
1388
1436
|
readonly warnings: Array<string>
|
|
1389
1437
|
}
|
|
1390
|
-
/** See [edr_solidity_tests::result::TestResult] */
|
|
1438
|
+
/** See [`edr_solidity_tests::result::TestResult`] */
|
|
1391
1439
|
export declare class TestResult {
|
|
1392
1440
|
/** The name of the test. */
|
|
1393
1441
|
readonly name: string
|
|
1394
|
-
/** See [edr_solidity_tests::result::TestResult::status] */
|
|
1442
|
+
/** See [`edr_solidity_tests::result::TestResult::status`] */
|
|
1395
1443
|
readonly status: TestStatus
|
|
1396
|
-
/** See [edr_solidity_tests::result::TestResult::reason] */
|
|
1444
|
+
/** See [`edr_solidity_tests::result::TestResult::reason`] */
|
|
1397
1445
|
readonly reason?: string
|
|
1398
|
-
/** See [edr_solidity_tests::result::TestResult::counterexample] */
|
|
1446
|
+
/** See [`edr_solidity_tests::result::TestResult::counterexample`] */
|
|
1399
1447
|
readonly counterexample?: BaseCounterExample | CounterExampleSequence
|
|
1400
|
-
/** See [edr_solidity_tests::result::TestResult::decoded_logs] */
|
|
1448
|
+
/** See [`edr_solidity_tests::result::TestResult::decoded_logs`] */
|
|
1401
1449
|
readonly decodedLogs: Array<string>
|
|
1402
|
-
/** See [edr_solidity_tests::result::TestResult::kind] */
|
|
1450
|
+
/** See [`edr_solidity_tests::result::TestResult::kind`] */
|
|
1403
1451
|
readonly kind: StandardTestKind | FuzzTestKind | InvariantTestKind
|
|
1404
|
-
/** See [edr_solidity_tests::result::TestResult::duration] */
|
|
1452
|
+
/** See [`edr_solidity_tests::result::TestResult::duration`] */
|
|
1405
1453
|
readonly durationNs: bigint
|
|
1406
1454
|
/**
|
|
1407
1455
|
* 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, 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,7 @@ 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
|
|
360
361
|
module.exports.addStatementCoverageInstrumentation = addStatementCoverageInstrumentation
|
|
361
362
|
module.exports.Precompile = Precompile
|
|
362
363
|
module.exports.precompileP256Verify = precompileP256Verify
|
|
@@ -368,6 +369,7 @@ module.exports.ExceptionalHalt = ExceptionalHalt
|
|
|
368
369
|
module.exports.CachedChains = CachedChains
|
|
369
370
|
module.exports.CachedEndpoints = CachedEndpoints
|
|
370
371
|
module.exports.FsAccessPermission = FsAccessPermission
|
|
372
|
+
module.exports.CollectStackTraces = CollectStackTraces
|
|
371
373
|
module.exports.IncludeTraces = IncludeTraces
|
|
372
374
|
module.exports.SolidityTestRunnerFactory = SolidityTestRunnerFactory
|
|
373
375
|
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.7",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"@napi-rs/cli": "^2.18.4",
|
|
6
6
|
"@nomicfoundation/ethereumjs-util": "^9.0.4",
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
"repository": "NomicFoundation/edr.git",
|
|
60
60
|
"types": "index.d.ts",
|
|
61
61
|
"optionalDependencies": {
|
|
62
|
-
"@nomicfoundation/edr-darwin-arm64": "0.12.0-next.
|
|
63
|
-
"@nomicfoundation/edr-darwin-x64": "0.12.0-next.
|
|
64
|
-
"@nomicfoundation/edr-linux-arm64-gnu": "0.12.0-next.
|
|
65
|
-
"@nomicfoundation/edr-linux-arm64-musl": "0.12.0-next.
|
|
66
|
-
"@nomicfoundation/edr-linux-x64-gnu": "0.12.0-next.
|
|
67
|
-
"@nomicfoundation/edr-linux-x64-musl": "0.12.0-next.
|
|
68
|
-
"@nomicfoundation/edr-win32-x64-msvc": "0.12.0-next.
|
|
62
|
+
"@nomicfoundation/edr-darwin-arm64": "0.12.0-next.7",
|
|
63
|
+
"@nomicfoundation/edr-darwin-x64": "0.12.0-next.7",
|
|
64
|
+
"@nomicfoundation/edr-linux-arm64-gnu": "0.12.0-next.7",
|
|
65
|
+
"@nomicfoundation/edr-linux-arm64-musl": "0.12.0-next.7",
|
|
66
|
+
"@nomicfoundation/edr-linux-x64-gnu": "0.12.0-next.7",
|
|
67
|
+
"@nomicfoundation/edr-linux-x64-musl": "0.12.0-next.7",
|
|
68
|
+
"@nomicfoundation/edr-win32-x64-msvc": "0.12.0-next.7"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
71
|
"artifacts": "napi artifacts",
|
package/src/chains/generic.rs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
use std::sync::Arc;
|
|
2
2
|
|
|
3
|
-
use edr_eth::l1;
|
|
4
3
|
use edr_generic::GenericChainSpec;
|
|
5
4
|
use edr_napi_core::{
|
|
6
5
|
logger::Logger,
|
|
@@ -31,7 +30,7 @@ impl SyncProviderFactory for GenericChainProviderFactory {
|
|
|
31
30
|
)?;
|
|
32
31
|
|
|
33
32
|
let provider_config =
|
|
34
|
-
edr_provider::ProviderConfig::<
|
|
33
|
+
edr_provider::ProviderConfig::<edr_chain_l1::Hardfork>::try_from(provider_config)?;
|
|
35
34
|
|
|
36
35
|
let provider = edr_provider::Provider::<GenericChainSpec>::new(
|
|
37
36
|
runtime.clone(),
|
package/src/chains/l1.rs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
use std::{str::FromStr, sync::Arc};
|
|
2
2
|
|
|
3
|
-
use
|
|
3
|
+
use edr_chain_l1::L1ChainSpec;
|
|
4
4
|
use edr_evm::eips::{
|
|
5
5
|
eip2935::{HISTORY_STORAGE_ADDRESS, HISTORY_STORAGE_UNSUPPORTED_BYTECODE},
|
|
6
6
|
eip4788::{BEACON_ROOTS_ADDRESS, BEACON_ROOTS_BYTECODE},
|
|
@@ -35,7 +35,7 @@ impl SyncProviderFactory for L1ProviderFactory {
|
|
|
35
35
|
Logger::<L1ChainSpec, CurrentTime>::new(logger_config, Arc::clone(&contract_decoder))?;
|
|
36
36
|
|
|
37
37
|
let provider_config =
|
|
38
|
-
edr_provider::ProviderConfig::<
|
|
38
|
+
edr_provider::ProviderConfig::<edr_chain_l1::Hardfork>::try_from(provider_config)?;
|
|
39
39
|
|
|
40
40
|
let provider = edr_provider::Provider::<L1ChainSpec>::new(
|
|
41
41
|
runtime.clone(),
|
|
@@ -52,7 +52,7 @@ impl SyncProviderFactory for L1ProviderFactory {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
#[napi]
|
|
55
|
-
pub const L1_CHAIN_TYPE: &str =
|
|
55
|
+
pub const L1_CHAIN_TYPE: &str = edr_chain_l1::CHAIN_TYPE;
|
|
56
56
|
|
|
57
57
|
#[napi(catch_unwind)]
|
|
58
58
|
pub fn l1_genesis_state(hardfork: SpecId) -> Vec<AccountOverride> {
|
|
@@ -142,25 +142,25 @@ impl FromStr for SpecId {
|
|
|
142
142
|
|
|
143
143
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
144
144
|
match s {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
145
|
+
edr_chain_l1::hardfork::name::FRONTIER => Ok(SpecId::Frontier),
|
|
146
|
+
edr_chain_l1::hardfork::name::FRONTIER_THAWING => Ok(SpecId::FrontierThawing),
|
|
147
|
+
edr_chain_l1::hardfork::name::HOMESTEAD => Ok(SpecId::Homestead),
|
|
148
|
+
edr_chain_l1::hardfork::name::DAO_FORK => Ok(SpecId::DaoFork),
|
|
149
|
+
edr_chain_l1::hardfork::name::TANGERINE => Ok(SpecId::Tangerine),
|
|
150
|
+
edr_chain_l1::hardfork::name::SPURIOUS_DRAGON => Ok(SpecId::SpuriousDragon),
|
|
151
|
+
edr_chain_l1::hardfork::name::BYZANTIUM => Ok(SpecId::Byzantium),
|
|
152
|
+
edr_chain_l1::hardfork::name::CONSTANTINOPLE => Ok(SpecId::Constantinople),
|
|
153
|
+
edr_chain_l1::hardfork::name::PETERSBURG => Ok(SpecId::Petersburg),
|
|
154
|
+
edr_chain_l1::hardfork::name::ISTANBUL => Ok(SpecId::Istanbul),
|
|
155
|
+
edr_chain_l1::hardfork::name::MUIR_GLACIER => Ok(SpecId::MuirGlacier),
|
|
156
|
+
edr_chain_l1::hardfork::name::BERLIN => Ok(SpecId::Berlin),
|
|
157
|
+
edr_chain_l1::hardfork::name::LONDON => Ok(SpecId::London),
|
|
158
|
+
edr_chain_l1::hardfork::name::ARROW_GLACIER => Ok(SpecId::ArrowGlacier),
|
|
159
|
+
edr_chain_l1::hardfork::name::GRAY_GLACIER => Ok(SpecId::GrayGlacier),
|
|
160
|
+
edr_chain_l1::hardfork::name::MERGE => Ok(SpecId::Merge),
|
|
161
|
+
edr_chain_l1::hardfork::name::SHANGHAI => Ok(SpecId::Shanghai),
|
|
162
|
+
edr_chain_l1::hardfork::name::CANCUN => Ok(SpecId::Cancun),
|
|
163
|
+
edr_chain_l1::hardfork::name::PRAGUE => Ok(SpecId::Prague),
|
|
164
164
|
_ => Err(napi::Error::new(
|
|
165
165
|
napi::Status::InvalidArg,
|
|
166
166
|
format!("The provided hardfork `{s}` is not supported."),
|
|
@@ -169,28 +169,28 @@ impl FromStr for SpecId {
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
impl From<SpecId> for
|
|
172
|
+
impl From<SpecId> for edr_chain_l1::Hardfork {
|
|
173
173
|
fn from(value: SpecId) -> Self {
|
|
174
174
|
match value {
|
|
175
|
-
SpecId::Frontier =>
|
|
176
|
-
SpecId::FrontierThawing =>
|
|
177
|
-
SpecId::Homestead =>
|
|
178
|
-
SpecId::DaoFork =>
|
|
179
|
-
SpecId::Tangerine =>
|
|
180
|
-
SpecId::SpuriousDragon =>
|
|
181
|
-
SpecId::Byzantium =>
|
|
182
|
-
SpecId::Constantinople =>
|
|
183
|
-
SpecId::Petersburg =>
|
|
184
|
-
SpecId::Istanbul =>
|
|
185
|
-
SpecId::MuirGlacier =>
|
|
186
|
-
SpecId::Berlin =>
|
|
187
|
-
SpecId::London =>
|
|
188
|
-
SpecId::ArrowGlacier =>
|
|
189
|
-
SpecId::GrayGlacier =>
|
|
190
|
-
SpecId::Merge =>
|
|
191
|
-
SpecId::Shanghai =>
|
|
192
|
-
SpecId::Cancun =>
|
|
193
|
-
SpecId::Prague =>
|
|
175
|
+
SpecId::Frontier => edr_chain_l1::Hardfork::FRONTIER,
|
|
176
|
+
SpecId::FrontierThawing => edr_chain_l1::Hardfork::FRONTIER_THAWING,
|
|
177
|
+
SpecId::Homestead => edr_chain_l1::Hardfork::HOMESTEAD,
|
|
178
|
+
SpecId::DaoFork => edr_chain_l1::Hardfork::DAO_FORK,
|
|
179
|
+
SpecId::Tangerine => edr_chain_l1::Hardfork::TANGERINE,
|
|
180
|
+
SpecId::SpuriousDragon => edr_chain_l1::Hardfork::SPURIOUS_DRAGON,
|
|
181
|
+
SpecId::Byzantium => edr_chain_l1::Hardfork::BYZANTIUM,
|
|
182
|
+
SpecId::Constantinople => edr_chain_l1::Hardfork::CONSTANTINOPLE,
|
|
183
|
+
SpecId::Petersburg => edr_chain_l1::Hardfork::PETERSBURG,
|
|
184
|
+
SpecId::Istanbul => edr_chain_l1::Hardfork::ISTANBUL,
|
|
185
|
+
SpecId::MuirGlacier => edr_chain_l1::Hardfork::MUIR_GLACIER,
|
|
186
|
+
SpecId::Berlin => edr_chain_l1::Hardfork::BERLIN,
|
|
187
|
+
SpecId::London => edr_chain_l1::Hardfork::LONDON,
|
|
188
|
+
SpecId::ArrowGlacier => edr_chain_l1::Hardfork::ARROW_GLACIER,
|
|
189
|
+
SpecId::GrayGlacier => edr_chain_l1::Hardfork::GRAY_GLACIER,
|
|
190
|
+
SpecId::Merge => edr_chain_l1::Hardfork::MERGE,
|
|
191
|
+
SpecId::Shanghai => edr_chain_l1::Hardfork::SHANGHAI,
|
|
192
|
+
SpecId::Cancun => edr_chain_l1::Hardfork::CANCUN,
|
|
193
|
+
SpecId::Prague => edr_chain_l1::Hardfork::PRAGUE,
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
}
|
|
@@ -206,25 +206,25 @@ pub fn l1_hardfork_from_string(hardfork: String) -> napi::Result<SpecId> {
|
|
|
206
206
|
#[napi(catch_unwind)]
|
|
207
207
|
pub fn l1_hardfork_to_string(harfork: SpecId) -> &'static str {
|
|
208
208
|
match harfork {
|
|
209
|
-
SpecId::Frontier =>
|
|
210
|
-
SpecId::FrontierThawing =>
|
|
211
|
-
SpecId::Homestead =>
|
|
212
|
-
SpecId::DaoFork =>
|
|
213
|
-
SpecId::Tangerine =>
|
|
214
|
-
SpecId::SpuriousDragon =>
|
|
215
|
-
SpecId::Byzantium =>
|
|
216
|
-
SpecId::Constantinople =>
|
|
217
|
-
SpecId::Petersburg =>
|
|
218
|
-
SpecId::Istanbul =>
|
|
219
|
-
SpecId::MuirGlacier =>
|
|
220
|
-
SpecId::Berlin =>
|
|
221
|
-
SpecId::London =>
|
|
222
|
-
SpecId::ArrowGlacier =>
|
|
223
|
-
SpecId::GrayGlacier =>
|
|
224
|
-
SpecId::Merge =>
|
|
225
|
-
SpecId::Shanghai =>
|
|
226
|
-
SpecId::Cancun =>
|
|
227
|
-
SpecId::Prague =>
|
|
209
|
+
SpecId::Frontier => edr_chain_l1::hardfork::name::FRONTIER,
|
|
210
|
+
SpecId::FrontierThawing => edr_chain_l1::hardfork::name::FRONTIER_THAWING,
|
|
211
|
+
SpecId::Homestead => edr_chain_l1::hardfork::name::HOMESTEAD,
|
|
212
|
+
SpecId::DaoFork => edr_chain_l1::hardfork::name::DAO_FORK,
|
|
213
|
+
SpecId::Tangerine => edr_chain_l1::hardfork::name::TANGERINE,
|
|
214
|
+
SpecId::SpuriousDragon => edr_chain_l1::hardfork::name::SPURIOUS_DRAGON,
|
|
215
|
+
SpecId::Byzantium => edr_chain_l1::hardfork::name::BYZANTIUM,
|
|
216
|
+
SpecId::Constantinople => edr_chain_l1::hardfork::name::CONSTANTINOPLE,
|
|
217
|
+
SpecId::Petersburg => edr_chain_l1::hardfork::name::PETERSBURG,
|
|
218
|
+
SpecId::Istanbul => edr_chain_l1::hardfork::name::ISTANBUL,
|
|
219
|
+
SpecId::MuirGlacier => edr_chain_l1::hardfork::name::MUIR_GLACIER,
|
|
220
|
+
SpecId::Berlin => edr_chain_l1::hardfork::name::BERLIN,
|
|
221
|
+
SpecId::London => edr_chain_l1::hardfork::name::LONDON,
|
|
222
|
+
SpecId::ArrowGlacier => edr_chain_l1::hardfork::name::ARROW_GLACIER,
|
|
223
|
+
SpecId::GrayGlacier => edr_chain_l1::hardfork::name::GRAY_GLACIER,
|
|
224
|
+
SpecId::Merge => edr_chain_l1::hardfork::name::MERGE,
|
|
225
|
+
SpecId::Shanghai => edr_chain_l1::hardfork::name::SHANGHAI,
|
|
226
|
+
SpecId::Cancun => edr_chain_l1::hardfork::name::CANCUN,
|
|
227
|
+
SpecId::Prague => edr_chain_l1::hardfork::name::PRAGUE,
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
|
|
@@ -240,7 +240,7 @@ macro_rules! export_spec_id {
|
|
|
240
240
|
($($variant:ident),*) => {
|
|
241
241
|
$(
|
|
242
242
|
#[napi]
|
|
243
|
-
pub const $variant: &str =
|
|
243
|
+
pub const $variant: &str = edr_chain_l1::hardfork::name::$variant;
|
|
244
244
|
)*
|
|
245
245
|
};
|
|
246
246
|
}
|
package/src/chains/op.rs
CHANGED
|
@@ -6,7 +6,7 @@ use edr_napi_core::{
|
|
|
6
6
|
provider::{SyncProvider, SyncProviderFactory},
|
|
7
7
|
subscription::subscriber_callback_for_chain_spec,
|
|
8
8
|
};
|
|
9
|
-
use edr_op::{predeploys::GAS_PRICE_ORACLE_ADDRESS, OpChainSpec
|
|
9
|
+
use edr_op::{predeploys::GAS_PRICE_ORACLE_ADDRESS, OpChainSpec};
|
|
10
10
|
use edr_provider::time::CurrentTime;
|
|
11
11
|
use edr_solidity::contract_decoder::ContractDecoder;
|
|
12
12
|
use napi::{
|
|
@@ -34,7 +34,8 @@ impl SyncProviderFactory for OpProviderFactory {
|
|
|
34
34
|
let logger =
|
|
35
35
|
Logger::<OpChainSpec, CurrentTime>::new(logger_config, Arc::clone(&contract_decoder))?;
|
|
36
36
|
|
|
37
|
-
let provider_config =
|
|
37
|
+
let provider_config =
|
|
38
|
+
edr_provider::ProviderConfig::<edr_op::Hardfork>::try_from(provider_config)?;
|
|
38
39
|
|
|
39
40
|
let provider = edr_provider::Provider::<OpChainSpec>::new(
|
|
40
41
|
runtime.clone(),
|
|
@@ -63,17 +64,17 @@ pub enum OpHardfork {
|
|
|
63
64
|
Isthmus = 107,
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
impl From<OpHardfork> for
|
|
67
|
+
impl From<OpHardfork> for edr_op::Hardfork {
|
|
67
68
|
fn from(hardfork: OpHardfork) -> Self {
|
|
68
69
|
match hardfork {
|
|
69
|
-
OpHardfork::Bedrock =>
|
|
70
|
-
OpHardfork::Regolith =>
|
|
71
|
-
OpHardfork::Canyon =>
|
|
72
|
-
OpHardfork::Ecotone =>
|
|
73
|
-
OpHardfork::Fjord =>
|
|
74
|
-
OpHardfork::Granite =>
|
|
75
|
-
OpHardfork::Holocene =>
|
|
76
|
-
OpHardfork::Isthmus =>
|
|
70
|
+
OpHardfork::Bedrock => edr_op::Hardfork::BEDROCK,
|
|
71
|
+
OpHardfork::Regolith => edr_op::Hardfork::REGOLITH,
|
|
72
|
+
OpHardfork::Canyon => edr_op::Hardfork::CANYON,
|
|
73
|
+
OpHardfork::Ecotone => edr_op::Hardfork::ECOTONE,
|
|
74
|
+
OpHardfork::Fjord => edr_op::Hardfork::FJORD,
|
|
75
|
+
OpHardfork::Granite => edr_op::Hardfork::GRANITE,
|
|
76
|
+
OpHardfork::Holocene => edr_op::Hardfork::HOLOCENE,
|
|
77
|
+
OpHardfork::Isthmus => edr_op::Hardfork::ISTHMUS,
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
}
|
|
@@ -335,10 +336,10 @@ pub fn op_provider_factory() -> ProviderFactory {
|
|
|
335
336
|
factory.into()
|
|
336
337
|
}
|
|
337
338
|
|
|
338
|
-
fn gas_price_oracle_override(hardfork:
|
|
339
|
-
if hardfork >=
|
|
339
|
+
fn gas_price_oracle_override(hardfork: edr_op::Hardfork) -> AccountOverride {
|
|
340
|
+
if hardfork >= edr_op::Hardfork::ISTHMUS {
|
|
340
341
|
gas_price_oracle_isthmus()
|
|
341
|
-
} else if hardfork >=
|
|
342
|
+
} else if hardfork >= edr_op::Hardfork::FJORD {
|
|
342
343
|
gas_price_oracle_fjord()
|
|
343
344
|
} else {
|
|
344
345
|
gas_price_oracle_ecotone()
|