Documentation ¶
Index ¶
- func ContractSelectors() contractSelectors
- func NewClient(ctx clientContext.ClientContext, messageChannel chan<- shared.ProtocolMessage) (*client, error)
- func SignatureSubmitterDataVerifier(data *SubProtocolResponse) error
- func StatusDataVerifier(data *SubProtocolResponse) error
- type DataVerifier
- type EpochRunner
- type SignatureSubmitter
- func (s *SignatureSubmitter) RunEpoch(currentEpoch int64)
- func (s *SignatureSubmitter) RunEpochAfterDeadline(currentEpoch int64, protocolsToQuery map[int]bool)
- func (s *SignatureSubmitter) RunEpochBeforeDeadline(currentEpoch int64, deadline time.Duration) (map[int]bool, error)
- func (s *SignatureSubmitter) WritePayload(buffer *bytes.Buffer, epoch int64, data *SubProtocolResponse, ...) error
- type SubProtocol
- type SubProtocolResponse
- type Submitter
- type SubmitterBase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContractSelectors ¶
func ContractSelectors() contractSelectors
ContractSelectors return function selectors for submission contract.
func NewClient ¶
func NewClient(ctx clientContext.ClientContext, messageChannel chan<- shared.ProtocolMessage) (*client, error)
NewClient creates new Client that manages fetching data from subProtocol providers and posting them on submission contract.
messageChannel is used to provider messages from submitSignature to the finalizer.Client.
func SignatureSubmitterDataVerifier ¶
func SignatureSubmitterDataVerifier(data *SubProtocolResponse) error
func StatusDataVerifier ¶ added in v1.0.0
func StatusDataVerifier(data *SubProtocolResponse) error
Types ¶
type DataVerifier ¶
type DataVerifier func(*SubProtocolResponse) error
type EpochRunner ¶
type EpochRunner interface {
RunEpoch(currentEpoch int64)
}
type SignatureSubmitter ¶
type SignatureSubmitter struct { SubmitterBase // contains filtered or unexported fields }
func (*SignatureSubmitter) RunEpoch ¶
func (s *SignatureSubmitter) RunEpoch(currentEpoch int64)
RunEpoch gets the submitSignature messages from the subprotocols providers, relays them to the finalizer, aggregated them and submits them to submission contract.
The first cycle of queries happens before the deadline: Each subprotocol is repeatedly queried until success or deadline. The successful queries are included in the payloads of the transaction. The transaction with payloads is sent once all queries are successful or at the deadline (whichever happens first).
After the first cycle, if not all subprotocols are queried successfully, there is another cycle. In this cycle, the not yet successful queries are retried at most dataFetchRetries times. If any subprotocols are queried successfully, their payload is submitted at the end of the cycle. The processes is repeated until all subprotocols are queried successfully or at most maxCycles of times.
func (*SignatureSubmitter) RunEpochAfterDeadline ¶
func (s *SignatureSubmitter) RunEpochAfterDeadline(currentEpoch int64, protocolsToQuery map[int]bool)
func (*SignatureSubmitter) RunEpochBeforeDeadline ¶
func (s *SignatureSubmitter) RunEpochBeforeDeadline(currentEpoch int64, deadline time.Duration) (map[int]bool, error)
RunEpochBeforeDeadline queries subprotocol providers for signed messages until success or deadline. Messages are written to transaction input in form of signature payload. Messages are also passed to finalizers. Once all subprotocols are successfully queried or the deadline has passed the transaction with constructed input is sent to the submission contract. A set of indexes of unsuccessfully queried subprotocols is returned.
func (*SignatureSubmitter) WritePayload ¶
func (s *SignatureSubmitter) WritePayload( buffer *bytes.Buffer, epoch int64, data *SubProtocolResponse, protocolID, protocolType uint8, ) error
WritePayload encodes payload to buffer. Payload data should be valid (data length 38, additional data length <= maxuint16 - 66). If an error is returned, the buffer is unchanged.
type SubProtocol ¶
type SubProtocol struct { ID uint8 APIUrl string XApiKey string Type uint8 //type of submitSignature payload }
func NewSubProtocol ¶
func NewSubProtocol(config config.ProtocolConfig) *SubProtocol
type SubProtocolResponse ¶
type SubProtocolResponse struct { Status payload.ResponseStatus `json:"status"` Data []byte `json:"data"` AdditionalData []byte `json:"additionalData"` }
type Submitter ¶
type Submitter struct { SubmitterBase // contains filtered or unexported fields }
type SubmitterBase ¶
type SubmitterBase struct {
// contains filtered or unexported fields
}