-
Notifications
You must be signed in to change notification settings - Fork 12
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
New ssv_types
#69
Conversation
There was a problem hiding this 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, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
/// Base-64 encoded PEM RSA public key | ||
pub rsa_pubkey: Rsa<Public>, | ||
/// Owner of the operator | ||
pub owner: Address, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
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.
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.