Skip to content

Commit

Permalink
Add test for old reply serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
chipshort committed May 30, 2024
1 parent 9bdf442 commit 806ee18
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/std/src/results/submessages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,4 +595,29 @@ mod tests {
}
);
}

#[test]
fn reply_serialization_cosmwasm_1() {
// json coming from wasmvm 1.5.0
let json = r#"{"id":1234,"result":{"ok":{"events":[{"type":"message","attributes":[{"key":"signer","value":"caller-addr"}]}],"data":"Zm9vYmFy"}}}"#;

let reply: Reply = from_json(json).unwrap();
assert_eq!(reply.id, 1234);
assert_eq!(reply.payload, Binary::default());
assert_eq!(
reply.result,
SubMsgResult::Ok(SubMsgResponse {
data: Some(Binary::from_base64("Zm9vYmFy").unwrap()),
events: vec![Event {
ty: "message".to_string(),
attributes: vec![Attribute {
key: "signer".to_string(),
value: "caller-addr".to_string()
}]
}],
msg_responses: vec![]
})
);
assert_eq!(reply.gas_used, 0);
}
}

0 comments on commit 806ee18

Please sign in to comment.