Godwoken 提款(withdrawal-lock)约束Godwoken withdrawal (withdrawal-lock) Constraints
来源:godwokenrises/godwoken @c2b1f85 / gwos/contracts/withdrawal-lock/src/entry.rs + gw-utils/src/withdrawal.rs · 部署:godwoken-info @8ce6390 mainnet_v1 / testnet_v1_1Source: godwokenrises/godwoken @c2b1f85 / gwos/contracts/withdrawal-lock/src/entry.rs + gw-utils/src/withdrawal.rs · deployments: godwoken-info @8ce6390 mainnet_v1 / testnet_v1_1
Godwoken
- 官网Websitegodwoken.com
- 文档Docsdocs.godwoken.io
- GitHubGitHubgithub.com/godwokenrises
- XXx.com/godwokenrises
来源:Source: godwoken repo homepage + README; website and X from the godwokenrises GitHub org profile
1 → 1终结后领取 UnlockWithdrawalViaFinalizeClaim after finality (UnlockWithdrawalViaFinalize)
Inputs 输入Inputs
input[i] withdrawal cellinput[i] withdrawal cellCell{
since: timestamp timepoint: absolute timestamp ≥ finalized ts,
capacity: W,
lock: WITHDRAWAL_LOCK(rollup_type_hash ‖ args ‖ owner_lock),
type: null | sUDT,
data: …
}
➜
Outputs 输出Outputs
output[i](同序号)output[i] (same index)Cell{
capacity: = W,
lock: owner_lock,
type: same as input,
data: same as input
}
// if any withdrawal input lacks such an output, an input under owner_lock_hash is required instead (8)
cell_depscell_deps
cell_dep:WITHDRAWAL_LOCK 代码cell_dep: WITHDRAWAL_LOCK codecode cell (see deployments)
// needed by CKB to run the script
cell_dep:rollup cell + RollupConfig(区块号 timepoint 时)cell_dep: rollup cell + RollupConfig (block-number timepoint)rollup cell (type hash = rollup_type_hash; may be an input instead) → GlobalState
RollupConfig by data hash → is_finalized()
witnesses(WitnessArgs)witnesses (WitnessArgs)
witnesses[组首输入]witnesses[first group input]{ lock: UnlockWithdrawalWitness::UnlockWithdrawalViaFinalize{} // 0x00000000 + empty table }
args = rollup_type_hash ‖ WithdrawalLockArgs(104B struct)‖ owner_lock_len(u32 BE)‖ owner_lock(Script)args = rollup_type_hash ‖ WithdrawalLockArgs (104B struct) ‖ owner_lock_len (u32 BE) ‖ owner_lock (Script)
rollup_type_hash32B
withdrawal_block_hash32B
withdrawal_finalized_timepoint8B
account_script_hash32B
owner_lock_hash32B
owner_lock_len4B BE
owner_lockScript
- rollup_type_hash 32B rollup cell type hashrollup cell type hash (5)
- withdrawal_block_hash 32B 包含该提款的 L2 区块L2 block containing the withdrawal (29)
- withdrawal_finalized_timepoint 8B 终结 Timepointfinalized Timepoint (45)
- account_script_hash 32B L2 账户脚本 hashL2 account script hash
- owner_lock_hash 32B L1 收款 lock hashL1 recipient lock hash = hash(owner_lock) (5)
- owner_lock_len 4B BE owner_lock 字节数(大端!)owner_lock byte length (big-endian!) = 剩余长度= remaining length (5)
- owner_lock Script L1 收款 lock 脚本L1 recipient lock script (5)
owner_lock_len0x00000049 ← 73 bytes (secp256k1 script, BE)
限制Constraints
- args:: 长度 ≥ 32+104+4,owner_lock 长度吻合,hash = owner_lock_hashlength ≥ 32+104+4; owner_lock length matches; hash = owner_lock_hash (5)
- witness.lock:: 合法 UnlockWithdrawalWitnessvalid UnlockWithdrawalWitness (11)
- 区块号block number:: rollup cell(deps 或 inputs)存在且已终结rollup cell (deps or inputs) exists and finalized (9 / 10 / 45)
- 时间戳timestamp:: since 为绝对时间戳且 ≥ timepointsince is an absolute timestamp ≥ timepoint (6 / 45)
- 输出outputs:: 每个同 lock 输入 i:output[i] capacity / data / type 相同且 lock = owner_lock;否则需 owner 输入each same-lock input i: output[i] same capacity / data / type and lock = owner_lock; else an owner input (8)
1 → 1区块回滚 UnlockWithdrawalViaRevertBlock reverted (UnlockWithdrawalViaRevert)
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] withdrawal cellinput[1] withdrawal cellCell{
capacity: W,
lock: WITHDRAWAL_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 …
}
// witness RollupSubmitBlock: reverted_block_hashes ∋ withdrawal_block_hash
output[k] custodian celloutput[k] custodian cellCell{
capacity: = W,
lock: { codeHash: config.custodian_script_type_hash, hashType: type,
args: rollup_type_hash ‖ deposit_block_hash = 0, timepoint = 0 ‖ … },
type: same,
data: same
}
cell_depscell_deps
cell_dep:RollupConfig cellcell_dep: RollupConfig cellCell{ data: RollupConfig (molecule) }
// load_rollup_config(): found by data hash == GlobalState.rollup_config_hash → else 10
witnesses(WitnessArgs)witnesses (WitnessArgs)
witnesses[组首输入]witnesses[first group input]{ lock: UnlockWithdrawalViaRevert{ custodian_lock_hash 32B } // item id 1 }
限制Constraints
- rollup:: 输出有 rollup cell 且动作为 SubmitBlock,回滚列表含 withdrawal_block_hasha rollup output whose action is SubmitBlock and whose reverted list contains withdrawal_block_hash (9 / 29)
- custodian:: 有 lock hash = custodian_lock_hash 的输出;args[0..32] = rollup_type_hashan output with lock hash = custodian_lock_hash; args[0..32] = rollup_type_hash (7 / 5)
- custodian:: code_hash = config.custodian_script_type_hash,type,block hash 与 timepoint 为 0,内容相同code_hash = config.custodian_script_type_hash, type, zero block hash and timepoint, same content (7)
部署与来源Deployments & source 未核验unverified
源码source godwokenrises/godwoken@c2b1f850 · gwos/contracts/withdrawal-lock/src/entry.rs · gwos/contracts/gw-utils/src/withdrawal.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)
| 网络network | code_hash | cell_dep | type_id args | 数据哈希data hash | 部署交易deploy tx |
|---|---|---|---|---|---|
| mainnet | 0x3714af858b8b82b2bb8f13d51f3cffede2dd8d352a6938334bb79e6b845e3658 type | 0xe6389b5cf6…40f4f20a:0 code | 0xffc2139a9f…fd17043a | 0x8ae445bca5…68bace84 | 0xe6389b5cf6…40f4f20a #7469203 |
| testnet | 0x06ae0706bb2d7997d66224741d3ec7c173dbb2854a6d2cf97088796b677269c6 type | 0x9c607a9a75…32bd2b93:0 code | 0xbfef6580c1…95052b9f | 0x8ae445bca5…68bace84 | 0x9c607a9a75…32bd2b93 #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).
错误码(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).