Documentation ¶
Index ¶
- Constants
- func CLIFlags(envVar string) []cli.Flag
- type CLIConfig
- type Metrics
- type Monitor
- func (m *Monitor) Close(_ context.Context) error
- func (m *Monitor) ConsumeEvent(enrichedWithdrawalEvent validator.EnrichedProvenWithdrawalEvent) (bool, error)
- func (m *Monitor) ConsumeEvents(enrichedWithdrawalEvent []validator.EnrichedProvenWithdrawalEvent) (*[]validator.EnrichedProvenWithdrawalEvent, error)
- func (m *Monitor) GetLatestBlock() (uint64, error)
- func (m *Monitor) GetMaxBlock() (uint64, error)
- func (m *Monitor) Run(ctx context.Context)
- type State
Constants ¶
const ( L1GethURLFlagName = "l1.geth.url" L2NodeURLFlagName = "l2.node.url" L2GethURLFlagName = "l2.geth.url" EventBlockRangeFlagName = "event.block.range" StartingL1BlockHeightFlagName = "start.block.height" HoursInThePastToStartFromFlagName = "start.block.hours.ago" OptimismPortalAddressFlagName = "optimismportal.address" )
const ( MetricsNamespace = "faultproof_withdrawals" DefaultHoursInThePastToStartFrom = 14 * 24 //14 days )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CLIConfig ¶
type CLIConfig struct { L1GethURL string L2OpGethURL string L2OpNodeURL string EventBlockRange uint64 StartingL1BlockHeight int64 HoursInThePastToStartFrom uint64 OptimismPortalAddress common.Address }
func ReadCLIFlags ¶
type Metrics ¶
type Metrics struct { InitialL1HeightGauge prometheus.Gauge NextL1HeightGauge prometheus.Gauge LatestL1HeightGauge prometheus.Gauge ProcessedProvenWithdrawalsEventsExtensions1Counter prometheus.Counter NumberOfDetectedForgeryGauge prometheus.Gauge NumberOfInvalidWithdrawalsGauge prometheus.Gauge WithdrawalsValidatedCounter prometheus.Counter NodeConnectionFailuresCounter prometheus.Counter ForgeriesWithdrawalsEventsGauge prometheus.Gauge InvalidProposalWithdrawalsEventsGauge prometheus.Gauge ForgeriesWithdrawalsEventsGaugeVec *prometheus.GaugeVec InvalidProposalWithdrawalsEventsGaugeVec *prometheus.GaugeVec // contains filtered or unexported fields }
func NewMetrics ¶
func (*Metrics) UpdateMetricsFromState ¶
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor monitors the state and events related to withdrawal forgery.
func NewMonitor ¶
func NewMonitor(ctx context.Context, log log.Logger, m metrics.Factory, cfg CLIConfig) (*Monitor, error)
NewMonitor creates a new Monitor instance with the provided configuration. It establishes connections to the specified L1 and L2 Geth clients, initializes the withdrawal validator, and sets up the initial state and metrics.
func (*Monitor) ConsumeEvent ¶
func (m *Monitor) ConsumeEvent(enrichedWithdrawalEvent validator.EnrichedProvenWithdrawalEvent) (bool, error)
ConsumeEvent processes a single enriched withdrawal event. It logs the event details and checks for any forgery detection.
func (*Monitor) ConsumeEvents ¶
func (m *Monitor) ConsumeEvents(enrichedWithdrawalEvent []validator.EnrichedProvenWithdrawalEvent) (*[]validator.EnrichedProvenWithdrawalEvent, error)
ConsumeEvents processes a slice of enriched withdrawal events and updates their states. It returns any events detected during the consumption that requires to be re-analysed again at a later stage (when the event referenced DisputeGame completes).
func (*Monitor) GetLatestBlock ¶
GetLatestBlock retrieves the latest block number from the L1 Geth client. It updates the state with the latest L1 height.
func (*Monitor) GetMaxBlock ¶
GetMaxBlock calculates the maximum block number to be processed. It considers the next L1 height and the defined max block range.