Documentation ¶
Index ¶
- Constants
- Variables
- func AllInvariants(k Keeper) sdk.Invariant
- func CheckBatches(ctx sdk.Context, k Keeper) error
- func ExportGenesis(ctx context.Context, k Keeper) types.GenesisState
- func InitGenesis(ctx context.Context, k Keeper, data types.GenesisState)
- func MakeTestCodec() *codec.LegacyAmino
- func MakeTestEncodingConfig() chainparams.EncodingConfig
- func MakeTestMarshaler() codec.Codec
- func MintVouchersFromAir(t *testing.T, ctx context.Context, k Keeper, dest sdk.AccAddress, ...) sdk.Coin
- func ModuleBalanceInvariant(k Keeper) sdk.Invariant
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewSkywayProposalHandler(k Keeper) govv1beta1types.Handler
- func NewTestMsgCreateValidator(address sdk.ValAddress, pubKey ccrypto.PubKey, amt math.Int) *stakingtypes.MsgCreateValidator
- func NewTestMsgUnDelegateValidator(address sdk.ValAddress, amt math.Int) *stakingtypes.MsgUndelegate
- func StoreValidityInvariant(k Keeper) sdk.Invariant
- func ValidateStore(ctx sdk.Context, k Keeper) error
- type AttestationHandler
- type Hooks
- func (h Hooks) AfterDelegationModified(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h Hooks) AfterUnbondingInitiated(ctx context.Context, id uint64) error
- func (h Hooks) AfterValidatorBeginUnbonding(ctx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error
- func (h Hooks) AfterValidatorBonded(_ context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error
- func (h Hooks) AfterValidatorCreated(ctx context.Context, valAddr sdk.ValAddress) error
- func (h Hooks) AfterValidatorRemoved(ctx context.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeDelegationCreated(_ context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeDelegationRemoved(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
- func (h Hooks) BeforeDelegationSharesModified(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeValidatorModified(_ context.Context, _ sdk.ValAddress) error
- func (h Hooks) BeforeValidatorSlashed(ctx context.Context, valAddr sdk.ValAddress, fraction math.LegacyDec) error
- type Keeper
- func (k Keeper) AddToOutgoingPool(ctx context.Context, sender sdk.AccAddress, ...) (uint64, error)
- func (k Keeper) AllBridgeTaxes(ctx context.Context) ([]*types.BridgeTax, error)
- func (k Keeper) AllBridgeTransferLimits(ctx context.Context) ([]*types.BridgeTransferLimit, error)
- func (k Keeper) AllLightNodeSaleContracts(ctx context.Context) ([]*types.LightNodeSaleContract, error)
- func (k Keeper) Attest(ctx context.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) BatchRequestByNonce(c context.Context, req *types.QueryBatchRequestByNonceRequest) (*types.QueryBatchRequestByNonceResponse, error)
- func (k Keeper) BridgeTax(ctx context.Context, token string) (*types.BridgeTax, error)
- func (k Keeper) BridgeTransferLimit(ctx context.Context, token string) (*types.BridgeTransferLimit, error)
- func (k Keeper) BridgeTransferUsage(ctx context.Context, token string) (*types.BridgeTransferUsage, error)
- func (k Keeper) BuildOutgoingTXBatch(ctx context.Context, chainReferenceID string, contract types.EthAddress, ...) (*types.InternalOutgoingTxBatch, error)
- func (k Keeper) CancelOutgoingTXBatch(ctx context.Context, tokenContract types.EthAddress, nonce uint64) error
- func (k Keeper) CastAllERC20ToDenoms(ctx context.Context) ([]evmtypes.ERC20Record, error)
- func (k Keeper) CastChainERC20ToDenoms(ctx context.Context, chainReferenceID string) ([]evmtypes.ERC20Record, error)
- func (k Keeper) CheckBadSignatureEvidence(ctx context.Context, msg *types.MsgSubmitBadSignatureEvidence, ...) error
- func (k Keeper) DeleteAttestation(ctx context.Context, chainReferenceID string, att types.Attestation) error
- func (k Keeper) DeleteBatch(ctx context.Context, batch types.InternalOutgoingTxBatch) error
- func (k Keeper) DeleteBatchConfirms(ctx context.Context, batch types.InternalOutgoingTxBatch) error
- func (k Keeper) DenomToERC20(c context.Context, req *types.QueryDenomToERC20Request) (*types.QueryDenomToERC20Response, 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) GetAllDenomToERC20s(ctx context.Context) ([]*types.ERC20ToDenom, error)
- func (k Keeper) GetAllERC20ToDenoms(ctx context.Context) ([]*types.ERC20ToDenom, error)
- func (k Keeper) GetAttestation(ctx context.Context, chainReferenceID string, eventNonce uint64, ...) *types.Attestation
- func (k Keeper) GetAttestationMapping(ctx context.Context, chainReferenceID string) (attestationMapping map[uint64][]types.Attestation, orderedKeys []uint64, ...)
- func (k Keeper) GetAttestations(c context.Context, req *types.QueryAttestationsRequest) (*types.QueryAttestationsResponse, error)
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetBatchConfirm(ctx context.Context, nonce uint64, tokenContract types.EthAddress, ...) (*types.MsgConfirmBatch, error)
- func (k Keeper) GetBatchConfirmByNonceAndTokenContract(ctx context.Context, nonce uint64, tokenContract types.EthAddress) (out []types.MsgConfirmBatch, err error)
- func (k Keeper) GetBridgeTaxes(goCtx context.Context, _ *emptypb.Empty) (*types.QueryBridgeTaxesResponse, error)
- func (k Keeper) GetBridgeTransferLimits(goCtx context.Context, _ *emptypb.Empty) (*types.QueryBridgeTransferLimitsResponse, error)
- func (k Keeper) GetChainsWithTokens(ctx context.Context) []string
- func (k Keeper) GetDenomOfERC20(ctx context.Context, chainReferenceId string, tokenContract types.EthAddress) (string, error)
- func (k Keeper) GetERC20OfDenom(ctx context.Context, chainReferenceId, denom string) (*types.EthAddress, error)
- func (k Keeper) GetErc20ToDenoms(c context.Context, denoms *types.QueryErc20ToDenoms) (*types.QueryErc20ToDenomsResponse, error)
- func (k Keeper) GetEthAddressByValidator(ctx context.Context, validator sdk.ValAddress, chainReferenceId string) (ethAddress *types.EthAddress, found bool, err error)
- func (k Keeper) GetLastObservedEthereumBlockHeight(ctx context.Context, chainReferenceID string) types.LastObservedEthereumBlockHeight
- func (k Keeper) GetLastObservedSkywayNonce(ctx context.Context, chainReferenceID string) (uint64, error)
- func (k Keeper) GetLastOutgoingBatchByTokenType(ctx context.Context, token types.EthAddress) (*types.InternalOutgoingTxBatch, error)
- func (k Keeper) GetLastSkywayNonceByValidator(ctx context.Context, validator sdk.ValAddress, chainReferenceID string) (uint64, error)
- func (k Keeper) GetLastSlashedBatchBlock(ctx context.Context) (uint64, error)
- func (k Keeper) GetLightNodeSaleContracts(goCtx context.Context, _ *emptypb.Empty) (*types.QueryLightNodeSaleContractsResponse, error)
- func (k Keeper) GetMostRecentAttestations(ctx context.Context, chainReferenceID string, limit uint64) ([]types.Attestation, error)
- func (k Keeper) GetOrchestratorValidator(ctx context.Context, orch sdk.AccAddress) (validator stakingtypes.Validator, found bool, err error)
- func (k Keeper) GetOutgoingTXBatch(ctx context.Context, tokenContract types.EthAddress, nonce uint64) (*types.InternalOutgoingTxBatch, error)
- func (k Keeper) GetOutgoingTxBatches(ctx context.Context) (out []types.InternalOutgoingTxBatch, err error)
- func (k Keeper) GetOutgoingTxBatchesByNonce(ctx context.Context) (map[uint64]types.InternalOutgoingTxBatch, error)
- func (k Keeper) GetParams(ctx context.Context) (params types.Params)
- func (k Keeper) GetPastEthSignatureCheckpoint(ctx context.Context, checkpoint []byte) (found bool)
- func (k Keeper) GetPendingSendToRemote(c context.Context, req *types.QueryPendingSendToRemote) (*types.QueryPendingSendToRemoteResponse, error)
- func (k Keeper) GetStore(ctx context.Context, chainReferenceID string) storetypes.KVStore
- func (k Keeper) GetUnSlashedBatches(ctx context.Context, maxHeight uint64) (out []types.InternalOutgoingTxBatch, err error)
- func (k Keeper) GetUnbatchedTransactions(ctx context.Context) ([]*types.InternalOutgoingTransferTx, error)
- func (k Keeper) GetUnbatchedTransactionsByContract(ctx context.Context, contractAddress types.EthAddress) ([]*types.InternalOutgoingTransferTx, error)
- func (k Keeper) GetUnbatchedTxByAmountAndId(ctx context.Context, token types.InternalERC20Token, txID uint64) (*types.InternalOutgoingTransferTx, error)
- func (k Keeper) GetUnbatchedTxById(ctx context.Context, txID uint64) (*types.InternalOutgoingTransferTx, error)
- func (k Keeper) GetValidatorByEthAddress(ctx context.Context, ethAddr types.EthAddress, chainReferenceId string) (validator stakingtypes.Validator, found bool, err error)
- func (k Keeper) HasLastSlashedBatchBlock(ctx context.Context) bool
- func (k Keeper) Hooks() Hooks
- func (k Keeper) InvalidSendToRemoteAddress(ctx context.Context, addr types.EthAddress, _erc20Addr types.EthAddress) bool
- func (k Keeper) IterateAttestations(ctx context.Context, chainReferenceID string, reverse bool, ...) error
- func (k Keeper) IterateBatchConfirmByNonceAndTokenContract(ctx context.Context, nonce uint64, tokenContract types.EthAddress, ...) error
- func (k Keeper) IterateBatchConfirms(ctx context.Context, cb func([]byte, types.MsgConfirmBatch) (stop bool))
- func (k Keeper) IterateClaims(ctx context.Context, chainReferenceID string, reverse bool, ...) error
- func (k Keeper) IterateOutgoingTxBatches(ctx context.Context, ...) error
- func (k Keeper) IteratePastEthSignatureCheckpoints(ctx context.Context, cb func(key []byte, value []byte) (stop bool)) error
- func (k Keeper) IterateUnbatchedTransactions(ctx context.Context, ...) error
- func (k Keeper) IterateUnbatchedTransactionsByContract(ctx context.Context, contractAddress types.EthAddress, ...) error
- func (k Keeper) IterateValidatorLastEventNonces(ctx context.Context, chainReferenceID string, ...) error
- func (k Keeper) LastObservedSkywayBlock(c context.Context, req *types.QueryLastObservedSkywayBlockRequest) (*types.QueryLastObservedSkywayBlockResponse, error)
- func (k Keeper) LastObservedSkywayNonce(c context.Context, req *types.QueryLastObservedSkywayNonceRequest) (*types.QueryLastObservedSkywayNonceResponse, error)
- func (k Keeper) LastObservedSkywayNonceByAddr(c context.Context, req *types.QueryLastObservedSkywayNonceByAddrRequest) (*types.QueryLastObservedSkywayNonceResponse, error)
- func (k Keeper) LastPendingBatchRequestByAddr(c context.Context, req *types.QueryLastPendingBatchRequestByAddrRequest) (*types.QueryLastPendingBatchRequestByAddrResponse, error)
- func (k Keeper) LightNodeSaleContract(ctx context.Context, chain string) (*types.LightNodeSaleContract, error)
- func (k Keeper) Logger(ctx context.Context) log.Logger
- func (k Keeper) OutgoingTxBatchExecuted(ctx context.Context, tokenContract types.EthAddress, ...) error
- func (k Keeper) OutgoingTxBatches(c context.Context, req *types.QueryOutgoingTxBatchesRequest) (*types.QueryOutgoingTxBatchesResponse, error)
- func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) RemoveFromOutgoingPoolAndRefund(ctx context.Context, txId uint64, sender sdk.AccAddress) error
- func (k Keeper) SendToCommunityPool(ctx context.Context, coins sdk.Coins) error
- func (k Keeper) SetAllLighNodeSaleContracts(ctx context.Context, contracts []*types.LightNodeSaleContract) error
- func (k Keeper) SetAttestation(ctx context.Context, chainReferenceID string, eventNonce uint64, ...)
- func (k Keeper) SetBatchConfirm(ctx context.Context, batch *types.MsgConfirmBatch) ([]byte, error)
- func (k Keeper) SetBridgeTax(ctx context.Context, tax *types.BridgeTax) error
- func (k Keeper) SetBridgeTransferLimit(ctx context.Context, limit *types.BridgeTransferLimit) error
- func (k Keeper) SetLastObservedEthereumBlockHeight(ctx context.Context, chainReferenceID string, ethereumHeight uint64) error
- func (k Keeper) SetLastSkywayNonceByValidator(ctx context.Context, validator sdk.ValAddress, chainReferenceID string, ...) error
- func (k Keeper) SetLastSlashedBatchBlock(ctx context.Context, blockHeight uint64) error
- func (k Keeper) SetParams(ctx context.Context, params types.Params)
- func (k Keeper) SetPastEthSignatureCheckpoint(ctx context.Context, checkpoint []byte)
- func (k Keeper) StoreBatch(ctx context.Context, batch types.InternalOutgoingTxBatch) error
- func (k Keeper) TryAttestation(ctx context.Context, att *types.Attestation) error
- func (k Keeper) UnpackAttestationClaim(att *types.Attestation) (types.EthereumClaim, error)
- func (k Keeper) UpdateBridgeTransferUsageWithLimit(ctx context.Context, sender sdk.AccAddress, coin sdk.Coin) error
- type Migrator
- type SkywayStoreGetter
- type TestInput
Constants ¶
const ( MERCURY_UPGRADE_HEIGHT uint64 = 1282013 QUERY_ATTESTATIONS_LIMIT uint64 = 1000 )
const MaxResults = 100
const OutgoingTxBatchSize = 100
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()), } EthPrivKeys = []*ecdsa.PrivateKey{ ethPrivKey1, ethPrivKey2, ethPrivKey3, ethPrivKey4, ethPrivKey5, } // EthAddrs holds etheruem addresses EthAddrs = []gethcommon.Address{ gethcommon.BytesToAddress(crypto.PubkeyToAddress(EthPrivKeys[0].PublicKey).Bytes()), gethcommon.BytesToAddress(crypto.PubkeyToAddress(EthPrivKeys[1].PublicKey).Bytes()), gethcommon.BytesToAddress(crypto.PubkeyToAddress(EthPrivKeys[2].PublicKey).Bytes()), gethcommon.BytesToAddress(crypto.PubkeyToAddress(EthPrivKeys[3].PublicKey).Bytes()), gethcommon.BytesToAddress(crypto.PubkeyToAddress(EthPrivKeys[4].PublicKey).Bytes()), } // 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: testDenom, MinCommissionRate: math.LegacyNewDecWithPrec(5, 2), } // TestingSkywayParams is a set of skyway params for testing TestingSkywayParams = types.Params{} )
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, }, ), params.AppModuleBasic{}, crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, vesting.AppModuleBasic{}, ) )
Functions ¶
func AllInvariants ¶
AllInvariants collects any defined invariants below
func CheckBatches ¶
CheckBatches checks that all batch related data in the store is appropriate Returns an error string and a boolean indicating an error if true, for use in an invariant
func ExportGenesis ¶
func ExportGenesis(ctx context.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 context.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() chainparams.EncodingConfig
func MakeTestMarshaler ¶
MakeTestMarshaler creates a proto codec for use in testing
func MintVouchersFromAir ¶
func MintVouchersFromAir(t *testing.T, ctx context.Context, k Keeper, dest sdk.AccAddress, amount types.InternalERC20Token) sdk.Coin
MintVouchersFromAir creates new skyway 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 NewSkywayProposalHandler ¶
func NewSkywayProposalHandler(k Keeper) govv1beta1types.Handler
func NewTestMsgCreateValidator ¶
func NewTestMsgCreateValidator(address sdk.ValAddress, pubKey ccrypto.PubKey, amt math.Int) *stakingtypes.MsgCreateValidator
func NewTestMsgUnDelegateValidator ¶
func NewTestMsgUnDelegateValidator(address sdk.ValAddress, amt math.Int) *stakingtypes.MsgUndelegate
func StoreValidityInvariant ¶
StoreValidityInvariant checks that the currently stored objects are not corrupted and all pass ValidateBasic checks Note that the returned bool should be true if there is an error, e.g. an unexpected batch was processed
Types ¶
type AttestationHandler ¶
type AttestationHandler struct {
// contains filtered or unexported fields
}
AttestationHandler processes `observed` Attestations
func (AttestationHandler) Handle ¶
func (a AttestationHandler) Handle(ctx context.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 context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
func (Hooks) AfterUnbondingInitiated ¶
func (Hooks) AfterValidatorBeginUnbonding ¶
func (h Hooks) AfterValidatorBeginUnbonding(ctx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error
func (Hooks) AfterValidatorBonded ¶
func (h Hooks) AfterValidatorBonded(_ context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error
func (Hooks) AfterValidatorCreated ¶
func (Hooks) AfterValidatorRemoved ¶
func (h Hooks) AfterValidatorRemoved(ctx context.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) error
func (Hooks) BeforeDelegationCreated ¶
func (h Hooks) BeforeDelegationCreated(_ context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
func (Hooks) BeforeDelegationRemoved ¶
func (h Hooks) BeforeDelegationRemoved(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error
func (Hooks) BeforeDelegationSharesModified ¶
func (h Hooks) BeforeDelegationSharesModified(ctx context.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 DistKeeper distrkeeper.Keeper EVMKeeper types.EVMKeeper AddressCodec address.Codec AttestationHandler interface { Handle(context.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( cdc codec.BinaryCodec, accKeeper types.AccountKeeper, stakingKeeper types.StakingKeeper, bankKeeper types.BankKeeper, slashingKeeper types.SlashingKeeper, distributionKeeper distrkeeper.Keeper, ibcTransferKeeper ibctransferkeeper.Keeper, evmKeeper types.EVMKeeper, consensusKeeper types.ConsensusKeeper, palomaKeeper types.PalomaKeeper, storeGetter keeperutil.StoreGetter, authority string, valAddressCodec address.Codec, ) Keeper
NewKeeper returns a new instance of the skyway keeper
func (Keeper) AddToOutgoingPool ¶
func (k Keeper) AddToOutgoingPool( ctx context.Context, sender sdk.AccAddress, counterpartReceiver types.EthAddress, amount sdk.Coin, chainReferenceID string, ) (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 - persists an OutgoingTx - adds the TX to the `available` TX pool
func (Keeper) AllBridgeTaxes ¶
func (Keeper) AllBridgeTransferLimits ¶
func (Keeper) AllLightNodeSaleContracts ¶ added in v1.15.6
func (Keeper) Attest ¶
func (k Keeper) Attest( ctx context.Context, claim types.EthereumClaim, anyClaim *codectypes.Any, ) (*types.Attestation, error)
func (Keeper) BatchConfirms ¶
func (k Keeper) BatchConfirms( c context.Context, req *types.QueryBatchConfirmsRequest, ) (*types.QueryBatchConfirmsResponse, error)
BatchConfirms returns the batch confirmations by nonce and token contract
func (Keeper) BatchRequestByNonce ¶
func (k Keeper) BatchRequestByNonce( c context.Context, req *types.QueryBatchRequestByNonceRequest, ) (*types.QueryBatchRequestByNonceResponse, error)
BatchRequestByNonce queries the BatchRequestByNonce of the skyway module.
func (Keeper) BridgeTransferLimit ¶
func (Keeper) BridgeTransferUsage ¶
func (Keeper) BuildOutgoingTXBatch ¶
func (k Keeper) BuildOutgoingTXBatch( ctx context.Context, chainReferenceID string, contract types.EthAddress, maxElements uint, ) (*types.InternalOutgoingTxBatch, error)
BuildOutgoingTXBatch starts the following process chain: - find bridged denominator for given voucher type - select available transactions from the outgoing transaction pool sorted by nonce desc - persist an outgoing batch object with an incrementing ID = nonce - emit an event
func (Keeper) CancelOutgoingTXBatch ¶
func (k Keeper) CancelOutgoingTXBatch(ctx context.Context, tokenContract types.EthAddress, nonce uint64) error
CancelOutgoingTXBatch releases all TX in the batch and deletes the batch
func (Keeper) CastAllERC20ToDenoms ¶
func (Keeper) CastChainERC20ToDenoms ¶ added in v1.15.7
func (Keeper) CheckBadSignatureEvidence ¶
func (Keeper) DeleteAttestation ¶
func (k Keeper) DeleteAttestation(ctx context.Context, chainReferenceID string, att types.Attestation) error
DeleteAttestation deletes the given attestation
func (Keeper) DeleteBatch ¶
DeleteBatch deletes an outgoing transaction batch
func (Keeper) DeleteBatchConfirms ¶
DeleteBatchConfirms deletes confirmations for an outgoing transaction batch
func (Keeper) DenomToERC20 ¶
func (k Keeper) DenomToERC20( c context.Context, req *types.QueryDenomToERC20Request, ) (*types.QueryDenomToERC20Response, error)
DenomToERC20 queries the Paloma Denom that maps to an Ethereum ERC20
func (Keeper) DeserializeValidatorIterator ¶
func (k Keeper) DeserializeValidatorIterator(vals []byte) stakingtypes.ValAddresses
DeserializeValidatorIterator returns validators from the validator iterator. Adding here in skyway 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) GetAllDenomToERC20s ¶
func (Keeper) GetAllERC20ToDenoms ¶
func (Keeper) GetAttestation ¶
func (k Keeper) GetAttestation(ctx context.Context, chainReferenceID string, eventNonce uint64, claimHash []byte) *types.Attestation
GetAttestation return an attestation given a nonce
func (Keeper) GetAttestationMapping ¶
func (k Keeper) GetAttestationMapping(ctx context.Context, chainReferenceID string) (attestationMapping map[uint64][]types.Attestation, orderedKeys []uint64, err error)
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) GetAuthority ¶
func (Keeper) GetBatchConfirm ¶
func (k Keeper) GetBatchConfirm(ctx context.Context, nonce uint64, tokenContract types.EthAddress, validator sdk.AccAddress) (*types.MsgConfirmBatch, error)
GetBatchConfirm returns a batch confirmation given its nonce, the token contract, and a validator address
func (Keeper) GetBatchConfirmByNonceAndTokenContract ¶
func (k Keeper) GetBatchConfirmByNonceAndTokenContract(ctx context.Context, nonce uint64, tokenContract types.EthAddress) (out []types.MsgConfirmBatch, err error)
GetBatchConfirmByNonceAndTokenContract returns the batch confirms
func (Keeper) GetBridgeTaxes ¶
func (Keeper) GetBridgeTransferLimits ¶
func (Keeper) GetChainsWithTokens ¶
GetChainsWithTokens returns a set of chain reference IDs for all chains that currently have tokens deployed on.
func (Keeper) GetDenomOfERC20 ¶
func (Keeper) GetERC20OfDenom ¶
func (Keeper) GetErc20ToDenoms ¶
func (k Keeper) GetErc20ToDenoms(c context.Context, denoms *types.QueryErc20ToDenoms) (*types.QueryErc20ToDenomsResponse, error)
func (Keeper) GetEthAddressByValidator ¶
func (k Keeper) GetEthAddressByValidator(ctx context.Context, validator sdk.ValAddress, chainReferenceId string) (ethAddress *types.EthAddress, found bool, err error)
GetEthAddressByValidator returns the eth address for a given skyway validator
func (Keeper) GetLastObservedEthereumBlockHeight ¶
func (k Keeper) GetLastObservedEthereumBlockHeight(ctx context.Context, chainReferenceID string) types.LastObservedEthereumBlockHeight
GetLastObservedEthereumBlockHeight height gets the block height to of the last observed attestation from the store
func (Keeper) GetLastObservedSkywayNonce ¶
func (k Keeper) GetLastObservedSkywayNonce(ctx context.Context, chainReferenceID string) (uint64, error)
GetLastObservedSkywayNonce returns the latest observed event nonce
func (Keeper) GetLastOutgoingBatchByTokenType ¶
func (k Keeper) GetLastOutgoingBatchByTokenType(ctx context.Context, token types.EthAddress) (*types.InternalOutgoingTxBatch, error)
GetLastOutgoingBatchByTokenType gets the latest outgoing tx batch by token type
func (Keeper) GetLastSkywayNonceByValidator ¶
func (k Keeper) GetLastSkywayNonceByValidator(ctx context.Context, validator sdk.ValAddress, chainReferenceID string) (uint64, error)
GetLastSkywayNonceByValidator returns the latest event nonce for a given validator
func (Keeper) GetLastSlashedBatchBlock ¶
GetLastSlashedBatchBlock returns the latest slashed Batch block
func (Keeper) GetLightNodeSaleContracts ¶ added in v1.15.6
func (Keeper) GetMostRecentAttestations ¶
func (k Keeper) GetMostRecentAttestations(ctx context.Context, chainReferenceID string, limit uint64) ([]types.Attestation, error)
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) GetOrchestratorValidator ¶
func (k Keeper) GetOrchestratorValidator(ctx context.Context, orch sdk.AccAddress) (validator stakingtypes.Validator, found bool, err error)
GetOrchestratorValidator returns the validator key associated with an orchestrator key
func (Keeper) GetOutgoingTXBatch ¶
func (k Keeper) GetOutgoingTXBatch(ctx context.Context, tokenContract types.EthAddress, nonce uint64) (*types.InternalOutgoingTxBatch, error)
GetOutgoingTXBatch loads a batch object. Returns nil when not exists.
func (Keeper) GetOutgoingTxBatches ¶
func (k Keeper) GetOutgoingTxBatches(ctx context.Context) (out []types.InternalOutgoingTxBatch, err error)
GetOutgoingTxBatches returns the outgoing tx batches
func (Keeper) GetOutgoingTxBatchesByNonce ¶
func (Keeper) GetPastEthSignatureCheckpoint ¶
GetPastEthSignatureCheckpoint tells you whether a given checkpoint has ever existed
func (Keeper) GetPendingSendToRemote ¶ added in v1.15.5
func (k Keeper) GetPendingSendToRemote( c context.Context, req *types.QueryPendingSendToRemote, ) (*types.QueryPendingSendToRemoteResponse, error)
func (Keeper) GetUnSlashedBatches ¶
func (k Keeper) GetUnSlashedBatches(ctx context.Context, maxHeight uint64) (out []types.InternalOutgoingTxBatch, err error)
GetUnSlashedBatches returns all the unslashed batches in state
func (Keeper) GetUnbatchedTransactions ¶
func (k Keeper) GetUnbatchedTransactions(ctx context.Context) ([]*types.InternalOutgoingTransferTx, error)
GetUnbatchedTransactions grabs all transactions from the tx pool, useful for queries or genesis save/load
func (Keeper) GetUnbatchedTransactionsByContract ¶
func (k Keeper) GetUnbatchedTransactionsByContract(ctx context.Context, contractAddress types.EthAddress) ([]*types.InternalOutgoingTransferTx, error)
GetUnbatchedTransactionsByContract grabs all unbatched transactions from the tx pool for the given contract unbatched transactions are sorted by nonce in DESC order
func (Keeper) GetUnbatchedTxByAmountAndId ¶
func (k Keeper) GetUnbatchedTxByAmountAndId(ctx context.Context, token types.InternalERC20Token, txID uint64) (*types.InternalOutgoingTransferTx, error)
GetUnbatchedTxByAmountAndId grabs a tx from the pool given its txID
func (Keeper) GetUnbatchedTxById ¶
func (k Keeper) GetUnbatchedTxById(ctx context.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 GetUnbatchedTxByAmountAndId method is much faster
func (Keeper) GetValidatorByEthAddress ¶
func (k Keeper) GetValidatorByEthAddress(ctx context.Context, ethAddr types.EthAddress, chainReferenceId string) (validator stakingtypes.Validator, found bool, err error)
GetValidatorByEthAddress returns the validator for a given eth address
func (Keeper) HasLastSlashedBatchBlock ¶
HasLastSlashedBatchBlock returns true if the last slashed batch block has been set in the store
func (Keeper) InvalidSendToRemoteAddress ¶ added in v1.15.5
func (k Keeper) InvalidSendToRemoteAddress(ctx context.Context, addr types.EthAddress, _erc20Addr types.EthAddress) bool
InvalidSendToRemoteAddress 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. (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) IterateAttestations ¶
func (k Keeper) IterateAttestations(ctx context.Context, chainReferenceID string, reverse bool, cb func(key []byte, att types.Attestation) (stop bool)) error
IterateAttestations iterates through all attestations executing a given callback on each discovered attestation If reverse is true, attestations will be returned in descending order by key (aka by event nonce and then claim hash) cb should return true to stop iteration, false to continue
func (Keeper) IterateBatchConfirmByNonceAndTokenContract ¶
func (k Keeper) IterateBatchConfirmByNonceAndTokenContract(ctx context.Context, nonce uint64, tokenContract types.EthAddress, cb func([]byte, types.MsgConfirmBatch) bool) error
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) IterateBatchConfirms ¶
func (k Keeper) IterateBatchConfirms(ctx context.Context, cb func([]byte, types.MsgConfirmBatch) (stop bool))
IterateBatchConfirms iterates through all batch confirmations
func (Keeper) IterateClaims ¶
func (k Keeper) IterateClaims(ctx context.Context, chainReferenceID string, reverse bool, claimType types.ClaimType, cb func(key []byte, att types.Attestation, claim types.EthereumClaim) (stop bool)) error
IterateClaims iterates through all attestations, filtering them for claims of a given type If reverse is true, attestations will be returned in descending order by key (aka by event nonce and then claim hash) cb should return true to stop iteration, false to continue
func (Keeper) IterateOutgoingTxBatches ¶
func (k Keeper) IterateOutgoingTxBatches(ctx context.Context, cb func(key []byte, batch types.InternalOutgoingTxBatch) bool) error
IterateOutgoingTxBatches iterates through all outgoing batches in ASC order.
func (Keeper) IteratePastEthSignatureCheckpoints ¶
func (Keeper) IterateUnbatchedTransactions ¶
func (k Keeper) IterateUnbatchedTransactions(ctx context.Context, cb func(key []byte, tx *types.InternalOutgoingTransferTx) (stop bool)) error
IterateUnbatchedTransactions iterates through all unbatched transactions in DESC order, executing the given callback on each discovered Tx. Return true in cb to stop iteration, false to continue. For finer grained control, use filterAndIterateUnbatchedTransactions or one of the above methods
func (Keeper) IterateUnbatchedTransactionsByContract ¶
func (k Keeper) IterateUnbatchedTransactionsByContract(ctx context.Context, contractAddress types.EthAddress, cb func(key []byte, tx *types.InternalOutgoingTransferTx) bool) error
IterateUnbatchedTransactionsByContract iterates through unbatched transactions from the tx pool for the given contract, executing the given callback on each discovered Tx. Return true in cb to stop iteration, false to continue. unbatched transactions are sorted by nonce in DESC order
func (Keeper) IterateValidatorLastEventNonces ¶
func (k Keeper) IterateValidatorLastEventNonces(ctx context.Context, chainReferenceID string, cb func(key []byte, nonce uint64) (stop bool)) error
IterateValidatorLastEventNonces iterates through all batch confirmations
func (Keeper) LastObservedSkywayBlock ¶
func (k Keeper) LastObservedSkywayBlock( c context.Context, req *types.QueryLastObservedSkywayBlockRequest, ) (*types.QueryLastObservedSkywayBlockResponse, error)
LastObservedSkywayBlock returns the last remote chain block height observed by Paloma.
func (Keeper) LastObservedSkywayNonce ¶
func (k Keeper) LastObservedSkywayNonce( c context.Context, req *types.QueryLastObservedSkywayNonceRequest, ) (*types.QueryLastObservedSkywayNonceResponse, error)
LastObservedSkywayNonce returns the last skyway nonce observed by Paloma.
func (Keeper) LastObservedSkywayNonceByAddr ¶
func (k Keeper) LastObservedSkywayNonceByAddr( c context.Context, req *types.QueryLastObservedSkywayNonceByAddrRequest, ) (*types.QueryLastObservedSkywayNonceResponse, error)
LastObservedSkywayNonceByAddr returns the last skyway nonce for the given validator address, this allows Pigeons 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 skyway module.
func (Keeper) LightNodeSaleContract ¶ added in v1.15.6
func (Keeper) OutgoingTxBatchExecuted ¶
func (k Keeper) OutgoingTxBatchExecuted(ctx context.Context, tokenContract types.EthAddress, claim types.MsgBatchSendToRemoteClaim) error
OutgoingTxBatchExecuted is run when the Cosmos chain detects that a batch has been executed on Ethereum It frees all the transactions in the batch
func (Keeper) OutgoingTxBatches ¶
func (k Keeper) OutgoingTxBatches( c context.Context, req *types.QueryOutgoingTxBatchesRequest, ) (*types.QueryOutgoingTxBatchesResponse, error)
OutgoingTxBatches queries the OutgoingTxBatches of the skyway module
func (Keeper) Params ¶
func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params queries the params of the skyway module
func (Keeper) RemoveFromOutgoingPoolAndRefund ¶
func (k Keeper) RemoveFromOutgoingPoolAndRefund(ctx context.Context, txId uint64, sender sdk.AccAddress) error
RemoveFromOutgoingPoolAndRefund performs the cancel function for pending Sends To Ethereum - checks that the provided tx actually exists - deletes the unbatched tx from the pool - issues the tokens back to the sender
func (Keeper) SendToCommunityPool ¶
SendToCommunityPool handles incorrect SendToPaloma 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) SetAllLighNodeSaleContracts ¶ added in v1.15.6
func (Keeper) SetAttestation ¶
func (k Keeper) SetAttestation(ctx context.Context, chainReferenceID string, 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) SetBridgeTax ¶
func (Keeper) SetBridgeTransferLimit ¶
func (Keeper) SetLastObservedEthereumBlockHeight ¶
func (k Keeper) SetLastObservedEthereumBlockHeight(ctx context.Context, chainReferenceID string, ethereumHeight uint64) error
SetLastObservedEthereumBlockHeight sets the block height in the store.
func (Keeper) SetLastSkywayNonceByValidator ¶
func (k Keeper) SetLastSkywayNonceByValidator(ctx context.Context, validator sdk.ValAddress, chainReferenceID string, nonce uint64) error
SetLastSkywayNonceByValidator sets the latest event nonce for a give validator
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
func (Keeper) SetPastEthSignatureCheckpoint ¶
SetPastEthSignatureCheckpoint puts the checkpoint of a batch into a set in order to prove later that it existed at one point.
func (Keeper) StoreBatch ¶
StoreBatch stores a transaction batch, it will refuse to overwrite an existing batch and errors 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) TryAttestation ¶
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) UpdateBridgeTransferUsageWithLimit ¶
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator is a struct for handling in-place store migrations.
func NewMigrator ¶
NewMigrator returns a new Migrator.
type SkywayStoreGetter ¶
type SkywayStoreGetter struct {
// contains filtered or unexported fields
}
func NewSkywayStoreGetter ¶
func NewSkywayStoreGetter(storeKey storetypes.StoreKey) SkywayStoreGetter
func (SkywayStoreGetter) Store ¶
func (gsg SkywayStoreGetter) Store(ctx context.Context) storetypes.KVStore
type TestInput ¶
type TestInput struct { SkywayKeeper Keeper AccountKeeper authkeeper.AccountKeeper StakingKeeper stakingkeeper.Keeper ValsetKeeper valsetkeeper.Keeper SlashingKeeper slashingkeeper.Keeper DistKeeper distrkeeper.Keeper BankKeeper bankkeeper.BaseKeeper GovKeeper govkeeper.Keeper IbcTransferKeeper ibctransferkeeper.Keeper Context context.Context Marshaler codec.Codec LegacyAmino *codec.LegacyAmino SkywayStoreKey *storetypes.KVStoreKey EvmKeeper evmkeeper.Keeper TreasuryKeeper *treasurykeeper.Keeper MetrixKeeper metrixmodulekeeper.Keeper }
TestInput stores the various keepers required to test skyway
func CreateTestEnv ¶
CreateTestEnv creates the keeper testing environment for skyway
func SetupFiveValChain ¶
SetupFiveValChain does all the initialization for a 5 Validator chain using the keys here
func SetupTestChain ¶
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
- grpc_query_get_bridge_taxes.go
- grpc_query_get_bridge_transfer_limits.go
- grpc_query_get_light_node_sale_contracts.go
- hooks.go
- invariants.go
- keeper.go
- keeper_batch.go
- keeper_delegate_key.go
- migrations.go
- msg_server.go
- pool.go
- test_common.go