observe

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package observe ports SolanaObserver of contracts/solana/reporter/solana.ts: it turns finalized Solana state into the observation the policy plans from. The owned RPC node is a trust boundary; finalized commitment cannot make an untrusted node truthful.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Change

type Change struct {
	Previous    solana.PublicKey
	Current     solana.PublicKey
	ContextSlot uint64
}

Change is a change of the followed light client, seen first at ContextSlot.

type Chunk

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

Chunk is one finalized snapshot of the deployment accounts and the status accounts of a chunk of transfers.

type Deployment

type Deployment struct {
	ContextSlot   uint64
	BridgeEnabled bool
	LightClient   solana.PublicKey
}

Deployment is the result of a deployment snapshot without status accounts.

type Finalized

type Finalized struct {
	Kind        policy.Kind
	ContextSlot uint64
	Address     solana.PublicKey
	Status      *aktsolana.TransferStatus
	Outcome     sinkv1.Outcome
	Slot        uint64
}

Finalized is the finalized status of one transfer. Address, Status, Outcome and Slot are set for KindResolved only.

type MismatchError

type MismatchError struct {
	Pinned  solana.PublicKey
	Current solana.PublicKey
}

MismatchError reports a bridge account that names a light client other than the configured pin.

func (*MismatchError) Error

func (e *MismatchError) Error() string

type Observer

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

Observer reads finalized Solana state for the reporter.

func New

func New(rpc *aktsolana.RPC, idx *aktsolana.EvidenceIndex, o Options, onChange func(Change)) *Observer

New returns an observer. onChange, which may be nil, is called with each change of the followed light client while the follow lock is held. New panics on a mint that is not the program's "mint" PDA or a zero slot lead, which configuration validation rules out.

func (*Observer) Chunk

func (o *Observer) Chunk(ctx context.Context, ids []sinkid.ID) (*Chunk, error)

Chunk takes one snapshot of the deployment accounts and the status accounts of ids. With the four deployment accounts, the RPC's 100-key limit allows 96 IDs.

func (*Observer) Deployment

func (o *Observer) Deployment(ctx context.Context) (Deployment, error)

Deployment takes a snapshot of the deployment accounts. It fails on a light-client pin mismatch.

func (*Observer) Finalized

func (o *Observer) Finalized(c *Chunk, rec sinkid.Record) (Finalized, error)

Finalized checks the finalized status of rec in the chunk snapshot against the Akash record.

func (*Observer) Observe

func (o *Observer) Observe(
	ctx context.Context,
	c *Chunk,
	rec sinkid.Record,
	reported []sinkv1.Observation,
	own *sinkv1.Observation,
) (policy.Observed, error)

Observe returns what this node observes for rec in the chunk snapshot. reported holds the Akash votes and the governance observation of the transfer; own, when set, is this reporter's authenticated stored vote. Its evidence is reused after the immutable finalized status is rechecked, so pruned transaction history does not break transfers already observed.

type Options

type Options struct {
	GenesisHash string
	ProgramID   solana.PublicKey
	Mint        solana.PublicKey
	// LightClientPin, when set, fails every snapshot whose bridge names another light client. Unset follows the bridge.
	LightClientPin *solana.PublicKey
	ChainID        string
	MaxAge         time.Duration
	// SlotLead is how far beyond this node's finalized slot another node's finalized slot can plausibly be.
	SlotLead uint64
	Clock    clock.Clock
}

Options configures an Observer.

Jump to

Keyboard shortcuts

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