Skip to content

Commit

Permalink
Rename NativeSystemAccountProvider to FrameSystemAccountProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
MOZGIII committed Sep 11, 2024
1 parent 995a3a7 commit 5daaffe
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion frame/ethereum/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ parameter_types! {
}

impl pallet_evm::Config for Test {
type AccountProvider = pallet_evm::NativeSystemAccountProvider<Self>;
type AccountProvider = pallet_evm::FrameSystemAccountProvider<Self>;
type FeeCalculator = FixedGasPrice;
type GasWeightMapping = pallet_evm::FixedGasWeightMapping<Self>;
type WeightPerGas = WeightPerGas;
Expand Down
2 changes: 1 addition & 1 deletion frame/evm/precompile/dispatch/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ parameter_types! {
pub SuicideQuickClearLimit: u32 = 0;
}
impl pallet_evm::Config for Test {
type AccountProvider = pallet_evm::NativeSystemAccountProvider<Self>;
type AccountProvider = pallet_evm::FrameSystemAccountProvider<Self>;
type FeeCalculator = FixedGasPrice;
type GasWeightMapping = pallet_evm::FixedGasWeightMapping<Self>;
type WeightPerGas = WeightPerGas;
Expand Down
2 changes: 1 addition & 1 deletion frame/evm/precompile/storage-cleaner/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ parameter_types! {
}

impl pallet_evm::Config for Runtime {
type AccountProvider = pallet_evm::NativeSystemAccountProvider<Self>;
type AccountProvider = pallet_evm::FrameSystemAccountProvider<Self>;
type FeeCalculator = ();
type GasWeightMapping = pallet_evm::FixedGasWeightMapping<Self>;
type WeightPerGas = WeightPerGas;
Expand Down
9 changes: 6 additions & 3 deletions frame/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1175,10 +1175,12 @@ impl<T> OnCreate<T> for Tuple {
}
}

/// Native system account provider that `frame_system` provides.
pub struct NativeSystemAccountProvider<T>(core::marker::PhantomData<T>);
/// EVM account provider based on the [`frame_system`] accounts.
///
/// Uses standard Substrate accounts system to hold EVM accounts.
pub struct FrameSystemAccountProvider<T>(core::marker::PhantomData<T>);

impl<T: frame_system::Config> AccountProvider for NativeSystemAccountProvider<T> {
impl<T: frame_system::Config> AccountProvider for FrameSystemAccountProvider<T> {
type AccountId = T::AccountId;
type Nonce = T::Nonce;

Expand All @@ -1193,6 +1195,7 @@ impl<T: frame_system::Config> AccountProvider for NativeSystemAccountProvider<T>
fn create_account(who: &Self::AccountId) {
let _ = frame_system::Pallet::<T>::inc_sufficients(who);
}

fn remove_account(who: &Self::AccountId) {
let _ = frame_system::Pallet::<T>::dec_sufficients(who);
}
Expand Down
2 changes: 1 addition & 1 deletion frame/evm/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ parameter_types! {
pub SuicideQuickClearLimit: u32 = 0;
}
impl crate::Config for Test {
type AccountProvider = crate::NativeSystemAccountProvider<Self>;
type AccountProvider = crate::FrameSystemAccountProvider<Self>;
type FeeCalculator = FixedGasPrice;
type GasWeightMapping = crate::FixedGasWeightMapping<Self>;
type WeightPerGas = WeightPerGas;
Expand Down
2 changes: 1 addition & 1 deletion precompiles/tests-external/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ parameter_types! {
}

impl pallet_evm::Config for Runtime {
type AccountProvider = pallet_evm::NativeSystemAccountProvider<Self>;
type AccountProvider = pallet_evm::FrameSystemAccountProvider<Self>;
type FeeCalculator = ();
type GasWeightMapping = pallet_evm::FixedGasWeightMapping<Self>;
type WeightPerGas = WeightPerGas;
Expand Down
2 changes: 1 addition & 1 deletion template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ parameter_types! {
}

impl pallet_evm::Config for Runtime {
type AccountProvider = pallet_evm::NativeSystemAccountProvider<Self>;
type AccountProvider = pallet_evm::FrameSystemAccountProvider<Self>;
type FeeCalculator = BaseFee;
type GasWeightMapping = pallet_evm::FixedGasWeightMapping<Self>;
type WeightPerGas = WeightPerGas;
Expand Down

0 comments on commit 5daaffe

Please sign in to comment.