Skip to content

Commit

Permalink
add comments and feature flags
Browse files Browse the repository at this point in the history
  • Loading branch information
gitofdeepanshu committed Sep 20, 2023
1 parent 2854089 commit e8dd394
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions primitives/src/precompiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use frame_support::{
};
use pallet_evm_precompile_dispatch::DispatchValidateT;

/// Struct that blocks all runtime calls to Dispatch Precompile
pub struct BlockAllDispatchValidate;

/// The default implementation of `DispatchValidateT`.
Expand All @@ -43,6 +44,8 @@ impl<AccountId, RuntimeCall> DispatchValidateT<AccountId, RuntimeCall>
}
}

/// Struct that allows only whitelisted runtime calls to pass through dispatch precompile,
/// Whitelisted calls are defined in runtime
pub struct DispatchFilterValidate<RuntimeCall, Filter: InstanceFilter<RuntimeCall> + Default>(
PhantomData<(RuntimeCall, Filter)>,
);
Expand Down
1 change: 1 addition & 0 deletions runtime/astar/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,7 @@ impl pallet_xc_asset_config::Config for Runtime {
type WeightInfo = pallet_xc_asset_config::weights::SubstrateWeight<Self>;
}

/// Filter that only allows whitelisted runtime call to pass through dispatch precompile
#[derive(Default)]
pub struct DispatchPrecompileFilter;

Expand Down
1 change: 1 addition & 0 deletions runtime/local/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,7 @@ impl pallet_sudo::Config for Runtime {
type WeightInfo = pallet_sudo::weights::SubstrateWeight<Runtime>;
}

/// Filter that only allows whitelisted runtime call to pass through dispatch precompile
#[derive(Default)]
pub struct DispatchPrecompileFilter;

Expand Down
2 changes: 2 additions & 0 deletions runtime/shibuya/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,8 @@ impl pallet_sudo::Config for Runtime {
type RuntimeCall = RuntimeCall;
type WeightInfo = pallet_sudo::weights::SubstrateWeight<Runtime>;
}

/// Filter that only allows whitelisted runtime call to pass through dispatch precompile
#[derive(Default)]
pub struct DispatchPrecompileFilter;

Expand Down
1 change: 1 addition & 0 deletions runtime/shiden/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,7 @@ impl pallet_xc_asset_config::Config for Runtime {
type WeightInfo = pallet_xc_asset_config::weights::SubstrateWeight<Self>;
}

/// Filter that only allows whitelisted runtime call to pass through dispatch precompile
#[derive(Default)]
pub struct DispatchPrecompileFilter;

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ mod assets;
#[cfg(feature = "shibuya")]
mod xvm;

#[cfg(feature = "shibuya")]
#[cfg(any(feature = "shibuya", feature = "shiden", feature = "astar"))]
mod dispatch_filter;

0 comments on commit e8dd394

Please sign in to comment.