Skip to content
Merged
9 changes: 4 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions bridges/snowbridge/pallets/ethereum-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,13 @@ pallet-timestamp = { optional = true, workspace = true }
snowbridge-beacon-primitives = { workspace = true }
snowbridge-core = { workspace = true }
snowbridge-ethereum = { workspace = true }
snowbridge-inbound-queue-primitives = { workspace = true }
snowbridge-pallet-ethereum-client-fixtures = { optional = true, workspace = true }
snowbridge-verification-primitives = { workspace = true }
static_assertions = { workspace = true }

[dev-dependencies]
hex-literal = { workspace = true, default-features = true }
pallet-timestamp = { workspace = true, default-features = true }
rand = { workspace = true, default-features = true }
serde = { workspace = true, default-features = true }
serde_json = { workspace = true, default-features = true }
snowbridge-pallet-ethereum-client-fixtures = { workspace = true, default-features = true }
Expand All @@ -64,8 +63,8 @@ std = [
"snowbridge-beacon-primitives/std",
"snowbridge-core/std",
"snowbridge-ethereum/std",
"snowbridge-inbound-queue-primitives/std",
"snowbridge-pallet-ethereum-client-fixtures/std",
"snowbridge-verification-primitives/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
Expand All @@ -79,7 +78,6 @@ runtime-benchmarks = [
"hex-literal",
"pallet-timestamp?/runtime-benchmarks",
"snowbridge-core/runtime-benchmarks",
"snowbridge-inbound-queue-primitives/runtime-benchmarks",
"snowbridge-pallet-ethereum-client-fixtures/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exclude-from-umbrella = true
hex-literal = { workspace = true, default-features = true }
snowbridge-beacon-primitives = { workspace = true }
snowbridge-core = { workspace = true }
snowbridge-inbound-queue-primitives = { workspace = true }
snowbridge-verification-primitives = { workspace = true }
sp-core = { workspace = true }
sp-std = { workspace = true }

Expand All @@ -30,11 +30,10 @@ default = ["std"]
std = [
"snowbridge-beacon-primitives/std",
"snowbridge-core/std",
"snowbridge-inbound-queue-primitives/std",
"snowbridge-verification-primitives/std",
"sp-core/std",
"sp-std/std",
]
runtime-benchmarks = [
"snowbridge-core/runtime-benchmarks",
"snowbridge-inbound-queue-primitives/runtime-benchmarks",
]
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use snowbridge_beacon_primitives::{
types::deneb, AncestryProof, BeaconHeader, ExecutionProof, NextSyncCommitteeUpdate,
SyncAggregate, SyncCommittee, VersionedExecutionPayloadHeader,
};
use snowbridge_inbound_queue_primitives::{EventProof, InboundQueueFixture, Log, Proof};
use snowbridge_verification_primitives::{EventFixture, EventProof, Log, Proof};
use sp_core::U256;
use sp_std::{boxed::Box, vec};

Expand Down Expand Up @@ -1225,8 +1225,8 @@ pub fn make_execution_proof() -> Box<ExecutionProof> {
})
}

pub fn make_inbound_fixture() -> InboundQueueFixture {
InboundQueueFixture {
pub fn make_inbound_fixture() -> EventFixture {
EventFixture {
event: EventProof {
event_log: Log {
address: hex!("eda338e4dc46038493b885327842fd3e301cab39").into(),
Expand Down
4 changes: 2 additions & 2 deletions bridges/snowbridge/pallets/ethereum-client/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use snowbridge_beacon_primitives::ExecutionProof;

use snowbridge_beacon_primitives::merkle_proof::{generalized_index_length, subtree_index};
use snowbridge_ethereum::Receipt;
use snowbridge_inbound_queue_primitives::{
use snowbridge_verification_primitives::{
VerificationError::{self, *},
*,
Verifier, *,
};

impl<T: Config> Verifier for Pallet<T> {
Expand Down
2 changes: 1 addition & 1 deletion bridges/snowbridge/pallets/ethereum-client/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::config;
use frame_support::{derive_impl, dispatch::DispatchResult, parameter_types};
use pallet_timestamp;
use snowbridge_beacon_primitives::{Fork, ForkVersions};
use snowbridge_inbound_queue_primitives::{Log, Proof};
use snowbridge_verification_primitives::{Log, Proof};
use sp_std::default::Default;
use std::{fs::File, path::PathBuf};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::config;
use frame_support::{derive_impl, dispatch::DispatchResult, parameter_types};
use pallet_timestamp;
use snowbridge_beacon_primitives::{Fork, ForkVersions};
use snowbridge_inbound_queue_primitives::{Log, Proof};
use snowbridge_verification_primitives::{Log, Proof};
use sp_std::default::Default;
use std::{fs::File, path::PathBuf};

Expand Down
2 changes: 1 addition & 1 deletion bridges/snowbridge/pallets/ethereum-client/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use snowbridge_beacon_primitives::{
types::deneb,
Fork, ForkVersions, NextSyncCommitteeUpdate, VersionedExecutionPayloadHeader,
};
use snowbridge_inbound_queue_primitives::{VerificationError, Verifier};
use snowbridge_verification_primitives::{VerificationError, Verifier};
use sp_core::H256;
use sp_runtime::DispatchError;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use snowbridge_beacon_primitives::{
types::deneb,
Fork, ForkVersions, NextSyncCommitteeUpdate, VersionedExecutionPayloadHeader,
};
use snowbridge_inbound_queue_primitives::{VerificationError, Verifier};
use snowbridge_verification_primitives::{VerificationError, Verifier};
use sp_core::H256;
use sp_runtime::DispatchError;

Expand Down
3 changes: 0 additions & 3 deletions bridges/snowbridge/pallets/inbound-queue-v2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ bp-relayers = { workspace = true }
frame-benchmarking = { workspace = true, default-features = true }
hex = { workspace = true, default-features = true }
hex-literal = { workspace = true, default-features = true }
snowbridge-pallet-ethereum-client = { workspace = true, default-features = true }
snowbridge-test-utils = { workspace = true }
sp-keyring = { workspace = true, default-features = true }

Expand Down Expand Up @@ -89,7 +88,6 @@ runtime-benchmarks = [
"pallet-balances/runtime-benchmarks",
"snowbridge-core/runtime-benchmarks",
"snowbridge-inbound-queue-primitives/runtime-benchmarks",
"snowbridge-pallet-ethereum-client/runtime-benchmarks",
"snowbridge-pallet-inbound-queue-v2-fixtures/runtime-benchmarks",
"snowbridge-test-utils/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
Expand All @@ -101,6 +99,5 @@ try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-balances/try-runtime",
"snowbridge-pallet-ethereum-client/try-runtime",
"sp-runtime/try-runtime",
]
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ use hex_literal::hex;
use snowbridge_beacon_primitives::{
types::deneb, AncestryProof, BeaconHeader, ExecutionProof, VersionedExecutionPayloadHeader,
};
use snowbridge_inbound_queue_primitives::{EventProof, InboundQueueFixture, Log, Proof};
use snowbridge_inbound_queue_primitives::{EventFixture, EventProof, Log, Proof};
use sp_core::U256;
use sp_std::vec;

pub fn make_register_token_message() -> InboundQueueFixture {
InboundQueueFixture {
pub fn make_register_token_message() -> EventFixture {
EventFixture {
event: EventProof {
event_log: Log {
address: hex!("b1185ede04202fe62d38f5db72f71e38ff3e8305").into(),
Expand Down
29 changes: 8 additions & 21 deletions bridges/snowbridge/pallets/inbound-queue-v2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ mod mock;
mod test;

pub use crate::weights::WeightInfo;
use frame_support::{
traits::{
fungible::{Inspect, Mutate},
tokens::Balance,
},
weights::WeightToFee,
};
use frame_system::ensure_signed;
use snowbridge_core::{
sparse_bitmap::{SparseBitmap, SparseBitmapImpl},
Expand All @@ -66,8 +59,6 @@ pub use pallet::*;
pub const LOG_TARGET: &str = "snowbridge-pallet-inbound-queue-v2";

pub type AccountIdOf<T> = <T as frame_system::Config>::AccountId;
type BalanceOf<T> =
<<T as pallet::Config>::Token as Inspect<<T as frame_system::Config>::AccountId>>::Balance;

pub type Nonce<T> = SparseBitmapImpl<crate::NonceBitmap<T>>;

Expand Down Expand Up @@ -95,8 +86,6 @@ pub mod pallet {
type XcmSender: SendXcm;
/// Handler for XCM fees.
type XcmExecutor: ExecuteXcm<Self::RuntimeCall>;
/// Ethereum NetworkId
type EthereumNetwork: Get<NetworkId>;
/// Address of the Gateway contract.
#[pallet::constant]
type GatewayAddress: Get<H160>;
Expand All @@ -106,21 +95,16 @@ pub mod pallet {
type MessageConverter: ConvertMessage;
#[cfg(feature = "runtime-benchmarks")]
type Helper: BenchmarkHelper<Self>;
/// Used for the dry run API implementation.
type Balance: Balance + From<u128>;
/// Reward discriminator type.
type RewardKind: Parameter + MaxEncodedLen + Send + Sync + Copy + Clone;
/// The default RewardKind discriminator for rewards allocated to relayers from this pallet.
#[pallet::constant]
type DefaultRewardKind: Get<Self::RewardKind>;
/// Relayer reward payment.
type RewardPayment: RewardLedger<Self::AccountId, Self::RewardKind, u128>;
type WeightInfo: WeightInfo;
/// Convert a weight value into deductible balance type.
type WeightToFee: WeightToFee<Balance = BalanceOf<Self>>;
type Token: Mutate<Self::AccountId> + Inspect<Self::AccountId>;
/// AccountId to Location converter
type AccountToLocation: for<'a> TryConvert<&'a Self::AccountId, Location>;
type WeightInfo: WeightInfo;
}

#[pallet::event]
Expand All @@ -135,8 +119,6 @@ pub mod pallet {
},
/// Set OperatingMode
OperatingModeChanged { mode: BasicOperatingMode },
/// XCM delivery fees were paid.
FeesPaid { paying: Location, fees: Assets },
}

#[pallet::error]
Expand Down Expand Up @@ -264,7 +246,13 @@ pub mod pallet {
})?;

// Pay relayer reward
T::RewardPayment::register_reward(&relayer, T::DefaultRewardKind::get(), relayer_fee);
if !relayer_fee.is_zero() {
T::RewardPayment::register_reward(
&relayer,
T::DefaultRewardKind::get(),
relayer_fee,
);
}

// Mark message as received
Nonce::<T>::set(nonce.into());
Expand Down Expand Up @@ -296,7 +284,6 @@ pub mod pallet {
);
SendError::Fees
})?;
Self::deposit_event(Event::FeesPaid { paying: fee_payer, fees: fee });
T::XcmSender::deliver(ticket)
}
}
Expand Down
Loading
Loading