keeper

package
v0.1.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrProbeEndpointInvalid marks a registered provider endpoint the
	// probe guard could not even parse into a URL/host to evaluate.
	ErrProbeEndpointInvalid = errors.New("probe endpoint invalid")

	// ErrProbeSchemeNotAllowed rejects probe endpoints whose scheme is
	// not http or https (Phase 3.3 SSRF guard).
	ErrProbeSchemeNotAllowed = errors.New("probe endpoint scheme not http(s)")

	// ErrProbeTargetBlocked rejects probe targets that resolve (or, at
	// dial time, connect) to a loopback, link-local — including the
	// 169.254.0.0/16 cloud metadata range — or unspecified address
	// while Params.AllowPrivateProbeTargets is false (Phase 3.3 SSRF
	// guard).
	ErrProbeTargetBlocked = errors.New("probe target address blocked by SSRF guard")
)

Functions

This section is empty.

Types

type Keeper

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

Keeper aggregates the valiporacle module's runtime state. P0.2 added `params`, a shared `*http.Client`, and a per-provider circuit breaker so ExtendVote probes reuse connections, apply operator-tunable limits, and back off against sinkholed providers instead of spending the validator's time budget on a dead host.

func NewKeeper

func NewKeeper(
	storeKey storetypes.StoreKey,
	wasmKeeper *wasmkeeper.Keeper,
	marketKeeper mkeeper.IKeeper,
	providerKeeper pkeeper.IKeeper,
	logger log.Logger,
	homePath string,
	params types.Params,
) *Keeper

NewKeeper constructs the valiporacle keeper. `params` carries all runtime-tunable probe-load knobs — see types/params.go.

func (*Keeper) BeginBlock

func (k *Keeper) BeginBlock(ctx sdk.Context)

func (*Keeper) ExtendVoteHandler

func (k *Keeper) ExtendVoteHandler() sdk.ExtendVoteHandler

ExtendVoteHandler returns the validator-local probe handler. P0.2 rewired it to:

  • Use operator-tuned Params (probe interval, concurrency, timeouts).
  • Reuse a single *http.Client built at keeper construction so TCP / TLS sessions survive across blocks.
  • Respect a per-provider circuit breaker so a sinkholed endpoint doesn't burn the validator's vote-extension time budget.
  • Fan probes out across a bounded worker pool, then re-sort the results deterministically so every validator marshals an identical-shaped extension — critical for aggregation matching.
  • Enforce Params.MaxVoteExtensionBytes; when exceeded, drop the tail of the list and emit a metric so operators can raise the ceiling if they're chronically full.

func (*Keeper) GetAllProviderMessages

func (k *Keeper) GetAllProviderMessages(ctx sdk.Context) []types.ProviderMessage

GetAllProviderMessages returns all stored provider messages.

func (*Keeper) GetCachedActiveLeases

func (k *Keeper) GetCachedActiveLeases() []types.ActiveLease

GetCachedActiveLeases returns the in-memory active lease list.

func (*Keeper) GetCachedEndpoint

func (k *Keeper) GetCachedEndpoint() (string, bool)

func (*Keeper) GetContractAddr

func (k *Keeper) GetContractAddr(ctx sdk.Context) string

func (*Keeper) GetLastLeaseRefresh

func (k *Keeper) GetLastLeaseRefresh(ctx sdk.Context) int64

func (*Keeper) GetLastRefreshHeight

func (k *Keeper) GetLastRefreshHeight(ctx sdk.Context) int64

func (*Keeper) GetLastSudoPush

func (k *Keeper) GetLastSudoPush(ctx sdk.Context) int64

func (*Keeper) LoadOracleConfigFromKV

func (k *Keeper) LoadOracleConfigFromKV(ctx sdk.Context) (types.OracleConfig, bool)

func (*Keeper) Params

func (k *Keeper) Params() types.Params

Params returns a copy of the keeper's current parameters.

func (*Keeper) PrepareProposalHandler

func (k *Keeper) PrepareProposalHandler() sdk.PrepareProposalHandler

PrepareProposalHandler aggregates vote extensions into a synthetic oracle tx.

func (*Keeper) ProcessOracleTxFromBlock

func (k *Keeper) ProcessOracleTxFromBlock(ctx sdk.Context, txs [][]byte)

func (*Keeper) ProcessProposalHandler

func (k *Keeper) ProcessProposalHandler() sdk.ProcessProposalHandler

ProcessProposalHandler verifies a proposed block's oracle tx.

func (*Keeper) RefreshActiveLeases

func (k *Keeper) RefreshActiveLeases(ctx sdk.Context)

RefreshActiveLeases combines three sources to build the list of providers to health-check:

  1. Contract-registered endpoints (explicit self-registration)
  2. On-chain leases from x/market (providers with active deployments)
  3. On-chain provider records from x/provider (fallback HostURI discovery)

Providers with active market leases that have no contract-registered endpoint get a fallback URL derived from their on-chain HostURI.

func (*Keeper) RefreshOracleEndpoint

func (k *Keeper) RefreshOracleEndpoint(ctx sdk.Context)

func (*Keeper) RestoreCachedEndpoint

func (k *Keeper) RestoreCachedEndpoint(ctx sdk.Context)

func (*Keeper) SaveOracleConfigToKV

func (k *Keeper) SaveOracleConfigToKV(ctx sdk.Context, cfg types.OracleConfig)

func (*Keeper) SetContractAddr

func (k *Keeper) SetContractAddr(ctx sdk.Context, addr string)

func (*Keeper) SetLastLeaseRefresh

func (k *Keeper) SetLastLeaseRefresh(ctx sdk.Context, h int64)

func (*Keeper) SetLastRefreshHeight

func (k *Keeper) SetLastRefreshHeight(ctx sdk.Context, h int64)

func (*Keeper) SetLastSudoPush

func (k *Keeper) SetLastSudoPush(ctx sdk.Context, h int64)

func (*Keeper) StoreProviderMessage

func (k *Keeper) StoreProviderMessage(ctx sdk.Context, msg types.ProviderMessage)

StoreProviderMessage persists a provider message keyed by provider+type.

func (*Keeper) SudoPushProviderMessages

func (k *Keeper) SudoPushProviderMessages(ctx sdk.Context)

func (*Keeper) VerifyVoteExtensionHandler

func (k *Keeper) VerifyVoteExtensionHandler() sdk.VerifyVoteExtensionHandler

VerifyVoteExtensionHandler validates a peer's vote extension.

Jump to

Keyboard shortcuts

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