Skip to content

fix: unify genesis timestamp across active modules#2112

Merged
Scottcjn merged 1 commit intoScottcjn:mainfrom
createkr:feat/issue-genesis-timestamp-consistency
Apr 6, 2026
Merged

fix: unify genesis timestamp across active modules#2112
Scottcjn merged 1 commit intoScottcjn:mainfrom
createkr:feat/issue-genesis-timestamp-consistency

Conversation

@createkr
Copy link
Copy Markdown
Contributor

@createkr createkr commented Apr 6, 2026

Fix: Unify GENESIS_TIMESTAMP to Canonical Value Across All Modules

What

Replaces stale/hardcoded GENESIS_TIMESTAMP values in 8 active modules with the canonical production value 1764706927 (Dec 2, 2025 — chain launch). Adds a cross-module consistency test to prevent regression.

Why

Six different genesis timestamps existed across the codebase, causing:

  • Governance founder veto bypass — veto window computed from Nov 2023 instead of Dec 2025, making it appear expired when it should be active until Dec 2027
  • Anti-double-mining epoch window drift — 6 hardcoded literals (1728000000) in arithmetic expressions, checking the wrong 24-hour window for duplicate identity detection (~425 epochs offset)
  • Block producer slot mismatch — slot numbers 61,178 higher than canonical, diverging from settlement layer
  • Rewards settlement window drift — epoch queries hit wrong attestation windows
  • Migration tool writes wrong genesis — mainnet DB inherits stale timestamp

Changes

Constants Updated (7 files)

File Old Value New Value
node/governance.py 1700000000 1764706927
node/rustchain_block_producer.py 1728000000 1764706927
node/rewards_implementation_rip200.py 1728000000 1764706927
node/rip_200_round_robin_1cpu1vote_v2.py 1728000000 1764706927
node/rustchain_migration.py 1728000000 1764706927
fossils/fossil_record_export.py 1728000000 1764706927
rips/rustchain-core/config/chain_params.py 1735689600 1764706927

Hardcoded Literals Replaced (1 file)

  • node/anti_double_mining.py — Added module-level GENESIS_TIMESTAMP and BLOCK_TIME constants; replaced 6 hardcoded arithmetic literals across 4 functions (get_epoch_miner_groups, settle_epoch_with_anti_double_mining, calculate_anti_double_mining_rewards, __main__ test block)

New Test (1 file)

  • tests/test_genesis_timestamp_consistency.py — 5 test properties:
    1. All lightweight modules import successfully
    2. All define GENESIS_TIMESTAMP attribute
    3. All match canonical value 1764706927
    4. Source-scanned heavy modules match canonical value
    5. No old hardcoded literals remain in arithmetic expressions

Testing

# New consistency test
python3 tests/test_genesis_timestamp_consistency.py -v
# 5 passed, 0 failed

# Existing blockchain tests (unchanged)
python3 -m pytest tests/test_blockchain.py -v
# 7 passed, 0 failed

# Formal verification tests (unchanged)
python3 tests/test_epoch_settlement_formal.py
# 25 passed, 0 failed

Scope

  • No API changes. Only constant values updated.
  • No behavioral changes for modules already using the canonical value.
  • Governance: Founder veto window now correctly computed from Dec 2025 (active until Dec 2027).
  • Anti-double-mining: Epoch windows now align with canonical consensus.
  • Deprecated modules in deprecated/old_nodes/ intentionally untouched.

Risk

Low. This is a constant-only change. The canonical value 1764706927 is already used by the primary consensus module (rip_200_round_robin_1cpu1vote.py), the integrated node, and the claims eligibility module. This PR brings the remaining modules into alignment.

@createkr createkr requested a review from Scottcjn as a code owner April 6, 2026 01:57
@github-actions github-actions bot added BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) node Node server related tests Test suite changes labels Apr 6, 2026
@createkr
Copy link
Copy Markdown
Contributor Author

createkr commented Apr 6, 2026

For bounty payout, please use RTC wallet: RTC1d48d848a5aa5ecf2c5f01aa5fb64837daaf2f35.

@github-actions github-actions bot added the size/XL PR: 500+ lines label Apr 6, 2026
@Scottcjn
Copy link
Copy Markdown
Owner

Scottcjn commented Apr 6, 2026

Merged. Payment: 40 RTC. Addresses #2111.

Canonicalizes GENESIS_TIMESTAMP = 1764706927 across fossil_record_export.py, anti_double_mining.py, and governance.py. Good housekeeping — scattered magic numbers are a real source of epoch calc bugs.

@Scottcjn Scottcjn merged commit afc50a9 into Scottcjn:main Apr 6, 2026
10 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) node Node server related size/XL PR: 500+ lines tests Test suite changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants