Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Event subscription as the first request results in fromBlock parameter to be deleted #570

Closed
jyeoniii opened this issue Jan 13, 2022 · 1 comment · Fixed by #571
Closed
Assignees
Labels
issue/bug Issues with the code-level bugs.

Comments

@jyeoniii
Copy link

jyeoniii commented Jan 13, 2022

Describe the bug
Race condition arises when the first request made by a Websocket provider is a subscription to an event which includes a request for historical logs.
It's been fixed in web3.js but it seems that the same bug still exists in caver-js.

How to reproduce
Create Caver using WebsocketProvider and request event subscription for the first request.

const caver = new Caver('wss://api.baobab.klaytn.net:8652');
const contract = new caver.klay.Contract(abi, contractAddress);
contract.events.allEvents({ fromBlock: 0 }).on('data', console.log);

If I call something like await caver.klay.getAccounts() before the subscription, it works fine.

Expected behavior
All events of the contract from block 0 should be retrieved.

Environment (please complete the following information)

  • caver-js version: 1.6.6
  • OS and its version: macOS 11.3.1
@jimni1222 jimni1222 self-assigned this Jan 14, 2022
@jimni1222 jimni1222 added the issue/bug Issues with the code-level bugs. label Jan 14, 2022
@jimni1222
Copy link
Contributor

@jyeoniii Thank you for reporting. You can use caver-js v1.6.7-rc.1 :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/bug Issues with the code-level bugs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants