Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): add Solana staking confirmation dialog #4639

Merged
merged 7 commits into from
Feb 25, 2025
Merged

Conversation

romanz
Copy link
Contributor

@romanz romanz commented Feb 17, 2025

Resolves #4560.

Figma

TODOs

  • show vote account with monospace font on Delizia
  • show the blockhash on Delizia summary menu
  • add UI test for stake & claim warnings
  • center claim question on Caesar
  • add translations for the new strings
  • show "Rent Fee" item -> Solana loadable tokens definitions & rent fee #4638

@romanz romanz added core Trezor Core firmware. Runs on Trezor Model T and T2B1. altcoin Any non-Bitcoin coins labels Feb 17, 2025
@romanz romanz self-assigned this Feb 17, 2025
@romanz romanz linked an issue Feb 17, 2025 that may be closed by this pull request
Copy link

github-actions bot commented Feb 17, 2025

core UI changes device test click test persistence test
T2T1 Model T test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
T3B1 Safe 3 test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
T3T1 Safe 5 test(screens) main(screens) test(screens) main(screens) test(screens) main(screens)
All main(screens)

@Hannsek
Copy link
Contributor

Hannsek commented Feb 17, 2025

Translations for these screens:

en-EN
The current wallet isn’t the SOL staking withdraw authority.
Withdraw authority address
Confirm message without review.
Claim SOL to address outside your current wallet
cs-CZ

  • Tato pěněženka nemůže být použita pro výběr z tohoto stakingu.
  • Adresa autority oprávněné k výběru
  • Potvrdit zprávu bez kontroly.
  • Nárokovat SOL na adresu mimo tuto peněženku
    fr-FR
  • Ce portefeuille ne pourra pas être utilisé pour retirer de ce staking.
  • Adresse de l’autorité de retrait
  • Confirmer le message sans le vérifier.
  • Retirer du SOL à une adresse en dehors de ce portefeuille
    es-ES
  • El monedero actual no podrá retirar de este staking.
  • Dirección de la autoridad de retiro.
  • Confirmar mensaje sin revisión.
  • Retira SOL a una dirección fuera de tu billetera actual.
    pt-BR
  • A carteira atual não é a autoridade de saque do staking de SOL.
  • Endereço da autoridade de saque
  • Confirmar mensagem sem revisão.
  • Reivindicar SOL para um endereço fora da sua carteira atual.
    de-DE
  • Diese Wallet hat keine SOL-Staking Auszahlungsberechtigung.
  • Auszahlungsautoritätsadresse
  • Nachricht unüberprüft bestätigen.
  • SOL an externe Adresse erhalten.

@romanz
Copy link
Contributor Author

romanz commented Feb 18, 2025

Translations for these screens:

Thanks @Hannsek! I have two questions:

  1. IIUC, there are more strings that are being used in the new layouts (see below) - should they also be translated?
diff --git a/core/translations/en.json b/core/translations/en.json
index 809fbde03..7dfe70a1c 100644
--- a/core/translations/en.json
+++ b/core/translations/en.json
@@ -772,6 +772,11 @@
     "sign_message__verify_address": "Verify address",
     "solana__account_index": "Account index",
     "solana__associated_token_account": "Associated token account",
+    "solana__base_fee": "Base fee",
+    "solana__cancel_and_exit": "Cancel & exit",
+    "solana__claim_question": "Claim SOL from stake account?",
+    "solana__claim": "Claim",
+    "solana__claim_recipient_warning": "Claiming SOL to address outside your current wallet.",
     "solana__confirm_multisig": "Confirm multisig",
     "solana__expected_fee": "Expected fee",
     "solana__instruction_accounts_template": "Instruction contains {0} accounts and its data is {1} bytes long.",
@@ -780,9 +785,17 @@
     "solana__is_provided_via_lookup_table_template": "{0} is provided via a lookup table.",
     "solana__lookup_table_address": "Lookup table address",
     "solana__multiple_signers": "Multiple signers",
+    "solana__priority_fee": "Priority fee",
+    "solana__stake_account": "Stake account",
+    "solana__stake_question": "Stake SOL on stake account?",
+    "solana__stake": "Stake",
+    "solana__stake_withdrawal_warning": "The current wallet isn't the SOL staking withdraw authority.",
     "solana__token_address": "Token address",
     "solana__transaction_contains_unknown_instructions": "Transaction contains unknown instructions.",
     "solana__transaction_requires_x_signers_template": "Transaction requires {0} signers which increases the fee.",
+    "solana__unstake_question": "Unstake SOL from stake account?",
+    "solana__unstake": "Unstake",
+    "solana__vote_account": "Vote account",
     "stellar__account_merge": "Account Merge",
     "stellar__account_thresholds": "Account Thresholds",
     "stellar__add_signer": "Add Signer",
  1. I am not sure where Confirm message without review. string should be used...

@Hannsek
Copy link
Contributor

Hannsek commented Feb 18, 2025

Yes, all strings should be translated. We should already have the translations of those strings somewhere in the repo.

@Hannsek
Copy link
Contributor

Hannsek commented Feb 18, 2025

"Confirm message without review" is not from Solana staking flow. This shouldn't be here, my fault.

@romanz
Copy link
Contributor Author

romanz commented Feb 18, 2025

Thanks!

@romanz
Copy link
Contributor Author

romanz commented Feb 18, 2025

The following screencasts are generated using the following test commands (derived from #4646) using ba0eb61:

STAKE=0100020a00d1699dcb1811b50bb0055f13044463128242e37a463b52f6c97a1f6eef88ad8c72b471e11674bdcd1e5f85421be42097d5d9c8642172ab73ccf6ff003a43f3c80f8b50107e9f3e3c16a661b8c806df454a6deb293d5e8730a9d28f2f4998c606a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b21000000000306466fe5211732ffecadba72c39be7bc8ce5bbc5f7126b2c439b3a40000000000000000000000000000000000000000000000000000000000000000000000006a7d517192c5c51218cc94c3d4af17f58daee089ba1fd44e3dbd98a0000000006a7d517193584d0feed9bb3431d13206be544281b57b8566cc5375ff400000006a1d817a502050b680791e6ce6db88e1e5b7150f61fc6790a4eb4d1000000001aea57c9906a7cad656ff61b3893abda63f4b6b210c939855e7ab6e54049213d0405000903401f00000000000006020001620300000000d1699dcb1811b50bb0055f13044463128242e37a463b52f6c97a1f6eef88ad0600000000000000736565643a31002d3101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003020107740000000000d1699dcb1811b50bb0055f13044463128242e37a463b52f6c97a1f6eef88ad00d1699dcb1811b50bb0055f13044463128242e37a463b52f6c97a1f6eef88ad00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003060102040809000402000000
UNSTAKE=0100020500d1699dcb1811b50bb0055f13044463128242e37a463b52f6c97a1f6eef88ad8c72b471e11674bdcd1e5f85421be42097d5d9c8642172ab73ccf6ff003a43f306a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b21000000000306466fe5211732ffecadba72c39be7bc8ce5bbc5f7126b2c439b3a400000001aea57c9906a7cad656ff61b3893abda63f4b6b210c939855e7ab6e54049213d0204000903401f00000000000002030103000405000000
CLAIM=0100030500d1699dcb1811b50bb0055f13044463128242e37a463b52f6c97a1f6eef88ad8c72b471e11674bdcd1e5f85421be42097d5d9c8642172ab73ccf6ff003a43f306a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d51718c774c928566398691d5eb68b5eb8a39b4b6d5c73555b21000000000306466fe5211732ffecadba72c39be7bc8ce5bbc5f7126b2c439b3a400000001aea57c9906a7cad656ff61b3893abda63f4b6b210c939855e7ab6e54049213d0204000903401f00000000000002060100030400000c0400000040420f0000000000

trezorctl device load -m 'all all all all all all all all all all all all'
trezorctl solana sign-tx -n 'm/44h/501h/0h/0h' $STAKE
trezorctl solana sign-tx -n 'm/44h/501h/0h/0h' $UNSTAKE
trezorctl solana sign-tx -n 'm/44h/501h/0h/0h' $CLAIM
Screencast.from.2025-02-18.19-08-39.webm
Screencast.from.2025-02-18.19-21-04.webm
Screencast.from.2025-02-18.19-23-21.webm

@Hannsek WDYT?

@romanz romanz changed the title feat(core): add Solana staking confirmation dialog feat(core): add Solana staking confirmation dialog for TS5 Feb 18, 2025
@romanz romanz force-pushed the romanz/sol-stake branch 2 times, most recently from e288975 to c3821fc Compare February 19, 2025 19:58
@romanz romanz changed the title feat(core): add Solana staking confirmation dialog for TS5 feat(core): add Solana staking confirmation dialog Feb 19, 2025
@romanz romanz force-pushed the romanz/sol-stake branch 2 times, most recently from 4f84439 to 6d205a4 Compare February 20, 2025 19:39
@romanz romanz added the translations Put this label on a PR to run tests in all languages label Feb 20, 2025
@bieleluk bieleluk self-requested a review February 21, 2025 07:56
@romanz romanz marked this pull request as ready for review February 21, 2025 07:58
@romanz romanz requested a review from matejcik as a code owner February 21, 2025 07:58
@romanz romanz requested a review from prusnak as a code owner February 21, 2025 07:58
@romanz romanz removed the request for review from prusnak February 21, 2025 12:34
@romanz romanz force-pushed the romanz/sol-stake branch 2 times, most recently from 4f82374 to 846ccf1 Compare February 24, 2025 08:14
@romanz
Copy link
Contributor Author

romanz commented Feb 24, 2025

Rebased and force-pushed to squash the fixup commits.

@romanz
Copy link
Contributor Author

romanz commented Feb 24, 2025

Added translations (2573758) and a small test-related fixup (d67d071).

@romanz
Copy link
Contributor Author

romanz commented Feb 25, 2025

Pushed more fixes:

@bieleluk
Copy link
Contributor

bieleluk commented Feb 25, 2025

I observed some some deviations from the Figma deign.

  • Delizia:
    • In the staking flow, the Provider has a different font.
    • In all flows, the account info menu item has title Send from instead of Account info
    • In all flows, the confirm amount menu uses extra tap to cancel screen
  • Caesar:
    • In the claim flow, there should be a title Claim and a question below. The question is directly in the title.
  • Bolt:
    • In the first screen of the stake flow, the fonts Stake SOL and Provider are swapped.
    • In all flows in Blockhash and Stake account menu items, there should be a bigger padding between the description and the value

They do not break the functionality so it is not critical to fix them all.
If some of them are easy to fix, then let's do it.

@bieleluk bieleluk closed this Feb 25, 2025
@romanz romanz reopened this Feb 25, 2025
Move fee calculation into `Transaction` class.

Also, replace floating-point division by integer division in fee calculation.

[no changelog]
Otherwise, we may get an additional empty confirmation screen.

[no changelog]
It will allow confirming the blockhash for Solana transactions.

Also, simplify arguments passing into `new_confirm_output()`.

[no changelog]
It will allow confirming the vote account for Solana staking.

[no changelog]
@bieleluk bieleluk self-requested a review February 25, 2025 10:15
Copy link
Contributor

@bieleluk bieleluk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM code-wise

@romanz
Copy link
Contributor Author

romanz commented Feb 25, 2025

Squashed the fixup commits - and opened #4672 for fixing the issues in #4639 (comment).

@romanz romanz merged commit d2165c3 into main Feb 25, 2025
141 checks passed
@romanz romanz deleted the romanz/sol-stake branch February 25, 2025 10:55
@obrusvit obrusvit added this to the Release 25.03 milestone Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
altcoin Any non-Bitcoin coins core Trezor Core firmware. Runs on Trezor Model T and T2B1. translations Put this label on a PR to run tests in all languages
Projects
Status: 🤝 Needs QA
Development

Successfully merging this pull request may close these issues.

Sol Stake: Align FW and Suite when signing
4 participants