forked from near/nearcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: adversarial controls for block production (near#10107)
Adversarial controls are needed to test malicious behaviour on chain. At least `malicious_chain.py` checks that a peer producing unexpected blocks is banned. However, the logic was not documented and messy, here I want to make it cleaner. Current flags are, from what I see: * adv_produce_blocks - ALWAYS set to true if someone called RPC to trigger malicious behaviour * adv_produce_blocks_only_valid - ALSO true if we want to produce valid blocks. Looks like we skip only `height <= known_height` condition in this case, but I don't want to look into impact of this for now. I want to replace two flags with one self-descriptive enum and simplify logic - e.g. by checking that node is adversarial from the beginning. Also, rename `should_reschedule_block` with `can_produce_block`. I prefer a method to return `true` in the default behaviour. It also seems that `false` means some issue with code logic, but I didn't look deeper. ## Testing Adversarial pytests: https://nayduck.near.org/#/run/3258 --------- Co-authored-by: Longarithm <the.aleksandr.logunov@gmail.com>
- Loading branch information
1 parent
2a98e2f
commit e8c1dd8
Showing
2 changed files
with
57 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters