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

Convert Phase0 slashing to Electra slashings at the fork #14844

Merged
merged 13 commits into from
Jan 31, 2025

Conversation

rkapka
Copy link
Contributor

@rkapka rkapka commented Jan 30, 2025

What type of PR is this?

Feature

What does this PR do? Why is it needed?

The PR adds a SlashingPoolService, whose function is to convert Phase0 slashing in the slashing pool into Electra slashings. Phase0 slashings will become invalid at the fork, so without this they would get lost.

Acknowledgements

@rkapka rkapka added the Electra electra hardfork label Jan 30, 2025
@rkapka rkapka requested a review from a team as a code owner January 30, 2025 07:27
@rkapka rkapka changed the title Eip 7549 slasher pt3 SlashingPoolService Jan 30, 2025
@@ -270,6 +270,32 @@ func (p *Pool) MarkIncludedProposerSlashing(ps *ethpb.ProposerSlashing) {
numProposerSlashingsIncluded.Inc()
}

// ConvertToElectra converts all Phase0 attester slashings to Electra attester slashings.
// This functionality is needed at the time of the Electra fork.
func (p *Pool) ConvertToElectra() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is tested in beacon-chain/operations/slashings/service_new_test.go

)

// WithElectraTimer includes functional options for the blockchain service related to CLI flags.
func WithElectraTimer(cw startup.ClockWaiter, currentSlotFn func() primitives.Slot) Option {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason why the parameter is a func, and not a struct or interface, is because we would need to pass in the chain service, which creates a cyclic dependency that is very hard to fix.

@rkapka rkapka changed the title SlashingPoolService Convert Phase0 slashing to Electra slashings at the fork Jan 30, 2025
@rkapka rkapka added this pull request to the merge queue Jan 31, 2025
Merged via the queue into develop with commit 1069da1 Jan 31, 2025
17 checks passed
@rkapka rkapka deleted the eip-7549-slasher-pt3 branch January 31, 2025 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Electra electra hardfork
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants