pier

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2020 License: GPL-3.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChainSyncer          = "chain-syncer"
	HeimdallCheckpointer = "heimdall-checkpointer"
	NoackService         = "checkpoint-no-ack"
	SpanServiceStr       = "span-service"
	ClerkServiceStr      = "clerk-service"
	AMQPConsumerService  = "amqp-consumer-service"

	// TxsURL represents txs url
	TxsURL = "/txs"

	AccountDetailsURL      = "/auth/accounts/%v"
	LastNoAckURL           = "/checkpoint/last-no-ack"
	CheckpointParamsURL    = "/checkpoint/params"
	ProposersURL           = "/staking/proposer/%v"
	BufferedCheckpointURL  = "/checkpoint/buffer"
	LatestCheckpointURL    = "/checkpoint/latest-checkpoint"
	CurrentProposerURL     = "/staking/current-proposer"
	LatestSpanURL          = "/bor/latest-span"
	NextSpanInfoURL        = "/bor/prepare-next-span"
	DividendAccountRootURL = "/staking/dividend-account-root"
	ValidatorURL           = "/staking/validator/%v"

	TransactionTimeout = 1 * time.Minute
	CommitTimeout      = 2 * time.Minute

	BridgeDBFlag = "bridge-db"
)

Variables

View Source
var Logger log.Logger

Global logger for bridge

Functions

func FetchFromAPI

func FetchFromAPI(cliCtx cliContext.CLIContext, URL string) (result rest.ResponseWithHeight, err error)

FetchFromAPI fetches data from any URL

func FetchVotes

func FetchVotes(
	height int64,
	client *httpClient.HTTP,
) (votes []*tmTypes.CommitSig, sigs []byte, chainID string, err error)

FetchVotes fetches votes and extracts sigs from it

func GetHeimdallServerEndpoint

func GetHeimdallServerEndpoint(endpoint string) string

GetHeimdallServerEndpoint returns heimdall server endpoint

func IsCatchingUp

func IsCatchingUp(cliCtx cliContext.CLIContext) bool

IsCatchingUp checks if the heimdall node you are connected to is fully synced or not returns true when synced

func WaitForOneEvent

func WaitForOneEvent(tx tmTypes.Tx, client *httpClient.HTTP) (tmTypes.TMEventData, error)

WaitForOneEvent subscribes to a websocket event for the given event time and returns upon receiving it one time, or when the timeout duration has expired.

This handles subscribing and unsubscribing under the hood

Types

type AckService

type AckService struct {
	// Base service
	common.BaseService
	// contains filtered or unexported fields
}

func NewAckService

func NewAckService(cdc *codec.Codec, queueConnector *QueueConnector, httpClient *httpClient.HTTP) *AckService

NewAckService returns new service object

func (*AckService) OnStart

func (ackService *AckService) OnStart() error

OnStart starts new block subscription

func (*AckService) OnStop

func (ackService *AckService) OnStop()

OnStop stops all necessary go routines

type Checkpointer

type Checkpointer struct {
	// Base service
	common.BaseService

	// header channel
	HeaderChannel chan *types.Header
	// contains filtered or unexported fields
}

Checkpointer to propose

func NewCheckpointer

func NewCheckpointer(cdc *codec.Codec, queueConnector *QueueConnector, httpClient *httpClient.HTTP) *Checkpointer

NewCheckpointer returns new service object

func (*Checkpointer) OnStart

func (c *Checkpointer) OnStart() error

OnStart starts new block subscription

func (*Checkpointer) OnStop

func (c *Checkpointer) OnStop()

OnStop stops all necessary go routines

type ClerkService

type ClerkService struct {
	// Base service
	common.BaseService
	// contains filtered or unexported fields
}

ClerkService service spans

func NewClerkService

func NewClerkService(cdc *codec.Codec, queueConnector *QueueConnector, httpClient *httpClient.HTTP) *ClerkService

NewClerkService returns new service object

func (*ClerkService) OnStart

func (s *ClerkService) OnStart() error

OnStart starts new block subscription

func (*ClerkService) OnStop

func (s *ClerkService) OnStop()

OnStop stops all necessary go routines

type ConsumerService

type ConsumerService struct {
	// Base service
	common.BaseService
	// contains filtered or unexported fields
}

ConsumerService consumer service

func NewConsumerService

func NewConsumerService(cdc *codec.Codec, queueConnector *QueueConnector) *ConsumerService

NewConsumerService returns new service object

func (*ConsumerService) OnStart

func (consumer *ConsumerService) OnStart() error

OnStart starts new block subscription

func (*ConsumerService) OnStop

func (consumer *ConsumerService) OnStop()

OnStop stops all necessary go routines

type ContractCheckpoint

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

ContractCheckpoint contract checkpoint

func NewContractCheckpoint

func NewContractCheckpoint(_newStart uint64, _newEnd uint64, _currentHeaderBlock *HeaderBlock) *ContractCheckpoint

NewContractCheckpoint creates contract checkpoint

func (ContractCheckpoint) String

func (c ContractCheckpoint) String() string

type HeaderBlock

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

HeaderBlock header block

type HeimdallCheckpoint

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

HeimdallCheckpoint heimdall checkpoint

func NewHeimdallCheckpoint

func NewHeimdallCheckpoint(_start uint64, _end uint64) *HeimdallCheckpoint

NewHeimdallCheckpoint creates new heimdall checkpoint object

type LightHeader

type LightHeader struct {
	Number *big.Int `json:"number"           gencodec:"required"`
	Time   uint64   `json:"timestamp"        gencodec:"required"`
}

LightHeader represent light header for in-memory queue

type QueueConnector

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

QueueConnector queue connector

func NewQueueConnector

func NewQueueConnector(cdc *codec.Codec, dialer string) *QueueConnector

NewQueueConnector creates a connector object which can be used to connect/send/consume bytes from queue

func (*QueueConnector) BroadcastBytesToHeimdall

func (qc *QueueConnector) BroadcastBytesToHeimdall(data []byte) error

BroadcastBytesToHeimdall broadcasts bytes to heimdall

func (*QueueConnector) BroadcastToBor

func (qc *QueueConnector) BroadcastToBor(data []byte) error

BroadcastToBor broadcasts to bor

func (*QueueConnector) BroadcastToHeimdall

func (qc *QueueConnector) BroadcastToHeimdall(msg sdk.Msg) error

BroadcastToHeimdall broadcasts to heimdall

func (*QueueConnector) Start

func (qc *QueueConnector) Start() error

Start connector

func (*QueueConnector) Stop

func (qc *QueueConnector) Stop()

Stop connector

type Result

type Result struct {
	Result uint64 `json:"result"`
}

Result represents single req result

type SpanService

type SpanService struct {
	// Base service
	common.BaseService
	// contains filtered or unexported fields
}

SpanService service spans

func NewSpanService

func NewSpanService(cdc *codec.Codec, queueConnector *QueueConnector, httpClient *httpClient.HTTP) *SpanService

NewSpanService returns new service object

func (*SpanService) OnStart

func (s *SpanService) OnStart() error

OnStart starts new block subscription

func (*SpanService) OnStop

func (s *SpanService) OnStop()

OnStop stops all necessary go routines

type Syncer

type Syncer struct {
	// Base service
	common.BaseService

	// header channel
	HeaderChannel chan *types.Header
	// contains filtered or unexported fields
}

Syncer syncs validators and checkpoints

func NewSyncer

func NewSyncer(cdc *codec.Codec, queueConnector *QueueConnector, httpClient *httpClient.HTTP) *Syncer

NewSyncer returns new service object for syncing events

func (*Syncer) OnStart

func (syncer *Syncer) OnStart() error

OnStart starts new block subscription

func (*Syncer) OnStop

func (syncer *Syncer) OnStop()

OnStop stops all necessary go routines

Jump to

Keyboard shortcuts

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