Skip to content

Commit

Permalink
Merge pull request #515 from HathorNetwork/release-candidate
Browse files Browse the repository at this point in the history
Release v0.34.0
  • Loading branch information
glevco authored Dec 20, 2024
2 parents e078fd6 + 88387b1 commit 71978e9
Show file tree
Hide file tree
Showing 32 changed files with 376 additions and 187 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"**/*.js"
],
"env": {
"es2020": true,
"jest": true
}
}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/apidocs-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:

strategy:
matrix:
node-version: [20.x]
node-version: [22.x]

steps:
# https://github.com/actions/checkout/releases/tag/v4.0.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/apidocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
node-version: [20.x]
node-version: [22.x]

steps:
# https://github.com/actions/checkout/releases/tag/v4.0.0
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

strategy:
matrix:
node-version: [20.x]
node-version: [22.x]

steps:
- name: Checkout
Expand All @@ -44,6 +44,7 @@ jobs:
run: npm run test_integration

- name: Upload coverage
if: ${{ matrix.node-version == '22.x' }}
# https://github.com/codecov/codecov-action/releases/tag/v4.5.0
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673
with:
Expand All @@ -56,24 +57,24 @@ jobs:
# https://github.com/actions/upload-artifact/releases/tag/v4.3.6
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a
with:
name: test-transacion-logs
name: test-transaction-logs-${{ matrix.node-version }}
path: tmp

- name: Collect docker logs on failure
if: failure()
# https://github.com/jwalton/gh-docker-logs/releases/tag/v1.0.0
uses: jwalton/gh-docker-logs@2a058a3b4c97aa3524391cb33bb5e917913ed676
with:
dest: './docker-logs'
dest: ./docker-logs-${{ matrix.node-version }}

- name: Tar logs
if: failure()
run: tar cvzf ./docker-logs.tgz ./docker-logs
run: tar cvzf ./docker-logs-${{ matrix.node-version }}.tgz ./docker-logs-${{ matrix.node-version }}

- name: Upload logs to GitHub
if: failure()
# https://github.com/actions/upload-artifact/releases/tag/v4.3.6
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a
with:
name: logs.tgz
path: ./docker-logs.tgz
name: logs-${{ matrix.node-version }}.tgz
path: ./docker-logs-${{ matrix.node-version }}.tgz
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
node-version: [20.x]
node-version: [22.x]
steps:
# https://github.com/actions/checkout/releases/tag/v4.1.7
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
timeout-minutes: 40 # default is 360
strategy:
matrix:
node-version: [20.x]
node-version: [22.x]
steps:
- name: Checkout
# https://github.com/actions/checkout/releases/tag/v4.1.7
Expand All @@ -40,6 +40,7 @@ jobs:
run: npm run test

- name: Upload coverage
if: ${{ matrix.node-version == '22.x' }}
# https://github.com/codecov/codecov-action/releases/tag/v4.5.0
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673
with:
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20
v22
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG IMG=node:20.11-alpine3.19
ARG IMG=node:22.11-alpine3.19

FROM $IMG as builder

Expand Down
84 changes: 83 additions & 1 deletion __tests__/__fixtures__/http-fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ export default {
tokens: ['04']
},
],
has_more: false,
},
'/v1a/push_tx': {
success: true,
Expand Down Expand Up @@ -1018,9 +1019,64 @@ export default {
'/transaction': {
success: true,
tx: {
hash: '00000008707722cde59ac9e7f4d44efbd3a5bd5f244223816ee676d328943b1b'
hash: '00000008707722cde59ac9e7f4d44efbd3a5bd5f244223816ee676d328943b1b',
version: 4,
nc_blueprint_id: '3cb032600bdf7db784800e4ea911b10676fa2f67591f82bb62628c234e771595',
nonce: '0',
timestamp: 1572636346,
weight: 1,
signal_bits: 0,
parents: ['1234', '5678'],
inputs: [],
outputs: [
{
value: 6400,
token_data: 0,
script: 'dqkUsmE9zshkgB58piBD7ETUV0e/NgmIrA==',
decoded: {
type: 'P2PKH',
address: 'WewDeXWyvHP7jJTs7tjLoQfoB72LLxJQqN',
timelock: null,
value: 6400,
},
token: '00',
spent_by: null,
selected_as_input: false,
},
{
value: 6400,
token_data: 0,
script: 'qRTqJUJmzEmBNvhkmDuZ4JxcMh5/ioc=',
decoded: {
type: 'MultiSig',
address: 'wgyUgNjqZ18uYr4YfE2ALW6tP5hd8MumH5',
timelock: null,
value: 6400,
},
token: '00',
spent_by: null,
selected_as_input: false,
},
],
tokens: [],
raw: '',
},
spent_outputs: {},
meta: {
hash: '5c02adea056d7b43e83171a0e2d226d564c791d583b32e9a404ef53a2e1b363a',
spent_outputs: [],
received_by: [],
children: [],
conflict_with: [],
voided_by: [],
twins: [],
accumulated_weight: 1,
score: 0,
height: 0,
min_height: 0,
feature_activation_bit_counts: null,
first_block: null,
validation: 'full',
first_block_height: 1234,
},
},
Expand All @@ -1030,6 +1086,32 @@ export default {
hash: '5c02adea056d7b43e83171a0e2d226d564c791d583b32e9a404ef53a2e1b363a',
version: 4,
nc_blueprint_id: '3cb032600bdf7db784800e4ea911b10676fa2f67591f82bb62628c234e771595',
nonce: '0',
timestamp: 1572636346,
weight: 1,
signal_bits: 0,
parents: ['1234', '5678'],
inputs: [],
outputs: [],
tokens: [],
raw: '',
},
spent_outputs: {},
meta: {
hash: '5c02adea056d7b43e83171a0e2d226d564c791d583b32e9a404ef53a2e1b363a',
spent_outputs: [],
received_by: [],
children: [],
conflict_with: [],
voided_by: [],
twins: [],
accumulated_weight: 1,
score: 0,
height: 0,
min_height: 0,
feature_activation_bit_counts: null,
first_block: null,
validation: 'full'
},
},
'/getmininginfo': {
Expand Down
4 changes: 2 additions & 2 deletions __tests__/atomic-swap/get-my-signatures.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ describe('get-my-signatures api', () => {
fromPartialTxSpy.mockImplementation((pt, storage) => createProposal(
storage,
[
new ProposalInput(fakeTxId, 0, 10, TestUtils.addresses[0]),
new ProposalInput(fakeTxId, 0, 10n, TestUtils.addresses[0]),
],
[
new ProposalOutput(10, scriptFromAddress(TestUtils.addresses[1])),
new ProposalOutput(10n, scriptFromAddress(TestUtils.addresses[1])),
],
));

Expand Down
6 changes: 3 additions & 3 deletions __tests__/atomic-swap/tx-proposal-create.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ describe('create tx-proposal api', () => {
index: 0,
token: hathorLib.constants.NATIVE_TOKEN_UID,
address: TestUtils.addresses[0],
value: 10,
authorities: 0,
value: 10n,
authorities: 0n,
timelock: null,
type: 1,
height: null,
Expand Down Expand Up @@ -238,7 +238,7 @@ describe('create tx-proposal api', () => {
index: 1,
token: fakeUid,
address: TestUtils.addresses[0],
value: 10,
value: 10n,
authorities: 0,
timelock: null,
type: 1,
Expand Down
18 changes: 5 additions & 13 deletions __tests__/decode.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,36 +146,27 @@ describe('decode api', () => {
let script = new P2PKH(address);
partialTx.outputs.push(
new ProposalOutput(
10,
10n,
script.createScript(),
{ token: fakeToken1, tokenData: 1 }
)
);

address = new Address(TestUtils.addresses[1]);
script = new P2PKH(address);
partialTx.outputs.push(new ProposalOutput(20, script.createScript()));
partialTx.outputs.push(new ProposalOutput(20n, script.createScript()));

partialTx.inputs.push(
new ProposalInput(
fakeInputHash,
1,
30,
30n,
TestUtils.addresses[2],
{ token: fakeToken2, tokenData: 1 },
)
);

const txHistoryResponse = httpFixtures['/thin_wallet/address_history'];
const txHistory = txHistoryResponse.history;
const fakeTx = txHistory[0];
const fakeTxResponse = {
success: true,
tx: fakeTx,
meta: {
first_block_height: 1234,
},
};
const fakeTxResponse = httpFixtures['/transaction'];
TestUtils.httpMock.onGet('/transaction').reply(200, fakeTxResponse);

// 1 input, 2 outputs
Expand All @@ -199,6 +190,7 @@ describe('decode api', () => {
address: 'wgyUgNjqZ18uYr4YfE2ALW6tP5hd8MumH5',
type: 'MultiSig',
timelock: null,
value: 6400,
},
script: expect.any(String),
token: '00',
Expand Down
32 changes: 16 additions & 16 deletions __tests__/healthcheck.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ describe('healthcheck api', () => {
describe('/health', () => {
it('should return 400 when the x-wallet-id is invalid', async () => {
const response = await TestUtils.request
.query({ wallet_ids: 'invalid' })
.get('/health');
.get('/health')
.query({ wallet_ids: 'invalid' });

expect(response.status).toBe(400);
expect(response.body).toStrictEqual({
Expand All @@ -51,12 +51,12 @@ describe('healthcheck api', () => {

it('should return 200 when all components are healthy', async () => {
const response = await TestUtils.request
.get('/health')
.query({
include_tx_mining: true,
include_fullnode: true,
wallet_ids: `${walletId},${anotherWalletId}`
})
.get('/health');
});
expect(response.status).toBe(200);

expect(response.body).toStrictEqual({
Expand Down Expand Up @@ -121,8 +121,8 @@ describe('healthcheck api', () => {
wallet.state = HathorWallet.SYNCING;

const response = await TestUtils.request
.query({ include_tx_mining: true, include_fullnode: true, wallet_ids: walletId })
.get('/health');
.get('/health')
.query({ include_tx_mining: true, include_fullnode: true, wallet_ids: walletId });
expect(response.status).toBe(503);

expect(response.body).toStrictEqual({
Expand Down Expand Up @@ -179,8 +179,8 @@ describe('healthcheck api', () => {
TestUtils.httpMock.onGet('http://fakehost:8083/v1a/health').reply(200, { status: 'fail' });

const response = await TestUtils.request
.query({ include_tx_mining: true, include_fullnode: true, wallet_ids: walletId })
.get('/health');
.get('/health')
.query({ include_tx_mining: true, include_fullnode: true, wallet_ids: walletId });
expect(response.status).toBe(503);

expect(response.body).toStrictEqual({
Expand Down Expand Up @@ -229,8 +229,8 @@ describe('healthcheck api', () => {
TestUtils.httpMock.onGet('http://fakehost:8083/v1a/health').reply(503, { status: 'fail' });

const response = await TestUtils.request
.query({ include_tx_mining: true, include_fullnode: true, wallet_ids: walletId })
.get('/health');
.get('/health')
.query({ include_tx_mining: true, include_fullnode: true, wallet_ids: walletId });
expect(response.status).toBe(503);

expect(response.body).toStrictEqual({
Expand Down Expand Up @@ -282,8 +282,8 @@ describe('healthcheck api', () => {
);

const response = await TestUtils.request
.query({ include_tx_mining: true, include_fullnode: true, wallet_ids: walletId })
.get('/health');
.get('/health')
.query({ include_tx_mining: true, include_fullnode: true, wallet_ids: walletId });
expect(response.status).toBe(503);

expect(response.body).toStrictEqual({
Expand Down Expand Up @@ -330,8 +330,8 @@ describe('healthcheck api', () => {

it('should not include the fullnode when the parameter is missing', async () => {
const response = await TestUtils.request
.query({ include_tx_mining: true, wallet_ids: walletId })
.get('/health');
.get('/health')
.query({ include_tx_mining: true, wallet_ids: walletId });
expect(response.status).toBe(200);

expect(response.body).toStrictEqual({
Expand Down Expand Up @@ -367,8 +367,8 @@ describe('healthcheck api', () => {

it('should not include the tx mining service when the parameter is missing', async () => {
const response = await TestUtils.request
.query({ include_fullnode: true, wallet_ids: walletId })
.get('/health');
.get('/health')
.query({ include_fullnode: true, wallet_ids: walletId });
expect(response.status).toBe(200);

expect(response.body).toStrictEqual({
Expand Down
Loading

0 comments on commit 71978e9

Please sign in to comment.