From e28f482c64f3061bed7b3b0a8d5e0d2f603995ac Mon Sep 17 00:00:00 2001 From: lisicky Date: Tue, 7 Nov 2023 16:42:49 +0800 Subject: [PATCH] fix committee certs naming --- .../certificates/certificate.rs | 12 +++++----- ...gistration.rs => committee_cold_resign.rs} | 0 ..._registration.rs => committee_hot_auth.rs} | 0 rust/src/protocol_types/certificates/mod.rs | 8 +++---- rust/src/tests/protocol_types/certificates.rs | 24 +++++++++---------- rust/src/tests/serialization/certificates.rs | 8 +++---- 6 files changed, 26 insertions(+), 26 deletions(-) rename rust/src/protocol_types/certificates/{committee_hot_key_deregistration.rs => committee_cold_resign.rs} (100%) rename rust/src/protocol_types/certificates/{committee_hot_key_registration.rs => committee_hot_auth.rs} (100%) diff --git a/rust/src/protocol_types/certificates/certificate.rs b/rust/src/protocol_types/certificates/certificate.rs index 9d9ba08f..dfe49dd6 100644 --- a/rust/src/protocol_types/certificates/certificate.rs +++ b/rust/src/protocol_types/certificates/certificate.rs @@ -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(), )) } @@ -260,14 +260,14 @@ impl Certificate { } } - pub fn as_committee_hot_key_registration(&self) -> Option { + pub fn as_committee_hot_auth(&self) -> Option { match &self.0 { CertificateEnum::CommitteeHotAuth(x) => Some(x.clone()), _ => None, } } - pub fn as_committee_hot_key_deregistration(&self) -> Option { + pub fn as_committee_cold_resign(&self) -> Option { match &self.0 { CertificateEnum::CommitteeColdResign(x) => Some(x.clone()), _ => None, diff --git a/rust/src/protocol_types/certificates/committee_hot_key_deregistration.rs b/rust/src/protocol_types/certificates/committee_cold_resign.rs similarity index 100% rename from rust/src/protocol_types/certificates/committee_hot_key_deregistration.rs rename to rust/src/protocol_types/certificates/committee_cold_resign.rs diff --git a/rust/src/protocol_types/certificates/committee_hot_key_registration.rs b/rust/src/protocol_types/certificates/committee_hot_auth.rs similarity index 100% rename from rust/src/protocol_types/certificates/committee_hot_key_registration.rs rename to rust/src/protocol_types/certificates/committee_hot_auth.rs diff --git a/rust/src/protocol_types/certificates/mod.rs b/rust/src/protocol_types/certificates/mod.rs index 0714273b..57ab6175 100644 --- a/rust/src/protocol_types/certificates/mod.rs +++ b/rust/src/protocol_types/certificates/mod.rs @@ -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::*; diff --git a/rust/src/tests/protocol_types/certificates.rs b/rust/src/tests/protocol_types/certificates.rs index 85dd70c6..27b5a088 100644 --- a/rust/src/tests/protocol_types/certificates.rs +++ b/rust/src/tests/protocol_types/certificates.rs @@ -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] diff --git a/rust/src/tests/serialization/certificates.rs b/rust/src/tests/serialization/certificates.rs index 3f8c4339..1fd065f1 100644 --- a/rust/src/tests/serialization/certificates.rs +++ b/rust/src/tests/serialization/certificates.rs @@ -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() ); } @@ -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() ); } @@ -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() ); } @@ -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() ); }