-
Notifications
You must be signed in to change notification settings - Fork 45
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
event loader with event watch and backfill #911
base: develop
Are you sure you want to change the base?
Conversation
9d952d8
to
748c6d2
Compare
instLogs[len(instLogs)-1].Failed = true | ||
|
||
idx := strings.Index(log, ": ") + 2 | ||
currText := fmt.Sprintf(`Program returned error: "%s"`, log[idx:]) |
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.
Interesting... this looks useful, but I didn't think it was in scope for what we were trying to support (reading success or failure of contract calls, as opposed to just indexing events). Is this something CCIP mentioned they want, or is it just included here in case it comes in handy at some point?
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 was just in case it is needed. I carried it over from my initial POC and didn't feel like losing it as a feature.
04b2776
to
dc6d31d
Compare
@@ -249,7 +251,10 @@ func (c *EncodedLogCollector) loadSlotBlocksRange(ctx context.Context, start, en | |||
} | |||
|
|||
for _, block := range result { | |||
c.chBlock <- block | |||
select { | |||
case <-ctx.Done(): |
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.
Shouldn't there be a break
statement here to break out of the for loop if the context is cancelled?
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.
Oh, also in this line at the beginning of the loadSlotBlockRange
method where you add an rpc timeout... I think we should rename the child context to something else and use that only for the call to GetBlocks
... making use of the parent context here.
ctx, cancel := context.WithTimeout(ctx, c.rpcTimeLimit)
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.
That can provide assurance that the function exits immediately. I'll add it.
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.
The linter doesn't seem to care about variable name shadowing here, probably because it the first and only reset of ctx
within the function and the scope doesn't change (making the meaning of ctx
consistent for all the function). I don't think in this ... context
... variable name shadowing applies.
pkg/solana/logpoller/loader.go
Outdated
if err := c.loadSlotBlocksRange(ctx, start, end); err != nil { | ||
// a retry will happen anyway on the next round of slots | ||
// so the error is handled by doing nothing | ||
c.lggr.Error("failed to load slot blocks range", "start", start, "end", end, "err", err) |
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 think this needs to be c.lggr.Errorw
to work
Quality Gate failedFailed conditions |
Description
This PR introduces a component that monitors solana slot production and loads program log messages looking for emitted events. This component also provides a backfill feature to look for events in past blocks by program address.
Included is an integration test to a local solana validator as a smoke test and a benchmark test for watching slot production.
NONEVM-742