spec

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: Apache-2.0 Imports: 6 Imported by: 1 module, 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 (
	NOT_APPLICABLE  int64 = -1
	LATEST_BLOCK    int64 = -2
	EARLIEST_BLOCK  int64 = -3
	PENDING_BLOCK   int64 = -4
	SAFE_BLOCK      int64 = -5
	FINALIZED_BLOCK int64 = -6

	DEFAULT_PARSED_RESULT_INDEX = 0

	APIInterfaceJsonRPC       = "jsonrpc"
	APIInterfaceTendermintRPC = "tendermintrpc"
	APIInterfaceRest          = "rest"
	APIInterfaceGrpc          = "grpc"

	ParserArgLatest = "latest"

	EncodingBase64 = "base64"
	EncodingHex    = "hex"
)

Variables

View Source
var EXTENSION_name = map[int32]string{
	0: "NONE",
	1: "ARCHIVE",
}
View Source
var EXTENSION_value = map[string]int32{
	"NONE":    0,
	"ARCHIVE": 1,
}
View Source
var FUNCTION_TAG_name = map[int32]string{
	0: "DISABLED",
	1: "GET_BLOCKNUM",
	2: "GET_BLOCK_BY_NUM",
	3: "SET_LATEST_IN_METADATA",
	4: "SET_LATEST_IN_BODY",
	5: "VERIFICATION",
	6: "GET_EARLIEST_BLOCK",
	7: "SUBSCRIBE",
	8: "UNSUBSCRIBE",
	9: "UNSUBSCRIBE_ALL",
}
View Source
var FUNCTION_TAG_value = map[string]int32{
	"DISABLED":               0,
	"GET_BLOCKNUM":           1,
	"GET_BLOCK_BY_NUM":       2,
	"SET_LATEST_IN_METADATA": 3,
	"SET_LATEST_IN_BODY":     4,
	"VERIFICATION":           5,
	"GET_EARLIEST_BLOCK":     6,
	"SUBSCRIBE":              7,
	"UNSUBSCRIBE":            8,
	"UNSUBSCRIBE_ALL":        9,
}
View Source
var Header_HeaderType_name = map[int32]string{
	0: "pass_send",
	1: "pass_reply",
	2: "pass_both",
	3: "pass_ignore",
	4: "pass_nullify",
	5: "pass_override",
}
View Source
var Header_HeaderType_value = map[string]int32{
	"pass_send":     0,
	"pass_reply":    1,
	"pass_both":     2,
	"pass_ignore":   3,
	"pass_nullify":  4,
	"pass_override": 5,
}
View Source
var PARSER_FUNC_name = map[int32]string{
	0: "EMPTY",
	1: "PARSE_BY_ARG",
	2: "PARSE_CANONICAL",
	3: "PARSE_DICTIONARY",
	4: "PARSE_DICTIONARY_OR_ORDERED",
	6: "DEFAULT",
}
View Source
var PARSER_FUNC_value = map[string]int32{
	"EMPTY":                       0,
	"PARSE_BY_ARG":                1,
	"PARSE_CANONICAL":             2,
	"PARSE_DICTIONARY":            3,
	"PARSE_DICTIONARY_OR_ORDERED": 4,
	"DEFAULT":                     6,
}
View Source
var PARSER_TYPE_name = map[int32]string{
	0: "NO_PARSER",
	1: "BLOCK_LATEST",
	2: "BLOCK_EARLIEST",
	3: "RESULT",
	4: "EXTENSION_ARG",
	5: "IDENTIFIER",
	6: "DEFAULT_VALUE",
	7: "BLOCK_HASH",
}
View Source
var PARSER_TYPE_value = map[string]int32{
	"NO_PARSER":      0,
	"BLOCK_LATEST":   1,
	"BLOCK_EARLIEST": 2,
	"RESULT":         3,
	"EXTENSION_ARG":  4,
	"IDENTIFIER":     5,
	"DEFAULT_VALUE":  6,
	"BLOCK_HASH":     7,
}
View Source
var ParseValue_VerificationSeverity_name = map[int32]string{
	0: "Fail",
	1: "Warning",
}
View Source
var ParseValue_VerificationSeverity_value = map[string]int32{
	"Fail":    0,
	"Warning": 1,
}
View Source
var Spec_ProvidersTypes_name = map[int32]string{
	0: "dynamic",
	1: "static",
}
View Source
var Spec_ProvidersTypes_value = map[string]int32{
	"dynamic": 0,
	"static":  1,
}

Functions

func CombineFields

func CombineFields[T Combinable](
	childCombinables map[string]CurrentContainer,
	parentCombinables []T,
	mergedMap map[string]interface{},
	mergedCombinables []T,
	allowOverwrite bool,
) ([]T, map[string]interface{}, error)

CombineFields merges parentCombinables into the accumulated mergedCombinables list, honouring allowOverwrite semantics. Returns the updated list and map.

func CombineUnique

func CombineUnique[T Combinable](
	appendFrom, appendTo []T,
	currentMap map[string]CurrentContainer,
	allowOverwrite bool,
) ([]T, error)

CombineUnique appends elements from appendFrom into appendTo, skipping items whose key already exists in currentMap. When allowOverwrite is true, existing elements may be updated via their Overwrite method.

func DoExpandSpec

func DoExpandSpec(
	ctx context.Context,
	spec *Spec,
	depends map[string]bool,
	inherit *map[string]bool,
	details string,
	getSpecFn GetSpecFunc,
) (string, error)

DoExpandSpec recursively resolves all Imports for spec, merging the API collections of each imported parent into spec. depends tracks the set of spec indices currently on the call stack to detect import cycles; inherit accumulates every transitively imported index. details is a human-readable trace string that is extended with each recursive call and returned for diagnostic purposes.

func GetCurrentFromCombinable

func GetCurrentFromCombinable[T Combinable](current []T) map[string]CurrentContainer

GetCurrentFromCombinable builds a map from differentiator key to CurrentContainer for all elements already present in a slice.

func IsFinalizedBlock

func IsFinalizedBlock(requestedBlock, latestBlock, finalizationCriteria int64) bool

IsFinalizedBlock returns true when the requested block is old enough to be considered finalized relative to the latest known block and the chain's finalization criteria (number of confirmations required).

Types

type Api

type Api struct {
	Enabled           bool            `json:"enabled,omitempty"            mapstructure:"enabled"`
	Name              string          `json:"name"                         mapstructure:"name"`
	ComputeUnits      uint64          `json:"compute_units,omitempty"`
	ExtraComputeUnits uint64          `json:"extra_compute_units,omitempty"`
	Category          SpecCategory    `json:"category"`
	BlockParsing      BlockParser     `json:"block_parsing"`
	TimeoutMs         uint64          `json:"timeout_ms,omitempty"`
	Parsers           []GenericParser `json:"parsers,omitempty"`
}

Api describes a single RPC method or REST endpoint exposed by a provider.

func (*Api) Differeniator

func (api *Api) Differeniator() string

func (*Api) Equal

func (api *Api) Equal(that interface{}) bool

func (*Api) GetBlockParsing

func (m *Api) GetBlockParsing() BlockParser

func (*Api) GetCategory

func (m *Api) GetCategory() SpecCategory

func (*Api) GetComputeUnits

func (m *Api) GetComputeUnits() uint64

func (*Api) GetEnabled

func (m *Api) GetEnabled() bool

func (*Api) GetExtraComputeUnits

func (m *Api) GetExtraComputeUnits() uint64

func (*Api) GetName

func (m *Api) GetName() string

func (*Api) GetParsers

func (m *Api) GetParsers() []GenericParser

func (*Api) GetTimeoutMs

func (m *Api) GetTimeoutMs() uint64

func (*Api) Overwrite

func (api *Api) Overwrite(_ Combinable) (Combinable, bool)

type ApiCollection

type ApiCollection struct {
	Enabled         bool              `json:"enabled,omitempty"`
	CollectionData  CollectionData    `json:"collection_data"`
	Apis            []*Api            `json:"apis,omitempty"`
	Headers         []*Header         `json:"headers,omitempty"`
	InheritanceApis []*CollectionData `json:"inheritance_apis,omitempty"`
	ParseDirectives []*ParseDirective `json:"parse_directives,omitempty"`
	Extensions      []*Extension      `json:"extensions,omitempty"`
	Verifications   []*Verification   `json:"verifications,omitempty"`
}

ApiCollection groups a set of APIs and associated metadata under a single CollectionData key (interface + path + type + add-on).

func (*ApiCollection) CombineWithOthers

func (apic *ApiCollection) CombineWithOthers(others []*ApiCollection, combineWithDisabled, allowOverwrite bool) (err error)

CombineWithOthers merges APIs, headers, parse directives, extensions, and verifications from others into apic. combineWithDisabled controls whether disabled collections are still merged; allowOverwrite controls whether duplicate keys cause errors.

func (*ApiCollection) Equals

func (apic *ApiCollection) Equals(other *ApiCollection) bool

Equals reports whether two ApiCollections share the same CollectionData key.

func (*ApiCollection) Expand

func (apic *ApiCollection) Expand(myCollections map[CollectionData]*ApiCollection, dependencies map[CollectionData]struct{}) error

Expand resolves InheritanceApis for this collection by recursively expanding its dependencies from myCollections, then merging their content.

func (*ApiCollection) GetApis

func (m *ApiCollection) GetApis() []*Api

func (*ApiCollection) GetCollectionData

func (m *ApiCollection) GetCollectionData() CollectionData

func (*ApiCollection) GetEnabled

func (m *ApiCollection) GetEnabled() bool

func (*ApiCollection) GetExtensions

func (m *ApiCollection) GetExtensions() []*Extension

func (*ApiCollection) GetHeaders

func (m *ApiCollection) GetHeaders() []*Header

func (*ApiCollection) GetInheritanceApis

func (m *ApiCollection) GetInheritanceApis() []*CollectionData

func (*ApiCollection) GetParseDirectives

func (m *ApiCollection) GetParseDirectives() []*ParseDirective

func (*ApiCollection) GetVerifications

func (m *ApiCollection) GetVerifications() []*Verification

func (*ApiCollection) Inherit

func (apic *ApiCollection) Inherit(relevantCollections []*ApiCollection, _ map[CollectionData]struct{}) error

Inherit merges the already-expanded parent collections into this collection without tracking circular dependencies (cross-spec inheritance is allowed to share the same collection type).

func (*ApiCollection) InheritAllFields

func (apic *ApiCollection) InheritAllFields(myCollections map[CollectionData]*ApiCollection, relevantParentCollections []*ApiCollection) error

InheritAllFields first expands internal inheritance for this collection and then merges all parent collections into it.

type BlockParser

type BlockParser struct {
	ParserArg    []string    `json:"parser_arg,omitempty"`
	ParserFunc   PARSER_FUNC `json:"parser_func,omitempty"`
	DefaultValue string      `json:"default_value,omitempty"`
	Encoding     string      `json:"encoding,omitempty"`
}

BlockParser configures how a block number is extracted from a request or response, including optional encoding (base64 / hex).

func (*BlockParser) GetDefaultValue

func (m *BlockParser) GetDefaultValue() string

func (*BlockParser) GetEncoding

func (m *BlockParser) GetEncoding() string

func (*BlockParser) GetParserArg

func (m *BlockParser) GetParserArg() []string

func (*BlockParser) GetParserFunc

func (m *BlockParser) GetParserFunc() PARSER_FUNC

type Coin

type Coin struct {
	Denom  string `json:"denom"`
	Amount int64  `json:"amount"`
}

Coin is a simple token denomination and amount pair, replacing sdk.Coin with no Cosmos SDK dependency. Custom UnmarshalJSON handles the protobuf JSON convention where Amount is encoded as a quoted string (e.g. "5000000000").

func (*Coin) UnmarshalJSON

func (c *Coin) UnmarshalJSON(b []byte) error

UnmarshalJSON handles both quoted-string and numeric Amount values. Protobuf JSON encoding uses strings for large integers: {"denom":"ulava","amount":"5000000000"}

type CollectionData

type CollectionData struct {
	ApiInterface string `json:"api_interface" mapstructure:"api_interface"`
	InternalPath string `json:"internal_path" mapstructure:"internal_path"`
	Type         string `json:"type"          mapstructure:"type"`
	AddOn        string `json:"add_on"        mapstructure:"add_on"`
}

CollectionData is the composite key that uniquely identifies an ApiCollection within a Spec.

func (*CollectionData) CanExpand

func (cd *CollectionData) CanExpand(other *CollectionData) bool

CanExpand reports whether cd can inherit from other, i.e. both share the same ApiInterface and Type, or other acts as a base collection with an empty ApiInterface.

func (*CollectionData) GetAddOn

func (m *CollectionData) GetAddOn() string

func (*CollectionData) GetApiInterface

func (m *CollectionData) GetApiInterface() string

func (*CollectionData) GetInternalPath

func (m *CollectionData) GetInternalPath() string

func (*CollectionData) GetType

func (m *CollectionData) GetType() string

func (CollectionData) String

func (cd CollectionData) String() string

String returns a human-readable representation used for sorting and error messages.

type Combinable

type Combinable interface {
	// Differeniator returns the unique key used to identify this item within
	// its containing collection (e.g. Api.Name, FUNCTION_TAG string, etc.).
	// The intentional spelling matches the original codebase.
	Differeniator() string

	// GetEnabled reports whether this item is active.
	GetEnabled() bool

	// Equal reports deep equality against another Combinable of the same type.
	Equal(interface{}) bool

	// Overwrite is called when this Combinable is the survivor of a conflict
	// with other. It may mutate the receiver to merge data from other and
	// returns (overwritten, true) when a merge was performed, or (self, false)
	// when no special handling is needed.
	Overwrite(other Combinable) (overwritten Combinable, isOverwritten bool)
}

Combinable is implemented by all types that can be merged across ApiCollection inheritance boundaries (Api, Header, ParseDirective, Extension, Verification).

type CurrentContainer

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

CurrentContainer holds the index of a Combinable within its parent slice so that overwrite operations can update the correct position in-place.

type EXTENSION

type EXTENSION int32
const (
	EXTENSION_NONE    EXTENSION = 0
	EXTENSION_ARCHIVE EXTENSION = 1
)

func (EXTENSION) MarshalJSON

func (s EXTENSION) MarshalJSON() ([]byte, error)

func (EXTENSION) String

func (x EXTENSION) String() string

func (*EXTENSION) UnmarshalJSON

func (s *EXTENSION) UnmarshalJSON(b []byte) error

type Extension

type Extension struct {
	Name         string `json:"name"`
	Rule         *Rule  `json:"rule,omitempty"`
	CuMultiplier uint64 `json:"cu_multiplier,omitempty"`
}

Extension attaches additional rules (e.g. archive block depth) to an ApiCollection and adjusts the compute-unit cost via CuMultiplier.

func (*Extension) Differeniator

func (e *Extension) Differeniator() string

func (*Extension) Equal

func (e *Extension) Equal(that interface{}) bool

func (*Extension) GetCuMultiplier

func (m *Extension) GetCuMultiplier() uint64

func (*Extension) GetEnabled

func (e *Extension) GetEnabled() bool

func (*Extension) GetName

func (m *Extension) GetName() string

func (*Extension) GetRule

func (m *Extension) GetRule() *Rule

func (*Extension) Overwrite

func (e *Extension) Overwrite(_ Combinable) (Combinable, bool)

type FUNCTION_TAG

type FUNCTION_TAG int32
const (
	FUNCTION_TAG_DISABLED               FUNCTION_TAG = 0
	FUNCTION_TAG_GET_BLOCKNUM           FUNCTION_TAG = 1
	FUNCTION_TAG_GET_BLOCK_BY_NUM       FUNCTION_TAG = 2
	FUNCTION_TAG_SET_LATEST_IN_METADATA FUNCTION_TAG = 3
	FUNCTION_TAG_SET_LATEST_IN_BODY     FUNCTION_TAG = 4
	FUNCTION_TAG_VERIFICATION           FUNCTION_TAG = 5
	FUNCTION_TAG_GET_EARLIEST_BLOCK     FUNCTION_TAG = 6
	FUNCTION_TAG_SUBSCRIBE              FUNCTION_TAG = 7
	FUNCTION_TAG_UNSUBSCRIBE            FUNCTION_TAG = 8
	FUNCTION_TAG_UNSUBSCRIBE_ALL        FUNCTION_TAG = 9
)

func (FUNCTION_TAG) MarshalJSON

func (s FUNCTION_TAG) MarshalJSON() ([]byte, error)

func (FUNCTION_TAG) String

func (x FUNCTION_TAG) String() string

func (*FUNCTION_TAG) UnmarshalJSON

func (s *FUNCTION_TAG) UnmarshalJSON(b []byte) error

type FlexFloat64

type FlexFloat64 float64

FlexFloat64 is a float64 that accepts both string and numeric JSON values. Protobuf/cosmos JSON encoding uses strings for decimal types (e.g. "0.015").

func (FlexFloat64) Float64

func (f FlexFloat64) Float64() float64

func (FlexFloat64) MarshalJSON

func (f FlexFloat64) MarshalJSON() ([]byte, error)

func (*FlexFloat64) UnmarshalJSON

func (f *FlexFloat64) UnmarshalJSON(b []byte) error

type GenericParser

type GenericParser struct {
	ParsePath string      `json:"parse_path,omitempty"`
	Value     string      `json:"value,omitempty"`
	ParseType PARSER_TYPE `json:"parse_type,omitempty"`
	Rule      string      `json:"rule,omitempty"`
}

GenericParser extracts a value (e.g. a block number) from an RPC response using a JSONPath-like parse_path and an optional rule.

func (*GenericParser) GetParsePath

func (m *GenericParser) GetParsePath() string

func (*GenericParser) GetParseType

func (m *GenericParser) GetParseType() PARSER_TYPE

func (*GenericParser) GetRule

func (m *GenericParser) GetRule() string

func (*GenericParser) GetValue

func (m *GenericParser) GetValue() string

type GetSpecFunc

type GetSpecFunc func(ctx context.Context, index string) (Spec, bool)

GetSpecFunc is the callback signature used by DoExpandSpec to retrieve a parent spec by its chain index. The context parameter is accepted for interface compatibility with callers that hold a Cosmos sdk.Context (which satisfies context.Context); it is not used internally.

type Header struct {
	Name        string            `json:"name"`
	Kind        Header_HeaderType `json:"kind,omitempty"`
	FunctionTag FUNCTION_TAG      `json:"function_tag,omitempty"`
	Value       string            `json:"value,omitempty"`
}

Header describes an HTTP header that should be forwarded, rewritten, or stripped during relay processing.

func (*Header) Differeniator

func (h *Header) Differeniator() string

func (*Header) Equal

func (h *Header) Equal(that interface{}) bool

func (*Header) GetEnabled

func (h *Header) GetEnabled() bool

func (*Header) GetFunctionTag

func (m *Header) GetFunctionTag() FUNCTION_TAG

func (*Header) GetKind

func (m *Header) GetKind() Header_HeaderType

func (*Header) GetName

func (m *Header) GetName() string

func (*Header) GetValue

func (m *Header) GetValue() string

func (*Header) Overwrite

func (h *Header) Overwrite(_ Combinable) (Combinable, bool)

type Header_HeaderType

type Header_HeaderType int32
const (
	Header_pass_send     Header_HeaderType = 0
	Header_pass_reply    Header_HeaderType = 1
	Header_pass_both     Header_HeaderType = 2
	Header_pass_ignore   Header_HeaderType = 3
	Header_pass_nullify  Header_HeaderType = 4
	Header_pass_override Header_HeaderType = 5
)

func (Header_HeaderType) MarshalJSON

func (s Header_HeaderType) MarshalJSON() ([]byte, error)

func (Header_HeaderType) String

func (x Header_HeaderType) String() string

func (*Header_HeaderType) UnmarshalJSON

func (s *Header_HeaderType) UnmarshalJSON(b []byte) error

type PARSER_FUNC

type PARSER_FUNC int32
const (
	PARSER_FUNC_EMPTY                       PARSER_FUNC = 0
	PARSER_FUNC_PARSE_BY_ARG                PARSER_FUNC = 1
	PARSER_FUNC_PARSE_CANONICAL             PARSER_FUNC = 2
	PARSER_FUNC_PARSE_DICTIONARY            PARSER_FUNC = 3
	PARSER_FUNC_PARSE_DICTIONARY_OR_ORDERED PARSER_FUNC = 4
	PARSER_FUNC_DEFAULT                     PARSER_FUNC = 6
)

func (PARSER_FUNC) MarshalJSON

func (s PARSER_FUNC) MarshalJSON() ([]byte, error)

func (PARSER_FUNC) String

func (x PARSER_FUNC) String() string

func (*PARSER_FUNC) UnmarshalJSON

func (s *PARSER_FUNC) UnmarshalJSON(b []byte) error

type PARSER_TYPE

type PARSER_TYPE int32
const (
	PARSER_TYPE_NO_PARSER      PARSER_TYPE = 0
	PARSER_TYPE_BLOCK_LATEST   PARSER_TYPE = 1
	PARSER_TYPE_BLOCK_EARLIEST PARSER_TYPE = 2
	PARSER_TYPE_RESULT         PARSER_TYPE = 3
	PARSER_TYPE_EXTENSION_ARG  PARSER_TYPE = 4
	PARSER_TYPE_IDENTIFIER     PARSER_TYPE = 5
	PARSER_TYPE_DEFAULT_VALUE  PARSER_TYPE = 6
	PARSER_TYPE_BLOCK_HASH     PARSER_TYPE = 7
)

func (PARSER_TYPE) MarshalJSON

func (s PARSER_TYPE) MarshalJSON() ([]byte, error)

func (PARSER_TYPE) String

func (x PARSER_TYPE) String() string

func (*PARSER_TYPE) UnmarshalJSON

func (s *PARSER_TYPE) UnmarshalJSON(b []byte) error

type ParseDirective

type ParseDirective struct {
	FunctionTag      FUNCTION_TAG    `json:"function_tag,omitempty"`
	FunctionTemplate string          `json:"function_template,omitempty"`
	ResultParsing    BlockParser     `json:"result_parsing"`
	ApiName          string          `json:"api_name,omitempty"`
	Parsers          []GenericParser `json:"parsers,omitempty"`
}

ParseDirective maps a FUNCTION_TAG to a request template and result parser, enabling the node client to construct and interpret specific RPC calls.

func (*ParseDirective) Differeniator

func (parsing *ParseDirective) Differeniator() string

func (*ParseDirective) Equal

func (parsing *ParseDirective) Equal(that interface{}) bool

func (*ParseDirective) GetApiName

func (m *ParseDirective) GetApiName() string

func (*ParseDirective) GetEnabled

func (p *ParseDirective) GetEnabled() bool

func (*ParseDirective) GetFunctionTag

func (m *ParseDirective) GetFunctionTag() FUNCTION_TAG

func (*ParseDirective) GetFunctionTemplate

func (m *ParseDirective) GetFunctionTemplate() string

func (*ParseDirective) GetParsers

func (m *ParseDirective) GetParsers() []GenericParser

func (*ParseDirective) GetResultParsing

func (m *ParseDirective) GetResultParsing() BlockParser

func (*ParseDirective) Overwrite

func (parsing *ParseDirective) Overwrite(_ Combinable) (Combinable, bool)

type ParseValue

type ParseValue struct {
	Extension      string                          `json:"extension,omitempty"`
	ExpectedValue  string                          `json:"expected_value,omitempty"`
	LatestDistance uint64                          `json:"latest_distance,omitempty"`
	Severity       ParseValue_VerificationSeverity `json:"severity,omitempty"`
}

ParseValue holds a single expected response value for a Verification, optionally scoped to a named extension and with configurable severity.

func (*ParseValue) GetExpectedValue

func (m *ParseValue) GetExpectedValue() string

func (*ParseValue) GetExtension

func (m *ParseValue) GetExtension() string

func (*ParseValue) GetLatestDistance

func (m *ParseValue) GetLatestDistance() uint64

func (*ParseValue) GetSeverity

type ParseValue_VerificationSeverity

type ParseValue_VerificationSeverity int32
const (
	ParseValue_Fail    ParseValue_VerificationSeverity = 0
	ParseValue_Warning ParseValue_VerificationSeverity = 1
)

func (ParseValue_VerificationSeverity) MarshalJSON

func (s ParseValue_VerificationSeverity) MarshalJSON() ([]byte, error)

func (ParseValue_VerificationSeverity) String

func (*ParseValue_VerificationSeverity) UnmarshalJSON

func (s *ParseValue_VerificationSeverity) UnmarshalJSON(b []byte) error

type QueryClient

type QueryClient interface {
	Spec(ctx context.Context, in *QueryGetSpecRequest, opts ...grpc.CallOption) (*QueryGetSpecResponse, error)
}

QueryClient is a subset of the full spec module query client interface. Only the Spec method is retained here; callers that need the full set of queries (SpecAll, ShowAllChains, etc.) should extend this interface or use the generated gRPC client directly.

func NewQueryClient

func NewQueryClient(cc grpc.ClientConnInterface) QueryClient

NewQueryClient returns a QueryClient that sends requests over the provided gRPC connection. The cc parameter is intentionally typed as grpc.ClientConnInterface so that both standard *grpc.ClientConn values and Cosmos gogoproto grpc.ClientConn implementations (which satisfy the same Invoke / NewStream contract) can be passed without a cast.

type QueryGetSpecRequest

type QueryGetSpecRequest struct {
	ChainID string `json:"ChainID"`
}

QueryGetSpecRequest is the request message for the Spec gRPC query.

func (*QueryGetSpecRequest) GetChainID

func (m *QueryGetSpecRequest) GetChainID() string

GetChainID returns the ChainID field (nil-safe getter matching the original protobuf-generated API).

type QueryGetSpecResponse

type QueryGetSpecResponse struct {
	Spec Spec `json:"Spec"`
}

QueryGetSpecResponse is the response message for the Spec gRPC query.

func (*QueryGetSpecResponse) GetSpec

func (m *QueryGetSpecResponse) GetSpec() Spec

GetSpec returns the Spec field (nil-safe getter matching the original protobuf-generated API).

type Rule

type Rule struct {
	Block uint64 `json:"block,omitempty"`
}

Rule defines a threshold block number used by Extension.

func (*Rule) GetBlock

func (m *Rule) GetBlock() uint64

type Spec

type Spec struct {
	Index                         string              `json:"index"                            mapstructure:"index"`
	Name                          string              `json:"name"                             mapstructure:"name"`
	Enabled                       bool                `json:"enabled,omitempty"`
	ReliabilityThreshold          uint32              `json:"reliability_threshold,omitempty"`
	DataReliabilityEnabled        bool                `json:"data_reliability_enabled,omitempty"`
	BlockDistanceForFinalizedData uint32              `json:"block_distance_for_finalized_data,omitempty"`
	BlocksInFinalizationProof     uint32              `json:"blocks_in_finalization_proof,omitempty"`
	AverageBlockTime              int64               `json:"average_block_time,omitempty"`
	AllowedBlockLagForQosSync     int64               `json:"allowed_block_lag_for_qos_sync,omitempty"`
	BlockLastUpdated              uint64              `json:"block_last_updated,omitempty"`
	MinStakeProvider              Coin                `json:"min_stake_provider"`
	ProvidersTypes                Spec_ProvidersTypes `json:"providers_types,omitempty"`
	Imports                       []string            `json:"imports,omitempty"`
	ApiCollections                []*ApiCollection    `json:"api_collections,omitempty"`
	Contributor                   []string            `json:"contributor,omitempty"`
	ContributorPercentage         *FlexFloat64        `json:"contributor_percentage,omitempty"`
	Shares                        uint64              `json:"shares,omitempty"`
	Identity                      string              `json:"identity,omitempty"`
}

Spec describes a single blockchain specification including all API collections, performance parameters, and governance metadata.

func (*Spec) CombineCollections

func (spec *Spec) CombineCollections(parentsCollections map[CollectionData][]*ApiCollection) error

CombineCollections appends parent api collections that are not already present in the current spec, combining multiple parent entries for the same CollectionData into a single merged collection.

func (*Spec) GetAllowedBlockLagForQosSync

func (m *Spec) GetAllowedBlockLagForQosSync() int64

func (*Spec) GetApiCollections

func (m *Spec) GetApiCollections() []*ApiCollection

func (*Spec) GetAverageBlockTime

func (m *Spec) GetAverageBlockTime() int64

func (*Spec) GetBlockDistanceForFinalizedData

func (m *Spec) GetBlockDistanceForFinalizedData() uint32

func (*Spec) GetBlockLastUpdated

func (m *Spec) GetBlockLastUpdated() uint64

func (*Spec) GetBlocksInFinalizationProof

func (m *Spec) GetBlocksInFinalizationProof() uint32

func (*Spec) GetContributor

func (m *Spec) GetContributor() []string

func (*Spec) GetContributorPercentage

func (m *Spec) GetContributorPercentage() *FlexFloat64

func (*Spec) GetDataReliabilityEnabled

func (m *Spec) GetDataReliabilityEnabled() bool

func (*Spec) GetEnabled

func (m *Spec) GetEnabled() bool

func (*Spec) GetIdentity

func (m *Spec) GetIdentity() string

func (*Spec) GetImports

func (m *Spec) GetImports() []string

func (*Spec) GetIndex

func (m *Spec) GetIndex() string

func (*Spec) GetMinStakeProvider

func (m *Spec) GetMinStakeProvider() Coin

func (*Spec) GetName

func (m *Spec) GetName() string

func (*Spec) GetProvidersTypes

func (m *Spec) GetProvidersTypes() Spec_ProvidersTypes

func (*Spec) GetReliabilityThreshold

func (m *Spec) GetReliabilityThreshold() uint32

func (*Spec) GetShares

func (m *Spec) GetShares() uint64

type SpecAddProposal

type SpecAddProposal struct {
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
	Specs       []Spec `json:"specs"`
}

SpecAddProposal represents a governance proposal to add or update one or more specs. It mirrors the original protobuf-generated type that was removed together with the blockchain modules.

type SpecAddProposalJSON

type SpecAddProposalJSON struct {
	Proposal SpecAddProposal `json:"proposal"`
	Deposit  string          `json:"deposit,omitempty" yaml:"deposit,omitempty"`
}

SpecAddProposalJSON is the on-disk JSON envelope used by spec proposal files. It is the authoritative format understood by the spec fetcher and loader.

type SpecCategory

type SpecCategory struct {
	Deterministic bool   `json:"deterministic,omitempty"`
	Local         bool   `json:"local,omitempty"`
	Subscription  bool   `json:"subscription,omitempty"`
	Stateful      uint32 `json:"stateful,omitempty"`
	HangingApi    bool   `json:"hanging_api,omitempty"`
}

SpecCategory classifies API behaviour (determinism, statefulness, etc.) and is used to select appropriate providers and routing strategies.

func (SpecCategory) Combine

func (sc SpecCategory) Combine(other SpecCategory) SpecCategory

Combine merges two SpecCategory values following the spec inheritance rules: Deterministic is AND-ed (both must agree), all boolean flags are OR-ed, and Stateful takes the maximum value.

func (*SpecCategory) GetDeterministic

func (m *SpecCategory) GetDeterministic() bool

func (*SpecCategory) GetHangingApi

func (m *SpecCategory) GetHangingApi() bool

func (*SpecCategory) GetLocal

func (m *SpecCategory) GetLocal() bool

func (*SpecCategory) GetStateful

func (m *SpecCategory) GetStateful() uint32

func (*SpecCategory) GetSubscription

func (m *SpecCategory) GetSubscription() bool

type Spec_ProvidersTypes

type Spec_ProvidersTypes int32
const (
	Spec_dynamic Spec_ProvidersTypes = 0
	Spec_static  Spec_ProvidersTypes = 1
)

func (Spec_ProvidersTypes) MarshalJSON

func (s Spec_ProvidersTypes) MarshalJSON() ([]byte, error)

func (Spec_ProvidersTypes) String

func (x Spec_ProvidersTypes) String() string

func (*Spec_ProvidersTypes) UnmarshalJSON

func (s *Spec_ProvidersTypes) UnmarshalJSON(b []byte) error

type Verification

type Verification struct {
	Name           string          `json:"name"`
	ParseDirective *ParseDirective `json:"parse_directive,omitempty"`
	Values         []*ParseValue   `json:"values,omitempty"`
}

Verification pairs a ParseDirective with a set of expected values, enabling the consumer to verify provider responses against known-good answers.

func (*Verification) Differeniator

func (v *Verification) Differeniator() string

func (*Verification) Equal

func (v *Verification) Equal(that interface{}) bool

func (*Verification) GetEnabled

func (v *Verification) GetEnabled() bool

func (*Verification) GetName

func (m *Verification) GetName() string

func (*Verification) GetParseDirective

func (m *Verification) GetParseDirective() *ParseDirective

func (*Verification) GetValues

func (m *Verification) GetValues() []*ParseValue

func (*Verification) Overwrite

func (v *Verification) Overwrite(other Combinable) (Combinable, bool)

Verification.Overwrite handles the case where this verification has no ParseDirective but the other one does: it borrows the directive and merges any non-overridden Values from the other verification.

Jump to

Keyboard shortcuts

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