yoda

package
v3.0.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: GPL-3.0 Imports: 45 Imported by: 0

README

Yoda

Introduction

Yoda is a program that is used by BandChain's validator nodes to automatically fulfill data for oracle requests.

Since a subset of validators who are selected for a data request must return the data they received from running the specified data source(s), each of them have to send a MsgReportData transaction to BandChain in order to fulfill their duty.

Although the transaction can be sent manually by user, it is not convenient, and would be rather time-consuming. Furthermore, most data providers already have APIs that can be used to query data automatically by another software. Therefore, we have developed Yoda to help validators to automatically query data from data providers by executing data source script, then submit the result to fulfill the request.

For more detail about Yoda, please follows this link

Installation

Please refer to this documentation for the most up-to-date installation guide.

Documentation

Index

Constants

View Source
const (
	TxQuery = "tm.event = 'Tx' AND request.id EXISTS"
	// EventChannelCapacity is a buffer size of channel between node and this program
	EventChannelCapacity = 2000
)

Variables

View Source
var (
	DefaultYodaHome string
)

Global instances.

Functions

func GetDataSourceHash

func GetDataSourceHash(c *Context, l *Logger, id types.DataSourceID) (string, error)

GetDataSourceHash fetches data source hash by id

func GetEventValue

func GetEventValue(events []abci.Event, evType string, evKey string) (string, error)

GetEventValue checks and returns the exact value in the given log with the given type and key.

func GetEventValues

func GetEventValues(events []abci.Event, evType string, evKey string) (res []string)

GetEventValues returns the list of all values in the given log with the given type and key.

func GetExecutable

func GetExecutable(c *Context, l *Logger, hash string) ([]byte, error)

GetExecutable fetches data source executable using the provided client.

func GetRequest

func GetRequest(c *Context, l *Logger, id types.RequestID) (types.Request, error)

GetRequest fetches request by id

func Main

func Main()

func MustAtoi

func MustAtoi(num string) int64

func NewYodaCollector

func NewYodaCollector(c *Context) prometheus.Collector

func SubmitReport

func SubmitReport(c *Context, l *Logger, keyIndex int64, reports []ReportMsgWithKey)

Types

type Config

type Config struct {
	ChainID           string `mapstructure:"chain-id"`            // ChainID of the target chain
	NodeURI           string `mapstructure:"node"`                // Remote RPC URI of BandChain node to connect to
	Validator         string `mapstructure:"validator"`           // The validator address that I'm responsible for
	GasPrices         string `mapstructure:"gas-prices"`          // Gas prices of the transaction
	LogLevel          string `mapstructure:"log-level"`           // Log level of the logger
	Executor          string `mapstructure:"executor"`            // Executor name and URL (example: "Executor name:URL")
	BroadcastTimeout  string `mapstructure:"broadcast-timeout"`   // The time that Yoda will wait for tx commit
	RPCPollInterval   string `mapstructure:"rpc-poll-interval"`   // The duration of rpc poll interval
	MaxTry            uint64 `mapstructure:"max-try"`             // The maximum number of tries to submit a report transaction
	MaxReport         uint64 `mapstructure:"max-report"`          // The maximum number of reports in one transaction
	MetricsListenAddr string `mapstructure:"metrics-listen-addr"` // Address to listen on for prometheus metrics
}

Config data structure for yoda daemon.

type Context

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

type FeeEstimationData

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

type Logger

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

func NewLogger

func NewLogger(level log.FilterFunc) *Logger

func (*Logger) Debug

func (l *Logger) Debug(format string, args ...interface{})

func (*Logger) Error

func (l *Logger) Error(format string, c *Context, args ...interface{})

func (*Logger) Info

func (l *Logger) Info(format string, args ...interface{})

func (*Logger) With

func (l *Logger) With(keyvals ...interface{}) *Logger

type ReportMsgWithKey

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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