全部经验 · Rust scripts and ckb-std · 从这里开始 · 术语表
Comparing packed epoch values实践再次出现
再次出现 · 核对结果:正确 · 核对于 2026-11-19
Decode epochs into (number, index, length) before comparing them. Compare the fractional parts by cross-multiplying (index_a*length_b vs index_b*length_a), because epoch length varies and raw packed integers don't order correctly.
为什么重要: Without decoding, a test or script judges epoch maturity wrongly, because the packed layout puts length and index above the epoch number. The daowow test would then expect an Immature refusal after the savings term had already ended.
代码模式
term_over = tip_n > term_n or (tip_n == term_n and tip_i*term_l >= term_i*tip_l); since = hex(0x2000000000000000 | epoch)同一提交中改动了测试
它与修复在一起,我们没有运行它。
- toastmanAu/daowow:
tests/devnet/reorg_history.py,tests/devnet/test_round_creation.py - salmansarwarr/Tranfr:
tests/src/tests.rs
- 概念
- Since and time locks
- 证据
- 再次出现: 在两个或以上项目中出现
- 首次出现
- 2026-11-18
- 最近改动
- 2026-11-18
- 最近核对
- 2026-11-19
- 对照提交的核对结果
- 正确:这条经验出自该提交,并且在今天的代码中仍然成立
来源(2)
- 2026-11-18 · toastmanAu/daowow · 这个项目的更多经验
- 2026-10-01 · salmansarwarr/Tranfr · 这个项目的更多经验
更多关于Rust scripts and ckb-std
- Median time vs tip timestamp for deadlines
- 24-bit epoch number overflow
- Absolute epoch since needs the 0x20 metric flag in the top byte
引用这条经验
LusoCryptoLabs, "Comparing packed epoch values", CKB lessons, https://pulse.lusocryptolabs.com/learned/scripts/comparing-packed-epoch-values, CC BY 4.0, last changed 2026-11-18.