-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
CCIP-1288 LogPoller - Ability to pass custom search queries #11242
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ng all the TX internals into the ORM implementation
I see that you haven't updated any CHANGELOG files. Would it make sense to do so? |
mateusz-sekara
force-pushed
the
logpoller/any-query
branch
2 times, most recently
from
November 9, 2023 11:21
8fe631b
to
3a782be
Compare
mateusz-sekara
force-pushed
the
logpoller/any-query
branch
2 times, most recently
from
November 13, 2023 07:05
6e540a6
to
0d7096f
Compare
mateusz-sekara
commented
Nov 13, 2023
AND executed.block_number <= %s | ||
) < ('x' || encode(substring(reports.data from 32*:max_seq_word_index+25 for 8), 'hex'))::::bit(64)::::bigint - ('x' || encode(substring(reports.data from 32*:min_seq_word_index+25 for 8), 'hex'))::::bit(64)::::bigint + 1 | ||
ORDER BY (reports.block_number, reports.log_index)`, | ||
logpoller.NestedBlockNumberQuery(confs), |
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.
As a next step, I want to cache lastBlock in the memory. This would simplify queries to sth like this
args := logpoller.NewQueryArgs().
WithNamedHash("commit_store_addr", commitStore).
WithNamedHash("commit_store_event", commitStoreEvent).
WithNamedHash("offramp_addr", offramp).
WithNamedHash("offramp_event", offrampEvent).
WithNamedArg("after", time.Now().Add(-time.Hour)).
WithConfs("confirmed_at_block", confs)
query := `
SELECT reports.* FROM evm.logs reports
WHERE reports.evm_chain_id = :evm_chain_id
AND reports.address = :commit_store_addr
AND reports.event_sig = :commit_store_event
AND reports.block_timestamp > :after
AND reports.block_number > :confirmed_at_block
`
logs, err := th.ORM.SelectAnyLogs("ccipUnexpiredRoots", query, *args)
WithConf
will pick the proper value from cache:
if confs == Finalized {
return cache.latest_finalized_block
} else {
return cache.last_block - confs
}
mateusz-sekara
changed the title
LogPoller - ability to pass custom search queries
CCIP-1288 LogPoller - ability to pass custom search queries
Nov 13, 2023
mateusz-sekara
force-pushed
the
logpoller/moving-tx-to-orm
branch
from
November 13, 2023 07:27
a66a61d
to
75b12e7
Compare
mateusz-sekara
force-pushed
the
logpoller/any-query
branch
from
November 13, 2023 07:29
0d7096f
to
71ddc06
Compare
SonarQube Quality Gate |
mateusz-sekara
changed the title
CCIP-1288 LogPoller - ability to pass custom search queries
CCIP-1288 LogPoller - Ability to pass custom search queries
Nov 13, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adding the ability to create custom read queries in LogPoller. It's the 2nd part of improvements to LogPoller, which CCIP requires.
TestSelectAny
contains an example query we will use in CCIP to speed up execution and reduce the number of records fetched from the database.