AvaProtocol / xcm-demo

Javascript usage of OAK’s XCM automation with parachains including Moonbeam, Astar and Mangata.
https://docs.oak.tech/docs/xcm/integration-overview/
4 stars 5 forks source link

Update Moonbase runtime 2403 #76

Closed imstar15 closed 1 year ago

imstar15 commented 1 year ago
  1. Modify WEIGHT_PROOF_SIZE in src/config/moonbase-local.js
  2. Modify getProxyAccount function for Moonbase. Both Moonbase and Moonbeam have updated their algorithms for computing derived account to HashedDescriptionDescribeFamilyAllTerminal. So we should follow the modification.

https://github.com/moonbeam-foundation/moonbeam/blob/93548eeba1e32361c401c58c87596b400707557a/runtime/moonbase/src/xcm_config.rs#L114

The implementation details are available here: https://github.com/moonbeam-foundation/polkadot/blob/89fd916a027ea7fb4a1b0092d0259e7897b45a79/xcm/xcm-builder/src/location_conversion.rs#L40

Our implementation refers to: https://github.com/Moonsong-Labs/xcm-tools/blob/d7618f219e7ceecd4b4c34ad686b25621b5eabff/scripts/calculate-multilocation-derivative-account.ts#L38

Log:

4. Execute an XCM from Moonbase Local to Turing Dev ...

a). Create a payload extrinsic to store in Turing’s task ...

b). Create an automation time task with the payload extrinsic ...
Task extrinsic encoded call data: 0x3c030004000000000000000003010100a10f03010200a10f040303010200a10f040300a0e7ae395d64000000000000000000c90126018097c3c354652cb1eeed3e5b65fba2576470678a01581501000000000000000000000000000000000000000000000000000000000000970951a12f975e6762482aca81e57d5a2a4e73f4000000000000000000000000000000000000000000000000000000000000000010d09de08a0003404ac76c5a15010003401462a85a860300d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d

c). Schedule the task from moonbase ...
Proxy task extrinsic encoded call data: 0x3c030004000000000000000003010100a10f03010200a10f040303010200a10f040300a0e7ae395d64000000000000000000c90126018097c3c354652cb1eeed3e5b65fba2576470678a01581501000000000000000000000000000000000000000000000000000000000000970951a12f975e6762482aca81e57d5a2a4e73f4000000000000000000000000000000000000000000000000000000000000000010d09de08a0003404ac76c5a15010003401462a85a860300d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d
transactCallWeight:  { refTime: '1,332,429,446', proofSize: '0' }
weight: (7332429446, 0)

Execute the above an XCM from Moonbase Local to schedule a task on Turing Dev ...
transactExtrinsic Encoded call data: 0x210603010100092100000100c7b1ac0e800401000000000000000061033c030004000000000000000003010100a10f03010200a10f040303010200a10f040300a0e7ae395d64000000000000000000c90126018097c3c354652cb1eeed3e5b65fba2576470678a01581501000000000000000000000000000000000000000000000000000000000000970951a12f975e6762482aca81e57d5a2a4e73f4000000000000000000000000000000000000000000000000000000000000000010d09de08a0003404ac76c5a15010003401462a85a860300d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d0386426b4f00010786fe0bb50100
status.type Ready
status.type InBlock
status.type Finalized
        automationTime:TaskScheduled:: (phase={"applyExtrinsic":0})
                        AccountId32: 6BNrKN1Hp6fd8nAVZPcTeR5smPHTEiz1g8rgrPtSmxVdSTcq
                        Bytes: 0x38342d302d31
                        Option<AccountId32>: 6AwtFW6sYcQ8RcuAJeXdDKuFtUVXj4xW57ghjYQ5xyciT1yd
TaskId: 84-0-1

5. Keep Listening XCM events on Moonbase Local until 2023-08-06 02:00:00(1691258400000) to verify that the task(taskId: 84-0-1) will be successfully executed ...
        ethereum:Executed:: (phase={"applyExtrinsic":1})
                        H160: 0x8097c3c354652cb1eeed3e5b65fba2576470678a
                        H160: 0x970951a12f975e6762482aca81e57d5a2a4e73f4
                        H256: 0x509664fff577d9ea034ca17faeeb2654ded259e86fd66445d6f8720026acde39
                        {"_enum":{"Succeed":"EvmCoreErrorExitSucceed","Error":"EvmCoreErrorExitError","Revert":"EvmCoreErrorExitRevert","Fatal":"EvmCoreErrorExitFatal"}}: {"succeed":"Stopped"}
                        Bytes: 0x
Task has been executed!
Reached the end of main() ...