1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
//! Result of the EVM execution. Containing both execution result, state and errors.
//!
//! [`ExecutionResult`] is the result of the EVM execution.
//!
//! [`InvalidTransaction`] is the error that is returned when the transaction is invalid.
//!
//! [`InvalidHeader`] is the error that is returned when the header is invalid.
//!
//! [`SuccessReason`] is the reason that the transaction successfully completed.
use crate::transaction::TransactionError;
use core::fmt::{self, Debug};
use database_interface::DBErrorMarker;
use primitives::{Address, Bytes, Log, U256};
use std::{boxed::Box, string::String, vec::Vec};
/// Trait for the halt reason.
pub trait HaltReasonTr: Clone + Debug + PartialEq + Eq + From<HaltReason> {}
impl<T> HaltReasonTr for T where T: Clone + Debug + PartialEq + Eq + From<HaltReason> {}
/// Tuple containing evm execution result and state.s
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct ResultAndState<R, S> {
/// Execution result
pub result: R,
/// Output State.
pub state: S,
}
/// Tuple containing multiple execution results and state.
pub type ResultVecAndState<R, S> = ResultAndState<Vec<R>, S>;
impl<R, S> ResultAndState<R, S> {
/// Creates new ResultAndState.
pub fn new(result: R, state: S) -> Self {
Self { result, state }
}
}
/// Result of a transaction execution
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum ExecutionResult<HaltReasonTy = HaltReason> {
/// Returned successfully
Success {
/// Reason for the success.
reason: SuccessReason,
/// Gas used by the transaction.s
gas_used: u64,
/// Gas refunded by the transaction.
gas_refunded: u64,
/// Logs emitted by the transaction.
logs: Vec<Log>,
/// Output of the transaction.
output: Output,
},
/// Reverted by `REVERT` opcode that doesn't spend all gas
Revert {
/// Gas used by the transaction.
gas_used: u64,
/// Output of the transaction.
output: Bytes,
},
/// Reverted for various reasons and spend all gas
Halt {
/// Reason for the halt.
reason: HaltReasonTy,
/// Gas used by the transaction.
///
/// Halting will spend all the gas, and will be equal to gas_limit.
gas_used: u64,
},
}
impl<HaltReasonTy> ExecutionResult<HaltReasonTy> {
/// Returns if transaction execution is successful.
///
/// 1 indicates success, 0 indicates revert.
///
/// <https://eips.ethereum.org/EIPS/eip-658>
pub fn is_success(&self) -> bool {
matches!(self, Self::Success { .. })
}
/// Maps a `DBError` to a new error type using the provided closure, leaving other variants unchanged.
pub fn map_haltreason<F, OHR>(self, op: F) -> ExecutionResult<OHR>
where
F: FnOnce(HaltReasonTy) -> OHR,
{
match self {
Self::Success {
reason,
gas_used,
gas_refunded,
logs,
output,
} => ExecutionResult::Success {
reason,
gas_used,
gas_refunded,
logs,
output,
},
Self::Revert { gas_used, output } => ExecutionResult::Revert { gas_used, output },
Self::Halt { reason, gas_used } => ExecutionResult::Halt {
reason: op(reason),
gas_used,
},
}
}
/// Returns created address if execution is Create transaction
/// and Contract was created.
pub fn created_address(&self) -> Option<Address> {
match self {
Self::Success { output, .. } => output.address().cloned(),
_ => None,
}
}
/// Returns true if execution result is a Halt.
pub fn is_halt(&self) -> bool {
matches!(self, Self::Halt { .. })
}
/// Returns the output data of the execution.
///
/// Returns [`None`] if the execution was halted.
pub fn output(&self) -> Option<&Bytes> {
match self {
Self::Success { output, .. } => Some(output.data()),
Self::Revert { output, .. } => Some(output),
_ => None,
}
}
/// Consumes the type and returns the output data of the execution.
///
/// Returns [`None`] if the execution was halted.
pub fn into_output(self) -> Option<Bytes> {
match self {
Self::Success { output, .. } => Some(output.into_data()),
Self::Revert { output, .. } => Some(output),
_ => None,
}
}
/// Returns the logs if execution is successful, or an empty list otherwise.
pub fn logs(&self) -> &[Log] {
match self {
Self::Success { logs, .. } => logs.as_slice(),
_ => &[],
}
}
/// Consumes [`self`] and returns the logs if execution is successful, or an empty list otherwise.
pub fn into_logs(self) -> Vec<Log> {
match self {
Self::Success { logs, .. } => logs,
_ => Vec::new(),
}
}
/// Returns the gas used.
pub fn gas_used(&self) -> u64 {
match *self {
Self::Success { gas_used, .. }
| Self::Revert { gas_used, .. }
| Self::Halt { gas_used, .. } => gas_used,
}
}
}
/// Output of a transaction execution
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Output {
/// Output of a call.
Call(Bytes),
/// Output of a create.
Create(Bytes, Option<Address>),
}
impl Output {
/// Returns the output data of the execution output.
pub fn into_data(self) -> Bytes {
match self {
Output::Call(data) => data,
Output::Create(data, _) => data,
}
}
/// Returns the output data of the execution output.
pub fn data(&self) -> &Bytes {
match self {
Output::Call(data) => data,
Output::Create(data, _) => data,
}
}
/// Returns the created address, if any.
pub fn address(&self) -> Option<&Address> {
match self {
Output::Call(_) => None,
Output::Create(_, address) => address.as_ref(),
}
}
}
/// Main EVM error
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum EVMError<DBError, TransactionError = InvalidTransaction> {
/// Transaction validation error
Transaction(TransactionError),
/// Header validation error
Header(InvalidHeader),
/// Database error
Database(DBError),
/// Custom error
///
/// Useful for handler registers where custom logic would want to return their own custom error.
Custom(String),
}
impl<DBError: DBErrorMarker, TX> From<DBError> for EVMError<DBError, TX> {
fn from(value: DBError) -> Self {
Self::Database(value)
}
}
/// Trait for converting a string to an [`EVMError::Custom`] error.
pub trait FromStringError {
/// Converts a string to an [`EVMError::Custom`] error.
fn from_string(value: String) -> Self;
}
impl<DB, TX> FromStringError for EVMError<DB, TX> {
fn from_string(value: String) -> Self {
Self::Custom(value)
}
}
impl<DB, TXE: From<InvalidTransaction>> From<InvalidTransaction> for EVMError<DB, TXE> {
fn from(value: InvalidTransaction) -> Self {
Self::Transaction(TXE::from(value))
}
}
impl<DBError, TransactionValidationErrorT> EVMError<DBError, TransactionValidationErrorT> {
/// Maps a `DBError` to a new error type using the provided closure, leaving other variants unchanged.
pub fn map_db_err<F, E>(self, op: F) -> EVMError<E, TransactionValidationErrorT>
where
F: FnOnce(DBError) -> E,
{
match self {
Self::Transaction(e) => EVMError::Transaction(e),
Self::Header(e) => EVMError::Header(e),
Self::Database(e) => EVMError::Database(op(e)),
Self::Custom(e) => EVMError::Custom(e),
}
}
}
impl<DBError, TransactionValidationErrorT> core::error::Error
for EVMError<DBError, TransactionValidationErrorT>
where
DBError: core::error::Error + 'static,
TransactionValidationErrorT: core::error::Error + 'static,
{
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
match self {
Self::Transaction(e) => Some(e),
Self::Header(e) => Some(e),
Self::Database(e) => Some(e),
Self::Custom(_) => None,
}
}
}
impl<DBError, TransactionValidationErrorT> fmt::Display
for EVMError<DBError, TransactionValidationErrorT>
where
DBError: fmt::Display,
TransactionValidationErrorT: fmt::Display,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Transaction(e) => write!(f, "transaction validation error: {e}"),
Self::Header(e) => write!(f, "header validation error: {e}"),
Self::Database(e) => write!(f, "database error: {e}"),
Self::Custom(e) => f.write_str(e),
}
}
}
impl<DBError, TransactionValidationErrorT> From<InvalidHeader>
for EVMError<DBError, TransactionValidationErrorT>
{
fn from(value: InvalidHeader) -> Self {
Self::Header(value)
}
}
/// Transaction validation error.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum InvalidTransaction {
/// When using the EIP-1559 fee model introduced in the London upgrade, transactions specify two primary fee fields:
/// - `gas_max_fee`: The maximum total fee a user is willing to pay, inclusive of both base fee and priority fee.
/// - `gas_priority_fee`: The extra amount a user is willing to give directly to the miner, often referred to as the "tip".
///
/// Provided `gas_priority_fee` exceeds the total `gas_max_fee`.
PriorityFeeGreaterThanMaxFee,
/// EIP-1559: `gas_price` is less than `basefee`.
GasPriceLessThanBasefee,
/// `gas_limit` in the tx is bigger than `block_gas_limit`.
CallerGasLimitMoreThanBlock,
/// Initial gas for a Call is bigger than `gas_limit`.
///
/// Initial gas for a Call contains:
/// - initial stipend gas
/// - gas for access list and input data
CallGasCostMoreThanGasLimit {
/// Initial gas for a Call.
initial_gas: u64,
/// Gas limit for the transaction.
gas_limit: u64,
},
/// Gas floor calculated from EIP-7623 Increase calldata cost
/// is more than the gas limit.
///
/// Tx data is too large to be executed.
GasFloorMoreThanGasLimit {
/// Gas floor calculated from EIP-7623 Increase calldata cost.
gas_floor: u64,
/// Gas limit for the transaction.
gas_limit: u64,
},
/// EIP-3607 Reject transactions from senders with deployed code
RejectCallerWithCode,
/// Transaction account does not have enough amount of ether to cover transferred value and gas_limit*gas_price.
LackOfFundForMaxFee {
/// Fee for the transaction.
fee: Box<U256>,
/// Balance of the sender.
balance: Box<U256>,
},
/// Overflow payment in transaction.
OverflowPaymentInTransaction,
/// Nonce overflows in transaction.
NonceOverflowInTransaction,
/// Nonce is too high.
NonceTooHigh {
/// Nonce of the transaction.
tx: u64,
/// Nonce of the state.
state: u64,
},
/// Nonce is too low.
NonceTooLow {
/// Nonce of the transaction.
tx: u64,
/// Nonce of the state.
state: u64,
},
/// EIP-3860: Limit and meter initcode
CreateInitCodeSizeLimit,
/// Transaction chain id does not match the config chain id.
InvalidChainId,
/// Missing chain id.
MissingChainId,
/// Transaction gas limit is greater than the cap.
TxGasLimitGreaterThanCap {
/// Transaction gas limit.
gas_limit: u64,
/// Gas limit cap.
cap: u64,
},
/// Access list is not supported for blocks before the Berlin hardfork.
AccessListNotSupported,
/// `max_fee_per_blob_gas` is not supported for blocks before the Cancun hardfork.
MaxFeePerBlobGasNotSupported,
/// `blob_hashes`/`blob_versioned_hashes` is not supported for blocks before the Cancun hardfork.
BlobVersionedHashesNotSupported,
/// Block `blob_gas_price` is greater than tx-specified `max_fee_per_blob_gas` after Cancun.
BlobGasPriceGreaterThanMax,
/// There should be at least one blob in Blob transaction.
EmptyBlobs,
/// Blob transaction can't be a create transaction.
///
/// `to` must be present
BlobCreateTransaction,
/// Transaction has more then `max` blobs
TooManyBlobs {
/// Maximum number of blobs allowed.
max: usize,
/// Number of blobs in the transaction.
have: usize,
},
/// Blob transaction contains a versioned hash with an incorrect version
BlobVersionNotSupported,
/// EOF create should have `to` address
EofCreateShouldHaveToAddress,
/// EIP-7702 is not enabled.
AuthorizationListNotSupported,
/// EIP-7702 transaction has invalid fields set.
AuthorizationListInvalidFields,
/// Empty Authorization List is not allowed.
EmptyAuthorizationList,
/// EIP-2930 is not supported.
Eip2930NotSupported,
/// EIP-1559 is not supported.
Eip1559NotSupported,
/// EIP-4844 is not supported.
Eip4844NotSupported,
/// EIP-7702 is not supported.
Eip7702NotSupported,
/// EIP-7873 is not supported.
Eip7873NotSupported,
// TODO (EOF)
// /// EIP-7873 needs to have at least one initcode.
// Eip7873EmptyInitcodeList,
// /// EIP-7873 initcode can't be zero length.
// Eip7873EmptyInitcode {
// i: usize,
// },
// /// EIP-7873 initcodes can't be more than [`MAX_INITCODE_COUNT`].
// Eip7873TooManyInitcodes {
// size: usize,
// },
// /// EIP-7873 initcodes can't be more than [`MAX_INITCODE_SIZE`].
// Eip7873InitcodeTooLarge {
// i: usize,
// size: usize,
// },
/// EIP-7873 initcode transaction should have `to` address.
Eip7873MissingTarget,
}
impl TransactionError for InvalidTransaction {}
impl core::error::Error for InvalidTransaction {}
impl fmt::Display for InvalidTransaction {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::PriorityFeeGreaterThanMaxFee => {
write!(f, "priority fee is greater than max fee")
}
Self::GasPriceLessThanBasefee => {
write!(f, "gas price is less than basefee")
}
Self::CallerGasLimitMoreThanBlock => {
write!(f, "caller gas limit exceeds the block gas limit")
}
Self::TxGasLimitGreaterThanCap { gas_limit, cap } => {
write!(
f,
"transaction gas limit ({gas_limit}) is greater than the cap ({cap})"
)
}
Self::CallGasCostMoreThanGasLimit {
initial_gas,
gas_limit,
} => {
write!(
f,
"call gas cost ({initial_gas}) exceeds the gas limit ({gas_limit})"
)
}
Self::GasFloorMoreThanGasLimit {
gas_floor,
gas_limit,
} => {
write!(
f,
"gas floor ({gas_floor}) exceeds the gas limit ({gas_limit})"
)
}
Self::RejectCallerWithCode => {
write!(f, "reject transactions from senders with deployed code")
}
Self::LackOfFundForMaxFee { fee, balance } => {
write!(f, "lack of funds ({balance}) for max fee ({fee})")
}
Self::OverflowPaymentInTransaction => {
write!(f, "overflow payment in transaction")
}
Self::NonceOverflowInTransaction => {
write!(f, "nonce overflow in transaction")
}
Self::NonceTooHigh { tx, state } => {
write!(f, "nonce {tx} too high, expected {state}")
}
Self::NonceTooLow { tx, state } => {
write!(f, "nonce {tx} too low, expected {state}")
}
Self::CreateInitCodeSizeLimit => {
write!(f, "create initcode size limit")
}
Self::InvalidChainId => write!(f, "invalid chain ID"),
Self::MissingChainId => write!(f, "missing chain ID"),
Self::AccessListNotSupported => write!(f, "access list not supported"),
Self::MaxFeePerBlobGasNotSupported => {
write!(f, "max fee per blob gas not supported")
}
Self::BlobVersionedHashesNotSupported => {
write!(f, "blob versioned hashes not supported")
}
Self::BlobGasPriceGreaterThanMax => {
write!(f, "blob gas price is greater than max fee per blob gas")
}
Self::EmptyBlobs => write!(f, "empty blobs"),
Self::BlobCreateTransaction => write!(f, "blob create transaction"),
Self::TooManyBlobs { max, have } => {
write!(f, "too many blobs, have {have}, max {max}")
}
Self::BlobVersionNotSupported => write!(f, "blob version not supported"),
Self::EofCreateShouldHaveToAddress => write!(f, "EOF crate should have `to` address"),
Self::AuthorizationListNotSupported => write!(f, "authorization list not supported"),
Self::AuthorizationListInvalidFields => {
write!(f, "authorization list tx has invalid fields")
}
Self::EmptyAuthorizationList => write!(f, "empty authorization list"),
Self::Eip2930NotSupported => write!(f, "Eip2930 is not supported"),
Self::Eip1559NotSupported => write!(f, "Eip1559 is not supported"),
Self::Eip4844NotSupported => write!(f, "Eip4844 is not supported"),
Self::Eip7702NotSupported => write!(f, "Eip7702 is not supported"),
Self::Eip7873NotSupported => write!(f, "Eip7873 is not supported"),
// TODO(EOF)
// Self::Eip7873EmptyInitcodeList => {
// write!(f, "Eip7873 initcode list should have at least one initcode")
// }
// Self::Eip7873EmptyInitcode { i } => {
// write!(f, "Eip7873 initcode {i} can't be zero length")
// }
// Self::Eip7873TooManyInitcodes { size } => {
// write!(
// f,
// "Eip7873 initcodes can't be more than {MAX_INITCODE_COUNT}, have {size}"
// )
// }
// Self::Eip7873InitcodeTooLarge { i, size } => {
// write!(
// f,
// "Eip7873 initcode {i} can't be more than {MAX_INITCODE_SIZE}, have {size}"
// )
// }
Self::Eip7873MissingTarget => {
write!(f, "Eip7873 initcode transaction should have `to` address")
}
}
}
}
/// Errors related to misconfiguration of a [`crate::Block`].
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum InvalidHeader {
/// `prevrandao` is not set for Merge and above.
PrevrandaoNotSet,
/// `excess_blob_gas` is not set for Cancun and above.
ExcessBlobGasNotSet,
}
impl core::error::Error for InvalidHeader {}
impl fmt::Display for InvalidHeader {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::PrevrandaoNotSet => write!(f, "`prevrandao` not set"),
Self::ExcessBlobGasNotSet => write!(f, "`excess_blob_gas` not set"),
}
}
}
/// Reason a transaction successfully completed.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum SuccessReason {
/// Stop [`state::bytecode::opcode::STOP`] opcode.
Stop,
/// Return [`state::bytecode::opcode::RETURN`] opcode.
Return,
/// Self destruct opcode.
SelfDestruct,
/// EOF [`state::bytecode::opcode::RETURNCONTRACT`] opcode.
EofReturnContract,
}
/// Indicates that the EVM has experienced an exceptional halt.
///
/// This causes execution to immediately end with all gas being consumed.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum HaltReason {
/// Out of gas error.
OutOfGas(OutOfGasError),
/// Opcode not found error.
OpcodeNotFound,
/// Invalid FE opcode error.
InvalidFEOpcode,
/// Invalid jump destination.
InvalidJump,
/// The feature or opcode is not activated in hardfork.
NotActivated,
/// Attempting to pop a value from an empty stack.
StackUnderflow,
/// Attempting to push a value onto a full stack.
StackOverflow,
/// Invalid memory or storage offset for [`state::bytecode::opcode::RETURNDATACOPY`].
OutOfOffset,
/// Address collision during contract creation.
CreateCollision,
/// Precompile error.
PrecompileError,
/// Nonce overflow.
NonceOverflow,
/// Create init code size exceeds limit (runtime).
CreateContractSizeLimit,
/// Error on created contract that begins with EF
CreateContractStartingWithEF,
/// EIP-3860: Limit and meter initcode. Initcode size limit exceeded.
CreateInitCodeSizeLimit,
/* Internal Halts that can be only found inside Inspector */
/// Overflow payment. Not possible to happen on mainnet.
OverflowPayment,
/// State change during static call.
StateChangeDuringStaticCall,
/// Call not allowed inside static call.
CallNotAllowedInsideStatic,
/// Out of funds to pay for the call.
OutOfFunds,
/// Call is too deep.
CallTooDeep,
/// Aux data overflow, new aux data is larger than [u16] max size.
EofAuxDataOverflow,
/// Aux data is smaller than already present data size.
EofAuxDataTooSmall,
/// EOF Subroutine stack overflow
SubRoutineStackOverflow,
/// Check for target address validity is only done inside subcall.
InvalidEXTCALLTarget,
}
/// Out of gas errors.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum OutOfGasError {
/// Basic OOG error. Not enough gas to execute the opcode.
Basic,
/// Tried to expand past memory limit.
MemoryLimit,
/// Basic OOG error from memory expansion
Memory,
/// Precompile threw OOG error
Precompile,
/// When performing something that takes a U256 and casts down to a u64, if its too large this would fire
/// i.e. in `as_usize_or_fail`
InvalidOperand,
/// When performing SSTORE the gasleft is less than or equal to 2300
ReentrancySentry,
}