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

Restart dropped elections for unconfirmed blocks with higher PoW #2335

Merged

Conversation

guilhermelawless
Copy link
Contributor

@guilhermelawless guilhermelawless commented Oct 10, 2019

With this and #2306 prioritization should be fully guaranteed.

Requires:

  • block get to check for work
  • account get + confirmation height get to check for confirmation

A 60s buffer of dropped elections is added which sets the maximum time another node has to send the upgraded block before it will only be confirmed via frontier confirmation. This was added to prevent high DB usage for any old block, instead it is only done if the root has been recently dropped. This grants protection from bad actors as they do not know which elections we dropped.

However:

  • It is possible to infer with a certain probability which blocks each node is dropping if they use a default config
  • It is not ideal to have a maximum time to upgrade a block

Therefore, another approach will follow in the future using a large container of passive elections.

@guilhermelawless guilhermelawless added this to the V20.0 milestone Oct 10, 2019
@guilhermelawless guilhermelawless self-assigned this Oct 10, 2019
@guilhermelawless guilhermelawless added the incomplete This item is incomplete and should not be merged if it is a pull request label Oct 10, 2019
@guilhermelawless
Copy link
Contributor Author

Marked as incomplete, will add a cache of recently dropped elections to reduce DB I/O in this path.

@guilhermelawless guilhermelawless removed the incomplete This item is incomplete and should not be merged if it is a pull request label Oct 11, 2019
@guilhermelawless
Copy link
Contributor Author

Finished, up to 32k dropped elections (less than 100 bytes each, 3MB) and only considered for checking the DB if the upgraded PoW arrived within 60 seconds (can increase this value).

Copy link
Contributor

@cryptocode cryptocode left a comment

Choose a reason for hiding this comment

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

LGTM, just a minor refactoring suggestion

nano/node/active_transactions.hpp Outdated Show resolved Hide resolved
nano/node/active_transactions.hpp Outdated Show resolved Hide resolved
nano/node/active_transactions.cpp Outdated Show resolved Hide resolved
@guilhermelawless guilhermelawless merged commit 49bedfc into nanocurrency:master Oct 24, 2019
@guilhermelawless guilhermelawless deleted the restart-dropped-elections branch October 24, 2019 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants