@nomicfoundation/edr 0.12.0-next.10 → 0.12.0-next.15
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 +21 -4
- package/index.js +2 -1
- package/package.json +9 -10
- package/src/account.rs +1 -1
- package/src/chains/l1.rs +48 -42
- package/src/config.rs +6 -6
- package/src/context.rs +2 -2
- package/src/mock/time.rs +5 -5
- package/src/mock.rs +1 -1
- package/src/precompile.rs +6 -6
- package/src/provider/response.rs +1 -1
- package/src/result.rs +21 -17
- package/src/solidity_tests/config.rs +13 -7
- package/src/solidity_tests/l1.rs +8 -4
- package/src/solidity_tests/op.rs +8 -5
- package/src/solidity_tests/runner.rs +1 -1
- package/src/solidity_tests/test_results.rs +60 -6
- package/src/trace/exit.rs +1 -1
- package/src/trace.rs +13 -11
package/index.d.ts
CHANGED
|
@@ -91,7 +91,9 @@ export enum SpecId {
|
|
|
91
91
|
/** Cancun */
|
|
92
92
|
Cancun = 17,
|
|
93
93
|
/** Prague */
|
|
94
|
-
Prague = 18
|
|
94
|
+
Prague = 18,
|
|
95
|
+
/** Osaka */
|
|
96
|
+
Osaka = 19
|
|
95
97
|
}
|
|
96
98
|
/**
|
|
97
99
|
* Tries to parse the provided string to create a [`SpecId`] instance.
|
|
@@ -125,6 +127,7 @@ export const MERGE: string
|
|
|
125
127
|
export const SHANGHAI: string
|
|
126
128
|
export const CANCUN: string
|
|
127
129
|
export const PRAGUE: string
|
|
130
|
+
export const OSAKA: string
|
|
128
131
|
/** Enumeration of supported OP hardforks. */
|
|
129
132
|
export enum OpHardfork {
|
|
130
133
|
Bedrock = 100,
|
|
@@ -586,8 +589,6 @@ export interface SolidityTestRunnerConfigArgs {
|
|
|
586
589
|
projectRoot: string
|
|
587
590
|
/** Configures the permissions of cheat codes that access the file system. */
|
|
588
591
|
fsPermissions?: Array<PathPermission>
|
|
589
|
-
/** Whether to support the `testFail` prefix. Defaults to false. */
|
|
590
|
-
testFail?: boolean
|
|
591
592
|
/** Address labels for traces. Defaults to none. */
|
|
592
593
|
labels?: Array<AddressLabel>
|
|
593
594
|
/**
|
|
@@ -838,6 +839,12 @@ export interface InvariantConfigArgs {
|
|
|
838
839
|
* Defaults to 5000.
|
|
839
840
|
*/
|
|
840
841
|
shrinkRunLimit?: number
|
|
842
|
+
/**
|
|
843
|
+
* The maximum number of rejects via `vm.assume` which can be encountered
|
|
844
|
+
* during a single invariant run.
|
|
845
|
+
* Defaults to 65536.
|
|
846
|
+
*/
|
|
847
|
+
maxAssumeRejects?: number
|
|
841
848
|
}
|
|
842
849
|
/** Settings to configure caching of remote RPC endpoints. */
|
|
843
850
|
export interface StorageCachingConfig {
|
|
@@ -1003,7 +1010,7 @@ export enum TestStatus {
|
|
|
1003
1010
|
/**Test skipped */
|
|
1004
1011
|
Skipped = 'Skipped'
|
|
1005
1012
|
}
|
|
1006
|
-
/** See [`edr_solidity_tests::result::TestKind::
|
|
1013
|
+
/** See [`edr_solidity_tests::result::TestKind::Unit`] */
|
|
1007
1014
|
export interface StandardTestKind {
|
|
1008
1015
|
/** The gas consumed by the test. */
|
|
1009
1016
|
readonly consumedGas: bigint
|
|
@@ -1034,6 +1041,16 @@ export interface InvariantTestKind {
|
|
|
1034
1041
|
readonly calls: bigint
|
|
1035
1042
|
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
1036
1043
|
readonly reverts: bigint
|
|
1044
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
1045
|
+
readonly metrics: Record<string, InvariantMetrics>
|
|
1046
|
+
/** See [`edr_solidity_tests::result::TestKind::Invariant`] */
|
|
1047
|
+
readonly failedCorpusReplays: bigint
|
|
1048
|
+
}
|
|
1049
|
+
/** See [`edr_solidity_tests::result::InvariantMetrics`] */
|
|
1050
|
+
export interface InvariantMetrics {
|
|
1051
|
+
readonly calls: bigint
|
|
1052
|
+
readonly reverts: bigint
|
|
1053
|
+
readonly discards: bigint
|
|
1037
1054
|
}
|
|
1038
1055
|
/**
|
|
1039
1056
|
* Original sequence size and sequence of calls used as a counter example
|
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, 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
|
|
313
|
+
const { GENERIC_CHAIN_TYPE, genericChainProviderFactory, L1_CHAIN_TYPE, l1GenesisState, l1ProviderFactory, SpecId, l1HardforkFromString, l1HardforkToString, l1HardforkLatest, FRONTIER, FRONTIER_THAWING, HOMESTEAD, DAO_FORK, TANGERINE, SPURIOUS_DRAGON, BYZANTIUM, CONSTANTINOPLE, PETERSBURG, ISTANBUL, MUIR_GLACIER, BERLIN, LONDON, ARROW_GLACIER, GRAY_GLACIER, MERGE, SHANGHAI, CANCUN, PRAGUE, OSAKA, OpHardfork, opHardforkFromString, opHardforkToString, opLatestHardfork, OP_CHAIN_TYPE, opGenesisState, opProviderFactory, BEDROCK, REGOLITH, CANYON, ECOTONE, FJORD, GRANITE, HOLOCENE, ISTHMUS, MineOrdering, EdrContext, ContractDecoder, GasReportExecutionStatus, addStatementCoverageInstrumentation, Precompile, precompileP256Verify, ProviderFactory, Response, Provider, SuccessReason, ExceptionalHalt, CachedChains, CachedEndpoints, FsAccessPermission, CollectStackTraces, IncludeTraces, SolidityTestRunnerFactory, l1SolidityTestRunnerFactory, opSolidityTestRunnerFactory, SuiteResult, TestResult, TestStatus, CallKind, LogKind, linkHexStringBytecode, printStackTrace, Exit, ExitCode, BytecodeWrapper, ContractFunctionType, ReturnData, StackTraceEntryType, stackTraceEntryTypeToString, FALLBACK_FUNCTION_NAME, RECEIVE_FUNCTION_NAME, CONSTRUCTOR_FUNCTION_NAME, UNRECOGNIZED_FUNCTION_NAME, UNKNOWN_FUNCTION_NAME, PRECOMPILE_FUNCTION_NAME, UNRECOGNIZED_CONTRACT_NAME, RawTrace, getLatestSupportedSolcVersion } = nativeBinding
|
|
314
314
|
|
|
315
315
|
module.exports.GENERIC_CHAIN_TYPE = GENERIC_CHAIN_TYPE
|
|
316
316
|
module.exports.genericChainProviderFactory = genericChainProviderFactory
|
|
@@ -340,6 +340,7 @@ module.exports.MERGE = MERGE
|
|
|
340
340
|
module.exports.SHANGHAI = SHANGHAI
|
|
341
341
|
module.exports.CANCUN = CANCUN
|
|
342
342
|
module.exports.PRAGUE = PRAGUE
|
|
343
|
+
module.exports.OSAKA = OSAKA
|
|
343
344
|
module.exports.OpHardfork = OpHardfork
|
|
344
345
|
module.exports.opHardforkFromString = opHardforkFromString
|
|
345
346
|
module.exports.opHardforkToString = opHardforkToString
|
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.15",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"@napi-rs/cli": "^2.18.4",
|
|
6
6
|
"@nomicfoundation/ethereumjs-util": "^9.0.4",
|
|
@@ -36,8 +36,7 @@
|
|
|
36
36
|
"files": [
|
|
37
37
|
"index.js",
|
|
38
38
|
"index.d.ts",
|
|
39
|
-
"src/"
|
|
40
|
-
"dist/src/"
|
|
39
|
+
"src/"
|
|
41
40
|
],
|
|
42
41
|
"license": "MIT",
|
|
43
42
|
"main": "index.js",
|
|
@@ -59,13 +58,13 @@
|
|
|
59
58
|
"repository": "NomicFoundation/edr.git",
|
|
60
59
|
"types": "index.d.ts",
|
|
61
60
|
"dependencies": {
|
|
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.
|
|
61
|
+
"@nomicfoundation/edr-darwin-arm64": "0.12.0-next.15",
|
|
62
|
+
"@nomicfoundation/edr-darwin-x64": "0.12.0-next.15",
|
|
63
|
+
"@nomicfoundation/edr-linux-arm64-gnu": "0.12.0-next.15",
|
|
64
|
+
"@nomicfoundation/edr-linux-arm64-musl": "0.12.0-next.15",
|
|
65
|
+
"@nomicfoundation/edr-linux-x64-gnu": "0.12.0-next.15",
|
|
66
|
+
"@nomicfoundation/edr-linux-x64-musl": "0.12.0-next.15",
|
|
67
|
+
"@nomicfoundation/edr-win32-x64-msvc": "0.12.0-next.15"
|
|
69
68
|
},
|
|
70
69
|
"scripts": {
|
|
71
70
|
"artifacts": "napi artifacts",
|
package/src/account.rs
CHANGED
|
@@ -82,7 +82,7 @@ impl TryFrom<AccountOverride> for Predeploy {
|
|
|
82
82
|
fn try_from(value: AccountOverride) -> Result<Self, Self::Error> {
|
|
83
83
|
let (address, account_override) = value.try_into()?;
|
|
84
84
|
|
|
85
|
-
let storage = account_override.storage.unwrap_or_else(HashMap::
|
|
85
|
+
let storage = account_override.storage.unwrap_or_else(HashMap::default);
|
|
86
86
|
let balance = account_override.balance.unwrap_or(U256::ZERO);
|
|
87
87
|
let nonce = account_override.nonce.unwrap_or(0);
|
|
88
88
|
let code = account_override.code.ok_or_else(|| {
|
package/src/chains/l1.rs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
use std::{str::FromStr, sync::Arc};
|
|
2
2
|
|
|
3
|
-
use
|
|
4
|
-
use edr_evm::eips::{
|
|
3
|
+
use edr_blockchain_fork::eips::{
|
|
5
4
|
eip2935::{HISTORY_STORAGE_ADDRESS, HISTORY_STORAGE_UNSUPPORTED_BYTECODE},
|
|
6
5
|
eip4788::{BEACON_ROOTS_ADDRESS, BEACON_ROOTS_BYTECODE},
|
|
7
6
|
};
|
|
7
|
+
use edr_chain_l1::L1ChainSpec;
|
|
8
8
|
use edr_napi_core::{
|
|
9
9
|
logger::Logger,
|
|
10
10
|
provider::{SyncProvider, SyncProviderFactory},
|
|
@@ -135,6 +135,8 @@ pub enum SpecId {
|
|
|
135
135
|
Cancun = 17,
|
|
136
136
|
/// Prague
|
|
137
137
|
Prague = 18,
|
|
138
|
+
/// Osaka
|
|
139
|
+
Osaka = 19,
|
|
138
140
|
}
|
|
139
141
|
|
|
140
142
|
impl FromStr for SpecId {
|
|
@@ -142,25 +144,26 @@ impl FromStr for SpecId {
|
|
|
142
144
|
|
|
143
145
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
144
146
|
match s {
|
|
145
|
-
edr_chain_l1::
|
|
146
|
-
edr_chain_l1::
|
|
147
|
-
edr_chain_l1::
|
|
148
|
-
edr_chain_l1::
|
|
149
|
-
edr_chain_l1::
|
|
150
|
-
edr_chain_l1::
|
|
151
|
-
edr_chain_l1::
|
|
152
|
-
edr_chain_l1::
|
|
153
|
-
edr_chain_l1::
|
|
154
|
-
edr_chain_l1::
|
|
155
|
-
edr_chain_l1::
|
|
156
|
-
edr_chain_l1::
|
|
157
|
-
edr_chain_l1::
|
|
158
|
-
edr_chain_l1::
|
|
159
|
-
edr_chain_l1::
|
|
160
|
-
edr_chain_l1::
|
|
161
|
-
edr_chain_l1::
|
|
162
|
-
edr_chain_l1::
|
|
163
|
-
edr_chain_l1::
|
|
147
|
+
edr_chain_l1::chains::name::FRONTIER => Ok(SpecId::Frontier),
|
|
148
|
+
edr_chain_l1::chains::name::FRONTIER_THAWING => Ok(SpecId::FrontierThawing),
|
|
149
|
+
edr_chain_l1::chains::name::HOMESTEAD => Ok(SpecId::Homestead),
|
|
150
|
+
edr_chain_l1::chains::name::DAO_FORK => Ok(SpecId::DaoFork),
|
|
151
|
+
edr_chain_l1::chains::name::TANGERINE => Ok(SpecId::Tangerine),
|
|
152
|
+
edr_chain_l1::chains::name::SPURIOUS_DRAGON => Ok(SpecId::SpuriousDragon),
|
|
153
|
+
edr_chain_l1::chains::name::BYZANTIUM => Ok(SpecId::Byzantium),
|
|
154
|
+
edr_chain_l1::chains::name::CONSTANTINOPLE => Ok(SpecId::Constantinople),
|
|
155
|
+
edr_chain_l1::chains::name::PETERSBURG => Ok(SpecId::Petersburg),
|
|
156
|
+
edr_chain_l1::chains::name::ISTANBUL => Ok(SpecId::Istanbul),
|
|
157
|
+
edr_chain_l1::chains::name::MUIR_GLACIER => Ok(SpecId::MuirGlacier),
|
|
158
|
+
edr_chain_l1::chains::name::BERLIN => Ok(SpecId::Berlin),
|
|
159
|
+
edr_chain_l1::chains::name::LONDON => Ok(SpecId::London),
|
|
160
|
+
edr_chain_l1::chains::name::ARROW_GLACIER => Ok(SpecId::ArrowGlacier),
|
|
161
|
+
edr_chain_l1::chains::name::GRAY_GLACIER => Ok(SpecId::GrayGlacier),
|
|
162
|
+
edr_chain_l1::chains::name::MERGE => Ok(SpecId::Merge),
|
|
163
|
+
edr_chain_l1::chains::name::SHANGHAI => Ok(SpecId::Shanghai),
|
|
164
|
+
edr_chain_l1::chains::name::CANCUN => Ok(SpecId::Cancun),
|
|
165
|
+
edr_chain_l1::chains::name::PRAGUE => Ok(SpecId::Prague),
|
|
166
|
+
edr_chain_l1::chains::name::OSAKA => Ok(SpecId::Osaka),
|
|
164
167
|
_ => Err(napi::Error::new(
|
|
165
168
|
napi::Status::InvalidArg,
|
|
166
169
|
format!("The provided hardfork `{s}` is not supported."),
|
|
@@ -191,6 +194,7 @@ impl From<SpecId> for edr_chain_l1::Hardfork {
|
|
|
191
194
|
SpecId::Shanghai => edr_chain_l1::Hardfork::SHANGHAI,
|
|
192
195
|
SpecId::Cancun => edr_chain_l1::Hardfork::CANCUN,
|
|
193
196
|
SpecId::Prague => edr_chain_l1::Hardfork::PRAGUE,
|
|
197
|
+
SpecId::Osaka => edr_chain_l1::Hardfork::OSAKA,
|
|
194
198
|
}
|
|
195
199
|
}
|
|
196
200
|
}
|
|
@@ -206,25 +210,26 @@ pub fn l1_hardfork_from_string(hardfork: String) -> napi::Result<SpecId> {
|
|
|
206
210
|
#[napi(catch_unwind)]
|
|
207
211
|
pub fn l1_hardfork_to_string(harfork: SpecId) -> &'static str {
|
|
208
212
|
match harfork {
|
|
209
|
-
SpecId::Frontier => edr_chain_l1::
|
|
210
|
-
SpecId::FrontierThawing => edr_chain_l1::
|
|
211
|
-
SpecId::Homestead => edr_chain_l1::
|
|
212
|
-
SpecId::DaoFork => edr_chain_l1::
|
|
213
|
-
SpecId::Tangerine => edr_chain_l1::
|
|
214
|
-
SpecId::SpuriousDragon => edr_chain_l1::
|
|
215
|
-
SpecId::Byzantium => edr_chain_l1::
|
|
216
|
-
SpecId::Constantinople => edr_chain_l1::
|
|
217
|
-
SpecId::Petersburg => edr_chain_l1::
|
|
218
|
-
SpecId::Istanbul => edr_chain_l1::
|
|
219
|
-
SpecId::MuirGlacier => edr_chain_l1::
|
|
220
|
-
SpecId::Berlin => edr_chain_l1::
|
|
221
|
-
SpecId::London => edr_chain_l1::
|
|
222
|
-
SpecId::ArrowGlacier => edr_chain_l1::
|
|
223
|
-
SpecId::GrayGlacier => edr_chain_l1::
|
|
224
|
-
SpecId::Merge => edr_chain_l1::
|
|
225
|
-
SpecId::Shanghai => edr_chain_l1::
|
|
226
|
-
SpecId::Cancun => edr_chain_l1::
|
|
227
|
-
SpecId::Prague => edr_chain_l1::
|
|
213
|
+
SpecId::Frontier => edr_chain_l1::chains::name::FRONTIER,
|
|
214
|
+
SpecId::FrontierThawing => edr_chain_l1::chains::name::FRONTIER_THAWING,
|
|
215
|
+
SpecId::Homestead => edr_chain_l1::chains::name::HOMESTEAD,
|
|
216
|
+
SpecId::DaoFork => edr_chain_l1::chains::name::DAO_FORK,
|
|
217
|
+
SpecId::Tangerine => edr_chain_l1::chains::name::TANGERINE,
|
|
218
|
+
SpecId::SpuriousDragon => edr_chain_l1::chains::name::SPURIOUS_DRAGON,
|
|
219
|
+
SpecId::Byzantium => edr_chain_l1::chains::name::BYZANTIUM,
|
|
220
|
+
SpecId::Constantinople => edr_chain_l1::chains::name::CONSTANTINOPLE,
|
|
221
|
+
SpecId::Petersburg => edr_chain_l1::chains::name::PETERSBURG,
|
|
222
|
+
SpecId::Istanbul => edr_chain_l1::chains::name::ISTANBUL,
|
|
223
|
+
SpecId::MuirGlacier => edr_chain_l1::chains::name::MUIR_GLACIER,
|
|
224
|
+
SpecId::Berlin => edr_chain_l1::chains::name::BERLIN,
|
|
225
|
+
SpecId::London => edr_chain_l1::chains::name::LONDON,
|
|
226
|
+
SpecId::ArrowGlacier => edr_chain_l1::chains::name::ARROW_GLACIER,
|
|
227
|
+
SpecId::GrayGlacier => edr_chain_l1::chains::name::GRAY_GLACIER,
|
|
228
|
+
SpecId::Merge => edr_chain_l1::chains::name::MERGE,
|
|
229
|
+
SpecId::Shanghai => edr_chain_l1::chains::name::SHANGHAI,
|
|
230
|
+
SpecId::Cancun => edr_chain_l1::chains::name::CANCUN,
|
|
231
|
+
SpecId::Prague => edr_chain_l1::chains::name::PRAGUE,
|
|
232
|
+
SpecId::Osaka => edr_chain_l1::chains::name::OSAKA,
|
|
228
233
|
}
|
|
229
234
|
}
|
|
230
235
|
|
|
@@ -240,7 +245,7 @@ macro_rules! export_spec_id {
|
|
|
240
245
|
($($variant:ident),*) => {
|
|
241
246
|
$(
|
|
242
247
|
#[napi]
|
|
243
|
-
pub const $variant: &str = edr_chain_l1::
|
|
248
|
+
pub const $variant: &str = edr_chain_l1::chains::name::$variant;
|
|
244
249
|
)*
|
|
245
250
|
};
|
|
246
251
|
}
|
|
@@ -264,5 +269,6 @@ export_spec_id!(
|
|
|
264
269
|
MERGE,
|
|
265
270
|
SHANGHAI,
|
|
266
271
|
CANCUN,
|
|
267
|
-
PRAGUE
|
|
272
|
+
PRAGUE,
|
|
273
|
+
OSAKA
|
|
268
274
|
);
|
package/src/config.rs
CHANGED
|
@@ -280,28 +280,28 @@ impl TryFrom<ForkConfig> for edr_provider::ForkConfig<String> {
|
|
|
280
280
|
let condition = match condition {
|
|
281
281
|
Either::A(HardforkActivationByBlockNumber {
|
|
282
282
|
block_number,
|
|
283
|
-
}) =>
|
|
283
|
+
}) => edr_chain_config::ForkCondition::Block(
|
|
284
284
|
block_number.try_cast()?,
|
|
285
285
|
),
|
|
286
286
|
Either::B(HardforkActivationByTimestamp {
|
|
287
287
|
timestamp,
|
|
288
|
-
}) =>
|
|
288
|
+
}) => edr_chain_config::ForkCondition::Timestamp(
|
|
289
289
|
timestamp.try_cast()?,
|
|
290
290
|
),
|
|
291
291
|
};
|
|
292
292
|
|
|
293
|
-
Ok(
|
|
293
|
+
Ok(edr_chain_config::HardforkActivation {
|
|
294
294
|
condition,
|
|
295
295
|
hardfork,
|
|
296
296
|
})
|
|
297
297
|
},
|
|
298
298
|
)
|
|
299
299
|
.collect::<napi::Result<Vec<_>>>()
|
|
300
|
-
.map(
|
|
300
|
+
.map(edr_chain_config::HardforkActivations::new)
|
|
301
301
|
})
|
|
302
302
|
.transpose()?;
|
|
303
303
|
|
|
304
|
-
let chain_config =
|
|
304
|
+
let chain_config = edr_chain_config::ChainOverride {
|
|
305
305
|
name,
|
|
306
306
|
hardfork_activation_overrides,
|
|
307
307
|
};
|
|
@@ -339,7 +339,7 @@ impl From<MemPoolConfig> for edr_provider::MemPoolConfig {
|
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
-
impl From<MineOrdering> for
|
|
342
|
+
impl From<MineOrdering> for edr_runtime::MineOrdering {
|
|
343
343
|
fn from(value: MineOrdering) -> Self {
|
|
344
344
|
match value {
|
|
345
345
|
MineOrdering::Fifo => Self::Fifo,
|
package/src/context.rs
CHANGED
|
@@ -390,8 +390,8 @@ impl Context {
|
|
|
390
390
|
}
|
|
391
391
|
|
|
392
392
|
Ok(Self {
|
|
393
|
-
provider_factories: HashMap::
|
|
394
|
-
solidity_test_runner_factories: HashMap::
|
|
393
|
+
provider_factories: HashMap::default(),
|
|
394
|
+
solidity_test_runner_factories: HashMap::default(),
|
|
395
395
|
#[cfg(feature = "tracing")]
|
|
396
396
|
_tracing_write_guard: guard,
|
|
397
397
|
})
|
package/src/mock/time.rs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
use std::sync::Arc;
|
|
2
2
|
|
|
3
|
-
use
|
|
4
|
-
use
|
|
3
|
+
use edr_chain_spec::ChainSpec;
|
|
4
|
+
use edr_chain_spec_block::BlockChainSpec;
|
|
5
5
|
use edr_generic::GenericChainSpec;
|
|
6
6
|
use edr_napi_core::logger::Logger;
|
|
7
7
|
use edr_primitives::B256;
|
|
8
|
-
use edr_rpc_spec::
|
|
8
|
+
use edr_rpc_spec::RpcBlockChainSpec;
|
|
9
9
|
use napi::{bindgen_prelude::BigInt, tokio::runtime, Env, JsObject};
|
|
10
10
|
use napi_derive::napi;
|
|
11
11
|
|
|
@@ -104,8 +104,8 @@ pub fn create_provider_with_mock_timer(
|
|
|
104
104
|
Box::new(logger),
|
|
105
105
|
Box::new(move |event| {
|
|
106
106
|
let event = edr_napi_core::subscription::SubscriptionEvent::new::<
|
|
107
|
-
<GenericChainSpec as
|
|
108
|
-
<GenericChainSpec as
|
|
107
|
+
<GenericChainSpec as BlockChainSpec>::Block,
|
|
108
|
+
<GenericChainSpec as RpcBlockChainSpec>::RpcBlock<B256>,
|
|
109
109
|
<GenericChainSpec as ChainSpec>::SignedTransaction,
|
|
110
110
|
>(event);
|
|
111
111
|
|
package/src/mock.rs
CHANGED
package/src/precompile.rs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
use
|
|
1
|
+
use edr_precompile::PrecompileFn;
|
|
2
2
|
use edr_primitives::Address;
|
|
3
3
|
use napi::bindgen_prelude::Uint8Array;
|
|
4
4
|
use napi_derive::napi;
|
|
@@ -24,11 +24,11 @@ impl Precompile {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
impl From<
|
|
28
|
-
fn from(value:
|
|
27
|
+
impl From<edr_precompile::Precompile> for Precompile {
|
|
28
|
+
fn from(value: edr_precompile::Precompile) -> Self {
|
|
29
29
|
Self {
|
|
30
|
-
address: value.
|
|
31
|
-
precompile_fn: value.
|
|
30
|
+
address: *value.address(),
|
|
31
|
+
precompile_fn: value.into_precompile(),
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -46,5 +46,5 @@ impl Precompile {
|
|
|
46
46
|
/// secp256r1 precompile.
|
|
47
47
|
#[napi(catch_unwind)]
|
|
48
48
|
pub fn precompile_p256_verify() -> Precompile {
|
|
49
|
-
Precompile::from(
|
|
49
|
+
Precompile::from(edr_precompile::secp256r1::P256VERIFY)
|
|
50
50
|
}
|
package/src/provider/response.rs
CHANGED
package/src/result.rs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
use
|
|
2
|
-
use
|
|
1
|
+
use edr_chain_spec::EvmHaltReason;
|
|
2
|
+
use edr_runtime::trace::AfterMessage;
|
|
3
3
|
use napi::{
|
|
4
4
|
bindgen_prelude::{BigInt, Either3, Uint8Array},
|
|
5
5
|
Either,
|
|
@@ -19,17 +19,17 @@ pub enum SuccessReason {
|
|
|
19
19
|
SelfDestruct,
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
impl From<
|
|
23
|
-
fn from(eval:
|
|
22
|
+
impl From<edr_evm_spec::result::SuccessReason> for SuccessReason {
|
|
23
|
+
fn from(eval: edr_evm_spec::result::SuccessReason) -> Self {
|
|
24
24
|
match eval {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
edr_evm_spec::result::SuccessReason::Stop => Self::Stop,
|
|
26
|
+
edr_evm_spec::result::SuccessReason::Return => Self::Return,
|
|
27
|
+
edr_evm_spec::result::SuccessReason::SelfDestruct => Self::SelfDestruct,
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
impl From<SuccessReason> for
|
|
32
|
+
impl From<SuccessReason> for edr_evm_spec::result::SuccessReason {
|
|
33
33
|
fn from(value: SuccessReason) -> Self {
|
|
34
34
|
match value {
|
|
35
35
|
SuccessReason::Stop => Self::Stop,
|
|
@@ -112,7 +112,9 @@ impl From<EvmHaltReason> for ExceptionalHalt {
|
|
|
112
112
|
EvmHaltReason::StackOverflow => ExceptionalHalt::StackOverflow,
|
|
113
113
|
EvmHaltReason::OutOfOffset => ExceptionalHalt::OutOfOffset,
|
|
114
114
|
EvmHaltReason::CreateCollision => ExceptionalHalt::CreateCollision,
|
|
115
|
-
EvmHaltReason::PrecompileError =>
|
|
115
|
+
EvmHaltReason::PrecompileError | EvmHaltReason::PrecompileErrorWithContext(_) => {
|
|
116
|
+
ExceptionalHalt::PrecompileError
|
|
117
|
+
}
|
|
116
118
|
EvmHaltReason::NonceOverflow => ExceptionalHalt::NonceOverflow,
|
|
117
119
|
EvmHaltReason::CreateContractSizeLimit => ExceptionalHalt::CreateContractSizeLimit,
|
|
118
120
|
EvmHaltReason::CreateContractStartingWithEF => {
|
|
@@ -157,7 +159,7 @@ impl From<&AfterMessage<EvmHaltReason>> for ExecutionResult {
|
|
|
157
159
|
} = value;
|
|
158
160
|
|
|
159
161
|
let result = match execution_result {
|
|
160
|
-
|
|
162
|
+
edr_evm_spec::result::ExecutionResult::Success {
|
|
161
163
|
reason,
|
|
162
164
|
gas_used,
|
|
163
165
|
gas_refunded,
|
|
@@ -172,12 +174,12 @@ impl From<&AfterMessage<EvmHaltReason>> for ExecutionResult {
|
|
|
172
174
|
gas_refunded: BigInt::from(*gas_refunded),
|
|
173
175
|
logs,
|
|
174
176
|
output: match output {
|
|
175
|
-
|
|
177
|
+
edr_evm_spec::result::Output::Call(return_value) => {
|
|
176
178
|
let return_value = Uint8Array::with_data_copied(return_value);
|
|
177
179
|
|
|
178
180
|
Either::A(CallOutput { return_value })
|
|
179
181
|
}
|
|
180
|
-
|
|
182
|
+
edr_evm_spec::result::Output::Create(return_value, address) => {
|
|
181
183
|
let return_value = Uint8Array::with_data_copied(return_value);
|
|
182
184
|
|
|
183
185
|
Either::B(CreateOutput {
|
|
@@ -188,7 +190,7 @@ impl From<&AfterMessage<EvmHaltReason>> for ExecutionResult {
|
|
|
188
190
|
},
|
|
189
191
|
})
|
|
190
192
|
}
|
|
191
|
-
|
|
193
|
+
edr_evm_spec::result::ExecutionResult::Revert { gas_used, output } => {
|
|
192
194
|
let output = Uint8Array::with_data_copied(output);
|
|
193
195
|
|
|
194
196
|
Either3::B(RevertResult {
|
|
@@ -196,10 +198,12 @@ impl From<&AfterMessage<EvmHaltReason>> for ExecutionResult {
|
|
|
196
198
|
output,
|
|
197
199
|
})
|
|
198
200
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
edr_evm_spec::result::ExecutionResult::Halt { reason, gas_used } => {
|
|
202
|
+
Either3::C(HaltResult {
|
|
203
|
+
reason: ExceptionalHalt::from(reason.clone()),
|
|
204
|
+
gas_used: BigInt::from(*gas_used),
|
|
205
|
+
})
|
|
206
|
+
}
|
|
203
207
|
};
|
|
204
208
|
|
|
205
209
|
let contract_address = contract_address.as_ref().map(Uint8Array::with_data_copied);
|
|
@@ -8,7 +8,7 @@ use edr_solidity_tests::{
|
|
|
8
8
|
inspectors::cheatcodes::{CheatsConfigOptions, ExecutionContextConfig},
|
|
9
9
|
TestFilterConfig,
|
|
10
10
|
};
|
|
11
|
-
use foundry_cheatcodes::{FsPermissions,
|
|
11
|
+
use foundry_cheatcodes::{FsPermissions, RpcEndpointUrl, RpcEndpoints};
|
|
12
12
|
use napi::{
|
|
13
13
|
bindgen_prelude::{BigInt, Uint8Array},
|
|
14
14
|
tokio::runtime,
|
|
@@ -36,8 +36,6 @@ pub struct SolidityTestRunnerConfigArgs {
|
|
|
36
36
|
pub project_root: String,
|
|
37
37
|
/// Configures the permissions of cheat codes that access the file system.
|
|
38
38
|
pub fs_permissions: Option<Vec<PathPermission>>,
|
|
39
|
-
/// Whether to support the `testFail` prefix. Defaults to false.
|
|
40
|
-
pub test_fail: Option<bool>,
|
|
41
39
|
/// Address labels for traces. Defaults to none.
|
|
42
40
|
pub labels: Option<Vec<AddressLabel>>,
|
|
43
41
|
/// Whether to enable isolation of calls. In isolation mode all top-level
|
|
@@ -173,7 +171,6 @@ impl SolidityTestRunnerConfigArgs {
|
|
|
173
171
|
let SolidityTestRunnerConfigArgs {
|
|
174
172
|
project_root,
|
|
175
173
|
fs_permissions,
|
|
176
|
-
test_fail,
|
|
177
174
|
labels,
|
|
178
175
|
isolate,
|
|
179
176
|
ffi,
|
|
@@ -246,7 +243,7 @@ impl SolidityTestRunnerConfigArgs {
|
|
|
246
243
|
RpcEndpoints::new(
|
|
247
244
|
endpoints
|
|
248
245
|
.into_iter()
|
|
249
|
-
.map(|(chain, url)| (chain,
|
|
246
|
+
.map(|(chain, url)| (chain, RpcEndpointUrl::new(url))),
|
|
250
247
|
)
|
|
251
248
|
})
|
|
252
249
|
.unwrap_or_default(),
|
|
@@ -267,6 +264,7 @@ impl SolidityTestRunnerConfigArgs {
|
|
|
267
264
|
.into_iter()
|
|
268
265
|
.map(|AddressLabel { address, label }| Ok((address.try_cast()?, label)))
|
|
269
266
|
.collect::<Result<_, napi::Error>>()?,
|
|
267
|
+
seed: fuzz.seed,
|
|
270
268
|
allow_internal_expect_revert: allow_internal_expect_revert.unwrap_or(false),
|
|
271
269
|
};
|
|
272
270
|
|
|
@@ -282,7 +280,6 @@ impl SolidityTestRunnerConfigArgs {
|
|
|
282
280
|
let config = edr_napi_core::solidity::config::TestRunnerConfig {
|
|
283
281
|
project_root: project_root.into(),
|
|
284
282
|
include_traces: include_traces.unwrap_or_default().into(),
|
|
285
|
-
test_fail: test_fail.unwrap_or_default(),
|
|
286
283
|
isolate,
|
|
287
284
|
ffi,
|
|
288
285
|
sender: sender.map(TryCast::try_cast).transpose()?,
|
|
@@ -370,7 +367,7 @@ impl TryFrom<FuzzConfigArgs> for FuzzConfig {
|
|
|
370
367
|
} = value;
|
|
371
368
|
|
|
372
369
|
let failure_persist_dir = failure_persist_dir.map(PathBuf::from);
|
|
373
|
-
let failure_persist_file = failure_persist_file.
|
|
370
|
+
let failure_persist_file = failure_persist_file.unwrap_or_else(|| "failures".to_string());
|
|
374
371
|
let seed = seed
|
|
375
372
|
.map(|s| {
|
|
376
373
|
s.parse().map_err(|_err| {
|
|
@@ -461,6 +458,10 @@ pub struct InvariantConfigArgs {
|
|
|
461
458
|
/// process is disabled if set to 0.
|
|
462
459
|
/// Defaults to 5000.
|
|
463
460
|
pub shrink_run_limit: Option<u32>,
|
|
461
|
+
/// The maximum number of rejects via `vm.assume` which can be encountered
|
|
462
|
+
/// during a single invariant run.
|
|
463
|
+
/// Defaults to 65536.
|
|
464
|
+
pub max_assume_rejects: Option<u32>,
|
|
464
465
|
}
|
|
465
466
|
|
|
466
467
|
impl InvariantConfigArgs {
|
|
@@ -514,6 +515,7 @@ impl From<InvariantConfigArgs> for InvariantConfig {
|
|
|
514
515
|
include_storage,
|
|
515
516
|
include_push_bytes,
|
|
516
517
|
shrink_run_limit,
|
|
518
|
+
max_assume_rejects,
|
|
517
519
|
} = value;
|
|
518
520
|
|
|
519
521
|
let failure_persist_dir = failure_persist_dir.map(PathBuf::from);
|
|
@@ -557,6 +559,10 @@ impl From<InvariantConfigArgs> for InvariantConfig {
|
|
|
557
559
|
invariant.shrink_run_limit = shrink_run_limit;
|
|
558
560
|
}
|
|
559
561
|
|
|
562
|
+
if let Some(max_assume_rejects) = max_assume_rejects {
|
|
563
|
+
invariant.max_assume_rejects = max_assume_rejects;
|
|
564
|
+
}
|
|
565
|
+
|
|
560
566
|
invariant
|
|
561
567
|
}
|
|
562
568
|
}
|
package/src/solidity_tests/l1.rs
CHANGED
|
@@ -7,8 +7,12 @@ use edr_napi_core::solidity::{
|
|
|
7
7
|
use edr_primitives::Bytes;
|
|
8
8
|
use edr_solidity::artifacts::ArtifactId;
|
|
9
9
|
use edr_solidity_tests::{
|
|
10
|
-
contracts::ContractsByArtifact,
|
|
11
|
-
|
|
10
|
+
contracts::ContractsByArtifact,
|
|
11
|
+
decode::RevertDecoder,
|
|
12
|
+
evm_context::L1EvmBuilder,
|
|
13
|
+
multi_runner::TestContract,
|
|
14
|
+
revm::context::{BlockEnv, TxEnv},
|
|
15
|
+
MultiContractRunner,
|
|
12
16
|
};
|
|
13
17
|
use napi::tokio;
|
|
14
18
|
use napi_derive::napi;
|
|
@@ -33,14 +37,14 @@ impl SyncTestRunnerFactory for L1TestRunnerFactory {
|
|
|
33
37
|
let runner = tokio::task::block_in_place(|| {
|
|
34
38
|
runtime
|
|
35
39
|
.block_on(MultiContractRunner::<
|
|
36
|
-
|
|
40
|
+
BlockEnv,
|
|
37
41
|
(),
|
|
38
42
|
L1EvmBuilder,
|
|
39
43
|
edr_chain_l1::HaltReason,
|
|
40
44
|
edr_chain_l1::Hardfork,
|
|
41
45
|
_,
|
|
42
46
|
edr_chain_l1::InvalidTransaction,
|
|
43
|
-
|
|
47
|
+
TxEnv,
|
|
44
48
|
>::new(
|
|
45
49
|
config.try_into()?,
|
|
46
50
|
contracts,
|
package/src/solidity_tests/op.rs
CHANGED
|
@@ -4,11 +4,14 @@ use edr_napi_core::solidity::{
|
|
|
4
4
|
config::{TestRunnerConfig, TracingConfigWithBuffers},
|
|
5
5
|
SyncTestRunner, SyncTestRunnerFactory,
|
|
6
6
|
};
|
|
7
|
-
use edr_op::solidity_tests::OpEvmBuilder;
|
|
7
|
+
use edr_op::{solidity_tests::OpEvmBuilder, transaction::OpTxEnv};
|
|
8
8
|
use edr_primitives::Bytes;
|
|
9
9
|
use edr_solidity::artifacts::ArtifactId;
|
|
10
10
|
use edr_solidity_tests::{
|
|
11
|
-
contracts::ContractsByArtifact,
|
|
11
|
+
contracts::ContractsByArtifact,
|
|
12
|
+
decode::RevertDecoder,
|
|
13
|
+
multi_runner::TestContract,
|
|
14
|
+
revm::context::{BlockEnv, TxEnv},
|
|
12
15
|
MultiContractRunner,
|
|
13
16
|
};
|
|
14
17
|
use napi::tokio;
|
|
@@ -34,14 +37,14 @@ impl SyncTestRunnerFactory for OpTestRunnerFactory {
|
|
|
34
37
|
let runner = tokio::task::block_in_place(|| {
|
|
35
38
|
runtime
|
|
36
39
|
.block_on(MultiContractRunner::<
|
|
37
|
-
|
|
40
|
+
BlockEnv,
|
|
38
41
|
_,
|
|
39
42
|
OpEvmBuilder,
|
|
40
43
|
edr_op::HaltReason,
|
|
41
44
|
edr_op::Hardfork,
|
|
42
45
|
_,
|
|
43
|
-
edr_op::
|
|
44
|
-
|
|
46
|
+
edr_op::InvalidTransaction,
|
|
47
|
+
OpTxEnv<TxEnv>,
|
|
45
48
|
>::new(
|
|
46
49
|
config.try_into()?,
|
|
47
50
|
contracts,
|
|
@@ -264,7 +264,7 @@ impl TestResult {
|
|
|
264
264
|
}),
|
|
265
265
|
decoded_logs: test_result.decoded_logs,
|
|
266
266
|
kind: match test_result.kind {
|
|
267
|
-
edr_solidity_tests::result::TestKind::
|
|
267
|
+
edr_solidity_tests::result::TestKind::Unit { gas: gas_consumed } => {
|
|
268
268
|
Either3::A(StandardTestKind {
|
|
269
269
|
consumed_gas: BigInt::from(gas_consumed),
|
|
270
270
|
})
|
|
@@ -283,11 +283,27 @@ impl TestResult {
|
|
|
283
283
|
runs,
|
|
284
284
|
calls,
|
|
285
285
|
reverts,
|
|
286
|
+
metrics,
|
|
287
|
+
failed_corpus_replays,
|
|
286
288
|
} => Either3::C(InvariantTestKind {
|
|
287
289
|
// usize as u64 is always safe
|
|
288
290
|
runs: BigInt::from(runs as u64),
|
|
289
291
|
calls: BigInt::from(calls as u64),
|
|
290
292
|
reverts: BigInt::from(reverts as u64),
|
|
293
|
+
metrics: metrics
|
|
294
|
+
.into_iter()
|
|
295
|
+
.map(|(name, metric)| {
|
|
296
|
+
(
|
|
297
|
+
name,
|
|
298
|
+
InvariantMetrics {
|
|
299
|
+
calls: BigInt::from(metric.calls as u64),
|
|
300
|
+
reverts: BigInt::from(metric.reverts as u64),
|
|
301
|
+
discards: BigInt::from(metric.discards as u64),
|
|
302
|
+
},
|
|
303
|
+
)
|
|
304
|
+
})
|
|
305
|
+
.collect(),
|
|
306
|
+
failed_corpus_replays: BigInt::from(failed_corpus_replays as u64),
|
|
291
307
|
}),
|
|
292
308
|
},
|
|
293
309
|
duration_ns: BigInt::from(test_result.duration.as_nanos()),
|
|
@@ -336,7 +352,7 @@ impl From<edr_solidity_tests::result::TestStatus> for TestStatus {
|
|
|
336
352
|
}
|
|
337
353
|
}
|
|
338
354
|
|
|
339
|
-
/// See [`edr_solidity_tests::result::TestKind::
|
|
355
|
+
/// See [`edr_solidity_tests::result::TestKind::Unit`]
|
|
340
356
|
#[napi(object)]
|
|
341
357
|
#[derive(Debug, Clone)]
|
|
342
358
|
pub struct StandardTestKind {
|
|
@@ -397,6 +413,27 @@ pub struct InvariantTestKind {
|
|
|
397
413
|
/// See [`edr_solidity_tests::result::TestKind::Invariant`]
|
|
398
414
|
#[napi(readonly)]
|
|
399
415
|
pub reverts: BigInt,
|
|
416
|
+
/// See [`edr_solidity_tests::result::TestKind::Invariant`]
|
|
417
|
+
#[napi(readonly)]
|
|
418
|
+
pub metrics: std::collections::HashMap<String, InvariantMetrics>,
|
|
419
|
+
/// See [`edr_solidity_tests::result::TestKind::Invariant`]
|
|
420
|
+
#[napi(readonly)]
|
|
421
|
+
pub failed_corpus_replays: BigInt,
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/// See [`edr_solidity_tests::result::InvariantMetrics`]
|
|
425
|
+
#[napi(object)]
|
|
426
|
+
#[derive(Debug, Clone)]
|
|
427
|
+
pub struct InvariantMetrics {
|
|
428
|
+
// Count of fuzzed selector calls.
|
|
429
|
+
#[napi(readonly)]
|
|
430
|
+
pub calls: BigInt,
|
|
431
|
+
// Count of fuzzed selector reverts.
|
|
432
|
+
#[napi(readonly)]
|
|
433
|
+
pub reverts: BigInt,
|
|
434
|
+
// Count of fuzzed selector discards (through assume cheatcodes).
|
|
435
|
+
#[napi(readonly)]
|
|
436
|
+
pub discards: BigInt,
|
|
400
437
|
}
|
|
401
438
|
|
|
402
439
|
/// Original sequence size and sequence of calls used as a counter example
|
|
@@ -543,10 +580,19 @@ impl CallTrace {
|
|
|
543
580
|
/// Instantiates a `CallTrace` with the details from a node and the supplied
|
|
544
581
|
/// children.
|
|
545
582
|
fn new(node: &traces::CallTraceNode, children: Vec<Either<CallTrace, LogTrace>>) -> Self {
|
|
546
|
-
let contract = node
|
|
583
|
+
let contract = node
|
|
584
|
+
.trace
|
|
585
|
+
.decoded
|
|
586
|
+
.as_ref()
|
|
587
|
+
.and_then(|decoded| decoded.label.clone());
|
|
547
588
|
let address = node.trace.address.to_checksum(None);
|
|
548
589
|
|
|
549
|
-
let inputs = match &node
|
|
590
|
+
let inputs = match &node
|
|
591
|
+
.trace
|
|
592
|
+
.decoded
|
|
593
|
+
.as_ref()
|
|
594
|
+
.and_then(|decoded| decoded.call_data.as_ref())
|
|
595
|
+
{
|
|
550
596
|
Some(traces::DecodedCallData { signature, args }) => {
|
|
551
597
|
let name = signature
|
|
552
598
|
.split('(')
|
|
@@ -559,7 +605,12 @@ impl CallTrace {
|
|
|
559
605
|
None => Either::B(node.trace.data.as_ref().into()),
|
|
560
606
|
};
|
|
561
607
|
|
|
562
|
-
let outputs = match
|
|
608
|
+
let outputs = match node
|
|
609
|
+
.trace
|
|
610
|
+
.decoded
|
|
611
|
+
.as_ref()
|
|
612
|
+
.and_then(|decoded| decoded.return_data.as_ref())
|
|
613
|
+
{
|
|
563
614
|
Some(outputs) => Either::A(outputs.clone()),
|
|
564
615
|
None => {
|
|
565
616
|
if node.kind().is_any_create() && node.trace.success {
|
|
@@ -676,7 +727,10 @@ impl CallTrace {
|
|
|
676
727
|
|
|
677
728
|
impl From<&traces::CallLog> for LogTrace {
|
|
678
729
|
fn from(log: &traces::CallLog) -> Self {
|
|
679
|
-
let decoded_log = log
|
|
730
|
+
let decoded_log = log
|
|
731
|
+
.decoded
|
|
732
|
+
.as_ref()
|
|
733
|
+
.and_then(|decoded| decoded.name.clone().zip(decoded.params.as_ref()));
|
|
680
734
|
|
|
681
735
|
let parameters = decoded_log.map_or_else(
|
|
682
736
|
|| {
|
package/src/trace/exit.rs
CHANGED
package/src/trace.rs
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
use std::sync::Arc;
|
|
9
9
|
|
|
10
|
-
use
|
|
11
|
-
use edr_evm_spec::EvmHaltReason;
|
|
10
|
+
use edr_chain_spec::EvmHaltReason;
|
|
12
11
|
use edr_primitives::bytecode::opcode::OpCode;
|
|
12
|
+
use edr_runtime::trace::BeforeMessage;
|
|
13
13
|
use napi::bindgen_prelude::{BigInt, Either3, Uint8Array};
|
|
14
14
|
use napi_derive::napi;
|
|
15
15
|
|
|
@@ -123,7 +123,7 @@ pub struct TracingStep {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
impl TracingStep {
|
|
126
|
-
pub fn new(step: &
|
|
126
|
+
pub fn new(step: &edr_runtime::trace::Step) -> Self {
|
|
127
127
|
let stack = step.stack.full().map_or_else(
|
|
128
128
|
|| {
|
|
129
129
|
step.stack
|
|
@@ -162,11 +162,11 @@ pub struct TracingMessageResult {
|
|
|
162
162
|
#[napi]
|
|
163
163
|
#[derive(Clone)]
|
|
164
164
|
pub struct RawTrace {
|
|
165
|
-
inner: Arc<
|
|
165
|
+
inner: Arc<edr_runtime::trace::Trace<EvmHaltReason>>,
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
impl From<Arc<
|
|
169
|
-
fn from(value: Arc<
|
|
168
|
+
impl From<Arc<edr_runtime::trace::Trace<EvmHaltReason>>> for RawTrace {
|
|
169
|
+
fn from(value: Arc<edr_runtime::trace::Trace<EvmHaltReason>>) -> Self {
|
|
170
170
|
Self { inner: value }
|
|
171
171
|
}
|
|
172
172
|
}
|
|
@@ -179,13 +179,15 @@ impl RawTrace {
|
|
|
179
179
|
.messages
|
|
180
180
|
.iter()
|
|
181
181
|
.map(|message| match message {
|
|
182
|
-
|
|
182
|
+
edr_runtime::trace::TraceMessage::Before(message) => {
|
|
183
183
|
Either3::A(TracingMessage::from(message))
|
|
184
184
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
edr_runtime::trace::TraceMessage::Step(step) => Either3::B(TracingStep::new(step)),
|
|
186
|
+
edr_runtime::trace::TraceMessage::After(message) => {
|
|
187
|
+
Either3::C(TracingMessageResult {
|
|
188
|
+
execution_result: ExecutionResult::from(message),
|
|
189
|
+
})
|
|
190
|
+
}
|
|
189
191
|
})
|
|
190
192
|
.collect()
|
|
191
193
|
}
|