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

abci Tag deserializer #717

Closed
ancazamfir opened this issue Dec 1, 2020 · 0 comments · Fixed by #718
Closed

abci Tag deserializer #717

ancazamfir opened this issue Dec 1, 2020 · 0 comments · Fixed by #718
Assignees

Comments

@ancazamfir
Copy link
Contributor

DeliverTx and rpc block_result Response include events in the form Vec<Event>, where Event is defined here like this:

/// Event
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Event {
    /// Event type
    #[serde(rename = "type")]
    pub type_str: String,

    /// Attributes
    pub attributes: Vec<Tag>,
}

Where Tag is defined here
The Tag fields are base64 encoded but we do not decode when deserializing them, so the the Event looks something like:

    type_str: "send_packet",
    attributes: [
        Tag {
            key: Key(
                "cGFja2V0X3RpbWVvdXRfaGVpZ2h0",
            ),
            value: Value(
                "MC00ODQw",
            ),
        },
...

instead of:

Event {
    type_str: "send_packet",
    attributes: [
        Tag {
            key: Key(
                "packet_timeout_height",
            ),
            value: Value(
                "0-4840",
            ),
        },
...

In IBC we need to extract some info from these tags (in particular the ones in DeliverTx) so we currently have to do something like:

let key = String::from_utf8(base64::decode(tag.key.to_string().as_bytes())?)?;

I think this should be done in tendermint-rs instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants