Change network to interface in SimpleSigner #106
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes:
SimpleSigner
expects an interface type for thenetwork
parameter instead ofcore.Network
ssvlabs/ssv#1308 introduces support of custom network configs where any value can be overridden. Currently,
SimpleSigner
expects thenetwork
parameter of the typecore.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 aKeyManager
, if the network name differs from supported, thenSimpleSigner
would not work as expected.The
SimpleSigner
uses twocore.Network
's methods:EstimatedEpochAtSlot(slot phase0.Slot) phase0.Epoch
EstimatedSlotAtTime(time int64) phase0.Slot
EstimatedEpochAtSlot
calls onlySlotsPerEpoch
which returns 32 for any network. However,EstimatedSlotAtTime
callsMinGenesisTime
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.