keeper

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrChainNotFound                               = liberr.Error("chain with chainReferenceID '%s' was not found")
	ErrChainNotActive                              = liberr.Error("chain with chainReferenceID '%s' is not active")
	ErrNotEnoughValidatorsForGivenChainReferenceID = liberr.Error("not enough validators in the current snapshot to form a proper valset")
	ErrUnexpectedError                             = liberr.Error("unexpected error")
	ErrConsensusNotAchieved                        = liberr.Error("evm: consensus not achieved")
	ErrCannotAddSupportForChainThatExists          = liberr.Error("chain info already exists: %s")
	ErrCannotActiveSmartContractThatIsNotDeploying = liberr.Error("trying to activate a smart contract that is not currently deploying")
	ErrInvalidReferenceBlockHeight                 = liberr.Error("new reference block height is invalid")
)
View Source
const (
	ConsensusTurnstoneMessage     = "evm-turnstone-message"
	ConsensusGetValidatorBalances = "validators-balances"
	ConsensusGetReferenceBlock    = "reference-block"
	ConsensusCollectFundEvents    = "collect-fund-events"
	SignaturePrefix               = "\x19Ethereum Signed Message:\n32"
)

Variables

View Source
var SupportedConsensusQueues = []supportedChainInfo{
	{
		// contains filtered or unexported fields
	},
	{
		// contains filtered or unexported fields
	},
	{
		// contains filtered or unexported fields
	},
	{
		// contains filtered or unexported fields
	},
}

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 {
	ConsensusKeeper types.ConsensusKeeper
	SchedulerKeeper types.SchedulerKeeper
	Valset          types.ValsetKeeper
	Gravity         types.GravityKeeper

	AddressCodec address.Codec
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeService corestore.KVStoreService,
	consensusKeeper types.ConsensusKeeper,
	valsetKeeper types.ValsetKeeper, a address.Codec,
) *Keeper

func (Keeper) ActivateChainReferenceID

func (k Keeper) ActivateChainReferenceID(
	ctx context.Context,
	chainReferenceID string,
	smartContract *types.SmartContract,
	smartContractAddr string,
	smartContractUniqueID []byte,
) (retErr error)

func (*Keeper) AddMessageConsensusAttestedListener added in v1.12.0

func (k *Keeper) AddMessageConsensusAttestedListener(l metrixtypes.OnConsensusMessageAttestedListener)

func (Keeper) AddSmartContractExecutionToConsensus

func (k Keeper) AddSmartContractExecutionToConsensus(
	ctx context.Context,
	chainReferenceID,
	turnstoneID string,
	logicCall *types.SubmitLogicCall,
) (uint64, error)

func (Keeper) AddSupportForNewChain

func (k Keeper) AddSupportForNewChain(
	ctx context.Context,
	chainReferenceID string,
	chainID uint64,
	blockHeight uint64,
	blockHashAtHeight string,
	minimumOnChainBalance *big.Int,
) error

func (Keeper) AddUploadSmartContractToConsensus added in v1.15.0

func (k Keeper) AddUploadSmartContractToConsensus(
	ctx context.Context,
	chainReferenceID string,
	smartContract *types.UploadSmartContract,
) (uint64, error)

func (Keeper) AllSmartContractsDeployments added in v0.6.0

func (k Keeper) AllSmartContractsDeployments(ctx sdk.Context) ([]*types.SmartContractDeployment, error)

func (Keeper) ChangeMinOnChainBalance added in v0.8.0

func (k Keeper) ChangeMinOnChainBalance(ctx sdk.Context, chainReferenceID string, balance *big.Int) error

func (Keeper) CheckExternalBalancesForChain added in v0.6.0

func (k Keeper) CheckExternalBalancesForChain(ctx context.Context, chainReferenceID string) error

func (Keeper) CollectJobFundEvents added in v0.10.2

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

func (Keeper) DeleteSmartContractDeploymentByContractID added in v1.9.1

func (k Keeper) DeleteSmartContractDeploymentByContractID(ctx context.Context, smartContractID uint64, chainReferenceID string)

func (Keeper) DeployNewSmartContract added in v1.7.0

func (Keeper) ExecuteJob added in v0.10.0

func (k Keeper) ExecuteJob(ctx context.Context, jcfg *xchain.JobConfiguration) (uint64, error)

ExecuteJob schedules the definition and payload for execution via consensus queue

func (Keeper) GetAllChainInfos

func (k Keeper) GetAllChainInfos(ctx context.Context) ([]*types.ChainInfo, error)

func (Keeper) GetChainInfo

func (k Keeper) GetChainInfo(ctx context.Context, targetChainReferenceID string) (*types.ChainInfo, error)

func (Keeper) GetEthAddressByValidator added in v1.8.0

func (k Keeper) GetEthAddressByValidator(ctx context.Context, validator sdk.ValAddress, chainReferenceId string) (ethAddress *gravitymoduletypes.EthAddress, found bool, err error)

func (Keeper) GetLastCompassContract added in v1.7.0

func (k Keeper) GetLastCompassContract(ctx context.Context) (*types.SmartContract, error)

func (Keeper) GetParams

func (k Keeper) GetParams(ctx context.Context) types.Params

GetParams get all parameters as types.Params

func (Keeper) GetRelayWeights added in v1.4.0

func (k Keeper) GetRelayWeights(ctx context.Context, chainReferenceID string) (*types.RelayWeights, error)

func (Keeper) GetValidatorAddressByEthAddress added in v1.8.0

func (k Keeper) GetValidatorAddressByEthAddress(ctx context.Context, ethAddr gravitymoduletypes.EthAddress, chainReferenceId string) (valAddr sdk.ValAddress, found bool, err error)

func (Keeper) GetValsetByID

GetValsetByID returns the valset given chain id and valset id. if the valset id is non-pozitive then it returns the latest valset existing.

func (Keeper) HasAnySmartContractDeployment

func (k Keeper) HasAnySmartContractDeployment(ctx context.Context, chainReferenceID string) (found bool)

func (Keeper) Logger

func (k Keeper) Logger(ctx context.Context) liblog.Logr

func (Keeper) MissingChains added in v1.7.0

func (k Keeper) MissingChains(ctx context.Context, inputChainReferenceIDs []string) ([]string, error)

MissingChains returns the chains in this keeper that aren't in the input slice

func (Keeper) ModuleName added in v0.6.0

func (k Keeper) ModuleName() string

func (Keeper) OnSnapshotBuilt

func (k Keeper) OnSnapshotBuilt(ctx context.Context, snapshot *valsettypes.Snapshot)

func (Keeper) Params

func (Keeper) PickValidatorForMessage added in v1.4.0

func (k Keeper) PickValidatorForMessage(ctx context.Context, chainReferenceID string, requirements *xchain.JobRequirements) (string, error)

func (Keeper) PreJobExecution added in v1.2.0

func (k Keeper) PreJobExecution(ctx context.Context, job *schedulertypes.Job) error

func (Keeper) PublishSnapshotToAllChains added in v1.7.0

func (k Keeper) PublishSnapshotToAllChains(ctx context.Context, snapshot *valsettypes.Snapshot, forcePublish bool) error

func (Keeper) PublishValsetToChain added in v1.7.0

func (k Keeper) PublishValsetToChain(ctx context.Context, valset types.Valset, chain *types.ChainInfo) error

func (Keeper) QueryGetSmartContract added in v0.6.0

func (Keeper) QueryGetSmartContractDeployments added in v0.6.0

func (Keeper) RemoveSmartContractDeployment added in v0.6.0

func (Keeper) RemoveSupportForChain

func (k Keeper) RemoveSupportForChain(ctx context.Context, proposal *types.RemoveChainProposal) error

func (Keeper) SaveNewSmartContract

func (k Keeper) SaveNewSmartContract(ctx context.Context, abiJSON string, bytecode []byte) (*types.SmartContract, error)

func (Keeper) ScheduleReferenceBlockForChain added in v1.14.0

func (k Keeper) ScheduleReferenceBlockForChain(ctx context.Context, chainReferenceID string) error

func (Keeper) SetAsCompassContract added in v1.7.0

func (k Keeper) SetAsCompassContract(ctx context.Context, smartContract *types.SmartContract) error

func (Keeper) SetParams

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

SetParams set the params

func (Keeper) SetRelayWeights added in v1.4.0

func (k Keeper) SetRelayWeights(ctx context.Context, chainReferenceID string, weights *types.RelayWeights) error

func (Keeper) SetSmartContractAsActive added in v1.11.0

func (k Keeper) SetSmartContractAsActive(ctx context.Context, smartContractID uint64, chainReferenceID string) (err error)

func (Keeper) SupportedQueues

func (k Keeper) SupportedQueues(ctx context.Context) ([]consensus.SupportsConsensusQueueAction, error)

func (Keeper) TryDeployingLastCompassContractToAllChains added in v1.7.0

func (k Keeper) TryDeployingLastCompassContractToAllChains(ctx context.Context)

func (Keeper) UpdateChainReferenceBlock added in v1.14.0

func (k Keeper) UpdateChainReferenceBlock(ctx sdk.Context, chainReferenceID string, referenceBlockHeight uint64, referenceBlockHash string) error

func (Keeper) VerifyJob added in v0.10.0

func (k Keeper) VerifyJob(ctx context.Context, definition, payload []byte, chainReferenceID xchain.ReferenceID) error

func (Keeper) XChainReferenceIDs added in v0.10.0

func (k Keeper) XChainReferenceIDs(ctx context.Context) []xchain.ReferenceID

func (Keeper) XChainType added in v0.10.0

func (k Keeper) XChainType() xchain.Type

type MsgAssigner added in v1.4.0

type MsgAssigner struct {
	ValsetKeeper types.ValsetKeeper
}

func (MsgAssigner) PickValidatorForMessage added in v1.4.0

func (ma MsgAssigner) PickValidatorForMessage(ctx context.Context, weights *types.RelayWeights, chainID string, req *xchain.JobRequirements) (string, error)

type ValidatorInfo added in v1.4.0

type ValidatorInfo struct {
	Fee           float64
	Uptime        float64
	SuccessRate   float64
	ExecutionTime float64
	FeatureSet    float64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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