Todas as lições · Rust scripts and ckb-std · Começa aqui · Glossário
Comparing packed epoch valuesPráticoVista outra vez
Vista outra vez · Verificação: certa · Verificada em 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.
Porque importa: 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.
Padrão
term_over = tip_n > term_n or (tip_n == term_n and tip_i*term_l >= term_i*tip_l); since = hex(0x2000000000000000 | epoch)Um teste mudou no mesmo commit
Está ao lado da correcção. Nós não o corremos.
- toastmanAu/daowow:
tests/devnet/reorg_history.py,tests/devnet/test_round_creation.py - salmansarwarr/Tranfr:
tests/src/tests.rs
- Conceitos
- Since and time locks
- Evidência
- Vista outra vez: vista em dois ou mais projetos
- Vista pela primeira vez
- 2026-11-18
- Última mudança
- 2026-11-18
- Última verificação
- 2026-11-19
- Verificação contra o commit
- certa: a lição sai do commit e continua a valer no código de hoje
Fontes (2)
- 2026-11-18 · toastmanAu/daowow · mais deste projeto
- 2026-10-01 · salmansarwarr/Tranfr · mais deste projeto
Mais sobre 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
Manténs um projeto de onde esta lição veio? Confirma ou corrige
Citar esta lição
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.