Godwoken 托管(custodian-lock)约束Godwoken custodian (custodian-lock) Constraints

来源:godwokenrises/godwoken @c2b1f85 / gwos/contracts/custodian-lock/src/entry.rs · 部署:godwoken-info @8ce6390 mainnet_v1 / testnet_v1_1Source: godwokenrises/godwoken @c2b1f85 / gwos/contracts/custodian-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 → *已终结:由 rollup 使用Finalized: used by the rollup

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] custodian cellinput[1] custodian cellCell{ capacity: X, lock: CUSTODIAN_LOCK(rollup_type_hash ‖ args), type: null | sUDT, data: … }
➜
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[…]output[…]withdrawal / merged custodian cells (checked by state-validator)

cell_depscell_deps

cell_dep:CUSTODIAN_LOCK 代码cell_dep: CUSTODIAN_LOCK codecode cell (see deployments) // needed by CKB to run the script
cell_dep:RollupConfig cellcell_dep: RollupConfig cellCell{ data: RollupConfig (molecule) } // load_rollup_config(): found by data hash == GlobalState.rollup_config_hash → else 10
args = rollup_type_hash ‖ CustodianLockArgs(table)args = rollup_type_hash ‖ CustodianLockArgs (table)
rollup_type_hash32B
deposit_block_hash32B
deposit_finalized_timepoint8B
deposit_lock_argsDepositLockArgs
  • rollup_type_hash 32B rollup cell type hashrollup cell type hash (5)
  • deposit_block_hash 32B 收录该存款的 L2 区块(0 = 已终结的合并托管)L2 block that took the deposit (0 = finalized/merged)
  • deposit_finalized_timepoint 8B 终结 Timepointfinalized Timepoint
  • deposit_lock_args DepositLockArgs 回滚时用来恢复 deposit cellused to restore the deposit cell on revert 回滚输出须一致revert output must match (7)
deposit_finalized_timepoint0x80… ← timestamp form

限制Constraints

  • args:: 合法valid (5)
  • rollup:: 输入中有 rollup cell(读其 GlobalState)a rollup cell in inputs (its GlobalState is read) (9)
  • config:: RollupConfig 在 cell_depsRollupConfig in cell_deps (10)
  • 终结finality:: deposit_finalized_timepoint 已终结 → 通过deposit_finalized_timepoint finalized → pass (0)

1 → 1未终结:存款区块被回滚,还原为 deposit cellNot finalized: deposit block reverted, restore the deposit cell

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) }
input[1] custodian cellinput[1] custodian cellCell{ capacity: X, lock: CUSTODIAN_LOCK(…), type: …, data: … }
➜
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 … } // its witness = RollupSubmitBlock with reverted_block_hashes ∋ deposit_block_hash
output[k] 还原的 deposit celloutput[k] restored deposit cellCell{ capacity: …, lock: { codeHash: config.deposit_script_type_hash, hashType: type, args: rollup_type_hash ‖ deposit_lock_args }, type: …, data: … }

witnesses(WitnessArgs)witnesses (WitnessArgs)

witnesses[custodian 组首输入]witnesses[first custodian input]{ lock: UnlockCustodianViaRevertWitness{ deposit_lock_hash 32B } } // must parse, else 5
witnesses[rollup 输出]witnesses[rollup output]{ output_type: RollupAction (must be RollupSubmitBlock) }

限制Constraints

  • witness:: lock 字段为 32 字节 deposit_lock_hashlock field is a 32-byte deposit_lock_hash (5)
  • 输出output:: 有 lock hash = deposit_lock_hash 的输出an output whose lock hash = deposit_lock_hash (7)
  • 输出 lockoutput lock:: args 前 32 字节 = rollup_type_hashargs[0..32] = rollup_type_hash (5)
  • 输出 lockoutput lock:: code_hash = config.deposit_script_type_hash,hash_type = type,args 与 deposit_lock_args 相同code_hash = config.deposit_script_type_hash, hash_type type, args equal deposit_lock_args (7)
  • rollup:: 输出有 rollup cella rollup cell in outputs (9)
  • 回滚revert:: RollupSubmitBlock 的 reverted_block_hashes 含 deposit_block_hashRollupSubmitBlock.reverted_block_hashes contains deposit_block_hash (29)
部署与来源Deployments & source 未核验unverified
源码source godwokenrises/godwoken@c2b1f850 · gwos/contracts/custodian-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
mainnet0x000f87062a2fe9bb4a6cc475212ea11014b84deb32e0375ee51e6ec4a553e009 type0x71b55e3641…4956cdc5:0 code0x3ef49f39b4…6ee569360xa254fee1ed…6c8addb00x71b55e3641…4956cdc5 #7469194
testnet0x85ae4db0dd83f428a31deb342e4000af37ce2c9645d9e619df00096e3c50a2bb type0x7aed145beb…6e28747a:0 code0xc4695745c6…da636e710xa254fee1ed…6c8addb00x7aed145beb…6e28747a #5292883
链上数据核对于 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