Skip to content

Commit

Permalink
Upgrade v7 (#107)
Browse files Browse the repository at this point in the history
* no V4 changes - to reset commit

* wip - upgrade to v7

* submit_unsigned testing fix

* update git modules

* change address type on zemu tests + snapshots

* bump version

* versioning

* Create python venv on GH runner for ledger guidelines

* bring back version_delta def

* python venv for build GH runner
  • Loading branch information
0xPxt authored Oct 15, 2024
1 parent 0030210 commit da259eb
Show file tree
Hide file tree
Showing 111 changed files with 44,789 additions and 83,039 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/guidelines_enforcer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,27 @@ on:
pull_request:

jobs:
setup_and_install:
name: Setup Python and Install Dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Create and activate virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: Install dependencies
run: |
pip install --upgrade pip
make deps
guidelines_enforcer:
name: Call Ledger guidelines_enforcer
needs: setup_and_install
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_guidelines_enforcer.yml@v1
with:
python-version: '3.10'
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ jobs:
submodules: true
- name: Install deps
run: |
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
python -m venv venv
source venv/bin/activate
make deps
- run: make cpp_test

Expand Down
15 changes: 3 additions & 12 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@
[submodule "deps/ledger-zxlib"]
path = deps/ledger-zxlib
url = https://github.com/zondax/ledger-zxlib
[submodule "deps/nanos-secure-sdk"]
path = deps/nanos-secure-sdk
url = https://github.com/LedgerHQ/ledger-secure-sdk.git
[submodule "deps/nanosplus-secure-sdk"]
path = deps/nanosplus-secure-sdk
url = https://github.com/LedgerHQ/ledger-secure-sdk.git
[submodule "deps/nanox-secure-sdk"]
path = deps/nanox-secure-sdk
url = https://github.com/LedgerHQ/ledger-secure-sdk.git
[submodule "deps/stax-secure-sdk"]
path = deps/stax-secure-sdk
url = https://github.com/LedgerHQ/ledger-secure-sdk.git
[submodule "deps/ledger-secure-sdk"]
path = deps/ledger-secure-sdk
url = https://github.com/LedgerHQ/ledger-secure-sdk
2 changes: 1 addition & 1 deletion app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.installer_script
include $(BOLOS_SDK)/Makefile.defines

# Set the default value for PRODUCTION_BUILD to 0 if not already defined
PRODUCTION_BUILD ?= 1
PRODUCTION_BUILD ?= 0

$(info ************ TARGET_NAME = [$(TARGET_NAME)])

Expand Down
4 changes: 2 additions & 2 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=104
APPVERSION_M=107
# This is the `spec_version` field of `Runtime`
APPVERSION_N=63001
APPVERSION_N=7000
# This is the patch version of this release
APPVERSION_P=0
1 change: 1 addition & 0 deletions app/src/parser_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ extern "C" {
#define GEN_DEF_TOSTRING_ARRAY(SIZE) \
CLEAN_AND_CHECK(); \
if ((SIZE) == 0) { \
*pageCount = 1; \
snprintf(outValue, outValueLen, "Empty"); \
return parser_ok; \
} \
Expand Down
5 changes: 1 addition & 4 deletions app/src/parser_impl_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
#include "substrate_types.h"
#include "substrate_dispatch.h"

#define SUPPORTED_SPEC_VERSION_V4 6003001

parser_error_t parser_init_context(parser_context_t *ctx,
const uint8_t *buffer,
uint16_t bufferSize) {
Expand Down Expand Up @@ -353,8 +351,7 @@ parser_error_t _checkVersions(parser_context_t *c) {
transactionVersion += (uint32_t) p[2] << 16u;
transactionVersion += (uint32_t) p[3] << 24u;

if (transactionVersion != (SUPPORTED_TX_VERSION_CURRENT) &&
transactionVersion != (SUPPORTED_SPEC_VERSION_V4)) {
if (transactionVersion != SUPPORTED_TX_VERSION_CURRENT) {
return parser_tx_version_not_supported;
}

Expand Down
6 changes: 3 additions & 3 deletions app/src/substrate/substrate_coin.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
extern "C" {
#endif

#define COIN_ADDR_TYPE 12
#define COIN_ADDR_TYPE 42
#define CLA 0x91

#define INS_SIGN_RAW 0x03
Expand Down Expand Up @@ -59,11 +59,11 @@ typedef enum {
#define SUPPORTED_TX_VERSION_CURRENT LEDGER_MAJOR_VERSION - ZX_MAJOR_VERSION_DELTA
#define SUPPORTED_TX_VERSION_PREVIOUS (LEDGER_MAJOR_VERSION - 1)
#define SUPPORTED_SPEC_VERSION (LEDGER_MINOR_VERSION + 0)
#define SUPPORTED_MINIMUM_SPEC_VERSION 6003001
#define SUPPORTED_MINIMUM_SPEC_VERSION 7000000

#define COIN_AMOUNT_DECIMAL_PLACES 6

#define COIN_GENESIS_HASH "6fbd74e5e1d0a61d52ccfe9d4adaed16dd3a7caa37c6bc4d0c2fa12e8b2f4063"
#define COIN_GENESIS_HASH "885d727362e25873fb2c5fcda890a91018f52425b41ba30e0c1aaf1ab411dd0a"
#define COIN_NAME "Polymesh"
#define COIN_TICKER "POLYX "

Expand Down
32 changes: 16 additions & 16 deletions app/src/substrate/substrate_dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ parser_error_t _readMethod(
pd_Method_t* method)
{
switch (c->tx_obj->transactionVersion) {
case 4:
return _readMethod_V4(c, moduleIdx, callIdx, &method->V4);
case 7:
return _readMethod_V7(c, moduleIdx, callIdx, &method->V7);
default:
return parser_tx_version_not_supported;
}
Expand All @@ -36,8 +36,8 @@ parser_error_t _readMethod(
uint8_t _getMethod_NumItems(uint32_t transactionVersion, uint8_t moduleIdx, uint8_t callIdx)
{
switch (transactionVersion) {
case 4:
return _getMethod_NumItems_V4(moduleIdx, callIdx);
case 7:
return _getMethod_NumItems_V7(moduleIdx, callIdx);
default:
return 0;
}
Expand All @@ -46,8 +46,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 4:
return _getMethod_ModuleName_V4(moduleIdx);
case 7:
return _getMethod_ModuleName_V7(moduleIdx);
default:
return NULL;
}
Expand All @@ -56,8 +56,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 4:
return _getMethod_Name_V4(moduleIdx, callIdx);
case 7:
return _getMethod_Name_V7(moduleIdx, callIdx);
default:
return NULL;
}
Expand All @@ -66,8 +66,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 4:
return _getMethod_ItemName_V4(moduleIdx, callIdx, itemIdx);
case 7:
return _getMethod_ItemName_V7(moduleIdx, callIdx, itemIdx);
default:
return NULL;
}
Expand All @@ -78,8 +78,8 @@ parser_error_t _getMethod_ItemValue(uint32_t transactionVersion, pd_Method_t* m,
uint8_t pageIdx, uint8_t* pageCount)
{
switch (transactionVersion) {
case 4:
return _getMethod_ItemValue_V4(&m->V4, moduleIdx, callIdx, itemIdx, outValue,
case 7:
return _getMethod_ItemValue_V7(&m->V7, moduleIdx, callIdx, itemIdx, outValue,
outValueLen, pageIdx, pageCount);
default:
return parser_tx_version_not_supported;
Expand All @@ -89,8 +89,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 4:
return _getMethod_ItemIsExpert_V4(moduleIdx, callIdx, itemIdx);
case 7:
return _getMethod_ItemIsExpert_V7(moduleIdx, callIdx, itemIdx);
default:
return false;
}
Expand All @@ -99,8 +99,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 4:
return _getMethod_IsNestingSupported_V4(moduleIdx, callIdx);
case 7:
return _getMethod_IsNestingSupported_V7(moduleIdx, callIdx);
default:
return false;
}
Expand Down
6 changes: 3 additions & 3 deletions app/src/substrate/substrate_dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ extern "C" {

#include "parser_common.h"
#include "stdbool.h"
#include "substrate_dispatch_V4.h"
#include "substrate_dispatch_V7.h"
#include <stddef.h>
#include <stdint.h>

Expand All @@ -32,8 +32,8 @@ extern "C" {
{ \
switch (txVersion) { \
\
case 4: \
return PD_CALL_##CALL##_V4; \
case 7: \
return PD_CALL_##CALL##_V7; \
\
default: \
return 0; \
Expand Down
Loading

0 comments on commit da259eb

Please sign in to comment.