Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Double-signing slashing (#1808)
* Add governance parameters to genesis an polybft config * Add Governance as fork (#1700) * [RFC-191] Add `governorAdmin` flag (#1728) * Add governorAdmin flag * Comments fix * [RFC-191]: Add governance `proposal-quorum` flag (#1730) * Add proposal-quorum flag * Comments fix * [RFC-191]: EVM-740 - Move distribute rewards to first block in epoch (#1735) * Move distribute rewards to first block of epoch * Modification of reward distribution as part of governance fork * Small change * Comments fix * Rebase fix * [RFC-191]: EVM-556 - Deploy governance contracts (#1733) * Add contracts * Fix integration test * [RFC-191]: EVM-558 - Update client configuration based on governance proposals (#1749) * GovernanceManager * PostEpoch * PostBlock and update of client config * Lint fix * UTs * Comments fix * Retry in PostEpoch as well * Comments fix * Rebase fix * [RFC-191]: EVM-750 - Governance e2e tests (#1761) * Governance e2e tests * Comments fix * [RFC-191]: EVM-760 - Utilize `ForkParams` contract (#1788) * Add forks activation based on ForkParams contract * Comments fix * Don't use hardcoded addresses for governance contracts (#1790) * Rebase fix * Minor optimization (#1798) * Rebase fix * Small fixes * Small fix * Comments fix * Slashing double signing tracker (#1756) * 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 * Double sign evidence struct modifications * Simplify double signer evidence (#1812) * Simplification * Suppress linting error * Rename checkpoint store to exit event store (#1814) * Sort rounds and senders in double signing tracker storage (#1806) * 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 (#1815) * slashing state transaction creation and validation * ut fixes * CR fixes * linter fix * Byzantine node testing (#1813) * Byzantine node testing * minor fix * lint fix * CR fix * CR fix * New byzantine binary --------- Co-authored-by: Nemanja0x <[email protected]> * Invoke PruneMsgsUntil when block is finalized (#1820) * generated new bindings & artifacts for ValidatorSet and CustomSupernetManager contracts (#1822) * Run byzantine node as a validator (#1824) * Run byzantine node as a validator * CR fix - rename * Expose JSON RPC function for slash exit events retrieval (#1823) * Slash exit events storage * Tear down checkpoint manager post block test * bridge_getPendingSlashProofs JSON RPC function * Add comment * Don't rely on doubleSignSlashing hardfork within the exit events storage * Log exit events that do not contain signature encoded * Create as much proofs as possible even if error is returned * Merge fix (move polybft_config to common package) * Generate SC artifacts and bindings * Build fix * Lint fix * SC artifacts regenerate * Merge fix (provide isFirstBlockOfEpoch indicator) * Increase timeout for e2e tests * Update byzantine binary (#1829) * GenerateSlashExitProofs UT (#1827) * Update contracts * Remove executed slashing exit events from storage (#1832) * Add removeSlashExitEvents function * Remove processed slashing events from exit events storage * Double sign slashing E2E test (#1833) E2E test for double sign slashing * e2e helper methods for byzantine validators (#1844) * Add governance parameters to genesis an polybft config * Add Governance as fork (#1700) * [RFC-191] Add `governorAdmin` flag (#1728) * Add governorAdmin flag * Comments fix * [RFC-191]: Add governance `proposal-quorum` flag (#1730) * Add proposal-quorum flag * Comments fix * [RFC-191]: EVM-740 - Move distribute rewards to first block in epoch (#1735) * Move distribute rewards to first block of epoch * Modification of reward distribution as part of governance fork * Small change * Comments fix * Rebase fix * [RFC-191]: EVM-556 - Deploy governance contracts (#1733) * Add contracts * Fix integration test * [RFC-191]: EVM-558 - Update client configuration based on governance proposals (#1749) * GovernanceManager * PostEpoch * PostBlock and update of client config * Lint fix * UTs * Comments fix * Retry in PostEpoch as well * Comments fix * Rebase fix * [RFC-191]: EVM-750 - Governance e2e tests (#1761) * Governance e2e tests * Comments fix * [RFC-191]: EVM-760 - Utilize `ForkParams` contract (#1788) * Add forks activation based on ForkParams contract * Comments fix * Don't use hardcoded addresses for governance contracts (#1790) * Rebase fix * Minor optimization (#1798) * Rebase fix * Small fixes * Small fix * Comments fix * Fix cluster script (provide governor-admin only for polybft consensus) * Update contracts * Merge fix (update contracts) * Add governance parameters to genesis an polybft config * Add Governance as fork (#1700) * [RFC-191] Add `governorAdmin` flag (#1728) * Add governorAdmin flag * Comments fix * [RFC-191]: Add governance `proposal-quorum` flag (#1730) * Add proposal-quorum flag * Comments fix * [RFC-191]: EVM-740 - Move distribute rewards to first block in epoch (#1735) * Move distribute rewards to first block of epoch * Modification of reward distribution as part of governance fork * Small change * Comments fix * Rebase fix * [RFC-191]: EVM-556 - Deploy governance contracts (#1733) * Add contracts * Fix integration test * [RFC-191]: EVM-558 - Update client configuration based on governance proposals (#1749) * GovernanceManager * PostEpoch * PostBlock and update of client config * Lint fix * UTs * Comments fix * Retry in PostEpoch as well * Comments fix * Rebase fix * [RFC-191]: EVM-750 - Governance e2e tests (#1761) * Governance e2e tests * Comments fix * [RFC-191]: EVM-760 - Utilize `ForkParams` contract (#1788) * Add forks activation based on ForkParams contract * Comments fix * Don't use hardcoded addresses for governance contracts (#1790) * Rebase fix * Minor optimization (#1798) * Rebase fix * Small fixes * Small fix * Comments fix * Fix cluster script (provide governor-admin only for polybft consensus) * Increase E2E tests timeout * Comments fix * Comments fix * Generate SC artifacts * Address comments (part 1) * Address comment (part 2) * Propagate error * forks as a field * Formatting * Fix bridge e2e tests * Fix UTs * Update byzantine binary * Update byzantine binary --------- Co-authored-by: Goran Rojovic <[email protected]> Co-authored-by: Goran Rojovic <[email protected]> Co-authored-by: dusan-maksimovic <[email protected]> Co-authored-by: Dusan Maksimovic <[email protected]> Co-authored-by: Marko Jelača <[email protected]> Co-authored-by: Nemanja0x <[email protected]> Co-authored-by: Igor Crevar <[email protected]>
- Loading branch information