Skip to content

Commit

Permalink
Merge pull request #3 from cspr-rad/add-v2-support
Browse files Browse the repository at this point in the history
Add casper-node 2.0.0-rc4 support
  • Loading branch information
marijanp authored Sep 10, 2024
2 parents 3722ae2 + b1e99fc commit a9df641
Show file tree
Hide file tree
Showing 19 changed files with 2,047 additions and 1,044 deletions.
1,107 changes: 511 additions & 596 deletions Cargo.lock

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "cctl-rs"
version = "0.1.0"
version = "0.2.0"
edition = "2021"
license = "MIT OR Apache-2.0"

[[bin]]
name = "cctld"
path = "bin/cctld.rs"
version = "0.1.0"
version = "0.2.0"
test = false
bench = false

Expand All @@ -20,12 +20,18 @@ path = "src/lib.rs"
anyhow = "1"
backoff = { version = "0.4", features = ["tokio", "futures"]}
clap = { version = "4", features = ["derive"] }
casper-client = "2.0"
casper-types = "3.0"
casper-client = { git = "https://github.com/casper-ecosystem/casper-client-rs", branch = "feat-track-node-2.0"}
casper-types= { git = "https://github.com/casper-network/casper-node", branch = "release-2.0.0-rc4" }
itertools = "0.13"
nom = "7"
hex = "0.4"
sd-notify = "0.4"
serde = "1"
serde_json = "1"
tokio = { version = "1", features = [ "full", "tracing", "macros" ] }
tempfile = "3"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["std", "env-filter"] }

[patch.crates-io]
casper-types = { git = "https://github.com/casper-network/casper-node", branch = "release-2.0.0-rc4" }
25 changes: 9 additions & 16 deletions bin/cctld.rs
Original file line number Diff line number Diff line change
@@ -1,38 +1,31 @@
use casper_types::{runtime_args, RuntimeArgs};
use clap::Parser;
use sd_notify::NotifyState;
use std::path::PathBuf;
use tokio::signal;
use tracing_subscriber::EnvFilter;

#[derive(Parser)]
pub struct Cli {
#[arg(short, long)]
pub working_dir: Option<PathBuf>,
#[arg(short, long)]
pub deploy_contract: Option<String>,
#[arg(short, long)]
pub deploy_contracts: Option<Vec<cctl::DeployableContract>>,
#[arg(short = 's', long)]
pub chainspec_path: Option<PathBuf>,
#[arg(short, long)]
#[arg(short = 'c', long)]
pub config_path: Option<PathBuf>,
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
tracing_subscriber::fmt()
.with_env_filter(EnvFilter::from_default_env())
.with_writer(std::io::stderr)
.init();
let cli = Cli::parse();
let deploy_contract = cli.deploy_contract.map(|deploy_contracts_arg| {
match deploy_contracts_arg.split_once(':') {
Some((hash_name, path)) => cctl::DeployableContract {
hash_name: hash_name.to_string(),
// FIXME at some point we want to make this parametrizable
runtime_args: runtime_args! { "initial_trie_root" => Option::<[u8; 32]>::None },
path: PathBuf::from(&path),
},
None => panic!("Error parsing the provided deploy contracts argument."),
}
});
let _network = cctl::CCTLNetwork::run(
cli.working_dir,
deploy_contract,
cli.deploy_contracts,
cli.chainspec_path,
cli.config_path,
)
Expand Down
44 changes: 35 additions & 9 deletions docker-image.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,58 @@
}:
dockerTools.buildLayeredImage {
name = "ghcr.io/cspr-rad/cctl-rs";
tag = "cctl-casper-node-1.5.7";
tag = "cctl-casper-node-2.0.0-rc4";
extraCommands = ''
mkdir -p tmp
'';
config = {
Cmd = lib.getExe cctld;
ExposedPorts = {
# RPC ports
# Node ports
# PROTOCOL ports
"11101/tcp" = { };
"11102/tcp" = { };
"11103/tcp" = { };
"11104/tcp" = { };
"11105/tcp" = { };

# BINARY ports
"12101/tcp" = { };
"12102/tcp" = { };
"12103/tcp" = { };
"12104/tcp" = { };
"12105/tcp" = { };

# REST ports
"13101/tcp" = { };
"13102/tcp" = { };
"13103/tcp" = { };
"13104/tcp" = { };
"13105/tcp" = { };

# SSE ports
"14101/tcp" = { };
"14102/tcp" = { };
"14103/tcp" = { };
"14104/tcp" = { };
"14105/tcp" = { };
# SSE ports
"18101/tcp" = { };
"18102/tcp" = { };
"18103/tcp" = { };
"18104/tcp" = { };
"18105/tcp" = { };
# Consensus ports

# Sidecar ports
# NODE-CLIENT ports
"12101/tcp" = { };
"12102/tcp" = { };
"12103/tcp" = { };
"12104/tcp" = { };
"12105/tcp" = { };

# MAIN-RPC ports
"21101/tcp" = { };
"21102/tcp" = { };
"21103/tcp" = { };
"21104/tcp" = { };
"21105/tcp" = { };

# SPEC-EXEC ports
"22101/tcp" = { };
"22102/tcp" = { };
"22103/tcp" = { };
Expand Down
Loading

0 comments on commit a9df641

Please sign in to comment.