Skip to content

Commit 7c14883

Browse files
committed
Add test case instantiate2_address_impl_matches_wasmd_for_len_24
1 parent e093f62 commit 7c14883

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

packages/std/src/addresses.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,28 @@ mod tests {
792792
}
793793
}
794794

795+
#[test]
796+
fn instantiate2_address_impl_matches_wasmd_for_len_24() {
797+
// Manual test data generated with wasmd and bech32 CLI as follows
798+
// 1. Install https://github.com/cmoog/bech32
799+
// 2. Check out wasmd main and change to `var ContractAddrLen = 24`
800+
// 3. Run `make build`
801+
// 4. Run `./build/wasmd q wasm build-address 1122112211221122112211221122112211221122112211221122112211221122 wasm1xvenxvenxvenxvenxvenxvenxvenxvenkz5vxp aabbaabb | bech32 -d | xxd -p`
802+
803+
let checksum =
804+
HexBinary::from_hex("1122112211221122112211221122112211221122112211221122112211221122")
805+
.unwrap();
806+
let creator = CanonicalAddr::from(hex!("3333333333333333333333333333333333333333"));
807+
let salt = hex!("aabbaabb");
808+
809+
let expected =
810+
CanonicalAddr::from(hex!["da1aaec9d0ddc75b873079eb1b4f7ddd73a0e3170225fec4"]);
811+
assert_eq!(
812+
instantiate2_address_impl(&checksum, &creator, &salt, b"", 24).unwrap(),
813+
expected
814+
);
815+
}
816+
795817
#[test]
796818
fn instantiate2_address_impl_works_for_cosmjs_test_vectors() {
797819
// Test data from https://github.com/cosmos/cosmjs/pull/1253

0 commit comments

Comments
 (0)