Skip to content

CCIP-6264 Removing redundant filter for data word > 0x0 #1050

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mateusz-sekara
Copy link
Contributor

ExecutionStateChange.State > 0 filter was redundant. It was translated to the following filter in the SQL query

substring(data from 32 * 1 + 1 for 32) > '\x0000000000000000000000000000000000000000000000000000000000000000'

That requires an additional index scan to verify whether the state is greater than or equal to 0. However, events with state = 0 must never land in the logs table, because UNTOUCHED(0) is an internal status used by the contract to track the state of the message during TX.

ExecutionStateChange event must never be emitted with anything other than INPROGRESS(1), SUCCESS(2) or FAILURE(3). Therefore, we can safely assume that extra filtering on the database level is not required. However, to stay defensive, we will add a check that will ignore events containing UNTOUCHED

Copy link

Metric exec-state-filtering main
Coverage 70.1% 69.6%

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.

1 participant