keeper

package
v0.0.0-...-def7031 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const MaxResults = 100 // todo: impl pagination
View Source
const OutgoingTxBatchSize = 100

Variables

This section is empty.

Functions

func ExportGenesis

func ExportGenesis(ctx sdk.Context, k Keeper) types.GenesisState

ExportGenesis exports all the state needed to restart the chain from the current state of the chain

func InitGenesis

func InitGenesis(ctx sdk.Context, k Keeper, data *types.GenesisState)

InitGenesis starts a chain from a genesis state

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the gov MsgServer interface for the provided Keeper.

func NormalizeGenesis

func NormalizeGenesis(data *types.GenesisState)

NormalizeGenesis takes care of formatting in the internal structures, as they're used as values in the keeper eventually, while having raw strings in them.

func PrefixRange

func PrefixRange(prefix []byte) ([]byte, []byte)

PrefixRange turns a prefix into a (start, end) range. The start is the given prefix value and the end is calculated by adding 1 bit to the start value. Nil is not allowed as prefix.

Example: []byte{1, 3, 4} becomes []byte{1, 3, 5}
		 []byte{15, 42, 255, 255} becomes []byte{15, 43, 0, 0}

In case of an overflow the end is set to nil.

Example: []byte{255, 255, 255, 255} becomes nil

MARK finish-batches: this is where some crazy shit happens

Types

type AttestationHandler

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

AttestationHandler processes `observed` Attestations

func NewAttestationHandler

func NewAttestationHandler(bankKeeper types.BankKeeper, keeper Keeper) AttestationHandler

func (AttestationHandler) Handle

func (a AttestationHandler) Handle(ctx sdk.Context, claim types.EthereumClaim) error

Handle is the entry point for Attestation processing.

type Hooks

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

Wrapper struct

func NewHooks

func NewHooks(keeper *Keeper) Hooks

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

func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec)

type Keeper

type Keeper struct {
	SlashingKeeper types.SlashingKeeper
	StakingKeeper  types.StakingKeeper

	AttestationHandler interface {
		Handle(sdk.Context, 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,
	storeKey sdk.StoreKey,
	paramSpace paramtypes.Subspace,
	stakingKeeper types.StakingKeeper,
	bankKeeper types.BankKeeper,
	slashingKeeper types.SlashingKeeper,
) Keeper

NewKeeper returns a new instance of the peggy keeper.

func (*Keeper) AddToOutgoingPool

func (k *Keeper) AddToOutgoingPool(ctx sdk.Context, sender sdk.AccAddress, counterpartReceiver common.Address, amount sdk.Coin, fee sdk.Coin) (uint64, error)

AddToOutgoingPool - 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 via a second index

func (*Keeper) Attest

func (k *Keeper) Attest(ctx sdk.Context, claim types.EthereumClaim, anyClaim *codectypes.Any) (*types.Attestation, error)

func (*Keeper) AutoIncrementID

func (k *Keeper) AutoIncrementID(ctx sdk.Context, idKey []byte) uint64

func (*Keeper) BatchConfirms

BatchConfirms returns the batch confirmations by nonce and token contract

func (*Keeper) BatchFees

BatchFees queries the batch fees from unbatched pool

func (*Keeper) BatchRequestByNonce

BatchRequestByNonce queries the BatchRequestByNonce of the peggy module

func (*Keeper) BuildOutgoingTXBatch

func (k *Keeper) BuildOutgoingTXBatch(ctx sdk.Context, contractAddress common.Address, maxElements int) (*types.OutgoingTxBatch, error)

BuildOutgoingTXBatch starts the following process chain:

  • find bridged denominator for given voucher type
  • determine if a an unexecuted batch is already waiting for this token type, if so confirm the new batch would have a higher total fees. If not exit 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) CancelOutgoingTXBatch

func (k *Keeper) CancelOutgoingTXBatch(ctx sdk.Context, tokenContract common.Address, nonce uint64) error

CancelOutgoingTXBatch releases all TX in the batch and deletes the batch

func (*Keeper) CheckBadSignatureEvidence

func (k *Keeper) CheckBadSignatureEvidence(ctx sdk.Context, msg *types.MsgSubmitBadSignatureEvidence) error

func (*Keeper) CurrentValset

CurrentValset queries the CurrentValset of the peggy module

func (*Keeper) DeleteAttestation

func (k *Keeper) DeleteAttestation(ctx sdk.Context, att *types.Attestation)

DeleteAttestation deletes an attestation given an event nonce and claim

func (*Keeper) DeleteBatch

func (k *Keeper) DeleteBatch(ctx sdk.Context, batch types.OutgoingTxBatch)

DeleteBatch deletes an outgoing transaction batch

func (*Keeper) DeleteValset

func (k *Keeper) DeleteValset(ctx sdk.Context, nonce uint64)

DeleteValset deletes the valset at a given nonce from state

func (*Keeper) DenomToERC20

DenomToERC20 queries the Cosmos Denom that maps to an Ethereum ERC20

func (*Keeper) DenomToERC20Lookup

func (k *Keeper) DenomToERC20Lookup(ctx sdk.Context, denom string) (bool, common.Address, error)

DenomToERC20Lookup returns an ERC20 token contract address and a boolean signaling if the denomination is a Cosmos native asset or not. It will return an error if it cannot parse the denom as a Peggy denom or if it cannot 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

ERC20ToDenom queries the ERC20 contract that maps to an Ethereum ERC20 if any

func (*Keeper) ERC20ToDenomLookup

func (k *Keeper) ERC20ToDenomLookup(ctx sdk.Context, tokenContract common.Address) (bool, string)

ERC20ToDenomLookup attempts to do a reverse lookup for denomination by an ERC20 token contract address and returns the corresponding denomination and a boolean signaling if the asset is a Cosmos native asset or not.

func (*Keeper) GetAllBatchFees

func (k *Keeper) GetAllBatchFees(ctx sdk.Context) (batchFees []*types.BatchFees)

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 desirable 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) (out map[uint64][]*types.Attestation)

GetAttestationMapping returns a mapping of eventnonce -> attestations at that nonce

func (*Keeper) GetBatchConfirm

func (k *Keeper) GetBatchConfirm(ctx sdk.Context, nonce uint64, tokenContract common.Address, 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 common.Address) (out []*types.MsgConfirmBatch)

GetBatchConfirmByNonceAndTokenContract returns the batch confirms

func (*Keeper) GetBatchFeesByTokenType

func (k *Keeper) GetBatchFeesByTokenType(ctx sdk.Context, tokenContractAddr common.Address) *types.BatchFees

GetBatchFeesByTokenType gets the fees the next batch of a given token type would have if created. This info is both presented to relayers for the purpose of determining when to request batches and also used by the batch creation process to decide not to create a new batch

func (*Keeper) GetBridgeChainID

func (k *Keeper) GetBridgeChainID(ctx sdk.Context) uint64

GetBridgeChainID returns the chain id of the ETH chain we are running against

func (*Keeper) GetBridgeContractAddress

func (k *Keeper) GetBridgeContractAddress(ctx sdk.Context) common.Address

GetBridgeContractAddress returns the bridge contract address on ETH

func (*Keeper) GetCosmosOriginatedDenom

func (k *Keeper) GetCosmosOriginatedDenom(ctx sdk.Context, tokenContract common.Address) (string, bool)

func (*Keeper) GetCosmosOriginatedERC20

func (k *Keeper) GetCosmosOriginatedERC20(ctx sdk.Context, denom string) (common.Address, bool)

func (*Keeper) GetCurrentValset

func (k *Keeper) GetCurrentValset(ctx sdk.Context) *types.Valset

GetCurrentValset gets powers from the store and normalizes them into an integer percentage with a resolution of uint32 Max meaning a given validators 'Peggy power' is computed as Cosmos power for that validator / total cosmos power = x / uint32 Max where x is the voting power on the Peggy contract. This allows us to only use integer division which produces a known rounding error from truncation equal to the ratio of the validators Cosmos power / total cosmos power ratio, leaving us at uint32 Max - 1 total voting power. This is an acceptable rounding error since floating point may cause consensus problems if different floating point unit implementations are involved.

'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 where 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

func (*Keeper) GetEthAddressByValidator

func (k *Keeper) GetEthAddressByValidator(ctx sdk.Context, validator sdk.ValAddress) (common.Address, bool)

GetEthAddressByValidator returns the eth address for a given peggy validator

func (*Keeper) GetLastEventByValidator

func (k *Keeper) GetLastEventByValidator(ctx sdk.Context, validator sdk.ValAddress) (lastEvent types.LastClaimEvent)

GetLastEventByValidator returns the latest event for a given validator

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

func (k *Keeper) GetLastObservedEventNonce(ctx sdk.Context) uint64

GetLastObservedEventNonce returns the latest observed event nonce

func (*Keeper) GetLastObservedValset

func (k *Keeper) GetLastObservedValset(ctx sdk.Context) *types.Valset

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 common.Address) *types.OutgoingTxBatch

GetLastOutgoingBatchByTokenType gets the latest outgoing tx batch by token type

func (*Keeper) GetLastOutgoingBatchID

func (k *Keeper) GetLastOutgoingBatchID(ctx sdk.Context) uint64

func (*Keeper) GetLastOutgoingPoolID

func (k *Keeper) GetLastOutgoingPoolID(ctx sdk.Context) uint64

func (*Keeper) GetLastSlashedBatchBlock

func (k *Keeper) GetLastSlashedBatchBlock(ctx sdk.Context) uint64

GetLastSlashedBatchBlock returns the latest slashed Batch block

func (*Keeper) GetLastSlashedValsetNonce

func (k *Keeper) GetLastSlashedValsetNonce(ctx sdk.Context) uint64

GetLastSlashedValsetNonce returns the latest slashed valset nonce

func (*Keeper) GetLastUnbondingBlockHeight

func (k *Keeper) GetLastUnbondingBlockHeight(ctx sdk.Context) uint64

GetLastUnbondingBlockHeight returns the last unbonding block height

func (*Keeper) GetLatestValset

func (k *Keeper) GetLatestValset(ctx sdk.Context) (out *types.Valset)

GetLatestValset returns the latest validator set in state

func (*Keeper) GetLatestValsetNonce

func (k *Keeper) GetLatestValsetNonce(ctx sdk.Context) uint64

GetLatestValsetNonce returns the latest valset nonce

func (*Keeper) GetOrchestratorAddresses

func (k *Keeper) GetOrchestratorAddresses(ctx sdk.Context) []*types.MsgSetOrchestratorAddresses

GetOrchestratorAddresses iterates both the EthAddress and Orchestrator address indexes to produce a vector of MsgSetOrchestratorAddresses entires containing all the delgate 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) GetOrchestratorValidator

func (k *Keeper) GetOrchestratorValidator(ctx sdk.Context, orch sdk.AccAddress) (sdk.ValAddress, bool)

GetOrchestratorValidator returns the validator key associated with an orchestrator key

func (*Keeper) GetOutgoingTXBatch

func (k *Keeper) GetOutgoingTXBatch(ctx sdk.Context, tokenContract common.Address, nonce uint64) *types.OutgoingTxBatch

GetOutgoingTXBatch loads a batch object. Returns nil when not exists.

func (*Keeper) GetOutgoingTxBatches

func (k *Keeper) GetOutgoingTxBatches(ctx sdk.Context) (out []*types.OutgoingTxBatch)

GetOutgoingTxBatches returns the outgoing tx batches

func (*Keeper) GetParams

func (k *Keeper) GetParams(ctx sdk.Context) *types.Params

GetParams returns the parameters from the store

func (*Keeper) GetPastEthSignatureCheckpoint

func (k *Keeper) GetPastEthSignatureCheckpoint(ctx sdk.Context, checkpoint common.Hash) (found bool)

GetPastEthSignatureCheckpoint tells you whether a given checkpoint has ever existed

func (*Keeper) GetPeggyID

func (k *Keeper) GetPeggyID(ctx sdk.Context) string

func (*Keeper) GetPoolTransactions

func (k *Keeper) GetPoolTransactions(ctx sdk.Context) []*types.OutgoingTransferTx

GetPoolTransactions, grabs all transactions from the tx pool, useful for queries or genesis save/load this does not include all transactions in batches, because it iterates using the second index key

func (*Keeper) GetUnslashedBatches

func (k *Keeper) GetUnslashedBatches(ctx sdk.Context, maxHeight uint64) (out []*types.OutgoingTxBatch)

GetUnslashedBatches returns all the unslashed batches in state

func (*Keeper) GetUnslashedValsets

func (k *Keeper) GetUnslashedValsets(ctx sdk.Context, maxHeight uint64) (out []*types.Valset)

GetUnslashedValsets returns all the unslashed validator sets in state

func (*Keeper) GetValidatorByEthAddress

func (k *Keeper) GetValidatorByEthAddress(ctx sdk.Context, ethAddr common.Address) (validator stakingtypes.Validator, found bool)

GetValidatorByEthAddress returns the validator for a given eth address

func (*Keeper) GetValset

func (k *Keeper) GetValset(ctx sdk.Context, nonce uint64) *types.Valset

GetValset returns a valset by nonce

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) (valsetConfirms []*types.MsgValsetConfirm)

GetValsetConfirms returns all validator set confirmations by nonce

func (*Keeper) GetValsets

func (k *Keeper) GetValsets(ctx sdk.Context) (out []*types.Valset)

GetValsets returns all the validator sets in state

func (*Keeper) HasValsetRequest

func (k *Keeper) HasValsetRequest(ctx sdk.Context, nonce uint64) bool

HasValsetRequest returns true if a valset defined by a nonce exists

func (*Keeper) Hooks

func (k *Keeper) Hooks() Hooks

Create new peggy hooks

func (*Keeper) IterateAttestations

func (k *Keeper) IterateAttestations(ctx sdk.Context, cb func(k []byte, v *types.Attestation) (stop bool))

IterateAttestations iterates through all attestations

func (*Keeper) IterateBatchBySlashedBatchBlock

func (k *Keeper) IterateBatchBySlashedBatchBlock(ctx sdk.Context, lastSlashedBatchBlock uint64, maxHeight uint64, cb func([]byte, *types.OutgoingTxBatch) bool)

IterateBatchBySlashedBatchBlock iterates through all Batch by last slashed Batch block in ASC order

func (*Keeper) IterateBatchConfirmByNonceAndTokenContract

func (k *Keeper) IterateBatchConfirmByNonceAndTokenContract(
	ctx sdk.Context,
	nonce uint64,
	tokenContract common.Address,
	cb func(k []byte, v *types.MsgConfirmBatch) (stop bool),
)

IterateBatchConfirmByNonceAndTokenContract iterates through all batch confirmations

func (*Keeper) IterateERC20ToDenom

func (k *Keeper) IterateERC20ToDenom(ctx sdk.Context, cb func(k []byte, v *types.ERC20ToDenom) (stop bool))

IterateERC20ToDenom iterates over erc20 to denom relations

func (*Keeper) IterateOutgoingPoolByFee

func (k *Keeper) IterateOutgoingPoolByFee(ctx sdk.Context, tokenContract common.Address, cb func(uint64, *types.OutgoingTransferTx) bool)

IterateOutgoingPoolByFee itetates over the outgoing pool which is sorted by fee

func (*Keeper) IterateOutgoingTXBatches

func (k *Keeper) IterateOutgoingTXBatches(ctx sdk.Context, cb func(key []byte, batch *types.OutgoingTxBatch) bool)

IterateOutgoingTXBatches iterates through all outgoing batches in DESC order.

func (*Keeper) IterateValsetBySlashedValsetNonce

func (k *Keeper) IterateValsetBySlashedValsetNonce(
	ctx sdk.Context,
	lastSlashedValsetNonce uint64,
	maxHeight uint64,
	cb func(k []byte, v *types.Valset) (stop bool),
)

IterateValsetBySlashedValsetNonce iterates through all valset by last slashed valset nonce in ASC order

func (*Keeper) IterateValsetConfirmByNonce

func (k *Keeper) IterateValsetConfirmByNonce(ctx sdk.Context, nonce uint64, cb func(k []byte, v *types.MsgValsetConfirm) (stop bool))

IterateValsetConfirmByNonce iterates through all valset confirms by validator set nonce in ASC order

func (*Keeper) IterateValsets

func (k *Keeper) IterateValsets(ctx sdk.Context, cb func(key []byte, val *types.Valset) bool)

IterateValsets retruns all valsetRequests

func (*Keeper) LastEventByAddr

LastEventByAddr returns the last event for the given validator address, this allows eth oracles to figure out where they left off

func (*Keeper) LastPendingBatchRequestByAddr

LastPendingBatchRequestByAddr queries the LastPendingBatchRequestByAddr of the peggy module

func (*Keeper) LastPendingValsetRequestByAddr

LastPendingValsetRequestByAddr queries the LastPendingValsetRequestByAddr of the peggy module

func (*Keeper) LastValsetRequests

LastValsetRequests queries the LastValsetRequests of the peggy module

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

func (*Keeper) OutgoingTxBatchExecuted

func (k *Keeper) OutgoingTxBatchExecuted(ctx sdk.Context, tokenContract common.Address, nonce uint64)

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

OutgoingTxBatches queries the OutgoingTxBatches of the peggy module

func (*Keeper) Params

Params queries the params of the peggy module

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 un-batched tx from the pool - issues the tokens back to the sender

func (*Keeper) RewardToERC20Lookup

func (k *Keeper) RewardToERC20Lookup(ctx sdk.Context, coin sdk.Coin) (common.Address, sdk.Int)

RewardToERC20Lookup is a specialized function wrapping DenomToERC20Lookup designed to validate the validator set reward any time we generate a validator set

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

func (k *Keeper) SetBatchConfirm(ctx sdk.Context, batch *types.MsgConfirmBatch) []byte

SetBatchConfirm sets a batch confirmation by a validator

func (*Keeper) SetCosmosOriginatedDenomToERC20

func (k *Keeper) SetCosmosOriginatedDenomToERC20(ctx sdk.Context, denom string, tokenContract common.Address)

func (*Keeper) SetEthAddressForValidator

func (k *Keeper) SetEthAddressForValidator(ctx sdk.Context, validator sdk.ValAddress, ethAddr common.Address)

SetEthAddressForValidator sets the ethereum address for a given validator

func (*Keeper) SetLastObservedEthereumBlockHeight

func (k *Keeper) SetLastObservedEthereumBlockHeight(ctx sdk.Context, ethereumHeight uint64)

SetLastObservedEthereumBlockHeight sets the block height in the store.

func (*Keeper) SetLastObservedValset

func (k *Keeper) SetLastObservedValset(ctx sdk.Context, valset types.Valset)

SetLastObservedValset updates the last observed validator set in the store

func (*Keeper) SetLastOutgoingBatchID

func (k *Keeper) SetLastOutgoingBatchID(ctx sdk.Context, lastOutgoingBatchID uint64)

func (*Keeper) SetLastOutgoingPoolID

func (k *Keeper) SetLastOutgoingPoolID(ctx sdk.Context, lastOutgoingPoolID uint64)

func (*Keeper) SetLastSlashedBatchBlock

func (k *Keeper) SetLastSlashedBatchBlock(ctx sdk.Context, blockHeight uint64)

SetLastSlashedBatchBlock sets the latest slashed Batch block height

func (*Keeper) SetLastSlashedValsetNonce

func (k *Keeper) SetLastSlashedValsetNonce(ctx sdk.Context, nonce uint64)

setLastSlashedValsetNonce sets the latest slashed valset nonce

func (*Keeper) SetLastUnbondingBlockHeight

func (k *Keeper) SetLastUnbondingBlockHeight(ctx sdk.Context, unbondingBlockHeight uint64)

SetLastUnbondingBlockHeight sets the last unbonding block height

func (*Keeper) SetLatestValsetNonce

func (k *Keeper) SetLatestValsetNonce(ctx sdk.Context, nonce uint64)

SetLatestValsetNonce sets the latest valset nonce

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) SetParams

func (k *Keeper) SetParams(ctx sdk.Context, params *types.Params)

SetParams sets the parameters in the store

func (*Keeper) SetPastEthSignatureCheckpoint

func (k *Keeper) SetPastEthSignatureCheckpoint(ctx sdk.Context, checkpoint common.Hash)

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

func (k *Keeper) SetValsetConfirm(ctx sdk.Context, valset *types.MsgValsetConfirm) []byte

SetValsetConfirm sets a valset confirmation

func (*Keeper) SetValsetRequest

func (k *Keeper) SetValsetRequest(ctx sdk.Context) *types.Valset

SetValsetRequest returns a new instance of the Peggy BridgeValidatorSet i.e. {"nonce": 1, "memebers": [{"eth_addr": "foo", "power": 11223}]}

func (*Keeper) StoreBatch

func (k *Keeper) StoreBatch(ctx sdk.Context, batch *types.OutgoingTxBatch)

StoreBatch stores a transaction batch

func (*Keeper) StoreBatchUnsafe

func (k *Keeper) StoreBatchUnsafe(ctx sdk.Context, batch *types.OutgoingTxBatch)

StoreBatchUnsafe stores a transaction batch w/o setting the height

func (*Keeper) StoreValset

func (k *Keeper) StoreValset(ctx sdk.Context, valset *types.Valset)

StoreValset is for storing a valiator set at a given height

func (*Keeper) StoreValsetUnsafe

func (k *Keeper) StoreValsetUnsafe(ctx sdk.Context, valset *types.Valset)

StoreValsetUnsafe is for storing a valiator set at a given height

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(attestation *types.Attestation) (types.EthereumClaim, error)

func (*Keeper) ValsetConfirm

ValsetConfirm queries the ValsetConfirm of the peggy module

func (*Keeper) ValsetConfirmsByNonce

ValsetConfirmsByNonce queries the ValsetConfirmsByNonce of the peggy module

func (*Keeper) ValsetRequest

ValsetRequest queries the ValsetRequest of the peggy module

Jump to

Keyboard shortcuts

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