Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
fix(prover): submit L2 signal root with submitting proof (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey authored May 12, 2023
1 parent 74fe156 commit 8b030ed
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 22 deletions.
7 changes: 6 additions & 1 deletion prover/proof_producer/dummy_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ func (d *DummyProofProducer) RequestProof(

time.AfterFunc(d.proofDelay(), func() {
resultCh <- &ProofWithHeader{
BlockID: blockID, Meta: meta, Header: header, ZkProof: []byte{0xff}, Degree: CircuitsDegree10Txs,
BlockID: blockID,
Meta: meta,
Header: header,
ZkProof: []byte{0xff},
Degree: CircuitsDegree10Txs,
Opts: opts,
}
})

Expand Down
1 change: 1 addition & 0 deletions prover/proof_producer/proof_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type ProofWithHeader struct {
Header *types.Header
ZkProof []byte
Degree uint64
Opts *ProofRequestOptions
}

type ProofProducer interface {
Expand Down
1 change: 1 addition & 0 deletions prover/proof_producer/special_proof_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ func (p *SpecialProofProducer) RequestProof(
Header: header,
Meta: meta,
ZkProof: proof,
Opts: opts,
}
})

Expand Down
1 change: 1 addition & 0 deletions prover/proof_producer/zkevm_cmd_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func (p *ZkevmCmdProducer) RequestProof(
Meta: meta,
ZkProof: proof,
Degree: CircuitsDegree10Txs,
Opts: opts,
}

return nil
Expand Down
1 change: 1 addition & 0 deletions prover/proof_producer/zkevm_rpcd_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func (p *ZkevmRpcdProducer) RequestProof(
Meta: meta,
ZkProof: proof,
Degree: degree,
Opts: opts,
}

return nil
Expand Down
27 changes: 6 additions & 21 deletions prover/proof_submitter/valid_proof_submitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,29 +201,14 @@ func (s *ValidProofSubmitter) SubmitProof(
return fmt.Errorf("failed to fetch anchor transaction receipt: %w", err)
}

signalRoot, err := s.anchorTxValidator.GetAnchoredSignalRoot(ctx, anchorTx)
if err != nil {
return err
}

parent, err := s.rpc.L2.BlockByHash(ctx, block.ParentHash())
if err != nil {
return err
}

blockInfo, err := s.rpc.TaikoL1.GetBlock(nil, blockID)
if err != nil {
return err
}

evidence := &encoding.TaikoL1Evidence{
MetaHash: blockInfo.MetaHash,
ParentHash: block.ParentHash(),
BlockHash: block.Hash(),
SignalRoot: signalRoot,
MetaHash: proofWithHeader.Opts.MetaHash,
ParentHash: proofWithHeader.Opts.ParentHash,
BlockHash: proofWithHeader.Opts.BlockHash,
SignalRoot: proofWithHeader.Opts.SignalRoot,
Graffiti: s.graffiti,
ParentGasUsed: uint32(parent.GasUsed()),
GasUsed: uint32(block.GasUsed()),
ParentGasUsed: uint32(proofWithHeader.Opts.ParentGasUsed),
GasUsed: uint32(proofWithHeader.Opts.GasUsed),
Proof: zkProof,
}

Expand Down

0 comments on commit 8b030ed

Please sign in to comment.