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

study freezing of validators #14515

Open
potuz opened this issue Oct 7, 2024 · 3 comments
Open

study freezing of validators #14515

potuz opened this issue Oct 7, 2024 · 3 comments

Comments

@potuz
Copy link
Contributor

potuz commented Oct 7, 2024

To date we have 1.6M validators in the validator slice, but less than 1.1M active validators. This proposal is to study replacing the corresponding exited validators by their HTR in the state structure. This should result in savings of about 45MB per beacon state. We could study how other clients have implemented this (I believe Nimbus already did this). A straw-man design is to have pointers to a validator interface in the state instead of pointers to the actual validator. We would have two types of structures satisfying this interface, a usual validator and an FrozenValidator. This last one would return errors for anything other than Active() (it can be hardcoded to false in the root version) and HashTreeRoot() (which would return the frozen root).

@threewebcode
Copy link
Contributor

The inactive validators should be pruned and validator index should be reused for later validator.

@tushar994
Copy link

tushar994 commented Oct 16, 2024

Hello, I would like to work on this, but I need some help.

  • I have asked the team at nimbus, and they said that they don't have something like this implemented right now.
  • I have gone through the repo, and I wanted to ask if the Validator struct generated by the validator.proto is the struct we will look to modify here? And I see two of these proto files, one in prysm/proto/prysm/v1alpha1/validator.pb.go and one in prysm/proto/eth/v1/validator.pb.go, which one is the relevant one?

How do I go about this change? Should I make a ValidatorInterface such that the validator struct satisfies it, create a proto file for FrozenValidator and make it satisfy the interface as well, and then replace the use of the pointer to the Validator struct everywhere instead with the use of a pointed to the ValidatorInterface instead?

And before doing all of this, should I look at any other client implementations to see if they have this implemented?

@potuz

@syjn99
Copy link
Contributor

syjn99 commented Oct 22, 2024

@threewebcode Reusing validator index must be followed by a core proposal. It seems like EIP-6914 once generates a discussion about this.

@tushar994 prysm/proto/prysm/v1alpha1/validator.pb.go has more usage like ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1", but I think we need to deal with both proto files.

I am interested this topic also, since it will be a huge burden especially after consolidation comes into.

Rough note here:

  • If validator is fully withdrawn(withdrawal_done), replace(="freeze") ethpb.Validator into newly created struct, maybe ethpb.FrozenValidator
  • For calculating hash tree root, field_root_validator.go must have some changes to use frozen root.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@potuz @tushar994 @syjn99 @threewebcode and others