Skip to content

Commit 3a9e1b7

Browse files
committed
fix(osmosis): the MsgSend client path was dead code with three bugs
Adding the first Osmosis device tests immediately failed with "Unsupported denomination: uosmo". The cause is that osmosis_sign_tx's MsgSend branch had never executed: 1. It whitelisted 'uatom' — the COSMOS denom. Osmosis's native denom is uosmo, so signing a plain OSMO transfer was impossible. 2. It never forwarded the denom, though OsmosisMsgSend carries one. The firmware needs it to decide whether to scale (uosmo -> OSMO) or show raw base units. 3. It assigned amount=int(...) to OsmosisMsgSend.amount, which is a STRING field — that alone would have raised for uatom too. Bug 3 proves the path never ran; bugs 1 and 2 are why it went unnoticed. No denom whitelist belongs on the client: the firmware already handles any denom, scaling uosmo and showing everything else as raw base units precisely so it never guesses a precision it does not know.
1 parent b257df2 commit 3a9e1b7

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

keepkeylib/client.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -999,15 +999,20 @@ def osmosis_sign_tx(
999999
if len(msg['value']['amount']) != 1:
10001000
raise CallException("Osmosis.MsgSend", "Multiple amounts per msg not supported")
10011001

1002-
denom = msg['value']['amount'][0]['denom']
1003-
if denom != 'uatom':
1004-
raise CallException("Osmosis.MsgSend", "Unsupported denomination: " + denom)
1005-
1002+
# This branch had never executed. It whitelisted 'uatom' — the
1003+
# COSMOS denom, so a native OSMO send was impossible — dropped
1004+
# the denom instead of forwarding it, and assigned an int to
1005+
# OsmosisMsgSend.amount, which is a string field and would have
1006+
# raised even for uatom. No denom whitelist belongs here at all:
1007+
# the firmware decides how to render each one (uosmo scaled to
1008+
# OSMO, anything else shown as raw base units).
1009+
coin = msg['value']['amount'][0]
10061010
resp = self.call(osmosis_proto.OsmosisMsgAck(
10071011
send=osmosis_proto.OsmosisMsgSend(
10081012
from_address=msg['value']['from_address'],
10091013
to_address=msg['value']['to_address'],
1010-
amount=int(msg['value']['amount'][0]['amount']),
1014+
denom=coin['denom'],
1015+
amount=str(coin['amount']),
10111016
address_type=types.SPEND,
10121017
)
10131018
))

0 commit comments

Comments
 (0)