localstatequery

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package localstatequery implements the Ouroboros local-state-query protocol

Index

Constants

View Source
const (
	MessageTypeAcquire          = 0
	MessageTypeAcquired         = 1
	MessageTypeFailure          = 2
	MessageTypeQuery            = 3
	MessageTypeResult           = 4
	MessageTypeRelease          = 5
	MessageTypeReacquire        = 6
	MessageTypeDone             = 7
	MessageTypeAcquireNoPoint   = 8
	MessageTypeReacquireNoPoint = 9
)

Message types

View Source
const (
	AcquireFailurePointTooOld     = 0
	AcquireFailurePointNotOnChain = 1
)

Acquire failure reasons

View Source
const (
	QueryTypeBlock        = 0
	QueryTypeSystemStart  = 1
	QueryTypeChainBlockNo = 2
	QueryTypeChainPoint   = 3

	// Block query sub-types
	QueryTypeShelley  = 0
	QueryTypeHardFork = 2

	// Hard fork query sub-types
	QueryTypeHardForkEraHistory = 0
	QueryTypeHardForkCurrentEra = 1

	// Shelley query sub-types
	QueryTypeShelleyLedgerTip                           = 0
	QueryTypeShelleyEpochNo                             = 1
	QueryTypeShelleyNonMyopicMemberRewards              = 2
	QueryTypeShelleyCurrentProtocolParams               = 3
	QueryTypeShelleyProposedProtocolParamsUpdates       = 4
	QueryTypeShelleyStakeDistribution                   = 5
	QueryTypeShelleyUtxoByAddress                       = 6
	QueryTypeShelleyUtxoWhole                           = 7
	QueryTypeShelleyDebugEpochState                     = 8
	QueryTypeShelleyCbor                                = 9
	QueryTypeShelleyFilteredDelegationAndRewardAccounts = 10
	QueryTypeShelleyGenesisConfig                       = 11
	QueryTypeShelleyDebugNewEpochState                  = 12
	QueryTypeShelleyDebugChainDepState                  = 13
	QueryTypeShelleyRewardProvenance                    = 14
	QueryTypeShelleyUtxoByTxin                          = 15
	QueryTypeShelleyStakePools                          = 16
	QueryTypeShelleyStakePoolParams                     = 17
	QueryTypeShelleyRewardInfoPools                     = 18
	QueryTypeShelleyPoolState                           = 19
	QueryTypeShelleyStakeSnapshots                      = 20
	QueryTypeShelleyPoolDistr                           = 21
)

Query types

Variables

View Source
var StateMap = protocol.StateMap{
	// contains filtered or unexported fields
}

LocalStateQuery protocol state machine

Functions

func NewMsgFromCbor

func NewMsgFromCbor(msgType uint, data []byte) (protocol.Message, error)

NewMsgFromCbor parses a LocalStateQuery message from CBOR

Types

type AcquireFailurePointNotOnChainError added in v0.21.0

type AcquireFailurePointNotOnChainError struct {
}

AcquireFailurePointNotOnChainError indicates a failure to acquire a point due to it not being present on the chain

func (AcquireFailurePointNotOnChainError) Error added in v0.21.0

type AcquireFailurePointTooOldError added in v0.21.0

type AcquireFailurePointTooOldError struct {
}

AcquireFailurePointTooOldError indicates a failure to acquire a point due to it being too old

func (AcquireFailurePointTooOldError) Error added in v0.21.0

type AcquireFunc

type AcquireFunc func(interface{}) error

Callback function types TODO: update callbacks

type Client added in v0.19.0

type Client struct {
	*protocol.Protocol
	// contains filtered or unexported fields
}

Client implements the LocalStateQuery client

func NewClient added in v0.19.0

func NewClient(protoOptions protocol.ProtocolOptions, cfg *Config) *Client

NewClient returns a new LocalStateQuery client object

func (*Client) Acquire added in v0.21.0

func (c *Client) Acquire(point *common.Point) error

Acquire starts the acquire process for the specified chain point

func (*Client) DebugChainDepState added in v0.21.0

func (c *Client) DebugChainDepState() (*DebugChainDepStateResult, error)

TODO

func (*Client) DebugEpochState added in v0.21.0

func (c *Client) DebugEpochState() (*DebugEpochStateResult, error)

TODO

func (*Client) DebugNewEpochState added in v0.21.0

func (c *Client) DebugNewEpochState() (*DebugNewEpochStateResult, error)

TODO

func (*Client) GetChainBlockNo added in v0.21.0

func (c *Client) GetChainBlockNo() (int64, error)

GetChainBlockNo returns the latest block number

func (*Client) GetChainPoint added in v0.21.0

func (c *Client) GetChainPoint() (*common.Point, error)

GetChainPoint returns the current chain tip

func (*Client) GetCurrentEra added in v0.21.0

func (c *Client) GetCurrentEra() (int, error)

GetCurrentEra returns the current era ID

func (*Client) GetCurrentProtocolParams added in v0.21.0

func (c *Client) GetCurrentProtocolParams() (*CurrentProtocolParamsResult, error)

GetCurrentProtocolParams returns the set of protocol params that are currently in effect

func (*Client) GetEpochNo added in v0.21.0

func (c *Client) GetEpochNo() (int, error)

GetEpochNo returns the current epoch number

func (*Client) GetEraHistory added in v0.21.0

func (c *Client) GetEraHistory() ([]EraHistoryResult, error)

GetEraHistory returns the era history

func (*Client) GetFilteredDelegationsAndRewardAccounts added in v0.21.0

func (c *Client) GetFilteredDelegationsAndRewardAccounts(creds []interface{}) (*FilteredDelegationsAndRewardAccountsResult, error)

TODO

func (*Client) GetGenesisConfig added in v0.21.0

func (c *Client) GetGenesisConfig() (*GenesisConfigResult, error)

TODO

func (*Client) GetNonMyopicMemberRewards added in v0.21.0

func (c *Client) GetNonMyopicMemberRewards() (*NonMyopicMemberRewardsResult, error)

TODO

func (*Client) GetPoolDistr added in v0.21.0

func (c *Client) GetPoolDistr(poolIds []interface{}) (*PoolDistrResult, error)

TODO

func (*Client) GetPoolState added in v0.21.0

func (c *Client) GetPoolState(poolIds []interface{}) (*PoolStateResult, error)

TODO

func (*Client) GetProposedProtocolParamsUpdates added in v0.21.0

func (c *Client) GetProposedProtocolParamsUpdates() (*ProposedProtocolParamsUpdatesResult, error)

TODO

func (*Client) GetRewardInfoPools added in v0.21.0

func (c *Client) GetRewardInfoPools() (*RewardInfoPoolsResult, error)

TODO

func (*Client) GetRewardProvenance added in v0.21.0

func (c *Client) GetRewardProvenance() (*RewardProvenanceResult, error)

TODO

func (*Client) GetStakeDistribution added in v0.21.0

func (c *Client) GetStakeDistribution() (*StakeDistributionResult, error)

GetStakeDistribution returns the stake distribution

func (*Client) GetStakePoolParams added in v0.21.0

func (c *Client) GetStakePoolParams(poolIds []interface{}) (*StakePoolParamsResult, error)

TODO

func (*Client) GetStakePools added in v0.21.0

func (c *Client) GetStakePools() (*StakePoolsResult, error)

TODO

func (*Client) GetStakeSnapshots added in v0.21.0

func (c *Client) GetStakeSnapshots(poolId interface{}) (*StakeSnapshotsResult, error)

TODO

func (*Client) GetSystemStart added in v0.21.0

func (c *Client) GetSystemStart() (*SystemStartResult, error)

GetSystemStart returns the SystemStart value

func (*Client) GetUTxOByAddress added in v0.21.0

func (c *Client) GetUTxOByAddress(addrs []interface{}) (*UTxOByAddressResult, error)

TODO

func (*Client) GetUTxOByTxIn added in v0.21.0

func (c *Client) GetUTxOByTxIn(txins []interface{}) (*UTxOByTxInResult, error)

TODO

func (*Client) GetUTxOWhole added in v0.21.0

func (c *Client) GetUTxOWhole() (*UTxOWholeResult, error)

TODO

func (*Client) Release added in v0.21.0

func (c *Client) Release() error

Release releases the previously acquired chain point

type Config added in v0.18.0

type Config struct {
	AcquireFunc    AcquireFunc
	QueryFunc      QueryFunc
	ReleaseFunc    ReleaseFunc
	ReAcquireFunc  ReAcquireFunc
	DoneFunc       DoneFunc
	AcquireTimeout time.Duration
	QueryTimeout   time.Duration
}

Config is used to configure the LocalStateQuery protocol instance

func NewConfig added in v0.25.0

func NewConfig(options ...LocalStateQueryOptionFunc) Config

NewConfig returns a new LocalStateQuery config object with the provided options

type CurrentProtocolParamsResult added in v0.21.0

type CurrentProtocolParamsResult struct {
	MinFeeA            int
	MinFeeB            int
	MaxBlockBodySize   int
	MaxTxSize          int
	MaxBlockHeaderSize int
	KeyDeposit         int
	PoolDeposit        int
	EMax               int
	NOpt               int
	A0                 []int
	Rho                []int
	Tau                []int
	// This field no longer exists in Babbage, but we're keeping this here for reference
	// unless we need to support querying a node still on an older era
	//DecentralizationParam  []int
	ProtocolVersionMajor   int
	ProtocolVersionMinor   int
	MinPoolCost            int
	Unknown                interface{}
	CostModels             interface{}
	ExecutionUnitPrices    interface{} // [priceMemory priceSteps]	both elements are fractions
	MaxTxExecutionUnits    []uint
	MaxBlockExecutionUnits []uint
	MaxValueSize           int
	CollateralPercentage   int
	// contains filtered or unexported fields
}

type DebugChainDepStateResult added in v0.21.0

type DebugChainDepStateResult interface{}

type DebugEpochStateResult added in v0.21.0

type DebugEpochStateResult interface{}

type DebugNewEpochStateResult added in v0.21.0

type DebugNewEpochStateResult interface{}

TODO

type DoneFunc

type DoneFunc func() error

type EraHistoryResult added in v0.21.0

type EraHistoryResult struct {
	Begin  eraHistoryResultBeginEnd
	End    eraHistoryResultBeginEnd
	Params eraHistoryResultParams
	// contains filtered or unexported fields
}

type FilteredDelegationsAndRewardAccountsResult added in v0.21.0

type FilteredDelegationsAndRewardAccountsResult interface{}

type GenesisConfigResult added in v0.21.0

type GenesisConfigResult struct {
	Start             SystemStartResult
	NetworkMagic      int
	NetworkId         uint8
	ActiveSlotsCoeff  []interface{}
	SecurityParam     int
	EpochLength       int
	SlotsPerKESPeriod int
	MaxKESEvolutions  int
	SlotLength        int
	UpdateQuorum      int
	MaxLovelaceSupply int64
	ProtocolParams    struct {
		MinFeeA               int
		MinFeeB               int
		MaxBlockBodySize      int
		MaxTxSize             int
		MaxBlockHeaderSize    int
		KeyDeposit            int
		PoolDeposit           int
		EMax                  int
		NOpt                  int
		A0                    []int
		Rho                   []int
		Tau                   []int
		DecentralizationParam []int
		ExtraEntropy          interface{}
		ProtocolVersionMajor  int
		ProtocolVersionMinor  int
		MinUTxOValue          int
		MinPoolCost           int
		// contains filtered or unexported fields
	}
	// This value contains maps with bytestring keys, which we can't parse yet
	GenDelegs cbor.RawMessage
	Unknown1  interface{}
	Unknown2  interface{}
	// contains filtered or unexported fields
}

type LocalStateQuery

type LocalStateQuery struct {
	Client *Client
	Server *Server
}

LocalStateQuery is a wrapper object that holds the client and server instances

func New

func New(protoOptions protocol.ProtocolOptions, cfg *Config) *LocalStateQuery

New returns a new LocalStateQuery object

type LocalStateQueryOptionFunc added in v0.25.0

type LocalStateQueryOptionFunc func(*Config)

LocalStateQueryOptionFunc represents a function used to modify the LocalStateQuery protocol config

func WithAcquireFunc added in v0.25.0

func WithAcquireFunc(acquireFunc AcquireFunc) LocalStateQueryOptionFunc

WithAcquireFunc specifies the Acquire callback function when acting as a server

func WithAcquireTimeout added in v0.25.0

func WithAcquireTimeout(timeout time.Duration) LocalStateQueryOptionFunc

WithAcquireTimeout specifies the timeout for the Acquire operation when acting as a client

func WithDoneFunc added in v0.25.0

func WithDoneFunc(doneFunc DoneFunc) LocalStateQueryOptionFunc

WithDoneFunc specifies the Done callback function when acting as a server

func WithQueryFunc added in v0.25.0

func WithQueryFunc(queryFunc QueryFunc) LocalStateQueryOptionFunc

WithQueryFunc specifies the Query callback function when acting as a server

func WithQueryTimeout added in v0.25.0

func WithQueryTimeout(timeout time.Duration) LocalStateQueryOptionFunc

WithQueryTimeout specifies the timeout for the Query operation when acting as a client

func WithReAcquireFunc added in v0.25.0

func WithReAcquireFunc(reAcquireFunc ReAcquireFunc) LocalStateQueryOptionFunc

WithReAcquireFunc specifies the ReAcquire callback function when acting as a server

func WithReleaseFunc added in v0.25.0

func WithReleaseFunc(releaseFunc ReleaseFunc) LocalStateQueryOptionFunc

WithReleaseFunc specifies the Release callback function when acting as a server

type MsgAcquire

type MsgAcquire struct {
	protocol.MessageBase
	Point common.Point
}

func NewMsgAcquire

func NewMsgAcquire(point common.Point) *MsgAcquire

type MsgAcquireNoPoint

type MsgAcquireNoPoint struct {
	protocol.MessageBase
}

func NewMsgAcquireNoPoint

func NewMsgAcquireNoPoint() *MsgAcquireNoPoint

type MsgAcquired

type MsgAcquired struct {
	protocol.MessageBase
}

func NewMsgAcquired

func NewMsgAcquired() *MsgAcquired

type MsgDone

type MsgDone struct {
	protocol.MessageBase
}

func NewMsgDone

func NewMsgDone() *MsgDone

type MsgFailure

type MsgFailure struct {
	protocol.MessageBase
	Failure uint8
}

func NewMsgFailure

func NewMsgFailure(failure uint8) *MsgFailure

type MsgQuery

type MsgQuery struct {
	protocol.MessageBase
	Query interface{}
}

func NewMsgQuery

func NewMsgQuery(query interface{}) *MsgQuery

type MsgReAcquire

type MsgReAcquire struct {
	protocol.MessageBase
	Point common.Point
}

func NewMsgReAcquire

func NewMsgReAcquire(point common.Point) *MsgReAcquire

type MsgReAcquireNoPoint

type MsgReAcquireNoPoint struct {
	protocol.MessageBase
}

func NewMsgReAcquireNoPoint

func NewMsgReAcquireNoPoint() *MsgReAcquireNoPoint

type MsgRelease

type MsgRelease struct {
	protocol.MessageBase
}

func NewMsgRelease

func NewMsgRelease() *MsgRelease

type MsgResult

type MsgResult struct {
	protocol.MessageBase
	Result cbor.RawMessage
}

func NewMsgResult

func NewMsgResult(resultCbor []byte) *MsgResult

type NonMyopicMemberRewardsResult added in v0.21.0

type NonMyopicMemberRewardsResult interface{}

TODO

type PoolDistrResult added in v0.21.0

type PoolDistrResult interface{}

type PoolStateResult added in v0.21.0

type PoolStateResult interface{}

type ProposedProtocolParamsUpdatesResult added in v0.21.0

type ProposedProtocolParamsUpdatesResult interface{}

TODO

type QueryFunc

type QueryFunc func(interface{}) error

type ReAcquireFunc

type ReAcquireFunc func(interface{}) error

type ReleaseFunc

type ReleaseFunc func() error

type RewardInfoPoolsResult added in v0.21.0

type RewardInfoPoolsResult interface{}

type RewardProvenanceResult added in v0.21.0

type RewardProvenanceResult interface{}

type Server added in v0.19.0

type Server struct {
	*protocol.Protocol
	// contains filtered or unexported fields
}

Server implements the LocalStateQuery server

func NewServer added in v0.19.0

func NewServer(protoOptions protocol.ProtocolOptions, cfg *Config) *Server

NewServer returns a new LocalStateQuery server object

type StakeDistributionResult added in v0.21.0

type StakeDistributionResult interface{}

type StakePoolParamsResult added in v0.21.0

type StakePoolParamsResult interface{}

type StakePoolsResult added in v0.21.0

type StakePoolsResult interface{}

type StakeSnapshotsResult added in v0.21.0

type StakeSnapshotsResult interface{}

type SystemStartResult added in v0.21.0

type SystemStartResult struct {
	Year        int
	Day         int
	Picoseconds uint64
	// contains filtered or unexported fields
}

type UTxOByAddressResult added in v0.21.0

type UTxOByAddressResult interface{}

type UTxOByTxInResult added in v0.21.0

type UTxOByTxInResult interface{}

type UTxOWholeResult added in v0.21.0

type UTxOWholeResult interface{}

Jump to

Keyboard shortcuts

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