Documentation ¶
Index ¶
- Constants
- Variables
- func ConstructDataReliabilityRelayRequest(ctx context.Context, vrfData *pairingtypes.VRFData, privKey *btcec.PrivateKey, ...) (*pairingtypes.RelayRequest, error)
- func ConstructRelayRequest(ctx context.Context, privKey *btcec.PrivateKey, chainID string, ...) (*pairingtypes.RelayRequest, error)
- func DataReliabilityThresholdToSession(vrfs [][]byte, uniqueIdentifiers []bool, reliabilityThreshold uint32, ...) (indexes map[int64]bool)
- func GetLatestFinalizedBlock(latestBlock int64, blockDistanceForFinalizedData int64) int64
- func GetTimePerCu(cu uint64) time.Duration
- func NewVRFData(differentiator bool, vrf_res []byte, vrf_proof []byte, ...) *pairingtypes.VRFData
- func ReplaceRequestedBlock(requestedBlock int64, latestBlock int64) int64
- func UpdateRequestedBlock(request *pairingtypes.RelayRequest, 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(originalResult *RelayResult, dataReliabilityResults []*RelayResult, ...) (conflict bool, 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 ¶
View Source
const ( TimePerCU = uint64(100 * time.Millisecond) MinimumTimePerRelayDelay = time.Second AverageWorldLatency = 200 * time.Millisecond SupportedNumberOfVRFs = 2 )
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 ConstructDataReliabilityRelayRequest ¶ added in v0.4.5
func ConstructDataReliabilityRelayRequest(ctx context.Context, vrfData *pairingtypes.VRFData, privKey *btcec.PrivateKey, chainID string, relayRequestCommonData *RelayRequestCommonData, providerPublicAddress string, epoch int64, reportedProviders []byte) (*pairingtypes.RelayRequest, error)
func ConstructRelayRequest ¶
func ConstructRelayRequest(ctx context.Context, privKey *btcec.PrivateKey, chainID string, relayRequestCommonData RelayRequestCommonData, providerPublicAddress string, consumerSession *lavasession.SingleConsumerSession, epoch int64, reportedProviders []byte) (*pairingtypes.RelayRequest, error)
func DataReliabilityThresholdToSession ¶ added in v0.4.5
func GetLatestFinalizedBlock ¶
func GetTimePerCu ¶ added in v0.4.5
func NewVRFData ¶ added in v0.4.5
func NewVRFData(differentiator bool, vrf_res []byte, vrf_proof []byte, request *pairingtypes.RelayRequest, reply *pairingtypes.RelayReply) *pairingtypes.VRFData
func ReplaceRequestedBlock ¶
func UpdateRequestedBlock ¶
func UpdateRequestedBlock(request *pairingtypes.RelayRequest, 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(originalResult *RelayResult, dataReliabilityResults []*RelayResult, totalNumberOfSessions int) (conflict bool, 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.RelayRequest, 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,6,opt,name=data,proto3" json:"data,omitempty"` RequestBlock int64 `protobuf:"varint,11,opt,name=request_block,json=requestBlock,proto3" json:"request_block,omitempty"` }
func NewRelayRequestCommonData ¶ added in v0.4.5
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.