Skip to content

Commit

Permalink
Merge branch 'main' into region-asset-transactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Szegoo authored May 7, 2024
2 parents 94c56ea + 3f11943 commit a6870bd
Show file tree
Hide file tree
Showing 23 changed files with 221 additions and 209 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
--exclude-files **/mock.rs **/weights/* **/weights.rs \
--out xml
- uses: codecov/codecov-action@v4.0.1
- uses: codecov/codecov-action@v4.3.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: RegionX-Labs/RegionX-Node
2 changes: 1 addition & 1 deletion .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

- uses: ./.github/actions/setup

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ bin/
node_modules
build/
**/package-lock.json
**/build
18 changes: 9 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ repository = "https://github.com/RegionX-Labs/RegionX-Node"
edition = "2021"

[workspace.dependencies]
serde = { version = "1.0.198", default-features = false }
serde = { version = "1.0.200", default-features = false }
sha2 = { version = "0.10.8", default-features = false }
clap = { version = "4.5.4" }
futures = { version = "0.3.29" }
jsonrpsee = { version = "0.16.3" }
color-print = "0.3.4"
color-print = "0.3.6"
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
hex-literal = { version = "0.4.1" }
log = { version = "0.4.20", default-features = false }
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,16 @@

```
zombienet-linux -p native test ./zombienet_tests/0003-custom-fee-payment.zndsl
```

- delegated governance(relay chain token holders)

```
zombienet-linux -p native test ./zombienet_tests/0004-delegated-governance.zndsl
```

- native governance(RegionX token holders)

```
zombienet-linux -p native test ./zombienet_tests/0005-native-governance.zndsl
```
6 changes: 3 additions & 3 deletions e2e_tests/common.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ApiPromise, Keyring } from "@polkadot/api";
import { SubmittableExtrinsic } from "@polkadot/api/types";
import { SubmittableExtrinsic, SignerOptions } from "@polkadot/api/types";
import { KeyringPair } from "@polkadot/keyring/types";

const RELAY_ASSET_ID = 1;
const RELAY_ASSET_ID = 1;

async function submitExtrinsic(signer: KeyringPair, call: SubmittableExtrinsic<"promise">, options: any): Promise<void> {
async function submitExtrinsic(signer: KeyringPair, call: SubmittableExtrinsic<"promise">, options: Partial<SignerOptions>): Promise<void> {
return new Promise(async (resolve, reject) => {
const unsub = await call.signAndSend(signer, options, (result) => {
console.log(`Current status is ${result.status}`);
Expand Down
73 changes: 0 additions & 73 deletions e2e_tests/fee-payment/custom.js

This file was deleted.

73 changes: 73 additions & 0 deletions e2e_tests/fee-payment/custom.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import { ApiPromise, WsProvider, Keyring } from "@polkadot/api";
import { submitExtrinsic, setupRelayAsset, RELAY_ASSET_ID } from "../common";

async function run(nodeName: string, networkInfo: any, _jsArgs: any) {
const { wsUri: regionXUri } = networkInfo.nodesByName[nodeName];
const { wsUri: rococoUri } = networkInfo.nodesByName["rococo-validator01"];

const rococoApi = await ApiPromise.create({ provider: new WsProvider(rococoUri) });
const regionXApi = await ApiPromise.create({
provider: new WsProvider(regionXUri),
signedExtensions: {
ChargeAssetTxPayment: {
extrinsic: {
tip: "Compact<Balance>",
assetId: "Option<AssetId>",
},
payload: {},
},
},
});

// account to submit tx
const keyring = new Keyring({ type: "sr25519" });
const alice = keyring.addFromUri("//Alice");

const setXcmVersion = rococoApi.tx.xcmPallet.forceDefaultXcmVersion([3]);
await submitExtrinsic(alice, rococoApi.tx.sudo.sudo(setXcmVersion), {});

await setupRelayAsset(regionXApi, alice);

const receiverKeypair = new Keyring();
receiverKeypair.addFromAddress(alice.address);

const feeAssetItem = 0;
const weightLimit = "Unlimited";
const reserveTransfer = rococoApi.tx.xcmPallet.limitedReserveTransferAssets(
{ V3: { parents: 0, interior: { X1: { Parachain: 2000 } } } }, //dest
{
V3: {
parents: 0,
interior: {
X1: {
AccountId32: {
chain: "Any",
id: receiverKeypair.pairs[0].publicKey,
},
},
},
},
}, //beneficiary
{
V3: [
{
id: {
Concrete: { parents: 0, interior: "Here" },
},
fun: {
Fungible: 10n ** 9n,
},
},
],
}, //asset
feeAssetItem,
weightLimit
);
await submitExtrinsic(alice, reserveTransfer, {});

// Try to pay for fees with relay chain asset.
const remarkCall = regionXApi.tx.system.remark("0x44");
await submitExtrinsic(alice, remarkCall, { assetId: RELAY_ASSET_ID });
}

export { run };
18 changes: 0 additions & 18 deletions e2e_tests/fee-payment/native.js

This file was deleted.

18 changes: 18 additions & 0 deletions e2e_tests/fee-payment/native.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { ApiPromise, Keyring, WsProvider } from "@polkadot/api";
import { submitExtrinsic } from "../common";

async function run(nodeName: string, networkInfo: any, _jsArgs: any) {
const { wsUri } = networkInfo.nodesByName[nodeName];
const api = await ApiPromise.create({ provider: new WsProvider(wsUri) });

// account to submit tx
const keyring = new Keyring({ type: "sr25519" });
const alice = keyring.addFromUri("//Alice");
const bob = keyring.addFromUri("//Bob");

const call = api.tx.balances.transferKeepAlive(bob.address, 10n ** 6n);
const sudo = api.tx.sudo.sudo(call);
await submitExtrinsic(alice, sudo, {});
}

export { run };
52 changes: 0 additions & 52 deletions e2e_tests/governance/delegated.js

This file was deleted.

Loading

0 comments on commit a6870bd

Please sign in to comment.