-
Notifications
You must be signed in to change notification settings - Fork 359
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
Fix header decoding errors #1343
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ancazamfir for jumping on this so quickly 🙏
@@ -71,8 +71,14 @@ pub fn extract_header_from_tx(event: &tendermint::abci::Event) -> Option<AnyHead | |||
let value = tag.value.as_ref(); | |||
if let HEADER = key { | |||
let header_bytes = hex::decode(value).unwrap(); | |||
let header: AnyHeader = Protobuf::decode(header_bytes.as_ref()).unwrap(); | |||
return Some(header); | |||
let result = match Protobuf::decode(header_bytes.as_ref()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we just return Result directly and let the calling code in the relayer trace the underlying error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe try_from_tx
should see its signature changed from
pub fn try_from_tx(event: &tendermint::abci::Event) -> Option<IbcEvent>
to
pub fn try_from_tx(event: &tendermint::abci::Event) -> (Option<IbcEvent>, Vec<Error>)
so that we can still build the IbcEvent
even if the header decoding failed, but also return any errors encountered (eg. the header decoding error itself).
While we're at it, we should perhaps also address the |
Let's address my comments in a follow-up PR. |
* Return None when header cannot be decoded * More details in misbehaviour error * Set the event height and include it in the error * Add .changelog entry Co-authored-by: Anca Zamfir <zamfiranca@gmail.com> Co-authored-by: Romain Ruetschi <romain@informal.systems>
Closes: #1342
Description
For contributor use:
unclog
.docs/
) and code comments.Files changed
in the Github PR explorer.