Skip to content

Commit

Permalink
Merge pull request #1 from Zondax/master
Browse files Browse the repository at this point in the history
Upgrading to Lotus 0.5.x (Space Race testnet)
  • Loading branch information
TamtamHero authored Sep 14, 2020
2 parents 705de9b + 3e02e50 commit efbd179
Show file tree
Hide file tree
Showing 86 changed files with 252 additions and 219 deletions.
6 changes: 3 additions & 3 deletions app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ COIN=FIL
endif

APPVERSION_M=0
APPVERSION_N=17
APPVERSION_P=3
APPVERSION_N=18
APPVERSION_P=1

$(info COIN = [$(COIN)])
ifeq ($(COIN),FIL)
Expand Down Expand Up @@ -123,7 +123,7 @@ SDK_SOURCE_PATH += lib_blewbxx lib_blewbxx_impl
else
# Assume Nano S
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=128
DEFINES += HAVE_BOLOS_UX COMPLIANCE_UX_160 HAVE_UX_LEGACY
DEFINES += COMPLIANCE_UX_160 HAVE_UX_LEGACY
endif

# X specific
Expand Down
2 changes: 1 addition & 1 deletion app/script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ MEMORY
}

PAGE_SIZE = 64;
STACK_SIZE = 2008;
STACK_SIZE = 1892;
END_STACK = ORIGIN(SRAM) + LENGTH(SRAM);

SECTIONS
Expand Down
17 changes: 11 additions & 6 deletions app/src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,6 @@ parser_error_t parser_getItem(const parser_context_t *ctx,
}

if (displayIdx == 4) {
snprintf(outKey, outKeyLen, "Gas Price");
return parser_printBigIntFixedPoint(&parser_tx_obj.gasprice, outVal, outValLen, pageIdx, pageCount);
}

if (displayIdx == 5) {
snprintf(outKey, outKeyLen, "Gas Limit");
if (int64_to_str(outVal, outValLen, parser_tx_obj.gaslimit) != NULL) {
return parser_unexepected_error;
Expand All @@ -175,7 +170,17 @@ parser_error_t parser_getItem(const parser_context_t *ctx,
return parser_ok;
}

if (displayIdx == 5) {
snprintf(outKey, outKeyLen, "Gas Premium");
return parser_printBigIntFixedPoint(&parser_tx_obj.gaspremium, outVal, outValLen, pageIdx, pageCount);
}

if (displayIdx == 6) {
snprintf(outKey, outKeyLen, "Gas Fee Cap");
return parser_printBigIntFixedPoint(&parser_tx_obj.gasfeecap, outVal, outValLen, pageIdx, pageCount);
}

if (displayIdx == 7) {
snprintf(outKey, outKeyLen, "Method");
*pageCount = 1;
switch(parser_tx_obj.method) {
Expand Down Expand Up @@ -207,7 +212,7 @@ parser_error_t parser_getItem(const parser_context_t *ctx,
return parser_unexpected_method;
}

if (displayIdx == 7) {
if (displayIdx == 8) {
*pageCount = 1;
snprintf(outKey, outKeyLen, "Params");
snprintf(outVal, outValLen, "Not Available");
Expand Down
23 changes: 14 additions & 9 deletions app/src/parser_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ parser_error_t _read(const parser_context_t *c, parser_tx_t *v) {
CHECK_CBOR_MAP_ERR(cbor_value_get_array_length(&it, &arraySize))

// Depends if we have params or not
PARSER_ASSERT_OR_ERROR(arraySize == 9 || arraySize == 8, parser_unexpected_number_items);
PARSER_ASSERT_OR_ERROR(arraySize == 10 || arraySize == 9, parser_unexpected_number_items);

CborValue arrayContainer;
PARSER_ASSERT_OR_ERROR(cbor_value_is_container(&it), parser_unexpected_type)
Expand Down Expand Up @@ -286,17 +286,22 @@ parser_error_t _read(const parser_context_t *c, parser_tx_t *v) {
PARSER_ASSERT_OR_ERROR(arrayContainer.type != CborInvalidType, parser_unexpected_type)
CHECK_CBOR_MAP_ERR(cbor_value_advance(&arrayContainer))

// "gasPrice" field
CHECK_PARSER_ERR(_readBigInt(&v->gasprice, &arrayContainer))
PARSER_ASSERT_OR_ERROR(arrayContainer.type != CborInvalidType, parser_unexpected_type)
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))
PARSER_ASSERT_OR_ERROR(arrayContainer.type != CborInvalidType, parser_unexpected_type)
CHECK_CBOR_MAP_ERR(cbor_value_advance(&arrayContainer))

// "gasPremium" field
CHECK_PARSER_ERR(_readBigInt(&v->gaspremium, &arrayContainer))
PARSER_ASSERT_OR_ERROR(arrayContainer.type != CborInvalidType, parser_unexpected_type)
CHECK_CBOR_MAP_ERR(cbor_value_advance(&arrayContainer))

// "gasFeeCap" field
CHECK_PARSER_ERR(_readBigInt(&v->gasfeecap, &arrayContainer))
PARSER_ASSERT_OR_ERROR(arrayContainer.type != CborInvalidType, parser_unexpected_type)
CHECK_CBOR_MAP_ERR(cbor_value_advance(&arrayContainer))

// "method" field
CHECK_PARSER_ERR(_readMethod(v, &arrayContainer))
PARSER_ASSERT_OR_ERROR(arrayContainer.type != CborInvalidType, parser_unexpected_type)
Expand All @@ -321,11 +326,11 @@ parser_error_t _validateTx(const parser_context_t *c, const parser_tx_t *v) {
}

uint8_t _getNumItems(const parser_context_t *c, const parser_tx_t *v) {
uint8_t itemCount = 8;
uint8_t itemCount = 9;

switch (v->method) {
case method0:
itemCount = 6;
itemCount = 7;
break;
case method1:
case method2:
Expand All @@ -334,7 +339,7 @@ uint8_t _getNumItems(const parser_context_t *c, const parser_tx_t *v) {
case method5:
case method6:
case method7:
itemCount = 8;
break;
}

return itemCount;
Expand Down
3 changes: 2 additions & 1 deletion app/src/parser_txdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ typedef struct {
address_t from;
uint64_t nonce;
bigint_t value;
bigint_t gasprice;
int64_t gaslimit;
bigint_t gaspremium;
bigint_t gasfeecap;
uint64_t method;
// params are not supported at this moment
// char *params
Expand Down
Loading

0 comments on commit efbd179

Please sign in to comment.