AstarNetwork / astar-frame

Core frame modules for Astar & Shiden network.
Other
58 stars 38 forks source link

Custom barrier for DescendOrigin #114

Closed Dinonard closed 1 year ago

Dinonard commented 1 year ago

Pull Request Summary

Adds custom Barrier for XCM that allows sequence like:

DescendOrigin -> WithdrawAsset -> BuyExecution

This is required if we want to support remote execution from non-parachain accounts. The common sense here is the assumption that none of the parachains would allow sending of customizable XCM sequence that isn't prepended with DescendOrigin.

Check list

github-actions[bot] commented 1 year ago

Code Coverage

Package Line Rate Branch Rate Health
frame/xc-asset-config/src 70% 0%
precompiles/utils/macro/tests 0% 0%
precompiles/utils/src 72% 0%
precompiles/substrate-ecdsa/src 78% 0%
chain-extensions/types/rmrk/src 0% 0%
chain-extensions/types/xvm/src 0% 0%
precompiles/assets-erc20/src 73% 0%
chain-extensions/rmrk/src 0% 0%
chain-extensions/xvm/src 0% 0%
frame/collator-selection/src 80% 0%
chain-extensions/dapps-staking/src 0% 0%
frame/pallet-xvm/src 11% 0%
frame/pallet-xcm/src 65% 0%
frame/pallet-xvm/src/pallet 34% 0%
frame/custom-signatures/src 57% 0%
precompiles/xcm/src 84% 0%
precompiles/xvm/src 94% 0%
precompiles/utils/src/data 72% 0%
precompiles/utils/macro/src 0% 0%
precompiles/sr25519/src 79% 0%
frame/block-reward/src 85% 0%
primitives/xcm/src 66% 0%
frame/dapps-staking/src 83% 0%
frame/dapps-staking/src/pallet 90% 0%
precompiles/dapps-staking/src 93% 0%
chain-extensions/types/dapps-staking/src 0% 0%
Summary 60% (2593 / 4352) 0% (0 / 0)

Minimum allowed line rate is 50%

Dinonard commented 1 year ago

One question though: why do we consider a sequence as valid if it contains some extra instructions? I mean, technically we can, of course, but should we?

Because the point of this barrier is to ensure that whoever is sending the sequence pays for it's execution. Whatever they do after paying is fine - that's why the UT contains scenario with one extra instruction.

The sequence being matched in the code is useless by itself.