auth

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2020 License: Apache-2.0 Imports: 21 Imported by: 5

Documentation

Overview

nolint autogenerated code using github.com/rigelrozanski/multitool aliases generated for the following subdirectories:

Index

Constants

View Source
const (
	ModuleName                    = types.ModuleName
	StoreKey                      = types.StoreKey
	FeeCollectorName              = types.FeeCollectorName
	QuerierRoute                  = types.QuerierRoute
	DefaultParamspace             = types.DefaultParamspace
	DefaultMaxMemoCharacters      = types.DefaultMaxMemoCharacters
	DefaultTxSigLimit             = types.DefaultTxSigLimit
	DefaultTxSizeCostPerByte      = types.DefaultTxSizeCostPerByte
	DefaultSigVerifyCostED25519   = types.DefaultSigVerifyCostED25519
	DefaultSigVerifyCostSecp256k1 = types.DefaultSigVerifyCostSecp256k1
	QueryAccount                  = types.QueryAccount

	RefundKey = types.RefundKey
)

Variables

View Source
var (
	// functions aliases
	NewBaseAccount                 = types.NewBaseAccount
	ProtoBaseAccount               = types.ProtoBaseAccount
	NewBaseAccountWithAddress      = types.NewBaseAccountWithAddress
	NewBaseVestingAccount          = types.NewBaseVestingAccount
	NewContinuousVestingAccountRaw = types.NewContinuousVestingAccountRaw
	NewContinuousVestingAccount    = types.NewContinuousVestingAccount
	NewDelayedVestingAccountRaw    = types.NewDelayedVestingAccountRaw
	NewDelayedVestingAccount       = types.NewDelayedVestingAccount
	RegisterCodec                  = types.RegisterCodec
	NewGenesisState                = types.NewGenesisState
	DefaultGenesisState            = types.DefaultGenesisState
	ValidateGenesis                = types.ValidateGenesis
	AddressStoreKey                = types.AddressStoreKey
	NewParams                      = types.NewParams
	ParamKeyTable                  = types.ParamKeyTable
	DefaultParams                  = types.DefaultParams
	NewQueryAccountParams          = types.NewQueryAccountParams
	NewStdTx                       = types.NewStdTx
	CountSubKeys                   = types.CountSubKeys
	NewStdFee                      = types.NewStdFee
	StdSignBytes                   = types.StdSignBytes
	DefaultTxDecoder               = types.DefaultTxDecoder
	DefaultTxEncoder               = types.DefaultTxEncoder
	NewTxBuilder                   = types.NewTxBuilder
	NewTxBuilderFromCLI            = types.NewTxBuilderFromCLI
	MakeSignature                  = types.MakeSignature
	NewAccountRetriever            = types.NewAccountRetriever

	// variable aliases
	ModuleCdc                 = types.ModuleCdc
	AddressStoreKeyPrefix     = types.AddressStoreKeyPrefix
	GlobalAccountNumberKey    = types.GlobalAccountNumberKey
	KeyMaxMemoCharacters      = types.KeyMaxMemoCharacters
	KeyTxSigLimit             = types.KeyTxSigLimit
	KeyTxSizeCostPerByte      = types.KeyTxSizeCostPerByte
	KeySigVerifyCostED25519   = types.KeySigVerifyCostED25519
	KeySigVerifyCostSecp256k1 = types.KeySigVerifyCostSecp256k1
)

Functions

func ConsumeMultisignatureVerificationGas added in v1.0.14

func ConsumeMultisignatureVerificationGas(meter sdk.GasMeter,
	sig multisig.Multisignature, pubkey multisig.PubKeyMultisigThreshold,
	params types.Params)

ConsumeMultisignatureVerificationGas consumes gas from a GasMeter for verifying a multisig pubkey signature

func DeductFees

func DeductFees(supplyKeeper types.SupplyKeeper, ctx sdk.Context, acc exported.Account, fees sdk.Coins) error

DeductFees deducts fees from the given account.

NOTE: We could use the BankKeeper (in addition to the AccountKeeper, because the BankKeeper doesn't give us accounts), but it seems easier to do this.

func DefaultSigVerificationGasConsumer

func DefaultSigVerificationGasConsumer(
	meter sdk.GasMeter, sig []byte, pubkey crypto.PubKey, params types.Params,
) error

DefaultSigVerificationGasConsumer is the default implementation of SignatureVerificationGasConsumer. It consumes gas for signature verification based upon the public key type. The cost is fetched from the given params and is matched by the concrete type.

func GetSignerAcc

func GetSignerAcc(ctx sdk.Context, ak AccountKeeper, addr sdk.AccAddress) (exported.Account, error)

GetSignerAcc returns an account for a given address that is expected to sign a transaction.

func InitGenesis

func InitGenesis(ctx sdk.Context, ak AccountKeeper, data GenesisState)

InitGenesis - Init store state from genesis data

CONTRACT: old coins from the FeeCollectionKeeper need to be transferred through a genesis port script to the new fee collector account

func NewAnteHandler

func NewAnteHandler(ak AccountKeeper, supplyKeeper types.SupplyKeeper, sigGasConsumer SignatureVerificationGasConsumer) sdk.AnteHandler

func NewFeeRefundHandler added in v1.0.12

func NewFeeRefundHandler(am AccountKeeper, supplyKeeper auth.SupplyKeeper, rk RefundKeeper) types.FeeRefundHandler

func NewQuerier

func NewQuerier(keeper AccountKeeper) sdk.Querier

creates a querier for auth REST endpoints

func RefundFees added in v1.0.12

func RefundFees(supplyKeeper auth.SupplyKeeper, ctx sdk.Context, acc Account, fees sdk.Coin) (*sdk.Result, error)

func SetGasMeter

func SetGasMeter(simulate bool, ctx sdk.Context, gasLimit uint64) sdk.Context

SetGasMeter returns a new context with a gas meter set from a given context.

func WithSigners added in v1.0.12

func WithSigners(ctx sdk.Context, account Account) sdk.Context

Types

type Account

type Account = exported.Account

func GetSigners added in v1.0.12

func GetSigners(ctx sdk.Context) Account

type AccountKeeper

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

AccountKeeper encodes/decodes accounts using the go-amino (binary) encoding/decoding library.

func NewAccountKeeper

func NewAccountKeeper(
	cdc *codec.Codec, key sdk.StoreKey, paramstore subspace.Subspace, proto func() exported.Account,
) AccountKeeper

NewAccountKeeper returns a new sdk.AccountKeeper that uses go-amino to (binary) encode and decode concrete sdk.Accounts. nolint

func (AccountKeeper) GetAccount

func (ak AccountKeeper) GetAccount(ctx sdk.Context, addr sdk.AccAddress) exported.Account

GetAccount implements sdk.AccountKeeper.

func (AccountKeeper) GetAllAccounts

func (ak AccountKeeper) GetAllAccounts(ctx sdk.Context) []exported.Account

GetAllAccounts returns all accounts in the accountKeeper.

func (AccountKeeper) GetNextAccountNumber

func (ak AccountKeeper) GetNextAccountNumber(ctx sdk.Context) uint64

GetNextAccountNumber Returns and increments the global account number counter

func (AccountKeeper) GetParams

func (ak AccountKeeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams gets the auth module's parameters.

func (AccountKeeper) GetPubKey

func (ak AccountKeeper) GetPubKey(ctx sdk.Context, addr sdk.AccAddress) (crypto.PubKey, error)

GetPubKey Returns the PubKey of the account at address

func (AccountKeeper) GetSequence

func (ak AccountKeeper) GetSequence(ctx sdk.Context, addr sdk.AccAddress) (uint64, error)

GetSequence Returns the Sequence of the account at address

func (AccountKeeper) IterateAccounts

func (ak AccountKeeper) IterateAccounts(ctx sdk.Context, process func(exported.Account) (stop bool))

IterateAccounts implements sdk.AccountKeeper.

func (AccountKeeper) Logger

func (ak AccountKeeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (AccountKeeper) NewAccount

func (ak AccountKeeper) NewAccount(ctx sdk.Context, acc exported.Account) exported.Account

NewAccount creates a new account

func (AccountKeeper) NewAccountWithAddress

func (ak AccountKeeper) NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) exported.Account

NewAccountWithAddress implements sdk.AccountKeeper.

func (AccountKeeper) RemoveAccount

func (ak AccountKeeper) RemoveAccount(ctx sdk.Context, acc exported.Account)

RemoveAccount removes an account for the account mapper store. NOTE: this will cause supply invariant violation if called

func (AccountKeeper) SetAccount

func (ak AccountKeeper) SetAccount(ctx sdk.Context, acc exported.Account)

SetAccount implements sdk.AccountKeeper.

func (AccountKeeper) SetParams

func (ak AccountKeeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets the auth module's parameters.

type AppModule

type AppModule struct {
	AppModuleBasic
	// contains filtered or unexported fields
}

___________________________ app module object

func NewAppModule

func NewAppModule(accountKeeper AccountKeeper) AppModule

NewAppModule creates a new AppModule object

func (AppModule) BeginBlock

func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock)

module begin-block

func (AppModule) EndBlock

module end-block

func (AppModule) ExportGenesis

func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage

module export genesis

func (AppModule) InitGenesis

func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate

module init-genesis

func (AppModule) Name

func (AppModule) Name() string

module name

func (AppModule) NewHandler

func (AppModule) NewHandler() sdk.Handler

module handler

func (AppModule) NewQuerierHandler

func (am AppModule) NewQuerierHandler() sdk.Querier

module querier

func (AppModule) QuerierRoute

func (AppModule) QuerierRoute() string

module querier route name

func (AppModule) RegisterInvariants

func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry)

register invariants

func (AppModule) Route

func (AppModule) Route() string

module message route name

type AppModuleBasic

type AppModuleBasic struct{}

app module basics object

func (AppModuleBasic) DefaultGenesis

func (AppModuleBasic) DefaultGenesis() json.RawMessage

default genesis state

func (AppModuleBasic) GetQueryCmd

func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command

get the root query command of this module

func (AppModuleBasic) GetTxCmd

func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command

get the root tx command of this module

func (AppModuleBasic) Name

func (AppModuleBasic) Name() string

module name

func (AppModuleBasic) RegisterCodec

func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)

register module codec

func (AppModuleBasic) RegisterRESTRoutes

func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)

register rest routes

func (AppModuleBasic) ValidateGenesis

func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error

module validate genesis

type BaseAccount

type BaseAccount = types.BaseAccount

type BaseVestingAccount

type BaseVestingAccount = types.BaseVestingAccount

type ConsumeTxSizeGasDecorator added in v1.0.14

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

ConsumeTxSizeGasDecorator will take in parameters and consume gas proportional to the size of tx before calling next AnteHandler. Note, the gas costs will be slightly over estimated due to the fact that any given signing account may need to be retrieved from state.

CONTRACT: If simulate=true, then signatures must either be completely filled in or empty. CONTRACT: To use this decorator, signatures of transaction must be represented as types.StdSignature otherwise simulate mode will incorrectly estimate gas cost.

func NewConsumeGasForTxSizeDecorator added in v1.0.14

func NewConsumeGasForTxSizeDecorator(ak AccountKeeper) ConsumeTxSizeGasDecorator

func (ConsumeTxSizeGasDecorator) AnteHandle added in v1.0.14

func (cgts ConsumeTxSizeGasDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error)

type ContinuousVestingAccount

type ContinuousVestingAccount = types.ContinuousVestingAccount

type DeductFeeDecorator added in v1.0.14

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

DeductFeeDecorator deducts fees from the first signer of the tx If the first signer does not have the funds to pay for the fees, return with InsufficientFunds error Call next AnteHandler if fees successfully deducted CONTRACT: Tx must implement FeeTx interface to use DeductFeeDecorator

func NewDeductFeeDecorator added in v1.0.14

func NewDeductFeeDecorator(ak AccountKeeper, sk types.SupplyKeeper) DeductFeeDecorator

func (DeductFeeDecorator) AnteHandle added in v1.0.14

func (dfd DeductFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)

type DelayedVestingAccount

type DelayedVestingAccount = types.DelayedVestingAccount

type FeeTx added in v1.0.14

type FeeTx interface {
	sdk.Tx
	GetGas() uint64
	GetFee() sdk.Coins
	FeePayer() sdk.AccAddress
}

type GasTx added in v1.0.14

type GasTx interface {
	sdk.Tx
	GetGas() uint64
}

GasTx defines a Tx with a GetGas() method which is needed to use SetUpContextDecorator

type GenesisState

type GenesisState = types.GenesisState

func ExportGenesis

func ExportGenesis(ctx sdk.Context, ak AccountKeeper) GenesisState

ExportGenesis returns a GenesisState for a given context and keeper

type IncrementSequenceDecorator added in v1.0.14

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

IncrementSequenceDecorator handles incrementing sequences of all signers. Use the IncrementSequenceDecorator decorator to prevent replay attacks. Note, there is no need to execute IncrementSequenceDecorator on CheckTx or RecheckTX since it is merely updating the nonce. As a result, this has the side effect that subsequent and sequential txs orginating from the same account cannot be handled correctly in a reliable way. To send sequential txs orginating from the same account, it is recommended to instead use multiple messages in a tx.

CONTRACT: The tx must implement the SigVerifiableTx interface.

func NewIncrementSequenceDecorator added in v1.0.14

func NewIncrementSequenceDecorator(ak AccountKeeper) IncrementSequenceDecorator

func (IncrementSequenceDecorator) AnteHandle added in v1.0.14

func (isd IncrementSequenceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error)

type MempoolFeeDecorator added in v1.0.14

type MempoolFeeDecorator struct{}

MempoolFeeDecorator will check if the transaction's fee is at least as large as the local validator's minimum gasFee (defined in validator config). If fee is too low, decorator returns error and tx is rejected from mempool. Note this only applies when ctx.CheckTx = true If fee is high enough or not CheckTx, then call next AnteHandler CONTRACT: Tx must implement FeeTx to use MempoolFeeDecorator

func NewMempoolFeeDecorator added in v1.0.14

func NewMempoolFeeDecorator() MempoolFeeDecorator

func (MempoolFeeDecorator) AnteHandle added in v1.0.14

func (mfd MempoolFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)

type Params

type Params = types.Params

type QueryAccountParams

type QueryAccountParams = types.QueryAccountParams

type RefundKeeper added in v1.0.14

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

func NewRefundKeeper added in v1.0.14

func NewRefundKeeper(cdc *codec.Codec, key sdk.StoreKey) RefundKeeper

type SetPubKeyDecorator added in v1.0.14

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

SetPubKeyDecorator sets PubKeys in context for any signer which does not already have pubkey set PubKeys must be set in context for all signers before any other sigverify decorators run CONTRACT: Tx must implement SigVerifiableTx interface

func NewSetPubKeyDecorator added in v1.0.14

func NewSetPubKeyDecorator(ak AccountKeeper) SetPubKeyDecorator

func (SetPubKeyDecorator) AnteHandle added in v1.0.14

func (spkd SetPubKeyDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error)

type SetUpContextDecorator added in v1.0.14

type SetUpContextDecorator struct{}

SetUpContextDecorator sets the GasMeter in the Context and wraps the next AnteHandler with a defer clause to recover from any downstream OutOfGas panics in the AnteHandler chain to return an error with information on gas provided and gas used. CONTRACT: Must be first decorator in the chain CONTRACT: Tx must implement GasTx interface

func NewSetUpContextDecorator added in v1.0.14

func NewSetUpContextDecorator() SetUpContextDecorator

func (SetUpContextDecorator) AnteHandle added in v1.0.14

func (sud SetUpContextDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)

type SigGasConsumeDecorator added in v1.0.14

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

Consume parameter-defined amount of gas for each signature according to the passed-in SignatureVerificationGasConsumer function before calling the next AnteHandler CONTRACT: Pubkeys are set in context for all signers before this decorator runs CONTRACT: Tx must implement SigVerifiableTx interface

func NewSigGasConsumeDecorator added in v1.0.14

func NewSigGasConsumeDecorator(ak AccountKeeper, sigGasConsumer SignatureVerificationGasConsumer) SigGasConsumeDecorator

func (SigGasConsumeDecorator) AnteHandle added in v1.0.14

func (sgcd SigGasConsumeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)

type SigVerifiableTx added in v1.0.14

type SigVerifiableTx interface {
	sdk.Tx
	GetSignatures() [][]byte
	GetSigners() []sdk.AccAddress
	GetPubKeys() []crypto.PubKey // If signer already has pubkey in context, this list will have nil in its place
	GetSignBytes(ctx sdk.Context, acc exported.Account) []byte
}

SigVerifiableTx defines a Tx interface for all signature verification decorators

type SigVerificationDecorator added in v1.0.14

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

Verify all signatures for a tx and return an error if any are invalid. Note, the SigVerificationDecorator decorator will not get executed on ReCheck.

CONTRACT: Pubkeys are set in context for all signers before this decorator runs CONTRACT: Tx must implement SigVerifiableTx interface

func NewSigVerificationDecorator added in v1.0.14

func NewSigVerificationDecorator(ak AccountKeeper) SigVerificationDecorator

func (SigVerificationDecorator) AnteHandle added in v1.0.14

func (svd SigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)

type SignatureVerificationGasConsumer

type SignatureVerificationGasConsumer = func(meter sdk.GasMeter, sig []byte, pubkey crypto.PubKey, params types.Params) error

SignatureVerificationGasConsumer is the type of function that is used to both consume gas when verifying signatures and also to accept or reject different types of pubkeys This is where apps can define their own PubKey

type StdFee

type StdFee = types.StdFee

type StdSignDoc

type StdSignDoc = types.StdSignDoc

type StdSignMsg

type StdSignMsg = types.StdSignMsg

type StdSignature

type StdSignature = types.StdSignature

type StdTx

type StdTx = types.StdTx

type TxBuilder

type TxBuilder = types.TxBuilder

type TxWithMemo added in v1.0.14

type TxWithMemo interface {
	sdk.Tx
	GetMemo() string
}

Tx must have GetMemo() method to use ValidateMemoDecorator

type ValidateBasicDecorator added in v1.0.14

type ValidateBasicDecorator struct{}

ValidateBasicDecorator will call tx.ValidateBasic and return any non-nil error. If ValidateBasic passes, decorator calls next AnteHandler in chain. Note, ValidateBasicDecorator decorator will not get executed on ReCheckTx since it is not dependent on application state.

func NewValidateBasicDecorator added in v1.0.14

func NewValidateBasicDecorator() ValidateBasicDecorator

func (ValidateBasicDecorator) AnteHandle added in v1.0.14

func (vbd ValidateBasicDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error)

type ValidateMemoDecorator added in v1.0.14

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

ValidateMemoDecorator will validate memo given the parameters passed in If memo is too large decorator returns with error, otherwise call next AnteHandler CONTRACT: Tx must implement TxWithMemo interface

func NewValidateMemoDecorator added in v1.0.14

func NewValidateMemoDecorator(ak AccountKeeper) ValidateMemoDecorator

func (ValidateMemoDecorator) AnteHandle added in v1.0.14

func (vmd ValidateMemoDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error)

type ValidateSigCountDecorator added in v1.0.14

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

ValidateSigCountDecorator takes in Params and returns errors if there are too many signatures in the tx for the given params otherwise it calls next AnteHandler Use this decorator to set parameterized limit on number of signatures in tx CONTRACT: Tx must implement SigVerifiableTx interface

func NewValidateSigCountDecorator added in v1.0.14

func NewValidateSigCountDecorator(ak AccountKeeper) ValidateSigCountDecorator

func (ValidateSigCountDecorator) AnteHandle added in v1.0.14

func (vscd ValidateSigCountDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error)

type VestingAccount

type VestingAccount = exported.VestingAccount

Directories

Path Synopsis
client
cli
nolint noalias
nolint noalias

Jump to

Keyboard shortcuts

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