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

Reject out of date blocks submitted via RPC #1914

Merged
merged 7 commits into from
Dec 29, 2021

Conversation

michaelsutton
Copy link
Collaborator

In order to avoid lagging miners from spamming the network, we reject by default all submitted blocks with DAA score < virtual DAA score - DAA window size. Such blocks are not rewarded anyhow. See issue #1896

@codecov
Copy link

codecov bot commented Dec 28, 2021

Codecov Report

Merging #1914 (5324545) into dev (8282fb4) will increase coverage by 0.00%.
The diff coverage is 38.46%.

❗ Current head 5324545 differs from pull request most recent head 10bdd15. Consider uploading reports for the commit 10bdd15 to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##              dev    #1914   +/-   ##
=======================================
  Coverage   61.46%   61.47%           
=======================================
  Files         628      628           
  Lines       29556    29568   +12     
=======================================
+ Hits        18167    18176    +9     
- Misses       8814     8817    +3     
  Partials     2575     2575           
Impacted Files Coverage Δ
app/appmessage/rpc_submit_block.go 81.81% <ø> (ø)
app/rpc/rpchandlers/submit_block.go 28.20% <27.27%> (-0.37%) ⬇️
...er/server/grpcserver/protowire/rpc_submit_block.go 78.94% <100.00%> (+0.13%) ⬆️
infrastructure/network/addressmanager/store.go 79.11% <0.00%> (+1.26%) ⬆️
...ructure/network/rpcclient/grpcclient/grpcclient.go 81.25% <0.00%> (+4.68%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8282fb4...10bdd15. Read the comment docs.

@@ -122,6 +122,7 @@ type Flags struct {
IsArchivalNode bool `long:"archival" description:"Run as an archival node: don't delete old block data when moving the pruning point (Warning: heavy disk usage)'"`
AllowSubmitBlockWhenNotSynced bool `long:"allow-submit-block-when-not-synced" hidden:"true" description:"Allow the node to accept blocks from RPC while not synced (this flag is mainly used for testing)"`
EnableSanityCheckPruningUTXOSet bool `long:"enable-sanity-check-pruning-utxo" hidden:"true" description:"When moving the pruning point - check that the utxo set matches the utxo commitment"`
AllowSubmittingNonDAABlocks bool `long:"allow-non-daa-blocks" hidden:"false" description:"When submitting blocks via RPC - accept blocks which are out of virtual daa window (although such blocks are not rewarded anyhow)"`
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@someone235 is hidden:"false" needed here ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's better to move this flag directly to the submitBlock RPC command

@@ -122,6 +122,7 @@ type Flags struct {
IsArchivalNode bool `long:"archival" description:"Run as an archival node: don't delete old block data when moving the pruning point (Warning: heavy disk usage)'"`
AllowSubmitBlockWhenNotSynced bool `long:"allow-submit-block-when-not-synced" hidden:"true" description:"Allow the node to accept blocks from RPC while not synced (this flag is mainly used for testing)"`
EnableSanityCheckPruningUTXOSet bool `long:"enable-sanity-check-pruning-utxo" hidden:"true" description:"When moving the pruning point - check that the utxo set matches the utxo commitment"`
AllowSubmittingNonDAABlocks bool `long:"allow-non-daa-blocks" hidden:"false" description:"When submitting blocks via RPC - accept blocks which are out of virtual daa window (although such blocks are not rewarded anyhow)"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's better to move this flag directly to the submitBlock RPC command

@someone235 someone235 merged commit 064b045 into kaspanet:dev Dec 29, 2021
@michaelsutton michaelsutton deleted the reject-non-daa-blocks branch December 29, 2021 18:17
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