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

Fix fetch state with endBlock and pending dynamic contracts #393

Merged
merged 6 commits into from
Dec 20, 2024

Conversation

DZakh
Copy link
Member

@DZakh DZakh commented Dec 20, 2024

No description provided.

@DZakh DZakh changed the title Fix fetch state with endblock Fix fetch state with endBlock and pending dynamic contracts Dec 20, 2024
let isPastEndblock = baseRegister.latestFetchedBlock.blockNumber >= endBlock
switch (baseRegister.registerType, endBlock) {
| (RootRegister, Some(endBlock)) =>
let isPastEndblock = getLatestFullyFetchedBlock(fetchState).blockNumber >= endBlock
Copy link
Member Author

Choose a reason for hiding this comment

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

This getLatestFullyFetchedBlock usage is the only change related to the fix. Since we want to consider pending dynamic contracts as well.

Other changes are either renaming of fetchState to partitionedFetchState which is more correct, since these are two different entities. And removing endBlock from fetchState since it's not needed there.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not 100% following the intricacies to be honest. Are you saying that before this fix, there could be pending requests to fetch more events for dynamic contracts that weren't accounted for - and 'getLatestFullyFetchedBlock' will include that?

Copy link
Member Author

Choose a reason for hiding this comment

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

Exactly

@DZakh DZakh requested a review from moose-code December 20, 2024 11:40
Copy link
Contributor

@JasoonS JasoonS left a comment

Choose a reason for hiding this comment

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

I'm not completely following - but happy to get this in so it doesn't block you and we can test it more (don't promote to 'latest' release etc until we're confident)

We can chat it through on a call too

let isPastEndblock = baseRegister.latestFetchedBlock.blockNumber >= endBlock
switch (baseRegister.registerType, endBlock) {
| (RootRegister, Some(endBlock)) =>
let isPastEndblock = getLatestFullyFetchedBlock(fetchState).blockNumber >= endBlock
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not 100% following the intricacies to be honest. Are you saying that before this fix, there could be pending requests to fetch more events for dynamic contracts that weren't accounted for - and 'getLatestFullyFetchedBlock' will include that?

@DZakh DZakh merged commit 12f5cce into main Dec 20, 2024
1 check passed
@DZakh DZakh deleted the dz/fix-fetch-state-with-endblock branch December 20, 2024 13:48
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.

2 participants