Skip to content

Commit

Permalink
composable runtime xcm barrier. to enable notification from relay (LSD)
Browse files Browse the repository at this point in the history
  • Loading branch information
RustNinja committed Dec 28, 2023
1 parent 09ba02c commit c96ee8a
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions code/parachain/runtime/composable/src/xcmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,29 @@ impl<ResponseHandler: OnResponse> ShouldExecute
max_weight: Weight,
weight_credit: &mut Weight,
) -> Result<(), ProcessMessageError> {
for i in instructions.iter_mut() {
if let QueryResponse { ref mut querier, .. } = i {
if querier.is_none() {
//need this line because querier is None
//and here is where it failed in pallet-xcm
//https://github.com/paritytech/polkadot/blob/release-v0.9.43/xcm/pallet-xcm/src/lib.rs#L2001-L2010
//so need to substitute it with expected querier
*querier = Some(MultiLocation { parents: 0, interior: Here });
}
}
}

AllowKnownQueryResponses::<ResponseHandler>::should_execute(
let result = AllowKnownQueryResponses::<ResponseHandler>::should_execute(
origin,
instructions,
max_weight,
weight_credit,
)?;
Ok(())
);

if result.is_err() {
for i in instructions.iter_mut() {
if let QueryResponse { query_id, .. } = i {
let is_asked_by_lsd =
pallet_liquid_staking::pallet::XcmRequests::<Runtime>::contains_key(
query_id,
);

if is_asked_by_lsd {
return Ok(())
}
//https://github.com/paritytech/polkadot/blob/release-v0.9.43/xcm/pallet-xcm/src/lib.rs#L2001-L2010
}
}
}
result
}
}

Expand Down

0 comments on commit c96ee8a

Please sign in to comment.