CKB Pulse
Lições

O que a CKB aprendeu

Começa aqui · Glossário · Testa-te · Feed

As lições estão escritas em inglês, por isso pesquise em inglês.

De uma correção

155 lições encontradas. Todas as lições

Página 11 de 13

Full-balance UDT burn is valid for SUDT and plain xUDTPráticoDe uma correção

Burning a UDT's entire balance is accepted by SUDT and xUDT without extensions, because those scripts allow output amount to be less than or equal to input amount. offckb removed a guard that rejected destroyAmount === totalBalance and now still emits a zero-balance type cell (16-byte zero amount), which is valid. Extension-enabled xUDT was not covered by this change.

#Transaction building and fees #Capacity and cell size · Fontes (1) · 2026-10-08

Disable overflow checks for ckb-std when using its dummy-atomic polyfillsAvançadoDe uma correção

When a release profile sets overflow-checks = true and ckb-std (here =1.1.0 with the dummy-atomic feature) supplies the single-thread __atomic polyfills, add a per-package override turning overflow checks off for ckb-std. Atomic read/modify/write arithmetic is defined to wrap, so checked arithmetic in those polyfills would panic instead of wrapping.

#Other · Fontes (1) · 2026-10-07

Parse raw CKB blocks with from_compatible_slice to accept BlockV1 extensionPráticoDe uma correção

Serialized CKB blocks may be BlockV1, which appends a consensus extension field after the Block molecule fields, so a strict packed::BlockReader::from_slice can reject them. This commit parses block bytes with ckb-gen-types 1.1.1 packed::BlockReader::from_compatible_slice, which accepts the extra field while still exposing header() and transactions().

#Data encoding (molecule, hex, bigints) · Fontes (1) · 2026-10-07

Partial load of a cell's type Script header to match code_hash and hash_typeAvançadoDe uma correção

In a ckb-std script you can load a cell's type script into a fixed 49 byte buffer with syscalls::load_cell_by_field(..., CellField::Type), then compare code_hash at bytes 16..48 and hash_type at byte 48 of the molecule Script table, without allocating for args. A short buffer returns Err(SysError::LengthNotEnough) yet still fills the buffer, so treat that error like Ok, and treat ItemMissing as a cell with no type script.

#Data encoding (molecule, hex, bigints) #Cell deps and script lookup · Fontes (1) · 2026-10-07

Raw cell_deps indexes match Source::CellDep only before the first dep groupAvançadoDe uma correção

When a script reads the raw transaction's cell_deps (via load_transaction) and uses a position there as a Source::CellDep index for load_cell_type_hash or load_cell_data, the mapping holds only for the leading run of dep_type code entries, because dep groups expand into their member cells and shift later indexes. This vote script restricts its proposal and deposit lookups to that direct prefix and lets wallet dep groups follow it.

#Cell deps and script lookup · Fontes (1) · 2026-10-07

Light client sync progress poll racing set_scriptsAvançadoDe uma correção

If an app saves per-script sync progress from the light client's get_scripts while another path calls set_scripts to reset or re-register scripts, a get_scripts result read before the set landed can overwrite the reset progress. Do the get_scripts read and the progress write under the same lock that guards set_scripts, and have the poll use tryLock and skip that tick while a registration is in flight, so it never queues behind it. Pocket Node does this in SyncCoordinator.tryWithRegistrationLock.

#Indexer queries and cell collection #Network and RPC reliability · Fontes (1) · 2026-10-06

DAO compensation must use the deposit cell's occupied capacity (102 CKB), not 61PráticoDe uma correção

When calculating Nervos DAO max withdraw or compensation (here via the light client's nativeCalculateMaxWithdraw), pass the occupied capacity of the actual DAO deposit cell (102 CKB for a secp256k1 lock plus DAO type plus 8 bytes data), not the 61 CKB of a plain secp256k1 cell. Using 61 overstates the interest by (C - 61) / (C - 102), and the result no longer matches what the unlock transaction pays out.

#Capacity and cell size · Fontes (1) · 2026-10-06

Output type scripts need cell deps too, including the native DAO typeBásicoDe uma correção

CKB runs the type script of every output (not only input locks and input types), so a transaction that creates a native DAO deposit must include the DAO type's code cell (genesis tx0 index 2) as a cell dep, or the node rejects it with ScriptNotFound on Outputs[i].Type. Pre-send checks that only verify deps for input locks will miss this; check every input lock, input type and output type, deduplicated by code_hash and hash_type.

#Cell deps and script lookup #Transaction building and fees · Fontes (1) · 2026-10-05

Delegating script validation via exec to a hash bound cell depPráticoDe uma correção

This lifecycle type script stores a 32 byte data hash in its args, scans cell deps with load_cell_data_hash to find exactly one match (rejecting duplicates), then calls ckb_std syscalls::exec on that dep, which keeps the current Script context (GroupInput, GroupOutput, args) for the child. Because exec only returns when it fails, any code after the call must return an error instead of falling through to success.

#Cell deps and script lookup #Type ID and upgrades · Fontes (1) · 2026-10-04

Relative block number since uses top byte 0x80, not the absolute epoch 0x20PráticoDe uma correção

Under RFC 0017 since encoding, bit 63 marks relative and bits 61 to 62 select the metric (00 is block number), so a relative block count is RELATIVE_BLOCK_FLAG (0x8000000000000000) OR the count, and 256 blocks becomes 0x8000000000000100. In this commit the type script checks since >> 56 == 0x80, so reusing the absolute epoch form (top byte 0x20) is rejected on chain with an error code that does not name the since as the cause.

#Since and time locks · Fontes (2) · 2026-10-02

Verify header_deps against independently fetched headers, not against the tx's own listPráticoDe uma correção

When checking a transaction that uses header_deps for entropy (for example, headers at fixed offsets from a cell's inclusion block), derive the expected headers yourself: get the creating tx with get_transaction, then get_header on its block_hash, then get_header_by_number for the scheduled heights. Only then compare them to the tx's header_deps. Taking the headers from header_deps makes the check circular, since it only confirms the transaction agrees with itself.

#Since and time locks #Network and RPC reliability · Fontes (1) · 2026-10-02

Light client set_scripts "all" replaces the whole registered script setPráticoDe uma correção

The CKB light client's set_scripts with the all command replaces every registered script, so a call carrying only one wallet's lock script unregisters all other wallets. When several scripts must stay tracked, either pass the full set with each script's own start block, or use the partial command to update only the changed script. If registrations can race, serialise them so a stale full set cannot overwrite a newer one.

#Indexer queries and cell collection #Network and RPC reliability · Fontes (1) · 2026-09-30

Página 11 de 13

Texto sob CC BY 4.0: dá crédito à LusoCryptoLabs, CKB lessons, com uma ligação para a lição. JSON · Queres que uma lição seja mudada ou retirada? Abre um issue.