event

package
v0.18.15 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: Apache-2.0 Imports: 43 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	TwoMinutes  = 60 * 2
	FiveMinutes = 60 * 5

	SixtyMinutes = 60 * 60
)
View Source
const (
	JobTypeAddSignature     = "addSignature"
	JobTypeBTCBroadcast     = "btcBroadcast"
	JobTypeBTCCheckFinality = "btcCheckFinality"
	JobTypeETHCheckfinalty  = "ethCheckFinality"
	JobTypeETHBroadcast     = "ethBroadcast"
	JobTypeETHSignRedeem    = "ethsignredeem"
	JobTypeETHVerifyRedeem  = "verifyredeem"

	JobTypeGOVCheckVotes       = "govCheckVotes"
	JobTypeGOVFinalizeProposal = "govFinalizeProposal"

	MaxJobRetries = 10
)
View Source
const (
	MAX_BROADCAST_RETRY = 20
)

Variables

View Source
var (
	EthLockEngine   transition.Engine
	EthRedeemEngine transition.Engine
	BtcEngine       transition.Engine
)

Functions

func BroadcastGovExpireVotesTx added in v0.14.3

func BroadcastGovExpireVotesTx(jobCtx *JobsContext, proposalID governance.ProposalID, jobID string) error

func BroadcastGovFinalizeVotesTx added in v0.14.3

func BroadcastGovFinalizeVotesTx(jobCtx *JobsContext, proposalID governance.ProposalID, jobID string) error

func BroadcastReportFinalityETHTx added in v0.14.0

func BroadcastReportFinalityETHTx(ethCtx *JobsContext, trackerName ethereum.TrackerName, jobID string, success bool) error

^TODO Replace error with InternalBroadcastStatus

func Broadcasting

func Broadcasting(ctx interface{}) error

TODO Go back to Busy broadcasting if there is a failure in Finalizing.

func Cleanup

func Cleanup(ctx interface{}) error

func CleanupFailed added in v0.14.0

func CleanupFailed(ctx interface{}) error

func DeleteCompletedJobs

func DeleteCompletedJobs(ctx *JobsContext, js *jobs.JobStore)

func Finalization

func Finalization(ctx interface{}) error

func Finalizing

func Finalizing(ctx interface{}) error

func FreezeForBroadcast

func FreezeForBroadcast(inp interface{}) error

func MakeAvailable

func MakeAvailable(input interface{}) error

func NewAddSignatureJob

func NewAddSignatureJob(trackerName, id string) jobs.Job

func NewBTCBroadcastJob

func NewBTCBroadcastJob(trackerName, id string) jobs.Job

func NewBTCCheckFinalityJob

func NewBTCCheckFinalityJob(trackerName, id string) jobs.Job

func ProcessAllJobs

func ProcessAllJobs(ctx *JobsContext, js *jobs.JobStore)

func RangeJobs

func RangeJobs(js *jobs.JobStore, pro JobProcess)

func RedeemConfirmed

func RedeemConfirmed(ctx interface{}) error

func ReportBroadcastSuccess

func ReportBroadcastSuccess(inp interface{}) error

func ReserveTracker

func ReserveTracker(inp interface{}) error

func Signing

func Signing(ctx interface{}) error

func VerifyRedeem

func VerifyRedeem(ctx interface{}) error

Types

type BroadcastReply

type BroadcastReply struct {
	TxHash bytes.HexBytes `json:"txHash"`
	// OK indicates whether this broadcast was a request.
	// For TxSync, it indicates success of CheckTx. Does not guarantee inclusion of a block
	// For TxAsync, it always returns true
	// For TxCommit, it indicates the success of both CheckTx and DeliverTx. If the broadcast fails is false.
	OK     bool   `json:"ok"`
	Height *int64 `json:"height,omitempty"`
	Log    string `json:"log"`
}

func (*BroadcastReply) FromResultBroadcastTx

func (reply *BroadcastReply) FromResultBroadcastTx(result *ctypes.ResultBroadcastTx)

type InternalBroadcastRequest

type InternalBroadcastRequest struct {
	RawTx action.RawTx `json:"rawTx"`
}

type JobAddSignature

type JobAddSignature struct {
	Type string

	TrackerName string

	JobID string

	Status jobs.Status
}

func (*JobAddSignature) DoMyJob

func (j *JobAddSignature) DoMyJob(ctxI interface{})

func (*JobAddSignature) GetJobID

func (j *JobAddSignature) GetJobID() string

func (*JobAddSignature) GetType

func (j *JobAddSignature) GetType() string

func (JobAddSignature) IsDone

func (j JobAddSignature) IsDone() bool

func (*JobAddSignature) IsFailed added in v0.14.0

func (j *JobAddSignature) IsFailed() bool

type JobBTCBroadcast

type JobBTCBroadcast struct {
	Type string

	TrackerName string

	JobID string

	Status jobs.Status

	RetryCount int
}

func (*JobBTCBroadcast) DoMyJob

func (j *JobBTCBroadcast) DoMyJob(ctxI interface{})

func (*JobBTCBroadcast) GetJobID

func (j *JobBTCBroadcast) GetJobID() string

func (*JobBTCBroadcast) GetType

func (j *JobBTCBroadcast) GetType() string

simple getters

func (JobBTCBroadcast) IsDone

func (j JobBTCBroadcast) IsDone() bool

func (*JobBTCBroadcast) IsFailed added in v0.14.0

func (j *JobBTCBroadcast) IsFailed() bool

type JobBTCCheckFinality

type JobBTCCheckFinality struct {
	Type string

	TrackerName string
	JobID       string
	CheckAfter  int64

	Status jobs.Status
}

func (*JobBTCCheckFinality) DoMyJob

func (cf *JobBTCCheckFinality) DoMyJob(ctxI interface{})

func (*JobBTCCheckFinality) GetJobID

func (cf *JobBTCCheckFinality) GetJobID() string

func (*JobBTCCheckFinality) GetType

func (cf *JobBTCCheckFinality) GetType() string

func (*JobBTCCheckFinality) IsDone

func (cf *JobBTCCheckFinality) IsDone() bool

func (*JobBTCCheckFinality) IsFailed added in v0.14.0

func (cf *JobBTCCheckFinality) IsFailed() bool

type JobBus

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

func NewJobBus

func NewJobBus(opt Option, store *jobs.JobStore) *JobBus

func (*JobBus) Close

func (j *JobBus) Close() error

func (*JobBus) Start

func (j *JobBus) Start(ctx *JobsContext) error

type JobETHBroadcast

type JobETHBroadcast struct {
	TrackerName ethereum.TrackerName
	JobID       string
	RetryCount  int
	Status      jobs.Status
}

func (*JobETHBroadcast) DoMyJob

func (job *JobETHBroadcast) DoMyJob(ctx interface{})

func (*JobETHBroadcast) GetJobID

func (job *JobETHBroadcast) GetJobID() string

func (*JobETHBroadcast) GetType

func (job *JobETHBroadcast) GetType() string

func (*JobETHBroadcast) IsDone

func (job *JobETHBroadcast) IsDone() bool

func (*JobETHBroadcast) IsFailed added in v0.14.0

func (job *JobETHBroadcast) IsFailed() bool

type JobETHCheckFinality

type JobETHCheckFinality struct {
	TrackerName ethereum.TrackerName
	JobID       string
	RetryCount  int
	Status      jobs.Status
}

func (*JobETHCheckFinality) DoMyJob

func (job *JobETHCheckFinality) DoMyJob(ctx interface{})

func (*JobETHCheckFinality) GetJobID

func (job *JobETHCheckFinality) GetJobID() string

func (*JobETHCheckFinality) GetType

func (job *JobETHCheckFinality) GetType() string

func (*JobETHCheckFinality) IsDone

func (job *JobETHCheckFinality) IsDone() bool

func (*JobETHCheckFinality) IsFailed added in v0.14.0

func (job *JobETHCheckFinality) IsFailed() bool

type JobETHSignRedeem

type JobETHSignRedeem struct {
	TrackerName ethereum.TrackerName
	JobID       string
	RetryCount  int
	Status      jobs.Status
	TxHash      *ethereum.TransactionHash
}

func (*JobETHSignRedeem) DoMyJob

func (j *JobETHSignRedeem) DoMyJob(ctx interface{})

func (*JobETHSignRedeem) GetJobID

func (j *JobETHSignRedeem) GetJobID() string

func (*JobETHSignRedeem) GetType

func (j *JobETHSignRedeem) GetType() string

func (*JobETHSignRedeem) IsDone

func (j *JobETHSignRedeem) IsDone() bool

func (*JobETHSignRedeem) IsFailed added in v0.14.0

func (j *JobETHSignRedeem) IsFailed() bool

type JobETHVerifyRedeem

type JobETHVerifyRedeem struct {
	TrackerName ethereum.TrackerName
	JobID       string
	RetryCount  int
	Status      jobs.Status
}

func (*JobETHVerifyRedeem) DoMyJob

func (job *JobETHVerifyRedeem) DoMyJob(ctx interface{})

func (*JobETHVerifyRedeem) GetJobID

func (job *JobETHVerifyRedeem) GetJobID() string

func (*JobETHVerifyRedeem) GetType

func (job *JobETHVerifyRedeem) GetType() string

func (*JobETHVerifyRedeem) IsDone

func (job *JobETHVerifyRedeem) IsDone() bool

func (*JobETHVerifyRedeem) IsFailed added in v0.14.0

func (job *JobETHVerifyRedeem) IsFailed() bool

type JobGovCheckVotes added in v0.14.3

type JobGovCheckVotes struct {
	ProposalID governance.ProposalID
	JobID      string
	RetryCount int
	Status     jobs.Status
}

func NewGovCheckVotesJob added in v0.14.3

func NewGovCheckVotesJob(proposalID governance.ProposalID, status governance.ProposalStatus) *JobGovCheckVotes

func (*JobGovCheckVotes) DoMyJob added in v0.14.3

func (j *JobGovCheckVotes) DoMyJob(ctx interface{})

func (*JobGovCheckVotes) GetJobID added in v0.14.3

func (j *JobGovCheckVotes) GetJobID() string

func (*JobGovCheckVotes) GetType added in v0.14.3

func (j *JobGovCheckVotes) GetType() string

func (*JobGovCheckVotes) IsDone added in v0.14.3

func (j *JobGovCheckVotes) IsDone() bool

func (*JobGovCheckVotes) IsFailed added in v0.14.3

func (j *JobGovCheckVotes) IsFailed() bool

type JobGovFinalizeProposal added in v0.14.3

type JobGovFinalizeProposal struct {
	ProposalID governance.ProposalID
	JobID      string
	RetryCount int
	Status     jobs.Status
}

func NewGovFinalizeProposalJob added in v0.14.3

func NewGovFinalizeProposalJob(proposalID governance.ProposalID, status governance.ProposalStatus) *JobGovFinalizeProposal

func (*JobGovFinalizeProposal) DoMyJob added in v0.14.3

func (j *JobGovFinalizeProposal) DoMyJob(ctx interface{})

func (*JobGovFinalizeProposal) GetJobID added in v0.14.3

func (j *JobGovFinalizeProposal) GetJobID() string

func (*JobGovFinalizeProposal) GetType added in v0.14.3

func (j *JobGovFinalizeProposal) GetType() string

func (*JobGovFinalizeProposal) IsDone added in v0.14.3

func (j *JobGovFinalizeProposal) IsDone() bool

func (*JobGovFinalizeProposal) IsFailed added in v0.14.3

func (j *JobGovFinalizeProposal) IsFailed() bool

type JobProcess

type JobProcess func(job jobs.Job) jobs.Job

type JobsContext

type JobsContext struct {
	Service          *Service
	Logger           *log.Logger
	Trackers         *bitcoin.TrackerStore
	Validators       *identity.ValidatorStore
	BTCPrivKey       *keys.PrivateKey
	ETHPrivKey       *keys.PrivateKey
	ValidatorAddress action.Address
	LockScripts      *bitcoin.LockScriptStore
	EthereumTrackers *ethereum.TrackerStore
	ProposalMaster   *governance.ProposalMasterStore
	// contains filtered or unexported fields
}

func NewJobsContext

func NewJobsContext(cfg config.Server,
	svc *Service,
	trackers *bitcoin.TrackerStore,
	validators *identity.ValidatorStore,
	privKey *keys.PrivateKey,
	ethprivKey *keys.PrivateKey,
	valAddress keys.Address,
	lStore *bitcoin.LockScriptStore,
	ethTracker *ethereum.TrackerStore,
	proposalMaster *governance.ProposalMasterStore,
	logger *log.Logger,
) *JobsContext

func (*JobsContext) GetValidatorETHAddress

func (jc *JobsContext) GetValidatorETHAddress() common.Address

func (*JobsContext) GetValidatorETHPrivKey

func (jc *JobsContext) GetValidatorETHPrivKey() *ecdsa.PrivateKey

type Option

type Option struct {
	BtcInterval time.Duration
	EthInterval time.Duration
	OltInterval time.Duration
}

type Service

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

func NewService

func NewService(ctx node.Context, logger *log.Logger, router action.Router, tmnode *consensus.Node) *Service

func (Service) InternalBroadcast

func (svc Service) InternalBroadcast(request InternalBroadcastRequest, reply *BroadcastReply) error

Jump to

Keyboard shortcuts

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