Skip to content

Commit d743990

Browse files
committed
evm frontier at stable2506
1 parent d779e9c commit d743990

7 files changed

Lines changed: 32 additions & 39 deletions

File tree

Cargo.lock

Lines changed: 16 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ evm-runtime = { git = "https://github.com/moonbeam-foundation/evm", branch = "mo
361361

362362
# EVM from acala
363363
module-evm-utility-macro = { path = "runtime/hydradx/src/evm/evm-utility/macro", default-features = false }
364-
ethereum = { version = "0.18.2", default-features = false, features = [
364+
ethereum = { git = "https://github.com/moonbeam-foundation/ethereum", branch = "moonbeam-polkadot-stable2603", default-features = false, features = [
365365
"with-scale",
366366
] }
367367
ethereum-types = { version = "0.15.1", default-features = false }

runtime/hydradx/src/evm/executor.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ where
4444
let config = <T as Config>::config();
4545
let precompiles = T::PrecompilesValue::get();
4646
let metadata = StackSubstateMetadata::new(gas, config);
47-
let state = SubstrateStackState::new(&vicinity, metadata, None, None);
47+
let state = SubstrateStackState::new(&vicinity, metadata, None, None, None);
4848
let account = T::AddressMapping::into_account_id(origin);
4949
let nonce = T::AccountProvider::account_nonce(&account.clone().into());
5050
let mut executor = StackExecutor::new_with_precompiles(state, config, &precompiles);
@@ -88,6 +88,7 @@ where
8888
false, // validate
8989
None, // weight_limit
9090
None, // proof_size_base_cost
91+
None, // state_override
9192
evm_config,
9293
);
9394

runtime/hydradx/src/evm/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use frame_support::{
3535
dispatch::RawOrigin,
3636
parameter_types,
3737
sp_runtime::traits::One,
38-
traits::{Defensive, EitherOf, FindAuthor},
38+
traits::{ConstBool, Defensive, EitherOf, FindAuthor},
3939
weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight},
4040
ConsensusEngineId,
4141
};
@@ -87,6 +87,8 @@ pub const DEFAULT_BASE_FEE_PER_GAS: u128 = 15_000_000;
8787
parameter_types! {
8888
// We allow for a 75% fullness of a 0.5s block
8989
pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS);
90+
// Fallback to BlockGasLimit
91+
pub TransactionGasLimit: Option<U256> = None;
9092

9193
pub PrecompilesValue: precompiles::HydraDXPrecompiles<Runtime> = precompiles::HydraDXPrecompiles::<_>::new();
9294
pub WeightPerGas: Weight = Weight::from_parts(WEIGHT_PER_GAS, 0);
@@ -189,6 +191,7 @@ impl pallet_evm::Config for Runtime {
189191
type PrecompilesValue = PrecompilesValue;
190192
type ChainId = crate::EVMChainId;
191193
type BlockGasLimit = BlockGasLimit;
194+
type TransactionGasLimit = TransactionGasLimit;
192195
type Runner = WrapRunner<
193196
Self,
194197
pallet_evm::runner::stack::Runner<Self>, // Evm runner that we wrap
@@ -225,6 +228,7 @@ impl pallet_ethereum::Config for Runtime {
225228
type StateRoot = pallet_ethereum::IntermediateStateRoot<Self::Version>;
226229
type PostLogContent = PostLogContent;
227230
type ExtraDataLength = sp_core::ConstU32<1>;
231+
type AllowUnprotectedTxs = ConstBool<false>;
228232
}
229233

230234
pub struct EvmNonceProvider;

runtime/hydradx/src/evm/permit.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ where
115115
validate,
116116
None,
117117
None,
118+
None,
118119
<R as pallet_evm::Config>::config(),
119120
) {
120121
Ok(info) => info,

runtime/hydradx/src/evm/runner.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
use crate::evm::evm_fee::evm_fee_payer;
2727
use crate::evm::WethAssetId;
2828
use ethereum::AuthorizationList;
29-
use fp_evm::{Account, TransactionValidationError};
29+
use fp_evm::{Account, StateOverride, TransactionValidationError};
3030
use frame_support::traits::Get;
3131
use hydradx_traits::AccountFeeCurrencyBalanceInCurrency;
3232
use pallet_evm::runner::Runner;
@@ -89,9 +89,11 @@ where
8989
fp_evm::CheckEvmTransactionConfig {
9090
evm_config,
9191
block_gas_limit: T::BlockGasLimit::get(),
92+
transaction_gas_limit: T::TransactionGasLimit::get(),
9293
base_fee,
9394
chain_id: T::ChainId::get(),
9495
is_transactional,
96+
allow_unprotected_txs: false,
9597
},
9698
fp_evm::CheckEvmTransactionInput {
9799
chain_id: Some(T::ChainId::get()),
@@ -131,6 +133,7 @@ where
131133
validate: bool,
132134
weight_limit: Option<Weight>,
133135
proof_size_base_cost: Option<u64>,
136+
state_override: StateOverride,
134137
config: &evm::Config,
135138
) -> Result<CallInfo, RunnerError<Self::Error>> {
136139
if validate {
@@ -171,6 +174,7 @@ where
171174
false,
172175
weight_limit,
173176
proof_size_base_cost,
177+
state_override,
174178
config,
175179
)?;
176180

runtime/hydradx/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,7 @@ impl_runtime_apis! {
781781
estimate: bool,
782782
access_list: Option<Vec<(H160, Vec<H256>)>>,
783783
authorization_list: Option<AuthorizationList>,
784+
state_override: fp_evm::StateOverride,
784785
) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {
785786
let mut config = <Runtime as pallet_evm::Config>::config().clone();
786787
config.estimate = estimate;
@@ -839,6 +840,7 @@ impl_runtime_apis! {
839840
validate,
840841
weight_limit,
841842
proof_size_base_cost,
843+
state_override,
842844
&config,
843845
)
844846
.map_err(|err| err.error.into())

0 commit comments

Comments
 (0)