Skip to content

feat: decouple testnet and testing config#1109

Merged
JesseTheRobot merged 4 commits into
masterfrom
feat/testnet-consensus-config
Jan 22, 2026
Merged

feat: decouple testnet and testing config#1109
JesseTheRobot merged 4 commits into
masterfrom
feat/testnet-consensus-config

Conversation

@JesseTheRobot

@JesseTheRobot JesseTheRobot commented Jan 22, 2026

Copy link
Copy Markdown
Member

Describe the changes
Decouples the testnet and testing consensus configuration, and updates the testnet configuration to mirror the actual configuration used on testnet.

Related Issue(s)
Please link to the issue(s) that will be closed with this PR.

Checklist

  • Tests have been added/updated for the changes.
  • Documentation has been updated for the changes (if applicable).
  • The code follows Rust's style guidelines.

Additional Context
Add any other context about the pull request here.

Summary by CodeRabbit

  • Tests

    • Updated consensus validation and storage pricing tests to use the standard testing defaults instead of prior testnet-style defaults.
  • Chores

    • Added/updated a dedicated testnet configuration and adjusted related configuration constants, genesis/hardfork values, and deserialization handling for consistency across modules.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 22, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds a new ConsensusConfig::testnet() with comprehensive testnet defaults and updates tests to use ConsensusConfig::testing() instead of testnet() in several places, shifting the testing baseline and wiring new constants and deserialization for aurora activation.

Changes

Cohort / File(s) Summary
Consensus config implementation
crates/types/src/config/consensus.rs
Added/modified pub fn testnet() -> Self providing full testnet defaults (genesis, hardforks, constants), added imports (unix_timestamp_string_serde, StringDeserializer), and switched SHA1/VDF values to constant-driven wiring.
Actor tests — block validation
crates/actors/src/block_validation.rs
Replaced ConsensusConfig::testnet() with ConsensusConfig::testing() in config_with_aurora and config_without_aurora test constructors.
Storage pricing tests
crates/types/src/storage_pricing.rs
Replaced ConsensusConfig::testnet() with ConsensusConfig::testing() across tests and adjusted test baselines (e.g., block_time, chunk_size, num_chunks_in_partition) to match the testing defaults.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: decouple testnet and testing config' clearly and concisely summarizes the main change: separating testnet configuration from testing configuration, which is directly reflected in the code changes across all three files.
Docstring Coverage ✅ Passed Docstring coverage is 82.61% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@JesseTheRobot JesseTheRobot marked this pull request as ready for review January 22, 2026 17:56

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In `@crates/types/src/config/consensus.rs`:
- Around line 803-806: The block_reward_config currently hard-codes
half_life_secs; change it to compute the value from the existing constants (e.g.
HALF_LIFE_YEARS and SECS_PER_YEAR) instead of the literal 126144000. Update the
BlockRewardConfig initialization (field half_life_secs) to compute
(HALF_LIFE_YEARS * SECS_PER_YEAR).try_into().unwrap() or the equivalent
conversion used elsewhere in mainnet/testing so the half-life stays in sync with
the project constants.
- Around line 808-812: The comment describing the testnet hardfork configuration
is stale (says "1 proof") while the code sets number_of_ingress_proofs_total: 3
in the IrysHardforkConfig -> FrontierParams block; update the comment to reflect
the actual configured value (3) or change number_of_ingress_proofs_total to 1 to
match the comment, and ensure the comment adjacent to FrontierParams /
IrysHardforkConfig mentions the chosen proof count consistently.

In `@crates/types/src/storage_pricing.rs`:
- Around line 1437-1447: The test computes bytes_to_store before updating
config.chunk_size, so bytes_to_store captures the old value (32) instead of the
intended 262144; move or recompute the bytes_to_store assignment to after the
config.chunk_size change (i.e., after setting config.chunk_size = 262144) so
that the variable used in the test (bytes_to_store) reflects the updated chunk
size in the ConsensusConfig used by the test functions like
number_of_ingress_proofs_total_at and any subsequent assertions.
- Around line 2161-2162: Remove the debug-only logging call dbg!(&config); from
the test code in storage_pricing.rs (delete the dbg!(&config); line); if you
need non-noisy diagnostics keep a proper logger call (e.g., tracing::debug!)
behind a feature or test-only flag, but otherwise simply remove dbg!(&config) so
tests no longer emit debug output.

Comment thread crates/types/src/config/consensus.rs
Comment thread crates/types/src/config/consensus.rs Outdated
Comment thread crates/types/src/storage_pricing.rs
Comment thread crates/types/src/storage_pricing.rs Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@crates/types/src/config/consensus.rs`:
- Around line 816-822: Replace the convoluted deserialization of the hardcoded
Aurora activation timestamp by constructing it directly with
UnixTimestamp::from_secs (use the same approach as testing()), i.e., set
Aurora.activation_timestamp via UnixTimestamp::from_secs(<seconds>) instead of
calling unix_timestamp_string_serde::deserialize with StringDeserializer; also
remove the now-unused StringDeserializer import if it’s no longer referenced.

Comment thread crates/types/src/config/consensus.rs
@JesseTheRobot JesseTheRobot merged commit 2ff0882 into master Jan 22, 2026
18 checks passed
@JesseTheRobot JesseTheRobot deleted the feat/testnet-consensus-config branch January 22, 2026 18:56
This was referenced Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant