diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index 7ccdaece0..a44ccb8f7 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -30,6 +30,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Ensure that all testnet coins use SLIP-44 coin type 1. - Disable all testnet coins from accessing Bitcoin paths. - Restrict BIP-45 paths to Bitcoin and coins with strong replay protection. +- Fix operation source account encoding in Stellar. ## 2.4.0 [9th June 2021] diff --git a/core/src/apps/stellar/operations/serialize.py b/core/src/apps/stellar/operations/serialize.py index fbd7f74e1..f8ccdff2f 100644 --- a/core/src/apps/stellar/operations/serialize.py +++ b/core/src/apps/stellar/operations/serialize.py @@ -138,8 +138,9 @@ def _write_set_options_int(w, value: int): def write_account(w, source_account: str): if source_account is None: writers.write_bool(w, False) - return - writers.write_pubkey(w, source_account) + else: + writers.write_bool(w, True) + writers.write_pubkey(w, source_account) def _write_asset_code(w, asset_type: int, asset_code: str): diff --git a/legacy/firmware/CHANGELOG.md b/legacy/firmware/CHANGELOG.md index cf8eb65d1..871036576 100644 --- a/legacy/firmware/CHANGELOG.md +++ b/legacy/firmware/CHANGELOG.md @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Don't show addresses that have an unrecognized path. - Disable all testnet coins from accessing Bitcoin paths. - Restrict the BIP-32 path ranges of `account`, `change` and `address_index` fields. +- Fix operation source account encoding in Stellar. ## 1.10.1 [9th June 2021] diff --git a/legacy/firmware/stellar.c b/legacy/firmware/stellar.c index ccc7bd569..8b79adb30 100644 --- a/legacy/firmware/stellar.c +++ b/legacy/firmware/stellar.c @@ -165,8 +165,8 @@ bool stellar_signingInit(const StellarSignTx *msg) { bool stellar_confirmSourceAccount(bool has_source_account, const char *str_account) { + stellar_hashupdate_bool(has_source_account); if (!has_source_account) { - stellar_hashupdate_bool(false); return true; } diff --git a/tests/device_tests/test_msg_stellar_sign_transaction.py b/tests/device_tests/test_msg_stellar_sign_transaction.py index dd9a55e4b..70070ecd5 100644 --- a/tests/device_tests/test_msg_stellar_sign_transaction.py +++ b/tests/device_tests/test_msg_stellar_sign_transaction.py @@ -234,7 +234,7 @@ def test_sign_tx_allow_trust_op(client): def test_sign_tx_change_trust_op(client): op = messages.StellarChangeTrustOp() - op.limit = 500111000 + op.limit = 5000000000 op.source_account = "GBOVKZBEM2YYLOCDCUXJ4IMRKHN4LCJAE7WEAEA2KF562XFAGDBOB64V" op.asset = messages.StellarAssetType( @@ -248,7 +248,7 @@ def test_sign_tx_change_trust_op(client): assert ( b64encode(response.signature) - == b"OZdDO/qW8o/xbV6nZaDM/D7z9/fqbrk+P4lSzzCqeD3C8nGOg+Jl33JqHek0zNNOW9Pn+tPpfdoQnuZWJzocCw==" + == b"B7UyKRCzVf6esTkzDJgac0vJ1YfI4Z7Ecq65/3TY0+D/VB3myZVg06LMjgIf10q8kF+GvJwN6XGKRd6q1wxHAw==" ) diff --git a/tests/ui_tests/fixtures.json b/tests/ui_tests/fixtures.json index 172bc8285..626a07208 100644 --- a/tests/ui_tests/fixtures.json +++ b/tests/ui_tests/fixtures.json @@ -593,7 +593,7 @@ "test_msg_stellar_sign_transaction.py::test_sign_tx_account_merge_op": "cba8c17ea77956cbe0cb77fdbaeac7408cdc934d60f1a3d0c2f1d4375ce49ebd", "test_msg_stellar_sign_transaction.py::test_sign_tx_allow_trust_op": "e1585be0bbf49a9dc0902fca6e8df6fa5851cbbe27b22a88710944209ac29315", "test_msg_stellar_sign_transaction.py::test_sign_tx_bump_sequence_op": "eaf6d92c7b897338959b20d4aa1281110d0a5179b4bd53ceab88ee50b2456b80", -"test_msg_stellar_sign_transaction.py::test_sign_tx_change_trust_op": "8d6cc0009b370753bdf0b674650543ae24e68cb420cb451e23631002e497790e", +"test_msg_stellar_sign_transaction.py::test_sign_tx_change_trust_op": "c3e3e56d684deb29a1558bbb35c13aad80e26dd58230aeed9ee3ddd127efcb52", "test_msg_stellar_sign_transaction.py::test_sign_tx_create_account_op": "a1dcb3b4630fc45a771b4a6e65eab879adfe59c38624881e140cf08c1f83a9df", "test_msg_stellar_sign_transaction.py::test_sign_tx_manage_offer_op": "32b68728958da31382907f8c0a76547011d264241ec4974fa85c487ffdb7a1b0", "test_msg_stellar_sign_transaction.py::test_sign_tx_passive_offer_op": "ab6808486a4e98bbf990b55d60489a4f3464572428e9374a8f55d5352581a678",