-
Notifications
You must be signed in to change notification settings - Fork 125
beacon: pass context to methods #2188
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
Conversation
# Conflicts: # beacon/goclient/signing.go
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
@@ -105,6 +105,8 @@ func New(logger *zap.Logger, opts Options, slotTickerProvider slotticker.Provide | |||
|
|||
// Start starts to stream duties and run IBFT instances | |||
func (n *Node) Start(logger *zap.Logger) error { | |||
ctx := n.context // TODO: pass it to Start |
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.
what about this todo ? I think it's better to create issue in GH rather then write TODO
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.
Pull Request Overview
This PR updates the beacon client to pass context parameters explicitly to all methods instead of relying on an internal context. The key changes include updating function signatures across multiple files, removing the Context field from the Options struct, and adjusting tests accordingly.
Reviewed Changes
Copilot reviewed 45 out of 45 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
beacon/goclient/voluntary_exit.go | Updated SubmitVoluntaryExit to take a context parameter. |
beacon/goclient/validatorliveness.go | Context is now passed to recordRequestDuration. |
beacon/goclient/validator.go | Function signatures updated to include context parameter in various methods. |
beacon/goclient/sync_committee_contribution.go | Updated functions to require context parameter. |
beacon/goclient/sync_committee.go | Updated signature for GetSyncMessageBlockRoot and SubmitSyncMessages. |
beacon/goclient/spec_test.go, signing_test.go | Updated tests to pass context appropriately. |
beacon/goclient/signing.go | Updated DomainData to accept context. |
beacon/goclient/proposer.go | Updated functions to include context in their calls. |
beacon/goclient/options.go | Removed the Context field from Options. |
beacon/goclient/goclient.go | Removed internal client context and updated New to accept context. |
Other test and helper files | Adjusted new client invocations to pass context. |
Comments suppressed due to low confidence (1)
beacon/goclient/options.go:10
- The Context field was removed from the Options struct; please update the documentation and code comments to reflect that the New function now expects a context as its first argument.
Context context.Context
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.
great job!
Left few minor comments related to the usage of t.Context()
in tests. I believe it's optional to fix them, hence approving PR.
@@ -49,7 +120,17 @@ type signer interface { | |||
|
|||
// BeaconNode interface for all beacon duty calls | |||
type BeaconNode interface { | |||
specssv.BeaconNode // spec beacon interface |
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 it OK not to use spec definitions?
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, yes. We decided to diverge from spec where we need it to keep spec looking like spec without any overhead
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.
gj
This reverts commit 8915277.
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.
Nice!
* beacon: pass context to methods * fix context.Background leftovers * fix fee recipient tests * use t.Context instead of context.Background in tests * beacon: delete unused returned errors * Revert "beacon: delete unused returned errors" This reverts commit 8915277. * beacon: delete unused returned errors * spec alignment --------- Co-authored-by: y0sher <lyosher@gmail.com>
* beacon: pass context to methods * fix context.Background leftovers * fix fee recipient tests * use t.Context instead of context.Background in tests * beacon: delete unused returned errors * Revert "beacon: delete unused returned errors" This reverts commit 8915277. * beacon: delete unused returned errors * spec alignment --------- Co-authored-by: y0sher <lyosher@gmail.com>
Closes #2161
Part of PRs that will replace #1308
Currently, the beacon methods aren't cancellable because they use the common beacon client context, which matches the ssv-node lifetime