Todas as lições · Developer tooling · Começa aqui · Glossário
Separate submit and commit verification environmentsAvançadoDe uma correção
De uma correção · Verificação: certa · Verificada em 2026-11-19
When verifying a transaction offline with ckb-script, use TxVerifyEnv::new_submit(&tip) for the submit phase. It evaluates since at tip number + 1 + proposal_window.closest, so it is more permissive than inclusion in the next block. For the commit phase, use TxVerifyEnv::new_commit(&candidate), where candidate is a header whose parent_hash is the real tip and whose number is tip + 1, and take median time from env.parent_hash() rather than tip.parent_hash().
Porque importa: Treating the tip as the candidate block evaluates block and median time since locks at the wrong height, so a transaction can be reported valid at submit and then be rejected as immature when it is actually committed.
Padrão
Treating tip_header as the candidate block and using TxVerifyEnv::new_commit(&tip) with median time taken from tip.parent_hash(), instead of separate submit and commit environments where the commit candidate is a verified direct child of the real tip.Um teste mudou no mesmo commit
Está ao lado da correcção. Nós não o corremos.
- Hanssen0-Alter-Ego/ckb-vm-js:
tests/browser/manual.js,tests/browser/worker.spec.js,tests/js/types.ts
- Conceitos
- Since and time locks, Testing and devnet
- Evidência
- De uma correção: de um projeto, verificada contra o commit
- Vista pela primeira vez
- 2026-11-12
- Última mudança
- 2026-11-12
- Ú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 (1)
- 2026-11-12 · Hanssen0-Alter-Ego/ckb-vm-js · mais deste projeto
Mais sobre Developer tooling
- Mirror on-chain rules off-chain with mutation tests
- Reset devnets instead of skewing the chain clock
- ckb-vm-js 0.2.0 (npm) checks header hash instead of rejecting the field
Manténs um projeto de onde esta lição veio? Confirma ou corrige
Citar esta lição
LusoCryptoLabs, "Separate submit and commit verification environments", CKB lessons, https://pulse.lusocryptolabs.com/learned/tooling/separate-submit-and-commit-verification-environments, CC BY 4.0, last changed 2026-11-12.