Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nervous-system): Add crate candid-utils and add proper Candid service argument validation #3488

Merged
merged 3 commits into from
Jan 20, 2025

Conversation

aterga
Copy link
Contributor

@aterga aterga commented Jan 16, 2025

This PR adds a new crate dedicated to Candid utilities that are likely to be useful in multiple places in the mono repo.

First, we add candid_utils::validation::validate_upgrade_args, which takes a full Candid service and checks if a given upgrade argument complies with it, using Candid subtyping. In particular, this function will soon be required in a tool for submitting upgrade proposals for SNS-controlled canisters.

| Next PR >

@github-actions github-actions bot added the feat label Jan 16, 2025
@aterga aterga marked this pull request as ready for review January 16, 2025 23:49
@aterga aterga requested a review from a team as a code owner January 16, 2025 23:49
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

If this pull request affects the behavior of any canister owned by
the Governance team, remember to update the corresponding
unreleased_changes.md file(s).

To acknowldge this reminder (and unblock the PR), dismiss this
code review by going to the bottom of the pull request page, and
supply one of the following reasons:

  1. Done.

  2. No canister behavior changes.

@aterga aterga dismissed github-actions[bot]’s stale review January 16, 2025 23:51

No canister behavior changes.

@aterga aterga enabled auto-merge January 16, 2025 23:51
rs/nervous_system/candid_utils/src/validation.rs Outdated Show resolved Hide resolved
rs/nervous_system/candid_utils/src/validation.rs Outdated Show resolved Hide resolved
rs/nervous_system/candid_utils/src/validation.rs Outdated Show resolved Hide resolved
rs/nervous_system/candid_utils/src/validation/tests.rs Outdated Show resolved Hide resolved
rs/nervous_system/candid_utils/src/validation/tests.rs Outdated Show resolved Hide resolved
rs/nervous_system/candid_utils/src/validation/tests.rs Outdated Show resolved Hide resolved
rs/nervous_system/candid_utils/src/validation.rs Outdated Show resolved Hide resolved
rs/nervous_system/candid_utils/src/validation.rs Outdated Show resolved Hide resolved
rs/nervous_system/candid_utils/src/validation.rs Outdated Show resolved Hide resolved
@aterga aterga added this pull request to the merge queue Jan 20, 2025
Merged via the queue into master with commit da702ec Jan 20, 2025
25 checks passed
@aterga aterga deleted the arshavir/candid-arg-validator branch January 20, 2025 12:15
github-merge-queue bot pushed a commit that referenced this pull request Jan 23, 2025
This PR moves Candid pretty printing into a separate function
`printing::pretty`, adding a few unit tests to specify its expected
behavior.

This function will be used in a new crate that will be added in a
follow-up PR.

< [Previous PR](#3488) | [Next
PR](#3439) >
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.

3 participants