Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vortex token distribution #726

Merged
merged 7 commits into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
925 changes: 526 additions & 399 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion client/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ use sc_service::ChainType;
use seed_runtime::{
constants::{
ONE_ROOT, ONE_XRP, ROOT_ASSET_ID, ROOT_DECIMALS, ROOT_MINIMUM_BALANCE, ROOT_NAME,
ROOT_SYMBOL, XRP_ASSET_ID, XRP_DECIMALS, XRP_MINIMUM_BALANCE, XRP_NAME, XRP_SYMBOL,
ROOT_SYMBOL, VTX_ASSET_ID, VTX_DECIMALS, VTX_MINIMUM_BALANCE, VTX_NAME, VTX_SYMBOL,
XRP_ASSET_ID, XRP_DECIMALS, XRP_MINIMUM_BALANCE, XRP_NAME, XRP_SYMBOL,
},
keys::*,
AccountId, AssetsConfig, BabeConfig, Balance, BalancesConfig, EthBridgeConfig, GenesisConfig,
Expand Down Expand Up @@ -153,10 +154,12 @@ fn testnet_genesis(
ROOT_DECIMALS,
),
(XRP_ASSET_ID, XRP_NAME.as_bytes().to_vec(), XRP_SYMBOL.as_bytes().to_vec(), XRP_DECIMALS),
(VTX_ASSET_ID, VTX_NAME.as_bytes().to_vec(), VTX_SYMBOL.as_bytes().to_vec(), VTX_DECIMALS),
];
let assets = vec![
(ROOT_ASSET_ID, root_key, true, ROOT_MINIMUM_BALANCE),
(XRP_ASSET_ID, root_key, true, XRP_MINIMUM_BALANCE),
(VTX_ASSET_ID, root_key, true, VTX_MINIMUM_BALANCE),
];
let mut endowed_assets = Vec::with_capacity(accounts_to_fund.len());
let mut endowed_balances = Vec::with_capacity(accounts_to_fund.len());
Expand Down
5,000 changes: 5,000 additions & 0 deletions e2e/common/generated_users.txt

Large diffs are not rendered by default.

25 changes: 22 additions & 3 deletions e2e/common/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { JsonRpcProvider } from "@ethersproject/providers";
import { ApiPromise } from "@polkadot/api";
import { ApiPromise, Keyring } from "@polkadot/api";
import { SubmittableExtrinsic } from "@polkadot/api/types";
import { KeyringPair } from "@polkadot/keyring/types";
import { AnyJson } from "@polkadot/types/types";
import { BigNumber } from "ethers";
import { writeFileSync } from "fs";
import fs, { writeFileSync } from "fs";
import { CliPrettify } from "markdown-table-prettify";
import { join } from "path";
import path, { join } from "path";
import web3 from "web3";

export * from "./node";
Expand Down Expand Up @@ -648,3 +648,22 @@ export const executeForPreviousEvent = async (
currentInHistory++;
}
};

export const loadTestUsers = (userAmount?: number): KeyringPair[] => {
const content = fs.readFileSync(path.resolve(__dirname, "./generated_users.txt"), "utf-8");
zees-dev marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why hardcode the generated user list? Could we not instead create random accounts and store them when the test is run?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed here; shouldn't be load testing in CI

const mnemonics = content
.replace(/\n{2,}/g, "\n")
.toString()
.split("\n");
const keyring = new Keyring({ type: "ethereum" });
const keypairs: KeyringPair[] = [];

for (let i = 0; i < mnemonics.length; i++) {
const mnemonic = mnemonics[i];
if (mnemonic !== "" && (userAmount === undefined || i < userAmount)) {
keypairs.push(keyring.addFromMnemonic(mnemonic, {}));
}
}
console.log(`loaded ${keypairs.length} users`);
return keypairs;
};
2 changes: 1 addition & 1 deletion e2e/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const config: HardhatUserConfig = {
apiKey: process.env.ETHERSCAN_API_KEY,
},
mocha: {
timeout: 120_000, // global tests timeout
timeout: 6_000_000, // global tests timeout
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the timeout shouldnt be this high; this implies 6000 seconds right - which is 100 minutes.
CI should never be that long.
It would. be best to identify the long test and reduce the timing of it (test on a subset or something).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah agreed here, I believe the root cause of this is because they seem want to do a load test inside this CI, which is not ideal. I will ask them to update this e2e folder later today due to the time difference.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I think the load testing should be separated from the usual CI flow which aims at regression testing.

},
};

Expand Down
Loading