Skip to content

feat(nns): Use Some(vec![]) to represent empty args and disallow None - #1088

Merged
jasonz-dfinity merged 2 commits into
masterfrom
jason/install-code-empty-arg
Aug 23, 2024
Merged

jasonz-dfinity merged 2 commits into
masterfrom
jason/install-code-empty-arg

Conversation

@jasonz-dfinity

Copy link
Copy Markdown
Contributor

Why

The predecessor of InstallCode - the NnsCanisterUpgrade function has Vec<u8> as the type of the arg. We should keep this consistency.

What

  • Only hashes the arg if it's not empty, and returns empty string if the arg is empty. It would be more difficult to understand if we return sha256([]) instead
  • Disallow None when submitting the proposal. Since ic0.install_code accepts vec nat8, we don't want to allow 2 ways (Some(vec![]), or None) to represent the same thing.
  • Send vec![] when creating the proposal in ic-admin
  • A minor change to stop truncating wasm_module and arg within the governance crate, since the API type conversion already avoid large fields

@jasonz-dfinity
jasonz-dfinity requested a review from a team as a code owner August 22, 2024 22:38
@github-actions github-actions Bot added the feat label Aug 22, 2024
Comment thread rs/nns/governance/src/pb/conversions.rs Resolved
@jasonz-dfinity
jasonz-dfinity force-pushed the jason/install-code-empty-arg branch from c2ce871 to bf7d8fb Compare August 22, 2024 22:58
@jasonz-dfinity
jasonz-dfinity force-pushed the jason/install-code-empty-arg branch from bf7d8fb to 5562f19 Compare August 22, 2024 23:00
@jasonz-dfinity
jasonz-dfinity added this pull request to the merge queue Aug 23, 2024
Merged via the queue into master with commit b4dffd8 Aug 23, 2024
@jasonz-dfinity
jasonz-dfinity deleted the jason/install-code-empty-arg branch August 23, 2024 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants