Skip to content

Commit ef0839b

Browse files
Merge pull request #696 from LedgerHQ/feat/apa/blind_signing_non_zero_amount
Show non-zero amounts in blind-signing flow
2 parents 61eef99 + 7632baa commit ef0839b

File tree

175 files changed

+49
-33
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+49
-33
lines changed

src/shared_context.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ typedef struct txStringProperties_s {
131131
char maxFee[50];
132132
char nonce[8]; // 10M tx per account ought to be enough for everybody
133133
char network_name[NETWORK_STRING_MAX_SIZE + 1];
134+
char tx_hash[2 + (INT256_LENGTH * 2) + 1];
134135
} txStringProperties_t;
135136

136137
#ifdef TARGET_NANOS

src_bagl/ui_flow_signTx.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ UX_STEP_NOCB(ux_approval_tx_hash_step,
120120
#else
121121
.title = "Transaction hash",
122122
#endif
123-
.text = strings.common.fullAmount
123+
.text = strings.common.tx_hash
124124
});
125125
UX_STEP_NOCB(
126126
ux_approval_amount_step,
@@ -249,8 +249,8 @@ void ux_approve_tx(bool fromPlugin) {
249249
} else {
250250
if (tmpContent.txContent.dataPresent) {
251251
#pragma GCC diagnostic ignored "-Wformat"
252-
snprintf(strings.common.fullAmount,
253-
sizeof(strings.common.fullAmount),
252+
snprintf(strings.common.tx_hash,
253+
sizeof(strings.common.tx_hash),
254254
"0x%.*h",
255255
sizeof(tmpCtx.transactionContext.hash),
256256
tmpCtx.transactionContext.hash);
@@ -261,7 +261,8 @@ void ux_approve_tx(bool fromPlugin) {
261261
if (strings.common.fromAddress[0] != 0) {
262262
ux_approval_tx_flow[step++] = &ux_approval_from_step;
263263
}
264-
if (!tmpContent.txContent.dataPresent) {
264+
if (!tmpContent.txContent.dataPresent ||
265+
!allzeroes(tmpContent.txContent.value.value, tmpContent.txContent.value.length)) {
265266
ux_approval_tx_flow[step++] = &ux_approval_amount_step;
266267
}
267268
#ifdef HAVE_TRUSTED_NAME

src_nbgl/ui_approve_tx.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,14 @@ static uint8_t setTagValuePairs(void) {
122122
} else {
123123
if (tmpContent.txContent.dataPresent) {
124124
#pragma GCC diagnostic ignored "-Wformat"
125-
snprintf(strings.common.fullAmount,
126-
sizeof(strings.common.fullAmount),
125+
snprintf(strings.common.tx_hash,
126+
sizeof(strings.common.tx_hash),
127127
"0x%.*h",
128128
sizeof(tmpCtx.transactionContext.hash),
129129
tmpCtx.transactionContext.hash);
130130
#pragma GCC diagnostic warning "-Wformat"
131131
pairs[nbPairs].item = "Transaction hash";
132-
pairs[nbPairs].value = strings.common.fullAmount;
132+
pairs[nbPairs].value = strings.common.tx_hash;
133133
nbPairs++;
134134
}
135135

@@ -139,7 +139,8 @@ static uint8_t setTagValuePairs(void) {
139139
nbPairs++;
140140
}
141141

142-
if (!tmpContent.txContent.dataPresent) {
142+
if (!tmpContent.txContent.dataPresent ||
143+
!allzeroes(tmpContent.txContent.value.value, tmpContent.txContent.value.length)) {
143144
pairs[nbPairs].item = "Amount";
144145
pairs[nbPairs].value = strings.common.fullAmount;
145146
nbPairs++;
File renamed without changes.
File renamed without changes.
23 KB
File renamed without changes.
File renamed without changes.
File renamed without changes.
18.1 KB

0 commit comments

Comments
 (0)