Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run is the CLI entrypoint for the force_ger_update tool: it loads and validates the configuration, dials L1 (HTTP, and WS when L1WSURL is set), starts the ethtxmanager, builds the GER monitor and forced-update sender, and runs the main timer loop until interrupted (SIGINT/SIGTERM) or a fatal setup error occurs.
Types ¶
type Config ¶
type Config struct {
// ForceGERUpdate contains all the settings the tool needs.
ForceGERUpdate ForceGERUpdateConfig `mapstructure:"ForceGERUpdate"`
}
Config is the root, standalone configuration for the force_ger_update tool.
func LoadConfig ¶
LoadConfig reads the TOML config file(s) specified by --cfg and unmarshals the fields required by the force-GER-update tool. Uses the same template rendering pipeline as the main aggkit binary so that default template variables (unrelated to this tool) resolve without extra ceremony.
type EthTxManager ¶
type EthTxManager = aggoracletypes.EthTxManager
EthTxManager is the narrow ethtxmanager interface (Add/Result/From/...) used to submit and track the forced-update transaction. It is a reference to the interface already defined in aggoracle/types/types.go — not a redefinition — so the sender (S3) depends on the same mockable contract the rest of the codebase uses.
type ForceGERUpdateConfig ¶
type ForceGERUpdateConfig struct {
// L1URL is the L1 HTTP RPC URL (mandatory).
L1URL string `mapstructure:"L1URL"`
// L1WSURL is an optional L1 websocket RPC URL. When set, event watching uses a subscription
// (WatchUpdateL1InfoTree); otherwise the monitor polls via FilterLogs.
L1WSURL string `mapstructure:"L1WSURL"`
// GlobalExitRootManagerAddr is the L1 PolygonZkEVMGlobalExitRootV2 (agglayerger binding) address.
GlobalExitRootManagerAddr common.Address `mapstructure:"GlobalExitRootManagerAddr"`
// BridgeAddr is the L1 PolygonZkEVMBridgeV2 (agglayerbridge binding) address.
BridgeAddr common.Address `mapstructure:"BridgeAddr"`
// MaxTimeWithoutGERUpdate (X) is the max time allowed to elapse since the last GER update
// before a forced update is sent.
MaxTimeWithoutGERUpdate configtypes.Duration `mapstructure:"MaxTimeWithoutGERUpdate"`
// CheckInterval is how often the timer loop evaluates the elapsed time.
CheckInterval configtypes.Duration `mapstructure:"CheckInterval"`
// EventPollInterval is, in polling mode (L1WSURL unset), how often to FilterLogs for new
// UpdateL1InfoTree events.
EventPollInterval configtypes.Duration `mapstructure:"EventPollInterval"`
// InitialLookbackBlocks bounds how far back (in FilterLogsChunkSize chunks) the boot scan for
// the last UpdateL1InfoTree event looks.
InitialLookbackBlocks uint64 `mapstructure:"InitialLookbackBlocks"`
// FilterLogsChunkSize is the block range used per FilterLogs call.
FilterLogsChunkSize uint64 `mapstructure:"FilterLogsChunkSize"`
// DestinationNetwork is the bridgeMessage destinationNetwork. Must not be 0 (L1 itself).
DestinationNetwork uint32 `mapstructure:"DestinationNetwork"`
// DestinationAddress is the bridgeMessage destinationAddress. Defaults to the sender address
// (ethTxManager.From()) when left unset (zero address).
DestinationAddress common.Address `mapstructure:"DestinationAddress"`
// DryRun logs the calldata instead of sending the transaction when true.
DryRun bool `mapstructure:"DryRun"`
// EthTxManager is the standard zkevm-ethtx-manager configuration used to send and track the
// forced-update transaction.
EthTxManager ethtxmanager.Config `mapstructure:"EthTxManager"`
}
ForceGERUpdateConfig contains configuration specific to the force-GER-update tool.
func (*ForceGERUpdateConfig) Validate ¶
func (c *ForceGERUpdateConfig) Validate() error
Validate checks the mandatory fields of the configuration.
type ForcedUpdateSender ¶
type ForcedUpdateSender interface {
// SendForcedGERUpdate submits (or, in DryRun mode, only logs) a bridgeMessage transaction with
// forceUpdateGlobalExitRoot = true, and waits for it to be mined before returning.
SendForcedGERUpdate(ctx context.Context) error
}
ForcedUpdateSender sends the forced-GER-update bridgeMessage transaction on L1 (forceUpdateGlobalExitRoot = true) through the ethtxmanager.
type GERMonitor ¶
type GERMonitor interface {
// LastGERUpdate performs a boot-time (backward, chunked FilterLogs) scan for the most recent
// UpdateL1InfoTree event on L1 and returns the timestamp of the block in which it was emitted.
// If no such event is found within the configured lookback window, implementations return the
// zero time.Time (no error) — the caller treats that as "stale" and forces an update on the
// first tick.
LastGERUpdate() (time.Time, error)
// Start begins watching (WS subscription) or polling (FilterLogs) for new UpdateL1InfoTree
// events, depending on configuration, and returns a channel on which every observed event is
// delivered in order. The returned channel is closed once ctx is cancelled.
Start(ctx context.Context) (<-chan GERUpdateEvent, error)
}
GERMonitor watches L1 for UpdateL1InfoTree events without relying on any syncer, reorg detector, or persistent storage: a boot-time scan establishes the last known GER update, and Start streams every subsequently observed event so the caller can reset its elapsed-time timer.
type GERUpdateEvent ¶
type GERUpdateEvent struct {
// BlockNumber is the L1 block number in which the UpdateL1InfoTree event was emitted.
BlockNumber uint64
// BlockTimestamp is the timestamp (wall-clock, from the block header) of BlockNumber.
BlockTimestamp time.Time
}
GERUpdateEvent represents an observed UpdateL1InfoTree event on L1: the block in which the GER was updated and that block's timestamp (used to reset the "time since last GER update" clock).
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor implements GERMonitor without any syncer, reorg detector, or persistent storage: LastGERUpdate performs a boot-time backward chunked FilterLogs scan, and Start watches (WS subscription) or polls (FilterLogs) for new UpdateL1InfoTree events.
func NewMonitor ¶
func NewMonitor(cfg ForceGERUpdateConfig, l1Client, wsClient aggkittypes.BaseEthereumClienter) (*Monitor, error)
NewMonitor builds a GERMonitor watching cfg.GlobalExitRootManagerAddr. l1Client is mandatory and is used for the boot scan, block-timestamp resolution, and (absent L1WSURL) polling. wsClient must be non-nil iff cfg.L1WSURL is set; it is then used exclusively to open the WatchUpdateL1InfoTree subscription.
func (*Monitor) LastGERUpdate ¶
LastGERUpdate implements GERMonitor.
type Option ¶
type Option func(*Sender)
Option configures optional Sender behavior (primarily used by tests to speed up polling).
func WithPollInterval ¶
WithPollInterval overrides the interval used to poll the ethtxmanager for the submitted transaction's result. Ignored if interval is not positive.
type Sender ¶
type Sender struct {
// contains filtered or unexported fields
}
Sender implements ForcedUpdateSender: it packs and submits the bridgeMessage transaction with forceUpdateGlobalExitRoot = true through the ethtxmanager, and waits for it to reach a terminal status before returning.
func NewSender ¶
func NewSender(cfg ForceGERUpdateConfig, ethTxManager EthTxManager, opts ...Option) (*Sender, error)
NewSender builds a Sender from the tool configuration and an already-constructed ethtxmanager. When cfg.DestinationAddress is the zero address, it defaults to ethTxManager.From().