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

Commit

Permalink
feat(prover): rename some variables
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Oct 8, 2023
1 parent ef82501 commit eb28b05
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
23 changes: 13 additions & 10 deletions prover/proof_submitter/proof_submitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,18 @@ func (s *ProofSubmitter) SubmitProof(
"proposer", proofWithHeader.Meta.Coinbase,
"hash", proofWithHeader.Header.Hash(),
"proof", common.Bytes2Hex(proofWithHeader.Proof),
"tier", s.proofProducer.Tier(),
"graffiti", common.Bytes2Hex(s.graffiti[:]),
)

metrics.ProverReceivedProofCounter.Inc(1)

var (
blockID = proofWithHeader.BlockID
header = proofWithHeader.Header
zkProof = proofWithHeader.Proof
proof = proofWithHeader.Proof
)

metrics.ProverReceivedProofCounter.Inc(1)

// Get the corresponding L2 block.
block, err := s.rpc.L2.BlockByHash(ctx, header.Hash())
if err != nil {
Expand All @@ -210,8 +212,7 @@ func (s *ProofSubmitter) SubmitProof(
}

// Get and validate this anchor transaction's receipt.
_, err = s.anchorTxValidator.GetAndValidateAnchorTxReceipt(ctx, anchorTx)
if err != nil {
if _, err = s.anchorTxValidator.GetAndValidateAnchorTxReceipt(ctx, anchorTx); err != nil {
return fmt.Errorf("failed to fetch anchor transaction receipt: %w", err)
}

Expand All @@ -222,14 +223,16 @@ func (s *ProofSubmitter) SubmitProof(
SignalRoot: proofWithHeader.Opts.SignalRoot,
Graffiti: s.graffiti,
Tier: s.proofProducer.Tier(),
Proof: zkProof,
Proof: proof,
}

circuitsIdx, err := proofProducer.DegreeToCircuitsIdx(proofWithHeader.Degree)
if err != nil {
return err
if s.proofProducer.Tier() == encoding.TierPseZkevmID {
circuitsIdx, err := proofProducer.DegreeToCircuitsIdx(proofWithHeader.Degree)
if err != nil {
return err
}
evidence.Proof = append(uint16ToBytes(circuitsIdx), evidence.Proof...)
}
evidence.Proof = append(uint16ToBytes(circuitsIdx), evidence.Proof...)

input, err := encoding.EncodeEvidence(evidence)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion prover/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func InitFromConfig(ctx context.Context, p *Prover, cfg *Config) (err error) {

var producer proofProducer.ProofProducer
if cfg.Dummy {
producer = &proofProducer.OptimisticProofProducer{}
producer = new(proofProducer.OptimisticProofProducer)
} else {
if producer, err = proofProducer.NewZkevmRpcdProducer(
cfg.ZKEvmRpcdEndpoint,
Expand Down Expand Up @@ -474,6 +474,7 @@ func (p *Prover) onBlockProposed(
"blockID", event.BlockId,
"prover", event.AssignedProver,
"expiresAt", provingWindowExpiresAt,
"minTier", event.MinTier,
)

metrics.ProverProofsAssigned.Inc(1)
Expand Down

0 comments on commit eb28b05

Please sign in to comment.