Skip to content
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

Get request logs from past n blocks #11052

Merged
merged 16 commits into from
Nov 1, 2023

Conversation

KuphJr
Copy link
Collaborator

@KuphJr KuphJr commented Oct 23, 2023

No description provided.

@github-actions
Copy link
Contributor

I see that you haven't updated any CHANGELOG files. Would it make sense to do so?

@github-actions
Copy link
Contributor

I see that you haven't updated any README files. Would it make sense to do so?

@KuphJr KuphJr marked this pull request as ready for review October 24, 2023 20:18
@KuphJr KuphJr requested review from a team, bolekk and justinkaseman as code owners October 24, 2023 20:18
@KuphJr KuphJr requested a review from bolekk October 26, 2023 00:57
logPollerCacheDurationSec := int64(pluginConfig.LogPollerCacheDurationSec)
if logPollerCacheDurationSec <= 0 {
lggr.Warnw("invalid logPollerCacheDuration, using 300 instead", "logPollerCacheDurationSec", logPollerCacheDurationSec)
logPollerCacheDurationSec = 300
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain what you mean by const here? I'm not understanding why this should be a const variable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bolek probably means because this is a magic number we should instead set it to a more descriptive named const such as const PastBlocksToPoll = 50. My personal preferenece would also be to pull this either the top of the file or to a constants area for easy reference and changing.

pastBlocksToPoll := int64(pluginConfig.PastBlocksToPoll)
if pastBlocksToPoll <= 0 {
lggr.Warnw("invalid pastBlocksToPoll, using 50 instead", "pastBlocksToPoll", pastBlocksToPoll)
pastBlocksToPoll = 50
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here as well.

core/services/relay/evm/functions/logpoller_wrapper.go Outdated Show resolved Hide resolved
core/services/relay/evm/functions/logpoller_wrapper.go Outdated Show resolved Hide resolved
core/services/relay/evm/functions/logpoller_wrapper.go Outdated Show resolved Hide resolved
@KuphJr KuphJr requested a review from bolekk October 27, 2023 16:21
@KuphJr KuphJr enabled auto-merge October 27, 2023 17:25
@KuphJr KuphJr force-pushed the fix/functions-reorg-handling-logpoller branch from 0dc1baf to 8b98b57 Compare October 31, 2023 17:35
bolekk
bolekk previously approved these changes Oct 31, 2023
Copy link
Contributor

@bolekk bolekk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

return resultsReq, resultsResp, nil
}

func (l *logPollerWrapper) FilterPreviouslyDetectedEvents(logs []logpoller.Log, detectedEvents *detectedEvents, filterType string) []logpoller.Log {
if len(logs) > maxLogsToProcess {
l.lggr.Warnw("FilterPreviouslyDetectedEvents: too many logs to process, only processing latest maxLogsToProcess logs", "filterType", filterType, "nLogs", len(logs), "maxLogsToProcess", maxLogsToProcess)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to error level

@KuphJr KuphJr added this pull request to the merge queue Oct 31, 2023
@bolekk bolekk removed this pull request from the merge queue due to a manual request Oct 31, 2023
bolekk
bolekk previously approved these changes Oct 31, 2023
@cl-sonarqube-production
Copy link

@KuphJr KuphJr added this pull request to the merge queue Oct 31, 2023
Merged via the queue into develop with commit 24de8af Nov 1, 2023
84 checks passed
@KuphJr KuphJr deleted the fix/functions-reorg-handling-logpoller branch November 1, 2023 00:11
bolekk pushed a commit that referenced this pull request Nov 6, 2023
* Get request logs from past n blocks

* Separate confirmations setting for reqs & resps

* Filter already detected reqs & resps

* validate pastBlocksToPoll

* Fixed bugs which appeared during tests

* Addressed feedback

* Added test

* Added comment to config

* Fixed log & removed const

* Used const values for defaults

* Address feedback

* Fixed types for logPoller

* Added tests for FilterPreviouslyDetectedEvents

* Added additional test assertions

* Fixed lint errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants