Godwoken 出块质押(stake-lock)约束Godwoken block-producer stake (stake-lock) Constraints

来源:godwokenrises/godwoken @c2b1f85 / gwos/contracts/stake-lock/src/entry.rs · 部署:godwoken-info @8ce6390 mainnet_v1 / testnet_v1_1Source: godwokenrises/godwoken @c2b1f85 / gwos/contracts/stake-lock/src/entry.rs · deployments: godwoken-info @8ce6390 mainnet_v1 / testnet_v1_1
Lock 脚本Lock script二层 / RollupLayer 2 / Rollup主网Mainnet测试网Testnet开源Open sourceNervos 官方Nervos

1 → 1出块时由 rollup 续用Reused by the rollup when producing a block

Inputs 输入Inputs
input[0] rollup cellinput[0] rollup cellCell{ capacity: R, lock: rollup lock (mainnet: omni_lock deployment), type: { codeHash: STATE_VALIDATOR, hashType: type, args: type_id 32B }, data: GlobalState (190B) } // type hash == args[0..32]
input[1] stake cellinput[1] stake cellCell{ capacity: S, lock: STAKE_LOCK(rollup_type_hash ‖ owner ‖ timepoint), type: null, data: 0x }
➜
Outputs 输出Outputs
output[0] rollup cell′output[0] rollup cell′Cell{ capacity: R, lock: rollup lock (mainnet: omni_lock deployment), type: { codeHash: STATE_VALIDATOR, hashType: type, args: type_id 32B }, data: GlobalState (190B) }
output[k] stake cell′output[k] stake cell′Cell{ capacity: ≥ S, ≥ required_staking_capacity, lock: STAKE_LOCK(same owner, timepoint = this block), type: null, data: 0x } // checked by state-validator (25)

cell_depscell_deps

cell_dep:STAKE_LOCK 代码cell_dep: STAKE_LOCK codecode cell (see deployments) // needed by CKB to run the script
args(72B)= rollup_type_hash ‖ StakeLockArgs(struct)args (72B) = rollup_type_hash ‖ StakeLockArgs (struct)
rollup_type_hash32B
owner_lock_hash32B
stake_finalized_timepoint8B LE
  • rollup_type_hash 32B rollup cell type hashrollup cell type hash (5)
  • owner_lock_hash 32B 出块者 L1 lock hashblock producer L1 lock hash (22)
  • stake_finalized_timepoint 8B LE 最近使用该质押的区块的终结点finality point of the last block using this stake 已终结才可取回must be finalized to withdraw (22)
args0x40d7…(32B)9b1a…(32B)e803000000000080 ← timestamp timepoint

限制Constraints

  • args:: 合法 StakeLockArgsvalid StakeLockArgs (5)
  • rollup:: 输入中有 rollup cell → 通过a rollup cell in inputs → pass (0)

1 → 0出块者取回Producer withdraws

Inputs 输入Inputs
input[0] stake cellinput[0] stake cellCell{ capacity: S, lock: STAKE_LOCK(…), type: null, data: 0x }
input[1] 所有者 cellinput[1] owner cellCell{ capacity: any, lock: lock hash == owner_lock_hash, type: any, data: any }
➜
Outputs 输出Outputs
outputsoutputsany

cell_depscell_deps

cell_dep:rollup cellcell_dep: rollup cellCell{ capacity: R, lock: rollup lock (mainnet: omni_lock deployment), type: { codeHash: STATE_VALIDATOR, hashType: type, args: type_id 32B }, data: GlobalState (190B) } // read only: GlobalState.last_finalized_timepoint
cell_dep:RollupConfig cellcell_dep: RollupConfig cellCell{ data: RollupConfig (molecule) } // load_rollup_config(): found by data hash == GlobalState.rollup_config_hash → else 10

限制Constraints

  • 终结finality:: cell_deps 中的 rollup cell 显示 stake_finalized_timepoint 已终结the rollup cell in cell_deps shows stake_finalized_timepoint finalized (22)
  • owner:: 有输入 lock hash = owner_lock_hashan input with lock hash = owner_lock_hash (22)
部署与来源Deployments & source 未核验unverified
源码source godwokenrises/godwoken@c2b1f850 · gwos/contracts/stake-lock/src/entry.rs · gwos/contracts/gw-utils/src/error.rs (exact commit read (default-branch HEAD, 2024-01-12). Deployment constants from godwokenrises/godwoken-info @8ce6390133ddfffe9d40d51b7be191418b54958c (mainnet_v1, testnet_v1_1 scripts-deploy-result.json).)
二进制核验binary check 未核验unverified no binary or checksum at the recorded commit matched the deployed data hash (reproducible build not attempted)
网络networkcode_hashcell_deptype_id args数据哈希data hash部署交易deploy tx
mainnet0xb619184ab9142c51b0ee75f4e24bcec3d077eefe513115bad68836d06738fd2c type0x2e46a10a67…50ad4f29:0 code0xd3847a81e2…40ed54a10x107f292ab7…9835e8a90x2e46a10a67…50ad4f29 #7469211
testnet0x7f5a09b8bd0e85bcf2ccad96411ccba2f289748a1c16900b0635c2ed9126f288 type0x053fdb4ed3…48be7de9:0 code0x0fc0f22f9a…6f4b471d0x107f292ab7…9835e8a90x053fdb4ed3…48be7de9 #5292884
链上数据核对于 on-chain data checked 2026-10-21
⚠ 状态:官方已宣布 Godwoken 退役(2025-06-01 起,Nervos Talk “Sunset of Force Bridge and Godwoken”);冻结期限延至 2026-01-01 23:59:59 UTC,之后网络冻结、桥前端下线,v0/v1 RPC 节点已关闭。本页仅作历史 / 审计参考。⚠ Status: Godwoken was officially sunset (from 2025-06-01, Nervos Talk “Sunset of Force Bridge and Godwoken”); the freeze deadline was extended to 2026-01-01 23:59:59 UTC, after which the network froze, the bridge UI went offline and v0/v1 RPC nodes were shut down. This page is for historical / audit reference.
错误码(gw-utils/src/error.rs):1 IndexOutOfBound,2 ItemMissing,3 LengthNotEnough,4 Encoding,5 InvalidArgs,6 InvalidSince,7 InvalidOutput,8 OwnerCellNotFound,9 RollupCellNotFound,10 RollupConfigNotFound,11 ProofNotFound,13 MerkleProof,14 AmountOverflow,15 InsufficientAmount,16/17 Insufficient{Input,Output}FinalizedAssets,18 SMTKeyMissing,19 InvalidStateCheckpoint,20 InvalidBlock,21 InvalidStatus,22 InvalidStakeCellUnlock,23 InvalidPostGlobalState,24 InvalidChallengeCell,25 InvalidStakeCell,26 InvalidDepositCell,27 InvalidWithdrawalCell,28 InvalidCustodianCell,29 InvalidRevertedBlocks,30 InvalidChallengeReward,32 InvalidChallengeTarget,33 InvalidWithdrawalRequest,34 UnknownEOAScript,39 InvalidTypeID,41 WrongSignature,43 RegistryAddressNotFound,45 NotFinalized。Error codes (gw-utils/src/error.rs): 1 IndexOutOfBound, 2 ItemMissing, 3 LengthNotEnough, 4 Encoding, 5 InvalidArgs, 6 InvalidSince, 7 InvalidOutput, 8 OwnerCellNotFound, 9 RollupCellNotFound, 10 RollupConfigNotFound, 11 ProofNotFound, 13 MerkleProof, 14 AmountOverflow, 15 InsufficientAmount, 16/17 Insufficient{Input,Output}FinalizedAssets, 18 SMTKeyMissing, 19 InvalidStateCheckpoint, 20 InvalidBlock, 21 InvalidStatus, 22 InvalidStakeCellUnlock, 23 InvalidPostGlobalState, 24 InvalidChallengeCell, 25 InvalidStakeCell, 26 InvalidDepositCell, 27 InvalidWithdrawalCell, 28 InvalidCustodianCell, 29 InvalidRevertedBlocks, 30 InvalidChallengeReward, 32 InvalidChallengeTarget, 33 InvalidWithdrawalRequest, 34 UnknownEOAScript, 39 InvalidTypeID, 41 WrongSignature, 43 RegistryAddressNotFound, 45 NotFinalized.
Timepoint(u64):最高位 0 = L2 区块号,1 = 毫秒时间戳(低 63 位)。Timepoint (u64): top bit 0 = L2 block number, 1 = millisecond timestamp (low 63 bits).
GitHub · gpBlockchain/ckb-contract-flow-html