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

Change network to interface in SimpleSigner #106

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nkryuchkov
Copy link

Changes:

  • SimpleSigner expects an interface type for the network parameter instead of core.Network

ssvlabs/ssv#1308 introduces support of custom network configs where any value can be overridden. Currently, SimpleSigner expects the network parameter of the type core.Network which means that it supports only values stored in this repository. On any other values, it returns default zero-values or crashes.

Therefore, when the SSV node calls NewSimpleSigner on setting up a KeyManager, if the network name differs from supported, then SimpleSigner would not work as expected.

The SimpleSigner uses two core.Network's methods:

  • EstimatedEpochAtSlot(slot phase0.Slot) phase0.Epoch
  • EstimatedSlotAtTime(time int64) phase0.Slot

EstimatedEpochAtSlot calls only SlotsPerEpoch which returns 32 for any network. However, EstimatedSlotAtTime calls MinGenesisTime which returns 0 for unknown ones.

The PR changes the type of the network parameter to the interface below to allow the SSV node to just pass any network matching the interface.

type network interface {
	EstimatedEpochAtSlot(slot phase0.Slot) phase0.Epoch
	EstimatedSlotAtTime(time int64) phase0.Slot
}

# Conflicts:
#	signer/far_future_protection.go
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.

2 participants