-
Notifications
You must be signed in to change notification settings - Fork 126
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
feat!: Customizable Slashing and Jailing #2403
base: main
Are you sure you want to change the base?
Conversation
c848f9d
to
9fa5ec3
Compare
76e01b7
to
544331e
Compare
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.
Partial review. See comments below.
.changelog/unreleased/features/provider/2403-customizable-slashing-jailing.md
Outdated
Show resolved
Hide resolved
.changelog/unreleased/state-breaking/2403-customizable-slashing-jailing.md
Outdated
Show resolved
Hide resolved
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.
Approve the general logic. Great work @stana-miric. See my comments below.
Please add also interchain tests to ensure that updating the infraction params works.
This reverts commit f1e7c6a.
Cannot add interchain tests at this point cuz its another module and I can import the right version of ics in ics interchain test only after this pr is merged. I've added test that tests: adding infraction parameters through MsgCreateConsumer and MsgUpdateConsumer, also added tests that test queuing and overriding existing queued item as well as cancelling update, and tests that confirms that when jailing and lashing is called for misbehavior on consumer chain that parameters for that specific consumer is used. |
Sounds good.
Great
Not sure we need to consumer side. That needed in general to test infractions (downtime and double signing). This feature just enables consumer chain owners to change the params. So the e2e test for it should just involve the provider API -- create consumer and update consumer. For example, can we use interchain tests to verify that an update will take the unbonding period? without waiting for 3 weeks :) |
3f7df35
to
2b0eb15
Compare
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.
Great work @stana-miric
Interchain tests are now implemented here. Once this pr is merged, pr with tests can be updated(ics version in go.mod, and image version) and reviewed |
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.
LGTM.
I still need to do an deep dive into the tests. The logic actually seems straightforward - any time a slash/jail operation needs to take place we first consult the consumer parameters and apply them instead of using the sdk defaults.
|
||
## Unreleased | ||
|
||
### Provider |
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.
Can we add some context here? Just a couple sentences would go a long way.
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.
fixed a068fcb
x/ccv/provider/client/cli/tx.go
Outdated
@@ -257,6 +257,16 @@ where create_consumer.json has the following structure: | |||
"allow_inactive_vals": false, | |||
"prioritylist": ["cosmosvalcons..."] | |||
}, | |||
"infraction_parameters": { |
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.
Nit: fix spacing.
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.
fixed a068fcb
@@ -363,6 +363,9 @@ message MsgCreateConsumer { | |||
|
|||
// allowlisted reward denoms of the consumer | |||
AllowlistedRewardDenoms allowlisted_reward_denoms = 6; | |||
|
|||
// infraction parameters for slashing and jailing | |||
InfractionParameters infraction_parameters = 7; |
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.
Is this optional when the Tx is submitted via CLI/RPC?
It seems very annoying to think about such details during MsgCreateConsumer.
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.
yes, its optional. if its not set, default values(same as the provider values) will be set.
Closes #2383
This PR introduces the ability for each consumer chain to set custom infraction parameters for slashing and jailing (double signing and downtime). The MsgCreateConsumer and MsgUpdateConsumer messages have been extended to support this functionality.
MsgCreateConsumer:
If infraction parameters are not provided in the message, the values will default to those from the provider and will be stored per consumer chain id.
MsgUpdateConsumer:
Pre-launch phase: Parameters are updated immediately.
Post-launch phase: Parameters are added to a queue, and the update will take effect after the unbonding period expires.
Queue Logic:
If parameters for the consumer already exist in the queue:
If the new parameters match the current infraction param for that consumer, the existing queued entry is removed to cancel the update. If the new parameters differ, the existing queued entry is replaced with the new parameters.
If parameters do not exist in the queue and the new parameters differ from the current ones, a new entry is added to schedule the update.
The unbonding period expiration is checked in the BeginBlocker, leveraging the existing time queue infrastructure.
When a consumer chain is removed, related queue records will also be deleted, but the infraction parameters will remain( following the same logic applied for power parameters). Additionally, a migration script has been implemented to set default infraction parameters for all currently active consumer chains.