Skip to content

Commit

Permalink
Merge pull request #121 from Zondax/support_multisig
Browse files Browse the repository at this point in the history
Support multisig
  • Loading branch information
jleni authored Feb 9, 2022
2 parents 0a99412 + 0e98b8a commit 0203567
Show file tree
Hide file tree
Showing 21 changed files with 16,819 additions and 16,161 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ Please:
| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|
|As multi threshold 1 | | | | `VecAccountId` other_signatories <br/>`Call` call <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/> |
|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/> |
|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
2 changes: 1 addition & 1 deletion app/Makefile.version
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ APPVERSION_M=10
# This is the `spec_version` field of `Runtime`
APPVERSION_N=9160
# This is the patch version of this release
APPVERSION_P=0
APPVERSION_P=1
69 changes: 69 additions & 0 deletions app/src/substrate/substrate_dispatch_V10.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,18 @@ __Z_INLINE parser_error_t _readMethod_proxy_proxy_announced_V10(
return parser_ok;
}

__Z_INLINE parser_error_t _readMethod_multisig_as_multi_V10(
parser_context_t* c, pd_multisig_as_multi_V10_t* m)
{
CHECK_ERROR(_readu16(c, &m->threshold))
CHECK_ERROR(_readVecAccountId_V10(c, &m->other_signatories))
CHECK_ERROR(_readOptionTimepoint_V10(c, &m->maybe_timepoint))
CHECK_ERROR(_readOpaqueCall_V10(c, &m->call))
CHECK_ERROR(_readbool(c, &m->store_call))
CHECK_ERROR(_readWeight_V10(c, &m->max_weight))
return parser_ok;
}

__Z_INLINE parser_error_t _readMethod_multisig_approve_as_multi_V10(
parser_context_t* c, pd_multisig_approve_as_multi_V10_t* m)
{
Expand Down Expand Up @@ -1712,6 +1724,9 @@ parser_error_t _readMethod_V10(
case 7433: /* module 29 call 9 */
CHECK_ERROR(_readMethod_proxy_proxy_announced_V10(c, &method->basic.proxy_proxy_announced_V10))
break;
case 7681: /* module 30 call 1 */
CHECK_ERROR(_readMethod_multisig_as_multi_V10(c, &method->nested.multisig_as_multi_V10))
break;
case 7682: /* module 30 call 2 */
CHECK_ERROR(_readMethod_multisig_approve_as_multi_V10(c, &method->nested.multisig_approve_as_multi_V10))
break;
Expand Down Expand Up @@ -2801,6 +2816,8 @@ uint8_t _getMethod_NumItems_V10(uint8_t moduleIdx, uint8_t callIdx)
return 5;
case 7433: /* module 29 call 9 */
return 4;
case 7681: /* module 30 call 1 */
return 6;
case 7682: /* module 30 call 2 */
return 5;
case 7683: /* module 30 call 3 */
Expand Down Expand Up @@ -3841,6 +3858,23 @@ const char* _getMethod_ItemName_V10(uint8_t moduleIdx, uint8_t callIdx, uint8_t
default:
return NULL;
}
case 7681: /* module 30 call 1 */
switch (itemIdx) {
case 0:
return STR_IT_threshold;
case 1:
return STR_IT_other_signatories;
case 2:
return STR_IT_maybe_timepoint;
case 3:
return STR_IT_call;
case 4:
return STR_IT_store_call;
case 5:
return STR_IT_max_weight;
default:
return NULL;
}
case 7682: /* module 30 call 2 */
switch (itemIdx) {
case 0:
Expand Down Expand Up @@ -5758,6 +5792,41 @@ parser_error_t _getMethod_ItemValue_V10(
default:
return parser_no_data;
}
case 7681: /* module 30 call 1 */
switch (itemIdx) {
case 0: /* multisig_as_multi_V10 - threshold */;
return _toStringu16(
&m->nested.multisig_as_multi_V10.threshold,
outValue, outValueLen,
pageIdx, pageCount);
case 1: /* multisig_as_multi_V10 - other_signatories */;
return _toStringVecAccountId_V10(
&m->nested.multisig_as_multi_V10.other_signatories,
outValue, outValueLen,
pageIdx, pageCount);
case 2: /* multisig_as_multi_V10 - maybe_timepoint */;
return _toStringOptionTimepoint_V10(
&m->nested.multisig_as_multi_V10.maybe_timepoint,
outValue, outValueLen,
pageIdx, pageCount);
case 3: /* multisig_as_multi_V10 - call */;
return _toStringOpaqueCall_V10(
&m->nested.multisig_as_multi_V10.call,
outValue, outValueLen,
pageIdx, pageCount);
case 4: /* multisig_as_multi_V10 - store_call */;
return _toStringbool(
&m->nested.multisig_as_multi_V10.store_call,
outValue, outValueLen,
pageIdx, pageCount);
case 5: /* multisig_as_multi_V10 - max_weight */;
return _toStringWeight_V10(
&m->nested.multisig_as_multi_V10.max_weight,
outValue, outValueLen,
pageIdx, pageCount);
default:
return parser_no_data;
}
case 7682: /* module 30 call 2 */
switch (itemIdx) {
case 0: /* multisig_approve_as_multi_V10 - threshold */;
Expand Down
71 changes: 70 additions & 1 deletion app/src/substrate/substrate_dispatch_V9.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* (c) 2019 Zondax GmbH
* (c) 2019 - 2022 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -827,6 +827,18 @@ __Z_INLINE parser_error_t _readMethod_proxy_proxy_announced_V9(
return parser_ok;
}

__Z_INLINE parser_error_t _readMethod_multisig_as_multi_V9(
parser_context_t* c, pd_multisig_as_multi_V9_t* m)
{
CHECK_ERROR(_readu16(c, &m->threshold))
CHECK_ERROR(_readVecAccountId_V9(c, &m->other_signatories))
CHECK_ERROR(_readOptionTimepoint_V9(c, &m->maybe_timepoint))
CHECK_ERROR(_readOpaqueCall_V9(c, &m->call))
CHECK_ERROR(_readbool(c, &m->store_call))
CHECK_ERROR(_readWeight_V9(c, &m->max_weight))
return parser_ok;
}

__Z_INLINE parser_error_t _readMethod_multisig_approve_as_multi_V9(
parser_context_t* c, pd_multisig_approve_as_multi_V9_t* m)
{
Expand Down Expand Up @@ -1637,6 +1649,9 @@ parser_error_t _readMethod_V9(
case 7433: /* module 29 call 9 */
CHECK_ERROR(_readMethod_proxy_proxy_announced_V9(c, &method->basic.proxy_proxy_announced_V9))
break;
case 7681: /* module 30 call 1 */
CHECK_ERROR(_readMethod_multisig_as_multi_V9(c, &method->nested.multisig_as_multi_V9))
break;
case 7682: /* module 30 call 2 */
CHECK_ERROR(_readMethod_multisig_approve_as_multi_V9(c, &method->nested.multisig_approve_as_multi_V9))
break;
Expand Down Expand Up @@ -2675,6 +2690,8 @@ uint8_t _getMethod_NumItems_V9(uint8_t moduleIdx, uint8_t callIdx)
return 5;
case 7433: /* module 29 call 9 */
return 4;
case 7681: /* module 30 call 1 */
return 6;
case 7682: /* module 30 call 2 */
return 5;
case 7683: /* module 30 call 3 */
Expand Down Expand Up @@ -3677,6 +3694,23 @@ const char* _getMethod_ItemName_V9(uint8_t moduleIdx, uint8_t callIdx, uint8_t i
default:
return NULL;
}
case 7681: /* module 30 call 1 */
switch (itemIdx) {
case 0:
return STR_IT_threshold;
case 1:
return STR_IT_other_signatories;
case 2:
return STR_IT_maybe_timepoint;
case 3:
return STR_IT_call;
case 4:
return STR_IT_store_call;
case 5:
return STR_IT_max_weight;
default:
return NULL;
}
case 7682: /* module 30 call 2 */
switch (itemIdx) {
case 0:
Expand Down Expand Up @@ -5519,6 +5553,41 @@ parser_error_t _getMethod_ItemValue_V9(
default:
return parser_no_data;
}
case 7681: /* module 30 call 1 */
switch (itemIdx) {
case 0: /* multisig_as_multi_V9 - threshold */;
return _toStringu16(
&m->nested.multisig_as_multi_V9.threshold,
outValue, outValueLen,
pageIdx, pageCount);
case 1: /* multisig_as_multi_V9 - other_signatories */;
return _toStringVecAccountId_V9(
&m->nested.multisig_as_multi_V9.other_signatories,
outValue, outValueLen,
pageIdx, pageCount);
case 2: /* multisig_as_multi_V9 - maybe_timepoint */;
return _toStringOptionTimepoint_V9(
&m->nested.multisig_as_multi_V9.maybe_timepoint,
outValue, outValueLen,
pageIdx, pageCount);
case 3: /* multisig_as_multi_V9 - call */;
return _toStringOpaqueCall_V9(
&m->nested.multisig_as_multi_V9.call,
outValue, outValueLen,
pageIdx, pageCount);
case 4: /* multisig_as_multi_V9 - store_call */;
return _toStringbool(
&m->nested.multisig_as_multi_V9.store_call,
outValue, outValueLen,
pageIdx, pageCount);
case 5: /* multisig_as_multi_V9 - max_weight */;
return _toStringWeight_V9(
&m->nested.multisig_as_multi_V9.max_weight,
outValue, outValueLen,
pageIdx, pageCount);
default:
return parser_no_data;
}
case 7682: /* module 30 call 2 */
switch (itemIdx) {
case 0: /* multisig_approve_as_multi_V9 - threshold */;
Expand Down
2 changes: 1 addition & 1 deletion app/src/substrate/substrate_dispatch_V9.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* (c) 2019 Zondax GmbH
* (c) 2019 - 2022 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
6 changes: 3 additions & 3 deletions app/src/substrate/substrate_functions_V10.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ parser_error_t _readMemberCount_V10(parser_context_t* c, pd_MemberCount_V10_t* v
parser_error_t _readMultiSignature_V10(parser_context_t* c, pd_MultiSignature_V10_t* v);
parser_error_t _readMultiSigner_V10(parser_context_t* c, pd_MultiSigner_V10_t* v);
parser_error_t _readNextConfigDescriptor_V10(parser_context_t* c, pd_NextConfigDescriptor_V10_t* v);
parser_error_t _readOpaqueCallT_V10(parser_context_t* c, pd_OpaqueCallT_V10_t* v);
parser_error_t _readOpaqueCall_V10(parser_context_t* c, pd_OpaqueCall_V10_t* v);
parser_error_t _readOptionAccountId_V10(parser_context_t* c, pd_OptionAccountId_V10_t* v);
parser_error_t _readOptionElectionScore_V10(parser_context_t* c, pd_OptionElectionScore_V10_t* v);
parser_error_t _readOptionMultiSignature_V10(parser_context_t* c, pd_OptionMultiSignature_V10_t* v);
Expand Down Expand Up @@ -386,8 +386,8 @@ parser_error_t _toStringNextConfigDescriptor_V10(
uint8_t pageIdx,
uint8_t* pageCount);

parser_error_t _toStringOpaqueCallT_V10(
const pd_OpaqueCallT_V10_t* v,
parser_error_t _toStringOpaqueCall_V10(
const pd_OpaqueCall_V10_t* v,
char* outValue,
uint16_t outValueLen,
uint8_t pageIdx,
Expand Down
8 changes: 4 additions & 4 deletions app/src/substrate/substrate_functions_V9.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* (c) 2019 Zondax GmbH
* (c) 2019 - 2022 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -64,7 +64,7 @@ parser_error_t _readMemberCount_V9(parser_context_t* c, pd_MemberCount_V9_t* v);
parser_error_t _readMultiSignature_V9(parser_context_t* c, pd_MultiSignature_V9_t* v);
parser_error_t _readMultiSigner_V9(parser_context_t* c, pd_MultiSigner_V9_t* v);
parser_error_t _readNextConfigDescriptor_V9(parser_context_t* c, pd_NextConfigDescriptor_V9_t* v);
parser_error_t _readOpaqueCallT_V9(parser_context_t* c, pd_OpaqueCallT_V9_t* v);
parser_error_t _readOpaqueCall_V9(parser_context_t* c, pd_OpaqueCall_V9_t* v);
parser_error_t _readOptionAccountId_V9(parser_context_t* c, pd_OptionAccountId_V9_t* v);
parser_error_t _readOptionElectionScore_V9(parser_context_t* c, pd_OptionElectionScore_V9_t* v);
parser_error_t _readOptionMultiSignature_V9(parser_context_t* c, pd_OptionMultiSignature_V9_t* v);
Expand Down Expand Up @@ -375,8 +375,8 @@ parser_error_t _toStringNextConfigDescriptor_V9(
uint8_t pageIdx,
uint8_t* pageCount);

parser_error_t _toStringOpaqueCallT_V9(
const pd_OpaqueCallT_V9_t* v,
parser_error_t _toStringOpaqueCall_V9(
const pd_OpaqueCall_V9_t* v,
char* outValue,
uint16_t outValueLen,
uint8_t pageIdx,
Expand Down
11 changes: 11 additions & 0 deletions app/src/substrate/substrate_methods_V10.h
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,16 @@ typedef struct {
pd_Call_t call;
} pd_proxy_proxy_V10_t;

#define PD_CALL_MULTISIG_AS_MULTI_V10 1
typedef struct {
pd_u16_t threshold;
pd_VecAccountId_V10_t other_signatories;
pd_OptionTimepoint_V10_t maybe_timepoint;
pd_OpaqueCall_V10_t call;
pd_bool_t store_call;
pd_Weight_V10_t max_weight;
} pd_multisig_as_multi_V10_t;

#define PD_CALL_MULTISIG_APPROVE_AS_MULTI_V10 2
typedef struct {
pd_u16_t threshold;
Expand Down Expand Up @@ -1227,6 +1237,7 @@ typedef union {
pd_system_remark_with_event_V10_t system_remark_with_event_V10;
pd_balances_set_balance_V10_t balances_set_balance_V10;
pd_proxy_proxy_V10_t proxy_proxy_V10;
pd_multisig_as_multi_V10_t multisig_as_multi_V10;
pd_multisig_approve_as_multi_V10_t multisig_approve_as_multi_V10;
pd_multisig_cancel_as_multi_V10_t multisig_cancel_as_multi_V10;
#endif
Expand Down
13 changes: 12 additions & 1 deletion app/src/substrate/substrate_methods_V9.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* (c) 2019 Zondax GmbH
* (c) 2019 - 2022 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -1140,6 +1140,16 @@ typedef struct {
pd_Call_t call;
} pd_proxy_proxy_V9_t;

#define PD_CALL_MULTISIG_AS_MULTI_V9 1
typedef struct {
pd_u16_t threshold;
pd_VecAccountId_V9_t other_signatories;
pd_OptionTimepoint_V9_t maybe_timepoint;
pd_OpaqueCall_V9_t call;
pd_bool_t store_call;
pd_Weight_V9_t max_weight;
} pd_multisig_as_multi_V9_t;

#define PD_CALL_MULTISIG_APPROVE_AS_MULTI_V9 2
typedef struct {
pd_u16_t threshold;
Expand Down Expand Up @@ -1172,6 +1182,7 @@ typedef union {
pd_system_remark_with_event_V9_t system_remark_with_event_V9;
pd_balances_set_balance_V9_t balances_set_balance_V9;
pd_proxy_proxy_V9_t proxy_proxy_V9;
pd_multisig_as_multi_V9_t multisig_as_multi_V9;
pd_multisig_approve_as_multi_V9_t multisig_approve_as_multi_V9;
pd_multisig_cancel_as_multi_V9_t multisig_cancel_as_multi_V9;
#endif
Expand Down
14 changes: 8 additions & 6 deletions app/src/substrate/substrate_types_V10.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,12 @@ parser_error_t _readNextConfigDescriptor_V10(parser_context_t* c, pd_NextConfigD
return parser_not_supported;
}

parser_error_t _readOpaqueCallT_V10(parser_context_t* c, pd_OpaqueCallT_V10_t* v)
parser_error_t _readOpaqueCall_V10(parser_context_t* c, pd_OpaqueCall_V10_t* v)
{
return parser_not_supported;
// Encoded as Byte[], array size comes first
uint8_t size;
CHECK_ERROR(_readUInt8(c, &size))
return _readCall(c, &v->call);
}

parser_error_t _readOverweightIndex_V10(parser_context_t* c, pd_OverweightIndex_V10_t* v)
Expand Down Expand Up @@ -1000,15 +1003,14 @@ parser_error_t _toStringNextConfigDescriptor_V10(
return parser_print_not_supported;
}

parser_error_t _toStringOpaqueCallT_V10(
const pd_OpaqueCallT_V10_t* v,
parser_error_t _toStringOpaqueCall_V10(
const pd_OpaqueCall_V10_t* v,
char* outValue,
uint16_t outValueLen,
uint8_t pageIdx,
uint8_t* pageCount)
{
CLEAN_AND_CHECK()
return parser_print_not_supported;
return _toStringCall(&v->call, outValue, outValueLen, pageIdx, pageCount);
}

parser_error_t _toStringOverweightIndex_V10(
Expand Down
9 changes: 4 additions & 5 deletions app/src/substrate/substrate_types_V10.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ typedef struct {
uint8_t _NOT_IMPLEMENTED__DO_NOT_USE;
} pd_schedulePeriodBlockNumber_V10_t;

typedef struct {
pd_Call_t call;
} pd_OpaqueCall_V10_t;

typedef struct {
uint8_t some;
pd_Timepoint_V10_t contained;
Expand Down Expand Up @@ -271,11 +275,6 @@ typedef struct {
uint8_t _NOT_IMPLEMENTED__DO_NOT_USE;
} pd_NextConfigDescriptor_V10_t;

typedef struct {
// TODO: Not implemented
uint8_t _NOT_IMPLEMENTED__DO_NOT_USE;
} pd_OpaqueCallT_V10_t;

typedef struct {
uint8_t some;
pd_AccountId_V10_t contained;
Expand Down
Loading

0 comments on commit 0203567

Please sign in to comment.