Skip to content

Commit

Permalink
Merge pull request #111 from Zondax/dev
Browse files Browse the repository at this point in the history
upgrade to v9
  • Loading branch information
jleni authored Dec 13, 2021
2 parents f2cf373 + dcc1eba commit f0bd3a3
Show file tree
Hide file tree
Showing 128 changed files with 20,701 additions and 21,023 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,5 @@ cmake-build-debug
tests_zemu/snapshots-tmp
tests_zemu/yarn.lock
tests_tools/target

fuzz-*.log
/scan-build
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
# BOLOS_SDK IS DEFINED We use the plain Makefile for Ledger
# BOLOS_SDK NOT DEFINED We use a containerized build approach

#TESTS_JS_PACKAGE = "@zondax/ledger-polkadot"
#TESTS_JS_DIR = $(CURDIR)/../ledger-polkadot-js
#TESTS_JS_PACKAGE = "@zondax/ledger-substrate"
#TESTS_JS_DIR = $(CURDIR)/../ledger-substrate-js

ifeq ($(BOLOS_SDK),)
# In this case, there is not predefined SDK and we run dockerized
Expand Down Expand Up @@ -51,4 +51,3 @@ test_all:
cd tests_zemu && yarn testSR25519
make clean_build && SUBSTRATE_PARSER_FULL=1 make
make zemu_test

46 changes: 35 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Ledger Polkadot app

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![GithubActions](https://github.com/zondax/ledger-polkadot/actions/workflows/main.yml/badge.svg)](https://github.com/Zondax/ledger-polkadot/blob/main/.github/workflows/main.yaml)

Expand All @@ -8,7 +9,8 @@

_Please visit our website at [zondax.ch](zondax.ch)_

------------------
---

This project contains the Kusama app (https://kusama.network/) for Ledger Nano S and X.

- Ledger Nano S/X BOLOS app
Expand All @@ -25,22 +27,22 @@ 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 8.9122.x

# Polkadot 9.9140.x

## System

| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|
|Fill block | | :heavy_check_mark: | :heavy_check_mark: | `Perbill` ratio <br/> |
|Remark | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | `Vecu8` remark <br/> |
|Remark | | :heavy_check_mark: | :heavy_check_mark: | `Vecu8` remark <br/> |
|Set heap pages | | :heavy_check_mark: | :heavy_check_mark: | `u64` pages <br/> |
|Set code | | :heavy_check_mark: | :heavy_check_mark: | `Vecu8` code <br/> |
|Set code without checks | | :heavy_check_mark: | :heavy_check_mark: | `Vecu8` code <br/> |
|Set changes trie config | | | | `OptionChangesTrieConfiguration` changes_trie_config <br/> |
|Set storage | | | | `VecKeyValue` items <br/> |
|Kill storage | | | | `VecKey` keys <br/> |
|Kill prefix | | | | `Key` prefix <br/>`u32` subkeys <br/> |
|Remark with event | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | `Vecu8` remark <br/> |
|Remark with event | | :heavy_check_mark: | :heavy_check_mark: | `Vecu8` remark <br/> |

## Scheduler

Expand Down Expand Up @@ -151,7 +153,7 @@ Please:
| :---------- |:------------:|:--------:|:--------:|:--------|
|Propose | | | | `Hash` proposal_hash <br/>`Compactu128` amount <br/> |
|Second | | :heavy_check_mark: | | `Compactu32` proposal <br/>`Compactu32` seconds_upper_bound <br/> |
|Vote | | | | `Compactu32` ref_index <br/>`AccountVoteBalanceOfT` vote <br/> |
|Vote | | | | `Compactu32` ref_index <br/>`AccountVoteBalanceOf` vote <br/> |
|Emergency cancel | | :heavy_check_mark: | | `ReferendumIndex` ref_index <br/> |
|External propose | | :heavy_check_mark: | | `Hash` proposal_hash <br/> |
|External propose majority | | :heavy_check_mark: | | `Hash` proposal_hash <br/> |
Expand Down Expand Up @@ -236,7 +238,7 @@ Please:
|Mint claim | | | | `EthereumAddress` who <br/>`Balance` amount <br/>`OptionTupleBalanceOfTBalanceOfTBlockNumber` vesting_schedule <br/>`OptionStatementKind` statement <br/> |
|Claim attest | | :heavy_check_mark: | | `AccountId` dest <br/>`EcdsaSignature` ethereum_signature <br/>`Bytes` statement <br/> |
|Attest | | :heavy_check_mark: | | `Bytes` statement <br/> |
|Move claim | | :heavy_check_mark: | | `EthereumAddress` old <br/>`EthereumAddress` new_ <br/>`OptionAccountId` maybe_preclaim <br/> |
|Move claim | | | | `EthereumAddress` old <br/>`EthereumAddress` new_ <br/>`OptionAccountId` maybe_preclaim <br/> |

## Vesting

Expand All @@ -255,6 +257,7 @@ Please:
|Batch | :heavy_check_mark: | :heavy_check_mark: | | `VecCall` calls <br/> |
|As derivative | | | | `u16` index <br/>`Call` call <br/> |
|Batch all | :heavy_check_mark: | :heavy_check_mark: | | `VecCall` calls <br/> |
|Dispatch as | | | | `BoxPalletsOrigin` as_origin <br/>`Call` call <br/> |

## Identity

Expand Down Expand Up @@ -286,17 +289,17 @@ Please:
|Remove proxies | | :heavy_check_mark: | | |
|Anonymous | | :heavy_check_mark: | | `ProxyType` proxy_type <br/>`BlockNumber` delay <br/>`u16` index <br/> |
|Kill anonymous | | :heavy_check_mark: | | `AccountId` spawner <br/>`ProxyType` proxy_type <br/>`u16` index <br/>`Compactu32` height <br/>`Compactu32` ext_index <br/> |
|Announce | | | | `AccountId` real <br/>`CallHashOfT` call_hash <br/> |
|Remove announcement | | | | `AccountId` real <br/>`CallHashOfT` call_hash <br/> |
|Reject announcement | | | | `AccountId` delegate <br/>`CallHashOfT` call_hash <br/> |
|Announce | | | | `AccountId` real <br/>`CallHashOf` call_hash <br/> |
|Remove announcement | | | | `AccountId` real <br/>`CallHashOf` call_hash <br/> |
|Reject announcement | | | | `AccountId` delegate <br/>`CallHashOf` call_hash <br/> |
|Proxy announced | | :heavy_check_mark: | | `AccountId` delegate <br/>`AccountId` real <br/>`OptionProxyType` force_proxy_type <br/>`Call` call <br/> |

## Multisig

| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|
|As multi threshold 1 | | | | `VecAccountId` other_signatories <br/>`Call` call <br/> |
|As multi | | :heavy_check_mark: | :heavy_check_mark: | `u16` threshold <br/>`VecAccountId` other_signatories <br/>`OptionTimepoint` maybe_timepoint <br/>`OpaqueCall` call <br/>`bool` store_call <br/>`Weight` max_weight <br/> |
|As multi | | | | `u16` threshold <br/>`VecAccountId` other_signatories <br/>`OptionTimepoint` maybe_timepoint <br/>`OpaqueCallT` call <br/>`bool` store_call <br/>`Weight` max_weight <br/> |
|Approve as multi | | :heavy_check_mark: | :heavy_check_mark: | `u16` threshold <br/>`VecAccountId` other_signatories <br/>`OptionTimepoint` maybe_timepoint <br/>`H256` call_hash <br/>`Weight` max_weight <br/> |
|Cancel as multi | | :heavy_check_mark: | :heavy_check_mark: | `u16` threshold <br/>`VecAccountId` other_signatories <br/>`Timepoint` timepoint <br/>`H256` call_hash <br/> |

Expand Down Expand Up @@ -334,6 +337,12 @@ Please:
|Set emergency election result | | | | `SupportsAccountId` supports <br/> |
|Submit | | | | `BoxRawSolutionSolutionOfT` raw_solution <br/>`u32` num_signed_submissions <br/> |

## BagsList

| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|
|Rebag | | :heavy_check_mark: | | `AccountId` dislocated <br/> |

## Configuration

| Name | Light | XL | Nesting | Arguments |
Expand Down Expand Up @@ -475,3 +484,18 @@ Please:
|Add memo | | | | `ParaId` index <br/>`Vecu8` memo <br/> |
|Poke | | | | `ParaId` index <br/> |

## XcmPallet

| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|
|Send | | | | `BoxVersionedMultiLocation` dest <br/>`BoxVersionedXcmTuple` message <br/> |
|Teleport assets | | | | `BoxVersionedMultiLocation` dest <br/>`BoxVersionedMultiLocation` beneficiary <br/>`BoxVersionedMultiAssets` assets <br/>`u32` fee_asset_item <br/> |
|Reserve transfer assets | | | | `BoxVersionedMultiLocation` dest <br/>`BoxVersionedMultiLocation` beneficiary <br/>`BoxVersionedMultiAssets` assets <br/>`u32` fee_asset_item <br/> |
|Execute | | | | `BoxVersionedXcmTasSysConfigCall` message <br/>`Weight` max_weight <br/> |
|Force xcm version | | | | `BoxMultiLocation` location <br/>`XcmVersion` xcm_version <br/> |
|Force default xcm version | | | | `OptionXcmVersion` maybe_xcm_version <br/> |
|Force subscribe version notify | | | | `BoxVersionedMultiLocation` location <br/> |
|Force unsubscribe version notify | | | | `BoxVersionedMultiLocation` location <br/> |
|Limited reserve transfer assets | | | | `BoxVersionedMultiLocation` dest <br/>`BoxVersionedMultiLocation` beneficiary <br/>`BoxVersionedMultiAssets` assets <br/>`u32` fee_asset_item <br/>`WeightLimit` weight_limit <br/> |
|Limited teleport assets | | | | `BoxVersionedMultiLocation` dest <br/>`BoxVersionedMultiLocation` beneficiary <br/>`BoxVersionedMultiAssets` assets <br/>`u32` fee_asset_item <br/>`WeightLimit` weight_limit <br/> |

2 changes: 2 additions & 0 deletions app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ DEFINES += HAVE_BLE_APDU BLE_COMMAND_TIMEOUT_MS=2000
SDK_SOURCE_PATH += lib_blewbxx lib_blewbxx_impl
else
# Assume Nano S
DEFINES += HAVE_BAGL BAGL_WIDTH=128 BAGL_HEIGHT=32
DEFINES += BAGL_WIDTH_MARGIN=10
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=128
endif

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=8
APPVERSION_M=9
# This is the `spec_version` field of `Runtime`
APPVERSION_N=9122
APPVERSION_N=9140
# This is the patch version of this release
APPVERSION_P=1
APPVERSION_P=0
Binary file added app/glyphs/icon_warning.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions app/rust/Cargo.lock

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

2 changes: 2 additions & 0 deletions app/src/parser_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ parser_error_t _readEra(parser_context_t *c, pd_ExtrinsicEra_t *v) {
// https://github.com/paritytech/substrate/blob/fc3adc87dc806237eb7371c1d21055eea1702be0/core/sr-primitives/src/generic/era.rs#L117

v->type = eEraImmortal;
v->period = 0;
v->phase = 0;

uint8_t first;
CHECK_ERROR(_readUInt8(c, &first))
Expand Down
60 changes: 30 additions & 30 deletions app/src/substrate_dispatch.c
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*******************************************************************************
* (c) 2019 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/
* (c) 2019 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/
#include "substrate_dispatch.h"
#include "parser_impl.h"

Expand All @@ -26,8 +26,8 @@ parser_error_t _readMethod(
pd_Method_t* method)
{
switch (c->tx_obj->transactionVersion) {
case 8:
return _readMethod_V8(c, moduleIdx, callIdx, &method->V8);
case 9:
return _readMethod_V9(c, moduleIdx, callIdx, &method->V9);
default:
return parser_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 8:
return _getMethod_NumItems_V8(moduleIdx, callIdx);
case 9:
return _getMethod_NumItems_V9(moduleIdx, callIdx);
default:
return parser_not_supported;
}
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 8:
return _getMethod_ModuleName_V8(moduleIdx);
case 9:
return _getMethod_ModuleName_V9(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 8:
return _getMethod_Name_V8(moduleIdx, callIdx);
case 9:
return _getMethod_Name_V9(moduleIdx, callIdx);
default:
return 0;
}
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 8:
return _getMethod_ItemName_V8(moduleIdx, callIdx, itemIdx);
case 9:
return _getMethod_ItemName_V9(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 8:
return _getMethod_ItemValue_V8(&m->V8, moduleIdx, callIdx, itemIdx, outValue,
case 9:
return _getMethod_ItemValue_V9(&m->V9, moduleIdx, callIdx, itemIdx, outValue,
outValueLen, pageIdx, pageCount);
default:
return parser_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 8:
return _getMethod_ItemIsExpert_V8(moduleIdx, callIdx, itemIdx);
case 9:
return _getMethod_ItemIsExpert_V9(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 8:
return _getMethod_IsNestingSupported_V8(moduleIdx, callIdx);
case 9:
return _getMethod_IsNestingSupported_V9(moduleIdx, callIdx);
default:
return false;
}
Expand Down
34 changes: 17 additions & 17 deletions app/src/substrate_dispatch.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*******************************************************************************
* (c) 2019 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/
* (c) 2019 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/
#pragma once

#ifdef __cplusplus
Expand All @@ -21,7 +21,7 @@ extern "C" {

#include "parser_common.h"
#include "stdbool.h"
#include "substrate_dispatch_V8.h"
#include "substrate_dispatch_V9.h"
#include <stddef.h>
#include <stdint.h>

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

0 comments on commit f0bd3a3

Please sign in to comment.