1pub mod meter;
19pub mod stack;
20
21use crate::{Config, Weight};
22use alloc::vec::Vec;
23use ethereum::AuthorizationList;
24use fp_evm::{CallInfo, CreateInfo, StateOverride};
25use sp_core::{H160, H256, U256};
26
27#[derive(Debug)]
28pub struct RunnerError<E: Into<sp_runtime::DispatchError>> {
29 pub error: E,
30 pub weight: Weight,
31}
32
33pub trait Runner<T: Config> {
34 type Error: Into<sp_runtime::DispatchError>;
35
36 fn validate(
37 source: H160,
38 target: Option<H160>,
39 input: Vec<u8>,
40 value: U256,
41 gas_limit: u64,
42 max_fee_per_gas: Option<U256>,
43 max_priority_fee_per_gas: Option<U256>,
44 nonce: Option<U256>,
45 access_list: Vec<(H160, Vec<H256>)>,
46 authorization_list: Vec<(U256, H160, U256, Option<H160>)>,
47 is_transactional: bool,
48 weight_limit: Option<Weight>,
49 proof_size_base_cost: Option<u64>,
50 evm_config: &evm::Config,
51 ) -> Result<(), RunnerError<Self::Error>>;
52
53 fn call(
54 source: H160,
55 target: H160,
56 input: Vec<u8>,
57 value: U256,
58 gas_limit: u64,
59 max_fee_per_gas: Option<U256>,
60 max_priority_fee_per_gas: Option<U256>,
61 nonce: Option<U256>,
62 access_list: Vec<(H160, Vec<H256>)>,
63 authorization_list: AuthorizationList,
64 is_transactional: bool,
65 validate: bool,
66 weight_limit: Option<Weight>,
67 proof_size_base_cost: Option<u64>,
68 state_override: StateOverride,
71 config: &evm::Config,
72 ) -> Result<CallInfo, RunnerError<Self::Error>>;
73
74 fn create(
75 source: H160,
76 init: Vec<u8>,
77 value: U256,
78 gas_limit: u64,
79 max_fee_per_gas: Option<U256>,
80 max_priority_fee_per_gas: Option<U256>,
81 nonce: Option<U256>,
82 access_list: Vec<(H160, Vec<H256>)>,
83 authorization_list: AuthorizationList,
84 is_transactional: bool,
85 validate: bool,
86 weight_limit: Option<Weight>,
87 proof_size_base_cost: Option<u64>,
88 config: &evm::Config,
89 ) -> Result<CreateInfo, RunnerError<Self::Error>>;
90
91 fn create2(
92 source: H160,
93 init: Vec<u8>,
94 salt: H256,
95 value: U256,
96 gas_limit: u64,
97 max_fee_per_gas: Option<U256>,
98 max_priority_fee_per_gas: Option<U256>,
99 nonce: Option<U256>,
100 access_list: Vec<(H160, Vec<H256>)>,
101 authorization_list: AuthorizationList,
102 is_transactional: bool,
103 validate: bool,
104 weight_limit: Option<Weight>,
105 proof_size_base_cost: Option<u64>,
106 config: &evm::Config,
107 ) -> Result<CreateInfo, RunnerError<Self::Error>>;
108
109 fn create_force_address(
110 source: H160,
111 init: Vec<u8>,
112 value: U256,
113 gas_limit: u64,
114 max_fee_per_gas: Option<U256>,
115 max_priority_fee_per_gas: Option<U256>,
116 nonce: Option<U256>,
117 access_list: Vec<(H160, Vec<H256>)>,
118 authorization_list: AuthorizationList,
119 is_transactional: bool,
120 validate: bool,
121 weight_limit: Option<Weight>,
122 proof_size_base_cost: Option<u64>,
123 config: &evm::Config,
124 contract_address: H160,
125 ) -> Result<CreateInfo, RunnerError<Self::Error>>;
126}