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

Cannot properly parse block #1403

Closed
rllola opened this issue Mar 28, 2024 · 3 comments · Fixed by #1404
Closed

Cannot properly parse block #1403

rllola opened this issue Mar 28, 2024 · 3 comments · Fixed by #1404
Labels
bug Something isn't working

Comments

@rllola
Copy link

rllola commented Mar 28, 2024

What went wrong?

We are trying to use tendermint httpclient to query blocks. After a hardfork we are querying the new genesis block but have this error:

invalid block: last_commit is empty on non-first block

Steps to reproduce

(If needed I can provide a minimal example)

Definition of "done"

Allowing parsing any kind of blocks regardless if they have empty commit or not.

@rllola rllola added the bug Something isn't working label Mar 28, 2024
@romac
Copy link
Member

romac commented Mar 28, 2024

Right, looks like we have such checks here:

if last_commit.is_none() && header.height.value() != 1 {
return Err(Error::invalid_block(
"last_commit is empty on non-first block".to_string(),
));
}
if last_commit.is_some() && header.height.value() == 1 {
return Err(Error::invalid_block(
"last_commit is filled on first block".to_string(),
));
}

Perhaps they should be bypassed when constructing a Block from an RPC response as we do not control the validity of the block we get in the response. But we should probably keep enforcing them when we build a Block by hand so to speak to still catch such mistakes when possible.

@romac
Copy link
Member

romac commented Mar 28, 2024

I just opened a draft PR with a tentative fix.

If you add the following lines at the end of namadexer/Cargo.toml and build it again, does it solve the issue?

[patch.crates-io]
tendermint        = { git = "https://github.com/informalsystems/tendermint-rs.git", branch = "romac/allow-misformed-block" }
tendermint-rpc    = { git = "https://github.com/informalsystems/tendermint-rs.git", branch = "romac/allow-misformed-block" }
tendermint-proto  = { git = "https://github.com/informalsystems/tendermint-rs.git", branch = "romac/allow-misformed-block" }
tendermint-config = { git = "https://github.com/informalsystems/tendermint-rs.git", branch = "romac/allow-misformed-block" }

@rllola
Copy link
Author

rllola commented Mar 28, 2024

It is working! Awesome. I really didn't expect to have a solution so fast. 5 stars

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants