From 5a2614159aac3b579c0faedef28578afd02e107f Mon Sep 17 00:00:00 2001 From: Hugh Cunningham Date: Fri, 13 Sep 2024 07:40:16 -0700 Subject: [PATCH] test memory allocation issues in rust --- .github/workflows/ci.yml | 76 ++++++++++--------- .../multisig/createSigningPackage.test.ts | 58 +++++++------- .../src/wallet/exporter/encryption.test.ts | 6 +- 3 files changed, 71 insertions(+), 69 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c844928378..47f71db17c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,7 @@ on: push: branches: - master + - test/hughy/ironfish-frost jobs: lint: @@ -63,7 +64,7 @@ jobs: run: yarn --non-interactive --frozen-lockfile - name: Run tests - run: yarn test:coverage --maxWorkers=2 --workerIdleMemoryLimit=2000MB + run: yarn test:coverage createSigningPackage.test.ts --maxWorkers=2 --workerIdleMemoryLimit=2000MB - name: Check for missing fixtures run: | @@ -76,39 +77,40 @@ jobs: if: github.repository == 'iron-fish/ironfish' run: CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} ROOT_PATH=$GITHUB_WORKSPACE/ yarn coverage:upload - testslow: - name: Slow Tests - runs-on: ubuntu-latest - - steps: - - name: Check out Git repository - uses: actions/checkout@v4 - - - name: Use Node.js - uses: actions/setup-node@v4 - with: - # Tests will only run on Node v20 due to https://github.com/nodejs/node/issues/35889 - node-version: 20 - cache: 'yarn' - - - name: Cache Rust - uses: Swatinem/rust-cache@v2 - with: - shared-key: nodejs - - - name: Install packages - run: yarn --non-interactive --frozen-lockfile - - - name: Run slow tests & coverage - run: yarn test:slow:coverage --maxWorkers=2 --workerIdleMemoryLimit=2000MB - - - name: Check for missing fixtures - run: | - if [[ $(git status | grep fixture) ]]; then - echo "New test fixtures have not been checked in, please check them in." - exit 1 - fi - - - name: Upload coverage - if: github.repository == 'iron-fish/ironfish' - run: CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} ROOT_PATH=$GITHUB_WORKSPACE/ yarn coverage:upload + # testslow: + # name: Slow Tests + # runs-on: ubuntu-latest + # + # steps: + # - name: Check out Git repository + # uses: actions/checkout@v4 + # + # - name: Use Node.js + # uses: actions/setup-node@v4 + # with: + # # Tests will only run on Node v20 due to https://github.com/nodejs/node/issues/35889 + # node-version: 20 + # cache: 'yarn' + # + # - name: Cache Rust + # uses: Swatinem/rust-cache@v2 + # with: + # shared-key: nodejs + # + # - name: Install packages + # run: yarn --non-interactive --frozen-lockfile + # + # - name: Run slow tests & coverage + # run: yarn test:slow:coverage --maxWorkers=2 --workerIdleMemoryLimit=2000MB + # + # - name: Check for missing fixtures + # run: | + # if [[ $(git status | grep fixture) ]]; then + # echo "New test fixtures have not been checked in, please check them in." + # exit 1 + # fi + # + # - name: Upload coverage + # if: github.repository == 'iron-fish/ironfish' + # run: CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} ROOT_PATH=$GITHUB_WORKSPACE/ yarn coverage:upload + # \ No newline at end of file diff --git a/ironfish/src/rpc/routes/wallet/multisig/createSigningPackage.test.ts b/ironfish/src/rpc/routes/wallet/multisig/createSigningPackage.test.ts index 6061aa2d66..7b80eccea8 100644 --- a/ironfish/src/rpc/routes/wallet/multisig/createSigningPackage.test.ts +++ b/ironfish/src/rpc/routes/wallet/multisig/createSigningPackage.test.ts @@ -7,7 +7,7 @@ import { createRouteTest } from '../../../../testUtilities/routeTest' describe('Route multisig/createSigningPackage', () => { const routeTest = createRouteTest() - it('should create signing package', async () => { + it.only('should create signing package', async () => { // Create a bunch of multisig identities const accountNames = Array.from({ length: 3 }, (_, index) => `test-account-${index}`) const participants = await Promise.all( @@ -37,34 +37,34 @@ describe('Route multisig/createSigningPackage', () => { } // Create an unsigned transaction - const txAccount = await useAccountAndAddFundsFixture(routeTest.wallet, routeTest.chain) - const unsignedTransaction = ( - await useUnsignedTxFixture(routeTest.wallet, txAccount, txAccount) - ) - .serialize() - .toString('hex') - - // Create signing commitments for all participants - const commitments = await Promise.all( - accountNames.map(async (accountName) => { - const signingCommitment = - await routeTest.client.wallet.multisig.createSigningCommitment({ - account: accountName, - unsignedTransaction, - signers: participants, - }) - return signingCommitment.content.commitment - }), - ) - - // Create the signing package - const responseSigningPackage = await routeTest.client.wallet.multisig.createSigningPackage({ - commitments, - unsignedTransaction, - }) - expect(responseSigningPackage.content).toMatchObject({ - signingPackage: expect.any(String), - }) + // const txAccount = await useAccountAndAddFundsFixture(routeTest.wallet, routeTest.chain) + // const unsignedTransaction = ( + // await useUnsignedTxFixture(routeTest.wallet, txAccount, txAccount) + // ) + // .serialize() + // .toString('hex') + + // // Create signing commitments for all participants + // const commitments = await Promise.all( + // accountNames.map(async (accountName) => { + // const signingCommitment = + // await routeTest.client.wallet.multisig.createSigningCommitment({ + // account: accountName, + // unsignedTransaction, + // signers: participants, + // }) + // return signingCommitment.content.commitment + // }), + // ) + + // // Create the signing package + // const responseSigningPackage = await routeTest.client.wallet.multisig.createSigningPackage({ + // commitments, + // unsignedTransaction, + // }) + // expect(responseSigningPackage.content).toMatchObject({ + // signingPackage: expect.any(String), + // }) }) it('should create signing package with a subset of signers', async () => { diff --git a/ironfish/src/wallet/exporter/encryption.test.ts b/ironfish/src/wallet/exporter/encryption.test.ts index 69be117b51..aa9e06b1e3 100644 --- a/ironfish/src/wallet/exporter/encryption.test.ts +++ b/ironfish/src/wallet/exporter/encryption.test.ts @@ -32,7 +32,7 @@ describe('Wallet Export Encryption', () => { const secret = multisig.ParticipantSecret.random() const identity = secret.toIdentity() - it('encodes an account and decodes the string', () => { + it.skip('encodes an account and decodes the string', () => { const encoded = new JsonEncoder().encode(account) const encrypted = encryptEncodedAccount(encoded, { kind: 'MultisigIdentity', @@ -43,7 +43,7 @@ describe('Wallet Export Encryption', () => { expect(decrypted).toEqual(encoded) }) - it('returns null when decoding with the wrong secret', () => { + it.skip('returns null when decoding with the wrong secret', () => { const wrongSecret = multisig.ParticipantSecret.random() const encoded = new JsonEncoder().encode(account) @@ -81,7 +81,7 @@ describe('Wallet Export Encryption', () => { expect(encrypted.slice(BASE64_JSON_MULTISIG_ENCRYPTED_ACCOUNT_PREFIX.length)).toBeBase64() }) - it('should decrypt an account using wallet secrets', async () => { + it.skip('should decrypt an account using wallet secrets', async () => { const identity = await nodeTest.wallet.createMultisigSecret('foo') const encoded = new JsonEncoder().encode(account)