Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

BlockchainOptions#validate is too coarse #120

Closed
alcuadrado opened this issue Jul 12, 2019 · 5 comments · Fixed by #121
Closed

BlockchainOptions#validate is too coarse #120

alcuadrado opened this issue Jul 12, 2019 · 5 comments · Fixed by #121
Assignees

Comments

@alcuadrado
Copy link
Member

alcuadrado commented Jul 12, 2019

I'm working on a testing chain with this module and ethereumjs-vm and want to validate everything but POW. The reason I want to do it is that I want to spot every error asap, but I don't want to waste time on POW mining.

The problem is that the only way to disable POW verification is by setting BlockchainOptions#validate to false, and this also disables blocks' validation (i.e. calling block.validate).

I think we should have two separate options for this.

@s1na
Copy link
Contributor

s1na commented Jul 15, 2019

Makes sense. We could introduce an option either for validating blocks, or one for validating PoW, and for backwards-compatibility set it to self.validate by default.

@alcuadrado alcuadrado self-assigned this Jul 18, 2019
@alcuadrado
Copy link
Member Author

I found something weird while implementing this.

Blockchain#validate can be modified from the outside, and the tests actually do it. But if you create a blockchain with validate: false, and then set it to true, it won't instantiate ethash in the constructor, so changing it to true renders the Blockchain unusable.

This makes me wonder how used is the validation feature, and especially, changing it after creation.

To be strict with semver, we should probably fix this and release a new major, but is it worth it if nobody was using it? Just thinking aloud. I don't have a strong opinion on this.

@holgerd77
Copy link
Member

@alcuadrado Is this technically really a breaking change and not rather some bug fixing? Do you need this for your validate logic improvement development? Otherwise we could tackle separately and open a new issue?

@alcuadrado
Copy link
Member Author

Is this technically really a breaking change and not rather some bug fixing?

It's hard to tell. The original intention is not clear, and I have no idea who is consuming this library apart from the vm.

Do you need this for your validate logic improvement development?

Yes, I'll use a setter that updates both pow and blocks validation flags.


BTW, I disabled blocks validation in my code. I'm using VM#runBlock, which already validates them, so Blockchain#putBlock was validating them a second time, taking slightly more time with no benefit.

@holgerd77
Copy link
Member

I would tend to not do this as a major breaking release. Maybe just do your PR, I think we'll find a way how we do the process here.

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

Successfully merging a pull request may close this issue.

3 participants