Skip to content

Commit

Permalink
Merge pull request #141 from Zondax/update-9230
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosala authored Jun 3, 2022
2 parents 93af0e5 + a53b16a commit bf4fa9a
Show file tree
Hide file tree
Showing 147 changed files with 21,765 additions and 30,594 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ledger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: CI
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -20,6 +20,8 @@ jobs:

steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: Build with Clang Static Analyzer
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
[submodule "deps/nanosplus-secure-sdk"]
path = deps/nanosplus-secure-sdk
url = https://github.com/LedgerHQ/nanosplus-secure-sdk
[submodule "deps/ledger-zxlib"]
path = deps/ledger-zxlib
url = https://github.com/zondax/ledger-zxlib
8 changes: 4 additions & 4 deletions 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.9220.x
# Polkadot 12.9230.x

## System

Expand Down Expand Up @@ -356,13 +356,13 @@ Please:

| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|
|Submit unsigned | | | | `BoxRawSolutionSolutionOfT` raw_solution <br/>`SolutionOrSnapshotSize` witness <br/> |
|Submit unsigned | | | | `BoxRawSolutionSolutionOfMinerConfig` raw_solution <br/>`SolutionOrSnapshotSize` witness <br/> |
|Set minimum untrusted score | | | | `OptionElectionScore` maybe_next_score <br/> |
|Set emergency election result | | | | `SupportsAccountId` supports <br/> |
|Submit | | | | `BoxRawSolutionSolutionOfT` raw_solution <br/> |
|Submit | | | | `BoxRawSolutionSolutionOfMinerConfig` raw_solution <br/> |
|Governance fallback | | :heavy_check_mark: | | `Optionu32` maybe_max_voters <br/>`Optionu32` maybe_max_targets <br/> |

## BagsList
## VoterList

| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|
Expand Down
4 changes: 2 additions & 2 deletions app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ ifneq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += SUBSTRATE_PARSER_FULL
endif
APPNAME = "Polkadot"
APPPATH = "44'/354'" --path "44'/434'"
APPPATH = "44'/354'" --path "44'/434'"

else ifeq ($(COIN),DOT_XL)
# XL app configuration
DEFINES += APP_STANDARD SUBSTRATE_PARSER_FULL
APPNAME = "Polkadot XL"
APPPATH = "44'/354'" --path "44'/434'"
APPPATH = "44'/354'" --path "44'/434'"

else
define error_message
Expand Down
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=12
# This is the `spec_version` field of `Runtime`
APPVERSION_N=9220
APPVERSION_N=9230
# This is the patch version of this release
APPVERSION_P=0
Binary file modified app/glyphs/icon_app.gif
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 app/nanos_icon.gif
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 app/nanox_icon.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions app/src/apdu_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ __Z_INLINE void handleGetAddr(volatile uint32_t *flags, volatile uint32_t *tx, u
}
if (requireConfirmation) {
view_review_init(addr_getItem, addr_getNumItems, app_reply_address);
view_review_show();
view_review_show(0x03);
*flags |= IO_ASYNCH_REPLY;
return;
}
Expand Down Expand Up @@ -173,7 +173,7 @@ __Z_INLINE void handleSignSr25519(volatile uint32_t *flags, volatile uint32_t *t
}

view_review_init(tx_getItem, tx_getNumItems, app_return_sr25519);
view_review_show();
view_review_show(0x03);
*flags |= IO_ASYNCH_REPLY;
}
#endif
Expand All @@ -189,7 +189,7 @@ __Z_INLINE void handleSignEd25519(volatile uint32_t *flags, volatile uint32_t *t
}

view_review_init(tx_getItem, tx_getNumItems, app_sign_ed25519);
view_review_show();
view_review_show(0x03);
*flags |= IO_ASYNCH_REPLY;
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/secret.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ zxerr_t secret_enabled() {
#ifdef APP_SECRET_MODE_ENABLED
zemu_log("RECOVERY TRIGGERED");
view_review_init(secret_getItem, secret_getNumItems, secret_accept);
view_review_show();
view_review_show(0x00);
#endif
return zxerr_ok;
}
26 changes: 13 additions & 13 deletions app/src/substrate/substrate_dispatch_V12.c
Original file line number Diff line number Diff line change
Expand Up @@ -1293,15 +1293,15 @@ __Z_INLINE parser_error_t _readMethod_electionprovidermultiphase_governance_fall
return parser_ok;
}

__Z_INLINE parser_error_t _readMethod_bagslist_rebag_V12(
parser_context_t* c, pd_bagslist_rebag_V12_t* m)
__Z_INLINE parser_error_t _readMethod_voterlist_rebag_V12(
parser_context_t* c, pd_voterlist_rebag_V12_t* m)
{
CHECK_ERROR(_readAccountId_V12(c, &m->dislocated))
return parser_ok;
}

__Z_INLINE parser_error_t _readMethod_bagslist_put_in_front_of_V12(
parser_context_t* c, pd_bagslist_put_in_front_of_V12_t* m)
__Z_INLINE parser_error_t _readMethod_voterlist_put_in_front_of_V12(
parser_context_t* c, pd_voterlist_put_in_front_of_V12_t* m)
{
CHECK_ERROR(_readAccountId_V12(c, &m->lighter))
return parser_ok;
Expand Down Expand Up @@ -2183,10 +2183,10 @@ parser_error_t _readMethod_V12(
CHECK_ERROR(_readMethod_electionprovidermultiphase_governance_fallback_V12(c, &method->basic.electionprovidermultiphase_governance_fallback_V12))
break;
case 9472: /* module 37 call 0 */
CHECK_ERROR(_readMethod_bagslist_rebag_V12(c, &method->basic.bagslist_rebag_V12))
CHECK_ERROR(_readMethod_voterlist_rebag_V12(c, &method->basic.voterlist_rebag_V12))
break;
case 9473: /* module 37 call 1 */
CHECK_ERROR(_readMethod_bagslist_put_in_front_of_V12(c, &method->basic.bagslist_put_in_front_of_V12))
CHECK_ERROR(_readMethod_voterlist_put_in_front_of_V12(c, &method->basic.voterlist_put_in_front_of_V12))
break;
case 13056: /* module 51 call 0 */
CHECK_ERROR(_readMethod_configuration_set_validation_upgrade_cooldown_V12(c, &method->basic.configuration_set_validation_upgrade_cooldown_V12))
Expand Down Expand Up @@ -2412,7 +2412,7 @@ const char* _getMethod_ModuleName_V12(uint8_t moduleIdx)
case 36:
return STR_MO_ELECTIONPROVIDERMULTIPHASE;
case 37:
return STR_MO_BAGSLIST;
return STR_MO_VOTERLIST;
case 51:
return STR_MO_CONFIGURATION;
case 57:
Expand Down Expand Up @@ -7386,19 +7386,19 @@ parser_error_t _getMethod_ItemValue_V12(
}
case 9472: /* module 37 call 0 */
switch (itemIdx) {
case 0: /* bagslist_rebag_V12 - dislocated */;
case 0: /* voterlist_rebag_V12 - dislocated */;
return _toStringAccountId_V12(
&m->basic.bagslist_rebag_V12.dislocated,
&m->basic.voterlist_rebag_V12.dislocated,
outValue, outValueLen,
pageIdx, pageCount);
default:
return parser_no_data;
}
case 9473: /* module 37 call 1 */
switch (itemIdx) {
case 0: /* bagslist_put_in_front_of_V12 - lighter */;
case 0: /* voterlist_put_in_front_of_V12 - lighter */;
return _toStringAccountId_V12(
&m->basic.bagslist_put_in_front_of_V12.lighter,
&m->basic.voterlist_put_in_front_of_V12.lighter,
outValue, outValueLen,
pageIdx, pageCount);
default:
Expand Down Expand Up @@ -8120,8 +8120,8 @@ bool _getMethod_IsNestingSupported_V12(uint8_t moduleIdx, uint8_t callIdx)
case 8964: // Tips:Close tip
case 8965: // Tips:Slash tip
case 9220: // ElectionProviderMultiPhase:Governance fallback
case 9472: // BagsList:Rebag
case 9473: // BagsList:Put in front of
case 9472: // VoterList:Rebag
case 9473: // VoterList:Put in front of
case 13056: // Configuration:Set validation upgrade cooldown
case 13057: // Configuration:Set validation upgrade delay
case 13058: // Configuration:Set code retention period
Expand Down
6 changes: 3 additions & 3 deletions app/src/substrate/substrate_functions_V12.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ parser_error_t _readBoxEquivocationProofHeader_V12(parser_context_t* c, pd_BoxEq
parser_error_t _readBoxIdentityInfoMaxAdditionalFields_V12(parser_context_t* c, pd_BoxIdentityInfoMaxAdditionalFields_V12_t* v);
parser_error_t _readBoxMultiLocation_V12(parser_context_t* c, pd_BoxMultiLocation_V12_t* v);
parser_error_t _readBoxPalletsOrigin_V12(parser_context_t* c, pd_BoxPalletsOrigin_V12_t* v);
parser_error_t _readBoxRawSolutionSolutionOfT_V12(parser_context_t* c, pd_BoxRawSolutionSolutionOfT_V12_t* v);
parser_error_t _readBoxRawSolutionSolutionOfMinerConfig_V12(parser_context_t* c, pd_BoxRawSolutionSolutionOfMinerConfig_V12_t* v);
parser_error_t _readBoxVersionedMultiAssets_V12(parser_context_t* c, pd_BoxVersionedMultiAssets_V12_t* v);
parser_error_t _readBoxVersionedMultiLocation_V12(parser_context_t* c, pd_BoxVersionedMultiLocation_V12_t* v);
parser_error_t _readBoxVersionedXcmTasSysConfigCall_V12(parser_context_t* c, pd_BoxVersionedXcmTasSysConfigCall_V12_t* v);
Expand Down Expand Up @@ -207,8 +207,8 @@ parser_error_t _toStringBoxPalletsOrigin_V12(
uint8_t pageIdx,
uint8_t* pageCount);

parser_error_t _toStringBoxRawSolutionSolutionOfT_V12(
const pd_BoxRawSolutionSolutionOfT_V12_t* v,
parser_error_t _toStringBoxRawSolutionSolutionOfMinerConfig_V12(
const pd_BoxRawSolutionSolutionOfMinerConfig_V12_t* v,
char* outValue,
uint16_t outValueLen,
uint8_t pageIdx,
Expand Down
14 changes: 7 additions & 7 deletions app/src/substrate/substrate_methods_V12.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ extern "C" {
#define PD_CALL_CHILDBOUNTIES_V12 38
#define PD_CALL_TIPS_V12 35
#define PD_CALL_ELECTIONPROVIDERMULTIPHASE_V12 36
#define PD_CALL_BAGSLIST_V12 37
#define PD_CALL_VOTERLIST_V12 37
#define PD_CALL_CONFIGURATION_V12 51
#define PD_CALL_INITIALIZER_V12 57
#define PD_CALL_HRMP_V12 60
Expand Down Expand Up @@ -908,15 +908,15 @@ typedef struct {
pd_Optionu32_t maybe_max_targets;
} pd_electionprovidermultiphase_governance_fallback_V12_t;

#define PD_CALL_BAGSLIST_REBAG_V12 0
#define PD_CALL_VOTERLIST_REBAG_V12 0
typedef struct {
pd_AccountId_V12_t dislocated;
} pd_bagslist_rebag_V12_t;
} pd_voterlist_rebag_V12_t;

#define PD_CALL_BAGSLIST_PUT_IN_FRONT_OF_V12 1
#define PD_CALL_VOTERLIST_PUT_IN_FRONT_OF_V12 1
typedef struct {
pd_AccountId_V12_t lighter;
} pd_bagslist_put_in_front_of_V12_t;
} pd_voterlist_put_in_front_of_V12_t;

#define PD_CALL_CONFIGURATION_SET_VALIDATION_UPGRADE_COOLDOWN_V12 0
typedef struct {
Expand Down Expand Up @@ -1334,8 +1334,8 @@ typedef union {
pd_tips_close_tip_V12_t tips_close_tip_V12;
pd_tips_slash_tip_V12_t tips_slash_tip_V12;
pd_electionprovidermultiphase_governance_fallback_V12_t electionprovidermultiphase_governance_fallback_V12;
pd_bagslist_rebag_V12_t bagslist_rebag_V12;
pd_bagslist_put_in_front_of_V12_t bagslist_put_in_front_of_V12;
pd_voterlist_rebag_V12_t voterlist_rebag_V12;
pd_voterlist_put_in_front_of_V12_t voterlist_put_in_front_of_V12;
pd_configuration_set_validation_upgrade_cooldown_V12_t configuration_set_validation_upgrade_cooldown_V12;
pd_configuration_set_validation_upgrade_delay_V12_t configuration_set_validation_upgrade_delay_V12;
pd_configuration_set_code_retention_period_V12_t configuration_set_code_retention_period_V12;
Expand Down
2 changes: 1 addition & 1 deletion app/src/substrate/substrate_strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static const char* STR_MO_BOUNTIES = "Bounties";
static const char* STR_MO_CHILDBOUNTIES = "Childbounties";
static const char* STR_MO_TIPS = "Tips";
static const char* STR_MO_ELECTIONPROVIDERMULTIPHASE = "Electionprovidermultiphase";
static const char* STR_MO_BAGSLIST = "Bagslist";
static const char* STR_MO_VOTERLIST = "Voterlist";
static const char* STR_MO_CONFIGURATION = "Configuration";
static const char* STR_MO_INITIALIZER = "Initializer";
static const char* STR_MO_HRMP = "Hrmp";
Expand Down
20 changes: 14 additions & 6 deletions app/src/substrate/substrate_types_V12.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ parser_error_t _readBoxPalletsOrigin_V12(parser_context_t* c, pd_BoxPalletsOrigi
return parser_not_supported;
}

parser_error_t _readBoxRawSolutionSolutionOfT_V12(parser_context_t* c, pd_BoxRawSolutionSolutionOfT_V12_t* v)
parser_error_t _readBoxRawSolutionSolutionOfMinerConfig_V12(parser_context_t* c, pd_BoxRawSolutionSolutionOfMinerConfig_V12_t* v)
{
return parser_not_supported;
}
Expand Down Expand Up @@ -366,7 +366,9 @@ parser_error_t _readPerbill_V12(parser_context_t* c, pd_Perbill_V12_t* v)

parser_error_t _readPercent_V12(parser_context_t* c, pd_Percent_V12_t* v)
{
return _readCompactInt(c, &v->value);
CHECK_INPUT()
CHECK_ERROR(_readUInt8(c, &v->value))
return parser_ok;
}

parser_error_t _readProxyType_V12(parser_context_t* c, pd_ProxyType_V12_t* v)
Expand Down Expand Up @@ -868,8 +870,8 @@ parser_error_t _toStringBoxPalletsOrigin_V12(
return parser_print_not_supported;
}

parser_error_t _toStringBoxRawSolutionSolutionOfT_V12(
const pd_BoxRawSolutionSolutionOfT_V12_t* v,
parser_error_t _toStringBoxRawSolutionSolutionOfMinerConfig_V12(
const pd_BoxRawSolutionSolutionOfMinerConfig_V12_t* v,
char* outValue,
uint16_t outValueLen,
uint8_t pageIdx,
Expand Down Expand Up @@ -1385,8 +1387,14 @@ parser_error_t _toStringPercent_V12(
uint8_t pageIdx,
uint8_t* pageCount)
{
// 9 but shift 2 to show as percentage
return _toStringCompactInt(&v->value, 7, "%", "", outValue, outValueLen, pageIdx, pageCount);
char bufferUI[50];
char bufferRatio[50];

uint64_to_str(bufferRatio, sizeof(bufferRatio), v->value);

snprintf(bufferUI, sizeof(bufferUI), "%s%%", bufferRatio);
pageString(outValue, outValueLen, bufferUI, pageIdx, pageCount);
return parser_ok;
}

parser_error_t _toStringProxyType_V12(
Expand Down
4 changes: 2 additions & 2 deletions app/src/substrate/substrate_types_V12.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ typedef struct {
typedef struct {
// TODO: Not implemented
uint8_t _NOT_IMPLEMENTED__DO_NOT_USE;
} pd_BoxRawSolutionSolutionOfT_V12_t;
} pd_BoxRawSolutionSolutionOfMinerConfig_V12_t;

typedef struct {
// TODO: Not implemented
Expand Down Expand Up @@ -411,7 +411,7 @@ typedef struct {
} pd_Perbill_V12_t;

typedef struct {
compactInt_t value;
uint8_t value;
} pd_Percent_V12_t;

typedef struct {
Expand Down
1 change: 1 addition & 0 deletions deps/ledger-zxlib
Submodule ledger-zxlib added at 10d684
16 changes: 0 additions & 16 deletions deps/ledger-zxlib/.editorconfig

This file was deleted.

29 changes: 0 additions & 29 deletions deps/ledger-zxlib/.github/workflows/main.yml

This file was deleted.

4 changes: 0 additions & 4 deletions deps/ledger-zxlib/.gitignore

This file was deleted.

Loading

0 comments on commit bf4fa9a

Please sign in to comment.