types

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 38 Imported by: 6

Documentation

Overview

Package types is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	// ModuleName defines the module name
	ModuleName = "challenge"

	// StoreKey defines the primary module store key
	StoreKey = ModuleName

	// RouterKey defines the module's message routing key
	RouterKey = ModuleName

	// MemStoreKey defines the in-memory store key
	MemStoreKey = "mem_challenge"

	// TStoreKey defines transient store key
	TStoreKey = "transient_challenge"
)
View Source
const BlsSignatureLength = 96

BlsSignatureLength defines the length of bls signature

View Source
const DefaultIndex uint64 = 1

DefaultIndex is the default global index

View Source
const RedundancyIndexPrimary = int32(-1)

RedundancyIndexPrimary defines the redundancy index for primary storage provider (asked by storage provider api)

View Source
const TypeMsgAttest = "attest"
View Source
const TypeMsgSubmit = "submit"

Variables

View Source
var (
	ErrUnknownSp               = sdkerrors.Register(ModuleName, 1, "unknown storage provider")
	ErrUnknownObject           = sdkerrors.Register(ModuleName, 2, "unknown object info")
	ErrInvalidSpStatus         = sdkerrors.Register(ModuleName, 3, "invalid storage provider status")
	ErrInvalidObjectStatus     = sdkerrors.Register(ModuleName, 4, "invalid object status to challenge")
	ErrNotStoredOnSp           = sdkerrors.Register(ModuleName, 5, "the object is not stored on the storage provider")
	ErrExistsRecentSlash       = sdkerrors.Register(ModuleName, 6, "the storage provider and object info had been slashed recently")
	ErrInvalidSegmentIndex     = sdkerrors.Register(ModuleName, 7, "the segment/piece index is invalid")
	ErrInvalidChallengeId      = sdkerrors.Register(ModuleName, 8, "invalid challenge id")
	ErrInvalidVoteResult       = sdkerrors.Register(ModuleName, 9, "invalid vote result")
	ErrInvalidVoteValidatorSet = sdkerrors.Register(ModuleName, 10, "invalid validator set")
	ErrInvalidVoteAggSignature = sdkerrors.Register(ModuleName, 11, "invalid bls signature")
	ErrDuplicatedSlash         = sdkerrors.Register(ModuleName, 12, "duplicated slash in cooling-off period")
	ErrInvalidBlsPubKey        = sdkerrors.Register(ModuleName, 13, "invalid bls public key")
	ErrNotEnoughVotes          = sdkerrors.Register(ModuleName, 14, "attest votes are not enough")
)

x/challenge module sentinel errors

View Source
var (
	ErrInvalidLengthEvents        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowEvents          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group")
)
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 (
	// OngoingChallengeIdKey is the key to retrieve the max id of challenge.
	OngoingChallengeIdKey = []byte{0x11}

	// AttestChallengeIdKey is the key to record the latest attest challenge id.
	AttestChallengeIdKey = []byte{0x12}

	// SlashKeyPrefix is the prefix to retrieve Slash.
	SlashKeyPrefix = []byte{0x13}

	// CurrentBlockChallengeCountKey is key to track the count of challenges in the current block.
	// The data is stored in transient store.
	CurrentBlockChallengeCountKey = []byte{0x14}
)
View Source
var (
	KeyChallengeCountPerBlock            = []byte("ChallengeCountPerBlock")
	DefaultChallengeCountPerBlock uint64 = 1
)
View Source
var (
	KeySlashCoolingOffPeriod            = []byte("SlashCoolingOffPeriod")
	DefaultSlashCoolingOffPeriod uint64 = 300
)
View Source
var (
	KeySlashAmountSizeRate     = []byte("SlashAmountSizeRate")
	DefaultSlashAmountSizeRate = sdk.NewDecWithPrec(85, 4)
)
View Source
var (
	KeySlashAmountMin     = []byte("SlashAmountMin")
	DefaultSlashAmountMin = math.NewIntFromBigInt(big.NewInt(1e16))
)
View Source
var (
	KeySlashAmountMax     = []byte("SlashAmountMax")
	DefaultSlashAmountMax = math.NewIntFromBigInt(big.NewInt(1e18))
)
View Source
var (
	KeyRewardValidatorRatio     = []byte("RewardValidatorRatio")
	DefaultRewardValidatorRatio = sdk.NewDecWithPrec(9, 1)
)
View Source
var (
	KeyRewardSubmitterRatio     = []byte("RewardSubmitterRatio")
	DefaultRewardSubmitterRatio = sdk.NewDecWithPrec(1, 3)
)
View Source
var (
	KeyRewardSubmitterThreshold     = []byte("RewardSubmitterThreshold")
	DefaultRewardSubmitterThreshold = math.NewIntFromBigInt(big.NewInt(1e15))
)
View Source
var (
	KeyHeartbeatInterval            = []byte("HeartbeatInterval")
	DefaultHeartbeatInterval uint64 = 1000
)
View Source
var (
	ErrInvalidLengthParams        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowParams          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthQuery        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQuery          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupQuery = 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 (
	ErrInvalidLengthTypes        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTypes          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group")
)
View Source
var VoteResult_name = map[int32]string{
	0: "CHALLENGE_FAILED",
	1: "CHALLENGE_SUCCEED",
}
View Source
var VoteResult_value = map[string]int32{
	"CHALLENGE_FAILED":  0,
	"CHALLENGE_SUCCEED": 1,
}

Functions

func KeyPrefix

func KeyPrefix(p string) []byte

func ParamKeyTable

func ParamKeyTable() paramtypes.KeyTable

ParamKeyTable the param key table for launch module

func RegisterCodec

func RegisterCodec(cdc *codec.LegacyAmino)

func RegisterInterfaces

func RegisterInterfaces(registry cdctypes.InterfaceRegistry)

func RegisterMsgServer

func RegisterMsgServer(s grpc1.Server, srv MsgServer)

func RegisterQueryHandler

func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterQueryHandlerClient

func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error

RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "QueryClient" to call the correct interceptors.

func RegisterQueryHandlerFromEndpoint

func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterQueryHandlerServer

func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error

RegisterQueryHandlerServer registers the http handlers for service Query to "mux". UnaryRPC :call QueryServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.

func RegisterQueryServer

func RegisterQueryServer(s grpc1.Server, srv QueryServer)

Types

type AccountKeeper

type AccountKeeper interface {
	GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI
}

AccountKeeper defines the expected account keeper used for simulations (noalias)

type BankKeeper

type BankKeeper interface {
	SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
}

BankKeeper defines the expected interface needed to retrieve account balances.

type EventAttestChallenge

type EventAttestChallenge struct {
	// The id of challenge.
	ChallengeId uint64 `protobuf:"varint,1,opt,name=challenge_id,json=challengeId,proto3" json:"challenge_id,omitempty"`
	// The result of challenge.
	Result VoteResult `protobuf:"varint,2,opt,name=result,proto3,enum=bnbchain.greenfield.challenge.VoteResult" json:"result,omitempty"`
	// The slashed storage provider address.
	SpOperatorAddress string `protobuf:"bytes,3,opt,name=sp_operator_address,json=spOperatorAddress,proto3" json:"sp_operator_address,omitempty"`
	// The slashed amount from the storage provider.
	SlashAmount string `protobuf:"bytes,4,opt,name=slash_amount,json=slashAmount,proto3" json:"slash_amount,omitempty"`
	// The address of challenger.
	ChallengerAddress string `protobuf:"bytes,5,opt,name=challenger_address,json=challengerAddress,proto3" json:"challenger_address,omitempty"`
	// The reward amount to the challenger.
	ChallengerRewardAmount string `` /* 129-byte string literal not displayed */
	// The submitter of challenge attestation.
	SubmitterAddress string `protobuf:"bytes,7,opt,name=submitter_address,json=submitterAddress,proto3" json:"submitter_address,omitempty"`
	// The reward amount to the submitter.
	SubmitterRewardAmount string `` /* 126-byte string literal not displayed */
	// The reward amount to all validators.
	ValidatorRewardAmount string `` /* 127-byte string literal not displayed */
}

func (*EventAttestChallenge) Descriptor

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

func (*EventAttestChallenge) GetChallengeId

func (m *EventAttestChallenge) GetChallengeId() uint64

func (*EventAttestChallenge) GetChallengerAddress

func (m *EventAttestChallenge) GetChallengerAddress() string

func (*EventAttestChallenge) GetChallengerRewardAmount

func (m *EventAttestChallenge) GetChallengerRewardAmount() string

func (*EventAttestChallenge) GetResult

func (m *EventAttestChallenge) GetResult() VoteResult

func (*EventAttestChallenge) GetSlashAmount

func (m *EventAttestChallenge) GetSlashAmount() string

func (*EventAttestChallenge) GetSpOperatorAddress

func (m *EventAttestChallenge) GetSpOperatorAddress() string

func (*EventAttestChallenge) GetSubmitterAddress

func (m *EventAttestChallenge) GetSubmitterAddress() string

func (*EventAttestChallenge) GetSubmitterRewardAmount

func (m *EventAttestChallenge) GetSubmitterRewardAmount() string

func (*EventAttestChallenge) GetValidatorRewardAmount

func (m *EventAttestChallenge) GetValidatorRewardAmount() string

func (*EventAttestChallenge) Marshal

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

func (*EventAttestChallenge) MarshalTo

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

func (*EventAttestChallenge) MarshalToSizedBuffer

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

func (*EventAttestChallenge) ProtoMessage

func (*EventAttestChallenge) ProtoMessage()

func (*EventAttestChallenge) Reset

func (m *EventAttestChallenge) Reset()

func (*EventAttestChallenge) Size

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

func (*EventAttestChallenge) String

func (m *EventAttestChallenge) String() string

func (*EventAttestChallenge) Unmarshal

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

func (*EventAttestChallenge) XXX_DiscardUnknown

func (m *EventAttestChallenge) XXX_DiscardUnknown()

func (*EventAttestChallenge) XXX_Marshal

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

func (*EventAttestChallenge) XXX_Merge

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

func (*EventAttestChallenge) XXX_Size

func (m *EventAttestChallenge) XXX_Size() int

func (*EventAttestChallenge) XXX_Unmarshal

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

type EventStartChallenge

type EventStartChallenge struct {
	// The id of challenge, which is generated by blockchain.
	ChallengeId uint64 `protobuf:"varint,1,opt,name=challenge_id,json=challengeId,proto3" json:"challenge_id,omitempty"`
	// The id of object info to be challenged.
	ObjectId Uint `protobuf:"bytes,2,opt,name=object_id,json=objectId,proto3,customtype=Uint" json:"object_id"`
	// The segment/piece index of the object info.
	SegmentIndex uint32 `protobuf:"varint,3,opt,name=segment_index,json=segmentIndex,proto3" json:"segment_index,omitempty"`
	// The storage provider to be challenged.
	SpOperatorAddress string `protobuf:"bytes,4,opt,name=sp_operator_address,json=spOperatorAddress,proto3" json:"sp_operator_address,omitempty"`
	// The redundancy index, which comes from the index of storage providers.
	RedundancyIndex int32 `protobuf:"varint,5,opt,name=redundancy_index,json=redundancyIndex,proto3" json:"redundancy_index,omitempty"`
	// The challenger who submits the challenge.
	ChallengerAddress string `protobuf:"bytes,6,opt,name=challenger_address,json=challengerAddress,proto3" json:"challenger_address,omitempty"`
}

func (*EventStartChallenge) Descriptor

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

func (*EventStartChallenge) GetChallengeId

func (m *EventStartChallenge) GetChallengeId() uint64

func (*EventStartChallenge) GetChallengerAddress

func (m *EventStartChallenge) GetChallengerAddress() string

func (*EventStartChallenge) GetRedundancyIndex

func (m *EventStartChallenge) GetRedundancyIndex() int32

func (*EventStartChallenge) GetSegmentIndex

func (m *EventStartChallenge) GetSegmentIndex() uint32

func (*EventStartChallenge) GetSpOperatorAddress

func (m *EventStartChallenge) GetSpOperatorAddress() string

func (*EventStartChallenge) Marshal

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

func (*EventStartChallenge) MarshalTo

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

func (*EventStartChallenge) MarshalToSizedBuffer

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

func (*EventStartChallenge) ProtoMessage

func (*EventStartChallenge) ProtoMessage()

func (*EventStartChallenge) Reset

func (m *EventStartChallenge) Reset()

func (*EventStartChallenge) Size

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

func (*EventStartChallenge) String

func (m *EventStartChallenge) String() string

func (*EventStartChallenge) Unmarshal

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

func (*EventStartChallenge) XXX_DiscardUnknown

func (m *EventStartChallenge) XXX_DiscardUnknown()

func (*EventStartChallenge) XXX_Marshal

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

func (*EventStartChallenge) XXX_Merge

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

func (*EventStartChallenge) XXX_Size

func (m *EventStartChallenge) XXX_Size() int

func (*EventStartChallenge) XXX_Unmarshal

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

type GenesisState

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

GenesisState defines the challenge module's genesis state.

func DefaultGenesis

func DefaultGenesis() *GenesisState

DefaultGenesis returns the default 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) Validate

func (gs GenesisState) Validate() error

Validate performs basic genesis state validation returning an error upon any failure.

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 Int

type Int = sdkmath.Int

type MsgAttest

type MsgAttest struct {
	// The submitter address.
	Submitter string `protobuf:"bytes,1,opt,name=submitter,proto3" json:"submitter,omitempty"`
	// The id of the challenge.
	ChallengeId uint64 `protobuf:"varint,2,opt,name=challenge_id,json=challengeId,proto3" json:"challenge_id,omitempty"`
	// The id of the object info.
	ObjectId Uint `protobuf:"bytes,3,opt,name=object_id,json=objectId,proto3,customtype=Uint" json:"object_id"`
	// The storage provider to be challenged.
	SpOperatorAddress string `protobuf:"bytes,4,opt,name=sp_operator_address,json=spOperatorAddress,proto3" json:"sp_operator_address,omitempty"`
	// Vote result of the attestation.
	VoteResult VoteResult `` /* 138-byte string literal not displayed */
	// The challenger who submits the challenge, which can be empty.
	ChallengerAddress string `protobuf:"bytes,6,opt,name=challenger_address,json=challengerAddress,proto3" json:"challenger_address,omitempty"`
	// The validators participated in the attestation.
	VoteValidatorSet []uint64 `protobuf:"fixed64,7,rep,packed,name=vote_validator_set,json=voteValidatorSet,proto3" json:"vote_validator_set,omitempty"`
	// The aggregated BLS signature from the validators.
	VoteAggSignature []byte `protobuf:"bytes,8,opt,name=vote_agg_signature,json=voteAggSignature,proto3" json:"vote_agg_signature,omitempty"`
}

func NewMsgAttest

func NewMsgAttest(submitter sdk.AccAddress, challengeId uint64, objectId Uint, spOperatorAddress string,
	voteResult VoteResult, challenger string, voteValidatorSet []uint64, voteAggSignature []byte) *MsgAttest

func (*MsgAttest) Descriptor

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

func (*MsgAttest) GetBlsSignBytes

func (msg *MsgAttest) GetBlsSignBytes() [32]byte

func (*MsgAttest) GetChallengeId

func (m *MsgAttest) GetChallengeId() uint64

func (*MsgAttest) GetChallengerAddress

func (m *MsgAttest) GetChallengerAddress() string

func (*MsgAttest) GetSignBytes

func (msg *MsgAttest) GetSignBytes() []byte

func (*MsgAttest) GetSigners

func (msg *MsgAttest) GetSigners() []sdk.AccAddress

func (*MsgAttest) GetSpOperatorAddress

func (m *MsgAttest) GetSpOperatorAddress() string

func (*MsgAttest) GetSubmitter

func (m *MsgAttest) GetSubmitter() string

func (*MsgAttest) GetVoteAggSignature

func (m *MsgAttest) GetVoteAggSignature() []byte

func (*MsgAttest) GetVoteResult

func (m *MsgAttest) GetVoteResult() VoteResult

func (*MsgAttest) GetVoteValidatorSet

func (m *MsgAttest) GetVoteValidatorSet() []uint64

func (*MsgAttest) Marshal

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

func (*MsgAttest) MarshalTo

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

func (*MsgAttest) MarshalToSizedBuffer

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

func (*MsgAttest) ProtoMessage

func (*MsgAttest) ProtoMessage()

func (*MsgAttest) Reset

func (m *MsgAttest) Reset()

func (*MsgAttest) Route

func (msg *MsgAttest) Route() string

func (*MsgAttest) Size

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

func (*MsgAttest) String

func (m *MsgAttest) String() string

func (*MsgAttest) Type

func (msg *MsgAttest) Type() string

func (*MsgAttest) Unmarshal

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

func (*MsgAttest) ValidateBasic

func (msg *MsgAttest) ValidateBasic() error

func (*MsgAttest) XXX_DiscardUnknown

func (m *MsgAttest) XXX_DiscardUnknown()

func (*MsgAttest) XXX_Marshal

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

func (*MsgAttest) XXX_Merge

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

func (*MsgAttest) XXX_Size

func (m *MsgAttest) XXX_Size() int

func (*MsgAttest) XXX_Unmarshal

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

type MsgAttestResponse

type MsgAttestResponse struct {
}

func (*MsgAttestResponse) Descriptor

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

func (*MsgAttestResponse) Marshal

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

func (*MsgAttestResponse) MarshalTo

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

func (*MsgAttestResponse) MarshalToSizedBuffer

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

func (*MsgAttestResponse) ProtoMessage

func (*MsgAttestResponse) ProtoMessage()

func (*MsgAttestResponse) Reset

func (m *MsgAttestResponse) Reset()

func (*MsgAttestResponse) Size

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

func (*MsgAttestResponse) String

func (m *MsgAttestResponse) String() string

func (*MsgAttestResponse) Unmarshal

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

func (*MsgAttestResponse) XXX_DiscardUnknown

func (m *MsgAttestResponse) XXX_DiscardUnknown()

func (*MsgAttestResponse) XXX_Marshal

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

func (*MsgAttestResponse) XXX_Merge

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

func (*MsgAttestResponse) XXX_Size

func (m *MsgAttestResponse) XXX_Size() int

func (*MsgAttestResponse) XXX_Unmarshal

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

type MsgClient

type MsgClient interface {
	Submit(ctx context.Context, in *MsgSubmit, opts ...grpc.CallOption) (*MsgSubmitResponse, error)
	Attest(ctx context.Context, in *MsgAttest, opts ...grpc.CallOption) (*MsgAttestResponse, 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 {
	Submit(context.Context, *MsgSubmit) (*MsgSubmitResponse, error)
	Attest(context.Context, *MsgAttest) (*MsgAttestResponse, error)
}

MsgServer is the server API for Msg service.

type MsgSubmit

type MsgSubmit struct {
	// The challenger address.
	Challenger string `protobuf:"bytes,1,opt,name=challenger,proto3" json:"challenger,omitempty"`
	// The storage provider to be challenged.
	SpOperatorAddress string `protobuf:"bytes,2,opt,name=sp_operator_address,json=spOperatorAddress,proto3" json:"sp_operator_address,omitempty"`
	// The bucket of the object info to be challenged.
	BucketName string `protobuf:"bytes,3,opt,name=bucket_name,json=bucketName,proto3" json:"bucket_name,omitempty"`
	// The name of the object info to be challenged.
	ObjectName string `protobuf:"bytes,4,opt,name=object_name,json=objectName,proto3" json:"object_name,omitempty"`
	// The index of segment/piece to challenge, start from zero.
	SegmentIndex uint32 `protobuf:"varint,5,opt,name=segment_index,json=segmentIndex,proto3" json:"segment_index,omitempty"`
	// Randomly pick a segment/piece to challenge or not.
	RandomIndex bool `protobuf:"varint,6,opt,name=random_index,json=randomIndex,proto3" json:"random_index,omitempty"`
}

func NewMsgSubmit

func NewMsgSubmit(challenger sdk.AccAddress, spOperatorAddress sdk.AccAddress, bucketName, objectName string, randomIndex bool, segmentIndex uint32) *MsgSubmit

func (*MsgSubmit) Descriptor

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

func (*MsgSubmit) GetBucketName

func (m *MsgSubmit) GetBucketName() string

func (*MsgSubmit) GetChallenger

func (m *MsgSubmit) GetChallenger() string

func (*MsgSubmit) GetObjectName

func (m *MsgSubmit) GetObjectName() string

func (*MsgSubmit) GetRandomIndex

func (m *MsgSubmit) GetRandomIndex() bool

func (*MsgSubmit) GetSegmentIndex

func (m *MsgSubmit) GetSegmentIndex() uint32

func (*MsgSubmit) GetSignBytes

func (msg *MsgSubmit) GetSignBytes() []byte

func (*MsgSubmit) GetSigners

func (msg *MsgSubmit) GetSigners() []sdk.AccAddress

func (*MsgSubmit) GetSpOperatorAddress

func (m *MsgSubmit) GetSpOperatorAddress() string

func (*MsgSubmit) Marshal

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

func (*MsgSubmit) MarshalTo

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

func (*MsgSubmit) MarshalToSizedBuffer

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

func (*MsgSubmit) ProtoMessage

func (*MsgSubmit) ProtoMessage()

func (*MsgSubmit) Reset

func (m *MsgSubmit) Reset()

func (*MsgSubmit) Route

func (msg *MsgSubmit) Route() string

func (*MsgSubmit) Size

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

func (*MsgSubmit) String

func (m *MsgSubmit) String() string

func (*MsgSubmit) Type

func (msg *MsgSubmit) Type() string

func (*MsgSubmit) Unmarshal

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

func (*MsgSubmit) ValidateBasic

func (msg *MsgSubmit) ValidateBasic() error

func (*MsgSubmit) XXX_DiscardUnknown

func (m *MsgSubmit) XXX_DiscardUnknown()

func (*MsgSubmit) XXX_Marshal

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

func (*MsgSubmit) XXX_Merge

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

func (*MsgSubmit) XXX_Size

func (m *MsgSubmit) XXX_Size() int

func (*MsgSubmit) XXX_Unmarshal

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

type MsgSubmitResponse

type MsgSubmitResponse struct {
}

func (*MsgSubmitResponse) Descriptor

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

func (*MsgSubmitResponse) Marshal

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

func (*MsgSubmitResponse) MarshalTo

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

func (*MsgSubmitResponse) MarshalToSizedBuffer

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

func (*MsgSubmitResponse) ProtoMessage

func (*MsgSubmitResponse) ProtoMessage()

func (*MsgSubmitResponse) Reset

func (m *MsgSubmitResponse) Reset()

func (*MsgSubmitResponse) Size

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

func (*MsgSubmitResponse) String

func (m *MsgSubmitResponse) String() string

func (*MsgSubmitResponse) Unmarshal

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

func (*MsgSubmitResponse) XXX_DiscardUnknown

func (m *MsgSubmitResponse) XXX_DiscardUnknown()

func (*MsgSubmitResponse) XXX_Marshal

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

func (*MsgSubmitResponse) XXX_Merge

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

func (*MsgSubmitResponse) XXX_Size

func (m *MsgSubmitResponse) XXX_Size() int

func (*MsgSubmitResponse) XXX_Unmarshal

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

type Params

type Params struct {
	// Challenges which will be emitted in each block, including user triggered or randomly triggered.
	ChallengeCountPerBlock uint64 `` /* 165-byte string literal not displayed */
	// The count of blocks to stand for the period in which the same storage and object info cannot be slashed again.
	SlashCoolingOffPeriod uint64 `` /* 161-byte string literal not displayed */
	// The slash coin amount will be calculated from the size of object info, and adjusted by this rate.
	SlashAmountSizeRate github_com_cosmos_cosmos_sdk_types.Dec `` /* 192-byte string literal not displayed */
	// The minimal slash amount.
	SlashAmountMin github_com_cosmos_cosmos_sdk_types.Int `` /* 145-byte string literal not displayed */
	// The maximum slash amount.
	SlashAmountMax github_com_cosmos_cosmos_sdk_types.Int `` /* 145-byte string literal not displayed */
	// The ratio of slash amount for all validator rewards.
	RewardValidatorRatio github_com_cosmos_cosmos_sdk_types.Dec `` /* 193-byte string literal not displayed */
	// The ratio of reward amount for submitter rewards.
	RewardSubmitterRatio github_com_cosmos_cosmos_sdk_types.Dec `` /* 194-byte string literal not displayed */
	// The reward amount to submitter will be adjusted by the threshold.
	RewardSubmitterThreshold github_com_cosmos_cosmos_sdk_types.Int `` /* 175-byte string literal not displayed */
	// Heartbeat interval defines the frequency of heartbeat based on challenges.
	HeartbeatInterval uint64 `` /* 139-byte string literal not displayed */
}

Params defines the parameters for the module.

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters

func NewParams

func NewParams(
	challengeCountPerBlock uint64,
	slashCoolingOffPeriod uint64,
	slashAmountSizeRate sdk.Dec,
	slashAmountMin math.Int,
	slashAmountMax math.Int,
	rewardValidatorRatio sdk.Dec,
	rewardSubmitterRatio sdk.Dec,
	rewardSubmitterThreshold math.Int,
	heartbeatInterval uint64,
) Params

NewParams creates a new Params instance

func (*Params) Descriptor

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

func (*Params) GetChallengeCountPerBlock

func (m *Params) GetChallengeCountPerBlock() uint64

func (*Params) GetHeartbeatInterval

func (m *Params) GetHeartbeatInterval() uint64

func (*Params) GetSlashCoolingOffPeriod

func (m *Params) GetSlashCoolingOffPeriod() 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) ParamSetPairs

func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs

ParamSetPairs get the params.ParamSet

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 (p Params) String() string

String implements the Stringer interface.

func (*Params) Unmarshal

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

func (Params) Validate

func (p Params) Validate() error

Validate validates the set of params

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 PaymentKeeper

type PaymentKeeper interface {
	QueryValidatorRewards(ctx sdk.Context) (amount sdkmath.Int)
	TransferValidatorRewards(ctx sdk.Context, toAddr sdk.AccAddress, amount sdkmath.Int) error
}

type QueryClient

type QueryClient interface {
	// Parameters queries the parameters of the module.
	Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
	// Queries a list of LatestAttestedChallenge items.
	LatestAttestedChallenge(ctx context.Context, in *QueryLatestAttestedChallengeRequest, opts ...grpc.CallOption) (*QueryLatestAttestedChallengeResponse, error)
}

QueryClient is the client API for Query service.

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

func NewQueryClient

func NewQueryClient(cc grpc1.ClientConn) QueryClient

type QueryLatestAttestedChallengeRequest

type QueryLatestAttestedChallengeRequest struct {
}

func (*QueryLatestAttestedChallengeRequest) Descriptor

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

func (*QueryLatestAttestedChallengeRequest) Marshal

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

func (*QueryLatestAttestedChallengeRequest) MarshalTo

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

func (*QueryLatestAttestedChallengeRequest) MarshalToSizedBuffer

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

func (*QueryLatestAttestedChallengeRequest) ProtoMessage

func (*QueryLatestAttestedChallengeRequest) ProtoMessage()

func (*QueryLatestAttestedChallengeRequest) Reset

func (*QueryLatestAttestedChallengeRequest) Size

func (*QueryLatestAttestedChallengeRequest) String

func (*QueryLatestAttestedChallengeRequest) Unmarshal

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

func (*QueryLatestAttestedChallengeRequest) XXX_DiscardUnknown

func (m *QueryLatestAttestedChallengeRequest) XXX_DiscardUnknown()

func (*QueryLatestAttestedChallengeRequest) XXX_Marshal

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

func (*QueryLatestAttestedChallengeRequest) XXX_Merge

func (*QueryLatestAttestedChallengeRequest) XXX_Size

func (*QueryLatestAttestedChallengeRequest) XXX_Unmarshal

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

type QueryLatestAttestedChallengeResponse

type QueryLatestAttestedChallengeResponse struct {
	ChallengeId uint64 `protobuf:"varint,1,opt,name=challengeId,proto3" json:"challengeId,omitempty"`
}

func (*QueryLatestAttestedChallengeResponse) Descriptor

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

func (*QueryLatestAttestedChallengeResponse) GetChallengeId

func (m *QueryLatestAttestedChallengeResponse) GetChallengeId() uint64

func (*QueryLatestAttestedChallengeResponse) Marshal

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

func (*QueryLatestAttestedChallengeResponse) MarshalTo

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

func (*QueryLatestAttestedChallengeResponse) MarshalToSizedBuffer

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

func (*QueryLatestAttestedChallengeResponse) ProtoMessage

func (*QueryLatestAttestedChallengeResponse) ProtoMessage()

func (*QueryLatestAttestedChallengeResponse) Reset

func (*QueryLatestAttestedChallengeResponse) Size

func (*QueryLatestAttestedChallengeResponse) String

func (*QueryLatestAttestedChallengeResponse) Unmarshal

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

func (*QueryLatestAttestedChallengeResponse) XXX_DiscardUnknown

func (m *QueryLatestAttestedChallengeResponse) XXX_DiscardUnknown()

func (*QueryLatestAttestedChallengeResponse) XXX_Marshal

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

func (*QueryLatestAttestedChallengeResponse) XXX_Merge

func (*QueryLatestAttestedChallengeResponse) XXX_Size

func (*QueryLatestAttestedChallengeResponse) XXX_Unmarshal

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

type QueryParamsRequest

type QueryParamsRequest struct {
}

QueryParamsRequest is request type for the Query/Params RPC method.

func (*QueryParamsRequest) Descriptor

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

func (*QueryParamsRequest) Marshal

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

func (*QueryParamsRequest) MarshalTo

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

func (*QueryParamsRequest) MarshalToSizedBuffer

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

func (*QueryParamsRequest) ProtoMessage

func (*QueryParamsRequest) ProtoMessage()

func (*QueryParamsRequest) Reset

func (m *QueryParamsRequest) Reset()

func (*QueryParamsRequest) Size

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

func (*QueryParamsRequest) String

func (m *QueryParamsRequest) String() string

func (*QueryParamsRequest) Unmarshal

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

func (*QueryParamsRequest) XXX_DiscardUnknown

func (m *QueryParamsRequest) XXX_DiscardUnknown()

func (*QueryParamsRequest) XXX_Marshal

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

func (*QueryParamsRequest) XXX_Merge

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

func (*QueryParamsRequest) XXX_Size

func (m *QueryParamsRequest) XXX_Size() int

func (*QueryParamsRequest) XXX_Unmarshal

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

type QueryParamsResponse

type QueryParamsResponse struct {
	// params holds all the parameters of this module.
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}

QueryParamsResponse is response type for the Query/Params RPC method.

func (*QueryParamsResponse) Descriptor

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

func (*QueryParamsResponse) GetParams

func (m *QueryParamsResponse) GetParams() Params

func (*QueryParamsResponse) Marshal

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

func (*QueryParamsResponse) MarshalTo

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

func (*QueryParamsResponse) MarshalToSizedBuffer

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

func (*QueryParamsResponse) ProtoMessage

func (*QueryParamsResponse) ProtoMessage()

func (*QueryParamsResponse) Reset

func (m *QueryParamsResponse) Reset()

func (*QueryParamsResponse) Size

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

func (*QueryParamsResponse) String

func (m *QueryParamsResponse) String() string

func (*QueryParamsResponse) Unmarshal

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

func (*QueryParamsResponse) XXX_DiscardUnknown

func (m *QueryParamsResponse) XXX_DiscardUnknown()

func (*QueryParamsResponse) XXX_Marshal

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

func (*QueryParamsResponse) XXX_Merge

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

func (*QueryParamsResponse) XXX_Size

func (m *QueryParamsResponse) XXX_Size() int

func (*QueryParamsResponse) XXX_Unmarshal

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

type QueryServer

type QueryServer interface {
	// Parameters queries the parameters of the module.
	Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
	// Queries a list of LatestAttestedChallenge items.
	LatestAttestedChallenge(context.Context, *QueryLatestAttestedChallengeRequest) (*QueryLatestAttestedChallengeResponse, error)
}

QueryServer is the server API for Query service.

type Slash

type Slash struct {
	SpOperatorAddress []byte `protobuf:"bytes,1,opt,name=sp_operator_address,json=spOperatorAddress,proto3" json:"sp_operator_address,omitempty"`
	ObjectId          Uint   `protobuf:"bytes,2,opt,name=object_id,json=objectId,proto3,customtype=Uint" json:"object_id"`
	Height            uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"`
}

func (*Slash) Descriptor

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

func (*Slash) GetHeight

func (m *Slash) GetHeight() uint64

func (*Slash) GetSpOperatorAddress

func (m *Slash) GetSpOperatorAddress() []byte

func (*Slash) Marshal

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

func (*Slash) MarshalTo

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

func (*Slash) MarshalToSizedBuffer

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

func (*Slash) ProtoMessage

func (*Slash) ProtoMessage()

func (*Slash) Reset

func (m *Slash) Reset()

func (*Slash) Size

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

func (*Slash) String

func (m *Slash) String() string

func (*Slash) Unmarshal

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

func (*Slash) XXX_DiscardUnknown

func (m *Slash) XXX_DiscardUnknown()

func (*Slash) XXX_Marshal

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

func (*Slash) XXX_Merge

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

func (*Slash) XXX_Size

func (m *Slash) XXX_Size() int

func (*Slash) XXX_Unmarshal

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

type SpKeeper

type SpKeeper interface {
	GetStorageProvider(ctx sdk.Context, addr sdk.AccAddress) (sp sp.StorageProvider, found bool)
	DepositDenomForSP(ctx sdk.Context) (res string)
	Slash(ctx sdk.Context, spAcc sdk.AccAddress, rewardInfos []sp.RewardInfo) error
}

type StakingKeeper

type StakingKeeper interface {
	GetLastValidators(ctx sdk.Context) (validators []staking.Validator)
	GetHistoricalInfo(ctx sdk.Context, height int64) (staking.HistoricalInfo, bool)
}

type StorageKeeper

type StorageKeeper interface {
	GetObjectInfo(ctx sdk.Context, bucketName string, objectName string) (*storage.ObjectInfo, bool)
	GetObjectInfoById(ctx sdk.Context, objectId sdkmath.Uint) (*storage.ObjectInfo, bool)
	GetObjectInfoCount(ctx sdk.Context) sdkmath.Uint
	GetBucketInfo(ctx sdk.Context, bucketName string) (*storage.BucketInfo, bool)
	MaxSegmentSize(ctx sdk.Context) (res uint64)
}

type Uint

type Uint = sdkmath.Uint

type UnimplementedMsgServer

type UnimplementedMsgServer struct {
}

UnimplementedMsgServer can be embedded to have forward compatible implementations.

func (*UnimplementedMsgServer) Attest

func (*UnimplementedMsgServer) Submit

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) Params

type VoteResult

type VoteResult int32
const (
	// The challenge failed, for further extension.
	CHALLENGE_FAILED VoteResult = 0
	// The challenge succeed.
	CHALLENGE_SUCCEED VoteResult = 1
)

func (VoteResult) EnumDescriptor

func (VoteResult) EnumDescriptor() ([]byte, []int)

func (VoteResult) String

func (x VoteResult) String() string

Jump to

Keyboard shortcuts

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