Skip to content

Commit 23876e1

Browse files
chipshortmergify[bot]
authored andcommitted
Add test for old reply serialization
(cherry picked from commit 806ee18)
1 parent c1a7e6e commit 23876e1

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

packages/std/src/results/submessages.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,4 +616,29 @@ mod tests {
616616
}
617617
);
618618
}
619+
620+
#[test]
621+
fn reply_serialization_cosmwasm_1() {
622+
// json coming from wasmvm 1.5.0
623+
let json = r#"{"id":1234,"result":{"ok":{"events":[{"type":"message","attributes":[{"key":"signer","value":"caller-addr"}]}],"data":"Zm9vYmFy"}}}"#;
624+
625+
let reply: Reply = from_json(json).unwrap();
626+
assert_eq!(reply.id, 1234);
627+
assert_eq!(reply.payload, Binary::default());
628+
assert_eq!(
629+
reply.result,
630+
SubMsgResult::Ok(SubMsgResponse {
631+
data: Some(Binary::from_base64("Zm9vYmFy").unwrap()),
632+
events: vec![Event {
633+
ty: "message".to_string(),
634+
attributes: vec![Attribute {
635+
key: "signer".to_string(),
636+
value: "caller-addr".to_string()
637+
}]
638+
}],
639+
msg_responses: vec![]
640+
})
641+
);
642+
assert_eq!(reply.gas_used, 0);
643+
}
619644
}

0 commit comments

Comments
 (0)