Skip to content

Commit

Permalink
add scheduleAfter
Browse files Browse the repository at this point in the history
  • Loading branch information
abenso committed Nov 7, 2024
1 parent 1efbd35 commit 77b7544
Show file tree
Hide file tree
Showing 11 changed files with 13,526 additions and 13,801 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,14 @@ Please:

## Scheduler

| Name | Nano S | Nano S XL | Nano SP/X - Stax | Nesting | Arguments |
| -------------------- | ------ | --------- | ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| Schedule | | | | | `BlockNumber`when<br/>`OptionschedulePeriodBlockNumber`maybe_periodic<br/>`schedulePriority`priority<br/>`Call`call<br/> |
| Cancel | | | | | `BlockNumber`when<br/>`u32`index<br/> |
| Schedule named | | | | | `TaskName`id<br/>`BlockNumber`when<br/>`OptionschedulePeriodBlockNumber`maybe_periodic<br/>`schedulePriority`priority<br/>`Call`call<br/> |
| Cancel named | | | | | `TaskName`id<br/> |
| Schedule after | | | | | `BlockNumber`after<br/>`OptionschedulePeriodBlockNumber`maybe_periodic<br/>`schedulePriority`priority<br/>`Call`call<br/> |
| Schedule named after | | | | | `TaskName`id<br/>`BlockNumber`after<br/>`OptionschedulePeriodBlockNumber`maybe_periodic<br/>`schedulePriority`priority<br/>`Call`call<br/> |
| Name | Nano S | Nano S XL | Nano SP/X - Stax | Nesting | Arguments |
| -------------------- | ------ | ------------------ | ------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| Schedule | | | | | `BlockNumber`when<br/>`OptionschedulePeriodBlockNumber`maybe_periodic<br/>`schedulePriority`priority<br/>`Call`call<br/> |
| Cancel | | | | | `BlockNumber`when<br/>`u32`index<br/> |
| Schedule named | | | | | `TaskName`id<br/>`BlockNumber`when<br/>`OptionschedulePeriodBlockNumber`maybe_periodic<br/>`schedulePriority`priority<br/>`Call`call<br/> |
| Cancel named | | | | | `TaskName`id<br/> |
| Schedule after | | :heavy_check_mark: | :heavy_check_mark: | | `BlockNumber`after<br/>`OptionschedulePeriodBlockNumber`maybe_periodic<br/>`schedulePriority`priority<br/>`Call`call<br/> |
| Schedule named after | | | | | `TaskName`id<br/>`BlockNumber`after<br/>`OptionschedulePeriodBlockNumber`maybe_periodic<br/>`schedulePriority`priority<br/>`Call`call<br/> |

## DataAvailability

Expand Down
58 changes: 58 additions & 0 deletions app/src/substrate/substrate_dispatch_V1.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,16 @@ __Z_INLINE parser_error_t _readMethod_grandpa_note_stalled_V1(
return parser_ok;
}

__Z_INLINE parser_error_t _readMethod_scheduler_schedule_after_V1(
parser_context_t* c, pd_scheduler_schedule_after_V1_t* m)
{
CHECK_ERROR(_readBlockNumber(c, &m->after))
CHECK_ERROR(_readOptionschedulePeriodBlockNumber(c, &m->maybe_periodic))
CHECK_ERROR(_readschedulePriority(c, &m->priority))
CHECK_ERROR(_readCall(c, &m->call))
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 @@ -961,6 +971,9 @@ parser_error_t _readMethod_V1(
case 4354: /* module 17 call 2 */
CHECK_ERROR(_readMethod_grandpa_note_stalled_V1(c, &method->basic.grandpa_note_stalled_V1))
break;
case 6148: /* module 24 call 4 */
CHECK_ERROR(_readMethod_scheduler_schedule_after_V1(c, &method->basic.scheduler_schedule_after_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 @@ -1114,6 +1127,8 @@ const char* _getMethod_ModuleName_V1(uint8_t moduleIdx)
return STR_MO_TECHNICALCOMMITTEE;
case 17:
return STR_MO_GRANDPA;
case 24:
return STR_MO_SCHEDULER;
case 29:
return STR_MO_DATAAVAILABILITY;
case 34:
Expand Down Expand Up @@ -1264,6 +1279,8 @@ const char* _getMethod_Name_V1_ParserFull(uint16_t callPrivIdx)
return STR_ME_VOTE;
case 4354: /* module 17 call 2 */
return STR_ME_NOTE_STALLED;
case 6148: /* module 24 call 4 */
return STR_ME_SCHEDULE_AFTER;
case 7424: /* module 29 call 0 */
return STR_ME_CREATE_APPLICATION_KEY;
case 7425: /* module 29 call 1 */
Expand Down Expand Up @@ -1470,6 +1487,8 @@ uint8_t _getMethod_NumItems_V1(uint8_t moduleIdx, uint8_t callIdx)
return 3;
case 4354: /* module 17 call 2 */
return 2;
case 6148: /* module 24 call 4 */
return 4;
case 7424: /* module 29 call 0 */
return 1;
case 7425: /* module 29 call 1 */
Expand Down Expand Up @@ -1999,6 +2018,19 @@ const char* _getMethod_ItemName_V1(uint8_t moduleIdx, uint8_t callIdx, uint8_t i
default:
return NULL;
}
case 6148: /* module 24 call 4 */
switch (itemIdx) {
case 0:
return STR_IT_after;
case 1:
return STR_IT_maybe_periodic;
case 2:
return STR_IT_priority;
case 3:
return STR_IT_call;
default:
return NULL;
}
case 7424: /* module 29 call 0 */
switch (itemIdx) {
case 0:
Expand Down Expand Up @@ -3069,6 +3101,31 @@ parser_error_t _getMethod_ItemValue_V1(
default:
return parser_no_data;
}
case 6148: /* module 24 call 4 */
switch (itemIdx) {
case 0: /* scheduler_schedule_after_V1 - after */;
return _toStringBlockNumber(
&m->basic.scheduler_schedule_after_V1.after,
outValue, outValueLen,
pageIdx, pageCount);
case 1: /* scheduler_schedule_after_V1 - maybe_periodic */;
return _toStringOptionschedulePeriodBlockNumber(
&m->basic.scheduler_schedule_after_V1.maybe_periodic,
outValue, outValueLen,
pageIdx, pageCount);
case 2: /* scheduler_schedule_after_V1 - priority */;
return _toStringschedulePriority(
&m->basic.scheduler_schedule_after_V1.priority,
outValue, outValueLen,
pageIdx, pageCount);
case 3: /* scheduler_schedule_after_V1 - call */;
return _toStringCall(
&m->basic.scheduler_schedule_after_V1.call,
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 @@ -3811,6 +3868,7 @@ bool _getMethod_IsNestingSupported_V1(uint8_t moduleIdx, uint8_t callIdx)
case 3586: // TechnicalCommittee:Propose
case 3587: // TechnicalCommittee:Vote
case 4354: // Grandpa:Note stalled
case 6148: // Scheduler:Schedule after
case 7424: // DataAvailability:Create application key
case 7425: // DataAvailability:Submit data
case 7426: // DataAvailability:Submit block length proposal
Expand Down
24 changes: 24 additions & 0 deletions app/src/substrate/substrate_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ parser_error_t _readVecBytes(parser_context_t* c, pd_VecBytes_t* v);
parser_error_t _readVecTupleDataData(parser_context_t* c, pd_VecTupleDataData_t* v);
parser_error_t _readWeightFee(parser_context_t* c, pd_WeightFee_t* v);
parser_error_t _readWeightMaximumFee(parser_context_t* c, pd_WeightMaximumFee_t* v);
parser_error_t _readschedulePeriodBlockNumber(parser_context_t* c, pd_schedulePeriodBlockNumber_t* v);
parser_error_t _readAddressedMessage(parser_context_t* c, pd_AddressedMessage_t* v);
parser_error_t _readBondExtraBalanceOfT(parser_context_t* c, pd_BondExtraBalanceOfT_t* v);
parser_error_t _readCommissionChangeRateBlockNumber(parser_context_t* c, pd_CommissionChangeRateBlockNumber_t* v);
Expand Down Expand Up @@ -90,12 +91,14 @@ parser_error_t _readKeys(parser_context_t* c, pd_Keys_t* v);
parser_error_t _readMemberCount(parser_context_t* c, pd_MemberCount_t* v);
parser_error_t _readOptionAccountId(parser_context_t* c, pd_OptionAccountId_t* v);
parser_error_t _readOptionProxyType(parser_context_t* c, pd_OptionProxyType_t* v);
parser_error_t _readOptionschedulePeriodBlockNumber(parser_context_t* c, pd_OptionschedulePeriodBlockNumber_t* v);
parser_error_t _readPage(parser_context_t* c, pd_Page_t* v);
parser_error_t _readPoolId(parser_context_t* c, pd_PoolId_t* v);
parser_error_t _readPoolState(parser_context_t* c, pd_PoolState_t* v);
parser_error_t _readVecAccountId(parser_context_t* c, pd_VecAccountId_t* v);
parser_error_t _readVecu32(parser_context_t* c, pd_Vecu32_t* v);
parser_error_t _readVecu8(parser_context_t* c, pd_Vecu8_t* v);
parser_error_t _readschedulePriority(parser_context_t* c, pd_schedulePriority_t* v);

// Common toString functions

Expand Down Expand Up @@ -337,6 +340,13 @@ parser_error_t _toStringWeightMaximumFee(
uint8_t pageIdx,
uint8_t* pageCount);

parser_error_t _toStringschedulePeriodBlockNumber(
const pd_schedulePeriodBlockNumber_t* v,
char* outValue,
uint16_t outValueLen,
uint8_t pageIdx,
uint8_t* pageCount);

parser_error_t _toStringAddressedMessage(
const pd_AddressedMessage_t* v,
char* outValue,
Expand Down Expand Up @@ -547,6 +557,13 @@ parser_error_t _toStringOptionProxyType(
uint8_t pageIdx,
uint8_t* pageCount);

parser_error_t _toStringOptionschedulePeriodBlockNumber(
const pd_OptionschedulePeriodBlockNumber_t* v,
char* outValue,
uint16_t outValueLen,
uint8_t pageIdx,
uint8_t* pageCount);

parser_error_t _toStringPage(
const pd_Page_t* v,
char* outValue,
Expand Down Expand Up @@ -589,6 +606,13 @@ parser_error_t _toStringVecu8(
uint8_t pageIdx,
uint8_t* pageCount);

parser_error_t _toStringschedulePriority(
const pd_schedulePriority_t* v,
char* outValue,
uint16_t outValueLen,
uint8_t pageIdx,
uint8_t* pageCount);

#ifdef __cplusplus
}
#endif
10 changes: 10 additions & 0 deletions app/src/substrate/substrate_methods_V1.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ extern "C" {
#define PD_CALL_SESSION_V1 11
#define PD_CALL_TECHNICALCOMMITTEE_V1 14
#define PD_CALL_GRANDPA_V1 17
#define PD_CALL_SCHEDULER_V1 24
#define PD_CALL_DATAAVAILABILITY_V1 29
#define PD_CALL_MULTISIG_V1 34
#define PD_CALL_NOMINATIONPOOLS_V1 36
Expand Down Expand Up @@ -233,6 +234,14 @@ typedef struct {
pd_BlockNumber_t best_finalized_block_number;
} pd_grandpa_note_stalled_V1_t;

#define PD_CALL_SCHEDULER_SCHEDULE_AFTER_V1 4
typedef struct {
pd_BlockNumber_t after;
pd_OptionschedulePeriodBlockNumber_t maybe_periodic;
pd_schedulePriority_t priority;
pd_Call_t call;
} pd_scheduler_schedule_after_V1_t;

#define PD_CALL_DATAAVAILABILITY_CREATE_APPLICATION_KEY_V1 0
typedef struct {
pd_AppKey_t key;
Expand Down Expand Up @@ -370,6 +379,7 @@ typedef union {
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_scheduler_schedule_after_V1_t scheduler_schedule_after_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: 7 additions & 0 deletions app/src/substrate/substrate_strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ static const char* STR_MO_STAKING = "Staking";
static const char* STR_MO_SESSION = "Session";
static const char* STR_MO_TECHNICALCOMMITTEE = "Technicalcommittee";

Check notice

Code scanning / CodeQL

Unused static variable Note

Static variable STR_MO_TECHNICALCOMMITTEE is never read.
static const char* STR_MO_GRANDPA = "Grandpa";

Check notice

Code scanning / CodeQL

Unused static variable Note

Static variable STR_MO_GRANDPA is never read.
static const char* STR_MO_SCHEDULER = "Scheduler";

Check notice

Code scanning / CodeQL

Unused static variable Note

Static variable STR_MO_SCHEDULER is never read.
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 @@ -91,6 +92,7 @@ static const char* STR_ME_EXECUTE = "Execute";
static const char* STR_ME_PROPOSE = "Propose";

Check notice

Code scanning / CodeQL

Unused static variable Note

Static variable STR_ME_PROPOSE is never read.
static const char* STR_ME_VOTE = "Vote";

Check notice

Code scanning / CodeQL

Unused static variable Note

Static variable STR_ME_VOTE is never read.
static const char* STR_ME_NOTE_STALLED = "Note stalled";

Check notice

Code scanning / CodeQL

Unused static variable Note

Static variable STR_ME_NOTE_STALLED is never read.
static const char* STR_ME_SCHEDULE_AFTER = "Schedule after";

Check notice

Code scanning / CodeQL

Unused static variable Note

Static variable STR_ME_SCHEDULE_AFTER is never read.
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 @@ -183,6 +185,11 @@ static const char* STR_IT_equivocation_proof = "Equivocation proof";
static const char* STR_IT_key_owner_proof = "Key owner proof";

Check notice

Code scanning / CodeQL

Unused static variable Note

Static variable STR_IT_key_owner_proof is never read.
static const char* STR_IT_delay = "Delay";

Check notice

Code scanning / CodeQL

Unused static variable Note

Static variable STR_IT_delay is never read.
static const char* STR_IT_best_finalized_block_number = "Best finalized block number";

Check notice

Code scanning / CodeQL

Unused static variable Note

Static variable STR_IT_best_finalized_block_number is never read.
static const char* STR_IT_when = "When";

Check notice

Code scanning / CodeQL

Unused static variable Note

Static variable STR_IT_when is never read.
static const char* STR_IT_maybe_periodic = "Maybe periodic";

Check notice

Code scanning / CodeQL

Unused static variable Note

Static variable STR_IT_maybe_periodic is never read.
static const char* STR_IT_priority = "Priority";

Check notice

Code scanning / CodeQL

Unused static variable Note

Static variable STR_IT_priority is never read.
static const char* STR_IT_id = "Id";

Check notice

Code scanning / CodeQL

Unused static variable Note

Static variable STR_IT_id is never read.
static const char* STR_IT_after = "After";

Check notice

Code scanning / CodeQL

Unused static variable Note

Static variable STR_IT_after is never read.
static const char* STR_IT_key = "Key";
static const char* STR_IT_data = "Data";
static const char* STR_IT_rows = "Rows";
Expand Down
Loading

0 comments on commit 77b7544

Please sign in to comment.