cuprated: version constants

This commit is contained in:
hinto.janai 2024-09-09 17:50:11 -04:00
parent 6dc38a401d
commit b6e8b3a08e
No known key found for this signature in database
GPG key ID: D47CE05FA175A499
6 changed files with 49 additions and 7 deletions

27
Cargo.lock generated
View file

@ -386,6 +386,26 @@ version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70"
[[package]]
name = "const_format"
version = "0.2.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50c655d81ff1114fb0dcdea9225ea9f0cc712a6f8d189378e82bdf62a473a64b"
dependencies = [
"const_format_proc_macros",
]
[[package]]
name = "const_format_proc_macros"
version = "0.2.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eff1a44b93f47b1bac19a27932f5c591e43d1ba357ee4f61526c8a25603f0eb1"
dependencies = [
"proc-macro2",
"quote",
"unicode-xid",
]
[[package]]
name = "core-foundation"
version = "0.9.4"
@ -927,6 +947,7 @@ dependencies = [
"cfg-if",
"chrono",
"clap",
"const_format",
"crossbeam",
"crypto-bigint",
"cuprate-address-book",
@ -3044,6 +3065,12 @@ version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "unicode-xid"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a"
[[package]]
name = "untrusted"
version = "0.9.0"

View file

@ -59,6 +59,7 @@ clap = { version = "4.4.7", default-features = false }
chrono = { version = "0.4.31", default-features = false }
crypto-bigint = { version = "0.5.5", default-features = false }
crossbeam = { version = "0.8.4", default-features = false }
const_format = { version = "0.2.33", default-features = false }
curve25519-dalek = { version = "4.1.3", default-features = false }
dashmap = { version = "5.5.3", default-features = false }
dirs = { version = "5.0.1", default-features = false }

View file

@ -42,10 +42,11 @@ borsh = { workspace = true }
bytemuck = { workspace = true }
bytes = { workspace = true }
cfg-if = { workspace = true }
clap = { workspace = true }
clap = { workspace = true, features = ["cargo"] }
chrono = { workspace = true }
crypto-bigint = { workspace = true }
crossbeam = { workspace = true }
const_format = { workspace = true }
curve25519-dalek = { workspace = true }
dashmap = { workspace = true }
dirs = { workspace = true }

View file

@ -17,6 +17,7 @@ mod config;
mod p2p;
mod rpc;
mod txpool;
mod version;
fn main() {
todo!()

View file

@ -32,12 +32,16 @@ use cuprate_rpc_types::{
SyncInfoResponse,
},
misc::{BlockHeader, Status},
CORE_RPC_VERSION,
};
use cuprate_types::{blockchain::BlockchainReadRequest, Chain};
use crate::{
rpc::{blockchain, helper},
rpc::{CupratedRpcHandlerState, RESTRICTED_BLOCK_COUNT, RESTRICTED_BLOCK_HEADER_RANGE},
rpc::{
blockchain, helper, CupratedRpcHandlerState, RESTRICTED_BLOCK_COUNT,
RESTRICTED_BLOCK_HEADER_RANGE,
},
version::CUPRATED_VERSION_IS_RELEASE,
};
/// Map a [`JsonRpcRequest`] to the function that will lead to a [`JsonRpcResponse`].
@ -440,14 +444,14 @@ async fn get_coinbase_tx_sum(
/// <https://github.com/monero-project/monero/blob/cc73fe71162d564ffda8e549b79a350bca53c454/src/rpc/core_rpc_server.cpp#L2981-L2996>
async fn get_version(
state: CupratedRpcHandlerState,
mut state: CupratedRpcHandlerState,
request: GetVersionRequest,
) -> Result<GetVersionResponse, Error> {
Ok(GetVersionResponse {
base: ResponseBase::ok(),
version: todo!(),
release: todo!(),
current_height: todo!(),
version: CORE_RPC_VERSION,
release: CUPRATED_VERSION_IS_RELEASE,
current_height: helper::top_height(&mut state).await?.0,
target_height: todo!(),
hard_forks: todo!(),
})

View file

@ -0,0 +1,8 @@
//! - <https://github.com/monero-project/monero/blob/a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623/src/version.h>
//! - <https://github.com/monero-project/monero/blob/a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623/src/version.cpp.in>
use const_format::formatcp;
pub const CUPRATED_VERSION: &str = formatcp!("{}", clap::crate_version!());
pub const CUPRATED_RELEASE_NAME: &str = "Fluorine Fermi";
pub const CUPRATED_VERSION_IS_RELEASE: bool = !cfg!(debug_assertions);