Skip to content

Commit

Permalink
fix(rust/cardano-blockchain-types): remove hashes.rs and `conversio…
Browse files Browse the repository at this point in the history
…n.rs` (#152)

* fix(cardano-blockchain-types): remove hashes.rs and conversion.rs

Signed-off-by: bkioshn <[email protected]>

* fix(cardano-blockchain-types): use cat-types

Signed-off-by: bkioshn <[email protected]>

* fix(cardano-blockchain-types): remove unused dep

Signed-off-by: bkioshn <[email protected]>

* fix(cardano-blockchain-types): format

Signed-off-by: bkioshn <[email protected]>

* fix(cardano-blockchain-types): doctest

Signed-off-by: bkioshn <[email protected]>

---------

Signed-off-by: bkioshn <[email protected]>
  • Loading branch information
bkioshn authored Jan 16, 2025
1 parent de369c5 commit 3381c5b
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 212 deletions.
1 change: 0 additions & 1 deletion rust/cardano-blockchain-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ workspace = true

[dependencies]
pallas = { version = "0.30.1", git = "https://github.com/input-output-hk/catalyst-pallas.git", rev = "9b5183c8b90b90fe2cc319d986e933e9518957b3" }
pallas-crypto = { version = "0.30.1", git = "https://github.com/input-output-hk/catalyst-pallas.git", rev = "9b5183c8b90b90fe2cc319d986e933e9518957b3" }
# pallas-hardano = { version = "0.30.1", git = "https://github.com/input-output-hk/catalyst-pallas.git", rev = "9b5183c8b90b90fe2cc319d986e933e9518957b3" }
cbork-utils = { version = "0.0.1", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "v0.0.11" }
catalyst-types = { version = "0.0.1", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "r20250108-00" }
Expand Down
2 changes: 1 addition & 1 deletion rust/cardano-blockchain-types/src/auxdata/metadatum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
use std::sync::Arc;

use catalyst_types::conversion::from_saturating;
use dashmap::DashMap;
use minicbor::Decode;

use super::{metadatum_label::MetadatumLabel, metadatum_value::MetadatumValue};
use crate::conversion::from_saturating;

/// Transaction Metadata
/// See: <https://github.com/IntersectMBO/cardano-ledger/blob/78b32d585fd4a0340fb2b184959fb0d46f32c8d2/eras/conway/impl/cddl-files/conway.cddl#L519>
Expand Down
55 changes: 0 additions & 55 deletions rust/cardano-blockchain-types/src/conversion.rs

This file was deleted.

2 changes: 1 addition & 1 deletion rust/cardano-blockchain-types/src/fork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use std::fmt;

use crate::conversion::from_saturating;
use catalyst_types::conversion::from_saturating;

#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd)]
/// Counter that is incremented every time there is a roll-back in live-chain.
Expand Down
144 changes: 0 additions & 144 deletions rust/cardano-blockchain-types/src/hashes.rs

This file was deleted.

2 changes: 0 additions & 2 deletions rust/cardano-blockchain-types/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
//! Catalyst Enhanced `MultiEraBlock` Structures
mod auxdata;
pub mod conversion;
mod fork;
pub mod hashes;
mod metadata;
mod multi_era_block_data;
mod network;
Expand Down
3 changes: 2 additions & 1 deletion rust/cardano-blockchain-types/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
use std::{ffi::OsStr, path::PathBuf};

use catalyst_types::conversion::from_saturating;
use chrono::{DateTime, Utc};
use pallas::{
ledger::traverse::wellknown::GenesisValues,
Expand All @@ -11,7 +12,7 @@ use pallas::{
// use strum_macros;
use tracing::debug;

use crate::{conversion::from_saturating, Slot};
use crate::Slot;

/// Default name of the executable if we can't derive it.
pub(crate) const DEFAULT_EXE_NAME: &str = "cardano_chain_follower";
Expand Down
10 changes: 7 additions & 3 deletions rust/cardano-blockchain-types/src/point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ use std::{
fmt::{Debug, Display, Formatter},
};

use catalyst_types::hashes::Blake2b256Hash;
use pallas::crypto::hash::Hash;

use crate::{hashes::Blake2b256Hash, Slot};
use crate::Slot;

/// A specific point in the blockchain. It can be used to
/// identify a particular location within the blockchain, such as the tip (the
Expand Down Expand Up @@ -279,7 +280,8 @@ impl Point {
/// # Examples
///
/// ```
/// use cardano_blockchain_types::{hashes::Blake2b256Hash, Point};
/// use cardano_blockchain_types::Point;
/// use catalyst_types::hashes::Blake2b256Hash;
///
/// let specific_point = Point::new(42.into(), [0; 32].into());
/// assert_eq!(
Expand Down Expand Up @@ -489,7 +491,9 @@ fn cmp_point(

#[cfg(test)]
mod tests {
use crate::{hashes::Blake2bHash, point::*};
use catalyst_types::hashes::Blake2bHash;

use crate::point::*;

#[test]
fn test_cmp_hash_simple() {
Expand Down
3 changes: 1 addition & 2 deletions rust/cardano-blockchain-types/src/slot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ use std::{
ops::{MulAssign, Sub},
};

use catalyst_types::conversion::from_saturating;
use num_bigint::{BigInt, Sign};
use serde::Serialize;

use crate::conversion::from_saturating;

#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Default, Serialize)]

/// Slot on the blockchain, typically one slot equals one second. However chain
Expand Down
2 changes: 1 addition & 1 deletion rust/cardano-blockchain-types/src/txn_index.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Transaction Index
use crate::conversion::from_saturating;
use catalyst_types::conversion::from_saturating;

/// Transaction index within a block
/// See: <https://github.com/IntersectMBO/cardano-ledger/blob/78b32d585fd4a0340fb2b184959fb0d46f32c8d2/eras/conway/impl/cddl-files/conway.cddl#L20C1-L20C33>
Expand Down
3 changes: 2 additions & 1 deletion rust/cardano-blockchain-types/src/txn_witness.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
//! Transaction Witness
use std::fmt::{Display, Formatter};

use catalyst_types::{conversion::vkey_from_bytes, hashes::Blake2b224Hash};
use dashmap::{DashMap, DashSet};
use ed25519_dalek::VerifyingKey;
use pallas::ledger::traverse::MultiEraTx;

use crate::{conversion::vkey_from_bytes, hashes::Blake2b224Hash, TxnIndex};
use crate::TxnIndex;

/// Hash of a witness verifying public key
pub type VKeyHash = Blake2b224Hash;
Expand Down

0 comments on commit 3381c5b

Please sign in to comment.