diff --git a/.github/workflows/integration_test_calamari.yml b/.github/workflows/integration_test_calamari.yml index fd33ea431..4565c954e 100644 --- a/.github/workflows/integration_test_calamari.yml +++ b/.github/workflows/integration_test_calamari.yml @@ -360,46 +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 - # Add the manta-pay, asset-manager and assets storage items and run stress test separately, - # in order to not break the logic of the other integration tests, which don't work with real data yet. - # NOTE: STRESS TEST TO BE FIXED/REENABLED IN https://github.com/Manta-Network/Manta/pull/984 - # - 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] diff --git a/.github/workflows/integration_test_dolphin.yml b/.github/workflows/integration_test_dolphin.yml index 803b53ba2..7869021e7 100644 --- a/.github/workflows/integration_test_dolphin.yml +++ b/.github/workflows/integration_test_dolphin.yml @@ -355,46 +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 - # Add the manta-pay, asset-manager and assets storage items and run stress test separately, - # in order to not break the logic of the other integration tests, which don't work with real data yet. - # NOTE: STRESS TEST TO BE FIXED/REENABLED IN https://github.com/Manta-Network/Manta/pull/984 - # - 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') diff --git a/tests/data/precomputed_mints b/tests/data/precomputed_mints index d93a69ae5..11a04fad3 100644 Binary files a/tests/data/precomputed_mints and b/tests/data/precomputed_mints differ diff --git a/tests/data/precomputed_reclaims b/tests/data/precomputed_reclaims index 1db926274..c46e3b6e3 100644 Binary files a/tests/data/precomputed_reclaims and b/tests/data/precomputed_reclaims differ diff --git a/tests/data/precomputed_transfers b/tests/data/precomputed_transfers index 0c7cbe3bf..45e42ea17 100644 Binary files a/tests/data/precomputed_transfers and b/tests/data/precomputed_transfers differ diff --git a/tests/insert_coins.js b/tests/insert_coins.js new file mode 100644 index 000000000..474430474 --- /dev/null +++ b/tests/insert_coins.js @@ -0,0 +1,97 @@ +const fs = require('fs').promises; + +const keyring = new Keyring({ + type: 'sr25519' +}); +const nodeAddress = "ws://127.0.0.1:9801"; + +async function createPromiseApi(nodeAddress) { + const wsProvider = new WsProvider(nodeAddress); + const api = await ApiPromise.create({ + provider: wsProvider + }); + await api.isReady; + return api; +} + +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_buffer = await fs.readFile(mints_file); + const transfers_buffer = await fs.readFile(transfers_file); + const reclaims_buffer = await fs.readFile(reclaims_file); + + const mints_offset = 2; + const transfers_offset = 4; + const reclaims_offset = 4; + const total_iterations = 15000; + const mint_size = 552; + const transfer_size = 100; + + 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)); + transactions.push(mint); + + const transfers_start = transfers_offset + i * (2 * mint_size + transfer_size); + const transfer_mint_1 = api.tx.mantaPay.toPrivate(transfers_buffer.subarray(transfers_start, transfers_start + mint_size)); + const transfer_mint_2 = api.tx.mantaPay.toPrivate(transfers_buffer.subarray(transfers_start + mint_size, transfers_start + 2 * mint_size)); + const transfer = api.tx.mantaPay.privateTransfer(transfers_buffer.subarray(transfers_start + 2 * mint_size, transfers_start + 2 * mint_size + transfer_size)); + transactions.push(transfer_mint_1); + transactions.push(transfer_mint_2); + transactions.push(transfer); + + await api.tx.utility.forceBatch(transactions).signAndSend(sender, { + nonce: -1 + }, ({ + events = [], + status + }) => { + if (status.isFinalized) { + console.log("tx %i success.", status.nonce); + } + if (status.isDropped || status.isUsurped || status.isFinalityTimeout || status.isRetracted) { + console.err(`tx %i ${status.type}.`, status.nonce); + } + }); + + await new Promise(resolve => setTimeout(resolve, 10000)); + transactions.length = 0; + + const reclaims_start = reclaims_offset + i * (2 * mint_size + transfer_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)); + transactions.push(reclaim_mint_1); + transactions.push(reclaim_mint_2); + transactions.push(reclaim); + + await api.tx.utility.forceBatch(transactions).signAndSend(sender, { + nonce: -1 + }, ({ + events = [], + status + }) => { + if (status.isFinalized) { + console.log("tx %i success.", status.nonce); + } + if (status.isDropped || status.isUsurped || status.isFinalityTimeout || status.isRetracted) { + console.err(`tx %i ${status.type}.`, status.nonce); + } + }); + + await new Promise(resolve => setTimeout(resolve, 10000)); + transactions.length = 0; + + } +} + +main().catch(console.error); \ No newline at end of file diff --git a/tests/stress_benchmark_test.ts b/tests/stress_benchmark_test.ts index 7ea357526..bd1c442c7 100644 --- a/tests/stress_benchmark_test.ts +++ b/tests/stress_benchmark_test.ts @@ -16,7 +16,7 @@ const test_config = { transfers_offset: 4, reclaims_offset: 4, total_iterations: 15000, - start_iteration: 13500, + start_iteration: 14000, tests_iterations: 100, mint_size: 552, transfer_size: 1290,