Skip to content

Commit

Permalink
Merge pull request #77 from cosmos/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ftheirs authored Jan 3, 2023
2 parents ee693d1 + f905876 commit 9a78592
Show file tree
Hide file tree
Showing 99 changed files with 312 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app/Makefile.version
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ APPVERSION_M=2
# This is the `spec_version` field of `Runtime`
APPVERSION_N=35
# This is the patch version of this release
APPVERSION_P=0
APPVERSION_P=1
2 changes: 1 addition & 1 deletion app/src/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ zxerr_t crypto_fillAddress(uint8_t *buffer, uint16_t buffer_len, uint16_t *addrR
ripemd160_32(hashed2_pk, hashed1_pk);

char *addr = (char *) (buffer + PK_LEN_SECP256K1);
CHECK_ZXERR(bech32EncodeFromBytes(addr, buffer_len - PK_LEN_SECP256K1, bech32_hrp, hashed2_pk, CX_RIPEMD160_SIZE, 1))
CHECK_ZXERR(bech32EncodeFromBytes(addr, buffer_len - PK_LEN_SECP256K1, bech32_hrp, hashed2_pk, CX_RIPEMD160_SIZE, 1, BECH32_ENCODING_BECH32))

*addrResponseLen = PK_LEN_SECP256K1 + strlen(addr);

Expand Down
8 changes: 4 additions & 4 deletions app/src/tx_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ static const key_subst_t key_substitutions[] = {
{"msgs/value/amount", "Amount"},
{"msgs/value/delegator_address", "Delegator"},
{"msgs/value/validator_address", "Validator"},
{"msgs/value/withdraw_address", "Withdraw Address"},
{"msgs/value/validator_src_address", "Validator Source"},
{"msgs/value/validator_dst_address", "Validator Dest"},
{"msgs/value/description", "Description"},
Expand All @@ -491,9 +492,8 @@ static const key_subst_t key_substitutions[] = {
{"msgs/value/proposal_type", "Proposal"},
{"msgs/value/proposer", "Proposer"},
{"msgs/value/title", "Title"},
{"msgs/value/depositer", "Sender"},
{"msgs/value/depositor", "Sender"},
{"msgs/value/proposal_id", "Proposal ID"},
{"msgs/value/amount", "Amount"},
{"msgs/value/voter", "Description"},
{"msgs/value/option", "Option"},
};
Expand Down Expand Up @@ -543,7 +543,7 @@ parser_error_t tx_display_translation(char *dst, uint16_t dstLen, char *src) {
} else {
*dst++ = '\\';
ASSERT_PTR_BOUNDS(count, dstLen);

uint8_t bytes_to_print = 8;
int32_t swapped = ZX_SWAP(tmp_codepoint);
if (tmp_codepoint > 0xFFFF) {
Expand All @@ -555,7 +555,7 @@ parser_error_t tx_display_translation(char *dst, uint16_t dstLen, char *src) {
bytes_to_print = 4;
swapped = (swapped >> 16) & 0xFFFF;
}

if(dstLen < bytes_to_print) {
return parser_unexpected_value;
}
Expand Down
14 changes: 9 additions & 5 deletions app/src/tx_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ static const key_subst_t value_substitutions[] = {
{"cosmos-sdk/MsgVote", "Vote"},
{"cosmos-sdk/MsgWithdrawDelegationReward", "Withdraw Reward"},
{"cosmos-sdk/MsgWithdrawValidatorCommission", "Withdraw Val. Commission"},
{"cosmos-sdk/MsgSetWithdrawAddress", "Withdraw Set Address"},
{"cosmos-sdk/MsgMultiSend", "Multi Send"},

};

parser_error_t tx_getToken(uint16_t token_index,
Expand All @@ -81,7 +82,6 @@ parser_error_t tx_getToken(uint16_t token_index,

const char *inValue = parser_tx_obj.tx_json.tx + token_start;
uint16_t inLen = token_end - token_start;

// empty strings are considered the first page
*pageCount = 1;
if (inLen > 0) {
Expand All @@ -91,11 +91,15 @@ parser_error_t tx_getToken(uint16_t token_index,
if (inLen == substStrLen && !MEMCMP(inValue, substStr, substStrLen)) {
inValue = value_substitutions[i].str2;
inLen = strlen(value_substitutions[i].str2);

//Extra Depth level for Multisend type
extraDepthLevel = (i == MULTISEND_KEY_IDX);
extraDepthLevel = false;
if (strstr(inValue, "Multi") != NULL) {
extraDepthLevel = true;
}

break;
}
}
}

pageStringExt(out_val, out_val_len, inValue, inLen, pageIdx, pageCount);
Expand Down
1 change: 0 additions & 1 deletion app/src/tx_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ extern "C" {
#endif

#define MAX_RECURSION_DEPTH 6
#define MULTISEND_KEY_IDX 9
extern bool extraDepthLevel;

#define INIT_QUERY_CONTEXT(_KEY, _KEY_LEN, _VAL, _VAL_LEN, _PAGE_IDX, _MAX_LEVEL) \
Expand Down
150 changes: 149 additions & 1 deletion tests/testcases/manual.json
Original file line number Diff line number Diff line change
Expand Up @@ -2031,5 +2031,153 @@
"17 | Tipper [2/2] : 6pkh5t"
],
"expert": true
}
},
{
"name": "MsgSetWithdrawAddress",
"tx":{
"account_number": "8",
"chain_id": "testing",
"fee": {
"amount": [
{
"amount": "5000",
"denom": "uatom"
}
],
"gas": "200000"
},
"memo": "",
"msgs": [
{
"type": "cosmos-sdk/MsgSetWithdrawAddress",
"value": {
"delegator_address": "cosmos1hr9x0sjvel6z3vt9qny8sdd5gnnlgk0p69d6cv",
"withdraw_address": "cosmos12d64j98tjjpqkx70r08aspc4nvntqp2w6wr2de"
}
},
{
"type": "cosmos-sdk/MsgWithdrawDelegationReward",
"value": {
"delegator_address": "cosmos1hr9x0sjvel6z3vt9qny8sdd5gnnlgk0p69d6cv",
"validator_address": "cosmosvaloper13dr26wdygna3s8fdl5tlc45m2le2ydyddxzj49"
}
}
],
"sequence": "7"
},
"parsingErr": "No error",
"validationErr": "No error",
"expected": [
"0 | Chain ID : testing",
"1 | Account : 8",
"2 | Sequence : 7",
"3 | Type : Withdraw Set Address",
"4 | Delegator [1/2] : cosmos1hr9x0sjvel6z3vt9qny8sdd5gnnlgk0p",
"4 | Delegator [2/2] : 69d6cv",
"5 | Withdraw Address [1/2] : cosmos12d64j98tjjpqkx70r08aspc4nvntqp2w",
"5 | Withdraw Address [2/2] : 6wr2de",
"6 | Type : Withdraw Reward",
"7 | Delegator [1/2] : cosmos1hr9x0sjvel6z3vt9qny8sdd5gnnlgk0p",
"7 | Delegator [2/2] : 69d6cv",
"8 | Validator [1/2] : cosmosvaloper13dr26wdygna3s8fdl5tlc45m2",
"8 | Validator [2/2] : le2ydyddxzj49",
"9 | Fee : 5000 uatom",
"10 | Gas : 200000"
],
"expert": true
},
{
"name": "Gaia_Sign_00",
"tx": {
"account_number":"8",
"sequence":"2",
"chain_id":"my-chain",
"memo":"A B C",
"fee":{
"amount":[],
"gas":"200000"
},
"msgs":[{
"type":"cosmos-sdk/MsgDeposit",
"value":{
"amount":[{
"amount":"10",
"denom":"stake"
}],
"depositor":"cosmos1xl2256vdh0j68khz9wq88hnyqcq0f5f4za2480",
"proposal_id":"1"
}
}]
},
"parsingErr": "No error",
"validationErr": "No error",
"expected": [
"0 | Chain ID : my-chain",
"1 | Account : 8",
"2 | Sequence : 2",
"3 | Type : Deposit",
"4 | Amount : 10 stake",
"5 | Sender [1/2] : cosmos1xl2256vdh0j68khz9wq88hnyqcq0f5f4",
"5 | Sender [2/2] : za2480",
"6 | Proposal ID : 1",
"7 | Memo : A B C",
"8 | Fee : Empty",
"9 | Gas : 200000"
],
"expert": true
},
{
"name": "Gaia_Sign_01",
"tx": {
"account_number":"123",
"sequence":"8",
"chain_id":"my-chain",
"fee":{
"amount":[{
"denom":"uatom",
"amount":"54"
}],
"gas_limit":"106309",
"granter": "cosmosaccaddr1d9h8xxxGRANTER",
"payer": "cosmosaccaddr1d9h8qatxxPAYER"
},

"msgs":[{
"type":"cosmos-sdk/MsgDeposit",
"value":{
"amount":[{
"amount":"255000000",
"denom":"uatom"
}],
"depositor":"cosmos1849m9wncrqp6v4tkss6a3j8uzvuv0cp7wcgvqa",
"proposal_id":"44"
}
}],
"memo":"",
"timeout_height":"0",
"extension_options":[],
"non_critical_extension_options":[],
"auth_info":{
"signer_infos":[]
},
"signatures":[]
},
"parsingErr": "No error",
"validationErr": "No error",
"expected": [
"0 | Chain ID : my-chain",
"1 | Account : 123",
"2 | Sequence : 8",
"3 | Type : Deposit",
"4 | Amount : 255000000 uatom",
"5 | Sender [1/2] : cosmos1849m9wncrqp6v4tkss6a3j8uzvuv0cp7",
"5 | Sender [2/2] : wcgvqa",
"6 | Proposal ID : 44",
"7 | Fee : 54 uatom",
"8 | fee/gas_limit : 106309",
"9 | Granter : cosmosaccaddr1d9h8xxxGRANTER",
"10 | Payer : cosmosaccaddr1d9h8qatxxPAYER"
],
"expert": true
}
]
Binary file added tests_zemu/snapshots/s-govDeposit/00000.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 added tests_zemu/snapshots/s-govDeposit/00001.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 added tests_zemu/snapshots/s-govDeposit/00002.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 added tests_zemu/snapshots/s-govDeposit/00003.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 added tests_zemu/snapshots/s-govDeposit/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 added tests_zemu/snapshots/s-govDeposit/00005.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 added tests_zemu/snapshots/s-govDeposit/00006.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 added tests_zemu/snapshots/s-govDeposit/00007.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 added tests_zemu/snapshots/s-govDeposit/00008.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 added tests_zemu/snapshots/s-govDeposit/00009.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 added tests_zemu/snapshots/s-govDeposit/00010.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 added tests_zemu/snapshots/s-govDeposit/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 added tests_zemu/snapshots/s-govDeposit/00012.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/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/00010.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 added tests_zemu/snapshots/s-setWithdrawAddress/00000.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 added tests_zemu/snapshots/s-setWithdrawAddress/00001.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 added tests_zemu/snapshots/s-setWithdrawAddress/00002.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 added tests_zemu/snapshots/s-setWithdrawAddress/00003.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 added tests_zemu/snapshots/s-setWithdrawAddress/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 added tests_zemu/snapshots/s-setWithdrawAddress/00005.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 added tests_zemu/snapshots/s-setWithdrawAddress/00006.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 added tests_zemu/snapshots/s-setWithdrawAddress/00007.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 added tests_zemu/snapshots/s-setWithdrawAddress/00008.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 added tests_zemu/snapshots/s-setWithdrawAddress/00009.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 added tests_zemu/snapshots/s-setWithdrawAddress/00010.png
Binary file added tests_zemu/snapshots/s-setWithdrawAddress/00011.png
Binary file added tests_zemu/snapshots/s-setWithdrawAddress/00012.png
Binary file added tests_zemu/snapshots/s-setWithdrawAddress/00013.png
Binary file added tests_zemu/snapshots/s-setWithdrawAddress/00014.png
Binary file added tests_zemu/snapshots/s-setWithdrawAddress/00015.png
Binary file added tests_zemu/snapshots/s-setWithdrawAddress/00016.png
Binary file added tests_zemu/snapshots/sp-govDeposit/00000.png
Binary file added tests_zemu/snapshots/sp-govDeposit/00001.png
Binary file added tests_zemu/snapshots/sp-govDeposit/00002.png
Binary file added tests_zemu/snapshots/sp-govDeposit/00003.png
Binary file added tests_zemu/snapshots/sp-govDeposit/00004.png
Binary file added tests_zemu/snapshots/sp-govDeposit/00005.png
Binary file added tests_zemu/snapshots/sp-govDeposit/00006.png
Binary file added tests_zemu/snapshots/sp-govDeposit/00007.png
Binary file added tests_zemu/snapshots/sp-govDeposit/00008.png
Binary file added tests_zemu/snapshots/sp-govDeposit/00009.png
Binary file added tests_zemu/snapshots/sp-govDeposit/00010.png
Binary file added tests_zemu/snapshots/sp-govDeposit/00011.png
Binary file added tests_zemu/snapshots/sp-govDeposit/00012.png
Binary file modified tests_zemu/snapshots/sp-mainmenu/00004.png
Binary file modified tests_zemu/snapshots/sp-mainmenu/00010.png
Binary file added tests_zemu/snapshots/sp-setWithdrawAddress/00000.png
Binary file added tests_zemu/snapshots/sp-setWithdrawAddress/00001.png
Binary file added tests_zemu/snapshots/sp-setWithdrawAddress/00002.png
Binary file added tests_zemu/snapshots/sp-setWithdrawAddress/00003.png
Binary file added tests_zemu/snapshots/sp-setWithdrawAddress/00004.png
Binary file added tests_zemu/snapshots/sp-setWithdrawAddress/00005.png
Binary file added tests_zemu/snapshots/sp-setWithdrawAddress/00006.png
Binary file added tests_zemu/snapshots/sp-setWithdrawAddress/00007.png
Binary file added tests_zemu/snapshots/sp-setWithdrawAddress/00008.png
Binary file added tests_zemu/snapshots/sp-setWithdrawAddress/00009.png
Binary file added tests_zemu/snapshots/sp-setWithdrawAddress/00010.png
Binary file added tests_zemu/snapshots/sp-setWithdrawAddress/00011.png
Binary file added tests_zemu/snapshots/sp-setWithdrawAddress/00012.png
Binary file added tests_zemu/snapshots/sp-setWithdrawAddress/00013.png
Binary file added tests_zemu/snapshots/x-govDeposit/00000.png
Binary file added tests_zemu/snapshots/x-govDeposit/00001.png
Binary file added tests_zemu/snapshots/x-govDeposit/00002.png
Binary file added tests_zemu/snapshots/x-govDeposit/00003.png
Binary file added tests_zemu/snapshots/x-govDeposit/00004.png
Binary file added tests_zemu/snapshots/x-govDeposit/00005.png
Binary file added tests_zemu/snapshots/x-govDeposit/00006.png
Binary file added tests_zemu/snapshots/x-govDeposit/00007.png
Binary file added tests_zemu/snapshots/x-govDeposit/00008.png
Binary file added tests_zemu/snapshots/x-govDeposit/00009.png
Binary file added tests_zemu/snapshots/x-govDeposit/00010.png
Binary file added tests_zemu/snapshots/x-govDeposit/00011.png
Binary file added tests_zemu/snapshots/x-govDeposit/00012.png
Binary file modified tests_zemu/snapshots/x-mainmenu/00004.png
Binary file modified tests_zemu/snapshots/x-mainmenu/00010.png
Binary file added tests_zemu/snapshots/x-setWithdrawAddress/00000.png
Binary file added tests_zemu/snapshots/x-setWithdrawAddress/00001.png
Binary file added tests_zemu/snapshots/x-setWithdrawAddress/00002.png
Binary file added tests_zemu/snapshots/x-setWithdrawAddress/00003.png
Binary file added tests_zemu/snapshots/x-setWithdrawAddress/00004.png
Binary file added tests_zemu/snapshots/x-setWithdrawAddress/00005.png
Binary file added tests_zemu/snapshots/x-setWithdrawAddress/00006.png
Binary file added tests_zemu/snapshots/x-setWithdrawAddress/00007.png
Binary file added tests_zemu/snapshots/x-setWithdrawAddress/00008.png
Binary file added tests_zemu/snapshots/x-setWithdrawAddress/00009.png
Binary file added tests_zemu/snapshots/x-setWithdrawAddress/00010.png
Binary file added tests_zemu/snapshots/x-setWithdrawAddress/00011.png
Binary file added tests_zemu/snapshots/x-setWithdrawAddress/00012.png
Binary file added tests_zemu/snapshots/x-setWithdrawAddress/00013.png
57 changes: 56 additions & 1 deletion tests_zemu/tests/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
******************************************************************************* */
import { DEFAULT_START_OPTIONS, DeviceModel } from '@zondax/zemu'
import {DEFAULT_KEY_DELAY} from "@zondax/zemu/src/constants";

const Resolve = require('path').resolve

Expand Down Expand Up @@ -245,3 +244,59 @@ export const ibc_denoms = {
],
sequence: '1'
}

export const setWithdrawAddress = {
account_number: '8',
chain_id: 'testing',
fee: {
amount: [
{
amount: '5000',
denom: 'uatom'
}
],
gas: '200000'
},
memo: '',
msgs: [
{
type: 'cosmos-sdk/MsgSetWithdrawAddress',
value: {
delegator_address: 'cosmos1hr9x0sjvel6z3vt9qny8sdd5gnnlgk0p69d6cv',
withdraw_address: 'cosmos12d64j98tjjpqkx70r08aspc4nvntqp2w6wr2de'
}
},
{
type: 'cosmos-sdk/MsgWithdrawDelegationReward',
value: {
delegator_address: 'cosmos1hr9x0sjvel6z3vt9qny8sdd5gnnlgk0p69d6cv',
validator_address: 'cosmosvaloper13dr26wdygna3s8fdl5tlc45m2le2ydyddxzj49'
}
}
],
sequence: '7'
}

export const cliGovDeposit = {
account_number: '8',
chain_id: 'my-chain',
fee: {
amount: [],
gas: '200000'
},
memo: 'A B C',
msgs: [
{
type: 'cosmos-sdk/MsgDeposit',
value: {
amount: [{
amount: '10',
denom: 'stake',
}],
depositor: 'cosmos1xl2256vdh0j68khz9wq88hnyqcq0f5f4za2480',
proposal_id: '1'
}
},
],
sequence: '2'
}
Loading

0 comments on commit 9a78592

Please sign in to comment.