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

The eos-transfers example crashes when started in replay mode and start at block -1 #171

Open
olivierbeaulieu opened this issue Jul 11, 2019 · 0 comments

Comments

@olivierbeaulieu
Copy link
Contributor

olivierbeaulieu commented Jul 11, 2019

When the eos-transfers example is run via yarn example eos-transfers, it works. However, is you start modifying values to see demux's difference behaviours, it crashes.

Changing startAtBlock from 50000000 to -1:

const actionReader = new NodeosActionReader({
  startAtBlock: -1,
  onlyIrreversible: false,
  nodeosEndpoint: "https://api.eosnewyork.io"
})

And changing watch to be in replay mode:

actionWatcher.watch(true)

Will crash on the first block with this error:

[2019-07-11T16:16:40.446Z] ERROR: demux/32914: Invalid array length
    RangeError: Invalid array length
        at ObjectActionHandler.rollbackTo (/Users/olivier/projects/demux-js-dfuse/node_modules/demux/examples/eos-transfers/ObjectActionHandler.js:68:26)
        at ObjectActionHandler.<anonymous> (/Users/olivier/projects/demux-js-dfuse/node_modules/demux/examples/eos-transfers/node_modules/demux/dist/AbstractActionHandler.js:187:28)
        at Generator.next (<anonymous>)
        at /Users/olivier/projects/demux-js-dfuse/node_modules/demux/examples/eos-transfers/node_modules/demux/dist/AbstractActionHandler.js:7:71
        at new Promise (<anonymous>)
        at __awaiter (/Users/olivier/projects/demux-js-dfuse/node_modules/demux/examples/eos-transfers/node_modules/demux/dist/AbstractActionHandler.js:3:12)
        at ObjectActionHandler.handleRollback (/Users/olivier/projects/demux-js-dfuse/node_modules/demux/examples/eos-transfers/node_modules/demux/dist/AbstractActionHandler.js:182:16)
        at ObjectActionHandler.<anonymous> (/Users/olivier/projects/demux-js-dfuse/node_modules/demux/examples/eos-transfers/node_modules/demux/dist/AbstractActionHandler.js:54:24)
        at Generator.next (<anonymous>)
        at fulfilled (/Users/olivier/projects/demux-js-dfuse/node_modules/demux/examples/eos-transfers/node_modules/demux/dist/AbstractActionHandler.js:4:58)

It is caused by ObjectActionHandler's rollbackTo trying to create an array with negative length, since latestBlockNumber is 0 (by default), and blockNumber will be something like 68149703.

I'm trying to understand why is a rollback attempted here, maybe you can shed some light on this.

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

No branches or pull requests

1 participant