SimpleSigner: change network to interface#106
Conversation
62088d8 to
079eb6f
Compare
|
@nkryuchkov @oleg-ssvlabs I have actually fixed a bug in this pr in this branch |
do you mean in |
@y0sher What bug does it fix? |
6f15d2e
d42891d
There was a problem hiding this comment.
Pull Request Overview
This PR updates the SimpleSigner component to accept a more flexible network interface, allowing custom network configurations to be passed in instead of being restricted to the pre-defined core.Network.
- Changed the network parameter type in SimpleSigner and related functions from core.Network to a new Network interface.
- Updated time handling in network functions and tests by replacing Unix timestamps with time.Time values and using time.Add for time deltas.
- Updated tests in signer and core packages to accommodate the new Network interface and time representations.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| signer/validator_signer.go | Updated SimpleSigner to use the new Network interface with time.Time-based methods. |
| signer/sign_beacon_block_test.go | Updated time parameter usage for far future validation tests. |
| signer/sign_attestation_test.go | Updated time parameter usage in attestation tests. |
| signer/far_future_protection.go | Refactored far future protection to use time.Time and updated delta variable. |
| core/networks_test.go | Updated tests to use time.Time in slot estimation. |
| core/networks.go | Modified the EstimatedSlotAtTime method signature and logic to use time.Time instead of Unix timestamps. |
c4795fa
c4795fa to
9389c39
Compare
Changes:
SimpleSignerexpects an interface type for thenetworkparameter instead ofcore.Networkssvlabs/ssv#1308 introduces support of custom network configs where any value can be overridden. Currently,
SimpleSignerexpects thenetworkparameter of the typecore.Networkwhich 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
NewSimpleSigneron setting up aKeyManager, if the network name differs from supported, thenSimpleSignerwould not work as expected.The
SimpleSigneruses twocore.Network's methods:EstimatedEpochAtSlot(slot phase0.Slot) phase0.EpochEstimatedSlotAtTime(time int64) phase0.SlotEstimatedEpochAtSlotcalls onlySlotsPerEpochwhich returns 32 for any network. However,EstimatedSlotAtTimecallsMinGenesisTimewhich returns 0 for unknown ones.The PR changes the type of the
networkparameter to the interface below to allow the SSV node to just pass any network matching the interface.