diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 427987d985..0da07df467 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,8 +8,8 @@ jobs: runs-on: ubuntu-22.04 steps: - run: | - wget -q https://packages.erlang-solutions.com/erlang/debian/pool/esl-erlang_25.0.4-1~ubuntu~jammy_amd64.deb - sudo apt install --allow-downgrades ./esl-erlang_25.0.4-1~ubuntu~jammy_amd64.deb + wget -q https://packages.erlang-solutions.com/erlang/debian/pool/esl-erlang_25.2.3-1~ubuntu~jammy_amd64.deb + sudo apt install ./esl-erlang_25.2.3-1~ubuntu~jammy_amd64.deb - uses: actions/checkout@v4 with: fetch-depth: 100 @@ -30,8 +30,6 @@ jobs: BASE: ${{ github.event.pull_request.base.sha }} run: npx commitlint --from $BASE --to $HEAD --verbose - run: npm run lint - # TODO: remove after merging https://github.com/aeternity/aeternity/pull/4319 - - run: chmod 666 ./docker/accounts-pub.json - run: docker compose up -d --wait - run: npx nyc npm test - run: npx nyc report --reporter=text-lcov > coverage.lcov diff --git a/docker-compose.yml b/docker-compose.yml index 523d042bc9..7d63264f18 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,9 +10,6 @@ services: interval: 2s volumes: - ./docker/aeternity.yaml:/home/aeternity/node/aeternity.yaml - - ./docker/accounts.json:/home/aeternity/node/data/aeplugin_dev_mode/devmode_prefunded_accounts.json - # TODO: remove after merging https://github.com/aeternity/aeternity/pull/4319 - - ./docker/accounts-pub.json:/home/aeternity/node/data/aeplugin_dev_mode/devmode_prefunded_accounts-PUB.json stop_grace_period: 0s emitter: @@ -22,7 +19,7 @@ services: condition: service_healthy compiler: - image: aeternity/aesophia_http:v8.0.0-rc1 + image: aeternity/aesophia_http:v8.0.0 ports: [3080:3080] # TODO: remove after releasing https://github.com/aeternity/aesophia_http/pull/133 healthcheck: diff --git a/docker/accounts-pub.json b/docker/accounts-pub.json deleted file mode 100644 index bed5d36c9a..0000000000 --- a/docker/accounts-pub.json +++ /dev/null @@ -1 +0,0 @@ -{"ak_21A27UVVt3hDkBE5J7rhhqnH5YNb4Y1dqo4PnSybrH85pnWo7E":10000000000000000000000} \ No newline at end of file diff --git a/docker/accounts.json b/docker/accounts.json deleted file mode 100644 index 57dcc53c1c..0000000000 --- a/docker/accounts.json +++ /dev/null @@ -1,6 +0,0 @@ -[{ - "pub_key": "ak_21A27UVVt3hDkBE5J7rhhqnH5YNb4Y1dqo4PnSybrH85pnWo7E", - "initial_balance": 10000000000000000000000, - "// TODO: encode using base58 after fixing": "https://github.com/aeternity/aeplugin_dev_mode/issues/32", - "priv_key": "sk_nr177aDHmvcqQuzjghpW7/FjWbbfN2zwSa7plVZfAi+hhfna" -}] diff --git a/docker/aeternity.yaml b/docker/aeternity.yaml index 3998a1e2de..30699dac08 100644 --- a/docker/aeternity.yaml +++ b/docker/aeternity.yaml @@ -22,3 +22,5 @@ chain: hard_forks: "1": 0 "6": 1 + genesis_accounts: + ak_21A27UVVt3hDkBE5J7rhhqnH5YNb4Y1dqo4PnSybrH85pnWo7E: 10000000000000000000000 diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 7413db0257..dfd0f77442 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [13.3.2](https://github.com/aeternity/aepp-sdk-js/compare/v13.3.1...v13.3.2) (2024-04-22) + + +### Bug Fixes + +* **contract:** detect if ACI doesn't match called contract ([8c4287f](https://github.com/aeternity/aepp-sdk-js/commit/8c4287f2cdd1690ed2e07410a322659e4f17f2d3)) +* ttl validation error in dev mode by reducing polling intervals ([6f8cdc9](https://github.com/aeternity/aepp-sdk-js/commit/6f8cdc9dd82a7dd7f146739d472dc07018f8d230)) + ### [13.3.1](https://github.com/aeternity/aepp-sdk-js/compare/v13.3.0...v13.3.1) (2024-04-19) diff --git a/package-lock.json b/package-lock.json index c5001c79d4..efa58bdfca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@aeternity/aepp-sdk", - "version": "13.3.1", + "version": "13.3.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@aeternity/aepp-sdk", - "version": "13.3.1", + "version": "13.3.2", "license": "ISC", "dependencies": { "@aeternity/aepp-calldata": "^1.7.0", @@ -12829,9 +12829,9 @@ } }, "node_modules/tar": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz", - "integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", "dependencies": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", diff --git a/package.json b/package.json index db83bb25fb..7a817bcb0a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@aeternity/aepp-sdk", - "version": "13.3.1", + "version": "13.3.2", "description": "SDK for the æternity blockchain", "main": "dist/aepp-sdk.js", "types": "es/index.d.ts", @@ -111,7 +111,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/aeternity/aepp-sdk-js" + "url": "git+https://github.com/aeternity/aepp-sdk-js.git" }, "devDependencies": { "@babel/cli": "^7.23.9", diff --git a/src/chain.ts b/src/chain.ts index 87c1e38f69..1c9bca7694 100644 --- a/src/chain.ts +++ b/src/chain.ts @@ -21,15 +21,25 @@ import { * @param type - Type * @param options - Options */ -export function _getPollInterval( - type: 'block' | 'microblock', // TODO: rename to 'key-block' | 'micro-block' - { _expectedMineRate = 180000, _microBlockCycle = 3000 }: - { _expectedMineRate?: number; _microBlockCycle?: number }, -): number { - const base = { - block: _expectedMineRate, - microblock: _microBlockCycle, - }[type]; +export async function _getPollInterval( + type: 'key-block' | 'micro-block', + { _expectedMineRate, _microBlockCycle, onNode }: + { _expectedMineRate?: number; _microBlockCycle?: number; onNode: Node }, +): Promise { + const getVal = async ( + t: string, + val: number | undefined, + devModeDef: number, + def: number, + ): Promise => { + if (t !== type) return null; + if (val != null) return val; + return await onNode?.getNetworkId() === 'ae_dev' ? devModeDef : def; + }; + + const base = await getVal('key-block', _expectedMineRate, 0, 180000) + ?? await getVal('micro-block', _microBlockCycle, 0, 3000) + ?? (() => { throw new InternalError(`Unknown type: ${type}`); })(); return Math.floor(base / 3); } @@ -53,7 +63,7 @@ export async function getHeight( const onNode = unwrapProxy(options.onNode); if (cached) { const cache = heightCache.get(onNode); - if (cache != null && cache.time > Date.now() - _getPollInterval('block', options)) { + if (cache != null && cache.time > Date.now() - await _getPollInterval('key-block', options)) { return cache.height; } } @@ -77,21 +87,21 @@ export async function getHeight( export async function poll( th: Encoded.TxHash, { - blocks = 5, interval, onNode, ...options + blocks = 5, interval, ...options }: { blocks?: number; interval?: number; onNode: Node } & Parameters[1], ): Promise> { - interval ??= _getPollInterval('microblock', options); + interval ??= await _getPollInterval('micro-block', options); let max; do { - const tx = await onNode.getTransactionByHash(th); + const tx = await options.onNode.getTransactionByHash(th); if (tx.blockHeight !== -1) return tx; if (max == null) { max = tx.tx.ttl !== 0 ? -1 - : await getHeight({ ...options, onNode, cached: true }) + blocks; + : await getHeight({ ...options, cached: true }) + blocks; } await pause(interval); - } while (max === -1 ? true : await getHeight({ ...options, onNode, cached: true }) < max); + } while (max === -1 ? true : await getHeight({ ...options, cached: true }) < max); throw new TxTimedOutError(blocks, th); } @@ -106,14 +116,14 @@ export async function poll( */ export async function awaitHeight( height: number, - { interval, onNode, ...options }: + { interval, ...options }: { interval?: number; onNode: Node } & Parameters[1], ): Promise { - interval ??= Math.min(_getPollInterval('block', options), 5000); + interval ??= Math.min(await _getPollInterval('key-block', options), 5000); let currentHeight; do { if (currentHeight != null) await pause(interval); - currentHeight = await getHeight({ onNode }); + currentHeight = await getHeight(options); } while (currentHeight < height); return currentHeight; } diff --git a/src/contract/Contract.ts b/src/contract/Contract.ts index 7e4bf8eb45..8f41f3e34e 100644 --- a/src/contract/Contract.ts +++ b/src/contract/Contract.ts @@ -171,6 +171,9 @@ class Contract { break; case 'error': message = decode(returnValue).toString(); + if (/Expected \d+ arguments, got \d+/.test(message)) { + throw new ContractError(`ACI doesn't match called contract. Error provided by node: ${message}`); + } break; default: throw new InternalError(`Unknown return type: ${returnType}`); diff --git a/src/oracle.ts b/src/oracle.ts index 3c64635651..d8fb034a58 100644 --- a/src/oracle.ts +++ b/src/oracle.ts @@ -34,13 +34,12 @@ type OracleQueries = Awaited>['orac export function pollForQueries( oracleId: Encoded.OracleAddress, onQuery: (query: OracleQueries[number]) => void, - { interval, onNode, ...options }: { interval?: number; onNode: Node } + { interval, ...options }: { interval?: number; onNode: Node } & Parameters[1], ): () => void { - interval ??= _getPollInterval('microblock', options); const knownQueryIds = new Set(); const checkNewQueries = async (): Promise => { - const queries = ((await onNode.getOracleQueriesByPubkey(oracleId)).oracleQueries ?? []) + const queries = ((await options.onNode.getOracleQueriesByPubkey(oracleId)).oracleQueries ?? []) .filter(({ id }) => !knownQueryIds.has(id)); queries.forEach((query) => { knownQueryIds.add(query.id); @@ -52,6 +51,7 @@ export function pollForQueries( // eslint-disable-next-line @typescript-eslint/no-floating-promises (async () => { + interval ??= await _getPollInterval('micro-block', options); while (!stopped) { // eslint-disable-line no-unmodified-loop-condition // TODO: allow to handle this error somehow await checkNewQueries().catch(console.error); @@ -74,19 +74,19 @@ export function pollForQueries( export async function pollForQueryResponse( oracleId: Encoded.OracleAddress, queryId: Encoded.OracleQueryId, - { interval, onNode, ...options }: + { interval, ...options }: { interval?: number; onNode: Node } & Parameters[1], ): Promise { - interval ??= _getPollInterval('microblock', options); + interval ??= await _getPollInterval('micro-block', options); let height; let ttl; let response; do { - ({ response, ttl } = await onNode.getOracleQueryByPubkeyAndQueryId(oracleId, queryId)); + ({ response, ttl } = await options.onNode.getOracleQueryByPubkeyAndQueryId(oracleId, queryId)); const responseBuffer = decode(response as Encoded.OracleResponse); if (responseBuffer.length > 0) return responseBuffer.toString(); await pause(interval); - height = await getHeight({ ...options, onNode, cached: true }); + height = await getHeight({ ...options, cached: true }); } while (ttl >= height); throw new RequestTimedOutError(height); } diff --git a/src/tx/builder/field-types/gas-price.ts b/src/tx/builder/field-types/gas-price.ts index 18f3efed59..1623260d05 100644 --- a/src/tx/builder/field-types/gas-price.ts +++ b/src/tx/builder/field-types/gas-price.ts @@ -16,10 +16,7 @@ export async function getCachedIncreasedGasPrice(node: Node): Promise { // TODO: remove after requiring node@6.13.0 const { nodeVersion } = await node._getCachedStatus(); - // TODO: remove remove '6.12.0+' check after releasing 6.13.0 - if (!nodeVersion.startsWith('6.12.0+') && !semverSatisfies(nodeVersion, '6.13.0', '8.0.0')) { - return 0n; - } + if (!semverSatisfies(nodeVersion, '6.13.0')) return 0n; const { minGasPrice, utilization } = (await node.getRecentGasPrices())[0]; let gasPrice = utilization < 70 ? 0n : BigInt( diff --git a/src/tx/builder/field-types/ttl.ts b/src/tx/builder/field-types/ttl.ts index a3196ba603..de2d1690de 100644 --- a/src/tx/builder/field-types/ttl.ts +++ b/src/tx/builder/field-types/ttl.ts @@ -23,7 +23,7 @@ export default { onNode?: Node; absoluteTtl?: boolean; _isInternalBuild?: boolean; - } & Parameters[1], + } & Omit[1], 'onNode'>, ) { if (absoluteTtl !== true && value !== 0 && (value != null || _isInternalBuild === true)) { if (onNode == null) throw new ArgumentError('onNode', 'provided', onNode); diff --git a/src/utils/semver-satisfies.ts b/src/utils/semver-satisfies.ts index 0ecfb9efff..697a76deae 100644 --- a/src/utils/semver-satisfies.ts +++ b/src/utils/semver-satisfies.ts @@ -1,21 +1,22 @@ -export default function semverSatisfies( - version: string, - geVersion: string, - ltVersion: string, -): boolean { +function verCmp(a: string, b: string): number { const getComponents = (v: string): number[] => v .split(/[-+]/)[0].split('.').map((i) => +i); - const versionComponents = getComponents(version); - const geComponents = getComponents(geVersion); - const ltComponents = getComponents(ltVersion); + const aComponents = getComponents(a); + const bComponents = getComponents(b); - const base = Math.max(...versionComponents, ...geComponents, ...ltComponents) + 1; + const base = Math.max(...aComponents, ...bComponents) + 1; const componentsToNumber = (components: number[]): number => components.reverse() .reduce((acc, n, idx) => acc + n * base ** idx, 0); - const vNumber = componentsToNumber(versionComponents); - const geNumber = componentsToNumber(geComponents); - const ltNumber = componentsToNumber(ltComponents); - return vNumber >= geNumber && vNumber < ltNumber; + return componentsToNumber(aComponents) - componentsToNumber(bComponents); +} + +export default function semverSatisfies( + version: string, + geVersion: string, + ltVersion?: string, +): boolean { + return verCmp(version, geVersion) >= 0 + && (ltVersion == null || verCmp(version, ltVersion) < 0); } diff --git a/test/integration/AeSdk.ts b/test/integration/AeSdk.ts new file mode 100644 index 0000000000..42745e093d --- /dev/null +++ b/test/integration/AeSdk.ts @@ -0,0 +1,24 @@ +import { describe, it } from 'mocha'; +import { expect } from 'chai'; +import { getSdk, networkId } from '.'; + +describe('AeSdk', () => { + describe('_getPollInterval', () => { + it('returns value based on options', async () => { + const aeSdk = await getSdk(0); + aeSdk._options._expectedMineRate = 1000; + aeSdk._options._microBlockCycle = 300; + expect(await aeSdk._getPollInterval('key-block')).to.be.equal(333); + expect(await aeSdk._getPollInterval('micro-block')).to.be.equal(100); + }); + + it('returns correct value', async () => { + const aeSdk = await getSdk(0); + delete aeSdk._options._expectedMineRate; + delete aeSdk._options._microBlockCycle; + const [kb, mb] = networkId === 'ae_dev' ? [0, 0] : [60000, 1000]; + expect(await aeSdk._getPollInterval('key-block')).to.be.equal(kb); + expect(await aeSdk._getPollInterval('micro-block')).to.be.equal(mb); + }); + }); +}); diff --git a/test/integration/compiler.ts b/test/integration/compiler.ts index b886552b81..9f3049627f 100644 --- a/test/integration/compiler.ts +++ b/test/integration/compiler.ts @@ -13,7 +13,7 @@ function testCompiler(compiler: CompilerBase, isAesophia7: boolean): void { let inclFileSystem: Record; const inclBytecode = isAesophia7 ? 'cb_+QEGRgOg7BH1sCv+p2IrS0Pn3/i6AfE8lOGUuC71lLPn6mbUm9PAuNm4cv4AWolkAjcCBwcHFBQAAgD+RNZEHwA3ADcAGg6CPwEDP/5Nt4A5AjcCBwcHDAECDAEABAMRAFqJZP6SiyA2ADcBBwcMAwgMAQAEAxFNt4A5/pSgnxIANwF3BwwBAAQDEarAwob+qsDChgI3AXcHPgQAALhgLwYRAFqJZD0uU3VibGlicmFyeS5zdW0RRNZEHxFpbml0EU23gDkxLkxpYnJhcnkuc3VtEZKLIDYRdGVzdBGUoJ8SJWdldExlbmd0aBGqwMKGOS5TdHJpbmcubGVuZ3Rogi8AhTcuNC4xABzDzFw=' - : 'cb_+QEKRgOg7BH1sCv+p2IrS0Pn3/i6AfE8lOGUuC71lLPn6mbUm9PAuNm4cv4AWolkAjcCBwcHFBQAAgD+RNZEHwA3ADcAGg6CPwEDP/5Nt4A5AjcCBwcHDAECDAEABAMRAFqJZP6SiyA2ADcBBwcMAwgMAQAEAxFNt4A5/pSgnxIANwF3BwwBAAQDEarAwob+qsDChgI3AXcHPgQAALhgLwYRAFqJZD0uU3VibGlicmFyeS5zdW0RRNZEHxFpbml0EU23gDkxLkxpYnJhcnkuc3VtEZKLIDYRdGVzdBGUoJ8SJWdldExlbmd0aBGqwMKGOS5TdHJpbmcubGVuZ3Rogi8AiTguMC4wLXJjMQCfQIbH'; + : 'cb_+QEGRgOg7BH1sCv+p2IrS0Pn3/i6AfE8lOGUuC71lLPn6mbUm9PAuNm4cv4AWolkAjcCBwcHFBQAAgD+RNZEHwA3ADcAGg6CPwEDP/5Nt4A5AjcCBwcHDAECDAEABAMRAFqJZP6SiyA2ADcBBwcMAwgMAQAEAxFNt4A5/pSgnxIANwF3BwwBAAQDEarAwob+qsDChgI3AXcHPgQAALhgLwYRAFqJZD0uU3VibGlicmFyeS5zdW0RRNZEHxFpbml0EU23gDkxLkxpYnJhcnkuc3VtEZKLIDYRdGVzdBGUoJ8SJWdldExlbmd0aBGqwMKGOS5TdHJpbmcubGVuZ3Rogi8AhTguMC4wAIUiDfs='; const testBytecode = 'cb_+GhGA6BgYgXqYB9ctBcQ8mJ0+we5OXhb9PpsSQWP2DhPx9obn8C4O57+RNZEHwA3ADcAGg6CPwEDP/6AeCCSADcBd3cBAQCYLwIRRNZEHxFpbml0EYB4IJIZZ2V0QXJngi8AhTcuMC4xAMXqWXc='; const interfaceSourceCodePath = './test/integration/contracts/Interface.aes'; @@ -63,7 +63,7 @@ function testCompiler(compiler: CompilerBase, isAesophia7: boolean): void { }); it('returns version', async () => { - expect(await compiler.version()).to.be.equal(isAesophia7 ? '7.4.1' : '8.0.0-rc1'); + expect(await compiler.version()).to.be.equal(isAesophia7 ? '7.4.1' : '8.0.0'); }); it('compiles and generates aci by path', async () => { diff --git a/test/integration/contract-aci.ts b/test/integration/contract-aci.ts index a357ccca0d..2223715127 100644 --- a/test/integration/contract-aci.ts +++ b/test/integration/contract-aci.ts @@ -19,6 +19,7 @@ import { NoSuchContractFunctionError, ConsensusProtocolVersion, InvalidTxError, + ContractError, } from '../../src'; import { getSdk } from '.'; import { @@ -362,6 +363,18 @@ describe('Contract instance', () => { expect((await contract.intFn(3)).decodedResult).to.be.equal(3n); }); + it('fails if aci doesn\'t match called contract', async () => { + const aci = structuredClone(testContractAci); + const fn = aci.at(-1)?.contract?.functions.find(({ name }) => name === 'intFn'); + assertNotNull(fn); + fn.arguments.push(fn.arguments[0]); + const contract = await aeSdk.initializeContract<{ + intFn: (a: InputNumber, b: InputNumber) => bigint; + }>({ aci, address: testContract.$options.address }); + await expect(contract.intFn(3, 2)).to.be + .rejectedWith(ContractError, 'ACI doesn\'t match called contract. Error provided by node: Expected 1 arguments, got 2'); + }); + it('deploys and calls by bytecode and aci', async () => { const contract = await aeSdk.initializeContract( { bytecode: testContractBytecode, aci: testContractAci }, diff --git a/test/integration/transaction.ts b/test/integration/transaction.ts index 8c79ad303b..b0f5915be1 100644 --- a/test/integration/transaction.ts +++ b/test/integration/transaction.ts @@ -202,7 +202,7 @@ describe('Transaction', () => { if (consensusProtocolVersion === ConsensusProtocolVersion.Iris) { return 'tx_+LAqAaEBhAyXS5cWR3ZFS6EZ2E7cTWBYqN7JK27cV4qy0wtMQgABuGr4aEYDoKEijZbj/w2AeiWwAbldusME5pm3ZgPuomnZ3TbUbYgrwLg7nv5E1kQfADcANwAaDoI/AQM//oB4IJIANwEHBwEBAJgvAhFE1kQfEWluaXQRgHggkhlnZXRBcmeCLwCFNy40LjEAgwcAA4ZHcyzkwAAAAACDTEtAhDuaygCHKxFE1kQfP+mk9Ac='; } - return 'tx_+LQqAaEBhAyXS5cWR3ZFS6EZ2E7cTWBYqN7JK27cV4qy0wtMQgABuG74bEYDoKEijZbj/w2AeiWwAbldusME5pm3ZgPuomnZ3TbUbYgrwLg7nv5E1kQfADcANwAaDoI/AQM//oB4IJIANwEHBwEBAJgvAhFE1kQfEWluaXQRgHggkhlnZXRBcmeCLwCJOC4wLjAtcmMxAIMIAAOGR4XNQ+AAAAAAg0xLQIQ7msoAhysRRNZEHz+l4Zcy'; + return 'tx_+LAqAaEBhAyXS5cWR3ZFS6EZ2E7cTWBYqN7JK27cV4qy0wtMQgABuGr4aEYDoKEijZbj/w2AeiWwAbldusME5pm3ZgPuomnZ3TbUbYgrwLg7nv5E1kQfADcANwAaDoI/AQM//oB4IJIANwEHBwEBAJgvAhFE1kQfEWluaXQRgHggkhlnZXRBcmeCLwCFOC4wLjAAgwgAA4ZHcyzkwAAAAACDTEtAhDuaygCHKxFE1kQfP6UPXo4='; }, async () => aeSdk.buildTx({ tag: Tag.ContractCreateTx, diff --git a/test/unit/ae-sdk.ts b/test/unit/ae-sdk.ts index 5d37c7cada..66863a6a7c 100644 --- a/test/unit/ae-sdk.ts +++ b/test/unit/ae-sdk.ts @@ -4,8 +4,8 @@ import '../index'; import { AeSdk } from '../../src'; describe('AeSdk', () => { - it('executes methods without node, compiler, accounts', () => { - const aeSdk = new AeSdk(); - expect(aeSdk._getPollInterval('block')).to.be.a('number'); + it('executes methods without node, compiler, accounts', async () => { + const aeSdk = new AeSdk({ _expectedMineRate: 1000 }); + expect(await aeSdk._getPollInterval('key-block')).to.be.equal(333); }); }); diff --git a/test/unit/semver-satisfies.ts b/test/unit/semver-satisfies.ts index 051815919a..e22b626385 100644 --- a/test/unit/semver-satisfies.ts +++ b/test/unit/semver-satisfies.ts @@ -13,5 +13,6 @@ describe('semverSatisfies', () => { expect(semverSatisfies('5.0.0', '3.0.0', '5.0.0')).to.equal(false); expect(semverSatisfies('6.0.0-rc4', '6.0.0', '7.0.0')).to.equal(true); expect(semverSatisfies('6.3.0+2.0f7ce80e', '6.0.0', '7.0.0')).to.equal(true); + expect(semverSatisfies('7.0.0', '6.13.0')).to.equal(true); }); }); diff --git a/tooling/autorest/compiler-prepare.mjs b/tooling/autorest/compiler-prepare.mjs index 1ebdb20dc8..1c67a1f8f9 100644 --- a/tooling/autorest/compiler-prepare.mjs +++ b/tooling/autorest/compiler-prepare.mjs @@ -1,6 +1,6 @@ import fs from 'fs'; -const swaggerUrl = 'https://raw.githubusercontent.com/aeternity/aesophia_http/v8.0.0-rc1/config/swagger.yaml'; +const swaggerUrl = 'https://raw.githubusercontent.com/aeternity/aesophia_http/v8.0.0/config/swagger.yaml'; const response = await fetch(swaggerUrl); console.assert(response.status === 200, 'Invalid response code', response.status); diff --git a/tooling/fetch-aesophia-cli-8.mjs b/tooling/fetch-aesophia-cli-8.mjs index c2b3f5106f..0b82a71565 100644 --- a/tooling/fetch-aesophia-cli-8.mjs +++ b/tooling/fetch-aesophia-cli-8.mjs @@ -3,11 +3,11 @@ import { writeFileSync } from 'fs'; import restoreFile from './restore-file.mjs'; const path = './bin/aesophia_cli_8'; -const hash = 'Xm+NIrI8S/u/mL4d5ZPcGJ+L+i3DfyKfvRY3iEXY+Or8dN8dGzupWcxlD2CJ3I2SRg/EzPwWIYPZCREC4RSgXA=='; +const hash = 'RYAgt3BbPt4UlANdcOff68hca0p1q2dK+H1b5BSMNUl6+zb9JjoJIn2/MlMxJAF0WdpjJKlVTkocXY7pMVIzCg=='; await restoreFile(path, hash, async () => { const request = await fetch( - 'https://github.com/aeternity/aesophia_cli/releases/download/v8.0.0-rc1/aesophia_cli', + 'https://github.com/aeternity/aesophia_cli/releases/download/v8.0.0/aesophia_cli', ); const body = Buffer.from(await request.arrayBuffer()); writeFileSync(path, body);