Skip to content

Commit

Permalink
Merge pull request #535 from Chia-Network/test_constants
Browse files Browse the repository at this point in the history
Add TEST_CONSTANTS to consensus constants
  • Loading branch information
matt-o-how committed May 23, 2024
2 parents 248437a + 47c79c0 commit 4a78212
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
55 changes: 55 additions & 0 deletions crates/chia-consensus/src/consensus_constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use chia_streamable_macro::streamable;

#[cfg(feature = "py-bindings")]
use chia_py_streamable_macro::{PyGetters, PyJsonDict, PyStreamable};
use hex_literal::hex;

#[cfg_attr(
feature = "py-bindings",
Expand Down Expand Up @@ -135,3 +136,57 @@ pub struct ConsensusConstants {
/// The 32 plot filter adjustment height.
plot_filter_32_height: u32,
}

pub const TEST_CONSTANTS: ConsensusConstants = ConsensusConstants {
slot_blocks_target: 32,
min_blocks_per_challenge_block: 16,
max_sub_slot_blocks: 128,
num_sps_sub_slot: 64,
sub_slot_iters_starting: u64::pow(2, 27),
difficulty_constant_factor: u128::pow(2, 67),
difficulty_starting: 7,
difficulty_change_max_factor: 3,
sub_epoch_blocks: 384,
epoch_blocks: 4608,
significant_bits: 8,
discriminant_size_bits: 1024,
number_zero_bits_plot_filter: 9,
min_plot_size: 32,
max_plot_size: 50,
sub_slot_time_target: 600,
num_sp_intervals_extra: 3,
max_future_time2: 2 * 60,
number_of_timestamps: 11,
genesis_challenge: Bytes32::new(hex!(
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
)),
agg_sig_me_additional_data: Bytes32::new(hex!(
"ccd5bb71183532bff220ba46c268991a3ff07eb358e8255a65c30a2dce0e5fbb"
)),
genesis_pre_farm_pool_puzzle_hash: Bytes32::new(hex!(
"d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc"
)),
genesis_pre_farm_farmer_puzzle_hash: Bytes32::new(hex!(
"3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af"
)),
max_vdf_witness_size: 64,
mempool_block_buffer: 10,
max_coin_amount: u64::MAX,
max_block_cost_clvm: 11000000000,
cost_per_byte: 12000,
weight_proof_threshold: 2,
blocks_cache_size: 4608 + (128 * 4),
weight_proof_recent_blocks: 1000,
max_block_count_per_requests: 32,
max_generator_size: 1000000,
max_generator_ref_list_size: 512,
pool_sub_slot_iters: 37600000000,
soft_fork2_height: 0,
soft_fork4_height: 5716000,
soft_fork5_height: 5940000,
hard_fork_height: 5496000,
hard_fork_fix_height: 5496000,
plot_filter_128_height: 10542000,
plot_filter_64_height: 15592000,
plot_filter_32_height: 20643000,
};
2 changes: 1 addition & 1 deletion crates/chia-protocol/src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl Deref for Bytes {
pub struct BytesImpl<const N: usize>([u8; N]);

impl<const N: usize> BytesImpl<N> {
pub fn new(bytes: [u8; N]) -> Self {
pub const fn new(bytes: [u8; N]) -> Self {
Self(bytes)
}

Expand Down

0 comments on commit 4a78212

Please sign in to comment.