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

InitChain does not respect InitialHeight #19765

Closed
1 task done
joshklop opened this issue Mar 15, 2024 · 1 comment
Closed
1 task done

InitChain does not respect InitialHeight #19765

joshklop opened this issue Mar 15, 2024 · 1 comment
Assignees
Labels

Comments

@joshklop
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

When I call InitChain with an InitialHeight of 0 and call Commit, subsequent calls to Info return 1 as the LastBlockHeight.

Does the cosmos-sdk require InitialHeight to be set to 1? (I am using v0.47.2, but it appears this is the case in v0.50.3 as well). The ABCI appears to allow for both 0 and 1.

Possibly related: #16796

Cosmos SDK Version

v0.47.2

How to reproduce?

N/A

@facundomedica
Copy link
Member

facundomedica commented Mar 18, 2024

CometBFT allows InitialHeight to be 0 in InitChain but that does not mean that it allows a block with height 0 to exist.

See here:

And the Cosmos SDK does the same, accepts both 0 and 1, but will start always at 1:

if app.initialHeight == 0 { // If initial height is 0, set it to 1
app.initialHeight = 1
}

So starting at 0 or 1 will get you on block 1, but starting at any N > 1 will get you block N.

@github-project-automation github-project-automation bot moved this from 📋 Backlog to 🥳 Done in Cosmos-SDK Mar 18, 2024
@tac0turtle tac0turtle removed this from Cosmos-SDK Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants