Documentation ¶
Index ¶
- Variables
- func ConstructRelayRequest(ctx context.Context, privKey *btcec.PrivateKey, lavaChainID string, ...) (*pairingtypes.RelayRequest, error)
- func ConstructRelaySession(lavaChainID string, relayRequestData *pairingtypes.RelayPrivateData, ...) *pairingtypes.RelaySession
- func GetLatestFinalizedBlock(latestBlock int64, blockDistanceForFinalizedData int64) int64
- func GetSalt(requestData *pairingtypes.RelayPrivateData) uint64
- func NewRelayData(ctx context.Context, connectionType string, apiUrl string, data []byte, ...) *pairingtypes.RelayPrivateData
- func ReplaceRequestedBlock(requestedBlock int64, latestBlock int64) int64
- func SetSalt(requestData *pairingtypes.RelayPrivateData, value uint64)
- func SignRelayResponse(consumerAddress sdk.AccAddress, request pairingtypes.RelayRequest, ...) (*pairingtypes.RelayReply, error)
- func UpdateRequestedBlock(request *pairingtypes.RelayPrivateData, response *pairingtypes.RelayReply)
- func VerifyFinalizationData(reply *pairingtypes.RelayReply, relayRequest *pairingtypes.RelayRequest, ...) (finalizedBlocks map[int64]string, ...)
- func VerifyRelayReply(reply *pairingtypes.RelayReply, relayRequest *pairingtypes.RelayRequest, ...) error
- func VerifyReliabilityResults(ctx context.Context, originalResult *RelayResult, ...) (conflicts *conflicttypes.ResponseConflict)
- type FinalizationConsensus
- func (s *FinalizationConsensus) ExpectedBlockHeight(chainParser chainlib.ChainParser) (expectedBlockHeight int64, numOfProviders int)
- func (fc *FinalizationConsensus) NewEpoch(epoch uint64)
- func (fc *FinalizationConsensus) UpdateFinalizedHashes(blockDistanceForFinalizedData int64, providerAddress string, latestBlock int64, ...) (finalizationConflict *conflicttypes.FinalizationConflict, err error)
- type ProviderHashesConsensus
- type RelayRequestCommonData
- type RelayResult
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ProviderFinzalizationDataError = sdkerrors.New("ProviderFinzalizationData Error", 3365, "provider did not sign finalization data correctly") ProviderFinzalizationDataAccountabilityError = sdkerrors.New("ProviderFinzalizationDataAccountability Error", 3366, "provider returned invalid finalization data, with accountability") HashesConsunsusError = sdkerrors.New("HashesConsunsus Error", 3367, "identified finalized responses with conflicting hashes, from two providers") )
Functions ¶
func ConstructRelayRequest ¶
func ConstructRelayRequest(ctx context.Context, privKey *btcec.PrivateKey, lavaChainID string, chainID string, relayRequestData *pairingtypes.RelayPrivateData, providerPublicAddress string, consumerSession *lavasession.SingleConsumerSession, epoch int64, reportedProviders []byte) (*pairingtypes.RelayRequest, error)
func ConstructRelaySession ¶
func ConstructRelaySession(lavaChainID string, relayRequestData *pairingtypes.RelayPrivateData, chainID string, providerPublicAddress string, singleConsumerSession *lavasession.SingleConsumerSession, epoch int64, reportedProviders []byte) *pairingtypes.RelaySession
func GetLatestFinalizedBlock ¶
func GetSalt ¶
func GetSalt(requestData *pairingtypes.RelayPrivateData) uint64
func NewRelayData ¶
func NewRelayData(ctx context.Context, connectionType string, apiUrl string, data []byte, requestBlock int64, apiInterface string, metadata []pairingtypes.Metadata) *pairingtypes.RelayPrivateData
func ReplaceRequestedBlock ¶
func SetSalt ¶
func SetSalt(requestData *pairingtypes.RelayPrivateData, value uint64)
func SignRelayResponse ¶
func SignRelayResponse(consumerAddress sdk.AccAddress, request pairingtypes.RelayRequest, pkey *btcSecp256k1.PrivateKey, reply *pairingtypes.RelayReply, signDataReliability bool) (*pairingtypes.RelayReply, error)
func UpdateRequestedBlock ¶
func UpdateRequestedBlock(request *pairingtypes.RelayPrivateData, response *pairingtypes.RelayReply)
func VerifyFinalizationData ¶
func VerifyFinalizationData(reply *pairingtypes.RelayReply, relayRequest *pairingtypes.RelayRequest, addr string, latestSessionBlock int64, blockDistanceForfinalization uint32) (finalizedBlocks map[int64]string, finalizationConflict *conflicttypes.FinalizationConflict, errRet error)
func VerifyRelayReply ¶
func VerifyRelayReply(reply *pairingtypes.RelayReply, relayRequest *pairingtypes.RelayRequest, addr string) error
func VerifyReliabilityResults ¶
func VerifyReliabilityResults(ctx context.Context, originalResult *RelayResult, dataReliabilityResult *RelayResult) (conflicts *conflicttypes.ResponseConflict)
Types ¶
type FinalizationConsensus ¶
type FinalizationConsensus struct {
// contains filtered or unexported fields
}
func (*FinalizationConsensus) ExpectedBlockHeight ¶
func (s *FinalizationConsensus) ExpectedBlockHeight(chainParser chainlib.ChainParser) (expectedBlockHeight int64, numOfProviders int)
returns the expected latest block, does the calculation on finalized entries then extrapolates the ending based on blockDistance
func (*FinalizationConsensus) NewEpoch ¶
func (fc *FinalizationConsensus) NewEpoch(epoch uint64)
func (*FinalizationConsensus) UpdateFinalizedHashes ¶
func (fc *FinalizationConsensus) UpdateFinalizedHashes(blockDistanceForFinalizedData int64, providerAddress string, latestBlock int64, finalizedBlocks map[int64]string, req *pairingtypes.RelaySession, reply *pairingtypes.RelayReply) (finalizationConflict *conflicttypes.FinalizationConflict, err error)
Compare finalized block hashes with previous providers Looks for discrepancy with current epoch providers if no conflicts, insert into consensus and break create new consensus group if no consensus matched check for discrepancy with old epoch checks if there is a consensus mismatch between hashes provided by different providers
type ProviderHashesConsensus ¶
type RelayRequestCommonData ¶
type RelayRequestCommonData struct { ChainID string `protobuf:"bytes,1,opt,name=chainID,proto3" json:"chainID,omitempty"` ConnectionType string `protobuf:"bytes,2,opt,name=connection_type,json=connectionType,proto3" json:"connection_type,omitempty"` ApiUrl string `protobuf:"bytes,3,opt,name=api_url,json=apiUrl,proto3" json:"api_url,omitempty"` Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` RequestBlock int64 `protobuf:"varint,5,opt,name=request_block,json=requestBlock,proto3" json:"request_block,omitempty"` ApiInterface string `protobuf:"bytes,6,opt,name=apiInterface,proto3" json:"apiInterface,omitempty"` }
type RelayResult ¶ added in v0.4.5
type RelayResult struct { Request *pairingtypes.RelayRequest Reply *pairingtypes.RelayReply ProviderAddress string ReplyServer *pairingtypes.Relayer_RelaySubscribeClient Finalized bool }
Click to show internal directories.
Click to hide internal directories.