types

package
v0.11.0-rc7 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// WSTypeStatus is a TrackingData snapshot (initial or on every change); its BridgeStatus
	// field is nil until the tracker resolves the bridge
	WSTypeStatus = "status"
	// WSTypeError is an ErrorData sent only for invalid request parameters (bad network_id/
	// tx_hash); the server closes the connection after sending it. Once a bridge is
	// registered, every outcome — including giving up trying to resolve it — is a
	// WSTypeStatus message instead (see TrackingData.Error)
	WSTypeError = "error"
)

WebSocket message types carried in the WSMessage envelope

View Source
const HealthStatusOK = "ok"

HealthStatusOK is the value of HealthResponse.Status: the endpoint always returns 200, so the status is always "ok"

Variables

This section is empty.

Functions

This section is empty.

Types

type BridgeLeafType

type BridgeLeafType int

BridgeLeafType identifies the kind of leaf the bridge created (asset or message)

const (
	// BridgeLeafTypeAsset the bridge was created with bridgeAsset (leaf_type=0)
	BridgeLeafTypeAsset BridgeLeafType = iota
	// BridgeLeafTypeMessage the bridge was created with bridgeMessage (leaf_type=1)
	BridgeLeafTypeMessage
)

func (BridgeLeafType) String

func (b BridgeLeafType) String() string

String representation of the enum

type BridgeRequest

type BridgeRequest struct {
	// NetworkID is the network where the bridge transaction was sent (0 -> Mainnet)
	NetworkID uint32 `json:"network_id"`
	// TxHash is the hash of the transaction that created the bridge (bridgeAsset)
	TxHash common.Hash `json:"tx_hash"`
}

BridgeRequest is the request of GET /tracker/v1/network/{network_id}/tx/{tx_hash}. Both values come from the URL path, so they are mandatory

type BridgeStep

type BridgeStep int

BridgeStep identifies each step a bridge goes through, from its creation with bridgeAsset until it is claimed on the destination network

const (
	// StepWaitingGERUpdate the bridge has been created (BridgeEvent emitted) on an L1
	// origin, but the Global Exit Root has not been updated yet (e.g.
	// forceUpdateGlobalExitRoot=false)
	StepWaitingGERUpdate BridgeStep = iota
	// StepWaitingLERUpdate the bridge has been created (BridgeEvent emitted) on an L2
	// origin, but its Local Exit Root has not been updated yet
	StepWaitingLERUpdate
	// StepPendingInclusion the bridge is not yet part of any certificate
	StepPendingInclusion
	// StepCertificatePending the bridge is included in a certificate sent to the Agglayer;
	// covers every status the certificate goes through (Pending, Proven, Candidate, InError)
	// until it settles — those intermediate statuses do not change the step, only the
	// certificate data carried in its Result (see BridgeStepPath.Result)
	StepCertificatePending
	// StepWaitL1SettledGER the certificate has settled, but its settlement tx has not been
	// confirmed on L1 yet: the tracker waits for that tx to reach the configured L1 finality
	// and its receipt to carry both VerifyBatchesTrustedAggregator and UpdateL1InfoTree
	// (UpdateL1InfoTreeV2 is captured too, if present, but is not required). Only reached by
	// L2-originated bridges (L2->L1 and L2->L2), right after StepCertificatePending
	StepWaitL1SettledGER
	// StepWaitingGERInjection the certificate is settled but the Global Exit Root has
	// not been injected on the destination network yet
	StepWaitingGERInjection
	// StepWaitingClaim the Global Exit Root that includes the bridge has been injected
	// on the destination network, so the bridge is ready to be claimed
	StepWaitingClaim
	// StepClaimed the bridge has been claimed on the destination network
	StepClaimed
)

func (BridgeStep) String

func (s BridgeStep) String() string

String representation of the enum

type BridgeType

type BridgeType int

BridgeType identifies the direction of a bridge

const (
	// BridgeTypeL1ToL2 is a bridge from mainnet to a rollup
	BridgeTypeL1ToL2 BridgeType = iota
	// BridgeTypeL2ToL1 is a bridge from a rollup to mainnet
	BridgeTypeL2ToL1
	// BridgeTypeL2ToL2 is a bridge between two rollups
	BridgeTypeL2ToL2
)

func (BridgeType) String

func (b BridgeType) String() string

String representation of the enum

type CertificateData

type CertificateData struct {
	CertificateID common.Hash                     `json:"certificate_id"`
	Status        agglayertypes.CertificateStatus `json:"status"`
	// StatusString is the string representation of Status, auto-populated on JSON marshaling
	StatusString string `json:"status_string"`
	// Error is only set if the certificate carries an error message (relevant for InError certs)
	Error            string       `json:"error,omitempty"`
	SettlementTxHash *common.Hash `json:"settlement_tx_hash,omitempty"`
}

CertificateData holds the Agglayer certificate information related to a bridge

func (CertificateData) MarshalJSON

func (c CertificateData) MarshalJSON() ([]byte, error)

MarshalJSON is the implementation of the json.Marshaler interface. It populates the string representation of the numeric enum fields

type CertificateInclusionData

type CertificateInclusionData struct {
	CertificateData
	// PreviousLocalExitRoot is the LER right before this certificate, nil for a network's first
	// certificate
	PreviousLocalExitRoot *common.Hash
	// NewLocalExitRoot is the LER this certificate advances to, the one that covers the bridge
	NewLocalExitRoot common.Hash
}

CertificateInclusionData is the data CertificateSource.CertificateFor resolves for the certificate that covers (or may come to cover) a bridge: its status (CertificateData, also StepCertificatePending's own Result type) plus the LER transition it produced, which only PendingInclusionResolver needs

type ClaimResult

type ClaimResult struct {
	ClaimTx     common.Hash `json:"claim_tx"`
	BlockNumber uint64      `json:"block_number"`
}

ClaimResult is the result of StepWaitingClaim once it completes: the claim transaction on the destination network and the block it was mined in

type Duration

type Duration struct {
	time.Duration
}

Duration is a time.Duration that marshals to/from a human-readable string (e.g. "5m0s") instead of nanoseconds

func NewDuration

func NewDuration(d time.Duration) *Duration

NewDuration returns a Duration wrapper

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON is the implementation of the json.Marshaler interface

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(data []byte) error

UnmarshalJSON is the implementation of the json.Unmarshaler interface

type ErrorData

type ErrorData struct {
	// Code is an HTTP-like error code (e.g. 400 invalid params, 404 bridge tx not found)
	Code int `json:"code"`
	// Message is a human-readable description of the error
	Message string `json:"message"`
}

ErrorData is the error structure shared by the REST error responses and the WebSocket "error" messages

type ErrorStep

type ErrorStep struct {
	ErrorType StepErrorType `json:"error_type"`
	// ErrorTypeString is the string representation of ErrorType, auto-populated on JSON marshaling
	ErrorTypeString string `json:"error_type_string"`
	// RetryCount is the number of retries attempted so far for this step
	RetryCount int `json:"retry_count"`
	// Description holds the human-readable description of the error; one entry per occurrence
	Description []string `json:"description"`
}

ErrorStep carries the details of a step that is in StepStatusError

func (ErrorStep) MarshalJSON

func (e ErrorStep) MarshalJSON() ([]byte, error)

MarshalJSON is the implementation of the json.Marshaler interface. It populates the string representation of the numeric enum fields

type GERData

type GERData struct {
	// NetworkID is the network the GER belongs to (0 -> Mainnet)
	NetworkID uint32 `json:"network_id"`
	// GER is the Global Exit Root
	GER *common.Hash `json:"ger,omitempty"`
	// MER is the Mainnet Exit Root
	MER *common.Hash `json:"mer,omitempty"`
	// RER is the Rollup Exit Root
	RER *common.Hash `json:"rer,omitempty"`
	// LER is the Local Exit Root
	LER *common.Hash `json:"ler,omitempty"`
	// LERType identifies which exit tree the LER belongs to
	LERType LERType `json:"ler_type"`
	// LERTypeString is the string representation of LERType, auto-populated on JSON marshaling
	LERTypeString string `json:"ler_type_string"`
	// BlockNumber is the block where the GER update happened. Only populated when resolving
	// the origin GER of an L1-originated bridge. Internal only: GERData is not serialized on
	// any tracker response, it is the domain layer's currency to decide GER coverage
	BlockNumber *uint64 `json:"-"`
}

GERData holds the exit roots of a Global Exit Root update relevant to a bridge

func (GERData) MarshalJSON

func (g GERData) MarshalJSON() ([]byte, error)

MarshalJSON is the implementation of the json.Marshaler interface. It populates the string representation of the numeric enum fields

type GERUpdateResult

type GERUpdateResult struct {
	// L1InfoTreeIndex is the leaf index the update landed at, resolved from the contract's own
	// leaf count (1-based) as of the update's block: index = count - 1
	L1InfoTreeIndex uint32      `json:"l1_info_tree_index"`
	GER             common.Hash `json:"ger"`
	MainnetExitRoot common.Hash `json:"mer"`
	RollupExitRoot  common.Hash `json:"rer"`
	BlockNumber     uint64      `json:"block_number"`
	BlockTimestamp  uint64      `json:"block_timestamp"`
	LogIndex        uint        `json:"log_index"`
}

GERUpdateResult is the result of StepWaitingGERUpdate once it completes: the GER produced by the update on the origin network (L1) and the block it was updated in

type HealthResponse

type HealthResponse struct {
	// Status is always "ok"
	Status string `json:"status"`
	// InstanceID is a UUID generated at startup; it changes on every execution, so two
	// responses with different InstanceID come from different instances (or the same
	// instance after a restart)
	InstanceID string `json:"instance_id"`
	// ConfigSHA1 is the sha1sum (hex) of the configuration the instance was started with;
	// it allows checking that all instances behind a proxy run the same configuration
	ConfigSHA1 string `json:"config_sha1"`
	// Version is the build/version information of the running instance
	Version VersionInfo `json:"version"`
}

HealthResponse is the body of GET /tracker/v1/health

type InjectedGERResult

type InjectedGERResult struct {
	GER common.Hash `json:"ger"`
}

InjectedGERResult is the result of StepWaitingGERInjection once it completes: the GER injected on the destination network that covers the bridge. The injection source does not expose the block it was injected in, unlike GERUpdateResult

type L1SettledGERResult

type L1SettledGERResult struct {
	TxHash                            common.Hash `json:"tx_hash"`
	BlockNumber                       uint64      `json:"block_number"`
	GER                               common.Hash `json:"ger"`
	L1InfoTreeIndex                   *uint32     `json:"l1_info_tree_index,omitempty"`
	HasVerifyBatchesTrustedAggregator bool        `json:"has_verify_batches_trusted_aggregator"`
	HasUpdateL1InfoTree               bool        `json:"has_update_l1_info_tree"`
	HasUpdateL1InfoTreeV2             bool        `json:"has_update_l1_info_tree_v2"`
}

L1SettledGERResult is the result of StepWaitL1SettledGER once it completes: the evidence, read off the certificate's settlement tx receipt on L1, that the settlement propagated to the L1 Global Exit Root. HasVerifyBatchesTrustedAggregator and HasUpdateL1InfoTree are both required for the step to complete; HasUpdateL1InfoTreeV2 is only informational. GER is the Global Exit Root produced by the settlement (computed from UpdateL1InfoTree's mainnet/rollup exit roots), used by StepWaitingGERInjection to check whether it has reached the destination. L1InfoTreeIndex is the leaf index GER landed at: populated straight from UpdateL1InfoTreeV2's LeafCount when that (optional) event fires, otherwise resolved by the step itself with one extra lookup (GER -> leaf) before it can complete — either way, by the time this step is Done, L1InfoTreeIndex is never nil

type LERType

type LERType int

LERType identifies which exit tree the Local Exit Root belongs to

const (
	// LERTypeNA the Local Exit Root is not available / not applicable
	LERTypeNA LERType = iota
	// LERTypeMainnet the Local Exit Root belongs to the mainnet exit tree
	LERTypeMainnet
	// LERTypeLocal the Local Exit Root belongs to a rollup local exit tree
	LERTypeLocal
)

func (LERType) String

func (l LERType) String() string

String representation of the enum

type LERUpdateResult

type LERUpdateResult struct {
	NetworkID   uint32      `json:"network_id"`
	LER         common.Hash `json:"ler"`
	BlockNumber uint64      `json:"block_number"`
}

LERUpdateResult is the result of StepWaitingLERUpdate once it completes: the LER produced by the update on the origin L2 network and the block it was updated in

type PendingInclusionResult

type PendingInclusionResult struct {
	CertificateID common.Hash  `json:"certificate_id"`
	NewLER        common.Hash  `json:"new_ler"`
	PreviousLER   *common.Hash `json:"previous_ler,omitempty"`
}

PendingInclusionResult is the result of StepPendingInclusion once it completes: the certificate that first includes the bridge and the LER transition it produced

type StepErrorType

type StepErrorType int

StepErrorType classifies a step error by whether it is expected to clear on retry

const (
	// StepErrorTransient the error is expected to be resolved by retrying the step
	StepErrorTransient StepErrorType = iota
	// StepErrorPermanent the error will not resolve by retrying and requires intervention
	StepErrorPermanent
	// StepErrorExhausted the error was transient but retries have been given up on
	StepErrorExhausted
)

func (StepErrorType) String

func (e StepErrorType) String() string

String representation of the enum

type StepStatus

type StepStatus int

StepStatus is the status of a single step within the bridge path

const (
	// StepStatusPending the step has not started yet
	StepStatusPending StepStatus = iota
	// StepStatusInProgress the step is the one currently in progress
	StepStatusInProgress
	// StepStatusDone the step has been completed
	StepStatusDone
	// StepStatusError the step failed; details are carried in BridgeStepPath.Error
	StepStatusError
)

func (StepStatus) String

func (s StepStatus) String() string

String representation of the enum

type TrackingStatus

type TrackingStatus int

TrackingStatus is the full lifecycle of a supervised bridge, from registration to settlement: Registered while BridgeStatus is still nil, then Running/Error/Finished from the same signal TrackingData.StepIndex points at once it resolves (see the TrackingData envelope in bridgetracker/api, the only package that constructs it)

const (
	// TrackingStatusRegistered the bridge has been added to the supervised list but the
	// tracker has no information about it yet (BridgeStatus is nil)
	TrackingStatusRegistered TrackingStatus = iota
	// TrackingStatusRunning the bridge is resolved and alive: still being polled/updated
	TrackingStatusRunning
	// TrackingStatusError the bridge is resolved and stopped: one of its steps reached an error
	TrackingStatusError
	// TrackingStatusFinished the bridge is resolved and reached its terminal step (Claimed)
	TrackingStatusFinished
)

func (TrackingStatus) String

func (t TrackingStatus) String() string

String representation of the enum

type VersionInfo

type VersionInfo struct {
	// Version is the semantic version (e.g. "v0.1.0")
	Version string `json:"version"`
	// GitRev is the git revision the binary was built from
	GitRev string `json:"git_rev"`
	// GitBranch is the git branch the binary was built from
	GitBranch string `json:"git_branch"`
	// BuildDate is the build timestamp
	BuildDate string `json:"build_date"`
	// GoVersion is the Go runtime version (e.g. "go1.24.0")
	GoVersion string `json:"go_version"`
	// OS is the target operating system (e.g. "linux")
	OS string `json:"os"`
	// Arch is the target architecture (e.g. "amd64")
	Arch string `json:"arch"`
}

VersionInfo is the build/version information of the running instance, populated from aggkit.GetVersion()

func NewVersionInfo

func NewVersionInfo() VersionInfo

NewVersionInfo builds a VersionInfo from the build-time version data

type WSMessage

type WSMessage struct {
	// Type is one of WSTypeStatus or WSTypeError
	Type string `json:"type"`
	// Data is a TrackingData for "status" and an ErrorData for "error"
	Data any `json:"data"`
}

WSMessage is the envelope of every message the WebSocket endpoint sends

Jump to

Keyboard shortcuts

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