From b8369411360fd91f79fecb8ff6eaee63a3c44421 Mon Sep 17 00:00:00 2001 From: Nick Garfield Date: Wed, 1 Jun 2022 14:40:12 -0500 Subject: [PATCH] Rename cronos-sdk to cronos-client --- Cargo.lock | 40 +++++++++---------- Cargo.toml | 2 +- cli/Cargo.toml | 2 +- cli/src/processor/clock.rs | 2 +- cli/src/processor/config.rs | 6 +-- cli/src/processor/health.rs | 8 ++-- cli/src/processor/initialize.rs | 22 +++++----- cli/src/processor/manager.rs | 9 +++-- cli/src/processor/node.rs | 20 +++++----- cli/src/processor/pool.rs | 2 +- cli/src/processor/process.rs | 2 +- cli/src/processor/queue.rs | 4 +- cli/src/processor/task.rs | 4 +- {sdk => client}/.gitignore | 0 {sdk => client}/Cargo.toml | 12 +++--- {sdk => client}/README.md | 0 {sdk => client}/src/client.rs | 0 .../src/health/instruction/initialize.rs | 0 {sdk => client}/src/health/instruction/mod.rs | 0 .../src/health/instruction/ping.rs | 0 {sdk => client}/src/health/mod.rs | 0 {sdk => client}/src/lib.rs | 9 ++--- .../src/network/instruction/initialize.rs | 0 .../src/network/instruction/mod.rs | 0 .../src/network/instruction/node_register.rs | 0 .../src/network/instruction/node_stake.rs | 0 {sdk => client}/src/network/mod.rs | 0 .../src/pool/instruction/initialize.rs | 0 {sdk => client}/src/pool/instruction/mod.rs | 0 {sdk => client}/src/pool/mod.rs | 0 .../instruction/admin_config_update.rs | 0 .../instruction/admin_fee_collect.rs | 0 .../src/scheduler/instruction/initialize.rs | 0 .../src/scheduler/instruction/manager_new.rs | 0 .../src/scheduler/instruction/mod.rs | 0 .../src/scheduler/instruction/queue_fund.rs | 0 .../src/scheduler/instruction/queue_new.rs | 0 .../src/scheduler/instruction/queue_start.rs | 0 .../src/scheduler/instruction/task_exec.rs | 0 .../src/scheduler/instruction/task_new.rs | 0 {sdk => client}/src/scheduler/mod.rs | 0 metrics/Cargo.toml | 2 +- metrics/src/main.rs | 4 +- plugin/Cargo.toml | 2 +- plugin/src/filter.rs | 4 +- plugin/src/plugin.rs | 8 ++-- scripts/bump-version.sh | 20 +++++----- stress/Cargo.toml | 2 +- stress/src/processor/benchmark.rs | 14 +++---- 49 files changed, 98 insertions(+), 102 deletions(-) rename {sdk => client}/.gitignore (100%) rename {sdk => client}/Cargo.toml (81%) rename {sdk => client}/README.md (100%) rename {sdk => client}/src/client.rs (100%) rename {sdk => client}/src/health/instruction/initialize.rs (100%) rename {sdk => client}/src/health/instruction/mod.rs (100%) rename {sdk => client}/src/health/instruction/ping.rs (100%) rename {sdk => client}/src/health/mod.rs (100%) rename {sdk => client}/src/lib.rs (60%) rename {sdk => client}/src/network/instruction/initialize.rs (100%) rename {sdk => client}/src/network/instruction/mod.rs (100%) rename {sdk => client}/src/network/instruction/node_register.rs (100%) rename {sdk => client}/src/network/instruction/node_stake.rs (100%) rename {sdk => client}/src/network/mod.rs (100%) rename {sdk => client}/src/pool/instruction/initialize.rs (100%) rename {sdk => client}/src/pool/instruction/mod.rs (100%) rename {sdk => client}/src/pool/mod.rs (100%) rename {sdk => client}/src/scheduler/instruction/admin_config_update.rs (100%) rename {sdk => client}/src/scheduler/instruction/admin_fee_collect.rs (100%) rename {sdk => client}/src/scheduler/instruction/initialize.rs (100%) rename {sdk => client}/src/scheduler/instruction/manager_new.rs (100%) rename {sdk => client}/src/scheduler/instruction/mod.rs (100%) rename {sdk => client}/src/scheduler/instruction/queue_fund.rs (100%) rename {sdk => client}/src/scheduler/instruction/queue_new.rs (100%) rename {sdk => client}/src/scheduler/instruction/queue_start.rs (100%) rename {sdk => client}/src/scheduler/instruction/task_exec.rs (100%) rename {sdk => client}/src/scheduler/instruction/task_new.rs (100%) rename {sdk => client}/src/scheduler/mod.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index fd62d474d..7a1745852 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -767,7 +767,7 @@ name = "cronos-cli" version = "0.2.0-alpha4" dependencies = [ "clap 3.1.18", - "cronos-sdk", + "cronos-client", "serde", "serde_json", "solana-clap-utils", @@ -778,6 +778,22 @@ dependencies = [ "version", ] +[[package]] +name = "cronos-client" +version = "0.2.0-alpha4" +dependencies = [ + "anchor-lang", + "anchor-spl", + "bincode", + "cronos-health", + "cronos-network", + "cronos-pool", + "cronos-scheduler", + "solana-client", + "solana-sdk", + "thiserror", +] + [[package]] name = "cronos-cron" version = "0.2.0-alpha4" @@ -800,7 +816,7 @@ name = "cronos-metrics" version = "0.2.0-alpha4" dependencies = [ "chrono", - "cronos-sdk", + "cronos-client", "dotenv", "elasticsearch", "serde_json", @@ -834,22 +850,6 @@ dependencies = [ "cronos-pool", ] -[[package]] -name = "cronos-sdk" -version = "0.2.0-alpha4" -dependencies = [ - "anchor-lang", - "anchor-spl", - "bincode", - "cronos-health", - "cronos-network", - "cronos-pool", - "cronos-scheduler", - "solana-client", - "solana-sdk", - "thiserror", -] - [[package]] name = "cronos-stress" version = "0.2.0-alpha4" @@ -857,8 +857,8 @@ dependencies = [ "base64 0.13.0", "chrono", "clap 3.1.18", + "cronos-client", "cronos-cron", - "cronos-sdk", "serde", "serde_json", "solana-clap-utils", @@ -875,7 +875,7 @@ version = "0.2.0-alpha4" dependencies = [ "bincode", "bs58 0.4.0", - "cronos-sdk", + "cronos-client", "dashmap 5.3.4", "log", "prost", diff --git a/Cargo.toml b/Cargo.toml index 1cf47c14e..d155d8693 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,11 @@ [workspace] members = [ "cli", + "client", "cron", "metrics", "plugin", "programs/*", - "sdk", "stress" ] diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 70fa9c450..ccae69829 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -14,7 +14,7 @@ keywords = ["solana", "cronos", "cli"] [dependencies] clap = { version = "3.1.2", features = ["derive"] } -cronos-sdk = { path = "../sdk", features = ["client"], version = "0.2.0-alpha4" } +cronos-client = { path = "../client", version = "0.2.0-alpha4" } serde = { version = "1.0.136", features = ["derive"] } serde_json = "1.0.79" solana-clap-utils = "1.10.19" diff --git a/cli/src/processor/clock.rs b/cli/src/processor/clock.rs index f3b608166..d4a223429 100644 --- a/cli/src/processor/clock.rs +++ b/cli/src/processor/clock.rs @@ -1,4 +1,4 @@ -use {crate::cli::CliError, cronos_sdk::Client}; +use {crate::cli::CliError, cronos_client::Client}; pub fn get(_client: &Client) -> Result<(), CliError> { panic!("Not implemented") diff --git a/cli/src/processor/config.rs b/cli/src/processor/config.rs index 1017c6977..3cf88920f 100644 --- a/cli/src/processor/config.rs +++ b/cli/src/processor/config.rs @@ -1,6 +1,6 @@ use { crate::cli::CliError, - cronos_sdk::{ + cronos_client::{ network::state::Config as NetworkConfig, pool::state::Config as PoolConfig, scheduler::state::Config as SchedulerConfig, Client, }, @@ -47,7 +47,7 @@ pub fn set( .get::(&config_pubkey) .map_err(|_err| CliError::AccountNotFound(config_pubkey.to_string()))?; - let settings = cronos_sdk::scheduler::state::ConfigSettings { + let settings = cronos_client::scheduler::state::ConfigSettings { admin: match admin { Some(admin) => admin, None => config.admin, @@ -70,7 +70,7 @@ pub fn set( }, }; - let ix = cronos_sdk::scheduler::instruction::admin_config_update( + let ix = cronos_client::scheduler::instruction::admin_config_update( client.payer_pubkey(), config_pubkey, settings, diff --git a/cli/src/processor/health.rs b/cli/src/processor/health.rs index 53a1ac916..7f886a7e4 100644 --- a/cli/src/processor/health.rs +++ b/cli/src/processor/health.rs @@ -1,17 +1,17 @@ -use cronos_sdk::Client; +use cronos_client::Client; use crate::cli::CliError; pub fn get(_client: &Client) -> Result<(), CliError> { panic!("Not implemented – moving to health program") - // let health_addr = cronos_sdk::account::Health::pda().0; + // let health_addr = cronos_client::account::Health::pda().0; // let data = client // .get_account_data(&health_addr) // .map_err(|_err| CliError::AccountNotFound(health_addr.to_string()))?; - // let health_data = cronos_sdk::account::Health::try_from(data) + // let health_data = cronos_client::account::Health::try_from(data) // .map_err(|_err| CliError::AccountDataNotParsable(health_addr.to_string()))?; // let ts = - // cronos_sdk::clock::get_time(client).map_err(|err| CliError::BadClient(err.to_string()))?; + // cronos_client::clock::get_time(client).map_err(|err| CliError::BadClient(err.to_string()))?; // println!(" Block time: {}", ts); // println!(" Last ping: {} sec", ts - health_data.last_ping); diff --git a/cli/src/processor/initialize.rs b/cli/src/processor/initialize.rs index 718ce200f..ff0096057 100644 --- a/cli/src/processor/initialize.rs +++ b/cli/src/processor/initialize.rs @@ -1,24 +1,24 @@ use { crate::cli::CliError, - cronos_sdk::Client, + cronos_client::Client, solana_sdk::{native_token::LAMPORTS_PER_SOL, pubkey::Pubkey}, }; pub fn initialize(client: &Client, mint: Pubkey) -> Result<(), CliError> { // Initialize the programs let admin = client.payer_pubkey(); - let ix_a = cronos_sdk::health::instruction::initialize(admin); - let ix_b = cronos_sdk::scheduler::instruction::initialize(admin); - let ix_c = cronos_sdk::network::instruction::initialize(admin, mint); - let ix_d = cronos_sdk::pool::instruction::initialize(admin); + let ix_a = cronos_client::health::instruction::initialize(admin); + let ix_b = cronos_client::scheduler::instruction::initialize(admin); + let ix_c = cronos_client::network::instruction::initialize(admin, mint); + let ix_d = cronos_client::pool::instruction::initialize(admin); // Fund the network program's queues - let authority = cronos_sdk::network::state::Authority::pda().0; - let manager = cronos_sdk::scheduler::state::Manager::pda(authority).0; - let queue_0 = cronos_sdk::scheduler::state::Queue::pda(manager, 0).0; - let queue_1 = cronos_sdk::scheduler::state::Queue::pda(manager, 1).0; - let ix_e = cronos_sdk::scheduler::instruction::queue_fund(LAMPORTS_PER_SOL, admin, queue_0); - let ix_f = cronos_sdk::scheduler::instruction::queue_fund(LAMPORTS_PER_SOL, admin, queue_1); + let authority = cronos_client::network::state::Authority::pda().0; + let manager = cronos_client::scheduler::state::Manager::pda(authority).0; + let queue_0 = cronos_client::scheduler::state::Queue::pda(manager, 0).0; + let queue_1 = cronos_client::scheduler::state::Queue::pda(manager, 1).0; + let ix_e = cronos_client::scheduler::instruction::queue_fund(LAMPORTS_PER_SOL, admin, queue_0); + let ix_f = cronos_client::scheduler::instruction::queue_fund(LAMPORTS_PER_SOL, admin, queue_1); // Submit tx client diff --git a/cli/src/processor/manager.rs b/cli/src/processor/manager.rs index b034c77ec..d96710b61 100644 --- a/cli/src/processor/manager.rs +++ b/cli/src/processor/manager.rs @@ -1,19 +1,20 @@ -use cronos_sdk::Client; +use cronos_client::Client; use solana_sdk::pubkey::Pubkey; use crate::cli::CliError; pub fn create(client: &Client) -> Result<(), CliError> { let authority = client.payer_pubkey(); - let manager_pubkey = cronos_sdk::scheduler::state::Manager::pda(authority).0; - let ix = cronos_sdk::scheduler::instruction::manager_new(authority, authority, manager_pubkey); + let manager_pubkey = cronos_client::scheduler::state::Manager::pda(authority).0; + let ix = + cronos_client::scheduler::instruction::manager_new(authority, authority, manager_pubkey); client.send_and_confirm(&[ix], &[client.payer()]).unwrap(); get(client, &manager_pubkey) } pub fn get(client: &Client, address: &Pubkey) -> Result<(), CliError> { let manager = client - .get::(address) + .get::(address) .map_err(|_err| CliError::AccountDataNotParsable(address.to_string()))?; println!("{:#?}", manager); Ok(()) diff --git a/cli/src/processor/node.rs b/cli/src/processor/node.rs index 410a44fe3..2a4a609d0 100644 --- a/cli/src/processor/node.rs +++ b/cli/src/processor/node.rs @@ -1,7 +1,7 @@ use { crate::cli::CliError, - cronos_sdk::network::state::{Authority, Config, Node, Registry, Snapshot, SnapshotEntry}, - cronos_sdk::Client, + cronos_client::network::state::{Authority, Config, Node, Registry, Snapshot, SnapshotEntry}, + cronos_client::Client, solana_sdk::{ pubkey::Pubkey, signature::{Keypair, Signer}, @@ -10,7 +10,7 @@ use { pub fn get(client: &Client, address: &Pubkey) -> Result<(), CliError> { let node = client - .get::(address) + .get::(address) .map_err(|_err| CliError::AccountDataNotParsable(address.to_string()))?; println!("{:#?}", node); Ok(()) @@ -39,22 +39,22 @@ pub fn register(client: &Client, delegate: Keypair) -> Result<(), CliError> { let snapshot_pubkey = Snapshot::pda(registry_data.snapshot_count - 1).0; let entry_pubkey = SnapshotEntry::pda(snapshot_pubkey, registry_data.node_count).0; - let manager_pubkey = cronos_sdk::scheduler::state::Manager::pda(authority_pubkey).0; - let cycler_queue_pubkey = cronos_sdk::scheduler::state::Queue::pda(manager_pubkey, 0).0; - let cycler_task_pubkey = cronos_sdk::scheduler::state::Task::pda( + let manager_pubkey = cronos_client::scheduler::state::Manager::pda(authority_pubkey).0; + let cycler_queue_pubkey = cronos_client::scheduler::state::Queue::pda(manager_pubkey, 0).0; + let cycler_task_pubkey = cronos_client::scheduler::state::Task::pda( cycler_queue_pubkey, registry_data.node_count.into(), ) .0; - let snapshot_queue_pubkey = cronos_sdk::scheduler::state::Queue::pda(manager_pubkey, 1).0; - let snapshot_task_pubkey = cronos_sdk::scheduler::state::Task::pda( + let snapshot_queue_pubkey = cronos_client::scheduler::state::Queue::pda(manager_pubkey, 1).0; + let snapshot_task_pubkey = cronos_client::scheduler::state::Task::pda( snapshot_queue_pubkey, (registry_data.node_count + 1).into(), ) .0; - let ix = cronos_sdk::network::instruction::node_register( + let ix = cronos_client::network::instruction::node_register( authority_pubkey, config_pubkey, cycler_queue_pubkey, @@ -86,7 +86,7 @@ pub fn stake(client: &Client, amount: u64, delegate: Pubkey) -> Result<(), CliEr // Build ix let signer = client.payer(); let node_pubkey = Node::pda(delegate).0; - let ix = cronos_sdk::network::instruction::node_stake( + let ix = cronos_client::network::instruction::node_stake( amount, config_pubkey, delegate, diff --git a/cli/src/processor/pool.rs b/cli/src/processor/pool.rs index dee5be842..faf5b3863 100644 --- a/cli/src/processor/pool.rs +++ b/cli/src/processor/pool.rs @@ -1,6 +1,6 @@ use { crate::cli::CliError, - cronos_sdk::{pool::state::Pool, Client}, + cronos_client::{pool::state::Pool, Client}, }; pub fn get(client: &Client) -> Result<(), CliError> { diff --git a/cli/src/processor/process.rs b/cli/src/processor/process.rs index c7009428c..2610cb36f 100644 --- a/cli/src/processor/process.rs +++ b/cli/src/processor/process.rs @@ -3,7 +3,7 @@ use crate::{ config::CliConfig, }; use clap::ArgMatches; -use cronos_sdk::Client; +use cronos_client::Client; pub fn process(matches: &ArgMatches) -> Result<(), CliError> { // Parse command and config diff --git a/cli/src/processor/queue.rs b/cli/src/processor/queue.rs index dee30bea8..efdcca584 100644 --- a/cli/src/processor/queue.rs +++ b/cli/src/processor/queue.rs @@ -1,6 +1,6 @@ use { crate::cli::CliError, - cronos_sdk::{ + cronos_client::{ scheduler::state::{Manager, Queue}, Client, }, @@ -19,7 +19,7 @@ pub fn create(client: &Client, schedule: String) -> Result<(), CliError> { // Build queue_create ix. let queue_pubkey = Queue::pda(manager_pubkey, manager_data.queue_count).0; - let queue_ix = cronos_sdk::scheduler::instruction::queue_new( + let queue_ix = cronos_client::scheduler::instruction::queue_new( authority_pubkey, manager_pubkey, authority_pubkey, diff --git a/cli/src/processor/task.rs b/cli/src/processor/task.rs index a0423fb74..048612748 100644 --- a/cli/src/processor/task.rs +++ b/cli/src/processor/task.rs @@ -1,11 +1,11 @@ -use cronos_sdk::Client; +use cronos_client::Client; use solana_sdk::pubkey::Pubkey; use crate::cli::CliError; pub fn get(client: &Client, address: &Pubkey) -> Result<(), CliError> { let task = client - .get::(&address) + .get::(&address) .map_err(|_err| CliError::AccountDataNotParsable(address.to_string()))?; println!("{:#?}", task); Ok(()) diff --git a/sdk/.gitignore b/client/.gitignore similarity index 100% rename from sdk/.gitignore rename to client/.gitignore diff --git a/sdk/Cargo.toml b/client/Cargo.toml similarity index 81% rename from sdk/Cargo.toml rename to client/Cargo.toml index b26f94e4c..6b8a540c7 100644 --- a/sdk/Cargo.toml +++ b/client/Cargo.toml @@ -1,18 +1,18 @@ [package] -name = "cronos-sdk" +name = "cronos-client" version = "0.2.0-alpha4" edition = "2021" -description = "Cronos SDK" +description = "Cronos client" license = "AGPL-3.0-or-later" homepage = "https://cronos.so" -repository = "https://github.com/cronos-so/sdk" -documentation = "https://docs.rs/cronos-sdk" +repository = "https://github.com/cronos-so/client" +documentation = "https://docs.rs/cronos-client" readme = "./README.md" keywords = ["solana"] [lib] crate-type = ["cdylib", "lib"] -name = "cronos_sdk" +name = "cronos_client" [dependencies] anchor-lang = "0.24.2" @@ -26,5 +26,3 @@ solana-client = "1.10.19" solana-sdk = "1.10.19" thiserror = "1.0.31" -[features] -client = [] diff --git a/sdk/README.md b/client/README.md similarity index 100% rename from sdk/README.md rename to client/README.md diff --git a/sdk/src/client.rs b/client/src/client.rs similarity index 100% rename from sdk/src/client.rs rename to client/src/client.rs diff --git a/sdk/src/health/instruction/initialize.rs b/client/src/health/instruction/initialize.rs similarity index 100% rename from sdk/src/health/instruction/initialize.rs rename to client/src/health/instruction/initialize.rs diff --git a/sdk/src/health/instruction/mod.rs b/client/src/health/instruction/mod.rs similarity index 100% rename from sdk/src/health/instruction/mod.rs rename to client/src/health/instruction/mod.rs diff --git a/sdk/src/health/instruction/ping.rs b/client/src/health/instruction/ping.rs similarity index 100% rename from sdk/src/health/instruction/ping.rs rename to client/src/health/instruction/ping.rs diff --git a/sdk/src/health/mod.rs b/client/src/health/mod.rs similarity index 100% rename from sdk/src/health/mod.rs rename to client/src/health/mod.rs diff --git a/sdk/src/lib.rs b/client/src/lib.rs similarity index 60% rename from sdk/src/lib.rs rename to client/src/lib.rs index 54caa71a7..6da216f74 100644 --- a/sdk/src/lib.rs +++ b/client/src/lib.rs @@ -3,10 +3,7 @@ pub mod network; pub mod pool; pub mod scheduler; -#[cfg(feature = "client")] -mod client; - -#[cfg(feature = "client")] -pub use client::*; - pub use cronos_scheduler::pda; + +mod client; +pub use client::Client; diff --git a/sdk/src/network/instruction/initialize.rs b/client/src/network/instruction/initialize.rs similarity index 100% rename from sdk/src/network/instruction/initialize.rs rename to client/src/network/instruction/initialize.rs diff --git a/sdk/src/network/instruction/mod.rs b/client/src/network/instruction/mod.rs similarity index 100% rename from sdk/src/network/instruction/mod.rs rename to client/src/network/instruction/mod.rs diff --git a/sdk/src/network/instruction/node_register.rs b/client/src/network/instruction/node_register.rs similarity index 100% rename from sdk/src/network/instruction/node_register.rs rename to client/src/network/instruction/node_register.rs diff --git a/sdk/src/network/instruction/node_stake.rs b/client/src/network/instruction/node_stake.rs similarity index 100% rename from sdk/src/network/instruction/node_stake.rs rename to client/src/network/instruction/node_stake.rs diff --git a/sdk/src/network/mod.rs b/client/src/network/mod.rs similarity index 100% rename from sdk/src/network/mod.rs rename to client/src/network/mod.rs diff --git a/sdk/src/pool/instruction/initialize.rs b/client/src/pool/instruction/initialize.rs similarity index 100% rename from sdk/src/pool/instruction/initialize.rs rename to client/src/pool/instruction/initialize.rs diff --git a/sdk/src/pool/instruction/mod.rs b/client/src/pool/instruction/mod.rs similarity index 100% rename from sdk/src/pool/instruction/mod.rs rename to client/src/pool/instruction/mod.rs diff --git a/sdk/src/pool/mod.rs b/client/src/pool/mod.rs similarity index 100% rename from sdk/src/pool/mod.rs rename to client/src/pool/mod.rs diff --git a/sdk/src/scheduler/instruction/admin_config_update.rs b/client/src/scheduler/instruction/admin_config_update.rs similarity index 100% rename from sdk/src/scheduler/instruction/admin_config_update.rs rename to client/src/scheduler/instruction/admin_config_update.rs diff --git a/sdk/src/scheduler/instruction/admin_fee_collect.rs b/client/src/scheduler/instruction/admin_fee_collect.rs similarity index 100% rename from sdk/src/scheduler/instruction/admin_fee_collect.rs rename to client/src/scheduler/instruction/admin_fee_collect.rs diff --git a/sdk/src/scheduler/instruction/initialize.rs b/client/src/scheduler/instruction/initialize.rs similarity index 100% rename from sdk/src/scheduler/instruction/initialize.rs rename to client/src/scheduler/instruction/initialize.rs diff --git a/sdk/src/scheduler/instruction/manager_new.rs b/client/src/scheduler/instruction/manager_new.rs similarity index 100% rename from sdk/src/scheduler/instruction/manager_new.rs rename to client/src/scheduler/instruction/manager_new.rs diff --git a/sdk/src/scheduler/instruction/mod.rs b/client/src/scheduler/instruction/mod.rs similarity index 100% rename from sdk/src/scheduler/instruction/mod.rs rename to client/src/scheduler/instruction/mod.rs diff --git a/sdk/src/scheduler/instruction/queue_fund.rs b/client/src/scheduler/instruction/queue_fund.rs similarity index 100% rename from sdk/src/scheduler/instruction/queue_fund.rs rename to client/src/scheduler/instruction/queue_fund.rs diff --git a/sdk/src/scheduler/instruction/queue_new.rs b/client/src/scheduler/instruction/queue_new.rs similarity index 100% rename from sdk/src/scheduler/instruction/queue_new.rs rename to client/src/scheduler/instruction/queue_new.rs diff --git a/sdk/src/scheduler/instruction/queue_start.rs b/client/src/scheduler/instruction/queue_start.rs similarity index 100% rename from sdk/src/scheduler/instruction/queue_start.rs rename to client/src/scheduler/instruction/queue_start.rs diff --git a/sdk/src/scheduler/instruction/task_exec.rs b/client/src/scheduler/instruction/task_exec.rs similarity index 100% rename from sdk/src/scheduler/instruction/task_exec.rs rename to client/src/scheduler/instruction/task_exec.rs diff --git a/sdk/src/scheduler/instruction/task_new.rs b/client/src/scheduler/instruction/task_new.rs similarity index 100% rename from sdk/src/scheduler/instruction/task_new.rs rename to client/src/scheduler/instruction/task_new.rs diff --git a/sdk/src/scheduler/mod.rs b/client/src/scheduler/mod.rs similarity index 100% rename from sdk/src/scheduler/mod.rs rename to client/src/scheduler/mod.rs diff --git a/metrics/Cargo.toml b/metrics/Cargo.toml index 072da4acf..ab3a5d452 100644 --- a/metrics/Cargo.toml +++ b/metrics/Cargo.toml @@ -12,7 +12,7 @@ keywords = ["solana"] [dependencies] chrono = "0.4.19" -cronos-sdk = { path = "../sdk", features = ["client"], version = "0.2.0-alpha4" } +cronos-client = { path = "../client", version = "0.2.0-alpha4" } dotenv = "0.15.0" elasticsearch = "7.14.0-alpha.1" serde_json = "~1" diff --git a/metrics/src/main.rs b/metrics/src/main.rs index 245d50a8e..bf8136e58 100644 --- a/metrics/src/main.rs +++ b/metrics/src/main.rs @@ -1,8 +1,8 @@ use { crate::env::Envvar, chrono::{TimeZone, Utc}, - cronos_sdk::health::state::Health, - cronos_sdk::Client, + cronos_client::health::state::Health, + cronos_client::Client, dotenv::dotenv, elasticsearch::{ auth::Credentials, http::transport::Transport, Elasticsearch, Error, IndexParts, diff --git a/plugin/Cargo.toml b/plugin/Cargo.toml index bc087cc59..395dd9a00 100644 --- a/plugin/Cargo.toml +++ b/plugin/Cargo.toml @@ -16,7 +16,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] bincode = "1.3.3" bs58 = "0.4.0" -cronos-sdk = { path = "../sdk", features = ["client"], version = "0.2.0-alpha4" } +cronos-client = { path = "../client", version = "0.2.0-alpha4" } log = "0.4" prost = "0.10.0" serde = { version = "1.0", features = ["derive"] } diff --git a/plugin/src/filter.rs b/plugin/src/filter.rs index 5b663d2c0..1261bd651 100644 --- a/plugin/src/filter.rs +++ b/plugin/src/filter.rs @@ -1,5 +1,5 @@ use bincode::deserialize; -use cronos_sdk::scheduler::state::Queue; +use cronos_client::scheduler::state::Queue; use solana_geyser_plugin_interface::geyser_plugin_interface::{ GeyserPluginError, ReplicaAccountInfo, }; @@ -25,7 +25,7 @@ impl TryFrom> for CronosAccountUpdate { } // If the account is a Cronos queue, return it - if Pubkey::new(account_info.owner).eq(&cronos_sdk::scheduler::ID) + if Pubkey::new(account_info.owner).eq(&cronos_client::scheduler::ID) && account_info.data.len() > 8 { return Ok(CronosAccountUpdate::Queue { diff --git a/plugin/src/plugin.rs b/plugin/src/plugin.rs index 0327a206e..d63edc3b2 100644 --- a/plugin/src/plugin.rs +++ b/plugin/src/plugin.rs @@ -1,6 +1,6 @@ use { crate::{config::PluginConfig, filter::CronosAccountUpdate}, - cronos_sdk::{ + cronos_client::{ scheduler::state::{Queue, Task}, Client, }, @@ -262,7 +262,7 @@ impl Inner { // Build queue_start ix let delegate_pubkey = self.client.payer_pubkey(); - let queue_start_ix = cronos_sdk::scheduler::instruction::queue_start( + let queue_start_ix = cronos_client::scheduler::instruction::queue_start( delegate_pubkey, queue.manager, queue_pubkey, @@ -278,7 +278,7 @@ impl Inner { let task = self.client.get::(&task_pubkey).unwrap(); // Build task_exec ix - let mut task_exec_ix = cronos_sdk::scheduler::instruction::task_exec( + let mut task_exec_ix = cronos_client::scheduler::instruction::task_exec( delegate_pubkey, queue.manager, queue_pubkey, @@ -303,7 +303,7 @@ impl Inner { // Inject the delegate pubkey as the Cronos "payer" account let mut payer_pubkey = acc.pubkey; - if acc.pubkey == cronos_sdk::scheduler::payer::ID { + if acc.pubkey == cronos_client::scheduler::payer::ID { payer_pubkey = delegate_pubkey; } task_exec_ix.accounts.push(match acc.is_writable { diff --git a/scripts/bump-version.sh b/scripts/bump-version.sh index 7fe9be94c..65116ed6d 100755 --- a/scripts/bump-version.sh +++ b/scripts/bump-version.sh @@ -26,27 +26,27 @@ sed -i '' -e 's/^cronos-cron =.*/cronos-cron = { path = "..\/..\/cron", version sed -i '' -e 's/^cronos-pool =.*/cronos-pool = { path = "..\/pool", features = ["cpi"], version = "'${new_version}'" }/g' programs/scheduler/Cargo.toml -# Bump cronos-sdk -sed -i '' -e 's/^cronos-health =.*/cronos-health = { path = "..\/programs\/health", features = ["no-entrypoint"], version = "'${new_version}'" }/g' sdk/Cargo.toml -sed -i '' -e 's/^cronos-network =.*/cronos-network = { path = "..\/programs\/network", features = ["no-entrypoint"], version = "'${new_version}'" }/g' sdk/Cargo.toml -sed -i '' -e 's/^cronos-pool =.*/cronos-pool = { path = "..\/programs\/pool", features = ["no-entrypoint"], version = "'${new_version}'" }/g' sdk/Cargo.toml -sed -i '' -e 's/^cronos-scheduler =.*/cronos-scheduler = { path = "..\/programs\/scheduler", features = ["no-entrypoint"], version = "'${new_version}'" }/g' sdk/Cargo.toml -sed -i '' -e '3s/^version = "'${current_version}'"/version = "'${new_version}'"/g' sdk/Cargo.toml +# Bump cronos-client +sed -i '' -e 's/^cronos-health =.*/cronos-health = { path = "..\/programs\/health", features = ["no-entrypoint"], version = "'${new_version}'" }/g' client/Cargo.toml +sed -i '' -e 's/^cronos-network =.*/cronos-network = { path = "..\/programs\/network", features = ["no-entrypoint"], version = "'${new_version}'" }/g' client/Cargo.toml +sed -i '' -e 's/^cronos-pool =.*/cronos-pool = { path = "..\/programs\/pool", features = ["no-entrypoint"], version = "'${new_version}'" }/g' client/Cargo.toml +sed -i '' -e 's/^cronos-scheduler =.*/cronos-scheduler = { path = "..\/programs\/scheduler", features = ["no-entrypoint"], version = "'${new_version}'" }/g' client/Cargo.toml +sed -i '' -e '3s/^version = "'${current_version}'"/version = "'${new_version}'"/g' client/Cargo.toml # Bump cronos-cli -sed -i '' -e 's/^cronos-sdk =.*/cronos-sdk = { path = "..\/sdk", features = ["client"], version = "'${new_version}'" }/g' cli/Cargo.toml +sed -i '' -e 's/^cronos-client =.*/cronos-client = { path = "..\/client", version = "'${new_version}'" }/g' cli/Cargo.toml sed -i '' -e '3s/^version = "'${current_version}'"/version = "'${new_version}'"/g' cli/Cargo.toml # Bump cronos-metrics -sed -i '' -e 's/^cronos-sdk =.*/cronos-sdk = { path = "..\/sdk", features = ["client"], version = "'${new_version}'" }/g' metrics/Cargo.toml +sed -i '' -e 's/^cronos-client =.*/cronos-client = { path = "..\/client", version = "'${new_version}'" }/g' metrics/Cargo.toml sed -i '' -e '3s/^version = "'${current_version}'"/version = "'${new_version}'"/g' metrics/Cargo.toml # Bump cronos-plugin -sed -i '' -e 's/^cronos-sdk =.*/cronos-sdk = { path = "..\/sdk", features = ["client"], version = "'${new_version}'" }/g' plugin/Cargo.toml +sed -i '' -e 's/^cronos-client =.*/cronos-client = { path = "..\/client", version = "'${new_version}'" }/g' plugin/Cargo.toml sed -i '' -e '3s/^version = "'${current_version}'"/version = "'${new_version}'"/g' plugin/Cargo.toml # Bump cronos-stress -sed -i '' -e 's/^cronos-sdk =.*/cronos-sdk = { path = "..\/sdk", features = ["client"], version = "'${new_version}'" }/g' stress/Cargo.toml +sed -i '' -e 's/^cronos-client =.*/cronos-client = { path = "..\/client", version = "'${new_version}'" }/g' stress/Cargo.toml sed -i '' -e 's/^cronos-cron =.*/cronos-cron = { path = "..\/cron", version = "'${new_version}'" }/g' stress/Cargo.toml sed -i '' -e '3s/^version = "'${current_version}'"/version = "'${new_version}'"/g' stress/Cargo.toml diff --git a/stress/Cargo.toml b/stress/Cargo.toml index 5b1de8e05..2419c1080 100644 --- a/stress/Cargo.toml +++ b/stress/Cargo.toml @@ -14,8 +14,8 @@ keywords = ["solana", "cronos", "program"] base64 = "0.13.0" chrono = { version = "0.4.19", default-features = false, features = ["alloc"] } clap = { version = "3.1.2", features = ["derive"] } +cronos-client = { path = "../client", version = "0.2.0-alpha4" } cronos-cron = { path = "../cron", version = "0.2.0-alpha4" } -cronos-sdk = { path = "../sdk", features = ["client"], version = "0.2.0-alpha4" } serde_json = "1.0.79" serde = { version = "1.0.136", features = ["derive"] } solana-clap-utils = "1.10.19" diff --git a/stress/src/processor/benchmark.rs b/stress/src/processor/benchmark.rs index ef7a5f0b6..23dfcaaf1 100644 --- a/stress/src/processor/benchmark.rs +++ b/stress/src/processor/benchmark.rs @@ -1,10 +1,10 @@ use { crate::{cli::CliError, parser::JsonInstructionData}, chrono::{prelude::*, Duration}, + cronos_client::scheduler::events::TaskExecuted, + cronos_client::scheduler::state::{Manager, Queue, Task}, + cronos_client::Client, cronos_cron::Schedule, - cronos_sdk::scheduler::events::TaskExecuted, - cronos_sdk::scheduler::state::{Manager, Queue, Task}, - cronos_sdk::Client, serde_json::json, solana_client::{ pubsub_client::PubsubClient, @@ -31,7 +31,7 @@ pub fn run(count: u32, parallelism: f32, recurrence: u32) -> Result<(), CliError // Create manager let authority = &Keypair::new(); let manager_pubkey = Manager::pda(authority.pubkey()).0; - let ix = cronos_sdk::scheduler::instruction::manager_new( + let ix = cronos_client::scheduler::instruction::manager_new( authority.pubkey(), authority.pubkey(), manager_pubkey, @@ -92,7 +92,7 @@ fn listen_for_events( ) -> Result<(), CliError> { let (ws_sub, log_receiver) = PubsubClient::logs_subscribe( "ws://localhost:8900/", - RpcTransactionLogsFilter::Mentions(vec![cronos_sdk::scheduler::ID.to_string()]), + RpcTransactionLogsFilter::Mentions(vec![cronos_client::scheduler::ID.to_string()]), RpcTransactionLogsConfig { commitment: Some(CommitmentConfig::confirmed()), }, @@ -163,7 +163,7 @@ fn create_queue_ix( next_minute.weekday(), next_minute.year() ); - let create_queue_ix = cronos_sdk::scheduler::instruction::queue_new( + let create_queue_ix = cronos_client::scheduler::instruction::queue_new( authority.pubkey(), manager_pubkey, authority.pubkey(), @@ -209,7 +209,7 @@ fn create_task_ix(authority: &Keypair, queue_id: u128, task_id: u128) -> Instruc let queue_pubkey = Queue::pda(manager_pubkey, queue_id).0; let task_pubkey = Task::pda(queue_pubkey, task_id).0; let memo_ix = build_memo_ix(&manager_pubkey); - cronos_sdk::scheduler::instruction::task_new( + cronos_client::scheduler::instruction::task_new( authority.pubkey(), vec![memo_ix], manager_pubkey,