Godwoken rollup cell(state-validator,type)约束Godwoken rollup cell (state-validator, type) Constraints
来源:godwokenrises/godwoken @c2b1f85 / gwos/contracts/state-validator + gw-utils · 部署:godwoken-info @8ce6390 mainnet_v1 / testnet_v1_1Source: godwokenrises/godwoken @c2b1f85 / gwos/contracts/state-validator + gw-utils · 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
0 → 1初始化 rollup cellInitialize rollup cell
Inputs 输入Inputs
input[0] 任意 cellinput[0] any cellCell{
capacity: any,
lock: deployer lock,
type: null,
data: any
}
// used for type_id
➜
Outputs 输出Outputs
output[i] rollup celloutput[i] rollup cellCell{
capacity: R,
lock: rollup lock,
type: { codeHash: STATE_VALIDATOR, hashType: type, args: type_id(inputs[0], i) 32B },
data: GlobalState
}
cell_depscell_deps
cell_dep:STATE_VALIDATOR 代码cell_dep: STATE_VALIDATOR 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
data:GlobalState(190 字节 struct;V0 为 181 字节)data: GlobalState (190-byte struct; V0 is 181 bytes)
rollup_config_hash32
account32+4
block32+8
reverted_block_root32
tip_block_hash32
tip_block_timestamp8
last_finalized_timepoint8
status1
version1
- rollup_config_hash 32 RollupConfig cell 的 data hashdata hash of the RollupConfig cell (10)
- account 32+4 L2 账户 SMT 根 + 账户数L2 account SMT root + count
- block 32+8 L2 区块 SMT 根 + 区块数L2 block SMT root + count submit:+1submit: +1 (23)
- reverted_block_root 32 已回滚区块 SMT 根reverted block SMT root (13)
- tip_block_hash 32 最新 L2 区块 hashlatest L2 block hash (23)
- tip_block_timestamp 8 最新区块时间戳(V0 无)latest block timestamp (absent in V0)
- last_finalized_timepoint 8 最近终结的 Timepointlast finalized Timepoint (23)
- status 1 0 running / 1 halting0 running / 1 halting (21)
- version 1 rollup 版本(V0 无)rollup version (absent in V0) ≤ 2,不可降级≤ 2, no downgrade (23)
rollup_config_hash0x…(32B)
block.count0xa086010000000000 ← 100000
last_finalized_timepoint0x800001… ← top bit 1 = timestamp
status / version0x0002
限制Constraints
- args ≥ 32 字节,前 32 字节满足 type_id 规则≥ 32 bytes; first 32 bytes satisfy the type_id rule (39)
- data:: 合法 GlobalStatevalid GlobalState (4)
- cell_deps:: 有 data hash = rollup_config_hash 的 RollupConfiga RollupConfig whose data hash = rollup_config_hash (10)
1 → 1提交 L2 区块 RollupSubmitBlockSubmit L2 block (RollupSubmitBlock)
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{ status: 0 running, block.count: n, … }
}
input[1…] deposit cells(本区块收录)input[1…] deposit cells (collected by this block)Cell{
capacity: ≥ deposit,
lock: { DEPOSIT_LOCK, args: rollup_type_hash ‖ DepositLockArgs },
type: null | sUDT,
data: 0x | sUDT amount
}
input[…] custodian cells(支付提款)input[…] custodian cells (fund withdrawals)Cell{
capacity: X,
lock: { CUSTODIAN_LOCK, args: rollup_type_hash ‖ CustodianLockArgs },
type: null | sUDT,
data: …
}
input[…] 出块者 stake cell(可选,续用)input[…] producer stake cell (optional, reused)Cell{
capacity: S,
lock: { STAKE_LOCK, args: 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{ block.count = n+1, tip_block_hash = new block,
account = block.post_account, config / reverted_root / status unchanged }
}
// lock unchanged
output[…] stake celloutput[…] stake cellCell{
capacity: ≥ required_staking_capacity, ≥ input stake,
lock: { STAKE_LOCK, args: same owner, stake_finalized_timepoint = this block },
type: null,
data: 0x
}
output[…] custodian cells(新存款)output[…] custodian cells (new deposits)Cell{
capacity: = deposits,
lock: { CUSTODIAN_LOCK, args: deposit_block_hash = this block, deposit_finalized_timepoint, deposit_lock_args },
type: null | sUDT,
data: …
}
output[…] withdrawal cells(本区块提款)output[…] withdrawal cells (this block’s withdrawals)Cell{
capacity: = request,
lock: { WITHDRAWAL_LOCK, args: rollup_type_hash ‖ WithdrawalLockArgs ‖ owner_lock },
type: null | sUDT,
data: …
}
cell_depscell_deps
cell_dep:STATE_VALIDATOR 代码cell_dep: STATE_VALIDATOR 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
cell_dep:各 lock 代码cell_dep: lock codescustodian / deposit / withdrawal / stake lock code cells
witnesses(WitnessArgs)witnesses (WitnessArgs)
witnesses[rollup 输出序号]witnesses[rollup output index]{ lock: signature for the rollup cell lock (block producer),
output_type: RollupAction::RollupSubmitBlock{ block: L2Block,
reverted_block_hashes, reverted_block_proof } }
data:GlobalState(190 字节 struct;V0 为 181 字节)data: GlobalState (190-byte struct; V0 is 181 bytes)
rollup_config_hash32
account32+4
block32+8
reverted_block_root32
tip_block_hash32
tip_block_timestamp8
last_finalized_timepoint8
status1
version1
- rollup_config_hash 32 RollupConfig cell 的 data hashdata hash of the RollupConfig cell (10)
- account 32+4 L2 账户 SMT 根 + 账户数L2 account SMT root + count
- block 32+8 L2 区块 SMT 根 + 区块数L2 block SMT root + count submit:+1submit: +1 (23)
- reverted_block_root 32 已回滚区块 SMT 根reverted block SMT root (13)
- tip_block_hash 32 最新 L2 区块 hashlatest L2 block hash (23)
- tip_block_timestamp 8 最新区块时间戳(V0 无)latest block timestamp (absent in V0)
- last_finalized_timepoint 8 最近终结的 Timepointlast finalized Timepoint (23)
- status 1 0 running / 1 halting0 running / 1 halting (21)
- version 1 rollup 版本(V0 无)rollup version (absent in V0) ≤ 2,不可降级≤ 2, no downgrade (23)
rollup_config_hash0x…(32B)
block.count0xa086010000000000 ← 100000
last_finalized_timepoint0x800001… ← top bit 1 = timestamp
status / version0x0002
witnesses[rollup 输出序号].output_type:RollupAction(molecule union)witnesses[rollup output index].output_type: RollupAction (molecule union)
item_id4B LE
bodytable
- item_id 4B LE 0 SubmitBlock / 1 EnterChallenge / 2 CancelChallenge / 3 Revert0 SubmitBlock / 1 EnterChallenge / 2 CancelChallenge / 3 Revert (4)
- body table 对应动作参数(如 SubmitBlock{block, reverted_block_hashes, reverted_block_proof})action args (e.g. SubmitBlock{block, reverted_block_hashes, reverted_block_proof}) ≤ 512 KiB (4)
RollupSubmitBlock0x00000000…
提交区块的详细规则(submit_block.rs 1000+ 行)只按错误码归纳,解码器不离线复算 SMT 证明与资产。The full submit rules (submit_block.rs, 1000+ lines) are summarized by error code; the decoder does not recompute SMT proofs or assets offline.
限制Constraints
- lock:: rollup cell lock 不变rollup cell lock unchanged (7)
- version:: post ≤ 2 且 ≥ prevpost ≤ 2 and ≥ prev (23)
- status:: prev = runningprev = running (21)
- 区块block:: 检查点 / 提款根 / 交易 / 时间戳checkpoints / withdrawal root / txs / timestamp (19 / 20)
- SMT:: kv_state_proof、区块 / 账户证明kv_state_proof, block / account proofs (13 / 18)
- stake:: 输出 stake cell 容量 ≥ required,参数与输入对应output stake capacity ≥ required; args match the input (25)
- deposit:: deposit cell 与 L2 铸币一致deposit cells match L2 minting (26)
- withdrawal:: withdrawal cell 与请求一致withdrawal cells match requests (27 / 33)
- custodian:: 输入 / 输出托管资产守恒custodian assets balance (28 / 16 / 17)
- 挑战challenge:: 交易中不得有 challenge cellno challenge cell in the tx (24)
- post GlobalState:: 完全等于按区块计算的期望值exactly equals the expected state (23)
- reverted_block_hashes:: 对 reverted_block_root 的 SMT 证明SMT proof against reverted_block_root (13)
1 → 1进入 / 取消挑战、回滚Enter / cancel challenge, revert
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[…] challenge cell(取消 / 回滚时)input[…] challenge cell (cancel / revert)Cell{
capacity: C,
lock: { CHALLENGE_LOCK, args: rollup_type_hash ‖ ChallengeLockArgs },
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{ status: Enter → 1 halting; Cancel / Revert → 0 running }
}
output[…] challenge cell(进入挑战时)output[…] challenge cell (enter challenge)Cell{
capacity: C,
lock: { CHALLENGE_LOCK, args: target{block_hash, target_index, target_type} ‖ rewards_receiver_lock },
type: null,
data: 0x
}
witnesses(WitnessArgs)witnesses (WitnessArgs)
witnesses[rollup 输出序号]witnesses[rollup output index]{ output_type: RollupEnterChallenge{ChallengeWitness} | RollupCancelChallenge{} |
RollupRevert{reverted_blocks, block_proof, reverted_block_proof, new_tip_block} }
witnesses[rollup 输出序号].output_type:RollupAction(molecule union)witnesses[rollup output index].output_type: RollupAction (molecule union)
item_id4B LE
bodytable
- item_id 4B LE 0 SubmitBlock / 1 EnterChallenge / 2 CancelChallenge / 3 Revert0 SubmitBlock / 1 EnterChallenge / 2 CancelChallenge / 3 Revert (4)
- body table 对应动作参数(如 SubmitBlock{block, reverted_block_hashes, reverted_block_proof})action args (e.g. SubmitBlock{block, reverted_block_hashes, reverted_block_proof}) ≤ 512 KiB (4)
RollupSubmitBlock0x00000000…
限制Constraints
- Enter:: prev running;输入无 / 输出恰有 challenge cell;目标区块未终结且存在prev running; no input / one output challenge cell; target block exists and is not finalized (21 / 24 / 32)
- Cancel:: 输入有 challenge cell;奖励 / 销毁正确;status 回 runningan input challenge cell; reward / burn correct; status back to running (24 / 30 / 23)
- Revert:: challenge 成熟;回滚区块与证明;奖励;stake 罚没challenge matured; reverted blocks and proofs; rewards; stake slashed (24 / 29 / 30 / 25 / 6 / 23)
部署与来源Deployments & source 未核验unverified
源码source godwokenrises/godwoken@c2b1f850 · gwos/contracts/state-validator/src · gwos/contracts/gw-utils/src · 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 | 0xfef1d086d9f74d143c60bf03bd04bab29200dbf484c801c72774f2056d4c6718 type | 0x9f8e73e096…6e543e67:0 code | 0x70f9600824…5e326d32 | 0x2ba2f8f983…fd90291f | 0x9f8e73e096…6e543e67 #7469219 |
| testnet | 0x1e44736436b406f8e48a30dfbddcf044feb0c9eebfe63b0f81cb5bb727d84854 type | 0xbcd73881ba…cb71612e:0 code | 0x063555cc66…f8257669 | 0x2ba2f8f983…fd90291f | 0xbcd73881ba…cb71612e #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).