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

New ssv_types #69

Merged
merged 4 commits into from
Dec 12, 2024
Merged

New ssv_types #69

merged 4 commits into from
Dec 12, 2024

Conversation

Zacholme7
Copy link
Member

Issue Addressed

N/A

Proposed Changes

This PR introduces a new ssv_types system.

The types follow a hierarchical structure of roughly the following. This cleanly represents all SSV specific information.

  • Operator
    • Operator ID
    • Operator Public Key
  • Cluster
    • Cluster ID
    • Validator Metadata
    • Cluster Members
      • Identifiers
      • Share

It does not contain related methods as we still need to determine what is needed, but this is an initial step to get the ball rolling.

Copy link
Contributor

@jking-aus jking-aus left a comment

Choose a reason for hiding this comment

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

I think this is the way to go - let's get it passing CI and have a chat about a few things then merge it down

edit: seeing the CI flags are dependencies -- let's just have a chat on the below and we'll merge anyway

/// The number of faulty operator in the Cluster
pub faulty: u64,
/// If the Cluster is liquidated or active
pub liquidated: bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see a liquidated flag in the specs but can understand why it would be useful. Is there no analogous implementation in the go client?

Copy link
Member Author

Choose a reason for hiding this comment

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

Its on the metadata here in the client.


/// A Cluster is a group of Operators that are acting on behalf of a Validator
#[derive(Debug, Clone)]
pub struct Cluster {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think domain needs to be included on the Cluster unless you had another plan for that implementation

Copy link
Member Author

Choose a reason for hiding this comment

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

I left domain and some other specific Validator data off since a lot of it is going to be included via the lighthouse types. If we realize it makes more sense to add it here we can do that.

/// Unique identifier for the Operator this member represents
pub operator_id: OperatorId,
/// Unique identifier for the Cluster this member is a part of
pub cluster_id: ClusterId,
Copy link
Contributor

Choose a reason for hiding this comment

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

I dont think we need clusterid here since ClusterMember is already contained within a Cluster -- suggest drop unless there's a reason

Copy link
Member Author

@Zacholme7 Zacholme7 Dec 10, 2024

Choose a reason for hiding this comment

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

Good point, but I think this depends on how we want to structure the maps for the database. If we want to do something like OperatorID => Vec of ClusterMembers, then this ClusterID is important. If we do ClusterID => Vec of ClusterMembers, then it is not important. The design of the database quite tightly influences the design of the types and it's hard to anticipate what the right structure is at this point.

#[derive(Debug, Clone)]
pub struct Share {
/// The public key of this Share
pub share_pubkey: PublicKey,
Copy link
Contributor

Choose a reason for hiding this comment

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

would we not need operatorID here?

Copy link
Member

Choose a reason for hiding this comment

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

The Share is part of ClusterMember, and the operator ID can be found there

Copy link
Member Author

Choose a reason for hiding this comment

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

Something I considered but this is also a it depends on the structure of the database. We do have the access to the OperatorID from the ClusterMember. My idea was to go from ClusterID => Share where the Share is owned by the current operator, so storing the ID on the share is not needed in this case.


/// Unique identifier for a cluster
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Hash, From, Deref)]
pub struct ClusterId(pub u64);
Copy link
Contributor

Choose a reason for hiding this comment

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

I know there is some terminology overlap but it's probably better we stick with "committee" for now so we're using the same terminology as the other client team

Copy link
Member

Choose a reason for hiding this comment

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

An argument for "cluster" is that "committee" might be confusable with the committees from Ethereum consensus

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep Daniel mentioned my idea behind Cluster. Im good to change it but in that case we should name it something like SSVCommittee just to be explicit about the difference.


/// General Metadata about a Validator
#[derive(Debug, Clone)]
pub struct ValidatorMetadata {
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a reason we've pulled out the committee ID and domaintype from here?

Copy link
Member

Choose a reason for hiding this comment

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

I think this type is supposed to basically represent the metadata of the validator operated by the cluster, not the cluster itself, so I think I like leaving it out here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, this is just about the Validator the cluster is acting on behalf of. Can be stored in database as ClusterID => ValidatorMetadata so this info still gets included. As for the domain, I left it off because I believe it is being included via lighthouse types, but I have to double check to confirm what it gets included through.


/// Client responsible for maintaining the overall health of the network.
#[derive(Debug, Clone)]
pub struct Operator {
Copy link
Contributor

Choose a reason for hiding this comment

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

is there any benefit to tracking our cluster memberships here or is that being handled in the DB?

Copy link
Member

Choose a reason for hiding this comment

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

IMO that should be handled in the db

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, I recommend keeping Operator self contained and handling this in the DB

#[derive(Debug, Clone)]
pub struct Share {
/// The public key of this Share
pub share_pubkey: PublicKey,
Copy link
Member

Choose a reason for hiding this comment

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

The Share is part of ClusterMember, and the operator ID can be found there


/// One of N shares of a split validator key.
#[derive(Debug, Clone)]
pub struct Share {
Copy link
Member

Choose a reason for hiding this comment

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

Should we add the (encrypted) private key here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I had it in but removed it right before the PR as I convinced myself it wasn't needed in the Share for some reason. Thinking on it now it should probably be here. I'll add it back in thanks!


/// Client responsible for maintaining the overall health of the network.
#[derive(Debug, Clone)]
pub struct Operator {
Copy link
Member

Choose a reason for hiding this comment

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

IMO that should be handled in the db


/// General Metadata about a Validator
#[derive(Debug, Clone)]
pub struct ValidatorMetadata {
Copy link
Member

Choose a reason for hiding this comment

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

I think this type is supposed to basically represent the metadata of the validator operated by the cluster, not the cluster itself, so I think I like leaving it out here.

Copy link
Contributor

@jking-aus jking-aus left a comment

Choose a reason for hiding this comment

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

lgtm

@jking-aus jking-aus merged commit 4182bf6 into sigp:unstable Dec 12, 2024
8 checks passed
@Zacholme7 Zacholme7 deleted the new-ssvtypes branch December 12, 2024 12:55
/// Base-64 encoded PEM RSA public key
pub rsa_pubkey: Rsa<Public>,
/// Owner of the operator
pub owner: Address,
Copy link

@diegomrsantos diegomrsantos Jan 9, 2025

Choose a reason for hiding this comment

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

Is this necessary? I think I didn't see it in the go code

Copy link
Member Author

Choose a reason for hiding this comment

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

The public key is used for initial operator identification. When you first join as an operator and do not yet know your id, the public key is used to match to event logs and figure out which id is yours.

The owner address is where the SSV you get paid for running an operator is sent to

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

Successfully merging this pull request may close these issues.

4 participants