Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d3976da
Substrate:Change min peers to start warp sync from 3 to 1
girazoki May 27, 2024
56de304
adapt xcm-emulator macros
Agusrodri Dec 21, 2023
c3a451d
add command PrecompileWasmCmd
librelois Sep 19, 2023
8db3a4a
snowbridge_pallet_outbound_queue: make it more generic
tmpolaczyk Nov 12, 2024
afab20b
pallet_inclusion: allow using generic AggregateMessageOrigin
tmpolaczyk Nov 12, 2024
7cf2af8
Add inbound queue (#4)
ParthDesai Nov 15, 2024
fc394d7
Add new commitment hook (#6)
ParthDesai Jan 8, 2025
636ba19
remove bandersnatch from sp-core
girazoki Jan 28, 2025
f5d5b91
Add reward processor in snowbridge inbound queue
dimartiro Feb 5, 2025
ebc9794
include fuzzing on mock_electra too
girazoki Feb 28, 2025
9627d90
Add possibility of executing or mocking additional inherents in xcm-e…
girazoki Jun 23, 2025
ee705fd
chore: Bump bounded-collections dep (#9004)
dimartiro Jul 1, 2025
25e6c3a
Re introduce snowbridge v1 removed extrinsics (#10)
dimartiro Jul 4, 2025
2cd5388
Improve inbound_queue benchmark helper (#9627)
dimartiro Jul 17, 2025
e12df2d
Fix compile errors in bridge hub benchmarks
tmpolaczyk Sep 18, 2025
1d3eaf6
xcm-emulator wrong imports
tmpolaczyk Sep 29, 2025
288914b
Fix pallet-revive-fixtures build script
tmpolaczyk Sep 30, 2025
43ed227
change back to have a consistent location to token id
girazoki Oct 1, 2025
7b7e7c5
[stable2509] Backport #9938 (#9954)
paritytech-release-backport-bot[bot] Oct 7, 2025
f8d4c8a
Revert "[stable2509] Backport #9938 (#9954)"
tmpolaczyk Oct 13, 2025
f9f50df
Tanssi polkadot stable2503 with fulu (#17)
ParthDesai Oct 13, 2025
6361642
consensus/grandpa: Fix high number of peer disconnects with invalid j…
lexnv Jul 22, 2025
f323fb0
Allow setting idle connection timeout value in custom node implementa…
dmitry-markin Jul 21, 2025
406a9bd
network/kad: Increase memory store capacity for providers (#9315)
dmitry-markin Jul 28, 2025
0fe0581
Fix confusing log messages in network protocol behaviour (#8819)
teor2345 Jun 30, 2025
166f218
network: Upgrade litep2p to v0.10.0 (#9287)
dmitry-markin Jul 22, 2025
ebaa553
Upgrade litep2p 0.10.0 -> 0.11.0 (#10056)
dmitry-markin Oct 20, 2025
bd8cff5
Fix compilation with litep2p 0.11.0
tmpolaczyk Oct 29, 2025
a48ddc6
network/litep2p: Switch to system DNS resolver (#9321)
dmitry-markin Jul 25, 2025
cfb3a53
update imple-dns https://github.com/paritytech/litep2p/pull/470
girazoki Nov 11, 2025
7252f58
apply diegos changes https://github.com/paritytech/polkadot-sdk/pull/…
dimartiro Oct 27, 2025
4ad2ae8
Revert "pallet_inclusion: allow using generic AggregateMessageOrigin"
girazoki Nov 14, 2025
5780498
allow more generic origins in xcm-emulator message processor (#10158)
girazoki Nov 13, 2025
918889e
Revert "Substrate:Change min peers to start warp sync from 3 to 1"
tmpolaczyk Nov 3, 2025
515b0d0
Snowbridge: Refactor inbound message conversion (#9510)
yrong Sep 30, 2025
e26e857
Snowbridge Inbound Queue V2 relayer tip payout fix (#9746)
claravanstaden Sep 23, 2025
c8b5d97
https://github.com/paritytech/polkadot-sdk/pull/8175 by agus
girazoki Nov 3, 2025
53b5701
agus changes https://github.com/paritytech/polkadot-sdk/pull/8053
Agusrodri Sep 23, 2025
f504b17
modify about the cherry-pick double mapping foreignToNative
girazoki Nov 5, 2025
05bf9ff
Increase `max_upward_message_size` in `RelayStateSproofBuilder` (#10313)
Agusrodri Nov 14, 2025
438e465
modify message processor trait to return worst case weight + refund e…
ParthDesai Jan 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
753 changes: 489 additions & 264 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,10 @@ Inflector = { version = "0.11.4" }
aes-gcm = { version = "0.10" }
ahash = { version = "0.8.2" }
alloy-core = { version = "1.1.0", default-features = false }
# TODO: remove alloy-primitives and alloy-sol-types, they are re-exported in alloy-core
# but the version is different so it doesnt compile
alloy-primitives = { version = "0.4.2", default-features = false }
alloy-sol-types = { version = "0.4.2", default-features = false }
always-assert = { version = "0.1" }
anyhow = { version = "1.0.81", default-features = false }
approx = { version = "0.5.1" }
Expand All @@ -643,7 +647,6 @@ ark-ed-on-bls12-377-ext = { version = "0.4.1", default-features = false }
ark-ed-on-bls12-381-bandersnatch = { version = "0.4.0", default-features = false }
ark-ed-on-bls12-381-bandersnatch-ext = { version = "0.4.1", default-features = false }
ark-scale = { version = "0.0.12", default-features = false }
ark-vrf = { version = "0.1.0", default-features = false }
array-bytes = { version = "6.2.2", default-features = false }
arrayvec = { version = "0.7.4" }
assert_cmd = { version = "2.0.14" }
Expand Down Expand Up @@ -671,7 +674,7 @@ blake2 = { version = "0.10.4", default-features = false }
blake2b_simd = { version = "1.0.2", default-features = false }
blake3 = { version = "1.5" }
bn = { package = "substrate-bn", version = "0.6", default-features = false }
bounded-collections = { version = "0.2.3", default-features = false }
bounded-collections = { version = "0.3.2", default-features = false }
bounded-vec = { version = "0.7" }
bp-asset-hub-rococo = { path = "cumulus/parachains/runtimes/assets/asset-hub-rococo/bridge-primitives", default-features = false }
bp-asset-hub-westend = { path = "cumulus/parachains/runtimes/assets/asset-hub-westend/bridge-primitives", default-features = false }
Expand Down Expand Up @@ -892,7 +895,7 @@ linked-hash-map = { version = "0.5.4" }
linked_hash_set = { version = "0.1.4" }
linregress = { version = "0.5.1" }
lite-json = { version = "0.2.0", default-features = false }
litep2p = { version = "0.9.5", features = ["websocket"] }
litep2p = { git = "https://github.com/moondance-labs/litep2p", branch = "girazoki-simple-dns-update-2", features = ["rsa", "websocket"] }
log = { version = "0.4.22", default-features = false }
macro_magic = { version = "0.5.1" }
maplit = { version = "1.0.2" }
Expand Down Expand Up @@ -1499,7 +1502,6 @@ overflow-checks = true
#
# This list is ordered alphabetically.
[profile.dev.package]
ark-vrf = { opt-level = 3 }
blake2 = { opt-level = 3 }
blake2b_simd = { opt-level = 3 }
chacha20poly1305 = { opt-level = 3 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,9 @@ trait JustificationVerifier<Header: HeaderT> {
justification.round,
context.authority_set_id,
&mut signature_buffer,
) {
)
.is_valid()
{
self.process_invalid_signature_vote(precommit_idx).map_err(Error::Precommit)?;
continue
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ mod benchmarks {
capella: Fork { version: hex!("03000000"), epoch: 0 },
deneb: Fork { version: hex!("04000000"), epoch: 0 },
electra: Fork { version: hex!("05000000"), epoch: 80000000000 },
fulu: Fork { version: hex!("06000000"), epoch: 80000000001 },
};
let finalized_root_gindex = EthereumBeaconClient::<T>::finalized_root_gindex_at_slot(
update.attested_header.slot,
Expand Down
5 changes: 4 additions & 1 deletion bridges/snowbridge/pallets/ethereum-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub mod weights;
#[cfg(any(test, feature = "fuzzing"))]
pub mod mock;

#[cfg(test)]
#[cfg(any(test, feature = "fuzzing"))]
pub mod mock_electra;

#[cfg(test)]
Expand Down Expand Up @@ -633,6 +633,9 @@ pub mod pallet {

/// Returns the fork version based on the current epoch.
pub(super) fn select_fork_version(fork_versions: &ForkVersions, epoch: u64) -> ForkVersion {
if epoch >= fork_versions.fulu.epoch {
return fork_versions.fulu.version
}
if epoch >= fork_versions.electra.epoch {
return fork_versions.electra.version
}
Expand Down
19 changes: 12 additions & 7 deletions bridges/snowbridge/pallets/ethereum-client/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use snowbridge_beacon_primitives::{Fork, ForkVersions};
use snowbridge_verification_primitives::{Log, Proof};
use sp_std::default::Default;
use std::{fs::File, path::PathBuf};
use hex_literal::hex;

type Block = frame_system::mocking::MockBlock<Test>;
use frame_support::traits::ConstU32;
Expand Down Expand Up @@ -114,28 +115,32 @@ impl pallet_timestamp::Config for Test {
parameter_types! {
pub const ChainForkVersions: ForkVersions = ForkVersions {
genesis: Fork {
version: [0, 0, 0, 0], // 0x00000000
version: hex!("00000000"), // 0x00000000
epoch: 0,
},
altair: Fork {
version: [1, 0, 0, 0], // 0x01000000
version: hex!("01000000"), // 0x01000000
epoch: 0,
},
bellatrix: Fork {
version: [2, 0, 0, 0], // 0x02000000
version: hex!("02000000"), // 0x02000000
epoch: 0,
},
capella: Fork {
version: [3, 0, 0, 0], // 0x03000000
version: hex!("03000000"), // 0x03000000
epoch: 0,
},
deneb: Fork {
version: [4, 0, 0, 0], // 0x04000000
version: hex!("04000000"), // 0x04000000
epoch: 0,
},
electra: Fork {
version: [5, 0, 0, 0], // 0x05000000
epoch: 80000000000,
version: hex!("05000000"),
epoch: 0,
},
fulu: Fork {
version: hex!("06000000"),
epoch: 100000000,
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ parameter_types! {
electra: Fork {
version: [5, 0, 0, 0], // 0x05000000
epoch: 0,
},
fulu: Fork {
version: [6, 0, 0, 0],
epoch: 800000000000,
}
};
}
Expand Down
1 change: 1 addition & 0 deletions bridges/snowbridge/pallets/ethereum-client/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ fn compute_fork_version() {
capella: Fork { version: [0, 0, 0, 3], epoch: 30 },
deneb: Fork { version: [0, 0, 0, 4], epoch: 40 },
electra: Fork { version: [0, 0, 0, 5], epoch: 50 },
fulu: Fork { version: [0, 0, 0, 6], epoch: 60 },
};
new_tester().execute_with(|| {
assert_eq!(EthereumBeaconClient::select_fork_version(&mock_fork_versions, 0), [0, 0, 0, 0]);
Expand Down
10 changes: 7 additions & 3 deletions bridges/snowbridge/pallets/inbound-queue-v2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ log = { workspace = true }
pallet-balances.workspace = true
scale-info = { features = ["derive"], workspace = true }
serde = { optional = true, workspace = true, default-features = true }
snowbridge-beacon-primitives.workspace = true
snowbridge-core.workspace = true
snowbridge-inbound-queue-primitives.workspace = true

snowbridge-beacon-primitives = { workspace = true }
snowbridge-core = { workspace = true }
snowbridge-inbound-queue-primitives = { workspace = true }
snowbridge-pallet-inbound-queue-v2-fixtures = { optional = true, workspace = true }
sp-core.workspace = true
sp-io.workspace = true
Expand All @@ -47,6 +48,9 @@ hex-literal = { workspace = true, default-features = true }
snowbridge-test-utils = { workspace = true }
sp-keyring = { default-features = true, workspace = true }

xcm-builder = { workspace = true }
xcm-executor = { workspace = true }

[features]
default = ["std"]
std = [
Expand Down
98 changes: 28 additions & 70 deletions bridges/snowbridge/pallets/inbound-queue-v2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ mod test;
pub use crate::weights::WeightInfo;
use bp_relayers::RewardLedger;
use frame_system::ensure_signed;
use frame_support::dispatch::PostDispatchInfo;
use snowbridge_core::{
reward::{AddTip, AddTipError},
sparse_bitmap::{SparseBitmap, SparseBitmapImpl},
BasicOperatingMode,
};
use snowbridge_inbound_queue_primitives::{
v2::{ConvertMessage, ConvertMessageError, Message},
v2::{ConvertMessageError, Message, MessageProcessor, MessageProcessorError},
EventProof, VerificationError, Verifier,
};
use sp_core::H160;
use sp_runtime::traits::TryConvert;
use sp_std::prelude::*;
use xcm::prelude::{ExecuteXcm, Junction::*, Location, SendXcm, *};
#[cfg(feature = "runtime-benchmarks")]
use {snowbridge_beacon_primitives::BeaconHeader, sp_core::H256};
use xcm::latest::SendError;

pub use pallet::*;

Expand Down Expand Up @@ -83,17 +83,11 @@ pub mod pallet {
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// The verifier for inbound messages from Ethereum.
type Verifier: Verifier;
/// XCM message sender.
type XcmSender: SendXcm;
/// Handler for XCM fees.
type XcmExecutor: ExecuteXcm<Self::RuntimeCall>;
/// Address of the Gateway contract.
#[pallet::constant]
type GatewayAddress: Get<H160>;
/// AssetHub parachain ID.
type AssetHubParaId: Get<u32>;
/// Convert a command from Ethereum to an XCM message.
type MessageConverter: ConvertMessage;
/// Process the message that was submitted.
type MessageProcessor: MessageProcessor<Self::AccountId>;
#[cfg(feature = "runtime-benchmarks")]
type Helper: BenchmarkHelper<Self>;
/// Reward discriminator type.
Expand All @@ -103,8 +97,6 @@ pub mod pallet {
type DefaultRewardKind: Get<Self::RewardKind>;
/// Relayer reward payment.
type RewardPayment: RewardLedger<Self::AccountId, Self::RewardKind, u128>;
/// AccountId to Location converter
type AccountToLocation: for<'a> TryConvert<&'a Self::AccountId, Location>;
type WeightInfo: WeightInfo;
}

Expand All @@ -126,22 +118,10 @@ pub mod pallet {
pub enum Error<T> {
/// Message came from an invalid outbound channel on the Ethereum side.
InvalidGateway,
/// Account could not be converted to bytes
InvalidAccount,
/// Message has an invalid envelope.
InvalidMessage,
/// Message has an unexpected nonce.
InvalidNonce,
/// Fee provided is invalid.
InvalidFee,
/// Message has an invalid payload.
InvalidPayload,
/// Message channel is invalid
InvalidChannel,
/// The max nonce for the type has been reached
MaxNonceReached,
/// Cannot convert location
InvalidAccountConversion,
/// Invalid network specified
InvalidNetwork,
/// Pallet is halted
Expand Down Expand Up @@ -201,8 +181,8 @@ pub mod pallet {
impl<T: Config> Pallet<T> {
/// Submit an inbound message originating from the Gateway contract on Ethereum
#[pallet::call_index(0)]
#[pallet::weight(T::WeightInfo::submit())]
pub fn submit(origin: OriginFor<T>, event: Box<EventProof>) -> DispatchResult {
#[pallet::weight(T::WeightInfo::submit().saturating_add(T::MessageProcessor::worst_case_message_processor_weight()))]
pub fn submit(origin: OriginFor<T>, event: Box<EventProof>) -> DispatchResultWithPostInfo {
let who = ensure_signed(origin)?;
ensure!(!OperatingMode::<T>::get().is_halted(), Error::<T>::Halted);

Expand Down Expand Up @@ -232,7 +212,7 @@ pub mod pallet {
}

impl<T: Config> Pallet<T> {
pub fn process_message(relayer: T::AccountId, message: Message) -> DispatchResult {
pub fn process_message(relayer: T::AccountId, message: Message) -> DispatchResultWithPostInfo {
// Verify that the message was submitted from the known Gateway contract
ensure!(T::GatewayAddress::get() == message.gateway, Error::<T>::InvalidGateway);

Expand All @@ -241,58 +221,36 @@ pub mod pallet {
// Verify the message has not been processed
ensure!(!Nonce::<T>::get(nonce), Error::<T>::InvalidNonce);

let xcm =
T::MessageConverter::convert(message).map_err(|error| Error::<T>::from(error))?;

// Forward XCM to AH
let dest = Location::new(1, [Parachain(T::AssetHubParaId::get())]);

// Mark message as received
Nonce::<T>::set(nonce);

let message_id =
Self::send_xcm(dest.clone(), &relayer, xcm.clone()).map_err(|error| {
tracing::error!(target: LOG_TARGET, ?error, ?dest, ?xcm, "XCM send failed with error");
Error::<T>::from(error)
let (message_id, maybe_corrected_weight) = T::MessageProcessor::process_message(relayer.clone(), message)
.map_err(|e| match e {
MessageProcessorError::ProcessMessage(e) => e,
MessageProcessorError::ConvertMessage(e) => Error::<T>::from(e).into(),
MessageProcessorError::SendMessage(e) => Error::<T>::from(e).into(),
})?;

// Pay relayer reward
if !relayer_fee.is_zero() {
T::RewardPayment::register_reward(
&relayer,
T::DefaultRewardKind::get(),
relayer_fee,
);
let tip = Tips::<T>::take(nonce).unwrap_or_default();
let total_tip = relayer_fee.saturating_add(tip);
if total_tip > 0 {
T::RewardPayment::register_reward(&relayer, T::DefaultRewardKind::get(), total_tip);
}

// Emit event with the message_id
Self::deposit_event(Event::MessageReceived { nonce, message_id });

Ok(())
}

fn send_xcm(
dest: Location,
fee_payer: &T::AccountId,
xcm: Xcm<()>,
) -> Result<XcmHash, SendError> {
let (ticket, fee) = validate_send::<T::XcmSender>(dest, xcm)?;
let fee_payer = T::AccountToLocation::try_convert(fee_payer).map_err(|err| {
tracing::error!(
target: LOG_TARGET,
?err,
"Failed to convert account to XCM location",
);
SendError::NotApplicable
})?;
T::XcmExecutor::charge_fees(fee_payer.clone(), fee.clone()).map_err(|error| {
tracing::error!(
target: LOG_TARGET,
?error,
"Charging fees failed with error",
);
SendError::Fees
})?;
T::XcmSender::deliver(ticket)
if let Some(corrected_weight) = maybe_corrected_weight {
Ok(PostDispatchInfo {
actual_weight: Some(corrected_weight.saturating_add(T::WeightInfo::submit())),
..Default::default()
})
}
else {
// Pays fees and non-corrected-weight
Ok(().into())
}
}
}

Expand Down
Loading
Loading