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

Dockernet Slash Test Configuration #330

Merged
merged 3 commits into from
Nov 16, 2022
Merged

Conversation

sampocs
Copy link
Collaborator

@sampocs sampocs commented Nov 7, 2022

Closes: #XXX

Context and purpose of the change

We often need to test out functionality related to slashing (e.g. updating validator weights after a slash). This PR adds configuration settings to dockernet to harshen parameters related to slashing, enabling a quicker dev cycle.

Brief Changelog

  • Adds a boolean variable to vars.sh called HARSHEN_SLASHING, which, if enabled to true:
    • Reduces the number of missed blocks before a slash
    • Reduces the jail duration
    • Increases the magnitude of the slash
  • Question for reviewer: Would it make more sense to just always use these settings (rather than making them configurable)? There's probably irrelevant normally since dockernet validators don't miss blocks unless you pause the process

Author's Checklist

I have...

  • Run and PASSED locally all GAIA integration tests
  • If the change is contentful, I either:
    • Added a new unit test OR
    • Added test cases to existing unit tests
  • OR this change is a trivial rework / code cleanup without any test coverage

If skipped any of the tests above, explain.

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • reviewed state machine logic
  • reviewed API design and naming
  • manually tested (if applicable)
  • confirmed the author wrote unit tests for new logic
  • reviewed documentation exists and is accurate

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes?
  • Is a relevant changelog entry added to the Unreleased section in CHANGELOG.md?
  • This pull request updates existing proto field values (and require a backend and frontend migration)?
  • Does this pull request change existing proto field names (and require a frontend migration)?
    How is the feature or change documented?
    • not applicable
    • jira ticket XXX
    • specification (x/<module>/spec/)
    • README.md
    • not documented

@sampocs sampocs requested a review from riley-stride November 7, 2022 16:24
@sampocs sampocs force-pushed the dockernet-slash-test-params branch from 473b75d to cd717bf Compare November 7, 2022 16:25
scripts/vars.sh Outdated
@@ -65,6 +65,7 @@ HOST_WEEK_EPOCH_DURATION="60s"
UNBONDING_TIME="120s"
MAX_DEPOSIT_PERIOD="30s"
VOTING_PERIOD="30s"
HARSHEN_SLASHING=false
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a slightly longer comment describing what this does?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can - although, do you think we should just enable these by default? I think you have to manually kill containers for any of these configurations to matter

Copy link
Contributor

@shellvish shellvish left a comment

Choose a reason for hiding this comment

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

LGTM! Although I think we can slightly lessen the harshness, and agreed with Aidan that a comment would be helpful

# Optionally harshen slashing parameters
if [[ "$HARSHEN_SLASHING" == "true" ]]; then
sed -i -E 's|"signed_blocks_window": "100"|"signed_blocks_window": "10"|g' $genesis_config
sed -i -E 's|"min_signed_per_window": ""0.500000000000000000"|"min_signed_per_window": ""1.000000000000000000"|g' $genesis_config
Copy link
Contributor

Choose a reason for hiding this comment

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

1 seems a bit too harsh (will we get any accidental slashes + jailing if a container gets too slow?), should we do 0.85 instead? Requires them to be down for 2 blocks which is still quite fast!

Copy link
Collaborator Author

@sampocs sampocs Nov 16, 2022

Choose a reason for hiding this comment

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

Good point, I can make it a little more conservative! I also just realized our blocks are 1s.

However, I do think we should either keep it strict and keep it optional, or relax it a tad and enable these by default. I'm not really sure how often slow containers cause missed blocks.

Maybe we leave the min_signed_per_window at 0.5, do signed_blocks_window as either 10 or 20, and then keep these by default (i.e. remove the HASHEN_SLASHING param)?
Then I think they have to miss 5 or 10 blocks which is probably both unlikely to occur by accident and fast enough when it occurs intentionally?

@sampocs sampocs force-pushed the dockernet-slash-test-params branch from cd717bf to 4f27b3f Compare November 16, 2022 17:00
@sampocs sampocs merged commit 1ba0b50 into main Nov 16, 2022
sontrinh16 pushed a commit to notional-labs/stride that referenced this pull request Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants