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: Unknown lookup status of a path in certificate yields error #3278

Merged
merged 7 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

# UNRELEASED

### feat: Updated handling of missing values in state tree certificates

The `Unknown` lookup of a path in a certificate results in an `AgentError` (the IC returns `Absent` for non-existing paths).

### fix: dfx deploy urls printed for asset canisters

### chore: --emulator parameter is deprecated and will be discontinued soon
Expand Down
7 changes: 2 additions & 5 deletions src/dfx/src/lib/state_tree/canister_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub async fn read_state_tree_canister_controllers(
.read_state_canister_info(canister_id, "controllers")
.await
{
Err(AgentError::LookupPathUnknown(_) | AgentError::LookupPathAbsent(_)) => {
Err(AgentError::LookupPathAbsent(_)) => {
return Ok(None);
}
r => r.with_context(|| format!("Failed to read controllers of canister {canister_id}."))?,
Expand Down Expand Up @@ -57,10 +57,7 @@ pub async fn read_state_tree_canister_module_hash(
.await
{
Ok(blob) => Some(blob),
// If the canister is empty, this path does not exist.
// The replica doesn't support negative lookups, therefore if the canister
// is empty, the replica will return lookup_path([], Pruned _) = Unknown
Err(AgentError::LookupPathUnknown(_)) | Err(AgentError::LookupPathAbsent(_)) => None,
Err(AgentError::LookupPathAbsent(_)) => None,
Err(x) => bail!(x),
};

Expand Down