Skip to content

Commit

Permalink
Merge pull request #135 from Zondax/democracy-pallet
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosala authored Apr 25, 2022
2 parents cdda1e7 + 45ef509 commit 5029529
Show file tree
Hide file tree
Showing 71 changed files with 19,588 additions and 19,489 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Ledger Polkadot app
# 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 Down Expand Up @@ -161,9 +161,9 @@ Please:

| Name | Light | XL | Nesting | Arguments |
| :---------- |:------------:|:--------:|:--------:|:--------|
|Propose | | | | `Hash` proposal_hash <br/>`Compactu128` amount <br/> |
|Propose | | :heavy_check_mark: | | `Hash` proposal_hash <br/>`CompactBalance` amount <br/> |
|Second | | :heavy_check_mark: | | `Compactu32` proposal <br/>`Compactu32` seconds_upper_bound <br/> |
|Vote | | | | `Compactu32` ref_index <br/>`AccountVote` vote <br/> |
|Vote | | :heavy_check_mark: | | `Compactu32` ref_index <br/>`AccountVote` 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
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=12
# This is the `spec_version` field of `Runtime`
APPVERSION_N=9190
# This is the patch version of this release
APPVERSION_P=0
APPVERSION_P=1
28 changes: 14 additions & 14 deletions app/src/substrate/substrate_coin.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*******************************************************************************
* (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.
* 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 - 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.
* 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 Down
28 changes: 14 additions & 14 deletions app/src/substrate/substrate_dispatch.c
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*******************************************************************************
* (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.
* 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 - 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.
* 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 Down
28 changes: 14 additions & 14 deletions app/src/substrate/substrate_dispatch.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*******************************************************************************
* (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.
* 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 - 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.
* 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 Down
108 changes: 94 additions & 14 deletions app/src/substrate/substrate_dispatch_V12.c
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*******************************************************************************
* (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.
* 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 - 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.
* 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_V12.h"
#include "substrate_strings.h"
Expand Down Expand Up @@ -369,6 +369,14 @@ __Z_INLINE parser_error_t _readMethod_grandpa_note_stalled_V12(
return parser_ok;
}

__Z_INLINE parser_error_t _readMethod_democracy_propose_V12(
parser_context_t* c, pd_democracy_propose_V12_t* m)
{
CHECK_ERROR(_readHash(c, &m->proposal_hash))
CHECK_ERROR(_readCompactBalance(c, &m->amount))
return parser_ok;
}

__Z_INLINE parser_error_t _readMethod_democracy_second_V12(
parser_context_t* c, pd_democracy_second_V12_t* m)
{
Expand All @@ -377,6 +385,14 @@ __Z_INLINE parser_error_t _readMethod_democracy_second_V12(
return parser_ok;
}

__Z_INLINE parser_error_t _readMethod_democracy_vote_V12(
parser_context_t* c, pd_democracy_vote_V12_t* m)
{
CHECK_ERROR(_readCompactu32(c, &m->ref_index))
CHECK_ERROR(_readAccountVote_V12(c, &m->vote))
return parser_ok;
}

__Z_INLINE parser_error_t _readMethod_democracy_emergency_cancel_V12(
parser_context_t* c, pd_democracy_emergency_cancel_V12_t* m)
{
Expand Down Expand Up @@ -1623,9 +1639,15 @@ parser_error_t _readMethod_V12(
case 2818: /* module 11 call 2 */
CHECK_ERROR(_readMethod_grandpa_note_stalled_V12(c, &method->basic.grandpa_note_stalled_V12))
break;
case 3584: /* module 14 call 0 */
CHECK_ERROR(_readMethod_democracy_propose_V12(c, &method->basic.democracy_propose_V12))
break;
case 3585: /* module 14 call 1 */
CHECK_ERROR(_readMethod_democracy_second_V12(c, &method->basic.democracy_second_V12))
break;
case 3586: /* module 14 call 2 */
CHECK_ERROR(_readMethod_democracy_vote_V12(c, &method->basic.democracy_vote_V12))
break;
case 3587: /* module 14 call 3 */
CHECK_ERROR(_readMethod_democracy_emergency_cancel_V12(c, &method->basic.democracy_emergency_cancel_V12))
break;
Expand Down Expand Up @@ -2260,8 +2282,12 @@ const char* _getMethod_Name_V12_ParserFull(uint16_t callPrivIdx)
return STR_ME_FORCE_APPLY_MIN_COMMISSION;
case 2818: /* module 11 call 2 */
return STR_ME_NOTE_STALLED;
case 3584: /* module 14 call 0 */
return STR_ME_PROPOSE;
case 3585: /* module 14 call 1 */
return STR_ME_SECOND;
case 3586: /* module 14 call 2 */
return STR_ME_VOTE;
case 3587: /* module 14 call 3 */
return STR_ME_EMERGENCY_CANCEL;
case 3588: /* module 14 call 4 */
Expand Down Expand Up @@ -2662,8 +2688,12 @@ uint8_t _getMethod_NumItems_V12(uint8_t moduleIdx, uint8_t callIdx)
return 1;
case 2818: /* module 11 call 2 */
return 2;
case 3584: /* module 14 call 0 */
return 2;
case 3585: /* module 14 call 1 */
return 2;
case 3586: /* module 14 call 2 */
return 2;
case 3587: /* module 14 call 3 */
return 1;
case 3588: /* module 14 call 4 */
Expand Down Expand Up @@ -3330,6 +3360,15 @@ const char* _getMethod_ItemName_V12(uint8_t moduleIdx, uint8_t callIdx, uint8_t
default:
return NULL;
}
case 3584: /* module 14 call 0 */
switch (itemIdx) {
case 0:
return STR_IT_proposal_hash;
case 1:
return STR_IT_amount;
default:
return NULL;
}
case 3585: /* module 14 call 1 */
switch (itemIdx) {
case 0:
Expand All @@ -3339,6 +3378,15 @@ const char* _getMethod_ItemName_V12(uint8_t moduleIdx, uint8_t callIdx, uint8_t
default:
return NULL;
}
case 3586: /* module 14 call 2 */
switch (itemIdx) {
case 0:
return STR_IT_ref_index;
case 1:
return STR_IT_vote;
default:
return NULL;
}
case 3587: /* module 14 call 3 */
switch (itemIdx) {
case 0:
Expand Down Expand Up @@ -5063,6 +5111,21 @@ parser_error_t _getMethod_ItemValue_V12(
default:
return parser_no_data;
}
case 3584: /* module 14 call 0 */
switch (itemIdx) {
case 0: /* democracy_propose_V12 - proposal_hash */;
return _toStringHash(
&m->basic.democracy_propose_V12.proposal_hash,
outValue, outValueLen,
pageIdx, pageCount);
case 1: /* democracy_propose_V12 - amount */;
return _toStringCompactBalance(
&m->basic.democracy_propose_V12.amount,
outValue, outValueLen,
pageIdx, pageCount);
default:
return parser_no_data;
}
case 3585: /* module 14 call 1 */
switch (itemIdx) {
case 0: /* democracy_second_V12 - proposal */;
Expand All @@ -5078,6 +5141,21 @@ parser_error_t _getMethod_ItemValue_V12(
default:
return parser_no_data;
}
case 3586: /* module 14 call 2 */
switch (itemIdx) {
case 0: /* democracy_vote_V12 - ref_index */;
return _toStringCompactu32(
&m->basic.democracy_vote_V12.ref_index,
outValue, outValueLen,
pageIdx, pageCount);
case 1: /* democracy_vote_V12 - vote */;
return _toStringAccountVote_V12(
&m->basic.democracy_vote_V12.vote,
outValue, outValueLen,
pageIdx, pageCount);
default:
return parser_no_data;
}
case 3587: /* module 14 call 3 */
switch (itemIdx) {
case 0: /* democracy_emergency_cancel_V12 - ref_index */;
Expand Down Expand Up @@ -6974,7 +7052,9 @@ bool _getMethod_IsNestingSupported_V12(uint8_t moduleIdx, uint8_t callIdx)
case 2304: // Session:Set keys
case 2305: // Session:Purge keys
case 2818: // Grandpa:Note stalled
case 3584: // Democracy:Propose
case 3585: // Democracy:Second
case 3586: // Democracy:Vote
case 3587: // Democracy:Emergency cancel
case 3588: // Democracy:External propose
case 3589: // Democracy:External propose majority
Expand Down
28 changes: 14 additions & 14 deletions app/src/substrate/substrate_dispatch_V12.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*******************************************************************************
* (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.
* 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 - 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.
* 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 Down
28 changes: 14 additions & 14 deletions app/src/substrate/substrate_functions.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*******************************************************************************
* (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.
* 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 - 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.
* 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 Down
Loading

0 comments on commit 5029529

Please sign in to comment.