Skip to content

Commit

Permalink
Merge branch 'rumenov/drop-statesyncattribute-params' into 'master'
Browse files Browse the repository at this point in the history
chore: remove the state sync attribute type

 

See merge request dfinity-lab/public/ic!11360
  • Loading branch information
rumenov committed Mar 21, 2023
2 parents 8b60ab1 + f139e7f commit 8124bd1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
9 changes: 4 additions & 5 deletions rs/state_manager/src/state_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use ic_logger::{info, warn, ReplicaLogger};
use ic_types::{
artifact::{
Advert, AdvertSendRequest, ArtifactDestination, ArtifactKind, ArtifactTag, Priority,
StateSyncArtifactId, StateSyncAttribute, StateSyncFilter, StateSyncMessage,
StateSyncArtifactId, StateSyncFilter, StateSyncMessage,
},
chunkable::Chunkable,
crypto::crypto_hash,
Expand Down Expand Up @@ -71,7 +71,7 @@ impl ArtifactKind for StateSyncArtifact {
const TAG: ArtifactTag = ArtifactTag::StateSyncArtifact;
type Id = StateSyncArtifactId;
type Message = StateSyncMessage;
type Attribute = StateSyncAttribute;
type Attribute = ();
type Filter = StateSyncFilter;

fn message_to_advert(msg: &StateSyncMessage) -> Advert<StateSyncArtifact> {
Expand All @@ -86,7 +86,7 @@ impl ArtifactKind for StateSyncArtifact {
height: msg.height,
hash: msg.root_hash.clone(),
},
attribute: StateSyncAttribute,
attribute: (),
size: size as usize,
integrity_hash: crypto_hash(msg).get(),
}
Expand Down Expand Up @@ -200,8 +200,7 @@ impl ArtifactClient<StateSyncArtifact> for StateSync {

fn get_priority_function(
&self,
) -> Box<dyn Fn(&StateSyncArtifactId, &StateSyncAttribute) -> Priority + Send + Sync + 'static>
{
) -> Box<dyn Fn(&StateSyncArtifactId, &()) -> Priority + Send + Sync + 'static> {
use ic_interfaces_state_manager::StateReader;

let latest_height = self.state_manager.latest_state_height();
Expand Down
12 changes: 6 additions & 6 deletions rs/state_manager/tests/state_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use ic_test_utilities_logger::with_test_replica_logger;
use ic_test_utilities_metrics::{fetch_int_counter_vec, fetch_int_gauge, Labels};
use ic_test_utilities_tmpdir::tmpdir;
use ic_types::{
artifact::{Priority, StateSyncArtifactId, StateSyncAttribute},
artifact::{Priority, StateSyncArtifactId},
chunkable::ChunkId,
crypto::CryptoHash,
ingress::{IngressState, IngressStatus, WasmResult},
Expand Down Expand Up @@ -1726,7 +1726,7 @@ fn state_sync_priority_fn_respects_states_to_fetch() {
height: height(*h),
hash: hash(*h as u8),
},
&StateSyncAttribute
&()
)
);
}
Expand All @@ -1742,7 +1742,7 @@ fn state_sync_priority_fn_respects_states_to_fetch() {
height: height(3),
hash: hash(3),
},
&StateSyncAttribute
&()
)
);
// Wrong hash
Expand All @@ -1753,7 +1753,7 @@ fn state_sync_priority_fn_respects_states_to_fetch() {
height: height(3),
hash: hash(4),
},
&StateSyncAttribute
&()
)
);

Expand All @@ -1767,7 +1767,7 @@ fn state_sync_priority_fn_respects_states_to_fetch() {
height: height(3),
hash: hash(3),
},
&StateSyncAttribute
&()
)
);
assert_eq!(
Expand All @@ -1777,7 +1777,7 @@ fn state_sync_priority_fn_respects_states_to_fetch() {
height: height(4),
hash: hash(4),
},
&StateSyncAttribute
&()
)
);
});
Expand Down
6 changes: 1 addition & 5 deletions rs/types/types/src/artifact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub enum ArtifactAttribute {
EcdsaMessage(EcdsaMessageAttribute),
CanisterHttpMessage(CanisterHttpResponseAttribute),
FileTreeSync(FileTreeSyncAttribute),
StateSync(StateSyncAttribute),
StateSync(()),
}

/// Artifact identifier type.
Expand Down Expand Up @@ -555,10 +555,6 @@ impl std::hash::Hash for StateSyncMessage {
}
}

/// State sync atrribute.
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct StateSyncAttribute;

/// State sync filter is by height.
#[derive(Default, Clone, Debug, PartialEq, Eq, Hash)]
pub struct StateSyncFilter {
Expand Down

0 comments on commit 8124bd1

Please sign in to comment.