Skip to content

Commit a6f7b75

Browse files
authored
Merge pull request #1978 from aeternity/release/13.3.2
Release v13.3.2
2 parents 4f06d95 + d2d9642 commit a6f7b75

22 files changed

Lines changed: 121 additions & 74 deletions

.github/workflows/main.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ jobs:
88
runs-on: ubuntu-22.04
99
steps:
1010
- run: |
11-
wget -q https://packages.erlang-solutions.com/erlang/debian/pool/esl-erlang_25.0.4-1~ubuntu~jammy_amd64.deb
12-
sudo apt install --allow-downgrades ./esl-erlang_25.0.4-1~ubuntu~jammy_amd64.deb
11+
wget -q https://packages.erlang-solutions.com/erlang/debian/pool/esl-erlang_25.2.3-1~ubuntu~jammy_amd64.deb
12+
sudo apt install ./esl-erlang_25.2.3-1~ubuntu~jammy_amd64.deb
1313
- uses: actions/checkout@v4
1414
with:
1515
fetch-depth: 100
@@ -30,8 +30,6 @@ jobs:
3030
BASE: ${{ github.event.pull_request.base.sha }}
3131
run: npx commitlint --from $BASE --to $HEAD --verbose
3232
- run: npm run lint
33-
# TODO: remove after merging https://github.com/aeternity/aeternity/pull/4319
34-
- run: chmod 666 ./docker/accounts-pub.json
3533
- run: docker compose up -d --wait
3634
- run: npx nyc npm test
3735
- run: npx nyc report --reporter=text-lcov > coverage.lcov

docker-compose.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ services:
1010
interval: 2s
1111
volumes:
1212
- ./docker/aeternity.yaml:/home/aeternity/node/aeternity.yaml
13-
- ./docker/accounts.json:/home/aeternity/node/data/aeplugin_dev_mode/devmode_prefunded_accounts.json
14-
# TODO: remove after merging https://github.com/aeternity/aeternity/pull/4319
15-
- ./docker/accounts-pub.json:/home/aeternity/node/data/aeplugin_dev_mode/devmode_prefunded_accounts-PUB.json
1613
stop_grace_period: 0s
1714

1815
emitter:
@@ -22,7 +19,7 @@ services:
2219
condition: service_healthy
2320

2421
compiler:
25-
image: aeternity/aesophia_http:v8.0.0-rc1
22+
image: aeternity/aesophia_http:v8.0.0
2623
ports: [3080:3080]
2724
# TODO: remove after releasing https://github.com/aeternity/aesophia_http/pull/133
2825
healthcheck:

docker/accounts-pub.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

docker/accounts.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

docker/aeternity.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ chain:
2222
hard_forks:
2323
"1": 0
2424
"6": 1
25+
genesis_accounts:
26+
ak_21A27UVVt3hDkBE5J7rhhqnH5YNb4Y1dqo4PnSybrH85pnWo7E: 10000000000000000000000

docs/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
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.
44

5+
### [13.3.2](https://github.com/aeternity/aepp-sdk-js/compare/v13.3.1...v13.3.2) (2024-04-22)
6+
7+
8+
### Bug Fixes
9+
10+
* **contract:** detect if ACI doesn't match called contract ([8c4287f](https://github.com/aeternity/aepp-sdk-js/commit/8c4287f2cdd1690ed2e07410a322659e4f17f2d3))
11+
* ttl validation error in dev mode by reducing polling intervals ([6f8cdc9](https://github.com/aeternity/aepp-sdk-js/commit/6f8cdc9dd82a7dd7f146739d472dc07018f8d230))
12+
513
### [13.3.1](https://github.com/aeternity/aepp-sdk-js/compare/v13.3.0...v13.3.1) (2024-04-19)
614

715

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@aeternity/aepp-sdk",
3-
"version": "13.3.1",
3+
"version": "13.3.2",
44
"description": "SDK for the æternity blockchain",
55
"main": "dist/aepp-sdk.js",
66
"types": "es/index.d.ts",
@@ -111,7 +111,7 @@
111111
},
112112
"repository": {
113113
"type": "git",
114-
"url": "https://github.com/aeternity/aepp-sdk-js"
114+
"url": "git+https://github.com/aeternity/aepp-sdk-js.git"
115115
},
116116
"devDependencies": {
117117
"@babel/cli": "^7.23.9",

src/chain.ts

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,25 @@ import {
2121
* @param type - Type
2222
* @param options - Options
2323
*/
24-
export function _getPollInterval(
25-
type: 'block' | 'microblock', // TODO: rename to 'key-block' | 'micro-block'
26-
{ _expectedMineRate = 180000, _microBlockCycle = 3000 }:
27-
{ _expectedMineRate?: number; _microBlockCycle?: number },
28-
): number {
29-
const base = {
30-
block: _expectedMineRate,
31-
microblock: _microBlockCycle,
32-
}[type];
24+
export async function _getPollInterval(
25+
type: 'key-block' | 'micro-block',
26+
{ _expectedMineRate, _microBlockCycle, onNode }:
27+
{ _expectedMineRate?: number; _microBlockCycle?: number; onNode: Node },
28+
): Promise<number> {
29+
const getVal = async (
30+
t: string,
31+
val: number | undefined,
32+
devModeDef: number,
33+
def: number,
34+
): Promise<number | null> => {
35+
if (t !== type) return null;
36+
if (val != null) return val;
37+
return await onNode?.getNetworkId() === 'ae_dev' ? devModeDef : def;
38+
};
39+
40+
const base = await getVal('key-block', _expectedMineRate, 0, 180000)
41+
?? await getVal('micro-block', _microBlockCycle, 0, 3000)
42+
?? (() => { throw new InternalError(`Unknown type: ${type}`); })();
3343
return Math.floor(base / 3);
3444
}
3545

@@ -53,7 +63,7 @@ export async function getHeight(
5363
const onNode = unwrapProxy(options.onNode);
5464
if (cached) {
5565
const cache = heightCache.get(onNode);
56-
if (cache != null && cache.time > Date.now() - _getPollInterval('block', options)) {
66+
if (cache != null && cache.time > Date.now() - await _getPollInterval('key-block', options)) {
5767
return cache.height;
5868
}
5969
}
@@ -77,21 +87,21 @@ export async function getHeight(
7787
export async function poll(
7888
th: Encoded.TxHash,
7989
{
80-
blocks = 5, interval, onNode, ...options
90+
blocks = 5, interval, ...options
8191
}:
8292
{ blocks?: number; interval?: number; onNode: Node } & Parameters<typeof _getPollInterval>[1],
8393
): Promise<TransformNodeType<SignedTx>> {
84-
interval ??= _getPollInterval('microblock', options);
94+
interval ??= await _getPollInterval('micro-block', options);
8595
let max;
8696
do {
87-
const tx = await onNode.getTransactionByHash(th);
97+
const tx = await options.onNode.getTransactionByHash(th);
8898
if (tx.blockHeight !== -1) return tx;
8999
if (max == null) {
90100
max = tx.tx.ttl !== 0 ? -1
91-
: await getHeight({ ...options, onNode, cached: true }) + blocks;
101+
: await getHeight({ ...options, cached: true }) + blocks;
92102
}
93103
await pause(interval);
94-
} while (max === -1 ? true : await getHeight({ ...options, onNode, cached: true }) < max);
104+
} while (max === -1 ? true : await getHeight({ ...options, cached: true }) < max);
95105
throw new TxTimedOutError(blocks, th);
96106
}
97107

@@ -106,14 +116,14 @@ export async function poll(
106116
*/
107117
export async function awaitHeight(
108118
height: number,
109-
{ interval, onNode, ...options }:
119+
{ interval, ...options }:
110120
{ interval?: number; onNode: Node } & Parameters<typeof _getPollInterval>[1],
111121
): Promise<number> {
112-
interval ??= Math.min(_getPollInterval('block', options), 5000);
122+
interval ??= Math.min(await _getPollInterval('key-block', options), 5000);
113123
let currentHeight;
114124
do {
115125
if (currentHeight != null) await pause(interval);
116-
currentHeight = await getHeight({ onNode });
126+
currentHeight = await getHeight(options);
117127
} while (currentHeight < height);
118128
return currentHeight;
119129
}

src/contract/Contract.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ class Contract<M extends ContractMethodsBase> {
171171
break;
172172
case 'error':
173173
message = decode(returnValue).toString();
174+
if (/Expected \d+ arguments, got \d+/.test(message)) {
175+
throw new ContractError(`ACI doesn't match called contract. Error provided by node: ${message}`);
176+
}
174177
break;
175178
default:
176179
throw new InternalError(`Unknown return type: ${returnType}`);

0 commit comments

Comments
 (0)