directrequestocr

package
v1.12.0-base-rc0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ParseResultTaskName string = "parse_result"
	ParseErrorTaskName  string = "parse_error"
)
View Source
const RequestIDLength int = 32

Variables

This section is empty.

Functions

func CheckStateTransition added in v1.12.0

func CheckStateTransition(prev RequestState, next RequestState) error

* +-----------+ * +----+IN_PROGRESS+----------------+ * | +-----+-----+ | * | | | * | v v * | +------------+ +---------+ * | |RESULT_READY+---------->|TIMED_OUT| * | +------+-----+ +---------+ * | | ^ * | v | * | +---------+ | * +---->|FINALIZED|-----------------+ * +---------+ * * \ / * | * v * +---------+ * |CONFIRMED| * +---------+

func ExtractRawBytes added in v1.11.0

func ExtractRawBytes(input []byte) ([]byte, error)

Process result from the EA saved by a jsonparse pipeline task. That value is a valid JSON string so it contains double quote characters. Allowed inputs are:

  1. "" (2 characters) -> return empty byte array
  2. "0x<val>" where <val> is a non-empty, valid hex -> return hex-decoded <val>

Types

type DRListener

type DRListener struct {
	utils.StartStopOnce
	// contains filtered or unexported fields
}

func NewDRListener

func NewDRListener(oracle *ocr2dr_oracle.OCR2DROracle, jb job.Job, runner pipeline.Runner, jobORM job.ORM, pluginORM ORM, pluginConfig config.PluginConfig, logBroadcaster log.Broadcaster, lggr logger.Logger, mailMon *utils.MailboxMonitor) *DRListener

func (*DRListener) Close

func (l *DRListener) Close() error

Close complies with job.Service

func (*DRListener) HandleLog

func (l *DRListener) HandleLog(lb log.Broadcast)

HandleLog implements log.Listener

func (*DRListener) JobID

func (l *DRListener) JobID() int32

JobID() complies with log.Listener

func (*DRListener) Start

func (l *DRListener) Start(context.Context) error

Start complies with job.Service

type ErrType

type ErrType int8
const (
	NONE ErrType = iota
	NODE_EXCEPTION
	SANDBOX_TIMEOUT
	USER_EXCEPTION
)

func (ErrType) String

func (e ErrType) String() string

type ORM

type ORM interface {
	CreateRequest(requestID RequestID, receivedAt time.Time, requestTxHash *common.Hash, qopts ...pg.QOpt) error

	SetResult(requestID RequestID, runID int64, computationResult []byte, readyAt time.Time, qopts ...pg.QOpt) error
	SetError(requestID RequestID, runID int64, errorType ErrType, computationError []byte, readyAt time.Time, qopts ...pg.QOpt) error
	SetFinalized(requestID RequestID, reportedResult []byte, reportedError []byte, qopts ...pg.QOpt) error
	SetConfirmed(requestID RequestID, qopts ...pg.QOpt) error

	TimeoutExpiredResults(cutoff time.Time, limit uint32, qopts ...pg.QOpt) ([]RequestID, error)

	FindOldestEntriesByState(state RequestState, limit uint32, qopts ...pg.QOpt) ([]Request, error)
	FindById(requestID RequestID, qopts ...pg.QOpt) (*Request, error)
}

func NewORM added in v1.12.0

func NewORM(db *sqlx.DB, lggr logger.Logger, cfg pg.QConfig, contractAddress common.Address) ORM

type Request

type Request struct {
	RequestID         RequestID
	RunID             *int64
	ReceivedAt        time.Time
	RequestTxHash     *common.Hash
	State             RequestState
	ResultReadyAt     *time.Time
	Result            []byte
	ErrorType         *ErrType
	Error             []byte
	TransmittedResult []byte
	TransmittedError  []byte
}

type RequestID added in v1.11.0

type RequestID [RequestIDLength]byte

func (*RequestID) Scan added in v1.12.0

func (r *RequestID) Scan(value interface{}) error

func (RequestID) String added in v1.11.0

func (r RequestID) String() string

func (RequestID) Value added in v1.12.0

func (r RequestID) Value() (driver.Value, error)

type RequestState

type RequestState int8
const (
	// IN_PROGRESS is the initial state of a request, set right after receiving it in an on-chain event.
	IN_PROGRESS RequestState = iota

	// RESULT_READY means that computation has finished executing (with either success or error).
	// OCR2 reporting includes only requests in RESULT_READY state (for Query and Observation phases).
	RESULT_READY

	// TIMED_OUT request has been waiting to get confirmed on chain for too long.
	// It won't be included in OCR2 reporting rounds any more.
	TIMED_OUT

	// FINALIZED request is a part of a report produced by OCR2 and has now entered the transmission protocol
	// (i.e. passed through ShouldAcceptFinalizedReport()).
	FINALIZED

	// CONFIRMED state indicates that we received an on-chain confirmation event
	// (with or without this node's participation in an earlier OCR round).
	// We can transition here at any time (full fan-in) and cannot transition out (empty fan-out).
	// This is a desired and expected final state for every request.
	CONFIRMED
)

func (RequestState) String

func (s RequestState) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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