mirror of
https://github.com/hinto-janai/cuprate.git
synced 2025-03-12 09:31:30 +00:00
remove todos
This commit is contained in:
parent
2c9725008a
commit
b4b456b78a
16 changed files with 14 additions and 384 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -598,7 +598,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cuprate-constants"
|
||||
version = "0.0.0"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"hex",
|
||||
"monero-serai",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "cuprate-constants"
|
||||
version = "0.0.0"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
description = "Constant/static data used throughout Cuprate"
|
||||
license = "MIT"
|
||||
|
|
|
@ -1 +1,6 @@
|
|||
# TODO
|
||||
# cuprate-constants
|
||||
This crate contains general constants that are not specific to any particular
|
||||
part of the codebase yet are used in multiple places such as the [`MAXIMUM_BLOCK_HEIGHT`].
|
||||
|
||||
## Static data
|
||||
This crate also contains `static` data used in multiple places such as the [`GENESIS_BLOCK`].
|
|
@ -1,67 +1,7 @@
|
|||
//! TODO
|
||||
//! Block related.
|
||||
|
||||
use crate::{difficulty, macros::monero_definition_link};
|
||||
use crate::macros::monero_definition_link;
|
||||
|
||||
/// The maximum block height possible.
|
||||
#[doc = monero_definition_link!(a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623, "/src/cryptonote_config.h", 40)]
|
||||
pub const MAX_BLOCK_HEIGHT: usize = 500_000_000;
|
||||
|
||||
/// TODO
|
||||
pub const CURRENT_BLOCK_MAJOR_VERSION: u64 = 1;
|
||||
|
||||
/// TODO
|
||||
pub const CURRENT_BLOCK_MINOR_VERSION: u64 = 0;
|
||||
|
||||
/// TODO
|
||||
pub const CRYPTONOTE_BLOCK_FUTURE_TIME_LIMIT: u64 = 60 * 60 * 2;
|
||||
|
||||
/// TODO
|
||||
pub const CRYPTONOTE_REWARD_BLOCKS_WINDOW: u64 = 100;
|
||||
|
||||
/// TODO
|
||||
pub const CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V2: u64 = 60000; //size of block (bytes) after which reward for block calculated ;using block size
|
||||
|
||||
/// TODO
|
||||
pub const CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1: u64 = 20000; //size of block (bytes) after which reward for block calculated ;using block size - before first fork
|
||||
|
||||
/// TODO
|
||||
pub const CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5: u64 = 300000; //size of block (bytes) after which reward for block calculated ;using block size - second change, from v5
|
||||
|
||||
/// TODO
|
||||
pub const CRYPTONOTE_LONG_TERM_BLOCK_WEIGHT_WINDOW_SIZE: u64 = 100000; // size in blocks of the long term block weight median window;
|
||||
|
||||
/// TODO
|
||||
pub const CRYPTONOTE_SHORT_TERM_BLOCK_WEIGHT_SURGE_FACTOR: u64 = 50;
|
||||
|
||||
/// TODO
|
||||
pub const ORPHANED_BLOCKS_MAX_COUNT: u64 = 100;
|
||||
|
||||
/// TODO
|
||||
pub const CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE: u64 = 600;
|
||||
|
||||
/// TODO
|
||||
pub const DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN: u64 = difficulty::DIFFICULTY_TARGET_V1.as_secs(); //just alias; used by tests;
|
||||
|
||||
/// TODO
|
||||
pub const BLOCKS_IDS_SYNCHRONIZING_DEFAULT_COUNT: u64 = 10000; //by default, blocks ids count in synchronizing;
|
||||
|
||||
/// TODO
|
||||
pub const BLOCKS_IDS_SYNCHRONIZING_MAX_COUNT: u64 = 25000; //max blocks ids count in synchronizing;
|
||||
|
||||
/// TODO
|
||||
pub const BLOCKS_SYNCHRONIZING_DEFAULT_COUNT_PRE_V4: u64 = 100; //by default, blocks count in blocks downloading;
|
||||
|
||||
/// TODO
|
||||
pub const BLOCKS_SYNCHRONIZING_DEFAULT_COUNT: u64 = 20; //by default, blocks count in blocks downloading;
|
||||
|
||||
/// TODO
|
||||
pub const BLOCKS_SYNCHRONIZING_MAX_COUNT: u64 = 2048; //must be a power of 2, greater than 128, equal to ;SEEDHASH_EPOCH_BLOCKS
|
||||
|
||||
/// TODO
|
||||
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;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//! TODO
|
||||
//! Build related metadata.
|
||||
|
||||
/// The current commit hash of the root Cuprate repository.
|
||||
///
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
//! TODO
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::macros::monero_definition_link;
|
||||
|
||||
/// TODO
|
||||
#[doc = monero_definition_link!(a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623, "/src/cryptonote_config.h", 81)]
|
||||
///
|
||||
/// ```rust
|
||||
/// # use cuprate_constants::difficulty::*;
|
||||
/// assert_eq!(DIFFICULTY_TARGET_V1.as_secs(), 60);
|
||||
/// ```
|
||||
pub const DIFFICULTY_TARGET_V1: Duration = Duration::from_secs(60);
|
||||
|
||||
/// TODO
|
||||
#[doc = monero_definition_link!(a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623, "/src/cryptonote_config.h", 80)]
|
||||
///
|
||||
/// ```rust
|
||||
/// # use cuprate_constants::difficulty::*;
|
||||
/// assert_eq!(DIFFICULTY_TARGET_V2.as_secs(), 120);
|
||||
/// ```
|
||||
pub const DIFFICULTY_TARGET_V2: Duration = Duration::from_secs(120);
|
||||
|
||||
/// TODO
|
||||
pub const DIFFICULTY_WINDOW: u64 = 720; // blocks;
|
||||
|
||||
/// TODO
|
||||
pub const DIFFICULTY_LAG: u64 = 15; // !!!;
|
||||
|
||||
/// TODO
|
||||
pub const DIFFICULTY_CUT: u64 = 60; // timestamps to cut after sorting;
|
||||
|
||||
/// TODO
|
||||
pub const DIFFICULTY_BLOCKS_COUNT: u64 = DIFFICULTY_WINDOW + DIFFICULTY_LAG;
|
|
@ -1,6 +1,6 @@
|
|||
//! Genesis block/transaction data.
|
||||
|
||||
#![allow(const_item_mutation, reason = "&mut is needed for `Read`")]
|
||||
#![expect(const_item_mutation, reason = "&mut is needed for `Read`")]
|
||||
|
||||
#[cfg(feature = "monero-serai")]
|
||||
use monero_serai::{block::Block, transaction::Transaction};
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
//! TODO
|
||||
|
||||
/// TODO
|
||||
pub const HF_VERSION_DYNAMIC_FEE: u64 = 4;
|
||||
|
||||
/// TODO
|
||||
pub const HF_VERSION_MIN_MIXIN_4: u64 = 6;
|
||||
|
||||
/// TODO
|
||||
pub const HF_VERSION_MIN_MIXIN_6: u64 = 7;
|
||||
|
||||
/// TODO
|
||||
pub const HF_VERSION_MIN_MIXIN_10: u64 = 8;
|
||||
|
||||
/// TODO
|
||||
pub const HF_VERSION_MIN_MIXIN_15: u64 = 15;
|
||||
|
||||
/// TODO
|
||||
pub const HF_VERSION_ENFORCE_RCT: u64 = 6;
|
||||
|
||||
/// TODO
|
||||
pub const HF_VERSION_PER_BYTE_FEE: u64 = 8;
|
||||
|
||||
/// TODO
|
||||
pub const HF_VERSION_SMALLER_BP: u64 = 10;
|
||||
|
||||
/// TODO
|
||||
pub const HF_VERSION_LONG_TERM_BLOCK_WEIGHT: u64 = 10;
|
||||
|
||||
/// TODO
|
||||
pub const HF_VERSION_MIN_2_OUTPUTS: u64 = 12;
|
||||
|
||||
/// TODO
|
||||
pub const HF_VERSION_MIN_V2_COINBASE_TX: u64 = 12;
|
||||
|
||||
/// TODO
|
||||
pub const HF_VERSION_SAME_MIXIN: u64 = 12;
|
||||
|
||||
/// TODO
|
||||
pub const HF_VERSION_REJECT_SIGS_IN_COINBASE: u64 = 12;
|
||||
|
||||
/// TODO
|
||||
pub const HF_VERSION_ENFORCE_MIN_AGE: u64 = 12;
|
||||
|
||||
/// TODO
|
||||
pub const HF_VERSION_EFFECTIVE_SHORT_TERM_MEDIAN_IN_PENALTY: u64 = 12;
|
||||
|
||||
/// TODO
|
||||
pub const HF_VERSION_EXACT_COINBASE: u64 = 13;
|
||||
|
||||
/// TODO
|
||||
pub const HF_VERSION_CLSAG: u64 = 13;
|
||||
|
||||
/// TODO
|
||||
pub const HF_VERSION_DETERMINISTIC_UNLOCK_TIME: u64 = 13;
|
||||
|
||||
/// TODO
|
||||
pub const HF_VERSION_BULLETPROOF_PLUS: u64 = 15;
|
||||
|
||||
/// TODO
|
||||
pub const HF_VERSION_VIEW_TAGS: u64 = 15;
|
||||
|
||||
/// TODO
|
||||
pub const HF_VERSION_2021_SCALING: u64 = 15;
|
|
@ -1,17 +1,9 @@
|
|||
#![doc = include_str!("../README.md")]
|
||||
#![deny(missing_docs)]
|
||||
#![deny(missing_docs, reason = "all constants should document what they are")]
|
||||
|
||||
mod macros;
|
||||
|
||||
pub mod block;
|
||||
pub mod build;
|
||||
pub mod difficulty;
|
||||
pub mod genesis;
|
||||
pub mod hard_fork;
|
||||
pub mod money;
|
||||
pub mod net;
|
||||
pub mod p2p;
|
||||
pub mod pruning;
|
||||
pub mod rpc;
|
||||
pub mod sys;
|
||||
pub mod tx;
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
//! TODO
|
||||
|
||||
use crate::block;
|
||||
|
||||
/// `MONEY_SUPPLY` - total number coins to be generated
|
||||
pub const MONEY_SUPPLY: u64 = u64::MAX - 1;
|
||||
|
||||
/// TODO
|
||||
pub const EMISSION_SPEED_FACTOR_PER_MINUTE: u64 = 20;
|
||||
|
||||
/// TODO
|
||||
pub const FINAL_SUBSIDY_PER_MINUTE: u64 = 300_000_000_000; // 3 * pow(10, 11);
|
||||
|
||||
/// TODO
|
||||
pub const CRYPTONOTE_DISPLAY_DECIMAL_POINT: u64 = 12;
|
||||
|
||||
/// COIN - number of smallest units in one coin
|
||||
pub const COIN: u64 = 1000000000000; // pow(10, 12);
|
||||
|
||||
/// TODO
|
||||
pub const FEE_PER_KB_OLD: u64 = 10000000000; // pow(10, 10);
|
||||
|
||||
/// TODO
|
||||
pub const FEE_PER_KB: u64 = 2000000000; // 2 * pow(10, 9);
|
||||
|
||||
/// TODO
|
||||
pub const FEE_PER_BYTE: u64 = 300000;
|
||||
|
||||
/// TODO
|
||||
pub const DYNAMIC_FEE_PER_KB_BASE_FEE: u64 = 2000000000; // 2 * pow(10,9);
|
||||
|
||||
/// TODO
|
||||
pub const DYNAMIC_FEE_PER_KB_BASE_BLOCK_REWARD: u64 = 10000000000000; // 10 * pow(10,12);
|
||||
|
||||
/// TODO
|
||||
pub const DYNAMIC_FEE_PER_KB_BASE_FEE_V5: u64 = 2000000000
|
||||
* block::CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V2
|
||||
/ block::CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5;
|
||||
|
||||
/// TODO
|
||||
pub const DYNAMIC_FEE_REFERENCE_TRANSACTION_WEIGHT: u64 = 3000;
|
|
@ -1,7 +0,0 @@
|
|||
//! TODO
|
||||
|
||||
/// TODO
|
||||
pub const CRYPTONOTE_DNS_TIMEOUT_MS: u64 = 20000;
|
||||
|
||||
/// TODO
|
||||
pub const DNS_BLOCKLIST_LIFETIME: u64 = 86400 * 8;
|
|
@ -1,76 +0,0 @@
|
|||
//! TODO
|
||||
|
||||
/// TODO
|
||||
pub const CRYPTONOTE_DNS_TIMEOUT_MS: u64 = 20000;
|
||||
|
||||
/// TODO
|
||||
pub const DNS_BLOCKLIST_LIFETIME: u64 = 86400 * 8;
|
||||
|
||||
/// TODO
|
||||
pub const P2P_LOCAL_WHITE_PEERLIST_LIMIT: u64 = 1000;
|
||||
|
||||
/// TODO
|
||||
pub const P2P_LOCAL_GRAY_PEERLIST_LIMIT: u64 = 5000;
|
||||
|
||||
/// TODO
|
||||
pub const P2P_DEFAULT_CONNECTIONS_COUNT: u64 = 12;
|
||||
|
||||
/// TODO
|
||||
pub const P2P_DEFAULT_HANDSHAKE_INTERVAL: u64 = 60; //secondes
|
||||
|
||||
/// TODO
|
||||
pub const P2P_DEFAULT_PACKET_MAX_SIZE: u64 = 50000000; //50000000 bytes maximum packet size
|
||||
|
||||
/// TODO
|
||||
pub const P2P_DEFAULT_PEERS_IN_HANDSHAKE: u64 = 250;
|
||||
|
||||
/// TODO
|
||||
pub const P2P_MAX_PEERS_IN_HANDSHAKE: u64 = 250;
|
||||
|
||||
/// TODO
|
||||
pub const P2P_DEFAULT_CONNECTION_TIMEOUT: u64 = 5000; //5 seconds
|
||||
|
||||
/// TODO
|
||||
pub const P2P_DEFAULT_SOCKS_CONNECT_TIMEOUT: u64 = 45; // seconds
|
||||
|
||||
/// TODO
|
||||
pub const P2P_DEFAULT_PING_CONNECTION_TIMEOUT: u64 = 2000; //2 seconds
|
||||
|
||||
/// TODO
|
||||
pub const P2P_DEFAULT_INVOKE_TIMEOUT: u64 = 60 * 2 * 1000; //2 minutes
|
||||
|
||||
/// TODO
|
||||
pub const P2P_DEFAULT_HANDSHAKE_INVOKE_TIMEOUT: u64 = 5000; //5 seconds
|
||||
|
||||
/// TODO
|
||||
pub const P2P_DEFAULT_WHITELIST_CONNECTIONS_PERCENT: u64 = 70;
|
||||
|
||||
/// TODO
|
||||
pub const P2P_DEFAULT_ANCHOR_CONNECTIONS_COUNT: u64 = 2;
|
||||
|
||||
/// TODO
|
||||
pub const P2P_DEFAULT_SYNC_SEARCH_CONNECTIONS_COUNT: u64 = 2;
|
||||
|
||||
/// TODO
|
||||
pub const P2P_DEFAULT_LIMIT_RATE_UP: u64 = 2048; // kB/s
|
||||
|
||||
/// TODO
|
||||
pub const P2P_DEFAULT_LIMIT_RATE_DOWN: u64 = 8192; // kB/s
|
||||
|
||||
/// TODO
|
||||
pub const P2P_FAILED_ADDR_FORGET_SECONDS: u64 = 60 * 60; //1 hour
|
||||
|
||||
/// TODO
|
||||
pub const P2P_IP_BLOCKTIME: u64 = 60 * 60 * 24; //24 hour
|
||||
|
||||
/// TODO
|
||||
pub const P2P_IP_FAILS_BEFORE_BLOCK: u64 = 10;
|
||||
|
||||
/// TODO
|
||||
pub const P2P_IDLE_CONNECTION_KILL_INTERVAL: u64 = 5 * 60; //5 minutes
|
||||
|
||||
/// TODO
|
||||
pub const P2P_SUPPORT_FLAG_FLUFFY_BLOCKS: u64 = 0x01;
|
||||
|
||||
/// TODO
|
||||
pub const P2P_SUPPORT_FLAGS: u64 = P2P_SUPPORT_FLAG_FLUFFY_BLOCKS;
|
|
@ -1,10 +0,0 @@
|
|||
//! TODO
|
||||
|
||||
/// The default log stripes for Monero pruning.
|
||||
pub const CRYPTONOTE_PRUNING_LOG_STRIPES: u32 = 3;
|
||||
|
||||
/// The amount of blocks that peers keep before another stripe starts storing blocks.
|
||||
pub const CRYPTONOTE_PRUNING_STRIPE_SIZE: usize = 4096;
|
||||
|
||||
/// The amount of blocks from the top of the chain that should not be pruned.
|
||||
pub const CRYPTONOTE_PRUNING_TIP_BLOCKS: usize = 5500;
|
|
@ -1,7 +1,4 @@
|
|||
//! TODO
|
||||
//!
|
||||
//! - <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>
|
||||
//! RPC related.
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
//! TODO
|
||||
|
||||
/// TODO
|
||||
pub const THREAD_STACK_SIZE: u64 = 5 * 1024 * 1024;
|
|
@ -1,67 +0,0 @@
|
|||
//! TODO
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::{difficulty, macros::monero_definition_link};
|
||||
|
||||
/// TODO
|
||||
#[doc = monero_definition_link!(a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623, "/src/cryptonote_config.h", 41)]
|
||||
pub const MAX_TX_SIZE: u64 = 1_000_000;
|
||||
|
||||
/// TODO
|
||||
#[doc = monero_definition_link!(a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623, "/src/cryptonote_config.h", 42)]
|
||||
pub const MAX_TX_PER_BLOCK: u64 = 0x10000000;
|
||||
|
||||
/// TODO
|
||||
#[doc = monero_definition_link!(a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623, "/src/cryptonote_config.h", 44)]
|
||||
pub const MINED_MONEY_UNLOCK_WINDOW: u64 = 60;
|
||||
|
||||
/// TODO
|
||||
#[doc = monero_definition_link!(a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623, "/src/cryptonote_config.h", 45)]
|
||||
pub const CURRENT_TRANSACTION_VERSION: u64 = 2;
|
||||
|
||||
/// TODO
|
||||
#[doc = monero_definition_link!(a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623, "/src/cryptonote_config.h", 49)]
|
||||
pub const DEFAULT_TX_SPENDABLE_AGE: u64 = 10;
|
||||
|
||||
/// TODO
|
||||
pub const LOCKED_TX_ALLOWED_DELTA_SECONDS_V1: u64 =
|
||||
difficulty::DIFFICULTY_TARGET_V1.as_secs() * LOCKED_TX_ALLOWED_DELTA_BLOCKS;
|
||||
|
||||
/// TODO
|
||||
pub const LOCKED_TX_ALLOWED_DELTA_SECONDS_V2: u64 =
|
||||
difficulty::DIFFICULTY_TARGET_V2.as_secs() * LOCKED_TX_ALLOWED_DELTA_BLOCKS;
|
||||
|
||||
/// TODO
|
||||
pub const LOCKED_TX_ALLOWED_DELTA_BLOCKS: u64 = 1;
|
||||
|
||||
/// TODO
|
||||
#[doc = monero_definition_link!(a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623, "/src/cryptonote_config.h", 213)]
|
||||
pub const MAX_TX_EXTRA_SIZE: u64 = 1060;
|
||||
|
||||
/// Three days.
|
||||
#[doc = monero_definition_link!(a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623, "/src/cryptonote_config.h", 102)]
|
||||
///
|
||||
/// ```rust
|
||||
/// # use cuprate_constants::tx::*;
|
||||
/// assert_eq!(MEMPOOL_TX_LIFETIME.as_secs(), 86_400 * 3);
|
||||
/// ```
|
||||
pub const MEMPOOL_TX_LIFETIME: Duration = Duration::from_secs(86_400 * 3);
|
||||
|
||||
/// One week.
|
||||
#[doc = monero_definition_link!(a1dc85c5373a30f14aaf7dcfdd95f5a7375d3623, "/src/cryptonote_config.h", 103)]
|
||||
///
|
||||
/// ```rust
|
||||
/// # 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: Duration = Duration::from_secs(86_400 * 7);
|
||||
|
||||
/// TODO
|
||||
pub const PER_KB_FEE_QUANTIZATION_DECIMALS: u64 = 8;
|
||||
|
||||
/// TODO
|
||||
pub const SCALING_2021_FEE_ROUNDING_PLACES: u64 = 2;
|
||||
|
||||
/// TODO
|
||||
pub const DEFAULT_TXPOOL_MAX_WEIGHT: u64 = 648_000_000; // 3 days at 300000, in bytes
|
Loading…
Reference in a new issue