-
Notifications
You must be signed in to change notification settings - Fork 783
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
Incorrect behavior of fakeBlockChain.prototype.getBlock #446
Comments
Also, this is really weird: https://github.com/ethereumjs/ethereumjs-vm/blob/master/lib/fakeBlockChain.js#L12 |
Haven't looked deeply, but generally |
@s1na Hmm, I am actually not really aware why |
That's how I found this issue. I wasn't passing any blockchain to the VM, and running a block without skipping validations. That resulted in a crash, and when trying to debug it, the block hashes that the VM saw were completely different from the ones of the blocks I was creating. |
@holgerd77 What do you think about removing it? or moving it to the |
What would you do on VM instantiation? Create a normal blockchain object as default? |
Again: are you aware why this was introduced compared to using blockchain? |
No, I'm also not sure why it was introduced. Git history shows this commit to have added fakeBlockchain as a default. Yeah, if no blockchain was provided, create a new normal instance. If however blockchain has to be provided by the user, we could alternatively throw an error if none was provided (but what you suggested is probably the better approach). |
Fixed by #466, will close. |
Hi,
I'm pretty sure there's a bug here: https://github.com/ethereumjs/ethereumjs-vm/blob/master/lib/fakeBlockChain.js#L10
In my experience, using a VM instance without skipping validation will call this function with block hashes, so it's hashing the hash.
hash
should beblockTag
.Of course, the validation process fails anyway, but that incorrect implementation of
getBlock
is confusing, especially when debugging and seeing strange block hashes.The text was updated successfully, but these errors were encountered: