linera_execution/evm/
mod.rs1#![cfg(with_revm)]
9
10mod data_types;
11mod database;
12pub mod inputs;
13pub mod revm;
14
15use linera_base::data_types::AmountConversionError;
16use revm_context::result::{HaltReason, Output, SuccessReason};
17use revm_primitives::{Address, Log, U256};
18use thiserror::Error;
19
20#[derive(Debug, Error)]
21pub enum EvmExecutionError {
22 #[error(transparent)]
23 AmountConversionError(#[from] AmountConversionError),
24 #[error("Failed to load contract EVM module: {_0}")]
25 LoadContractModule(#[source] anyhow::Error),
26 #[error("Failed to load service EVM module: {_0}")]
27 LoadServiceModule(#[source] anyhow::Error),
28 #[error("It is illegal to call {0} from an operation")]
29 IllegalOperationCall(String),
30 #[error("runtime error")]
31 RuntimeError(String),
32 #[error("The balances are incoherent for address {0}, balances {1}, {2}")]
33 IncoherentBalances(Address, U256, U256),
34 #[error("Unknown signer")]
35 UnknownSigner,
36 #[error("The function {0} is being called but is missing from the bytecode API")]
37 MissingFunction(String),
38 #[error("Incorrect contract creation: {0}")]
39 IncorrectContractCreation(String),
40 #[error("The operation should contain the evm selector and so have length 4 or more")]
41 OperationIsTooShort,
42 #[error("Contracts cannot call themselves")]
43 NoSelfCall,
44 #[error("Incorrect ApplicationId")]
45 IncorrectApplicationId,
46 #[error("Non-zero transfer precompile")]
47 NonZeroTransferPrecompile,
48 #[error("Transact error {0}")]
49 TransactError(String),
50 #[error("Impossible to create contracts in services")]
51 NoContractCreationInService,
52 #[error("Transact commit error {0}")]
53 TransactCommitError(String),
54 #[error("Precompile error: {0}")]
55 PrecompileError(String),
56 #[error("Missing account info")]
57 MissingAccountInfo,
58 #[error("The operation was reverted with {gas_used} gas used and output {output:?}")]
59 Revert {
60 gas_used: u64,
61 output: revm_primitives::Bytes,
62 },
63 #[error("The operation was halted with {gas_used} gas used due to {reason:?}")]
64 Halt { gas_used: u64, reason: HaltReason },
65 #[error("The interpreter did not return, reason={:?}, gas_used={}, gas_refunded={}, logs={:?}, output={:?}",
66 reason, gas_used, gas_refunded, logs, output)]
67 NoReturnInterpreter {
68 reason: SuccessReason,
69 gas_used: u64,
70 gas_refunded: u64,
71 logs: Vec<Log>,
72 output: Output,
73 },
74}