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

Commit

Permalink
feat(prover): optimize oracle proofs submission delay
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Oct 6, 2023
1 parent 6df0c19 commit 60fe780
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions prover/proof_producer/dummy_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type DummyProofProducer struct {
RandomDummyProofDelayUpperBound *time.Duration
OracleProofSubmissionDelay time.Duration
OracleProverAddress common.Address
ProofWindow uint16
}

// RequestProof implements the ProofProducer interface.
Expand All @@ -41,11 +42,11 @@ func (d *DummyProofProducer) RequestProof(

if opts.AssignedProver != encoding.OracleProverAddress && d.OracleProofSubmissionDelay != 0 {
var delay time.Duration
if time.Now().Unix()-int64(header.Time) >= int64(d.OracleProofSubmissionDelay.Seconds()) {
if time.Now().Unix()-int64(header.Time+uint64(d.ProofWindow)) >= int64(d.OracleProofSubmissionDelay.Seconds()) {
delay = 0
} else {
delay = time.Duration(
int64(d.OracleProofSubmissionDelay.Seconds())-(time.Now().Unix()-int64(header.Time)),
int64(d.OracleProofSubmissionDelay.Seconds())-(time.Now().Unix()-int64(header.Time+uint64(d.ProofWindow))),
) * time.Second
}

Expand Down
1 change: 1 addition & 0 deletions prover/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ func InitFromConfig(ctx context.Context, p *Prover, cfg *Config) (err error) {
RandomDummyProofDelayLowerBound: p.cfg.RandomDummyProofDelayLowerBound,
RandomDummyProofDelayUpperBound: p.cfg.RandomDummyProofDelayUpperBound,
OracleProofSubmissionDelay: p.cfg.OracleProofSubmissionDelay,
ProofWindow: p.protocolConfigs.ProofWindow,
}
} else {
if producer, err = proofProducer.NewZkevmRpcdProducer(
Expand Down

0 comments on commit 60fe780

Please sign in to comment.