Skip to content

Commit

Permalink
Merge remote-tracking branch 'ata/address_case'
Browse files Browse the repository at this point in the history
  • Loading branch information
asi345 committed Aug 14, 2024
2 parents 73ec580 + cf20bf5 commit bc9c8f4
Show file tree
Hide file tree
Showing 11 changed files with 187 additions and 55 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ customers cannot upgrade their bootloader, its changes are recorded separately.
- Bitcoin: allow multisig accounts at arbitrary keypaths
- Bitcoin: allow spendung UTXOs at very high BIP-44 address indices
- Ethereum: allow signing EIP-712 messages containing multi-line strings
- Ethereum: display the addresses on device in the same case as the user input
- Allow exiting the screen asking to insert the microSD card
- HWW: add initialized status byte to _api_info response

Expand Down
8 changes: 8 additions & 0 deletions messages/eth.proto
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ enum ETHCoin {
RinkebyETH = 2;
}

enum ETHAddressCase {
ETH_ADDRESS_CASE_MIXED = 0;
ETH_ADDRESS_CASE_UPPER = 1;
ETH_ADDRESS_CASE_LOWER = 2;
}

message ETHPubRequest {
repeated uint32 keypath = 1;
// Deprecated: use chain_id instead.
Expand Down Expand Up @@ -56,6 +62,7 @@ message ETHSignRequest {
AntiKleptoHostNonceCommitment host_nonce_commitment = 9;
// If non-zero, `coin` is ignored and `chain_id` is used to identify the network.
uint64 chain_id = 10;
ETHAddressCase address_case = 11;
}

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

message ETHSignMessageRequest {
Expand Down
1 change: 1 addition & 0 deletions py/bitbox02/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

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

# 6.3.0
- Allow infering product and version via API call instead of via USB descriptor
Expand Down
10 changes: 9 additions & 1 deletion py/bitbox02/bitbox02/bitbox02/bitbox02.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,13 @@ def eth_pub(
)
return self._eth_msg_query(request, expected_response="pub").pub.pub

def eth_sign(self, transaction: bytes, keypath: Sequence[int], chain_id: int = 1) -> bytes:
def eth_sign(
self,
transaction: bytes,
keypath: Sequence[int],
address_case: eth.ETHAddressCase.ValueType = eth.ETH_ADDRESS_CASE_MIXED,
chain_id: int = 1,
) -> bytes:
"""
transaction should be given as a full rlp encoded eth transaction.
"""
Expand Down Expand Up @@ -853,6 +859,7 @@ def handle_antiklepto(request: eth.ETHRequest) -> bytes:
recipient=recipient,
value=value,
data=data,
address_case=address_case,
)
)
return handle_antiklepto(request)
Expand All @@ -871,6 +878,7 @@ def handle_antiklepto(request: eth.ETHRequest) -> bytes:
recipient=recipient,
value=value,
data=data,
address_case=address_case,
)
)

Expand Down
62 changes: 32 additions & 30 deletions py/bitbox02/bitbox02/communication/generated/eth_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bc9c8f4

Please sign in to comment.