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

Commit

Permalink
feat(prover): improve oracle proof submission delay (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha authored May 5, 2023
1 parent e061540 commit 20c1423
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion proposer/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ func (p *Proposer) checkTaikoTokenBalance() error {
}

if balance.Cmp(new(big.Int).SetUint64(fee)) == -1 {
return fmt.Errorf("proposer does not have enough tko balance to propose")
return fmt.Errorf("proposer does not have enough tko balance to propose, balance: %d, fee: %d", balance, fee)
}

return nil
Expand Down
13 changes: 12 additions & 1 deletion prover/proof_producer/oracle_proof_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,18 @@ func (p *OracleProducer) RequestProof(
return fmt.Errorf("failed to sign evidence: %w", err)
}

time.AfterFunc(p.proofTimeTarget, func() {
var (
delay time.Duration = 0
now = time.Now()
blockTime = time.Unix(int64(block.Time()), 0)
)
if now.Before(blockTime.Add(p.proofTimeTarget)) {
delay = blockTime.Add(p.proofTimeTarget).Sub(now)
}

log.Info("Oracle proof submission delay", "delay", delay)

time.AfterFunc(delay, func() {
resultCh <- &ProofWithHeader{
BlockID: blockID,
Header: header,
Expand Down

0 comments on commit 20c1423

Please sign in to comment.