Skip to content

Conversation

@furszy
Copy link

@furszy furszy commented Jun 30, 2021

Continuation of #2463. Another error prone topic.

Essentially focused in the following points:

  • Remove duplicate and incorrect peer misbehaving:
    -1) The peer misbehaving score set for an invalid arriving block is being performed inside PeerLogicValidation::BlockChecked.
    -2) The CValidationState param in ProcessNewBlock does not return the error nor the invalidity reason if the block is marked invalid during the activate best chain process (block connection), an empty CValidationState is set. The BlockChecked signal is used instead to notify the block invalidity reason.

  • Get rid off CValidationState param in ProcessNewBlock and use only BlockChecked (own version of ae22357)

  • Removal of BIP61 (p2p: Remove BIP61 reject messages bitcoin/bitcoin#15437 and test: Remove REJECT message code bitcoin/bitcoin#18609).
    -- BIP61 could be disabled first by default before its removal like upstream did (or moved to its own standalone PR), but.. i don't think that worth to continue maintaining it, most likely no one is using it and if someone is actually using it, isn't good to have any piece of software depending on it. --

  • Move block spam filter check to BlockChecked. Following the same peer-processing-logic / block-connection-logic division. Improves the spam protection as now blocks rejected during the connection process are going to pass through the spam filter check as well (before, only blocks rejected during AcceptBlock were passing through it).
    Plus, this improvement let me do some further cleanup and remove the extra fAccepted flag from ProcessNewBlock.

  • Create GetDataMsg enum and replace ppszTypeName array for direct GetCommand call.
    The array was duplicated with the NetMsgType constants

@furszy furszy self-assigned this Jun 30, 2021
@furszy furszy added this to the 6.0.0 milestone Jun 30, 2021
@furszy furszy changed the title Decouple peer-processing-logic from block-connection-logic + BIP61 removal. [WIP] Decouple peer-processing-logic from block-connection-logic + BIP61 removal. Jun 30, 2021
@furszy furszy changed the title [WIP] Decouple peer-processing-logic from block-connection-logic + BIP61 removal. Decouple peer-processing-logic from block-connection-logic + BIP61 removal. Jun 30, 2021
@furszy furszy force-pushed the 2021_remove_processBlock_state branch 6 times, most recently from 4b233a8 to 8320fd6 Compare July 7, 2021 00:02
@furszy furszy force-pushed the 2021_remove_processBlock_state branch 2 times, most recently from edc5520 to 82ea177 Compare July 19, 2021 14:38
@furszy
Copy link
Author

furszy commented Jul 19, 2021

Rebased on master, lint-python warnings fixed. Ready to go.

@furszy furszy force-pushed the 2021_remove_processBlock_state branch from 82ea177 to e1c01c4 Compare July 19, 2021 17:01
@furszy
Copy link
Author

furszy commented Jul 19, 2021

And.. the rebase came with few needed changes.
The new test cases added in evo_deterministicmns_tests.cpp were using the previous ProcessBlock function signature (change squashed in 7a6787d8). Plus added a commit solving some annoying compiler warnings in blockassembler, validation, rpcwallet and evo_deterministicmns_tests files.

All good now, ready.

Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

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

Really nice PR. Just few nits

@furszy furszy force-pushed the 2021_remove_processBlock_state branch from e1c01c4 to b5afa79 Compare July 21, 2021 20:27
furszy added 9 commits July 21, 2021 17:28
Backport of btc@fa25f43ac5692082dba3f90456c501eb08f1b75c and btc@b1b0cfecb639ce44be280c7a45a41a19e893c401
…invalid arriving block.

1) The actual peer misbehaving check is being performed inside PeerLogicValidation::BlockChecked.
2) The CValidationState inputted to ProcessNewBlock does not return the error nor invalidity reason if the block is marked as invalid during the activate best chain process (thus why BlockChecked exists).
…ocessNewBlock.

Any block processing error is being notified by the BlockChecked signal.
Aside from the code responsibilities division improvement, this adds the good property of checking block spam filter for blocks that were rejected during the connection process as well (before, was only called if AcceptBlock rejected the block).
Plus pass pblock as const reference.
Plus minor cleanup, removing unused parameter.
furszy added 3 commits July 21, 2021 17:28
…and made static as them are only used there.
…ect GetCommand call.

The array is duplicated with the NetMsgType constants
@furszy furszy force-pushed the 2021_remove_processBlock_state branch from b5afa79 to f16f422 Compare July 21, 2021 20:35
@furszy
Copy link
Author

furszy commented Jul 21, 2021

Updated per zebra's feedback, squashing all the updates in their respective commits, and rebased it on master so it has the correct bench raw files generation.

To minimize the review mental burden --> git range-diff master e1c01c4 f16f4224

Do not loop over every protocol message type, only walk through the tier two possible messages.
@furszy furszy force-pushed the 2021_remove_processBlock_state branch from f16f422 to 8e9f2bc Compare July 22, 2021 13:09
@furszy
Copy link
Author

furszy commented Jul 22, 2021

updated, added the vector change.

Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

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

ACK 8e9f2bc

@random-zebra random-zebra merged commit d340e28 into PIVX-Project:master Jul 25, 2021
random-zebra added a commit to random-zebra/PIVX that referenced this pull request Jul 25, 2021
random-zebra added a commit that referenced this pull request Jul 25, 2021
4155b48 [Tests] Fix ProcessNewBlock signature in budget_tests.cpp (random-zebra)

Pull request description:

  broken due to merges of #2438 + #2464

Top commit has no ACKs.

Tree-SHA512: 1df1a7a45be0cdaca9409f2698220dfcf025df2fe784d28bd9d7b084a73718d4fccfad5def3296992f5bb4e78c0fea5860651b28c6e61f1c121a08e4df1e1535
@furszy furszy deleted the 2021_remove_processBlock_state branch November 29, 2022 15:44
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.

2 participants