core

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	P = "provider"
	C = "consumer"
)

Variables

This section is empty.

Functions

func GetZeroState

func GetZeroState(
	suite *suite.Suite,
	initState InitState,
) (path *ibctesting.Path, addrs []sdk.ValAddress, heightLastCommitted, timeLastCommitted int64)

The state of the data returned is equivalent to the state of two chains after a full handshake, but the precise order of steps used to reach the state does not necessarily mimic the order of steps that happen in a live scenario.

Types

type Action

type Action struct {
	Amt              int    `json:"amt,omitempty"`
	Chain            string `json:"chain,omitempty"`
	InfractionHeight int    `json:"infractionHeight,omitempty"`
	IsDowntime       bool   `json:"isDowntime"`
	Kind             string `json:"kind"`
	NumPackets       int    `json:"numPackets,omitempty"`
	Val              int    `json:"val,omitempty"`
}

type ActionAndPartialState

type ActionAndPartialState struct {
	Action       Action       `json:"action"`
	PartialState PartialState `json:"partialState"`
	Ix           int          `json:"ix"`
}

type Builder

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

type InitState

type InitState struct {
	PKSeeds                []string
	NumValidators          int
	MaxValidators          int
	InitialDelegatorTokens int
	SlashDoublesign        sdk.Dec
	SlashDowntime          sdk.Dec
	UnbondingP             time.Duration
	UnbondingC             time.Duration
	Trusting               time.Duration
	MaxClockDrift          time.Duration
	BlockInterval          time.Duration
	ConsensusParams        *abci.ConsensusParams
	ValStates              ValStates
	MaxEntries             int
}

type PartialState

type PartialState struct {
	Delegation          []int    `json:"delegation,omitempty"`
	DelegatorTokens     int      `json:"delegatorTokens,omitempty"`
	Jailed              []*int   `json:"jailed,omitempty"`
	OutstandingDowntime []bool   `json:"outstandingDowntime,omitempty"`
	ConsumerPower       []*int   `json:"consumerPower,omitempty"`
	Status              []string `json:"status,omitempty"`
	Tokens              []int    `json:"tokens,omitempty"`
	H                   int      `json:"h,omitempty"`
	T                   int      `json:"t,omitempty"`
}

type TraceData

type TraceData struct {
	Actions   []ActionAndPartialState `json:"actions"`
	Constants struct {
		BlockSeconds            int     `json:"BLOCK_SECONDS"`
		C                       string  `json:"C"`
		DelegateAmtMax          int     `json:"DELEGATE_AMT_MAX"`
		DelegateAmtMin          int     `json:"DELEGATE_AMT_MIN"`
		InitialDelegatorTokens  int     `json:"INITIAL_DELEGATOR_TOKENS"`
		IsDowntimeProbability   float64 `json:"ISDOWNTIME_PROBABILITY"`
		JailSeconds             int     `json:"JAIL_SECONDS"`
		MaxNumPacketsForDeliver int     `json:"MAX_NUM_PACKETS_FOR_DELIVER"`
		MaxValidators           int     `json:"MAX_VALIDATORS"`
		NumValidators           int     `json:"NUM_VALIDATORS"`
		P                       string  `json:"P"`
		SlashDoublesign         int     `json:"SLASH_DOUBLESIGN"`
		SlashDowntime           int     `json:"SLASH_DOWNTIME"`
		TrustingSeconds         int     `json:"TRUSTING_SECONDS"`
		UnbondingSecondsC       int     `json:"UNBONDING_SECONDS_C"`
		UnbondingSecondsP       int     `json:"UNBONDING_SECONDS_P"`
		UndelegateAmtMax        int     `json:"UNDELEGATE_AMT_MAX"`
		UndelegateAmtMin        int     `json:"UNDELEGATE_AMT_MIN"`
	} `json:"constants"`
	Events []string `json:"events"`
	Meta   struct {
		Commit string `json:"commit"`
		Diff   string `json:"diff"`
	} `json:"meta"`
}

func LoadTraces

func LoadTraces(fn string) []TraceData

type Traces

type Traces struct {
	// index of trace in json
	CurrentTraceIx int
	// index of current action
	CurrentActionIx int
	// traces
	Data []TraceData
}

Traces stores a list of traces and gives a diagnostic for debugging failed tests.

func (*Traces) Action

func (t *Traces) Action() Action

func (*Traces) Actions

func (t *Traces) Actions() []ActionAndPartialState

func (*Traces) Consequence

func (t *Traces) Consequence() PartialState

func (*Traces) ConsumerPower

func (t *Traces) ConsumerPower(i int) *int

func (*Traces) Delegation

func (t *Traces) Delegation(i int) int

func (*Traces) DelegatorTokens

func (t *Traces) DelegatorTokens() int

func (*Traces) Diagnostic

func (t *Traces) Diagnostic() string

diagnostic returns a string for diagnosing errors

func (*Traces) Height

func (t *Traces) Height() int

func (*Traces) Jailed

func (t *Traces) Jailed(i int) *int

func (*Traces) OutstandingDowntime

func (t *Traces) OutstandingDowntime(i int) bool

func (*Traces) Status

func (t *Traces) Status(i int) stakingtypes.BondStatus

func (*Traces) Time

func (t *Traces) Time() int

func (*Traces) Tokens

func (t *Traces) Tokens(i int) int

func (*Traces) Trace

func (t *Traces) Trace() TraceData

type ValStates

type ValStates struct {
	Delegation           []int
	Tokens               []int
	ValidatorExtraTokens []int
	Status               []stakingtypes.BondStatus
}

ValStates represents the total delegation and bond status of a validator

Jump to

Keyboard shortcuts

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