relay

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: Apache-2.0 Imports: 39 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultDialTimeout                 = 20 // seconds
	DefaultMessageAggregationBatchSize = 8
)
View Source
const ModuleName = "lcp-prover"

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 ErrEnclaveKeyInfoNotFound = errors.New("enclave key info not found")

Functions

func LCPCmd

func LCPCmd(ctx *config.Context) *cobra.Command

func RegisterInterfaces

func RegisterInterfaces(registry codectypes.InterfaceRegistry)

RegisterInterfaces register the module interfaces to protobuf Any.

Types

type Any added in v0.2.4

type Any struct {
	TypeURL string `json:"type_url"`
	Value   []byte `json:"value"`
}

type CreateELCResult added in v0.2.2

type CreateELCResult struct {
	Created bool                              `json:"created"`
	Message *lcptypes.UpdateStateProxyMessage `json:"message,omitempty"`
}

type EIP712CosmosChainParams added in v0.2.5

type EIP712CosmosChainParams struct {
	ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
	Prefix  string `protobuf:"bytes,2,opt,name=prefix,proto3" json:"prefix,omitempty"`
}

func (*EIP712CosmosChainParams) Descriptor added in v0.2.5

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

func (*EIP712CosmosChainParams) Marshal added in v0.2.5

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

func (*EIP712CosmosChainParams) MarshalTo added in v0.2.5

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

func (*EIP712CosmosChainParams) MarshalToSizedBuffer added in v0.2.5

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

func (*EIP712CosmosChainParams) ProtoMessage added in v0.2.5

func (*EIP712CosmosChainParams) ProtoMessage()

func (*EIP712CosmosChainParams) Reset added in v0.2.5

func (m *EIP712CosmosChainParams) Reset()

func (*EIP712CosmosChainParams) Size added in v0.2.5

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

func (*EIP712CosmosChainParams) String added in v0.2.5

func (m *EIP712CosmosChainParams) String() string

func (*EIP712CosmosChainParams) Unmarshal added in v0.2.5

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

func (*EIP712CosmosChainParams) XXX_DiscardUnknown added in v0.2.5

func (m *EIP712CosmosChainParams) XXX_DiscardUnknown()

func (*EIP712CosmosChainParams) XXX_Marshal added in v0.2.5

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

func (*EIP712CosmosChainParams) XXX_Merge added in v0.2.5

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

func (*EIP712CosmosChainParams) XXX_Size added in v0.2.5

func (m *EIP712CosmosChainParams) XXX_Size() int

func (*EIP712CosmosChainParams) XXX_Unmarshal added in v0.2.5

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

type EIP712DomainParams added in v0.2.5

type EIP712DomainParams struct {
	ChainId               uint64
	VerifyingContractAddr common.Address
}

type EIP712EVMChainParams added in v0.2.5

type EIP712EVMChainParams struct {
	ChainId                  uint64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
	VerifyingContractAddress string `` /* 135-byte string literal not displayed */
}

func (*EIP712EVMChainParams) Descriptor added in v0.2.5

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

func (*EIP712EVMChainParams) Marshal added in v0.2.5

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

func (*EIP712EVMChainParams) MarshalTo added in v0.2.5

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

func (*EIP712EVMChainParams) MarshalToSizedBuffer added in v0.2.5

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

func (*EIP712EVMChainParams) ProtoMessage added in v0.2.5

func (*EIP712EVMChainParams) ProtoMessage()

func (*EIP712EVMChainParams) Reset added in v0.2.5

func (m *EIP712EVMChainParams) Reset()

func (*EIP712EVMChainParams) Size added in v0.2.5

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

func (*EIP712EVMChainParams) String added in v0.2.5

func (m *EIP712EVMChainParams) String() string

func (*EIP712EVMChainParams) Unmarshal added in v0.2.5

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

func (*EIP712EVMChainParams) XXX_DiscardUnknown added in v0.2.5

func (m *EIP712EVMChainParams) XXX_DiscardUnknown()

func (*EIP712EVMChainParams) XXX_Marshal added in v0.2.5

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

func (*EIP712EVMChainParams) XXX_Merge added in v0.2.5

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

func (*EIP712EVMChainParams) XXX_Size added in v0.2.5

func (m *EIP712EVMChainParams) XXX_Size() int

func (*EIP712EVMChainParams) XXX_Unmarshal added in v0.2.5

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

type EIP712Signer added in v0.2.5

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

func NewEIP712Signer added in v0.2.5

func NewEIP712Signer(signer signer.Signer) *EIP712Signer

func (EIP712Signer) GetSignerAddress added in v0.2.5

func (s EIP712Signer) GetSignerAddress() (common.Address, error)

func (EIP712Signer) Sign added in v0.2.5

func (s EIP712Signer) Sign(commitment [32]byte) ([]byte, error)

type ELCMsgClient

type ELCMsgClient = elc.MsgClient

type ELCQueryClient

type ELCQueryClient = elc.QueryClient

type EnclaveQueryClient

type EnclaveQueryClient = enclave.QueryClient

type Fraction added in v0.2.5

type Fraction struct {
	Numerator   uint64 `protobuf:"varint,1,opt,name=numerator,proto3" json:"numerator,omitempty"`
	Denominator uint64 `protobuf:"varint,2,opt,name=denominator,proto3" json:"denominator,omitempty"`
}

func (*Fraction) Descriptor added in v0.2.5

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

func (*Fraction) Marshal added in v0.2.5

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

func (*Fraction) MarshalTo added in v0.2.5

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

func (*Fraction) MarshalToSizedBuffer added in v0.2.5

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

func (*Fraction) ProtoMessage added in v0.2.5

func (*Fraction) ProtoMessage()

func (*Fraction) Reset added in v0.2.5

func (m *Fraction) Reset()

func (*Fraction) Size added in v0.2.5

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

func (*Fraction) String added in v0.2.5

func (m *Fraction) String() string

func (*Fraction) Unmarshal added in v0.2.5

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

func (*Fraction) XXX_DiscardUnknown added in v0.2.5

func (m *Fraction) XXX_DiscardUnknown()

func (*Fraction) XXX_Marshal added in v0.2.5

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

func (*Fraction) XXX_Merge added in v0.2.5

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

func (*Fraction) XXX_Size added in v0.2.5

func (m *Fraction) XXX_Size() int

func (*Fraction) XXX_Unmarshal added in v0.2.5

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

type LCPQuerier

type LCPQuerier struct {
	core.FinalityAwareChain
	// contains filtered or unexported fields
}

func NewLCPQuerier

func NewLCPQuerier(serviceClient LCPServiceClient, clientID string) LCPQuerier

func (LCPQuerier) AverageBlockTime added in v0.1.3

func (LCPQuerier) AverageBlockTime() time.Duration

AverageBlockTime returns the average time required for each new block to be committed

func (LCPQuerier) ChainID

func (q LCPQuerier) ChainID() string

func (LCPQuerier) LatestHeight

func (LCPQuerier) LatestHeight() (ibcexported.Height, error)

LatestHeight returns the latest height of the chain

func (LCPQuerier) QueryClientConsensusState

func (q LCPQuerier) QueryClientConsensusState(ctx core.QueryContext, dstClientConsHeight ibcexported.Height) (*clienttypes.QueryConsensusStateResponse, error)

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

func (LCPQuerier) QueryClientState

QueryClientState returns the client state of dst chain height represents the height of dst chain

func (LCPQuerier) Timestamp added in v0.1.1

func (LCPQuerier) Timestamp(ibcexported.Height) (time.Time, error)

Timestamp returns the timestamp corresponding to the height

type LCPServiceClient

type LCPServiceClient struct {
	ELCMsgClient
	ELCQueryClient
	EnclaveQueryClient
}

func NewLCPServiceClient

func NewLCPServiceClient(conn *grpc.ClientConn) LCPServiceClient

type Module

type Module struct{}

func (Module) GetCmd

func (Module) GetCmd(ctx *config.Context) *cobra.Command

GetCmd returns the command

func (Module) Name

func (Module) Name() string

Name returns the name of the module

func (Module) RegisterInterfaces

func (Module) RegisterInterfaces(registry codectypes.InterfaceRegistry)

RegisterInterfaces register the module interfaces to protobuf Any.

type Prover

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

func NewProver

func NewProver(config ProverConfig, originChain core.Chain, originProver core.Prover) (*Prover, error)

func (*Prover) CheckRefreshRequired added in v0.1.4

func (pr *Prover) CheckRefreshRequired(counterparty core.ChainInfoICS02Querier) (bool, error)

func (*Prover) ComputeEIP712RegisterEnclaveKeyHash added in v0.2.5

func (pr *Prover) ComputeEIP712RegisterEnclaveKeyHash(report string) (common.Hash, error)

func (*Prover) ComputeEIP712UpdateOperatorsHash added in v0.2.5

func (pr *Prover) ComputeEIP712UpdateOperatorsHash(nonce uint64, newOperators []common.Address, thresholdNumerator, thresholdDenominator uint64) (common.Hash, error)

func (*Prover) CreateInitialLightClientState added in v0.1.7

func (pr *Prover) CreateInitialLightClientState(height exported.Height) (exported.ClientState, exported.ConsensusState, error)

CreateInitialLightClientState returns a pair of ClientState and ConsensusState based on the state of the self chain at `height`. These states will be submitted to the counterparty chain as MsgCreateClient. If `height` is nil, the latest finalized height is selected automatically.

func (*Prover) GetChainID

func (pr *Prover) GetChainID() string

GetChainID returns the chain ID

func (*Prover) GetLatestFinalizedHeader

func (pr *Prover) GetLatestFinalizedHeader() (core.Header, error)

GetLatestFinalizedHeader returns the latest finalized header on this chain The returned header is expected to be the latest one of headers that can be verified by the light client

func (*Prover) GetOperators added in v0.2.5

func (pr *Prover) GetOperators() ([]common.Address, error)

func (*Prover) GetOperatorsThreshold added in v0.2.5

func (pr *Prover) GetOperatorsThreshold() Fraction

func (*Prover) GetOriginProver

func (pr *Prover) GetOriginProver() core.Prover

func (*Prover) Init

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

Init initializes the chain

func (*Prover) IsOperatorEnabled added in v0.2.5

func (pr *Prover) IsOperatorEnabled() bool

func (*Prover) ProveHostConsensusState added in v0.1.13

func (pr *Prover) ProveHostConsensusState(ctx core.QueryContext, height exported.Height, consensusState exported.ConsensusState) (proof []byte, err error)

ProveHostConsensusState returns an existence proof of the consensus state at `height` This proof would be ignored in ibc-go, but it is required to `getSelfConsensusState` of ibc-solidity.

func (*Prover) ProveState

func (pr *Prover) ProveState(ctx core.QueryContext, path string, value []byte) ([]byte, clienttypes.Height, error)

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

SetupForRelay performs chain-specific setup before starting the relay

func (*Prover) SetupHeadersForUpdate

func (pr *Prover) SetupHeadersForUpdate(dstChain core.FinalityAwareChain, latestFinalizedHeader core.Header) ([]core.Header, error)

SetupHeadersForUpdate returns the finalized header and any intermediate headers needed to apply it to the client on the counterpaty chain The order of the returned header slice should be as: [<intermediate headers>..., <update header>] if the header slice's length == nil and err == nil, the relayer should skips the update-client

func (*Prover) UpdateEKIfNeeded added in v0.1.5

func (pr *Prover) UpdateEKIfNeeded(ctx context.Context, counterparty core.FinalityAwareChain) error

UpdateEKIIfNeeded checks if the enclave key needs to be updated

type ProverConfig

type ProverConfig struct {
	OriginProver *types.Any `protobuf:"bytes,1,opt,name=origin_prover,json=originProver,proto3" json:"origin_prover,omitempty"`
	// hex string
	LcpServiceAddress string `protobuf:"bytes,2,opt,name=lcp_service_address,json=lcpServiceAddress,proto3" json:"lcp_service_address,omitempty"`
	// unit: seconds
	LcpServiceDialTimeout uint64 `` /* 129-byte string literal not displayed */
	// hex string
	Mrenclave            string   `protobuf:"bytes,4,opt,name=mrenclave,proto3" json:"mrenclave,omitempty"`
	AllowedQuoteStatuses []string `protobuf:"bytes,5,rep,name=allowed_quote_statuses,json=allowedQuoteStatuses,proto3" json:"allowed_quote_statuses,omitempty"`
	AllowedAdvisoryIds   []string `protobuf:"bytes,6,rep,name=allowed_advisory_ids,json=allowedAdvisoryIds,proto3" json:"allowed_advisory_ids,omitempty"`
	// unit: seconds
	KeyExpiration               uint64 `protobuf:"varint,7,opt,name=key_expiration,json=keyExpiration,proto3" json:"key_expiration,omitempty"`
	ElcClientId                 string `protobuf:"bytes,8,opt,name=elc_client_id,json=elcClientId,proto3" json:"elc_client_id,omitempty"`
	MessageAggregation          bool   `protobuf:"varint,9,opt,name=message_aggregation,json=messageAggregation,proto3" json:"message_aggregation,omitempty"`
	MessageAggregationBatchSize uint64 `` /* 148-byte string literal not displayed */
	IsDebugEnclave              bool   `protobuf:"varint,11,opt,name=is_debug_enclave,json=isDebugEnclave,proto3" json:"is_debug_enclave,omitempty"`
	// --- Operator Config --- //
	// if empty, any operator is allowed (default)
	// otherwise, only operators in this list are allowed
	Operators []string `protobuf:"bytes,12,rep,name=operators,proto3" json:"operators,omitempty"`
	// this only works when operators is not empty
	// the value must be less than or equal to 1
	OperatorsThreshold Fraction `protobuf:"bytes,13,opt,name=operators_threshold,json=operatorsThreshold,proto3" json:"operators_threshold"`
	// signer for eip712 commitment
	OperatorSigner *types.Any `protobuf:"bytes,14,opt,name=operator_signer,json=operatorSigner,proto3" json:"operator_signer,omitempty"`
	// eip712 params
	//
	// Types that are valid to be assigned to OperatorsEip712Params:
	//	*ProverConfig_OperatorsEip712EvmChainParams
	//	*ProverConfig_OperatorsEip712CosmosChainParams
	OperatorsEip712Params isProverConfig_OperatorsEip712Params `protobuf_oneof:"operators_eip712_params"`
}

func (ProverConfig) Build

func (pc ProverConfig) Build(chain core.Chain) (core.Prover, error)

func (ProverConfig) ChainType added in v0.2.5

func (pc ProverConfig) ChainType() lcptypes.ChainType

func (*ProverConfig) Descriptor

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

func (ProverConfig) GetDialTimeout added in v0.1.12

func (pc ProverConfig) GetDialTimeout() time.Duration

func (ProverConfig) GetMessageAggregationBatchSize added in v0.1.11

func (pc ProverConfig) GetMessageAggregationBatchSize() uint64

func (ProverConfig) GetMrenclave

func (pc ProverConfig) GetMrenclave() []byte

func (*ProverConfig) GetOperatorsEip712CosmosChainParams added in v0.2.5

func (m *ProverConfig) GetOperatorsEip712CosmosChainParams() *EIP712CosmosChainParams

func (*ProverConfig) GetOperatorsEip712EvmChainParams added in v0.2.5

func (m *ProverConfig) GetOperatorsEip712EvmChainParams() *EIP712EVMChainParams

func (*ProverConfig) GetOperatorsEip712Params added in v0.2.5

func (m *ProverConfig) GetOperatorsEip712Params() isProverConfig_OperatorsEip712Params

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

func (pc ProverConfig) Validate() 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_OneofWrappers added in v0.2.5

func (*ProverConfig) XXX_OneofWrappers() []interface{}

XXX_OneofWrappers is for the internal use of the proto package.

func (*ProverConfig) XXX_Size

func (m *ProverConfig) XXX_Size() int

func (*ProverConfig) XXX_Unmarshal

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

type ProverConfig_OperatorsEip712CosmosChainParams added in v0.2.5

type ProverConfig_OperatorsEip712CosmosChainParams struct {
	OperatorsEip712CosmosChainParams *EIP712CosmosChainParams `` /* 170-byte string literal not displayed */
}

func (*ProverConfig_OperatorsEip712CosmosChainParams) MarshalTo added in v0.2.5

func (*ProverConfig_OperatorsEip712CosmosChainParams) MarshalToSizedBuffer added in v0.2.5

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

func (*ProverConfig_OperatorsEip712CosmosChainParams) Size added in v0.2.5

type ProverConfig_OperatorsEip712EvmChainParams added in v0.2.5

type ProverConfig_OperatorsEip712EvmChainParams struct {
	OperatorsEip712EvmChainParams *EIP712EVMChainParams `` /* 161-byte string literal not displayed */
}

func (*ProverConfig_OperatorsEip712EvmChainParams) MarshalTo added in v0.2.5

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

func (*ProverConfig_OperatorsEip712EvmChainParams) MarshalToSizedBuffer added in v0.2.5

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

func (*ProverConfig_OperatorsEip712EvmChainParams) Size added in v0.2.5

type QueryELCResult added in v0.2.4

type QueryELCResult struct {
	// if false, `Raw` and `Decoded` are empty
	Found bool `json:"found"`
	Raw   struct {
		ClientState    Any `json:"client_state"`
		ConsensusState Any `json:"consensus_state"`
	} `json:"raw"`
	// if cannot decode the client state or the consensus state, `Decoded` is empty
	Decoded struct {
		ClientState    ibcexported.ClientState    `json:"client_state"`
		ConsensusState ibcexported.ConsensusState `json:"consensus_state"`
	} `json:"decoded,omitempty"`
}

type UpdateELCResult added in v0.2.2

type UpdateELCResult struct {
	Messages []*lcptypes.UpdateStateProxyMessage `json:"messages"`
}

Directories

Path Synopsis
signers
raw
cmd

Jump to

Keyboard shortcuts

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