Documentation ¶
Index ¶
- Constants
- func GenerateManyHeaderBisectionCases(jsonValList string)
- func GenerateSingleStepSequentialCases(jsonValList string)
- func GenerateSingleStepSkippingCases(jsonValList string)
- func GenerateValList(numVals int, votingPower int64)
- func NewState(chainID string, valSet *types.ValidatorSet, nextValSet *types.ValidatorSet) st.State
- func ReadFile(file string) []byte
- type Initial
- type LiteBlock
- type MockProvider
- func (mp MockProvider) ChainID() string
- func (mp MockProvider) Copy() MockProvider
- func (mp MockProvider) New(chainID string, liteBlocks []LiteBlock) MockProvider
- func (mp MockProvider) SignedHeader(height int64) (*types.SignedHeader, error)
- func (mp MockProvider) ValidatorSet(height int64) (*types.ValidatorSet, error)
- type TestBisection
- type TestCase
- type TrustOptions
- type ValList
- type ValSetChanges
Constants ¶
const MULTI_PEER_BISECTION_PATH = "./tests/json/bisection/multi_peer/"
const SINGLE_PEER_BISECTION_PATH = "./tests/json/bisection/single_peer/"
const (
SINGLE_STEP_SEQ_PATH = "./tests/json/single_step/sequential/"
)
const (
SINGLE_STEP_SKIPPING_PATH = "./tests/json/single_step/skipping/"
)
const (
TRUSTING_PERIOD = 3 * time.Hour
)
Variables ¶
This section is empty.
Functions ¶
func GenerateManyHeaderBisectionCases ¶
func GenerateManyHeaderBisectionCases(jsonValList string)
func GenerateSingleStepSequentialCases ¶
func GenerateSingleStepSequentialCases(jsonValList string)
GenerateSingleStepSequentialCases creates three json files each for validator set, commit and header cases These cases are categorized according to the data structure it is trying to test (e.g. Validator set, Commit, etc...) It produces cases that test the single step sequential verification what this means is, given a trusted state and height can the lite node verify the next block height?
func GenerateSingleStepSkippingCases ¶
func GenerateSingleStepSkippingCases(jsonValList string)
GenerateSingleStepSkippingCases creates three json files each for validator set, commit and header cases These cases test the single step skipping verification which means, given a trusted height and state can the lite node jump to a certain block height?
func GenerateValList ¶
GenerateValList produces a val_list.json file which contains a list validators and privVals of given number abd voting power
func NewState ¶
func NewState(chainID string, valSet *types.ValidatorSet, nextValSet *types.ValidatorSet) st.State
NewState is used to initiate a state that will be used and manipulated by functions to create blocks for the "simulated" blockchain It creates an INITIAL state with the given parameters
Types ¶
type Initial ¶
type Initial struct { SignedHeader types.SignedHeader `json:"signed_header"` NextValidatorSet types.ValidatorSet `json:"next_validator_set"` TrustingPeriod time.Duration `json:"trusting_period"` Now time.Time `json:"now"` }
Initial stores the data required by a test case to set the context i.e. the initial state to begin the test from
type LiteBlock ¶
type LiteBlock struct { SignedHeader types.SignedHeader `json:"signed_header"` ValidatorSet types.ValidatorSet `json:"validator_set"` NextValidatorSet types.ValidatorSet `json:"next_validator_set"` }
LiteBlock refers to the minimum data a lite client interacts with. Essentially, it only requires a SignedHeader and Validator Set for current and next height
type MockProvider ¶
type MockProvider struct { ChainId string `json:"chain_id"` LiteBlocks []LiteBlock `json:"lite_blocks"` }
func (MockProvider) ChainID ¶
func (mp MockProvider) ChainID() string
func (MockProvider) Copy ¶
func (mp MockProvider) Copy() MockProvider
func (MockProvider) New ¶
func (mp MockProvider) New(chainID string, liteBlocks []LiteBlock) MockProvider
func (MockProvider) SignedHeader ¶
func (mp MockProvider) SignedHeader(height int64) (*types.SignedHeader, error)
func (MockProvider) ValidatorSet ¶
func (mp MockProvider) ValidatorSet(height int64) (*types.ValidatorSet, error)
type TestBisection ¶
type TestBisection struct { Description string `json:"description"` TrustOptions TrustOptions `json:"trust_options"` Primary MockProvider `json:"primary"` Witnesses []provider.Provider `json:"witnesses"` HeightToVerify int64 `json:"height_to_verify"` Now time.Time `json:"now"` ExpectedOutput string `json:"expected_output"` ExpectedBisections int32 `json:"expected_num_of_bisections"` }
type TestCase ¶
type TestCase struct { Description string `json:"description"` Initial Initial `json:"initial"` Input []LiteBlock `json:"input"` ExpectedOutput string `json:"expected_output"` }
TestCase stores all the necessary information for single step test cases to perform verification test on the data given
type TrustOptions ¶
type ValList ¶
type ValList struct { Validators []*types.Validator `json:"validators"` PrivVals types.PrivValidatorsByAddress `json:"priv_val"` }
ValList stores a list of validators and privVals It is populated from the lite-client/tests/json/val_list.json It used to have a predefined set of validators for mocking the test data
func GetValList ¶
GetValList reads the validators and privals list in the file unmarshals it to ValList struct "file" parameter specifies the path to the val_list.json file
type ValSetChanges ¶
type ValSetChanges []ValList