从这里开始 · 术语表 · 自测 · 订阅
经验用英文撰写,请用英文搜索。
“Since and time locks” ✕
找到 18 条经验。 全部经验
第 1 页,共 2 页下一页
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 · 来源(1) · 2026-11-15
The Nervos DAO pays out phase 2 only at a whole number of 180-epoch cycles counted from the deposit epoch D, so a withdrawal started after D + 180×n matures at D + 180×(n+1). If a lock refuses phase 1 until a term of n cycles has passed, then in practice the funds are held (n + 1) × 180 epochs, not n × 180, and interest stops at the phase 1 block. Only a phase 1 that lands exactly in the boundary epoch fraction avoids the extra cycle.
#Since and time locks #Other · 来源(1) · 2026-11-13
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
On-chain since checks use the median time of past blocks, but clients often use the tip header's timestamp, and the two can diverge widely after devnet time travel. Compute deadlines from max(ceil(tipMs/1000), medianSeconds) so minimum-term checks hold on both sides.
#Since and time locks #Testing and devnet · 来源(3) · 2026-11-15
Set the phase-two input since to an absolute epoch counted from the DEPOSIT header, not the withdrawing block. Round the elapsed epochs up to whole 180-epoch cycles, compare epoch fractions by cross-multiplication, and keep the deposit's epoch index and length. The withdrawable amount is occupied + (capacity − occupied) × AR_withdraw / AR_deposit, where AR is a little-endian u64 read from bytes 8..16 of each header's dao field. WitnessArgs.input_type must hold the deposit header's index in header_deps as an 8-byte little-endian u64.
#Since and time locks #Witnesses and signatures #Capacity and cell size · 来源(1) · 2026-11-13
After get_header_by_number or get_epoch_by_number, treat a null result as unavailable and check that the returned number equals the one you asked for. To get an epoch's start time, read the header at the EpochView's start_number. Then check that this header's epoch field has the epoch number in its low 24 bits and 0 in bits 24 to 39 (the block's index within the epoch), so the block really is the first block of that epoch.
#Network and RPC reliability #Since and time locks #Data encoding (molecule, hex, bigints) · 来源(2) · 2026-11-12
A raw since u64 can carry the reserved metric flag 0b11 (e.g. 0x6000_0000_0000_0000), for which ckb_sdk::Since::extract_metric() returns None, and a timestamp metric value can exceed what chrono can represent. Code that formats since values received from RPC should handle both cases instead of unwrapping, as ckb-cli now does by printing "invalid since" or "invalid".
#Since and time locks #Data encoding (molecule, hex, bigints) · 来源(1) · 2026-11-09
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 · 来源(2) · 2026-10-02
An input's since meant as an absolute epoch must have bit 61 set (0x2000000000000000) with bit 63 (relative) and bit 62 clear (RFC 0017). With all three top bits zero the node reads the same number as an absolute block number. The epoch number is in the low 24 bits (raw & 0xffffff), with index and length above it, so check the epoch number inclusively against the required epoch before signing.
since flag bits, not covered
#Since and time locks · 来源(1) · 2026-09-25
An input since meaning "not before epoch N" must be 0x2000000000000000 | N: top byte 0x20 (absolute, epoch metric) with the epoch number in the low 24 bits. Without the flag the node reads the value as an absolute block number, which for any realistic epoch is already past, so the node enforces no epoch bound. A script that reads since as an epoch must check the metric flag itself, as this project's contract does by refusing a since whose top byte is not 0x20.
Builder side rule for setting the epoch flag.
#Since and time locks · 来源(2) · 2026-09-25
Decode epochs into (number, index, length) before comparing them. Compare the fractional parts by cross-multiplying (index_a*length_b vs index_b*length_a), because epoch length varies and raw packed integers don't order correctly.
#Since and time locks · 来源(2) · 2026-11-18
An absolute epoch since carries only a 24-bit epoch number (max 0xFFFFFF). When a script requires an input since at or after an epoch computed from cell data (for example entry_end plus a wait), compute it with checked addition. Refuse any result above 0xFFFFFF when the cell is created, otherwise the guarded transition can never be satisfied.
#Since and time locks · 来源(2) · 2026-11-17
第 1 页,共 2 页下一页
文本采用 CC BY 4.0:请署名 LusoCryptoLabs, CKB lessons,并附上经验的链接。 JSON · 想修改或撤下某条经验?请提交 issue。