Commit 8e90cd7
fix: v23.1 — BFT-certified rotation hardening + cryptographic binding
Five concrete defects in v23 closed by direct cross-file audit. Together
they bring the microblock layer to canonical BFT-PoS L1 standards.
1. timeout_round cryptographically bound to block identity
* MicroBlock::hash and EfficientMicroBlock::hash now include
timeout_round in the SHA3-256 digest.
* sign_microblock_with_dilithium / verify_microblock_signature
include timeout_round in the signing payload; payload tag
bumped to "Block_Sig_v23.1" (breaking, requires clean restart).
* Closes the surface where a peer-relay could mutate timeout_round
in transit and storage-L4 anti-fork would treat the mutated
block as idempotent re-save.
2. Producer selection uses STRICT 2f+1 certified-only rotation
* New get_certified_rotation_round(mb_idx) = HIGHEST_CERTIFIED_ROUND
− baseline (no f+1 adopted input).
* Old get_effective_rotation_round marked #[deprecated]; its
max(certified, adopted) semantics re-introduced the h=556
split-brain class under partial gossip propagation. v23 had
accidentally adopted that path; v23.1 reverts to v15.13's
supermajority-only rule.
3. Authenticity gate on block.timeout_round (block_pipeline.rs)
* Hard-reject when claimed round exceeds local_certified by more
than TIMEOUT_ROUND_DRIFT_WINDOW=3. Bounds Byzantine claim
inflation that could lock the rotation baseline.
4. Sticky leader within view (node.rs STICKY_LEADER_PER_VIEW)
* Once a fallback (timeout_round > 0) successfully produces in
leadership_round L, it sticks for the remainder of L. Replaces
the v23 thrash pattern where every successful fallback was
followed by a retry of the failed primary on the next height
(6-sec stall per block while primary offline). Sticky lock is
released only when certified advances to a different round
OR the 30-block view ends.
5. Bounded memory for the two new rotation DashMaps
* LAST_TIMEOUT_EMIT_PER_MB and STICKY_LEADER_PER_VIEW pruned by
the existing cleanup_old_timeout_data sweep, sharing the same
active-macroblock-window retention contract as the rest of the
rotation state.
BREAKING (signing-payload tag change):
Existing peers running v22.1 or earlier will fail signature
verification on v23.1-signed blocks and vice versa. Operational
path is a coordinated clean restart with QNET_BOOTSTRAP_FRESH=1
on every genesis node and a wiped Explorer database.
Verification:
* cargo check --release --tests: 0 warnings, 0 errors.
* cargo test --release tests_v23_rotation_round: 2/2 passed.
* cargo build --release --bin qnet-node: exit 0, 22 MB binary.
Files touched (4): core/qnet-state/src/block.rs,
development/qnet-integration/src/{block_pipeline.rs, node.rs, unified_p2p.rs}.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent b3bd4fe commit 8e90cd7
4 files changed
Lines changed: 729 additions & 383 deletions
File tree
- core/qnet-state/src
- development/qnet-integration/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
957 | 957 | | |
958 | 958 | | |
959 | 959 | | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
960 | 989 | | |
961 | 990 | | |
962 | 991 | | |
963 | 992 | | |
964 | 993 | | |
965 | 994 | | |
966 | 995 | | |
967 | | - | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
968 | 999 | | |
969 | 1000 | | |
970 | 1001 | | |
| |||
1123 | 1154 | | |
1124 | 1155 | | |
1125 | 1156 | | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
1126 | 1166 | | |
1127 | 1167 | | |
1128 | 1168 | | |
1129 | 1169 | | |
1130 | 1170 | | |
1131 | 1171 | | |
1132 | 1172 | | |
1133 | | - | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
1134 | 1176 | | |
1135 | 1177 | | |
1136 | 1178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1822 | 1822 | | |
1823 | 1823 | | |
1824 | 1824 | | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
1825 | 1887 | | |
1826 | 1888 | | |
1827 | 1889 | | |
1828 | 1890 | | |
1829 | | - | |
1830 | | - | |
1831 | | - | |
1832 | | - | |
1833 | | - | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
1834 | 1897 | | |
1835 | 1898 | | |
1836 | 1899 | | |
| |||
0 commit comments