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 historical event subscriptions when made as first provider request #3455

Merged
merged 1 commit into from
Apr 6, 2020

Conversation

cgewecke
Copy link
Collaborator

@cgewecke cgewecke commented Apr 3, 2020

Description

Revival of #3401, targeted at 1.x

Resolves a race condition that arises when the first request made by a Websocket provider is a subscription to an event which includes a request for historical logs.

Web3 was deleting the fromBlock parameter made for the historical logs request while the Websocket connection established itself, resulting in the "missing logs" bug reported in #3389.

Commit (#3401) 64c1302 is a test that can be seen failing in Travis here
Commit (#3401) 7f3f42b fixes it by copying the params.

The copied params object looks like....

{
 "fromBlock": "0x0",
 "topics": [
  "0x929af6b98ce8455e51b1e90cceeeec03ce38d7c7396f1f0b0233d043c898a29c",
  null
 ],
 "address": "0xc30a9b6f84a3d660585437a00ddd0090773ea9dc"
}

Fixes #3389

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • Any dependent changes have been merged and published in downstream modules.
  • I ran npm run dtslint with success and extended the tests and types if necessary.
  • I ran npm run test:unit with success.
  • I have executed npm run test:cov and my test cases do cover all lines and branches of the added code.
  • I ran npm run build-all and tested the resulting file/'s from dist folder in a browser.
  • I have updated the CHANGELOG.md file in the root folder.
  • I have tested my code on the live network.

@cgewecke cgewecke added 1.x 1.0 related issues Review Needed Maintainer(s) need to review labels Apr 3, 2020
@coveralls
Copy link

coveralls commented Apr 3, 2020

Coverage Status

Coverage increased (+0.004%) to 88.581% when pulling b8f5223 on issue/3389 into cae5334 on 1.x.

@holgerd77
Copy link
Collaborator

@cgewecke had a short look, but I'll leave conflict resolving to you here (after merging the Websocket Improvement PR), not sure on all changes

holgerd77
holgerd77 previously approved these changes Apr 6, 2020
Copy link
Collaborator

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

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

LGTM

});
});
});

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice and clean test setup and procedural structure. Really cool! 👍

this.options.requestManager.send({
method: 'eth_getLogs',
params: [payload.params[1]]
params: [blockParams]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Had some broader look at surrounding code blocks, should be side-effects free.

@holgerd77
Copy link
Collaborator

(@cgewecke can you eventually update other outstanding PRs as well? Think this will make the process easier.)

Copy link
Collaborator

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

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

Reapproval after merge-conflict resolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x 1.0 related issues Review Needed Maintainer(s) need to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WebsocketProvider with fromBlock doesnt return events from the past
3 participants