stakingcommon

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddKeysToWaitingList

func AddKeysToWaitingList(
	accountsDB state.AccountsAdapter,
	waitingKeys [][]byte,
	marshaller marshal.Marshalizer,
	rewardAddress []byte,
	ownerAddress []byte,
)

AddKeysToWaitingList will add the owner's provided bls keys in the staking queue list

func AddStakingData

func AddStakingData(
	accountsDB state.AccountsAdapter,
	ownerAddress []byte,
	rewardAddress []byte,
	stakedKeys [][]byte,
	marshaller marshal.Marshalizer,
)

AddStakingData will add the owner's staked keys in the provided accounts db

func AddValidatorData

func AddValidatorData(
	accountsDB state.AccountsAdapter,
	ownerKey []byte,
	registeredKeys [][]byte,
	totalStake *big.Int,
	marshaller marshal.Marshalizer,
)

AddValidatorData will add the validator's registered keys in the provided accounts db

func CreateEconomicsData

func CreateEconomicsData() process.EconomicsDataHandler

CreateEconomicsData returns an initialized process.EconomicsDataHandler

func GetWaitingListElement

func GetWaitingListElement(
	stakingSCAcc state.UserAccountHandler,
	marshaller marshal.Marshalizer,
	key []byte,
) (*systemSmartContracts.ElementInList, error)

GetWaitingListElement returns the element in waiting list saved at the provided key

func LoadUserAccount

func LoadUserAccount(accountsDB state.AccountsAdapter, address []byte) state.UserAccountHandler

LoadUserAccount returns address's state.UserAccountHandler from the provided db

func RegisterValidatorKeys

func RegisterValidatorKeys(
	accountsDB state.AccountsAdapter,
	ownerAddress []byte,
	rewardAddress []byte,
	stakedKeys [][]byte,
	totalStake *big.Int,
	marshaller marshal.Marshalizer,
)

RegisterValidatorKeys will register validator's staked key in the provided accounts db

func SaveDelegationManagerConfig

func SaveDelegationManagerConfig(accountsDB state.AccountsAdapter, marshaller marshal.Marshalizer)

SaveDelegationManagerConfig will save a mock configuration for the delegation manager SC

func SaveNodesConfig

func SaveNodesConfig(
	accountsDB state.AccountsAdapter,
	marshaller marshal.Marshalizer,
	stakedNodes,
	minNumNodes,
	maxNumNodes int64,
)

SaveNodesConfig saves the nodes config in accounts db under "nodesConfig" key with provided params

Types

type AuctionListSelectorStub

type AuctionListSelectorStub struct {
	SelectNodesFromAuctionListCalled func(validatorsInfoMap state.ShardValidatorsInfoMapHandler, randomness []byte) error
}

AuctionListSelectorStub -

func (*AuctionListSelectorStub) IsInterfaceNil

func (als *AuctionListSelectorStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*AuctionListSelectorStub) SelectNodesFromAuctionList

func (als *AuctionListSelectorStub) SelectNodesFromAuctionList(
	validatorsInfoMap state.ShardValidatorsInfoMapHandler,
	randomness []byte,
) error

SelectNodesFromAuctionList -

type StakingDataProviderStub

type StakingDataProviderStub struct {
	CleanCalled                           func()
	PrepareStakingDataCalled              func(validatorsMap state.ShardValidatorsInfoMapHandler) error
	GetTotalStakeEligibleNodesCalled      func() *big.Int
	GetTotalTopUpStakeEligibleNodesCalled func() *big.Int
	GetNodeStakedTopUpCalled              func(blsKey []byte) (*big.Int, error)
	FillValidatorInfoCalled               func(validator state.ValidatorInfoHandler) error
	ComputeUnQualifiedNodesCalled         func(validatorInfos state.ShardValidatorsInfoMapHandler) ([][]byte, map[string][][]byte, error)
	GetBlsKeyOwnerCalled                  func(blsKey []byte) (string, error)
	GetOwnersDataCalled                   func() map[string]*epochStart.OwnerData
}

StakingDataProviderStub -

func (*StakingDataProviderStub) Clean

func (sdps *StakingDataProviderStub) Clean()

Clean -

func (*StakingDataProviderStub) ComputeUnQualifiedNodes

func (sdps *StakingDataProviderStub) ComputeUnQualifiedNodes(validatorInfos state.ShardValidatorsInfoMapHandler) ([][]byte, map[string][][]byte, error)

ComputeUnQualifiedNodes -

func (*StakingDataProviderStub) EpochConfirmed

func (sdps *StakingDataProviderStub) EpochConfirmed(uint32, uint64)

EpochConfirmed -

func (*StakingDataProviderStub) FillValidatorInfo

func (sdps *StakingDataProviderStub) FillValidatorInfo(validator state.ValidatorInfoHandler) error

FillValidatorInfo -

func (*StakingDataProviderStub) GetBlsKeyOwner

func (sdps *StakingDataProviderStub) GetBlsKeyOwner(blsKey []byte) (string, error)

GetBlsKeyOwner -

func (*StakingDataProviderStub) GetCurrentEpochValidatorStats

func (sdps *StakingDataProviderStub) GetCurrentEpochValidatorStats() epochStart.ValidatorStatsInEpoch

GetCurrentEpochValidatorStats -

func (*StakingDataProviderStub) GetNodeStakedTopUp

func (sdps *StakingDataProviderStub) GetNodeStakedTopUp(blsKey []byte) (*big.Int, error)

GetNodeStakedTopUp -

func (*StakingDataProviderStub) GetNumOfValidatorsInCurrentEpoch

func (sdps *StakingDataProviderStub) GetNumOfValidatorsInCurrentEpoch() uint32

GetNumOfValidatorsInCurrentEpoch -

func (*StakingDataProviderStub) GetOwnersData

func (sdps *StakingDataProviderStub) GetOwnersData() map[string]*epochStart.OwnerData

GetOwnersData -

func (*StakingDataProviderStub) GetTotalStakeEligibleNodes

func (sdps *StakingDataProviderStub) GetTotalStakeEligibleNodes() *big.Int

GetTotalStakeEligibleNodes -

func (*StakingDataProviderStub) GetTotalTopUpStakeEligibleNodes

func (sdps *StakingDataProviderStub) GetTotalTopUpStakeEligibleNodes() *big.Int

GetTotalTopUpStakeEligibleNodes -

func (*StakingDataProviderStub) IsInterfaceNil

func (sdps *StakingDataProviderStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*StakingDataProviderStub) PrepareStakingData

func (sdps *StakingDataProviderStub) PrepareStakingData(validatorsMap state.ShardValidatorsInfoMapHandler) error

PrepareStakingData -

type ValidatorsProviderStub

type ValidatorsProviderStub struct {
	GetLatestValidatorsCalled func() map[string]*validator.ValidatorStatistics
	GetAuctionListCalled      func() ([]*common.AuctionListValidatorAPIResponse, error)
	ForceUpdateCalled         func() error
}

ValidatorsProviderStub -

func (*ValidatorsProviderStub) Close

func (vp *ValidatorsProviderStub) Close() error

Close -

func (*ValidatorsProviderStub) ForceUpdate

func (vp *ValidatorsProviderStub) ForceUpdate() error

ForceUpdate -

func (*ValidatorsProviderStub) GetAuctionList

GetAuctionList -

func (*ValidatorsProviderStub) GetLatestValidators

func (vp *ValidatorsProviderStub) GetLatestValidators() map[string]*validator.ValidatorStatistics

GetLatestValidators -

func (*ValidatorsProviderStub) IsInterfaceNil

func (vp *ValidatorsProviderStub) IsInterfaceNil() bool

IsInterfaceNil -

Jump to

Keyboard shortcuts

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