Skip to content

Commit

Permalink
fix committee certs naming
Browse files Browse the repository at this point in the history
  • Loading branch information
lisicky committed Nov 7, 2023
1 parent 7a618a2 commit e28f482
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
12 changes: 6 additions & 6 deletions rust/src/protocol_types/certificates/certificate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,18 @@ impl Certificate {
}

pub fn new_committee_hot_auth(
committee_hot_key_registration: &CommitteeHotAuth,
committee_hot_auth: &CommitteeHotAuth,
) -> Self {
Self(CertificateEnum::CommitteeHotAuth(
committee_hot_key_registration.clone(),
committee_hot_auth.clone(),
))
}

pub fn new_committee_cold_resign(
committee_hot_key_deregistration: &CommitteeColdResign,
committee_cold_resign: &CommitteeColdResign,
) -> Self {
Self(CertificateEnum::CommitteeColdResign(
committee_hot_key_deregistration.clone(),
committee_cold_resign.clone(),
))
}

Expand Down Expand Up @@ -260,14 +260,14 @@ impl Certificate {
}
}

pub fn as_committee_hot_key_registration(&self) -> Option<CommitteeHotAuth> {
pub fn as_committee_hot_auth(&self) -> Option<CommitteeHotAuth> {
match &self.0 {
CertificateEnum::CommitteeHotAuth(x) => Some(x.clone()),
_ => None,
}
}

pub fn as_committee_hot_key_deregistration(&self) -> Option<CommitteeColdResign> {
pub fn as_committee_cold_resign(&self) -> Option<CommitteeColdResign> {
match &self.0 {
CertificateEnum::CommitteeColdResign(x) => Some(x.clone()),
_ => None,
Expand Down
8 changes: 4 additions & 4 deletions rust/src/protocol_types/certificates/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ pub use stake_vote_registration_and_delegation::*;
mod vote_registration_and_delegation;
pub use vote_registration_and_delegation::*;

mod committee_hot_key_registration;
pub use committee_hot_key_registration::*;
mod committee_hot_auth;
pub use committee_hot_auth::*;

mod committee_hot_key_deregistration;
pub use committee_hot_key_deregistration::*;
mod committee_cold_resign;
pub use committee_cold_resign::*;

mod drep_registration;
pub use drep_registration::*;
Expand Down
24 changes: 12 additions & 12 deletions rust/src/tests/protocol_types/certificates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,41 @@ use crate::tests::mock_objects::{crate_full_pool_params, create_anchor};
use crate::*;

#[test]
fn committee_hot_key_deregistration_setters_getters_test() {
fn committee_cold_resign_setters_getters_test() {
let cred_key_hash = Credential::from_keyhash(&fake_key_hash(1));
let cred_script_hash = Credential::from_scripthash(&fake_script_hash(2));
let committee_hot_key_deregistration_1 = CommitteeColdResign::new(&cred_key_hash);
let committee_cold_resign_1 = CommitteeColdResign::new(&cred_key_hash);

let committee_hot_key_deregistration_2 = CommitteeColdResign::new(&cred_script_hash);
let committee_cold_resign_2 = CommitteeColdResign::new(&cred_script_hash);

assert_eq!(
committee_hot_key_deregistration_1.committee_cold_key(),
committee_cold_resign_1.committee_cold_key(),
cred_key_hash
);
assert!(!committee_hot_key_deregistration_1.has_script_credentials());
assert!(!committee_cold_resign_1.has_script_credentials());
assert_eq!(
committee_hot_key_deregistration_2.committee_cold_key(),
committee_cold_resign_2.committee_cold_key(),
cred_script_hash
);
assert!(committee_hot_key_deregistration_2.has_script_credentials());
assert!(committee_cold_resign_2.has_script_credentials());
}

#[test]
fn committee_hot_key_registration_setters_getters_test() {
fn committee_hot_auth_setters_getters_test() {
let cold_cred_key_hash = Credential::from_keyhash(&fake_key_hash(1));
let hot_cred_key_hash = Credential::from_keyhash(&fake_key_hash(1));
let committee_hot_key_registration =
let committee_hot_auth =
CommitteeHotAuth::new(&cold_cred_key_hash, &hot_cred_key_hash);

assert_eq!(
committee_hot_key_registration.committee_cold_key(),
committee_hot_auth.committee_cold_key(),
cold_cred_key_hash
);
assert_eq!(
committee_hot_key_registration.committee_hot_key(),
committee_hot_auth.committee_hot_key(),
hot_cred_key_hash
);
assert!(!committee_hot_key_registration.has_script_credentials());
assert!(!committee_hot_auth.has_script_credentials());
}

#[test]
Expand Down
8 changes: 4 additions & 4 deletions rust/src/tests/serialization/certificates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn committee_cold_resign_key_hash_ser_round_trip() {
to_from_test!(CommitteeColdResign, cert, cert_wrapped);
assert_eq!(
cert,
cert_wrapped.as_committee_hot_key_deregistration().unwrap()
cert_wrapped.as_committee_cold_resign().unwrap()
);
}

Expand All @@ -54,7 +54,7 @@ fn committee_cold_resign_with_anchor_ser_round_trip() {
to_from_test!(CommitteeColdResign, cert, cert_wrapped);
assert_eq!(
cert,
cert_wrapped.as_committee_hot_key_deregistration().unwrap()
cert_wrapped.as_committee_cold_resign().unwrap()
);
}

Expand All @@ -65,7 +65,7 @@ fn committee_cold_resign_script_hash_ser_round_trip() {
to_from_test!(CommitteeColdResign, cert, cert_wrapped);
assert_eq!(
cert,
cert_wrapped.as_committee_hot_key_deregistration().unwrap()
cert_wrapped.as_committee_cold_resign().unwrap()
);
}

Expand All @@ -79,7 +79,7 @@ fn committee_hot_auth_ser_round_trip() {
to_from_test!(CommitteeHotAuth, cert, cert_wrapped);
assert_eq!(
cert,
cert_wrapped.as_committee_hot_key_registration().unwrap()
cert_wrapped.as_committee_hot_auth().unwrap()
);
}

Expand Down

0 comments on commit e28f482

Please sign in to comment.