BCSkill (Block chain skill )
区块链中文技术社区

只讨论区块链底层技术
遵守一切相关法律政策!

op-succinct 实测和流程相关代码分析

Clone op-succinct

https://github.com/succinctlabs/op-succinct.git

更新项目submodule

git submodule update --init --recursive

创建 .env

在op-succinct根目录新建.env文件,并填写自己的配置信息

L1_RPC=https://eth-sepolia.g.alchemy.com/v2/mQz ...
L1_BEACON_RPC=https://ethereum-sepolia-beacon-api.publicnode.com
L2_RPC=http://...:8545
L2_NODE_RPC=http://....:4000
PRIVATE_KEY=0xa7d....
ETHERSCAN_API_KEY=2BY57NTWCW...

L2_RPC需要开启debug,否则会在启动时debug_chainConfig报错

安装just

sudo apt update
sudo apt install snapd
sudo snap install just --classic

安装rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

安装OpenSSL

sudo apt update
sudo apt install libssl-dev

安装 RocksDB

sudo apt update
sudo apt install librocksdb-dev build-essential cmake libclang-dev

部署一个SP1MockVerifier用于验证模拟证明的

https://succinctlabs.github.io/op-succinct/quick-start/mock.html

just deploy-mock-verifier

注:如果出错,多重试几次

执行日志

[⠊] Compiling...
No files changed, compilation skipped
Script ran successfully.

== Return ==
0: address 0xe31B339d16697105Bc7EF9faf474CF7528557fF0

## Setting up 1 EVM.

==========================

Chain 11155111

Estimated gas price: 48.919307822 gwei

Estimated total gas used for script: 170454

Estimated amount required: 0.008338491695491188 ETH

修改.env

VERIFIER_ADDRESS=0xe31B339d16697105Bc7EF9faf474CF7528557fF0

部署地址:https://sepolia.etherscan.io/address/0x7C44E2970b17fE5BA823fEF5a3f60e38DDBb19d4

部署OPSuccinctL2outputOracle合约

just deploy-oracle

注:如果报交易发送失败等问题,就多尝试几次

执行日志

== Return ==
0: address 0x050FDc19d469ACc9e9A20761A565bEcE0cDD5879

## Setting up 1 EVM.

==========================

Chain 11155111

Estimated gas price: 62.822606964 gwei

Estimated total gas used for script: 3676931

Estimated amount required: 0.230994391046747484 ETH

==========================

##### sepolia
✅  [Success]Hash: 0xbd7ac1497869e49a110d0a85c9bd2b9ce3addc2328d89a9388125580825ae64b
Contract Address: 0xA9F8DEc334a35a99B7eFaca5C0a55b3e3706774A
Block: 7443868
Paid: 0.058773015956194648 ETH (1951822 gas * 30.111872884 gwei)


##### sepolia
✅  [Success]Hash: 0x925e583251914e0554cc4eb6076682817c11330c6eabbb5969fba2397988fd3f
Contract Address: 0x050FDc19d469ACc9e9A20761A565bEcE0cDD5879
Block: 7443868
Paid: 0.013220527454101548 ETH (439047 gas * 30.111872884 gwei)


##### sepolia
✅  [Success]Hash: 0x67a663442dfacf19296aa51b03fc6dddf9e66c254b93d6e2f64898ee15e0957b
Block: 7443868
Paid: 0.012419521523514264 ETH (412446 gas * 30.111872884 gwei)

✅ Sequence #1 on sepolia | Total Paid: 0.08441306493381046 ETH (2803315 gas * avg 30.111872884 gwei)


==========================

ONCHAIN EXECUTION COMPLETE & SUCCESSFUL.
##
Start verification for (2) contracts
Start verifying contract `0xA9F8DEc334a35a99B7eFaca5C0a55b3e3706774A` deployed on sepolia

Submitting verification for [src/OPSuccinctL2OutputOracle.sol:OPSuccinctL2OutputOracle] 0xA9F8DEc334a35a99B7eFaca5C0a55b3e3706774A.

Submitting verification for [src/OPSuccinctL2OutputOracle.sol:OPSuccinctL2OutputOracle] 0xA9F8DEc334a35a99B7eFaca5C0a55b3e3706774A.

Submitting verification for [src/OPSuccinctL2OutputOracle.sol:OPSuccinctL2OutputOracle] 0xA9F8DEc334a35a99B7eFaca5C0a55b3e3706774A.

Submitting verification for [src/OPSuccinctL2OutputOracle.sol:OPSuccinctL2OutputOracle] 0xA9F8DEc334a35a99B7eFaca5C0a55b3e3706774A.

Submitting verification for [src/OPSuccinctL2OutputOracle.sol:OPSuccinctL2OutputOracle] 0xA9F8DEc334a35a99B7eFaca5C0a55b3e3706774A.
Submitted contract for verification:
        Response: `OK`
        GUID: `brpptxuzsp3nan5cgtjqviyfnpj4tveeqam2slyg4z3aapjvav`
        URL: https://sepolia.etherscan.io/address/0xa9f8dec334a35a99b7efaca5c0a55b3e3706774a
Contract verification status:
Response: `NOTOK`
Details: `Pending in queue`
Contract verification status:
Response: `NOTOK`
Details: `Already Verified`
Contract source code already verified
Start verifying contract `0x050FDc19d469ACc9e9A20761A565bEcE0cDD5879` deployed on sepolia

Submitting verification for [lib/optimism/packages/contracts-bedrock/src/universal/Proxy.sol:Proxy] 0x050FDc19d469ACc9e9A20761A565bEcE0cDD5879.
Submitted contract for verification:
        Response: `OK`
        GUID: `2mvuftsib5mqxxaqyza4aumdmxfp6y5dwxtiiwvuaibutet6qb`
        URL: https://sepolia.etherscan.io/address/0x050fdc19d469acc9e9a20761a565bece0cdd5879
Contract verification status:
Response: `NOTOK`
Details: `Already Verified`
Contract source code already verified
All (2) contracts were verified!

Transactions saved to: /mnt/md0/saas/sp1/op-succinct/contracts/broadcast/OPSuccinctDeployer.s.sol/11155111/run-latest.json

Sensitive values saved to: /mnt/md0/saas/sp1/op-succinct/contracts/cache/OPSuccinctDeployer.s.sol/11155111/run-latest.json

run-latest.json

root@204185:/mnt/md0/saas/sp1/op-succinct# cat contracts/broadcast/OPSuccinctDeployer.s.sol/11155111/run-latest.json

{
  "transactions": [
    {
      "hash": "0xbd7ac1497869e49a110d0a85c9bd2b9ce3addc2328d89a9388125580825ae64b",
      "transactionType": "CREATE",
      "contractName": "OPSuccinctL2OutputOracle",
      "contractAddress": "0xa9f8dec334a35a99b7efaca5c0a55b3e3706774a",
      "function": null,
      "arguments": null,
      "transaction": {
        "from": "0xc2df13b6ad0753e0547a318f65f99ac62aec6e2b",
        "gas": "0x26b4c3",
        "value": "0x0",
        "input": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6121d880620000ee6000396000f3fe6080604052600436106102715760003560e01c806389c44cbb1161014f578063bffa7f0f116100c1578063d46512761161007a578063d465127614610758578063db1470f514610788578063dcec3348146107a8578063e1a41bcf146107bd578063f2fde38b146107d3578063f4daa291146107f357600080fd5b8063bffa7f0f146106ae578063c32e4e3e146106cc578063c4cb03ec146106e2578063ce5db8d614610702578063cf8e5cf014610718578063d1de856c1461073857600080fd5b80639ad84880116101135780639ad84880146105bb578063a196b525146105ce578063a25ae557146105fb578063a8e4fb901461064e578063b03cd4181461066e578063bc91ce331461068e57600080fd5b806389c44cbb146105325780638da5cb5b1461055257806393991af31461057257806397fc007c146105885780639aaab648146105a857600080fd5b8063534db0e2116101e85780636b4d98dd116101ac5780636b4d98dd1461048b5780636d9a1c8b146104a957806370872aa5146104bf5780637f006420146104d55780637f01ea68146104f5578063887862721461051c57600080fd5b8063534db0e2146103d457806354fd4d50146103f457806360caf7a01461043757806369f16eec146104615780636abcf5631461047657600080fd5b80632b7ac3f31161023a5780632b7ac3f3146103125780632c6979611461034a578063336c9e811461036a5780634599c7881461038a5780634ab309ac1461039f578063529933df146103bf57600080fd5b80622134cc1461027657806309d632d31461029a5780631bdd450c146102bc5780631e856800146102dc5780632b31841e146102fc575b600080fd5b34801561028257600080fd5b506005545b6040519081526020015b60405180910390f35b3480156102a657600080fd5b506102ba6102b5366004611c2f565b610808565b005b3480156102c857600080fd5b506102ba6102d7366004611c51565b610891565b3480156102e857600080fd5b506102ba6102f7366004611c51565b6108ef565b34801561030857600080fd5b50610287600a5481565b34801561031e57600080fd5b50600b54610332906001600160a01b031681565b6040516001600160a01b039091168152602001610291565b34801561035657600080fd5b506102ba610365366004611c51565b610921565b34801561037657600080fd5b506102ba610385366004611c51565b6109b3565b34801561039657600080fd5b50610287610a1e565b3480156103ab57600080fd5b506102ba6103ba366004611c51565b610a7b565b3480156103cb57600080fd5b50600454610287565b3480156103e057600080fd5b50600654610332906001600160a01b031681565b34801561040057600080fd5b5061042a6040518060400160405280600a8152602001693b189718171816b9319960b11b81525081565b6040516102919190611cb7565b34801561044357600080fd5b506010546104519060ff1681565b6040519015158152602001610291565b34801561046d57600080fd5b50610287610b09565b34801561048257600080fd5b50600354610287565b34801561049757600080fd5b506006546001600160a01b0316610332565b3480156104b557600080fd5b50610287600c5481565b3480156104cb57600080fd5b5061028760015481565b3480156104e157600080fd5b506102876104f0366004611c51565b610b1b565b34801561050157600080fd5b5061050a600181565b60405160ff9091168152602001610291565b34801561052857600080fd5b5061028760025481565b34801561053e57600080fd5b506102ba61054d366004611c51565b610cb9565b34801561055e57600080fd5b50600d54610332906001600160a01b031681565b34801561057e57600080fd5b5061028760055481565b34801561059457600080fd5b506102ba6105a3366004611c2f565b610ebe565b6102ba6105b6366004611cca565b610f44565b6102ba6105c9366004611d6d565b61120b565b3480156105da57600080fd5b506102876105e9366004611c51565b600f6020526000908152604090205481565b34801561060757600080fd5b5061061b610616366004611c51565b6115a5565b60408051825181526020808401516001600160801b03908116918301919091529282015190921690820152606001610291565b34801561065a57600080fd5b50600754610332906001600160a01b031681565b34801561067a57600080fd5b506102ba610689366004611c2f565b611623565b34801561069a57600080fd5b506102ba6106a9366004611c51565b6116a4565b3480156106ba57600080fd5b506007546001600160a01b0316610332565b3480156106d857600080fd5b5061028760095481565b3480156106ee57600080fd5b506102ba6106fd366004611c51565b611702565b34801561070e57600080fd5b5061028760085481565b34801561072457600080fd5b5061061b610733366004611c51565b611760565b34801561074457600080fd5b50610287610753366004611c51565b611798565b34801561076457600080fd5b50610451610773366004611c2f565b600e6020526000908152604090205460ff1681565b34801561079457600080fd5b506102ba6107a3366004611e1f565b6117c8565b3480156107b457600080fd5b50610287611b76565b3480156107c957600080fd5b5061028760045481565b3480156107df57600080fd5b506102ba6107ee366004611c2f565b611b8d565b3480156107ff57600080fd5b50600854610287565b600d546001600160a01b0316331461083b5760405162461bcd60e51b815260040161083290611ee2565b60405180910390fd5b6001600160a01b0381166000818152600e60209081526040808320805460ff19169055519182527f5df38d395edc15b669d646569bd015513395070b5b4deb8a16300abb060d1b5a91015b60405180910390a250565b600d546001600160a01b031633146108bb5760405162461bcd60e51b815260040161083290611ee2565b600c546040518291907f5d9ebe9f09b0810b3546b30781ba9a51092b37dd6abada4b830ce54a41ac6a4b90600090a3600c55565b80408061090f576040516321301a1960e21b815260040160405180910390fd5b6000918252600f602052604090912055565b600d546001600160a01b0316331461094b5760405162461bcd60e51b815260040161083290611ee2565b60105460ff161561096e5760405162461bcd60e51b815260040161083290611f29565b60088190556010805460ff191660019081179091556040518281527f1f5c872f1ea93c57e43112ea449ee19ef5754488b87627b4c52456b0e5a4109a90602001610886565b600d546001600160a01b031633146109dd5760405162461bcd60e51b815260040161083290611ee2565b60045460408051918252602082018390527fc1bf9abfb57ea01ed9ecb4f45e9cefa7ba44b2e6778c3ce7281409999f1af1b2910160405180910390a1600455565b60035460009015610a725760038054610a3990600190611f89565b81548110610a4957610a49611fa0565b6000918252602090912060029091020160010154600160801b90046001600160801b0316919050565b6001545b905090565b600d546001600160a01b03163314610aa55760405162461bcd60e51b815260040161083290611ee2565b60105460ff16610ac75760405162461bcd60e51b815260040161083290611fb6565b60088190556010805460ff191690556040518181526000907f1f5c872f1ea93c57e43112ea449ee19ef5754488b87627b4c52456b0e5a4109a90602001610886565b600354600090610a7690600190611f89565b6000610b25610a1e565b821115610bab5760405162461bcd60e51b815260206004820152604860248201527f4c324f75747075744f7261636c653a2063616e6e6f7420676574206f7574707560448201527f7420666f72206120626c6f636b207468617420686173206e6f74206265656e206064820152671c1c9bdc1bdcd95960c21b608482015260a401610832565b600354610c2f5760405162461bcd60e51b815260206004820152604660248201527f4c324f75747075744f7261636c653a2063616e6e6f7420676574206f7574707560448201527f74206173206e6f206f7574707574732068617665206265656e2070726f706f736064820152651959081e595d60d21b608482015260a401610832565b6003546000905b80821015610cb25760006002610c4c8385612004565b610c56919061201c565b90508460038281548110610c6c57610c6c611fa0565b6000918252602090912060029091020160010154600160801b90046001600160801b03161015610ca857610ca1816001612004565b9250610cac565b8091505b50610c36565b5092915050565b6006546001600160a01b03163314610d395760405162461bcd60e51b815260206004820152603e60248201527f4c324f75747075744f7261636c653a206f6e6c7920746865206368616c6c656e60448201527f67657220616464726573732063616e2064656c657465206f75747075747300006064820152608401610832565b6003548110610dbc5760405162461bcd60e51b815260206004820152604360248201527f4c324f75747075744f7261636c653a2063616e6e6f742064656c657465206f7560448201527f747075747320616674657220746865206c6174657374206f757470757420696e6064820152620c8caf60eb1b608482015260a401610832565b60085460038281548110610dd257610dd2611fa0565b6000918252602090912060016002909202010154610df9906001600160801b031642611f89565b10610e7b5760405162461bcd60e51b815260206004820152604660248201527f4c324f75747075744f7261636c653a2063616e6e6f742064656c657465206f7560448201527f74707574732074686174206861766520616c7265616479206265656e2066696e606482015265185b1a5e995960d21b608482015260a401610832565b6000610e8660035490565b90508160035581817f4ee37ac2c786ec85e87592d3c5c8a1dd66f8496dda3f125d9ea8ca5f657629b660405160405180910390a35050565b600d546001600160a01b03163314610ee85760405162461bcd60e51b815260040161083290611ee2565b600b546040516001600160a01b038084169216907f0243549a92b2412f7a3caf7a2e56d65b8821b91345363faa5f57195384065fcc90600090a3600b80546001600160a01b0319166001600160a01b0392909216919091179055565b60105460ff16610f665760405162461bcd60e51b815260040161083290611fb6565b336000908152600e602052604090205460ff1680610fae575060008052600e6020527fe710864318d4a32f37d6ce54cb3fadbef648dd12d8dbdf53973564d56b7f881c5460ff165b610fca5760405162461bcd60e51b81526004016108329061203e565b610fd2611b76565b83146110575760405162461bcd60e51b815260206004820152604860248201527f4c324f75747075744f7261636c653a20626c6f636b206e756d626572206d757360448201527f7420626520657175616c20746f206e65787420657870656374656420626c6f636064820152673590373ab6b132b960c11b608482015260a401610832565b4261106184611798565b1061107e5760405162461bcd60e51b81526004016108329061209b565b8361109b5760405162461bcd60e51b8152600401610832906120f1565b811561112957818140146111295760405162461bcd60e51b815260206004820152604960248201527f4c324f75747075744f7261636c653a20626c6f636b206861736820646f65732060448201527f6e6f74206d6174636820746865206861736820617420746865206578706563746064820152681959081a195a59da1d60ba1b608482015260a401610832565b8261113360035490565b857fa7aaf2512769da4e444e3de247be2564225c2e7a8f74cfe528e46e17d24868e24260405161116591815260200190565b60405180910390a45050604080516060810182529283526001600160801b034281166020850190815292811691840191825260038054600181018255600091909152935160029094027fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b810194909455915190518216600160801b029116177fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85c90910155565b60105460ff161561122e5760405162461bcd60e51b815260040161083290611f29565b336000908152600e602052604090205460ff1680611276575060008052600e6020527fe710864318d4a32f37d6ce54cb3fadbef648dd12d8dbdf53973564d56b7f881c5460ff165b6112925760405162461bcd60e51b81526004016108329061203e565b61129a611b76565b8310156113355760405162461bcd60e51b815260206004820152605860248201527f4c324f75747075744f7261636c653a20626c6f636b206e756d626572206d757360448201527f742062652067726561746572207468616e206f7220657175616c20746f206e6560648201527f787420657870656374656420626c6f636b206e756d6265720000000000000000608482015260a401610832565b4261133f84611798565b1061135c5760405162461bcd60e51b81526004016108329061209b565b836113795760405162461bcd60e51b8152600401610832906120f1565b6000828152600f6020526040902054806113a657604051630455475360e31b815260040160405180910390fd5b60006040518060c0016040528083815260200160036113c3610b09565b815481106113d3576113d3611fa0565b60009182526020918290206002909102015482528181018990526040808301899052600c54606080850191909152600a54608094850152600b5460095483518751818701529487015185850152928601518483015290850151838501529284015160a08084019190915284015160c08301529293506001600160a01b03909116916341493c609160e001604051602081830303815290604052866040518463ffffffff1660e01b815260040161148b9392919061214e565b60006040518083038186803b1580156114a357600080fd5b505afa1580156114b7573d6000803e3d6000fd5b50505050846114c560035490565b877fa7aaf2512769da4e444e3de247be2564225c2e7a8f74cfe528e46e17d24868e2426040516114f791815260200190565b60405180910390a45050604080516060810182529485526001600160801b034281166020870190815294811691860191825260038054600181018255600091909152955160029096027fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b810196909655935190518416600160801b029316929092177fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85c909301929092555050565b6040805160608101825260008082526020820181905291810191909152600382815481106115d5576115d5611fa0565b600091825260209182902060408051606081018252600290930290910180548352600101546001600160801b0380821694840194909452600160801b90049092169181019190915292915050565b600d546001600160a01b0316331461164d5760405162461bcd60e51b815260040161083290611ee2565b6001600160a01b0381166000818152600e6020908152604091829020805460ff1916600190811790915591519182527f5df38d395edc15b669d646569bd015513395070b5b4deb8a16300abb060d1b5a9101610886565b600d546001600160a01b031633146116ce5760405162461bcd60e51b815260040161083290611ee2565b600a546040518291907fbf8cab6317796bfa97fea82b6d27c9542a08fa0821813cf2a57e7cff7fdc815690600090a3600a55565b600d546001600160a01b0316331461172c5760405162461bcd60e51b815260040161083290611ee2565b6009546040518291907f390b73b2b067afcef04d30b573e4590c6e565519e370927dd777ca0ce8a55db090600090a3600955565b6040805160608101825260008082526020820181905291810191909152600361178883610b1b565b815481106115d5576115d5611fa0565b6000600554600154836117ab9190611f89565b6117b59190612183565b6002546117c29190612004565b92915050565b600054600190610100900460ff161580156117ea575060005460ff8083169116105b61184d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610832565b6000805461ffff191660ff8316176101001790556101608201516118d95760405162461bcd60e51b815260206004820152603a60248201527f4c324f75747075744f7261636c653a207375626d697373696f6e20696e74657260448201527f76616c206d7573742062652067726561746572207468616e20300000000000006064820152608401610832565b600082608001511161194a5760405162461bcd60e51b815260206004820152603460248201527f4c324f75747075744f7261636c653a204c3220626c6f636b2074696d65206d75604482015273073742062652067726561746572207468616e20360641b6064820152608401610832565b4282610140015111156119d35760405162461bcd60e51b8152602060048201526044602482018190527f4c324f75747075744f7261636c653a207374617274696e67204c322074696d65908201527f7374616d70206d757374206265206c657373207468616e2063757272656e742060648201526374696d6560e01b608482015260a401610832565b6101608201516004556080820151600555600354600003611aaa57604080516060810182526101008401518152610140840180516001600160801b03908116602084019081526101208701805183169585019586526003805460018181018355600092909252955160029687027fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b810191909155925196518416600160801b0296909316959095177fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85c909101559251909255905190555b8151600680546001600160a01b03199081166001600160a01b0393841617909155606084015160085560208085015183166000908152600e82526040808220805460ff1916600117905560a087015160095560c0870151600a55610180870151600b8054861691871691909117905560e0870151600c5580870151600d8054909516951694909417909255815461ff001916909155905160ff831681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498910160405180910390a15050565b6000600454611b83610a1e565b610a769190612004565b600d546001600160a01b03163314611bb75760405162461bcd60e51b815260040161083290611ee2565b600d546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600d80546001600160a01b0319166001600160a01b0392909216919091179055565b80356001600160a01b0381168114611c2a57600080fd5b919050565b600060208284031215611c4157600080fd5b611c4a82611c13565b9392505050565b600060208284031215611c6357600080fd5b5035919050565b6000815180845260005b81811015611c9057602081850181015186830182015201611c74565b81811115611ca2576000602083870101525b50601f01601f19169290920160200192915050565b602081526000611c4a6020830184611c6a565b60008060008060808587031215611ce057600080fd5b5050823594602084013594506040840135936060013592509050565b634e487b7160e01b600052604160045260246000fd5b6040516101a0810167ffffffffffffffff81118282101715611d3657611d36611cfc565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611d6557611d65611cfc565b604052919050565b60008060008060808587031215611d8357600080fd5b84359350602080860135935060408601359250606086013567ffffffffffffffff80821115611db157600080fd5b818801915088601f830112611dc557600080fd5b813581811115611dd757611dd7611cfc565b611de9601f8201601f19168501611d3c565b91508082528984828501011115611dff57600080fd5b808484018584013760008482840101525080935050505092959194509250565b60006101a08284031215611e3257600080fd5b611e3a611d12565b611e4383611c13565b8152611e5160208401611c13565b6020820152611e6260408401611c13565b6040820152606083013560608201526080830135608082015260a083013560a082015260c083013560c082015260e083013560e0820152610100808401358183015250610120808401358183015250610140808401358183015250610160808401358183015250610180611ed7818501611c13565b908201529392505050565b60208082526027908201527f4c324f75747075744f7261636c653a2063616c6c6572206973206e6f74207468604082015266329037bbb732b960c91b606082015260800190565b6020808252602a908201527f4c324f75747075744f7261636c653a206f7074696d6973746963206d6f6465206040820152691a5cc8195b98589b195960b21b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b600082821015611f9b57611f9b611f73565b500390565b634e487b7160e01b600052603260045260246000fd5b6020808252602e908201527f4c324f75747075744f7261636c653a206f7074696d6973746963206d6f64652060408201526d1a5cc81b9bdd08195b98589b195960921b606082015260800190565b6000821982111561201757612017611f73565b500190565b60008261203957634e487b7160e01b600052601260045260246000fd5b500490565b6020808252603f908201527f4c324f75747075744f7261636c653a206f6e6c7920617070726f76656420707260408201527f6f706f736572732063616e2070726f706f7365206e6577206f75747075747300606082015260800190565b60208082526036908201527f4c324f75747075744f7261636c653a2063616e6e6f742070726f706f7365204c60408201527532206f757470757420696e207468652066757475726560501b606082015260800190565b6020808252603a908201527f4c324f75747075744f7261636c653a204c32206f75747075742070726f706f7360408201527f616c2063616e6e6f7420626520746865207a65726f2068617368000000000000606082015260800190565b8381526060602082015260006121676060830185611c6a565b82810360408401526121798185611c6a565b9695505050505050565b600081600019048311821515161561219d5761219d611f73565b50029056fea26469706673582212205e369ad4437dabea1f1be6283d955e7638d425f8b17b82e789370710917ca6f664736f6c634300080f0033",
        "nonce": "0x4a",
        "chainId": "0xaa36a7"
      },
      "additionalContracts": [],
      "isFixedGasLimit": false
    },
    {
      "hash": "0x925e583251914e0554cc4eb6076682817c11330c6eabbb5969fba2397988fd3f",
      "transactionType": "CREATE",
      "contractName": "Proxy",
      "contractAddress": "0x050fdc19d469acc9e9a20761a565bece0cdd5879",
      "function": null,
      "arguments": [
        "0xC2Df13b6AD0753E0547A318F65F99aC62AEC6E2b"
      ],
      "transaction": {
        "from": "0xc2df13b6ad0753e0547a318f65f99ac62aec6e2b",
        "gas": "0x8b4e7",
        "value": "0x0",
        "input": "0x608060405234801561001057600080fd5b5060405161078e38038061078e83398101604081905261002f916100b5565b6100388161003e565b506100e5565b600061005660008051602061076e8339815191525490565b60008051602061076e833981519152838155604080516001600160a01b0380851682528616602082015292935090917f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f910160405180910390a1505050565b6000602082840312156100c757600080fd5b81516001600160a01b03811681146100de57600080fd5b9392505050565b61067a806100f46000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100855780635c60da1b146100ae5780638f283970146100db578063f851a440146100fb5761005d565b3661005d5761005b610110565b005b61005b610110565b34801561007157600080fd5b5061005b610080366004610521565b6101c8565b61009861009336600461053c565b61020e565b6040516100a591906105bf565b60405180910390f35b3480156100ba57600080fd5b506100c361033e565b6040516001600160a01b0390911681526020016100a5565b3480156100e757600080fd5b5061005b6100f6366004610521565b6103a9565b34801561010757600080fd5b506100c36103e4565b600061013a7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b90506001600160a01b0381166101a55760405162461bcd60e51b815260206004820152602560248201527f50726f78793a20696d706c656d656e746174696f6e206e6f7420696e697469616044820152641b1a5e995960da1b60648201526084015b60405180910390fd5b3660008037600080366000845af43d6000803e806101c2573d6000fd5b503d6000f35b600080516020610625833981519152546001600160a01b0316336001600160a01b031614806101f5575033155b156102065761020381610432565b50565b610203610110565b60606102266000805160206106258339815191525490565b6001600160a01b0316336001600160a01b03161480610243575033155b1561032f5761025184610432565b600080856001600160a01b0316858560405161026e929190610614565b600060405180830381855af49150503d80600081146102a9576040519150601f19603f3d011682016040523d82523d6000602084013e6102ae565b606091505b5091509150816103265760405162461bcd60e51b815260206004820152603960248201527f50726f78793a2064656c656761746563616c6c20746f206e657720696d706c6560448201527f6d656e746174696f6e20636f6e7472616374206661696c656400000000000000606482015260840161019c565b91506103379050565b610337610110565b9392505050565b60006103566000805160206106258339815191525490565b6001600160a01b0316336001600160a01b03161480610373575033155b1561039e57507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b6103a6610110565b90565b600080516020610625833981519152546001600160a01b0316336001600160a01b031614806103d6575033155b15610206576102038161048e565b60006103fc6000805160206106258339815191525490565b6001600160a01b0316336001600160a01b03161480610419575033155b1561039e57506000805160206106258339815191525490565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8181556040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a25050565b60006104a66000805160206106258339815191525490565b600080516020610625833981519152838155604080516001600160a01b0380851682528616602082015292935090917f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f910160405180910390a1505050565b80356001600160a01b038116811461051c57600080fd5b919050565b60006020828403121561053357600080fd5b61033782610505565b60008060006040848603121561055157600080fd5b61055a84610505565b9250602084013567ffffffffffffffff8082111561057757600080fd5b818601915086601f83011261058b57600080fd5b81358181111561059a57600080fd5b8760208285010111156105ac57600080fd5b6020830194508093505050509250925092565b600060208083528351808285015260005b818110156105ec578581018301518582016040015282016105d0565b818111156105fe576000604083870101525b50601f01601f1916929092016040019392505050565b818382376000910190815291905056feb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103a2646970667358221220318caf201f2a8916e5df0b75205914e02ed0e95fa1304e2b2510e3499a9c88f164736f6c634300080f0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103000000000000000000000000c2df13b6ad0753e0547a318f65f99ac62aec6e2b",
        "nonce": "0x4b",
        "chainId": "0xaa36a7"
      },
      "additionalContracts": [],
      "isFixedGasLimit": false
    },
    {
      "hash": "0x67a663442dfacf19296aa51b03fc6dddf9e66c254b93d6e2f64898ee15e0957b",
      "transactionType": "CALL",
      "contractName": "Proxy",
      "contractAddress": "0x050fdc19d469acc9e9a20761a565bece0cdd5879",
      "function": "upgradeToAndCall(address,bytes)",
      "arguments": [
        "0xA9F8DEc334a35a99B7eFaca5C0a55b3e3706774A",
        "0xdb1470f5000000000000000000000000c2df13b6ad0753e0547a318f65f99ac62aec6e2b000000000000000000000000c2df13b6ad0753e0547a318f65f99ac62aec6e2b000000000000000000000000c2df13b6ad0753e0547a318f65f99ac62aec6e2b0000000000000000000000000000000000000000000000000000000000000e10000000000000000000000000000000000000000000000000000000000000000200d4e72bc998d0528b0722a53bedd9c6f0143c9157af194ad4bb2502e37a496f33e3678015df481724af3aac49d000923caeec277027610b1490f857769f9459ae480336b576abf09a25c2a05c88aea3449a0a8d799175eb5b8d1e164f1af100e985c9bd50994b5a7c672caf4d0db7045cd0ab3bd324f1463886b5cb1073f205000000000000000000000000000000000000000000000000000000000005b97b00000000000000000000000000000000000000000000000000000000677dddf600000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000e31b339d16697105bc7ef9faf474cf7528557ff0"
      ],
      "transaction": {
        "from": "0xc2df13b6ad0753e0547a318f65f99ac62aec6e2b",
        "to": "0x050fdc19d469acc9e9a20761a565bece0cdd5879",
        "gas": "0x8b159",
        "value": "0x0",
        "input": "0x4f1ef286000000000000000000000000a9f8dec334a35a99b7efaca5c0a55b3e3706774a000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001a4db1470f5000000000000000000000000c2df13b6ad0753e0547a318f65f99ac62aec6e2b000000000000000000000000c2df13b6ad0753e0547a318f65f99ac62aec6e2b000000000000000000000000c2df13b6ad0753e0547a318f65f99ac62aec6e2b0000000000000000000000000000000000000000000000000000000000000e10000000000000000000000000000000000000000000000000000000000000000200d4e72bc998d0528b0722a53bedd9c6f0143c9157af194ad4bb2502e37a496f33e3678015df481724af3aac49d000923caeec277027610b1490f857769f9459ae480336b576abf09a25c2a05c88aea3449a0a8d799175eb5b8d1e164f1af100e985c9bd50994b5a7c672caf4d0db7045cd0ab3bd324f1463886b5cb1073f205000000000000000000000000000000000000000000000000000000000005b97b00000000000000000000000000000000000000000000000000000000677dddf600000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000e31b339d16697105bc7ef9faf474cf7528557ff000000000000000000000000000000000000000000000000000000000",
        "nonce": "0x4c",
        "chainId": "0xaa36a7"
      },
      "additionalContracts": [],
      "isFixedGasLimit": false
    }
  ],
  "receipts": [
    {
      "status": "0x1",
      "cumulativeGasUsed": "0x9d85f8",
      "logs": [
        {
          "address": "0xa9f8dec334a35a99b7efaca5c0a55b3e3706774a",
          "topics": [
            "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498"
          ],
          "data": "0x00000000000000000000000000000000000000000000000000000000000000ff",
          "blockHash": "0x730c7d63af79783184946d8790b62a2d32490e27c1459780af534a01cf70390e",
          "blockNumber": "0x71959c",
          "transactionHash": "0xbd7ac1497869e49a110d0a85c9bd2b9ce3addc2328d89a9388125580825ae64b",
          "transactionIndex": "0x47",
          "logIndex": "0x90",
          "removed": false
        }
      ],
      "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000",
      "type": "0x2",
      "transactionHash": "0xbd7ac1497869e49a110d0a85c9bd2b9ce3addc2328d89a9388125580825ae64b",
      "transactionIndex": "0x47",
      "blockHash": "0x730c7d63af79783184946d8790b62a2d32490e27c1459780af534a01cf70390e",
      "blockNumber": "0x71959c",
      "gasUsed": "0x1dc84e",
      "effectiveGasPrice": "0x702ceb774",
      "from": "0xc2df13b6ad0753e0547a318f65f99ac62aec6e2b",
      "to": null,
      "contractAddress": "0xa9f8dec334a35a99b7efaca5c0a55b3e3706774a"
    },
    {
      "status": "0x1",
      "cumulativeGasUsed": "0xa438ff",
      "logs": [
        {
          "address": "0x050fdc19d469acc9e9a20761a565bece0cdd5879",
          "topics": [
            "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f"
          ],
          "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c2df13b6ad0753e0547a318f65f99ac62aec6e2b",
          "blockHash": "0x730c7d63af79783184946d8790b62a2d32490e27c1459780af534a01cf70390e",
          "blockNumber": "0x71959c",
          "transactionHash": "0x925e583251914e0554cc4eb6076682817c11330c6eabbb5969fba2397988fd3f",
          "transactionIndex": "0x48",
          "logIndex": "0x91",
          "removed": false
        }
      ],
      "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800004000000000000000000000008000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
      "type": "0x2",
      "transactionHash": "0x925e583251914e0554cc4eb6076682817c11330c6eabbb5969fba2397988fd3f",
      "transactionIndex": "0x48",
      "blockHash": "0x730c7d63af79783184946d8790b62a2d32490e27c1459780af534a01cf70390e",
      "blockNumber": "0x71959c",
      "gasUsed": "0x6b307",
      "effectiveGasPrice": "0x702ceb774",
      "from": "0xc2df13b6ad0753e0547a318f65f99ac62aec6e2b",
      "to": null,
      "contractAddress": "0x050fdc19d469acc9e9a20761a565bece0cdd5879"
    },
    {
      "status": "0x1",
      "cumulativeGasUsed": "0xaa841d",
      "logs": [
        {
          "address": "0x050fdc19d469acc9e9a20761a565bece0cdd5879",
          "topics": [
            "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b",
            "0x000000000000000000000000a9f8dec334a35a99b7efaca5c0a55b3e3706774a"
          ],
          "data": "0x",
          "blockHash": "0x730c7d63af79783184946d8790b62a2d32490e27c1459780af534a01cf70390e",
          "blockNumber": "0x71959c",
          "transactionHash": "0x67a663442dfacf19296aa51b03fc6dddf9e66c254b93d6e2f64898ee15e0957b",
          "transactionIndex": "0x49",
          "logIndex": "0x92",
          "removed": false
        },
        {
          "address": "0x050fdc19d469acc9e9a20761a565bece0cdd5879",
          "topics": [
            "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498"
          ],
          "data": "0x0000000000000000000000000000000000000000000000000000000000000001",
          "blockHash": "0x730c7d63af79783184946d8790b62a2d32490e27c1459780af534a01cf70390e",
          "blockNumber": "0x71959c",
          "transactionHash": "0x67a663442dfacf19296aa51b03fc6dddf9e66c254b93d6e2f64898ee15e0957b",
          "transactionIndex": "0x49",
          "logIndex": "0x93",
          "removed": false
        }
      ],
      "logsBloom": "0x00000000000000000000000000000000400080000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000008000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000040000020000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
      "type": "0x2",
      "transactionHash": "0x67a663442dfacf19296aa51b03fc6dddf9e66c254b93d6e2f64898ee15e0957b",
      "transactionIndex": "0x49",
      "blockHash": "0x730c7d63af79783184946d8790b62a2d32490e27c1459780af534a01cf70390e",
      "blockNumber": "0x71959c",
      "gasUsed": "0x64b1e",
      "effectiveGasPrice": "0x702ceb774",
      "from": "0xc2df13b6ad0753e0547a318f65f99ac62aec6e2b",
      "to": "0x050fdc19d469acc9e9a20761a565bece0cdd5879",
      "contractAddress": null
    }
  ],
  "libraries": [],
  "pending": [],
  "returns": {
    "0": {
      "internal_type": "address",
      "value": "0x050FDc19d469ACc9e9A20761A565bEcE0cDD5879"
    }
  },
  "timestamp": 1736304388,
  "chain": 11155111,
  "commit": "519e7c8"
}

地址交易

https://sepolia.etherscan.io/tx/0xbd7ac1497869e49a110d0a85c9bd2b9ce3addc2328d89a9388125580825ae64b
https://sepolia.etherscan.io/tx/0x925e583251914e0554cc4eb6076682817c11330c6eabbb5969fba2397988fd3f
https://sepolia.etherscan.io/tx/0x67a663442dfacf19296aa51b03fc6dddf9e66c254b93d6e2f64898ee15e0957b

设置op-succinct服务环境变量

修改.env,在前面配置前提下,增加以下配置

  • L2OO_ADDRESS OPSuccinctL2OutputOracle上一步中的合约地址。(执行日志中,最开始return的地址)
  • OP_SUCCINCT_MOCK 设置为true模拟模式。
L2OO_ADDRESS=0x050FDc19d469ACc9e9A20761A565bEcE0cDD5879
OP_SUCCINCT_MOCK=true

op-succinct已模拟器方式启动

构建 Docker Compose 设置。

docker compose build
CONTAINER ID   IMAGE                                            COMMAND                  CREATED              STATUS              PORTS                                                                                                                                                                                     NAMES
516e7d420adb   op-succinct-op-succinct-proposer                 "/usr/local/bin/op_p…"   About a minute ago   Up About a minute   0.0.0.0:7300->7300/tcp, :::7300->7300/tcp                                                                                                                                                 op-succinct-op-succinct-proposer-1
5c9def1ff705   op-succinct-op-succinct-server                   "/usr/local/bin/serv…"   About a minute ago   Up About a minute   0.0.0.0:3000->3000/tcp, :::3000->3000/tcp                                                                                                                                                 op-succinct-op-succinct-server-1

运行提议器

docker compose up -d

此命令在后台启动op-succinct 服务。它会启动两个容器:一个容器管理证明生成,另一个容器是原始 op-proposer 服务的一个小分支。
几分钟后,您应该会看到 op-succinct-proposer 服务开始生成模拟范围证明。一旦生成了足够的范围证明,就会创建一个模拟聚合证明并提交给 L1。

查看日志

docker compose logs -f
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:46:54+0000 lvl=info msg="Proposer status" metrics="{L2UnsafeHeadBlock:378134 L2FinalizedBlock:376987 LatestContractL2Block:375163 HighestProvenContiguousL2Block:376963 MinBlockToProveToAgg:376163 NumProving:0 NumWitnessgen:0 NumUnrequested:0}"
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:46:54+0000 lvl=info msg="Stage 1: Getting Range Proof Boundaries..."
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:46:54+0000 lvl=info msg="Stage 2: Processing PROVING requests..."
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:46:54+0000 lvl=info msg="Stage 3: Processing WITNESSGEN requests..."
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:46:54+0000 lvl=info msg="Stage 3: Deriving Agg Proofs..."
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:46:55+0000 lvl=info msg="created new AGG proof" from=375163 to=376963
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:46:55+0000 lvl=info msg="Stage 4: Requesting Queued Proofs..."
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:46:55+0000 lvl=info msg="Publishing transaction" service=proposer tx=0xd314db1133eb1a6948a030c4d6d1d5eb438783c4d702740871fdbaebb67e8e02 nonce=77 gasTipCap=1000000000 gasFeeCap=40045868604 gasLimit=49166 tx=0xd314db1133eb1a6948a030c4d6d1d5eb438783c4d702740871fdbaebb67e8e02
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:46:55+0000 lvl=info msg="Transaction successfully published" service=proposer tx=0xd314db1133eb1a6948a030c4d6d1d5eb438783c4d702740871fdbaebb67e8e02 nonce=77 gasTipCap=1000000000 gasFeeCap=40045868604 gasLimit=49166 tx=0xd314db1133eb1a6948a030c4d6d1d5eb438783c4d702740871fdbaebb67e8e02
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:49:19+0000 lvl=info msg="Transaction confirmed" service=proposer tx=0xd314db1133eb1a6948a030c4d6d1d5eb438783c4d702740871fdbaebb67e8e02 block=0x7453cd10c2109e64833eba6157f18ff5190721435f20fa12255e2c60d5fb1abc:7444153 effectiveGasPrice=20301622776
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:49:19+0000 lvl=info msg="checkpoint blockhash tx successfully published" tx_hash=0xd314db1133eb1a6948a030c4d6d1d5eb438783c4d702740871fdbaebb67e8e02
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:49:19+0000 lvl=info msg="Stage 5: Submitting Agg Proofs..."
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:49:20+0000 lvl=info msg="Proposer status" metrics="{L2UnsafeHeadBlock:378207 L2FinalizedBlock:376987 LatestContractL2Block:375163 HighestProvenContiguousL2Block:376963 MinBlockToProveToAgg:376163 NumProving:0 NumWitnessgen:0 NumUnrequested:1}"
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:49:20+0000 lvl=info msg="Stage 1: Getting Range Proof Boundaries..."
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:49:20+0000 lvl=info msg="Stage 2: Processing PROVING requests..."
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:49:20+0000 lvl=info msg="Stage 3: Processing WITNESSGEN requests..."
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:49:20+0000 lvl=info msg="Stage 3: Deriving Agg Proofs..."
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:49:20+0000 lvl=info msg="Stage 4: Requesting Queued Proofs..."
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:49:20+0000 lvl=info msg="found agg proof with already checkpointed l1 block info"
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:49:20+0000 lvl=info msg="Stage 5: Submitting Agg Proofs..."
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:49:20+0000 lvl=info msg="requesting proof from server" type=AGG start=375163 end=376963 id=7
op-succinct-op-succinct-server-1    | stdout: WARNING: Using insecure random number generator.
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:49:33+0000 lvl=info msg="Proposer status" metrics="{L2UnsafeHeadBlock:378214 L2FinalizedBlock:376987 LatestContractL2Block:375163 HighestProvenContiguousL2Block:376963 MinBlockToProveToAgg:376163 NumProving:0 NumWitnessgen:0 NumUnrequested:0}"
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:49:33+0000 lvl=info msg="Stage 1: Getting Range Proof Boundaries..."
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:49:33+0000 lvl=info msg="Stage 2: Processing PROVING requests..."
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:49:33+0000 lvl=info msg="Stage 3: Processing WITNESSGEN requests..."
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:49:33+0000 lvl=info msg="Stage 3: Deriving Agg Proofs..."
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:49:33+0000 lvl=info msg="Stage 4: Requesting Queued Proofs..."
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:49:33+0000 lvl=info msg="Stage 5: Submitting Agg Proofs..."
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:49:53+0000 lvl=info msg="Proposing output root" output=0xc9400255dc53cf40ab7f44249bb8178d54b670a7d82a3605e98174361e09fe2f block=0x41c1f7ceea6b1ab0731587a60083e9700d13f00cef2313fdb1ce7fd2eaf96572:376963
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:49:53+0000 lvl=info msg="Publishing transaction" service=proposer tx=0x00ca0165505b68ba746238e38c392bb4a3893619dcc2583425fac81a333b460c nonce=78 gasTipCap=1000000000 gasFeeCap=45304698768 gasLimit=115535 tx=0x00ca0165505b68ba746238e38c392bb4a3893619dcc2583425fac81a333b460c
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:49:53+0000 lvl=info msg="Transaction successfully published" service=proposer tx=0x00ca0165505b68ba746238e38c392bb4a3893619dcc2583425fac81a333b460c nonce=78 gasTipCap=1000000000 gasFeeCap=45304698768 gasLimit=115535 tx=0x00ca0165505b68ba746238e38c392bb4a3893619dcc2583425fac81a333b460c
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:51:53+0000 lvl=info msg="Transaction confirmed" service=proposer tx=0x00ca0165505b68ba746238e38c392bb4a3893619dcc2583425fac81a333b460c block=0xbb06380707e28390e051c9b6678b5502ffdb8a76ae1d90d28a73c81cc28140f5:7444166 effectiveGasPrice=21571495890
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:51:53+0000 lvl=info msg="Proposer tx successfully published" tx_hash=0x00ca0165505b68ba746238e38c392bb4a3893619dcc2583425fac81a333b460c
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:51:53+0000 lvl=info msg="AGG proof submitted on-chain" end=376963
op-succinct-op-succinct-proposer-1  | t=2025-01-08T03:51:54+0000 lvl=info msg="Slack notifications disabled, token not set"

当前提交的Proposing output root: 0xc9400255dc53cf40ab7f44249bb8178d54b670a7d82a3605e98174361e09fe2f

交易分析

# Name Type Data
0 _blockNumber uint256 7444413

https://github.com/succinctlabs/op-succinct/blob/c4eef1ac5f11b5b1d2750d4ee5cbff5e57fa5cc2/contracts/src/OPSuccinctL2OutputOracle.sol#L430C3-L437C6

/// @notice Checkpoints a block hash at a given block number.
    /// @param _blockNumber Block number to checkpoint the hash at.
    /// @dev If the block hash is not available, this will revert.
    function checkpointBlockHash(uint256 _blockNumber) external {
        bytes32 blockHash = blockhash(_blockNumber);
        if (blockHash == bytes32(0)) {
            revert L1BlockHashNotAvailable();
        }
        historicBlockHashes[_blockNumber] = blockHash;
    }

注:检查存储对应L1高度的区块hash,作为检查点,会在后续verifyProof时作为proof验证源数据

# Name Type Data
0 _outputRoot bytes32 0xc9400255dc53cf40ab7f44249bb8178d54b670a7d82a3605e98174361e09fe2f
1 _l2BlockNumber uint256 376963
2 _l1BlockNumber uint256 7444151
3 _proof bytes

注:当前_proof为Mock数据,数据空(length == 0)

contracts/src/OPSuccinctL2OutputOracle.sol

https://github.com/succinctlabs/op-succinct/blob/c4eef1ac5f11b5b1d2750d4ee5cbff5e57fa5cc2/contracts/src/OPSuccinctL2OutputOracle.sol#L349-L358

AggregationOutputs memory publicValues = AggregationOutputs({
    l1Head: l1BlockHash,
    l2PreRoot: l2Outputs[latestOutputIndex()].outputRoot,
    claimRoot: _outputRoot,
    claimBlockNum: _l2BlockNumber,
    rollupConfigHash: rollupConfigHash,
    rangeVkeyCommitment: rangeVkeyCommitment
});

ISP1Verifier(verifier).verifyProof(aggregationVkey, abi.encode(publicValues), _proof);

contracts/src/SP1MockVerifier.sol

https://github.com/succinctlabs/sp1-contracts/blob/90d99052cf7880fe521f5fb0974b9c51056f9619/contracts/src/SP1MockVerifier.sol#L12

contract SP1MockVerifier is ISP1Verifier {
    /// @notice Verifies a mock proof with given public values and vkey.
    /// @param proofBytes The proof of the program execution the SP1 zkVM encoded as bytes.
    function verifyProof(bytes32, bytes calldata, bytes calldata proofBytes) external pure {
        assert(proofBytes.length == 0);
    }
}

浏览器截图

使用真实Proof

具体最终配置在 contracts/opsuccinctl2ooconfig.json

{
  "challenger": "0xC2Df13b6AD0753E0547A318F65F99aC62AEC6E2b",
  "finalizationPeriod": 3600,
  "l2BlockTime": 2,
  "owner": "0xC2Df13b6AD0753E0547A318F65F99aC62AEC6E2b",
  "proposer": "0xC2Df13b6AD0753E0547A318F65F99aC62AEC6E2b",
  "rollupConfigHash": "0xae480336b576abf09a25c2a05c88aea3449a0a8d799175eb5b8d1e164f1af100",
  "startingBlockNumber": 375163,
  "startingOutputRoot": "0xe985c9bd50994b5a7c672caf4d0db7045cd0ab3bd324f1463886b5cb1073f205",
  "startingTimestamp": 1736302070,
  "submissionInterval": 1000,
  "verifier": "0xe31B339d16697105Bc7EF9faf474CF7528557fF0",
  "aggregationVkey": "0x00d4e72bc998d0528b0722a53bedd9c6f0143c9157af194ad4bb2502e37a496f",
  "rangeVkeyCommitment": "0x33e3678015df481724af3aac49d000923caeec277027610b1490f857769f9459"
}

verifier对应的就是节点验证合约地址,通过.env 中的VERIFIER_ADDRESS进行设置
官方版本对应的地址为:https://sepolia.etherscan.io/address/0x397A5f7f3dBd538f23DE225B51f532c34448dA9B#code
部署的合约为:https://github.com/succinctlabs/sp1-contracts/blob/90d99052cf7880fe521f5fb0974b9c51056f9619/contracts/src/SP1VerifierGateway.sol

注:支持PLONK和Groth16两种类型的SP1 验证器网关,官方默认为Groth16

Clone sp1-contracts

git clone https://github.com/succinctlabs/sp1-contracts.git
cd sp1-contracts/
git checkout v3.0.0
git submodule update --init --recursive

参考文档:https://github.com/succinctlabs/sp1-contracts/blob/v3.0.0/README.md

修改.env

cd contracts/ && cp .env.example .env && vi .env

### Salt used to deploy the contracts. Recommended to use the same salt across different chains.
CREATE2_SALT=0x0000000000000000000000000000000000000000000000000000000000000000

### The owner of the SP1 Verifier Gateway. This is the account that will be able to add and freeze routes.
OWNER=0xC2Df13b6AD0753E0547A318F65F99aC62AEC6E2b

### The chains to deploy to, specified by chain name (e.g. CHAINS=mainnet,sepolia,arbitrum_sepolia)
CHAINS=sepolia

### RPCs for each chain ID
RPC_SEPOLIA=http://....:8545

# Etherscan API keys for each chain ID
ETHERSCAN_API_KEY_SEPOLIA=2BY57NTWCWIWN....

## Contract Deployer Private Key
PRIVATE_KEY=0xa7da3c790f48.....

部署合约

source .env
FOUNDRY_PROFILE=deploy forge script ./script/deploy/SP1VerifierGateway.s.sol:SP1VerifierGatewayScript --private-key $PRIVATE_KEY --verify --verifier etherscan --multi --broadcast

部署地址:https://sepolia.etherscan.io/address/0x88C89693758CD526cB9F5897865a2644eEbBCd1E#code

注:在v4.0.0+版本,去除了统一的SP1VerifierGateway,分别使用SP1VerifierGatewayPlonk和SP1VerifierGatewayGroth16,目前还是rc版本,目前优先使用v3.0.0 release 版本

添加验证者地址

FOUNDRY_PROFILE=deploy forge script ./script/deploy/v3.0.0/SP1VerifierPlonk.s.sol:SP1VerifierScript --private-key $PRIVATE_KEY --verify --verifier etherscan --multi --broadcast

部署地址:https://sepolia.etherscan.io/address/0x339319bBCfDEa130E9642028684dB85d430230E8#code

完整模式下启动op-succinct

修改op-succinct .env

VERIFIER_ADDRESS=0x88C89693758CD526cB9F5897865a2644eEbBCd1E

部署OPSuccinctL2outputOracle合约

just deploy-oracle

部署地址:https://sepolia.etherscan.io/address/0x6360f7e2c222153365d4479d55484cbed5165df3

设置op-succinct服务环境变量

修改变量,并新增两个配置

  • SP1_PRIVATE_KEY:将向 L1 提交证明的账户的私钥。
  • PROVER_NETWORK_RPC:默认是作为三方加入Succinct官方,需要审核访问权限。默认端点 ( https://rpc.succinct.xyz) ,对于自搭建的环境,直接填prover 服务地址,例如 http://172.18.36.185:3000
L2OO_ADDRESS=0x6360f7e2c222153365d4479d55484cbed5165df3
OP_SUCCINCT_MOCK=false
SP1_PRIVATE_KEY=0x....
PROVER_NETWORK_RPC=http://172.18.36.185:3000

构建 Docker Compose 设置。

docker compose build

运行提议器

docker compose up -d

查看日志

docker compose logs -f

参考文档

https://succinctlabs.github.io/op-succinct/

Intel® SGX 与 Intel® TDX

1. Intel 软件防护扩展技术 Intel® SGX

Intel® SGX 的设计主旨是为用户应用程序提供可信的执行环境,使得应用程序有能力在用户地址空间中开辟一段特别的,受保护的内存空间,并对这段受保护的内存空间实行严格的访问控制和加密操作来保障数据机密性和代码完整性,确保即使是 Hypervisor、BIOS,操作系统等特权应用都不能随意访问这段地址空间,这一段地址空间被称之为 Enclave(称之为飞地)。

按照文章的前部分介绍,把应用程序部署在云上,需要验证程序确实运行在 TEE 里,具体更多的 SGX 技术细节,请参见 Intel 官方的技术文档。以及 Intel 架构开发者手册。验证包括本地验证和远程验证。本地验证指在同一个平台上,让不同的 Enclave 互相验证 Trusted Computing Base(TCB)。远程验证是指让一个平台中运行的 Enclave 向远端的信赖凭证者 Relying Party 证明自己的 TCB,证明自己运行在 SGX TEE 中,并且没有被篡改,同时证明当前的 CPU SGX 安全版本信息。

SGX 应用程序涉及两部分:安全区和非安全区。开发者或者用户可以把涉及敏感数据的处理、Key 的保护等都放在 Enclave 里面,从而将应用程序的代码、数据划分为受信任和不受信任的组件,因此开发者或者用户需要决定哪些组件应该置于 Enclave 内部,哪些置于 Enclave 外部。

2. Intel 信任域扩展技术 Intel® TDX

Intel® TDX 旨在将虚拟机(VM)与平台上的虚拟机管理程序(VMM)和任何其他非信任域 Trust Domain (TD) 的软件隔离,以保护 TD VM 免受各种软件的安全威胁。

TDX 的设计思路是将整个虚拟机 VM 放在一个 TEE 可信执行环境里,这样不管应用在私有云还是公有云上,不需要再对应用程序和数据做受信任和不受信任的划分和修改,只要操作系统支持就行。

TDX 基本思路就是引入新的 CPU 工作模式,然后通过对内存加密技术,将两个虚拟机用不同的 key 加密,同时 key 由 CPU 来直接进行管理。本质上讲,TDX 是通过两种技术方式来配合实现,一种就是新的 CPU 模式,叫做安全仲裁模式 Secure Arbitration Mode(SEAM),第二种是多密钥内存加密技术方式 Multi-key Total-Memory-Encryption(MKTME)。SEAM 模式使用新的指令,例如 SEAMCALL, SEAMRET, SEAMOPS, TDCALL 等来实现和 TD OS,以及 Host/VMM 交互。同时,提供特定区域的物理内存来保护 Intel TDX Module 代码模块,通过 Intel Authenticated Code Module (SEAMLDR)来装载。多密钥内存加密 MKTME 技术中,MKTME engine 通过 PCONFIG 指令来分配和设置各个 TD VM 的内存加密 Keys。TDX 将内存分为两个部分,私有和共享内存。在 TDX 下还是需要在外部加固的,加固的时候需要共享内存,这部分内存外部是可以读取的,因为有些虚拟化或半虚拟化设备需要和外部通信时,是需要 host 操作系统有能力访问来提供网络等服务的。

对比

当前的 Intel® TDX 认证的本质原理和 SGX 认证类似,也需要提供远程证明来验证其运行在 TEE 环境里。更多详细的 TDX 技术说明,请参见 Intel 官方网站的 Intel® TDX 技术规范和白皮书。

Intel® TDX 和 Intel® SGX 是用来解决不同问题的。TDX 是把整个软件包不做修改直接放到虚拟机上就能实现安全,而 SGX 关注应用层面,通过对飞地 Enclave 来保障机密性和完整性,用户根据业务场景需求可以选择不同的技术。

参考文档

https://www.intel.com/content/www/us/en/developer/tools/trust-domain-extensions/overview.html
https://www.intel.com/content/www/us/en/products/docs/accelerator-engines/software-guard-extensions.html
https://cloud.tencent.com/developer/news/918918

可信执行环境 (TEE) - Automata Network 代码分析

基础信息

官网:https://www.ata.network/
GitHub: https://github.com/automata-network
docs: https://docs.ata.network/

重点关注项目

文档关键信息

TEE 验证器的设计

https://docs.ata.network/~gitbook/image?url=https%3A%2F%2F1690124894-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FtYKuUrKWPlgYjy0suCeT%252Fuploads%252FynRN9jA9wkhKAL4nk9x1%252Fimage1.png%3Falt%3Dmedia%26token%3D48037549-4a1e-41d6-97df-9879c0053d95&width=768&dpr=4&quality=100&sign=3f2e5c96&sv=2

带有 Scroll 的 TEE Prover 的架构有两个主要组件:

  • SGX 证明器。一种链下组件,用于检查安全区域内区块执行后状态根是否与现有状态根匹配,并将执行证明 (PoE) 提交给 SGX 验证器。
  • SGX 验证器。确认 SGX 证明器提出的状态转换正确性的 L1 合约。它还验证 Intel SGX 飞地提交的证明报告,以确保证明器的完整性。

Intel SGX 的链上验证

远程认证允许以编程方式验证英特尔 SGX 飞地的属性和完整性。这是建立并确保其执行的任何计算或数据处理都是值得信赖的关键过程。
https://docs.ata.network/~gitbook/image?url=https%3A%2F%2F1690124894-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FtYKuUrKWPlgYjy0suCeT%252Fuploads%252FkELAGSfLK5H2Emk3Dxwh%252Fimage3.png%3Falt%3Dmedia%26token%3Dc19926a0-31b7-46fb-9bdb-0cab3e1d42c0&width=768&dpr=4&quality=100&sign=d3a64264&sv=2

https://docs.ata.network/tee-overview/tee-prover

多重证明器 AVS 的工作原理

  • 任务提交:协议构建者参与 AVS 并提交多重证明任务。在汇总场景中,这包括对 L2 向 L1 提交的批量交易进行采样和证明。
  • 验证器注册:独立操作员注册以承担这些任务。操作员利用可重现的构建来运行 TEE 验证器,并通过 Automata 的TEE Compile进行验证,以确保构建过程的完整性。
  • 执行和证明:每个操作员(证明者)在其选择的 TEE 平台上执行任务。生成证明以验证执行的正确性和完整性。
  • 链上验证:将证明提交至区块链,智能合约充当证明人的角色并在链上进行验证。
  • 奖励发放:成功完成任务后,向操作员发放奖励。

https://docs.ata.network/tee-overview/multi-prover-avs-eigenlayer

multi-prover-avs 代码分析

GitHub: https://github.com/automata-network/multi-prover-avs/tree/main

目录结构

═── contract:Solidity合约,包括AVS合约和证明层合约。
│ │ │ ── dcap-v3-attestation:英特尔 SGX 的 Dcap 认证链上验证库。
│ │ ── src:AVS 合约的源文件。
│ └── test:智能合约的测试。
═── operator:运算符实现。
═── aggregator:聚合器实现。
═── sgx-prover:TEE 证明器的 sgx 版本。

AVS任务描述

任务定义:寻求利用可信执行环境 (TEE) 内的独立执行来确定其正确性的状态转换或计算过程。

struct StateHeader {
    uint256 identifier;
    bytes metadata;
    bytes state;
}

这是提交给证明者的状态头结构,下面是详细解释:

  • identifier:处理任务的标识符,用于区分不同类型的任务,并用于计算各个算子的贡献
  • metadata:描述特定任务的元数据,例如keccak256(abi.encodePacked(chainID, blockNumber))用于证明特定区块高度的区块链状态的任务的元数据
  • state:TEE 证明器产生的最终状态,可以是区块链的根状态,也可以是 zk 电路证明的语句

AVS 架构

AVS 的架构包含:

  • Eigenlayer 核心合约
  • AVS 合同
    • 未来将添加 ServiceManager,允许操作员提交任务、奖励和削减逻辑
  • 鉴证合约
    • 管理各种 TEE 证明器的注册/注销和活跃性,它将验证不同 TEE 平台的认证,例如 Intel SGX、AMD SEV、ARM TrustZone 等
    • TEEProverRegister 是运营商和聚合器使用的认证层的接口
  • 聚合器
    • 汇总来自操作员的 BLS 签名并将汇总状态提交给 AVS
    • 与自动机证明层交互,检查每个证明者(操作员)的有效性,未能通过证明验证或活性挑战的将被拒绝处理任务,直到其再次有效。
  • 操作员
    • 从 TEE 证明者处获取状态证明并将其提交给聚合器
  • TEE 证明器
    • TEE 证明器可以证明给定任务的最终状态,例如 zk-rollup L2 的证明器将在 TEE 内部执行区块并在特定区块处生成根状态

AVS 工作流程

以下是工作流程的详细图表

成分:

工作流程分为两部分:

  1. 设置

    • 按照Eigenlayer 的文档进行质押并注册成为 Multi-prover AVS 的运营商
    • 生成证明并注册为 TEE 证明者,不同的 TEE 技术,证明及其生成过程不同。例如,dcap-v3-attestation是验证 Intel SGX Dcap 证明的合约
  2. 在职的

    • 除了操作员处理任务之外,他们必须定期完成活性挑战,否则将被视为无效,其提交将被聚合器拒绝
    • 算子获取新任务并在 TEE 内部完成计算
    • 操作员签署最终状态并将其与签名一起发送给聚合器
    • 聚合器将在接受运营商的提交之前获取其有效性
    • 聚合器聚合所有 BLS 签名并提交给 AVS 服务管理器

TEE 委员会和法定人数


TEE 委员会是一组负责处理特定类型任务的法定人数。例如,在特定区块高度证明 Zk-Rollup 的根状态。操作员无需主动选择委员会,而是通过加入法定人数自动属于委员会。引入有利于TEE Committee操作员和任务更有组织的结构化。并为未来的增强奠定了基础,包括奖励机制和法定人数之间权益分配的约束。

TEE Quorum的概念与 Eigenlayer 使用的 Quorum 定义一致,但每个 Quorum 都与一个 TEE 平台相关联,例如 Intel SGX。每个 Quorum 都属于一个委员会,操作员可以选择加入任何 Quorum,但只有拥有必要证明的操作员的投票才会被聚合器接受。

如果您有兴趣加入以太坊主网上的 Multi-Prover AVS,请访问Operator 设置存储库。入职指南可在此处获取。

从源代码编译

操作员

go build -o out/operator ./cmd/operator

聚合器

go build -o out/aggregator ./cmd/aggregator

相关文档

https://scroll.io/blog/scaling-security
https://blog.ata.network/verifiability-as-the-missing-piece-for-ai-agents-in-web3-504839dca893
https://blog.ata.network/towards-a-common-tee-stack-71a7812a4bf9
https://blog.ata.network/automata-joins-the-superchain-ecosystem-launching-on-optimisms-op-stack-da25840cc658
https://atanetwork.notion.site/Multi-Prover-AVS-with-TEE-545319c42885489196142d966f0ede86
https://gramine.readthedocs.io/en/stable/attestation.html
https://sgx101.gitbook.io/sgx101

op-stack + zk + DA 方案测试 TODO

空余看SP1,顺便想了下,目前主流的几个L2,都有些不足?

  • zk类的 prover 运行成本高,或者 EVM兼容性,RPC 性能低
  • op 类的,有个7天
  • 必要的DA支持,降低提交成本

zkSync,Polygon cdk,arbitrum, op-stack 等主流的项目代码大部分都看过了
从代码实现,Evm兼容性,代码架构,稳定性,功能定制复杂度,op-stack 是最合适的?

目前各个方案综合来看,最优的组合是 op-stack + zk + DA ?

方案组成调研

TODO

  1. op-succinct的部署,prover 实际机器成本,产出性能
  2. EigenDA私有化部署