types

package
v0.0.0-...-58d014b Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ClaimPrimaryKeyPrefix is the prefix to retrieve the entire Claim object (the primary store)
	// TODO_TECHDEBT: consider renaming to ClaimSessionIDPrefix.
	ClaimPrimaryKeyPrefix = "Claim/primary_key/"

	// ClaimSupplierAddressPrefix is the key to retrieve a Claim's Primary Key from the Address index
	ClaimSupplierAddressPrefix = "Claim/address/"

	// ClaimSessionEndHeightPrefix is the key to retrieve a Claim's Primary Key from the Height index
	ClaimSessionEndHeightPrefix = "Claim/height/"
)
View Source
const (
	// ProofPrimaryKeyPrefix is the prefix to retrieve the entire Proof object (the primary store)
	// TODO_TECHDEBT: consider renaming to ProofSessionIDPrefix.
	ProofPrimaryKeyPrefix = "Proof/primary_key/"

	// ProofSupplierAddressPrefix is the key to retrieve a Proof's Primary Key from the Address index
	ProofSupplierAddressPrefix = "Proof/address/"

	// ProofSessionEndHeightPrefix is the key to retrieve a Proof's Primary Key from the Height index
	ProofSessionEndHeightPrefix = "Proof/height/"
)
View Source
const (
	// ModuleName defines the module name
	ModuleName = "proof"

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

	// MemStoreKey defines the in-memory store key
	MemStoreKey = "mem_proof"
)
View Source
const TypeMsgCreateClaim = "create_claim"

Variables

View Source
var (
	ErrProofInvalidSigner             = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message")
	ErrProofInvalidAddress            = sdkerrors.Register(ModuleName, 1101, "invalid address")
	ErrProofNotFound                  = sdkerrors.Register(ModuleName, 1102, "supplier not found")
	ErrProofInvalidService            = sdkerrors.Register(ModuleName, 1103, "invalid service in supplier")
	ErrProofInvalidClaimRootHash      = sdkerrors.Register(ModuleName, 1104, "invalid root hash")
	ErrProofInvalidQueryRequest       = sdkerrors.Register(ModuleName, 1105, "invalid query request")
	ErrProofClaimNotFound             = sdkerrors.Register(ModuleName, 1106, "claim not found")
	ErrProofProofNotFound             = sdkerrors.Register(ModuleName, 1107, "proof not found")
	ErrProofInvalidProof              = sdkerrors.Register(ModuleName, 1108, "invalid proof")
	ErrProofInvalidRelay              = sdkerrors.Register(ModuleName, 1109, "invalid relay")
	ErrProofInvalidRelayRequest       = sdkerrors.Register(ModuleName, 1110, "invalid relay request")
	ErrProofInvalidRelayResponse      = sdkerrors.Register(ModuleName, 1111, "invalid relay response")
	ErrProofNotSecp256k1Curve         = sdkerrors.Register(ModuleName, 1112, "not secp256k1 curve")
	ErrProofApplicationNotFound       = sdkerrors.Register(ModuleName, 1113, "application not found")
	ErrProofPubKeyNotFound            = sdkerrors.Register(ModuleName, 1114, "public key not found")
	ErrProofInvalidSessionHeader      = sdkerrors.Register(ModuleName, 1115, "invalid session header")
	ErrProofInvalidSessionId          = sdkerrors.Register(ModuleName, 1116, "invalid session ID")
	ErrProofInvalidSessionEndHeight   = sdkerrors.Register(ModuleName, 1117, "invalid session end height")
	ErrProofInvalidSessionStartHeight = sdkerrors.Register(ModuleName, 1118, "invalid session start height")
)

x/proof module sentinel errors

View Source
var (
	ParamsKey = []byte("p_proof")
	// KeyDelimiter is the delimiter for composite keys.
	KeyDelimiter = []byte("/")
)

Functions

func ClaimPrimaryKey

func ClaimPrimaryKey(sessionId, supplierAddr string) []byte

ClaimPrimaryKey returns the primary store key used to retrieve a Claim by creating a composite key of the sessionId and supplierAddr.

func ClaimSupplierAddressKey

func ClaimSupplierAddressKey(supplierAddr string, primaryKey []byte) []byte

ClaimSupplierAddressKey returns the key used to iterate through claims given a supplier Address.

func ClaimSupplierEndSessionHeightKey

func ClaimSupplierEndSessionHeightKey(sessionEndHeight int64, primaryKey []byte) []byte

ClaimSupplierEndSessionHeightKey returns the key used to iterate through claims given a session end height.

func KeyComposite

func KeyComposite(keys ...[]byte) []byte

KeyComposite combines the given keys into a single key for use with KVStore.

func KeyPrefix

func KeyPrefix(p string) []byte

func NewAccountKeeperQueryClient

func NewAccountKeeperQueryClient(accountKeeper AccountKeeper) client.AccountQueryClient

NewAccountKeeperQueryClient returns a new AccountQueryClient that is backed by an AccountKeeper instance. It is used by the PubKeyClient to get the public key that corresponds to the provided address. It should be injected into the PubKeyClient when initialized from within the a keeper.

func NewAppKeeperQueryClient

func NewAppKeeperQueryClient(appKeeper ApplicationKeeper) client.ApplicationQueryClient

NewAppKeeperQueryClient returns a new ApplicationQueryClient that is backed by an ApplicationKeeper instance. It is used by the RingClient to get the gateway address that an application has delegated its signing power to. It should be injected into the RingClient when initialized from within the a keeper.

func ParamKeyTable

func ParamKeyTable() paramtypes.KeyTable

ParamKeyTable the param key table for launch module

func ProofPrimaryKey

func ProofPrimaryKey(sessionId, supplierAddr string) []byte

ProofPrimaryKey returns the primary store key used to retrieve a Proof by creating a composite key of the sessionId and supplierAddr.

func ProofSupplierAddressKey

func ProofSupplierAddressKey(supplierAddr string, primaryKey []byte) []byte

ProofSupplierAddressKey returns the key used to iterate through Proofs given a supplier Address.

func ProofSupplierEndSessionHeightKey

func ProofSupplierEndSessionHeightKey(sessionEndHeight int64, primaryKey []byte) []byte

ProofSupplierEndSessionHeightKey returns the key used to iterate through Proofs given a session end height.

func RegisterInterfaces

func RegisterInterfaces(registry cdctypes.InterfaceRegistry)

Types

type AccountKeeper

type AccountKeeper interface {
	GetAccount(context.Context, sdk.AccAddress) sdk.AccountI
	SetAccount(context.Context, sdk.AccountI)
	// Return a new account with the next account number and the specified address. Does not save the new account to the store.
	NewAccountWithAddress(context.Context, sdk.AccAddress) sdk.AccountI
	// Fetch the next account number, and increment the internal counter.
	NextAccountNumber(context.Context) uint64
}

AccountKeeper defines the expected interface for the Account module.

type AccountKeeperQueryClient

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

AccountKeeperQueryClient is a thin wrapper around the AccountKeeper. It does not rely on the QueryClient, and therefore does not make any network requests as in the off-chain implementation.

func (*AccountKeeperQueryClient) GetAccount

func (accountQueryClient *AccountKeeperQueryClient) GetAccount(
	ctx context.Context,
	addr string,
) (account types.AccountI, err error)

GetAccount returns the account associated with the provided address.

func (*AccountKeeperQueryClient) GetPubKeyFromAddress

func (accountQueryClient *AccountKeeperQueryClient) GetPubKeyFromAddress(
	ctx context.Context,
	address string,
) (cryptotypes.PubKey, error)

GetPubKeyFromAddress returns the public key of the given address. It uses the accountQuerier to get the account and then returns its public key.

type AppKeeperQueryClient

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

AppKeeperQueryClient is a thin wrapper around the AccountKeeper. It does not rely on the QueryClient, and therefore does not make any network requests as in the off-chain implementation.

func (*AppKeeperQueryClient) GetAllApplications

func (appQueryClient *AppKeeperQueryClient) GetAllApplications(ctx context.Context) ([]apptypes.Application, error)

GetAllApplications returns all the applications in the application store.

func (*AppKeeperQueryClient) GetApplication

func (appQueryClient *AppKeeperQueryClient) GetApplication(
	ctx context.Context,
	appAddr string,
) (apptypes.Application, error)

GetApplication returns the application corresponding to the given address.

type ApplicationKeeper

type ApplicationKeeper interface {
	GetApplication(ctx context.Context, address string) (app apptypes.Application, found bool)
	GetAllApplications(ctx context.Context) []apptypes.Application
	SetApplication(context.Context, apptypes.Application)
}

ApplicationKeeper defines the expected application keeper to retrieve applications

type BankKeeper

type BankKeeper interface {
	// We use the bankkeeper SendXXX instead of DelegateXX methods
	// because their purpose is to "escrow" funds on behalf of an account rather
	// than "delegate" funds from one account to another which is more closely
	// linked to staking.
	SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
	SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
}

BankKeeper defines the expected interface for the Bank module.

type SessionKeeper

type SessionKeeper interface {
	GetSession(context.Context, *sessiontypes.QueryGetSessionRequest) (*sessiontypes.QueryGetSessionResponse, error)
	GetBlockHash(ctx context.Context, height int64) []byte
	StoreBlockHash(ctx context.Context)
}

type SupplierKeeper

type SupplierKeeper interface {
	SetSupplier(context.Context, sharedtypes.Supplier)
}

Jump to

Keyboard shortcuts

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