Skip to content

Commit

Permalink
Merge branch 'stable2412' into gui-backport-6463-to-stable2412
Browse files Browse the repository at this point in the history
  • Loading branch information
gui1117 authored Dec 30, 2024
2 parents b687209 + d9b1353 commit 9ec2223
Show file tree
Hide file tree
Showing 183 changed files with 5,834 additions and 2,621 deletions.
1 change: 0 additions & 1 deletion .github/scripts/common/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ fetch_release_artifacts_from_s3() {
pwd
ls -al --color
popd > /dev/null
unset OUTPUT_DIR
}

# Pass the name of the binary as input, it will
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release-50_publish-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ on:
required: true

stable_tag:
description: Tag matching the actual stable release version in the format stableYYMM or stableYYMM-X for patch releases
description: Tag matching the actual stable release version in the format polkadpt-stableYYMM(-rcX) or plkadot-stableYYMM-X(-rcX) for patch releases
required: true

permissions:
Expand Down Expand Up @@ -311,9 +311,9 @@ jobs:
# TODO: The owner should be used below but buildx does not resolve the VARs
# TODO: It would be good to get rid of this GHA that we don't really need.
tags: |
egorpop/polkadot:${{ steps.fetch-data.outputs.stable }}
egorpop/polkadot:latest
egorpop/polkadot:${{ needs.fetch-latest-debian-package-version.outputs.polkadot_container_tag }}
parity/polkadot:${{ steps.fetch-data.outputs.stable }}
parity/polkadot:latest
parity/polkadot:${{ needs.fetch-latest-debian-package-version.outputs.polkadot_container_tag }}
build-args: |
VCS_REF=${{ github.ref }}
POLKADOT_VERSION=${{ needs.fetch-latest-debian-package-version.outputs.polkadot_apt_version }}
Expand Down
20 changes: 14 additions & 6 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -848,13 +848,13 @@ 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.8.3", features = ["websocket"] }
litep2p = { version = "0.8.4", features = ["websocket"] }
log = { version = "0.4.22", default-features = false }
macro_magic = { version = "0.5.1" }
maplit = { version = "1.0.2" }
memmap2 = { version = "0.9.3" }
memory-db = { version = "0.32.0", default-features = false }
merkleized-metadata = { version = "0.1.2" }
merkleized-metadata = { version = "0.2.0" }
merlin = { version = "3.0", default-features = false }
messages-relay = { path = "bridges/relays/messages" }
metered = { version = "0.6.1", default-features = false, package = "prioritized-metered-channel" }
Expand Down
6 changes: 6 additions & 0 deletions bridges/chains/chain-asset-hub-rococo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@ scale-info = { features = ["derive"], workspace = true }

# Substrate Dependencies
frame-support = { workspace = true }
sp-core = { workspace = true }

# Bridge Dependencies
bp-xcm-bridge-hub-router = { workspace = true }

# Polkadot dependencies
xcm = { workspace = true }

[features]
default = ["std"]
std = [
"bp-xcm-bridge-hub-router/std",
"codec/std",
"frame-support/std",
"scale-info/std",
"sp-core/std",
"xcm/std",
]
25 changes: 25 additions & 0 deletions bridges/chains/chain-asset-hub-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@
#![cfg_attr(not(feature = "std"), no_std)]

extern crate alloc;

use codec::{Decode, Encode};
use scale_info::TypeInfo;

pub use bp_xcm_bridge_hub_router::XcmBridgeHubRouterCall;
use xcm::latest::prelude::*;

/// `AssetHubRococo` Runtime `Call` enum.
///
Expand All @@ -44,5 +47,27 @@ frame_support::parameter_types! {
pub const XcmBridgeHubRouterTransactCallMaxWeight: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(200_000_000, 6144);
}

/// Builds an (un)congestion XCM program with the `report_bridge_status` call for
/// `ToWestendXcmRouter`.
pub fn build_congestion_message<RuntimeCall>(
bridge_id: sp_core::H256,
is_congested: bool,
) -> alloc::vec::Vec<Instruction<RuntimeCall>> {
alloc::vec![
UnpaidExecution { weight_limit: Unlimited, check_origin: None },
Transact {
origin_kind: OriginKind::Xcm,
fallback_max_weight: Some(XcmBridgeHubRouterTransactCallMaxWeight::get()),
call: Call::ToWestendXcmRouter(XcmBridgeHubRouterCall::report_bridge_status {
bridge_id,
is_congested,
})
.encode()
.into(),
},
ExpectTransactStatus(MaybeErrorCode::Success),
]
}

/// Identifier of AssetHubRococo in the Rococo relay chain.
pub const ASSET_HUB_ROCOCO_PARACHAIN_ID: u32 = 1000;
6 changes: 6 additions & 0 deletions bridges/chains/chain-asset-hub-westend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@ scale-info = { features = ["derive"], workspace = true }

# Substrate Dependencies
frame-support = { workspace = true }
sp-core = { workspace = true }

# Bridge Dependencies
bp-xcm-bridge-hub-router = { workspace = true }

# Polkadot dependencies
xcm = { workspace = true }

[features]
default = ["std"]
std = [
"bp-xcm-bridge-hub-router/std",
"codec/std",
"frame-support/std",
"scale-info/std",
"sp-core/std",
"xcm/std",
]
25 changes: 25 additions & 0 deletions bridges/chains/chain-asset-hub-westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@
#![cfg_attr(not(feature = "std"), no_std)]

extern crate alloc;

use codec::{Decode, Encode};
use scale_info::TypeInfo;

pub use bp_xcm_bridge_hub_router::XcmBridgeHubRouterCall;
use xcm::latest::prelude::*;

/// `AssetHubWestend` Runtime `Call` enum.
///
Expand All @@ -44,5 +47,27 @@ frame_support::parameter_types! {
pub const XcmBridgeHubRouterTransactCallMaxWeight: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(200_000_000, 6144);
}

/// Builds an (un)congestion XCM program with the `report_bridge_status` call for
/// `ToRococoXcmRouter`.
pub fn build_congestion_message<RuntimeCall>(
bridge_id: sp_core::H256,
is_congested: bool,
) -> alloc::vec::Vec<Instruction<RuntimeCall>> {
alloc::vec![
UnpaidExecution { weight_limit: Unlimited, check_origin: None },
Transact {
origin_kind: OriginKind::Xcm,
fallback_max_weight: Some(XcmBridgeHubRouterTransactCallMaxWeight::get()),
call: Call::ToRococoXcmRouter(XcmBridgeHubRouterCall::report_bridge_status {
bridge_id,
is_congested,
})
.encode()
.into(),
},
ExpectTransactStatus(MaybeErrorCode::Success),
]
}

/// Identifier of AssetHubWestend in the Westend relay chain.
pub const ASSET_HUB_WESTEND_PARACHAIN_ID: u32 = 1000;
27 changes: 23 additions & 4 deletions bridges/modules/xcm-bridge-hub-router/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#![cfg(feature = "runtime-benchmarks")]

use crate::{DeliveryFeeFactor, MINIMAL_DELIVERY_FEE_FACTOR};
use crate::{Bridge, BridgeState, Call, MINIMAL_DELIVERY_FEE_FACTOR};
use frame_benchmarking::{benchmarks_instance_pallet, BenchmarkError};
use frame_support::traits::{Get, Hooks};
use frame_support::traits::{EnsureOrigin, Get, Hooks, UnfilteredDispatchable};
use sp_runtime::traits::Zero;
use xcm::prelude::*;

Expand All @@ -45,16 +45,35 @@ pub trait Config<I: 'static>: crate::Config<I> {

benchmarks_instance_pallet! {
on_initialize_when_non_congested {
DeliveryFeeFactor::<T, I>::put(MINIMAL_DELIVERY_FEE_FACTOR + MINIMAL_DELIVERY_FEE_FACTOR);
Bridge::<T, I>::put(BridgeState {
is_congested: false,
delivery_fee_factor: MINIMAL_DELIVERY_FEE_FACTOR + MINIMAL_DELIVERY_FEE_FACTOR,
});
}: {
crate::Pallet::<T, I>::on_initialize(Zero::zero())
}

on_initialize_when_congested {
DeliveryFeeFactor::<T, I>::put(MINIMAL_DELIVERY_FEE_FACTOR + MINIMAL_DELIVERY_FEE_FACTOR);
Bridge::<T, I>::put(BridgeState {
is_congested: false,
delivery_fee_factor: MINIMAL_DELIVERY_FEE_FACTOR + MINIMAL_DELIVERY_FEE_FACTOR,
});
let _ = T::ensure_bridged_target_destination()?;
T::make_congested();
}: {
crate::Pallet::<T, I>::on_initialize(Zero::zero())
}

report_bridge_status {
Bridge::<T, I>::put(BridgeState::default());

let origin: T::RuntimeOrigin = T::BridgeHubOrigin::try_successful_origin().expect("expected valid BridgeHubOrigin");
let bridge_id = Default::default();
let is_congested = true;

let call = Call::<T, I>::report_bridge_status { bridge_id, is_congested };
}: { call.dispatch_bypass_filter(origin)? }
verify {
assert!(Bridge::<T, I>::get().is_congested);
}
}
Loading

0 comments on commit 9ec2223

Please sign in to comment.