This repository has been archived by the owner on Oct 31, 2024. It is now read-only.
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 (0xPolygon#1808)
* Add governance parameters to genesis an polybft config * Add Governance as fork (0xPolygon#1700) * [RFC-191] Add `governorAdmin` flag (0xPolygon#1728) * Add governorAdmin flag * Comments fix * [RFC-191]: Add governance `proposal-quorum` flag (0xPolygon#1730) * Add proposal-quorum flag * Comments fix * [RFC-191]: EVM-740 - Move distribute rewards to first block in epoch (0xPolygon#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 (0xPolygon#1733) * Add contracts * Fix integration test * [RFC-191]: EVM-558 - Update client configuration based on governance proposals (0xPolygon#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 (0xPolygon#1761) * Governance e2e tests * Comments fix * [RFC-191]: EVM-760 - Utilize `ForkParams` contract (0xPolygon#1788) * Add forks activation based on ForkParams contract * Comments fix * Don't use hardcoded addresses for governance contracts (0xPolygon#1790) * Rebase fix * Minor optimization (0xPolygon#1798) * Rebase fix * Small fixes * Small fix * Comments fix * Slashing double signing tracker (0xPolygon#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 (0xPolygon#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 (0xPolygon#1812) * Simplification * Suppress linting error * Rename checkpoint store to exit event store (0xPolygon#1814) * Sort rounds and senders in double signing tracker storage (0xPolygon#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 (0xPolygon#1815) * slashing state transaction creation and validation * ut fixes * CR fixes * linter fix * Byzantine node testing (0xPolygon#1813) * Byzantine node testing * minor fix * lint fix * CR fix * CR fix * New byzantine binary --------- Co-authored-by: Nemanja0x <nemanja@ethernal.tech> * Invoke PruneMsgsUntil when block is finalized (0xPolygon#1820) * generated new bindings & artifacts for ValidatorSet and CustomSupernetManager contracts (0xPolygon#1822) * Run byzantine node as a validator (0xPolygon#1824) * Run byzantine node as a validator * CR fix - rename * Expose JSON RPC function for slash exit events retrieval (0xPolygon#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 (0xPolygon#1829) * GenerateSlashExitProofs UT (0xPolygon#1827) * Update contracts * Remove executed slashing exit events from storage (0xPolygon#1832) * Add removeSlashExitEvents function * Remove processed slashing events from exit events storage * Double sign slashing E2E test (0xPolygon#1833) E2E test for double sign slashing * e2e helper methods for byzantine validators (0xPolygon#1844) * Add governance parameters to genesis an polybft config * Add Governance as fork (0xPolygon#1700) * [RFC-191] Add `governorAdmin` flag (0xPolygon#1728) * Add governorAdmin flag * Comments fix * [RFC-191]: Add governance `proposal-quorum` flag (0xPolygon#1730) * Add proposal-quorum flag * Comments fix * [RFC-191]: EVM-740 - Move distribute rewards to first block in epoch (0xPolygon#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 (0xPolygon#1733) * Add contracts * Fix integration test * [RFC-191]: EVM-558 - Update client configuration based on governance proposals (0xPolygon#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 (0xPolygon#1761) * Governance e2e tests * Comments fix * [RFC-191]: EVM-760 - Utilize `ForkParams` contract (0xPolygon#1788) * Add forks activation based on ForkParams contract * Comments fix * Don't use hardcoded addresses for governance contracts (0xPolygon#1790) * Rebase fix * Minor optimization (0xPolygon#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 (0xPolygon#1700) * [RFC-191] Add `governorAdmin` flag (0xPolygon#1728) * Add governorAdmin flag * Comments fix * [RFC-191]: Add governance `proposal-quorum` flag (0xPolygon#1730) * Add proposal-quorum flag * Comments fix * [RFC-191]: EVM-740 - Move distribute rewards to first block in epoch (0xPolygon#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 (0xPolygon#1733) * Add contracts * Fix integration test * [RFC-191]: EVM-558 - Update client configuration based on governance proposals (0xPolygon#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 (0xPolygon#1761) * Governance e2e tests * Comments fix * [RFC-191]: EVM-760 - Utilize `ForkParams` contract (0xPolygon#1788) * Add forks activation based on ForkParams contract * Comments fix * Don't use hardcoded addresses for governance contracts (0xPolygon#1790) * Rebase fix * Minor optimization (0xPolygon#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 <goran.rojovic@ethernal.tech> Co-authored-by: Goran Rojovic <100121253+goran-ethernal@users.noreply.github.com> Co-authored-by: dusan-maksimovic <dusan.maksimovic@ethernal.tech> Co-authored-by: Dusan Maksimovic <94966669+dusan-maksimovic@users.noreply.github.com> Co-authored-by: Marko Jelača <jelaca.marko@gmail.com> Co-authored-by: Nemanja0x <nemanja@ethernal.tech> Co-authored-by: Igor Crevar <crewce@gmail.com>
- Loading branch information