prysmaticlabs/prysm

study freezing of validators

potuz opened this issue · 3 comments

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).

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

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

@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.