LiçõesO 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.
“Testing and devnet” ✕
48 lições encontradas. Todas as lições
Página 1 de 4Seguinte
A CCC client for a devnet only knows the scripts you give it, and fee completion looks up KnownScript.NervosDao, so register it by hand. Take the cell dep from genesis block tx 0: find the output whose type script, hashed with Script.from({codeHash: o.type.code_hash, hashType: o.type.hash_type, args: o.type.args}).hash(), equals the DAO code hash 0x82d76d1b75fe2fd9a27dfbaa65a039221a380d76c926f378d3f81cf3e7e13f2e, and fail loudly if none is found. Register it as {codeHash, hashType: 'type', cellDeps: [{cellDep: {outPoint: {txHash: genesisTx0Hash, index: '0x' + daoIndex.toString(16)}, depType: 'code'}}]}.
#Cell deps and script lookup #Testing and devnet · Fontes (2) · 2026-11-15
With the IntegrationTest RPC module enabled, call get_block_template, set current_time (hex ms) to a future value, and submit it with generate_block_with_template, block by block. Since/timestamp checks use the median time, which only moves after many future-dated blocks. Poll get_blockchain_info.median_time until it reaches the target rather than mining one far-future block.
#Testing and devnet #Since and time locks · Fontes (1) · 2026-11-15
On a devnet a transaction is not committed as soon as you send it: it must be proposed in one block and committed in a later one inside the proposal window, so a fixed small number of mined blocks can still leave the old cell state. Before asserting, mine a couple of blocks at a time in a bounded loop and re-read the cell state until it equals the expected value or the retry limit is reached.
#Testing and devnet · Fontes (1) · 2026-11-15
Pushing devnet timestamps ahead leaves the chain clock skewed for every later run, which stalls services that compare the tip with wall time. Reset the devnet for each scenario. At the start, assert that |tip timestamp − now| is small, for example under 600 s.
#Testing and devnet #Since and time locks · Fontes (1) · 2026-11-15
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 · Fontes (1) · 2026-11-14
OffCKB 0.4.13's system scripts export for the devnet Spore V2 deployment has only codeHash, hashType and cellDeps, with no field for the protocol mode. When building a SporeScriptInfoLike from it for @ckb-ccc/spore createSpore({ scriptInfo }), set cobuild: true yourself, because the deployed binary uses cobuild semantics. Treat that flag as an assumption you pin, not something read from the export.
cobuild: true needed for OffCKB devnet Spore scripts.
#Cell deps and script lookup #Testing and devnet · Fontes (1) · 2026-10-28
In a CKB devnet reorg test, transactions from detached blocks can return to the txpool and be committed again on the winning branch, which hides the rollback you want to observe. Have the winning branch spend one input of the orphaned transaction, such as its fee input, before the branches reconnect. Resubmitting the old transaction is then rejected with TransactionFailedToResolve (-301), and you must rebuild it with fresh funding.
#Testing and devnet #Indexer queries and cell collection · Fontes (1) · 2026-10-10
To exercise genuine fork choice on a Dummy devnet, partition two nodes with set_network_active(false) plus remove_node, wait until get_peers is empty on both, then mine a longer competing branch on one node with generate_block. Reconnect with set_network_active(true) and add_node(node_id, /ip4/.../tcp/port), and wait until both nodes report the same get_tip_header hash and the same tx_pool_info tip_hash before checking reorg recovery.
#Testing and devnet #Network and RPC reliability · Fontes (2) · 2026-10-10
To force a real reorg between two Dummy devnet nodes without truncate or submit_block, call set_network_active(false) and remove_node on both, let the main node commit its transactions, then on the peer spend one input that those transactions consume and mine a longer branch with generate_block. Reconnect with set_network_active(true) on both and add_node, and treat convergence as reached only when get_tip_header and tx_pool_info.tip_hash both equal the winning hash on both nodes. Because the peer branch spent that input, the orphan transactions stay out of the chain and the pool, and replaying one of them fails with TransactionFailedToResolve (code -301).
#Testing and devnet · Fontes (1) · 2026-10-10
After generate_block, CKB's tx pool updates its snapshot asynchronously, so a transaction spending just-committed outputs can be rejected (e.g. "Resolve failed Unknown") even though get_live_cell sees them. Before send_transaction or send_test_transaction, poll tx_pool_info until its tip_hash and tip_number equal get_tip_header's hash and number.
#Testing and devnet #Network and RPC reliability · Fontes (1) · 2026-10-08
In a devnet reorg test, the inclusion status a client reads from the node does not mean your own indexing service has processed that block. Before truncating the chain below block n, poll that service's indexed block number until it reaches n. Otherwise it never sees the block, never records a rollback, and the test times out on slow CI runners.
#Testing and devnet #Indexer queries and cell collection · Fontes (1) · 2026-10-08
Do not hardcode devnet code hashes and cell dep out points (secp256k1, Spore, cluster) in an example: they come from the local OffCKB devnet and can drift when OffCKB's bundled scripts change. Export them with `offckb system-scripts --network devnet --export-style ccc` before start, fail if a needed script lacks codeHash, hashType or a cellDep outPoint, and build both the CCC client config and the Spore SDK lumos config from that one file.
#Cell deps and script lookup #Testing and devnet · Fontes (2) · 2026-09-29
Página 1 de 4Seguinte
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.