Skip to content

Commit

Permalink
Merge pull request #48 from cosmos/dev
Browse files Browse the repository at this point in the history
allow longer message type names
  • Loading branch information
jleni authored Feb 20, 2022
2 parents 7d5fc3a + 4901f68 commit 0e73561
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app/Makefile.version
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This is the `transaction_version` field of `Runtime`
APPVERSION_M=2
# This is the `spec_version` field of `Runtime`
APPVERSION_N=33
APPVERSION_N=34
# This is the patch version of this release
APPVERSION_P=0
6 changes: 6 additions & 0 deletions app/src/coin.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ typedef enum {
#define COIN_DENOM_MAXSIZE 50
#define COIN_AMOUNT_MAXSIZE 50

#define COIN_MAX_CHAINID_LEN 20
#define INDEXING_TMP_KEYSIZE 70
#define INDEXING_TMP_VALUESIZE 70
#define INDEXING_GROUPING_REF_TYPE_SIZE 70
#define INDEXING_GROUPING_REF_FROM_SIZE 70

#define MENU_MAIN_APP_LINE2_SECRET "?"
#define COIN_SECRET_REQUIRED_CLICKS 0

Expand Down
7 changes: 1 addition & 6 deletions app/src/tx_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ __Z_INLINE parser_error_t calculate_is_default_chainid() {

// get chain_id
char outKey[2];
char outVal[20];
char outVal[COIN_MAX_CHAINID_LEN];
uint8_t pageCount;
INIT_QUERY_CONTEXT(outKey, sizeof(outKey),
outVal, sizeof(outVal),
Expand Down Expand Up @@ -140,11 +140,6 @@ __Z_INLINE bool address_matches_own(char *addr) {
return true;
}

#define INDEXING_TMP_KEYSIZE 70
#define INDEXING_TMP_VALUESIZE 70
#define INDEXING_GROUPING_REF_TYPE_SIZE 70
#define INDEXING_GROUPING_REF_FROM_SIZE 70

parser_error_t tx_indexRootFields() {
if (parser_tx_obj.flags.cache_valid) {
return parser_ok;
Expand Down
19 changes: 10 additions & 9 deletions app/src/tx_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,15 @@ __Z_INLINE void strcat_chunk_s(char *dst, uint16_t dst_max, const char *src_chun
///////////////////////////

static const key_subst_t value_substitutions[] = {
{"cosmos-sdk/MsgSend", "Send"},
{"cosmos-sdk/MsgDelegate", "Delegate"},
{"cosmos-sdk/MsgUndelegate", "Undelegate"},
{"cosmos-sdk/MsgBeginRedelegate", "Redelegate"},
{"cosmos-sdk/MsgSubmitProposal", "Propose"},
{"cosmos-sdk/MsgDeposit", "Deposit"},
{"cosmos-sdk/MsgVote", "Vote"},
{"cosmos-sdk/MsgWithdrawDelegationReward", "Withdraw Reward"},
{"cosmos-sdk/MsgSend", "Send"},
{"cosmos-sdk/MsgDelegate", "Delegate"},
{"cosmos-sdk/MsgUndelegate", "Undelegate"},
{"cosmos-sdk/MsgBeginRedelegate", "Redelegate"},
{"cosmos-sdk/MsgSubmitProposal", "Propose"},
{"cosmos-sdk/MsgDeposit", "Deposit"},
{"cosmos-sdk/MsgVote", "Vote"},
{"cosmos-sdk/MsgWithdrawDelegationReward", "Withdraw Reward"},
{"cosmos-sdk/MsgWithdrawValidatorCommission", "Withdraw Val. Commission"},
};

parser_error_t tx_getToken(uint16_t token_index,
Expand All @@ -80,7 +81,7 @@ parser_error_t tx_getToken(uint16_t token_index,
// empty strings are considered the first page
*pageCount = 1;
if (inLen > 0) {
for (uint32_t i = 0; i < array_length(value_substitutions); i++) {
for (uint32_t i = 0; i < array_length(value_substitutions); i++) {
const char *substStr = value_substitutions[i].str1;
const size_t substStrLen = strlen(substStr);
if (inLen == substStrLen && !MEMCMP(inValue, substStr, substStrLen)) {
Expand Down
36 changes: 36 additions & 0 deletions tests/testcases/manual.json
Original file line number Diff line number Diff line change
Expand Up @@ -1728,5 +1728,41 @@
"8 | Tipper : cosmosaccaddr1d9h8qatxTIPPER"
],
"expert": true
},
{
"name": "MsgWithdrawValidatorCommission",
"tx": {
"account_number": "6571",
"chain_id": "cosmoshub-4",
"fee": {
"amount": [
{
"amount": "5000",
"denom": "uatom"
}
],
"gas": "200000"
},
"memo": "Zondax.ch",
"msgs": [
{
"type": "cosmos-sdk/MsgWithdrawValidatorCommission",
"value": {
"validator_address": "cosmosvaloper1grgelyng2v6v3t8z87wu3sxgt9m5s03xfytvz7"
}
}
],
"sequence": "1"
},
"parsingErr": "No error",
"validationErr": "No error",
"expected": [
"0 | Type : Withdraw Val. Commission",
"1 | Validator [1/2] : cosmosvaloper1grgelyng2v6v3t8z87wu3sxgt",
"1 | Validator [2/2] : 9m5s03xfytvz7",
"2 | Memo : Zondax.ch",
"3 | Fee : 0.005000 ATOM"
],
"expert": false
}
]
Binary file modified tests_zemu/snapshots/s-mainmenu/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/s-mainmenu/00011.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/x-mainmenu/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/x-mainmenu/00011.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0e73561

Please sign in to comment.