Skip to content
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

Genesis hash fo ShelleyGenesis file #1531

Closed
erikd opened this issue Jun 9, 2020 · 4 comments
Closed

Genesis hash fo ShelleyGenesis file #1531

erikd opened this issue Jun 9, 2020 · 4 comments

Comments

@erikd
Copy link
Contributor

erikd commented Jun 9, 2020

This is not a must have, but is a "nice to have".

For pure Shelley networks (eg testnets that do not follow on from Byrin), it would be nice to have a way of canonically hashing the shelley genesis file so that the first block in a pure Shelley chain can use the hash of the genesis file as the hash of the first block's previous block.

@mrBliss
Copy link
Contributor

mrBliss commented Jun 23, 2020

I'm bumping this to a higher priority because we need the genesis hash for IntersectMBO/ouroboros-network#2235, which is needed for a Byron-to-Shelley mainnet.

What I have in mind is something like the GenesisHash of Byron. Just a newtype around a hash. It should at least have a NoUnexpectedThunks instance. This value will be read from the CLI/configuration file (not the genesis file itself of course) and passed to ouroboros-consensus as part of the ProtocolInfo for Shelley. Should it use the same HASH type? Are the CLI tools to quickly compute that HASH of the genesis.json file?

@nc6
Copy link
Contributor

nc6 commented Jun 24, 2020

It would be nice to clarify exactly the requirements of this task. The original issue from @erikd refers to a separate thing than the comment from @mrBliss. I'll try to describe what I think the possibilities here are:

  • @mrBliss's comment seems to refer mostly to a value used for the initial nonce. If this is the only thing needed, I'm not clear what's required from the ledger here, which treats the initial nonce just as a random value. Do we want to verify that the initial nonce matches some derivation from the genesis? That would seem odd in the ledger, which cares neither about the initial nonce nor about ShelleyGenesis.

  • @erikd, on the other hand, talks about a hash included in the first block referring to Shelley genesis. We used to have this, but it was removed (by Jared, in Allow Shelley ledger to start at origin #1326), I think in response to requirements from consensus. Currently the issue with adding an initial hash is that we use WithOrigin LastAppliedBlock in certain state, and we cannot therefore include a hash inside Origin. Without understanding why these changes were made, I'm hesitant to remove them.

@mrBliss
Copy link
Contributor

mrBliss commented Jun 24, 2020

I had a discussion with @nc6 and we decided that it's best to just use the Nonce type directly for this, both in cardano-ledger-specs (to avoid confusion as Genesis(Config)Hash would not be related to the existing GenesisHash and genesis in any way) and in ouroboros-consensus (we just need a Nonce for entropy, we also don't care where it comes from). Only in cardano-node, where they have to provide that Nonce to consensus (via ProtocolInfo, is the choice made to use the hash of the Shelley genesis JSON file.

For a Byron-to-Shelley mainnet, we don't care about Origin being replaced with the actual genesis hash, it will be the hash of the last Byron block. It only matters for fresh Shelley nets, which are not the highest priority.

@nc6
Copy link
Contributor

nc6 commented Nov 19, 2020

I think we will not address this issue further; it would require various changes in consensus and our interface to do so.

@nc6 nc6 closed this as completed Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants