Skip to content

test: adds custom network #420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft
9 changes: 5 additions & 4 deletions rust/cardano-blockchain-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ crate-type = ["cdylib", "rlib"]
workspace = true

[dependencies]
pallas = { version = "0.33.0" }
# pallas-hardano = { version = "0.33.0" }
catalyst-types = { version = "0.0.5", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "catalyst-types-v0.0.5" }
cbork-utils = { version = "0.0.2", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "cbork-utils-v0.0.2" }
pallas = { version = "0.33.0", git = "https://github.com/input-output-hk/catalyst-pallas.git", branch = "test/testnet-genesis-values", package = "pallas" }
# pallas-hardano = { version = "0.33.0", git = "https://github.com/input-output-hk/catalyst-pallas.git", branch = "test/testnet-genesis-values" }
catalyst-types = { version = "0.0.5", git = "https://github.com/input-output-hk/catalyst-libs.git", branch = "test/adds-custom-network" }
cbork-utils = { version = "0.0.2", git = "https://github.com/input-output-hk/catalyst-libs.git", branch = "test/adds-custom-network" }


ouroboros = "0.18.4"
tracing = "0.1.41"
Expand Down
1 change: 1 addition & 0 deletions rust/cardano-blockchain-types/src/data/devnet-genesis.vkey
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5b33322c3235332c3138362c3230312c3137372c31312c3131372c3133352c3138372c3136372c3138312c3138382c32322c35392c3230362c3130352c3233312c3135302c3231352c33302c37382c3231322c37362c31362c3235322c3138302c37322c3133342c3133372c3234372c3136312c36385d
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl Cip36 {

let valid = match self.network {
Network::Mainnet => network_tag.value() == 1,
Network::Preprod | Network::Preview => network_tag.value() == 0,
Network::Preprod | Network::Preview | Network::Devnet => network_tag.value() == 0,
};

// Report invalid network tag if necessary
Expand Down
20 changes: 18 additions & 2 deletions rust/cardano-blockchain-types/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use catalyst_types::conversion::from_saturating;
use chrono::{DateTime, Utc};
use pallas::{
ledger::{addresses::Network as PallasNetwork, traverse::wellknown::GenesisValues},
network::miniprotocols::{MAINNET_MAGIC, PREVIEW_MAGIC, PRE_PRODUCTION_MAGIC},
network::miniprotocols::{MAINNET_MAGIC, PREVIEW_MAGIC, PRE_PRODUCTION_MAGIC, TESTNET_MAGIC},
};
use tracing::debug;

Expand Down Expand Up @@ -45,6 +45,8 @@ pub enum Network {
Preprod = 1,
/// Cardano preview network.
Preview = 2,
/// Cardano testnet network.
Devnet = 3
}

// Mainnet Defaults.
Expand Down Expand Up @@ -74,6 +76,15 @@ const DEFAULT_PREVIEW_MITHRIL_GENESIS_KEY: &str = include_str!("data/preview-gen
const DEFAULT_PREVIEW_MITHRIL_AGGREGATOR: &str =
"https://aggregator.pre-release-preview.api.mithril.network/aggregator";

// Devnet Defaults
/// Devnet Default Public Cardano Relay.
const DEFAULT_DEVNET_RELAY: &str = "127.0.0.1:3001";
/// Preprod network Mithril Signature genesis vkey.
const DEFAULT_DEVNET_MITHRIL_GENESIS_KEY: &str = include_str!("data/devnet-genesis.vkey");
/// Default Mithril Aggregator to use.
const DEFAULT_DEVNET_MITHRIL_AGGREGATOR: &str =
"http://localhost:8080/aggregator";

impl Network {
/// Get the default Relay for a blockchain network.
#[must_use]
Expand All @@ -82,6 +93,7 @@ impl Network {
Network::Mainnet => DEFAULT_MAINNET_RELAY.to_string(),
Network::Preprod => DEFAULT_PREPROD_RELAY.to_string(),
Network::Preview => DEFAULT_PREVIEW_RELAY.to_string(),
Network::Devnet => DEFAULT_DEVNET_RELAY.to_string(),
}
}

Expand All @@ -92,6 +104,7 @@ impl Network {
Network::Mainnet => DEFAULT_MAINNET_MITHRIL_AGGREGATOR.to_string(),
Network::Preprod => DEFAULT_PREPROD_MITHRIL_AGGREGATOR.to_string(),
Network::Preview => DEFAULT_PREVIEW_MITHRIL_AGGREGATOR.to_string(),
Network::Devnet => DEFAULT_DEVNET_MITHRIL_AGGREGATOR.to_string(),
}
}

Expand All @@ -102,6 +115,7 @@ impl Network {
Network::Mainnet => DEFAULT_MAINNET_MITHRIL_GENESIS_KEY.to_string(),
Network::Preprod => DEFAULT_PREPROD_MITHRIL_GENESIS_KEY.to_string(),
Network::Preview => DEFAULT_PREVIEW_MITHRIL_GENESIS_KEY.to_string(),
Network::Devnet => DEFAULT_DEVNET_MITHRIL_GENESIS_KEY.to_string(),
}
}

Expand Down Expand Up @@ -155,6 +169,7 @@ impl Network {
Network::Mainnet => GenesisValues::mainnet(),
Network::Preprod => GenesisValues::preprod(),
Network::Preview => GenesisValues::preview(),
Network::Devnet => GenesisValues::testnet(),
}
}

Expand Down Expand Up @@ -221,6 +236,7 @@ impl From<Network> for u64 {
Network::Mainnet => MAINNET_MAGIC,
Network::Preprod => PRE_PRODUCTION_MAGIC,
Network::Preview => PREVIEW_MAGIC,
Network::Devnet => TESTNET_MAGIC,
}
}
}
Expand All @@ -229,7 +245,7 @@ impl From<Network> for PallasNetwork {
fn from(value: Network) -> Self {
match value {
Network::Mainnet => PallasNetwork::Mainnet,
Network::Preprod | Network::Preview => PallasNetwork::Testnet,
Network::Preprod | Network::Preview | Network::Devnet => PallasNetwork::Testnet,
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions rust/cardano-chain-follower/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ license.workspace = true
workspace = true

[dependencies]
pallas = { version = "0.33.0" }
pallas-hardano = { version = "0.33.0" }
pallas-crypto = { version = "0.33.0" }
pallas = {version = "0.33.0", git = "https://github.com/input-output-hk/catalyst-pallas.git", branch = "test/testnet-genesis-values" }
pallas-hardano = {version = "0.33.0", git = "https://github.com/input-output-hk/catalyst-pallas.git", branch = "test/testnet-genesis-values" }
pallas-crypto = {version = "0.33.0", git = "https://github.com/input-output-hk/catalyst-pallas.git", branch = "test/testnet-genesis-values" }

mithril-client = { version = "0.12.2", default-features = false, features = [
"full",
"num-integer-backend",
] }

cardano-blockchain-types = { version = "0.0.5", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "cardano-blockchain-types-v0.0.5" }
catalyst-types = { version = "0.0.5", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "catalyst-types-v0.0.5" }
cardano-blockchain-types = { version = "0.0.5", git = "https://github.com/input-output-hk/catalyst-libs.git", branch = "test/adds-custom-network" }
catalyst-types = { version = "0.0.5", git = "https://github.com/input-output-hk/catalyst-libs.git", branch = "test/adds-custom-network"}


thiserror = "1.0.69"
Expand Down Expand Up @@ -65,7 +65,7 @@ test-log = { version = "0.2.16", default-features = false, features = [
"trace",
] }
clap = "4.5.23"
rbac-registration = { version = "0.0.6", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "rbac-registration-v0.0.6" }
rbac-registration = { version = "0.0.6", git = "https://github.com/input-output-hk/catalyst-libs.git", branch = "test/adds-custom-network" }
minicbor = { version = "2.0.0", features = ["alloc","half"]}

# Note, these features are for support of features exposed by dependencies.
Expand Down
6 changes: 3 additions & 3 deletions rust/cardano-chain-follower/src/turbo_downloader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ impl DlConfig {
resolver.resolve(url, worker)
}

/// Builds a `UReq` Agent.
/// Builds a `UReq` Agent.
///
/// Because we need multiple clients to prevent all traffic being forced onto a single
/// connection when HTTP2 is used, the client can NOT be supplied by the user.
Expand Down Expand Up @@ -359,8 +359,8 @@ impl ParallelDownloadProcessorInner {
.set(RANGE.as_str(), &range_header)
.call()
.context("GET ranged request failed")?;
// let addr = get_range_response.remote_addr();
// debug!("Chunk {chunk} from {addr:?}");
let addr = get_range_response.remote_addr();
debug!("Chunk {chunk} from {addr:?}");
if get_range_response.status() != StatusCode::PARTIAL_CONTENT {
bail!(
"Response to range request has an unexpected status code (expected {}, found {})",
Expand Down
2 changes: 1 addition & 1 deletion rust/catalyst-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ hex = "0.4.3"
minicbor = { version = "0.25.1", features = ["std"] }
num-traits = "0.2.19"
orx-concurrent-vec = { version = "3.6.0", features = ["serde"] }
pallas-crypto = { version = "0.33.0" }
pallas-crypto = { version = "0.33.0", git = "https://github.com/input-output-hk/catalyst-pallas.git", branch = "test/testnet-genesis-values" }
serde = { version = "1.0.217", features = ["derive", "rc"] }
thiserror = "2.0.11"
base64-url = "3.0.0"
Expand Down
10 changes: 5 additions & 5 deletions rust/rbac-registration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ uuid = "1.11.0"
oid-registry = "0.7.1"
thiserror = "2.0.11"

c509-certificate = { version = "0.0.3", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "c509-certificate-v0.0.3" }
pallas = { version = "0.33.0" }
cbork-utils = { version = "0.0.2", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "cbork-utils-v0.0.2" }
cardano-blockchain-types = { version = "0.0.5", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "cardano-blockchain-types-v0.0.5" }
catalyst-types = { version = "0.0.5", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "catalyst-types-v0.0.5" }
c509-certificate = { version = "0.0.3", git = "https://github.com/input-output-hk/catalyst-libs.git", branch = "test/adds-custom-network" }
pallas = { version = "0.33.0", git = "https://github.com/input-output-hk/catalyst-pallas.git", branch = "test/testnet-genesis-values" }
cbork-utils = { version = "0.0.2", git = "https://github.com/input-output-hk/catalyst-libs.git", branch = "test/adds-custom-network" }
cardano-blockchain-types = { version = "0.0.5", git = "https://github.com/input-output-hk/catalyst-libs.git", branch = "test/adds-custom-network" }
catalyst-types = { version = "0.0.5", git = "https://github.com/input-output-hk/catalyst-libs.git", branch = "test/adds-custom-network" }
4 changes: 2 additions & 2 deletions rust/signed_doc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ license.workspace = true
workspace = true

[dependencies]
catalyst-types = { version = "0.0.5", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "catalyst-types-v0.0.5" }
cbork-utils = { version = "0.0.2", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "cbork-utils-v0.0.2" }
catalyst-types = { version = "0.0.5", git = "https://github.com/input-output-hk/catalyst-libs.git", branch = "test/adds-custom-network"}
cbork-utils = { version = "0.0.2", git = "https://github.com/input-output-hk/catalyst-libs.git", branch = "test/adds-custom-network" }

anyhow = "1.0.95"
serde = { version = "1.0.217", features = ["derive"] }
Expand Down
Loading