Skip to content

Commit 055bda6

Browse files
committed
eth tx verification: use same address case as in input
Previously, no matter the format of the adress given by user to the client, BitBox02 was showing this address in mixed case in the verification step(see 'mixed-case checksum address encoding in EIP-55'). Even though this is acceptable, we thought that this could create confusion among users when they see that the address they inputted is not the same on the device(only difference is in the case though). To avoid any questions, this commit achieves showing the address in the same case as in user input on the device. Valid cases are : all upper, all lower or mixed(EIP-55). The client libraries will also implement a mechanism to categorize the case of the input address to pass to BitBox02 firmware. Signed-off-by: asi345 <[email protected]>
1 parent cb481ba commit 055bda6

File tree

10 files changed

+179
-55
lines changed

10 files changed

+179
-55
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ customers cannot upgrade their bootloader, its changes are recorded separately.
1414
- Bitcoin: allow multisig accounts at arbitrary keypaths
1515
- Bitcoin: allow spendung UTXOs at very high BIP-44 address indices
1616
- Ethereum: allow signing EIP-712 messages containing multi-line strings
17+
- Ethereum: display the addresses on device in the same case as the user input
1718
- Allow exiting the screen asking to insert the microSD card
1819
- HWW: add initialized status byte to _api_info response
1920

messages/eth.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ enum ETHCoin {
2727
RinkebyETH = 2;
2828
}
2929

30+
enum ETHAddressCase {
31+
ETH_ADDRESS_CASE_MIXED = 0;
32+
ETH_ADDRESS_CASE_UPPER = 1;
33+
ETH_ADDRESS_CASE_LOWER = 2;
34+
}
35+
3036
message ETHPubRequest {
3137
repeated uint32 keypath = 1;
3238
// Deprecated: use chain_id instead.
@@ -56,6 +62,7 @@ message ETHSignRequest {
5662
AntiKleptoHostNonceCommitment host_nonce_commitment = 9;
5763
// If non-zero, `coin` is ignored and `chain_id` is used to identify the network.
5864
uint64 chain_id = 10;
65+
ETHAddressCase address_case = 11;
5966
}
6067

6168
// TX payload for an EIP-1559 (type 2) transaction: https://eips.ethereum.org/EIPS/eip-1559
@@ -70,6 +77,7 @@ message ETHSignEIP1559Request {
7077
bytes value = 8; // smallest big endian serialization, max. 32 bytes
7178
bytes data = 9;
7279
AntiKleptoHostNonceCommitment host_nonce_commitment = 10;
80+
ETHAddressCase address_case = 11;
7381
}
7482

7583
message ETHSignMessageRequest {

py/bitbox02/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
# 7.0.0
66
- get_info: add optional device initialized boolean to returned tuple
7+
- eth_sign: add address_case field, which should be initialized by the client
78

89
# 6.3.0
910
- Allow infering product and version via API call instead of via USB descriptor

py/bitbox02/bitbox02/bitbox02/bitbox02.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,13 @@ def eth_pub(
788788
)
789789
return self._eth_msg_query(request, expected_response="pub").pub.pub
790790

791-
def eth_sign(self, transaction: bytes, keypath: Sequence[int], chain_id: int = 1) -> bytes:
791+
def eth_sign(
792+
self,
793+
transaction: bytes,
794+
keypath: Sequence[int],
795+
address_case: eth.ETHAddressCase.ValueType = eth.ETH_ADDRESS_CASE_MIXED,
796+
chain_id: int = 1,
797+
) -> bytes:
792798
"""
793799
transaction should be given as a full rlp encoded eth transaction.
794800
"""
@@ -853,6 +859,7 @@ def handle_antiklepto(request: eth.ETHRequest) -> bytes:
853859
recipient=recipient,
854860
value=value,
855861
data=data,
862+
address_case=address_case,
856863
)
857864
)
858865
return handle_antiklepto(request)
@@ -871,6 +878,7 @@ def handle_antiklepto(request: eth.ETHRequest) -> bytes:
871878
recipient=recipient,
872879
value=value,
873880
data=data,
881+
address_case=address_case,
874882
)
875883
)
876884

py/bitbox02/bitbox02/communication/generated/eth_pb2.py

Lines changed: 32 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)