-
Notifications
You must be signed in to change notification settings - Fork 990
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
[feature] Introduce command 'verify-chain' to verify the whole chain state #3609
Comments
This could be a useful command for an “extended test” CI job as well. |
There is a |
Good question and good find. I'm not familiar with the code, but it seems that it calls this https://github.com/mimblewimble/grin/blob/master/chain/src/chain.rs#L616-L624 . The interesting part is that the fast_validation argument is set to true, which means that it skips verification of kernel sigs and and rangeproofs in this case as can be seen here https://github.com/mimblewimble/grin/blob/master/chain/src/txhashset/txhashset.rs#L1575-L1582 My understanding is that the |
Yes This is not actively used currently and I see no reason why we don't want to simply default this to |
|
This seems to have been resolved. |
Is your feature request related to a problem? Please describe.
There is no way to verify the chain state from the command line. We assume the UTXO set, the set of kernels and the offset produce a valid state. In general this should be true, but as was seen in the recent events, it is possible to produce an invalid state through block processing due to the use of various optimization techniques.
Describe the solution you'd like
As a user, I would like to run
./grin verify-chain
which would verify the whole state of the blockchain at that point in time.Verification processing includes:
sum(kernels) = sum(utxo_set) + height*H + offset*G
(this formula is not precise but you get the point)It is possible I missed some elements of the chain that would need to be verified.
Describe alternatives you've considered
I think the alternative right now is to resync the node - although I'm not sure if this does such verification until the horizon point and then block validation for the last week which may include the optimizations that I would like to avoid.
Additional context
This feature may be useful for catching live processing bugs due to optimizations or other reasons e.g. an inflation bug could have been caught earlier if someone was running this command periodically for their local chain.
Note: Since this command requires a lot of computation, it would probably mean that the node would need to stop processing and propagating blocks to avoid changing the state while we verify it. An example of what we don't want is to prune the rangeproofs or outputs that are in the UTXO set at the time we started verifying the chain state. Stopping processing seems conceptually simpler and safer than labeling merkle entries as removed until the computation is finished and later running a garbage collector.
The text was updated successfully, but these errors were encountered: