keeper

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: Apache-2.0 Imports: 44 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")
	ErrFeeManagerNotPresent                        = liberr.Error("evm: fee manager not present")
	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 (
	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
	Skyway          types.SkywayKeeper

	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,
	metrixKeeper types.MetrixKeeper,
	treasuryKeeper types.TreasuryKeeper,
) *Keeper

func (Keeper) ActivateChainReferenceID

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

func (Keeper) AddJustInTimeValsetUpdates

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

func (*Keeper) AddMessageConsensusAttestedListener

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

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

func (Keeper) AddUploadUserSmartContractToConsensus

func (k Keeper) AddUploadUserSmartContractToConsensus(
	ctx context.Context,
	chainReferenceID string,
	turnstoneID string,
	userSmartContract *types.UploadUserSmartContract,
) (uint64, error)

func (Keeper) AllSmartContractsDeployments

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

func (Keeper) ChangeMinOnChainBalance

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

func (Keeper) CheckExternalBalancesForChain

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

func (Keeper) CollectJobFundEvents

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

func (Keeper) CreateUserSmartContractDeployment

func (k Keeper) CreateUserSmartContractDeployment(
	ctx context.Context,
	addr string,
	id uint64,
	targetChain string,
) (uint64, error)

func (Keeper) DeleteSmartContractDeploymentByContractID

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

func (Keeper) DeleteUserSmartContract

func (k Keeper) DeleteUserSmartContract(
	ctx context.Context,
	addr string,
	id uint64,
) error

func (Keeper) ExecuteJob

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

func (k Keeper) GetActiveChainNames(ctx context.Context) []string

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

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

func (Keeper) GetLastCompassContract

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

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

func (Keeper) GetValidatorAddressByEthAddress

func (k Keeper) GetValidatorAddressByEthAddress(ctx context.Context, ethAddr skywaymoduletypes.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

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

func (k Keeper) ModuleName() string

func (Keeper) OnSnapshotBuilt

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

func (Keeper) Params

func (Keeper) PickValidatorForMessage

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

func (Keeper) PreJobExecution

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

func (Keeper) PublishSnapshotToAllChains

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

func (Keeper) PublishValsetToChain

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

func (Keeper) PurgeStaleUserSmartContracts

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

Remove contracts that are not updated nor deployed for over 30 days

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

func (k Keeper) SaveUserSmartContract(
	ctx context.Context,
	addr string,
	c *types.UserSmartContract,
) (uint64, error)

func (Keeper) ScheduleReferenceBlockForChain

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

func (Keeper) SetAsCompassContract

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

func (Keeper) SetFeeManagerAddress

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

func (Keeper) SetParams

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

SetParams set the params

func (Keeper) SetRelayWeights

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

func (Keeper) SetSmartContractAsActive

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

func (Keeper) SetSmartContractDeployer

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

func (Keeper) SetUserSmartContractDeploymentActive

func (k Keeper) SetUserSmartContractDeploymentActive(
	ctx context.Context,
	addr string,
	id uint64,
	blockHeight int64,
	targetChain string,
	contractAddr string,
) error

func (Keeper) SetUserSmartContractDeploymentError

func (k Keeper) SetUserSmartContractDeploymentError(
	ctx context.Context,
	addr string,
	id uint64,
	blockHeight int64,
	targetChain string,
) error

func (Keeper) SupportedQueues

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

func (Keeper) TryDeployingLastCompassContractToAllChains

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

func (Keeper) UpdateChainReferenceBlock

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

func (Keeper) UserSmartContracts

func (k Keeper) UserSmartContracts(
	ctx context.Context,
	addr string,
) ([]*types.UserSmartContract, error)

func (Keeper) VerifyJob

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

func (Keeper) XChainReferenceIDs

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

func (Keeper) XChainType

func (k Keeper) XChainType() xchain.Type

type ValidatorInfo

type ValidatorInfo struct {
	Fee           math.LegacyDec
	Uptime        math.LegacyDec
	SuccessRate   math.LegacyDec
	ExecutionTime math.LegacyDec
	FeatureSet    math.LegacyDec
}

Jump to

Keyboard shortcuts

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