diff --git a/.circleci/config.yml b/.circleci/config.yml index 2e33670aa..3bb28f735 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,13 +2,13 @@ version: 2.1 orbs: - node: circleci/node@5.1.0 + node: circleci/node@5.2.0 executors: rust-node: docker: - - image: cimg/rust:1.73-node + - image: cimg/rust:1.80-node commands: diff --git a/sdk/package.json b/sdk/package.json index d7234665d..360b8a08c 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -57,6 +57,7 @@ "@rollup/plugin-replace": "^5.0.5", "@types/chai": "^4.3.16", "@types/mime": "^3.0.1", + "@types/mocha": "^10.0.7", "@types/sinon": "^17.0.3", "@typescript-eslint/eslint-plugin": "^5.41.0", "@typescript-eslint/parser": "^5.41.0", diff --git a/sdk/tests/key-provider.test.ts b/sdk/tests/key-provider.test.ts index 942799953..87bd24023 100644 --- a/sdk/tests/key-provider.test.ts +++ b/sdk/tests/key-provider.test.ts @@ -19,7 +19,7 @@ describe('KeyProvider', () => { } catch (e) { expect(e).instanceof(Error); } - }, 60000); + }); it('Should use cache when set and not use it when not', async () => { // Ensure the cache properly downloads and stores keys @@ -48,7 +48,7 @@ describe('KeyProvider', () => { expect(keyProvider.cache.size).equal(0); expect(redownloadedProvingKey).instanceof(ProvingKey); expect(redownloadedVerifyingKey).instanceof(VerifyingKey); - }, 200000); + }); it.skip("Should not fetch offline keys that haven't already been stored", async () => { // Download the credits.aleo function keys @@ -139,7 +139,6 @@ describe('KeyProvider', () => { expect(transferPublicToPrivateVerifierLocal.isTransferPublicToPrivateVerifier()).equal(true); expect(unbondPublicProverLocal.isUnbondPublicProver()).equal(true); expect(unbondPublicVerifierLocal.isUnbondPublicVerifier()).equal(true); - - }, 380000); + }); }); }); diff --git a/sdk/tests/network-client.integration.ts b/sdk/tests/network-client.integration.ts index 7585a540c..1cacf3ad8 100644 --- a/sdk/tests/network-client.integration.ts +++ b/sdk/tests/network-client.integration.ts @@ -21,7 +21,7 @@ describe('NodeConnection', () => { if (!(records instanceof Error)) { expect(records.length).above(0); } - }, 60000); + }); it('should find records when a private key is pre-configured', async () => { const records = await remoteApiClientWithPrivateKey.findUnspentRecords(0, undefined, undefined, undefined, 100, []); @@ -29,7 +29,7 @@ describe('NodeConnection', () => { if (!(records instanceof Error)) { expect(records.length).above(0); } - }, 60000); + }); it('should find records even when block height specified is higher than current block height', async () => { const records = await localApiClient.findUnspentRecords(0, 50000000000000, beaconPrivateKeyString, undefined, 100, []); @@ -37,7 +37,7 @@ describe('NodeConnection', () => { if (!(records instanceof Error)) { expect(records.length).above(0); } - }, 60000); + }); it('should find records with specified amounts', async () => { let records = await localApiClient.findUnspentRecords(0, 3, beaconPrivateKeyString, [100, 200], undefined, []); @@ -51,7 +51,7 @@ describe('NodeConnection', () => { if (!(records instanceof Error)) { expect(records.length).above(0); } - }, 60000); + }); it('should not find records with existing nonces', async () => { const nonces: string[] = []; @@ -75,7 +75,6 @@ describe('NodeConnection', () => { }); } } - - }, 60000); + }); }); }); diff --git a/sdk/tests/network-client.test.ts b/sdk/tests/network-client.test.ts index 20beb340f..3e715e4bd 100644 --- a/sdk/tests/network-client.test.ts +++ b/sdk/tests/network-client.test.ts @@ -42,21 +42,21 @@ describe('NodeConnection', () => { const account = new Account(); connection.setAccount(account); expect(connection.getAccount()).equal(account); - }, 60000); + }); }); describe('getBlock', () => { it.skip('should return a Block object', async () => { const block = await connection.getBlock(1); expect((block as Block).block_hash).equal("ab17jdwevmgu20kcqazp2wjyy2u2k75rac2mtvuf6w6kjn8egv0uvrqe7mra6"); - }, 60000); + }); it('should throw an error if the request fails', async () => { await expectThrows( () => connection.getBlock(99999999), "Error fetching block.", ); - }, 60000); + }); }); describe('getBlockRange', () => { @@ -67,18 +67,18 @@ describe('NodeConnection', () => { expect(((blockRange as Block[])[0] as Block).block_hash).equal("ab17jdwevmgu20kcqazp2wjyy2u2k75rac2mtvuf6w6kjn8egv0uvrqe7mra6"); expect(((blockRange as Block[])[1] as Block).block_hash).equal("ab1q60nvh5ha8ld43x0jph9futqwkdm4j3cvw5a2unj5d23ml090c9qkcvr3g"); - }, 60000); + }); it('should throw an error if the request fails', async () => { expect(await connection.getBlockRange(999999999, 1000000000)).deep.equal([]); - }, 60000); + }); }); describe('getProgram', () => { it('should return a string', async () => { const program = await connection.getProgram('credits.aleo'); expect(typeof program).equal('string'); - }, 60000); + }); it('should throw an error if the request fails', async () => { const program_id = "a" + (Math.random()).toString(32).substring(2) + ".aleo"; @@ -87,14 +87,14 @@ describe('NodeConnection', () => { () => connection.getProgram(program_id), "Error fetching program", ); - }, 60000); + }); }); describe('getLatestBlock', () => { it('should return a Block object', async () => { const latestBlock = await connection.getLatestBlock(); expect(typeof (latestBlock as Block).block_hash).equal('string'); - }, 60000); + }); it('should set the X-Aleo-SDK-Version header', async () => { expect(windowFetchSpy.args).deep.equal([]); @@ -113,28 +113,28 @@ describe('NodeConnection', () => { } ], ]); - }, 60000); + }); }); describe('getLatestCommittee', () => { it('should return a string', async () => { const latestCommittee = await connection.getLatestCommittee(); expect(typeof latestCommittee).equal('object'); - }, 60000); + }); }); describe('getLatestHeight', () => { it('should return a number', async () => { const latestHeight = await connection.getLatestHeight(); expect(typeof latestHeight).equal('number'); - }, 60000); + }); }); describe('getStateRoot', () => { it('should return a string', async () => { const stateRoot = await connection.getStateRoot(); expect(typeof stateRoot).equal('string'); - }, 60000); + }); }); describe('getTransactions', () => { @@ -143,7 +143,7 @@ describe('NodeConnection', () => { () => connection.getTransactions(999999999), "Error fetching transactions.", ); - }, 60000); + }); }); describe('getProgramImports', () => { @@ -151,7 +151,7 @@ describe('NodeConnection', () => { const creditImports = await connection.getProgramImportNames("credits.aleo"); const expectedCreditImports: string[] = []; expect(creditImports).deep.equal(expectedCreditImports); - }, 60000); + }); it.skip('should return all nested imports', async () => { const imports = await connection.getProgramImports("imported_add_mul.aleo"); @@ -180,7 +180,7 @@ describe('NodeConnection', () => { ' output r2 as u32.private;\n' }; expect(imports).equal(expectedImports); - }, 60000); + }); }); describe('findUnspentRecords', () => { @@ -204,7 +204,7 @@ describe('NodeConnection', () => { () => connection.findUnspentRecords(0, 5, undefined, undefined, undefined, []), "Private key must be specified in an argument to findOwnedRecords or set in the AleoNetworkClient", ); - }, 60000); + }); it.skip('should search a range correctly and not find records where none exist', async () => { const records = await connection.findUnspentRecords(0, 204, beaconPrivateKeyString, undefined, undefined, []); @@ -212,7 +212,7 @@ describe('NodeConnection', () => { if (!(records instanceof Error)) { expect(records.length).equal(0); } - }, 90000); + }); }); describe('Mappings', () => { @@ -221,6 +221,6 @@ describe('NodeConnection', () => { if (!(mappings instanceof Error)) { expect(mappings).deep.equal(["committee", "delegated", "metadata", "bonded", "unbonding", "account", "withdraw"]); } - }, 60000); + }); }); }); diff --git a/sdk/tests/program-manager.test.ts b/sdk/tests/program-manager.test.ts index b9b61d0f6..b4210ea19 100644 --- a/sdk/tests/program-manager.test.ts +++ b/sdk/tests/program-manager.test.ts @@ -18,7 +18,7 @@ describe('Program Manager', () => { const execution_result = await programManager.run(helloProgram, "hello", ["5u32", "5u32"], true, undefined, undefined, undefined, undefined, undefined, undefined) expect(execution_result.getOutputs()[0]).equal("10u32"); programManager.verifyExecution(execution_result); - }, 1020000); + }); }); describe('Offline query', () => { @@ -32,12 +32,12 @@ describe('Program Manager', () => { const execution_result = await programManager.run(credits, "transfer_private", [statePathRecord, beaconAddressString, "5u64"], true, undefined, undefined, undefined, undefined, undefined, offlineQuery); const verified = programManager.verifyExecution(execution_result); expect(verified).equal(true); - }, 1020000); + }); }); describe('Staking - Bond Public', () => { it.skip('Should execute bondPublic', async () => { // TODO - }, 420000); + }); }); }); diff --git a/sdk/tests/record-provider.integration.ts b/sdk/tests/record-provider.integration.ts index 4dcb6e5bc..2ca23bae2 100644 --- a/sdk/tests/record-provider.integration.ts +++ b/sdk/tests/record-provider.integration.ts @@ -42,6 +42,6 @@ describe('RecordProvider', () => { } catch (e) { throw e; } - }, 60000); + }); }); }); diff --git a/sdk/tests/record-provider.test.ts b/sdk/tests/record-provider.test.ts index 485eabb75..527a4f3bb 100644 --- a/sdk/tests/record-provider.test.ts +++ b/sdk/tests/record-provider.test.ts @@ -7,6 +7,7 @@ describe.skip('RecordProvider', () => { let account: Account; let networkClient: AleoNetworkClient; let recordProvider: NetworkRecordProvider; + beforeEach(() => { account = new Account({privateKey: beaconPrivateKeyString}); networkClient = new AleoNetworkClient("http://vm.aleo.org/api"); @@ -23,6 +24,6 @@ describe.skip('RecordProvider', () => { log(e) throw e; } - }, 60000); + }); }); }); diff --git a/yarn.lock b/yarn.lock index fae92eae9..1058ac4cc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2480,6 +2480,11 @@ dependencies: "@types/node" "*" +"@types/mocha@^10.0.7": + version "10.0.7" + resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-10.0.7.tgz#4c620090f28ca7f905a94b706f74dc5b57b44f2f" + integrity sha512-GN8yJ1mNTcFcah/wKEFIJckJx9iJLoMSzWcfRRuxz/Jk+U6KQNnml+etbtxFK8lPjzOw3zp4Ha/kjSst9fsHYw== + "@types/node@*": version "22.1.0" resolved "https://registry.yarnpkg.com/@types/node/-/node-22.1.0.tgz#6d6adc648b5e03f0e83c78dc788c2b037d0ad94b"