Skip to content

feat: add external signing functionality for v2 wallet - #1944

Merged
DariusParvin merged 4 commits into
masterfrom
BG-42470-add-external-signing-function
Feb 10, 2022
Merged

feat: add external signing functionality for v2 wallet#1944
DariusParvin merged 4 commits into
masterfrom
BG-42470-add-external-signing-function

Conversation

@DariusParvin

@DariusParvin DariusParvin commented Feb 2, 2022

Copy link
Copy Markdown
Contributor
  • Add signing functionality for v2 wallet in handleV2Sign
  • Check config arguments to prevent a user from running as a normal BG Express instance and an external signer instance at the same time
  • Check the signerFileSystemPath argument on startup to make sure it contains a JSON file with a "prv" field
  • Only allow external signer mode to run in test mode

@DariusParvin
DariusParvin force-pushed the BG-42470-add-external-signing-function branch from 472b540 to 8d6c237 Compare February 2, 2022 19:50
@codecov

codecov Bot commented Feb 2, 2022

Copy link
Copy Markdown

Codecov Report

Merging #1944 (7b00932) into master (c6b1574) will increase coverage by 53.93%.
The diff coverage is 91.17%.

@@             Coverage Diff             @@
##           master    #1944       +/-   ##
===========================================
+ Coverage        0   53.93%   +53.93%     
===========================================
  Files           0        5        +5     
  Lines           0      534      +534     
  Branches        0       82       +82     
===========================================
+ Hits            0      288      +288     
- Misses          0      242      +242     
- Partials        0        4        +4     
Flag Coverage Δ
unit 53.93% <91.17%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
modules/express/src/errors.ts 83.33% <66.66%> (ø)
modules/express/src/clientRoutes.ts 31.95% <84.61%> (ø)
modules/express/src/expressApp.ts 90.00% <100.00%> (ø)
modules/express/src/config.ts 100.00% <0.00%> (ø)
modules/express/src/args.ts 100.00% <0.00%> (ø)

@DariusParvin
DariusParvin force-pushed the BG-42470-add-external-signing-function branch 3 times, most recently from dbf841e to 56e32ff Compare February 2, 2022 21:55
tylerlevine
tylerlevine previously approved these changes Feb 3, 2022

@tylerlevine tylerlevine left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

awesome work 👍

Comment thread modules/express/src/errors.ts Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: this is no longer necessary and can be removed from all other errors defined here. Please remove in a follow up PR though, no need to do this clean up item here

@DariusParvin

DariusParvin commented Feb 7, 2022

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback! I added changes (and a test) that require express to be in test mode when using the external signer feature.

I'll create a separate PR for removing the unnecessary ExternalSignerConfigError class

Darius Parvin added 4 commits February 8, 2022 15:24
add signing functionality to handleV2Sign.

Ticket: BG-42470
prevent express from starting up with an invalid config with respect to
external signer flags.

Ticket: BG-42470
When express is acting as an external
signer, signerFileSystemPath should containt the path to the user's
private key.

Ticket: BG-42470
Comment on lines +240 to +244
try {
checkSignerPrvPath(signerFileSystemPath);
} catch (e) {
throw e;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No need to catch if you're just going to immediately rethrow - feel free to handle in a follow up PR to clean up some other nits as well.

Suggested change
try {
checkSignerPrvPath(signerFileSystemPath);
} catch (e) {
throw e;
}
checkSignerPrvPath(signerFileSystemPath);

@DariusParvin
DariusParvin merged commit df5447c into master Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants