mod.rs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /// Block definition
  2. pub mod block;
  3. pub use block::{Block, BlockInfo, BlockProposal, Header, ProposalChain};
  4. /// Consensus metadata
  5. pub mod metadata;
  6. pub use metadata::{LeadProof, Metadata};
  7. /// Consensus participant
  8. pub mod participant;
  9. pub use participant::{KeepAlive, Participant};
  10. /// Consensus state
  11. pub mod state;
  12. pub use state::{ValidatorState, ValidatorStatePtr};
  13. /// Utility functions and types
  14. use crate::util::time::Timestamp;
  15. /// P2P net protocols
  16. pub mod proto;
  17. /// async tasks to utilize the protocols
  18. pub mod task;
  19. /// Lamport clock
  20. pub mod clock;
  21. pub use clock::{Clock, Ticks};
  22. /// Ouroboros simulation
  23. pub mod ouroboros;
  24. /// Ouroboros consensus coins functions
  25. pub mod coins;
  26. /// Utility types
  27. pub mod types;
  28. pub use types::Float10;
  29. /// Utility functions
  30. pub mod utils;
  31. use lazy_static::lazy_static;
  32. lazy_static! {
  33. /// Genesis hash for the mainnet chain
  34. pub static ref MAINNET_GENESIS_HASH_BYTES: blake3::Hash = blake3::hash(b"darkfi_mainnet");
  35. /// Genesis timestamp for the mainnet chain
  36. pub static ref MAINNET_GENESIS_TIMESTAMP: Timestamp = Timestamp(1650887115);
  37. /// Genesis hash for the testnet chain
  38. pub static ref TESTNET_GENESIS_HASH_BYTES: blake3::Hash = blake3::hash(b"darkfi_testnet");
  39. /// Genesis timestamp for the testnet chain
  40. pub static ref TESTNET_GENESIS_TIMESTAMP: Timestamp = Timestamp(1650887115);
  41. /// Block version number
  42. pub static ref BLOCK_VERSION: u8 = 1;
  43. /// Block magic bytes
  44. pub static ref BLOCK_MAGIC_BYTES: [u8; 4] = [0x11, 0x6d, 0x75, 0x1f];
  45. /// Block info magic bytes
  46. pub static ref BLOCK_INFO_MAGIC_BYTES: [u8; 4] = [0x90, 0x44, 0xf1, 0xf6];
  47. // Epoch configuration
  48. /// Slots in an epoch
  49. pub static ref EPOCH_LENGTH: u64 = 10;
  50. /// Block leader reward
  51. pub static ref REWARD: u64 = 420;
  52. /// `2 * DELTA` represents slot time
  53. pub static ref DELTA: u64 = 20;
  54. /// Quarantine duration, in slots
  55. pub static ref QUARANTINE_DURATION: u64 = 5;
  56. /// Leader proof rows number
  57. pub static ref LEADER_PROOF_K: u32 = 13;
  58. // TODO: Describe constants meaning in comment
  59. pub static ref RADIX_BITS: usize = 76;
  60. pub static ref P: &'static str = "28948022309329048855892746252171976963363056481941560715954676764349967630337";
  61. pub static ref LOTTERY_HEAD_START: u64 = 1;
  62. pub static ref PRF_NULLIFIER_PREFIX: u64 = 0;
  63. }