Documentation
¶
Overview ¶
Package policy ports contracts/solana/reporter/policy.ts: it decides which sink messages the reporter sends.
Index ¶
- Constants
- func ChallengeSeconds(settlement sinkv1.SettlementData) (int64, error)
- func CompareOutcome(transfer sinkv1.TransferState, outcome sinkv1.Outcome) (contradicts, terminalMatches bool)
- func MinimumSlot(transfer sinkv1.TransferState, slotLimit *uint64) uint64
- func ReportedObservations(transfer sinkv1.TransferState) []sinkv1.Observation
- func ReporterThreshold(ratio sdkmath.LegacyDec, members int) (int, error)
- func SettledConsistently(transfer sinkv1.TransferState, outcome sinkv1.Outcome) bool
- type Key
- type Kind
- type MsgKind
- type Observed
- type Plan
- type Planned
- type Snapshot
Constants ¶
const ( AlertFabricatedSlot = "Akash reports a Solana slot beyond any plausible finalized slot" AlertNoStatus = "Akash reports an outcome without a finalized Solana status" AlertContradiction = "Akash settlement contradicts finalized Solana outcome" AlertGovernanceReview = "Transfer requires governance review" )
Variables ¶
This section is empty.
Functions ¶
func ChallengeSeconds ¶
func ChallengeSeconds(settlement sinkv1.SettlementData) (int64, error)
ChallengeSeconds returns the end of the challenge window in Unix seconds.
func CompareOutcome ¶
func CompareOutcome(transfer sinkv1.TransferState, outcome sinkv1.Outcome) (contradicts, terminalMatches bool)
CompareOutcome tells how a finalized Solana outcome relates to the Akash settlement and its reported observations.
func MinimumSlot ¶
func MinimumSlot(transfer sinkv1.TransferState, slotLimit *uint64) uint64
MinimumSlot returns the highest reported slot, ignoring slots above slotLimit when one is given.
func ReportedObservations ¶
func ReportedObservations(transfer sinkv1.TransferState) []sinkv1.Observation
ReportedObservations returns the governance observation, then the observation of every vote.
func ReporterThreshold ¶
ReporterThreshold returns ceil(ratio × members), which must exceed two thirds of the members unless there are none.
func SettledConsistently ¶
func SettledConsistently(transfer sinkv1.TransferState, outcome sinkv1.Outcome) bool
SettledConsistently reports a terminal, unheld settlement that agrees with the finalized outcome and every report. PlanOutcome would return no message and no alert for it.
Types ¶
type Key ¶
Key identifies a message for the purpose of executing it at most once. A vote is keyed by outcome, round and policy version. A veto and a refund are keyed by the transfer alone: MsgVetoVoid carries no round, so a veto planned in one round and one planned after a governance resolution share a key.
type MsgKind ¶
type MsgKind uint8
MsgKind identifies the kind of a sink message. The values are the kind bytes of the nonce slot hash.
type Observed ¶
type Observed struct {
Kind Kind
ContextSlot uint64
SlotLimit *uint64
Observation sinkv1.Observation
}
Observed is what a node saw on Solana. Observation is set for KindResolved only. SlotLimit, when set, is the highest slot that any node could have finalized at ContextSlot.
type Planned ¶
type Planned struct {
ID sinkid.ID
Msg sdk.Msg
Key Key
// PlanHeight and PlanTime are the height and block time of the snapshot the message was planned from.
PlanHeight int64
PlanTime time.Time
}
Planned is a message the policy planned from one snapshot.
type Snapshot ¶
type Snapshot struct {
Params sinkv1.Params
Policy sinkv1.ReporterPolicy
RefundUsage sinkv1.EpochUsage
Epoch uint64
Time int64
RefundHead *sinkid.ID
Transfer sinkv1.TransferState
}
Snapshot is the chain state a decision is made from. Time is the block time in Unix seconds. RefundHead is the head of the refund queue: x/sink pays refunds oldest first.