-
Notifications
You must be signed in to change notification settings - Fork 136
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
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.
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.