Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions crates/chia-consensus/src/consensus_constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,16 @@ pub struct ConsensusConstants {
min_plot_strength: u8,
max_plot_strength: u8,

plot_filter_v2_first_adjustment_height: u32,
plot_filter_v2_second_adjustment_height: u32,
plot_filter_v2_third_adjustment_height: u32,
/// relative heights from hard fork 2 activation, where the plot filter
/// tightens. Ordered in reverse chronological order, the first height is
/// the last to activate
plot_filter_v2_relative_height: [u32; 9],

/// SPs per plot filter window (64 SPs / 4 windows), v2 plots
filter_window_size: u8,

/// effective plot filter cap
max_effective_plot_filter_bits: u8,

/// Whether we're running on a testnet (or in tests) as opposed to mainnet.
testnet: bool,
Expand Down Expand Up @@ -249,9 +256,19 @@ pub const TEST_CONSTANTS: ConsensusConstants = ConsensusConstants {
min_plot_strength: 2,
max_plot_strength: 32,

plot_filter_v2_first_adjustment_height: 0xffff_ffff, // placeholder
plot_filter_v2_second_adjustment_height: 0xffff_ffff, // placeholder
plot_filter_v2_third_adjustment_height: 0xffff_ffff, // placeholder
plot_filter_v2_relative_height: [
50_494_000_u32,
45_444_000,
40_394_000,
35_343_000,
30_298_000,
25_247_000,
20_197_000,
15_146_000,
10_101_000,
],
filter_window_size: 16,
max_effective_plot_filter_bits: 13,

testnet: true,
};
16 changes: 13 additions & 3 deletions tests/run_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,19 @@
PLOT_FILTER_32_HEIGHT=uint32(20643000),
MIN_PLOT_STRENGTH=uint8(2),
MAX_PLOT_STRENGTH=uint8(32),
PLOT_FILTER_V2_FIRST_ADJUSTMENT_HEIGHT=uint32(0xFFFFFFFF),
PLOT_FILTER_V2_SECOND_ADJUSTMENT_HEIGHT=uint32(0xFFFFFFFF),
PLOT_FILTER_V2_THIRD_ADJUSTMENT_HEIGHT=uint32(0xFFFFFFFF),
PLOT_FILTER_V2_RELATIVE_HEIGHT=[
uint32(50_494_000),
uint32(45_444_000),
uint32(40_394_000),
uint32(35_343_000),
uint32(30_298_000),
uint32(25_247_000),
uint32(20_197_000),
uint32(15_146_000),
uint32(10_101_000),
],
FILTER_WINDOW_SIZE=uint8(16),
MAX_EFFECTIVE_PLOT_FILTER_BITS=uint8(13),
TESTNET=True,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_consensus_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ def test_formatting() -> None:

assert (
f"{DEFAULT_CONSTANTS}"
== "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: 134217728, DIFFICULTY_CONSTANT_FACTOR: 147573952589676412928, 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_V1: 9, NUMBER_ZERO_BITS_PLOT_FILTER_V2: 5, MIN_PLOT_SIZE_V1: 32, MAX_PLOT_SIZE_V1: 50, PLOT_SIZE_V2: 28, SUB_SLOT_TIME_TARGET: 600, NUM_SP_INTERVALS_EXTRA: 3, MAX_FUTURE_TIME2: 120, NUMBER_OF_TIMESTAMPS: 11, GENESIS_CHALLENGE: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855, AGG_SIG_ME_ADDITIONAL_DATA: ccd5bb71183532bff220ba46c268991a3ff07eb358e8255a65c30a2dce0e5fbb, AGG_SIG_PARENT_ADDITIONAL_DATA: baf5d69c647c91966170302d18521b0a85663433d161e72c826ed08677b53a74, AGG_SIG_PUZZLE_ADDITIONAL_DATA: 284fa2ef486c7a41cc29fc99c9d08376161e93dd37817edb8219f42dca7592c4, AGG_SIG_AMOUNT_ADDITIONAL_DATA: cda186a9cd030f7a130fae45005e81cae7a90e0fa205b75f6aebc0d598e0348e, AGG_SIG_PUZZLE_AMOUNT_ADDITIONAL_DATA: 0f7d90dff0613e6901e24dae59f1e690f18b8f5fbdcf1bb192ac9deaf7de22ad, AGG_SIG_PARENT_AMOUNT_ADDITIONAL_DATA: 585796bd90bb553c0430b87027ffee08d88aba0162c6e1abbbcc6b583f2ae7f9, AGG_SIG_PARENT_PUZZLE_ADDITIONAL_DATA: 2ebfdae17b29d83bae476a25ea06f0c4bd57298faddbbc3ec5ad29b9b86ce5df, GENESIS_PRE_FARM_POOL_PUZZLE_HASH: d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc, GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: 3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af, MAX_VDF_WITNESS_SIZE: 64, MEMPOOL_BLOCK_BUFFER: 10, MAX_COIN_AMOUNT: 18446744073709551615, MAX_BLOCK_COST_CLVM: 11000000000, COST_PER_BYTE: 12000, WEIGHT_PROOF_THRESHOLD: 2, WEIGHT_PROOF_RECENT_BLOCKS: 1000, MAX_BLOCK_COUNT_PER_REQUESTS: 32, BLOCKS_CACHE_SIZE: 5120, MAX_GENERATOR_REF_LIST_SIZE: 512, POOL_SUB_SLOT_ITERS: 37600000000, HARD_FORK_HEIGHT: 5496000, HARD_FORK2_HEIGHT: 4294967295, SOFT_FORK8_HEIGHT: 8655000, SOFT_FORK9_HEIGHT: 4294967295, PLOT_V1_PHASE_OUT_EPOCH_BITS: 8, PLOT_FILTER_128_HEIGHT: 10542000, PLOT_FILTER_64_HEIGHT: 15592000, PLOT_FILTER_32_HEIGHT: 20643000, MIN_PLOT_STRENGTH: 2, MAX_PLOT_STRENGTH: 32, PLOT_FILTER_V2_FIRST_ADJUSTMENT_HEIGHT: 4294967295, PLOT_FILTER_V2_SECOND_ADJUSTMENT_HEIGHT: 4294967295, PLOT_FILTER_V2_THIRD_ADJUSTMENT_HEIGHT: 4294967295, TESTNET: true, }"
== "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: 134217728, DIFFICULTY_CONSTANT_FACTOR: 147573952589676412928, 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_V1: 9, NUMBER_ZERO_BITS_PLOT_FILTER_V2: 5, MIN_PLOT_SIZE_V1: 32, MAX_PLOT_SIZE_V1: 50, PLOT_SIZE_V2: 28, SUB_SLOT_TIME_TARGET: 600, NUM_SP_INTERVALS_EXTRA: 3, MAX_FUTURE_TIME2: 120, NUMBER_OF_TIMESTAMPS: 11, GENESIS_CHALLENGE: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855, AGG_SIG_ME_ADDITIONAL_DATA: ccd5bb71183532bff220ba46c268991a3ff07eb358e8255a65c30a2dce0e5fbb, AGG_SIG_PARENT_ADDITIONAL_DATA: baf5d69c647c91966170302d18521b0a85663433d161e72c826ed08677b53a74, AGG_SIG_PUZZLE_ADDITIONAL_DATA: 284fa2ef486c7a41cc29fc99c9d08376161e93dd37817edb8219f42dca7592c4, AGG_SIG_AMOUNT_ADDITIONAL_DATA: cda186a9cd030f7a130fae45005e81cae7a90e0fa205b75f6aebc0d598e0348e, AGG_SIG_PUZZLE_AMOUNT_ADDITIONAL_DATA: 0f7d90dff0613e6901e24dae59f1e690f18b8f5fbdcf1bb192ac9deaf7de22ad, AGG_SIG_PARENT_AMOUNT_ADDITIONAL_DATA: 585796bd90bb553c0430b87027ffee08d88aba0162c6e1abbbcc6b583f2ae7f9, AGG_SIG_PARENT_PUZZLE_ADDITIONAL_DATA: 2ebfdae17b29d83bae476a25ea06f0c4bd57298faddbbc3ec5ad29b9b86ce5df, GENESIS_PRE_FARM_POOL_PUZZLE_HASH: d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc, GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: 3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af, MAX_VDF_WITNESS_SIZE: 64, MEMPOOL_BLOCK_BUFFER: 10, MAX_COIN_AMOUNT: 18446744073709551615, MAX_BLOCK_COST_CLVM: 11000000000, COST_PER_BYTE: 12000, WEIGHT_PROOF_THRESHOLD: 2, WEIGHT_PROOF_RECENT_BLOCKS: 1000, MAX_BLOCK_COUNT_PER_REQUESTS: 32, BLOCKS_CACHE_SIZE: 5120, MAX_GENERATOR_REF_LIST_SIZE: 512, POOL_SUB_SLOT_ITERS: 37600000000, HARD_FORK_HEIGHT: 5496000, HARD_FORK2_HEIGHT: 4294967295, SOFT_FORK8_HEIGHT: 8655000, SOFT_FORK9_HEIGHT: 4294967295, PLOT_V1_PHASE_OUT_EPOCH_BITS: 8, PLOT_FILTER_128_HEIGHT: 10542000, PLOT_FILTER_64_HEIGHT: 15592000, PLOT_FILTER_32_HEIGHT: 20643000, MIN_PLOT_STRENGTH: 2, MAX_PLOT_STRENGTH: 32, PLOT_FILTER_V2_RELATIVE_HEIGHT: [50494000, 45444000, 40394000, 35343000, 30298000, 25247000, 20197000, 15146000, 10101000], FILTER_WINDOW_SIZE: 16, MAX_EFFECTIVE_PLOT_FILTER_BITS: 13, TESTNET: true, }"
)
18 changes: 9 additions & 9 deletions wheel/python/chia_rs/chia_rs.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4707,9 +4707,9 @@ class ConsensusConstants:
PLOT_FILTER_32_HEIGHT: uint32
MIN_PLOT_STRENGTH: uint8
MAX_PLOT_STRENGTH: uint8
PLOT_FILTER_V2_FIRST_ADJUSTMENT_HEIGHT: uint32
PLOT_FILTER_V2_SECOND_ADJUSTMENT_HEIGHT: uint32
PLOT_FILTER_V2_THIRD_ADJUSTMENT_HEIGHT: uint32
PLOT_FILTER_V2_RELATIVE_HEIGHT: list[uint32]
FILTER_WINDOW_SIZE: uint8
MAX_EFFECTIVE_PLOT_FILTER_BITS: uint8
TESTNET: bool
def __new__(
cls,
Expand Down Expand Up @@ -4765,9 +4765,9 @@ class ConsensusConstants:
PLOT_FILTER_32_HEIGHT: uint32,
MIN_PLOT_STRENGTH: uint8,
MAX_PLOT_STRENGTH: uint8,
PLOT_FILTER_V2_FIRST_ADJUSTMENT_HEIGHT: uint32,
PLOT_FILTER_V2_SECOND_ADJUSTMENT_HEIGHT: uint32,
PLOT_FILTER_V2_THIRD_ADJUSTMENT_HEIGHT: uint32,
PLOT_FILTER_V2_RELATIVE_HEIGHT: Sequence[uint32],
FILTER_WINDOW_SIZE: uint8,
MAX_EFFECTIVE_PLOT_FILTER_BITS: uint8,
TESTNET: bool
) -> Self: ...
def __hash__(self) -> int: ...
Expand Down Expand Up @@ -4839,8 +4839,8 @@ class ConsensusConstants:
PLOT_FILTER_32_HEIGHT: Union[ uint32, _Unspec] = _Unspec(),
MIN_PLOT_STRENGTH: Union[ uint8, _Unspec] = _Unspec(),
MAX_PLOT_STRENGTH: Union[ uint8, _Unspec] = _Unspec(),
PLOT_FILTER_V2_FIRST_ADJUSTMENT_HEIGHT: Union[ uint32, _Unspec] = _Unspec(),
PLOT_FILTER_V2_SECOND_ADJUSTMENT_HEIGHT: Union[ uint32, _Unspec] = _Unspec(),
PLOT_FILTER_V2_THIRD_ADJUSTMENT_HEIGHT: Union[ uint32, _Unspec] = _Unspec(),
PLOT_FILTER_V2_RELATIVE_HEIGHT: Union[ list[uint32], _Unspec] = _Unspec(),
FILTER_WINDOW_SIZE: Union[ uint8, _Unspec] = _Unspec(),
MAX_EFFECTIVE_PLOT_FILTER_BITS: Union[ uint8, _Unspec] = _Unspec(),
TESTNET: Union[ bool, _Unspec] = _Unspec()) -> ConsensusConstants: ...
def truncate(self, field: str, length: int) -> None: ...
Loading