proxy

package
v0.0.0-...-dcd92f1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2022 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthProver        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowProver          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupProver = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ConnectionVersion         = connectiontypes.ExportedVersionsToProto(connectiontypes.GetCompatibleVersions())[0]
	DefaultDelayPeriod uint64 = 0
)

Functions

func RegisterInterfaces

func RegisterInterfaces(registry codectypes.InterfaceRegistry)

RegisterInterfaces register the module interfaces to protobuf Any.

func UpdateUpstreamClient

func UpdateUpstreamClient(upstream *core.ProvableChain) error

Types

type DownstreamConfig

type DownstreamConfig struct {
	ProxyChain       *types.Any `protobuf:"bytes,1,opt,name=proxy_chain,json=proxyChain,proto3" json:"proxy_chain,omitempty"`
	ProxyChainProver *types.Any `protobuf:"bytes,2,opt,name=proxy_chain_prover,json=proxyChainProver,proto3" json:"proxy_chain_prover,omitempty"`
	// the client id corresponding to the upstream on the proxy machine
	// TODO this parameter should be moved into a path configuration
	UpstreamClientId string `protobuf:"bytes,3,opt,name=upstream_client_id,json=upstreamClientId,proto3" json:"upstream_client_id,omitempty"`
}

func (*DownstreamConfig) Descriptor

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

func (*DownstreamConfig) GetProxyChain

func (m *DownstreamConfig) GetProxyChain() *types.Any

func (*DownstreamConfig) GetProxyChainProver

func (m *DownstreamConfig) GetProxyChainProver() *types.Any

func (*DownstreamConfig) GetUpstreamClientId

func (m *DownstreamConfig) GetUpstreamClientId() string

func (*DownstreamConfig) Marshal

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

func (*DownstreamConfig) MarshalTo

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

func (*DownstreamConfig) MarshalToSizedBuffer

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

func (*DownstreamConfig) ProtoMessage

func (*DownstreamConfig) ProtoMessage()

func (*DownstreamConfig) Reset

func (m *DownstreamConfig) Reset()

func (*DownstreamConfig) Size

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

func (*DownstreamConfig) String

func (m *DownstreamConfig) String() string

func (*DownstreamConfig) Unmarshal

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

func (*DownstreamConfig) UnpackInterfaces

func (cfg *DownstreamConfig) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error

func (*DownstreamConfig) XXX_DiscardUnknown

func (m *DownstreamConfig) XXX_DiscardUnknown()

func (*DownstreamConfig) XXX_Marshal

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

func (*DownstreamConfig) XXX_Merge

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

func (*DownstreamConfig) XXX_Size

func (m *DownstreamConfig) XXX_Size() int

func (*DownstreamConfig) XXX_Unmarshal

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

type MultiVProver

type MultiVProver struct {
	core.ProverI
}

func NewMultiVProver

func NewMultiVProver(prover core.ProverI) *MultiVProver

func (*MultiVProver) CreateMsgCreateClient

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

type Prover

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

func NewProver

func NewProver(chain core.ChainI, prover core.ProverI, upstreamConfig *UpstreamConfig, downstreamConfig *DownstreamConfig) (*Prover, error)

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) GetChainID

func (pr *Prover) GetChainID() string

GetChainID returns the chain ID

func (*Prover) GetLatestLightHeight

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

GetLatestLightHeight returns the latest height on the light client

func (*Prover) GetUnderlyingProver

func (pr *Prover) GetUnderlyingProver() core.ProverI

func (*Prover) Init

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

Init ...

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) SetRelayInfo

func (pr *Prover) SetRelayInfo(path *core.PathEnd, counterparty *core.ProvableChain, counterpartyPath *core.PathEnd) error

SetRelayInfo sets source's path and counterparty's info to the chain

func (*Prover) SetupForRelay

func (pr *Prover) SetupForRelay(ctx context.Context) error

func (*Prover) SetupHeader

func (pr *Prover) SetupHeader(dst core.LightClientIBCQueryierI, baseSrcHeader core.HeaderI) (core.HeaderI, error)

SetupHeader creates a new header based on a given header

func (*Prover) UpdateLightWithHeader

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

UpdateLightWithHeader updates a header on the light client and returns the header and height corresponding to the chain

type ProverConfig

type ProverConfig struct {
	Prover     *types.Any        `protobuf:"bytes,1,opt,name=prover,proto3" json:"prover,omitempty"`
	Upstream   *UpstreamConfig   `protobuf:"bytes,2,opt,name=upstream,proto3" json:"upstream,omitempty"`
	Downstream *DownstreamConfig `protobuf:"bytes,3,opt,name=downstream,proto3" json:"downstream,omitempty"`
}

func (ProverConfig) Build

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

func (*ProverConfig) Descriptor

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

func (*ProverConfig) GetDownstream

func (m *ProverConfig) GetDownstream() *DownstreamConfig

func (*ProverConfig) GetProver

func (m *ProverConfig) GetProver() *types.Any

func (*ProverConfig) GetUpstream

func (m *ProverConfig) GetUpstream() *UpstreamConfig

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) UnpackInterfaces

func (cfg *ProverConfig) UnpackInterfaces(unpacker codectypes.AnyUnpacker) 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

type ProxyChainConfigI

type ProxyChainConfigI interface {
	proto.Message
	Build() (ProxyChainI, error)
}

type ProxyChainI

type ProxyChainI interface {
	core.ChainI
	ProxyChainQueryierI

	SetProxyPath(ProxyPath)
	ProxyPath() ProxyPath
}

type ProxyChainProverConfigI

type ProxyChainProverConfigI interface {
	proto.Message
	Build(ProxyChainI) (ProxyChainProverI, error)
}

type ProxyChainProverI

type ProxyChainProverI interface {
	core.ProverI
	ProxyChainProverQueryierI
}

type ProxyChainProverQueryierI

type ProxyChainProverQueryierI interface {
	QueryProxyClientStateWithProof(height int64) (*clienttypes.QueryClientStateResponse, error)
	QueryProxyClientConsensusStateWithProof(height int64, dstClientConsHeight ibcexported.Height) (*clienttypes.QueryConsensusStateResponse, error)
	QueryProxyConnectionStateWithProof(height int64) (*connectiontypes.QueryConnectionResponse, error)
	QueryProxyChannelWithProof(height int64) (chanRes *chantypes.QueryChannelResponse, err error)
	QueryProxyPacketCommitmentWithProof(height int64, seq uint64) (comRes *chantypes.QueryPacketCommitmentResponse, err error)
	QueryProxyPacketAcknowledgementCommitmentWithProof(height int64, seq uint64) (ackRes *chantypes.QueryPacketAcknowledgementResponse, err error)
}

type ProxyChainQueryierI

type ProxyChainQueryierI interface {
	QueryProxyClientState(height int64) (*clienttypes.QueryClientStateResponse, error)
	QueryProxyClientConsensusState(height int64, dstClientConsHeight ibcexported.Height) (*clienttypes.QueryConsensusStateResponse, error)
	QueryProxyConnectionState(height int64) (*connectiontypes.QueryConnectionResponse, error)
	QueryProxyChannel(height int64) (chanRes *chantypes.QueryChannelResponse, err error)
	QueryProxyPacketCommitment(height int64, seq uint64) (comRes *chantypes.QueryPacketCommitmentResponse, err error)
	QueryProxyPacketAcknowledgementCommitment(height int64, seq uint64) (ackRes *chantypes.QueryPacketAcknowledgementResponse, err error)
}

type ProxyPath

type ProxyPath struct {
	UpstreamClientID string
	UpstreamChain    core.ChainI
}

type ProxyProvableChain

type ProxyProvableChain struct {
	ProxyChainI
	ProxyChainProverI
}

func NewDownstreamProxy

func NewDownstreamProxy(config *DownstreamConfig, chain core.ChainI) *ProxyProvableChain

func NewProxyProvableChain

func NewProxyProvableChain(chain ProxyChainI, prover ProxyChainProverI) *ProxyProvableChain

func NewUpstreamProxy

func NewUpstreamProxy(config *UpstreamConfig, chain core.ChainI) *ProxyProvableChain

func (*ProxyProvableChain) Init

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

func (*ProxyProvableChain) SetRelayInfo

func (pc *ProxyProvableChain) SetRelayInfo(path *core.PathEnd, counterparty *core.ProvableChain, counterpartyPath *core.PathEnd) error

type ProxySynchronizer

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

func NewProxySynchronizer

func NewProxySynchronizer(
	path *core.PathEnd,
	upstream *core.ProvableChain,
	downstreamProver core.ProverI,
	upstreamProxy *ProxyProvableChain,
	downstreamProxy *ProxyProvableChain,
) *ProxySynchronizer

func (ProxySynchronizer) SyncALL

func (ps ProxySynchronizer) SyncALL() error

func (ProxySynchronizer) SyncChannelOpenAck

func (ps ProxySynchronizer) SyncChannelOpenAck() error

func (ProxySynchronizer) SyncChannelOpenConfirm

func (ps ProxySynchronizer) SyncChannelOpenConfirm() error

func (ProxySynchronizer) SyncChannelOpenInit

func (ps ProxySynchronizer) SyncChannelOpenInit() error

func (ProxySynchronizer) SyncChannelOpenTry

func (ps ProxySynchronizer) SyncChannelOpenTry() error

func (ProxySynchronizer) SyncClientState

func (ps ProxySynchronizer) SyncClientState() error

func (ProxySynchronizer) SyncConnectionOpenAck

func (ps ProxySynchronizer) SyncConnectionOpenAck(counterpartyConnectionID string) error

func (ProxySynchronizer) SyncConnectionOpenConfirm

func (ps ProxySynchronizer) SyncConnectionOpenConfirm() error

func (ProxySynchronizer) SyncConnectionOpenInit

func (ps ProxySynchronizer) SyncConnectionOpenInit(connCP connectiontypes.Counterparty) error

func (ProxySynchronizer) SyncConnectionOpenTry

func (ps ProxySynchronizer) SyncConnectionOpenTry(connCP connectiontypes.Counterparty) error

func (ProxySynchronizer) SyncCreateClient

func (ps ProxySynchronizer) SyncCreateClient() error

SyncCreateClient creates an upstream client on the proxy

func (ProxySynchronizer) SyncRecvPacket

func (ps ProxySynchronizer) SyncRecvPacket(packet channeltypes.Packet) error

func (ProxySynchronizer) TrySyncChannelState

func (ps ProxySynchronizer) TrySyncChannelState() error

func (ProxySynchronizer) TrySyncClientState

func (ps ProxySynchronizer) TrySyncClientState() error

func (ProxySynchronizer) TrySyncConnectionState

func (ps ProxySynchronizer) TrySyncConnectionState() error

func (ProxySynchronizer) TrySyncPacketState

func (ps ProxySynchronizer) TrySyncPacketState() error

type ProxyUpdater

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

func NewProxyUpdater

func NewProxyUpdater(synchronizer *ProxySynchronizer) ProxyUpdater

func (ProxyUpdater) OnSentMsg

func (up ProxyUpdater) OnSentMsg(msgs []sdk.Msg) error

path: a path kept on upstream chain WARNING: This callback function calling may be skipped if the relayer is stopped for some reason.

type UpstreamConfig

type UpstreamConfig struct {
	ProxyChain       *types.Any `protobuf:"bytes,1,opt,name=proxy_chain,json=proxyChain,proto3" json:"proxy_chain,omitempty"`
	ProxyChainProver *types.Any `protobuf:"bytes,2,opt,name=proxy_chain_prover,json=proxyChainProver,proto3" json:"proxy_chain_prover,omitempty"`
	// the client id corresponding to the upstream on the proxy machine
	// TODO this parameter should be moved into a path configuration
	UpstreamClientId string `protobuf:"bytes,3,opt,name=upstream_client_id,json=upstreamClientId,proto3" json:"upstream_client_id,omitempty"`
}

func (*UpstreamConfig) Descriptor

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

func (*UpstreamConfig) GetProxyChain

func (m *UpstreamConfig) GetProxyChain() *types.Any

func (*UpstreamConfig) GetProxyChainProver

func (m *UpstreamConfig) GetProxyChainProver() *types.Any

func (*UpstreamConfig) GetUpstreamClientId

func (m *UpstreamConfig) GetUpstreamClientId() string

func (*UpstreamConfig) Marshal

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

func (*UpstreamConfig) MarshalTo

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

func (*UpstreamConfig) MarshalToSizedBuffer

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

func (*UpstreamConfig) ProtoMessage

func (*UpstreamConfig) ProtoMessage()

func (*UpstreamConfig) Reset

func (m *UpstreamConfig) Reset()

func (*UpstreamConfig) Size

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

func (*UpstreamConfig) String

func (m *UpstreamConfig) String() string

func (*UpstreamConfig) Unmarshal

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

func (*UpstreamConfig) UnpackInterfaces

func (cfg *UpstreamConfig) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error

func (*UpstreamConfig) XXX_DiscardUnknown

func (m *UpstreamConfig) XXX_DiscardUnknown()

func (*UpstreamConfig) XXX_Marshal

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

func (*UpstreamConfig) XXX_Merge

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

func (*UpstreamConfig) XXX_Size

func (m *UpstreamConfig) XXX_Size() int

func (*UpstreamConfig) XXX_Unmarshal

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

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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