1pub mod meter;
19pub mod stack;
20
21use crate::{Config, Weight};
22use alloc::vec::Vec;
23use ethereum::AuthorizationList;
24use fp_evm::{CallInfo, CreateInfo};
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 config: &evm::Config,
69 ) -> Result<CallInfo, RunnerError<Self::Error>>;
70
71 fn create(
72 source: H160,
73 init: Vec<u8>,
74 value: U256,
75 gas_limit: u64,
76 max_fee_per_gas: Option<U256>,
77 max_priority_fee_per_gas: Option<U256>,
78 nonce: Option<U256>,
79 access_list: Vec<(H160, Vec<H256>)>,
80 authorization_list: AuthorizationList,
81 is_transactional: bool,
82 validate: bool,
83 weight_limit: Option<Weight>,
84 proof_size_base_cost: Option<u64>,
85 config: &evm::Config,
86 ) -> Result<CreateInfo, RunnerError<Self::Error>>;
87
88 fn create2(
89 source: H160,
90 init: Vec<u8>,
91 salt: H256,
92 value: U256,
93 gas_limit: u64,
94 max_fee_per_gas: Option<U256>,
95 max_priority_fee_per_gas: Option<U256>,
96 nonce: Option<U256>,
97 access_list: Vec<(H160, Vec<H256>)>,
98 authorization_list: AuthorizationList,
99 is_transactional: bool,
100 validate: bool,
101 weight_limit: Option<Weight>,
102 proof_size_base_cost: Option<u64>,
103 config: &evm::Config,
104 ) -> Result<CreateInfo, RunnerError<Self::Error>>;
105}