Documentation ¶
Index ¶
- Constants
- Variables
- func AllInvariants(k Keeper) sdk.Invariant
- func ExportGenesis(ctx sdk.Context, k Keeper) types.GenesisState
- func InitGenesis(ctx sdk.Context, k Keeper, data types.GenesisState)
- func MakeTestCodec() *codec.LegacyAmino
- func MakeTestEncodingConfig() gravityparams.EncodingConfig
- func MakeTestMarshaler() codec.Codec
- func MintVouchersFromAir(t *testing.T, ctx sdk.Context, k Keeper, dest sdk.AccAddress, ...) sdk.Coin
- func ModuleBalanceInvariant(k Keeper) sdk.Invariant
- func NewGravityProposalHandler(k Keeper) govtypes.Handler
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQuerier(keeper Keeper) sdk.Querier
- func NewTestMsgCreateValidator(address sdk.ValAddress, pubKey ccrypto.PubKey, amt sdk.Int) *stakingtypes.MsgCreateValidator
- func NewTestMsgUnDelegateValidator(address sdk.ValAddress, amt sdk.Int) *stakingtypes.MsgUndelegate
- func RegisterProposalTypes()
- type AttestationHandler
- type Hooks
- func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
- func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress)
- func (h Hooks) AfterValidatorBonded(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress)
- func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)
- func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress)
- func (h Hooks) BeforeDelegationCreated(_ sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
- func (h Hooks) BeforeDelegationRemoved(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress)
- func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
- func (h Hooks) BeforeValidatorModified(_ sdk.Context, _ sdk.ValAddress)
- func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec)
- type Keeper
- func (k Keeper) AddToOutgoingPool(ctx sdk.Context, sender sdk.AccAddress, counterpartReceiver types.EthAddress, ...) (uint64, error)
- func (k Keeper) Attest(ctx sdk.Context, claim types.EthereumClaim, anyClaim *codectypes.Any) (*types.Attestation, error)
- func (k Keeper) BatchConfirms(c context.Context, req *types.QueryBatchConfirmsRequest) (*types.QueryBatchConfirmsResponse, error)
- func (k Keeper) BatchFees(c context.Context, req *types.QueryBatchFeeRequest) (*types.QueryBatchFeeResponse, error)
- func (k Keeper) BatchRequestByNonce(c context.Context, req *types.QueryBatchRequestByNonceRequest) (*types.QueryBatchRequestByNonceResponse, error)
- func (k Keeper) BuildOutgoingTXBatch(ctx sdk.Context, contract types.EthAddress, maxElements uint) (*types.InternalOutgoingTxBatch, error)
- func (k Keeper) CancelOutgoingLogicCall(ctx sdk.Context, invalidationId []byte, invalidationNonce uint64) error
- func (k Keeper) CancelOutgoingTXBatch(ctx sdk.Context, tokenContract types.EthAddress, nonce uint64) error
- func (k Keeper) CheckBadSignatureEvidence(ctx sdk.Context, msg *types.MsgSubmitBadSignatureEvidence) error
- func (k Keeper) CheckLatestValsetNonce(ctx sdk.Context) bool
- func (k Keeper) CurrentValset(c context.Context, req *types.QueryCurrentValsetRequest) (*types.QueryCurrentValsetResponse, error)
- func (k Keeper) DeleteAttestation(ctx sdk.Context, att types.Attestation)
- func (k Keeper) DeleteBatch(ctx sdk.Context, batch types.InternalOutgoingTxBatch)
- func (k Keeper) DeleteBatchConfirms(ctx sdk.Context, batch types.InternalOutgoingTxBatch)
- func (k Keeper) DeleteLogicCallConfirm(ctx sdk.Context, invalidationID []byte, invalidationNonce uint64, ...)
- func (k Keeper) DeleteOutgoingLogicCall(ctx sdk.Context, invalidationID []byte, invalidationNonce uint64)
- func (k Keeper) DeleteValset(ctx sdk.Context, nonce uint64)
- func (k Keeper) DeleteValsetConfirms(ctx sdk.Context, nonce uint64)
- func (k Keeper) DenomToERC20(c context.Context, req *types.QueryDenomToERC20Request) (*types.QueryDenomToERC20Response, error)
- func (k Keeper) DenomToERC20Lookup(ctx sdk.Context, denom string) (bool, *types.EthAddress, error)
- func (k Keeper) DeserializeValidatorIterator(vals []byte) stakingtypes.ValAddresses
- func (k Keeper) ERC20ToDenom(c context.Context, req *types.QueryERC20ToDenomRequest) (*types.QueryERC20ToDenomResponse, error)
- func (k Keeper) ERC20ToDenomLookup(ctx sdk.Context, tokenContract types.EthAddress) (bool, string)
- func (k Keeper) GetAllBatchFees(ctx sdk.Context, maxElements uint) (batchFees []types.BatchFees)
- func (k Keeper) GetAttestation(ctx sdk.Context, eventNonce uint64, claimHash []byte) *types.Attestation
- func (k Keeper) GetAttestationMapping(ctx sdk.Context) (attestationMapping map[uint64][]types.Attestation, orderedKeys []uint64)
- func (k Keeper) GetAttestations(c context.Context, req *types.QueryAttestationsRequest) (*types.QueryAttestationsResponse, error)
- func (k Keeper) GetBatchConfirm(ctx sdk.Context, nonce uint64, tokenContract types.EthAddress, ...) *types.MsgConfirmBatch
- func (k Keeper) GetBatchConfirmByNonceAndTokenContract(ctx sdk.Context, nonce uint64, tokenContract types.EthAddress) (out []types.MsgConfirmBatch)
- func (k Keeper) GetBatchFeeByTokenType(ctx sdk.Context, tokenContractAddr types.EthAddress, maxElements uint) *types.BatchFees
- func (k Keeper) GetBridgeChainID(ctx sdk.Context) uint64
- func (k Keeper) GetBridgeContractAddress(ctx sdk.Context) *types.EthAddress
- func (k Keeper) GetCosmosOriginatedDenom(ctx sdk.Context, tokenContract types.EthAddress) (string, bool)
- func (k Keeper) GetCosmosOriginatedERC20(ctx sdk.Context, denom string) (*types.EthAddress, bool)
- func (k Keeper) GetCurrentValset(ctx sdk.Context) (types.Valset, error)
- func (k Keeper) GetDelegateKeyByEth(c context.Context, req *types.QueryDelegateKeysByEthAddress) (*types.QueryDelegateKeysByEthAddressResponse, error)
- func (k Keeper) GetDelegateKeyByOrchestrator(c context.Context, req *types.QueryDelegateKeysByOrchestratorAddress) (*types.QueryDelegateKeysByOrchestratorAddressResponse, error)
- func (k Keeper) GetDelegateKeyByValidator(c context.Context, req *types.QueryDelegateKeysByValidatorAddress) (*types.QueryDelegateKeysByValidatorAddressResponse, error)
- func (k Keeper) GetDelegateKeys(ctx sdk.Context) []types.MsgSetOrchestratorAddress
- func (k Keeper) GetEthAddressByValidator(ctx sdk.Context, validator sdk.ValAddress) (ethAddress *types.EthAddress, found bool)
- func (k Keeper) GetGravityID(ctx sdk.Context) string
- func (k Keeper) GetLastEventNonceByValidator(ctx sdk.Context, validator sdk.ValAddress) uint64
- func (k Keeper) GetLastObservedEthBlock(c context.Context, req *types.QueryLastObservedEthBlockRequest) (*types.QueryLastObservedEthBlockResponse, error)
- func (k Keeper) GetLastObservedEthNonce(c context.Context, req *types.QueryLastObservedEthNonceRequest) (*types.QueryLastObservedEthNonceResponse, error)
- func (k Keeper) GetLastObservedEthereumBlockHeight(ctx sdk.Context) types.LastObservedEthereumBlockHeight
- func (k Keeper) GetLastObservedEventNonce(ctx sdk.Context) uint64
- func (k Keeper) GetLastObservedValset(ctx sdk.Context) *types.Valset
- func (k Keeper) GetLastOutgoingBatchByTokenType(ctx sdk.Context, token types.EthAddress) *types.InternalOutgoingTxBatch
- func (k Keeper) GetLastSlashedBatchBlock(ctx sdk.Context) uint64
- func (k Keeper) GetLastSlashedLogicCallBlock(ctx sdk.Context) uint64
- func (k Keeper) GetLastSlashedValsetNonce(ctx sdk.Context) uint64
- func (k Keeper) GetLastUnBondingBlockHeight(ctx sdk.Context) uint64
- func (k Keeper) GetLatestValset(ctx sdk.Context) (out *types.Valset)
- func (k Keeper) GetLatestValsetNonce(ctx sdk.Context) uint64
- func (k Keeper) GetLogicCallConfirm(ctx sdk.Context, invalidationId []byte, invalidationNonce uint64, ...) *types.MsgConfirmLogicCall
- func (k Keeper) GetLogicConfirmByInvalidationIDAndNonce(ctx sdk.Context, invalidationId []byte, invalidationNonce uint64) (out []types.MsgConfirmLogicCall)
- func (k Keeper) GetMostRecentAttestations(ctx sdk.Context, limit uint64) []types.Attestation
- func (k Keeper) GetNextPendingIbcAutoForward(ctx sdk.Context) *types.PendingIbcAutoForward
- func (k Keeper) GetOldLastObservedEthereumBlockHeight(ctx sdk.Context) types.LastObservedEthereumBlockHeight
- func (k Keeper) GetOldLastObservedEventNonce(ctx sdk.Context) uint64
- func (k Keeper) GetOrchestratorValidator(ctx sdk.Context, orch sdk.AccAddress) (validator stakingtypes.Validator, found bool)
- func (k Keeper) GetOrchestratorValidatorAddr(ctx sdk.Context, orch sdk.AccAddress) (validator sdk.ValAddress, found bool)
- func (k Keeper) GetOutgoingLogicCall(ctx sdk.Context, invalidationID []byte, invalidationNonce uint64) *types.OutgoingLogicCall
- func (k Keeper) GetOutgoingLogicCalls(ctx sdk.Context) (out []types.OutgoingLogicCall)
- func (k Keeper) GetOutgoingTXBatch(ctx sdk.Context, tokenContract types.EthAddress, nonce uint64) *types.InternalOutgoingTxBatch
- func (k Keeper) GetOutgoingTxBatches(ctx sdk.Context) (out []types.InternalOutgoingTxBatch)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPastEthSignatureCheckpoint(ctx sdk.Context, checkpoint []byte) (found bool)
- func (k Keeper) GetPendingIbcAutoForwards(c context.Context, req *types.QueryPendingIbcAutoForwards) (*types.QueryPendingIbcAutoForwardsResponse, error)
- func (k Keeper) GetPendingSendToEth(c context.Context, req *types.QueryPendingSendToEth) (*types.QueryPendingSendToEthResponse, error)
- func (k Keeper) GetUnSlashedBatches(ctx sdk.Context, maxHeight uint64) (out []types.InternalOutgoingTxBatch)
- func (k Keeper) GetUnSlashedLogicCalls(ctx sdk.Context, maxHeight uint64) (out []types.OutgoingLogicCall)
- func (k Keeper) GetUnSlashedValsets(ctx sdk.Context, signedValsetsWindow uint64) (out []*types.Valset)
- func (k Keeper) GetUnbatchedTransactions(ctx sdk.Context) []*types.InternalOutgoingTransferTx
- func (k Keeper) GetUnbatchedTransactionsByContract(ctx sdk.Context, contractAddress types.EthAddress) []*types.InternalOutgoingTransferTx
- func (k Keeper) GetUnbatchedTxByFeeAndId(ctx sdk.Context, fee types.InternalERC20Token, txID uint64) (*types.InternalOutgoingTransferTx, error)
- func (k Keeper) GetUnbatchedTxById(ctx sdk.Context, txID uint64) (*types.InternalOutgoingTransferTx, error)
- func (k Keeper) GetValidatorByEthAddress(ctx sdk.Context, ethAddr types.EthAddress) (validator stakingtypes.Validator, found bool)
- func (k Keeper) GetValset(ctx sdk.Context, nonce uint64) *types.Valset
- func (k Keeper) GetValsetConfirm(ctx sdk.Context, nonce uint64, validator sdk.AccAddress) *types.MsgValsetConfirm
- func (k Keeper) GetValsetConfirms(ctx sdk.Context, nonce uint64) (confirms []types.MsgValsetConfirm)
- func (k Keeper) GetValsets(ctx sdk.Context) (out []types.Valset)
- func (k Keeper) HandleAirdropProposal(ctx sdk.Context, p *types.AirdropProposal) error
- func (k Keeper) HandleIBCMetadataProposal(ctx sdk.Context, p *types.IBCMetadataProposal) error
- func (k Keeper) HandleUnhaltBridgeProposal(ctx sdk.Context, p *types.UnhaltBridgeProposal) error
- func (k Keeper) HasLastSlashedBatchBlock(ctx sdk.Context) bool
- func (k Keeper) HasLastSlashedLogicCallBlock(ctx sdk.Context) bool
- func (k Keeper) HasValsetRequest(ctx sdk.Context, nonce uint64) bool
- func (k Keeper) Hooks() Hooks
- func (k Keeper) InvalidSendToEthAddress(ctx sdk.Context, addr types.EthAddress, _erc20Addr types.EthAddress) bool
- func (k Keeper) IsOnBlacklist(ctx sdk.Context, addr types.EthAddress) bool
- func (k Keeper) IterateAttestations(ctx sdk.Context, reverse bool, cb func([]byte, types.Attestation) bool)
- func (k Keeper) IterateBatchConfirmByNonceAndTokenContract(ctx sdk.Context, nonce uint64, tokenContract types.EthAddress, ...)
- func (k Keeper) IterateERC20ToDenom(ctx sdk.Context, cb func([]byte, *types.ERC20ToDenom) bool)
- func (k Keeper) IterateLogicConfirmByInvalidationIDAndNonce(ctx sdk.Context, invalidationID []byte, invalidationNonce uint64, ...)
- func (k Keeper) IterateOldAttestations(ctx sdk.Context, reverse bool, cb func([]byte, types.Attestation) bool)
- func (k Keeper) IterateOutgoingLogicCalls(ctx sdk.Context, cb func([]byte, types.OutgoingLogicCall) bool)
- func (k Keeper) IterateOutgoingTXBatches(ctx sdk.Context, cb func(key []byte, batch types.InternalOutgoingTxBatch) bool)
- func (k Keeper) IterateUnbatchedTransactions(ctx sdk.Context, prefixKey []byte, ...)
- func (k Keeper) IterateUnbatchedTransactionsByContract(ctx sdk.Context, contractAddress types.EthAddress, ...)
- func (k Keeper) IterateValsetBySlashedValsetNonce(ctx sdk.Context, lastSlashedValsetNonce uint64, ...)
- 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) LastPendingLogicCallByAddr(c context.Context, req *types.QueryLastPendingLogicCallByAddrRequest) (*types.QueryLastPendingLogicCallByAddrResponse, error)
- func (k Keeper) LastPendingValsetRequestByAddr(c context.Context, req *types.QueryLastPendingValsetRequestByAddrRequest) (*types.QueryLastPendingValsetRequestByAddrResponse, error)
- func (k Keeper) LastValsetRequests(c context.Context, req *types.QueryLastValsetRequestsRequest) (*types.QueryLastValsetRequestsResponse, error)
- func (k Keeper) LogicConfirms(c context.Context, req *types.QueryLogicConfirmsRequest) (*types.QueryLogicConfirmsResponse, error)
- func (k Keeper) OutgoingLogicCalls(c context.Context, req *types.QueryOutgoingLogicCallsRequest) (*types.QueryOutgoingLogicCallsResponse, error)
- func (k Keeper) OutgoingTxBatchExecuted(ctx sdk.Context, tokenContract types.EthAddress, ...)
- 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) PendingIbcAutoForwards(ctx sdk.Context, limit uint64) []*types.PendingIbcAutoForward
- func (k Keeper) ProcessNextPendingIbcAutoForward(ctx sdk.Context) (stop bool, err error)
- func (k Keeper) ProcessPendingIbcAutoForwards(ctx sdk.Context, forwardsToClear uint64) error
- func (k Keeper) RemoveFromOutgoingPoolAndRefund(ctx sdk.Context, txId uint64, sender sdk.AccAddress) error
- func (k Keeper) RewardToERC20Lookup(ctx sdk.Context, coin sdk.Coin) (*types.EthAddress, sdk.Int)
- func (k Keeper) SendToCommunityPool(ctx sdk.Context, coins sdk.Coins) error
- func (k Keeper) SetAttestation(ctx sdk.Context, eventNonce uint64, claimHash []byte, att *types.Attestation)
- func (k Keeper) SetBatchConfirm(ctx sdk.Context, batch *types.MsgConfirmBatch) []byte
- func (k Keeper) SetEthAddressForValidator(ctx sdk.Context, validator sdk.ValAddress, ethAddr types.EthAddress)
- func (k Keeper) SetGravityID(ctx sdk.Context, v string)
- func (k Keeper) SetLastEventNonceByValidator(ctx sdk.Context, validator sdk.ValAddress, nonce uint64)
- func (k Keeper) SetLastObservedEthereumBlockHeight(ctx sdk.Context, ethereumHeight uint64)
- func (k Keeper) SetLastObservedValset(ctx sdk.Context, valset types.Valset)
- func (k Keeper) SetLastSlashedBatchBlock(ctx sdk.Context, blockHeight uint64)
- func (k Keeper) SetLastSlashedLogicCallBlock(ctx sdk.Context, blockHeight uint64)
- func (k Keeper) SetLastSlashedValsetNonce(ctx sdk.Context, nonce uint64)
- func (k Keeper) SetLastUnBondingBlockHeight(ctx sdk.Context, unbondingBlockHeight uint64)
- func (k Keeper) SetLatestValsetNonce(ctx sdk.Context, nonce uint64)
- func (k Keeper) SetLogicCallConfirm(ctx sdk.Context, msg *types.MsgConfirmLogicCall)
- func (k Keeper) SetOrchestratorValidator(ctx sdk.Context, val sdk.ValAddress, orch sdk.AccAddress)
- func (k Keeper) SetOutgoingLogicCall(ctx sdk.Context, call types.OutgoingLogicCall)
- func (k Keeper) SetParams(ctx sdk.Context, ps types.Params)
- func (k Keeper) SetPastEthSignatureCheckpoint(ctx sdk.Context, checkpoint []byte)
- func (k Keeper) SetValsetConfirm(ctx sdk.Context, valsetConf types.MsgValsetConfirm) []byte
- func (k Keeper) SetValsetRequest(ctx sdk.Context) types.Valset
- func (k Keeper) StoreBatch(ctx sdk.Context, batch types.InternalOutgoingTxBatch)
- func (k Keeper) StoreValset(ctx sdk.Context, valset types.Valset)
- func (k Keeper) TryAttestation(ctx sdk.Context, att *types.Attestation)
- func (k Keeper) UnpackAttestationClaim(att *types.Attestation) (types.EthereumClaim, error)
- func (k Keeper) ValidateMembers()
- func (k Keeper) ValidatePendingIbcAutoForward(ctx sdk.Context, forward types.PendingIbcAutoForward) error
- 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) ValsetRequest(c context.Context, req *types.QueryValsetRequestRequest) (*types.QueryValsetRequestResponse, error)
- type Migrator
- type MultiSigUpdateResponse
- type TestInput
Constants ¶
const ( QueryCurrentValset = "currentValset" QueryGravityID = "gravityID" )
const MERCURY_UPGRADE_HEIGHT uint64 = 1282013
const MaxResults = 100 // todo: impl pagination
const OutgoingTxBatchSize = 100
const QUERY_ATTESTATIONS_LIMIT uint64 = 1000
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()), } // AccPubKeys holds the pub keys for the account keys OrchPubKeys = []ccrypto.PubKey{ OrchPrivKeys[0].PubKey(), OrchPrivKeys[1].PubKey(), OrchPrivKeys[2].PubKey(), OrchPrivKeys[3].PubKey(), OrchPrivKeys[4].PubKey(), } // Orchestrator private keys OrchPrivKeys = []ccrypto.PrivKey{ secp256k1.GenPrivKey(), secp256k1.GenPrivKey(), secp256k1.GenPrivKey(), secp256k1.GenPrivKey(), secp256k1.GenPrivKey(), } // AccAddrs holds the sdk.AccAddresses OrchAddrs = []sdk.AccAddress{ sdk.AccAddress(OrchPubKeys[0].Address()), sdk.AccAddress(OrchPubKeys[1].Address()), sdk.AccAddress(OrchPubKeys[2].Address()), sdk.AccAddress(OrchPubKeys[3].Address()), sdk.AccAddress(OrchPubKeys[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", } // TestingGravityParams is a set of gravity params for testing TestingGravityParams = types.Params{ GravityId: "testgravityid", ContractSourceHash: "62328f7bc12efb28f86111d08c29b39285680a906ea0e524e0209d6f6657b713", BridgeEthereumAddress: "0x8858eeb3dfffa017d4bce9801d340d36cf895ccf", BridgeChainId: 11, SignedValsetsWindow: 10, SignedBatchesWindow: 10, SignedLogicCallsWindow: 10, TargetBatchTimeout: 60001, AverageBlockTime: 5000, AverageEthereumBlockTime: 15000, SlashFractionValset: sdk.NewDecWithPrec(1, 2), SlashFractionBatch: sdk.NewDecWithPrec(1, 2), SlashFractionLogicCall: sdk.Dec{}, UnbondSlashingValsetsWindow: 15, SlashFractionBadEthSignature: sdk.NewDecWithPrec(1, 2), ValsetReward: sdk.Coin{Denom: "", Amount: sdk.ZeroInt()}, BridgeActive: true, } )
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{}, ) )
Functions ¶
func AllInvariants ¶
TODO: Add any future invariants here TODO: (see the sdk docs for more info https://docs.cosmos.network/master/building-modules/invariants.html)
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 MakeTestEncodingConfig ¶
func MakeTestEncodingConfig() gravityparams.EncodingConfig
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.InternalERC20Token) sdk.Coin
MintVouchersFromAir creates new gravity vouchers given erc20tokens
func ModuleBalanceInvariant ¶
ModuleBalanceInvariant checks that the module account's balance is equal to the balance of unbatched transactions and unobserved batches Note that the returned bool should be true if there is an error, e.g. an unexpected module balance
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
func NewTestMsgCreateValidator ¶
func NewTestMsgCreateValidator(address sdk.ValAddress, pubKey ccrypto.PubKey, amt sdk.Int) *stakingtypes.MsgCreateValidator
func NewTestMsgUnDelegateValidator ¶
func NewTestMsgUnDelegateValidator(address sdk.ValAddress, amt sdk.Int) *stakingtypes.MsgUndelegate
func RegisterProposalTypes ¶
func RegisterProposalTypes()
Types ¶
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.EthereumClaim) error
Handle is the entry point for Attestation processing, only attestations with sufficient validator submissions should be processed through this function, solidifying their effect in chain state
func (AttestationHandler) ValidateMembers ¶
func (a AttestationHandler) ValidateMembers()
Check for nil members
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
Wrapper struct
func (Hooks) AfterDelegationModified ¶
func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
func (Hooks) AfterValidatorBeginUnbonding ¶
func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress)
func (Hooks) AfterValidatorBonded ¶
func (h Hooks) AfterValidatorBonded(_ sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress)
func (Hooks) AfterValidatorCreated ¶
func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)
func (Hooks) AfterValidatorRemoved ¶
func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress)
func (Hooks) BeforeDelegationCreated ¶
func (h Hooks) BeforeDelegationCreated(_ sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
func (Hooks) BeforeDelegationRemoved ¶
func (h Hooks) BeforeDelegationRemoved(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress)
func (Hooks) BeforeDelegationSharesModified ¶
func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
func (Hooks) BeforeValidatorModified ¶
func (h Hooks) BeforeValidatorModified(_ sdk.Context, _ sdk.ValAddress)
func (Hooks) BeforeValidatorSlashed ¶
type Keeper ¶
type Keeper struct { StakingKeeper *stakingkeeper.Keeper SlashingKeeper *slashingkeeper.Keeper DistKeeper *distrkeeper.Keeper AttestationHandler interface { Handle(sdk.Context, types.Attestation, types.EthereumClaim) error } // 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( storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, cdc codec.BinaryCodec, bankKeeper *bankkeeper.BaseKeeper, stakingKeeper *stakingkeeper.Keeper, slashingKeeper *slashingkeeper.Keeper, distKeeper *distrkeeper.Keeper, accKeeper *authkeeper.AccountKeeper, ibcTransferKeeper *ibctransferkeeper.Keeper, bech32IbcKeeper *bech32ibckeeper.Keeper, ) Keeper
NewKeeper returns a new instance of the gravity keeper
func (Keeper) AddToOutgoingPool ¶
func (k Keeper) AddToOutgoingPool( ctx sdk.Context, sender sdk.AccAddress, counterpartReceiver types.EthAddress, amount sdk.Coin, fee sdk.Coin, ) (uint64, error)
AddToOutgoingPool creates a transaction and adds it to the pool, returns the id of the unbatched transaction - checks a counterpart denominator 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
func (Keeper) Attest ¶
func (k Keeper) Attest( ctx sdk.Context, claim types.EthereumClaim, anyClaim *codectypes.Any, ) (*types.Attestation, error)
TODO-JT: carefully look at atomicity of this function
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) BatchFees ¶
func (k Keeper) BatchFees( c context.Context, req *types.QueryBatchFeeRequest) (*types.QueryBatchFeeResponse, error)
BatchFees queries the batch fees from unbatched pool
func (Keeper) BatchRequestByNonce ¶
func (k Keeper) BatchRequestByNonce( c context.Context, req *types.QueryBatchRequestByNonceRequest, ) (*types.QueryBatchRequestByNonceResponse, error)
BatchRequestByNonce queries the BatchRequestByNonce of the gravity module.
func (Keeper) BuildOutgoingTXBatch ¶
func (k Keeper) BuildOutgoingTXBatch( ctx sdk.Context, contract types.EthAddress, maxElements uint) (*types.InternalOutgoingTxBatch, error)
BuildOutgoingTXBatch starts the following process chain: - find bridged denominator for given voucher type - determine if 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 without creating a batch - 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) CancelOutgoingLogicCall ¶
func (k Keeper) CancelOutgoingLogicCall(ctx sdk.Context, invalidationId []byte, invalidationNonce uint64) error
CancelOutgoingLogicCalls releases all TX in the batch and deletes the batch
func (Keeper) CancelOutgoingTXBatch ¶
func (k Keeper) CancelOutgoingTXBatch(ctx sdk.Context, tokenContract types.EthAddress, nonce uint64) error
CancelOutgoingTXBatch releases all TX in the batch and deletes the batch
func (Keeper) CheckBadSignatureEvidence ¶
func (Keeper) CheckLatestValsetNonce ¶
CheckLatestValsetNonce returns true if the latest valset nonce is declared in the store and false if it has not been initialized
func (Keeper) CurrentValset ¶
func (k Keeper) CurrentValset( c context.Context, req *types.QueryCurrentValsetRequest) (*types.QueryCurrentValsetResponse, error)
CurrentValset queries the CurrentValset of the gravity module
func (Keeper) DeleteAttestation ¶
func (k Keeper) DeleteAttestation(ctx sdk.Context, att types.Attestation)
DeleteAttestation deletes the given attestation
func (Keeper) DeleteBatch ¶
func (k Keeper) DeleteBatch(ctx sdk.Context, batch types.InternalOutgoingTxBatch)
DeleteBatch deletes an outgoing transaction batch
func (Keeper) DeleteBatchConfirms ¶
func (k Keeper) DeleteBatchConfirms(ctx sdk.Context, batch types.InternalOutgoingTxBatch)
DeleteBatchConfirms deletes confirmations for an outgoing transaction batch
func (Keeper) DeleteLogicCallConfirm ¶
func (k Keeper) DeleteLogicCallConfirm( ctx sdk.Context, invalidationID []byte, invalidationNonce uint64, val sdk.AccAddress)
DeleteLogicCallConfirm deletes a logic confirm from the store
func (Keeper) DeleteOutgoingLogicCall ¶
func (k Keeper) DeleteOutgoingLogicCall(ctx sdk.Context, invalidationID []byte, invalidationNonce uint64)
DeleteOutgoingLogicCall deletes outgoing logic calls
func (Keeper) DeleteValset ¶
DeleteValset deletes the valset at a given nonce from state
func (Keeper) DeleteValsetConfirms ¶
DeleteValsetConfirms deletes the valset confirmations for the valset at a given nonce from state
func (Keeper) DenomToERC20 ¶
func (k Keeper) DenomToERC20( c context.Context, req *types.QueryDenomToERC20Request) (*types.QueryDenomToERC20Response, error)
DenomToERC20 queries the Cosmos Denom that maps to an Ethereum ERC20
func (Keeper) DenomToERC20Lookup ¶
DenomToERC20 returns (bool isCosmosOriginated, EthAddress 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) DeserializeValidatorIterator ¶
func (k Keeper) DeserializeValidatorIterator(vals []byte) stakingtypes.ValAddresses
DeserializeValidatorIterator returns validators from the validator iterator. Adding here in gravity keeper as cdc is not available inside endblocker.
func (Keeper) ERC20ToDenom ¶
func (k Keeper) ERC20ToDenom( c context.Context, req *types.QueryERC20ToDenomRequest) (*types.QueryERC20ToDenomResponse, error)
ERC20ToDenom queries the ERC20 contract that maps to an Ethereum ERC20 if any
func (Keeper) ERC20ToDenomLookup ¶
ERC20ToDenom returns (bool isCosmosOriginated, string denom, err) Using this information, you can see if an ERC20 address representing an asset is native to Cosmos or Ethereum, and get its corresponding denom
func (Keeper) GetAllBatchFees ¶
GetAllBatchFees creates a fee entry for every batch type currently in the store this can be used by relayers to determine what batch types are desireable to request
func (Keeper) GetAttestation ¶
func (k Keeper) GetAttestation(ctx sdk.Context, eventNonce uint64, claimHash []byte) *types.Attestation
GetAttestation return an attestation given a nonce
func (Keeper) GetAttestationMapping ¶
func (k Keeper) GetAttestationMapping(ctx sdk.Context) (attestationMapping map[uint64][]types.Attestation, orderedKeys []uint64)
GetAttestationMapping returns a mapping of eventnonce -> attestations at that nonce it also returns a pre-sorted array of the keys, this assists callers of this function by providing a deterministic iteration order. You should always iterate over ordered keys if you are iterating this map at all.
func (Keeper) GetAttestations ¶
func (k Keeper) GetAttestations( c context.Context, req *types.QueryAttestationsRequest, ) (*types.QueryAttestationsResponse, error)
GetAttestations queries the attestation map
func (Keeper) GetBatchConfirm ¶
func (k Keeper) GetBatchConfirm(ctx sdk.Context, nonce uint64, tokenContract types.EthAddress, validator sdk.AccAddress) *types.MsgConfirmBatch
GetBatchConfirm returns a batch confirmation given its nonce, the token contract, and a validator address
func (Keeper) GetBatchConfirmByNonceAndTokenContract ¶
func (k Keeper) GetBatchConfirmByNonceAndTokenContract(ctx sdk.Context, nonce uint64, tokenContract types.EthAddress) (out []types.MsgConfirmBatch)
GetBatchConfirmByNonceAndTokenContract returns the batch confirms
func (Keeper) GetBatchFeeByTokenType ¶
func (k Keeper) GetBatchFeeByTokenType(ctx sdk.Context, tokenContractAddr types.EthAddress, maxElements uint) *types.BatchFees
GetBatchFeeByTokenType gets the fee the next batch of a given token type would have if created right now. 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 (fees must be increasing)
func (Keeper) GetBridgeChainID ¶
GetBridgeChainID returns the chain id of the ETH chain we are running against
func (Keeper) GetBridgeContractAddress ¶
func (k Keeper) GetBridgeContractAddress(ctx sdk.Context) *types.EthAddress
GetBridgeContractAddress returns the bridge contract address on ETH
func (Keeper) GetCosmosOriginatedDenom ¶
func (Keeper) GetCosmosOriginatedERC20 ¶
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 'gravity power' is computed as Cosmos power for that validator / 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.
'total cosmos power' has an edge case, if a validator has not set their Ethereum key they are not included in the total. If they were control of the bridge could be lost in the following situation.
If we have 100 total power, and 100 total power joins the validator set the new validators hold more than 33% of the bridge power, if we generate and submit a valset and they don't have their eth keys set they can never update the validator set again and the bridge and all its' funds are lost. For this reason we exclude validators with unset eth keys from validator sets
The function is intended to return what the valset would look like if you made one now you should call this function, evaluate if you want to save this new valset, and discard it or save
func (Keeper) GetDelegateKeyByEth ¶
func (k Keeper) GetDelegateKeyByEth( c context.Context, req *types.QueryDelegateKeysByEthAddress) (*types.QueryDelegateKeysByEthAddressResponse, error)
func (Keeper) GetDelegateKeyByOrchestrator ¶
func (k Keeper) GetDelegateKeyByOrchestrator( c context.Context, req *types.QueryDelegateKeysByOrchestratorAddress) (*types.QueryDelegateKeysByOrchestratorAddressResponse, error)
func (Keeper) GetDelegateKeyByValidator ¶
func (k Keeper) GetDelegateKeyByValidator( c context.Context, req *types.QueryDelegateKeysByValidatorAddress) (*types.QueryDelegateKeysByValidatorAddressResponse, error)
func (Keeper) GetDelegateKeys ¶
func (k Keeper) GetDelegateKeys(ctx sdk.Context) []types.MsgSetOrchestratorAddress
GetDelegateKeys iterates both the EthAddress and Orchestrator address indexes to produce a vector of MsgSetOrchestratorAddress entires containing all the delegate keys for state export / import. This may seem at first glance to be excessively complicated, why not combine the EthAddress and Orchestrator address indexes and simply iterate one thing? The answer is that even though we set the Eth and Orchestrator address in the same place we use them differently we always go from Orchestrator address to Validator address and from validator address to Ethereum address we want to keep looking up the validator address for various reasons, so a direct Orchestrator to Ethereum address mapping will mean having to keep two of the same data around just to provide lookups.
For the time being this will serve
func (Keeper) GetEthAddressByValidator ¶
func (k Keeper) GetEthAddressByValidator(ctx sdk.Context, validator sdk.ValAddress) (ethAddress *types.EthAddress, found bool)
GetEthAddressByValidator returns the eth address for a given gravity validator
func (Keeper) GetGravityID ¶
GetGravityID returns the GravityID the GravityID is essentially a salt value for bridge signatures, provided each chain running Gravity has a unique ID it won't be possible to play back signatures from one bridge onto another even if they share a validator set.
The lifecycle of the GravityID is that it is set in the Genesis file read from the live chain for the contract deployment, once a Gravity contract is deployed the GravityID CAN NOT BE CHANGED. Meaning that it can't just be the same as the chain id since the chain id may be changed many times with each successive chain in charge of the same bridge
func (Keeper) GetLastEventNonceByValidator ¶
GetLastEventNonceByValidator returns the latest event nonce for a given validator
func (Keeper) GetLastObservedEthBlock ¶
func (k Keeper) GetLastObservedEthBlock( c context.Context, req *types.QueryLastObservedEthBlockRequest, ) (*types.QueryLastObservedEthBlockResponse, error)
GetLastObservedEthBlock queries the LastObservedEthereumBlockHeight
func (Keeper) GetLastObservedEthNonce ¶
func (k Keeper) GetLastObservedEthNonce( c context.Context, req *types.QueryLastObservedEthNonceRequest, ) (*types.QueryLastObservedEthNonceResponse, error)
GetLastObservedEthNonce queries the LastObservedEventNonce
func (Keeper) GetLastObservedEthereumBlockHeight ¶
func (k Keeper) GetLastObservedEthereumBlockHeight(ctx sdk.Context) types.LastObservedEthereumBlockHeight
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) GetLastObservedValset ¶
GetLastObservedValset retrieves the last observed validator set from the store WARNING: This value is not an up to date validator set on Ethereum, it is a validator set that AT ONE POINT was the one in the Gravity bridge on Ethereum. If you assume that it's up to date you may break the bridge
func (Keeper) GetLastOutgoingBatchByTokenType ¶
func (k Keeper) GetLastOutgoingBatchByTokenType(ctx sdk.Context, token types.EthAddress) *types.InternalOutgoingTxBatch
GetLastOutgoingBatchByTokenType gets the latest outgoing tx batch by token type
func (Keeper) GetLastSlashedBatchBlock ¶
GetLastSlashedBatchBlock returns the latest slashed Batch block
func (Keeper) GetLastSlashedLogicCallBlock ¶
GetLastSlashedLogicCallBlock returns the latest slashed logic call block
func (Keeper) GetLastSlashedValsetNonce ¶
GetLastSlashedValsetNonce returns the latest slashed valset nonce
func (Keeper) GetLastUnBondingBlockHeight ¶
GetLastUnBondingBlockHeight returns the last unbonding block height, returns zero if not set, this is not saved or loaded ing enesis and is reset to zero on chain upgrade
func (Keeper) GetLatestValset ¶
GetLatestValset returns the latest validator set in store. This is different from the CurrrentValset because this one has been saved and is therefore *the* valset for this nonce. GetCurrentValset shows you what could be, if you chose to save it, this function shows you what is the latest valset that was saved.
func (Keeper) GetLatestValsetNonce ¶
GetLatestValsetNonce returns the latest valset nonce
func (Keeper) GetLogicCallConfirm ¶
func (k Keeper) GetLogicCallConfirm(ctx sdk.Context, invalidationId []byte, invalidationNonce uint64, val sdk.AccAddress) *types.MsgConfirmLogicCall
GetLogicCallConfirm gets a logic confirm from the store
func (Keeper) GetLogicConfirmByInvalidationIDAndNonce ¶
func (k Keeper) GetLogicConfirmByInvalidationIDAndNonce(ctx sdk.Context, invalidationId []byte, invalidationNonce uint64) (out []types.MsgConfirmLogicCall)
GetLogicConfirmsByInvalidationIdAndNonce returns the logic call confirms
func (Keeper) GetMostRecentAttestations ¶
GetMostRecentAttestations returns sorted (by nonce) attestations up to a provided limit number of attestations Note: calls GetAttestationMapping in the hopes that there are potentially many attestations which are distributed between few nonces to minimize sorting time
func (Keeper) GetNextPendingIbcAutoForward ¶
func (k Keeper) GetNextPendingIbcAutoForward(ctx sdk.Context) *types.PendingIbcAutoForward
GetNextPendingIbcAutoForward returns the first pending IBC Auto-Forward in the queue
func (Keeper) GetOldLastObservedEthereumBlockHeight ¶
func (k Keeper) GetOldLastObservedEthereumBlockHeight(ctx sdk.Context) types.LastObservedEthereumBlockHeight
func (Keeper) GetOldLastObservedEventNonce ¶
func (Keeper) GetOrchestratorValidator ¶
func (k Keeper) GetOrchestratorValidator(ctx sdk.Context, orch sdk.AccAddress) (validator stakingtypes.Validator, found bool)
GetOrchestratorValidator returns the validator key associated with an orchestrator key
func (Keeper) GetOrchestratorValidatorAddr ¶
func (k Keeper) GetOrchestratorValidatorAddr(ctx sdk.Context, orch sdk.AccAddress) (validator sdk.ValAddress, found bool)
GetOrchestratorValidatorAddr returns the validator address associated with an orchestrator key. Getting a result from this function means that the validator existed at some point and sent a SetOrchestratorAddress message. It does not mean that the validator is in the current validator set, for that use GetOrchestratorValidator. This will hold true as long as we never delete any delegate keys.
func (Keeper) GetOutgoingLogicCall ¶
func (k Keeper) GetOutgoingLogicCall(ctx sdk.Context, invalidationID []byte, invalidationNonce uint64) *types.OutgoingLogicCall
GetOutgoingLogicCall gets an outgoing logic call
func (Keeper) GetOutgoingLogicCalls ¶
func (k Keeper) GetOutgoingLogicCalls(ctx sdk.Context) (out []types.OutgoingLogicCall)
GetOutgoingLogicCalls returns the outgoing logic calls
func (Keeper) GetOutgoingTXBatch ¶
func (k Keeper) GetOutgoingTXBatch(ctx sdk.Context, tokenContract types.EthAddress, nonce uint64) *types.InternalOutgoingTxBatch
GetOutgoingTXBatch loads a batch object. Returns nil when not exists.
func (Keeper) GetOutgoingTxBatches ¶
func (k Keeper) GetOutgoingTxBatches(ctx sdk.Context) (out []types.InternalOutgoingTxBatch)
GetOutgoingTxBatches returns the outgoing tx batches
func (Keeper) GetPastEthSignatureCheckpoint ¶
GetPastEthSignatureCheckpoint tells you whether a given checkpoint has ever existed
func (Keeper) GetPendingIbcAutoForwards ¶
func (k Keeper) GetPendingIbcAutoForwards( c context.Context, req *types.QueryPendingIbcAutoForwards, ) (*types.QueryPendingIbcAutoForwardsResponse, error)
func (Keeper) GetPendingSendToEth ¶
func (k Keeper) GetPendingSendToEth( c context.Context, req *types.QueryPendingSendToEth) (*types.QueryPendingSendToEthResponse, error)
func (Keeper) GetUnSlashedBatches ¶
func (k Keeper) GetUnSlashedBatches(ctx sdk.Context, maxHeight uint64) (out []types.InternalOutgoingTxBatch)
GetUnSlashedBatches returns all the unslashed batches in state
func (Keeper) GetUnSlashedLogicCalls ¶
func (k Keeper) GetUnSlashedLogicCalls(ctx sdk.Context, maxHeight uint64) (out []types.OutgoingLogicCall)
GetUnSlashedLogicCalls returns all the unslashed logic calls in state
func (Keeper) GetUnSlashedValsets ¶
func (k Keeper) GetUnSlashedValsets(ctx sdk.Context, signedValsetsWindow uint64) (out []*types.Valset)
GetUnSlashedValsets returns all the "ready-to-slash" unslashed validator sets in state (valsets at least signedValsetsWindow blocks old)
func (Keeper) GetUnbatchedTransactions ¶
func (k Keeper) GetUnbatchedTransactions(ctx sdk.Context) []*types.InternalOutgoingTransferTx
GetPoolTransactions, grabs all transactions from the tx pool, useful for queries or genesis save/load
func (Keeper) GetUnbatchedTransactionsByContract ¶
func (k Keeper) GetUnbatchedTransactionsByContract(ctx sdk.Context, contractAddress types.EthAddress) []*types.InternalOutgoingTransferTx
GetUnbatchedTransactionsByContract, grabs all unbatched transactions from the tx pool for the given contract unbatched transactions are sorted by fee amount in DESC order
func (Keeper) GetUnbatchedTxByFeeAndId ¶
func (k Keeper) GetUnbatchedTxByFeeAndId(ctx sdk.Context, fee types.InternalERC20Token, txID uint64) (*types.InternalOutgoingTransferTx, error)
GetUnbatchedTxByFeeAndId grabs a tx from the pool given its fee and txID
func (Keeper) GetUnbatchedTxById ¶
func (k Keeper) GetUnbatchedTxById(ctx sdk.Context, txID uint64) (*types.InternalOutgoingTransferTx, error)
GetUnbatchedTxById grabs a tx from the pool given only the txID note that due to the way unbatched txs are indexed, the GetUnbatchedTxByFeeAndId method is much faster
func (Keeper) GetValidatorByEthAddress ¶
func (k Keeper) GetValidatorByEthAddress(ctx sdk.Context, ethAddr types.EthAddress) (validator stakingtypes.Validator, found bool)
GetValidatorByEthAddress returns the validator for a given eth address
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) GetValsetConfirms ¶
func (k Keeper) GetValsetConfirms(ctx sdk.Context, nonce uint64) (confirms []types.MsgValsetConfirm)
GetValsetConfirms returns all validator set confirmations by nonce
func (Keeper) GetValsets ¶
GetValsets returns all the validator sets in state
func (Keeper) HandleAirdropProposal ¶
Allows governance to deploy an airdrop to a provided list of addresses
func (Keeper) HandleIBCMetadataProposal ¶
handles a governance proposal for setting the metadata of an IBC token, this takes the normal metadata struct with one key difference, the base unit must be set as the ibc path string in order for setting the denom metadata to work.
func (Keeper) HandleUnhaltBridgeProposal ¶
In the event the bridge is halted and governance has decided to reset oracle history, we roll back oracle history and reset the parameters
func (Keeper) HasLastSlashedBatchBlock ¶
HasLastSlashedBatchBlock returns true if the last slashed batch block has been set in the store
func (Keeper) HasLastSlashedLogicCallBlock ¶
SetLastSlashedLogicCallBlock returns true if the last slashed logic call block has been set in the store
func (Keeper) HasValsetRequest ¶
HasValsetRequest returns true if a valset defined by a nonce exists
func (Keeper) InvalidSendToEthAddress ¶
func (k Keeper) InvalidSendToEthAddress(ctx sdk.Context, addr types.EthAddress, _erc20Addr types.EthAddress) bool
Returns true if the provided address is invalid to send to Ethereum this could be for one of several reasons. (1) it is invalid in general like the Zero address, (2) it is invalid for a subset of ERC20 addresses or (3) it is on the governance deposit/withdraw blacklist. (2) is not yet implemented Blocking some addresses is technically motivated, if any ERC20 transfers in a batch fail the entire batch becomes impossible to execute.
func (Keeper) IsOnBlacklist ¶
Checks if the provided Ethereum address is on the Governance blacklist
func (Keeper) IterateAttestations ¶
func (k Keeper) IterateAttestations(ctx sdk.Context, reverse bool, cb func([]byte, types.Attestation) bool)
IterateAttestations iterates through all attestations
func (Keeper) IterateBatchConfirmByNonceAndTokenContract ¶
func (k Keeper) IterateBatchConfirmByNonceAndTokenContract(ctx sdk.Context, nonce uint64, tokenContract types.EthAddress, cb func([]byte, types.MsgConfirmBatch) bool)
IterateBatchConfirmByNonceAndTokenContract 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) IterateERC20ToDenom ¶
IterateERC20ToDenom iterates over erc20 to denom relations
func (Keeper) IterateLogicConfirmByInvalidationIDAndNonce ¶
func (k Keeper) IterateLogicConfirmByInvalidationIDAndNonce( ctx sdk.Context, invalidationID []byte, invalidationNonce uint64, cb func([]byte, *types.MsgConfirmLogicCall) bool)
IterateLogicConfirmByInvalidationIDAndNonce iterates over all logic confirms stored by nonce
func (Keeper) IterateOldAttestations ¶
func (k Keeper) IterateOldAttestations(ctx sdk.Context, reverse bool, cb func([]byte, types.Attestation) bool)
This is the pre-Mercury Attestation iterator, which used an old prefix
func (Keeper) IterateOutgoingLogicCalls ¶
func (k Keeper) IterateOutgoingLogicCalls(ctx sdk.Context, cb func([]byte, types.OutgoingLogicCall) bool)
IterateOutgoingLogicCalls iterates over outgoing logic calls
func (Keeper) IterateOutgoingTXBatches ¶
func (k Keeper) IterateOutgoingTXBatches(ctx sdk.Context, cb func(key []byte, batch types.InternalOutgoingTxBatch) bool)
IterateOutgoingTXBatches iterates through all outgoing batches in DESC order.
func (Keeper) IterateUnbatchedTransactions ¶
func (k Keeper) IterateUnbatchedTransactions(ctx sdk.Context, prefixKey []byte, cb func(key []byte, tx *types.InternalOutgoingTransferTx) bool)
IterateUnbatchedTransactions iterates through all unbatched transactions whose keys begin with prefixKey in DESC order
func (Keeper) IterateUnbatchedTransactionsByContract ¶
func (k Keeper) IterateUnbatchedTransactionsByContract(ctx sdk.Context, contractAddress types.EthAddress, cb func(key []byte, tx *types.InternalOutgoingTransferTx) bool)
IterateUnbatchedTransactionsByContract, iterates through unbatched transactions from the tx pool for the given contract unbatched transactions are sorted by fee amount in DESC order
func (Keeper) IterateValsetBySlashedValsetNonce ¶
func (k Keeper) IterateValsetBySlashedValsetNonce(ctx sdk.Context, lastSlashedValsetNonce uint64, cb func([]byte, *types.Valset) bool)
IterateValsetBySlashedValsetNonce iterates through all valset by last slashed valset nonce in ASC order
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 gravity module.
func (Keeper) LastPendingLogicCallByAddr ¶
func (k Keeper) LastPendingLogicCallByAddr( c context.Context, req *types.QueryLastPendingLogicCallByAddrRequest) (*types.QueryLastPendingLogicCallByAddrResponse, error)
func (Keeper) LastPendingValsetRequestByAddr ¶
func (k Keeper) LastPendingValsetRequestByAddr( c context.Context, req *types.QueryLastPendingValsetRequestByAddrRequest) (*types.QueryLastPendingValsetRequestByAddrResponse, error)
LastPendingValsetRequestByAddr queries the LastPendingValsetRequestByAddr of the gravity module
func (Keeper) LastValsetRequests ¶
func (k Keeper) LastValsetRequests( c context.Context, req *types.QueryLastValsetRequestsRequest) (*types.QueryLastValsetRequestsResponse, error)
LastValsetRequests queries the LastValsetRequests of the gravity module
func (Keeper) LogicConfirms ¶
func (k Keeper) LogicConfirms( c context.Context, req *types.QueryLogicConfirmsRequest) (*types.QueryLogicConfirmsResponse, error)
LogicConfirms returns the Logic confirmations by nonce and token contract
func (Keeper) OutgoingLogicCalls ¶
func (k Keeper) OutgoingLogicCalls( c context.Context, req *types.QueryOutgoingLogicCallsRequest) (*types.QueryOutgoingLogicCallsResponse, error)
OutgoingLogicCalls queries the OutgoingLogicCalls of the gravity module
func (Keeper) OutgoingTxBatchExecuted ¶
func (k Keeper) OutgoingTxBatchExecuted(ctx sdk.Context, tokenContract types.EthAddress, claim types.MsgBatchSendToEthClaim)
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, this function panics instead of returning errors because any failure will cause a double spend.
func (Keeper) OutgoingTxBatches ¶
func (k Keeper) OutgoingTxBatches( c context.Context, req *types.QueryOutgoingTxBatchesRequest) (*types.QueryOutgoingTxBatchesResponse, error)
OutgoingTxBatches queries the OutgoingTxBatches of the gravity module
func (Keeper) Params ¶
func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params queries the params of the gravity module
func (Keeper) PendingIbcAutoForwards ¶
func (k Keeper) PendingIbcAutoForwards(ctx sdk.Context, limit uint64) []*types.PendingIbcAutoForward
PendingIbcAutoForwards returns an ordered slice of the queued IBC Auto-Forward sends to IBC-enabled chains
func (Keeper) ProcessNextPendingIbcAutoForward ¶
ProcessNextPendingIbcAutoForward processes and dequeues a single pending IBC Auto-Forward, initially sending the funds to the local gravity-prefixed account and then initiating an ibc transfer to the destination chain e.g. if the SendToCosmos CosmosReceiver was [cosmos1|ADDR|COSMOSCHECKSUM] the gravity-prefixed account will be [gravity1|ADDR|GRAVITYCHECKSUM] instead, the same account will retain control of the funds but they will need to use the gravity chain directly. Return: stop - true if there are no items to process Return: err - nil if successful, non-nil if there was an issue sending funds to the user
func (Keeper) ProcessPendingIbcAutoForwards ¶
ProcessPendingIbcAutoForwards processes and dequeues many pending IBC Auto-Forwards, either sending the funds to their respective destination chains or on error sending the funds to the local gravity-prefixed account See ProcessNextPendingIbcAutoForward for more details
func (Keeper) RemoveFromOutgoingPoolAndRefund ¶
func (k Keeper) RemoveFromOutgoingPoolAndRefund(ctx sdk.Context, txId uint64, sender sdk.AccAddress) error
RemoveFromOutgoingPoolAndRefund - checks that the provided tx actually exists - deletes the unbatched tx from the pool - issues the tokens back to the sender
func (Keeper) RewardToERC20Lookup ¶
RewardToERC20Lookup is a specialized function wrapping DenomToERC20Lookup designed to validate the validator set reward any time we generate a validator set
func (Keeper) SendToCommunityPool ¶
SendToCommunityPool handles incorrect SendToCosmos calls to the community pool, since the calls have already been made on Ethereum there's nothing we can do to reverse them, and we should at least make use of the tokens which would otherwise be lost
func (Keeper) SetAttestation ¶
func (k Keeper) SetAttestation(ctx sdk.Context, eventNonce uint64, claimHash []byte, att *types.Attestation)
SetAttestation sets the attestation in the store
func (Keeper) SetBatchConfirm ¶
SetBatchConfirm sets a batch confirmation by a validator
func (Keeper) SetEthAddressForValidator ¶
func (k Keeper) SetEthAddressForValidator(ctx sdk.Context, validator sdk.ValAddress, ethAddr types.EthAddress)
SetEthAddress sets the ethereum address for a given validator
func (Keeper) SetGravityID ¶
Set GravityID sets the GravityID the GravityID is essentially a salt value for bridge signatures, provided each chain running Gravity has a unique ID it won't be possible to play back signatures from one bridge onto another even if they share a validator set.
The lifecycle of the GravityID is that it is set in the Genesis file read from the live chain for the contract deployment, once a Gravity contract is deployed the GravityID CAN NOT BE CHANGED. Meaning that it can't just be the same as the chain id since the chain id may be changed many times with each successive chain in charge of the same bridge
func (Keeper) SetLastEventNonceByValidator ¶
func (k Keeper) SetLastEventNonceByValidator(ctx sdk.Context, validator sdk.ValAddress, nonce uint64)
setLastEventNonceByValidator sets the latest event nonce for a give validator
func (Keeper) SetLastObservedEthereumBlockHeight ¶
SetLastObservedEthereumBlockHeight sets the block height in the store.
func (Keeper) SetLastObservedValset ¶
SetLastObservedValset updates the last observed validator set in the store
func (Keeper) SetLastSlashedBatchBlock ¶
SetLastSlashedBatchBlock sets the latest slashed Batch block height this is done by block height instead of nonce because batches could have individual nonces for each token type this function will panic if a lower last slashed block is set, this protects against programmer error
func (Keeper) SetLastSlashedLogicCallBlock ¶
SetLastSlashedLogicCallBlock sets the latest slashed logic call block height
func (Keeper) SetLastSlashedValsetNonce ¶
setLastSlashedValsetNonce sets the latest slashed valset nonce
func (Keeper) SetLastUnBondingBlockHeight ¶
SetLastUnBondingBlockHeight sets the last unbonding block height. Note this value is not saved and loaded in genesis and is reset to zero on chain upgrade.
func (Keeper) SetLatestValsetNonce ¶
SetLatestValsetNonce sets the latest valset nonce, since it's expected that this value will only increase it panics on an attempt to decrement
func (Keeper) SetLogicCallConfirm ¶
func (k Keeper) SetLogicCallConfirm(ctx sdk.Context, msg *types.MsgConfirmLogicCall)
SetLogicCallConfirm sets a logic confirm in the store
func (Keeper) SetOrchestratorValidator ¶
func (k Keeper) SetOrchestratorValidator(ctx sdk.Context, val sdk.ValAddress, orch sdk.AccAddress)
SetOrchestratorValidator sets the Orchestrator key for a given validator
func (Keeper) SetOutgoingLogicCall ¶
func (k Keeper) SetOutgoingLogicCall(ctx sdk.Context, call types.OutgoingLogicCall)
SetOutogingLogicCall sets an outgoing logic call, panics if one already exists at this index, since we collect signatures over logic calls no mutation can be valid
func (Keeper) SetPastEthSignatureCheckpoint ¶
SetPastEthSignatureCheckpoint puts the checkpoint of a valset, batch, or logic call into a set in order to prove later that it existed at one point.
func (Keeper) SetValsetConfirm ¶
SetValsetConfirm sets a valset confirmation
func (Keeper) SetValsetRequest ¶
SetValsetRequest returns a new instance of the Gravity BridgeValidatorSet by taking a snapshot of the current set, this validator set is also placed into the store to be signed by validators and submitted to Ethereum. This is the only function to call when you want to create a validator set that is signed by consensus. If you want to peek at the present state of the set and perhaps take action based on that use k.GetCurrentValset i.e. {"nonce": 1, "memebers": [{"eth_addr": "foo", "power": 11223}]}
func (Keeper) StoreBatch ¶
func (k Keeper) StoreBatch(ctx sdk.Context, batch types.InternalOutgoingTxBatch)
StoreBatch stores a transaction batch, it will refuse to overwrite an existing batch and panic instead, once a batch is stored in state signature collection begins so no mutation of a batch in state can ever be valid
func (Keeper) StoreValset ¶
StoreValset is for storing a valiator set at a given height, once this function is called the validator set will be available to the Ethereum Signers (orchestrators) to submit signatures therefore this function will panic if you attempt to overwrite an existing key. Any changes to historical valsets can not possibly be correct, as it would invalidate the signatures. The only valid operation on the same index is store followed by delete when it is time to prune state
func (Keeper) TryAttestation ¶
func (k Keeper) TryAttestation(ctx sdk.Context, att *types.Attestation)
TryAttestation checks if an attestation has enough votes to be applied to the consensus state and has not already been marked Observed, then calls processAttestation to actually apply it to the state, and then marks it Observed and emits an event.
func (Keeper) UnpackAttestationClaim ¶
func (k Keeper) UnpackAttestationClaim(att *types.Attestation) (types.EthereumClaim, error)
func (Keeper) ValidatePendingIbcAutoForward ¶
func (k Keeper) ValidatePendingIbcAutoForward(ctx sdk.Context, forward types.PendingIbcAutoForward) error
ValidatePendingIbcAutoForward performs basic validation, asserts the nonce is not ahead of what gravity is aware of, requires ForeignReceiver's bech32 prefix to be registered and match with IbcChannel, and gravity module must have the funds to meet this forward amount
func (Keeper) ValsetConfirm ¶
func (k Keeper) ValsetConfirm( c context.Context, req *types.QueryValsetConfirmRequest) (*types.QueryValsetConfirmResponse, error)
ValsetConfirm queries the ValsetConfirm of the gravity module
func (Keeper) ValsetConfirmsByNonce ¶
func (k Keeper) ValsetConfirmsByNonce( c context.Context, req *types.QueryValsetConfirmsByNonceRequest) (*types.QueryValsetConfirmsByNonceResponse, error)
ValsetConfirmsByNonce queries the ValsetConfirmsByNonce of the gravity module
func (Keeper) ValsetRequest ¶
func (k Keeper) ValsetRequest( c context.Context, req *types.QueryValsetRequestRequest) (*types.QueryValsetRequestResponse, error)
ValsetRequest queries the ValsetRequest of the gravity module
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator is a struct for handling in-place store migrations.
type MultiSigUpdateResponse ¶
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 IbcTransferKeeper ibctransferkeeper.Keeper Context sdk.Context Marshaler codec.Codec LegacyAmino *codec.LegacyAmino GravityStoreKey *sdk.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 SetupTestChain ¶
func SetupTestChain(t *testing.T, weights []uint64, setDelegateAddresses bool) (TestInput, sdk.Context)
SetupTestChain sets up a test environment with the provided validator voting weights
func (TestInput) AssertInvariants ¶
func (t TestInput) AssertInvariants()
AssertInvariants tests each modules invariants individually, this is easier than dealing with all the init required to get the crisis keeper working properly by running appModuleBasic for every module and allowing them to register their invariants
Source Files ¶
- attestation.go
- attestation_handler.go
- batch.go
- cosmos-originated.go
- evidence.go
- genesis.go
- governance_proposals.go
- grpc_query.go
- hooks.go
- ibc_auto_forward.go
- invariants.go
- keeper.go
- keeper_batch.go
- keeper_delegate_key.go
- keeper_logic_call.go
- keeper_valset.go
- migrations.go
- msg_server.go
- pool.go
- querier.go
- test_common.go