mirror of
https://github.com/hinto-janai/cuprate.git
synced 2025-01-26 20:35:56 +00:00
rpc.rs
docs
This commit is contained in:
parent
751d3c6a94
commit
e6414ce90e
7 changed files with 101 additions and 23 deletions
5
Cargo.lock
generated
5
Cargo.lock
generated
|
@ -602,6 +602,11 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cuprate-constants"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"hex",
|
||||
"monero-serai",
|
||||
"pretty_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cuprate-cryptonight"
|
||||
|
|
|
@ -9,11 +9,16 @@ repository = "https://github.com/Cuprate/cuprate/tree/main/constants"
|
|||
keywords = ["cuprate", "constants"]
|
||||
|
||||
[features]
|
||||
default = []
|
||||
default = ["monero-serai"]
|
||||
monero-serai = ["dep:monero-serai"]
|
||||
|
||||
[dependencies]
|
||||
monero-serai = { workspace = true, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
monero-serai = { workspace = true }
|
||||
hex = { workspace = true, features = ["std"] }
|
||||
pretty_assertions = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
|
@ -62,3 +62,6 @@ pub const BULLETPROOF_MAX_OUTPUTS: u64 = 16;
|
|||
|
||||
/// TODO
|
||||
pub const BULLETPROOF_PLUS_MAX_OUTPUTS: u64 = 16;
|
||||
|
||||
/// TODO
|
||||
pub const BLOCK_SIZE_SANITY_LEEWAY: usize = 100;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
///
|
||||
/// ```rust
|
||||
/// # use cuprate_constants::build::*;
|
||||
/// assert_eq!(COMMIT.is_ascii());
|
||||
/// assert!(COMMIT.is_ascii());
|
||||
/// assert_eq!(COMMIT.as_bytes().len(), 40);
|
||||
/// assert_eq!(COMMIT.to_lowercase(), COMMIT);
|
||||
/// ```
|
||||
|
|
|
@ -6,6 +6,7 @@ mod macros;
|
|||
pub mod block;
|
||||
pub mod build;
|
||||
pub mod difficulty;
|
||||
pub mod genesis;
|
||||
pub mod hard_fork;
|
||||
pub mod money;
|
||||
pub mod net;
|
||||
|
|
|
@ -3,38 +3,102 @@
|
|||
//! - <https://github.com/monero-project/monero/blob/cc73fe71162d564ffda8e549b79a350bca53c454/src/rpc/core_rpc_server.cpp#L63-L77>
|
||||
//! - <https://github.com/monero-project/monero/blob/a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623/src/cryptonote_core/cryptonote_core.cpp#L63-L72>
|
||||
|
||||
/// TODO
|
||||
pub const MAX_RESTRICTED_FAKE_OUTS_COUNT: usize = 40;
|
||||
use std::time::Duration;
|
||||
|
||||
/// TODO
|
||||
pub const MAX_RESTRICTED_GLOBAL_FAKE_OUTS_COUNT: usize = 5000;
|
||||
use crate::macros::monero_definition_link;
|
||||
|
||||
/// 3 days max, the wallet requests 1.8: usize = days.
|
||||
pub const OUTPUT_HISTOGRAM_RECENT_CUTOFF_RESTRICTION: usize = 3 * 86400;
|
||||
|
||||
/// TODO
|
||||
/// Maximum requestable block header range.
|
||||
#[doc = monero_definition_link!(a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623, "/src/rpc/core_rpc_server.cpp", 74)]
|
||||
///
|
||||
/// This is the maximum amount of blocks that can be requested
|
||||
/// per invocation of `get_block_headers` if the RPC server is
|
||||
/// in restricted mode.
|
||||
///
|
||||
/// Used at:
|
||||
/// - <https://github.com/monero-project/monero/blob/a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623/src/rpc/core_rpc_server.cpp#L2593>
|
||||
pub const RESTRICTED_BLOCK_HEADER_RANGE: u64 = 1000;
|
||||
|
||||
/// TODO
|
||||
/// Maximum requestable transaction count.
|
||||
#[doc = monero_definition_link!(a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623, "/src/rpc/core_rpc_server.cpp", 75)]
|
||||
///
|
||||
/// This is the maximum amount of transactions that can be requested
|
||||
/// per invocation of `get_transactions` and `get_indexes` if the
|
||||
/// RPC server is in restricted mode.
|
||||
///
|
||||
/// Used at:
|
||||
/// - <https://github.com/monero-project/monero/blob/a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623/src/rpc/core_rpc_server.cpp#L660>
|
||||
/// - <https://github.com/monero-project/monero/blob/a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623/src/rpc/core_rpc_server.cpp#L998>
|
||||
pub const RESTRICTED_TRANSACTIONS_COUNT: usize = 100;
|
||||
|
||||
/// TODO
|
||||
/// Maximum amount of requestable key image checks.
|
||||
#[doc = monero_definition_link!(a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623, "/src/rpc/core_rpc_server.cpp", 76)]
|
||||
///
|
||||
/// This is the maximum amount of key images that can be requested
|
||||
/// to be checked per `/is_key_image_spent` call if the RPC server
|
||||
/// is in restricted mode.
|
||||
///
|
||||
/// Used at:
|
||||
/// - <https://github.com/monero-project/monero/blob/a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623/src/rpc/core_rpc_server.cpp#L1248>
|
||||
/// - <https://github.com/monero-project/monero/blob/a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623/src/rpc/core_rpc_server.cpp#L3570>
|
||||
pub const RESTRICTED_SPENT_KEY_IMAGES_COUNT: usize = 5000;
|
||||
|
||||
/// TODO
|
||||
/// Maximum amount of requestable blocks.
|
||||
#[doc = monero_definition_link!(a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623, "/src/rpc/core_rpc_server.cpp", 77)]
|
||||
///
|
||||
/// This is the maximum amount of blocks that can be
|
||||
/// requested if the RPC server is in restricted mode.
|
||||
///
|
||||
/// Used at:
|
||||
/// - <https://github.com/monero-project/monero/blob/a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623/src/rpc/core_rpc_server.cpp#L834>
|
||||
/// - <https://github.com/monero-project/monero/blob/a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623/src/rpc/core_rpc_server.cpp#L2519>
|
||||
pub const RESTRICTED_BLOCK_COUNT: usize = 1000;
|
||||
|
||||
/// TODO
|
||||
pub const BLOCK_SIZE_SANITY_LEEWAY: usize = 100;
|
||||
/// Maximum amount of fake outputs.
|
||||
#[doc = monero_definition_link!(a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623, "/src/rpc/core_rpc_server.cpp", 67)]
|
||||
///
|
||||
/// This is the maximum amount of outputs that can be
|
||||
/// requested if the RPC server is in restricted mode.
|
||||
///
|
||||
/// Used at:
|
||||
/// - <https://github.com/monero-project/monero/blob/a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623/src/rpc/core_rpc_server.cpp#L905>
|
||||
/// - <https://github.com/monero-project/monero/blob/a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623/src/rpc/core_rpc_server.cpp#L935>
|
||||
pub const MAX_RESTRICTED_GLOBAL_FAKE_OUTS_COUNT: usize = 5000;
|
||||
|
||||
/// TODO
|
||||
pub const COMMAND_RPC_GET_BLOCKS_FAST_MAX_BLOCK_COUNT: u64 = 1000;
|
||||
/// Maximum output histrogram cutoff.
|
||||
#[doc = monero_definition_link!(a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623, "/src/rpc/core_rpc_server.cpp", 69)]
|
||||
///
|
||||
/// This is the maximum cutoff duration allowed in `get_output_histogram` (3 days).
|
||||
///
|
||||
/// ```rust
|
||||
/// # use cuprate_constants::rpc::*;
|
||||
/// assert_eq!(OUTPUT_HISTOGRAM_RECENT_CUTOFF_RESTRICTION.as_secs(), 86_400 * 3);
|
||||
/// ```
|
||||
///
|
||||
/// Used at:
|
||||
/// <https://github.com/monero-project/monero/blob/a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623/src/rpc/core_rpc_server.cpp#L2961>
|
||||
pub const OUTPUT_HISTOGRAM_RECENT_CUTOFF_RESTRICTION: Duration = Duration::from_secs(86400 * 3);
|
||||
|
||||
/// TODO
|
||||
pub const COMMAND_RPC_GET_BLOCKS_FAST_MAX_TX_COUNT: u64 = 20_000;
|
||||
/// Maximum amount of requestable blocks in `/get_blocks.bin`.
|
||||
#[doc = monero_definition_link!(a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623, "/src/cryptonote_config.h", 128)]
|
||||
pub const GET_BLOCKS_BIN_MAX_BLOCK_COUNT: u64 = 1000;
|
||||
|
||||
/// TODO
|
||||
pub const MAX_RPC_CONTENT_LENGTH: u64 = 1_048_576; // 1 MB
|
||||
/// Maximum amount of requestable transactions in `/get_blocks.bin`.
|
||||
#[doc = monero_definition_link!(a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623, "/src/cryptonote_config.h", 129)]
|
||||
pub const GET_BLOCKS_BIN_MAX_TX_COUNT: u64 = 20_000;
|
||||
|
||||
/// TODO
|
||||
/// Max message content length in the RPC server.
|
||||
#[doc = monero_definition_link!(a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623, "/src/cryptonote_config.h", 130)]
|
||||
///
|
||||
/// This is the maximum amount of bytes an HTTP request
|
||||
/// body can be before the RPC server rejects it (1 megabyte).
|
||||
pub const MAX_RPC_CONTENT_LENGTH: u64 = 1_048_576;
|
||||
|
||||
/// Amount of fails before blocking a remote RPC server.
|
||||
#[doc = monero_definition_link!(a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623, "/src/cryptonote_config.h", 159)]
|
||||
///
|
||||
/// This is the amount of times an RPC will attempt to
|
||||
/// connect to another remote IP before blocking it.
|
||||
///
|
||||
/// RPC servers connect to nodes when they themselves
|
||||
/// lack the data to fulfill the response.
|
||||
pub const RPC_IP_FAILS_BEFORE_BLOCK: u64 = 3;
|
||||
|
|
|
@ -55,7 +55,7 @@ pub const MEMPOOL_TX_LIFETIME: Duration = Duration::from_secs(86_400 * 3);
|
|||
/// # use cuprate_constants::tx::*;
|
||||
/// assert_eq!(MEMPOOL_TX_FROM_ALT_BLOCK_LIVETIME.as_secs(), 86_400 * 7);
|
||||
/// ```
|
||||
pub const MEMPOOL_TX_FROM_ALT_BLOCK_LIVETIME: u64 = 86_400 * 7;
|
||||
pub const MEMPOOL_TX_FROM_ALT_BLOCK_LIVETIME: Duration = Duration::from_secs(86_400 * 7);
|
||||
|
||||
/// TODO
|
||||
pub const PER_KB_FEE_QUANTIZATION_DECIMALS: u64 = 8;
|
||||
|
|
Loading…
Reference in a new issue