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

ssv-signer support #2028

Open
wants to merge 172 commits into
base: stage
Choose a base branch
from
Open

ssv-signer support #2028

wants to merge 172 commits into from

Conversation

nkryuchkov
Copy link
Contributor

@nkryuchkov nkryuchkov commented Feb 7, 2025

Add remote signer support

  • add ssv-signer service
  • add ssv-signer support to ssv-node

Comment on lines 11 to 16
type RemoteSigner interface {
ListKeys(ctx context.Context) ([]string, error)
ImportKeystore(ctx context.Context, keystoreList, keystorePasswordList []string) ([]web3signer.Status, error)
DeleteKeystore(ctx context.Context, sharePubKeyList []string) ([]web3signer.Status, error)
Sign(ctx context.Context, sharePubKey []byte, payload web3signer.SignRequest) ([]byte, error)
}
Copy link
Contributor

@iurii-ssv iurii-ssv Mar 7, 2025

Choose a reason for hiding this comment

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

Because we are importing web3signer package here anyway - it seems web3signer package is a better place to have RemoteSigner interface defined as well don't you think ?

Just to be on the same page - I believe it only makes sense to define interface on the user/caller side in the following cases (which doesn't seem to apply here):

  • we can't define it in the original package (maybe we can't modify that code, eg. it's a 3rd party lib)
  • we don't want to import the package defining some interface we need as a dependency for some reason
  • or we just want a subset of methods on some interface (because we either want to make it explicit which ones we actually gonna use; and/or maybe it's just simpler to mock out smaller interface)

The reason I don't like to define interface(s) on the user/caller side is that eventually results in bunch of interface definitions (often duplicate ones) all over the code which makes it harder to navigate. Maybe it's not a problem if such definitions are made package-private (so it's clear they aren't meant to be re-imported by other packages) - but that's a convention we'd need to explicitly follow for it to work like that.

wdyt ? cc @olegshmuelov @oleg-ssvlabs @moshe-blox @y0sher @MatusKysel

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We also want to support other signers, such as https://github.com/attestantio/dirk. They require different implementations. I don't mind changing it to unexported though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

made it unexported

Comment on lines +119 to +121
if len(statuses) != 1 {
return fmt.Errorf("bug: expected 1 status, got %d", len(statuses))
}
Copy link
Contributor

@moshe-blox moshe-blox Mar 9, 2025

Choose a reason for hiding this comment

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

shouldn't this check be done by default in the client if the responses are always expected to return len(statuses) == len(pubkeys)?

Comment on lines +8 to +11
type BlockRootWithSlot struct {
spectypes.SSZBytes // block root
Slot phase0.Slot
}
Copy link
Contributor

@moshe-blox moshe-blox Mar 9, 2025

Choose a reason for hiding this comment

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

if this is a type solely meant for signing, perhaps this should be in ekm package

also, if it should only be a phase0.Root, then let's please use that type to guarantee that...

)

type BeaconBlockData struct {
Version string `json:"version"`
Copy link
Contributor

Choose a reason for hiding this comment

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

lets use our custom DataVersion wrapper instead of string (see #2028 (comment))

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.

7 participants