Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

emit error on missing node #5

Closed
kumavis opened this issue May 29, 2015 · 10 comments
Closed

emit error on missing node #5

kumavis opened this issue May 29, 2015 · 10 comments

Comments

@kumavis
Copy link
Member

kumavis commented May 29, 2015

just blows up

/Users/kumavis/Development/Node/vapor-db/node_modules/merkle-patricia-tree/index.js:220
    if (node.type === 'leaf') {
            ^
TypeError: Cannot read property 'type' of null
    at processNode (/Users/kumavis/Development/Node/vapor-db/node_modules/merkle-patricia-tree/index.js:220:13)
    at /Users/kumavis/Development/Node/vapor-db/node_modules/merkle-patricia-tree/index.js:560:9
    at dispatchError (/Users/kumavis/Development/Node/vapor-db/node_modules/level/node_modules/level-packager/node_modules/levelup/lib/util.js:59:35)
    at /Users/kumavis/Development/Node/vapor-db/node_modules/level/node_modules/level-packager/node_modules/levelup/lib/levelup.js:222:14

npm ERR! Darwin 14.0.0
npm ERR! argv "node" "/usr/local/share/npm/bin/npm" "start"
npm ERR! node v0.12.0
npm ERR! npm  v2.9.1
npm ERR! code ELIFECYCLE
npm ERR! vapor-db@1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the vapor-db@1.0.0 start script 'node index.js'.
npm ERR! This is most likely a problem with the vapor-db package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node index.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls vapor-db
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/kumavis/Development/Node/vapor-db/npm-debug.log
@kumavis
Copy link
Member Author

kumavis commented May 29, 2015

triggered by

new Trie(stateDb, '0000000000000000000000000000000000000000000000000000000000000000')
trie.createReadStream().pipe(out)

@kumavis
Copy link
Member Author

kumavis commented May 29, 2015

of course I dont expect that to work, but i dont expect it to crash my program either

@wanderer
Copy link
Member

wanderer commented Jun 1, 2015

right that won't work because the stateRoot '0000000000000000000000000000000000000000000000000000000000000000' doesn't exsist.

@wanderer
Copy link
Member

wanderer commented Jun 1, 2015

@kumavis do you have any opoins on the expected behavior here?

@kumavis
Copy link
Member Author

kumavis commented Jun 1, 2015

should throw an error on a non-existing state root, no?

@kumavis
Copy link
Member Author

kumavis commented Jun 1, 2015

with the exception of the empty rlp stateRoot

@axic
Copy link
Member

axic commented Jun 13, 2016

Is this sorted?

@wanderer
Copy link
Member

no. I think we just need a better error message here

@kumavis
Copy link
Member Author

kumavis commented Dec 15, 2016

related #12

@holgerd77
Copy link
Member

Behavior of the current state of the library is to check for correctness of the provided stateRoot value and then initialize a trie with the stateRoot as the new root. Will close here.

Example code run:

import { BaseTrie as Trie } from 'merkle-patricia-tree'
const trie = new Trie(null, Buffer.from('0000000000000000000000000000000000000000000000000000000000000000', 'hex'))
stream.on('data', (d: any) => {
  console.log(d.key.toString())
  console.log(d.value.toString())
})
stream.on('end', () => {
  console.log('The end.')
})

Feel free to reopen if I haven't understand something correctly about the issue semantics.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants