Repository navigation
Description
Migrated from SergioDemianLerner/rustock#48 (issue by @SDL-A1, 2026-09-22).
Original: SergioDemianLerner/rustock#48
Applies to testnet only. They cannot fire on mainnet as rskj is configured today.
The last two rules from Group 1 of docs/audit-triage-medium-low.md — the group whose other eight are implemented in #44. Audit finding FRCR-479 covers the RSKIP351 half; the RSKIP144 half came out of diffing rskj's rule set rather than from the audit.
Both are gated on reed810:
| network | reed810 |
|---|---|
mainnet (config/main.conf) |
-1 — never activates |
testnet (config/testnet.conf) |
7,139,600 |
So on testnet both rules have been live since #7,139,600, and rustock enforces neither.
Like the other eight, these are accepts-too-much gaps: rustock still computes rskj's state root for every block rskj accepts. What is missing is the ability to reject, so rustock would follow a chain rskj refuses.
1. ValidTxExecutionSublistsEdgesRule (RSKIP144 + RSKIP351)
Validates the parallel-execution sublist edges in the header. rskj requires both consensus rules active before it applies:
short[] edges = block.getHeader().getTxExecutionSublistsEdges();
if (edges.length == 0) return true;
if (edges.length > Constants.getTransactionExecutionThreads()) return false; // TX_EXECUTION_THREADS = 2
if (edges[0] <= 0) return false;
for (int i = 0; i < edges.length - 1; i++) {
if (edges[i] >= edges[i + 1]) return false; // strictly ascending
}
if (edges[edges.length - 1] > block.getTransactionsList().size() - 1) return false;
return true;Four conditions: at most TX_EXECUTION_THREADS (2) edges, first edge strictly positive, strictly ascending, and the last edge within the transaction list.
2. RSKIP351 compressed-header validation
Header::decode in crates/core/src/types/header.rs already recognises the compressed field 6 — non-list and ≠ 256 bytes means store the raw extension_data and default the logs_bloom — so the block hash is computed over the compressed payload correctly. What it never does is validate the contents:
- The version integer inside
RLP(version, hash)is not parsed, and not checked to equal 1. - The extension hash is not reconstructed or compared. rskj
BlockHeaderExtensionV1.getHash()iskeccak256(getEncodedForHash())overRLP(logsBloom, txExecutionSublistsEdges).
Detection today is purely by field size; there is no RSKIP351 activation gate anywhere in the crate.
Where this goes
The seam already exists from #44. BlockProcessor::validate_block_rules is where the body rules live, called from the sync service's acceptance paths, and crates/core/src/validation/block_rules.rs is the natural home for the edges rule. Add a has_rskip351 / has_rskip144 pair keyed on RskNetworkUpgrade::Reed810, which rustock's ladder already models correctly (reed810 is absent from MAINNET_ACTIVATIONS and present at #7,139,600 in TESTNET_ACTIVATIONS).
Acceptance
- Negative unit tests per condition: too many edges, non-positive first edge, non-ascending, last edge past the end; plus the empty-edges early return and the both-rules-required gate.
- Extension-hash round trip against a real testnet header.
- Extend
crates/execution/tests/mainnet_block_rules.rs— or add a testnet sibling — so the rules run against real post-Fix/header parent resolution #7,139,600 testnet blocks. That test is what caught the genesis/REMASC case in Implement the eight mainnet block-validity rules rskj runs and rustock did not #44, and the same argument applies here: these rules reject blocks, so the dangerous failure is a false rejection, which only real data can rule out.
Note that rustock's testnet activation ladder was itself wrong until #43 (wasabi100, twoToThree, papyrus200, lovell700 and reed800 were all off), and the ChainConfig papyrus200 testnet height until #44. Worth confirming the ladder against config/testnet.conf again before trusting a testnet replay.
🤖 Generated with Claude Code
Activity