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

Bytes base64 deserialization #1251

Open
fmorency opened this issue Dec 15, 2022 · 1 comment
Open

Bytes base64 deserialization #1251

fmorency opened this issue Dec 15, 2022 · 1 comment

Comments

@fmorency
Copy link
Contributor

fmorency commented Dec 15, 2022

Using tendermint-rs v0.28.0

Base64 deserialization on Bytes, e.g.,

// rpc/src/endpoint/broadcast/tx_sync.rs
pub struct Response {
...
  #[serde(with = "serializers::bytes::base64string")]
  pub data: Bytes,
...
}

doesn't work properly.

The following transaction is being executed.

ResponseDeliverTx { 
  code: 0, 
  data: b"\xd9'\x12\xa3\x02\xd9'\x10X\x1d\x01J\x10\x1dR\x1d\x81\x02\x11\xa0\xc64k\xa8\x9b\xd1\xcc\x1f\x82\x1c\x03\xb9i\xff\x9d\\\x8b/Y\x04A\xf6\x05\xc1\0", 
...
}

where the hexadecimal string corresponding to data is d92712a302d92710581d014a101d521d810211a0c6346ba89bd1cc1f821c03b969ff9d5c8b2f590441f605c100.

However, I get the following response when executing self.client.tx(tendermint::Hash::Sha256(hash), false).await

Response { 
  hash: Hash::Sha256(E35B544830279AE45AD4D5225C67C2BD2AECDCE25B1685CEA3767F0E8331882D), 
  ...
  tx_result: DeliverTx { 
    code: Ok, 
    data: b"2ScSowLZJxBYHQFKEB1SHYECEaDGNGuom9HMH4IcA7lp/51ciy9ZBEH2BcEA", 
    ...
  }
  ...
}

The data field is still base64-encoded.

echo 2ScSowLZJxBYHQFKEB1SHYECEaDGNGuom9HMH4IcA7lp/51ciy9ZBEH2BcEA | base64 -d | xxd -p
d92712a302d92710581d014a101d521d810211a0c6346ba89bd1cc1f821c03b969ff9d5c8b2f590441f605c100
@fmorency
Copy link
Contributor Author

cc @thanethomson

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

1 participant