valiporacle

package
v0.1.0-beta.2 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: 3 Imported by: 1 module, 1 package

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

Index

Constants

View Source
const (
	// ModuleName is the valiporacle module identifier.
	ModuleName = "valiporacle"

	// OracleTxPrefix marks a synthetic block tx produced by the
	// valiporacle PrepareProposal handler so PreBlocker can route it.
	// It is part of the block wire format.
	OracleTxPrefix = "VALIPORACLE|"

	// Size limits (bytes / count). MaxVoteExtensionSize and
	// MaxTargetsPerValidator are superseded by module Params for the
	// runtime-tunable case; the consts remain as hard caps for
	// VerifyVoteExtension / validation so a misbehaving validator can
	// never force the chain into processing an arbitrarily large blob.
	MaxVoteExtensionSize   = 32 * 1024 // hard ceiling; Params.MaxVoteExtensionBytes is the runtime-tunable
	MaxEndpointLength      = 512
	MaxOracleTxSize        = 131072 // 128 KiB
	MaxProviderAddrLength  = 128
	MaxMessagePayload      = 2048
	MaxTargetsPerValidator = 50 // hard cap; Params.MaxTargetsPerValidator is the runtime-tunable
)

Variables

This section is empty.

Functions

func EncodeOracleTx

func EncodeOracleTx(data *OracleData) ([]byte, error)

func ExtractHealthStatus

func ExtractHealthStatus(payload string) string

ExtractHealthStatus parses the status field from a health_check payload.

func HealthStatusSeverity

func HealthStatusSeverity(status string) int

func IsOracleTx

func IsOracleTx(tx []byte) bool

func ValidateEndpoint

func ValidateEndpoint(s string) bool

func ValidateProviderMessage

func ValidateProviderMessage(m *ProviderMessage) bool

Types

type ActiveLease

type ActiveLease struct {
	Owner    string `json:"owner"`
	DSeq     uint64 `json:"dseq"`
	GSeq     uint32 `json:"gseq"`
	OSeq     uint32 `json:"oseq"`
	Provider string `json:"provider"`
	Endpoint string `json:"endpoint,omitempty"` // provider's health endpoint URL
}

ActiveLease represents a lease the validators should monitor.

type GetProviderEndpointsResponse

type GetProviderEndpointsResponse struct {
	Providers []ProviderEndpointInfo `json:"providers"`
	Count     uint32                 `json:"count"`
}

GetProviderEndpointsResponse is the contract query response.

type HealthPayload

type HealthPayload struct {
	Status     string `json:"status"`  // "healthy", "degraded", "unhealthy", "unreachable"
	Message    string `json:"message"` // human-readable detail
	LeaseOwner string `json:"lease_owner,omitempty"`
	DSeq       uint64 `json:"dseq,omitempty"`
	LatencyMs  int64  `json:"latency_ms,omitempty"`  // response latency in milliseconds
	HTTPStatus int    `json:"http_status,omitempty"` // HTTP status code from health endpoint
	PortOpen   *bool  `json:"port_open,omitempty"`   // whether the service port is reachable
	TLSValid   *bool  `json:"tls_valid,omitempty"`   // whether TLS handshake succeeded
}

HealthPayload is the structured payload for Type="health_check".

type OracleConfig

type OracleConfig struct {
	Endpoint string `json:"endpoint,omitempty"` // legacy, no longer used for health probes
	Enabled  bool   `json:"enabled"`
}

OracleConfig is queried from the contract to determine behavior.

type OracleData

type OracleData struct {
	Height   int64             `json:"height"`
	Messages []ProviderMessage `json:"messages,omitempty"`
}

func DecodeOracleTx

func DecodeOracleTx(tx []byte) (*OracleData, error)

type ProviderEndpointInfo

type ProviderEndpointInfo struct {
	Address      string `json:"address"`
	Endpoint     string `json:"endpoint"`
	RegisteredAt uint64 `json:"registered_at"`
}

ProviderEndpointInfo mirrors the contract's ProviderInfo.

type ProviderMessage

type ProviderMessage struct {
	Provider        string `json:"provider"`
	Type            string `json:"type"`
	Payload         string `json:"payload"`
	QuorumUncertain bool   `json:"quorum_uncertain,omitempty"`
	QuorumVoters    uint32 `json:"quorum_voters,omitempty"`
}

ProviderMessage is a generic extensible message from a provider, collected via vote extensions. The Type field allows future message kinds beyond health checks (e.g. resource usage, deployment status, pricing updates).

QuorumUncertain / QuorumVoters are stamped by the proposer after vote aggregation (P0.2 partition-bias detection) so downstream consumers can tell whether a winner message met the MinQuorumFraction threshold. Both fields use `omitempty` so older contracts/consumers that don't know about them continue to work unchanged.

type PushProviderMsgsPayload

type PushProviderMsgsPayload struct {
	Messages        []ProviderMessage `json:"messages"`
	Height          int64             `json:"height"`
	QuorumUncertain bool              `json:"quorum_uncertain,omitempty"`
	TotalVoters     uint32            `json:"total_voters,omitempty"`
}

PushProviderMsgsPayload is the sudo payload delivered to the valiporacle contract once per block (or on SudoPushInterval cadence).

QuorumUncertain is the OR of every message's flag: if any winner in this batch fell below MinQuorumFraction, the contract should treat the batch as non-authoritative (hold state instead of flipping HA). TotalVoters records how many validators produced a non-empty vote extension so operators can correlate thresholds with quorum size.

type SmartQueryMsg

type SmartQueryMsg struct {
	GetOracleConfig      *struct{} `json:"get_oracle_config,omitempty"`
	GetProviderEndpoints *struct{} `json:"get_provider_endpoints,omitempty"`
}

type SudoMsg

type SudoMsg struct {
	PushProviderMsgs *PushProviderMsgsPayload `json:"push_provider_msgs,omitempty"`
}

type VoteExtensionData

type VoteExtensionData struct {
	Messages []ProviderMessage `json:"messages,omitempty"`
}

Jump to

Keyboard shortcuts

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