Documentation ¶
Index ¶
- Constants
- Variables
- func CreateTestEnv(t *testing.T) (Keeper, sdk.Context, TestKeepers)
- func ExportGenesis(ctx sdk.Context, k Keeper) types.GenesisState
- func InitGenesis(ctx sdk.Context, keeper Keeper, data types.GenesisState)
- func MakeTestCodec() *codec.LegacyAmino
- func MakeTestMarshaler() codec.BinaryMarshaler
- func MintVouchersFromAir(t *testing.T, ctx sdk.Context, k Keeper, dest sdk.AccAddress, ...) sdk.Coin
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQuerier(keeper Keeper) sdk.Querier
- type AlwaysPanicStakingMock
- type AttestationHandler
- type Keeper
- func (k Keeper) AddClaim(ctx sdk.Context, claimType types.ClaimType, eventNonce uint64, ...) (*types.Attestation, error)
- func (k Keeper) AddToOutgoingPool(ctx sdk.Context, sender sdk.AccAddress, counterpartReceiver string, ...) (uint64, error)
- func (k Keeper) BatchConfirms(c context.Context, req *types.QueryBatchConfirmsRequest) (*types.QueryBatchConfirmsResponse, error)
- func (k Keeper) BatchRequestByNonce(c context.Context, req *types.QueryBatchRequestByNonceRequest) (*types.QueryBatchRequestByNonceResponse, error)
- func (k Keeper) BuildOutgoingTXBatch(ctx sdk.Context, maxElements int) (*types.OutgoingTxBatch, error)
- func (k Keeper) CancelOutgoingTXBatch(ctx sdk.Context, nonce uint64) error
- func (k Keeper) ColdStorageTransfer(ctx sdk.Context, c *types.ColdStorageTransferProposal) error
- func (k Keeper) CurrentValset(c context.Context, req *types.QueryCurrentValsetRequest) (*types.QueryCurrentValsetResponse, error)
- func (k Keeper) DeleteValset(ctx sdk.Context, nonce uint64)
- func (k Keeper) GetAllValsetConfirmsByNonce(ctx sdk.Context, nonce uint64) (confirms []*types.MsgValsetConfirm)
- func (k Keeper) GetAttestation(ctx sdk.Context, eventNonce uint64, details types.MinterClaim) *types.Attestation
- func (k Keeper) GetBatchConfirm(ctx sdk.Context, nonce uint64, validator sdk.AccAddress) *types.MsgConfirmBatch
- func (k Keeper) GetBridgeChainID(ctx sdk.Context) uint64
- func (k Keeper) GetBridgeContractAddress(ctx sdk.Context) string
- func (k Keeper) GetColdStorageAddr(ctx sdk.Context) string
- func (k Keeper) GetCurrentValset(ctx sdk.Context) *types.Valset
- func (k Keeper) GetLastEventNonceByValidator(ctx sdk.Context, validator sdk.ValAddress) uint64
- func (k Keeper) GetLastObservedEventNonce(ctx sdk.Context) uint64
- func (k Keeper) GetLastValset(ctx sdk.Context) *types.Valset
- func (k Keeper) GetMinterAddress(ctx sdk.Context, validator sdk.AccAddress) string
- func (k Keeper) GetOutgoingTXBatch(ctx sdk.Context, nonce uint64) *types.OutgoingTxBatch
- func (k Keeper) GetParams(ctx sdk.Context) (p types.Params)
- func (k Keeper) GetPeggyID(ctx sdk.Context) string
- func (k Keeper) GetStartThreshold(ctx sdk.Context) uint64
- func (k Keeper) GetValsetConfirm(ctx sdk.Context, nonce uint64, validator sdk.AccAddress) *types.MsgValsetConfirm
- func (k Keeper) GetValsetRequest(ctx sdk.Context, nonce uint64) *types.Valset
- func (k Keeper) GetValsets(ctx sdk.Context) (out []*types.Valset)
- func (k Keeper) HasClaim(ctx sdk.Context, claimType types.ClaimType, nonce uint64, ...) bool
- func (k Keeper) HasValsetRequest(ctx sdk.Context, nonce uint64) bool
- func (k Keeper) IsStopped(ctx sdk.Context) bool
- func (k Keeper) IterateBatchConfirmByNonce(ctx sdk.Context, nonce uint64, cb func([]byte, types.MsgConfirmBatch) bool)
- func (k Keeper) IterateOutgoingPool(ctx sdk.Context, cb func(uint64, *types.OutgoingTx) bool)
- func (k Keeper) IterateOutgoingTXBatches(ctx sdk.Context, cb func(key []byte, batch *types.OutgoingTxBatch) bool)
- func (k Keeper) IterateValsetConfirmByNonce(ctx sdk.Context, nonce uint64, cb func([]byte, types.MsgValsetConfirm) bool)
- func (k Keeper) IterateValsetRequest(ctx sdk.Context, cb func(key []byte, val *types.Valset) bool)
- func (k Keeper) IterateValsets(ctx sdk.Context, cb func(key []byte, val *types.Valset) bool)
- func (k Keeper) LastEventNonceByAddr(c context.Context, req *types.QueryLastEventNonceByAddrRequest) (*types.QueryLastEventNonceByAddrResponse, error)
- func (k Keeper) LastPendingBatchRequestByAddr(c context.Context, req *types.QueryLastPendingBatchRequestByAddrRequest) (*types.QueryLastPendingBatchRequestByAddrResponse, error)
- func (k Keeper) LastPendingValsetRequestByAddr(c context.Context, req *types.QueryLastPendingValsetRequestByAddrRequest) (*types.QueryLastPendingValsetRequestByAddrResponse, error)
- func (k Keeper) LastValset(c context.Context, _ *types.QueryLastValsetRequest) (*types.QueryLastValsetResponse, error)
- func (k Keeper) LastValsetRequests(c context.Context, req *types.QueryLastValsetRequestsRequest) (*types.QueryLastValsetRequestsResponse, error)
- func (k Keeper) OracleKeeper() oraclekeeper.Keeper
- func (k Keeper) OutgoingTxBatchExecuted(ctx sdk.Context, nonce uint64, hash string) error
- func (k Keeper) OutgoingTxBatches(c context.Context, req *types.QueryOutgoingTxBatchesRequest) (*types.QueryOutgoingTxBatchesResponse, error)
- func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) SetAttestation(ctx sdk.Context, att *types.Attestation, claim types.MinterClaim)
- func (k Keeper) SetBatchConfirm(ctx sdk.Context, batch *types.MsgConfirmBatch) []byte
- func (k Keeper) SetMinterAddress(ctx sdk.Context, validator sdk.AccAddress, ethAddr string)
- func (k Keeper) SetPeggyKeeper(keeper types.PeggyKeeper)
- func (k Keeper) SetValsetConfirm(ctx sdk.Context, valsetConf types.MsgValsetConfirm) []byte
- func (k Keeper) SetValsetRequest(ctx sdk.Context) *types.Valset
- func (k Keeper) ValsetConfirm(c context.Context, req *types.QueryValsetConfirmRequest) (*types.QueryValsetConfirmResponse, error)
- func (k Keeper) ValsetConfirmsByNonce(c context.Context, req *types.QueryValsetConfirmsByNonceRequest) (*types.QueryValsetConfirmsByNonceResponse, error)
- func (k Keeper) ValsetExecuted(ctx sdk.Context, nonce uint64) error
- func (k Keeper) ValsetRequest(c context.Context, req *types.QueryValsetRequestRequest) (*types.QueryValsetRequestResponse, error)
- type MockStakingValidatorData
- type MultiSigUpdateResponse
- type SignatureWithAddress
- type SignedOutgoingTxBatchResponse
- type StakingKeeperMock
- func (s *StakingKeeperMock) GetBondedValidatorsByPower(ctx sdk.Context) []stakingtypes.Validator
- func (s *StakingKeeperMock) GetLastTotalPower(ctx sdk.Context) (power sdk.Int)
- func (s *StakingKeeperMock) GetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress) int64
- func (s *StakingKeeperMock) Jail(context sdk.Context, address sdk.ConsAddress)
- type TestKeepers
Constants ¶
const ( // used in the relayer QueryValsetRequest = "valsetRequest" QueryValsetConfirmsByNonce = "valsetConfirms" QueryLastValsetRequests = "lastValsetRequests" QueryLastPendingValsetRequestByAddr = "lastPendingValsetRequest" // used to deploy eth contract QueryCurrentValset = "currentValset" QueryValsetConfirm = "valsetConfirm" QueryPeggyID = "peggyID" QueryBatch = "batch" QueryLastPendingBatchRequestByAddr = "lastPendingBatchRequest" QueryOutgoingTxBatches = "lastBatches" QueryBatchConfirms = "batchConfirms" )
const MaxResults = 100 // todo: impl pagination
const OutgoingTxBatchSize = 100
Variables ¶
var ( // ModuleBasics is a mock module basic manager for testing ModuleBasics = module.NewBasicManager( auth.AppModuleBasic{}, genutil.AppModuleBasic{}, bank.AppModuleBasic{}, capability.AppModuleBasic{}, staking.AppModuleBasic{}, mint.AppModuleBasic{}, distribution.AppModuleBasic{}, gov.NewAppModuleBasic( paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.ProposalHandler, upgradeclient.CancelProposalHandler, ), params.AppModuleBasic{}, crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, vesting.AppModuleBasic{}, ) // TestingStakeParams is a set of staking params for testing TestingStakeParams = stakingtypes.Params{ UnbondingTime: 100, MaxValidators: 10, MaxEntries: 10, HistoricalEntries: 10, BondDenom: "stake", } )
Functions ¶
func CreateTestEnv ¶
CreateTestEnv creates the keeper testing environment for peggy
func ExportGenesis ¶
func ExportGenesis(ctx sdk.Context, k Keeper) types.GenesisState
func InitGenesis ¶
func InitGenesis(ctx sdk.Context, keeper Keeper, data types.GenesisState)
func MakeTestCodec ¶
func MakeTestCodec() *codec.LegacyAmino
MakeTestCodec creates a legacy amino codec for testing
func MakeTestMarshaler ¶
func MakeTestMarshaler() codec.BinaryMarshaler
MakeTestMarshaler creates a proto codec for use in testing
func MintVouchersFromAir ¶
func MintVouchersFromAir(t *testing.T, ctx sdk.Context, k Keeper, dest sdk.AccAddress, amount types.MinterCoin) sdk.Coin
MintVouchersFromAir creates new peggy vouchers given erc20tokens
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the gov MsgServer interface for the provided Keeper.
func NewQuerier ¶
NewQuerier is the module level router for state queries
Types ¶
type AlwaysPanicStakingMock ¶
type AlwaysPanicStakingMock struct{}
AlwaysPanicStakingMock is a mock staking keeper that panics on usage
func (AlwaysPanicStakingMock) GetBondedValidatorsByPower ¶
func (s AlwaysPanicStakingMock) GetBondedValidatorsByPower(ctx sdk.Context) []stakingtypes.Validator
GetBondedValidatorsByPower implements the interface for staking keeper required by peggy
func (AlwaysPanicStakingMock) GetLastTotalPower ¶
func (s AlwaysPanicStakingMock) GetLastTotalPower(ctx sdk.Context) (power sdk.Int)
GetLastTotalPower implements the interface for staking keeper required by peggy
func (AlwaysPanicStakingMock) GetLastValidatorPower ¶
func (s AlwaysPanicStakingMock) GetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress) int64
GetLastValidatorPower implements the interface for staking keeper required by peggy
type AttestationHandler ¶
type AttestationHandler struct {
// contains filtered or unexported fields
}
AttestationHandler processes `observed` Attestations
func (*AttestationHandler) Handle ¶
func (a *AttestationHandler) Handle(ctx sdk.Context, att types.Attestation, claim types.MinterClaim) error
Handle is the entry point for Attestation processing.
func (*AttestationHandler) SetPeggyKeeper ¶
func (a *AttestationHandler) SetPeggyKeeper(keeper types.PeggyKeeper)
type Keeper ¶
type Keeper struct { StakingKeeper types.StakingKeeper AttestationHandler interface { Handle(sdk.Context, types.Attestation, types.MinterClaim) error SetPeggyKeeper(keeper types.PeggyKeeper) } // contains filtered or unexported fields }
Keeper maintains the link to storage and exposes getter/setter methods for the various parts of the state machine
func NewKeeper ¶
func NewKeeper(cdc codec.BinaryMarshaler, storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, stakingKeeper types.StakingKeeper, bankKeeper types.BankKeeper, oracleKeeper oraclekeeper.Keeper) Keeper
NewKeeper returns a new instance of the peggy keeper
func (Keeper) AddClaim ¶
func (k Keeper) AddClaim(ctx sdk.Context, claimType types.ClaimType, eventNonce uint64, validator sdk.ValAddress, details types.MinterClaim) (*types.Attestation, error)
AddClaim starts the following process chain:
- Records that a given validator has made a claim about a given ethereum event, checking that the event nonce is contiguous (non contiguous eventNonces indicate out of order events which can cause double spends)
- Either creates a new attestation or adds the validator's vote to the existing attestation for this event
- Checks if the attestation has enough votes to be considered "Observed", then attempts to apply it to the consensus state (e.g. minting tokens for a deposit event)
- If so, marks it "Observed" and emits an event
func (Keeper) AddToOutgoingPool ¶
func (k Keeper) AddToOutgoingPool(ctx sdk.Context, sender sdk.AccAddress, counterpartReceiver string, txHash string, amount sdk.Coin) (uint64, error)
AddToOutgoingPool - checks a counterpart denomintor exists for the given voucher type - burns the voucher for transfer amount and fees - persists an OutgoingTx - adds the TX to the `available` TX pool via a second index
func (Keeper) BatchConfirms ¶
func (k Keeper) BatchConfirms(c context.Context, req *types.QueryBatchConfirmsRequest) (*types.QueryBatchConfirmsResponse, error)
BatchConfirms returns the batch confirmations by nonce and token contract
func (Keeper) BatchRequestByNonce ¶
func (k Keeper) BatchRequestByNonce(c context.Context, req *types.QueryBatchRequestByNonceRequest) (*types.QueryBatchRequestByNonceResponse, error)
BatchRequestByNonce queries the BatchRequestByNonce of the peggy module
func (Keeper) BuildOutgoingTXBatch ¶
func (k Keeper) BuildOutgoingTXBatch(ctx sdk.Context, maxElements int) (*types.OutgoingTxBatch, error)
BuildOutgoingTXBatch starts the following process chain: - find bridged denominator for given voucher type - select available transactions from the outgoing transaction pool sorted by fee desc - persist an outgoing batch object with an incrementing ID = nonce - emit an event
func (Keeper) CancelOutgoingTXBatch ¶
CancelOutgoingTXBatch releases all TX in the batch and deletes the batch
func (Keeper) ColdStorageTransfer ¶
func (Keeper) CurrentValset ¶
func (k Keeper) CurrentValset(c context.Context, req *types.QueryCurrentValsetRequest) (*types.QueryCurrentValsetResponse, error)
CurrentValset queries the CurrentValset of the peggy module
func (Keeper) DeleteValset ¶
DeleteValset deletes the valset at a given nonce from state
func (Keeper) GetAllValsetConfirmsByNonce ¶
func (k Keeper) GetAllValsetConfirmsByNonce(ctx sdk.Context, nonce uint64) (confirms []*types.MsgValsetConfirm)
GetAllValsetConfirmsByNonce returns all validator set confirmations by nonce
func (Keeper) GetAttestation ¶
func (k Keeper) GetAttestation(ctx sdk.Context, eventNonce uint64, details types.MinterClaim) *types.Attestation
GetAttestation return an attestation given a nonce and
func (Keeper) GetBatchConfirm ¶
func (k Keeper) GetBatchConfirm(ctx sdk.Context, nonce uint64, validator sdk.AccAddress) *types.MsgConfirmBatch
GetBatchConfirm returns a batch confirmation given its nonce, the token contract, and a validator address
func (Keeper) GetBridgeChainID ¶
GetBridgeChainID returns the chain id of the ETH chain we are running against
func (Keeper) GetBridgeContractAddress ¶
GetBridgeContractAddress returns the bridge contract address on ETH
func (Keeper) GetCurrentValset ¶
GetCurrentValset gets powers from the store and normalizes them into an integer percentage with a resolution of uint32 Max meaning a given validators 'Peggy power' is computed as Cosmos power / total cosmos power = x / uint32 Max where x is the voting power on the Peggy contract. This allows us to only use integer division which produces a known rounding error from truncation equal to the ratio of the validators Cosmos power / total cosmos power ratio, leaving us at uint32 Max - 1 total voting power. This is an acceptable rounding error since floating point may cause consensus problems if different floating point unit implementations are involved.
func (Keeper) GetLastEventNonceByValidator ¶
GetLastEventNonceByValidator returns the latest event nonce for a given validator
func (Keeper) GetLastObservedEventNonce ¶
GetLastObservedEventNonce returns the latest observed event nonce
func (Keeper) GetMinterAddress ¶
GetMinterAddress returns the eth address for a given peggy validator
func (Keeper) GetOutgoingTXBatch ¶
GetOutgoingTXBatch loads a batch object. Returns nil when not exists.
func (Keeper) GetPeggyID ¶
GetPeggyID returns the PeggyID (???)
func (Keeper) GetStartThreshold ¶
GetStartThreshold returns the start threshold for the peggy validator set
func (Keeper) GetValsetConfirm ¶
func (k Keeper) GetValsetConfirm(ctx sdk.Context, nonce uint64, validator sdk.AccAddress) *types.MsgValsetConfirm
GetValsetConfirm returns a valset confirmation by a nonce and validator address
func (Keeper) GetValsetRequest ¶
GetValsetRequest returns a valset by nonce
func (Keeper) HasClaim ¶
func (k Keeper) HasClaim(ctx sdk.Context, claimType types.ClaimType, nonce uint64, validator sdk.ValAddress, details types.MinterClaim) bool
HasClaim returns true if a claim exists
func (Keeper) HasValsetRequest ¶
HasValsetRequest returns true if a valset defined by a nonce exists
func (Keeper) IterateBatchConfirmByNonce ¶
func (k Keeper) IterateBatchConfirmByNonce(ctx sdk.Context, nonce uint64, cb func([]byte, types.MsgConfirmBatch) bool)
IterateBatchConfirmByNonce iterates through all batch confirmations MARK finish-batches: this is where the key is iterated in the old (presumed working) code TODO: specify which nonce this is
func (Keeper) IterateOutgoingPool ¶
IterateOutgoingPoolByFee itetates over the outgoing pool which is sorted by fee
func (Keeper) IterateOutgoingTXBatches ¶
func (k Keeper) IterateOutgoingTXBatches(ctx sdk.Context, cb func(key []byte, batch *types.OutgoingTxBatch) bool)
IterateOutgoingTXBatches iterates through all outgoing batches in DESC order.
func (Keeper) IterateValsetConfirmByNonce ¶
func (k Keeper) IterateValsetConfirmByNonce(ctx sdk.Context, nonce uint64, cb func([]byte, types.MsgValsetConfirm) bool)
IterateValsetConfirmByNonce iterates through all valset confirms by nonce in ASC order MARK finish-batches: this is where the key is iterated in the old (presumed working) code TODO: specify which nonce this is
func (Keeper) IterateValsetRequest ¶
IterateValsetRequest retruns all valsetRequests
func (Keeper) IterateValsets ¶
IterateValsets retruns all valsetRequests
func (Keeper) LastEventNonceByAddr ¶
func (k Keeper) LastEventNonceByAddr(c context.Context, req *types.QueryLastEventNonceByAddrRequest) (*types.QueryLastEventNonceByAddrResponse, error)
LastEventNonceByAddr returns the last event nonce for the given validator address, this allows eth oracles to figure out where they left off
func (Keeper) LastPendingBatchRequestByAddr ¶
func (k Keeper) LastPendingBatchRequestByAddr(c context.Context, req *types.QueryLastPendingBatchRequestByAddrRequest) (*types.QueryLastPendingBatchRequestByAddrResponse, error)
LastPendingBatchRequestByAddr queries the LastPendingBatchRequestByAddr of the peggy module
func (Keeper) LastPendingValsetRequestByAddr ¶
func (k Keeper) LastPendingValsetRequestByAddr(c context.Context, req *types.QueryLastPendingValsetRequestByAddrRequest) (*types.QueryLastPendingValsetRequestByAddrResponse, error)
LastPendingValsetRequestByAddr queries the LastPendingValsetRequestByAddr of the peggy module
func (Keeper) LastValset ¶
func (k Keeper) LastValset(c context.Context, _ *types.QueryLastValsetRequest) (*types.QueryLastValsetResponse, error)
func (Keeper) LastValsetRequests ¶
func (k Keeper) LastValsetRequests(c context.Context, req *types.QueryLastValsetRequestsRequest) (*types.QueryLastValsetRequestsResponse, error)
LastValsetRequests queries the LastValsetRequests of the peggy module
func (Keeper) OracleKeeper ¶
func (k Keeper) OracleKeeper() oraclekeeper.Keeper
func (Keeper) OutgoingTxBatchExecuted ¶
OutgoingTxBatchExecuted is run when the Cosmos chain detects that a batch has been executed on Ethereum It frees all the transactions in the batch, then cancels all earlier batches
func (Keeper) OutgoingTxBatches ¶
func (k Keeper) OutgoingTxBatches(c context.Context, req *types.QueryOutgoingTxBatchesRequest) (*types.QueryOutgoingTxBatchesResponse, error)
OutgoingTxBatches queries the OutgoingTxBatches of the peggy module
func (Keeper) Params ¶
func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params queries the params of the peggy module
func (Keeper) SetAttestation ¶
func (k Keeper) SetAttestation(ctx sdk.Context, att *types.Attestation, claim types.MinterClaim)
SetAttestation sets the attestation in the store
func (Keeper) SetBatchConfirm ¶
SetBatchConfirm sets a batch confirmation by a validator
func (Keeper) SetMinterAddress ¶
SetMinterAddress sets the ethereum address for a given validator
func (Keeper) SetPeggyKeeper ¶
func (k Keeper) SetPeggyKeeper(keeper types.PeggyKeeper)
func (Keeper) SetValsetConfirm ¶
SetValsetConfirm sets a valset confirmation
func (Keeper) SetValsetRequest ¶
SetValsetRequest returns a new instance of the Peggy BridgeValidatorSet i.e. {"nonce": 1, "memebers": [{"eth_addr": "foo", "power": 11223}]}
func (Keeper) ValsetConfirm ¶
func (k Keeper) ValsetConfirm(c context.Context, req *types.QueryValsetConfirmRequest) (*types.QueryValsetConfirmResponse, error)
ValsetConfirm queries the ValsetConfirm of the peggy module
func (Keeper) ValsetConfirmsByNonce ¶
func (k Keeper) ValsetConfirmsByNonce(c context.Context, req *types.QueryValsetConfirmsByNonceRequest) (*types.QueryValsetConfirmsByNonceResponse, error)
ValsetConfirmsByNonce queries the ValsetConfirmsByNonce of the peggy module
func (Keeper) ValsetRequest ¶
func (k Keeper) ValsetRequest(c context.Context, req *types.QueryValsetRequestRequest) (*types.QueryValsetRequestResponse, error)
ValsetRequest queries the ValsetRequest of the peggy module
type MockStakingValidatorData ¶
type MockStakingValidatorData struct { Operator sdk.ValAddress Power int64 }
MockStakingValidatorData creates mock validator data
type MultiSigUpdateResponse ¶
type SignatureWithAddress ¶
type SignatureWithAddress struct { Signature string `json:"eth_signature"` Address string `json:"eth_address"` }
We can assume that the signatures and the valset members are sorted in the same order but this is insufficient for a relayer to actually relay the batch. Since a batch may pass without signatures from some validators we need some metadata to know who the signatures are from. So that we can properly pass a blank signature for a specific validator
type SignedOutgoingTxBatchResponse ¶
type SignedOutgoingTxBatchResponse struct { Batch types.OutgoingTxBatch `json:"batch"` Signatures []SignatureWithAddress `json:"signatures,omitempty"` }
type StakingKeeperMock ¶
type StakingKeeperMock struct { BondedValidators []stakingtypes.Validator ValidatorPower map[string]int64 }
StakingKeeperMock is a mock staking keeper for use in the tests
func NewStakingKeeperMock ¶
func NewStakingKeeperMock(operators ...sdk.ValAddress) *StakingKeeperMock
NewStakingKeeperMock creates a new mock staking keeper
func NewStakingKeeperWeightedMock ¶
func NewStakingKeeperWeightedMock(t ...MockStakingValidatorData) *StakingKeeperMock
NewStakingKeeperWeightedMock creates a new mock staking keeper with some mock validator data
func (*StakingKeeperMock) GetBondedValidatorsByPower ¶
func (s *StakingKeeperMock) GetBondedValidatorsByPower(ctx sdk.Context) []stakingtypes.Validator
GetBondedValidatorsByPower implements the interface for staking keeper required by peggy
func (*StakingKeeperMock) GetLastTotalPower ¶
func (s *StakingKeeperMock) GetLastTotalPower(ctx sdk.Context) (power sdk.Int)
GetLastTotalPower implements the interface for staking keeper required by peggy
func (*StakingKeeperMock) GetLastValidatorPower ¶
func (s *StakingKeeperMock) GetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress) int64
GetLastValidatorPower implements the interface for staking keeper required by peggy
func (*StakingKeeperMock) Jail ¶
func (s *StakingKeeperMock) Jail(context sdk.Context, address sdk.ConsAddress)
type TestKeepers ¶
type TestKeepers struct { AccountKeeper authkeeper.AccountKeeper StakingKeeper stakingkeeper.Keeper DistKeeper distrkeeper.Keeper BankKeeper bankkeeper.Keeper GovKeeper govkeeper.Keeper }
TestKeepers stores the various keepers required to test peggy