Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: wallet-service monorepo [part 2] - CI #99

Merged
merged 45 commits into from
Dec 11, 2023
Merged

Conversation

andreabadesso
Copy link
Collaborator

@andreabadesso andreabadesso commented Nov 30, 2023

Acceptance Criteria

  • We should run tests for the wallet-service lambdas on every push
  • We should run tests for the daemon on every push
  • We should update the aws-sdk to v3 as v2 was deprecated
  • We should update jest to the latest version

Security Checklist

  • Make sure you do not include new dependencies in the project unless strictly necessary and do not include dev-dependencies as production ones. More dependencies increase the possibility of one of them being hijacked and affecting us.

@andreabadesso andreabadesso force-pushed the chore/monorepo-pt2 branch 3 times, most recently from 73eb29d to 215ef98 Compare December 5, 2023 22:28
@andreabadesso andreabadesso changed the title chore: wallet-service monorepo [part 2] - CI + CD chore: wallet-service monorepo [part 2] - CI Dec 6, 2023
@@ -843,7 +843,7 @@ describe('address and wallet related tests', () => {
for (const [index, address] of addressesInfo.addresses.entries()) {
expect(ADDRESSES[index]).toBe(address);
}
} );
}, 15000);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It times out with less than 15s

Comment on lines -404 to -421

it('transaction already in the database should throw', async () => {
const context = {
event: {
event: {
data: {
hash: 'hashValue',
},
id: 'idValue',
},
},
};

const mockTransaction = { tx_id: 'hashValue' };
(getTransactionById as jest.Mock).mockResolvedValue(mockTransaction);

await expect(handleVertexAccepted(context as any, {} as any)).rejects.toThrow('Transaction hashValue already in the database, this should never happen');
});
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition was removed on the reliable-integrations part 2 PR, this test was failing

@@ -35,7 +35,7 @@
"typescript": "^4.9.5"
},
"dependencies": {
"@hathor/wallet-lib": "^1.0.2",
"@hathor/wallet-lib": "^0.39.0",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should update the wallet-lib on another PR for both the daemon and the wallet-service

@@ -7,6 +7,7 @@

import { BinaryToTextEncoding, createHash } from 'crypto';

import { Logger } from 'winston';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this happened, but the build was failing because of this missing dependency

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe its used as an argument type, maybe the LSP does not count type annotations as usage of the import.

Comment on lines +1126 to +1143
bitcore.Networks.add({
...network.bitcoreNetwork,
networkMagic: network.bitcoreNetwork.networkMagic.readUInt32BE(),
});

export const getXPrivKeyFromSeed = (
seed: string,
options: {
passphrase?: string,
networkName?: string
} = {}): bitcore.HDPrivateKey => {
const methodOptions = Object.assign({passphrase: '', networkName: 'mainnet'}, options);
const { passphrase, networkName } = methodOptions;

const network = new Network(networkName);
const code = new Mnemonic(seed);
return code.toHDPrivateKey(passphrase, network.bitcoreNetwork);
};
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to create my own getXPrivKeyFromSeed because the lib was having issues with its own bitcore-mnemonic dependency

I also had to add Hathor's network manually to be able to use the wallet-lib methods

@@ -181,7 +182,7 @@ test('GET /addresses', async () => {
expect(result.statusCode).toBe(STATUS_CODE_TABLE[ApiError.INVALID_PAYLOAD]);
expect(returnBody.details).toHaveLength(1);
expect(returnBody.details[0].message)
.toMatchInlineSnapshot('"\\"index\\" must be greater than or equal to 0"');
.toMatchInlineSnapshot('"\"index\" must be greater than or equal to 0"');
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to update all inline snapshots after jest update

@@ -7,6 +7,7 @@

import { BinaryToTextEncoding, createHash } from 'crypto';

import { Logger } from 'winston';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe its used as an argument type, maybe the LSP does not count type annotations as usage of the import.

Base automatically changed from chore/monorepo to dev December 11, 2023 14:35
@andreabadesso andreabadesso force-pushed the chore/monorepo-pt2 branch 4 times, most recently from b680990 to b8863bb Compare December 11, 2023 15:24
@andreabadesso andreabadesso merged commit 5b7d6bc into dev Dec 11, 2023
1 check passed
@andreabadesso andreabadesso deleted the chore/monorepo-pt2 branch February 22, 2024 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants