sybilprotection

package
v1.0.0-alpha.14 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewEvents = event.CreateGroupConstructor(func() (newEvents *Events) {
	return &Events{
		CommitteeSelected: event.New2[*account.SeatedAccounts, iotago.EpochIndex](),
		RewardsCommitted:  event.New1[iotago.EpochIndex](),
	}
})

NewEvents contains the constructor of the Events object (it is generated by a generic factory).

Functions

This section is empty.

Types

type Events

type Events struct {
	CommitteeSelected *event.Event2[*account.SeatedAccounts, iotago.EpochIndex]
	RewardsCommitted  *event.Event1[iotago.EpochIndex]

	event.Group[Events, *Events]
}

type SybilProtection

type SybilProtection interface {
	TrackBlock(block *blocks.Block)
	EligibleValidators(epoch iotago.EpochIndex) (accounts.AccountsData, error)
	OrderedRegisteredCandidateValidatorsList(epoch iotago.EpochIndex) ([]*api.ValidatorResponse, error)
	IsCandidateActive(validatorID iotago.AccountID, epoch iotago.EpochIndex) (bool, error)
	// ValidatorReward returns the amount of mana that a validator with the given staking feature has earned in the feature's epoch range.
	//
	// The first epoch in which rewards existed is returned (firstRewardEpoch).
	// Since the validator may still be active and the EndEpoch might be in the future, the epoch until which rewards were calculated is returned in addition to the first epoch in which rewards existed (lastRewardEpoch).
	// The rewards are decayed until claimingEpoch, which should be set to the epoch in which the rewards would be claimed.
	ValidatorReward(validatorID iotago.AccountID, stakingFeature *iotago.StakingFeature, claimingEpoch iotago.EpochIndex) (validatorReward iotago.Mana, firstRewardEpoch iotago.EpochIndex, lastRewardEpoch iotago.EpochIndex, err error)
	// DelegatorReward returns the amount of mana that a delegator has earned in a given epoch range.
	//
	// The first epoch in which rewards existed is returned (firstRewardEpoch).
	// Since the Delegation Output's EndEpoch might be unset due to an ongoing delegation, the epoch until which rewards were calculated is also returned (lastRewardEpoch).
	// The rewards are decayed until claimingEpoch, which should be set to the epoch in which the rewards would be claimed.
	DelegatorReward(validatorID iotago.AccountID, delegatedAmount iotago.BaseToken, epochStart iotago.EpochIndex, epochEnd iotago.EpochIndex, claimingEpoch iotago.EpochIndex) (delegatorReward iotago.Mana, firstRewardEpoch iotago.EpochIndex, lastRewardEpoch iotago.EpochIndex, err error)
	// PoolRewardsForAccount returns the pool rewards of the account identified by accountID in the last committed epoch.
	PoolRewardsForAccount(accountID iotago.AccountID) (
		poolRewardsForAccount iotago.Mana, exists bool, err error)
	SeatManager() seatmanager.SeatManager
	CommitSlot(slot iotago.SlotIndex) (iotago.Identifier, iotago.Identifier, error)
	Import(reader io.ReadSeeker) error
	Export(writer io.WriteSeeker, targetSlot iotago.SlotIndex) error

	// Reset resets the component to a clean state as if it was created at the last commitment.
	Reset()

	module.Module
}

Directories

Path Synopsis
poa

Jump to

Keyboard shortcuts

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