Skip to content

Commit 59cbde0

Browse files
committed
fmt
1 parent ff91596 commit 59cbde0

File tree

11 files changed

+111
-109
lines changed

11 files changed

+111
-109
lines changed

src/access_list.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ where
7373
.insert(B256::from(slot.to_be_bytes()));
7474
}
7575
}
76-
opcode::EXTCODECOPY |
77-
opcode::EXTCODEHASH |
78-
opcode::EXTCODESIZE |
79-
opcode::BALANCE |
80-
opcode::SELFDESTRUCT => {
76+
opcode::EXTCODECOPY
77+
| opcode::EXTCODEHASH
78+
| opcode::EXTCODESIZE
79+
| opcode::BALANCE
80+
| opcode::SELFDESTRUCT => {
8181
if let Ok(slot) = interpreter.stack().peek(0) {
8282
let addr = Address::from_word(B256::from(slot.to_be_bytes()));
8383
if !self.excluded.contains(&addr) {

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
//!
33
//! ## Feature Flags
44
//!
5-
//! - `js-tracer`: Enables a JavaScript tracer implementation. This pulls in extra
6-
//! dependencies (such as `boa`, `tokio` and `serde_json`).
5+
//! - `js-tracer`: Enables a JavaScript tracer implementation. This pulls in extra dependencies
6+
//! (such as `boa`, `tokio` and `serde_json`).
77
88
#![doc(
99
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",

src/stack/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ where
140140

141141
// Allow inspectors to exit early
142142
if status != InstructionResult::Continue {
143-
return (status, gas, retdata)
143+
return (status, gas, retdata);
144144
}
145145
});
146146

@@ -162,7 +162,7 @@ where
162162
// If the inspector returns a different ret or a revert with a non-empty message,
163163
// we assume it wants to tell us something
164164
if new_ret != ret || (new_ret == InstructionResult::Revert && new_out != out) {
165-
return (new_ret, new_gas, new_out)
165+
return (new_ret, new_gas, new_out);
166166
}
167167
});
168168

@@ -179,7 +179,7 @@ where
179179

180180
// Allow inspectors to exit early
181181
if status != InstructionResult::Continue {
182-
return (status, addr, gas, retdata)
182+
return (status, addr, gas, retdata);
183183
}
184184
});
185185

@@ -200,7 +200,7 @@ where
200200
inspector.create_end(data, inputs, ret, address, remaining_gas, out.clone());
201201

202202
if new_ret != ret {
203-
return (new_ret, new_address, new_gas, new_retdata)
203+
return (new_ret, new_address, new_gas, new_retdata);
204204
}
205205
});
206206

src/tracing/arena.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl CallTraceArena {
2626
// The entry node, just update it
2727
0 => {
2828
self.arena[0].trace = new_trace;
29-
return 0
29+
return 0;
3030
}
3131
// We found the parent node, add the new trace as a child
3232
_ if self.arena[entry].trace.depth == new_trace.depth - 1 => {
@@ -47,7 +47,7 @@ impl CallTraceArena {
4747
parent.children.push(id);
4848
}
4949

50-
return id
50+
return id;
5151
}
5252
_ => {
5353
// We haven't found the parent node, go deeper

src/tracing/builder/geth.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl GethTraceBuilder {
8989
opts: GethDefaultTracingOptions,
9090
) -> DefaultFrame {
9191
if self.nodes.is_empty() {
92-
return Default::default()
92+
return Default::default();
9393
}
9494
// Fetch top-level trace
9595
let main_trace_node = &self.nodes[0];
@@ -116,7 +116,7 @@ impl GethTraceBuilder {
116116
/// [ExecutionResult](revm::primitives::ExecutionResult) of the executed transaction.
117117
pub fn geth_call_traces(&self, opts: CallConfig, gas_used: u64) -> CallFrame {
118118
if self.nodes.is_empty() {
119-
return Default::default()
119+
return Default::default();
120120
}
121121

122122
let include_logs = opts.with_log.unwrap_or_default();
@@ -132,7 +132,7 @@ impl GethTraceBuilder {
132132
}
133133

134134
if opts.only_top_call.unwrap_or_default() {
135-
return root_call_frame
135+
return root_call_frame;
136136
}
137137

138138
// fill all the call frames in the root call frame with the recorded traces.
@@ -164,7 +164,7 @@ impl GethTraceBuilder {
164164
parent_frame.1.calls.insert(0, call);
165165
} else {
166166
debug_assert!(call_frames.is_empty(), "only one root node has no parent");
167-
return call
167+
return call;
168168
}
169169
}
170170
}
@@ -306,7 +306,7 @@ impl GethTraceBuilder {
306306
post.retain(|addr, post_state| {
307307
// Don't keep destroyed accounts in the post state
308308
if change_type.get(addr).map(|ty| ty.1.is_selfdestruct()).unwrap_or(false) {
309-
return false
309+
return false;
310310
}
311311
if let Some(pre_state) = pre.get(addr) {
312312
// remove any unchanged account info

src/tracing/builder/parity.rs

Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ impl ParityTraceBuilder {
9393
fn trace_address(&self, idx: usize) -> Vec<usize> {
9494
if idx == 0 {
9595
// root call has empty traceAddress
96-
return vec![]
96+
return vec![];
9797
}
9898
let mut graph = vec![];
9999
let mut node = &self.nodes[idx];
100100
if node.is_precompile() {
101-
return graph
101+
return graph;
102102
}
103103
while let Some(parent) = node.parent {
104104
// the index of the child call in the arena
@@ -226,7 +226,7 @@ impl ParityTraceBuilder {
226226
trace_types: &HashSet<TraceType>,
227227
) -> (Option<Vec<TransactionTrace>>, Option<VmTrace>, Option<StateDiff>) {
228228
if trace_types.is_empty() || self.nodes.is_empty() {
229-
return (None, None, None)
229+
return (None, None, None);
230230
}
231231

232232
let with_traces = trace_types.contains(&TraceType::Trace);
@@ -342,7 +342,7 @@ impl ParityTraceBuilder {
342342
{
343343
// This is a special case where there's a single STOP which is
344344
// "optimised away", transfers for example
345-
break 'outer instructions
345+
break 'outer instructions;
346346
}
347347

348348
instructions.push(self.make_instruction(step, maybe_sub_call));
@@ -428,7 +428,7 @@ where
428428

429429
fn next(&mut self) -> Option<Self::Item> {
430430
if let Some(selfdestruct) = self.next_selfdestruct.take() {
431-
return Some(selfdestruct)
431+
return Some(selfdestruct);
432432
}
433433
let (mut trace, node) = self.iter.next()?;
434434
if node.is_selfdestruct() {
@@ -498,7 +498,7 @@ where
498498
for (addr, changed_acc) in account_diffs.into_iter() {
499499
// if the account was selfdestructed and created during the transaction, we can ignore it
500500
if changed_acc.is_selfdestructed() && changed_acc.is_created() {
501-
continue
501+
continue;
502502
}
503503

504504
let addr = *addr;
@@ -534,13 +534,13 @@ where
534534
}
535535

536536
// check if the account was changed at all
537-
if entry.storage.is_empty() &&
538-
db_acc == changed_acc.info &&
539-
!changed_acc.is_selfdestructed()
537+
if entry.storage.is_empty()
538+
&& db_acc == changed_acc.info
539+
&& !changed_acc.is_selfdestructed()
540540
{
541541
// clear the entry if the account was not changed
542542
state_diff.remove(&addr);
543-
continue
543+
continue;
544544
}
545545

546546
entry.balance = if db_acc.balance == changed_acc.info.balance {
@@ -576,58 +576,58 @@ pub(crate) fn stack_push_count(step_op: OpCode) -> usize {
576576
opcode::PUSH0..=opcode::PUSH32 => 1,
577577
opcode::SWAP1..=opcode::SWAP16 => (step_op - opcode::SWAP1) as usize + 2,
578578
opcode::DUP1..=opcode::DUP16 => (step_op - opcode::DUP1) as usize + 2,
579-
opcode::CALLDATALOAD |
580-
opcode::SLOAD |
581-
opcode::MLOAD |
582-
opcode::CALLDATASIZE |
583-
opcode::LT |
584-
opcode::GT |
585-
opcode::DIV |
586-
opcode::SDIV |
587-
opcode::SAR |
588-
opcode::AND |
589-
opcode::EQ |
590-
opcode::CALLVALUE |
591-
opcode::ISZERO |
592-
opcode::ADD |
593-
opcode::EXP |
594-
opcode::CALLER |
595-
opcode::KECCAK256 |
596-
opcode::SUB |
597-
opcode::ADDRESS |
598-
opcode::GAS |
599-
opcode::MUL |
600-
opcode::RETURNDATASIZE |
601-
opcode::NOT |
602-
opcode::SHR |
603-
opcode::SHL |
604-
opcode::EXTCODESIZE |
605-
opcode::SLT |
606-
opcode::OR |
607-
opcode::NUMBER |
608-
opcode::PC |
609-
opcode::TIMESTAMP |
610-
opcode::BALANCE |
611-
opcode::SELFBALANCE |
612-
opcode::MULMOD |
613-
opcode::ADDMOD |
614-
opcode::BASEFEE |
615-
opcode::BLOCKHASH |
616-
opcode::BYTE |
617-
opcode::XOR |
618-
opcode::ORIGIN |
619-
opcode::CODESIZE |
620-
opcode::MOD |
621-
opcode::SIGNEXTEND |
622-
opcode::GASLIMIT |
623-
opcode::DIFFICULTY |
624-
opcode::SGT |
625-
opcode::GASPRICE |
626-
opcode::MSIZE |
627-
opcode::EXTCODEHASH |
628-
opcode::SMOD |
629-
opcode::CHAINID |
630-
opcode::COINBASE => 1,
579+
opcode::CALLDATALOAD
580+
| opcode::SLOAD
581+
| opcode::MLOAD
582+
| opcode::CALLDATASIZE
583+
| opcode::LT
584+
| opcode::GT
585+
| opcode::DIV
586+
| opcode::SDIV
587+
| opcode::SAR
588+
| opcode::AND
589+
| opcode::EQ
590+
| opcode::CALLVALUE
591+
| opcode::ISZERO
592+
| opcode::ADD
593+
| opcode::EXP
594+
| opcode::CALLER
595+
| opcode::KECCAK256
596+
| opcode::SUB
597+
| opcode::ADDRESS
598+
| opcode::GAS
599+
| opcode::MUL
600+
| opcode::RETURNDATASIZE
601+
| opcode::NOT
602+
| opcode::SHR
603+
| opcode::SHL
604+
| opcode::EXTCODESIZE
605+
| opcode::SLT
606+
| opcode::OR
607+
| opcode::NUMBER
608+
| opcode::PC
609+
| opcode::TIMESTAMP
610+
| opcode::BALANCE
611+
| opcode::SELFBALANCE
612+
| opcode::MULMOD
613+
| opcode::ADDMOD
614+
| opcode::BASEFEE
615+
| opcode::BLOCKHASH
616+
| opcode::BYTE
617+
| opcode::XOR
618+
| opcode::ORIGIN
619+
| opcode::CODESIZE
620+
| opcode::MOD
621+
| opcode::SIGNEXTEND
622+
| opcode::GASLIMIT
623+
| opcode::DIFFICULTY
624+
| opcode::SGT
625+
| opcode::GASPRICE
626+
| opcode::MSIZE
627+
| opcode::EXTCODEHASH
628+
| opcode::SMOD
629+
| opcode::CHAINID
630+
| opcode::COINBASE => 1,
631631
_ => 0,
632632
}
633633
}

src/tracing/js/bindings.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl MemoryRef {
234234
format!(
235235
"tracer accessed out of bound memory: offset {start}, end {end}"
236236
),
237-
)))
237+
)));
238238
}
239239
let start = start as usize;
240240
let end = end as usize;
@@ -418,7 +418,7 @@ impl StackRef {
418418
format!(
419419
"tracer accessed out of bound stack: size {len}, index {idx_f64}"
420420
),
421-
)))
421+
)));
422422
}
423423
stack.peek(idx, ctx)
424424
},
@@ -705,14 +705,14 @@ impl EvmDbRef {
705705
let buf = from_buf(address, ctx)?;
706706
let address = bytes_to_address(buf);
707707
if let acc @ Some(_) = self.state.get_account(&address) {
708-
return Ok(acc)
708+
return Ok(acc);
709709
}
710710
let (tx, rx) = channel();
711711
if self.to_db.try_send(JsDbRequest::Basic { address, resp: tx }).is_err() {
712712
return Err(JsError::from_native(
713713
JsNativeError::error()
714714
.with_message(format!("Failed to read address {address:?} from database",)),
715-
))
715+
));
716716
}
717717

718718
match rx.recv() {
@@ -728,15 +728,15 @@ impl EvmDbRef {
728728
let acc = self.read_basic(address, ctx)?;
729729
let code_hash = acc.map(|acc| acc.code_hash).unwrap_or(KECCAK_EMPTY);
730730
if code_hash == KECCAK_EMPTY {
731-
return JsArrayBuffer::new(0, ctx)
731+
return JsArrayBuffer::new(0, ctx);
732732
}
733733

734734
let (tx, rx) = channel();
735735
if self.to_db.try_send(JsDbRequest::Code { code_hash, resp: tx }).is_err() {
736736
return Err(JsError::from_native(
737737
JsNativeError::error()
738738
.with_message(format!("Failed to read code hash {code_hash:?} from database",)),
739-
))
739+
));
740740
}
741741

742742
let code = match rx.recv() {
@@ -771,7 +771,7 @@ impl EvmDbRef {
771771
{
772772
return Err(JsError::from_native(JsNativeError::error().with_message(format!(
773773
"Failed to read state for {address:?} at {slot:?} from database",
774-
))))
774+
))));
775775
}
776776

777777
let value = match rx.recv() {

0 commit comments

Comments
 (0)