feat(governance): Batch proposal#9986
feat(governance): Batch proposal#9986daniel-wong-dfinity-org wants to merge 10 commits intomasterfrom
Conversation
1880724 to
0154753
Compare
…h rework mostly consists of deleting execute_nns_function, but also renames.
e9ed13d to
3247831
Compare
cf04996 to
3e45e71
Compare
- Behind flag.
- No; just like for all new proposal types.
- Existing proposals and neurons are fine.
- Asked.
| *self.time_warp.write().unwrap() = new_time_warp; | ||
| } | ||
|
|
||
| fn execute_nns_function( |
There was a problem hiding this comment.
I very much like this change, but I strongly suggest splitting it into a smaller PR.
| @@ -4200,148 +4148,161 @@ impl Governance { | |||
| } | |||
|
|
|||
| async fn perform_action(&mut self, pid: u64, action: ValidProposalAction) { | |||
There was a problem hiding this comment.
We have an existing issue that could be made worse with the batch execution - the execution of a proposal is within the same method execution as everything else (most notably, changing the execution status). That means, if the instruction limit is hit for a synchronous proposal (e.g. manage neuron) and if such proposal execution triggered through deadline, then it will keep trying. I considered this case when disabling "making proposal as part of manage neuron proposal" (cbebf5d).
I haven't gone through all the proposal types, but I suppose for most types it's not an issue. However, I can think of a case - a ManageNeuron proposals with 100 RegisterVote, and each one triggers a lot of following (sadly, for the same reason, the proposal execution triggered by RegisterVote causing an absolute majority, also executes within the RegisterVote message, and vote cascading can be expensive).
Therefore, my suggestion is to change ic_cdk::spawn=>ic_cdk::spawn_migatory (if I understood that correctly, I'm not 100% sure about the behavior of different spawn methods)
| } | ||
| } | ||
|
|
||
| fn try_into_valid_batch(batch: Batch) -> Result<Vec<ValidProposalAction>, GovernanceError> { |
There was a problem hiding this comment.
I would assume the "all actions have the same topic" validation happens somewhere below, but I can't find it.
All sub-actions must have same topic.
Topic is inherited from sub-action(s).
Implementation
To make this work, I (well, Claude, really) had to split
perform_actioninto two separate steps:try_perform_action(new), followed byset_proposal_execution_status(existing)This way,
perform_batchcan calltry_perform_actionfor each sub-action, and NOT set the proposal's final execution status.Furthermore, we also had to make sure that the implementation of every action (called by
try_perform_action) did not try to set the proposal's execution status.In particular, significant rework was needed for
ExecuteNnsFunction. Such rework includes getting rid ofexecute_nns_functionin theEnvironmenttrait. It was just a shitty version ofcall_canister_methodanyway; therefore, deletingexecute_nns_functionis really not as bad as it sounds.References
Closes NNS1-4296.