Skip to content

Commit

Permalink
feat: replace ic-certified-map with ic-certification (#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpeterparker committed Nov 17, 2023
1 parent 615dcaa commit fb1b1eb
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 235 deletions.
31 changes: 11 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/satellite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ serde = "1.0.190"
serde_bytes = "0.11.12"
serde_cbor = "0.11.2"
regex = "1.9.3"
ic-certified-map = "0.4.0"
ic-certification = "1.3.0"
sha2 = "0.10.7"
base64 = "0.13.1"
url = "2.4.0"
Expand Down
9 changes: 4 additions & 5 deletions src/satellite/src/storage/certification/impls.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::storage::certification::constants::{
EXACT_MATCH_TERMINATOR, LABEL_ASSETS_V1, LABEL_ASSETS_V2, WILDCARD_MATCH_TERMINATOR,
};
use crate::storage::certification::tree::merge_hash_trees;
use crate::storage::certification::tree_utils::{
fallback_paths, nested_tree_expr_path, nested_tree_key, nested_tree_path,
};
Expand All @@ -16,7 +15,7 @@ use crate::storage::types::config::StorageConfig;
use crate::storage::types::state::FullPath;
use crate::storage::types::store::Asset;
use crate::storage::url::alternative_paths;
use ic_certified_map::{fork, fork_hash, labeled, labeled_hash, AsHashTree, Hash, HashTree};
use ic_certification::{fork, fork_hash, labeled, labeled_hash, merge_hash_trees, AsHashTree, Hash, HashTree, pruned};
use sha2::{Digest, Sha256};

impl CertifiedAssetHashes {
Expand All @@ -33,7 +32,7 @@ impl CertifiedAssetHashes {
let witness = self.tree_v1.witness(path.as_bytes());
fork(
labeled(LABEL_ASSETS_V1, witness),
HashTree::Pruned(labeled_hash(LABEL_ASSETS_V2, &self.tree_v2.root_hash())),
pruned(labeled_hash(LABEL_ASSETS_V2, &self.tree_v2.root_hash())),
)
}

Expand All @@ -44,7 +43,7 @@ impl CertifiedAssetHashes {
let witness = self.tree_v2.witness(&segments);

fork(
HashTree::Pruned(labeled_hash(LABEL_ASSETS_V1, &self.tree_v1.root_hash())),
pruned(labeled_hash(LABEL_ASSETS_V1, &self.tree_v1.root_hash())),
labeled(LABEL_ASSETS_V2, witness),
)
}
Expand All @@ -68,7 +67,7 @@ impl CertifiedAssetHashes {
});

fork(
HashTree::Pruned(labeled_hash(LABEL_ASSETS_V1, &self.tree_v1.root_hash())),
pruned(labeled_hash(LABEL_ASSETS_V1, &self.tree_v1.root_hash())),
labeled(LABEL_ASSETS_V2, combined_proof),
)
}
Expand Down
1 change: 0 additions & 1 deletion src/satellite/src/storage/certification/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
pub mod cert;
mod constants;
mod impls;
mod tree;
mod tree_utils;
pub mod types;
203 changes: 0 additions & 203 deletions src/satellite/src/storage/certification/tree.rs

This file was deleted.

2 changes: 1 addition & 1 deletion src/satellite/src/storage/certification/tree_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::storage::certification::constants::{
use crate::storage::http::types::{HeaderField, StatusCode};
use crate::storage::types::state::FullPath;
use crate::types::core::Blob;
use ic_certified_map::Hash;
use ic_certification::Hash;
use ic_representation_independent_hash::{representation_independent_hash, Value};
use sha2::{Digest, Sha256};

Expand Down
3 changes: 1 addition & 2 deletions src/satellite/src/storage/certification/types.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
pub mod certified {
use crate::storage::certification::tree::NestedTree;
use crate::types::core::Blob;
use ic_certified_map::{Hash, RbTree};
use ic_certification::{Hash, NestedTree, RbTree};
use std::clone::Clone;

#[derive(Default, Clone)]
Expand Down
4 changes: 2 additions & 2 deletions src/satellite/src/storage/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub mod store {
use crate::storage::types::state::FullPath;
use crate::types::core::{Blob, CollectionKey};
use candid::CandidType;
use ic_certified_map::Hash;
use ic_certification::Hash;
use serde::{Deserialize, Serialize};
use shared::types::state::UserId;
use std::clone::Clone;
Expand Down Expand Up @@ -116,7 +116,7 @@ pub mod store {

pub mod interface {
use candid::{CandidType, Deserialize};
use ic_certified_map::Hash;
use ic_certification::Hash;

use crate::storage::http::types::HeaderField;
use crate::storage::types::state::FullPath;
Expand Down

0 comments on commit fb1b1eb

Please sign in to comment.