From 8b611e1839177f693e2851fe118efa68ebc0fd94 Mon Sep 17 00:00:00 2001 From: Mikhail Kalinin Date: Thu, 4 May 2023 17:54:47 +0600 Subject: [PATCH 1/5] EIP-6987: initial draft --- EIPS/eip-6987.md | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 EIPS/eip-6987.md diff --git a/EIPS/eip-6987.md b/EIPS/eip-6987.md new file mode 100644 index 00000000000000..8170e6d78fbf6a --- /dev/null +++ b/EIPS/eip-6987.md @@ -0,0 +1,57 @@ +--- +eip: 6987 +title: Slashed validator cannot be elected as a block proposer +description: Prevents a slashed validator from being elected as a block proposer +author: Mikhail Kalinin (@mkalinin) +discussions-to: +status: Draft +type: Standards Track +category: Core +created: 2023-05-04 +--- + +## Abstract + +Introduces a modificaiton to the consensus layer specification which ensures that slashed validator cannot be elected as block proposer. + +## Motivation + +A block proposed by a slashed validator is invalidated by the corresponding check in the [`phase0/process_block_header`](https://github.com/ethereum/consensus-specs/blob/3115d1140b23dd4c9c23fbd9e2428186cf816bde/specs/phase0/beacon-chain.md#block-header) function as it is defined in the consensus layer specification. + +At the same time the definition of the [`phase0/compute_proposer_index`](https://github.com/ethereum/consensus-specs/blob/3115d1140b23dd4c9c23fbd9e2428186cf816bde/specs/phase0/beacon-chain.md#compute_proposer_index) allows for a slashed validator to be elected as a proposer. This contradiction may effectively lead to an empty slot if a block is supposed to be proposed by a slahed validator. + +An impact of the proposed fix in the case of a single slashing on Ethereum Mainnet is negligible, while it becomes significant in the case of correlated slashings. For instance, a correlated slashing of `1/10th` of a validator set can lead to `1/10th` of missed proposals during a number of epochs after the slashing. + +## Specification + +The proposed change is specified in [the consensus layer specification](https://github.com/ethereum/consensus-specs/blob/82cd2f1f2317f664b7e179acdd898a327e1fe77e/specs/deneb/beacon-chain.md#modified-compute_proposer_index). + +_TODO: move specification to `/_features` and provide a link._ + +## Rationale + +### Modifying `get_beacon_proposer_index` + +This function is modified to read a proposer index from a beacon state if a slot of a latest block header is the same as the `state.slot`. + +This modification is done to make the function return correct proposer index in the case when the proposer of a given block is being slashed during processing of the block. + +## Backwards Compatibility + +This fix changes proposer election mechanism in a backwards incompatible way and requires a hard fork to be deployed. + +## Test Cases + +_TODO: provide a link to the tests written as a part of consensus layer specification._ + +## Reference Implementation + +_TODO: provide a link to consensus layer specification._ + +## Security Considerations + +There are no observed security issues introduced by the proposed change. + +## Copyright + +Copyright and related rights waived via [CC0](../LICENSE.md). From 7cbb4af826792a08c8cce98587ebe57f5344ea89 Mon Sep 17 00:00:00 2001 From: Mikhail Kalinin Date: Wed, 17 May 2023 18:25:12 +0600 Subject: [PATCH 2/5] Apply suggestions from code review Co-authored-by: Andrew B Coathup <28278242+abcoathup@users.noreply.github.com> Co-authored-by: g11tech --- EIPS/eip-6987.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/EIPS/eip-6987.md b/EIPS/eip-6987.md index 8170e6d78fbf6a..eedc7f5a994d8a 100644 --- a/EIPS/eip-6987.md +++ b/EIPS/eip-6987.md @@ -12,15 +12,15 @@ created: 2023-05-04 ## Abstract -Introduces a modificaiton to the consensus layer specification which ensures that slashed validator cannot be elected as block proposer. +Introduces a modification to the consensus layer specification which ensures that slashed validator cannot be elected as block proposer. ## Motivation -A block proposed by a slashed validator is invalidated by the corresponding check in the [`phase0/process_block_header`](https://github.com/ethereum/consensus-specs/blob/3115d1140b23dd4c9c23fbd9e2428186cf816bde/specs/phase0/beacon-chain.md#block-header) function as it is defined in the consensus layer specification. +A block proposed by a slashed validator is rejected by a corresponding validation check in the [`phase0/process_block_header`](https://github.com/ethereum/consensus-specs/blob/3115d1140b23dd4c9c23fbd9e2428186cf816bde/specs/phase0/beacon-chain.md#block-header) function as defined in the consensus layer specification. -At the same time the definition of the [`phase0/compute_proposer_index`](https://github.com/ethereum/consensus-specs/blob/3115d1140b23dd4c9c23fbd9e2428186cf816bde/specs/phase0/beacon-chain.md#compute_proposer_index) allows for a slashed validator to be elected as a proposer. This contradiction may effectively lead to an empty slot if a block is supposed to be proposed by a slahed validator. +At the same time the definition of the [`phase0/compute_proposer_index`](https://github.com/ethereum/consensus-specs/blob/3115d1140b23dd4c9c23fbd9e2428186cf816bde/specs/phase0/beacon-chain.md#compute_proposer_index) allows for a slashed validator to be elected as a proposer. This contradiction effectively leads to an empty slot if a block is supposed to be proposed by a slashed validator. -An impact of the proposed fix in the case of a single slashing on Ethereum Mainnet is negligible, while it becomes significant in the case of correlated slashings. For instance, a correlated slashing of `1/10th` of a validator set can lead to `1/10th` of missed proposals during a number of epochs after the slashing. +The impact of the proposed fix in the case of a single slashing on Ethereum Mainnet is negligible but it becomes significant in the case of correlated slashings. For instance, a correlated slashing of `1/10th` of a validator set can lead to `1/10th` of missed proposals in a number of epochs after the slashing. ## Specification From 65187226b2e84855c45d8ac503bfef7e53de9fdc Mon Sep 17 00:00:00 2001 From: Mikhail Kalinin Date: Wed, 17 May 2023 18:27:02 +0600 Subject: [PATCH 3/5] Update EIPS/eip-6987.md Co-authored-by: Andrew B Coathup <28278242+abcoathup@users.noreply.github.com> --- EIPS/eip-6987.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EIPS/eip-6987.md b/EIPS/eip-6987.md index eedc7f5a994d8a..c6a6e293e72741 100644 --- a/EIPS/eip-6987.md +++ b/EIPS/eip-6987.md @@ -1,5 +1,5 @@ --- -eip: 6987 +eip: 6988 title: Slashed validator cannot be elected as a block proposer description: Prevents a slashed validator from being elected as a block proposer author: Mikhail Kalinin (@mkalinin) From 5672cd98a6d8bc0d9bb31819941bc13a181233b2 Mon Sep 17 00:00:00 2001 From: Mikhail Kalinin Date: Fri, 19 May 2023 12:46:26 +0600 Subject: [PATCH 4/5] Update 6988 with links to spec and tests --- EIPS/eip-6987.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/EIPS/eip-6987.md b/EIPS/eip-6987.md index c6a6e293e72741..4dffa1585f9de7 100644 --- a/EIPS/eip-6987.md +++ b/EIPS/eip-6987.md @@ -1,6 +1,6 @@ --- eip: 6988 -title: Slashed validator cannot be elected as a block proposer +title: Elected block proposer is not slashed description: Prevents a slashed validator from being elected as a block proposer author: Mikhail Kalinin (@mkalinin) discussions-to: @@ -16,17 +16,15 @@ Introduces a modification to the consensus layer specification which ensures tha ## Motivation -A block proposed by a slashed validator is rejected by a corresponding validation check in the [`phase0/process_block_header`](https://github.com/ethereum/consensus-specs/blob/3115d1140b23dd4c9c23fbd9e2428186cf816bde/specs/phase0/beacon-chain.md#block-header) function as defined in the consensus layer specification. +A block proposed by a slashed validator is rejected by the corresponding validity check in the [`phase0/process_block_header`](https://github.com/ethereum/consensus-specs/blob/3115d1140b23dd4c9c23fbd9e2428186cf816bde/specs/phase0/beacon-chain.md#block-header) function as defined in the consensus layer specification. -At the same time the definition of the [`phase0/compute_proposer_index`](https://github.com/ethereum/consensus-specs/blob/3115d1140b23dd4c9c23fbd9e2428186cf816bde/specs/phase0/beacon-chain.md#compute_proposer_index) allows for a slashed validator to be elected as a proposer. This contradiction effectively leads to an empty slot if a block is supposed to be proposed by a slashed validator. +At the same time the definition of the [`phase0/compute_proposer_index`](https://github.com/ethereum/consensus-specs/blob/3115d1140b23dd4c9c23fbd9e2428186cf816bde/specs/phase0/beacon-chain.md#compute_proposer_index) allows for a slashed validator to be elected as a proposer. This contradiction effectively leads to a missed proposal if it is supposed to be made by a slashed validator. The impact of the proposed fix in the case of a single slashing on Ethereum Mainnet is negligible but it becomes significant in the case of correlated slashings. For instance, a correlated slashing of `1/10th` of a validator set can lead to `1/10th` of missed proposals in a number of epochs after the slashing. ## Specification -The proposed change is specified in [the consensus layer specification](https://github.com/ethereum/consensus-specs/blob/82cd2f1f2317f664b7e179acdd898a327e1fe77e/specs/deneb/beacon-chain.md#modified-compute_proposer_index). - -_TODO: move specification to `/_features` and provide a link._ +Specification of the proposed change can be found in [`/_features/eip6988/beacon-chain.md`](https://github.com/ethereum/consensus-specs/blob/0ad3972725e7c22e8edf3bab2dd7730acbe3c272/specs/_features/eip6988/beacon-chain.md). ## Rationale @@ -42,11 +40,15 @@ This fix changes proposer election mechanism in a backwards incompatible way and ## Test Cases -_TODO: provide a link to the tests written as a part of consensus layer specification._ +The following test cases were added to cover this change: +* [`test_slashed_proposer_rewarded_for_sync_aggregate_inclusion`](https://github.com/ethereum/consensus-specs/blob/0ad3972725e7c22e8edf3bab2dd7730acbe3c272/tests/core/pyspec/eth2spec/test/altair/block_processing/sync_aggregate/test_process_sync_aggregate.py#L712) +* [`test_slashed_proposer_rewarded_for_attestation_inclusion`](https://github.com/ethereum/consensus-specs/blob/0ad3972725e7c22e8edf3bab2dd7730acbe3c272/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_attestation.py#L17) +* [`test_slashed_validator_not_elected_for_proposal`](https://github.com/ethereum/consensus-specs/blob/0ad3972725e7c22e8edf3bab2dd7730acbe3c272/tests/core/pyspec/eth2spec/test/eip6988/unittests/validator/test_validator.py#L9) +* [`test_slashed_validator_elected_for_proposal`](https://github.com/ethereum/consensus-specs/blob/0ad3972725e7c22e8edf3bab2dd7730acbe3c272/tests/core/pyspec/eth2spec/test/phase0/unittests/validator/test_validator_unittest.py#L520) ## Reference Implementation -_TODO: provide a link to consensus layer specification._ +Reference implementation is in the same place as [Specification](#specification). ## Security Considerations From 56d1cb83b39aa31b23195d0558619e832e413de4 Mon Sep 17 00:00:00 2001 From: Mikhail Kalinin Date: Fri, 19 May 2023 12:55:57 +0600 Subject: [PATCH 5/5] EIP-6988: Add discussions-to --- EIPS/{eip-6987.md => eip-6988.md} | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) rename EIPS/{eip-6987.md => eip-6988.md} (95%) diff --git a/EIPS/eip-6987.md b/EIPS/eip-6988.md similarity index 95% rename from EIPS/eip-6987.md rename to EIPS/eip-6988.md index 4dffa1585f9de7..f7816ad40f61c7 100644 --- a/EIPS/eip-6987.md +++ b/EIPS/eip-6988.md @@ -1,9 +1,9 @@ --- eip: 6988 -title: Elected block proposer is not slashed +title: Elected block proposer has not been slashed description: Prevents a slashed validator from being elected as a block proposer author: Mikhail Kalinin (@mkalinin) -discussions-to: +discussions-to: https://ethereum-magicians.org/t/eip-6988-elected-block-proposer-has-not-been-slashed/14349 status: Draft type: Standards Track category: Core @@ -41,6 +41,7 @@ This fix changes proposer election mechanism in a backwards incompatible way and ## Test Cases The following test cases were added to cover this change: + * [`test_slashed_proposer_rewarded_for_sync_aggregate_inclusion`](https://github.com/ethereum/consensus-specs/blob/0ad3972725e7c22e8edf3bab2dd7730acbe3c272/tests/core/pyspec/eth2spec/test/altair/block_processing/sync_aggregate/test_process_sync_aggregate.py#L712) * [`test_slashed_proposer_rewarded_for_attestation_inclusion`](https://github.com/ethereum/consensus-specs/blob/0ad3972725e7c22e8edf3bab2dd7730acbe3c272/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_attestation.py#L17) * [`test_slashed_validator_not_elected_for_proposal`](https://github.com/ethereum/consensus-specs/blob/0ad3972725e7c22e8edf3bab2dd7730acbe3c272/tests/core/pyspec/eth2spec/test/eip6988/unittests/validator/test_validator.py#L9)