Skip to content

Commit

Permalink
get testnet2 test cases back (#41)
Browse files Browse the repository at this point in the history
gasLimit back to bigint
  • Loading branch information
jleni authored Apr 21, 2020
1 parent f50130e commit 4243d23
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 62 deletions.
2 changes: 1 addition & 1 deletion app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ include $(BOLOS_SDK)/Makefile.defines
APPNAME = "Filecoin"
APPVERSION_M=0
APPVERSION_N=14
APPVERSION_P=0
APPVERSION_P=1

APPPATH = "44'/461'"
APP_LOAD_PARAMS = --appFlags 0x200 --delete $(COMMON_LOAD_PARAMS) --path ${APPPATH} --path "44'/1'"
Expand Down
6 changes: 1 addition & 5 deletions app/src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,7 @@ parser_error_t parser_getItem(const parser_context_t *ctx,

if (displayIdx == 5) {
snprintf(outKey, outKeyLen, "Gas Limit");
if (int64_to_str(outVal, outValLen, parser_tx_obj.gaslimit) != NULL) {
return parser_unexepected_error;
}
*pageCount = 1;
return parser_ok;
return parser_printBigInt(&parser_tx_obj.gaslimit, outVal, outValLen, pageIdx, pageCount);
}

if (displayIdx == 6 && parser_tx_obj.method != method0) {
Expand Down
3 changes: 1 addition & 2 deletions app/src/parser_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,7 @@ parser_error_t _read(const parser_context_t *c, parser_tx_t *v) {
CHECK_CBOR_MAP_ERR(cbor_value_advance(&arrayContainer))

// "gasLimit" field
PARSER_ASSERT_OR_ERROR(cbor_value_is_integer(&arrayContainer), parser_unexpected_type)
CHECK_PARSER_ERR(cbor_value_get_int64(&arrayContainer, &v->gaslimit))
CHECK_PARSER_ERR(_readBigInt(&v->gaslimit, &arrayContainer))
PARSER_ASSERT_OR_ERROR(arrayContainer.type != CborInvalidType, parser_unexpected_type)
CHECK_CBOR_MAP_ERR(cbor_value_advance(&arrayContainer))

Expand Down
2 changes: 1 addition & 1 deletion app/src/parser_txdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ typedef struct {
uint64_t nonce;
bigint_t value;
bigint_t gasprice;
int64_t gaslimit;
bigint_t gaslimit;
uint64_t method;
// params are not supported at this moment
// char *params
Expand Down
16 changes: 16 additions & 0 deletions tests/testvectors/issues.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
[
{
"description": "KnownIssue",
"encoded_tx": "iFUBYFX4eMzkUraMsLeLqqimg6cSS2VVASMIDACm8q1tEAM+jnMvR3rzdcOtAEIAAkIAA0MAA+gAQA==",
"valid": true,
"testnet": false,
"encoded_tx_hex": "8855016055f878cce452b68cb0b78baaa8a683a7124b65550123080c00a6f2ad6d10033e8e732f477af375c3ad00420002420003430003e80040",
"message" : {
"to": "f1mbk7q6gm4rjlndfqw6f2vkfgqotres3fgicb2uq",
"from": "f1emeayafg6kww2eadh2hhgl2hplzxlq5nln7xs5i",
"nonce": 0,
"value": "2",
"gasprice": "3",
"gaslimit": "1000",
"method": 0
}
}
]
104 changes: 52 additions & 52 deletions tests/testvectors/manual.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion tools/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ function toCBOR(tc) {
answer.push(buf);

// "gaslimit"
answer.push( parseInt(tc.message.gaslimit, 10));
buf = bigintToArray(tc.message.gaslimit);
answer.push(buf);

// "method"
answer.push(tc.message.method);
Expand Down

0 comments on commit 4243d23

Please sign in to comment.