types

package
v0.4.0-dev.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	EventTypeTallyCompletion = "tally_completion"

	AttributeDataRequestID = "dr_id"
	AttributeDataResultID  = "id"
	AttributeTypeConsensus = "consensus"
	AttributeTallyVMStdOut = "tally_vm_stdout"
	AttributeTallyVMStdErr = "tally_vm_stderr"
	AttributeExecGasUsed   = "exec_gas_used"
	AttributeTallyGasUsed  = "tally_gas_used"
	AttributeTallyExitCode = "exit_code"
	AttributeProxyPubKeys  = "proxy_public_keys"
)
View Source
const (
	ModuleName = "tally"
	StoreKey   = ModuleName
)
View Source
const (
	DefaultMaxTallyGasLimit = 300_000_000_000_000
)

Variables

View Source
var (
	ErrInvalidFilterType   = errors.Register("tally", 2, "invalid filter type")
	ErrFilterInputTooShort = errors.Register("tally", 3, "filter input length too short")
	ErrInvalidPathLen      = errors.Register("tally", 4, "invalid JSON path length")
	ErrEmptyReveals        = errors.Register("tally", 5, "no reveals given")
	ErrCorruptReveals      = errors.Register("tally", 6, "> 1/3 of reveals are corrupted")
	ErrNoConsensus         = errors.Register("tally", 7, "> 1/3 of reveals do not agree on reveal data")
	ErrNoBasicConsensus    = errors.Register("tally", 8, "> 1/3 of reveals do not agree on (exit_code, proxy_pub_keys)")
	ErrInvalidNumberType   = errors.Register("tally", 9, "invalid number type specified")
	ErrFilterUnexpected    = errors.Register("tally", 10, "unexpected error occurred in filter")
	ErrInvalidSaltLength   = errors.Register("tally", 11, "salt should be 32-byte long")
)
View Source
var (
	ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthTally        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTally          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTally = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthTx        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTx          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)
View Source
var Msg_serviceDesc = _Msg_serviceDesc
View Source
var ParamsPrefix = collections.NewPrefix(0)

Functions

func RegisterMsgServer

func RegisterMsgServer(s grpc1.Server, srv MsgServer)

Types

type BatchingKeeper

type BatchingKeeper interface {
	SetDataResultForBatching(ctx context.Context, result batchingtypes.DataResult) error
}

type Filter

type Filter interface {
	// ApplyFilter takes in a list of reveals and returns an outlier
	// list, whose value at index i indicates whether i-th reveal is
	// an outlier. Value of 1 indicates an outlier, and value of 0
	// indicates a non-outlier reveal.
	ApplyFilter(reveals []RevealBody) ([]int, error)
}

type FilterMode

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

func NewFilterMode

func NewFilterMode(input []byte) (FilterMode, error)

NewFilterMode constructs a new FilerMode object given a filter input. Mode filter input looks as follows: 0 1 9 9+data_path_length | filter_type | data_path_length | data_path |

func (FilterMode) ApplyFilter

func (f FilterMode) ApplyFilter(reveals []RevealBody) ([]int, error)

ApplyFilter applies the Mode Filter and returns an outlier list. (i) If more than 1/3 of reveals are corrupted, a corrupt reveals error is returned without an outlier list. (ii) Otherwise, a reveal is declared an outlier if it does not match the mode value. If less than 2/3 of the reveals are non-outliers, "no consensus" error is returned along with an outlier list.

type FilterNone

type FilterNone struct{}

func NewFilterNone

func NewFilterNone(_ []byte) (FilterNone, error)

NewFilterNone constructs a new FilterNone object.

func (FilterNone) ApplyFilter

func (f FilterNone) ApplyFilter(reveals []RevealBody) ([]int, error)

FilterNone declares all reveals as non-outliers, unless reveals are empty or corrupt.

type FilterStdDev

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

func NewFilterStdDev

func NewFilterStdDev(input []byte) (FilterStdDev, error)

NewFilterStdDev constructs a new FilterStdDev object given a filter input. Standard deviation filter input looks as follows: 0 1 9 10 18 18+json_path_length | filter_type | max_sigma | number_type | json_path_length | json_path |

func (FilterStdDev) ApplyFilter

func (f FilterStdDev) ApplyFilter(reveals []RevealBody) ([]int, error)

ApplyFilter applies the Standard Deviation Filter and returns an outlier list. (i) If more than 1/3 of reveals are corrupted (i.e. invalid json path, invalid bytes, etc.), a corrupt reveals error is returned without an outlier list. (ii) If the number type is invalid, an error is returned without an outlier list. (iii) Otherwise, an outlier list is returned. A reveal is declared an outlier if it deviates from the median by more than the given max sigma. If less than 2/3 of the reveals are non-outliers, "no consensus" error is returned as well.

type GenesisState

type GenesisState struct {
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}

GenesisState defines tally module's genesis state.

func (*GenesisState) Descriptor

func (*GenesisState) Descriptor() ([]byte, []int)

func (*GenesisState) GetParams

func (m *GenesisState) GetParams() Params

func (*GenesisState) Marshal

func (m *GenesisState) Marshal() (dAtA []byte, err error)

func (*GenesisState) MarshalTo

func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)

func (*GenesisState) MarshalToSizedBuffer

func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GenesisState) ProtoMessage

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset

func (m *GenesisState) Reset()

func (*GenesisState) Size

func (m *GenesisState) Size() (n int)

func (*GenesisState) String

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal

func (m *GenesisState) Unmarshal(dAtA []byte) error

func (*GenesisState) XXX_DiscardUnknown

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal

func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GenesisState) XXX_Merge

func (m *GenesisState) XXX_Merge(src proto.Message)

func (*GenesisState) XXX_Size

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal

func (m *GenesisState) XXX_Unmarshal(b []byte) error

type HalfStepInt

type HalfStepInt[T constraints.Integer] struct {
	// contains filtered or unexported fields
}

HalfStepInt is an integer type with half-step increments (0.5).

func (HalfStepInt[T]) IsWithinSigma

func (h HalfStepInt[T]) IsWithinSigma(x T, maxSigma Sigma) bool

IsWithinSigma returns true if and only if the integer x is within the maxSigma range from the halfStepInt h. That is, IsWithinSigma returns true if and only if the absolute difference between x and h is less than or equal to maxSigma.

func (*HalfStepInt[T]) Mid

func (h *HalfStepInt[T]) Mid(x, y T) *HalfStepInt[T]

Mid sets h to the middle point between the two integers x and y and returns h.

type MsgClient

type MsgClient interface {
	// The UpdateParams method updates the module's parameters.
	UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
}

MsgClient is the client API for Msg service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewMsgClient

func NewMsgClient(cc grpc1.ClientConn) MsgClient

type MsgServer

type MsgServer interface {
	// The UpdateParams method updates the module's parameters.
	UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
}

MsgServer is the server API for Msg service.

type MsgUpdateParams

type MsgUpdateParams struct {
	// authority is the address that controls the module (defaults to x/gov unless
	// overwritten).
	Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
	Params    Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"`
}

The request message for the UpdateParams method.

func (*MsgUpdateParams) Descriptor

func (*MsgUpdateParams) Descriptor() ([]byte, []int)

func (*MsgUpdateParams) GetAuthority

func (m *MsgUpdateParams) GetAuthority() string

func (*MsgUpdateParams) GetParams

func (m *MsgUpdateParams) GetParams() Params

func (*MsgUpdateParams) Marshal

func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error)

func (*MsgUpdateParams) MarshalTo

func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error)

func (*MsgUpdateParams) MarshalToSizedBuffer

func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgUpdateParams) ProtoMessage

func (*MsgUpdateParams) ProtoMessage()

func (*MsgUpdateParams) Reset

func (m *MsgUpdateParams) Reset()

func (*MsgUpdateParams) Size

func (m *MsgUpdateParams) Size() (n int)

func (*MsgUpdateParams) String

func (m *MsgUpdateParams) String() string

func (*MsgUpdateParams) Unmarshal

func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error

func (*MsgUpdateParams) XXX_DiscardUnknown

func (m *MsgUpdateParams) XXX_DiscardUnknown()

func (*MsgUpdateParams) XXX_Marshal

func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgUpdateParams) XXX_Merge

func (m *MsgUpdateParams) XXX_Merge(src proto.Message)

func (*MsgUpdateParams) XXX_Size

func (m *MsgUpdateParams) XXX_Size() int

func (*MsgUpdateParams) XXX_Unmarshal

func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error

type MsgUpdateParamsResponse

type MsgUpdateParamsResponse struct {
}

The response message for the UpdateParams method.

func (*MsgUpdateParamsResponse) Descriptor

func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int)

func (*MsgUpdateParamsResponse) Marshal

func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error)

func (*MsgUpdateParamsResponse) MarshalTo

func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error)

func (*MsgUpdateParamsResponse) MarshalToSizedBuffer

func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgUpdateParamsResponse) ProtoMessage

func (*MsgUpdateParamsResponse) ProtoMessage()

func (*MsgUpdateParamsResponse) Reset

func (m *MsgUpdateParamsResponse) Reset()

func (*MsgUpdateParamsResponse) Size

func (m *MsgUpdateParamsResponse) Size() (n int)

func (*MsgUpdateParamsResponse) String

func (m *MsgUpdateParamsResponse) String() string

func (*MsgUpdateParamsResponse) Unmarshal

func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error

func (*MsgUpdateParamsResponse) XXX_DiscardUnknown

func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown()

func (*MsgUpdateParamsResponse) XXX_Marshal

func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgUpdateParamsResponse) XXX_Merge

func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message)

func (*MsgUpdateParamsResponse) XXX_Size

func (m *MsgUpdateParamsResponse) XXX_Size() int

func (*MsgUpdateParamsResponse) XXX_Unmarshal

func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error

type Params

type Params struct {
	// max_tally_gas_limit is the maximum gas limit for a tally request.
	MaxTallyGasLimit uint64 `protobuf:"varint,1,opt,name=max_tally_gas_limit,json=maxTallyGasLimit,proto3" json:"max_tally_gas_limit,omitempty"`
}

Params defines the parameters for the tally module.

func DefaultParams

func DefaultParams() Params

DefaultParams returns default tally module parameters.

func (*Params) Descriptor

func (*Params) Descriptor() ([]byte, []int)

func (*Params) GetMaxTallyGasLimit

func (m *Params) GetMaxTallyGasLimit() uint64

func (*Params) Marshal

func (m *Params) Marshal() (dAtA []byte, err error)

func (*Params) MarshalTo

func (m *Params) MarshalTo(dAtA []byte) (int, error)

func (*Params) MarshalToSizedBuffer

func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Params) ProtoMessage

func (*Params) ProtoMessage()

func (*Params) Reset

func (m *Params) Reset()

func (*Params) Size

func (m *Params) Size() (n int)

func (*Params) String

func (m *Params) String() string

func (*Params) Unmarshal

func (m *Params) Unmarshal(dAtA []byte) error

func (*Params) Validate

func (p *Params) Validate() error

ValidateBasic performs basic validation on tally module parameters.

func (*Params) XXX_DiscardUnknown

func (m *Params) XXX_DiscardUnknown()

func (*Params) XXX_Marshal

func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Params) XXX_Merge

func (m *Params) XXX_Merge(src proto.Message)

func (*Params) XXX_Size

func (m *Params) XXX_Size() int

func (*Params) XXX_Unmarshal

func (m *Params) XXX_Unmarshal(b []byte) error

type Request

type Request struct {
	ID                string                `json:"id"`
	Height            uint64                `json:"height"`
	ExecProgramID     string                `json:"exec_program_id"`
	ExecInputs        string                `json:"exec_inputs"`
	ExecGasLimit      uint64                `json:"exec_gas_limit"`
	TallyProgramID    string                `json:"tally_program_id"`
	TallyInputs       string                `json:"tally_inputs"`
	TallyGasLimit     uint64                `json:"tally_gas_limit"`
	GasPrice          string                `json:"gas_price"`
	Memo              string                `json:"memo"`
	PaybackAddress    string                `json:"payback_address"`
	ReplicationFactor int64                 `json:"replication_factor"`
	ConsensusFilter   string                `json:"consensus_filter"`
	Commits           map[string][]byte     `json:"commits"`
	Reveals           map[string]RevealBody `json:"reveals"`
	SedaPayload       string                `json:"seda_payload"`
	Version           string                `json:"version"`
}

type RevealBody

type RevealBody struct {
	ID           string   `json:"id"`
	Salt         []byte   `json:"salt"`
	ExitCode     byte     `json:"exit_code"`
	GasUsed      uint64   `json:"gas_used"`
	Reveal       string   `json:"reveal"` // base64-encoded string
	ProxyPubKeys []string `json:"proxy_public_keys"`
}

func (*RevealBody) MarshalJSON

func (u *RevealBody) MarshalJSON() ([]byte, error)

type Sigma

type Sigma uint64

Sigma is a 10^6 precision fixed-point unsigned number represented by a uint64, whose last 6 digits represent the fractional part.

func NewSigma

func NewSigma(data []byte) (Sigma, error)

func (Sigma) FractionalPart

func (s Sigma) FractionalPart() uint64

FractionalPart returns Sigma's fractional part as a uint64. For example, the fractional part of Sigma(1_500_000) is 500_000, representing the fraction 500_000 / 1_000_000.

func (Sigma) WholeNumber

func (s Sigma) WholeNumber() uint64

WholeNumber returns Sigma's whole number part. For example, the whole number part of Sigma(1_000_000) is 1.

type SudoRemoveDataRequest

type SudoRemoveDataRequest struct {
	ID string `json:"dr_id"`
}

SudoRemoveDataRequest is the message type used to remove a given data request from the Core Contract.

type UnimplementedMsgServer

type UnimplementedMsgServer struct {
}

UnimplementedMsgServer can be embedded to have forward compatible implementations.

func (*UnimplementedMsgServer) UpdateParams

type WasmStorageKeeper

type WasmStorageKeeper interface {
	GetCoreContractAddr(ctx context.Context) (sdk.AccAddress, error)
	GetOracleProgram(ctx context.Context, hash string) (types.OracleProgram, error)
}

Jump to

Keyboard shortcuts

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