Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

[Feature] Double-signing slashing #1808

Merged
merged 100 commits into from
Sep 6, 2023
Merged

[Feature] Double-signing slashing #1808

merged 100 commits into from
Sep 6, 2023

Conversation

Stefan-Ethernal
Copy link
Collaborator

@Stefan-Ethernal Stefan-Ethernal commented Aug 11, 2023

Description

Double signers are malicious validators who have signed more than 1 message of the same type, with different hash in the given round. The aim of this feature is to track such malicious behavior and punish it by slashing a portion of the stake.

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)

Breaking changes

Please complete this section if any breaking changes have been made, otherwise delete it

Checklist

  • I have assigned this PR to myself
  • I have added at least 1 reviewer
  • I have added the relevant labels
  • I have updated the official documentation
  • I have added sufficient documentation in code

Testing

  • I have tested this code with the official test suite
  • I have tested this code manually

Manual tests

Please complete this section if you ran manual tests for this functionality, otherwise delete it

Documentation update

Please link the documentation update PR in this section if it's present, otherwise delete it

Additional comments

Please post additional comments in this section if you have them, otherwise delete it

goran-ethernal and others added 18 commits August 9, 2023 14:23
* Add governorAdmin flag

* Comments fix
* Add proposal-quorum flag

* Comments fix
…1735)

* Move distribute rewards to first block of epoch

* Modification of reward distribution as part of governance fork

* Small change

* Comments fix
* Add contracts

* Fix integration test
…proposals (#1749)

* GovernanceManager

* PostEpoch

* PostBlock and update of client config

* Lint fix

* UTs

* Comments fix

* Retry in PostEpoch as well

* Comments fix
* Governance e2e tests

* Comments fix
* Add forks activation based on ForkParams contract

* Comments fix
@Stefan-Ethernal Stefan-Ethernal added the feature New update to Polygon Edge label Aug 11, 2023
Stefan-Ethernal and others added 3 commits August 15, 2023 10:07
* Double signing tracker (draft)

* Track all messages and detect double signing by comparing signatures

* Address comments

* Add mutex, fix double sign detection

* Unit tests (part 1)

* PruneMsgsUntil unit test

* tracker.Handle multiple senders UT

* Address comments

* Updated comment

* GetEvidences UT

* Remove redundant variable

* Add missing mutex calls

* Protect from spammers in tracker

* Ignore messages sent by non-validators (#1767)

* Filter messages which are not sent by known validators in double signing tracker

* Init double signing tracker only when stake store is populated with validators

* Fix tests

* Fix GetEvidences UT

* Simplification in add message fn

* Add comments

* Deterministic IBFT message types iterating

* Make linter happy (again)

* Simplify GetEvidences, since messages with unique signatures are added into the storage

* Rename GetValidators to GetAllValidators

* Send messages from a separate routine

* Run IBFT messages handling in parallel
* Simplification

* Suppress linting error
Stefan-Ethernal and others added 7 commits August 15, 2023 12:09
* Provide only 2 messages per evidence

* Introduce MinAddressHeap and use it to store addresses sorted

* Add min round heap to keep rounds sorted

* Use sorted slice instead of heap for rounds and addresses

* Prevent adding the same address and rounds multiple times

* Remove SortedMessages structure

* Add randomized test

* Messages.stringer

* Linter fix

* Make randomized test working

* Fix GetDoubleSigners property test

* Rename

* Unexport Min function

* Cleanup

* Release lock if there are no msgs for the given height
* slashing state transaction creation and validation

* ut fixes

* CR fixes

* linter fix
* Byzantine node testing

* minor fix

* lint fix

* CR fix

* CR fix

* New byzantine binary

---------

Co-authored-by: Nemanja0x <[email protected]>
@goran-ethernal goran-ethernal force-pushed the feat/on-chain-governance branch from 7a8b5e0 to 4a92ab0 Compare September 5, 2023 09:00
@Stefan-Ethernal Stefan-Ethernal requested a review from a team September 5, 2023 10:13
@goran-ethernal goran-ethernal force-pushed the feat/on-chain-governance branch from 1a1b624 to 3c9262c Compare September 5, 2023 15:56
Base automatically changed from feat/on-chain-governance to develop September 5, 2023 15:56
@Stefan-Ethernal Stefan-Ethernal merged commit 06153fb into develop Sep 6, 2023
6 checks passed
@Stefan-Ethernal Stefan-Ethernal deleted the feat/slashing branch September 6, 2023 06:16
@github-actions github-actions bot locked and limited conversation to collaborators Sep 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New update to Polygon Edge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants