-
Notifications
You must be signed in to change notification settings - Fork 331
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nns): Avoid cloning large fields when listing proposals (#3505)
# Why When converting from `ProposalData` to `ProposalInfo`, the large fields (e.g. canister WASMs, logos) are "omitted" in a way that those fields are first cloned then cleared. It indeed saves space in the response by not including them, but the instructions are nevertheless wasted for the clone, and this can be significant for certain queries (e.g. listing only proposals including canister WASMs). # What * Make `ProposalInfo`/`ListProposalInfoResponse` pure API types, by removing its corresponding internal type * Add conversion method `proposal_data_to_info` from the `ProposalData` internal type to `ProposalInfo` API type * Implement the equivalent behavior of `omit_large_fields` in the conversion code * Let `Governance::list_proposals` use the new conversion method and return `ListProposalInfoResponse`(API type) * Update benchmark results (98% improvement on list_proposals) # Tests `rs/nns/governance/tests/governance.rs` already tests various cases for `omit_large_fields`
- Loading branch information
1 parent
aa12bb1
commit 3aa3266
Showing
32 changed files
with
596 additions
and
741 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.