Skip to content

Commit

Permalink
chore: sort derives (#35)
Browse files Browse the repository at this point in the history
NFC
  • Loading branch information
DaniPopes authored Feb 15, 2024
1 parent e8d4595 commit 44942b3
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/access_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::collections::{BTreeSet, HashMap, HashSet};
/// An [Inspector] that collects touched accounts and storage slots.
///
/// This can be used to construct an [AccessList] for a transaction via `eth_createAccessList`
#[derive(Default, Debug)]
#[derive(Debug, Default)]
pub struct AccessListInspector {
/// All addresses that should be excluded from the final accesslist
excluded: HashSet<Address>,
Expand Down
2 changes: 1 addition & 1 deletion src/opcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use revm::{
use std::collections::HashMap;

/// An Inspector that counts opcodes and measures gas usage per opcode.
#[derive(Default, Debug, Clone)]
#[derive(Clone, Debug, Default)]
pub struct OpcodeCounterInspector {
/// Map of opcode counts per transaction.
pub opcode_counts: HashMap<OpCode, u64>,
Expand Down
6 changes: 3 additions & 3 deletions src/stack/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub use maybe_owned::MaybeOwnedInspector;
/// - Block: Hook on block execution
/// - BlockWithIndex: Hook on block execution transaction index
/// - Transaction: Hook on a specific transaction hash
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum Hook {
#[default]
/// No hook.
Expand All @@ -33,7 +33,7 @@ pub enum Hook {
/// If a call to an inspector returns a value other than
/// [revm::interpreter::InstructionResult::Continue] (or equivalent) the remaining inspectors are
/// not called.
#[derive(Default, Clone)]
#[derive(Clone, Default)]
pub struct InspectorStack {
/// An inspector that prints the opcode traces to the console.
pub custom_print_tracer: Option<CustomPrintTracer>,
Expand Down Expand Up @@ -74,7 +74,7 @@ impl InspectorStack {
}

/// Configuration for the inspectors.
#[derive(Debug, Default, Clone, Copy)]
#[derive(Clone, Copy, Debug, Default)]
pub struct InspectorStackConfig {
/// Enable revm inspector printer.
/// In execution this will print opcode level traces directly to console.
Expand Down
2 changes: 1 addition & 1 deletion src/tracing/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::tracing::types::{CallTrace, CallTraceNode, LogCallOrder};
/// An arena of recorded traces.
///
/// This type will be populated via the [TracingInspector](crate::tracing::TracingInspector).
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CallTraceArena {
/// The arena of recorded trace nodes
pub(crate) arena: Vec<CallTraceNode>,
Expand Down
6 changes: 3 additions & 3 deletions src/tracing/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::collections::HashSet;
///
/// Use [TracingInspectorConfig::default_parity] or [TracingInspectorConfig::default_geth] to get
/// the default configs for specific styles of traces.
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct TracingInspectorConfig {
/// Whether to record every individual opcode level step.
pub record_steps: bool,
Expand Down Expand Up @@ -152,7 +152,7 @@ impl TracingInspectorConfig {
}

/// How much of the stack to record. Nothing, just the items pushed, or the full stack
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum StackSnapshotType {
/// Don't record stack snapshots
None,
Expand All @@ -179,7 +179,7 @@ impl StackSnapshotType {
/// What kind of tracing style this is.
///
/// This affects things like error messages.
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) enum TraceStyle {
/// Parity style tracer
Parity,
Expand Down
2 changes: 1 addition & 1 deletion src/tracing/fourbyte.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use revm::{
use std::{collections::HashMap, ops::Range};

/// Fourbyte tracing inspector that records all function selectors and their calldata sizes.
#[derive(Debug, Clone, Default)]
#[derive(Clone, Debug, Default)]
pub struct FourByteInspector {
/// The map of SELECTOR to number of occurrences entries
inner: HashMap<(Selector, usize), u64>,
Expand Down
10 changes: 5 additions & 5 deletions src/tracing/js/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ macro_rules! js_value_capture_getter {
///
/// This type supports garbage collection of (rust) references and prevents access to the value if
/// it has been dropped.
#[derive(Debug, Clone)]
#[derive(Clone, Debug)]
struct GuardedNullableGc<Val: 'static> {
/// The lifetime is a lie to make it possible to use a reference in boa which requires 'static
inner: Rc<RefCell<Option<Guarded<'static, Val>>>>,
Expand Down Expand Up @@ -217,7 +217,7 @@ impl StepLog {
}

/// Represents the memory object
#[derive(Debug, Clone)]
#[derive(Clone, Debug)]
pub(crate) struct MemoryRef(GuardedNullableGc<SharedMemory>);

impl MemoryRef {
Expand Down Expand Up @@ -309,7 +309,7 @@ unsafe impl Trace for MemoryRef {
}

/// Represents the state object
#[derive(Debug, Clone)]
#[derive(Clone, Debug)]
pub(crate) struct StateRef(GuardedNullableGc<State>);

impl StateRef {
Expand All @@ -331,7 +331,7 @@ unsafe impl Trace for StateRef {
}

/// Represents the database
#[derive(Debug, Clone)]
#[derive(Clone, Debug)]
pub(crate) struct GcDb<DB: 'static>(GuardedNullableGc<DB>);

impl<DB> GcDb<DB>
Expand Down Expand Up @@ -484,7 +484,7 @@ unsafe impl Trace for StackRef {
}

/// Represents the contract object
#[derive(Debug, Clone, Default)]
#[derive(Clone, Debug, Default)]
pub(crate) struct Contract {
pub(crate) caller: Address,
pub(crate) contract: Address,
Expand Down
2 changes: 1 addition & 1 deletion src/tracing/js/builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ fn hex_decode_js_string(js_string: JsString) -> JsResult<Vec<u8>> {
}

/// A container for all precompile addresses used for the `isPrecompiled` global callable.
#[derive(Debug, Clone)]
#[derive(Clone, Debug)]
pub(crate) struct PrecompileList(pub(crate) HashSet<Address>);

impl PrecompileList {
Expand Down
2 changes: 1 addition & 1 deletion src/tracing/js/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ where

/// Contains some contextual infos for a transaction execution that is made available to the JS
/// object.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct TransactionContext {
/// Hash of the block the tx is contained within.
///
Expand Down
4 changes: 2 additions & 2 deletions src/tracing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub mod js;
/// The [TracingInspector] keeps track of everything by:
/// 1. start tracking steps/calls on [Inspector::step] and [Inspector::call]
/// 2. complete steps/calls on [Inspector::step_end] and [Inspector::call_end]
#[derive(Debug, Clone)]
#[derive(Clone, Debug)]
pub struct TracingInspector {
/// Configures what and how the inspector records traces.
config: TracingInspectorConfig,
Expand Down Expand Up @@ -554,7 +554,7 @@ where
}
}

#[derive(Debug, Clone, Copy)]
#[derive(Clone, Copy, Debug)]
struct StackStep {
trace_idx: usize,
step_idx: usize,
Expand Down
2 changes: 1 addition & 1 deletion src/tracing/opcount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use revm::{interpreter::Interpreter, Database, EvmContext, Inspector};

/// An inspector that counts all opcodes.
#[derive(Debug, Clone, Copy, Default)]
#[derive(Clone, Copy, Debug, Default)]
pub struct OpcodeCountInspector {
/// opcode counter
count: usize,
Expand Down
8 changes: 4 additions & 4 deletions src/tracing/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl Default for CallTrace {
}

/// A node in the arena
#[derive(Default, Debug, Clone, PartialEq, Eq)]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct CallTraceNode {
/// Parent node index in the arena
pub parent: Option<usize>,
Expand Down Expand Up @@ -355,7 +355,7 @@ impl CallTraceNode {
}

/// A unified representation of a call.
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "UPPERCASE")]
pub enum CallKind {
/// Represents a regular call.
Expand Down Expand Up @@ -473,7 +473,7 @@ pub(crate) struct CallTraceStepStackItem<'a> {
}

/// Ordering enum for calls and logs
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LogCallOrder {
/// Contains the index of the corresponding log
Log(usize),
Expand Down Expand Up @@ -623,7 +623,7 @@ pub struct StorageChange {
/// Represents the memory captured during execution
///
/// This is a wrapper around the [SharedMemory](revm::interpreter::SharedMemory) context memory.
#[derive(Debug, Clone, PartialEq, Eq, Default)]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct RecordedMemory(pub(crate) Vec<u8>);

impl RecordedMemory {
Expand Down

0 comments on commit 44942b3

Please sign in to comment.