从这里开始 · 术语表 · 自测 · 订阅
经验用英文撰写,请用英文搜索。
#Testing and devnet ✕
找到 48 条经验。 全部经验
上一页第 2 页,共 4 页下一页
In a ckb-debugger mock_info, list the dep_group cell with dep_type "dep_group" (data included) and also list each member out point as a separate cell dep with dep_type "code", with its data. Get the members by decoding the group cell's data as a molecule OutPoint vector: a u32 LE count, then per entry a 32-byte tx hash and a u32 LE index (36 bytes each), and check that the length is 4 + 36*count bytes.
#Testing and devnet #Cell deps and script lookup #Data encoding (molecule, hex, bigints) · 来源(1) · 2026-11-14
nervosnetwork/sparse-merkle-tree folds runs of empty siblings into MergeWithZero nodes (merge byte 2; a normal merge uses byte 1 plus height and parent path), and bit 0 of a key is the low bit of byte 0. Compiled proofs use the opcodes 0x4c, 0x50, 0x51, 0x4f n (n=0 means 256) and 0x48. Test any off-chain port against vectors generated by the Rust code.
#Data encoding (molecule, hex, bigints) #Testing and devnet · 来源(1) · 2026-11-14
Under an always-success lock, a test never checks that the signature covers the witnesses. That matters most when contract data shares a WitnessArgs with the signature, for example in inputType. Move the test cells to a secp256k1 lock, using its code cell and dep group from genesis, and sign with ccc.SignerCkbPrivateKey. The 20-byte lock args need 6 more CKB of capacity than the 14-byte fixture args.
#Witnesses and signatures #Testing and devnet #Capacity and cell size · 来源(1) · 2026-11-14
When off-chain JS encodes or derives cell data that a Rust type script decodes or re-derives byte for byte, test the JS against JSON vectors generated by the Rust code, using a distinct value in every field so a wrong offset fails. Mirror the contract's validation refusals and its exact ordering and rounding: BTreeMap ascending key order, BigInt floor division with the dust going to fixed indices, and merging duplicates before dividing. The chain only returns a bare error code, so only this off-chain check can tell you which rule failed.
#Data encoding (molecule, hex, bigints) #Testing and devnet #Transaction building and fees · 来源(2) · 2026-11-13
A CKB script that refuses a transaction returns only an error code that names no rule, so port the contract's witness decoders to JS with the same refusals (bad version, truncation, trailing bytes, count or size limits). Check that they round-trip bytes produced by the Rust code. Before signing, run a checker that re-derives the contract's rules from the finished transaction, and pin each rule with a mutation test that breaks one field of a valid transaction and expects that rule's named reason.
#Testing and devnet #Data encoding (molecule, hex, bigints) #Since and time locks · 来源(1) · 2026-11-13
The preview network is retired and specs/preview.toml has been removed. `ckb init --chain preview` is rejected, and configs using { bundled = "specs/preview.toml" } fail to load after upgrading. Point tooling and tests at testnet, staging or dev instead.
#Testing and devnet · 来源(1) · 2026-11-12
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().
#Since and time locks #Testing and devnet · 来源(1) · 2026-11-12
A pre-sign checker that reuses the builder's assumptions will miss the builder's bugs, so make it compare every field the script compares, outputs_data included. When you add data to an output, count those bytes in its occupied capacity (8 + data + lock + type). Replay refused transactions in ckb-debugger against the deployed binaries to confirm the fix.
#Capacity and cell size #Transaction building and fees #Testing and devnet · 来源(1) · 2026-11-11
When subscribing to the CKB node's "log" topic over the TCP subscription RPC, the notification's params.result can be a JSON-encoded string of the log entry (message, level, target, date) rather than an object. Parse it with JSON.parse when it is a string, and skip malformed payloads instead of stopping the stream; otherwise script debug output (target ckb_script::verify) is silently dropped.
#Network and RPC reliability #Testing and devnet · 来源(1) · 2026-11-09
When a Cheque lock cell (RFC 0039) is spent on the receiver path, rule 1.b.ii requires the Cheque cell's CKB capacity to go back to the sender's lock. An output paying that CKB to the receiver fails with Cheque error 8 (SenderCapacityNotSame). So the Cheque lock cannot be used to deliver plain CKB to the receiver, and in this project's tests it also blocked an owner placed in the receiver role from reclaiming their own CKB.
#Testing and devnet #Capacity and cell size · 来源(1) · 2026-11-09
The deployed Cheque lock (RFC 0039) accepts a sender withdrawal only when the Cheque input's since is exactly 0xA000000000000006 (relative epoch, 6 epochs after the cell was committed). A since of 0 fails with Cheque error 11 (WithdrawChequeInputSinceError), so the sender cannot reclaim for about 24h after each create or renew.
#Since and time locks #Testing and devnet · 来源(1) · 2026-11-09
A saved CKB transaction lists its cell deps by out point. A replay that resolves those deps as live cells, as a node does when it verifies a new transaction, stops working once a lock upgrade or redeployment spends a dep cell, although neither the saved transaction nor the verifier changed. A replay test should tell that case (a dep that is no longer live) apart from a real verification failure, and skip the vector with a note instead of reporting a defect.
#Testing and devnet #Cell deps and script lookup · 来源(1) · 2026-11-09
上一页第 2 页,共 4 页下一页
文本采用 CC BY 4.0:请署名 LusoCryptoLabs, CKB lessons,并附上经验的链接。 JSON · 想修改或撤下某条经验?请提交 issue。