Todas as lições · Other · Começa aqui · Glossário
Range check since epoch fields instead of masking themPráticoDe uma correção
De uma correção · Verificação: certa · Verificada em 2026-11-21
When packing an epoch-based since value (24-bit epoch number, 16-bit index, 16-bit length), masking an out-of-range epoch silently wraps it into a much earlier deadline. This commit's packSince now throws a RangeError for any field outside its bit width, and createTranfr/renewTranfr check that tip epoch plus duration fits within 0xFFFFFF before packing.
Porque importa: Masking an epoch number above 0xFFFFFF silently wraps it into a much earlier since deadline, so the time lock can open far sooner than the caller intended with no error raised.
The existing since lesson covers the metric flag bits. This card is about range checking the epoch number, index and length fields rather than masking them.
Padrão
((epoch & NUMBER_MASK) << NUMBER_OFFSET)Tirado do commit, encurtado.
Um teste mudou no mesmo commit
Está ao lado da correcção. Nós não o corremos.
- salmansarwarr/Tranfr:
demo/e2e/wallet-mode.spec.ts,sdk/tests/client.test.ts,sdk/tests/since-cmp.test.ts,tests/src/tests.rs
- Conceitos
- Since and time locks, Data encoding (molecule, hex, bigints)
- Evidência
- De uma correção: de um projeto, verificada contra o commit
- Vista pela primeira vez
- 2026-11-20
- Última mudança
- 2026-11-20
- Última verificação
- 2026-11-21
- Verificação contra o commit
- certa: a lição sai do commit e continua a valer no código de hoje
Fontes (1)
- 2026-11-20 · salmansarwarr/Tranfr · mais deste projeto
Mais sobre Other
- Recognizing a Nervos DAO deposit cell (not a withdrawing one)
- Absolute epoch since needs the 0x20 metric flag
- Hand-encoding WitnessArgs in molecule
Manténs um projeto de onde esta lição veio? Confirma ou corrige
Citar esta lição
LusoCryptoLabs, "Range check since epoch fields instead of masking them", CKB lessons, https://pulse.lusocryptolabs.com/learned/other/range-check-since-epoch-fields-instead-of-masking-them, CC BY 4.0, last changed 2026-11-20.