types

package
v1.39.1 Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DoNotModify = "[do-not-modify]"

	MaxNameLength        = 128
	MaxDescriptionLength = 4096
	MaxClientIDLength    = 128
	MaxRequestKeyLength  = 128
	MaxSchemaLength      = 512
	MaxURLLength         = 128

	MaxExecutableSize       = 8 * 1024        // 8kB
	MaxWasmCodeSize         = 512 * 1024      // 512kB
	MaxCompiledWasmCodeSize = 1 * 1024 * 1024 // 1MB
	MaxDataSize             = 256             // 256B

	MaximumOwasmGas = 20000000 // The half of block gas limit
)

nolint

View Source
const (
	// ModuleName is the name of the module.
	ModuleName = "bandoracle"

	// Version defines the current version the IBC oracle module supports
	Version = "bandchain-1"

	// StoreKey to be used when creating the KVStore.
	StoreKey = ModuleName

	// QuerierRoute is the querier route for the oracle module
	QuerierRoute = ModuleName

	// RouterKey is the msg router key for the oracle module
	RouterKey = ModuleName

	// PortID is the default port id that oracle module binds to.
	PortID = ModuleName
)

Variables

View Source
var (
	ErrOwasmCompilation         = sdkerrors.Register(ModuleName, 1, "owasm compilation failed")
	ErrBadWasmExecution         = sdkerrors.Register(ModuleName, 2, "bad wasm execution")
	ErrDataSourceNotFound       = sdkerrors.Register(ModuleName, 3, "data source not found")
	ErrOracleScriptNotFound     = sdkerrors.Register(ModuleName, 4, "oracle script not found")
	ErrRequestNotFound          = sdkerrors.Register(ModuleName, 5, "request not found")
	ErrRawRequestNotFound       = sdkerrors.Register(ModuleName, 6, "raw request not found")
	ErrReporterNotFound         = sdkerrors.Register(ModuleName, 7, "reporter not found")
	ErrResultNotFound           = sdkerrors.Register(ModuleName, 8, "result not found")
	ErrReporterAlreadyExists    = sdkerrors.Register(ModuleName, 9, "reporter already exists")
	ErrValidatorNotRequested    = sdkerrors.Register(ModuleName, 10, "validator not requested")
	ErrValidatorAlreadyReported = sdkerrors.Register(ModuleName, 11, "validator already reported")
	ErrInvalidReportSize        = sdkerrors.Register(ModuleName, 12, "invalid report size")
	ErrReporterNotAuthorized    = sdkerrors.Register(ModuleName, 13, "reporter not authorized")
	ErrEditorNotAuthorized      = sdkerrors.Register(ModuleName, 14, "editor not authorized")
	ErrValidatorAlreadyActive   = sdkerrors.Register(ModuleName, 16, "validator already active")
	ErrTooSoonToActivate        = sdkerrors.Register(ModuleName, 17, "too soon to activate")
	ErrTooLongName              = sdkerrors.Register(ModuleName, 18, "too long name")
	ErrTooLongDescription       = sdkerrors.Register(ModuleName, 19, "too long description")
	ErrEmptyExecutable          = sdkerrors.Register(ModuleName, 20, "empty executable")
	ErrEmptyWasmCode            = sdkerrors.Register(ModuleName, 21, "empty wasm code")
	ErrTooLargeExecutable       = sdkerrors.Register(ModuleName, 22, "too large executable")
	ErrTooLargeWasmCode         = sdkerrors.Register(ModuleName, 23, "too large wasm code")
	ErrInvalidMinCount          = sdkerrors.Register(ModuleName, 24, "invalid min count")
	ErrInvalidAskCount          = sdkerrors.Register(ModuleName, 25, "invalid ask count")
	ErrTooLargeCalldata         = sdkerrors.Register(ModuleName, 26, "too large calldata")
	ErrTooLongClientID          = sdkerrors.Register(ModuleName, 27, "too long client id")
	ErrEmptyRawRequests         = sdkerrors.Register(ModuleName, 28, "empty raw requests")
	ErrEmptyReport              = sdkerrors.Register(ModuleName, 29, "empty report")
	ErrDuplicateExternalID      = sdkerrors.Register(ModuleName, 30, "duplicate external id")
	ErrTooLongSchema            = sdkerrors.Register(ModuleName, 31, "too long schema")
	ErrTooLongURL               = sdkerrors.Register(ModuleName, 32, "too long url")
	ErrTooLargeRawReportData    = sdkerrors.Register(ModuleName, 33, "too large raw report data")
	ErrInsufficientValidators   = sdkerrors.Register(ModuleName, 34, "insufficient available validators")
	ErrCreateWithDoNotModify    = sdkerrors.Register(ModuleName, 35, "cannot create with [do-not-modify] content")
	ErrSelfReferenceAsReporter  = sdkerrors.Register(ModuleName, 36, "cannot reference self as reporter")
	ErrOBIDecode                = sdkerrors.Register(ModuleName, 37, "obi decode failed")
	ErrUncompressionFailed      = sdkerrors.Register(ModuleName, 38, "uncompression failed")
	ErrRequestAlreadyExpired    = sdkerrors.Register(ModuleName, 39, "request already expired")
	ErrBadDrbgInitialization    = sdkerrors.Register(ModuleName, 40, "bad drbg initialization")
	ErrMaxOracleChannels        = sdkerrors.Register(ModuleName, 41, "max oracle channels")
	ErrInvalidVersion           = sdkerrors.Register(ModuleName, 42, "invalid ICS20 version")
	ErrNotEnoughFee             = sdkerrors.Register(ModuleName, 43, "not enough fee")
	ErrInvalidOwasmGas          = sdkerrors.Register(ModuleName, 44, "invalid owasm gas")
	ErrIBCRequestDisabled       = sdkerrors.Register(ModuleName, 45, "sending oracle request via IBC is disabled")
	ErrInvalidRequestKey        = sdkerrors.Register(ModuleName, 46, "invalid request key")
	ErrTooLongRequestKey        = sdkerrors.Register(ModuleName, 47, "too long request key")
)
View Source
var (
	// RollingSeedSizeInBytes is the size of rolling block hash for random seed.
	RollingSeedSizeInBytes = 32
	// GlobalStoreKeyPrefix is the prefix for global primitive state variables.
	GlobalStoreKeyPrefix = []byte{0x00}
	// RollingSeedStoreKey is the key that keeps the seed based on the first 8-bit of the most recent 32 block hashes.
	RollingSeedStoreKey = append(GlobalStoreKeyPrefix, []byte("RollingSeed")...)
	// RequestCountStoreKey is the key that keeps the total request count.
	RequestCountStoreKey = append(GlobalStoreKeyPrefix, []byte("RequestCount")...)
	// RequestLastExpiredStoreKey is the key that keeps the ID of the last expired request, or 0 if none.
	RequestLastExpiredStoreKey = append(GlobalStoreKeyPrefix, []byte("RequestLastExpired")...)
	// PendingResolveListStoreKey is the key that keeps the list of pending-resolve requests.
	PendingResolveListStoreKey = append(GlobalStoreKeyPrefix, []byte("PendingList")...)
	// DataSourceCountStoreKey is the key that keeps the total data source count.
	DataSourceCountStoreKey = append(GlobalStoreKeyPrefix, []byte("DataSourceCount")...)
	// OracleScriptCountStoreKey is the key that keeps the total oracle sciprt count.
	OracleScriptCountStoreKey = append(GlobalStoreKeyPrefix, []byte("OracleScriptCount")...)

	// RequestStoreKeyPrefix is the prefix for request store.
	RequestStoreKeyPrefix = []byte{0x01}
	// ReportStoreKeyPrefix is the prefix for report store.
	ReportStoreKeyPrefix = []byte{0x02}
	// DataSourceStoreKeyPrefix is the prefix for data source store.
	DataSourceStoreKeyPrefix = []byte{0x03}
	// OracleScriptStoreKeyPrefix is the prefix for oracle script store.
	OracleScriptStoreKeyPrefix = []byte{0x04}
	// ReporterStoreKeyPrefix is the prefix for reporter store.
	ReporterStoreKeyPrefix = []byte{0x05}
	// ValidatorStatusKeyPrefix is the prefix for validator status store.
	ValidatorStatusKeyPrefix = []byte{0x06}
	// ResultStoreKeyPrefix is the prefix for request result store.
	ResultStoreKeyPrefix = []byte{0xff}

	// PortKey defines the key to store the port ID in store
	PortKey = []byte{0xf0}
)
View Source
var (
	DoNotModifyBytes = []byte(DoNotModify)
)

nolint

Functions

func DataSourceStoreKey

func DataSourceStoreKey(dataSourceID DataSourceID) []byte

DataSourceStoreKey returns the key to retrieve a specific data source from the store.

func GetEscrowAddress

func GetEscrowAddress(requestKey, portID, channelID string) sdk.AccAddress

GetEscrowAddress returns the escrow address for the specified channel and request key. The escrow address follows the format as outlined in ADR 028: https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-028-public-key-addresses.md

func OracleScriptStoreKey

func OracleScriptStoreKey(oracleScriptID OracleScriptID) []byte

OracleScriptStoreKey returns the key to retrieve a specific oracle script from the store.

func ReportStoreKey

func ReportStoreKey(requestID RequestID) []byte

ReportStoreKey returns the key to retrieve all data reports for a request.

func ReporterStoreKey

func ReporterStoreKey(validatorAddress sdk.ValAddress, reporterAddress sdk.AccAddress) []byte

ReporterStoreKey returns the key to check whether an address is a reporter of a validator.

func ReportersOfValidatorPrefixKey

func ReportersOfValidatorPrefixKey(val sdk.ValAddress) []byte

ReportersOfValidatorPrefixKey returns the prefix key to get all reporters of a validator.

func ReportsOfValidatorPrefixKey

func ReportsOfValidatorPrefixKey(reqID RequestID, val sdk.ValAddress) []byte

ReportsOfValidatorPrefixKey returns the prefix key to get all reports for a request from a validator.

func RequestStoreKey

func RequestStoreKey(requestID RequestID) []byte

RequestStoreKey returns the key to retrieve a specific request from the store.

func ResultStoreKey

func ResultStoreKey(requestID RequestID) []byte

ResultStoreKey returns the key to a request result in the store.

func ValidatorStatusStoreKey

func ValidatorStatusStoreKey(v sdk.ValAddress) []byte

ValidatorStatusStoreKey returns the key to a validator's status.

func WrapMaxError

func WrapMaxError(err error, got int, max int) error

WrapMaxError wraps an error message with additional info of the current and max values.

Types

type DataSourceID

type DataSourceID int64

DataSourceID is the type-safe unique identifier type for data sources.

type ExternalID

type ExternalID int64

ExternalID is the type-safe unique identifier type for raw data requests.

type OracleScriptID

type OracleScriptID int64

OracleScriptID is the type-safe unique identifier type for oracle scripts.

type RequestID

type RequestID int64

RequestID is the type-safe unique identifier type for data requests.

Jump to

Keyboard shortcuts

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