-
Notifications
You must be signed in to change notification settings - Fork 622
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
Dynamically remove validator key #12011
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env python3 | ||
# Starts one validating node and one non-validating node | ||
# Dynamically remove the key from the validator node | ||
# and make sure that the network stalls. | ||
# Dynamically reload the key at the validator node | ||
# and make sure that the network progress again. | ||
|
||
import unittest | ||
import sys | ||
import pathlib | ||
|
||
sys.path.append(str(pathlib.Path(__file__).resolve().parents[2] / 'lib')) | ||
|
||
from configured_logger import logger | ||
from cluster import start_cluster | ||
from utils import wait_for_blocks | ||
import state_sync_lib | ||
|
||
EPOCH_LENGTH = 20 | ||
TIMEOUT = 100 | ||
|
||
|
||
class ValidatorRemoveKeyQuickTest(unittest.TestCase): | ||
|
||
def test_validator_remove_key_quick(self): | ||
logger.info("Validator remove key quick test") | ||
validator_config, rpc_config = state_sync_lib.get_state_sync_configs_pair( | ||
) | ||
|
||
validator_config.update({ | ||
"tracked_shards": [0], | ||
"store.load_mem_tries_for_tracked_shards": True, | ||
}) | ||
|
||
rpc_config.update({ | ||
"tracked_shards": [0], | ||
}) | ||
|
||
[validator, | ||
rpc] = start_cluster(1, 1, 1, None, | ||
[["epoch_length", EPOCH_LENGTH], | ||
["block_producer_kickout_threshold", 80], | ||
["chunk_producer_kickout_threshold", 80]], { | ||
0: validator_config, | ||
1: rpc_config | ||
}) | ||
|
||
wait_for_blocks(rpc, target=EPOCH_LENGTH) | ||
validator_key = validator.validator_key | ||
validator.remove_validator_key() | ||
wait_for_blocks(rpc, target=EPOCH_LENGTH * 2) | ||
validator.reload_updateable_config() | ||
validator.stop_checking_store() | ||
try: | ||
wait_for_blocks(rpc, count=5, timeout=10) | ||
except: | ||
pass | ||
else: | ||
self.fail('Blocks are not supposed to be produced') | ||
|
||
validator.reset_validator_key(validator_key) | ||
validator.reload_updateable_config() | ||
validator.stop_checking_store() | ||
wait_for_blocks(rpc, count=EPOCH_LENGTH * 2) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it makes sense to use a custom enum here instead. Parsing
Option<Option<Foo>>
feels too cumbersome compared to having a enum with specific variants.