Skip to content

Commit 3b1ae1b

Browse files
committed
fix(cardano-blockchain-types): remove validation from cip36 struct
Signed-off-by: bkioshn <[email protected]>
1 parent 0957f71 commit 3b1ae1b

File tree

2 files changed

+4
-35
lines changed

2 files changed

+4
-35
lines changed

rust/cardano-blockchain-types/src/metadata/cip36/mod.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use key_registration::Cip36KeyRegistration;
1111
use minicbor::{Decode, Decoder};
1212
use pallas::ledger::addresses::ShelleyAddress;
1313
use registration_witness::Cip36RegistrationWitness;
14-
use validation::{validate_cip36, Cip36Validation};
14+
use validation::validate_cip36;
1515
use voting_pk::VotingPubKey;
1616

1717
use crate::{MetadatumLabel, MultiEraBlock, TxnIndex};
@@ -25,9 +25,6 @@ pub struct Cip36 {
2525
registration_witness: Cip36RegistrationWitness,
2626
/// Is this a Catalyst strict registration?
2727
is_catalyst_strict: bool,
28-
/// CIP36 validation.
29-
#[allow(dead_code)]
30-
validation: Cip36Validation,
3128
}
3229

3330
impl Cip36 {
@@ -101,14 +98,13 @@ impl Cip36 {
10198
key_registration,
10299
registration_witness,
103100
is_catalyst_strict,
104-
validation,
105101
};
106102

107103
if validation_report.is_empty() {
108104
Ok(cip36)
109105
} else {
110106
// If there are validation errors, the CIP36 is invalid
111-
bail!("CIP-36 validation failed: {cip36:?}, Reports: {validation_report:?}")
107+
bail!("CIP-36 validation failed: {cip36:?}, Validation: {validation:?}, Reports: {validation_report:?}")
112108
}
113109
}
114110

@@ -172,10 +168,4 @@ impl Cip36 {
172168
pub fn is_strict_catalyst(&self) -> bool {
173169
self.is_catalyst_strict
174170
}
175-
176-
/// Get the CIP-36 validation.
177-
#[must_use]
178-
pub fn validation(&self) -> &Cip36Validation {
179-
&self.validation
180-
}
181171
}

rust/cardano-blockchain-types/src/metadata/cip36/validation.rs

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ pub const SIGNDATA_PREAMBLE: [u8; 4] = [0xA1, 0x19, 0xEF, 0x64];
1515
/// Validation value for CIP-36.
1616
#[allow(clippy::struct_excessive_bools, clippy::module_name_repetitions)]
1717
#[derive(Clone, Default, Debug)]
18-
pub struct Cip36Validation {
18+
#[allow(dead_code)]
19+
pub(crate) struct Cip36Validation {
1920
/// Is the signature valid? (signature in 61285)
2021
is_valid_signature: bool,
2122
/// Is the payment address on the correct network?
@@ -26,28 +27,6 @@ pub struct Cip36Validation {
2627
is_valid_purpose: bool,
2728
}
2829

29-
impl Cip36Validation {
30-
/// Is the signature from witness registration valid?
31-
pub fn is_valid_signature(&self) -> bool {
32-
self.is_valid_signature
33-
}
34-
35-
/// Is the payment address network valid?
36-
pub fn is_valid_payment_address_network(&self) -> bool {
37-
self.is_valid_payment_address_network
38-
}
39-
40-
/// Are the voting keys valid?
41-
pub fn is_valid_voting_keys(&self) -> bool {
42-
self.is_valid_voting_keys
43-
}
44-
45-
/// Is the purpose valid?
46-
pub fn is_valid_purpose(&self) -> bool {
47-
self.is_valid_purpose
48-
}
49-
}
50-
5130
/// Validation for CIP-36
5231
/// The validation include the following:
5332
/// * Signature validation of the registration witness 61285 against the stake public key

0 commit comments

Comments
 (0)