Skip to content

feat(governance): Batch proposal#9986

Open
daniel-wong-dfinity-org wants to merge 10 commits intomasterfrom
composite-proposal-daniel-wong
Open

feat(governance): Batch proposal#9986
daniel-wong-dfinity-org wants to merge 10 commits intomasterfrom
composite-proposal-daniel-wong

Conversation

@daniel-wong-dfinity-org
Copy link
Copy Markdown
Contributor

@daniel-wong-dfinity-org daniel-wong-dfinity-org commented Apr 22, 2026

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_action into two separate steps:

  1. try_perform_action (new), followed by
  2. set_proposal_execution_status (existing)

This way, perform_batch can call try_perform_action for 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 of execute_nns_function in the Environment trait. It was just a shitty version of call_canister_method anyway; therefore, deleting execute_nns_function is really not as bad as it sounds.

References

Closes NNS1-4296.

@daniel-wong-dfinity-org daniel-wong-dfinity-org force-pushed the composite-proposal-daniel-wong branch 2 times, most recently from 1880724 to 0154753 Compare April 23, 2026 13:38
@daniel-wong-dfinity-org daniel-wong-dfinity-org force-pushed the composite-proposal-daniel-wong branch from e9ed13d to 3247831 Compare April 24, 2026 12:37
@daniel-wong-dfinity-org daniel-wong-dfinity-org changed the title Composite proposal daniel wong feat(governance): Batch proposal Apr 24, 2026
@github-actions github-actions Bot added the feat label Apr 24, 2026
@daniel-wong-dfinity-org daniel-wong-dfinity-org marked this pull request as ready for review April 24, 2026 12:47
@daniel-wong-dfinity-org daniel-wong-dfinity-org requested a review from a team as a code owner April 24, 2026 12:47
github-actions[bot]

This comment was marked as resolved.

@daniel-wong-dfinity-org daniel-wong-dfinity-org force-pushed the composite-proposal-daniel-wong branch from cf04996 to 3e45e71 Compare April 24, 2026 13:00
@daniel-wong-dfinity-org daniel-wong-dfinity-org dismissed github-actions[bot]’s stale review April 24, 2026 13:04
  1. Behind flag.
  2. No; just like for all new proposal types.
  3. Existing proposals and neurons are fine.
  4. Asked.
*self.time_warp.write().unwrap() = new_time_warp;
}

fn execute_nns_function(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would assume the "all actions have the same topic" validation happens somewhere below, but I can't find it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants