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

Commit

Permalink
Merge branch 'main' into remove-more-db
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha authored Mar 11, 2024
2 parents d3d2e31 + 2d00517 commit feefcbd
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 30 deletions.
6 changes: 5 additions & 1 deletion bindings/encoding/custom_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ import (
)

// TryParsingCustomError tries to checks whether the given error is one of the
// custom errors defined the TaikoL1 / TaikoL2's ABI, if so, it will return
// custom errors defined the protocol ABIs, if so, it will return
// the matched custom error, otherwise, it simply returns the original error.
func TryParsingCustomError(originalError error) error {
if originalError == nil {
return nil
}

errData := getErrorData(originalError)

// if errData is unparsable and returns 0x, we should not match any errors.
Expand Down
56 changes: 29 additions & 27 deletions prover/proof_submitter/proof_contester.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,35 +99,37 @@ func (c *ProofContester) SubmitContest(
return err
}

return c.sender.Send(
ctx,
&proofProducer.ProofWithHeader{
BlockID: blockID,
Meta: meta,
Header: header,
Proof: []byte{},
Opts: &proofProducer.ProofRequestOptions{
EventL1Hash: l1HeaderProposedIn.Hash(),
StateRoot: header.Root,
},
Tier: tier,
},
c.txBuilder.Build(
return encoding.TryParsingCustomError(
c.sender.Send(
ctx,
blockID,
meta,
&bindings.TaikoDataTransition{
ParentHash: header.ParentHash,
BlockHash: header.Hash(),
StateRoot: header.Root,
Graffiti: c.graffiti,
},
&bindings.TaikoDataTierProof{
Tier: transition.Tier,
Data: []byte{},
&proofProducer.ProofWithHeader{
BlockID: blockID,
Meta: meta,
Header: header,
Proof: []byte{},
Opts: &proofProducer.ProofRequestOptions{
EventL1Hash: l1HeaderProposedIn.Hash(),
StateRoot: header.Root,
},
Tier: tier,
},
c.sender.GetOpts(),
false,
c.txBuilder.Build(
ctx,
blockID,
meta,
&bindings.TaikoDataTransition{
ParentHash: header.ParentHash,
BlockHash: header.Hash(),
StateRoot: header.Root,
Graffiti: c.graffiti,
},
&bindings.TaikoDataTierProof{
Tier: transition.Tier,
Data: []byte{},
},
c.sender.GetOpts(),
false,
),
),
)
}
4 changes: 2 additions & 2 deletions prover/proof_submitter/proof_submitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (s *ProofSubmitter) SubmitProof(
}

// Build the TaikoL1.proveBlock transaction and send it to the L1 node.
if err := s.sender.Send(
if err := encoding.TryParsingCustomError(s.sender.Send(
ctx,
proofWithHeader,
s.txBuilder.Build(
Expand All @@ -190,7 +190,7 @@ func (s *ProofSubmitter) SubmitProof(
s.sender.GetOpts(),
proofWithHeader.Tier == encoding.TierGuardianID,
),
); err != nil {
)); err != nil {
if err.Error() == transaction.ErrUnretryableSubmission.Error() {
return nil
}
Expand Down

0 comments on commit feefcbd

Please sign in to comment.