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

Commit

Permalink
feat(prover): changes based on proofVerifer protocol updates (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha authored Jul 31, 2023
1 parent c6cd1b0 commit 6dcb34a
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 291 deletions.
2 changes: 1 addition & 1 deletion bindings/.githead
Original file line number Diff line number Diff line change
@@ -1 +1 @@
013912fc7b74e9212dcbd374f47cf6b3e22252d6
4b23d14239a22ef8583845089ecf312bb75029ff
4 changes: 0 additions & 4 deletions bindings/encoding/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,6 @@ var (
Name: "gasUsed",
Type: "uint32",
},
{
Name: "verifierId",
Type: "uint16",
},
{
Name: "proof",
Type: "bytes",
Expand Down
3 changes: 0 additions & 3 deletions bindings/encoding/input_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ func TestEncodeEvidence(t *testing.T) {
Prover: common.BigToAddress(new(big.Int).SetUint64(rand.Uint64())),
ParentGasUsed: 1024,
GasUsed: 1024,
VerifierId: 1024,
Proof: randomHash().Big().Bytes(),
}

Expand Down Expand Up @@ -53,7 +52,6 @@ func TestEncodeProveBlockInput(t *testing.T) {
Prover: common.BigToAddress(new(big.Int).SetUint64(rand.Uint64())),
ParentGasUsed: 1024,
GasUsed: 1024,
VerifierId: 1024,
Proof: randomHash().Big().Bytes(),
},
)
Expand All @@ -73,7 +71,6 @@ func TestEncodeProveBlockInvalidInput(t *testing.T) {
Prover: common.BigToAddress(new(big.Int).SetUint64(rand.Uint64())),
ParentGasUsed: 1024,
GasUsed: 1024,
VerifierId: 1024,
Proof: randomHash().Big().Bytes(),
},
&testMeta,
Expand Down
1 change: 0 additions & 1 deletion bindings/encoding/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ type TaikoL1Evidence struct {
Prover common.Address
ParentGasUsed uint32
GasUsed uint32
VerifierId uint16
Proof []byte
}

Expand Down
2 changes: 1 addition & 1 deletion bindings/gen_taiko_l1.go

Large diffs are not rendered by default.

193 changes: 0 additions & 193 deletions prover/proof_producer/special_proof_producer.go

This file was deleted.

64 changes: 0 additions & 64 deletions prover/proof_producer/special_proof_producer_test.go

This file was deleted.

13 changes: 10 additions & 3 deletions prover/proof_submitter/valid_proof_submitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package submitter
import (
"context"
"crypto/ecdsa"
"encoding/binary"
"errors"
"fmt"
"math/big"
Expand Down Expand Up @@ -225,8 +226,7 @@ func (s *ValidProofSubmitter) SubmitProof(
if s.isOracleProver {
prover = encoding.OracleProverAddress

circuitsIdx = uint16(int(zkProof[64]))
evidence.Proof = zkProof[0:64]
circuitsIdx = uint16(0)
} else {
prover = s.proverAddress

Expand All @@ -235,8 +235,8 @@ func (s *ValidProofSubmitter) SubmitProof(
return err
}
}
evidence.Proof = append(uint16ToBytes(circuitsIdx), evidence.Proof...)
evidence.Prover = prover
evidence.VerifierId = circuitsIdx

input, err := encoding.EncodeProveBlockInput(evidence)
if err != nil {
Expand Down Expand Up @@ -292,3 +292,10 @@ func (s *ValidProofSubmitter) SubmitProof(
func (s *ValidProofSubmitter) CancelProof(ctx context.Context, blockID *big.Int) error {
return s.proofProducer.Cancel(ctx, blockID)
}

// uint16ToBytes converts an uint16 to bytes.
func uint16ToBytes(i uint16) []byte {
b := make([]byte, 2)
binary.BigEndian.PutUint16(b, i)
return b
}
22 changes: 1 addition & 21 deletions prover/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package prover

import (
"context"
"crypto/ecdsa"
"fmt"
"math"
"math/big"
Expand Down Expand Up @@ -170,26 +169,7 @@ func InitFromConfig(ctx context.Context, p *Prover, cfg *Config) (err error) {

var producer proofProducer.ProofProducer

isOracleProver := cfg.OracleProver

if isOracleProver {
var specialProverAddress common.Address
var privateKey *ecdsa.PrivateKey

specialProverAddress = oracleProverAddress
privateKey = p.cfg.OracleProverPrivateKey

if producer, err = proofProducer.NewSpecialProofProducer(
p.rpc,
privateKey,
p.cfg.TaikoL2Address,
specialProverAddress,
p.cfg.Graffiti,
p.cfg.OracleProofSubmissionDelay,
); err != nil {
return err
}
} else if cfg.Dummy {
if cfg.Dummy {
producer = &proofProducer.DummyProofProducer{
RandomDummyProofDelayLowerBound: p.cfg.RandomDummyProofDelayLowerBound,
RandomDummyProofDelayUpperBound: p.cfg.RandomDummyProofDelayUpperBound,
Expand Down

0 comments on commit 6dcb34a

Please sign in to comment.