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

feat(prover): Proof skip size eldfell #363

Merged
merged 2 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cmd/flags/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ var (
Usage: "Gas limit will be used for TaikoL1.proveBlock transactions",
Category: proverCategory,
}
ProofSkipSize = &cli.Uint64Flag{
Name: "prover.proofSkipSize",
Usage: "Prove every Nth block",
Category: proverCategory,
}
)

// All prover flags.
Expand All @@ -127,4 +132,5 @@ var ProverFlags = MergeFlags(CommonFlags, []cli.Flag{
CheckProofWindowExpiredInterval,
ProveUnassignedBlocks,
ProveBlockTxGasLimit,
ProofSkipSize,
})
8 changes: 8 additions & 0 deletions prover/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type Config struct {
RPCTimeout *time.Duration
WaitReceiptTimeout time.Duration
ProveBlockGasLimit *uint64
ProofSkipSize *uint64
}

// NewConfigFromCliContext creates a new config instance from command line flags.
Expand Down Expand Up @@ -116,6 +117,12 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) {
proveBlockTxGasLimit = &gasLimit
}

var proofSkipSize *uint64
if c.IsSet(flags.ProofSkipSize.Name) {
skipSize := c.Uint64(flags.ProofSkipSize.Name)
proofSkipSize = &skipSize
}

return &Config{
L1WsEndpoint: c.String(flags.L1WSEndpoint.Name),
L1HttpEndpoint: c.String(flags.L1HTTPEndpoint.Name),
Expand Down Expand Up @@ -146,5 +153,6 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) {
RPCTimeout: timeout,
WaitReceiptTimeout: time.Duration(c.Uint64(flags.WaitReceiptTimeout.Name)) * time.Second,
ProveBlockGasLimit: proveBlockTxGasLimit,
ProofSkipSize: proofSkipSize,
}, nil
}
14 changes: 13 additions & 1 deletion prover/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,14 +429,26 @@ func (p *Prover) onBlockProposed(
)
}

metrics.ProverReceivedProposedBlockGauge.Update(event.BlockId.Int64())

if p.cfg.ProofSkipSize != nil && (event.BlockId.Uint64()%*p.cfg.ProofSkipSize != 0) {
log.Info("Skipping proposed block",
"L1Height", event.Raw.BlockNumber,
"L1Hash", event.Raw.BlockHash,
"SkipSize", *p.cfg.ProofSkipSize,
"BlockID", event.BlockId,
"Removed", event.Raw.Removed,
)
return nil
}

log.Info(
"Proposed block",
"L1Height", event.Raw.BlockNumber,
"L1Hash", event.Raw.BlockHash,
"BlockID", event.BlockId,
"Removed", event.Raw.Removed,
)
metrics.ProverReceivedProposedBlockGauge.Update(event.BlockId.Int64())

handleBlockProposedEvent := func() error {
defer func() { <-p.proposeConcurrencyGuard }()
Expand Down
Loading