Skip to content

Commit 20ca1c1

Browse files
committed
fix(legacy): misc fix
1 parent 7031656 commit 20ca1c1

25 files changed

+108
-70
lines changed

common/protob/messages-tron.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ message TronSignTx {
9898
optional uint64 balance = 3;
9999
optional string receiver_address = 4;
100100
optional bool lock = 5;
101+
optional uint64 lock_period = 6;
101102
}
102103
message TronUnDelegateResourceContract {
103104
optional TronResourceCode resource = 2;

legacy/firmware/cosmos_networks.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ const CosmosNetworkType cosmos_networks[COSMOS_NETWORK_COUNT] = {
66
{"osmosis-1", "osmo", "Osmosis", "OSMO", "uosmo", 6},
77
{"secret-4", "secret", "Secret Network", "SCRT", "uscrt", 6},
88
{"akashnet-2", "akash", "Akash", "AKT", "uakt", 6},
9-
{"crypto-org-chain-mainnet-1", "cro", "Crypto.org", "CRO", "basecro", 8},
9+
{"crypto-org-chain-mainnet-1", "cro", "Cronos POS Chain", "CRO", "basecro",
10+
8},
1011
{"iov-mainnet-ibc", "star", "Starname", "IOV", "uiov", 6},
1112
{"sifchain-1", "sif", "Sifchain", "ROWAN", "rowan", 18},
1213
{"shentu-2.2", "certik", "Shentu", "CTK", "uctk", 6},
@@ -32,6 +33,7 @@ const CosmosNetworkType cosmos_networks[COSMOS_NETWORK_COUNT] = {
3233
{"quicksilver-1", "quick", "Quicksilver", "QCK", "uqck", 6},
3334
{"fetchhub-4", "fetch", "Fetch.ai", "FET", "afet", 18},
3435
{"celestia", "celestia", "Celestia", "TIA", "utia", 6},
36+
{"bbn-1", "bbn", "BABYLON", "BABY", "ubbn", 6},
3537
};
3638

3739
const CosmosNetworkType *cosmosnetworkByChainId(const char *chain_id) {

legacy/firmware/cosmos_networks.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include <stdint.h>
55

6-
#define COSMOS_NETWORK_COUNT 30
6+
#define COSMOS_NETWORK_COUNT 31
77

88
typedef struct {
99
const char *const chain_id;

legacy/firmware/ethereum.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static bool eip1559;
5454
struct SHA3_CTX keccak_ctx = {0};
5555

5656
static uint32_t signing_access_list_count;
57-
static EthereumAccessList signing_access_list[8];
57+
static EthereumAccessList signing_access_list[16];
5858
_Static_assert(sizeof(signing_access_list) ==
5959
sizeof(((EthereumSignTxEIP1559 *)NULL)->access_list),
6060
"access_list buffer size mismatch");

legacy/firmware/ethereum_onekey.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static bool eip1559;
5555
static struct SHA3_CTX keccak_ctx = {0};
5656

5757
static uint32_t signing_access_list_count;
58-
static EthereumAccessListOneKey signing_access_list[8];
58+
static EthereumAccessListOneKey signing_access_list[16];
5959
_Static_assert(sizeof(signing_access_list) ==
6060
sizeof(((EthereumSignTxEIP1559OneKey *)NULL)->access_list),
6161
"access_list buffer size mismatch");

legacy/firmware/language.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,8 @@ const char *const languages[][2] = {
448448
{"Format:", "格式:"},
449449
// layout2.c
450450
{"From", "发送方"},
451+
// solana.c
452+
{"From (Token Account)", "发送方 (代币账户)"},
451453
// layout2.c
452454
{"GPG sign for:", ""},
453455
{"Gas Fee Cap", "燃料单价上限"},
@@ -798,6 +800,8 @@ const char *const languages[][2] = {
798800
{"Tip Amount", "小费金额"},
799801
{"Tipper", "小费支付方"},
800802
{"Title", "标题"},
803+
// solana.c
804+
{"To (Token Account)", "接收方 (代币账户)"},
801805
// signing.c fsm_msg_coin.h
802806
// ada.c
803807
{"To Pool:", "目标质押池:"},

legacy/firmware/pinmatrix.c

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include "pinmatrix.h"
2626
#include "rng.h"
2727

28-
static char pinmatrix_perm[10] = "XXXXXXXXX";
28+
static char pinmatrix_perm[11] = "XXXXXXXXX";
2929

3030
void pinmatrix_draw(const char *text) {
3131
const BITMAP *bmp_digits[10] = {
@@ -37,21 +37,23 @@ void pinmatrix_draw(const char *text) {
3737
if (text) {
3838
oledDrawStringCenterAdapter(OLED_WIDTH / 2, 0, text, FONT_STANDARD);
3939
}
40-
const int w = bmp_digit0.width, h = bmp_digit0.height, pad = 2;
40+
const int w = bmp_digit0.width, h = bmp_digit0.height, pad = 1;
41+
int k = 0;
4142
for (int i = 0; i < 3; i++) {
4243
for (int j = 0; j < 3; j++) {
4344
// use (2 - j) instead of j to achieve 789456123 layout
44-
int k = pinmatrix_perm[i + (2 - j) * 3] - '0';
45+
k = pinmatrix_perm[i + (2 - j) * 3] - '0';
4546
oledDrawBitmap((OLED_WIDTH - 3 * w - 2 * pad) / 2 + i * (w + pad),
46-
OLED_HEIGHT - 3 * h - 2 * pad + j * (h + pad),
47+
OLED_HEIGHT - 4 * h - 3 * pad + j * (h + pad),
4748
bmp_digits[k]);
4849
}
4950
}
50-
for (int i = 0; i < 3; i++) {
51-
// 36 is the maximum pixels used for a pin matrix pixel row
52-
// but we use 56 pixels to add some extra
53-
oledSCAInside(12 + i * (h + pad), 12 + i * (h + pad) + h - 1, 56, 38,
54-
OLED_WIDTH - 38);
51+
k = pinmatrix_perm[9] - '0';
52+
oledBox(27, 52, 101, 64, true);
53+
oledDrawBitmap(52, 52, bmp_digits[k]);
54+
for (int i = 0; i < 4; i++) {
55+
oledSCAInside(13 + i * (h + pad), 13 + i * (h + pad) + h - 1, 76, 27,
56+
OLED_WIDTH - 27);
5557
}
5658
oledRefresh();
5759
}
@@ -60,8 +62,9 @@ void pinmatrix_start(const char *text) {
6062
for (int i = 0; i < 9; i++) {
6163
pinmatrix_perm[i] = '1' + i;
6264
}
63-
pinmatrix_perm[9] = 0;
64-
random_permute(pinmatrix_perm, 9);
65+
pinmatrix_perm[9] = '0';
66+
pinmatrix_perm[10] = 0;
67+
random_permute(pinmatrix_perm, 10);
6568
pinmatrix_draw(text);
6669
}
6770

@@ -70,7 +73,8 @@ secbool pinmatrix_done(bool clear, char *pin) {
7073
secbool ret = sectrue;
7174
while (pin && pin[i]) {
7275
k = pin[i] - '1';
73-
if (k >= 0 && k <= 8) {
76+
if (k == -1) k = 9;
77+
if (k >= 0 && k <= 9) {
7478
pin[i] = pinmatrix_perm[k];
7579
} else {
7680
pin[i] = 'X';

legacy/firmware/protect.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -882,9 +882,7 @@ const char *protectInputPin(const char *text, uint8_t min_pin_len,
882882
if (counter >= DEFAULT_PIN_LEN) {
883883
index = 10;
884884
} else {
885-
do {
886-
index = random_uniform(10);
887-
} while (index == 0);
885+
index = random_uniform(10);
888886
}
889887
}
890888

@@ -894,24 +892,24 @@ const char *protectInputPin(const char *text, uint8_t min_pin_len,
894892
if (isLongPress(KEY_UP_OR_DOWN) && getLongPressStatus()) {
895893
if (isLongPress(KEY_UP)) { // up
896894
if (!d) { // default direction
897-
if (index > 1)
895+
if (index > 0)
898896
index--;
899897
else
900898
index = max_index;
901899
} else {
902900
if (index < max_index)
903901
index++;
904902
else
905-
index = 1;
903+
index = 0;
906904
}
907905
} else if (isLongPress(KEY_DOWN)) { // down
908906
if (!d) {
909907
if (index < max_index)
910908
index++;
911909
else
912-
index = 1;
910+
index = 0;
913911
} else {
914-
if (index > 1)
912+
if (index > 0)
915913
index--;
916914
else
917915
index = max_index;
@@ -930,7 +928,7 @@ const char *protectInputPin(const char *text, uint8_t min_pin_len,
930928
}
931929
switch (key) {
932930
case KEY_UP:
933-
if (index > 1)
931+
if (index > 0)
934932
index--;
935933
else
936934
index = max_index;
@@ -939,7 +937,7 @@ const char *protectInputPin(const char *text, uint8_t min_pin_len,
939937
if (index < max_index)
940938
index++;
941939
else
942-
index = 1;
940+
index = 0;
943941
goto refresh_menu;
944942
case KEY_CONFIRM:
945943
(void)pin;

legacy/firmware/protob/messages-ethereum-onekey.options

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ EthereumSignTxEIP1559OneKey.gas_limit max_size:32
1414
EthereumSignTxEIP1559OneKey.to max_size:43
1515
EthereumSignTxEIP1559OneKey.value max_size:32
1616
EthereumSignTxEIP1559OneKey.data_initial_chunk max_size:1024
17-
EthereumSignTxEIP1559OneKey.access_list max_count:8
17+
EthereumSignTxEIP1559OneKey.access_list max_count:16
1818

1919
EthereumAccessListOneKey.address max_size:43
2020
EthereumAccessListOneKey.storage_keys max_count:8 max_size:32

legacy/firmware/protob/messages-ethereum.options

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ EthereumSignTxEIP1559.gas_limit max_size:32
1414
EthereumSignTxEIP1559.to max_size:43
1515
EthereumSignTxEIP1559.value max_size:32
1616
EthereumSignTxEIP1559.data_initial_chunk max_size:1024
17-
EthereumSignTxEIP1559.access_list max_count:8
17+
EthereumSignTxEIP1559.access_list max_count:16
1818

1919
EthereumAccessList.address max_size:43
2020
EthereumAccessList.storage_keys max_count:8 max_size:32

0 commit comments

Comments
 (0)