mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 22:11:02 +00:00
[testnet] Add AssetHubRococo <-> AssetHubWestend asset bridging support (#1967)
## Summary Asset bridging support for AssetHub**Rococo** <-> AssetHub**Wococo** was added [here](https://github.com/paritytech/polkadot-sdk/pull/1215), so now we aim to bridge AssetHub**Rococo** and AssetHub**Westend**. (And perhaps retire AssetHubWococo and the Wococo chains). ## Solution **bridge-hub-westend-runtime** - added new runtime as a copy of `bridge-hub-rococo-runtime` - added support for bridging to `BridgeHubRococo` - added tests and benchmarks **bridge-hub-rococo-runtime** - added support for bridging to `BridgeHubWestend` - added tests and benchmarks - internal refactoring by splitting bridge configuration per network, e.g., `bridge_to_whatevernetwork_config.rs`. **asset-hub-rococo-runtime** - added support for asset bridging to `AssetHubWestend` (allows to receive only WNDs) - added new xcm router for `Westend` - added tests and benchmarks **asset-hub-westend-runtime** - added support for asset bridging to `AssetHubRococo` (allows to receive only ROCs) - added new xcm router for `Rococo` - added tests and benchmarks ## Deployment All changes will be deployed as a part of https://github.com/paritytech/polkadot-sdk/issues/1988. ## TODO - [x] benchmarks for all pallet instances - [x] integration tests - [x] local run scripts Relates to: https://github.com/paritytech/parity-bridges-common/issues/2602 Relates to: https://github.com/paritytech/polkadot-sdk/issues/1988 --------- Co-authored-by: command-bot <> Co-authored-by: Adrian Catangiu <adrian@parity.io> Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
async function run(nodeName, networkInfo, args) {
|
||||
const {wsUri, userDefinedTypes} = networkInfo.nodesByName[nodeName];
|
||||
const api = await zombie.connect(wsUri, userDefinedTypes);
|
||||
|
||||
// TODO: could be replaced with https://github.com/polkadot-js/api/issues/4930 (depends on metadata v15) later
|
||||
const bridgedChainName = args[0];
|
||||
const expectedBridgedChainHeaderNumber = Number(args[1]);
|
||||
const runtimeApiMethod = bridgedChainName + "FinalityApi_best_finalized";
|
||||
|
||||
while (true) {
|
||||
const encodedBestFinalizedHeaderId = await api.rpc.state.call(runtimeApiMethod, []);
|
||||
const bestFinalizedHeaderId = api.createType("Option<BpRuntimeHeaderId>", encodedBestFinalizedHeaderId);
|
||||
if (bestFinalizedHeaderId.isSome) {
|
||||
const bestFinalizedHeaderNumber = Number(bestFinalizedHeaderId.unwrap().toHuman()[0]);
|
||||
if (bestFinalizedHeaderNumber > expectedBridgedChainHeaderNumber) {
|
||||
return bestFinalizedHeaderNumber;
|
||||
}
|
||||
}
|
||||
|
||||
// else sleep and retry
|
||||
await new Promise((resolve) => setTimeout(resolve, 12000));
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { run }
|
||||
@@ -0,0 +1,28 @@
|
||||
async function run(nodeName, networkInfo, args) {
|
||||
const {wsUri, userDefinedTypes} = networkInfo.nodesByName[nodeName];
|
||||
const api = await zombie.connect(wsUri, userDefinedTypes);
|
||||
|
||||
// TODO: could be replaced with https://github.com/polkadot-js/api/issues/4930 (depends on metadata v15) later
|
||||
const relayerAccountAddress = args[0];
|
||||
const laneId = args[1];
|
||||
const bridgedChainId = args[2];
|
||||
const relayerFundOwner = args[3];
|
||||
const expectedRelayerReward = BigInt(args[4]);
|
||||
while (true) {
|
||||
const relayerReward = await api.query.bridgeRelayers.relayerRewards(
|
||||
relayerAccountAddress,
|
||||
{ laneId: laneId, bridgedChainId: bridgedChainId, owner: relayerFundOwner }
|
||||
);
|
||||
if (relayerReward.isSome) {
|
||||
const relayerRewardBalance = relayerReward.unwrap().toBigInt();
|
||||
if (relayerRewardBalance > expectedRelayerReward) {
|
||||
return relayerRewardBalance;
|
||||
}
|
||||
}
|
||||
|
||||
// else sleep and retry
|
||||
await new Promise((resolve) => setTimeout(resolve, 12000));
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { run }
|
||||
@@ -0,0 +1,26 @@
|
||||
async function run(nodeName, networkInfo, args) {
|
||||
const {wsUri, userDefinedTypes} = networkInfo.nodesByName[nodeName];
|
||||
const api = await zombie.connect(wsUri, userDefinedTypes);
|
||||
|
||||
// TODO: could be replaced with https://github.com/polkadot-js/api/issues/4930 (depends on metadata v15) later
|
||||
const accountAddress = args[0];
|
||||
const expectedForeignAssetBalance = BigInt(args[1]);
|
||||
const bridgedNetworkName = args[2];
|
||||
while (true) {
|
||||
const foreignAssetAccount = await api.query.foreignAssets.account(
|
||||
{ parents: 2, interior: { X1: { GlobalConsensus: bridgedNetworkName } } },
|
||||
accountAddress
|
||||
);
|
||||
if (foreignAssetAccount.isSome) {
|
||||
const foreignAssetAccountBalance = foreignAssetAccount.unwrap().balance.toBigInt();
|
||||
if (foreignAssetAccountBalance > expectedForeignAssetBalance) {
|
||||
return foreignAssetAccountBalance;
|
||||
}
|
||||
}
|
||||
|
||||
// else sleep and retry
|
||||
await new Promise((resolve) => setTimeout(resolve, 12000));
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { run }
|
||||
Reference in New Issue
Block a user