Skip to content

Commit fa39dd8

Browse files
authored
Chain ID must not be 0 or 1 (#207)
* Chain ID must not be 0 or 1 * bump version
1 parent e5f634d commit fa39dd8

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

evm/parser_impl_evm.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ eth_tx_t eth_tx_obj;
4242

4343
#define ETHEREUM_RECOVERY_OFFSET 27
4444
#define EIP155_V_BASE 35
45+
#define INVALID_CHAIN_ID_0 0
46+
#define INVALID_CHAIN_ID_1 1
4547

4648
static parser_error_t readChainID(parser_context_t *ctx, rlp_t *chainId) {
4749
if (ctx == NULL || chainId == NULL) {
@@ -59,6 +61,12 @@ static parser_error_t readChainID(parser_context_t *ctx, rlp_t *chainId) {
5961
return parser_unexpected_error;
6062
}
6163

64+
// According to Ledger's specifications, chain ID must not be 0 or 1
65+
// when using an Ethereum derivation path
66+
if (tmpChainId == INVALID_CHAIN_ID_0 || tmpChainId == INVALID_CHAIN_ID_1) {
67+
return parser_invalid_chain_id;
68+
}
69+
6270
if (supported_networks_evm_len == 0) {
6371
return parser_invalid_chain_id;
6472
}

include/zxversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717

1818
#define ZXLIB_MAJOR 36
1919
#define ZXLIB_MINOR 0
20-
#define ZXLIB_PATCH 4
20+
#define ZXLIB_PATCH 5

0 commit comments

Comments
 (0)