yoda

package
v1.2.7-0...-4cd777e Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: GPL-3.0 Imports: 39 Imported by: 0

README

Yoda

Prepare environment

  1. Install PostgresSQL brew install postgresql
  2. Install Golang
  3. Install Rust
  4. Install Docker
  5. run cd owasm/chaintests/bitcoin_block_count/
  6. run wasm-pack build .
  7. make install in chain directory
  8. Open 3 tabs on cmd
  9. run docker pull bandprotocol/runtime:1.0.2

How to install and run Yoda

  1. Open first cmd tab for running the BandChain
  2. Open second cmd tab for running the Yoda
  3. Open third cmd tab for running the BandChain CLI

How to run BandChain on development mode

  1. Go to chain directory
  2. Setup your PostgresSQL user, port and database name on start_bandd.sh
  3. run chmod +x scripts/start_bandd.sh to change the access permission of start_bandd.script
  4. run ./scripts/start_bandd.sh to start BandChain
  5. If fail, try owasm pack build then run script again.
cd ../owasm/chaintests/bitcoin_block_count/
wasm-pack build .
cd ../../../chain

How to run Yoda

  1. Go to chain directory
  2. run chmod +x scripts/start_yoda.sh to change the access permission of start_yoda.script
  3. run ./scripts/start_yoda.sh validator [number of reporter] to start Yoda

Try to request data BandChain

After we have BandChain and Yoda running, now we can request data on BandChain. Example of requesting data on BandChain

bandcli tx oracle request 1 -c 0000000342544300000000000003e8 1 1  --from requester --chain-id bandchain --gas 3000000 --keyring-backend test  --from requester

Documentation

Index

Constants

View Source
const (
	// TODO: We can subscribe only for txs that contain request messages
	TxQuery = "tm.event = 'Tx'"
	// EventChannelCapacity is a buffer size of channel between node and this program
	EventChannelCapacity = 2000
)

TODO: refactor yoda to more consistent errors

Variables

This section is empty.

Functions

func GetDataProviderRewardPerByte

func GetDataProviderRewardPerByte(c *Context, l *Logger) (sdk.Dec, error)

todo for refactoring

func GetDataSource

func GetDataSource(c *Context, l *Logger, id types.DataSourceID) (types.DataSource, error)

func GetEventValue

func GetEventValue(log sdk.ABCIMessageLog, 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(log sdk.ABCIMessageLog, 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 GetRawRequests

func GetRawRequests(c *Context, l *Logger, log sdk.ABCIMessageLog) ([]rawRequest, error)

GetRawRequests returns the list of all raw data requests in the given log.

func GetRequest

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

GetRequest fetches request by id

func Main

func Main()

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
}

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.Option) *Logger

func (*Logger) Debug

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

func (*Logger) Error

func (l *Logger) Error(format string, 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
}

type VerificationMessage

type VerificationMessage struct {
	ChainID    string           `json:"chain_id"`
	Validator  sdk.ValAddress   `json:"validator"`
	RequestID  types.RequestID  `json:"request_id"`
	ExternalID types.ExternalID `json:"external_id"`
}

func NewVerificationMessage

func NewVerificationMessage(
	chainID string, validator sdk.ValAddress, requestID types.RequestID, externalID types.ExternalID,
) VerificationMessage

func (VerificationMessage) GetSignBytes

func (msg VerificationMessage) GetSignBytes() []byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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