Documentation ¶
Index ¶
- Constants
- Variables
- func ExportGenesis(ctx sdk.Context, k Keeper) types.GenesisState
- func InitGenesis(ctx sdk.Context, k Keeper, data types.GenesisState)
- func MakeTestCodec() *codec.LegacyAmino
- func MakeTestMarshaler() codec.Codec
- func MintVouchersFromAir(t *testing.T, ctx sdk.Context, k Keeper, dest sdk.AccAddress, ...) sdk.Coin
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type AlwaysPanicStakingMock
- func (s AlwaysPanicStakingMock) GetBondedValidatorsByPower(ctx sdk.Context) []stakingtypes.Validator
- func (s AlwaysPanicStakingMock) GetLastTotalPower(ctx sdk.Context) (power sdkmath.Int)
- func (s AlwaysPanicStakingMock) GetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress) int64
- func (s AlwaysPanicStakingMock) IterateBondedValidatorsByPower(sdk.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool))
- func (s AlwaysPanicStakingMock) IterateLastValidators(sdk.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool))
- func (s AlwaysPanicStakingMock) IterateValidators(sdk.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool))
- func (s AlwaysPanicStakingMock) Jail(sdk.Context, sdk.ConsAddress)
- func (s AlwaysPanicStakingMock) Slash(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec)
- func (s AlwaysPanicStakingMock) Validator(sdk.Context, sdk.ValAddress) stakingtypes.ValidatorI
- func (s AlwaysPanicStakingMock) ValidatorByConsAddr(sdk.Context, sdk.ConsAddress) stakingtypes.ValidatorI
- type Hooks
- func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, _ sdk.ConsAddress, valAddress sdk.ValAddress) error
- func (h Hooks) AfterValidatorBonded(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error
- func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) error
- func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeDelegationCreated(_ sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeDelegationRemoved(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
- func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeValidatorModified(_ sdk.Context, _ sdk.ValAddress) error
- func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) error
- type Keeper
- func (k Keeper) AfterBatchExecutedEvent(ctx sdk.Context, event types.BatchExecutedEvent)
- func (k Keeper) AfterContractCallExecutedEvent(ctx sdk.Context, event types.ContractCallExecutedEvent)
- func (k Keeper) AfterERC20DeployedEvent(ctx sdk.Context, event types.ERC20DeployedEvent)
- func (k Keeper) AfterSendToCosmosEvent(ctx sdk.Context, event types.SendToCosmosEvent)
- func (k Keeper) AfterSignerSetExecutedEvent(ctx sdk.Context, event types.SignerSetTxExecutedEvent)
- func (k Keeper) BatchTx(c context.Context, req *types.BatchTxRequest) (*types.BatchTxResponse, error)
- func (k Keeper) BatchTxConfirmations(c context.Context, req *types.BatchTxConfirmationsRequest) (*types.BatchTxConfirmationsResponse, error)
- func (k Keeper) BatchTxConfirmationsByValidator(c context.Context, req *types.BatchTxConfirmationsByValidatorRequest) (*types.BatchTxConfirmationsByValidatorResponse, error)
- func (k Keeper) BatchTxFees(c context.Context, req *types.BatchTxFeesRequest) (*types.BatchTxFeesResponse, error)
- func (k Keeper) BatchTxs(c context.Context, req *types.BatchTxsRequest) (*types.BatchTxsResponse, error)
- func (k Keeper) BatchedSendToEthereums(c context.Context, req *types.BatchedSendToEthereumsRequest) (*types.BatchedSendToEthereumsResponse, error)
- func (k Keeper) CancelBatchTx(ctx sdk.Context, batch *types.BatchTx)
- func (k Keeper) CompleteOutgoingTx(ctx sdk.Context, otx types.OutgoingTx)
- func (k Keeper) CompletedBatchTxs(c context.Context, req *types.CompletedBatchTxsRequest) (*types.CompletedBatchTxsResponse, error)
- func (k Keeper) CompletedContractCallTxs(c context.Context, req *types.CompletedContractCallTxsRequest) (*types.CompletedContractCallTxsResponse, error)
- func (k Keeper) CompletedSignerSetTxs(c context.Context, req *types.CompletedSignerSetTxsRequest) (*types.CompletedSignerSetTxsResponse, error)
- func (k Keeper) ContractCallTx(c context.Context, req *types.ContractCallTxRequest) (*types.ContractCallTxResponse, error)
- func (k Keeper) ContractCallTxConfirmations(c context.Context, req *types.ContractCallTxConfirmationsRequest) (*types.ContractCallTxConfirmationsResponse, error)
- func (k Keeper) ContractCallTxConfirmationsByValidator(c context.Context, req *types.ContractCallTxConfirmationsByValidatorRequest) (*types.ContractCallTxConfirmationsByValidatorResponse, error)
- func (k Keeper) ContractCallTxs(c context.Context, req *types.ContractCallTxsRequest) (*types.ContractCallTxsResponse, error)
- func (k Keeper) CreateBatchTx(ctx sdk.Context, contractAddress common.Address, maxElements int) *types.BatchTx
- func (k Keeper) CreateContractCallTx(ctx sdk.Context, invalidationNonce uint64, invalidationScope tmbytes.HexBytes, ...) *types.ContractCallTx
- func (k Keeper) CreateSignerSetTx(ctx sdk.Context) *types.SignerSetTx
- func (k Keeper) CurrentSignerSet(ctx sdk.Context) types.EthereumSigners
- func (k Keeper) DelegateKeys(c context.Context, req *types.DelegateKeysRequest) (*types.DelegateKeysResponse, error)
- func (k Keeper) DelegateKeysByEthereumSigner(c context.Context, req *types.DelegateKeysByEthereumSignerRequest) (*types.DelegateKeysByEthereumSignerResponse, error)
- func (k Keeper) DelegateKeysByOrchestrator(c context.Context, req *types.DelegateKeysByOrchestratorRequest) (*types.DelegateKeysByOrchestratorResponse, error)
- func (k Keeper) DelegateKeysByValidator(c context.Context, req *types.DelegateKeysByValidatorRequest) (*types.DelegateKeysByValidatorResponse, error)
- func (k Keeper) DeleteCompletedOutgoingTx(ctx sdk.Context, storeIndex []byte)
- func (k Keeper) DeleteEthereumEventVoteRecord(ctx sdk.Context, eventNonce uint64, claimHash []byte)
- func (k Keeper) DeleteEthereumSignatures(ctx sdk.Context, storeIndex []byte)
- func (k Keeper) DeleteOutgoingTx(ctx sdk.Context, storeIndex []byte)
- func (k Keeper) DenomToERC20(c context.Context, req *types.DenomToERC20Request) (*types.DenomToERC20Response, error)
- func (k Keeper) DenomToERC20Lookup(ctx sdk.Context, denom string) (bool, common.Address, error)
- func (k Keeper) DenomToERC20Params(c context.Context, req *types.DenomToERC20ParamsRequest) (*types.DenomToERC20ParamsResponse, error)
- func (k Keeper) DetectMaliciousSupply(ctx sdk.Context, denom string, amount sdk.Int) (err error)
- func (k Keeper) ERC20ToDenom(c context.Context, req *types.ERC20ToDenomRequest) (*types.ERC20ToDenomResponse, error)
- func (k Keeper) ERC20ToDenomLookup(ctx sdk.Context, tokenContract common.Address) (bool, string)
- func (k Keeper) EthereumEventVoteRecords(c context.Context, req *types.EthereumEventVoteRecordsRequest) (*types.EthereumEventVoteRecordsResponse, error)
- func (k Keeper) EthereumEventVotes(c context.Context, req *types.EthereumEventVotesRequest) (*types.EthereumEventVotesResponse, error)
- func (k Keeper) GetBatchFeesByTokenType(ctx sdk.Context, tokenContractAddr common.Address, maxElements int) sdk.Int
- func (k Keeper) GetBondedValidatorSlashingInfos(ctx sdk.Context) ([]stakingtypes.Validator, []ValidatorSlashingInfo)
- func (k Keeper) GetCompletedOutgoingTx(ctx sdk.Context, storeIndex []byte) (out types.OutgoingTx)
- func (k Keeper) GetEthereumEventVoteRecord(ctx sdk.Context, eventNonce uint64, claimHash []byte) *types.EthereumEventVoteRecord
- func (k Keeper) GetEthereumEventVoteRecordMapping(ctx sdk.Context) (out map[uint64][]*types.EthereumEventVoteRecord)
- func (k Keeper) GetEthereumHeightVote(ctx sdk.Context, valAddress sdk.ValAddress) types.LatestEthereumBlockHeight
- func (k Keeper) GetEthereumOrchestratorAddress(ctx sdk.Context, ethAddr common.Address) sdk.AccAddress
- func (k Keeper) GetEthereumSignatures(ctx sdk.Context, storeIndex []byte) map[string][]byte
- func (k Keeper) GetLastObservedEthereumBlockHeight(ctx sdk.Context) types.LatestEthereumBlockHeight
- func (k Keeper) GetLastObservedEventNonce(ctx sdk.Context) uint64
- func (k Keeper) GetLastObservedSignerSetTx(ctx sdk.Context) *types.SignerSetTx
- func (k Keeper) GetLastSlashedOutgoingTxBlockHeight(ctx sdk.Context) uint64
- func (k Keeper) GetLastUnbondingBlockHeight(ctx sdk.Context) uint64
- func (k Keeper) GetLatestSignerSetTx(ctx sdk.Context) *types.SignerSetTx
- func (k Keeper) GetLatestSignerSetTxNonce(ctx sdk.Context) uint64
- func (k Keeper) GetOrchestratorValidatorAddress(ctx sdk.Context, orchAddr sdk.AccAddress) sdk.ValAddress
- func (k Keeper) GetOutgoingTx(ctx sdk.Context, storeIndex []byte) (out types.OutgoingTx)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetSignerSetTxs(ctx sdk.Context) (out []*types.SignerSetTx)
- func (k Keeper) GetUnbondingValidatorSlashingInfos(ctx sdk.Context) ([]stakingtypes.Validator, []ValidatorSlashingInfo)
- func (k Keeper) GetUnsignedBatchTxs(ctx sdk.Context, val sdk.ValAddress) []*types.BatchTx
- func (k Keeper) GetUnsignedContractCallTxs(ctx sdk.Context, val sdk.ValAddress) []*types.ContractCallTx
- func (k Keeper) GetUnsignedSignerSetTxs(ctx sdk.Context, val sdk.ValAddress) []*types.SignerSetTx
- func (k Keeper) GetUnslashedOutgoingTxs(ctx sdk.Context, maxHeight uint64) (out []types.OutgoingTx)
- func (k Keeper) GetValidatorEthereumAddress(ctx sdk.Context, valAddr sdk.ValAddress) common.Address
- func (k Keeper) GetValidatorSlashingInfo(ctx sdk.Context, validator stakingtypes.Validator) ValidatorSlashingInfo
- func (k Keeper) Handle(ctx sdk.Context, eve types.EthereumEvent) (err error)
- func (k Keeper) HandleCommunityPoolEthereumSpendProposal(ctx sdk.Context, p *types.CommunityPoolEthereumSpendProposal) error
- func (k Keeper) Hooks() Hooks
- func (k Keeper) IterateBatchTxEthereumSignatures(ctx sdk.Context, cb func(common.Address, uint64, sdk.ValAddress, []byte) bool)
- func (k Keeper) IterateCompletedOutgoingTxs(ctx sdk.Context, cb func(key []byte, outgoing types.OutgoingTx) bool)
- func (k Keeper) IterateCompletedOutgoingTxsByType(ctx sdk.Context, prefixByte byte, ...)
- func (k Keeper) IterateContractCallTxEthereumSignatures(ctx sdk.Context, cb func([]byte, uint64, sdk.ValAddress, []byte) bool)
- func (k Keeper) IterateEthereumEventVoteRecords(ctx sdk.Context, cb func([]byte, *types.EthereumEventVoteRecord) bool)
- func (k Keeper) IterateEthereumHeightVotes(ctx sdk.Context, ...)
- func (k Keeper) IterateOutgoingTxsByType(ctx sdk.Context, prefixByte byte, ...)
- func (k Keeper) IterateSignerSetTxEthereumSignatures(ctx sdk.Context, cb func(uint64, sdk.ValAddress, []byte) bool)
- func (k Keeper) IterateUnbatchedSendToEthereums(ctx sdk.Context, cb func(*types.SendToEthereum) bool)
- func (k Keeper) LastObservedEthereumHeight(c context.Context, req *types.LastObservedEthereumHeightRequest) (*types.LastObservedEthereumHeightResponse, error)
- func (k Keeper) LastSubmittedEthereumEvent(c context.Context, req *types.LastSubmittedEthereumEventRequest) (*types.LastSubmittedEthereumEventResponse, error)
- func (k Keeper) LatestSignerSetTx(c context.Context, req *types.LatestSignerSetTxRequest) (*types.SignerSetTxResponse, error)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MigrateGravityContract(ctx sdk.Context, newBridgeAddress string, bridgeDeploymentHeight uint64)
- func (k Keeper) PaginateEthereumEventVoteRecords(ctx sdk.Context, pageReq *query.PageRequest, ...) (*query.PageResponse, error)
- func (k Keeper) PaginateOutgoingTxsByType(ctx sdk.Context, pageReq *query.PageRequest, prefixByte byte, ...) (*query.PageResponse, error)
- func (k Keeper) Params(c context.Context, req *types.ParamsRequest) (*types.ParamsResponse, error)
- func (k Keeper) SetCompletedOutgoingTx(ctx sdk.Context, outgoing types.OutgoingTx)
- func (k Keeper) SetEthereumHeightVote(ctx sdk.Context, valAddress sdk.ValAddress, ethereumHeight uint64)
- func (k Keeper) SetEthereumSignature(ctx sdk.Context, sig types.EthereumTxConfirmation, val sdk.ValAddress) []byte
- func (k *Keeper) SetHooks(sh types.GravityHooks) *Keeper
- func (k Keeper) SetLastObservedEthereumBlockHeight(ctx sdk.Context, ethereumHeight uint64)
- func (k Keeper) SetLastObservedEthereumBlockHeightWithCosmos(ctx sdk.Context, ethereumHeight uint64, cosmosHeight uint64)
- func (k Keeper) SetLastSlashedOutgoingTxBlockHeight(ctx sdk.Context, blockHeight uint64)
- func (k Keeper) SetOrchestratorValidatorAddress(ctx sdk.Context, val sdk.ValAddress, orchAddr sdk.AccAddress)
- func (k Keeper) SetOutgoingTx(ctx sdk.Context, outgoing types.OutgoingTx)
- func (k Keeper) SetParams(ctx sdk.Context, ps types.Params)
- func (k Keeper) SignerSetExecuted(ctx sdk.Context, nonce uint64)
- func (k Keeper) SignerSetTx(c context.Context, req *types.SignerSetTxRequest) (*types.SignerSetTxResponse, error)
- func (k Keeper) SignerSetTxConfirmations(c context.Context, req *types.SignerSetTxConfirmationsRequest) (*types.SignerSetTxConfirmationsResponse, error)
- func (k Keeper) SignerSetTxConfirmationsByValidator(c context.Context, req *types.SignerSetTxConfirmationsByValidatorRequest) (*types.SignerSetTxConfirmationsByValidatorResponse, error)
- func (k Keeper) SignerSetTxs(c context.Context, req *types.SignerSetTxsRequest) (*types.SignerSetTxsResponse, error)
- func (k Keeper) SlashAndJail(ctx sdk.Context, validator stakingtypes.Validator, reason string)
- func (k Keeper) TryEventVoteRecord(ctx sdk.Context, eventVoteRecord *types.EthereumEventVoteRecord)
- func (k Keeper) UnbatchedSendToEthereums(c context.Context, req *types.UnbatchedSendToEthereumsRequest) (*types.UnbatchedSendToEthereumsResponse, error)
- func (k Keeper) UnsignedBatchTxs(c context.Context, req *types.UnsignedBatchTxsRequest) (*types.UnsignedBatchTxsResponse, error)
- func (k Keeper) UnsignedContractCallTxs(c context.Context, req *types.UnsignedContractCallTxsRequest) (*types.UnsignedContractCallTxsResponse, error)
- func (k Keeper) UnsignedSignerSetTxs(c context.Context, req *types.UnsignedSignerSetTxsRequest) (*types.UnsignedSignerSetTxsResponse, error)
- type Migrator
- type MockStakingValidatorData
- type StakingKeeperMock
- func (s *StakingKeeperMock) GetBondedValidatorsByPower(ctx sdk.Context) []stakingtypes.Validator
- func (s *StakingKeeperMock) GetLastTotalPower(ctx sdk.Context) (power sdkmath.Int)
- func (s *StakingKeeperMock) GetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress) int64
- func (s *StakingKeeperMock) GetParams(ctx sdk.Context) stakingtypes.Params
- func (s *StakingKeeperMock) GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool)
- func (s *StakingKeeperMock) IterateBondedValidatorsByPower(ctx sdk.Context, ...)
- func (s *StakingKeeperMock) IterateLastValidators(ctx sdk.Context, ...)
- func (s *StakingKeeperMock) IterateValidators(ctx sdk.Context, ...)
- func (s *StakingKeeperMock) Jail(sdk.Context, sdk.ConsAddress)
- func (s *StakingKeeperMock) Slash(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec) sdkmath.Int
- func (s *StakingKeeperMock) Validator(ctx sdk.Context, addr sdk.ValAddress) stakingtypes.ValidatorI
- func (s *StakingKeeperMock) ValidatorByConsAddr(ctx sdk.Context, addr sdk.ConsAddress) stakingtypes.ValidatorI
- func (s *StakingKeeperMock) ValidatorQueueIterator(ctx sdk.Context, endTime time.Time, endHeight int64) sdk.Iterator
- type TestInput
- type ValidatorSlashingInfo
Constants ¶
const BatchTxSize = 100
TODO: should we make this a parameter or a a call arg?
Variables ¶
var ( // ConsPrivKeys generate ed25519 ConsPrivKeys to be used for validator operator keys ConsPrivKeys = []ccrypto.PrivKey{ ed25519.GenPrivKey(), ed25519.GenPrivKey(), ed25519.GenPrivKey(), ed25519.GenPrivKey(), ed25519.GenPrivKey(), } // ConsPubKeys holds the consensus public keys to be used for validator operator keys ConsPubKeys = []ccrypto.PubKey{ ConsPrivKeys[0].PubKey(), ConsPrivKeys[1].PubKey(), ConsPrivKeys[2].PubKey(), ConsPrivKeys[3].PubKey(), ConsPrivKeys[4].PubKey(), } // AccPrivKeys generate secp256k1 pubkeys to be used for account pub keys AccPrivKeys = []ccrypto.PrivKey{ secp256k1.GenPrivKey(), secp256k1.GenPrivKey(), secp256k1.GenPrivKey(), secp256k1.GenPrivKey(), secp256k1.GenPrivKey(), } // AccPubKeys holds the pub keys for the account keys AccPubKeys = []ccrypto.PubKey{ AccPrivKeys[0].PubKey(), AccPrivKeys[1].PubKey(), AccPrivKeys[2].PubKey(), AccPrivKeys[3].PubKey(), AccPrivKeys[4].PubKey(), } // AccAddrs holds the sdk.AccAddresses AccAddrs = []sdk.AccAddress{ sdk.AccAddress(AccPubKeys[0].Address()), sdk.AccAddress(AccPubKeys[1].Address()), sdk.AccAddress(AccPubKeys[2].Address()), sdk.AccAddress(AccPubKeys[3].Address()), sdk.AccAddress(AccPubKeys[4].Address()), } // ValAddrs holds the sdk.ValAddresses ValAddrs = []sdk.ValAddress{ sdk.ValAddress(AccPubKeys[0].Address()), sdk.ValAddress(AccPubKeys[1].Address()), sdk.ValAddress(AccPubKeys[2].Address()), sdk.ValAddress(AccPubKeys[3].Address()), sdk.ValAddress(AccPubKeys[4].Address()), } // EthAddrs holds etheruem addresses EthAddrs = []gethcommon.Address{ gethcommon.BytesToAddress(bytes.Repeat([]byte{byte(1)}, 20)), gethcommon.BytesToAddress(bytes.Repeat([]byte{byte(2)}, 20)), gethcommon.BytesToAddress(bytes.Repeat([]byte{byte(3)}, 20)), gethcommon.BytesToAddress(bytes.Repeat([]byte{byte(4)}, 20)), gethcommon.BytesToAddress(bytes.Repeat([]byte{byte(5)}, 20)), } // TokenContractAddrs holds example token contract addresses TokenContractAddrs = []string{ "0x6b175474e89094c44da98b954eedeac495271d0f", "0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e", "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", "0xc00e94cb662c3520282e6f5717214004a7f26888", "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f", } // InitTokens holds the number of tokens to initialize an account with InitTokens = sdk.TokensFromConsensusPower(110, sdk.DefaultPowerReduction) // InitCoins holds the number of coins to initialize an account with InitCoins = sdk.NewCoins(sdk.NewCoin(TestingStakeParams.BondDenom, InitTokens)) // StakingAmount holds the staking power to start a validator with StakingAmount = sdk.TokensFromConsensusPower(10, sdk.DefaultPowerReduction) // StakingCoins holds the staking coins to start a validator with StakingCoins = sdk.NewCoins(sdk.NewCoin(TestingStakeParams.BondDenom, StakingAmount)) // TestingStakeParams is a set of staking params for testing TestingStakeParams = stakingtypes.Params{ UnbondingTime: 100, MaxValidators: 10, MaxEntries: 10, HistoricalEntries: 10000, BondDenom: "stake", MinCommissionRate: sdk.ZeroDec(), } // TestingGravityParams is a set of gravity params for testing TestingGravityParams = types.Params{ GravityId: "testgravityid", ContractSourceHash: "62328f7bc12efb28f86111d08c29b39285680a906ea0e524e0209d6f6657b713", BridgeEthereumAddress: "0x8858eeb3dfffa017d4bce9801d340d36cf895ccf", BridgeChainId: 11, ConfirmedOutgoingTxWindow: 10, SignedSignerSetTxsWindow: 10, UnbondSlashingSignerSetTxsWindow: 10, EthereumSignaturesWindow: 10, TargetEthTxTimeout: 60001, AverageBlockTime: 5000, AverageEthereumBlockTime: 15000, SlashFractionSignerSetTx: sdk.NewDecWithPrec(1, 2), SlashFractionBatch: sdk.NewDecWithPrec(1, 2), SlashFractionEthereumSignature: sdk.NewDecWithPrec(1, 2), SlashFractionConflictingEthereumSignature: sdk.NewDecWithPrec(1, 2), } )
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( []govclient.ProposalHandler{ paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.LegacyProposalHandler, upgradeclient.LegacyCancelProposalHandler, }, ), params.AppModuleBasic{}, crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, vesting.AppModuleBasic{}, ) )
Functions ¶
func ExportGenesis ¶
func ExportGenesis(ctx sdk.Context, k Keeper) types.GenesisState
ExportGenesis exports all the state needed to restart the chain from the current state of the chain
func InitGenesis ¶
func InitGenesis(ctx sdk.Context, k Keeper, data types.GenesisState)
InitGenesis starts a chain from a genesis state
func MakeTestCodec ¶
func MakeTestCodec() *codec.LegacyAmino
MakeTestCodec creates a legacy amino codec for testing
func MakeTestMarshaler ¶
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.ERC20Token) sdk.Coin
MintVouchersFromAir creates new gravity vouchers given erc20tokens
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the gov MsgServer interface for the provided Keeper.
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 gravity
func (AlwaysPanicStakingMock) GetLastTotalPower ¶
func (s AlwaysPanicStakingMock) GetLastTotalPower(ctx sdk.Context) (power sdkmath.Int)
GetLastTotalPower implements the interface for staking keeper required by gravity
func (AlwaysPanicStakingMock) GetLastValidatorPower ¶
func (s AlwaysPanicStakingMock) GetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress) int64
GetLastValidatorPower implements the interface for staking keeper required by gravity
func (AlwaysPanicStakingMock) IterateBondedValidatorsByPower ¶
func (s AlwaysPanicStakingMock) IterateBondedValidatorsByPower(sdk.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool))
IterateBondedValidatorsByPower staisfies the interface
func (AlwaysPanicStakingMock) IterateLastValidators ¶
func (s AlwaysPanicStakingMock) IterateLastValidators(sdk.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool))
IterateLastValidators staisfies the interface
func (AlwaysPanicStakingMock) IterateValidators ¶
func (s AlwaysPanicStakingMock) IterateValidators(sdk.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool))
IterateValidators staisfies the interface
func (AlwaysPanicStakingMock) Jail ¶
func (s AlwaysPanicStakingMock) Jail(sdk.Context, sdk.ConsAddress)
Jail staisfies the interface
func (AlwaysPanicStakingMock) Slash ¶
func (s AlwaysPanicStakingMock) Slash(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec)
Slash staisfies the interface
func (AlwaysPanicStakingMock) Validator ¶
func (s AlwaysPanicStakingMock) Validator(sdk.Context, sdk.ValAddress) stakingtypes.ValidatorI
Validator staisfies the interface
func (AlwaysPanicStakingMock) ValidatorByConsAddr ¶
func (s AlwaysPanicStakingMock) ValidatorByConsAddr(sdk.Context, sdk.ConsAddress) stakingtypes.ValidatorI
ValidatorByConsAddr staisfies the interface
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
func (Hooks) AfterDelegationModified ¶
func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
func (Hooks) AfterValidatorBeginUnbonding ¶
func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, _ sdk.ConsAddress, valAddress sdk.ValAddress) error
func (Hooks) AfterValidatorBonded ¶
func (h Hooks) AfterValidatorBonded(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error
func (Hooks) AfterValidatorCreated ¶
func (Hooks) AfterValidatorRemoved ¶
func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) error
func (Hooks) BeforeDelegationCreated ¶
func (h Hooks) BeforeDelegationCreated(_ sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
func (Hooks) BeforeDelegationRemoved ¶
func (h Hooks) BeforeDelegationRemoved(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
func (Hooks) BeforeDelegationSharesModified ¶
func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
func (Hooks) BeforeValidatorModified ¶
func (Hooks) BeforeValidatorSlashed ¶
type Keeper ¶
type Keeper struct { StakingKeeper types.StakingKeeper SlashingKeeper types.SlashingKeeper DistributionKeeper types.DistributionKeeper PowerReduction sdkmath.Int ReceiverModuleAccounts map[string]string SenderModuleAccounts map[string]string // 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.Codec, storeKey storetypes.StoreKey, paramSpace paramtypes.Subspace, accKeeper types.AccountKeeper, stakingKeeper types.StakingKeeper, bankKeeper types.BankKeeper, slashingKeeper types.SlashingKeeper, distributionKeeper types.DistributionKeeper, powerReduction sdkmath.Int, receiverModuleAccounts map[string]string, senderModuleAccounts map[string]string, ) Keeper
NewKeeper returns a new instance of the gravity keeper
func (Keeper) AfterBatchExecutedEvent ¶
func (k Keeper) AfterBatchExecutedEvent(ctx sdk.Context, event types.BatchExecutedEvent)
func (Keeper) AfterContractCallExecutedEvent ¶
func (k Keeper) AfterContractCallExecutedEvent(ctx sdk.Context, event types.ContractCallExecutedEvent)
func (Keeper) AfterERC20DeployedEvent ¶
func (k Keeper) AfterERC20DeployedEvent(ctx sdk.Context, event types.ERC20DeployedEvent)
func (Keeper) AfterSendToCosmosEvent ¶
func (k Keeper) AfterSendToCosmosEvent(ctx sdk.Context, event types.SendToCosmosEvent)
func (Keeper) AfterSignerSetExecutedEvent ¶
func (k Keeper) AfterSignerSetExecutedEvent(ctx sdk.Context, event types.SignerSetTxExecutedEvent)
func (Keeper) BatchTx ¶
func (k Keeper) BatchTx(c context.Context, req *types.BatchTxRequest) (*types.BatchTxResponse, error)
func (Keeper) BatchTxConfirmations ¶
func (k Keeper) BatchTxConfirmations(c context.Context, req *types.BatchTxConfirmationsRequest) (*types.BatchTxConfirmationsResponse, error)
func (Keeper) BatchTxConfirmationsByValidator ¶
func (k Keeper) BatchTxConfirmationsByValidator(c context.Context, req *types.BatchTxConfirmationsByValidatorRequest) (*types.BatchTxConfirmationsByValidatorResponse, error)
func (Keeper) BatchTxFees ¶
func (k Keeper) BatchTxFees(c context.Context, req *types.BatchTxFeesRequest) (*types.BatchTxFeesResponse, error)
func (Keeper) BatchTxs ¶
func (k Keeper) BatchTxs(c context.Context, req *types.BatchTxsRequest) (*types.BatchTxsResponse, error)
func (Keeper) BatchedSendToEthereums ¶
func (k Keeper) BatchedSendToEthereums(c context.Context, req *types.BatchedSendToEthereumsRequest) (*types.BatchedSendToEthereumsResponse, error)
func (Keeper) CancelBatchTx ¶
CancelBatchTx releases all TX in the batch and deletes the batch
func (Keeper) CompleteOutgoingTx ¶
func (k Keeper) CompleteOutgoingTx(ctx sdk.Context, otx types.OutgoingTx)
func (Keeper) CompletedBatchTxs ¶
func (k Keeper) CompletedBatchTxs(c context.Context, req *types.CompletedBatchTxsRequest) (*types.CompletedBatchTxsResponse, error)
func (Keeper) CompletedContractCallTxs ¶
func (k Keeper) CompletedContractCallTxs(c context.Context, req *types.CompletedContractCallTxsRequest) (*types.CompletedContractCallTxsResponse, error)
func (Keeper) CompletedSignerSetTxs ¶
func (k Keeper) CompletedSignerSetTxs(c context.Context, req *types.CompletedSignerSetTxsRequest) (*types.CompletedSignerSetTxsResponse, error)
func (Keeper) ContractCallTx ¶
func (k Keeper) ContractCallTx(c context.Context, req *types.ContractCallTxRequest) (*types.ContractCallTxResponse, error)
func (Keeper) ContractCallTxConfirmations ¶
func (k Keeper) ContractCallTxConfirmations(c context.Context, req *types.ContractCallTxConfirmationsRequest) (*types.ContractCallTxConfirmationsResponse, error)
func (Keeper) ContractCallTxConfirmationsByValidator ¶
func (k Keeper) ContractCallTxConfirmationsByValidator(c context.Context, req *types.ContractCallTxConfirmationsByValidatorRequest) (*types.ContractCallTxConfirmationsByValidatorResponse, error)
func (Keeper) ContractCallTxs ¶
func (k Keeper) ContractCallTxs(c context.Context, req *types.ContractCallTxsRequest) (*types.ContractCallTxsResponse, error)
func (Keeper) CreateBatchTx ¶
func (k Keeper) CreateBatchTx(ctx sdk.Context, contractAddress common.Address, maxElements int) *types.BatchTx
CreateBatchTx starts the following process chain:
- find bridged denominator for given voucher type
- determine if a an unexecuted batch is already waiting for this token type, if so confirm the new batch would have a higher total fees. If not exit withtout creating a batch
- select available transactions from the unbatched SendToEthereums sorted by fee desc
- persist an OutgoingTx (BatchTx) object with an incrementing ID = nonce
- emit an event
func (Keeper) CreateContractCallTx ¶
func (k Keeper) CreateContractCallTx(ctx sdk.Context, invalidationNonce uint64, invalidationScope tmbytes.HexBytes, address common.Address, payload []byte, tokens []types.ERC20Token, fees []types.ERC20Token) *types.ContractCallTx
CreateContractCallTx xxx
func (Keeper) CreateSignerSetTx ¶
func (k Keeper) CreateSignerSetTx(ctx sdk.Context) *types.SignerSetTx
CreateSignerSetTx gets the current signer set from the staking keeper, increments the nonce, creates the signer set tx object, emits an event and sets the signer set in state
func (Keeper) CurrentSignerSet ¶
func (k Keeper) CurrentSignerSet(ctx sdk.Context) types.EthereumSigners
CurrentSignerSet gets powers from the store and normalizes them into an integer percentage with a resolution of uint32 Max meaning a given validators 'gravity power' is computed as Cosmos power / total cosmos power = x / uint32 Max where x is the voting power on the gravity 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) DelegateKeys ¶
func (k Keeper) DelegateKeys(c context.Context, req *types.DelegateKeysRequest) (*types.DelegateKeysResponse, error)
func (Keeper) DelegateKeysByEthereumSigner ¶
func (k Keeper) DelegateKeysByEthereumSigner(c context.Context, req *types.DelegateKeysByEthereumSignerRequest) (*types.DelegateKeysByEthereumSignerResponse, error)
func (Keeper) DelegateKeysByOrchestrator ¶
func (k Keeper) DelegateKeysByOrchestrator(c context.Context, req *types.DelegateKeysByOrchestratorRequest) (*types.DelegateKeysByOrchestratorResponse, error)
func (Keeper) DelegateKeysByValidator ¶
func (k Keeper) DelegateKeysByValidator(c context.Context, req *types.DelegateKeysByValidatorRequest) (*types.DelegateKeysByValidatorResponse, error)
func (Keeper) DeleteCompletedOutgoingTx ¶
DeleteCompletedOutgoingTx deletes a given outgoingtx
func (Keeper) DeleteEthereumEventVoteRecord ¶
func (Keeper) DeleteEthereumSignatures ¶
DeleteEthereumSignatures deletes all ethereum signatures for a given outgoing tx by store index
func (Keeper) DeleteOutgoingTx ¶
DeleteOutgoingTx deletes a given outgoingtx
func (Keeper) DenomToERC20 ¶
func (k Keeper) DenomToERC20(c context.Context, req *types.DenomToERC20Request) (*types.DenomToERC20Response, error)
func (Keeper) DenomToERC20Lookup ¶
DenomToERC20 returns (bool isCosmosOriginated, string ERC20, err) Using this information, you can see if an asset is native to Cosmos or Ethereum, and get its corresponding ERC20 address. This will return an error if it cant parse the denom as a gravity denom, and then also can't find the denom in an index of ERC20 contracts deployed on Ethereum to serve as synthetic Cosmos assets.
func (Keeper) DenomToERC20Params ¶
func (k Keeper) DenomToERC20Params(c context.Context, req *types.DenomToERC20ParamsRequest) (*types.DenomToERC20ParamsResponse, error)
func (Keeper) DetectMaliciousSupply ¶
func (Keeper) ERC20ToDenom ¶
func (k Keeper) ERC20ToDenom(c context.Context, req *types.ERC20ToDenomRequest) (*types.ERC20ToDenomResponse, error)
func (Keeper) ERC20ToDenomLookup ¶
ERC20ToDenom returns (bool isCosmosOriginated, string denom, err) Using this information, you can see if an ERC20 address represents an asset is native to Cosmos or Ethereum, and get its corresponding denom
func (Keeper) EthereumEventVoteRecords ¶
func (k Keeper) EthereumEventVoteRecords(c context.Context, req *types.EthereumEventVoteRecordsRequest) (*types.EthereumEventVoteRecordsResponse, error)
func (Keeper) EthereumEventVotes ¶
func (k Keeper) EthereumEventVotes(c context.Context, req *types.EthereumEventVotesRequest) (*types.EthereumEventVotesResponse, error)
func (Keeper) GetBatchFeesByTokenType ¶
func (k Keeper) GetBatchFeesByTokenType(ctx sdk.Context, tokenContractAddr common.Address, maxElements int) sdk.Int
GetBatchFeesByTokenType gets the fees the next batch of a given token type would have if created. This info is both presented to relayers for the purpose of determining when to request batches and also used by the batch creation process to decide not to create a new batch
func (Keeper) GetBondedValidatorSlashingInfos ¶
func (k Keeper) GetBondedValidatorSlashingInfos(ctx sdk.Context) ([]stakingtypes.Validator, []ValidatorSlashingInfo)
GetBondedValidatorSlashingInfos returns the information needed for slashing for each bonded validator
func (Keeper) GetCompletedOutgoingTx ¶
GetCompletedOutgoingTx gets a completed outgoing tx
func (Keeper) GetEthereumEventVoteRecord ¶
func (k Keeper) GetEthereumEventVoteRecord(ctx sdk.Context, eventNonce uint64, claimHash []byte) *types.EthereumEventVoteRecord
GetEthereumEventVoteRecord return a vote record given a nonce
func (Keeper) GetEthereumEventVoteRecordMapping ¶
func (k Keeper) GetEthereumEventVoteRecordMapping(ctx sdk.Context) (out map[uint64][]*types.EthereumEventVoteRecord)
GetEthereumEventVoteRecordMapping returns a mapping of eventnonce -> attestations at that nonce
func (Keeper) GetEthereumHeightVote ¶
func (k Keeper) GetEthereumHeightVote(ctx sdk.Context, valAddress sdk.ValAddress) types.LatestEthereumBlockHeight
GetEthereumHeightVoteRecord gets the latest observed heights per validator
func (Keeper) GetEthereumOrchestratorAddress ¶
func (k Keeper) GetEthereumOrchestratorAddress(ctx sdk.Context, ethAddr common.Address) sdk.AccAddress
GetEthereumOrchestratorAddress gets the orch address for a given eth address
func (Keeper) GetEthereumSignatures ¶
GetEthereumSignatures returns all etherum signatures for a given outgoing tx by store index
func (Keeper) GetLastObservedEthereumBlockHeight ¶
func (k Keeper) GetLastObservedEthereumBlockHeight(ctx sdk.Context) types.LatestEthereumBlockHeight
GetLastObservedEthereumBlockHeight height gets the block height to of the last observed attestation from the store
func (Keeper) GetLastObservedEventNonce ¶
GetLastObservedEventNonce returns the latest observed event nonce
func (Keeper) GetLastObservedSignerSetTx ¶
func (k Keeper) GetLastObservedSignerSetTx(ctx sdk.Context) *types.SignerSetTx
GetLastObservedSignerSetTx retrieves the last observed validator set from the store
func (Keeper) GetLastSlashedOutgoingTxBlockHeight ¶
GetLastSlashedOutgoingTxBlockHeight returns the latest slashed Batch block
func (Keeper) GetLastUnbondingBlockHeight ¶
GetLastUnbondingBlockHeight returns the last unbonding block height
func (Keeper) GetLatestSignerSetTx ¶
func (k Keeper) GetLatestSignerSetTx(ctx sdk.Context) *types.SignerSetTx
GetLatestSignerSetTx returns the latest validator set in state
func (Keeper) GetLatestSignerSetTxNonce ¶
GetLatestSignerSetTxNonce returns the latest valset nonce
func (Keeper) GetOrchestratorValidatorAddress ¶
func (k Keeper) GetOrchestratorValidatorAddress(ctx sdk.Context, orchAddr sdk.AccAddress) sdk.ValAddress
GetOrchestratorValidatorAddress returns the validator key associated with an orchestrator key.
func (Keeper) GetOutgoingTx ¶
GetOutgoingTx todo: outgoingTx prefix byte
func (Keeper) GetSignerSetTxs ¶
func (k Keeper) GetSignerSetTxs(ctx sdk.Context) (out []*types.SignerSetTx)
GetSignerSetTxs returns all the signer set txs from the store
func (Keeper) GetUnbondingValidatorSlashingInfos ¶
func (k Keeper) GetUnbondingValidatorSlashingInfos(ctx sdk.Context) ([]stakingtypes.Validator, []ValidatorSlashingInfo)
GetUnbondingValidatorSlashingInfos returns the information needed for slashing for each unbonding validator
func (Keeper) GetUnsignedBatchTxs ¶
GetUnsignedBatchTxs returns all batches for which the specified validator has not submitted confirmations in ascending nonce order
func (Keeper) GetUnsignedContractCallTxs ¶
func (k Keeper) GetUnsignedContractCallTxs(ctx sdk.Context, val sdk.ValAddress) []*types.ContractCallTx
func (Keeper) GetUnsignedSignerSetTxs ¶
func (k Keeper) GetUnsignedSignerSetTxs(ctx sdk.Context, val sdk.ValAddress) []*types.SignerSetTx
func (Keeper) GetUnslashedOutgoingTxs ¶
func (Keeper) GetValidatorEthereumAddress ¶
GetValidatorEthereumAddress returns the eth address for a given gravity validator.
func (Keeper) GetValidatorSlashingInfo ¶
func (k Keeper) GetValidatorSlashingInfo(ctx sdk.Context, validator stakingtypes.Validator) ValidatorSlashingInfo
GetValidatorInfo returns the consensus key address, signing info, and whether or not the validator exists, for the purposes of slashing/jailing
func (Keeper) HandleCommunityPoolEthereumSpendProposal ¶
func (Keeper) IterateBatchTxEthereumSignatures ¶
func (Keeper) IterateCompletedOutgoingTxs ¶
func (k Keeper) IterateCompletedOutgoingTxs(ctx sdk.Context, cb func(key []byte, outgoing types.OutgoingTx) bool)
IterateOutgoingTxs iterates over a specific type of outgoing transaction denoted by the chosen prefix byte
func (Keeper) IterateCompletedOutgoingTxsByType ¶
func (k Keeper) IterateCompletedOutgoingTxsByType(ctx sdk.Context, prefixByte byte, cb func(key []byte, outgoing types.OutgoingTx) (stop bool))
IterateCompletedOutgoingTxsByType iterates over a specific type of completed outgoing transaction denoted by the chosen prefix byte
func (Keeper) IterateContractCallTxEthereumSignatures ¶
func (Keeper) IterateEthereumEventVoteRecords ¶
func (k Keeper) IterateEthereumEventVoteRecords(ctx sdk.Context, cb func([]byte, *types.EthereumEventVoteRecord) bool)
iterateEthereumEventVoteRecords iterates through all attestations
func (Keeper) IterateEthereumHeightVotes ¶
func (k Keeper) IterateEthereumHeightVotes(ctx sdk.Context, cb func(val sdk.ValAddress, height types.LatestEthereumBlockHeight) (stop bool))
func (Keeper) IterateOutgoingTxsByType ¶
func (k Keeper) IterateOutgoingTxsByType(ctx sdk.Context, prefixByte byte, cb func(key []byte, outgoing types.OutgoingTx) (stop bool))
IterateOutgoingTxsByType iterates over a specific type of outgoing transaction denoted by the chosen prefix byte
func (Keeper) IterateSignerSetTxEthereumSignatures ¶
func (Keeper) IterateUnbatchedSendToEthereums ¶
func (Keeper) LastObservedEthereumHeight ¶
func (k Keeper) LastObservedEthereumHeight(c context.Context, req *types.LastObservedEthereumHeightRequest) (*types.LastObservedEthereumHeightResponse, error)
func (Keeper) LastSubmittedEthereumEvent ¶
func (k Keeper) LastSubmittedEthereumEvent(c context.Context, req *types.LastSubmittedEthereumEventRequest) (*types.LastSubmittedEthereumEventResponse, error)
func (Keeper) LatestSignerSetTx ¶
func (k Keeper) LatestSignerSetTx(c context.Context, req *types.LatestSignerSetTxRequest) (*types.SignerSetTxResponse, error)
func (Keeper) MigrateGravityContract ¶
func (k Keeper) MigrateGravityContract(ctx sdk.Context, newBridgeAddress string, bridgeDeploymentHeight uint64)
Clean up all state associated a previous gravity contract and set a new contract. This is intended to run in the upgrade handler. This implementation is partial at best. It doees not contain necessary functionality to freeze the bridge. We will have yet to implement functionality to Migrate the Cosmos ERC20 tokens or any other ERC20 tokens bridged to the gravity contracts. This just does keeper state cleanup if a new gravity contract has been deployed
func (Keeper) PaginateEthereumEventVoteRecords ¶
func (k Keeper) PaginateEthereumEventVoteRecords(ctx sdk.Context, pageReq *query.PageRequest, cb func(key []byte, record *types.EthereumEventVoteRecord) bool) (*query.PageResponse, error)
func (Keeper) PaginateOutgoingTxsByType ¶
func (k Keeper) PaginateOutgoingTxsByType(ctx sdk.Context, pageReq *query.PageRequest, prefixByte byte, cb func(key []byte, outgoing types.OutgoingTx) bool) (*query.PageResponse, error)
func (Keeper) Params ¶
func (k Keeper) Params(c context.Context, req *types.ParamsRequest) (*types.ParamsResponse, error)
func (Keeper) SetCompletedOutgoingTx ¶
func (k Keeper) SetCompletedOutgoingTx(ctx sdk.Context, outgoing types.OutgoingTx)
SetCompletedOutgoingTx sets a completed outgoing tx
func (Keeper) SetEthereumHeightVote ¶
func (k Keeper) SetEthereumHeightVote(ctx sdk.Context, valAddress sdk.ValAddress, ethereumHeight uint64)
SetEthereumHeightVoteRecord sets the latest observed heights per validator
func (Keeper) SetEthereumSignature ¶
func (k Keeper) SetEthereumSignature(ctx sdk.Context, sig types.EthereumTxConfirmation, val sdk.ValAddress) []byte
SetEthereumSignature sets an ethereum signature
func (Keeper) SetLastObservedEthereumBlockHeight ¶
SetLastObservedEthereumBlockHeight sets the block height in the store.
func (Keeper) SetLastObservedEthereumBlockHeightWithCosmos ¶
func (k Keeper) SetLastObservedEthereumBlockHeightWithCosmos(ctx sdk.Context, ethereumHeight uint64, cosmosHeight uint64)
SetLastObservedEthereumBlockHeight sets the block height in the store, specifying the cosmos height
func (Keeper) SetLastSlashedOutgoingTxBlockHeight ¶
SetLastSlashedOutgoingTxBlockHeight sets the latest slashed Batch block height
func (Keeper) SetOrchestratorValidatorAddress ¶
func (k Keeper) SetOrchestratorValidatorAddress(ctx sdk.Context, val sdk.ValAddress, orchAddr sdk.AccAddress)
SetOrchestratorValidatorAddress sets the Orchestrator key for a given validator.
func (Keeper) SetOutgoingTx ¶
func (k Keeper) SetOutgoingTx(ctx sdk.Context, outgoing types.OutgoingTx)
func (Keeper) SignerSetExecuted ¶
TODO here we should check the contents of the validator set against the store, if they differ we should take some action to indicate to the user that bridge highjacking has occurred
func (Keeper) SignerSetTx ¶
func (k Keeper) SignerSetTx(c context.Context, req *types.SignerSetTxRequest) (*types.SignerSetTxResponse, error)
func (Keeper) SignerSetTxConfirmations ¶
func (k Keeper) SignerSetTxConfirmations(c context.Context, req *types.SignerSetTxConfirmationsRequest) (*types.SignerSetTxConfirmationsResponse, error)
func (Keeper) SignerSetTxConfirmationsByValidator ¶
func (k Keeper) SignerSetTxConfirmationsByValidator(c context.Context, req *types.SignerSetTxConfirmationsByValidatorRequest) (*types.SignerSetTxConfirmationsByValidatorResponse, error)
func (Keeper) SignerSetTxs ¶
func (k Keeper) SignerSetTxs(c context.Context, req *types.SignerSetTxsRequest) (*types.SignerSetTxsResponse, error)
func (Keeper) SlashAndJail ¶
SlashAndJail slashes the validator and sets the validator to jailed if they are not already jailed
func (Keeper) TryEventVoteRecord ¶
func (k Keeper) TryEventVoteRecord(ctx sdk.Context, eventVoteRecord *types.EthereumEventVoteRecord)
TryEventVoteRecord checks if an event vote record has enough votes to be applied to the consensus state and has not already been marked Observed, then calls processEthereumEvent to actually apply it to the state, and then marks it Observed and emits an event.
func (Keeper) UnbatchedSendToEthereums ¶
func (k Keeper) UnbatchedSendToEthereums(c context.Context, req *types.UnbatchedSendToEthereumsRequest) (*types.UnbatchedSendToEthereumsResponse, error)
func (Keeper) UnsignedBatchTxs ¶
func (k Keeper) UnsignedBatchTxs(c context.Context, req *types.UnsignedBatchTxsRequest) (*types.UnsignedBatchTxsResponse, error)
UnsignedBatchTxs returns all batch txs that have not been signed by the given validator
func (Keeper) UnsignedContractCallTxs ¶
func (k Keeper) UnsignedContractCallTxs(c context.Context, req *types.UnsignedContractCallTxsRequest) (*types.UnsignedContractCallTxsResponse, error)
UnsignedContractCallTxs returns all contract call txs that have not been signed by the given validator
func (Keeper) UnsignedSignerSetTxs ¶
func (k Keeper) UnsignedSignerSetTxs(c context.Context, req *types.UnsignedSignerSetTxsRequest) (*types.UnsignedSignerSetTxsResponse, error)
UnsignedSignerSetTxs returns all signer set txs that have not been signed by the given validator
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator is a struct for handling in-place store migrations.
func (Migrator) Migrate1to2 ¶
Migrate1to2 migrates from consensus version 1 to 2.
func (Migrator) Migrate2to3 ¶
Migrate2to3 migrates from consensus version 2 to 3.
type MockStakingValidatorData ¶
type MockStakingValidatorData struct { Operator sdk.ValAddress Power int64 }
MockStakingValidatorData creates mock validator data
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 gravity
func (*StakingKeeperMock) GetLastTotalPower ¶
func (s *StakingKeeperMock) GetLastTotalPower(ctx sdk.Context) (power sdkmath.Int)
GetLastTotalPower implements the interface for staking keeper required by gravity
func (*StakingKeeperMock) GetLastValidatorPower ¶
func (s *StakingKeeperMock) GetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress) int64
GetLastValidatorPower implements the interface for staking keeper required by gravity
func (*StakingKeeperMock) GetParams ¶
func (s *StakingKeeperMock) GetParams(ctx sdk.Context) stakingtypes.Params
func (*StakingKeeperMock) GetValidator ¶
func (s *StakingKeeperMock) GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool)
func (*StakingKeeperMock) IterateBondedValidatorsByPower ¶
func (s *StakingKeeperMock) IterateBondedValidatorsByPower(ctx sdk.Context, cb func(index int64, validator stakingtypes.ValidatorI) (stop bool))
IterateBondedValidatorsByPower staisfies the interface
func (*StakingKeeperMock) IterateLastValidators ¶
func (s *StakingKeeperMock) IterateLastValidators(ctx sdk.Context, cb func(index int64, validator stakingtypes.ValidatorI) (stop bool))
IterateLastValidators staisfies the interface
func (*StakingKeeperMock) IterateValidators ¶
func (s *StakingKeeperMock) IterateValidators(ctx sdk.Context, cb func(index int64, validator stakingtypes.ValidatorI) (stop bool))
IterateValidators staisfies the interface
func (*StakingKeeperMock) Jail ¶
func (s *StakingKeeperMock) Jail(sdk.Context, sdk.ConsAddress)
Jail staisfies the interface
func (*StakingKeeperMock) Validator ¶
func (s *StakingKeeperMock) Validator(ctx sdk.Context, addr sdk.ValAddress) stakingtypes.ValidatorI
Validator staisfies the interface
func (*StakingKeeperMock) ValidatorByConsAddr ¶
func (s *StakingKeeperMock) ValidatorByConsAddr(ctx sdk.Context, addr sdk.ConsAddress) stakingtypes.ValidatorI
ValidatorByConsAddr staisfies the interface
func (*StakingKeeperMock) ValidatorQueueIterator ¶
type TestInput ¶
type TestInput struct { GravityKeeper Keeper AccountKeeper authkeeper.AccountKeeper StakingKeeper stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper DistKeeper distrkeeper.Keeper BankKeeper bankkeeper.BaseKeeper GovKeeper govkeeper.Keeper Context sdk.Context Marshaler codec.Codec LegacyAmino *codec.LegacyAmino GravityStoreKey *storetypes.KVStoreKey }
TestInput stores the various keepers required to test gravity
func CreateTestEnv ¶
CreateTestEnv creates the keeper testing environment for gravity
func SetupFiveValChain ¶
SetupFiveValChain does all the initialization for a 5 Validator chain using the keys here
func (TestInput) AddBalanceToBank ¶
func (TestInput) AddSendToEthTxsToPool ¶
func (input TestInput) AddSendToEthTxsToPool(t *testing.T, ctx sdk.Context, tokenContract gethcommon.Address, sender sdk.AccAddress, receiver gethcommon.Address, ids ...uint64)
type ValidatorSlashingInfo ¶
type ValidatorSlashingInfo struct { Validator stakingtypes.Validator Exists bool SigningInfo slashingtypes.ValidatorSigningInfo ConsAddress sdk.ConsAddress }