Skip to content

Conversation

@troggy
Copy link
Member

@troggy troggy commented Nov 1, 2019

ContractsEventsSubscription class reads events in interval [fromBlock,toBlock] every root chain block. After each read, it does fromBlock = toBlock assignment, to continue reading from toBlock.

However, both boundaries are included in the iteration. So block at toBlock height is already been read within [fromBlock,toBlock] iteration. To read the next portion, we have to start from toBlock + 1, not from toBlock.

Relates #340

`ContractsEventsSubscription` class reads events in interval `[fromBlock,toBlock]` every root chain block. After each read, it does `fromBlock = toBlock` assignment, to continue reading from `toBlock`.

However, both boundaries are included in the iteration. So block at `toBlock` height is already been read within `[fromBlock,toBlock]` iteration. To read the next portion, we have to start from `toBlock + 1`, not from `toBlock`.
@codecov
Copy link

codecov bot commented Nov 1, 2019

Codecov Report

Merging #348 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #348   +/-   ##
=======================================
  Coverage   95.16%   95.16%           
=======================================
  Files          72       72           
  Lines        1096     1096           
  Branches      206      206           
=======================================
  Hits         1043     1043           
  Misses         47       47           
  Partials        6        6
Impacted Files Coverage Δ
src/utils/ContractsEventsSubscription.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5195438...798bea7. Read the comment docs.

@troggy troggy changed the title fix: event subscription read the same block twice. fix: event subscription code reads the same block twice. Nov 1, 2019
@sunify sunify self-requested a review November 2, 2019 13:39
Copy link
Member

@sunify sunify left a comment

Choose a reason for hiding this comment

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

image

@troggy troggy merged commit 628c596 into master Nov 2, 2019
@troggy troggy deleted the fix/contract-event-subscription branch November 2, 2019 13:45
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.

3 participants