feat(solis-pending): add modification to starknet service to gather r… #12
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.
Enhance gather_messages function to handle pending and confirmed events
Pull Request Description
This pull request enhances the
gather_messages
function to ensure no events are missed by fetching and processing events from both confirmed and pending blocks within the Starknet blockchain.Summary of Changes
The
gather_messages
function now:from_block
toto_block
).Detailed Explanation
The function correctly handles errors in fetching the latest block number, logging a warning and returning an error.
from_block
Against Latest Block:This ensures the function does not process blocks that are not yet confirmed.
to_block
:The
to_block
is determined correctly to avoid going beyond the latest block.Events are fetched and processed correctly, converting them into
L1HandlerTx
transactions if they meet the required criteria.A lock is acquired to ensure atomicity, and pending events are fetched and processed.
The latest block number is fetched again to ensure no new blocks were missed.
Confirmed events from the latest block are fetched and processed to ensure none are missed.
The cache is cleared, and pending events are fetched again to ensure no events are missed during cache clearing.
Complete Updated
gather_messages
Function