Skip to content

Commit

Permalink
Merge pull request #5 from Zondax/main
Browse files Browse the repository at this point in the history
Update version
  • Loading branch information
TamtamHero authored Jan 14, 2022
2 parents 01bf61d + db8fe5e commit 1e8f828
Show file tree
Hide file tree
Showing 64 changed files with 13,395 additions and 14,469 deletions.
49 changes: 24 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Ledger Statemine 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-statemine/actions/workflows/main.yaml/badge.svg)](https://github.com/Zondax/ledger-statemine/blob/main/.github/workflows/main.yaml)
[![GithubActions](https://github.com/zondax/ledger-statemine/actions/workflows/main.yml/badge.svg)](https://github.com/Zondax/ledger-statemine/blob/main/.github/workflows/main.yaml)

---

Expand All @@ -28,9 +28,9 @@ Please:
- **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**

# Statemine 3.504.x
# Statemine 4.601.x

## SYSTEM
## System

| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|
Expand All @@ -45,40 +45,39 @@ Please:
|Kill prefix | | | | `Key` prefix <br/>`u32` subkeys <br/> |
|Remark with event | | :heavy_check_mark: | | `Vecu8` remark <br/> |

## PARACHAINSYSTEM
## ParachainSystem

| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|
|Set upgrade block | | | | `RelayChainBlockNumber` relay_chain_block <br/> |
|Set validation data | | | | `ParachainInherentData` data <br/> |
|Sudo send upward message | | | | `UpwardMessage` message <br/> |
|Authorize upgrade | | | | `Hash` code_hash <br/> |
|Enact authorized upgrade | | | | `Vecu8` code <br/> |

## TIMESTAMP
## Timestamp

| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|
|Set | | :heavy_check_mark: | | `Compactu64` now <br/> |

## BALANCES
## Balances

| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|
|Transfer | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | `LookupasStaticLookupSource` dest <br/>`CompactBalance` Amount <br/> |
|Transfer | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | `LookupasStaticLookupSource` dest <br/>`CompactBalance` amount <br/> |
|Set balance | | :heavy_check_mark: | :heavy_check_mark: | `LookupasStaticLookupSource` who <br/>`CompactBalance` new_free <br/>`CompactBalance` new_reserved <br/> |
|Force transfer | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | `LookupasStaticLookupSource` source <br/>`LookupasStaticLookupSource` dest <br/>`CompactBalance` Amount <br/> |
|Transfer keep alive | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | `LookupasStaticLookupSource` dest <br/>`CompactBalance` Amount <br/> |
|Force transfer | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | `LookupasStaticLookupSource` source <br/>`LookupasStaticLookupSource` dest <br/>`CompactBalance` amount <br/> |
|Transfer keep alive | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | `LookupasStaticLookupSource` dest <br/>`CompactBalance` amount <br/> |
|Transfer all | :heavy_check_mark: | :heavy_check_mark: | | `LookupasStaticLookupSource` dest <br/>`bool` keep_alive <br/> |
|Force unreserve | | :heavy_check_mark: | | `LookupasStaticLookupSource` who <br/>`Balance` amount <br/> |

## AUTHORSHIP
## Authorship

| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|
|Set uncles | | | | `VecHeader` new_uncles <br/> |

## COLLATORSELECTION
## CollatorSelection

| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|
Expand All @@ -88,19 +87,19 @@ Please:
|Register as candidate | | :heavy_check_mark: | | |
|Leave intent | | :heavy_check_mark: | | |

## SESSION
## Session

| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|
|Set keys | :heavy_check_mark: | | | `Keys` keys <br/>`Bytes` proof <br/> |
|Set keys | :heavy_check_mark: | :heavy_check_mark: | | `Keys` keys <br/>`Bytes` proof <br/> |
|Purge keys | :heavy_check_mark: | :heavy_check_mark: | | |

## XCMPQUEUE
## XcmpQueue

| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|

## POLKADOTXCM
## PolkadotXcm

| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|
Expand All @@ -115,21 +114,21 @@ Please:
|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/> |

## DMPQUEUE
## DmpQueue

| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|
|Service overweight | | | | `OverweightIndex` index <br/>`Weight` weight_limit <br/> |

## UTILITY
## Utility

| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|
|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/> |

## MULTISIG
## Multisig

| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|
Expand All @@ -138,7 +137,7 @@ Please:
|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/> |

## PROXY
## Proxy

| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|
Expand All @@ -148,12 +147,12 @@ 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/> |

## ASSETS
## Assets

| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|
Expand Down Expand Up @@ -181,7 +180,7 @@ Please:
|Force cancel approval | | :heavy_check_mark: | :heavy_check_mark: | `Compactu32` id <br/>`LookupasStaticLookupSource` owner <br/>`LookupasStaticLookupSource` delegate <br/> |
|Transfer approved | | :heavy_check_mark: | :heavy_check_mark: | `Compactu32` id <br/>`LookupasStaticLookupSource` owner <br/>`LookupasStaticLookupSource` destination <br/>`CompactBalance` amount <br/> |

## UNIQUES
## Uniques

| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|
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=3
APPVERSION_M=4
# This is the `spec_version` field of `Runtime`
APPVERSION_N=504
APPVERSION_N=601
# This is the patch version of this release
APPVERSION_P=0
2 changes: 1 addition & 1 deletion app/src/coin.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ typedef enum {

#define COIN_AMOUNT_DECIMAL_PLACES 12

#define COIN_GENESIS_HASH "b0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe"
#define COIN_GENESIS_HASH "48239ef607d7928874027a43a67689209727dfb3d3dc5e5b03a39bdc2eda771a"
#define COIN_NAME "Statemine"
#define COIN_TICKER "KSM "

Expand Down
26 changes: 22 additions & 4 deletions app/src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,17 @@ void __assert_fail(const char * assertion, const char * file, unsigned int line,
}
#endif

#define FIELD_FIXED_TOTAL_COUNT 7
#define FIELD_FIXED_TOTAL_COUNT 8

#define FIELD_METHOD 0
#define FIELD_NETWORK 1
#define FIELD_NONCE 2
#define FIELD_TIP 3
#define FIELD_ERA_PHASE 4
#define FIELD_ERA_PERIOD 5
#define FIELD_BLOCK_HASH 6
#define FIELD_ASSET_ID 4
#define FIELD_ERA_PHASE 5
#define FIELD_ERA_PERIOD 6
#define FIELD_BLOCK_HASH 7


#define EXPERT_FIELDS_TOTAL_COUNT 5

Expand Down Expand Up @@ -219,6 +221,22 @@ parser_error_t parser_getItem(const parser_context_t *ctx,
displayIdx++;
}

if (displayIdx == FIELD_ASSET_ID) {
snprintf(outKey, outKeyLen, "AssetId");
err = _toStringCompactInt(&ctx->tx_obj->assetId,
0, "", "",
outVal, outValLen,
pageIdx, pageCount);
if (err != parser_ok) return err;
number_inplace_trimming(outVal, 1);
return err;
}

if (!parser_show_expert_fields()) {
displayIdx++;
}


if (displayIdx == FIELD_ERA_PHASE && parser_show_expert_fields()) {
snprintf(outKey, outKeyLen, "Era Phase");
uint64_to_str(outVal, outValLen, ctx->tx_obj->era.phase);
Expand Down
3 changes: 3 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 Expand Up @@ -387,6 +389,7 @@ parser_error_t _readTx(parser_context_t *c, parser_tx_t *v) {
CHECK_ERROR(_readEra(c, &v->era))
CHECK_ERROR(_readCompactIndex(c, &v->nonce))
CHECK_ERROR(_readCompactBalance(c, &v->tip))
CHECK_ERROR(_readCompactInt(c,&v->assetId))
CHECK_ERROR(_readUInt32(c, &v->specVersion))
CHECK_ERROR(_readUInt32(c, &v->transactionVersion))
CHECK_ERROR(_readHash(c, &v->genesisHash))
Expand Down
1 change: 1 addition & 0 deletions app/src/parser_txdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ typedef struct {
pd_ExtrinsicEra_t era;
pd_CompactIndex_t nonce;
pd_CompactBalance_t tip;
compactInt_t assetId;
uint32_t specVersion;
uint32_t transactionVersion;

Expand Down
32 changes: 16 additions & 16 deletions app/src/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 3:
return _readMethod_V3(c, moduleIdx, callIdx, &method->V3);
case 4:
return _readMethod_V4(c, moduleIdx, callIdx, &method->V4);
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 3:
return _getMethod_NumItems_V3(moduleIdx, callIdx);
case 4:
return _getMethod_NumItems_V4(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 3:
return _getMethod_ModuleName_V3(moduleIdx);
case 4:
return _getMethod_ModuleName_V4(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 3:
return _getMethod_Name_V3(moduleIdx, callIdx);
case 4:
return _getMethod_Name_V4(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 3:
return _getMethod_ItemName_V3(moduleIdx, callIdx, itemIdx);
case 4:
return _getMethod_ItemName_V4(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 3:
return _getMethod_ItemValue_V3(&m->V3, moduleIdx, callIdx, itemIdx, outValue,
case 4:
return _getMethod_ItemValue_V4(&m->V4, 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 3:
return _getMethod_ItemIsExpert_V3(moduleIdx, callIdx, itemIdx);
case 4:
return _getMethod_ItemIsExpert_V4(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 3:
return _getMethod_IsNestingSupported_V3(moduleIdx, callIdx);
case 4:
return _getMethod_IsNestingSupported_V4(moduleIdx, callIdx);
default:
return false;
}
Expand Down
6 changes: 3 additions & 3 deletions app/src/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_V3.h"
#include "substrate_dispatch_V4.h"
#include <stddef.h>
#include <stdint.h>

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

0 comments on commit 1e8f828

Please sign in to comment.