-
Notifications
You must be signed in to change notification settings - Fork 782
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
Some cleanup for stateManager #266
Conversation
5e20d07
to
9536412
Compare
lib/stateManager.js
Outdated
self.blockchain = blockchain | ||
self.trie = trie | ||
self.blockchain = opts.blockchain || fakeBlockchain | ||
self.trie = opts.trie || new Trie() | ||
self._storageTries = {} // the storage trie cache | ||
self.cache = new Cache(trie) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should cache
also be made an option, so that people can easier switch that if desired?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but I'd do it in a separate work. _storageTries
is another cache too, so not sure how it works yet.
lib/stateManager.js
Outdated
@@ -33,6 +33,10 @@ function StateManager (opts) { | |||
|
|||
var proto = StateManager.prototype | |||
|
|||
proto.clone = function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be called copy
since both VM
and Trie
uses copy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. to improve consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though I think copy
is wrong overall, should be clone
, yet we can do that in a separate step.
lib/stateManager.js
Outdated
self.blockchain = blockchain | ||
self.trie = trie | ||
self.blockchain = opts.blockchain || fakeBlockchain | ||
self.trie = opts.trie || new Trie() | ||
self._storageTries = {} // the storage trie cache | ||
self.cache = new Cache(trie) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use self.trie
here, wonder why lint didn't catch this.
Looks good overall. I approve of this refactor. |
fe82d0b
to
d43976f
Compare
d43976f
to
1d5fecb
Compare
1d5fecb
to
eb745fb
Compare
Need to figure out why this is failing. |
eb745fb
to
2da1e3c
Compare
2da1e3c
to
405df7c
Compare
405df7c
to
c67fd50
Compare
Just rebased this. |
This is breaking at # file: modexpRandomInput test: modexpRandomInput
ok 1472 the state roots should match
ok 1473 the state roots should match
/Users/hdrewes/Documents/DEV/EthereumJS/ethereumjs-vm/node_modules/rustbn.js/lib/index.asm.js:1
(function (exports, require, module, __filename, __dirname) { var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else{throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object
Error: Number can only safely store up to 53 bits
at assert (/Users/hdrewes/Documents/DEV/EthereumJS/ethereumjs-vm/node_modules/bn.js/lib/bn.js:6:21)
at BN.toNumber (/Users/hdrewes/Documents/DEV/EthereumJS/ethereumjs-vm/node_modules/bn.js/lib/bn.js:506:7)
at getAdjustedExponentLength (/Users/hdrewes/Documents/DEV/EthereumJS/ethereumjs-vm/dist/precompiled/05-modexp.js:30:43)
at Object.module.exports [as code] (/Users/hdrewes/Documents/DEV/EthereumJS/ethereumjs-vm/dist/precompiled/05-modexp.js:82:22) Test can be run with: node tests/tester.js -s --test='modexpRandomInput' (just realized that I took the updated tests from #272, results on Travis might be different) |
c67fd50
to
b51c864
Compare
Just rebased this. |
b51c864
to
b25306e
Compare
@holgerd77 this works now! 😉 |
@holgerd77 mergemerge? :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Depends on #264. Part of #33.