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

Added support for synchronized proof-of-work challenge nonce across nodes #103

Merged
merged 3 commits into from
Jan 23, 2024

Conversation

thehenrytsai
Copy link
Collaborator

@thehenrytsai thehenrytsai commented Jan 19, 2024

Added support for synchronized proof-of-work challenge nonce across nodes by:

  • Added a seed for proof-of-work to allow deterministic challenge nonce generation.
  • Allowed for slight server clock drift.

With this PR, the registration endpoint with proof-of-work is now ready to be used in a production environment with many nodes.

Copy link

codesandbox bot commented Jan 19, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@codecov-commenter
Copy link

codecov-commenter commented Jan 19, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (c4a46c0) 92.16% compared to head (d574aba) 90.63%.

Files Patch % Lines
src/index.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #103      +/-   ##
==========================================
- Coverage   92.16%   90.63%   -1.53%     
==========================================
  Files          20       20              
  Lines        1722     1752      +30     
  Branches      214      211       -3     
==========================================
+ Hits         1587     1588       +1     
- Misses        135      164      +29     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

LiranCohen
LiranCohen previously approved these changes Jan 22, 2024
Copy link
Member

@LiranCohen LiranCohen left a comment

Choose a reason for hiding this comment

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

This is great! Really clever way of allowing a deterministic nonce and accounting for the time drift between instances.

My only nit/suggestion is I'm not sure if I saw a test that actually accounts for the nonce refresh + validation. I know there's a test that stubs out the nonce refresh and makes sure it's called.

Other than that it looks good!

Copy link
Member

@LiranCohen LiranCohen left a comment

Choose a reason for hiding this comment

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

🐐 🚀 🚀 🚀

@thehenrytsai thehenrytsai merged commit f16e915 into main Jan 23, 2024
8 checks passed
@thehenrytsai thehenrytsai deleted the henrytsai/synchronized-nonce branch January 23, 2024 22:12
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.

3 participants