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

Update stress benchmark test #1078

Merged
merged 3 commits into from
Apr 19, 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
74 changes: 37 additions & 37 deletions .github/workflows/integration_test_calamari.yml
Original file line number Diff line number Diff line change
Expand Up @@ -360,43 +360,43 @@ jobs:
name: test - calamari alice peered successfully
run: |
grep '\[Parachain\] 💤 Idle (${{ matrix.chain-spec.expected.peer-count.para }} peers)' ${{ github.workspace }}/polkadot-launch/9921.log
# - name: append manta-pay storage
# run: |
# wget -P ${{ github.workspace }}/Manta/tests/data https://manta-ops.s3.amazonaws.com/integration-tests-data/storage.json
# mv $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${GITHUB_SHA:0:7}-spec.json ${{ github.workspace }}/Manta/tests/data/fork.json
# cd ${{ github.workspace }}/Manta/tests
# yarn install
# yarn
# node append_storage.js
# cd ../../
# mv ${{ github.workspace }}/Manta/tests/data/fork.json $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${GITHUB_SHA:0:7}-spec.json
# - name: launch testnet
# run: |
# cd ${{ github.workspace }}/polkadot-launch
# yarn install
# yarn build
# pm2 start dist/cli.js \
# --name polkadot-launch \
# --output ${{ github.workspace }}/polkadot-launch-for-${{ matrix.chain-spec.id }}-stdout.log \
# --error ${{ github.workspace }}/polkadot-launch-for-${{ matrix.chain-spec.id }}-stderr.log \
# --no-autorestart \
# -- $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${GITHUB_SHA:0:7}-launch-config.json
# - name: run stress test
# run: |
# sleep 720
# cd ${{ github.workspace }}/Manta/tests
# yarn install
# yarn
# yarn stress_benchmark_test --address=ws://127.0.0.1:9921 --exit
# - name: stop testnet
# run: |
# cd ${{ github.workspace }}/polkadot-launch
# pm2 stop polkadot-launch
# - if: always()
# uses: actions/upload-artifact@v2
# with:
# name: ${{ matrix.chain-spec.id }}-alice-stress.log
# path: ${{ github.workspace }}/polkadot-launch/9921.log
- name: append manta-pay storage
run: |
wget -P ${{ github.workspace }}/Manta/tests/data https://manta-ops.s3.amazonaws.com/integration-tests-data/storage.json
mv $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${GITHUB_SHA:0:7}-spec.json ${{ github.workspace }}/Manta/tests/data/fork.json
cd ${{ github.workspace }}/Manta/tests
yarn install
yarn
node append_storage.js
cd ../../
mv ${{ github.workspace }}/Manta/tests/data/fork.json $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${GITHUB_SHA:0:7}-spec.json
- name: launch testnet
run: |
cd ${{ github.workspace }}/polkadot-launch
yarn install
yarn build
pm2 start dist/cli.js \
--name polkadot-launch \
--output ${{ github.workspace }}/polkadot-launch-for-${{ matrix.chain-spec.id }}-stdout.log \
--error ${{ github.workspace }}/polkadot-launch-for-${{ matrix.chain-spec.id }}-stderr.log \
--no-autorestart \
-- $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${GITHUB_SHA:0:7}-launch-config.json
- name: run stress test
run: |
sleep 720
cd ${{ github.workspace }}/Manta/tests
yarn install
yarn
yarn stress_benchmark_test --address=ws://127.0.0.1:9921 --exit
- name: stop testnet
run: |
cd ${{ github.workspace }}/polkadot-launch
pm2 stop polkadot-launch
- if: always()
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.chain-spec.id }}-alice-stress.log
path: ${{ github.workspace }}/polkadot-launch/9921.log
docker-image-test:
if: contains(github.event.pull_request.labels.*.name, 'A-calamari' || github.ref == 'refs/heads/manta')
needs: [build-node-current, start-docker-image-tester]
Expand Down
74 changes: 37 additions & 37 deletions .github/workflows/integration_test_dolphin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -355,43 +355,43 @@ jobs:
name: test - dolphin alice peered successfully
run: |
grep '\[Parachain\] 💤 Idle (${{ matrix.chain-spec.expected.peer-count.para }} peers)' ${{ github.workspace }}/polkadot-launch/9921.log
# - name: append manta-pay storage
# run: |
# wget -P ${{ github.workspace }}/Manta/tests/data https://manta-ops.s3.amazonaws.com/integration-tests-data/storage.json
# mv $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${GITHUB_SHA:0:7}-spec.json ${{ github.workspace }}/Manta/tests/data/fork.json
# cd ${{ github.workspace }}/Manta/tests
# yarn install
# yarn
# node append_storage.js
# cd ../../
# mv ${{ github.workspace }}/Manta/tests/data/fork.json $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${GITHUB_SHA:0:7}-spec.json
# - name: launch testnet
# run: |
# cd ${{ github.workspace }}/polkadot-launch
# yarn install
# yarn build
# pm2 start dist/cli.js \
# --name polkadot-launch \
# --output ${{ github.workspace }}/polkadot-launch-for-${{ matrix.chain-spec.id }}-stdout.log \
# --error ${{ github.workspace }}/polkadot-launch-for-${{ matrix.chain-spec.id }}-stderr.log \
# --no-autorestart \
# -- $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${GITHUB_SHA:0:7}-launch-config.json
# - name: run stress test
# run: |
# sleep 720
# cd ${{ github.workspace }}/Manta/tests
# yarn install
# yarn
# yarn stress_benchmark_test --address=ws://127.0.0.1:9921 --exit
# - name: stop testnet
# run: |
# cd ${{ github.workspace }}/polkadot-launch
# pm2 stop polkadot-launch
# - if: always()
# uses: actions/upload-artifact@v2
# with:
# name: ${{ matrix.chain-spec.id }}-alice-stress.log
# path: ${{ github.workspace }}/polkadot-launch/9921.log
- name: append manta-pay storage
run: |
wget -P ${{ github.workspace }}/Manta/tests/data https://manta-ops.s3.amazonaws.com/integration-tests-data/storage.json
mv $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${GITHUB_SHA:0:7}-spec.json ${{ github.workspace }}/Manta/tests/data/fork.json
cd ${{ github.workspace }}/Manta/tests
yarn install
yarn
node append_storage.js
cd ../../
mv ${{ github.workspace }}/Manta/tests/data/fork.json $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${GITHUB_SHA:0:7}-spec.json
- name: launch testnet
run: |
cd ${{ github.workspace }}/polkadot-launch
yarn install
yarn build
pm2 start dist/cli.js \
--name polkadot-launch \
--output ${{ github.workspace }}/polkadot-launch-for-${{ matrix.chain-spec.id }}-stdout.log \
--error ${{ github.workspace }}/polkadot-launch-for-${{ matrix.chain-spec.id }}-stderr.log \
--no-autorestart \
-- $HOME/.local/share/calamari-pc/${{ matrix.chain-spec.id }}-${GITHUB_SHA:0:7}-launch-config.json
- name: run stress test
run: |
sleep 720
cd ${{ github.workspace }}/Manta/tests
yarn install
yarn
yarn stress_benchmark_test --address=ws://127.0.0.1:9921 --exit
- name: stop testnet
run: |
cd ${{ github.workspace }}/polkadot-launch
pm2 stop polkadot-launch
- if: always()
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.chain-spec.id }}-alice-stress.log
path: ${{ github.workspace }}/polkadot-launch/9921.log
# HELPER JOBS BELOW
start-node-builder-current:
if: contains(github.event.pull_request.labels.*.name, 'A-dolphin' || github.ref == 'refs/heads/manta')
Expand Down
Binary file modified tests/data/precomputed_mints
Binary file not shown.
Binary file modified tests/data/precomputed_reclaims
Binary file not shown.
Binary file modified tests/data/precomputed_transfers
Binary file not shown.
34 changes: 19 additions & 15 deletions tests/insert_coins.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const fs = require('fs').promises;
const { Keyring } = require('@polkadot/keyring');
const { ApiPromise, WsProvider } = require('@polkadot/api');

const keyring = new Keyring({
type: 'sr25519'
Expand All @@ -18,9 +20,9 @@ async function main() {
const api = await createPromiseApi(nodeAddress);
const sender = keyring.addFromMnemonic("bottom drive obey lake curtain smoke basket hold race lonely fit walk//Alice");

const mints_file = '/home/georgi/Desktop/workspace/Manta/precomputed-15k-iterations/precomputed_mints_v3-5';
const transfers_file = '/home/georgi/Desktop/workspace/Manta/precomputed-15k-iterations/precomputed_transfers_v3-5';
const reclaims_file = '/home/georgi/Desktop/workspace/Manta/precomputed-15k-iterations/precomputed_reclaims_v3-5';
const mints_file = './data/precomputed_mints';
const transfers_file = './data/precomputed_transfers';
const reclaims_file = './data/precomputed_reclaims';

const mints_buffer = await fs.readFile(mints_file);
const transfers_buffer = await fs.readFile(transfers_file);
Expand All @@ -29,16 +31,17 @@ async function main() {
const mints_offset = 2;
const transfers_offset = 4;
const reclaims_offset = 4;
const total_iterations = 15000;
const mint_size = 552;
const transfer_size = 100;
const total_iterations = 14000;
const mint_size = 553;
const transfer_size = 1291;
const reclaim_size = 1001;

let batches_sent = 0;
const transactions = [];

for (let i = 0; i < total_iterations; i++) {
const mints_start = mints_offset + i * mint_size;
const mint = api.tx.mantaPay.toPrivate(mints_buffer.subarray(mints_start, mint_size + mints_start));
const mint = api.tx.mantaPay.toPrivate(mints_buffer.subarray(mints_start, mints_start + mint_size));
transactions.push(mint);

const transfers_start = transfers_offset + i * (2 * mint_size + transfer_size);
Expand All @@ -59,17 +62,17 @@ async function main() {
console.log("tx %i success.", status.nonce);
}
if (status.isDropped || status.isUsurped || status.isFinalityTimeout || status.isRetracted) {
console.err(`tx %i ${status.type}.`, status.nonce);
console.log(`tx %i ${status.type}.`, status.nonce);
}
});

await new Promise(resolve => setTimeout(resolve, 10000));
await new Promise(resolve => setTimeout(resolve, 12000));
transactions.length = 0;

const reclaims_start = reclaims_offset + i * (2 * mint_size + transfer_size);
const reclaims_start = reclaims_offset + i * (2 * mint_size + reclaim_size);
const reclaim_mint_1 = api.tx.mantaPay.toPrivate(reclaims_buffer.subarray(reclaims_start, reclaims_start + mint_size));
const reclaim_mint_2 = api.tx.mantaPay.toPrivate(reclaims_buffer.subarray(reclaims_start, reclaims_start + mint_size));
const reclaim = api.tx.mantaPay.toPrivate(reclaims_buffer.subarray(reclaims_start, reclaims_start + mint_size));
const reclaim_mint_2 = api.tx.mantaPay.toPrivate(reclaims_buffer.subarray(reclaims_start + mint_size, reclaims_start + 2 * mint_size));
const reclaim = api.tx.mantaPay.toPublic(reclaims_buffer.subarray(reclaims_start + 2 * mint_size, reclaims_start + 2 * mint_size + reclaim_size));
transactions.push(reclaim_mint_1);
transactions.push(reclaim_mint_2);
transactions.push(reclaim);
Expand All @@ -84,13 +87,14 @@ async function main() {
console.log("tx %i success.", status.nonce);
}
if (status.isDropped || status.isUsurped || status.isFinalityTimeout || status.isRetracted) {
console.err(`tx %i ${status.type}.`, status.nonce);
console.log(`tx %i ${status.type}.`, status.nonce);
}
});

await new Promise(resolve => setTimeout(resolve, 10000));
batches_sent++;
console.log("Batches sent: ", batches_sent);
await new Promise(resolve => setTimeout(resolve, 12000));
transactions.length = 0;

}
}

Expand Down
6 changes: 3 additions & 3 deletions tests/stress_benchmark_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ const test_config = {
total_iterations: 15000,
start_iteration: 14000,
tests_iterations: 100,
mint_size: 552,
transfer_size: 1290,
reclaim_size: 968,
mint_size: 553,
transfer_size: 1291,
reclaim_size: 1001,
expected_tps: 0.5,
};

Expand Down