-
Notifications
You must be signed in to change notification settings - Fork 733
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
Node: Reobserve with custom endpoint #4260
base: main
Are you sure you want to change the base?
Node: Reobserve with custom endpoint #4260
Conversation
d399f23
to
ccaca21
Compare
da65817
to
880d508
Compare
456fed5
to
e724478
Compare
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.
Looks good, made some suggestions to simplify the code.
Note: Once #4116 is merged, the EVM version of |
// In the primary watcher flow, this is of no concern since we assume the node | ||
// always sends the head before it sends the logs (implicit synchronization | ||
// by relying on the same websocket connection). | ||
blockNumberU := atomic.LoadUint64(&w.latestFinalizedBlockNumber) |
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.
this does not seem same to assume that the watcher finalized block has any relation to the transaction from another connection. can Reobserve
create a new watcher instance?
@@ -341,8 +343,17 @@ func (s *SolanaWatcher) Run(ctx context.Context) error { | |||
ContractAddress: contractAddr, | |||
}) | |||
|
|||
// Don't overwrite these fields if they are already set in case there is an old go routine still using them. |
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.
does this actually happen somewhere or is this just a defense?
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.
This drew my eye as well. Maybe it's worth logging if s.ctx
isn't nil? Could be helpful to know if there's a Go routine out there that shouldn't be there.
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.
I have not actually seen it happen, it just seems like a theoretical possibility since the watcher spawns go routines to fetch accounts. Maybe those could still be running (and attempting to log or something) when the watcher restarts.
This PR adds support for the
reobserve-with-endpoint
admin command.Don't be alarmed by the size of this PR. 900+ lines are generated protobuf code. Also the code in
handleReobservationRequest
in Solana and EVM is mostly just code moved into a function so it can be reused.Tests performed: