Skip to content

Commit

Permalink
Merge pull request #151 from Zondax/update/9250
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosala authored Jul 7, 2022
2 parents 96841b2 + fd4f440 commit f95a5ec
Show file tree
Hide file tree
Showing 37 changed files with 33,393 additions and 23,605 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Please:
- **Do not use in production**
- **Do not use a Ledger device with funds for development purposes.**
- **Have a separate and marked device that is used ONLY for development and testing**
# Polkadot 12.9230.x
# Polkadot 13.9250.x

## System

Expand Down Expand Up @@ -239,6 +239,7 @@ Please:
|Propose spend | | :heavy_check_mark: | | `CompactBalance` amount <br/>`LookupasStaticLookupSource` beneficiary <br/> |
|Reject proposal | | :heavy_check_mark: | | `Compactu32` proposal_id <br/> |
|Approve proposal | | :heavy_check_mark: | | `Compactu32` proposal_id <br/> |
|Spend | | :heavy_check_mark: | | `CompactBalance` amount <br/>`LookupasStaticLookupSource` beneficiary <br/> |
|Remove approval | | :heavy_check_mark: | | `Compactu32` proposal_id <br/> |

## Claims
Expand Down
6 changes: 3 additions & 3 deletions 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=12
APPVERSION_M=13
# This is the `spec_version` field of `Runtime`
APPVERSION_N=9230
APPVERSION_N=9250
# This is the patch version of this release
APPVERSION_P=1
APPVERSION_P=0
8 changes: 4 additions & 4 deletions app/rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/src/common/parser_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ typedef enum {
parser_tx_nesting_not_supported,
parser_tx_nesting_limit_reached,
parser_tx_call_vec_too_large,
parser_junction_limit,
} parser_error_t;

typedef struct {
Expand Down
1 change: 1 addition & 0 deletions app/src/parser_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ parser_error_t _readCompactIndex(parser_context_t *c, pd_CompactIndex_t *v);
uint16_t _detectAddressType(const parser_context_t *c);

parser_error_t _toStringCompactInt(const compactInt_t *c, uint8_t decimalPlaces,
bool trimTrailingZeros,
char postfix[],
char prefix[],
char *outValue, uint16_t outValueLen,
Expand Down
12 changes: 9 additions & 3 deletions app/src/parser_impl_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ const char *parser_getErrorDescription(parser_error_t err) {
return "Max nested calls reached";
case parser_tx_call_vec_too_large:
return "Call vector exceeds limit";
case parser_junction_limit:
return "Max junctions reached";
default:
return "Unrecognized error code";
}
Expand Down Expand Up @@ -189,6 +191,7 @@ parser_error_t _getValue(const compactInt_t *c, uint64_t *v) {

parser_error_t _toStringCompactInt(const compactInt_t *c,
uint8_t decimalPlaces,
bool trimTrailingZeros,
char postfix[],
char prefix[],
char *outValue, uint16_t outValueLen,
Expand Down Expand Up @@ -223,6 +226,10 @@ parser_error_t _toStringCompactInt(const compactInt_t *c,
return parser_unexpected_buffer_end;
}

if(trimTrailingZeros) {
number_inplace_trimming(bufferUI, 1);
}

pageString(outValue, outValueLen, bufferUI, pageIdx, pageCount);

return parser_ok;
Expand Down Expand Up @@ -293,17 +300,16 @@ parser_error_t _readCompactBalance(parser_context_t *c, pd_CompactBalance_t *v)
parser_error_t _toStringCompactIndex(const pd_CompactIndex_t *v,
char *outValue, uint16_t outValueLen,
uint8_t pageIdx, uint8_t *pageCount) {
return _toStringCompactInt(&v->index, 0, "", "", outValue, outValueLen, pageIdx, pageCount);
return _toStringCompactInt(&v->index, 0, false, "", "", outValue, outValueLen, pageIdx, pageCount);
}

parser_error_t _toStringCompactBalance(const pd_CompactBalance_t *v,
char *outValue, uint16_t outValueLen,
uint8_t pageIdx, uint8_t *pageCount) {
CHECK_ERROR(_toStringCompactInt(
&v->value,
COIN_AMOUNT_DECIMAL_PLACES, "", COIN_TICKER,
COIN_AMOUNT_DECIMAL_PLACES, true, "", COIN_TICKER,
outValue, outValueLen, pageIdx, pageCount))
number_inplace_trimming(outValue, 1);
return parser_ok;
}

Expand Down
17 changes: 17 additions & 0 deletions app/src/substrate/substrate_dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ parser_error_t _readMethod(
pd_Method_t* method)
{
switch (c->tx_obj->transactionVersion) {
case 13:
return _readMethod_V13(c, moduleIdx, callIdx, &method->V13);
case 12:
return _readMethod_V12(c, moduleIdx, callIdx, &method->V12);
default:
Expand All @@ -36,6 +38,8 @@ parser_error_t _readMethod(
uint8_t _getMethod_NumItems(uint32_t transactionVersion, uint8_t moduleIdx, uint8_t callIdx)
{
switch (transactionVersion) {
case 13:
return _getMethod_NumItems_V13(moduleIdx, callIdx);
case 12:
return _getMethod_NumItems_V12(moduleIdx, callIdx);
default:
Expand All @@ -46,6 +50,8 @@ uint8_t _getMethod_NumItems(uint32_t transactionVersion, uint8_t moduleIdx, uint
const char* _getMethod_ModuleName(uint32_t transactionVersion, uint8_t moduleIdx)
{
switch (transactionVersion) {
case 13:
return _getMethod_ModuleName_V13(moduleIdx);
case 12:
return _getMethod_ModuleName_V12(moduleIdx);
default:
Expand All @@ -56,6 +62,8 @@ const char* _getMethod_ModuleName(uint32_t transactionVersion, uint8_t moduleIdx
const char* _getMethod_Name(uint32_t transactionVersion, uint8_t moduleIdx, uint8_t callIdx)
{
switch (transactionVersion) {
case 13:
return _getMethod_Name_V13(moduleIdx, callIdx);
case 12:
return _getMethod_Name_V12(moduleIdx, callIdx);
default:
Expand All @@ -66,6 +74,8 @@ const char* _getMethod_Name(uint32_t transactionVersion, uint8_t moduleIdx, uint
const char* _getMethod_ItemName(uint32_t transactionVersion, uint8_t moduleIdx, uint8_t callIdx, uint8_t itemIdx)
{
switch (transactionVersion) {
case 13:
return _getMethod_ItemName_V13(moduleIdx, callIdx, itemIdx);
case 12:
return _getMethod_ItemName_V12(moduleIdx, callIdx, itemIdx);
default:
Expand All @@ -78,6 +88,9 @@ parser_error_t _getMethod_ItemValue(uint32_t transactionVersion, pd_Method_t* m,
uint8_t pageIdx, uint8_t* pageCount)
{
switch (transactionVersion) {
case 13:
return _getMethod_ItemValue_V13(&m->V13, moduleIdx, callIdx, itemIdx, outValue,
outValueLen, pageIdx, pageCount);
case 12:
return _getMethod_ItemValue_V12(&m->V12, moduleIdx, callIdx, itemIdx, outValue,
outValueLen, pageIdx, pageCount);
Expand All @@ -89,6 +102,8 @@ parser_error_t _getMethod_ItemValue(uint32_t transactionVersion, pd_Method_t* m,
bool _getMethod_ItemIsExpert(uint32_t transactionVersion, uint8_t moduleIdx, uint8_t callIdx, uint8_t itemIdx)
{
switch (transactionVersion) {
case 13:
return _getMethod_ItemIsExpert_V13(moduleIdx, callIdx, itemIdx);
case 12:
return _getMethod_ItemIsExpert_V12(moduleIdx, callIdx, itemIdx);
default:
Expand All @@ -99,6 +114,8 @@ bool _getMethod_ItemIsExpert(uint32_t transactionVersion, uint8_t moduleIdx, uin
bool _getMethod_IsNestingSupported(uint32_t transactionVersion, uint8_t moduleIdx, uint8_t callIdx)
{
switch (transactionVersion) {
case 13:
return _getMethod_IsNestingSupported_V13(moduleIdx, callIdx);
case 12:
return _getMethod_IsNestingSupported_V12(moduleIdx, callIdx);
default:
Expand Down
4 changes: 4 additions & 0 deletions app/src/substrate/substrate_dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ extern "C" {
#include "parser_common.h"
#include "stdbool.h"
#include "substrate_dispatch_V12.h"
#include "substrate_dispatch_V13.h"
#include <stddef.h>
#include <stdint.h>

Expand All @@ -32,6 +33,9 @@ extern "C" {
{ \
switch (txVersion) { \
\
case 13: \
return PD_CALL_##CALL##_V13; \
\
case 12: \
return PD_CALL_##CALL##_V12; \
\
Expand Down
Loading

0 comments on commit f95a5ec

Please sign in to comment.