Skip to content

Commit 0594d57

Browse files
committed
test(osmosis): derive the osmo1 address from the device, not a literal
The hardcoded fixture was a cosmos1 address with the prefix swapped to osmo1, so its bech32 checksum was invalid. osmosis_signTxUpdateMsgSend bech32-decodes to_address and returns false on failure, which surfaces as the opaque 'Failed to include send message in transaction' — a device-side syntax error that reads like a firmware bug and was mine. Asking the device for its own address also makes these genuine self-sends.
1 parent 3a9e1b7 commit 0594d57

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

tests/test_msg_osmosis_signtx.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
# Osmosis uses the Cosmos coin type (118), not one of its own.
3535
DEFAULT_BIP32_PATH = "m/44h/118h/0h/0/0"
3636

37-
ADDR = "osmo15cenya0tr7nm3tz2wn3h3zwkht2rxrq7q7h3dj"
38-
3937

4038
def make_send(from_address, to_address, amount, denom='uosmo'):
4139
return {
@@ -50,14 +48,28 @@ def make_send(from_address, to_address, amount, denom='uosmo'):
5048

5149
class TestMsgOsmosisSignTx(common.KeepKeyTest):
5250

51+
def _address(self):
52+
"""Ask the device for its own osmo1 address.
53+
54+
Deliberately NOT a hardcoded constant: the firmware bech32-decodes
55+
to_address and refuses a bad checksum, so a literal invented by
56+
swapping a cosmos1 prefix for osmo1 fails with the opaque "Failed to
57+
include send message in transaction". Deriving it keeps the fixture
58+
honest and makes these self-sends.
59+
"""
60+
return self.client.osmosis_get_address(
61+
address_n=parse_path(DEFAULT_BIP32_PATH)
62+
).address
63+
5364
def _sign(self, amount, denom='uosmo'):
65+
addr = self._address()
5466
return self.client.osmosis_sign_tx(
5567
address_n=parse_path(DEFAULT_BIP32_PATH),
5668
account_number=16359,
5769
chain_id="osmosis-1",
5870
fee=800,
5971
gas=290000,
60-
msgs=[make_send(ADDR, ADDR, amount, denom)],
72+
msgs=[make_send(addr, addr, amount, denom)],
6173
memo="",
6274
sequence=17,
6375
)

0 commit comments

Comments
 (0)