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

AOPP support #1903

Merged
merged 11 commits into from Nov 10, 2021
Merged

AOPP support #1903

merged 11 commits into from Nov 10, 2021

Conversation

andrewkozlik
Copy link
Contributor

Implements https://github.com/trezor/trezor-firmware/issues/1586.

  • Adds a new bool parameter to SignMessage in T1 and TT called no_script_type, which is false by default and when set to true SignMessage does not include script type information in the recovery byte of the signature, same as in Bitcoin Core.
  • Implements pagination in SignMessage on T1 so that up to 1024 characters can be displayed.
  • Adds a screen showing the address being used for signing in SignMessage and EthereumSignMessage on T1 and TT.
  • Improves message signing UI to better distinguish the externally provided text from internally generated messages by:
    • Adding a "Confirm message" subheader to SignMessage and VerifyMessage.
    • Unifying font for SignMessage and VerifyMessage to monospaced. (SignMessage used to show the message in normal font and VerifyMessage in monospaced.)

I didn't tweak the message color as originally proposed in https://github.com/trezor/trezor-firmware/issues/1586#issuecomment-848653922, because after discussion with @matejzak we concluded that users probably wouldn't understand the color distinction. Nevertheless, I already added a parameter to paginate_text() so that changing the text color will be a one-line change if we choose to do this in the future.

@@ -152,6 +152,7 @@ message SignMessage {
required bytes message = 2; // message to be signed
optional string coin_name = 3 [default='Bitcoin']; // coin to use for signing
optional InputScriptType script_type = 4 [default=SPENDADDRESS]; // used to distinguish between various address formats (non-segwit, segwit, etc.)
optional bool no_script_type = 5 [default=false]; // don't include script type information in the recovery byte of the signature, same as in Bitcoin Core
Copy link
Member

Choose a reason for hiding this comment

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

Isn't [default=false] redundant here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed ed627c4.

Copy link
Member

@mmilata mmilata left a comment

Choose a reason for hiding this comment

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

Overall this looks very good, however there seems to be a problem with the legacy pagination because it shows garbage at the end of TestMsgVerifymessage::test_message_long:

verylong

The PR changes some ButtonRequests from ProtectCall to Other, we might want to notify Suite of this change. TT currently always uses Other.

UI diff ack.

core/src/trezor/ui/components/tt/scroll.py Outdated Show resolved Hide resolved
@andrewkozlik
Copy link
Contributor Author

there seems to be a problem with the legacy pagination because it shows garbage at the end of TestMsgVerifymessage::test_message_long:

There was a bug in split_message(), which didn't correctly handle strings that are not null-terminated. Fixed e7ed41b.

The PR changes some ButtonRequests from ProtectCall to Other, we might want to notify Suite of this change. TT currently always uses Other.

Yes, I wanted to unify the T1/TT behavior. Do we have some agreed-upon way of communicating such changes? Just posting it on slack?

Copy link
Member

@mmilata mmilata left a comment

Choose a reason for hiding this comment

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

LGTM!

@andrewkozlik andrewkozlik merged commit 0737dee into master Nov 10, 2021
@andrewkozlik andrewkozlik deleted the andrewkozlik/aopp branch November 10, 2021 16:35
br_type = "sign_message"

text = Text(header, new_lines=False)
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be using confirm_address() layout

Copy link
Contributor

Choose a reason for hiding this comment

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

...i wanted to make an issue to fix consistency of this, but it's probably not worth it while we expect to move to Rust UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants