@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/src/result.rs CHANGED
@@ -19,17 +19,17 @@ pub enum SuccessReason {
19
19
  SelfDestruct,
20
20
  }
21
21
 
22
- impl From<edr_eth::result::SuccessReason> for SuccessReason {
23
- fn from(eval: edr_eth::result::SuccessReason) -> Self {
22
+ impl From<edr_evm::result::SuccessReason> for SuccessReason {
23
+ fn from(eval: edr_evm::result::SuccessReason) -> Self {
24
24
  match eval {
25
- edr_eth::result::SuccessReason::Stop => Self::Stop,
26
- edr_eth::result::SuccessReason::Return => Self::Return,
27
- edr_eth::result::SuccessReason::SelfDestruct => Self::SelfDestruct,
25
+ edr_evm::result::SuccessReason::Stop => Self::Stop,
26
+ edr_evm::result::SuccessReason::Return => Self::Return,
27
+ edr_evm::result::SuccessReason::SelfDestruct => Self::SelfDestruct,
28
28
  }
29
29
  }
30
30
  }
31
31
 
32
- impl From<SuccessReason> for edr_eth::result::SuccessReason {
32
+ impl From<SuccessReason> for edr_evm::result::SuccessReason {
33
33
  fn from(value: SuccessReason) -> Self {
34
34
  match value {
35
35
  SuccessReason::Stop => Self::Stop,
@@ -157,7 +157,7 @@ impl From<&AfterMessage<EvmHaltReason>> for ExecutionResult {
157
157
  } = value;
158
158
 
159
159
  let result = match execution_result {
160
- edr_eth::result::ExecutionResult::Success {
160
+ edr_evm::result::ExecutionResult::Success {
161
161
  reason,
162
162
  gas_used,
163
163
  gas_refunded,
@@ -172,12 +172,12 @@ impl From<&AfterMessage<EvmHaltReason>> for ExecutionResult {
172
172
  gas_refunded: BigInt::from(*gas_refunded),
173
173
  logs,
174
174
  output: match output {
175
- edr_eth::result::Output::Call(return_value) => {
175
+ edr_evm::result::Output::Call(return_value) => {
176
176
  let return_value = Uint8Array::with_data_copied(return_value);
177
177
 
178
178
  Either::A(CallOutput { return_value })
179
179
  }
180
- edr_eth::result::Output::Create(return_value, address) => {
180
+ edr_evm::result::Output::Create(return_value, address) => {
181
181
  let return_value = Uint8Array::with_data_copied(return_value);
182
182
 
183
183
  Either::B(CreateOutput {
@@ -188,7 +188,7 @@ impl From<&AfterMessage<EvmHaltReason>> for ExecutionResult {
188
188
  },
189
189
  })
190
190
  }
191
- edr_eth::result::ExecutionResult::Revert { gas_used, output } => {
191
+ edr_evm::result::ExecutionResult::Revert { gas_used, output } => {
192
192
  let output = Uint8Array::with_data_copied(output);
193
193
 
194
194
  Either3::B(RevertResult {
@@ -196,7 +196,7 @@ impl From<&AfterMessage<EvmHaltReason>> for ExecutionResult {
196
196
  output,
197
197
  })
198
198
  }
199
- edr_eth::result::ExecutionResult::Halt { reason, gas_used } => Either3::C(HaltResult {
199
+ edr_evm::result::ExecutionResult::Halt { reason, gas_used } => Either3::C(HaltResult {
200
200
  reason: ExceptionalHalt::from(*reason),
201
201
  gas_used: BigInt::from(*gas_used),
202
202
  }),
package/src/serde.rs CHANGED
@@ -1,4 +1,4 @@
1
- use edr_eth::hex;
1
+ use edr_primitives::hex;
2
2
  use napi::bindgen_prelude::{BigInt, Uint8Array};
3
3
  use serde::Serializer;
4
4
 
@@ -1,7 +1,7 @@
1
1
  use std::{collections::HashMap, path::PathBuf};
2
2
 
3
3
  use derive_more::Debug;
4
- use edr_eth::hex;
4
+ use edr_primitives::hex;
5
5
  use edr_solidity_tests::{
6
6
  executors::invariant::InvariantConfig,
7
7
  fuzz::FuzzConfig,
@@ -109,7 +109,7 @@ pub struct SolidityTestRunnerConfigArgs {
109
109
  /// Defaults to false.
110
110
  pub disable_block_gas_limit: Option<bool>,
111
111
  /// The memory limit of the EVM in bytes.
112
- /// Defaults to 33_554_432 (2^25 = 32MiB).
112
+ /// Defaults to `33_554_432` (2^25 = 32MiB).
113
113
  #[serde(serialize_with = "serialize_optional_bigint_as_struct")]
114
114
  pub memory_limit: Option<BigInt>,
115
115
  /// The predeploys applied in local mode. Defaults to no predeploys.
@@ -143,6 +143,8 @@ pub struct SolidityTestRunnerConfigArgs {
143
143
  /// If an invariant config setting is not set, but a corresponding fuzz
144
144
  /// config value is set, then the fuzz config value will be used.
145
145
  pub invariant: Option<InvariantConfigArgs>,
146
+ /// Whether to collect stack traces.
147
+ pub collect_stack_traces: Option<CollectStackTraces>,
146
148
  /// Controls which test results should include execution traces. Defaults to
147
149
  /// None.
148
150
  pub include_traces: Option<IncludeTraces>,
@@ -153,6 +155,11 @@ pub struct SolidityTestRunnerConfigArgs {
153
155
  /// A regex pattern to filter tests. If provided, only test methods that
154
156
  /// match the pattern will be executed and reported as a test result.
155
157
  pub test_pattern: Option<String>,
158
+ /// Controls whether to generate a gas report after running the tests.
159
+ /// Enabling this also enables collection of all traces and EVM isolation
160
+ /// mode.
161
+ /// Defaults to false.
162
+ pub generate_gas_report: Option<bool>,
156
163
  }
157
164
 
158
165
  impl SolidityTestRunnerConfigArgs {
@@ -194,9 +201,11 @@ impl SolidityTestRunnerConfigArgs {
194
201
  prompt_timeout,
195
202
  fuzz,
196
203
  invariant,
204
+ collect_stack_traces,
197
205
  include_traces,
198
206
  observability,
199
207
  test_pattern,
208
+ generate_gas_report,
200
209
  } = self;
201
210
 
202
211
  let test_pattern = TestFilterConfig {
@@ -296,8 +305,13 @@ impl SolidityTestRunnerConfigArgs {
296
305
  cheatcode,
297
306
  fuzz,
298
307
  invariant,
308
+ collect_stack_traces: collect_stack_traces.map_or(
309
+ edr_solidity_tests::CollectStackTraces::OnFailure,
310
+ edr_solidity_tests::CollectStackTraces::from,
311
+ ),
299
312
  on_collected_coverage_fn,
300
313
  test_pattern,
314
+ generate_gas_report,
301
315
  };
302
316
 
303
317
  Ok(config)
@@ -721,6 +735,29 @@ pub struct AddressLabel {
721
735
  pub label: String,
722
736
  }
723
737
 
738
+ /// A type that controls when stack traces are collected.
739
+ #[napi]
740
+ #[derive(Debug, serde::Serialize)]
741
+ pub enum CollectStackTraces {
742
+ /// Always collects stack traces, adding performance overhead.
743
+ Always,
744
+ /// Only collects stack traces upon failure, re-executing the test. This
745
+ /// minimizes performance overhead.
746
+ ///
747
+ /// Not all tests can be re-executed since certain cheatcodes contain
748
+ /// non-deterministic side-effects.
749
+ OnFailure,
750
+ }
751
+
752
+ impl From<CollectStackTraces> for edr_solidity_tests::CollectStackTraces {
753
+ fn from(value: CollectStackTraces) -> Self {
754
+ match value {
755
+ CollectStackTraces::Always => edr_solidity_tests::CollectStackTraces::Always,
756
+ CollectStackTraces::OnFailure => edr_solidity_tests::CollectStackTraces::OnFailure,
757
+ }
758
+ }
759
+ }
760
+
724
761
  /// Configuration for [`SolidityTestRunnerConfigArgs::include_traces`] that
725
762
  /// controls execution trace decoding and inclusion in test results.
726
763
  #[napi]
@@ -1,10 +1,10 @@
1
1
  use std::{collections::BTreeMap, sync::Arc};
2
2
 
3
- use edr_eth::Bytes;
4
3
  use edr_napi_core::solidity::{
5
4
  config::{TestRunnerConfig, TracingConfigWithBuffers},
6
5
  SyncTestRunner, SyncTestRunnerFactory,
7
6
  };
7
+ use edr_primitives::Bytes;
8
8
  use edr_solidity::artifacts::ArtifactId;
9
9
  use edr_solidity_tests::{
10
10
  contracts::ContractsByArtifact, decode::RevertDecoder, evm_context::L1EvmBuilder,
@@ -1,11 +1,11 @@
1
1
  use std::{collections::BTreeMap, sync::Arc};
2
2
 
3
- use edr_eth::Bytes;
4
3
  use edr_napi_core::solidity::{
5
4
  config::{TestRunnerConfig, TracingConfigWithBuffers},
6
5
  SyncTestRunner, SyncTestRunnerFactory,
7
6
  };
8
7
  use edr_op::solidity_tests::OpEvmBuilder;
8
+ use edr_primitives::Bytes;
9
9
  use edr_solidity::artifacts::ArtifactId;
10
10
  use edr_solidity_tests::{
11
11
  contracts::ContractsByArtifact, decode::RevertDecoder, multi_runner::TestContract,
@@ -18,6 +18,7 @@ use napi_derive::napi;
18
18
 
19
19
  use crate::{
20
20
  cast::TryCast,
21
+ gas_report::GasReport,
21
22
  solidity_tests::{artifact::ArtifactId, config::IncludeTraces},
22
23
  trace::{solidity_stack_trace::SolidityStackTraceEntry, u256_to_bigint},
23
24
  };
@@ -42,7 +43,7 @@ pub struct ValueSnapshotEntry {
42
43
  pub value: String,
43
44
  }
44
45
 
45
- /// See [edr_solidity_tests::result::SuiteResult]
46
+ /// See [`edr_solidity_tests::result::SuiteResult`]
46
47
  #[napi]
47
48
  #[derive(Clone, Debug)]
48
49
  pub struct SuiteResult {
@@ -50,13 +51,13 @@ pub struct SuiteResult {
50
51
  /// callback
51
52
  #[napi(readonly)]
52
53
  pub id: ArtifactId,
53
- /// See [edr_solidity_tests::result::SuiteResult::duration]
54
+ /// See [`edr_solidity_tests::result::SuiteResult::duration`]
54
55
  #[napi(readonly)]
55
56
  pub duration_ns: BigInt,
56
- /// See [edr_solidity_tests::result::SuiteResult::test_results]
57
+ /// See [`edr_solidity_tests::result::SuiteResult::test_results`]
57
58
  #[napi(readonly)]
58
59
  pub test_results: Vec<TestResult>,
59
- /// See [edr_solidity_tests::result::SuiteResult::warnings]
60
+ /// See [`edr_solidity_tests::result::SuiteResult::warnings`]
60
61
  #[napi(readonly)]
61
62
  pub warnings: Vec<String>,
62
63
  }
@@ -80,29 +81,29 @@ impl SuiteResult {
80
81
  }
81
82
  }
82
83
 
83
- /// See [edr_solidity_tests::result::TestResult]
84
+ /// See [`edr_solidity_tests::result::TestResult`]
84
85
  #[napi]
85
86
  #[derive(Clone, Debug)]
86
87
  pub struct TestResult {
87
88
  /// The name of the test.
88
89
  #[napi(readonly)]
89
90
  pub name: String,
90
- /// See [edr_solidity_tests::result::TestResult::status]
91
+ /// See [`edr_solidity_tests::result::TestResult::status`]
91
92
  #[napi(readonly)]
92
93
  pub status: TestStatus,
93
- /// See [edr_solidity_tests::result::TestResult::reason]
94
+ /// See [`edr_solidity_tests::result::TestResult::reason`]
94
95
  #[napi(readonly)]
95
96
  pub reason: Option<String>,
96
- /// See [edr_solidity_tests::result::TestResult::counterexample]
97
+ /// See [`edr_solidity_tests::result::TestResult::counterexample`]
97
98
  #[napi(readonly)]
98
99
  pub counterexample: Option<Either<BaseCounterExample, CounterExampleSequence>>,
99
- /// See [edr_solidity_tests::result::TestResult::decoded_logs]
100
+ /// See [`edr_solidity_tests::result::TestResult::decoded_logs`]
100
101
  #[napi(readonly)]
101
102
  pub decoded_logs: Vec<String>,
102
- /// See [edr_solidity_tests::result::TestResult::kind]
103
+ /// See [`edr_solidity_tests::result::TestResult::kind`]
103
104
  #[napi(readonly)]
104
105
  pub kind: Either3<StandardTestKind, FuzzTestKind, InvariantTestKind>,
105
- /// See [edr_solidity_tests::result::TestResult::duration]
106
+ /// See [`edr_solidity_tests::result::TestResult::duration`]
106
107
  #[napi(readonly)]
107
108
  pub duration_ns: BigInt,
108
109
  /// Groups of value snapshot entries (incl. gas).
@@ -335,7 +336,7 @@ impl From<edr_solidity_tests::result::TestStatus> for TestStatus {
335
336
  }
336
337
  }
337
338
 
338
- /// See [edr_solidity_tests::result::TestKind::Standard]
339
+ /// See [`edr_solidity_tests::result::TestKind::Standard`]
339
340
  #[napi(object)]
340
341
  #[derive(Debug, Clone)]
341
342
  pub struct StandardTestKind {
@@ -344,22 +345,22 @@ pub struct StandardTestKind {
344
345
  pub consumed_gas: BigInt,
345
346
  }
346
347
 
347
- /// See [edr_solidity_tests::result::TestKind::Fuzz]
348
+ /// See [`edr_solidity_tests::result::TestKind::Fuzz`]
348
349
  #[napi(object)]
349
350
  #[derive(Debug, Clone)]
350
351
  pub struct FuzzTestKind {
351
- /// See [edr_solidity_tests::result::TestKind::Fuzz]
352
+ /// See [`edr_solidity_tests::result::TestKind::Fuzz`]
352
353
  #[napi(readonly)]
353
354
  pub runs: BigInt,
354
- /// See [edr_solidity_tests::result::TestKind::Fuzz]
355
+ /// See [`edr_solidity_tests::result::TestKind::Fuzz`]
355
356
  #[napi(readonly)]
356
357
  pub mean_gas: BigInt,
357
- /// See [edr_solidity_tests::result::TestKind::Fuzz]
358
+ /// See [`edr_solidity_tests::result::TestKind::Fuzz`]
358
359
  #[napi(readonly)]
359
360
  pub median_gas: BigInt,
360
361
  }
361
362
 
362
- /// See [edr_solidity_tests::fuzz::FuzzCase]
363
+ /// See [`edr_solidity_tests::fuzz::FuzzCase`]
363
364
  #[napi(object)]
364
365
  #[derive(Clone)]
365
366
  pub struct FuzzCase {
@@ -383,17 +384,17 @@ impl Debug for FuzzCase {
383
384
  }
384
385
  }
385
386
 
386
- /// See [edr_solidity_tests::result::TestKind::Invariant]
387
+ /// See [`edr_solidity_tests::result::TestKind::Invariant`]
387
388
  #[napi(object)]
388
389
  #[derive(Debug, Clone)]
389
390
  pub struct InvariantTestKind {
390
- /// See [edr_solidity_tests::result::TestKind::Invariant]
391
+ /// See [`edr_solidity_tests::result::TestKind::Invariant`]
391
392
  #[napi(readonly)]
392
393
  pub runs: BigInt,
393
- /// See [edr_solidity_tests::result::TestKind::Invariant]
394
+ /// See [`edr_solidity_tests::result::TestKind::Invariant`]
394
395
  #[napi(readonly)]
395
396
  pub calls: BigInt,
396
- /// See [edr_solidity_tests::result::TestKind::Invariant]
397
+ /// See [`edr_solidity_tests::result::TestKind::Invariant`]
397
398
  #[napi(readonly)]
398
399
  pub reverts: BigInt,
399
400
  }
@@ -409,26 +410,26 @@ pub struct CounterExampleSequence {
409
410
  pub sequence: Vec<BaseCounterExample>,
410
411
  }
411
412
 
412
- /// See [edr_solidity_tests::fuzz::BaseCounterExample]
413
+ /// See [`edr_solidity_tests::fuzz::BaseCounterExample`]
413
414
  #[napi(object)]
414
415
  #[derive(Clone)]
415
416
  pub struct BaseCounterExample {
416
- /// See [edr_solidity_tests::fuzz::BaseCounterExample::sender]
417
+ /// See [`edr_solidity_tests::fuzz::BaseCounterExample::sender`]
417
418
  #[napi(readonly)]
418
419
  pub sender: Option<Uint8Array>,
419
- /// See [edr_solidity_tests::fuzz::BaseCounterExample::addr]
420
+ /// See [`edr_solidity_tests::fuzz::BaseCounterExample::addr`]
420
421
  #[napi(readonly)]
421
422
  pub address: Option<Uint8Array>,
422
- /// See [edr_solidity_tests::fuzz::BaseCounterExample::calldata]
423
+ /// See [`edr_solidity_tests::fuzz::BaseCounterExample::calldata`]
423
424
  #[napi(readonly)]
424
425
  pub calldata: Uint8Array,
425
- /// See [edr_solidity_tests::fuzz::BaseCounterExample::contract_name]
426
+ /// See [`edr_solidity_tests::fuzz::BaseCounterExample::contract_name`]
426
427
  #[napi(readonly)]
427
428
  pub contract_name: Option<String>,
428
- /// See [edr_solidity_tests::fuzz::BaseCounterExample::signature]
429
+ /// See [`edr_solidity_tests::fuzz::BaseCounterExample::signature`]
429
430
  #[napi(readonly)]
430
431
  pub signature: Option<String>,
431
- /// See [edr_solidity_tests::fuzz::BaseCounterExample::args]
432
+ /// See [`edr_solidity_tests::fuzz::BaseCounterExample::args`]
432
433
  #[napi(readonly)]
433
434
  pub args: Option<String>,
434
435
  }
@@ -604,7 +605,10 @@ impl CallTrace {
604
605
  loop {
605
606
  // We will break out of the loop before the stack goes empty.
606
607
  let mut item = stack.pop().unwrap();
607
- let node = &arena.nodes()[item.arena_index];
608
+ let node = arena
609
+ .nodes()
610
+ .get(item.arena_index)
611
+ .expect("Arena index should be valid");
608
612
 
609
613
  if item.visited {
610
614
  let mut logs = node
@@ -618,11 +622,20 @@ impl CallTrace {
618
622
  .iter()
619
623
  .filter_map(|ord| match *ord {
620
624
  traces::TraceMemberOrder::Log(i) => {
621
- let log = logs[i].take().unwrap();
625
+ let log = logs
626
+ .get_mut(i)
627
+ .expect("Log index should be valid")
628
+ .take()
629
+ .unwrap();
622
630
  Some(Either::B(log))
623
631
  }
624
632
  traces::TraceMemberOrder::Call(i) => {
625
- let child_trace = item.child_traces[i].take().unwrap();
633
+ let child_trace = item
634
+ .child_traces
635
+ .get_mut(i)
636
+ .expect("Child trace index should be valid")
637
+ .take()
638
+ .unwrap();
626
639
  Some(Either::A(child_trace))
627
640
  }
628
641
  traces::TraceMemberOrder::Step(_) => None,
@@ -632,7 +645,9 @@ impl CallTrace {
632
645
  let trace = CallTrace::new(node, children);
633
646
 
634
647
  if let Some(parent_stack_index) = item.parent_stack_index {
635
- let parent = &mut stack[parent_stack_index];
648
+ let parent = stack
649
+ .get_mut(parent_stack_index)
650
+ .expect("Parent stack index should be valid");
636
651
  parent.child_traces.push(Some(trace));
637
652
  } else {
638
653
  return trace;
@@ -703,3 +718,19 @@ impl From<traces::CallKind> for CallKind {
703
718
  }
704
719
  }
705
720
  }
721
+
722
+ /// The result of a Solidity test run.
723
+ #[napi(object)]
724
+ pub struct SolidityTestResult {
725
+ /// Gas report, if it was generated.
726
+ #[napi(readonly)]
727
+ pub gas_report: Option<GasReport>,
728
+ }
729
+
730
+ impl From<edr_solidity_tests::multi_runner::SolidityTestResult> for SolidityTestResult {
731
+ fn from(value: edr_solidity_tests::multi_runner::SolidityTestResult) -> Self {
732
+ Self {
733
+ gas_report: value.gas_report.map(GasReport::from),
734
+ }
735
+ }
736
+ }
@@ -9,7 +9,7 @@ pub mod test_results;
9
9
 
10
10
  use std::path::Path;
11
11
 
12
- use edr_eth::Bytes;
12
+ use edr_primitives::Bytes;
13
13
  use edr_solidity::linker::{LinkOutput, Linker};
14
14
  use edr_solidity_tests::{constants::LIBRARY_DEPLOYER, contracts::ContractsByArtifact};
15
15
  use foundry_compilers::artifacts::Libraries;
@@ -46,7 +46,9 @@ fn print_stack_trace(trace: SolidityStackTrace) -> napi::Result<()> {
46
46
  })?;
47
47
 
48
48
  let mut value = serde_json::to_value(entry)?;
49
- value["message"] = decoded_error_msg.into();
49
+ if let Some(obj) = value.as_object_mut() {
50
+ obj.insert("message".to_string(), decoded_error_msg.into());
51
+ }
50
52
  Ok(value)
51
53
  }
52
54
  })
@@ -22,11 +22,9 @@ pub struct ReturnData {
22
22
  impl ReturnData {
23
23
  #[napi(catch_unwind, constructor)]
24
24
  pub fn new(value: Uint8Array) -> Self {
25
- let selector = if value.len() >= 4 {
26
- Some(value[0..4].try_into().unwrap())
27
- } else {
28
- None
29
- };
25
+ let selector = value
26
+ .get(0..4)
27
+ .map(|selector| selector.try_into().expect("selector is 4 bytes"));
30
28
 
31
29
  Self { value, selector }
32
30
  }
@@ -3,7 +3,7 @@
3
3
 
4
4
  use std::convert::Infallible;
5
5
 
6
- use edr_eth::{hex, U256};
6
+ use edr_primitives::{hex, U256};
7
7
  use napi::bindgen_prelude::{BigInt, Either25, FromNapiValue, ToNapiValue, Uint8Array, Undefined};
8
8
  use napi_derive::napi;
9
9
  use serde::{Serialize, Serializer};
@@ -848,7 +848,8 @@ const _: () = {
848
848
  assert_to_from_napi_value::<SolidityStackTraceEntry>();
849
849
  };
850
850
 
851
- /// Serializes a [`BigInt`] that represents an EVM value as a [`edr_eth::U256`].
851
+ /// Serializes a [`BigInt`] that represents an EVM value as a
852
+ /// [`edr_primitives::U256`].
852
853
  fn serialize_evm_value_bigint_using_u256<S>(bigint: &BigInt, s: S) -> Result<S::Ok, S::Error>
853
854
  where
854
855
  S: Serializer,
package/src/trace.rs CHANGED
@@ -7,9 +7,9 @@
7
7
 
8
8
  use std::sync::Arc;
9
9
 
10
- use edr_eth::bytecode::opcode::OpCode;
11
10
  use edr_evm::trace::BeforeMessage;
12
11
  use edr_evm_spec::EvmHaltReason;
12
+ use edr_primitives::bytecode::opcode::OpCode;
13
13
  use napi::bindgen_prelude::{BigInt, Either3, Uint8Array};
14
14
  use napi_derive::napi;
15
15
 
@@ -145,7 +145,7 @@ impl TracingStep {
145
145
  }
146
146
  }
147
147
 
148
- pub(crate) fn u256_to_bigint(v: &edr_eth::U256) -> BigInt {
148
+ pub(crate) fn u256_to_bigint(v: &edr_primitives::U256) -> BigInt {
149
149
  BigInt {
150
150
  sign_bit: false,
151
151
  words: v.into_limbs().to_vec(),
package/src/withdrawal.rs CHANGED
@@ -1,4 +1,4 @@
1
- use edr_eth::Address;
1
+ use edr_primitives::Address;
2
2
  use napi::bindgen_prelude::{BigInt, Uint8Array};
3
3
  use napi_derive::napi;
4
4
 
@@ -16,21 +16,21 @@ pub struct Withdrawal {
16
16
  pub amount: BigInt,
17
17
  }
18
18
 
19
- impl From<edr_eth::withdrawal::Withdrawal> for Withdrawal {
20
- fn from(withdrawal: edr_eth::withdrawal::Withdrawal) -> Self {
19
+ impl From<edr_block_header::Withdrawal> for Withdrawal {
20
+ fn from(withdrawal: edr_block_header::Withdrawal) -> Self {
21
21
  Self {
22
22
  index: BigInt::from(withdrawal.index),
23
23
  validator_index: BigInt::from(withdrawal.validator_index),
24
24
  address: Uint8Array::with_data_copied(withdrawal.address),
25
25
  amount: BigInt {
26
26
  sign_bit: false,
27
- words: withdrawal.amount.as_limbs().to_vec(),
27
+ words: vec![withdrawal.amount],
28
28
  },
29
29
  }
30
30
  }
31
31
  }
32
32
 
33
- impl TryFrom<Withdrawal> for edr_eth::withdrawal::Withdrawal {
33
+ impl TryFrom<Withdrawal> for edr_block_header::Withdrawal {
34
34
  type Error = napi::Error;
35
35
 
36
36
  fn try_from(value: Withdrawal) -> Result<Self, Self::Error> {