Documentation
¶
Index ¶
- Variables
- func AreAddressEqual(address1 string, address2 string) bool
- func IsValidAddress(v string) bool
- func IsValidIndex(v string) (uint64, bool)
- func IsValidPubkey(v string) bool
- type ApiService
- func (m *ApiService) ApplyNonFinalizedState(subs []Subscription, unsubs []Unsubscription, ...)
- func (m *ApiService) GetSubscriptionsTillHead(latestProcessedBlock uint64) ([]Subscription, error)
- func (m *ApiService) GetUnsubscriptionsTillHead(latestProcessedBlock uint64) ([]Unsubscription, error)
- func (m *ApiService) OracleReady(maxSlotsBehind uint64) bool
- func (m *ApiService) StartHTTPServer()
- type Subscription
- type Unsubscription
Constants ¶
This section is empty.
Variables ¶
var MaxSlotsBehind = uint64(64)
Oracle does not serve some endpoint if not in sync to latest finalized epoch. Some slots behind are allowed, since its normal that when a new epoch is finalized, some slots are still pending to be processed. This is the max number of slots allowed
var SlotsInOneMonth = uint64(216000)
30 days/month * 24 hours/day * 3600 seconds/day / 12 seconds/slot
Functions ¶
func AreAddressEqual ¶
Copied from oracle/utils. Cant import due to circular dependency TODO: Move to utils package
func IsValidAddress ¶
func IsValidIndex ¶
func IsValidPubkey ¶
Types ¶
type ApiService ¶
type ApiService struct { Onchain *oracle.Onchain ApiListenAddr string Network string // contains filtered or unexported fields }
func NewApiService ¶
func (*ApiService) ApplyNonFinalizedState ¶
func (m *ApiService) ApplyNonFinalizedState( subs []Subscription, unsubs []Unsubscription, validators map[uint64]*oracle.ValidatorInfo)
func (*ApiService) GetSubscriptionsTillHead ¶
func (m *ApiService) GetSubscriptionsTillHead(latestProcessedBlock uint64) ([]Subscription, error)
TODO: unsure if move this somewhere else
func (*ApiService) GetUnsubscriptionsTillHead ¶
func (m *ApiService) GetUnsubscriptionsTillHead(latestProcessedBlock uint64) ([]Unsubscription, error)
func (*ApiService) OracleReady ¶
func (m *ApiService) OracleReady(maxSlotsBehind uint64) bool
func (*ApiService) StartHTTPServer ¶
func (m *ApiService) StartHTTPServer()
type Subscription ¶
type Subscription struct { Event *contract.ContractSubscribeValidator `json:"event"` Validator *v1.Validator `json:"validator"` }
Subscription event and the associated validator (if any) TODO: Perhaps remove, no longer need if refactored a bit
func GetSubInBlock ¶
func GetSubInBlock(subs []Subscription, block uint64) []Subscription
type Unsubscription ¶
type Unsubscription struct { Event *contract.ContractUnsubscribeValidator `json:"event"` Validator *v1.Validator `json:"validator"` }
Unsubscription event and the associated validator (if any) TODO: Perhaps remove, no longer need if refactored a bit
func GetUnsubInBlock ¶
func GetUnsubInBlock(subs []Unsubscription, block uint64) []Unsubscription