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

Tech debt: make rollapp.GetRevisionForHeight more robust to missing heights #1596

Open
danwt opened this issue Dec 2, 2024 · 1 comment
Open

Comments

@danwt
Copy link
Contributor

danwt commented Dec 2, 2024

Should return also and error or OK bool. The current method is bug prone

@mtsitrin
Copy link
Contributor

mtsitrin commented Dec 3, 2024

can u elaborate what the possible bug is?

func (r Rollapp) GetRevisionForHeight(h uint64) Revision {
	for i := len(r.Revisions) - 1; i >= 0; i-- {
		if r.Revisions[i].StartHeight <= h {
			return r.Revisions[i]
		}
	}
	return Revision{}
}

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