Skip to content

Commit

Permalink
Clean: Remove unused gateway origin (#1976)
Browse files Browse the repository at this point in the history
* remove unused gateway origin

* fix: reanchor submodule to 6e8f1a29dff0d7cf5ff74285cfffadae8a8b303f

---------

Co-authored-by: William Freudenberger <[email protected]>
  • Loading branch information
lemunozm and wischli authored Aug 18, 2024
1 parent 7126ef9 commit c55e74f
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 70 deletions.
20 changes: 2 additions & 18 deletions pallets/liquidity-pools-gateway/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,15 @@ use crate::{
weights::WeightInfo,
};

mod origin;
pub use origin::*;

pub mod message;

pub mod weights;

mod message_processing;

#[cfg(test)]
mod mock;

mod message_processing;
#[cfg(test)]
mod tests;

Expand All @@ -74,25 +72,11 @@ pub mod pallet {
#[pallet::storage_version(STORAGE_VERSION)]
pub struct Pallet<T>(_);

#[pallet::origin]
pub type Origin = GatewayOrigin;

#[pallet::config]
pub trait Config: frame_system::Config {
/// The origin type.
type RuntimeOrigin: Into<Result<GatewayOrigin, <Self as frame_system::Config>::RuntimeOrigin>>
+ From<GatewayOrigin>;

/// The event type.
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;

/// The LocalOrigin ensures that some calls can only be performed from a
/// local context i.e. a different pallet.
type LocalEVMOrigin: EnsureOrigin<
<Self as frame_system::Config>::RuntimeOrigin,
Success = GatewayOrigin,
>;

/// The AdminOrigin ensures that some calls can only be performed by
/// admins.
type AdminOrigin: EnsureOrigin<<Self as frame_system::Config>::RuntimeOrigin>;
Expand Down
4 changes: 1 addition & 3 deletions pallets/liquidity-pools-gateway/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use scale_info::TypeInfo;
use sp_core::{crypto::AccountId32, H160};
use sp_runtime::{traits::IdentityLookup, DispatchError, DispatchResult};

use crate::{pallet as pallet_liquidity_pools_gateway, EnsureLocal, GatewayMessage};
use crate::{pallet as pallet_liquidity_pools_gateway, GatewayMessage};

pub const TEST_SESSION_ID: u32 = 1;
pub const TEST_EVM_CHAIN: EVMChainId = 1;
Expand Down Expand Up @@ -202,7 +202,6 @@ frame_support::parameter_types! {
impl pallet_liquidity_pools_gateway::Config for Runtime {
type AdminOrigin = EnsureRoot<AccountId32>;
type InboundMessageHandler = MockLiquidityPools;
type LocalEVMOrigin = EnsureLocal;
type MaxIncomingMessageSize = MaxIncomingMessageSize;
type MaxRouterCount = MaxRouterCount;
type Message = Message;
Expand All @@ -211,7 +210,6 @@ impl pallet_liquidity_pools_gateway::Config for Runtime {
type RouterId = RouterId;
type RouterProvider = TestRouterProvider;
type RuntimeEvent = RuntimeEvent;
type RuntimeOrigin = RuntimeOrigin;
type Sender = Sender;
type SessionId = u32;
type WeightInfo = ();
Expand Down
37 changes: 0 additions & 37 deletions pallets/liquidity-pools-gateway/src/origin.rs

This file was deleted.

4 changes: 1 addition & 3 deletions runtime/altair/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1775,7 +1775,6 @@ parameter_types! {
impl pallet_liquidity_pools_gateway::Config for Runtime {
type AdminOrigin = EnsureRoot<AccountId>;
type InboundMessageHandler = LiquidityPools;
type LocalEVMOrigin = pallet_liquidity_pools_gateway::EnsureLocal;
type MaxIncomingMessageSize = MaxIncomingMessageSize;
type MaxRouterCount = MaxRouterCount;
type Message = pallet_liquidity_pools::Message;
Expand All @@ -1784,7 +1783,6 @@ impl pallet_liquidity_pools_gateway::Config for Runtime {
type RouterId = RouterId;
type RouterProvider = LPGatewayRouterProvider;
type RuntimeEvent = RuntimeEvent;
type RuntimeOrigin = RuntimeOrigin;
type Sender = Sender;
type SessionId = LPGatewaySessionId;
type WeightInfo = ();
Expand Down Expand Up @@ -2096,7 +2094,7 @@ construct_runtime!(
BlockRewards: pallet_block_rewards::{Pallet, Call, Storage, Event<T>, Config<T>} = 105,
Keystore: pallet_keystore::{Pallet, Call, Storage, Event<T>} = 106,
LiquidityPools: pallet_liquidity_pools::{Pallet, Call, Storage, Event<T>} = 108,
LiquidityPoolsGateway: pallet_liquidity_pools_gateway::{Pallet, Call, Storage, Event<T>, Origin } = 109,
LiquidityPoolsGateway: pallet_liquidity_pools_gateway::{Pallet, Call, Storage, Event<T> } = 109,
LiquidityRewardsBase: pallet_rewards::<Instance2>::{Pallet, Storage, Event<T>, Config<T>} = 110,
LiquidityRewards: pallet_liquidity_rewards::{Pallet, Call, Storage, Event<T>} = 111,
GapRewardMechanism: pallet_rewards::mechanism::gap = 112,
Expand Down
4 changes: 1 addition & 3 deletions runtime/centrifuge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1874,7 +1874,6 @@ parameter_types! {
impl pallet_liquidity_pools_gateway::Config for Runtime {
type AdminOrigin = EnsureAccountOrRootOr<LpAdminAccount, TwoThirdOfCouncil>;
type InboundMessageHandler = LiquidityPools;
type LocalEVMOrigin = pallet_liquidity_pools_gateway::EnsureLocal;
type MaxIncomingMessageSize = MaxIncomingMessageSize;
type MaxRouterCount = MaxRouterCount;
type Message = pallet_liquidity_pools::Message;
Expand All @@ -1883,7 +1882,6 @@ impl pallet_liquidity_pools_gateway::Config for Runtime {
type RouterId = RouterId;
type RouterProvider = LPGatewayRouterProvider;
type RuntimeEvent = RuntimeEvent;
type RuntimeOrigin = RuntimeOrigin;
type Sender = Sender;
type SessionId = LPGatewaySessionId;
type WeightInfo = ();
Expand Down Expand Up @@ -2099,7 +2097,7 @@ construct_runtime!(
LiquidityRewardsBase: pallet_rewards::<Instance2>::{Pallet, Storage, Event<T>, Config<T>} = 104,
LiquidityRewards: pallet_liquidity_rewards::{Pallet, Call, Storage, Event<T>} = 105,
GapRewardMechanism: pallet_rewards::mechanism::gap = 106,
LiquidityPoolsGateway: pallet_liquidity_pools_gateway::{Pallet, Call, Storage, Event<T>, Origin } = 107,
LiquidityPoolsGateway: pallet_liquidity_pools_gateway::{Pallet, Call, Storage, Event<T> } = 107,
OrderBook: pallet_order_book::{Pallet, Call, Storage, Event<T>} = 108,
ForeignInvestments: pallet_foreign_investments::{Pallet, Storage, Event<T>} = 109,
TransferAllowList: pallet_transfer_allowlist::{Pallet, Call, Storage, Event<T>, HoldReason} = 110,
Expand Down
4 changes: 1 addition & 3 deletions runtime/development/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1880,7 +1880,6 @@ parameter_types! {
impl pallet_liquidity_pools_gateway::Config for Runtime {
type AdminOrigin = EnsureRootOr<HalfOfCouncil>;
type InboundMessageHandler = LiquidityPools;
type LocalEVMOrigin = pallet_liquidity_pools_gateway::EnsureLocal;
type MaxIncomingMessageSize = MaxIncomingMessageSize;
type MaxRouterCount = MaxRouterCount;
type Message = pallet_liquidity_pools::Message;
Expand All @@ -1889,7 +1888,6 @@ impl pallet_liquidity_pools_gateway::Config for Runtime {
type RouterId = RouterId;
type RouterProvider = LPGatewayRouterProvider;
type RuntimeEvent = RuntimeEvent;
type RuntimeOrigin = RuntimeOrigin;
type Sender = Sender;
type SessionId = LPGatewaySessionId;
type WeightInfo = ();
Expand Down Expand Up @@ -2207,7 +2205,7 @@ construct_runtime!(
BlockRewards: pallet_block_rewards::{Pallet, Call, Storage, Event<T>, Config<T>} = 111,
TransferAllowList: pallet_transfer_allowlist::{Pallet, Call, Storage, Event<T>, HoldReason} = 112,
GapRewardMechanism: pallet_rewards::mechanism::gap = 114,
LiquidityPoolsGateway: pallet_liquidity_pools_gateway::{Pallet, Call, Storage, Event<T>, Origin } = 115,
LiquidityPoolsGateway: pallet_liquidity_pools_gateway::{Pallet, Call, Storage, Event<T> } = 115,
OrderBook: pallet_order_book::{Pallet, Call, Storage, Event<T>} = 116,
ForeignInvestments: pallet_foreign_investments::{Pallet, Storage, Event<T>} = 117,
OraclePriceFeed: pallet_oracle_feed::{Pallet, Call, Storage, Event<T>} = 118,
Expand Down
3 changes: 1 addition & 2 deletions runtime/integration-tests/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,7 @@ pub trait Runtime:
+ Clone
+ OriginTrait<Call = <Self as frame_system::Config>::RuntimeCall, AccountId = AccountId>
+ From<pallet_ethereum::RawOrigin>
+ Into<Result<pallet_ethereum::Origin, <Self as frame_system::Config>::RuntimeOrigin>>
+ From<pallet_liquidity_pools_gateway::GatewayOrigin>;
+ Into<Result<pallet_ethereum::Origin, <Self as frame_system::Config>::RuntimeOrigin>>;

/// Block used by the runtime
type BlockExt: Block<
Expand Down
2 changes: 1 addition & 1 deletion runtime/integration-tests/submodules/liquidity-pools
Submodule liquidity-pools updated 1 files
+1 −1 README.md

0 comments on commit c55e74f

Please sign in to comment.