feat!: allow nextnet to mine randomxT#7070
feat!: allow nextnet to mine randomxT#7070SWvheerden merged 9 commits intotari-project:developmentfrom
Conversation
|
Warning Rate limit exceeded@SWvheerden has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 12 minutes and 13 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (8)
WalkthroughThe changes split the Changes
Sequence Diagram(s)sequenceDiagram
participant Node
participant ProtoChainMetadata
participant ChainMetadata
Node->>ProtoChainMetadata: Receive proto with accumulated_difficulty_low & high
ProtoChainMetadata->>ChainMetadata: Validate & concatenate high + low, convert to U512
ChainMetadata-->>ProtoChainMetadata: On serialize, split U512 into high & low, assign to proto fields
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting
📒 Files selected for processing (3)
base_layer/core/src/base_node/proto/chain_metadata.proto(1 hunks)base_layer/core/src/base_node/proto/chain_metadata.rs(2 hunks)base_layer/core/src/consensus/consensus_constants.rs(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
base_layer/core/src/base_node/proto/chain_metadata.rs (2)
base_layer/core/src/proto/block.rs (7)
try_from(43-55)try_from(61-66)try_from(74-90)try_from(96-103)try_from(131-196)try_from(204-224)try_from(230-245)base_layer/common_types/src/chain_metadata.rs (1)
accumulated_difficulty(124-126)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: test (testnet, esmeralda)
- GitHub Check: test (mainnet, stagenet)
- GitHub Check: test (nextnet, nextnet)
- GitHub Check: cargo check with stable
- GitHub Check: ci
🔇 Additional comments (6)
base_layer/core/src/base_node/proto/chain_metadata.proto (1)
15-17: Improved backward compatibility through accumulated difficulty field splitting.The accumulated difficulty field has been split into low and high parts (each representing a u256) to maintain compatibility with older nodes. This is a good approach as it allows new nodes to work with the full 512-bit difficulty while enabling communication with nodes that might only support part of it.
base_layer/core/src/consensus/consensus_constants.rs (3)
673-694: New consensus constants for RandomXT mining.The new third consensus configuration introduces RandomXT as an additional proof-of-work algorithm for the NextNet. It's appropriately activated at block height 1500 with a blockchain version bump to 1, which ensures a clean transition to the new mining algorithm.
695-695: Added new consensus configuration to vector.The consensus constants vector now includes the third configuration with RandomXT.
686-691:Details
❓ Verification inconclusive
Verify RandomXT mining difficulty is appropriate.
The minimum difficulty for RandomXT is set to 1,200,000 which is identical to RandomXM. Have you confirmed this difficulty setting is appropriate for RandomXT? The chosen value will affect the network's security and block production rate.
🏁 Script executed:
#!/bin/bash # Check for other RandomXT difficulty references in the codebase rg "RandomXT.*difficulty" -A 5 -B 5Length of output: 1109
🏁 Script executed:
#!/bin/bash rg -n "PowAlgorithm::RandomXM" -A5 -B5 base_layer/core/src/consensus/consensus_constants.rsLength of output: 5085
Confirm RandomXT difficulty matches RandomXM across consensus versions
I’ve checked the constants and observed that RandomXT’s
min_difficultyis identical to RandomXM’s (1,200,000) for chain version 3. Please confirm this is intentional given the difference in algorithm characteristics, or adjust the value if RandomXT requires its own baseline.Locations:
base_layer/core/src/consensus/consensus_constants.rs@ lines 681–685:
algos.insert(PowAlgorithm::RandomXM, PowAlgorithmConstants { min_difficulty: Difficulty::from_u64(1_200_000)… target_time: 360, });base_layer/core/src/consensus/consensus_constants.rs@ lines 686–690:
algos.insert(PowAlgorithm::RandomXT, PowAlgorithmConstants { min_difficulty: Difficulty::from_u64(1_200_000)… target_time: 360, });base_layer/core/src/base_node/proto/chain_metadata.rs (2)
30-31: Added constants for accumulated difficulty byte sizes.Good practice to define constants for the byte sizes, making the code more maintainable and readable.
36-52: Updated deserialization for split accumulated difficulty.The deserialization logic now properly validates both the low and high parts of the accumulated difficulty before concatenating them into the full U512 value.
Test Results (CI) 3 files 88 suites 41m 35s ⏱️ For more details on these failures, see this check. Results for commit b576376. ♻️ This comment has been updated with latest results. |
Test Results (Integration tests)0 tests 0 ✅ 0s ⏱️ Results for commit 2f26dcd. ♻️ This comment has been updated with latest results. |
ec552e7 to
46c7792
Compare
f585172 to
14fc0ef
Compare
Description
enable nextnet to mine randomxT
Summary by CodeRabbit
New Features
Refactor
Tests