Skip to content

Commit ecf9b59

Browse files
committed
docs: Remove unnecessary code comments
1 parent 174d404 commit ecf9b59

File tree

2 files changed

+0
-97
lines changed

2 files changed

+0
-97
lines changed

crates/vm/src/core/opcodes/mod.rs

-10
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,6 @@ macro_rules! opcodes {
150150
/// This macro provides a convenient way to construct a `WrappedOpcode` for a specific
151151
/// opcode (`$name`), supporting between 0 and 8 input arguments that implement
152152
/// `Into<WrappedInput>`.
153-
///
154-
/// # Examples
155-
///
156-
/// ```
157-
/// // Create an ADD opcode with two inputs
158-
/// let add_op = w_add!(value1, value2);
159-
///
160-
/// // Create a MSTORE opcode with memory offset and value
161-
/// let mstore_op = w_mstore!(offset, value);
162-
/// ```
163153
#[macro_export]
164154
macro_rules! [<w_$name:lower>] {
165155
// zero inputs

crates/vm/src/core/opcodes/wrapped.rs

-87
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,6 @@ impl WrappedOpcode {
3939
/// The depth is calculated as the maximum depth of any input plus 1.
4040
/// A depth of 1 means the opcode has only raw inputs (or no inputs).
4141
/// Greater depths indicate a chain of operations.
42-
///
43-
/// ```
44-
/// use heimdall_vm::core::opcodes::wrapped::{WrappedOpcode, WrappedInput};
45-
/// use alloy::primitives::U256;
46-
/// use heimdall_vm::ext::lexers::solidity::WrappedOpcode;
47-
///
48-
/// // Create a PUSH1 0x01 operation
49-
/// let push1 = WrappedOpcode::new(0x60, vec![WrappedInput::Raw(U256::from(1))]);
50-
/// assert_eq!(push1.depth(), 1); // Depth is 1 because it has only raw inputs
51-
///
52-
/// // Create an ADD operation that takes the result of two PUSH operations
53-
/// let add = WrappedOpcode::new(0x01, vec![
54-
/// WrappedInput::Opcode(push1.clone()),
55-
/// WrappedInput::Opcode(push1.clone())
56-
/// ]);
57-
/// assert_eq!(add.depth(), 2); // Depth is 2 because it contains operations with depth 1
58-
/// ```
5942
pub fn depth(&self) -> u32 {
6043
self.inputs.iter().map(|x| x.depth()).max().unwrap_or(0) + 1
6144
}
@@ -66,21 +49,6 @@ impl std::fmt::Display for WrappedOpcode {
6649
///
6750
/// The format is: `OPCODENAME(input1, input2, ...)` where each input is
6851
/// formatted according to its own [`Display`] implementation.
69-
///
70-
/// ```
71-
/// use heimdall_vm::core::opcodes::wrapped::{WrappedOpcode, WrappedInput};
72-
/// use heimdall_vm::ext::lexers::solidity::WrappedOpcode;
73-
/// use alloy::primitives::U256;
74-
///
75-
/// let push1 = WrappedOpcode::new(0x60, vec![WrappedInput::Raw(U256::from(1))]);
76-
/// assert_eq!(push1.to_string(), "PUSH1(1)");
77-
///
78-
/// let add = WrappedOpcode::new(0x01, vec![
79-
/// WrappedInput::Opcode(push1.clone()),
80-
/// WrappedInput::Opcode(push1.clone())
81-
/// ]);
82-
/// assert_eq!(add.to_string(), "ADD(PUSH1(1), PUSH1(1))");
83-
/// ```
8452
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8553
write!(
8654
f,
@@ -99,21 +67,6 @@ impl WrappedInput {
9967
///
10068
/// This method is used to calculate the recursive depth of operations
10169
/// for analysis and optimization purposes.
102-
///
103-
/// ```
104-
/// use heimdall_vm::core::opcodes::wrapped::WrappedInput;
105-
/// use heimdall_vm::ext::lexers::solidity::WrappedOpcode;
106-
/// use alloy::primitives::U256;
107-
///
108-
/// // Raw inputs have depth 0
109-
/// let raw = WrappedInput::Raw(U256::from(42));
110-
/// assert_eq!(raw.depth(), 0);
111-
///
112-
/// // Opcode inputs have the depth of the operation they contain
113-
/// let push1 = WrappedOpcode::new(0x60, vec![WrappedInput::Raw(U256::from(1))]);
114-
/// let op_input = WrappedInput::Opcode(push1);
115-
/// assert_eq!(op_input.depth(), 1);
116-
/// ```
11770
pub fn depth(&self) -> u32 {
11871
match self {
11972
WrappedInput::Raw(_) => 0,
@@ -127,19 +80,6 @@ impl std::fmt::Display for WrappedInput {
12780
///
12881
/// - For [`Raw`] inputs, displays the contained [`U256`] value.
12982
/// - For [`Opcode`] inputs, recursively formats the contained [`WrappedOpcode`].
130-
///
131-
/// ```
132-
/// use heimdall_vm::core::opcodes::wrapped::WrappedInput;
133-
/// use heimdall_vm::ext::lexers::solidity::WrappedOpcode;
134-
/// use alloy::primitives::U256;
135-
///
136-
/// let raw = WrappedInput::Raw(U256::from(42));
137-
/// assert_eq!(raw.to_string(), "42");
138-
///
139-
/// let push1 = WrappedOpcode::new(0x60, vec![WrappedInput::Raw(U256::from(1))]);
140-
/// let op_input = WrappedInput::Opcode(push1);
141-
/// assert_eq!(op_input.to_string(), "PUSH1(1)");
142-
/// ```
14383
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14484
match self {
14585
WrappedInput::Raw(u256) => write!(f, "{u256}"),
@@ -153,19 +93,6 @@ impl From<U256> for WrappedInput {
15393
///
15494
/// This implementation allows for more ergonomic code when creating
15595
/// [`WrappedInput`]s from raw values.
156-
///
157-
/// ```
158-
/// use heimdall_vm::core::opcodes::wrapped::WrappedInput;
159-
/// use alloy::primitives::U256;
160-
///
161-
/// let u256_val = U256::from(42);
162-
/// let input: WrappedInput = u256_val.into();
163-
///
164-
/// match input {
165-
/// WrappedInput::Raw(val) => assert_eq!(val, U256::from(42)),
166-
/// _ => panic!("Expected Raw variant"),
167-
/// }
168-
/// ```
16996
fn from(val: U256) -> Self {
17097
WrappedInput::Raw(val)
17198
}
@@ -176,20 +103,6 @@ impl From<WrappedOpcode> for WrappedInput {
176103
///
177104
/// This implementation allows for more ergonomic code when creating
178105
/// [`WrappedInput`]s from operations.
179-
///
180-
/// ```
181-
/// use heimdall_vm::core::opcodes::wrapped::WrappedInput;
182-
/// use heimdall_vm::ext::lexers::solidity::WrappedOpcode;
183-
/// use alloy::primitives::U256;
184-
///
185-
/// let push1 = WrappedOpcode::new(0x60, vec![WrappedInput::Raw(U256::from(1))]);
186-
/// let input: WrappedInput = push1.clone().into();
187-
///
188-
/// match input {
189-
/// WrappedInput::Opcode(op) => assert_eq!(op, push1),
190-
/// _ => panic!("Expected Opcode variant"),
191-
/// }
192-
/// ```
193106
fn from(val: WrappedOpcode) -> Self {
194107
WrappedInput::Opcode(val)
195108
}

0 commit comments

Comments
 (0)