types

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: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName     = apivp.ModuleName
	OracleTxPrefix = apivp.OracleTxPrefix

	MaxVoteExtensionSize   = apivp.MaxVoteExtensionSize
	MaxEndpointLength      = apivp.MaxEndpointLength
	MaxOracleTxSize        = apivp.MaxOracleTxSize
	MaxProviderAddrLength  = apivp.MaxProviderAddrLength
	MaxMessagePayload      = apivp.MaxMessagePayload
	MaxTargetsPerValidator = apivp.MaxTargetsPerValidator
)
View Source
const (
	// StoreKey is the KV-store key name; aliases ModuleName.
	StoreKey = ModuleName

	// KV store keys. Prefixed "vp/" to avoid collision with other
	// modules writing into the same unified store.
	KeyContractAddr      = "vp/contract_addr"
	KeyOracleConfig      = "vp/oracle_config"
	KeyProviderMsgPrefix = "vp/pmsg/"
	KeyLastRefreshHeight = "vp/last_refresh"
	KeyLastSudoPush      = "vp/last_sudo_push"
	KeyLastLeaseRefresh  = "vp/last_lease_refresh"

	// Block intervals for periodic keeper work.
	ConfigRefreshInterval int64 = 5
	SudoPushInterval      int64 = 5
	LeaseRefreshInterval  int64 = 10

	// HTTPTimeoutSeconds is retained for back-compat; probes themselves
	// now take the timeout from Params.ProbeTimeoutSeconds.
	HTTPTimeoutSeconds = 3

	// ContractAddrFile is the on-disk filename under <homedir>/config
	// where the valiporacle contract address is stored.
	ContractAddrFile = "valiporacle_contract_addr"
)
View Source
const (
	// DefaultProbeIntervalBlocks is the "1-in-N" sampling divisor used
	// by ExtendVote to decide which providers each validator probes.
	// Replaces the previously hard-coded `samplingDivisor := uint64(5)`.
	DefaultProbeIntervalBlocks uint64 = 5

	// DefaultProbeTimeoutSeconds bounds each HTTP probe.
	DefaultProbeTimeoutSeconds uint64 = 3

	// DefaultMaxTargetsPerValidator caps how many providers a single
	// validator may report per block. Lower than the pre-P0.2 const
	// (50) to reflect the roadmap recommendation.
	DefaultMaxTargetsPerValidator uint32 = 32

	// DefaultMaxVoteExtensionBytes is the chain-accepted vote extension
	// size ceiling. Larger than the pre-P0.2 const so health payloads
	// for 32 providers comfortably fit.
	DefaultMaxVoteExtensionBytes uint64 = 32 * 1024

	// DefaultCircuitBreakerTrips is the consecutive-failure count that
	// opens a per-provider breaker and starts the cooldown window.
	DefaultCircuitBreakerTrips uint32 = 5

	// DefaultCircuitBreakerCooldown is how many blocks the breaker stays
	// open after tripping.
	DefaultCircuitBreakerCooldown uint64 = 200

	// DefaultProbeConcurrency is the worker-pool fan-out for per-block
	// probes on a single validator. Keeps us out of the "one-HTTP-call
	// per lease sequentially" regime without unbounded goroutines.
	DefaultProbeConcurrency uint32 = 4

	// DefaultMinQuorumFraction expresses the minimum per-(provider,type)
	// agreement threshold below which a winner message is flagged
	// `quorum_uncertain`. Stored as "num/den" so it survives JSON /
	// future param-store migration without float rounding headaches.
	DefaultMinQuorumFraction = "2/3"

	// DefaultTCPProbeTimeoutSeconds applies to the diagnostic TCP / TLS
	// fallback probes (probePort / probeTLS).
	DefaultTCPProbeTimeoutSeconds uint64 = 2

	// DefaultAllowPrivateProbeTargets keeps the Phase 3.3 probe SSRF
	// guard enabled: endpoints resolving to loopback (127.0.0.0/8,
	// ::1), link-local — including the cloud metadata range
	// 169.254.0.0/16 and fe80::/10 — or unspecified (0.0.0.0, ::)
	// addresses are never dialed. Single-host labs whose providers
	// legitimately live on loopback opt out via
	// EnvAllowPrivateProbeTargets.
	DefaultAllowPrivateProbeTargets = false

	// EnvAllowPrivateProbeTargets is the node-process environment
	// variable (read once at app wiring, node/app/types/app.go) that
	// flips Params.AllowPrivateProbeTargets to true. Validator-local:
	// it only changes which endpoints this validator's ExtendVote
	// probes will dial — never any deterministic state-machine path —
	// so mixed settings across a validator set cannot fork consensus.
	EnvAllowPrivateProbeTargets = "AKASH_VALIPORACLE_ALLOW_PRIVATE_PROBE_TARGETS" //nolint:gosec // env var name, not a credential
)

Default parameter values. The field comments explain why each knob exists; the defaults come from §P0.2 of the roadmap.

Variables

View Source
var (
	ValidateEndpoint        = apivp.ValidateEndpoint
	ValidateProviderMessage = apivp.ValidateProviderMessage
	HealthStatusSeverity    = apivp.HealthStatusSeverity
	ExtractHealthStatus     = apivp.ExtractHealthStatus
	EncodeOracleTx          = apivp.EncodeOracleTx
	DecodeOracleTx          = apivp.DecodeOracleTx
	IsOracleTx              = apivp.IsOracleTx
)

Functions

func ParseQuorumFraction

func ParseQuorumFraction(s string) (num, den uint32, err error)

ParseQuorumFraction splits a "num/den" string into integer components. Returns an error when the format is malformed, when numerator is greater than the denominator, or when either side is zero.

The num > den check is deliberate: the "2/3" knob means "winner must have at least 2/3 of votes to be certain"; values > 1 are nonsense (you can never have more voters than voted).

Types

type ActiveLease

type ActiveLease = apivp.ActiveLease

type GetProviderEndpointsResponse

type GetProviderEndpointsResponse = apivp.GetProviderEndpointsResponse

type HealthPayload

type HealthPayload = apivp.HealthPayload

type OracleConfig

type OracleConfig = apivp.OracleConfig

type OracleData

type OracleData = apivp.OracleData

type Params

type Params struct {
	ProbeIntervalBlocks    uint64
	ProbeTimeoutSeconds    uint64
	MaxTargetsPerValidator uint32
	MaxVoteExtensionBytes  uint64
	CircuitBreakerTrips    uint32
	CircuitBreakerCooldown uint64
	ProbeConcurrency       uint32
	// MinQuorumFraction is stored as a textual "num/den" ratio. Use
	// ParseQuorumFraction to obtain the integer pair at call sites.
	MinQuorumFraction      string
	TCPProbeTimeoutSeconds uint64
	// AllowPrivateProbeTargets disables the Phase 3.3 probe SSRF
	// guard, admitting loopback/link-local/unspecified endpoints.
	// Lab-only. Like every field here this is plain validator-local
	// wiring — Params is never serialized into genesis, a param
	// store, or any consensus artifact, so adding/flipping it cannot
	// break state compatibility.
	AllowPrivateProbeTargets bool
}

Params holds valiporacle module tunables. Plumbed through NewKeeper at app-wiring time; callers cannot mutate the keeper's view after construction.

func DefaultParams

func DefaultParams() Params

DefaultParams returns the P0.2 roadmap defaults.

func (Params) Validate

func (p Params) Validate() error

Validate sanity-checks a Params value. Catches misconfigurations at app-wiring time rather than at first-probe.

type ProviderEndpointInfo

type ProviderEndpointInfo = apivp.ProviderEndpointInfo

type ProviderMessage

type ProviderMessage = apivp.ProviderMessage

type PushProviderMsgsPayload

type PushProviderMsgsPayload = apivp.PushProviderMsgsPayload

type SmartQueryMsg

type SmartQueryMsg = apivp.SmartQueryMsg

type SudoMsg

type SudoMsg = apivp.SudoMsg

type VoteExtensionData

type VoteExtensionData = apivp.VoteExtensionData

Jump to

Keyboard shortcuts

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