Skip to content

Fix fetch state with endBlock and pending dynamic contracts#393

Merged
DZakh merged 6 commits intomainfrom
dz/fix-fetch-state-with-endblock
Dec 20, 2024
Merged

Fix fetch state with endBlock and pending dynamic contracts#393
DZakh merged 6 commits intomainfrom
dz/fix-fetch-state-with-endblock

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