Change the hash on the doc, to a hash on the genesis file itself. #1287
Labels
P:storage-optimization
Priority: Give operators greater control over storage and storage optimization
Milestone
Uh oh!
There was an error while loading. Please reload this page.
This is a follow-up issue from the PR #1017 submitted and merged
During the PR review, there were a few points highlighted to address some concerns the CometBFT team had regarding this particular PR. Since this PR was merged from a fork, a few of the suggestions by the CometBFT team to address the concerns were not possible to be accepted directly on the PR. So we merged the PR #1017 and will address these concerns in this issue.
Concerns to be addressed:
AppState
part of the genesis is application dependent and CometBFT has no "understanding" on its internal data structures. In theGenesisDoc
type, theAppState
property is just ajson.RawMessage
so any variations in its content might cause side effects that are beyond CometBFT's control such as hash mismatches.Context on genesis file chain initialization and upgrades:
genesis
file is to compare a checksum obtained from a reference repository or a group of operators during a coordinated upgrade or new chain initialization. For example, during a chain upgrade, validators might export the current state via the CLI (e.g.gaiad export
) and then they can generate a checksum of the exported genesis (based on a agreed hashing function (e.g. `sha256sum) and then they coordinate the upgrade by validating their own checksum against the "agreed" checksum of the majority of operators to ensure they all match in order to start the chain and achieve consensus. Therefore, implementing a logic that leverages the same hashing functionality on the same input used by operators is critical to ensure a reliable and trusted solution.mainnet
repository somewhere in Github where they list the checksum on a page for each genesis upgrade, or the checksum might be part of the release information for a chain mainnet or upgrade in Github.Suggested changes to be made to improve the solution:
#1
and#2
above. In our opinion, relying on a hash of the marshalled JSON input (bytes) is not the best solution (as mentioned in the sections above). We believe that a better approach is to rely on the checksum of thegenesis.json
file content. By applying this logic, we use the same approach chain operators use to manually validate a thegenesis
file (perform a checksum of the file contents, e.g.$ sha256sum genesis.json
). We believe operators will have more confidence in the solution since they can also have an external way to validate the hash information.genesis_hash = "b2fca9af31aae6953124439df5bc300c1ef11fb8be938aeb570767c5b6bfdaaf"
that can be used to validate the hash computed by CometBFT when reading the genesis file. If the hashes don't match (computed = specified) then the node fails to start, if they match then store the hash in the database. This will ensure that they are confident on the hash that will be stored in the database. As part of the future planning, we can also return the hash information via RPC and this will make it possible for operators and other users to validate the hash information against peers or public RPC nodes and that would address point#6
aboveThe text was updated successfully, but these errors were encountered: