question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unexplicable range error

See original GitHub issue

I’m trying to implement this in a project but lately one of the passing tests which was using that library keeps on failing due to:

RangeError: Maximum call stack size exceeded                                                                                                                                                                                                      at MerkleTree.createHashes (node_modules/merkletreejs/index.js:41:15)                                                   at MerkleTree.createHashes (node_modules/merkletreejs/index.js:87:10)                                                   at MerkleTree.createHashes (node_modules/merkletreejs/index.js:87:10)                                                   at MerkleTree.createHashes (node_modules/merkletreejs/index.js:87:10)                                                   at MerkleTree.createHashes (node_modules/merkletreejs/index.js:87:10)                                                   at MerkleTree.createHashes (node_modules/merkletreejs/index.js:87:10)                                                   at MerkleTree.createHashes (node_modules/merkletreejs/index.js:87:10)                                                   at MerkleTree.createHashes (node_modules/merkletreejs/index.js:87:10)                                                   at MerkleTree.createHashes (node_modules/merkletreejs/index.js:87:10)                                                   at MerkleTree.createHashes (node_modules/merkletreejs/index.js:87:10)

Is it meant to act like that with a code like (using Block from here):

const block = new Block();
const SHA256 = require('crypto-js/sha256');
const BSHA3 = bufferify(require('crypto-js/sha3')); //see #5

const leaves = block.transactions.map(BSHA3);
console.log('leaves=', leaves); //[] as expected
block.merkleTree = new MerkleTree(leaves, SHA256); //Runs into the RangeError shown above

Or am I missing something?

EDIT: this doesn’t happen when the leaves point to a non-empty array but give the error whenever it uses an empty one (even before it got filled later on).

Would it be preferrable to only create and initialise the tree once the data passed to the leaves would already be there (say a bunch of transactions in a block) or was that edge case simply not taken into account?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
miguelmotacommented, Oct 26, 2018

@Berkmann18 ah sorry, you’re right. The leaves weren’t being converted into buffers. Pushed an update to convert the leaves into buffers so you don’t need to ‘bufferify’ the hash algo for the leaves

1reaction
miguelmotacommented, Oct 23, 2018

will take a look…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inexplicable Subscript out of range error forWorksheet reference ...
I run across the same error from identical, earlier versions of the program that had worked fine. Also, the problem is the same...
Read more >
Attempt to write outside buffer bounds" · Issue #7047 · nodejs ...
I've had multiple users report a RangeError: Attempt to write outside buffer bounds error that originates inside the Buffer constructor. Here's ...
Read more >
Inexplicable, simple, 'list index out of range' -- Python
I keep trying to use this for loop. Actually a variety of for loops. I keep getting the error, 'list index out of...
Read more >
Inexplicable errors by dynare - General DSGE Modeling
I am getting errors which I have never seen before. Without making any changes , the error description changes everytime i run the...
Read more >
Inexplicable Error with a simple Script - Unity Forum
Try creating a public instance variable for PickableObject and see if it's possible to assign it through the inspector. One reason this might...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found