@nomicfoundation/edr 0.4.0 → 0.4.2
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/Cargo.toml +4 -0
- package/package.json +8 -8
- package/src/logger.rs +26 -21
- package/src/provider.rs +1 -1
- package/src/result.rs +20 -3
- package/src/subscribe.rs +2 -2
package/Cargo.toml
CHANGED
|
@@ -20,6 +20,7 @@ edr_defaults = { version = "0.3.5", path = "../edr_defaults" }
|
|
|
20
20
|
edr_evm = { version = "0.3.5", path = "../edr_evm", features = ["tracing"]}
|
|
21
21
|
edr_eth = { version = "0.3.5", path = "../edr_eth" }
|
|
22
22
|
edr_provider = { version = "0.3.5", path = "../edr_provider" }
|
|
23
|
+
edr_rpc_eth = { version = "0.3.5", path = "../edr_rpc_eth" }
|
|
23
24
|
serde_json = { version = "1.0.85", default-features = false, features = ["alloc"] }
|
|
24
25
|
thiserror = { version = "1.0.37", default-features = false }
|
|
25
26
|
tracing = { version = "0.1.37", default-features = false, features = ["std"] }
|
|
@@ -52,3 +53,6 @@ scenarios = ["rand"]
|
|
|
52
53
|
|
|
53
54
|
[profile.release]
|
|
54
55
|
lto = true
|
|
56
|
+
|
|
57
|
+
[lints]
|
|
58
|
+
workspace = true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nomicfoundation/edr",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
"node": ">= 18"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@nomicfoundation/edr-darwin-arm64": "0.4.
|
|
50
|
-
"@nomicfoundation/edr-darwin-x64": "0.4.
|
|
51
|
-
"@nomicfoundation/edr-linux-arm64-gnu": "0.4.
|
|
52
|
-
"@nomicfoundation/edr-linux-arm64-musl": "0.4.
|
|
53
|
-
"@nomicfoundation/edr-linux-x64-gnu": "0.4.
|
|
54
|
-
"@nomicfoundation/edr-linux-x64-musl": "0.4.
|
|
55
|
-
"@nomicfoundation/edr-win32-x64-msvc": "0.4.
|
|
49
|
+
"@nomicfoundation/edr-darwin-arm64": "0.4.2",
|
|
50
|
+
"@nomicfoundation/edr-darwin-x64": "0.4.2",
|
|
51
|
+
"@nomicfoundation/edr-linux-arm64-gnu": "0.4.2",
|
|
52
|
+
"@nomicfoundation/edr-linux-arm64-musl": "0.4.2",
|
|
53
|
+
"@nomicfoundation/edr-linux-x64-gnu": "0.4.2",
|
|
54
|
+
"@nomicfoundation/edr-linux-x64-musl": "0.4.2",
|
|
55
|
+
"@nomicfoundation/edr-win32-x64-msvc": "0.4.2"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"artifacts": "napi artifacts",
|
package/src/logger.rs
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
use std::{fmt::Display, sync::mpsc::channel};
|
|
2
2
|
|
|
3
3
|
use ansi_term::{Color, Style};
|
|
4
|
-
use edr_eth::{
|
|
4
|
+
use edr_eth::{
|
|
5
|
+
transaction::{self, Transaction},
|
|
6
|
+
Bytes, B256, U256,
|
|
7
|
+
};
|
|
5
8
|
use edr_evm::{
|
|
6
9
|
blockchain::BlockchainError,
|
|
10
|
+
chain_spec::L1ChainSpec,
|
|
7
11
|
precompile::{self, Precompiles},
|
|
8
12
|
trace::{AfterMessage, TraceMessage},
|
|
9
|
-
|
|
13
|
+
transaction::SignedTransaction as _,
|
|
14
|
+
ExecutionResult, SyncBlock,
|
|
10
15
|
};
|
|
11
16
|
use edr_provider::{ProviderError, TransactionFailure};
|
|
12
17
|
use itertools::izip;
|
|
@@ -135,7 +140,7 @@ impl edr_provider::Logger for Logger {
|
|
|
135
140
|
fn log_call(
|
|
136
141
|
&mut self,
|
|
137
142
|
spec_id: edr_eth::SpecId,
|
|
138
|
-
transaction: &
|
|
143
|
+
transaction: &transaction::Signed,
|
|
139
144
|
result: &edr_provider::CallResult,
|
|
140
145
|
) -> Result<(), Self::LoggerError> {
|
|
141
146
|
self.collector.log_call(spec_id, transaction, result);
|
|
@@ -146,7 +151,7 @@ impl edr_provider::Logger for Logger {
|
|
|
146
151
|
fn log_estimate_gas_failure(
|
|
147
152
|
&mut self,
|
|
148
153
|
spec_id: edr_eth::SpecId,
|
|
149
|
-
transaction: &
|
|
154
|
+
transaction: &transaction::Signed,
|
|
150
155
|
failure: &edr_provider::EstimateGasFailure,
|
|
151
156
|
) -> Result<(), Self::LoggerError> {
|
|
152
157
|
self.collector
|
|
@@ -176,7 +181,7 @@ impl edr_provider::Logger for Logger {
|
|
|
176
181
|
fn log_send_transaction(
|
|
177
182
|
&mut self,
|
|
178
183
|
spec_id: edr_eth::SpecId,
|
|
179
|
-
transaction: &edr_evm::
|
|
184
|
+
transaction: &edr_evm::transaction::Signed,
|
|
180
185
|
mining_results: &[edr_provider::DebugMineBlockResult<Self::BlockchainError>],
|
|
181
186
|
) -> Result<(), Self::LoggerError> {
|
|
182
187
|
self.collector
|
|
@@ -335,7 +340,7 @@ impl LogCollector {
|
|
|
335
340
|
pub fn log_call(
|
|
336
341
|
&mut self,
|
|
337
342
|
spec_id: edr_eth::SpecId,
|
|
338
|
-
transaction: &
|
|
343
|
+
transaction: &transaction::Signed,
|
|
339
344
|
result: &edr_provider::CallResult,
|
|
340
345
|
) {
|
|
341
346
|
let edr_provider::CallResult {
|
|
@@ -350,7 +355,7 @@ impl LogCollector {
|
|
|
350
355
|
logger.log_contract_and_function_name::<true>(spec_id, trace);
|
|
351
356
|
|
|
352
357
|
logger.log_with_title("From", format!("0x{:x}", transaction.caller()));
|
|
353
|
-
if let Some(to) = transaction.to() {
|
|
358
|
+
if let Some(to) = transaction.kind().to() {
|
|
354
359
|
logger.log_with_title("To", format!("0x{to:x}"));
|
|
355
360
|
}
|
|
356
361
|
if transaction.value() > U256::ZERO {
|
|
@@ -370,7 +375,7 @@ impl LogCollector {
|
|
|
370
375
|
pub fn log_estimate_gas(
|
|
371
376
|
&mut self,
|
|
372
377
|
spec_id: edr_eth::SpecId,
|
|
373
|
-
transaction: &
|
|
378
|
+
transaction: &transaction::Signed,
|
|
374
379
|
result: &edr_provider::EstimateGasFailure,
|
|
375
380
|
) {
|
|
376
381
|
let edr_provider::EstimateGasFailure {
|
|
@@ -387,7 +392,7 @@ impl LogCollector {
|
|
|
387
392
|
);
|
|
388
393
|
|
|
389
394
|
logger.log_with_title("From", format!("0x{:x}", transaction.caller()));
|
|
390
|
-
if let Some(to) = transaction.to() {
|
|
395
|
+
if let Some(to) = transaction.kind().to() {
|
|
391
396
|
logger.log_with_title("To", format!("0x{to:x}"));
|
|
392
397
|
}
|
|
393
398
|
logger.log_with_title("Value", wei_to_human_readable(transaction.value()));
|
|
@@ -491,7 +496,7 @@ impl LogCollector {
|
|
|
491
496
|
pub fn log_send_transaction(
|
|
492
497
|
&mut self,
|
|
493
498
|
spec_id: edr_eth::SpecId,
|
|
494
|
-
transaction: &edr_evm::
|
|
499
|
+
transaction: &edr_evm::transaction::Signed,
|
|
495
500
|
mining_results: &[edr_provider::DebugMineBlockResult<BlockchainError>],
|
|
496
501
|
) {
|
|
497
502
|
if !mining_results.is_empty() {
|
|
@@ -685,20 +690,20 @@ impl LogCollector {
|
|
|
685
690
|
self.log_empty_line();
|
|
686
691
|
}
|
|
687
692
|
|
|
688
|
-
fn log_block_hash(&mut self, block: &dyn SyncBlock<Error = BlockchainError>) {
|
|
693
|
+
fn log_block_hash(&mut self, block: &dyn SyncBlock<L1ChainSpec, Error = BlockchainError>) {
|
|
689
694
|
let block_hash = block.hash();
|
|
690
695
|
|
|
691
696
|
self.log(format!("Block: {block_hash}"));
|
|
692
697
|
}
|
|
693
698
|
|
|
694
|
-
fn log_block_id(&mut self, block: &dyn SyncBlock<Error = BlockchainError>) {
|
|
699
|
+
fn log_block_id(&mut self, block: &dyn SyncBlock<L1ChainSpec, Error = BlockchainError>) {
|
|
695
700
|
let block_number = block.header().number;
|
|
696
701
|
let block_hash = block.hash();
|
|
697
702
|
|
|
698
703
|
self.log(format!("Block #{block_number}: {block_hash}"));
|
|
699
704
|
}
|
|
700
705
|
|
|
701
|
-
fn log_block_number(&mut self, block: &dyn SyncBlock<Error = BlockchainError>) {
|
|
706
|
+
fn log_block_number(&mut self, block: &dyn SyncBlock<L1ChainSpec, Error = BlockchainError>) {
|
|
702
707
|
let block_number = block.header().number;
|
|
703
708
|
|
|
704
709
|
self.log(format!("Mined block #{block_number}"));
|
|
@@ -708,7 +713,7 @@ impl LogCollector {
|
|
|
708
713
|
fn log_block_transaction(
|
|
709
714
|
&mut self,
|
|
710
715
|
spec_id: edr_eth::SpecId,
|
|
711
|
-
transaction: &edr_evm::
|
|
716
|
+
transaction: &edr_evm::transaction::Signed,
|
|
712
717
|
result: &edr_evm::ExecutionResult,
|
|
713
718
|
trace: &edr_evm::trace::Trace,
|
|
714
719
|
console_log_inputs: &[Bytes],
|
|
@@ -727,7 +732,7 @@ impl LogCollector {
|
|
|
727
732
|
self.indented(|logger| {
|
|
728
733
|
logger.log_contract_and_function_name::<false>(spec_id, trace);
|
|
729
734
|
logger.log_with_title("From", format!("0x{:x}", transaction.caller()));
|
|
730
|
-
if let Some(to) = transaction.to() {
|
|
735
|
+
if let Some(to) = transaction.kind().to() {
|
|
731
736
|
logger.log_with_title("To", format!("0x{to:x}"));
|
|
732
737
|
}
|
|
733
738
|
logger.log_with_title("Value", wei_to_human_readable(transaction.value()));
|
|
@@ -881,7 +886,7 @@ impl LogCollector {
|
|
|
881
886
|
}
|
|
882
887
|
}
|
|
883
888
|
|
|
884
|
-
fn log_empty_block(&mut self, block: &dyn SyncBlock<Error = BlockchainError>) {
|
|
889
|
+
fn log_empty_block(&mut self, block: &dyn SyncBlock<L1ChainSpec, Error = BlockchainError>) {
|
|
885
890
|
let block_header = block.header();
|
|
886
891
|
let block_number = block_header.number;
|
|
887
892
|
|
|
@@ -906,7 +911,7 @@ impl LogCollector {
|
|
|
906
911
|
|
|
907
912
|
fn log_hardhat_mined_empty_block(
|
|
908
913
|
&mut self,
|
|
909
|
-
block: &dyn SyncBlock<Error = BlockchainError>,
|
|
914
|
+
block: &dyn SyncBlock<L1ChainSpec, Error = BlockchainError>,
|
|
910
915
|
empty_blocks_range_start: Option<u64>,
|
|
911
916
|
) {
|
|
912
917
|
self.indented(|logger| {
|
|
@@ -1054,7 +1059,7 @@ impl LogCollector {
|
|
|
1054
1059
|
&mut self,
|
|
1055
1060
|
spec_id: edr_eth::SpecId,
|
|
1056
1061
|
block_result: &edr_provider::DebugMineBlockResult<BlockchainError>,
|
|
1057
|
-
transaction: &
|
|
1062
|
+
transaction: &transaction::Signed,
|
|
1058
1063
|
transaction_result: &edr_evm::ExecutionResult,
|
|
1059
1064
|
trace: &edr_evm::trace::Trace,
|
|
1060
1065
|
) {
|
|
@@ -1076,7 +1081,7 @@ impl LogCollector {
|
|
|
1076
1081
|
&mut self,
|
|
1077
1082
|
spec_id: edr_eth::SpecId,
|
|
1078
1083
|
result: &edr_provider::DebugMineBlockResult<BlockchainError>,
|
|
1079
|
-
transaction: &
|
|
1084
|
+
transaction: &transaction::Signed,
|
|
1080
1085
|
) {
|
|
1081
1086
|
let trace = result
|
|
1082
1087
|
.transaction_traces
|
|
@@ -1095,7 +1100,7 @@ impl LogCollector {
|
|
|
1095
1100
|
&mut self,
|
|
1096
1101
|
spec_id: edr_eth::SpecId,
|
|
1097
1102
|
block_result: &edr_provider::DebugMineBlockResult<BlockchainError>,
|
|
1098
|
-
transaction: &
|
|
1103
|
+
transaction: &transaction::Signed,
|
|
1099
1104
|
transaction_result: &edr_evm::ExecutionResult,
|
|
1100
1105
|
trace: &edr_evm::trace::Trace,
|
|
1101
1106
|
) {
|
|
@@ -1106,7 +1111,7 @@ impl LogCollector {
|
|
|
1106
1111
|
logger.log_with_title("Transaction", transaction_hash);
|
|
1107
1112
|
|
|
1108
1113
|
logger.log_with_title("From", format!("0x{:x}", transaction.caller()));
|
|
1109
|
-
if let Some(to) = transaction.to() {
|
|
1114
|
+
if let Some(to) = transaction.kind().to() {
|
|
1110
1115
|
logger.log_with_title("To", format!("0x{to:x}"));
|
|
1111
1116
|
}
|
|
1112
1117
|
logger.log_with_title("Value", wei_to_human_readable(transaction.value()));
|
package/src/provider.rs
CHANGED
package/src/result.rs
CHANGED
|
@@ -16,6 +16,7 @@ pub enum SuccessReason {
|
|
|
16
16
|
Return,
|
|
17
17
|
/// The opcode `SELFDESTRUCT` was called
|
|
18
18
|
SelfDestruct,
|
|
19
|
+
EofReturnContract,
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
impl From<edr_evm::SuccessReason> for SuccessReason {
|
|
@@ -24,6 +25,7 @@ impl From<edr_evm::SuccessReason> for SuccessReason {
|
|
|
24
25
|
edr_evm::SuccessReason::Stop => Self::Stop,
|
|
25
26
|
edr_evm::SuccessReason::Return => Self::Return,
|
|
26
27
|
edr_evm::SuccessReason::SelfDestruct => Self::SelfDestruct,
|
|
28
|
+
edr_evm::SuccessReason::EofReturnContract => Self::EofReturnContract,
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
}
|
|
@@ -34,6 +36,7 @@ impl From<SuccessReason> for edr_evm::SuccessReason {
|
|
|
34
36
|
SuccessReason::Stop => Self::Stop,
|
|
35
37
|
SuccessReason::Return => Self::Return,
|
|
36
38
|
SuccessReason::SelfDestruct => Self::SelfDestruct,
|
|
39
|
+
SuccessReason::EofReturnContract => Self::EofReturnContract,
|
|
37
40
|
}
|
|
38
41
|
}
|
|
39
42
|
}
|
|
@@ -82,7 +85,7 @@ pub struct RevertResult {
|
|
|
82
85
|
pub enum ExceptionalHalt {
|
|
83
86
|
OutOfGas,
|
|
84
87
|
OpcodeNotFound,
|
|
85
|
-
|
|
88
|
+
InvalidEFOpcode,
|
|
86
89
|
InvalidJump,
|
|
87
90
|
NotActivated,
|
|
88
91
|
StackUnderflow,
|
|
@@ -97,6 +100,12 @@ pub enum ExceptionalHalt {
|
|
|
97
100
|
CreateContractStartingWithEF,
|
|
98
101
|
/// EIP-3860: Limit and meter initcode. Initcode size limit exceeded.
|
|
99
102
|
CreateInitCodeSizeLimit,
|
|
103
|
+
/// Aux data overflow, new aux data is larger tha u16 max size.
|
|
104
|
+
EofAuxDataOverflow,
|
|
105
|
+
/// Aud data is smaller then already present data size.
|
|
106
|
+
EofAuxDataTooSmall,
|
|
107
|
+
/// EOF Subroutine stack overflow
|
|
108
|
+
EOFFunctionStackOverflow,
|
|
100
109
|
}
|
|
101
110
|
|
|
102
111
|
impl From<edr_evm::HaltReason> for ExceptionalHalt {
|
|
@@ -104,7 +113,7 @@ impl From<edr_evm::HaltReason> for ExceptionalHalt {
|
|
|
104
113
|
match halt {
|
|
105
114
|
edr_evm::HaltReason::OutOfGas(..) => ExceptionalHalt::OutOfGas,
|
|
106
115
|
edr_evm::HaltReason::OpcodeNotFound => ExceptionalHalt::OpcodeNotFound,
|
|
107
|
-
edr_evm::HaltReason::
|
|
116
|
+
edr_evm::HaltReason::InvalidEFOpcode => ExceptionalHalt::InvalidEFOpcode,
|
|
108
117
|
edr_evm::HaltReason::InvalidJump => ExceptionalHalt::InvalidJump,
|
|
109
118
|
edr_evm::HaltReason::NotActivated => ExceptionalHalt::NotActivated,
|
|
110
119
|
edr_evm::HaltReason::StackUnderflow => ExceptionalHalt::StackUnderflow,
|
|
@@ -122,6 +131,11 @@ impl From<edr_evm::HaltReason> for ExceptionalHalt {
|
|
|
122
131
|
edr_evm::HaltReason::CreateInitCodeSizeLimit => {
|
|
123
132
|
ExceptionalHalt::CreateInitCodeSizeLimit
|
|
124
133
|
}
|
|
134
|
+
edr_evm::HaltReason::EofAuxDataOverflow => ExceptionalHalt::EofAuxDataOverflow,
|
|
135
|
+
edr_evm::HaltReason::EofAuxDataTooSmall => ExceptionalHalt::EofAuxDataTooSmall,
|
|
136
|
+
edr_evm::HaltReason::EOFFunctionStackOverflow => {
|
|
137
|
+
ExceptionalHalt::EOFFunctionStackOverflow
|
|
138
|
+
}
|
|
125
139
|
edr_evm::HaltReason::OverflowPayment
|
|
126
140
|
| edr_evm::HaltReason::StateChangeDuringStaticCall
|
|
127
141
|
| edr_evm::HaltReason::CallNotAllowedInsideStatic
|
|
@@ -138,7 +152,7 @@ impl From<ExceptionalHalt> for edr_evm::HaltReason {
|
|
|
138
152
|
match value {
|
|
139
153
|
ExceptionalHalt::OutOfGas => Self::OutOfGas(edr_evm::OutOfGasError::Basic),
|
|
140
154
|
ExceptionalHalt::OpcodeNotFound => Self::OpcodeNotFound,
|
|
141
|
-
ExceptionalHalt::
|
|
155
|
+
ExceptionalHalt::InvalidEFOpcode => Self::InvalidEFOpcode,
|
|
142
156
|
ExceptionalHalt::InvalidJump => Self::InvalidJump,
|
|
143
157
|
ExceptionalHalt::NotActivated => Self::NotActivated,
|
|
144
158
|
ExceptionalHalt::StackUnderflow => Self::StackUnderflow,
|
|
@@ -150,6 +164,9 @@ impl From<ExceptionalHalt> for edr_evm::HaltReason {
|
|
|
150
164
|
ExceptionalHalt::CreateContractSizeLimit => Self::CreateContractSizeLimit,
|
|
151
165
|
ExceptionalHalt::CreateContractStartingWithEF => Self::CreateContractStartingWithEF,
|
|
152
166
|
ExceptionalHalt::CreateInitCodeSizeLimit => Self::CreateInitCodeSizeLimit,
|
|
167
|
+
ExceptionalHalt::EofAuxDataOverflow => Self::EofAuxDataOverflow,
|
|
168
|
+
ExceptionalHalt::EofAuxDataTooSmall => Self::EofAuxDataTooSmall,
|
|
169
|
+
ExceptionalHalt::EOFFunctionStackOverflow => Self::EOFFunctionStackOverflow,
|
|
153
170
|
}
|
|
154
171
|
}
|
|
155
172
|
}
|
package/src/subscribe.rs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
use edr_eth::
|
|
1
|
+
use edr_eth::B256;
|
|
2
2
|
use napi::{
|
|
3
3
|
bindgen_prelude::BigInt,
|
|
4
4
|
threadsafe_function::{
|
|
@@ -28,7 +28,7 @@ impl SubscriberCallback {
|
|
|
28
28
|
let result = match ctx.value.result {
|
|
29
29
|
edr_provider::SubscriptionEventData::Logs(logs) => ctx.env.to_js_value(&logs),
|
|
30
30
|
edr_provider::SubscriptionEventData::NewHeads(block) => {
|
|
31
|
-
let block =
|
|
31
|
+
let block = edr_rpc_eth::Block::<B256>::from(block);
|
|
32
32
|
ctx.env.to_js_value(&block)
|
|
33
33
|
}
|
|
34
34
|
edr_provider::SubscriptionEventData::NewPendingTransactions(tx_hash) => {
|