Help us shape the future of Go! Take the 2026 Go Developer Survey

bridgeservice

package
v0.11.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: Apache-2.0, MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// BridgeV1Prefix is the url prefix for the bridge service
	BridgeV1Prefix = "/bridge/v1"

	// DefaultRemoveGERLimit is the default number of remove GER events to return when no limit is specified
	DefaultRemoveGERLimit = uint32(50)
)
View Source
const (
	// DefaultPageSize is the default number of records to be fetched
	DefaultPageSize = uint32(20)
	// MaxPageSize is the maximum number of records to be fetched
	MaxPageSize = 200
	// DefaultPage is the default page number to be used when fetching records
	DefaultPage = uint32(1)
	// MaxNetworkIDs is the maximum number of network IDs allowed in a single request
	MaxNetworkIDs = 5
)

Variables

View Source
var (
	ErrNotOnL1Info = errors.New("this bridge has not been included on the L1 Info Tree yet")

	// DefaultHealthCheckCacheTTL is the fallback for Config.HealthCheckCacheTTL when left unset
	// (the zero value), following the same fallback pattern as
	// bridgeservicefinder.DefaultHealthCheckPath. Kept short -- well below Kubernetes' own 10s
	// default livenessProbe.periodSeconds -- so a burst of concurrent health probes within one
	// window shares a single computeSyncStatus call (see healthCheckCache) while a real recovery
	// or regression still surfaces within a couple of seconds.
	DefaultHealthCheckCacheTTL = cfgtypes.Duration{Duration: 2 * time.Second} //nolint:mnd

	// DefaultHealthCheckComputeTimeout bounds a single computeSyncStatus computation (the RPC/DB
	// calls across all configured syncers, computed concurrently, backing HealthCheckHandler)
	// independently of Config.ReadTimeout. ReadTimeout is request-scoped and can be as large as 5 minutes
	// (PublicREST.ReadTimeout's default), which is sized for large paginated response bodies, not
	// for a liveness probe: without its own bound, a black-holed RPC endpoint would let /` and
	// `/health` hang for up to ReadTimeout, and every concurrent caller waiting on the
	// single-flight channel (see healthCheckCache) with them. On expiry, a call that honors ctx
	// (e.g. a database read using QueryContext) returns a context-deadline error promptly, which
	// computeSyncStatus reports the same way as any other component error -- HealthSyncStatusError,
	// HTTP 200 -- rather than a hang. A call that does not honor ctx keeps running until it returns
	// on its own instead (a pre-existing gap, not addressed here); this timeout only bounds how
	// long a ctx-respecting call waits, not the wall-clock time of the slowest component. A
	// package-level var (not a const) so tests can shrink it instead of sleeping for the real
	// default.
	DefaultHealthCheckComputeTimeout = 3 * time.Second
)

Functions

func NewBridgeResponse

func NewBridgeResponse(bridge *bridgesync.Bridge, networkID uint32,
	etrogL1UpgradeBlock uint64) *bridgetypes.BridgeResponse

NewBridgeResponse creates a new BridgeResponse instance out of the provided Bridge instance

func NewClaimResponse

func NewClaimResponse(claim *claimsynctypes.Claim, populateProofs bool) *bridgetypes.ClaimResponse

NewClaimResponse creates ClaimResponse instance out of the provided Claim

func NewL1InfoTreeLeafResponse

func NewL1InfoTreeLeafResponse(leaf *l1infotreesync.L1InfoTreeLeaf) *bridgetypes.L1InfoTreeLeafResponse

NewL1InfoTreeLeafResponse creates L1InfoTreeLeafResponse instance out of the provided L1InfoTreeLeaf

func NewTokenMappingResponse

func NewTokenMappingResponse(tokenMapping *bridgesync.TokenMapping) *bridgetypes.TokenMappingResponse

NewTokenMappingResponse creates TokenMappingResponse instance out of the provided TokenMapping

func NewTokenMigrationResponse

func NewTokenMigrationResponse(
	tokenMigration *bridgesync.LegacyTokenMigration) *bridgetypes.LegacyTokenMigrationResponse

NewTokenMigrationResponse creates LegacyTokenMigrationResponse instance out of the provided LegacyTokenMigration

Types

type AgglayerManagerUpgradeQuerier added in v0.8.0

type AgglayerManagerUpgradeQuerier interface {
	GetUpgradeBlock(ctx context.Context, versionID uint8) uint64
}

AgglayerManagerUpgradeQuerier abstracts AgglayerManager upgrade block retrieval based on the rollup initializer version

type BridgeService

type BridgeService struct {
	// contains filtered or unexported fields
}

BridgeService contains implementations for the bridge service endpoints

func New

func New(
	cfg *Config,
	upgradeQuerier AgglayerManagerUpgradeQuerier,
	l1InfoTree L1InfoTreeSyncer,
	injectedGERs L2GERSyncer,
	bridgeL1 Bridger,
	claimL1 Claimer,
	bridgeL2 Bridger,
	claimL2 Claimer,
) *BridgeService

New returns instance of BridgeService

func (*BridgeService) ClaimProofHandler

func (b *BridgeService) ClaimProofHandler(c *gin.Context)

ClaimProofHandler returns the Merkle proofs required to verify a claim on the target network.

@Summary Get claim proof @Description Returns the Merkle proofs (local and rollup exit root) and @Description the corresponding L1 info tree leaf needed to verify a claim. @Tags claims @Param network_id query uint32 true "Origin network ID" @Param leaf_index query uint32 true "Index in the L1 info tree" @Param deposit_count query uint32 true "Number of deposits in the bridge" @Produce json @Success 200 {object} types.ClaimProof "Merkle proofs and L1 info tree leaf" @Failure 400 {object} types.ErrorResponse "Bad Request" @Failure 404 {object} types.ErrorResponse "Not Found - not indexed by the syncers yet, retry later" @Failure 500 {object} types.ErrorResponse "Internal Server Error" @Failure 503 {object} types.ErrorResponse "Service Unavailable - syncer not available or resolving a reorg" @Router /claim-proof [get]

func (*BridgeService) GetBridgeByDepositCountHandler added in v0.8.2

func (b *BridgeService) GetBridgeByDepositCountHandler(c *gin.Context)

GetBridgeByDepositCountHandler retrieves a bridge by deposit count for the given network.

@Summary Get bridge by deposit count @Description Returns the bridge by deposit count for the specified network (checks bridge and bridge_archive). @Tags bridges @Param network_id query uint32 true "Network ID (0 for L1, L2 network ID otherwise)" @Param deposit_count query uint32 true "Deposit count" @Produce json @Success 200 {object} types.BridgeResponse @Failure 400 {object} types.ErrorResponse "Bad Request" @Failure 404 {object} types.ErrorResponse "Not Found" @Failure 500 {object} types.ErrorResponse "Internal Server Error" @Failure 503 {object} types.ErrorResponse "Service Unavailable" @Router /bridge-by-deposit-count [get]

func (*BridgeService) GetBridgesByContentHandler added in v0.8.2

func (b *BridgeService) GetBridgesByContentHandler(c *gin.Context)

GetBridgesByContentHandler retrieves bridges matching the given content fields for the specified network.

@Summary Get bridges by content @Description Returns all bridges (bridge and bridge_archive) matching the specified content for the given network. @Tags bridges @Param network_id query uint32 true "Network ID (0 for L1, L2 network ID otherwise)" @Param leaf_type query uint8 true "Leaf type (0=asset, 1=message)" @Param origin_address query string true "Origin address (hex)" @Param destination_network query uint32 true "Destination network ID" @Param destination_address query string true "Destination address (hex)" @Param amount query string true "Amount (decimal string)" @Param metadata query string false "Metadata (0x-prefixed hex, default empty)" @Produce json @Success 200 {object} types.BridgesByContentResult @Failure 400 {object} types.ErrorResponse "Bad Request" @Failure 500 {object} types.ErrorResponse "Internal Server Error" @Failure 503 {object} types.ErrorResponse "Service Unavailable" @Router /bridges-by-content [get]

func (*BridgeService) GetBridgesHandler

func (b *BridgeService) GetBridgesHandler(c *gin.Context)

GetBridgesHandler retrieves paginated bridge data for the specified network.

@Summary Get bridges @Description Returns a paginated list of bridge events for the specified network. @Tags bridges @Param network_id query uint32 true "Origin network ID" @Param page_number query uint32 false "Page number (default 1)" @Param page_size query uint32 false "Page size (default 100)" @Param deposit_count query uint64 false "Filter by deposit count" @Param from_address query string false "Filter by from address" @Param network_ids query []uint32 false "Filter by one or more destination network IDs (maximum 5 allowed)" @Produce json @Success 200 {object} types.BridgesResult @Failure 400 {object} types.ErrorResponse "Bad Request" @Failure 500 {object} types.ErrorResponse "Internal Server Error" @Router /bridges [get]

func (*BridgeService) GetClaimsByGERHandler added in v0.8.2

func (b *BridgeService) GetClaimsByGERHandler(c *gin.Context)

GetClaimsByGERHandler retrieves all DetailedClaimEvent claims that used the given global exit root.

@Summary Get claims by global exit root @Description Returns all claims (DetailedClaimEvent type) recorded with the specified GER for the given network. @Tags claims @Param network_id query uint32 true "Network ID (0 for L1, L2 network ID otherwise)" @Param global_exit_root query string true "Global exit root (0x-prefixed 32-byte hex)" @Produce json @Success 200 {object} types.ClaimsByGERResult @Failure 400 {object} types.ErrorResponse "Bad Request" @Failure 500 {object} types.ErrorResponse "Internal Server Error" @Failure 503 {object} types.ErrorResponse "Service Unavailable" @Router /claims-by-ger [get]

func (*BridgeService) GetClaimsHandler

func (b *BridgeService) GetClaimsHandler(c *gin.Context)

GetClaimsHandler retrieves paginated claims for a given network.

@Summary Get claims @Description Returns a paginated list of claims for the specified network. @Tags claims @Param network_id query uint32 true "Origin network ID" @Param page_number query uint32 false "Page number (default 1)" @Param page_size query uint32 false "Page size (default 100)" @Param network_ids query []uint32 false "Filter by one or more source network IDs (maximum 5 allowed)" @Param include_all_fields query bool false "Whether to include full response fields (default false)" @Param global_index query uint32 false "Filter by global index" @Produce json @Success 200 {object} types.ClaimsResult @Failure 400 {object} types.ErrorResponse "Bad Request" @Failure 500 {object} types.ErrorResponse "Internal Server Error" @Router /claims [get]

func (*BridgeService) GetLastReorgEventHandler

func (b *BridgeService) GetLastReorgEventHandler(c *gin.Context)

GetLastReorgEventHandler returns the most recent reorganization event for the specified network.

@Summary Get last reorg event @Description Retrieves the last known reorg event for either L1 or L2, based on the provided network ID. @Tags reorgs @Param network_id query int true "Network ID (e.g., 0 for L1, or the ID of the L2 network)" @Produce json @Success 200 {object} bridgesync.LastReorg "Details of the last reorg event" @Failure 400 {object} types.ErrorResponse "Bad Request" @Failure 500 {object} types.ErrorResponse "Internal Server Error" @Router /last-reorg-event [get]

func (*BridgeService) GetLegacyTokenMigrationsHandler

func (b *BridgeService) GetLegacyTokenMigrationsHandler(c *gin.Context)

@Summary Get legacy token migrations @Description Returns legacy token migrations for the given network, paginated @Tags legacy-token-migrations @Param network_id query int true "Network ID" @Param page_number query int false "Page number" @Param page_size query int false "Page size" @Produce json @Success 200 {object} types.LegacyTokenMigrationsResult @Failure 400 {object} types.ErrorResponse "Bad Request" @Failure 500 {object} types.ErrorResponse "Internal Server Error" @Router /legacy-token-migrations [get]

func (*BridgeService) GetPublicConfigHandler added in v0.11.0

func (b *BridgeService) GetPublicConfigHandler(c *gin.Context)

GetPublicConfigHandler returns the public, non-sensitive configuration of the bridge service.

@Summary Get public configuration @Description Returns a sanitized view of the bridge service configuration: component sync @Description parameters and contract addresses, deduplicated by network. Never exposes RPC @Description URLs, DB paths, private keys or any other internal/sensitive configuration value. @Tags config @Produce json @Success 200 {object} types.PublicConfigResponse "Public bridge service configuration" @Router /config [get]

func (*BridgeService) GetRemoveGEREventsHandler added in v0.8.0

func (b *BridgeService) GetRemoveGEREventsHandler(c *gin.Context)

GetRemoveGEREventsHandler retrieves remove GER events.

@Summary Get remove GER events @Description Returns a list of remove GER events, optionally filtered by specific GER. Results are limited by the limit parameter (default 50). If global_exit_root is provided, filters by that GER as well. @Tags ger-events @Param global_exit_root query string false "Filter by specific Global Exit Root hash" @Param limit query int false "Maximum number of events to return (default: 50)" @Produce json @Success 200 {object} types.RemoveGEREventsResult "List of remove GER events" @Failure 400 {object} types.ErrorResponse "Bad Request" @Failure 500 {object} types.ErrorResponse "Internal Server Error" @Failure 503 {object} types.ErrorResponse "Service Unavailable" @Router /removed-gers [get]

func (*BridgeService) GetSetClaimsHandler added in v0.8.2

func (b *BridgeService) GetSetClaimsHandler(c *gin.Context)

@Summary Get set claims @Description Returns set claims for the configured L2 network, paginated. Note: set claims are only available for L2 networks, not L1. @Tags set-claims @Param page_number query int false "Page number" @Param page_size query int false "Page size" @Param global_index query string false "Filter by global index" @Produce json @Success 200 {object} types.SetClaimsResult @Failure 400 {object} types.ErrorResponse "Bad Request - Invalid parameters" @Failure 500 {object} types.ErrorResponse "Internal Server Error" @Failure 503 {object} types.ErrorResponse "Service Unavailable - L2 bridge syncer not available" @Router /set-claims [get]

func (*BridgeService) GetSettlementsHandler added in v0.11.0

func (b *BridgeService) GetSettlementsHandler(c *gin.Context)

GetSettlementsHandler returns a paginated list of the L1 events that settled a new local exit root for this network (RollupManager's VerifyBatchesTrustedAggregator), most recent first. This lets a caller walk the network's settlement history to find the exact settlement that first covered a given bridge, instead of relying on agglayer reporting "the latest settled certificate" (issue #1817).

@Summary Get L1 settlement history for this network @Description Returns a paginated list of the L1 transactions that settled a new local exit @Description root for this network, most recent first. tx_hash and block_timestamp are omitted @Description for settlements synced before this endpoint was added, and are never backfilled @Description for those. @Tags settlements @Param page_number query uint32 false "Page number (default 1)" @Param page_size query uint32 false "Page size (default 20)" @Produce json @Success 200 {object} types.SettlementsResult @Failure 400 {object} types.ErrorResponse "Bad Request" @Failure 500 {object} types.ErrorResponse "Internal Server Error" @Failure 503 {object} types.ErrorResponse "Service Unavailable" @Router /settlements [get]

func (*BridgeService) GetSyncStatusHandler

func (b *BridgeService) GetSyncStatusHandler(c *gin.Context)

GetSyncStatusHandler returns the bridge synchronization status for L1 and L2 networks, the l2gersync (injected-GER) synchronization status, and the l1infotreesync/claimsync synchronization status when configured.

@Summary Get bridge synchronization status @Description Returns bridge sync status by comparing on-chain bridge deposit counts with local database counts. @Description Shows if bridge syncers are active and whether they're keeping up with on-chain events. Also @Description reports l2gersync, l1infotreesync and claimsync status when available. Always responds 200 -- @Description a syncer that could not be computed reports its own error in its entry, it never fails the request. @Tags sync @Produce json @Success 200 {object} types.SyncStatus "Bridge synchronization status" @Router /sync-status [get]

func (*BridgeService) GetTokenMappingsHandler

func (b *BridgeService) GetTokenMappingsHandler(c *gin.Context)

@Summary Get token mappings @Description Returns token mappings for the given network, paginated @Tags token-mappings @Param network_id query int true "Network ID" @Param page_number query int false "Page number" @Param page_size query int false "Page size" @Param origin_token_address query string false "Filter by origin token address" @Produce json @Success 200 {object} types.TokenMappingsResult @Failure 400 {object} types.ErrorResponse "Bad Request" @Failure 500 {object} types.ErrorResponse "Internal Server Error" @Router /token-mappings [get]

func (*BridgeService) GetUnsetClaimsHandler added in v0.8.0

func (b *BridgeService) GetUnsetClaimsHandler(c *gin.Context)

@Summary Get unset claims @Description Returns unset claims for the configured L2 network, paginated. Note: unset claims are only available for L2 networks, not L1. @Tags unset-claims @Param page_number query int false "Page number" @Param page_size query int false "Page size" @Param global_index query string false "Filter by global index" @Produce json @Success 200 {object} types.UnsetClaimsResult @Failure 400 {object} types.ErrorResponse "Bad Request - Invalid parameters" @Failure 500 {object} types.ErrorResponse "Internal Server Error" @Failure 503 {object} types.ErrorResponse "Service Unavailable - L2 bridge syncer not available" @Router /unset-claims [get]

func (*BridgeService) HealthCheckHandler

func (b *BridgeService) HealthCheckHandler(c *gin.Context)

HealthCheckHandler returns the health status, version information and a summary bridge sync status of the bridge service. It is registered both at "/" and "/health" (issue #1689).

HealthCheckHandler always answers HTTP 200, on purpose: this endpoint backs liveness/routing probes (see bridgeservicefinder/health.go), and a syncer that is merely lagging or briefly erroring (SyncStatus == "pending"/"error") must never get this instance evicted from routing -- that would make an already-degraded topology worse. Callers that need to react to sync health should inspect the SyncStatus/Details fields, not the HTTP status code.

@Summary Get health status @Description Returns the health status, version information and summary bridge sync status of @Description the bridge service. Always responds 200 -- see SyncStatus/Details for sync health. @Tags health @Produce json @Success 200 {object} types.HealthCheckResponse "Health status, version and sync status information" @Router / [get] @Router /health [get]

func (*BridgeService) InjectedL1InfoLeafHandler

func (b *BridgeService) InjectedL1InfoLeafHandler(c *gin.Context)

@Summary Get injected L1 info tree leaf after a given L1 info tree index @Description Returns the L1 info tree leaf either at the given index (for L1) @Description or the first injected global exit root after the given index (for L2). For L2, @Description injected_l2_block_num/injected_l2_block_timestamp additionally carry the destination @Description network's own block, and when, the Global Exit Root got injected. @Tags l1-info-tree-leaf @Param network_id query int true "Network ID" @Param leaf_index query int true "L1 Info Tree Index" @Produce json @Success 200 {object} types.L1InfoTreeLeafResponse @Failure 400 {object} types.ErrorResponse "Bad Request" @Failure 404 {object} types.ErrorResponse "Not Found - global exit root not injected or leaf not indexed yet" @Failure 500 {object} types.ErrorResponse "Internal Server Error" @Failure 503 {object} types.ErrorResponse "Service Unavailable - a syncer is resolving a reorg, retry later" @Router /injected-l1-info-leaf [get]

func (*BridgeService) L1InfoTreeIndexForBridgeHandler

func (b *BridgeService) L1InfoTreeIndexForBridgeHandler(c *gin.Context)

@Summary Get L1 Info Tree index for a bridge @Description Returns the first L1 Info Tree index after a given deposit count for the specified network @Tags l1-info-tree-leaf @Param network_id query int true "Network ID" @Param deposit_count query int true "Deposit count" @Produce json @Success 200 {object} uint32 @Failure 400 {object} types.ErrorResponse "Bad Request" @Failure 404 {object} types.ErrorResponse "Not Found - not indexed by the syncers yet, retry later" @Failure 500 {object} types.ErrorResponse "Internal Server Error" @Failure 503 {object} types.ErrorResponse "Service Unavailable - a syncer is resolving a reorg, retry later" @Router /l1-info-tree-index [get]

func (*BridgeService) L1InfoTreeLeafByGERHandler added in v0.11.0

func (b *BridgeService) L1InfoTreeLeafByGERHandler(c *gin.Context)

@Summary Get L1 info tree leaf by Global Exit Root @Description Returns the L1 info tree leaf (index, exit roots, block info) for the given @Description Global Exit Root. The L1 info tree only exists on L1, so network_id must be 0. @Tags l1-info-tree-leaf @Param network_id query int true "Network ID (must be 0, mainnet)" @Param global_exit_root query string true "Global Exit Root" @Produce json @Success 200 {object} types.L1InfoTreeLeafResponse @Failure 400 {object} types.ErrorResponse "Bad Request" @Failure 404 {object} types.ErrorResponse "Not Found - GER not part of the L1 info tree (yet)" @Failure 500 {object} types.ErrorResponse "Internal Server Error" @Router /l1-info-tree-leaf-by-ger [get]

func (*BridgeService) RegisterRoutes added in v0.11.0

func (b *BridgeService) RegisterRoutes(router gin.IRouter)

RegisterRoutes registers all bridge service routes on router.

func (*BridgeService) RootByLERHandler added in v0.11.0

func (b *BridgeService) RootByLERHandler(c *gin.Context)

RootByLERHandler resolves ler to the position (deposit-count index) it had in network_id's local exit tree when it was computed. This lets a caller order two LERs (e.g. a bridge's own LER against a certificate's NewLocalExitRoot) by comparing their Index, instead of walking or syncing the whole tree itself.

@Summary Get the deposit-count index of a local exit root @Description Resolves ler to the position (deposit-count index) it had in network_id's local @Description exit tree when it was computed. @Tags bridges @Param network_id query int true "Network ID (0 for L1, L2 network ID otherwise)" @Param ler query string true "Local exit root (0x-prefixed 32-byte hex)" @Produce json @Success 200 {object} types.RootByLERResponse @Failure 400 {object} types.ErrorResponse "Bad Request" @Failure 404 {object} types.ErrorResponse "Not Found - ler not synced yet" @Failure 500 {object} types.ErrorResponse "Internal Server Error" @Failure 503 {object} types.ErrorResponse "Service Unavailable" @Router /root-by-ler [get]

type Bridger

type Bridger interface {
	GetProof(ctx context.Context, depositCount uint32, localExitRoot common.Hash) (tree.Proof, error)
	GetRootByLER(ctx context.Context, ler common.Hash) (*tree.Root, error)
	GetLastRoot(ctx context.Context) (*tree.Root, error)
	GetBridgesPaged(ctx context.Context, pageNumber, pageSize uint32,
		depositCount *uint64, networkIDs []uint32, fromAddress string) ([]*bridgesync.Bridge, int, error)
	GetTokenMappings(ctx context.Context, pageNumber, pageSize uint32,
		originTokenAddress string) ([]*bridgesync.TokenMapping, int, error)
	GetLegacyTokenMigrations(ctx context.Context,
		pageNumber, pageSize uint32) ([]*bridgesync.LegacyTokenMigration, int, error)
	GetLastReorgEvent(ctx context.Context) (*bridgesync.LastReorg, error)
	GetContractDepositCount(ctx context.Context) (uint32, error)
	GetLastProcessedBlock(ctx context.Context) (uint64, bool, error)
	GetLatestNetworkBlock(ctx context.Context) (uint64, error)
	IsActive(ctx context.Context) bool
	GetBridgeByDepositCount(ctx context.Context, depositCount uint32) (*bridgesync.Bridge, error)
	GetBridgesByContent(ctx context.Context, leafType uint8, originAddress common.Address,
		destinationNetwork uint32, destinationAddress common.Address,
		amount *big.Int, metadata []byte) ([]*bridgesync.Bridge, error)
}

type Claimer added in v0.10.0

type Claimer interface {
	GetClaimsPaged(ctx context.Context, page, pageSize uint32,
		networkIDs []uint32, globalIndex *big.Int) ([]*claimsynctype.Claim, int, error)
	GetUnsetClaimsPaged(ctx context.Context, page, pageSize uint32,
		globalIndex *big.Int) ([]*claimsynctype.UnsetClaim, int, error)
	GetSetClaimsPaged(ctx context.Context, page, pageSize uint32,
		globalIndex *big.Int) ([]*claimsynctype.SetClaim, int, error)
	GetClaimsByGER(ctx context.Context, globalExitRoot common.Hash) ([]*claimsynctype.Claim, error)
	// GetLastProcessedBlock returns the last processed block and whether any block has been
	// processed yet.
	GetLastProcessedBlock(ctx context.Context) (uint64, bool, error)
}

type Config

type Config struct {
	Logger       *log.Logger
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	NetworkID    uint32
	// PublicConfig is the sanitized configuration served on the public config endpoint
	PublicConfig types.PublicConfigResponse
	// HealthCheckCacheTTL is how long a computed /health (and its underlying sync-status)
	// result is cached before being recomputed, collapsing a burst of concurrent health probes
	// into a single computeSyncStatus call. Zero (the field's default when unset -- there is no
	// [BridgeService] TOML section today) falls back to DefaultHealthCheckCacheTTL.
	HealthCheckCacheTTL cfgtypes.Duration
	// HealthCheckComputeTimeout bounds a single health-check sync-status computation,
	// independently of ReadTimeout (see DefaultHealthCheckComputeTimeout for why the two must not
	// share a budget). Zero (the field's default when unset -- there is no [BridgeService] TOML
	// section today) falls back to DefaultHealthCheckComputeTimeout.
	HealthCheckComputeTimeout cfgtypes.Duration
}

type L1InfoTreeSyncer added in v0.7.0

type L1InfoTreeSyncer interface {
	GetInfoByIndex(ctx context.Context, index uint32) (*l1infotreesync.L1InfoTreeLeaf, error)
	GetInfoByGlobalExitRoot(ger common.Hash) (*l1infotreesync.L1InfoTreeLeaf, error)
	GetRollupExitTreeMerkleProof(ctx context.Context, networkID uint32, root common.Hash) (tree.Proof, error)
	GetLocalExitRoot(ctx context.Context, networkID uint32, rollupExitRoot common.Hash) (common.Hash, error)
	GetLastInfo() (*l1infotreesync.L1InfoTreeLeaf, error)
	GetFirstInfo() (*l1infotreesync.L1InfoTreeLeaf, error)
	GetFirstInfoAfterBlock(blockNum uint64) (*l1infotreesync.L1InfoTreeLeaf, error)
	GetLatestL1InfoLeafUntilBlock(ctx context.Context, blockNum uint64) (*l1infotreesync.L1InfoTreeLeaf, error)
	GetLastVerifiedBatches(rollupID uint32) (*l1infotreesync.VerifyBatches, error)
	GetFirstVerifiedBatches(rollupID uint32) (*l1infotreesync.VerifyBatches, error)
	GetFirstVerifiedBatchesAfterBlock(rollupID uint32, blockNum uint64) (*l1infotreesync.VerifyBatches, error)
	GetFirstL1InfoWithRollupExitRoot(rollupExitRoot common.Hash) (*l1infotreesync.L1InfoTreeLeaf, error)
	GetVerifiedBatchesPaged(
		rollupID, pageNumber, pageSize uint32,
	) ([]*l1infotreesync.VerifiedBatchWithBlockHash, int, error)
	// IsActive reports whether the l1infotreesync processor is not halted.
	IsActive(ctx context.Context) bool
	// GetLastProcessedBlock returns the last processed L1 block; 0 (nil error) if none yet.
	// Returns sync.ErrInconsistentState while the processor is halted.
	GetLastProcessedBlock(ctx context.Context) (uint64, error)
}

type L2GERSyncer added in v0.7.0

type L2GERSyncer interface {
	GetFirstGERAfterL1InfoTreeIndex(
		ctx context.Context, atOrAfterL1InfoTreeIndex uint32,
	) (l2gersync.GlobalExitRootInfo, error)
	GetRemoveGEREvents(
		ctx context.Context, globalExitRoot *common.Hash, limit uint32,
	) ([]*l2gersync.RemoveGEREvent, error)
	GetLastProcessedBlock(ctx context.Context) (uint64, error)
	GetLastGER(ctx context.Context) (l2gersync.GlobalExitRootInfo, error)
}

type UintParam

type UintParam interface {
	~uint32 | ~uint64
}

Directories

Path Synopsis
Package docs Code generated by swaggo/swag.
Package docs Code generated by swaggo/swag.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL