osmosis-labs/test-tube

Non UTF-8 Go code

Buckram123 opened this issue · 3 comments

I just got this panic:

thread 'deposit_lands' panicked at .../.cargo/registry/src/index.crates.io-6f17d22bba15001f/test-tube-0.3.0/src/runner/result.rs:222:18:
Go code must encode valid UTF-8 string: Utf8Error { valid_up_to: 127, error_len: Some(1)

You can see it here:

let content_string = CString::new(content)
.unwrap()
.to_str()
.expect("Go code must encode valid UTF-8 string")
.to_string();

Converting error to the lossy string helped me figure out the issue:

[.../.cargo/registry/src/index.crates.io-6f17d22bba15001f/test-tube-0.3.0/src/runner/result.rs:221] lossy = "failed to execute message; message index: 0: dispatch: submessages: dispatch: submessages: failed to update grant with key \u{1}\u{14}\u{f6ec} ��Gl�O�=\u{1e}�\u{18}N�L�* �=\u{10}�\u{11}�V\t�\u{10}\u{1b}��mr>����G��tn�R\u{b}j��W/osmosis.concentratedliquidity.v1beta1.MsgCreatePosition: authorization not found"

I would like to at least get the lossy error in case of the Non UTF-8 strings

#50 (comment)

@iboss-ptk I would like to contribute on this! Would you prefer just always lossy string or different error type if it's non-utf8?

Hey! Wonder what creates non-utf8 content, what does that look like?

Hey! Wonder what creates non-utf8 content, what does that look like?

The error that is in description was from smart contract trying to use authz grant, but that grant didn't exist. Grant keys are non utf-8

See #51