darwinia-network / darwinia-common

Darwinia Runtime Pallet Library and Pangolin/Pangoro Testnet
https://rust-docs.darwinia.network/darwinia-common
GNU General Public License v3.0
30 stars 9 forks source link

Substrate2SubstrateBacking and Substrate2SubstrateIssuing pallet support #626

Closed hackfisher closed 3 years ago

hackfisher commented 3 years ago

Resources might be used:

Pangolin Runtime (mock Crab):

https://github.com/darwinia-network/darwinia-common/blob/c4570e02f425c5855c283b0c0385ce8e9a6a2012/bin/node/runtime/pangolin/src/lib.rs#L375

Millau Runtime (mock Darwinia):

https://github.com/darwinia-network/darwinia-launch/blob/b7a295ba7264467e4fd380fe0a6b2c516cb1cdf0/millau/runtime/src/lib.rs#L330

Dispatch pallet seems to be used in target chain (Substrate2SubstrateIssuing) https://github.com/darwinia-network/parity-bridges-common/tree/master/modules/dispatch

Message pallet seems to be used in source chain (Substrate2SubstrateBacking) https://github.com/darwinia-network/parity-bridges-common/tree/master/modules/messages

grandpa(chain relay) is used for proof verification under the hood https://github.com/darwinia-network/parity-bridges-common/tree/master/modules/grandpa

Sample Case:

Cross-chain transfer RING from Darwinia to Crab and the mapped token existing as an ERC20-RING in Crab DVM.

xiaoch05 commented 3 years ago

@HackFisher @AurevoirXavier It seems that we don't need to implement the trait MessageDispatcher. Just encode a remote Call, and send it to the target chain using send_message. This may be a good example. from wococo chain to rococo chain. https://github.com/darwinia-network/parity-bridges-common/blob/master/primitives/chain-wococo/src/lib.rs#L46

AurevoirXavier commented 3 years ago

Yep. Just need to wrap the struct with FromBridgedChainMessageDispatch which was already implemented the MessageDispatcher.

hackfisher commented 3 years ago

Related https://github.com/darwinia-network/darwinia-common/pull/692