Skip to content

Commit 05b34f4

Browse files
authored
docs: improve InstructionResult documentation (#1673)
* docs: improve `InstructionResult` documentation * chore: clean up
1 parent 4d0feec commit 05b34f4

File tree

1 file changed

+40
-17
lines changed

1 file changed

+40
-17
lines changed

crates/interpreter/src/instruction_result.rs

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,68 +4,91 @@ use crate::primitives::{HaltReason, OutOfGasError, SuccessReason};
44
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
55
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
66
pub enum InstructionResult {
7-
// success codes
7+
// Success Codes
88
#[default]
9+
/// Execution should continue to the next one.
910
Continue = 0x00,
11+
/// Encountered a `STOP` opcode
1012
Stop,
13+
/// Return from the current call.
1114
Return,
15+
/// Self-destruct the current contract.
1216
SelfDestruct,
17+
/// Return a contract (used in contract creation).
1318
ReturnContract,
1419

15-
// revert codes
16-
Revert = 0x10, // revert opcode
20+
// Revert Codes
21+
/// Revert the transaction.
22+
Revert = 0x10,
23+
/// Exceeded maximum call depth.
1724
CallTooDeep,
25+
/// Insufficient funds for transfer.
1826
OutOfFunds,
19-
/// Revert if CREATE/CREATE2 starts with 0xEF00
27+
/// Revert if `CREATE`/`CREATE2` starts with `0xEF00`.
2028
CreateInitCodeStartingEF00,
21-
/// Invalid EOF initcode,
29+
/// Invalid EVM Object Format (EOF) init code.
2230
InvalidEOFInitCode,
23-
/// ExtDelegateCall calling a non EOF contract.
31+
/// `ExtDelegateCall` calling a non EOF contract.
2432
InvalidExtDelegateCallTarget,
2533

26-
// Actions
34+
// Action Codes
35+
/// Indicates a call or contract creation.
2736
CallOrCreate = 0x20,
2837

29-
// error codes
38+
// Error Codes
3039
OutOfGas = 0x50,
40+
/// Out of gas error encountered during memory expansion.
3141
MemoryOOG,
42+
/// The memory limit of the EVM has been exceeded.
3243
MemoryLimitOOG,
44+
/// Out of gas error encountered during the execution of a precompiled contract.
3345
PrecompileOOG,
46+
/// Out of gas error encountered while calling an invalid operand.
3447
InvalidOperandOOG,
48+
/// Unknown or invalid opcode.
3549
OpcodeNotFound,
36-
/// Transferring value with CALL/CALLCODE is not possible in static mode.
50+
/// Invalid `CALL` with value transfer in static context.
3751
CallNotAllowedInsideStatic,
38-
/// State change attempted in static mode.
52+
/// Invalid state modification in static call.
3953
StateChangeDuringStaticCall,
54+
/// An undefined bytecode value encountered during execution.
4055
InvalidFEOpcode,
4156
InvalidJump,
57+
/// The feature or opcode is not activated in this version of the EVM.
4258
NotActivated,
59+
/// Attempting to pop a value from an empty stack.
4360
StackUnderflow,
61+
/// Attempting to push a value onto a full stack.
4462
StackOverflow,
63+
/// Invalid memory or storage offset.
4564
OutOfOffset,
65+
/// Address collision during contract creation.
4666
CreateCollision,
67+
/// Payment amount overflow.
4768
OverflowPayment,
69+
/// Error in precompiled contract execution.
4870
PrecompileError,
71+
/// Nonce overflow.
4972
NonceOverflow,
50-
/// Create init code size exceeds limit (runtime).
73+
/// Exceeded contract size limit during creation.
5174
CreateContractSizeLimit,
52-
/// Error on created contract that begins with EF
75+
/// Created contract starts with invalid bytes (`0xEF`).
5376
CreateContractStartingWithEF,
54-
/// EIP-3860: Limit and meter initcode. Initcode size limit exceeded.
77+
/// Exceeded init code size limit (EIP-3860: Limit and meter initcode).
5578
CreateInitCodeSizeLimit,
5679
/// Fatal external error. Returned by database.
5780
FatalExternalError,
58-
/// RETURNCONTRACT called in not init eof code.
81+
/// `RETURNCONTRACT` called outside init EOF code.
5982
ReturnContractInNotInitEOF,
6083
/// Legacy contract is calling opcode that is enabled only in EOF.
6184
EOFOpcodeDisabledInLegacy,
62-
/// EOF function stack overflow
85+
/// Stack overflow in EOF subroutine function calls.
6386
EOFFunctionStackOverflow,
64-
/// Aux data overflow, new aux data is larger tha u16 max size.
87+
/// Aux data overflow, new aux data is larger than `u16` max size.
6588
EofAuxDataOverflow,
6689
/// Aux data is smaller then already present data size.
6790
EofAuxDataTooSmall,
68-
/// EXT*CALL target address needs to be padded with 0s.
91+
/// `EXT*CALL` target address needs to be padded with 0s.
6992
InvalidEXTCALLTarget,
7093
}
7194

0 commit comments

Comments
 (0)