Skip to content

Commit

Permalink
Added fallback_max_weight to Transact for sending messages to V4 chai… (
Browse files Browse the repository at this point in the history
#6778)

Backport of #6643 to
stable2412.

We need it before the release so we have a good story with chains that
haven't upgraded yet.

---------

Co-authored-by: GitHub Action <[email protected]>
Co-authored-by: Adrian Catangiu <[email protected]>
Co-authored-by: Branislav Kontur <[email protected]>
  • Loading branch information
4 people authored Dec 9, 2024
1 parent 641e133 commit 5e47c23
Show file tree
Hide file tree
Showing 39 changed files with 839 additions and 38 deletions.
4 changes: 2 additions & 2 deletions bridges/snowbridge/pallets/inbound-queue/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ fn test_submit_happy_path() {
.into(),
nonce: 1,
message_id: [
11, 25, 133, 51, 23, 68, 111, 211, 132, 94, 254, 17, 194, 252, 198, 233, 10, 193,
156, 93, 72, 140, 65, 69, 79, 155, 154, 28, 141, 166, 171, 255,
247, 182, 157, 129, 170, 106, 218, 13, 70, 39, 166, 4, 229, 93, 231, 185, 27, 79,
14, 22, 115, 150, 151, 113, 227, 171, 216, 123, 221, 34, 183, 43
],
fee_burned: 110000000000,
}
Expand Down
1 change: 1 addition & 0 deletions bridges/snowbridge/primitives/router/src/inbound/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ where
// Call create_asset on foreign assets pallet.
Transact {
origin_kind: OriginKind::Xcm,
fallback_max_weight: Some(Weight::from_parts(400_000_000, 8_000)),
call: (
create_call_index,
asset_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn xcm_transact_paid_execution(
VersionedXcm::from(Xcm(vec![
WithdrawAsset(fees.clone().into()),
BuyExecution { fees, weight_limit },
Transact { origin_kind, call },
Transact { origin_kind, call, fallback_max_weight: None },
RefundSurplus,
DepositAsset {
assets: All.into(),
Expand All @@ -53,7 +53,7 @@ pub fn xcm_transact_unpaid_execution(

VersionedXcm::from(Xcm(vec![
UnpaidExecution { weight_limit, check_origin },
Transact { origin_kind, call },
Transact { origin_kind, call, fallback_max_weight: None },
]))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn transfer_and_transact_in_same_xcm(

// xcm to be executed at dest
let xcm_on_dest = Xcm(vec![
Transact { origin_kind: OriginKind::Xcm, call },
Transact { origin_kind: OriginKind::Xcm, call, fallback_max_weight: None },
ExpectTransactStatus(MaybeErrorCode::Success),
// since this is the last hop, we don't need to further use any assets previously
// reserved for fees (there are no further hops to cover transport fees for); we
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ fn create_agent() {
let remote_xcm = VersionedXcm::from(Xcm(vec![
UnpaidExecution { weight_limit: Unlimited, check_origin: None },
DescendOrigin(Parachain(origin_para).into()),
Transact { origin_kind: OriginKind::Xcm, call: create_agent_call.encode().into() },
Transact {
origin_kind: OriginKind::Xcm,
call: create_agent_call.encode().into(),
fallback_max_weight: None,
},
]));

// Rococo Global Consensus
Expand Down Expand Up @@ -138,7 +142,11 @@ fn create_channel() {
let create_agent_xcm = VersionedXcm::from(Xcm(vec![
UnpaidExecution { weight_limit: Unlimited, check_origin: None },
DescendOrigin(Parachain(origin_para).into()),
Transact { origin_kind: OriginKind::Xcm, call: create_agent_call.encode().into() },
Transact {
origin_kind: OriginKind::Xcm,
call: create_agent_call.encode().into(),
fallback_max_weight: None,
},
]));

let create_channel_call =
Expand All @@ -147,7 +155,11 @@ fn create_channel() {
let create_channel_xcm = VersionedXcm::from(Xcm(vec![
UnpaidExecution { weight_limit: Unlimited, check_origin: None },
DescendOrigin(Parachain(origin_para).into()),
Transact { origin_kind: OriginKind::Xcm, call: create_channel_call.encode().into() },
Transact {
origin_kind: OriginKind::Xcm,
call: create_channel_call.encode().into(),
fallback_max_weight: None,
},
]));

// Rococo Global Consensus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fn transfer_and_transact_in_same_xcm(

// xcm to be executed at dest
let xcm_on_dest = Xcm(vec![
Transact { origin_kind: OriginKind::Xcm, call },
Transact { origin_kind: OriginKind::Xcm, call, fallback_max_weight: None },
ExpectTransactStatus(MaybeErrorCode::Success),
// since this is the last hop, we don't need to further use any assets previously
// reserved for fees (there are no further hops to cover transport fees for); we
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ fn fellows_whitelist_call() {
)
.encode()
.into(),
fallback_max_weight: None
}
]))),
});
Expand Down
Loading

0 comments on commit 5e47c23

Please sign in to comment.