Skip to content

Conversation

@GiovanniTorrisi-ChainSecurity
Copy link
Collaborator

@GiovanniTorrisi-ChainSecurity GiovanniTorrisi-ChainSecurity commented Jul 7, 2025

This PR resolves #28.

Added early quit logic to the event validation, querying events in blocks and early quitting if there is a mismatch.

Refactored the get_events function into two:

  • get_eth_events: queries for all events in the range [from_block, to_block]
  • get_eth_events_paginated: splits the block range in blocks of at most config.max_blocks_per_event_query, and uses get_eth_events to query the events.

@GiovanniTorrisi-ChainSecurity
Copy link
Collaborator Author

DO NOT MERGE YET.

The tests are finally passing. But the sneaky bug that caused them to fail needs to be clarified before merging.

@stiefn stiefn marked this pull request as draft July 8, 2025 14:49
@GiovanniTorrisi-ChainSecurity GiovanniTorrisi-ChainSecurity marked this pull request as ready for review July 11, 2025 12:49
@GiovanniTorrisi-ChainSecurity
Copy link
Collaborator Author

Hi! There are a lot of commits in this MR. I would merge this with a single commit with a short commit message, instead of including all the sub-commits in the commit message.

@GiovanniTorrisi-ChainSecurity GiovanniTorrisi-ChainSecurity added the optimization Something is too slow label Jul 25, 2025
@stiefn stiefn force-pushed the 28-early-quit-event-validation branch 2 times, most recently from 26055ed to 2d56ebe Compare August 14, 2025 14:29
@stiefn stiefn force-pushed the 28-early-quit-event-validation branch from 40a6f55 to 0724277 Compare January 23, 2026 10:33
} else {
return Err(ValidationError::Invalid(message));
}
if num_occurrences + seen_events.len() > num_occurrences_expected {
Copy link
Contributor

Choose a reason for hiding this comment

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

this no longer checks if the number of occurrences is lower than the expected ones. if a dvf has been set up correctly, this should never happen but there are no guarantees that the dvfs are set up correctly. you can now create a dvf with an additional event that has not been emitted yet and it will validate in the future once it is emitted.

current_from = current_to + 1;
}

if num_occurrences < num_occurrences_expected {
Copy link
Contributor

Choose a reason for hiding this comment

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

fixed here

@stiefn stiefn merged commit bb4c1ba into main Jan 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

optimization Something is too slow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Early quit validation of critical events

3 participants