tendermint

package
v0.0.0-...-22ee8c0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: Apache-2.0, Apache-2.0 Imports: 61 Imported by: 0

README

Tendermint

This implementation is a fork of cosmos/relayer

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthConfig        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowConfig          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupConfig = fmt.Errorf("proto: unexpected end of group")
)
View Source
var ErrLightNotInitialized = errors.New("light client is not initialized")

ErrLightNotInitialized returns the canonical error for a an uninitialized light client

Functions

func BuildSimTx

func BuildSimTx(txf tx.Factory, msgs ...sdk.Msg) ([]byte, error)

BuildSimTx creates an unsigned tx with an empty single signature and returns the encoded transaction or an error if the unsigned transaction cannot be built.

func CalculateGas

func CalculateGas(
	queryFunc func(string, []byte) ([]byte, int64, error), txf tx.Factory, msgs ...sdk.Msg,
) (txtypes.SimulateResponse, uint64, error)

CalculateGas simulates the execution of a transaction and returns the simulation response obtained by the query and the adjusted gas amount.

func CreateMnemonic

func CreateMnemonic() (string, error)

CreateMnemonic creates a new mnemonic

func MustGetHeight

func MustGetHeight(h ibcexported.Height) uint64

MustGetHeight takes the height inteface and returns the actual height

func RegisterInterfaces

func RegisterInterfaces(registry codectypes.InterfaceRegistry)

RegisterInterfaces register the module interfaces to protobuf Any.

Types

type Chain

type Chain struct {

	// TODO: make these private
	HomePath string           `yaml:"-" json:"-"`
	PathEnd  *core.PathEnd    `yaml:"-" json:"-"`
	Keybase  keys.Keyring     `yaml:"-" json:"-"`
	Client   rpcclient.Client `yaml:"-" json:"-"`
	// contains filtered or unexported fields
}

Chain represents the necessary data for connecting to and indentifying a chain and its counterparites

func (*Chain) CLIContext

func (c *Chain) CLIContext(height int64) sdkCtx.Context

CLIContext returns an instance of client.Context derived from Chain

func (*Chain) ChainID

func (c *Chain) ChainID() string

func (*Chain) ClientID

func (c *Chain) ClientID() string

func (*Chain) Codec

func (c *Chain) Codec() codec.ProtoCodecMarshaler

func (*Chain) Config

func (c *Chain) Config() ChainConfig

func (*Chain) ErrCantSetPath

func (c *Chain) ErrCantSetPath(err error) error

ErrCantSetPath returns an error if the path doesn't set properly

func (*Chain) GetAddress

func (c *Chain) GetAddress() (sdk.AccAddress, error)

GetAddress returns the sdk.AccAddress associated with the configred key

func (*Chain) GetLatestHeight

func (c *Chain) GetLatestHeight() (int64, error)

QueryLatestHeight queries the chain for the latest height and returns it

func (*Chain) Init

func (c *Chain) Init(homePath string, timeout time.Duration, codec codec.ProtoCodecMarshaler, debug bool) error

func (*Chain) Key

func (c *Chain) Key() string

func (*Chain) KeyExists

func (c *Chain) KeyExists(name string) bool

KeyExists returns true if there is a specified key in chain's keybase

func (*Chain) Log

func (c *Chain) Log(s string)

Log takes a string and logs the data

func (*Chain) LogFailedTx

func (c *Chain) LogFailedTx(res *sdk.TxResponse, err error, msgs []sdk.Msg)

LogFailedTx takes the transaction and the messages to create it and logs the appropriate data

func (*Chain) LogSuccessTx

func (c *Chain) LogSuccessTx(res *sdk.TxResponse, msgs []sdk.Msg)

LogSuccessTx take the transaction and the messages to create it and logs the appropriate data

func (*Chain) MustGetAddress

func (c *Chain) MustGetAddress() sdk.AccAddress

MustGetAddress used for brevity

func (*Chain) Path

func (c *Chain) Path() *core.PathEnd

func (*Chain) Print

func (c *Chain) Print(toPrint proto.Message, text, indent bool) error

Print fmt.Printlns the json or yaml representation of whatever is passed in CONTRACT: The cmd calling this function needs to have the "json" and "indent" flags set TODO: better "text" printing here would be a nice to have TODO: fix indenting all over the code base

func (*Chain) QueryBalance

func (c *Chain) QueryBalance(addr sdk.AccAddress) (sdk.Coins, error)

QueryBalance returns the amount of coins in the relayer account

func (*Chain) QueryChannel

func (c *Chain) QueryChannel(height int64) (chanRes *chantypes.QueryChannelResponse, err error)

QueryChannel returns the channel associated with a channelID

func (*Chain) QueryClientConsensusState

func (c *Chain) QueryClientConsensusState(
	height int64, dstClientConsHeight ibcexported.Height) (*clienttypes.QueryConsensusStateResponse, error)

QueryClientConsensusState retrevies the latest consensus state for a client in state at a given height

func (*Chain) QueryClientState

func (c *Chain) QueryClientState(height int64) (*clienttypes.QueryClientStateResponse, error)

QueryClientState retrevies the latest consensus state for a client in state at a given height

func (*Chain) QueryConnection

func (c *Chain) QueryConnection(height int64) (*conntypes.QueryConnectionResponse, error)

QueryConnection returns the remote end of a given connection

func (*Chain) QueryConsensusParams

func (c *Chain) QueryConsensusParams() (*abci.ConsensusParams, error)

QueryConsensusParams returns the consensus params

func (*Chain) QueryDenomTraces

func (c *Chain) QueryDenomTraces(offset, limit uint64, height int64) (*transfertypes.QueryDenomTracesResponse, error)

QueryDenomTraces returns all the denom traces from a given chain

func (*Chain) QueryHistoricalInfo

func (c *Chain) QueryHistoricalInfo(height clienttypes.Height) (*stakingtypes.QueryHistoricalInfoResponse, error)

QueryHistoricalInfo returns historical header data

func (*Chain) QueryPacket

func (src *Chain) QueryPacket(height int64, seq uint64) (*chantypes.Packet, error)

func (*Chain) QueryPacketAcknowledgement

func (dst *Chain) QueryPacketAcknowledgement(height int64, sequence uint64) ([]byte, error)

func (*Chain) QueryPacketAcknowledgementCommitment

func (c *Chain) QueryPacketAcknowledgementCommitment(height int64, seq uint64) (ackRes *chantypes.QueryPacketAcknowledgementResponse, err error)

QueryPacketAcknowledgementCommitment returns the packet ack proof at a given height

func (*Chain) QueryPacketAcknowledgementCommitments

func (c *Chain) QueryPacketAcknowledgementCommitments(offset, limit uint64, height int64) (comRes *chantypes.QueryPacketAcknowledgementsResponse, err error)

QueryPacketAcknowledgementCommitments returns an array of packet acks

func (*Chain) QueryPacketCommitment

func (c *Chain) QueryPacketCommitment(
	height int64, seq uint64) (comRes *chantypes.QueryPacketCommitmentResponse, err error)

QueryPacketCommitment returns the packet commitment proof at a given height

func (*Chain) QueryPacketCommitments

func (c *Chain) QueryPacketCommitments(
	offset, limit uint64, height int64) (comRes *chantypes.QueryPacketCommitmentsResponse, err error)

QueryPacketCommitments returns an array of packet commitments

func (*Chain) QueryPacketReciept

func (c *Chain) QueryPacketReciept(height int64, seq uint64) (recRes *chantypes.QueryPacketReceiptResponse, err error)

QueryPacketReciept returns the packet reciept proof at a given height

func (*Chain) QueryTxs

func (c *Chain) QueryTxs(height int64, page, limit int, events []string) ([]*ctypes.ResultTx, error)

QueryTxs returns an array of transactions given a tag

func (*Chain) QueryUnbondingPeriod

func (c *Chain) QueryUnbondingPeriod() (time.Duration, error)

QueryUnbondingPeriod returns the unbonding period of the chain

func (*Chain) QueryUnrecievedAcknowledgements

func (c *Chain) QueryUnrecievedAcknowledgements(height int64, seqs []uint64) ([]uint64, error)

QueryUnrecievedAcknowledgements returns a list of unrelayed packet acks

func (*Chain) QueryUnrecievedPackets

func (c *Chain) QueryUnrecievedPackets(height int64, seqs []uint64) ([]uint64, error)

QueryUnrecievedPackets returns a list of unrelayed packet commitments

func (*Chain) QueryValsetAtHeight

func (c *Chain) QueryValsetAtHeight(height clienttypes.Height) (*tmproto.ValidatorSet, error)

QueryValsetAtHeight returns the validator set at a given height

func (*Chain) Send

func (c *Chain) Send(msgs []sdk.Msg) bool

func (*Chain) SendMsgs

func (c *Chain) SendMsgs(msgs []sdk.Msg) ([]byte, error)

func (*Chain) SetPath

func (c *Chain) SetPath(p *core.PathEnd) error

SetPath sets the path and validates the identifiers

func (*Chain) StartEventListener

func (c *Chain) StartEventListener(dst core.ChainI, strategy core.StrategyI)

func (*Chain) TxFactory

func (c *Chain) TxFactory(height int64) tx.Factory

TxFactory returns an instance of tx.Factory derived from

func (*Chain) UseSDKContext

func (c *Chain) UseSDKContext() func()

UseSDKContext uses a custom Bech32 account prefix and returns a restore func CONTRACT: When using this function, caller must ensure that lock contention doesn't cause program to hang. This function is only for use in codec calls

type ChainConfig

type ChainConfig struct {
	Key           string  `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	ChainId       string  `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
	RpcAddr       string  `protobuf:"bytes,3,opt,name=rpc_addr,json=rpcAddr,proto3" json:"rpc_addr,omitempty"`
	AccountPrefix string  `protobuf:"bytes,4,opt,name=account_prefix,json=accountPrefix,proto3" json:"account_prefix,omitempty"`
	GasAdjustment float64 `protobuf:"fixed64,5,opt,name=gas_adjustment,json=gasAdjustment,proto3" json:"gas_adjustment,omitempty"`
	GasPrices     string  `protobuf:"bytes,6,opt,name=gas_prices,json=gasPrices,proto3" json:"gas_prices,omitempty"`
}

func (ChainConfig) Build

func (c ChainConfig) Build() (core.ChainI, error)

func (*ChainConfig) Descriptor

func (*ChainConfig) Descriptor() ([]byte, []int)

func (*ChainConfig) Marshal

func (m *ChainConfig) Marshal() (dAtA []byte, err error)

func (*ChainConfig) MarshalTo

func (m *ChainConfig) MarshalTo(dAtA []byte) (int, error)

func (*ChainConfig) MarshalToSizedBuffer

func (m *ChainConfig) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ChainConfig) ProtoMessage

func (*ChainConfig) ProtoMessage()

func (*ChainConfig) Reset

func (m *ChainConfig) Reset()

func (*ChainConfig) Size

func (m *ChainConfig) Size() (n int)

func (*ChainConfig) String

func (m *ChainConfig) String() string

func (*ChainConfig) Unmarshal

func (m *ChainConfig) Unmarshal(dAtA []byte) error

func (*ChainConfig) XXX_DiscardUnknown

func (m *ChainConfig) XXX_DiscardUnknown()

func (*ChainConfig) XXX_Marshal

func (m *ChainConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ChainConfig) XXX_Merge

func (m *ChainConfig) XXX_Merge(src proto.Message)

func (*ChainConfig) XXX_Size

func (m *ChainConfig) XXX_Size() int

func (*ChainConfig) XXX_Unmarshal

func (m *ChainConfig) XXX_Unmarshal(b []byte) error

type Prover

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

func NewProver

func NewProver(chain *Chain, config ProverConfig) *Prover

func (*Prover) CreateMsgCreateClient

func (pr *Prover) CreateMsgCreateClient(clientID string, dstHeader core.HeaderI, signer sdk.AccAddress) (*clienttypes.MsgCreateClient, error)

CreateMsgCreateClient creates a CreateClientMsg to this chain

func (*Prover) DeleteLightDB

func (pr *Prover) DeleteLightDB() error

DeleteLightDB removes the light client database on disk, forcing re-initialization

func (*Prover) GetChainID

func (pr *Prover) GetChainID() string

GetChainID returns the chain ID

func (*Prover) GetLatestLightHeader

func (pr *Prover) GetLatestLightHeader() (*tmclient.Header, error)

GetLatestLightHeader returns the header to be used for client creation

func (*Prover) GetLatestLightHeight

func (pr *Prover) GetLatestLightHeight() (int64, error)

GetLatestLightHeight uses the CLI utilities to pull the latest height from a given chain

func (*Prover) GetLightSignedHeaderAtHeight

func (pr *Prover) GetLightSignedHeaderAtHeight(height int64) (*tmclient.Header, error)

GetLightSignedHeaderAtHeight returns a signed header at a particular height.

func (*Prover) LightClient

func (pr *Prover) LightClient(db dbm.DB) (*light.Client, error)

LightClient initializes the light client for a given chain from the trusted store in the database this should be call for all other light client usage

func (*Prover) LightClientWithTrust

func (pr *Prover) LightClientWithTrust(db dbm.DB, to light.TrustOptions) (*light.Client, error)

LightClientWithTrust takes a header from the chain and attempts to add that header to the light database.

func (*Prover) LightClientWithoutTrust

func (pr *Prover) LightClientWithoutTrust(db dbm.DB) (*light.Client, error)

LightClientWithoutTrust querys the latest header from the chain and initializes a new light client database using that header. This should only be called when first initializing the light client

func (*Prover) LightHTTP

func (pr *Prover) LightHTTP() lightp.Provider

LightHTTP returns the http client for light clients

func (*Prover) NewLightDB

func (pr *Prover) NewLightDB() (db *dbm.GoLevelDB, df func(), err error)

func (*Prover) QueryChannelWithProof

func (pr *Prover) QueryChannelWithProof(height int64) (chanRes *chantypes.QueryChannelResponse, err error)

QueryChannelWithProof returns the Channel and its proof

func (*Prover) QueryClientConsensusStateWithProof

func (pr *Prover) QueryClientConsensusStateWithProof(height int64, dstClientConsHeight ibcexported.Height) (*clienttypes.QueryConsensusStateResponse, error)

QueryClientConsensusState returns the ClientConsensusState and its proof

func (*Prover) QueryClientStateWithProof

func (pr *Prover) QueryClientStateWithProof(height int64) (*clienttypes.QueryClientStateResponse, error)

QueryClientStateWithProof returns the ClientState and its proof

func (*Prover) QueryConnectionWithProof

func (pr *Prover) QueryConnectionWithProof(height int64) (*conntypes.QueryConnectionResponse, error)

QueryConnectionWithProof returns the Connection and its proof

func (*Prover) QueryLatestHeader

func (pr *Prover) QueryLatestHeader() (out core.HeaderI, err error)

QueryLatestHeader returns the latest header from the chain

func (*Prover) QueryPacketAcknowledgementCommitmentWithProof

func (pr *Prover) QueryPacketAcknowledgementCommitmentWithProof(height int64, seq uint64) (ackRes *chantypes.QueryPacketAcknowledgementResponse, err error)

QueryPacketAcknowledgementCommitmentWithProof returns the packet acknowledgement commitment and its proof

func (*Prover) QueryPacketCommitmentWithProof

func (pr *Prover) QueryPacketCommitmentWithProof(height int64, seq uint64) (comRes *chantypes.QueryPacketCommitmentResponse, err error)

QueryPacketCommitmentWithProof returns the packet commitment and its proof

func (*Prover) SetupHeader

func (pr *Prover) SetupHeader(dstChain core.LightClientIBCQueryierI, srcHeader core.HeaderI) (core.HeaderI, error)

SetupHeader creates a new header based on a given header

func (*Prover) TrustOptions

func (pr *Prover) TrustOptions(height int64, hash []byte) light.TrustOptions

TrustOptions returns light.TrustOptions given a height and hash

func (*Prover) UpdateLightWithHeader

func (pr *Prover) UpdateLightWithHeader() (header core.HeaderI, provableHeight int64, queryableHeight int64, err error)

UpdateLightWithHeader calls client.Update and then .

type ProverConfig

type ProverConfig struct {
	TrustingPeriod string `protobuf:"bytes,1,opt,name=trusting_period,json=trustingPeriod,proto3" json:"trusting_period,omitempty"`
}

func (ProverConfig) Build

func (c ProverConfig) Build(chain core.ChainI) (core.ProverI, error)

func (*ProverConfig) Descriptor

func (*ProverConfig) Descriptor() ([]byte, []int)

func (*ProverConfig) Marshal

func (m *ProverConfig) Marshal() (dAtA []byte, err error)

func (*ProverConfig) MarshalTo

func (m *ProverConfig) MarshalTo(dAtA []byte) (int, error)

func (*ProverConfig) MarshalToSizedBuffer

func (m *ProverConfig) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ProverConfig) ProtoMessage

func (*ProverConfig) ProtoMessage()

func (*ProverConfig) Reset

func (m *ProverConfig) Reset()

func (*ProverConfig) Size

func (m *ProverConfig) Size() (n int)

func (*ProverConfig) String

func (m *ProverConfig) String() string

func (*ProverConfig) Unmarshal

func (m *ProverConfig) Unmarshal(dAtA []byte) error

func (*ProverConfig) XXX_DiscardUnknown

func (m *ProverConfig) XXX_DiscardUnknown()

func (*ProverConfig) XXX_Marshal

func (m *ProverConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ProverConfig) XXX_Merge

func (m *ProverConfig) XXX_Merge(src proto.Message)

func (*ProverConfig) XXX_Size

func (m *ProverConfig) XXX_Size() int

func (*ProverConfig) XXX_Unmarshal

func (m *ProverConfig) XXX_Unmarshal(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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