Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xcm queue paused and resume #1737

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

xcm queue paused and resume #1737

wants to merge 15 commits into from

Conversation

zqhxuyuan
Copy link
Contributor

closes: #1664

runtime/common/src/lib.rs Outdated Show resolved Hide resolved
@zqhxuyuan zqhxuyuan marked this pull request as ready for review December 30, 2021 14:11
runtime/common/src/lib.rs Outdated Show resolved Hide resolved
modules/transaction-pause/src/lib.rs Outdated Show resolved Hide resolved
modules/transaction-pause/src/lib.rs Outdated Show resolved Hide resolved
runtime/common/src/lib.rs Outdated Show resolved Hide resolved
runtime/common/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@shaunxw shaunxw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When paused, XCM messages should be queued in storage, and they needs to be replayed after resumed.

@zqhxuyuan
Copy link
Contributor Author

zqhxuyuan commented Jan 3, 2022

When paused, XCM messages should be queued in storage, and they needs to be replayed after resumed.

@shaunxw @zjb0807 the implementation of processing DMP and HRMP message both first store data in relaychain, then the parachain sync relaychain data, and read messages by relay_client.runtime_api. when processing dmp and hrmp messages in parachain, it'll update ProcessedDownwardMessages and HrmpWatermark, and this two storage value will be included in collation info that will be the argument of relaychain to prune_dmq and prune_hrmp.

in current implementation, even though we ingnore invoke handle_dmp_messages or handle_xcmp_messages when xcm is paused, the ProcessedDownwardMessages and HrmpWatermark is updated anyway. so the relaychain still prune the dmp-queue and hrmp-queue.

going back to Tuple implementation of DmpMessageHandler and XcmpMessageHandler, if we disabled xcm, we could set Handler to (), and then xcm message is discarded. the reason why dmp/xcmp message is discarded is because of ProcessedDownwardMessages/HrmpWatermark is updated that we mentioned before.

fortunately, the dmp-queue implementation of DmpMessageHandler and xcmp-queue implementaion of XcmpMessageHandler both have some cache machanism which store cross chain message(origin from relaychain) in parachain. through this way, we don't need to implements how to queue message in storage and relayed after resumed.

the premise of using these machanism is that we must call dmp-queue implementation of DmpMessageHandler and xcmp-queue implementaion of XcmpMessageHandler, that's why I set max_weight to 0 instead of didn't invoke them.
there's a same implements in moonbeam.

Ps. as currenty xcm-emulator use memory like(non-relayed) to test cross chain message, and for the case of dmp, relaychain may send duplicate dmp message to parachain. so the dmp-queue testcase may seems a little strange.

Copy link
Contributor

@shaunxw shaunxw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right. We can leverage the message cache to dmp and xcmp queue with max_weight.

Message sending in xcm-emulator can be improved later, at this time it's good to have manual tests to be safe.

runtime/common/src/lib.rs Outdated Show resolved Hide resolved
@shaunxw shaunxw dismissed their stale review January 4, 2022 22:31

dmp / xcmp queue will handle msg cache

@zqhxuyuan
Copy link
Contributor Author

zqhxuyuan commented Jan 5, 2022

/bench runtime mandala module_transaction_pause

@ghost
Copy link

ghost commented Jan 5, 2022

Finished benchmark for branch: xcm-pause

Benchmark: Benchmark Runtime Mandala Module

cargo run --release --color=never --bin=acala --features=runtime-benchmarks --features=with-mandala-runtime -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=module_transaction_pause --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --template=./templates/runtime-weight-template.hbs --output=./runtime/mandala/src/weights/

Results

Pallet: "module_transaction_pause", Extrinsic: "pause_transaction", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info

Storage: TransactionPause PausedTransactions (r:1 w:1)

Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 22.4
µs

Reads = 1
Writes = 1

Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 22.4
µs

Reads = 1
Writes = 1

Pallet: "module_transaction_pause", Extrinsic: "unpause_transaction", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info

Storage: TransactionPause PausedTransactions (r:1 w:1)

Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 22.97
µs

Reads = 1
Writes = 1

Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 22.97
µs

Reads = 1
Writes = 1

Pallet: "module_transaction_pause", Extrinsic: "pause_xcm", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info

Storage: TransactionPause XcmPaused (r:1 w:1)

Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 19.39
µs

Reads = 1
Writes = 1

Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 19.39
µs

Reads = 1
Writes = 1

Pallet: "module_transaction_pause", Extrinsic: "resume_xcm", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info

Storage: TransactionPause XcmPaused (r:1 w:0)

Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 4.19
µs

Reads = 1
Writes = 0

Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 4.19
µs

Reads = 1
Writes = 0

Acala Benchmarking Bot added 2 commits January 5, 2022 06:19
…hmarks --features=with-mandala-runtime -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=module_transaction_pause --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --template=./templates/runtime-weight-template.hbs --output=./runtime/mandala/src/weights/
@zqhxuyuan
Copy link
Contributor Author

/bench runtime karura module_transaction_pause

@ghost
Copy link

ghost commented Jan 5, 2022

Finished benchmark for branch: xcm-pause

Benchmark: Benchmark Runtime Karura Module

cargo run --release --color=never --bin=acala --features=runtime-benchmarks --features=with-karura-runtime -- benchmark --chain=karura-dev --steps=50 --repeat=20 --pallet=module_transaction_pause --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --template=./templates/runtime-weight-template.hbs --output=./runtime/karura/src/weights/

Results

Pallet: "module_transaction_pause", Extrinsic: "pause_transaction", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info

Storage: TransactionPause PausedTransactions (r:1 w:1)

Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 22.43
µs

Reads = 1
Writes = 1

Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 22.43
µs

Reads = 1
Writes = 1

Pallet: "module_transaction_pause", Extrinsic: "unpause_transaction", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info

Storage: TransactionPause PausedTransactions (r:1 w:1)

Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 22.65
µs

Reads = 1
Writes = 1

Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 22.65
µs

Reads = 1
Writes = 1

Pallet: "module_transaction_pause", Extrinsic: "pause_xcm", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info

Storage: TransactionPause XcmPaused (r:1 w:1)

Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 19.43
µs

Reads = 1
Writes = 1

Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 19.43
µs

Reads = 1
Writes = 1

Pallet: "module_transaction_pause", Extrinsic: "resume_xcm", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info

Storage: TransactionPause XcmPaused (r:1 w:0)

Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 4.208
µs

Reads = 1
Writes = 0

Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 4.208
µs

Reads = 1
Writes = 0

…hmarks --features=with-karura-runtime -- benchmark --chain=karura-dev --steps=50 --repeat=20 --pallet=module_transaction_pause --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --template=./templates/runtime-weight-template.hbs --output=./runtime/karura/src/weights/
@zqhxuyuan
Copy link
Contributor Author

/bench runtime acala module_transaction_pause

@ghost
Copy link

ghost commented Jan 5, 2022

Finished benchmark for branch: xcm-pause

Benchmark: Benchmark Runtime Acala Module

cargo run --release --color=never --bin=acala --features=runtime-benchmarks --features=with-acala-runtime -- benchmark --chain=acala-latest --steps=50 --repeat=20 --pallet=module_transaction_pause --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --template=./templates/runtime-weight-template.hbs --output=./runtime/acala/src/weights/

Results

Pallet: "module_transaction_pause", Extrinsic: "pause_transaction", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info

Storage: TransactionPause PausedTransactions (r:1 w:1)

Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 23.38
µs

Reads = 1
Writes = 1

Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 23.38
µs

Reads = 1
Writes = 1

Pallet: "module_transaction_pause", Extrinsic: "unpause_transaction", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info

Storage: TransactionPause PausedTransactions (r:1 w:1)

Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 23.85
µs

Reads = 1
Writes = 1

Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 23.85
µs

Reads = 1
Writes = 1

Pallet: "module_transaction_pause", Extrinsic: "pause_xcm", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info

Storage: TransactionPause XcmPaused (r:1 w:1)

Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 20.26
µs

Reads = 1
Writes = 1

Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 20.26
µs

Reads = 1
Writes = 1

Pallet: "module_transaction_pause", Extrinsic: "resume_xcm", Lowest values: [], Highest values: [], Steps: 50, Repeat: 20
Raw Storage Info

Storage: TransactionPause XcmPaused (r:1 w:0)

Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 4.521
µs

Reads = 1
Writes = 0

Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 4.521
µs

Reads = 1
Writes = 0

…hmarks --features=with-acala-runtime -- benchmark --chain=acala-latest --steps=50 --repeat=20 --pallet=module_transaction_pause --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --template=./templates/runtime-weight-template.hbs --output=./runtime/acala/src/weights/
@zqhxuyuan
Copy link
Contributor Author

zqhxuyuan commented Jan 6, 2022

the manual test (after pause) log show un-expected result:

  • the first time execute_xcm() is expected as max_weight is set to 0, so weight_limit: 0 results Weight limit reached! weight > weight_limit: 800000000 > 0
  • but there're another execute_xcm() later on set max_weight to 489869531000 make the xcm execution success.
2022-01-06 17:00:41.541 TRACE tokio-runtime-worker xcm::weight: [Relaychain] FixedWeightBounds message: Xcm([TransferReserveAsset { assets: MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: Here }), fun: Fungible(1000128000000) }]), dest: MultiLocation { parents: 0, interior: X1(Parachain(2000)) }, xcm: Xcm([]) }])
2022-01-06 17:00:42.060 TRACE tokio-runtime-worker xcm::weight: [Relaychain] FixedWeightBounds message: Xcm([TransferReserveAsset { assets: MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: Here }), fun: Fungible(1000128000000) }]), dest: MultiLocation { parents: 0, interior: X1(Parachain(2000)) }, xcm: Xcm([]) }])
2022-01-06 17:00:42.060 TRACE tokio-runtime-worker xcm::weight: [Relaychain] FixedWeightBounds message: Xcm([ReserveAssetDeposited(MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: Here }), fun: Fungible(1000128000000) }])), ClearOrigin, BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }, weight_limit: Limited(0) }, DepositAsset { assets: Wild(All), max_assets: 1, beneficiary: MultiLocation { parents: 0, interior: X1(AccountId32 { network: Any, id: [48, 103, 33, 33, 29, 84, 4, 189, 157, 168, 142, 2, 4, 54, 10, 26, 154, 184, 184, 124, 102, 193, 188, 47, 205, 211, 127, 60, 34, 34, 204, 32] }) } }])
2022-01-06 17:00:42.060 TRACE tokio-runtime-worker xcm::weight: [Relaychain] FixedWeightBounds message: Xcm([TransferReserveAsset { assets: MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: Here }), fun: Fungible(1000128000000) }]), dest: MultiLocation { parents: 0, interior: X1(Parachain(2000)) }, xcm: Xcm([BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }, weight_limit: Limited(4000000000) }, DepositAsset { assets: Wild(All), max_assets: 1, beneficiary: MultiLocation { parents: 0, interior: X1(AccountId32 { network: Any, id: [48, 103, 33, 33, 29, 84, 4, 189, 157, 168, 142, 2, 4, 54, 10, 26, 154, 184, 184, 124, 102, 193, 188, 47, 205, 211, 127, 60, 34, 34, 204, 32] }) } }]) }])
2022-01-06 17:00:42.060 TRACE tokio-runtime-worker xcm::execute_xcm_in_credit: [Relaychain] origin: MultiLocation { parents: 0, interior: X1(AccountId32 { network: Polkadot, id: [212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125] }) }, message: Xcm([TransferReserveAsset { assets: MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: Here }), fun: Fungible(1000128000000) }]), dest: MultiLocation { parents: 0, interior: X1(Parachain(2000)) }, xcm: Xcm([BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }, weight_limit: Limited(4000000000) }, DepositAsset { assets: Wild(All), max_assets: 1, beneficiary: MultiLocation { parents: 0, interior: X1(AccountId32 { network: Any, id: [48, 103, 33, 33, 29, 84, 4, 189, 157, 168, 142, 2, 4, 54, 10, 26, 154, 184, 184, 124, 102, 193, 188, 47, 205, 211, 127, 60, 34, 34, 204, 32] }) } }]) }]), weight_limit: 1000000000, weight_credit: 1000000000
2022-01-06 17:00:42.060 TRACE tokio-runtime-worker xcm::weight: [Relaychain] FixedWeightBounds message: Xcm([TransferReserveAsset { assets: MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: Here }), fun: Fungible(1000128000000) }]), dest: MultiLocation { parents: 0, interior: X1(Parachain(2000)) }, xcm: Xcm([BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }, weight_limit: Limited(4000000000) }, DepositAsset { assets: Wild(All), max_assets: 1, beneficiary: MultiLocation { parents: 0, interior: X1(AccountId32 { network: Any, id: [48, 103, 33, 33, 29, 84, 4, 189, 157, 168, 142, 2, 4, 54, 10, 26, 154, 184, 184, 124, 102, 193, 188, 47, 205, 211, 127, 60, 34, 34, 204, 32] }) } }]) }])
2022-01-06 17:00:42.060 TRACE tokio-runtime-worker xcm::barriers: [Relaychain] TakeWeightCredit origin: MultiLocation { parents: 0, interior: X1(AccountId32 { network: Polkadot, id: [212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125] }) }, message: Xcm([TransferReserveAsset { assets: MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: Here }), fun: Fungible(1000128000000) }]), dest: MultiLocation { parents: 0, interior: X1(Parachain(2000)) }, xcm: Xcm([BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }, weight_limit: Limited(4000000000) }, DepositAsset { assets: Wild(All), max_assets: 1, beneficiary: MultiLocation { parents: 0, interior: X1(AccountId32 { network: Any, id: [48, 103, 33, 33, 29, 84, 4, 189, 157, 168, 142, 2, 4, 54, 10, 26, 154, 184, 184, 124, 102, 193, 188, 47, 205, 211, 127, 60, 34, 34, 204, 32] }) } }]) }]), max_weight: 1000000000, weight_credit: 1000000000
2022-01-06 17:00:42.060 TRACE tokio-runtime-worker xcm::execute: [Relaychain] origin: Some(MultiLocation { parents: 0, interior: X1(AccountId32 { network: Polkadot, id: [212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125] }) }), total_surplus/refunded: 0/0, error_handler_weight: 0
2022-01-06 17:00:42.060 TRACE tokio-runtime-worker xcm::currency_adapter: [Relaychain] withdraw_asset what: MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: Here }), fun: Fungible(1000128000000) }, who: MultiLocation { parents: 0, interior: X1(AccountId32 { network: Polkadot, id: [212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125] }) }
2022-01-06 17:00:42.060 TRACE tokio-runtime-worker xcm::currency_adapter: [Relaychain] deposit_asset what: MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: Here }), fun: Fungible(1000128000000) }, who: MultiLocation { parents: 0, interior: X1(Parachain(2000)) }
2022-01-06 17:00:42.060 TRACE tokio-runtime-worker xcm::execute_xcm_in_credit: [Relaychain] result: Ok(())

2022-01-06 17:00:42.223 DEBUG tokio-runtime-worker xcm::execute_xcm: [Parachain] origin: MultiLocation { parents: 1, interior: Here }, message: Xcm([ReserveAssetDeposited(MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }])), ClearOrigin, BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }, weight_limit: Limited(4000000000) }, DepositAsset { assets: Wild(All), max_assets: 1, beneficiary: MultiLocation { parents: 0, interior: X1(AccountId32 { network: Any, id: [48, 103, 33, 33, 29, 84, 4, 189, 157, 168, 142, 2, 4, 54, 10, 26, 154, 184, 184, 124, 102, 193, 188, 47, 205, 211, 127, 60, 34, 34, 204, 32] }) } }]), weight_limit: 0
2022-01-06 17:00:42.223 TRACE tokio-runtime-worker xcm::execute_xcm_in_credit: [Parachain] origin: MultiLocation { parents: 1, interior: Here }, message: Xcm([ReserveAssetDeposited(MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }])), ClearOrigin, BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }, weight_limit: Limited(4000000000) }, DepositAsset { assets: Wild(All), max_assets: 1, beneficiary: MultiLocation { parents: 0, interior: X1(AccountId32 { network: Any, id: [48, 103, 33, 33, 29, 84, 4, 189, 157, 168, 142, 2, 4, 54, 10, 26, 154, 184, 184, 124, 102, 193, 188, 47, 205, 211, 127, 60, 34, 34, 204, 32] }) } }]), weight_limit: 0, weight_credit: 0
2022-01-06 17:00:42.223 TRACE tokio-runtime-worker xcm::weight: [Parachain] FixedWeightBounds message: Xcm([ReserveAssetDeposited(MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }])), ClearOrigin, BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }, weight_limit: Limited(4000000000) }, DepositAsset { assets: Wild(All), max_assets: 1, beneficiary: MultiLocation { parents: 0, interior: X1(AccountId32 { network: Any, id: [48, 103, 33, 33, 29, 84, 4, 189, 157, 168, 142, 2, 4, 54, 10, 26, 154, 184, 184, 124, 102, 193, 188, 47, 205, 211, 127, 60, 34, 34, 204, 32] }) } }])
2022-01-06 17:00:42.223 DEBUG tokio-runtime-worker xcm::execute_xcm_in_credit: [Parachain] Weight limit reached! weight > weight_limit: 800000000 > 0. (origin: MultiLocation { parents: 1, interior: Here }, message: Xcm([ReserveAssetDeposited(MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }])), ClearOrigin, BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }, weight_limit: Limited(4000000000) }, DepositAsset { assets: Wild(All), max_assets: 1, beneficiary: MultiLocation { parents: 0, interior: X1(AccountId32 { network: Any, id: [48, 103, 33, 33, 29, 84, 4, 189, 157, 168, 142, 2, 4, 54, 10, 26, 154, 184, 184, 124, 102, 193, 188, 47, 205, 211, 127, 60, 34, 34, 204, 32] }) } }]), weight_limit: 0, weight_credit: 0)

2022-01-06 17:00:42.225 DEBUG tokio-runtime-worker xcm::execute_xcm: [Parachain] origin: MultiLocation { parents: 1, interior: Here }, message: Xcm([ReserveAssetDeposited(MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }])), ClearOrigin, BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }, weight_limit: Limited(4000000000) }, DepositAsset { assets: Wild(All), max_assets: 1, beneficiary: MultiLocation { parents: 0, interior: X1(AccountId32 { network: Any, id: [48, 103, 33, 33, 29, 84, 4, 189, 157, 168, 142, 2, 4, 54, 10, 26, 154, 184, 184, 124, 102, 193, 188, 47, 205, 211, 127, 60, 34, 34, 204, 32] }) } }]), weight_limit: 489869531000
2022-01-06 17:00:42.225 TRACE tokio-runtime-worker xcm::execute_xcm_in_credit: [Parachain] origin: MultiLocation { parents: 1, interior: Here }, message: Xcm([ReserveAssetDeposited(MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }])), ClearOrigin, BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }, weight_limit: Limited(4000000000) }, DepositAsset { assets: Wild(All), max_assets: 1, beneficiary: MultiLocation { parents: 0, interior: X1(AccountId32 { network: Any, id: [48, 103, 33, 33, 29, 84, 4, 189, 157, 168, 142, 2, 4, 54, 10, 26, 154, 184, 184, 124, 102, 193, 188, 47, 205, 211, 127, 60, 34, 34, 204, 32] }) } }]), weight_limit: 489869531000, weight_credit: 0
2022-01-06 17:00:42.225 TRACE tokio-runtime-worker xcm::weight: [Parachain] FixedWeightBounds message: Xcm([ReserveAssetDeposited(MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }])), ClearOrigin, BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }, weight_limit: Limited(4000000000) }, DepositAsset { assets: Wild(All), max_assets: 1, beneficiary: MultiLocation { parents: 0, interior: X1(AccountId32 { network: Any, id: [48, 103, 33, 33, 29, 84, 4, 189, 157, 168, 142, 2, 4, 54, 10, 26, 154, 184, 184, 124, 102, 193, 188, 47, 205, 211, 127, 60, 34, 34, 204, 32] }) } }])
2022-01-06 17:00:42.225 TRACE tokio-runtime-worker xcm::barriers: [Parachain] TakeWeightCredit origin: MultiLocation { parents: 1, interior: Here }, message: Xcm([ReserveAssetDeposited(MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }])), ClearOrigin, BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }, weight_limit: Limited(4000000000) }, DepositAsset { assets: Wild(All), max_assets: 1, beneficiary: MultiLocation { parents: 0, interior: X1(AccountId32 { network: Any, id: [48, 103, 33, 33, 29, 84, 4, 189, 157, 168, 142, 2, 4, 54, 10, 26, 154, 184, 184, 124, 102, 193, 188, 47, 205, 211, 127, 60, 34, 34, 204, 32] }) } }]), max_weight: 800000000, weight_credit: 0
2022-01-06 17:00:42.225 TRACE tokio-runtime-worker xcm::barriers: [Parachain] AllowTopLevelPaidExecutionFrom origin: MultiLocation { parents: 1, interior: Here }, message: Xcm([ReserveAssetDeposited(MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }])), ClearOrigin, BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: Here }), fun: Fungible(1000128000000) }, weight_limit: Limited(4000000000) }, DepositAsset { assets: Wild(All), max_assets: 1, beneficiary: MultiLocation { parents: 0, interior: X1(AccountId32 { network: Any, id: [48, 103, 33, 33, 29, 84, 4, 189, 157, 168, 142, 2, 4, 54, 10, 26, 154, 184, 184, 124, 102, 193, 188, 47, 205, 211, 127, 60, 34, 34, 204, 32] }) } }]), max_weight: 800000000, weight_credit: 0
2022-01-06 17:00:42.225 TRACE tokio-runtime-worker xcm::execute: [Parachain] origin: Some(MultiLocation { parents: 1, interior: Here }), total_surplus/refunded: 0/0, error_handler_weight: 0
2022-01-06 17:00:42.225 TRACE tokio-runtime-worker xcm::weight: [Parachain] FixedRateOfFungible::buy_weight weight: 800000000, payment: <wasm:stripped>
2022-01-06 17:00:42.225 TRACE tokio-runtime-worker xcm::execute_xcm_in_credit: [Parachain] result: Ok(())

@zqhxuyuan
Copy link
Contributor Author

zqhxuyuan commented Jan 6, 2022

I found the second execute_xcm is invoked by on_idle

	#[pallet::hooks]
	impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
		fn on_idle(_now: T::BlockNumber, max_weight: Weight) -> Weight {
			// on_idle processes additional messages with any remaining block weight.
			Self::service_queue(max_weight)
		}
	}

so we need other machanism to make sure don't invoke on_idle.

@xlc
Copy link
Member

xlc commented Jan 6, 2022

I can see few options:

  • queue the messages in our own pallet and send them to the xcmp/dmp queue upon resume
  • request XCMP/DMP queue pallet to implement a way to disable the on_idle handler
  • send suspend signal to the other chain so we won't receive any more messages

@shaunxw
Copy link
Contributor

shaunxw commented Jan 7, 2022

Or requesting hrmp/dmp pallets to be able to pause/resume channels.

@xlc
Copy link
Member

xlc commented Jan 31, 2022

paritytech/cumulus#896 is merged

@zqhxuyuan
Copy link
Contributor Author

I'll continue this work after v0.9.16 is merged, as cumulus merge the PR to the master branch. also I think it'll be easy now, just need to add two config item to xcmp_queue::Config and do some test.

the dmp-queue seems haven't implement yet. so we may just first introduct xcmp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to pause & queue xcm messages
4 participants