Precompiles (#201)

* Moved PR to monorepo

* Update evm-template/runtime/src/lib.rs

Co-authored-by: Amar Singh <asinghchrony@protonmail.com>

* minimal precompile config

* try fix remaining merge conflicts by accepting all incoming

* into merge again

* clippy fix

* use workspace dep as per suggestion

* try fix

* insert revert bytecode in evm account storage at genesis for precompile addresses

* toml sort

---------

Co-authored-by: Nikita Khateev <nikita.khateev@openzeppelin.com>
This commit is contained in:
Amar Singh
2024-05-31 16:04:14 -04:00
committed by GitHub
parent dc4f0129f1
commit 7b1388b15c
8 changed files with 176 additions and 56 deletions
+7 -8
View File
@@ -63,10 +63,10 @@ use crate::{
Nonce,
},
weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},
Aura, Balances, BaseFee, CollatorSelection, EVMChainId, MessageQueue, OriginCaller, PalletInfo,
ParachainSystem, Preimage, Runtime, RuntimeCall, RuntimeEvent, RuntimeFreezeReason,
RuntimeHoldReason, RuntimeOrigin, RuntimeTask, Session, SessionKeys, System, Timestamp,
Treasury, UncheckedExtrinsic, WeightToFee, XcmpQueue,
Aura, Balances, BaseFee, CollatorSelection, EVMChainId, MessageQueue, OpenZeppelinPrecompiles,
OriginCaller, PalletInfo, ParachainSystem, Preimage, Runtime, RuntimeCall, RuntimeEvent,
RuntimeFreezeReason, RuntimeHoldReason, RuntimeOrigin, RuntimeTask, Session, SessionKeys,
System, Timestamp, Treasury, UncheckedExtrinsic, WeightToFee, XcmpQueue,
};
parameter_types! {
@@ -604,6 +604,7 @@ impl pallet_ethereum::Config for Runtime {
parameter_types! {
pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS);
pub GasLimitPovSizeRatio: u64 = BlockGasLimit::get().as_u64().saturating_div(MAX_POV_SIZE);
pub PrecompilesValue: OpenZeppelinPrecompiles<Runtime> = OpenZeppelinPrecompiles::<_>::new();
pub WeightPerGas: Weight = Weight::from_parts(WEIGHT_PER_GAS, 0);
pub SuicideQuickClearLimit: u32 = 0;
}
@@ -621,10 +622,8 @@ impl pallet_evm::Config for Runtime {
type GasWeightMapping = pallet_evm::FixedGasWeightMapping<Self>;
type OnChargeTransaction = EVMCurrencyAdapter<Balances, ()>;
type OnCreate = ();
// FIXME: Will be implemented in #11
type PrecompilesType = ();
// FIXME: Will be implemented in #11
type PrecompilesValue = ();
type PrecompilesType = OpenZeppelinPrecompiles<Self>;
type PrecompilesValue = PrecompilesValue;
type Runner = pallet_evm::runner::stack::Runner<Self>;
type RuntimeEvent = RuntimeEvent;
type SuicideQuickClearLimit = SuicideQuickClearLimit;