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

Unexpected zero hash for genesis header. #71

Closed
davxy opened this issue Feb 15, 2025 · 3 comments
Closed

Unexpected zero hash for genesis header. #71

davxy opened this issue Feb 15, 2025 · 3 comments

Comments

@davxy
Copy link

davxy commented Feb 15, 2025

I'm attempting to import your test blocks.

Of course I started from the first one with tiny config : https://github.com/jam-duna/jamtestnet/blob/main/data/assurances/blocks/1_000.json

Given your tiny chainspec https://github.com/jam-duna/jamtestnet/blob/main/chainspecs/rawkv/genesis-tiny.json I get the same state root, so far so good.

However, there seems to be a discrepancy with the genesis block header hash. In your implementation (referenced here: link), you've set the genesis block header hash to all zeros. Instead, we expect it to be the hash of the actual genesis block header.

We expect that the parent field in the genesis header to be set to all zeros, but the parent of the first block to correspond to the genesis block header hash.

@davxy
Copy link
Author

davxy commented Feb 15, 2025

For the record this is how our Genesis block looks like

{
    "header": {
        "parent": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "parent_state_root": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "extrinsic_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "slot": 0,
        "epoch_mark": {
            "entropy": "0x0000000000000000000000000000000000000000000000000000000000000000",
            "tickets_entropy": "0x0000000000000000000000000000000000000000000000000000000000000000",
            "validators": [
                "0x5e465beb01dbafe160ce8216047f2155dd0569f058afd52dcea601025a8d161d",
                "0x3d5e5a51aab2b048f8686ecd79712a80e3265a114cc73f14bdb2a59233fb66d0",
                "0xaa2b95f7572875b0d0f186552ae745ba8222fc0b5bd456554bfe51c68938f8bc",
                "0x7f6190116d118d643a98878e294ccf62b509e214299931aad8ff9764181a4e33",
                "0x48e5fcdce10e0b64ec4eebd0d9211c7bac2f27ce54bca6f7776ff6fee86ab3e3",
                "0xf16e5352840afb47e206b5c89f560f2611835855cf2e6ebad1acc9520a72591d"
            ]
        },
        "tickets_mark": null,
        "offenders_mark": [],
        "author_index": 65535,
        "entropy_source": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "seal": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
    },
    "extrinsic": {
        "tickets": [],
        "preimages": [],
        "guarantees": [],
        "assurances": [],
        "disputes": {
            "verdicts": [],
            "culprits": [],
            "faults": []
        }
    }
}

Header hash for this genesis block is:
0x476243ad7cc4fc49cb6cb362c6568e931731d8650d917007a6037cceedd62244

Thus we expect your first block (1_000.json) to have genesis block header hash as parent (instead of 0x00..00)

@sourabhniyogi
Copy link
Contributor

Thank you for making the existence of a genesis block crystal clear, we'll add this concept and publish a chain spec with this genesis block for tiny and similarly for other network sizes.

Up until your comment we assumed there was simply a genesis state and no need for a genesis block. Will conform and confirm soon!

@davxy
Copy link
Author

davxy commented Feb 15, 2025

As the hash of any block header can serve as a reference to that block's post-state, the genesis header hash specifically serves as a reference to the genesis post state while executing the first block.

The post-state root of the genesis matches yours, by the way. In other words, the parent state root of your first block header is the same with what we have. It’s simply a matter of adjusting the genesis header to be used. Let me know when you're ready for me to give it another try—I’m excited to move forward!

@davxy davxy closed this as completed Feb 16, 2025
ggwpez added a commit to JamBrains/jam-docs that referenced this issue Feb 18, 2025
Proposal for **tiny** genesis header $H_0$ to be used for
interoperability testing.


[Rendered](https://github.com/davxy/jam-docs/blob/davxy/genesis-specs/docs/basics/genesis-config/index.md)

---

Related discussions:
- jam-duna/jamtestnet#71
- javajamio/javajam-trace#2


---

Feel free to edit PR e.g. to move the content to
`basics/genesis-config/tiny.md`

---------

Co-authored-by: Oliver Tale-Yazdi <[email protected]>
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

2 participants