All lessons · Developer tooling · Start here · Glossary
Separate submit and commit verification environmentsAdvancedFrom one fix
From one fix · Check: right · Checked 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().
Why it matters: 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.
Pattern
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.A test changed in the same commit
It sits next to the fix. We did not run it.
- Hanssen0-Alter-Ego/ckb-vm-js:
tests/browser/manual.js,tests/browser/worker.spec.js,tests/js/types.ts
- Concepts
- Since and time locks, Testing and devnet
- Evidence
- From one fix: from one project, checked against its commit
- First seen
- 2026-11-12
- Last changed
- 2026-11-12
- Last checked
- 2026-11-19
- Check against the commit
- right: the lesson follows from its commit and still holds in the code today
Sources (1)
- 2026-11-12 · Hanssen0-Alter-Ego/ckb-vm-js · more from this project
More about 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
Do you maintain a project this lesson came from? Confirm or correct it
Cite this lesson
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.