Comments (4)
@Ryanmtate do you have the code that generates this error?
from merkle-patricia-tree.
I've seen this a bunch with the TestRPC. Was too intermittent to figure out the root cause however.
from merkle-patricia-tree.
This problem still exists with TestRPC, I've spent a few hours trying to track down how to fix it, but so far haven't figured out how. Callback hell...
I've tried making it pass an error in the callback from watchController.only
in walkTrie
helper processNode
but there seems to be a lot of code elsewhere that doesn't follow the callback(error, value) convention, causing all kinds of strange behaviour. I squashed many of those, but I don't think calling the continuation in only
with an error if node
is undefined is the right fix. It seems to put the server's state manager in a broken state, all subsequent calls return the same error. Don't fully understand all the surrounding code yet.
Giving up for now, might look at it again later if I have time. But I'm documenting my findings below if anyone else has the patience:
The symptoms start with this line in Trie._findPath
's processNode
walkController.only(branchIndex)
which then runs this function
only: function (childIndex) {
var childRoot = node.getValue(childIndex)
self._lookupNode(childRoot, function (node) { // node is undefined here
var childKey = key.slice()
childKey.push(childIndex)
processNode(childRoot, node, childKey, cb)
})
}
In the recursive call for processNode from above it calls this line
if (!node) return cb() <-- no arguments
this is cb from above
if (err) {
return onDone(err)
}
// returnValues is an empty array from the walkTrie closure, so essentially onDone()
onDone.apply(null, returnValues)
onDone from above is the callback in Trie.put
at this line
self._findPath(key, function (err, foundValue, keyRemainder, stack) {
// all arguments here are undefined because it gets called with no arguments
if (err) {
return cb(err);
}
// then update
// this call crashes the program because stack is undefined
self._updateNode(key, value, keyRemainder, stack, cb)
})
from merkle-patricia-tree.
Will cautiously close this since the issue is pretty old, there hasn't been any reports lately and the code base changed significantly since. There has also been a refactor of the WalkController
in #135 by @jochem-brouwer. Feel free to reopen though if you still think this is an issue.
from merkle-patricia-tree.
Related Issues (20)
- missing typescript types HOT 3
- Trie only accepts one `put` call HOT 2
- Rename Trie.prove to Trie.createProof HOT 7
- Analyze speed deterioration of v4 HOT 6
- Verify Proof fails if there is an extension with an embedded branch
- Library fails branch-value-update test HOT 5
- update checkpointing API HOT 2
- Support Question, headline replaced by admin
- better proof/verification support HOT 3
- Support Promise and callbacks for async functions HOT 1
- Extract db-related logic from baseTrie HOT 4
- Replace istanbul with nyc HOT 1
- More consistent and better structured directory/file layout HOT 2
- Data gets lost when using string as a key. (memdown + 2 tries) HOT 3
- Tape v4.10.0 breaks tests
- Delete node error HOT 6
- nibbles.js matchingNibbleLength potential error HOT 1
- Replace sha3 with keccak256 HOT 1
- npm run build fails HOT 1
- Add Ethereum name or address to package.json
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from merkle-patricia-tree.