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

Remove hack for prev_block_hash in Celestia genesis #553

Merged
merged 2 commits into from
Jul 25, 2023

Conversation

preston-evans98
Copy link
Member

Description

Tendermint's Hash type is an enum with two variants: sha256 or None, where None is only used by the Genesis block. This representation violates the Sovereign SDK's requirement that all blocks be uniquely identifiable by a [u8;32]. To fix it, we just need to hardcode a special "placeholder" hash for the genesis block.

We had previously done this inside our TmHash type, but that type was missing block height information - so it could potentially be fooled into returning the placeholder for blocks other than the first. This PR fixes that issue.

Linked Issues

Testing

I tested this using a local Celestia devnet to ensure that the hack worked if and only if the height was 1.

@neysofu neysofu force-pushed the preston/fix_celestia_hack branch from fb71a22 to b533688 Compare July 25, 2023 10:53
@neysofu
Copy link
Member

neysofu commented Jul 25, 2023

I rebased to –hopefully– fix CI.

@codecov
Copy link

codecov bot commented Jul 25, 2023

Codecov Report

Merging #553 (1a41299) into nightly (adeafc1) will decrease coverage by 0.2%.
The diff coverage is 30.0%.

Files Changed Coverage Δ
adapters/celestia/src/verifier/mod.rs 0.0% <0.0%> (ø)
adapters/celestia/src/celestia.rs 58.3% <31.5%> (-2.4%) ⬇️

@preston-evans98 preston-evans98 enabled auto-merge (squash) July 25, 2023 16:43
@preston-evans98 preston-evans98 merged commit fd58400 into nightly Jul 25, 2023
@preston-evans98 preston-evans98 deleted the preston/fix_celestia_hack branch July 25, 2023 17:08
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

Successfully merging this pull request may close these issues.

Remove hack for prev_block_hash in Celestia genesis
4 participants