Skip to content

Commit

Permalink
add grandpa
Browse files Browse the repository at this point in the history
  • Loading branch information
abenso committed Nov 6, 2024
1 parent bdc173e commit b9729f3
Show file tree
Hide file tree
Showing 7 changed files with 14,692 additions and 13,044 deletions.
42 changes: 42 additions & 0 deletions app/src/substrate/substrate_dispatch_V1.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,14 @@ __Z_INLINE parser_error_t _readMethod_technicalcommittee_vote_V1(
return parser_ok;
}

__Z_INLINE parser_error_t _readMethod_grandpa_note_stalled_V1(
parser_context_t* c, pd_grandpa_note_stalled_V1_t* m)
{
CHECK_ERROR(_readBlockNumber(c, &m->delay))
CHECK_ERROR(_readBlockNumber(c, &m->best_finalized_block_number))
return parser_ok;
}

__Z_INLINE parser_error_t _readMethod_dataavailability_create_application_key_V1(
parser_context_t* c, pd_dataavailability_create_application_key_V1_t* m)
{
Expand Down Expand Up @@ -943,6 +951,9 @@ parser_error_t _readMethod_V1(
case 3587: /* module 14 call 3 */
CHECK_ERROR(_readMethod_technicalcommittee_vote_V1(c, &method->basic.technicalcommittee_vote_V1))
break;
case 4354: /* module 17 call 2 */
CHECK_ERROR(_readMethod_grandpa_note_stalled_V1(c, &method->basic.grandpa_note_stalled_V1))
break;
case 7424: /* module 29 call 0 */
CHECK_ERROR(_readMethod_dataavailability_create_application_key_V1(c, &method->basic.dataavailability_create_application_key_V1))
break;
Expand Down Expand Up @@ -1091,6 +1102,8 @@ const char* _getMethod_ModuleName_V1(uint8_t moduleIdx)
return STR_MO_SYSTEM;
case 14:
return STR_MO_TECHNICALCOMMITTEE;
case 17:
return STR_MO_GRANDPA;
case 29:
return STR_MO_DATAAVAILABILITY;
case 34:
Expand Down Expand Up @@ -1237,6 +1250,8 @@ const char* _getMethod_Name_V1_ParserFull(uint16_t callPrivIdx)
return STR_ME_PROPOSE;
case 3587: /* module 14 call 3 */
return STR_ME_VOTE;
case 4354: /* module 17 call 2 */
return STR_ME_NOTE_STALLED;
case 7424: /* module 29 call 0 */
return STR_ME_CREATE_APPLICATION_KEY;
case 7425: /* module 29 call 1 */
Expand Down Expand Up @@ -1439,6 +1454,8 @@ uint8_t _getMethod_NumItems_V1(uint8_t moduleIdx, uint8_t callIdx)
return 3;
case 3587: /* module 14 call 3 */
return 3;
case 4354: /* module 17 call 2 */
return 2;
case 7424: /* module 29 call 0 */
return 1;
case 7425: /* module 29 call 1 */
Expand Down Expand Up @@ -1957,6 +1974,15 @@ const char* _getMethod_ItemName_V1(uint8_t moduleIdx, uint8_t callIdx, uint8_t i
default:
return NULL;
}
case 4354: /* module 17 call 2 */
switch (itemIdx) {
case 0:
return STR_IT_delay;
case 1:
return STR_IT_best_finalized_block_number;
default:
return NULL;
}
case 7424: /* module 29 call 0 */
switch (itemIdx) {
case 0:
Expand Down Expand Up @@ -3005,6 +3031,21 @@ parser_error_t _getMethod_ItemValue_V1(
default:
return parser_no_data;
}
case 4354: /* module 17 call 2 */
switch (itemIdx) {
case 0: /* grandpa_note_stalled_V1 - delay */;
return _toStringBlockNumber(
&m->basic.grandpa_note_stalled_V1.delay,
outValue, outValueLen,
pageIdx, pageCount);
case 1: /* grandpa_note_stalled_V1 - best_finalized_block_number */;
return _toStringBlockNumber(
&m->basic.grandpa_note_stalled_V1.best_finalized_block_number,
outValue, outValueLen,
pageIdx, pageCount);
default:
return parser_no_data;
}
case 7424: /* module 29 call 0 */
switch (itemIdx) {
case 0: /* dataavailability_create_application_key_V1 - key */;
Expand Down Expand Up @@ -3736,6 +3777,7 @@ bool _getMethod_IsNestingSupported_V1(uint8_t moduleIdx, uint8_t callIdx)
case 3585: // TechnicalCommittee:Execute
case 3586: // TechnicalCommittee:Propose
case 3587: // TechnicalCommittee:Vote
case 4354: // Grandpa:Note stalled
case 7424: // DataAvailability:Create application key
case 7425: // DataAvailability:Submit data
case 7426: // DataAvailability:Submit block length proposal
Expand Down
8 changes: 8 additions & 0 deletions app/src/substrate/substrate_methods_V1.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ extern "C" {
#define PD_CALL_STAKING_V1 10
#define PD_CALL_SESSION_V1 11
#define PD_CALL_TECHNICALCOMMITTEE_V1 14
#define PD_CALL_GRANDPA_V1 17
#define PD_CALL_DATAAVAILABILITY_V1 29
#define PD_CALL_MULTISIG_V1 34
#define PD_CALL_NOMINATIONPOOLS_V1 36
Expand Down Expand Up @@ -225,6 +226,12 @@ typedef struct {
pd_bool_t approve;
} pd_technicalcommittee_vote_V1_t;

#define PD_CALL_GRANDPA_NOTE_STALLED_V1 2
typedef struct {
pd_BlockNumber_t delay;
pd_BlockNumber_t best_finalized_block_number;
} pd_grandpa_note_stalled_V1_t;

#define PD_CALL_DATAAVAILABILITY_CREATE_APPLICATION_KEY_V1 0
typedef struct {
pd_AppKey_t key;
Expand Down Expand Up @@ -356,6 +363,7 @@ typedef union {
pd_technicalcommittee_execute_V1_t technicalcommittee_execute_V1;
pd_technicalcommittee_propose_V1_t technicalcommittee_propose_V1;
pd_technicalcommittee_vote_V1_t technicalcommittee_vote_V1;
pd_grandpa_note_stalled_V1_t grandpa_note_stalled_V1;
pd_dataavailability_create_application_key_V1_t dataavailability_create_application_key_V1;
pd_dataavailability_submit_data_V1_t dataavailability_submit_data_V1;
pd_dataavailability_submit_block_length_proposal_V1_t dataavailability_submit_block_length_proposal_V1;
Expand Down
7 changes: 6 additions & 1 deletion app/src/substrate/substrate_strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ static const char* STR_MO_BALANCES = "Balances";
static const char* STR_MO_STAKING = "Staking";
static const char* STR_MO_SESSION = "Session";
static const char* STR_MO_TECHNICALCOMMITTEE = "Technicalcommittee";
static const char* STR_MO_GRANDPA = "Grandpa";
static const char* STR_MO_DATAAVAILABILITY = "Dataavailability";
static const char* STR_MO_MULTISIG = "Multisig";
static const char* STR_MO_NOMINATIONPOOLS = "Nominationpools";
Expand Down Expand Up @@ -88,6 +89,7 @@ static const char* STR_ME_SET_MEMBERS = "Set members";
static const char* STR_ME_EXECUTE = "Execute";
static const char* STR_ME_PROPOSE = "Propose";
static const char* STR_ME_VOTE = "Vote";
static const char* STR_ME_NOTE_STALLED = "Note stalled";
static const char* STR_ME_CREATE_APPLICATION_KEY = "Create application key";
static const char* STR_ME_SUBMIT_DATA = "Submit data";
static const char* STR_ME_SUBMIT_BLOCK_LENGTH_PROPOSAL = "Submit block length proposal";
Expand Down Expand Up @@ -175,6 +177,10 @@ static const char* STR_IT_threshold = "Threshold";
static const char* STR_IT_approve = "Approve";
static const char* STR_IT_proposal_hash = "Proposal hash";
static const char* STR_IT_proposal_weight_bound = "Proposal weight bound";
static const char* STR_IT_equivocation_proof = "Equivocation proof";
static const char* STR_IT_key_owner_proof = "Key owner proof";
static const char* STR_IT_delay = "Delay";
static const char* STR_IT_best_finalized_block_number = "Best finalized block number";
static const char* STR_IT_key = "Key";
static const char* STR_IT_data = "Data";
static const char* STR_IT_rows = "Rows";
Expand Down Expand Up @@ -251,7 +257,6 @@ static const char* STR_IT_real = "Real";
static const char* STR_IT_force_proxy_type = "Force proxy type";
static const char* STR_IT_delegate = "Delegate";
static const char* STR_IT_proxy_type = "Proxy type";
static const char* STR_IT_delay = "Delay";
static const char* STR_IT_spawner = "Spawner";
static const char* STR_IT_height = "Height";
static const char* STR_IT_ext_index = "Ext index";
Expand Down
26 changes: 13 additions & 13 deletions docs/supported_1.39.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,22 +117,22 @@

## TechnicalCommittee

| Name | Nano S | Nano S XL | Nano SP/X - Stax | Nesting | Arguments |
| ------------------- | ------ | --------- | ---------------- | ------- | ------------------------------------------------------------------------------------------------------------- |
| Set members | | | | | `VecAccountId`new_members<br/>`OptionAccountId`prime<br/>`MemberCount`old_count<br/> |
| Execute | | | | | `Proposal`proposal<br/>`Compactu32`length_bound<br/> |
| Propose | | | | | `Compactu32`threshold<br/>`Proposal`proposal<br/>`Compactu32`length_bound<br/> |
| Vote | | | | | `Hash`proposal<br/>`Compactu32`index<br/>`bool`approve<br/> |
| Disapprove proposal | | | | | `Hash`proposal_hash<br/> |
| Close | | | | | `Hash`proposal_hash<br/>`Compactu32`index<br/>`Weight`proposal_weight_bound<br/>`Compactu32`length_bound<br/> |
| Name | Nano S | Nano S XL | Nano SP/X - Stax | Nesting | Arguments |
| ------------------- | ------ | ------------------ | ------------------ | ------- | ------------------------------------------------------------------------------------------------------------- |
| Set members | | :heavy_check_mark: | :heavy_check_mark: | | `VecAccountId`new_members<br/>`OptionAccountId`prime<br/>`MemberCount`old_count<br/> |
| Execute | | :heavy_check_mark: | :heavy_check_mark: | | `Proposal`proposal<br/>`Compactu32`length_bound<br/> |
| Propose | | :heavy_check_mark: | :heavy_check_mark: | | `Compactu32`threshold<br/>`Proposal`proposal<br/>`Compactu32`length_bound<br/> |
| Vote | | :heavy_check_mark: | :heavy_check_mark: | | `Hash`proposal<br/>`Compactu32`index<br/>`bool`approve<br/> |
| Disapprove proposal | | | | | `Hash`proposal_hash<br/> |
| Close | | | | | `Hash`proposal_hash<br/>`Compactu32`index<br/>`Weight`proposal_weight_bound<br/>`Compactu32`length_bound<br/> |

## Grandpa

| Name | Nano S | Nano S XL | Nano SP/X - Stax | Nesting | Arguments |
| ---------------------------- | ------ | --------- | ---------------- | ------- | ----------------------------------------------------------------------------------------------- |
| Report equivocation | | | | | `BoxEquivocationProofHashBlockNumber`equivocation_proof<br/>`KeyOwnerProof`key_owner_proof<br/> |
| Report equivocation unsigned | | | | | `BoxEquivocationProofHashBlockNumber`equivocation_proof<br/>`KeyOwnerProof`key_owner_proof<br/> |
| Note stalled | | | | | `BlockNumber`delay<br/>`BlockNumber`best_finalized_block_number<br/> |
| Name | Nano S | Nano S XL | Nano SP/X - Stax | Nesting | Arguments |
| ---------------------------- | ------ | ------------------ | ------------------ | ------- | ----------------------------------------------------------------------------------------------- |
| Report equivocation | | | | | `BoxEquivocationProofHashBlockNumber`equivocation_proof<br/>`KeyOwnerProof`key_owner_proof<br/> |
| Report equivocation unsigned | | | | | `BoxEquivocationProofHashBlockNumber`equivocation_proof<br/>`KeyOwnerProof`key_owner_proof<br/> |
| Note stalled | | :heavy_check_mark: | :heavy_check_mark: | | `BlockNumber`delay<br/>`BlockNumber`best_finalized_block_number<br/> |

## Treasury

Expand Down
10 changes: 5 additions & 5 deletions docs/supported_latest.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@

## Grandpa

| Name | Nano S | Nano S XL | Nano SP/X - Stax | Nesting | Arguments |
| ---------------------------- | ------ | --------- | ---------------- | ------- | ----------------------------------------------------------------------------------------------- |
| Report equivocation | | | | | `BoxEquivocationProofHashBlockNumber`equivocation_proof<br/>`KeyOwnerProof`key_owner_proof<br/> |
| Report equivocation unsigned | | | | | `BoxEquivocationProofHashBlockNumber`equivocation_proof<br/>`KeyOwnerProof`key_owner_proof<br/> |
| Note stalled | | | | | `BlockNumber`delay<br/>`BlockNumber`best_finalized_block_number<br/> |
| Name | Nano S | Nano S XL | Nano SP/X - Stax | Nesting | Arguments |
| ---------------------------- | ------ | ------------------ | ------------------ | ------- | ----------------------------------------------------------------------------------------------- |
| Report equivocation | | | | | `BoxEquivocationProofHashBlockNumber`equivocation_proof<br/>`KeyOwnerProof`key_owner_proof<br/> |
| Report equivocation unsigned | | | | | `BoxEquivocationProofHashBlockNumber`equivocation_proof<br/>`KeyOwnerProof`key_owner_proof<br/> |
| Note stalled | | :heavy_check_mark: | :heavy_check_mark: | | `BlockNumber`delay<br/>`BlockNumber`best_finalized_block_number<br/> |

## Treasury

Expand Down
Loading

0 comments on commit b9729f3

Please sign in to comment.