CKB Pulse

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.

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)

Mais sobre Developer tooling

Ver as 35 deste tema

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.

Tiradas de commits públicos e verificadas contra o commit de onde cada uma veio e o código de hoje do projeto. Lê a fonte antes de confiar numa. Texto sob CC BY 4.0: dá crédito à LusoCryptoLabs, CKB lessons, com uma ligação para a lição. Queres que uma lição seja mudada ou retirada? Abre um issue.