Skip to content

Commit 02d293d

Browse files
Merge pull request #740 from HathorNetwork/release-candidate
Release v1.10.0
2 parents f740387 + a960396 commit 02d293d

File tree

95 files changed

+992
-550
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+992
-550
lines changed

.eslintrc.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.exports = {
99
parserOptions: {
1010
ecmaVersion: 2023, // Allows for the parsing of modern ECMAScript features
1111
sourceType: 'module', // Allows for the use of imports
12+
project: ['./tsconfig.json', './tsconfig.test.json'],
1213
},
1314
settings: {
1415
'import/resolver': {
@@ -54,6 +55,7 @@ module.exports = {
5455
{
5556
vars: 'all',
5657
args: 'none', // We should change to args: after-used
58+
varsIgnorePattern: '^_', // Allow variables starting with _ to be unused
5759
},
5860
],
5961
'no-underscore-dangle': 0,
@@ -70,6 +72,7 @@ module.exports = {
7072
ts: 'never',
7173
},
7274
],
75+
'jest/no-disabled-tests': 'off', // It's useful to have skipped tests on our suites
7376

7477
/* These last rules would require a large effort and potentially cause breaking changes,
7578
* So they will be left out for now and dealt with separately.
@@ -92,6 +95,33 @@ module.exports = {
9295
},
9396
plugins: ['jest'],
9497
extends: ['plugin:jest/recommended'], // Use recommended Jest rules
98+
rules: {
99+
'jest/no-disabled-tests': 'off', // It's useful to have skipped tests on our suites
100+
"jest/expect-expect": [
101+
'error',
102+
{
103+
assertFunctionNames: [
104+
'expect',
105+
'executeTests', // from NanoContracts bet tests
106+
'testUnlockWhenSpent', // from Nano contracts Storage tests
107+
'testLockedUtxoMethods', // from Common Store tests
108+
'testRegisteredTokens', // from Common Store tests
109+
'testScanningPolicies', // from Common Store tests
110+
'testBestUtxoSelection', // from utxo test
111+
'testFastUtxoSelection', // from utxo test
112+
'handleStopTest', // from storage test
113+
'processLockedUtxoTest', // from storage test
114+
'getChangeAddressTest', // from storage test
115+
'getAcctXprivTest', // from storage test
116+
'accessDataTest', // from storage test
117+
'checkPinTest', // from storage test
118+
'checkPasswdTest', // from storage test
119+
'testSelectUtxos', // from storage test
120+
'testScanningPolicy', // from storage test
121+
],
122+
},
123+
],
124+
},
95125
},
96126
],
97127
};

.github/workflows/integration-test.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
name: integration-test
22
on:
3+
push:
4+
branches:
5+
- master
6+
- release
7+
- release-candidate
8+
tags:
9+
- v*
310
pull_request:
411
branches:
512
- release
@@ -37,8 +44,8 @@ jobs:
3744

3845
- name: Upload debug transaction logs
3946
if: always()
40-
# https://github.com/actions/upload-artifact/releases/tag/v3.1.2
41-
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
47+
# https://github.com/actions/upload-artifact/releases/tag/v4.3.6
48+
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a
4249
with:
4350
name: test-transacion-logs
4451
path: tmp
@@ -64,8 +71,8 @@ jobs:
6471

6572
- name: Upload logs to GitHub
6673
if: failure()
67-
# https://github.com/actions/upload-artifact/releases/tag/v3.1.2
68-
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
74+
# https://github.com/actions/upload-artifact/releases/tag/v4.3.6
75+
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a
6976
with:
7077
name: logs.tgz
7178
path: ./docker-logs.tgz

.github/workflows/release-sync.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: Sync Release with Master
22

33
# Triggered when a new version is released publicly
44
on:
5-
workflow_dispatch:
65
release:
76
types: [ released ]
87

__tests__/__fixtures__/tx_history.js renamed to __tests__/__fixtures__/tx_history.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ export default [
22
{
33
tx_id: '0000000110eb9ec96e255a09d6ae7d856bff53453773bae5500cee2905db670e',
44
version: 0,
5+
signalBits: 0,
6+
nonce: 0,
7+
tokens: [],
58
weight: 22.719884359974895,
69
timestamp: 1613538740,
710
is_voided: false,
@@ -31,6 +34,9 @@ export default [
3134
{
3235
tx_id: '0000000211673128a49ea700c7b3efbbbc4b3bfe5bf289bc5a1967f12d3c30b5',
3336
version: 0,
37+
signalBits: 0,
38+
nonce: 0,
39+
tokens: [],
3440
weight: 21.911255937644835,
3541
timestamp: 1613519819,
3642
is_voided: false,
@@ -60,6 +66,9 @@ export default [
6066
{
6167
tx_id: '0000000292236abbb41a2201409b85084631389950f76f7da0d8734b51b31758',
6268
version: 0,
69+
signalBits: 0,
70+
nonce: 0,
71+
tokens: [],
6372
weight: 22.255565408819944,
6473
timestamp: 1613524608,
6574
is_voided: false,
@@ -89,6 +98,9 @@ export default [
8998
{
9099
tx_id: '00000003508b2c24066365cffe23cd77896dad01a665c64cd4797654c6acab92',
91100
version: 0,
101+
signalBits: 0,
102+
nonce: 0,
103+
tokens: [],
92104
weight: 21.7848190101318,
93105
timestamp: 1613529833,
94106
is_voided: true,
@@ -118,6 +130,9 @@ export default [
118130
{
119131
tx_id: '0000000419625e2587c225fb49f36278c9da681ec05e039125307b8aef3d3d30',
120132
version: 0,
133+
signalBits: 0,
134+
nonce: 0,
135+
tokens: [],
121136
weight: 22.227347437740097,
122137
timestamp: 1613522627,
123138
is_voided: false,
@@ -147,6 +162,9 @@ export default [
147162
{
148163
tx_id: '0000000fa2157d34a56b89c08e1783cd1103f6e6807bb01ccff1d920b31d1052',
149164
version: 0,
165+
signalBits: 0,
166+
nonce: 0,
167+
tokens: [],
150168
weight: 26.450454121121226,
151169
timestamp: 1613678350,
152170
is_voided: false,
@@ -176,6 +194,9 @@ export default [
176194
{
177195
tx_id: '0000000fa2157d34a56b89c08e1783cd1103f6e6807bb01ccff1d920b31d1053',
178196
version: 0,
197+
signalBits: 0,
198+
nonce: 0,
199+
tokens: [],
179200
weight: 26.450454121121226,
180201
timestamp: 1613678350,
181202
is_voided: false,
@@ -205,6 +226,9 @@ export default [
205226
{
206227
tx_id: '0000000fa2157d34a56b89c08e1783cd1103f6e6807bb01ccff1d920b31d1054',
207228
version: 0,
229+
signalBits: 0,
230+
nonce: 0,
231+
tokens: [],
208232
weight: 26.450454121121226,
209233
timestamp: 1613678350,
210234
is_voided: false,
@@ -234,6 +258,9 @@ export default [
234258
{
235259
tx_id: '0000000fa2157d34a56b89c08e1783cd1103f6e6807bb01ccff1d920b31d1055',
236260
version: 0,
261+
signalBits: 0,
262+
nonce: 0,
263+
tokens: [],
237264
weight: 26.450454121121226,
238265
timestamp: 1613678350,
239266
is_voided: false,
@@ -263,6 +290,9 @@ export default [
263290
{
264291
tx_id: '0000000fa2157d34a56b89c08e1783cd1103f6e6807bb01ccff1d920b31d1056',
265292
version: 0,
293+
signalBits: 0,
294+
nonce: 0,
295+
tokens: [],
266296
weight: 26.450454121121226,
267297
timestamp: 1613678370,
268298
is_voided: false,
@@ -292,6 +322,9 @@ export default [
292322
{
293323
tx_id: '0000000fa2157d34a56b89c08e1783cd1103f6e6807bb01ccff1d920b31d1057',
294324
version: 0,
325+
signalBits: 0,
326+
nonce: 0,
327+
tokens: [],
295328
weight: 26.450454121121226,
296329
timestamp: 1613678370,
297330
is_voided: false,

__tests__/api/txMining.test.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import MockAdapter from 'axios-mock-adapter';
2-
import axios from 'axios';
2+
import axios, { AxiosError } from 'axios';
33
import txMiningApi from '../../src/api/txMining';
44

55
describe('txMiningApi', () => {
@@ -37,12 +37,15 @@ describe('txMiningApi', () => {
3737
it('should allow capturing errors in case the server responds with 500', async () => {
3838
mock.onGet('job-status').reply(500);
3939

40+
let err: unknown;
4041
try {
4142
await txMiningApi.getJobStatus('jobId', () => {});
4243
} catch (e) {
43-
expect(e.message).toEqual('Request failed with status code 500');
44-
expect(e.response.status).toEqual(500);
44+
err = e;
4545
}
46+
expect(err).toBeInstanceOf(AxiosError);
47+
expect((err as AxiosError).message).toEqual('Request failed with status code 500');
48+
expect((err as AxiosError).response?.status).toEqual(500);
4649
});
4750
});
4851

@@ -70,12 +73,14 @@ describe('txMiningApi', () => {
7073
it('should allow capturing errors in case the server responds with 500', async () => {
7174
mock.onPost('cancel-job').reply(500);
7275

76+
let err: unknown;
7377
try {
7478
await txMiningApi.cancelJob('jobId', () => {});
7579
} catch (e) {
76-
expect(e.message).toEqual('Request failed with status code 500');
77-
expect(e.response.status).toEqual(500);
80+
err = e;
7881
}
82+
expect((err as AxiosError).message).toEqual('Request failed with status code 500');
83+
expect((err as AxiosError).response?.status).toEqual(500);
7984
});
8085
});
8186

@@ -98,12 +103,14 @@ describe('txMiningApi', () => {
98103
it('should allow capturing errors in case the server responds with 500', async () => {
99104
mock.onGet('health').reply(500);
100105

106+
let err: unknown;
101107
try {
102108
await txMiningApi.getHealth();
103109
} catch (e) {
104-
expect(e.message).toEqual('Request failed with status code 500');
105-
expect(e.response.status).toEqual(500);
110+
err = e;
106111
}
112+
expect((err as AxiosError).message).toEqual('Request failed with status code 500');
113+
expect((err as AxiosError).response?.status).toEqual(500);
107114
});
108115
});
109116

@@ -138,12 +145,14 @@ describe('txMiningApi', () => {
138145
it('should allow capturing errors in case the server responds with 500', async () => {
139146
mock.onPost('submit-job').reply(500);
140147

148+
let err: unknown;
141149
try {
142150
await txMiningApi.submitJob('tx', true, true, 10, () => {});
143151
} catch (e) {
144-
expect(e.message).toEqual('Request failed with status code 500');
145-
expect(e.response.status).toEqual(500);
152+
err = e;
146153
}
154+
expect((err as AxiosError).message).toEqual('Request failed with status code 500');
155+
expect((err as AxiosError).response?.status).toEqual(500);
147156
});
148157
});
149158
});

__tests__/api/version.test.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import MockAdapter from 'axios-mock-adapter';
2-
import axios from 'axios';
2+
import axios, { AxiosError } from 'axios';
33
import versionApi from '../../src/api/version';
44

55
describe('versionApi', () => {
@@ -34,12 +34,14 @@ describe('versionApi', () => {
3434
it('should allow capturing errors in case the server responds with 500', async () => {
3535
mock.onGet('/version').reply(500);
3636

37+
let err: unknown;
3738
try {
3839
await versionApi.getVersion(() => {});
3940
} catch (e) {
40-
expect(e.message).toEqual('Request failed with status code 500');
41-
expect(e.response.status).toEqual(500);
41+
err = e;
4242
}
43+
expect((err as AxiosError).message).toEqual('Request failed with status code 500');
44+
expect((err as AxiosError).response?.status).toEqual(500);
4345
});
4446
});
4547

@@ -62,12 +64,14 @@ describe('versionApi', () => {
6264
it('should allow capturing errors in case the server responds with 500', async () => {
6365
mock.onGet('/version').reply(500);
6466

67+
let err: unknown;
6568
try {
6669
await versionApi.asyncGetVersion();
6770
} catch (e) {
68-
expect(e.message).toEqual('Request failed with status code 500');
69-
expect(e.response.status).toEqual(500);
71+
err = e;
7072
}
73+
expect((err as AxiosError).message).toEqual('Request failed with status code 500');
74+
expect((err as AxiosError).response?.status).toEqual(500);
7175
});
7276
});
7377
});

__tests__/integration/atomic_swap.test.js renamed to __tests__/integration/atomic_swap.test.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { loggers } from './utils/logger.util';
1010
import { NATIVE_TOKEN_UID } from '../../src/constants';
1111
import SendTransaction from '../../src/new/sendTransaction';
1212
import PartialTxProposal from '../../src/wallet/partialTxProposal';
13-
import { delay } from './utils/core.util';
1413

1514
describe('partial tx proposal', () => {
1615
afterEach(async () => {
@@ -24,11 +23,7 @@ describe('partial tx proposal', () => {
2423
const hWallet2 = await generateWalletHelper();
2524

2625
// Injecting funds and creating a new custom token
27-
const txI = await GenesisWalletHelper.injectFunds(
28-
hWallet1,
29-
await hWallet1.getAddressAtIndex(0),
30-
103
31-
);
26+
await GenesisWalletHelper.injectFunds(hWallet1, await hWallet1.getAddressAtIndex(0), 103);
3227
const { hash: token1Uid } = await createTokenHelper(hWallet1, 'Token1', 'TK1', 200);
3328

3429
// Injecting funds and creating a new custom token

__tests__/integration/configuration/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66

77
fullnode:
88
image:
9-
${HATHOR_LIB_INTEGRATION_TESTS_FULLNODE_IMAGE:-hathornetwork/hathor-core:experimental-nano-sdk-v1.1}
9+
${HATHOR_LIB_INTEGRATION_TESTS_FULLNODE_IMAGE:-hathornetwork/hathor-core:experimental-nano-sdk-new-types}
1010
command: [
1111
"run_node",
1212
"--listen", "tcp:40404",

__tests__/integration/hathorwallet_facade.test.js renamed to __tests__/integration/hathorwallet_facade.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,7 @@ describe('addresses methods', () => {
712712

713713
// Validating gap limit
714714
if (i === 22) {
715+
// eslint-disable-next-line jest/no-conditional-expect -- This is already the simplest way to test the gap limit
715716
expect(genResults).toStrictEqual({
716717
done: true,
717718
value: undefined,

0 commit comments

Comments
 (0)