Skip to content

Commit

Permalink
feat: Colosseum supports proving fault using zkVM proof (#384)
Browse files Browse the repository at this point in the history
* feat(contracts): save parent L1 block hash when creating challenge

* feat(contracts): separate `ZKProofVerifier` and support zkVM proving

* feat(contracts): modify deploy scripts for `Colosseum`, `ZKProofVerifier`

* feat(validator): branch challenger's proving fault based on MPT time

* refac: separate `proveFault` function

* refac(contracts): move private function below external function

* fix(contracts): change the order of params of `verifyZKVMProof`

* refac(contracts): rename variables to pascal case
  • Loading branch information
seolaoh committed Nov 8, 2024
1 parent 3f70540 commit c7c4785
Show file tree
Hide file tree
Showing 28 changed files with 1,774 additions and 878 deletions.
3 changes: 2 additions & 1 deletion kroma-bindings/artifacts.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@
"WETH9",
"ZKMerkleTrie",
"ZKTrieHasher",
"ZKVerifier"
"ZKVerifier",
"ZKProofVerifier"
]
181 changes: 57 additions & 124 deletions kroma-bindings/bindings/colosseum.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions kroma-bindings/bindings/colosseum_more.go

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions kroma-bindings/bindings/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

482 changes: 482 additions & 0 deletions kroma-bindings/bindings/zkproofverifier.go

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions kroma-bindings/bindings/zkproofverifier_more.go

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions kroma-chain-ops/genesis/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,11 @@ type DeployConfig struct {
ZKVerifierHashScalar *hexutil.Big `json:"zkVerifierHashScalar"`
ZKVerifierM56Px *hexutil.Big `json:"zkVerifierM56Px"`
ZKVerifierM56Py *hexutil.Big `json:"zkVerifierM56Py"`

// ZKProofVerifierSP1Verifier is the address of the SP1VerifierGateway contract.
ZKProofVerifierSP1Verifier common.Address `json:"zkProofVerifierSP1Verifier"`
// ZKProofVerifierVKey is the verification key for the zkVM program.
ZKProofVerifierVKey common.Hash `json:"zkProofVerifierVKey"`
// [Kroma: END]
}

Expand Down Expand Up @@ -630,6 +635,12 @@ func (d *DeployConfig) Check() error {
if d.ZKVerifierM56Py == nil {
return fmt.Errorf("%w: ZKVerifierM56Py cannot be nil", ErrInvalidDeployConfig)
}
if d.ZKProofVerifierSP1Verifier == (common.Address{}) {
return fmt.Errorf("%w: ZKProofVerifierSP1Verifier cannot be address(0)", ErrInvalidDeployConfig)
}
if d.ZKProofVerifierVKey == (common.Hash{}) {
return fmt.Errorf("%w: ZKProofVerifierVKey cannot be 0", ErrInvalidDeployConfig)
}
// [Kroma: END]

return nil
Expand Down Expand Up @@ -883,6 +894,8 @@ type L1Deployments struct {
ZKMerkleTrie common.Address `json:"ZKMerkleTrie"`
ZKVerifier common.Address `json:"ZKVerifier"`
ZKVerifierProxy common.Address `json:"ZKVerifierProxy"`
ZKProofVerifier common.Address `json:"ZKProofVerifier"`
ZKProofVerifierProxy common.Address `json:"ZKProofVerifierProxy"`
// [Kroma: END]
}

Expand Down
2 changes: 2 additions & 0 deletions kroma-chain-ops/genesis/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ func TestL1Deployments(t *testing.T) {
require.NotEqual(t, deployments.ZKMerkleTrie, common.Address{})
require.NotEqual(t, deployments.ZKVerifier, common.Address{})
require.NotEqual(t, deployments.ZKVerifierProxy, common.Address{})
require.NotEqual(t, deployments.ZKProofVerifier, common.Address{})
require.NotEqual(t, deployments.ZKProofVerifierProxy, common.Address{})
// [Kroma: END]

// require.Equal(t, "AddressManager", deployments.GetName(deployments.AddressManager))
Expand Down
560 changes: 290 additions & 270 deletions kroma-chain-ops/genesis/testdata/allocs-l1.json

Large diffs are not rendered by default.

58 changes: 30 additions & 28 deletions kroma-chain-ops/genesis/testdata/deploy.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,42 @@
{
"AssetManager": "0x82e01223d51Eb87e16A03E24687EDF0F294da6f1",
"AssetManagerProxy": "0x0B306BF915C4d645ff596e518fAf3F9669b97016",
"Colosseum": "0x9E545E3C0baAB3E08CdfD552C960A1050f373042",
"ColosseumProxy": "0x610178dA211FEF7D417bC0e6FeD39F05609AD788",
"KromaMintableERC20Factory": "0x4A679253410272dd5232B3Ff7cF5dbB88f295319",
"AssetManager": "0x2bdCC0de6bE1f7D2ee689a0342D76F52E8EFABa3",
"AssetManagerProxy": "0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1",
"Colosseum": "0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9",
"ColosseumProxy": "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e",
"KromaMintableERC20Factory": "0x7a2088a1bFc9d81c55368AE168C2C02570cB814F",
"KromaMintableERC20FactoryProxy": "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6",
"KromaPortal": "0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8",
"KromaPortal": "0x851356ae760d987E095750cCeb3bC6014560891C",
"KromaPortalProxy": "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
"L1CrossDomainMessenger": "0x3Aa5ebB10DC797CAC828524e59A333d0A371443c",
"L1CrossDomainMessenger": "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d",
"L1CrossDomainMessengerProxy": "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707",
"L1ERC721Bridge": "0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44",
"L1ERC721Bridge": "0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f",
"L1ERC721BridgeProxy": "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853",
"L1GovernanceToken": "0x5f3f1dBD7B74C6B46e8c44f98792A1dAf8d69154",
"L1GovernanceTokenProxy": "0x4c5859f0F772848b2D91F1D83E2Fe57935348029",
"L1MintManager": "0x1291Be112d480055DaFd8a610b7d1e203891C274",
"L1StandardBridge": "0x59b670e9fA9D0A427751Af201D676719a970857b",
"L1GovernanceToken": "0xb7278A61aa25c888815aFC32Ad3cC52fF24fE575",
"L1GovernanceTokenProxy": "0x1291Be112d480055DaFd8a610b7d1e203891C274",
"L1MintManager": "0x5f3f1dBD7B74C6B46e8c44f98792A1dAf8d69154",
"L1StandardBridge": "0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1",
"L1StandardBridgeProxy": "0x0165878A594ca255338adfa4d48449f69242Eb8F",
"L2OutputOracle": "0x67d269191c92Caf3cD7723F116c85e6E9bf55933",
"L2OutputOracle": "0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E",
"L2OutputOracleProxy": "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",
"Poseidon2": "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE",
"Poseidon2": "0x68B1D87F95878fE05B998F19b66F4baba5De1aed",
"ProxyAdmin": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
"SecurityCouncil": "0x36C02dA8a0983159322a80FFE9F24b1acfF8B570",
"SecurityCouncilProxy": "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e",
"SecurityCouncilToken": "0x998abeb3E57409262aE5b751f60747921B33613E",
"SecurityCouncilTokenProxy": "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0",
"SystemConfig": "0xf5059a5D33d5853360D16C683c16e67980206f36",
"SecurityCouncil": "0x809d550fca64d94Bd9F66E60752A544199cfAC3D",
"SecurityCouncilProxy": "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0",
"SecurityCouncilToken": "0x70e0bA845a1A0F2DA3359C97E0285013525FFC49",
"SecurityCouncilTokenProxy": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82",
"SystemConfig": "0x95401dc811bb5740090279Ba06cfA8fcF6113778",
"SystemConfigProxy": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
"TimeLock": "0x0E801D84Fa97b50751Dbf25036d067dCf18858bF",
"TimeLockProxy": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82",
"UpgradeGovernor": "0x9d4454B023096f34B160D6B654540c56A1F81688",
"UpgradeGovernorProxy": "0x9A676e781A523b5d0C0e43731313A708CB607508",
"ValidatorManager": "0x7969c5eD335650692Bc04293B07F5BF2e7A673C0",
"ValidatorManagerProxy": "0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1",
"ValidatorPool": "0x09635F643e140090A9A8Dcd712eD6285858ceBef",
"TimeLock": "0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf",
"TimeLockProxy": "0x9A676e781A523b5d0C0e43731313A708CB607508",
"UpgradeGovernor": "0x5eb3Bc0a489C5A8288765d2336659EbCA68FCd00",
"UpgradeGovernorProxy": "0x0B306BF915C4d645ff596e518fAf3F9669b97016",
"ValidatorManager": "0x7bc06c482DEAd17c0e297aFbC32f6e63d3846650",
"ValidatorManagerProxy": "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE",
"ValidatorPool": "0xc5a5C42992dECbae36851359345FE25997F5C42d",
"ValidatorPoolProxy": "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
"ZKMerkleTrie": "0x68B1D87F95878fE05B998F19b66F4baba5De1aed",
"ZKVerifier": "0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690",
"ZKMerkleTrie": "0x3Aa5ebB10DC797CAC828524e59A333d0A371443c",
"ZKProofVerifier": "0xFD471836031dc5108809D173A067e8486B9047A3",
"ZKProofVerifierProxy": "0x610178dA211FEF7D417bC0e6FeD39F05609AD788",
"ZKVerifier": "0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB",
"ZKVerifierProxy": "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318"
}
58 changes: 30 additions & 28 deletions kroma-chain-ops/genesis/testdata/l1-deployments.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,42 @@
{
"AssetManager": "0x82e01223d51Eb87e16A03E24687EDF0F294da6f1",
"AssetManagerProxy": "0x0B306BF915C4d645ff596e518fAf3F9669b97016",
"Colosseum": "0x9E545E3C0baAB3E08CdfD552C960A1050f373042",
"ColosseumProxy": "0x610178dA211FEF7D417bC0e6FeD39F05609AD788",
"KromaMintableERC20Factory": "0x4A679253410272dd5232B3Ff7cF5dbB88f295319",
"AssetManager": "0x2bdCC0de6bE1f7D2ee689a0342D76F52E8EFABa3",
"AssetManagerProxy": "0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1",
"Colosseum": "0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9",
"ColosseumProxy": "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e",
"KromaMintableERC20Factory": "0x7a2088a1bFc9d81c55368AE168C2C02570cB814F",
"KromaMintableERC20FactoryProxy": "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6",
"KromaPortal": "0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8",
"KromaPortal": "0x851356ae760d987E095750cCeb3bC6014560891C",
"KromaPortalProxy": "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
"L1CrossDomainMessenger": "0x3Aa5ebB10DC797CAC828524e59A333d0A371443c",
"L1CrossDomainMessenger": "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d",
"L1CrossDomainMessengerProxy": "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707",
"L1ERC721Bridge": "0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44",
"L1ERC721Bridge": "0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f",
"L1ERC721BridgeProxy": "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853",
"L1GovernanceToken": "0x5f3f1dBD7B74C6B46e8c44f98792A1dAf8d69154",
"L1GovernanceTokenProxy": "0x4c5859f0F772848b2D91F1D83E2Fe57935348029",
"L1MintManager": "0x1291Be112d480055DaFd8a610b7d1e203891C274",
"L1StandardBridge": "0x59b670e9fA9D0A427751Af201D676719a970857b",
"L1GovernanceToken": "0xb7278A61aa25c888815aFC32Ad3cC52fF24fE575",
"L1GovernanceTokenProxy": "0x1291Be112d480055DaFd8a610b7d1e203891C274",
"L1MintManager": "0x5f3f1dBD7B74C6B46e8c44f98792A1dAf8d69154",
"L1StandardBridge": "0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1",
"L1StandardBridgeProxy": "0x0165878A594ca255338adfa4d48449f69242Eb8F",
"L2OutputOracle": "0x67d269191c92Caf3cD7723F116c85e6E9bf55933",
"L2OutputOracle": "0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E",
"L2OutputOracleProxy": "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",
"Poseidon2": "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE",
"Poseidon2": "0x68B1D87F95878fE05B998F19b66F4baba5De1aed",
"ProxyAdmin": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
"SecurityCouncil": "0x36C02dA8a0983159322a80FFE9F24b1acfF8B570",
"SecurityCouncilProxy": "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e",
"SecurityCouncilToken": "0x998abeb3E57409262aE5b751f60747921B33613E",
"SecurityCouncilTokenProxy": "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0",
"SystemConfig": "0xf5059a5D33d5853360D16C683c16e67980206f36",
"SecurityCouncil": "0x809d550fca64d94Bd9F66E60752A544199cfAC3D",
"SecurityCouncilProxy": "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0",
"SecurityCouncilToken": "0x70e0bA845a1A0F2DA3359C97E0285013525FFC49",
"SecurityCouncilTokenProxy": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82",
"SystemConfig": "0x95401dc811bb5740090279Ba06cfA8fcF6113778",
"SystemConfigProxy": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
"TimeLock": "0x0E801D84Fa97b50751Dbf25036d067dCf18858bF",
"TimeLockProxy": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82",
"UpgradeGovernor": "0x9d4454B023096f34B160D6B654540c56A1F81688",
"UpgradeGovernorProxy": "0x9A676e781A523b5d0C0e43731313A708CB607508",
"ValidatorManager": "0x7969c5eD335650692Bc04293B07F5BF2e7A673C0",
"ValidatorManagerProxy": "0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1",
"ValidatorPool": "0x09635F643e140090A9A8Dcd712eD6285858ceBef",
"TimeLock": "0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf",
"TimeLockProxy": "0x9A676e781A523b5d0C0e43731313A708CB607508",
"UpgradeGovernor": "0x5eb3Bc0a489C5A8288765d2336659EbCA68FCd00",
"UpgradeGovernorProxy": "0x0B306BF915C4d645ff596e518fAf3F9669b97016",
"ValidatorManager": "0x7bc06c482DEAd17c0e297aFbC32f6e63d3846650",
"ValidatorManagerProxy": "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE",
"ValidatorPool": "0xc5a5C42992dECbae36851359345FE25997F5C42d",
"ValidatorPoolProxy": "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
"ZKMerkleTrie": "0x68B1D87F95878fE05B998F19b66F4baba5De1aed",
"ZKVerifier": "0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690",
"ZKMerkleTrie": "0x3Aa5ebB10DC797CAC828524e59A333d0A371443c",
"ZKProofVerifier": "0xFD471836031dc5108809D173A067e8486B9047A3",
"ZKProofVerifierProxy": "0x610178dA211FEF7D417bC0e6FeD39F05609AD788",
"ZKVerifier": "0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB",
"ZKVerifierProxy": "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318"
}
2 changes: 2 additions & 0 deletions kroma-chain-ops/genesis/testdata/test-deploy-config-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@
"zkVerifierHashScalar": "0xb54142d3712f03ff5c15914a3dce82c0d8a8d537e165e2342048adf14e34aa",
"zkVerifierM56Px": "0x175a2d1aaf07ee184a955e35f3deac123ef1088b68c38bace37056dcfc9d304d",
"zkVerifierM56Py": "0x150856c3d1750c2578b823cb3c7d74ed3e94c1cfece7e1bfdaaff36eea788fb9",
"zkProofVerifierSP1Verifier": "0x0000000000000000000000000000000000000001",
"zkProofVerifierVKey": "0x0000000000000000000000000000000000000000000000000000000000000001",
"governanceTokenNotUseCreate2": true,
"governanceTokenProxySalt": "0x0000000000000000000000000000000000000000000000000000004b726f6d61",
"mintManagerOwner": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
Expand Down
77 changes: 47 additions & 30 deletions kroma-validator/challenger.go
Original file line number Diff line number Diff line change
Expand Up @@ -986,8 +986,6 @@ func (c *Challenger) CancelChallenge(ctx context.Context, outputIndex *big.Int)
// ProveFault creates proveFault transaction for invalid output root.
// TODO: ProveFault will take long time, so that we may have to handle it carefully.
func (c *Challenger) ProveFault(ctx context.Context, outputIndex *big.Int, challenger common.Address, skipSelectFaultPosition bool) (*types.Transaction, error) {
c.log.Info("crafting proveFault tx", "outputIndex", outputIndex, "challenger", challenger)

challenge, err := c.GetChallenge(ctx, outputIndex, challenger)
if err != nil {
return nil, err
Expand All @@ -1006,40 +1004,59 @@ func (c *Challenger) ProveFault(ctx context.Context, outputIndex *big.Int, chall
blockNumber = new(big.Int).Add(blockNumber, position)
}

proof, err := c.PublicInputProof(ctx, blockNumber.Uint64())
if err != nil {
return nil, fmt.Errorf("failed to get public input proof(fault position blockNumber: %d): %w", blockNumber.Uint64(), err)
}
txOpts := optsutils.NewSimpleTxOpts(ctx, c.cfg.TxManager.From(), c.cfg.TxManager.Signer)

targetBlockNumber := new(big.Int).Add(blockNumber, common.Big1)
cCtx, cCancel := context.WithTimeout(ctx, c.cfg.NetworkTimeout)
defer cCancel()
trace, err := c.l2Client.GetBlockTraceByNumber(cCtx, targetBlockNumber)
header, err := c.l2Client.HeaderByNumber(ctx, blockNumber)
if err != nil {
return nil, fmt.Errorf("failed to get block trace(fault position blockNumber: %d): %w", targetBlockNumber.Uint64(), err)
return nil, fmt.Errorf("failed to get block header(fault position blockNumber: %d): %w", blockNumber.Uint64(), err)
}

traceBz, err := json.Marshal(trace)
if err != nil {
return nil, fmt.Errorf("failed to marshal block trace(fault position blockNumber: %d): %w", targetBlockNumber.Uint64(), err)
}
// if the src block time is after Kroma MPT time, generate zkVM proof otherwise zkEVM proof
if c.cfg.RollupConfig.IsKromaMPT(header.Time) {
c.log.Info("crafting zkVMProveFault tx", "outputIndex", outputIndex, "challenger", challenger)

fetchResult, err := c.cfg.ProofFetcher.FetchProofAndPair(ctx, string(traceBz))
if err != nil {
return nil, fmt.Errorf("failed to fetch proof and pair(fault position blockNumber: %d): %w", targetBlockNumber.Uint64(), err)
}
// TODO(seolaoh): add fetching zkVM preimages and proof

txOpts := optsutils.NewSimpleTxOpts(ctx, c.cfg.TxManager.From(), c.cfg.TxManager.Signer)
return c.colosseumContract.ProveFault(
txOpts,
outputIndex,
position,
proof,
fetchResult.Proof,
// NOTE(0xHansLee): the hash of public input (pair[4], pair[5]) is not needed in proving fault.
// It can be calculated using public input sent to colosseum contract.
fetchResult.Pair[:4],
)
return c.colosseumContract.ProveFaultWithZkVm(txOpts, outputIndex, position, bindings.TypesZkVmProof{})
} else {
c.log.Info("crafting zkEVMProveFault tx", "outputIndex", outputIndex, "challenger", challenger)

proof, err := c.PublicInputProof(ctx, blockNumber.Uint64())
if err != nil {
return nil, fmt.Errorf("failed to get public input proof(fault position blockNumber: %d): %w", blockNumber.Uint64(), err)
}

targetBlockNumber := new(big.Int).Add(blockNumber, common.Big1)
cCtx, cCancel := context.WithTimeout(ctx, c.cfg.NetworkTimeout)
defer cCancel()
trace, err := c.l2Client.GetBlockTraceByNumber(cCtx, targetBlockNumber)
if err != nil {
return nil, fmt.Errorf("failed to get block trace(fault position blockNumber: %d): %w", targetBlockNumber.Uint64(), err)
}

traceBz, err := json.Marshal(trace)
if err != nil {
return nil, fmt.Errorf("failed to marshal block trace(fault position blockNumber: %d): %w", targetBlockNumber.Uint64(), err)
}

fetchResult, err := c.cfg.ProofFetcher.FetchProofAndPair(ctx, string(traceBz))
if err != nil {
return nil, fmt.Errorf("failed to fetch proof and pair(fault position blockNumber: %d): %w", targetBlockNumber.Uint64(), err)
}

return c.colosseumContract.ProveFaultWithZkEvm(
txOpts,
outputIndex,
position,
bindings.TypesZkEvmProof{
PublicInputProof: proof,
Proof: fetchResult.Proof,
// NOTE(0xHansLee): the hash of public input (pair[4], pair[5]) is not needed in proving fault.
// It can be calculated using public input sent to colosseum contract.
Pair: fetchResult.Pair[:4],
},
)
}
}

// IsOutputDeleted checks if the output is deleted.
Expand Down
Loading

0 comments on commit c7c4785

Please sign in to comment.