Documentation

Index

Constants

View Source
const (

	// used in the relayer
	QueryValsetRequest                  = "valsetRequest"
	QueryValsetConfirmsByNonce          = "valsetConfirms"
	QueryLastValsetRequests             = "lastValsetRequests"
	QueryLastPendingValsetRequestByAddr = "lastPendingValsetRequest"

	// used to deploy eth contract
	QueryCurrentValset = "currentValset"
	QueryValsetConfirm = "valsetConfirm"
	QueryPeggyID       = "peggyID"

	QueryBatch                         = "batch"
	QueryLastPendingBatchRequestByAddr = "lastPendingBatchRequest"
	QueryOutgoingTxBatches             = "lastBatches"
	QueryBatchConfirms                 = "batchConfirms"
)
View Source
const MaxResults = 100 // todo: impl pagination
View Source
const OutgoingTxBatchSize = 100

Variables

View Source
var (
	// ConsPrivKeys generate ed25519 ConsPrivKeys to be used for validator operator keys
	ConsPrivKeys = []ccrypto.PrivKey{
		ed25519.GenPrivKey(),
		ed25519.GenPrivKey(),
		ed25519.GenPrivKey(),
		ed25519.GenPrivKey(),
		ed25519.GenPrivKey(),
	}

	// ConsPubKeys holds the consensus public keys to be used for validator operator keys
	ConsPubKeys = []ccrypto.PubKey{
		ConsPrivKeys[0].PubKey(),
		ConsPrivKeys[1].PubKey(),
		ConsPrivKeys[2].PubKey(),
		ConsPrivKeys[3].PubKey(),
		ConsPrivKeys[4].PubKey(),
	}

	// AccPrivKeys generate secp256k1 pubkeys to be used for account pub keys
	AccPrivKeys = []ccrypto.PrivKey{
		secp256k1.GenPrivKey(),
		secp256k1.GenPrivKey(),
		secp256k1.GenPrivKey(),
		secp256k1.GenPrivKey(),
		secp256k1.GenPrivKey(),
	}

	// AccPubKeys holds the pub keys for the account keys
	AccPubKeys = []ccrypto.PubKey{
		AccPrivKeys[0].PubKey(),
		AccPrivKeys[1].PubKey(),
		AccPrivKeys[2].PubKey(),
		AccPrivKeys[3].PubKey(),
		AccPrivKeys[4].PubKey(),
	}

	// AccAddrs holds the sdk.AccAddresses
	AccAddrs = []sdk.AccAddress{
		sdk.AccAddress(AccPubKeys[0].Address()),
		sdk.AccAddress(AccPubKeys[1].Address()),
		sdk.AccAddress(AccPubKeys[2].Address()),
		sdk.AccAddress(AccPubKeys[3].Address()),
		sdk.AccAddress(AccPubKeys[4].Address()),
	}

	// ValAddrs holds the sdk.ValAddresses
	ValAddrs = []sdk.ValAddress{
		sdk.ValAddress(AccPubKeys[0].Address()),
		sdk.ValAddress(AccPubKeys[1].Address()),
		sdk.ValAddress(AccPubKeys[2].Address()),
		sdk.ValAddress(AccPubKeys[3].Address()),
		sdk.ValAddress(AccPubKeys[4].Address()),
	}

	// EthAddrs holds etheruem addresses
	EthAddrs = []gethcommon.Address{
		gethcommon.BytesToAddress(bytes.Repeat([]byte{byte(1)}, 20)),
		gethcommon.BytesToAddress(bytes.Repeat([]byte{byte(2)}, 20)),
		gethcommon.BytesToAddress(bytes.Repeat([]byte{byte(3)}, 20)),
		gethcommon.BytesToAddress(bytes.Repeat([]byte{byte(4)}, 20)),
		gethcommon.BytesToAddress(bytes.Repeat([]byte{byte(5)}, 20)),
	}

	// TokenContractAddrs holds example token contract addresses
	TokenContractAddrs = []string{
		"0x6b175474e89094c44da98b954eedeac495271d0f",
		"0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e",
		"0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
		"0xc00e94cb662c3520282e6f5717214004a7f26888",
		"0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f",
	}

	// InitTokens holds the number of tokens to initialize an account with
	InitTokens = sdk.TokensFromConsensusPower(110)

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

	// 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",
	}

	// TestingPeggyParams is a set of peggy params for testing
	TestingPeggyParams = types.Params{
		PeggyId:                       "testpeggyid",
		ContractSourceHash:            "62328f7bc12efb28f86111d08c29b39285680a906ea0e524e0209d6f6657b713",
		StartThreshold:                0,
		EthereumAddress:               "0x8858eeb3dfffa017d4bce9801d340d36cf895ccf",
		BridgeChainId:                 11,
		SignedBatchesWindow:           10,
		SignedValsetsWindow:           10,
		SignedClaimsWindow:            10,
		SlashFractionValset:           sdk.NewDecWithPrec(1, 2),
		SlashFractionBatch:            sdk.NewDecWithPrec(1, 2),
		SlashFractionClaim:            sdk.NewDecWithPrec(1, 2),
		SlashFractionConflictingClaim: sdk.NewDecWithPrec(1, 2),
	}
)

Functions

func ExportGenesis

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

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

    func InitGenesis

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

      InitGenesis starts a chain from a genesis state

      func MakeTestCodec

      func MakeTestCodec() *codec.LegacyAmino

        MakeTestCodec creates a legacy amino codec for testing

        func MakeTestMarshaler

        func MakeTestMarshaler() codec.Marshaler

          MakeTestMarshaler creates a proto codec for use in testing

          func MintVouchersFromAir

          func MintVouchersFromAir(t *testing.T, ctx sdk.Context, k Keeper, dest sdk.AccAddress, amount types.ERC20Token) sdk.Coin

            MintVouchersFromAir creates new peggy vouchers given erc20tokens

            func NewMsgServerImpl

            func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

              func NewQuerier

              func NewQuerier(keeper Keeper) sdk.Querier

                NewQuerier is the module level router for state queries

                func NewTestMsgCreateValidator

                func NewTestMsgCreateValidator(address sdk.ValAddress, pubKey ccrypto.PubKey, amt sdk.Int) *stakingtypes.MsgCreateValidator

                Types

                type AlwaysPanicStakingMock

                type AlwaysPanicStakingMock struct{}

                  AlwaysPanicStakingMock is a mock staking keeper that panics on usage

                  func (AlwaysPanicStakingMock) GetBondedValidatorsByPower

                  func (s AlwaysPanicStakingMock) GetBondedValidatorsByPower(ctx sdk.Context) []stakingtypes.Validator

                    GetBondedValidatorsByPower implements the interface for staking keeper required by peggy

                    func (AlwaysPanicStakingMock) GetLastTotalPower

                    func (s AlwaysPanicStakingMock) GetLastTotalPower(ctx sdk.Context) (power sdk.Int)

                      GetLastTotalPower implements the interface for staking keeper required by peggy

                      func (AlwaysPanicStakingMock) GetLastValidatorPower

                      func (s AlwaysPanicStakingMock) GetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress) int64

                        GetLastValidatorPower implements the interface for staking keeper required by peggy

                        func (AlwaysPanicStakingMock) IterateBondedValidatorsByPower

                        func (s AlwaysPanicStakingMock) IterateBondedValidatorsByPower(sdk.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool))

                          IterateBondedValidatorsByPower staisfies the interface

                          func (AlwaysPanicStakingMock) IterateLastValidators

                          func (s AlwaysPanicStakingMock) IterateLastValidators(sdk.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool))

                            IterateLastValidators staisfies the interface

                            func (AlwaysPanicStakingMock) IterateValidators

                            func (s AlwaysPanicStakingMock) IterateValidators(sdk.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool))

                              IterateValidators staisfies the interface

                              func (AlwaysPanicStakingMock) Jail

                                Jail staisfies the interface

                                func (AlwaysPanicStakingMock) Slash

                                  Slash staisfies the interface

                                  func (AlwaysPanicStakingMock) Validator

                                    Validator staisfies the interface

                                    func (AlwaysPanicStakingMock) ValidatorByConsAddr

                                      ValidatorByConsAddr staisfies the interface

                                      type AttestationHandler

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

                                        AttestationHandler processes `observed` Attestations

                                        func (AttestationHandler) Handle

                                          Handle is the entry point for Attestation processing.

                                          type Keeper

                                          type Keeper struct {
                                          	StakingKeeper types.StakingKeeper
                                          
                                          	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(cdc codec.BinaryMarshaler, storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, stakingKeeper types.StakingKeeper, bankKeeper types.BankKeeper, minterKeeper minterkeeper.Keeper, oracleKeeper oraclekeeper.Keeper) Keeper

                                              NewKeeper returns a new instance of the peggy keeper

                                              func (Keeper) AddClaim

                                              func (k Keeper) AddClaim(ctx sdk.Context, details types.EthereumClaim) (*types.Attestation, error)

                                                AddClaim starts the following process chain: - Records that a given validator has made a claim about a given ethereum event, checking that the event nonce is contiguous

                                                (non contiguous eventNonces indicate out of order events which can cause double spends)
                                                

                                                - Either creates a new attestation or adds the validator's vote to the existing attestation for this event - Checks if the attestation has enough votes to be considered "Observed", then attempts to apply it to the

                                                consensus state (e.g. minting tokens for a deposit event)
                                                

                                                - If so, marks it "Observed" and emits an event

                                                func (Keeper) AddToOutgoingPool

                                                func (k Keeper) AddToOutgoingPool(ctx sdk.Context, sender sdk.AccAddress, counterpartReceiver string, refundAddr string, txHash string, amount sdk.Coin, fee sdk.Coin) (uint64, error)

                                                  AddToOutgoingPool - checks a counterpart denomintor exists for the given voucher type - burns the voucher for transfer amount and fees - persists an OutgoingTx - adds the TX to the `available` TX pool via a second index

                                                  func (Keeper) BatchConfirms

                                                    BatchConfirms returns the batch confirmations by nonce and token contract

                                                    func (Keeper) BatchRequestByNonce

                                                      BatchRequestByNonce queries the BatchRequestByNonce of the peggy module

                                                      func (Keeper) BuildOutgoingTXBatch

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

                                                        BuildOutgoingTXBatch starts the following process chain: - find bridged denominator for given voucher type - select available transactions from the outgoing transaction pool sorted by fee desc - persist an outgoing batch object with an incrementing ID = nonce - emit an event

                                                        func (Keeper) CancelOutgoingTXBatch

                                                        func (k Keeper) CancelOutgoingTXBatch(ctx sdk.Context, tokenContract string, nonce uint64) error

                                                          CancelOutgoingTXBatch releases all TX in the batch and deletes the batch

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

                                                                  func (k Keeper) GetAttestation(ctx sdk.Context, eventNonce uint64, details types.EthereumClaim) *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 string, 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 string) (out []types.MsgConfirmBatch)

                                                                          GetBatchConfirmByNonceAndTokenContract returns the batch confirms

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

                                                                              GetBridgeContractAddress returns the bridge contract address on ETH

                                                                              func (Keeper) GetClaimsByValidatorAndType

                                                                              func (k Keeper) GetClaimsByValidatorAndType(ctx sdk.Context, claimType types.ClaimType, val sdk.ValAddress) (out []types.EthereumClaim)

                                                                                GetClaimsByValidatorAndType returns the list of claims a validator has signed for

                                                                                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 / total cosmos power = x / uint32 Max where x is the voting power on the Peggy contract. This allows us to only use integer division which produces a known rounding error from truncation equal to the ratio of the validators Cosmos power / total cosmos power ratio, leaving us at uint32 Max - 1 total voting power. This is an acceptable rounding error since floating point may cause consensus problems if different floating point unit implementations are involved.

                                                                                  func (Keeper) GetEthAddress

                                                                                  func (k Keeper) GetEthAddress(ctx sdk.Context, validator sdk.ValAddress) string

                                                                                    GetEthAddress returns the eth address for a given peggy validator

                                                                                    func (Keeper) GetLastEventNonceByValidator

                                                                                    func (k Keeper) GetLastEventNonceByValidator(ctx sdk.Context, validator sdk.ValAddress) uint64

                                                                                      GetLastEventNonceByValidator returns the latest event nonce for a given validator

                                                                                      func (Keeper) GetLastObservedEventNonce

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

                                                                                        GetLastObservedEventNonce returns the latest observed event nonce

                                                                                        func (Keeper) GetOrchestratorValidator

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

                                                                                          GetOrchestratorValidator returns the validator key associated with an orchestrator key

                                                                                          func (Keeper) GetOutgoingTXBatch

                                                                                          func (k Keeper) GetOutgoingTXBatch(ctx sdk.Context, tokenContract string, 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) (p types.Params)

                                                                                                GetParams returns the parameters from the store

                                                                                                func (Keeper) GetPeggyID

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

                                                                                                  GetPeggyID returns the PeggyID (???)

                                                                                                  func (Keeper) GetStartThreshold

                                                                                                  func (k Keeper) GetStartThreshold(ctx sdk.Context) uint64

                                                                                                    GetStartThreshold returns the start threshold for the peggy validator set

                                                                                                    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) (confirms []*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) HasClaim

                                                                                                            func (k Keeper) HasClaim(ctx sdk.Context, details types.EthereumClaim) bool

                                                                                                              HasClaim returns true if a claim exists

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

                                                                                                                func (k Keeper) IsStopped(ctx sdk.Context) bool

                                                                                                                func (Keeper) IterateAttestaions

                                                                                                                func (k Keeper) IterateAttestaions(ctx sdk.Context, cb func([]byte, types.Attestation) bool)

                                                                                                                  IterateAttestaions iterates through all attestations

                                                                                                                  func (Keeper) IterateBatchConfirmByNonceAndTokenContract

                                                                                                                  func (k Keeper) IterateBatchConfirmByNonceAndTokenContract(ctx sdk.Context, nonce uint64, tokenContract string, 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) IterateClaimsByValidatorAndType

                                                                                                                    func (k Keeper) IterateClaimsByValidatorAndType(ctx sdk.Context, claimType types.ClaimType, validatorKey sdk.ValAddress, cb func([]byte, types.EthereumClaim) bool)

                                                                                                                      IterateClaimsByValidatorAndType takes a validator key and a claim type and then iterates over these claims

                                                                                                                      func (Keeper) IterateOutgoingPoolByFee

                                                                                                                      func (k Keeper) IterateOutgoingPoolByFee(ctx sdk.Context, contract string, cb func(uint64, *types.OutgoingTx) 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) IterateValsetConfirmByNonce

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

                                                                                                                            IterateValsetConfirmByNonce iterates through all valset confirms by nonce in ASC order MARK finish-batches: this is where the key is iterated in the old (presumed working) code TODO: specify which nonce this is

                                                                                                                            func (Keeper) IterateValsets

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

                                                                                                                              IterateValsets retruns all valsetRequests

                                                                                                                              func (Keeper) LastEventNonceByAddr

                                                                                                                                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

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

                                                                                                                                      func (k Keeper) MinterKeeper() minterkeeper.Keeper

                                                                                                                                      func (Keeper) OracleKeeper

                                                                                                                                      func (k Keeper) OracleKeeper() oraclekeeper.Keeper

                                                                                                                                      func (Keeper) OutgoingTxBatchExecuted

                                                                                                                                      func (k Keeper) OutgoingTxBatchExecuted(ctx sdk.Context, tokenContract string, nonce uint64, txSender string, txHash string) 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, then cancels all earlier batches

                                                                                                                                        func (Keeper) OutgoingTxBatches

                                                                                                                                          OutgoingTxBatches queries the OutgoingTxBatches of the peggy module

                                                                                                                                          func (Keeper) Params

                                                                                                                                            Params queries the params of the peggy module

                                                                                                                                            func (Keeper) RefundOutgoingTx

                                                                                                                                            func (k Keeper) RefundOutgoingTx(ctx sdk.Context, id uint64, tx *types.OutgoingTx)

                                                                                                                                            func (Keeper) SetAttestation

                                                                                                                                            func (k Keeper) SetAttestation(ctx sdk.Context, att *types.Attestation, claim types.EthereumClaim)

                                                                                                                                              SetAttestation sets the attestation in the store

                                                                                                                                              func (Keeper) SetAttestationUnsafe

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

                                                                                                                                                SetAttestationUnsafe sets the attestation w/o setting height and claim hash

                                                                                                                                                func (Keeper) SetBatchConfirm

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

                                                                                                                                                  SetBatchConfirm sets a batch confirmation by a validator

                                                                                                                                                  func (Keeper) SetEthAddress

                                                                                                                                                  func (k Keeper) SetEthAddress(ctx sdk.Context, validator sdk.ValAddress, ethAddr string)

                                                                                                                                                    SetEthAddress sets the ethereum address for a given validator

                                                                                                                                                    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, ps types.Params)

                                                                                                                                                        SetParams sets the parameters in the store

                                                                                                                                                        func (Keeper) SetValsetConfirm

                                                                                                                                                        func (k Keeper) SetValsetConfirm(ctx sdk.Context, valsetConf 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) 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

                                                                                                                                                                          type MockStakingValidatorData

                                                                                                                                                                          type MockStakingValidatorData struct {
                                                                                                                                                                          	Operator sdk.ValAddress
                                                                                                                                                                          	Power    int64
                                                                                                                                                                          }

                                                                                                                                                                            MockStakingValidatorData creates mock validator data

                                                                                                                                                                            type MultiSigUpdateResponse

                                                                                                                                                                            type MultiSigUpdateResponse struct {
                                                                                                                                                                            	Valset     types.Valset `json:"valset"`
                                                                                                                                                                            	Signatures [][]byte     `json:"signatures,omitempty"`
                                                                                                                                                                            }

                                                                                                                                                                            type SignatureWithAddress

                                                                                                                                                                            type SignatureWithAddress struct {
                                                                                                                                                                            	Signature string `json:"eth_signature"`
                                                                                                                                                                            	Address   string `json:"eth_address"`
                                                                                                                                                                            }

                                                                                                                                                                              We can assume that the signatures and the valset members are sorted in the same order but this is insufficient for a relayer to actually relay the batch. Since a batch may pass without signatures from some validators we need some metadata to know who the signatures are from. So that we can properly pass a blank signature for a specific validator

                                                                                                                                                                              type SignedOutgoingTxBatchResponse

                                                                                                                                                                              type SignedOutgoingTxBatchResponse struct {
                                                                                                                                                                              	Batch      types.OutgoingTxBatch  `json:"batch"`
                                                                                                                                                                              	Signatures []SignatureWithAddress `json:"signatures,omitempty"`
                                                                                                                                                                              }

                                                                                                                                                                              type StakingKeeperMock

                                                                                                                                                                              type StakingKeeperMock struct {
                                                                                                                                                                              	BondedValidators []stakingtypes.Validator
                                                                                                                                                                              	ValidatorPower   map[string]int64
                                                                                                                                                                              }

                                                                                                                                                                                StakingKeeperMock is a mock staking keeper for use in the tests

                                                                                                                                                                                func NewStakingKeeperMock

                                                                                                                                                                                func NewStakingKeeperMock(operators ...sdk.ValAddress) *StakingKeeperMock

                                                                                                                                                                                  NewStakingKeeperMock creates a new mock staking keeper

                                                                                                                                                                                  func NewStakingKeeperWeightedMock

                                                                                                                                                                                  func NewStakingKeeperWeightedMock(t ...MockStakingValidatorData) *StakingKeeperMock

                                                                                                                                                                                    NewStakingKeeperWeightedMock creates a new mock staking keeper with some mock validator data

                                                                                                                                                                                    func (*StakingKeeperMock) GetBondedValidatorsByPower

                                                                                                                                                                                    func (s *StakingKeeperMock) GetBondedValidatorsByPower(ctx sdk.Context) []stakingtypes.Validator

                                                                                                                                                                                      GetBondedValidatorsByPower implements the interface for staking keeper required by peggy

                                                                                                                                                                                      func (*StakingKeeperMock) GetLastTotalPower

                                                                                                                                                                                      func (s *StakingKeeperMock) GetLastTotalPower(ctx sdk.Context) (power sdk.Int)

                                                                                                                                                                                        GetLastTotalPower implements the interface for staking keeper required by peggy

                                                                                                                                                                                        func (*StakingKeeperMock) GetLastValidatorPower

                                                                                                                                                                                        func (s *StakingKeeperMock) GetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress) int64

                                                                                                                                                                                          GetLastValidatorPower implements the interface for staking keeper required by peggy

                                                                                                                                                                                          func (*StakingKeeperMock) IterateBondedValidatorsByPower

                                                                                                                                                                                          func (s *StakingKeeperMock) IterateBondedValidatorsByPower(ctx sdk.Context, cb func(index int64, validator stakingtypes.ValidatorI) (stop bool))

                                                                                                                                                                                            IterateBondedValidatorsByPower staisfies the interface

                                                                                                                                                                                            func (*StakingKeeperMock) IterateLastValidators

                                                                                                                                                                                            func (s *StakingKeeperMock) IterateLastValidators(ctx sdk.Context, cb func(index int64, validator stakingtypes.ValidatorI) (stop bool))

                                                                                                                                                                                              IterateLastValidators staisfies the interface

                                                                                                                                                                                              func (*StakingKeeperMock) IterateValidators

                                                                                                                                                                                              func (s *StakingKeeperMock) IterateValidators(ctx sdk.Context, cb func(index int64, validator stakingtypes.ValidatorI) (stop bool))

                                                                                                                                                                                                IterateValidators staisfies the interface

                                                                                                                                                                                                func (*StakingKeeperMock) Jail

                                                                                                                                                                                                  Jail staisfies the interface

                                                                                                                                                                                                  func (*StakingKeeperMock) Slash

                                                                                                                                                                                                    Slash staisfies the interface

                                                                                                                                                                                                    func (*StakingKeeperMock) Validator

                                                                                                                                                                                                      Validator staisfies the interface

                                                                                                                                                                                                      func (*StakingKeeperMock) ValidatorByConsAddr

                                                                                                                                                                                                      func (s *StakingKeeperMock) ValidatorByConsAddr(ctx sdk.Context, addr sdk.ConsAddress) stakingtypes.ValidatorI

                                                                                                                                                                                                        ValidatorByConsAddr staisfies the interface

                                                                                                                                                                                                        type TestInput

                                                                                                                                                                                                        type TestInput struct {
                                                                                                                                                                                                        	PeggyKeeper   Keeper
                                                                                                                                                                                                        	AccountKeeper authkeeper.AccountKeeper
                                                                                                                                                                                                        	StakingKeeper stakingkeeper.Keeper
                                                                                                                                                                                                        	DistKeeper    distrkeeper.Keeper
                                                                                                                                                                                                        	BankKeeper    bankkeeper.BaseKeeper
                                                                                                                                                                                                        	GovKeeper     govkeeper.Keeper
                                                                                                                                                                                                        	Context       sdk.Context
                                                                                                                                                                                                        	Marshaler     codec.Marshaler
                                                                                                                                                                                                        	LegacyAmino   *codec.LegacyAmino
                                                                                                                                                                                                        }

                                                                                                                                                                                                          TestInput stores the various keepers required to test peggy

                                                                                                                                                                                                          func CreateTestEnv

                                                                                                                                                                                                          func CreateTestEnv(t *testing.T) TestInput

                                                                                                                                                                                                            CreateTestEnv creates the keeper testing environment for peggy

                                                                                                                                                                                                            func SetupFiveValChain

                                                                                                                                                                                                            func SetupFiveValChain(t *testing.T) (TestInput, sdk.Context)

                                                                                                                                                                                                              SetupFiveValChain does all the initialization for a 5 Validator chain using the keys here