keeper

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

Types

type Keeper

type Keeper struct {
	Schema                       collections.Schema
	Params                       collections.Item[types.Params]
	BridgeValset                 collections.Item[types.BridgeValidatorSet]
	ValidatorCheckpoint          collections.Item[types.ValidatorCheckpoint]
	WithdrawalId                 collections.Item[types.WithdrawalId]
	OperatorToEVMAddressMap      collections.Map[string, types.EVMAddress]
	BridgeValsetSignaturesMap    collections.Map[uint64, types.BridgeValsetSignatures]
	ValidatorCheckpointParamsMap collections.Map[uint64, types.ValidatorCheckpointParams]
	ValidatorCheckpointIdxMap    collections.Map[uint64, types.CheckpointTimestamp]
	LatestCheckpointIdx          collections.Item[types.CheckpointIdx]
	BridgeValsetByTimestampMap   collections.Map[uint64, types.BridgeValidatorSet]
	ValsetTimestampToIdxMap      collections.Map[uint64, types.CheckpointIdx]
	AttestSnapshotsByReportMap   collections.Map[[]byte, types.AttestationSnapshots]
	AttestSnapshotDataMap        collections.Map[[]byte, types.AttestationSnapshotData]
	SnapshotToAttestationsMap    collections.Map[[]byte, types.OracleAttestations]
	AttestRequestsByHeightMap    collections.Map[uint64, types.AttestationRequests]
	DepositIdClaimedMap          collections.Map[uint64, types.DepositClaimed]
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeService storetypes.KVStoreService,
	stakingKeeper types.StakingKeeper,
	oracleKeeper types.OracleKeeper,
	bankKeeper types.BankKeeper,
	reporterKeeper types.ReporterKeeper,
) Keeper

func (Keeper) CalculateValidatorSetCheckpoint

func (k Keeper) CalculateValidatorSetCheckpoint(
	ctx context.Context,
	powerThreshold uint64,
	validatorTimestamp uint64,
	validatorSetHash []byte,
) ([]byte, error)

func (Keeper) ClaimDeposit

func (k Keeper) ClaimDeposit(ctx context.Context, depositId, reportIndex uint64, msgSender sdk.AccAddress) error

func (Keeper) CompareAndSetBridgeValidators

func (k Keeper) CompareAndSetBridgeValidators(ctx context.Context) (bool, error)

function for loading last saved bridge validator set and comparing it to current set

func (Keeper) CreateNewReportSnapshots

func (k Keeper) CreateNewReportSnapshots(ctx context.Context) error

func (Keeper) CreateSnapshot

func (k Keeper) CreateSnapshot(ctx context.Context, queryId []byte, timestamp time.Time, isExternalRequest bool) error

Called with each new agg report and with new request for optimistic attestations

func (Keeper) CreateWithdrawalAggregate

func (k Keeper) CreateWithdrawalAggregate(goCtx context.Context, amount sdk.Coin, sender sdk.AccAddress, recipient []byte, withdrawalId uint64) (*oracletypes.Aggregate, error)

func (Keeper) DecodeDepositReportValue

func (k Keeper) DecodeDepositReportValue(ctx context.Context, reportValue string) (recipient sdk.AccAddress, amount, tip sdk.Coins, err error)

replicate solidity decoding, abi.decode(reportValue, (address ethSender, string layerRecipient, uint256 amount, uint256 tip))

func (Keeper) EVMAddressFromSignatures

func (k Keeper) EVMAddressFromSignatures(ctx context.Context, sigA, sigB []byte) (common.Address, error)

func (Keeper) EncodeAndHashValidatorSet

func (k Keeper) EncodeAndHashValidatorSet(ctx context.Context, validatorSet *types.BridgeValidatorSet) (encodedBridgeValidatorSet, bridgeValidatorSetHash []byte, err error)

func (Keeper) EncodeOracleAttestationData

func (k Keeper) EncodeOracleAttestationData(
	queryId []byte,
	value string,
	timestamp uint64,
	aggregatePower uint64,
	previousTimestamp uint64,
	nextTimestamp uint64,
	valsetCheckpoint []byte,
	attestationTimestamp uint64,
) ([]byte, error)

func (Keeper) GetAttestationRequestsByHeight

func (k Keeper) GetAttestationRequestsByHeight(ctx context.Context, height uint64) (*types.AttestationRequests, error)

func (Keeper) GetBridgeValsetByTimestamp

func (k Keeper) GetBridgeValsetByTimestamp(ctx context.Context, timestamp uint64) (*types.BridgeValidatorSet, error)

func (Keeper) GetCurrentValidatorSetEVMCompatible

func (k Keeper) GetCurrentValidatorSetEVMCompatible(ctx context.Context) (*types.BridgeValidatorSet, error)

func (Keeper) GetCurrentValidatorSetTimestamp

func (k Keeper) GetCurrentValidatorSetTimestamp(ctx context.Context) (uint64, error)

func (Keeper) GetCurrentValidatorsEVMCompatible

func (k Keeper) GetCurrentValidatorsEVMCompatible(ctx context.Context) ([]*types.BridgeValidator, error)

func (Keeper) GetDepositQueryId

func (k Keeper) GetDepositQueryId(depositId uint64) ([]byte, error)

replicate solidity encoding, keccak256(abi.encode(string "TRBBridge", abi.encode(bool true, uint256 depositId)))

func (Keeper) GetEVMAddressByOperator

func (k Keeper) GetEVMAddressByOperator(ctx context.Context, operatorAddress string) ([]byte, error)

func (Keeper) GetLatestCheckpointIndex

func (k Keeper) GetLatestCheckpointIndex(ctx context.Context) (uint64, error)

func (Keeper) GetValidatorCheckpointFromStorage

func (k Keeper) GetValidatorCheckpointFromStorage(ctx context.Context) (*types.ValidatorCheckpoint, error)

func (Keeper) GetValidatorCheckpointParamsFromStorage

func (k Keeper) GetValidatorCheckpointParamsFromStorage(ctx context.Context, timestamp uint64) (types.ValidatorCheckpointParams, error)

func (Keeper) GetValidatorDidSignCheckpoint

func (k Keeper) GetValidatorDidSignCheckpoint(ctx context.Context, operatorAddr string, checkpointTimestamp uint64) (didSign bool, prevValsetIndex int64, err error)

func (Keeper) GetValidatorSetIndexByTimestamp

func (k Keeper) GetValidatorSetIndexByTimestamp(ctx context.Context, timestamp uint64) (uint64, error)

func (Keeper) GetValidatorSetSignaturesFromStorage

func (k Keeper) GetValidatorSetSignaturesFromStorage(ctx context.Context, timestamp uint64) (*types.BridgeValsetSignatures, error)

func (Keeper) GetValidatorSetTimestampBefore

func (k Keeper) GetValidatorSetTimestampBefore(ctx context.Context, targetTimestamp uint64) (uint64, error)

func (Keeper) GetValidatorTimestampByIdxFromStorage

func (k Keeper) GetValidatorTimestampByIdxFromStorage(ctx context.Context, checkpointIdx uint64) (types.CheckpointTimestamp, error)

func (Keeper) GetWithdrawalQueryId

func (k Keeper) GetWithdrawalQueryId(withdrawalId uint64) ([]byte, error)

func (Keeper) GetWithdrawalReportValue

func (k Keeper) GetWithdrawalReportValue(amount sdk.Coin, sender sdk.AccAddress, recipient []byte) ([]byte, error)

func (Keeper) IncrementWithdrawalId

func (k Keeper) IncrementWithdrawalId(goCtx context.Context) (uint64, error)

func (Keeper) LastSavedValidatorSetStale

func (k Keeper) LastSavedValidatorSetStale(ctx context.Context) (bool, error)

check whether last saved validator set is too old (more than 2 weeks)

func (Keeper) Logger

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

func (Keeper) PowerDiff

func (k Keeper) PowerDiff(ctx context.Context, b, c types.BridgeValidatorSet) int64

func (Keeper) SetBridgeValidatorParams

func (k Keeper) SetBridgeValidatorParams(ctx context.Context, bridgeValidatorSet *types.BridgeValidatorSet) error

func (Keeper) SetBridgeValsetSignature

func (k Keeper) SetBridgeValsetSignature(ctx context.Context, operatorAddress string, timestamp uint64, signature string) error

func (Keeper) SetEVMAddressByOperator

func (k Keeper) SetEVMAddressByOperator(ctx context.Context, operatorAddr string, evmAddr []byte) error

func (Keeper) SetOracleAttestation

func (k Keeper) SetOracleAttestation(ctx context.Context, operatorAddress string, snapshot, sig []byte) error

func (Keeper) TryRecoverAddressWithBothIDs

func (k Keeper) TryRecoverAddressWithBothIDs(sig, msgHash []byte) ([]common.Address, error)

func (Keeper) WithdrawTokens

func (k Keeper) WithdrawTokens(ctx context.Context, amount sdk.Coin, sender sdk.AccAddress, recipient []byte) (uint64, error)

type Querier

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

func NewQuerier

func NewQuerier(keeper Keeper) Querier

func (Querier) Params

Jump to

Keyboard shortcuts

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