Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
add gateway to storage
Browse files Browse the repository at this point in the history
  • Loading branch information
alistair-singh committed Dec 14, 2023
1 parent f8aaa4b commit f65cb1f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ impl pallet_utility::Config for Runtime {

parameter_types! {
pub const Reward: u128 = 10;
pub const GatewayAddress: H160 = H160(hex_literal::hex!("EDa338E4dC46038493b885327842fD3E301CaB39"));
pub storage EthereumGatewayAddress: H160 = H160(hex_literal::hex!("EDa338E4dC46038493b885327842fD3E301CaB39"));
pub const CreateAssetCall: [u8;2] = [53, 0];
pub const CreateAssetDeposit: u128 = (UNITS / 10) + EXISTENTIAL_DEPOSIT;
pub const InboundQueuePalletInstance: u8 = snowbridge_rococo_common::INBOUND_QUEUE_MESSAGES_PALLET_INDEX;
Expand All @@ -529,7 +529,7 @@ impl snowbridge_inbound_queue::Config for Runtime {
#[cfg(feature = "runtime-benchmarks")]
type XcmSender = DoNothingRouter;
type ChannelLookup = EthereumSystem;
type GatewayAddress = GatewayAddress;
type GatewayAddress = EthereumGatewayAddress;
#[cfg(feature = "runtime-benchmarks")]
type Helper = Runtime;
type MessageConverter = MessageToXcm<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ use super::{
ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin,
TransactionByteFee, WeightToFee, XcmpQueue,
};
use crate::bridge_common_config::{
BridgeGrandpaWestendInstance, DeliveryRewardInBalance, RequiredStakeForStakeAndSlash,
use crate::{
bridge_common_config::{
BridgeGrandpaWestendInstance, DeliveryRewardInBalance, RequiredStakeForStakeAndSlash,
},
EthereumGatewayAddress,
};
use bp_messages::LaneId;
use bp_relayers::{PayRewardFromAccount, RewardsAccountOwner, RewardsAccountParams};
Expand Down Expand Up @@ -156,7 +159,8 @@ impl Contains<RuntimeCall> for SafeCallFilter {
RuntimeCall::System(frame_system::Call::set_storage { items })
if items.iter().all(|(k, _)| {
k.eq(&DeliveryRewardInBalance::key()) |
k.eq(&RequiredStakeForStakeAndSlash::key())
k.eq(&RequiredStakeForStakeAndSlash::key()) |
k.eq(&EthereumGatewayAddress::key())
}) =>
return true,
_ => (),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ use bp_polkadot_core::Signature;
use bridge_hub_rococo_runtime::{
bridge_common_config, bridge_to_westend_config,
xcm_config::{RelayNetwork, TokenLocation, XcmConfig},
AllPalletsWithoutSystem, BridgeRejectObsoleteHeadersAndMessages, Executive, ExistentialDeposit,
ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, SessionKeys, SignedExtra,
TransactionPayment, UncheckedExtrinsic,
AllPalletsWithoutSystem, BridgeRejectObsoleteHeadersAndMessages, EthereumGatewayAddress,
Executive, ExistentialDeposit, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall,
RuntimeEvent, SessionKeys, SignedExtra, TransactionPayment, UncheckedExtrinsic,
};
use codec::{Decode, Encode};
use frame_support::{dispatch::GetDispatchInfo, parameter_types};
use frame_system::pallet_prelude::HeaderFor;
use parachains_common::{rococo::fee::WeightToFee, AccountId, AuraId, Balance};
use sp_core::H160;
use sp_keyring::AccountKeyring::Alice;
use sp_runtime::{
generic::{Era, SignedPayload},
Expand Down Expand Up @@ -139,6 +140,21 @@ mod bridge_hub_rococo_tests {
)
}

#[test]
fn change_ethereum_gateway_by_governance_works() {
bridge_hub_test_utils::test_cases::change_storage_constant_by_governance_works::<
Runtime,
EthereumGatewayAddress,
H160,
>(
collator_session_keys(),
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
Box::new(|call| RuntimeCall::System(call).encode()),
|| (EthereumGatewayAddress::key().to_vec(), EthereumGatewayAddress::get()),
|_| H160::default(),
)
}

#[test]
fn change_delivery_reward_by_governance_works() {
bridge_hub_test_utils::test_cases::change_storage_constant_by_governance_works::<
Expand Down

0 comments on commit f65cb1f

Please sign in to comment.