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

Outdated SlashPackets are not dropped #544

Closed
3 of 5 tasks
mpoke opened this issue Dec 2, 2022 · 5 comments
Closed
3 of 5 tasks

Outdated SlashPackets are not dropped #544

mpoke opened this issue Dec 2, 2022 · 5 comments
Assignees
Labels
type: bug Issues that need priority attention -- something isn't working

Comments

@mpoke
Copy link
Contributor

mpoke commented Dec 2, 2022

Problem

A corrupt consumer chain could send SlashPackets with data.vscId after sending a VSCMaturedPacket for the same vscId. These packets should be dropped.

After discussions with @MSalopek, we realized that it's correct behavior to send SlashPackets with data.vscId after sending a VSCMaturedPacket for the same vscId. This is because the data.vscId in a SlashPacket is the vscId of the VSCPacket that last updated the validator set of the block when the infraction was committed. The misbehaving validator must be punished regardless of the infraction height. data.vscId is mapped on a height on the provider that is used to determined what undelegations and redelegations should be slashed (see Slash in the staking module).

Thus, this issue is about reducing as much as possible the scenarios in which a corrupt consumer chain ends up slashing a validator without following the rules. A more complete solution will be added as part of future versions, i.e., the provider can verify the evidence for all the SlashPackets.

Closing criteria

Drop SlashPackets for which a corresponding VSCMaturedPacket was already received.

  • Drop SlashPackets for downtime infraction for the same validator that were received from the same consumer without the validator having the chance to Unjail itself.
  • Drop SlashPackets for downtime infraction were received from the same consumer for infraction heights smaller than the latest downtime infraction height received from that consumer.
  • RunSlashPacketData.ValidateBasic on receiving SlashPackets

TODOs

  • Labels have been added for issue
  • Issue has been added to the ICS project
@mpoke mpoke added type: bug Issues that need priority attention -- something isn't working ccv-core labels Dec 2, 2022
@mpoke mpoke moved this to Todo in Replicated Security Dec 2, 2022
@shaspitz
Copy link
Contributor

shaspitz commented Dec 2, 2022

Nice! This logic can be added to validateSlashPacket after #542 is merged. I won't address this issue in 542 however, as I want to make sure that PR does not introduce any functionality changes.

@mpoke
Copy link
Contributor Author

mpoke commented Dec 2, 2022

This logic can be added to validateSlashPacket after #542 is merged.

If we add it to validateSlashPacket, we need to check VSCMaturedPackets in the queue. Alternatively, we can drop the packets when we handle them, but then we don't sent back err ack.

@shaspitz
Copy link
Contributor

Reading the new Closing criteria, the proposed validations seem safe. My concern is that these validations, along with 1-4 defined in #594, will make the slash packet validation logic pretty complex, and hard to reason about. Could we consider validations (as a part of ValidateSlashPacket) that are more broad, such as:

  1. Drop double-sign slash packets (from any consumer) for vals that're already tombstoned. Note this logic already exists once the packet is handled, but not yet in ValidateSlashPacket.
  2. Drop downtime slash packets (from any consumer) in ValidateSlashPacket for vals that are already jailed. Note this would change the protocol's slashing behavior, but could make our protocol implementation more simple and practical.

I'd prefer not to worry about SlashAcks, infraction heights, etc. in these validations, as I believe it can create more weird edge cases where spamming is still possible. See this comment as an example

@shaspitz
Copy link
Contributor

shaspitz commented Dec 22, 2022

This issue is a subtask of solving #594, and I think we need to be considering the big picture of what 594 is trying to achieve. My comment above could easily have flaws, and maybe we just need to brainstorm a wholistic solution that checks all the boxes but doesn't introduce a large amount of validation complexity or edge cases.

The Don't stop iteration through queue strategy described in the parent issue (with some tweaks) may be worth considering again

@mpoke mpoke moved this from In Progress to Waiting for review in Replicated Security Jan 3, 2023
@mpoke
Copy link
Contributor Author

mpoke commented Jan 3, 2023

Closing in favor of #635 and #634

@mpoke mpoke closed this as completed Jan 3, 2023
@github-project-automation github-project-automation bot moved this from Waiting for review to Done in Replicated Security Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Issues that need priority attention -- something isn't working
Projects
No open projects
Status: Done
Development

No branches or pull requests

3 participants