Documentation ¶
Overview ¶
Package state is a generated GoMock package.
Package state is a generated GoMock package.
Package state is a generated GoMock package.
Index ¶
- Variables
- type Chain
- type CurrentStakers
- type Diff
- type MockStakerIterator
- type MockStakerIteratorMockRecorder
- type MockState
- func (m *MockState) AddChain(arg0 *txs.Tx)
- func (m *MockState) AddRewardUTXO(arg0 ids.ID, arg1 *avax.UTXO)
- func (m *MockState) AddSubnet(arg0 *txs.Tx)
- func (m *MockState) AddTx(arg0 *txs.Tx, arg1 status.Status)
- func (m *MockState) AddUTXO(arg0 *avax.UTXO)
- func (m *MockState) Close() error
- func (m *MockState) DeleteCurrentDelegator(arg0 *Staker)
- func (m *MockState) DeleteCurrentValidator(arg0 *Staker)
- func (m *MockState) DeletePendingDelegator(arg0 *Staker)
- func (m *MockState) DeletePendingValidator(arg0 *Staker)
- func (m *MockState) DeleteUTXO(arg0 ids.ID)
- func (m *MockState) DoneInit() error
- func (m *MockState) EXPECT() *MockStateMockRecorder
- func (m *MockState) GetChains(arg0 ids.ID) ([]*txs.Tx, error)
- func (m *MockState) GetCurrentDelegatorIterator(arg0 ids.ID, arg1 ids.NodeID) (StakerIterator, error)
- func (m *MockState) GetCurrentStakerIterator() (StakerIterator, error)
- func (m *MockState) GetCurrentSupply() uint64
- func (m *MockState) GetCurrentValidator(arg0 ids.ID, arg1 ids.NodeID) (*Staker, error)
- func (m *MockState) GetLastAccepted() ids.ID
- func (m *MockState) GetPendingDelegatorIterator(arg0 ids.ID, arg1 ids.NodeID) (StakerIterator, error)
- func (m *MockState) GetPendingStakerIterator() (StakerIterator, error)
- func (m *MockState) GetPendingValidator(arg0 ids.ID, arg1 ids.NodeID) (*Staker, error)
- func (m *MockState) GetRewardUTXOs(arg0 ids.ID) ([]*avax.UTXO, error)
- func (m *MockState) GetStartTime(arg0 ids.NodeID) (time.Time, error)
- func (m *MockState) GetSubnets() ([]*txs.Tx, error)
- func (m *MockState) GetTimestamp() time.Time
- func (m *MockState) GetTx(arg0 ids.ID) (*txs.Tx, status.Status, error)
- func (m *MockState) GetUTXO(arg0 ids.ID) (*avax.UTXO, error)
- func (m *MockState) GetUptime(arg0 ids.NodeID) (time.Duration, time.Time, error)
- func (m *MockState) GetValidatorWeightDiffs(arg0 uint64, arg1 ids.ID) (map[ids.NodeID]*ValidatorWeightDiff, error)
- func (m *MockState) Load() error
- func (m *MockState) PutCurrentDelegator(arg0 *Staker)
- func (m *MockState) PutCurrentValidator(arg0 *Staker)
- func (m *MockState) PutPendingDelegator(arg0 *Staker)
- func (m *MockState) PutPendingValidator(arg0 *Staker)
- func (m *MockState) SetCurrentSupply(arg0 uint64)
- func (m *MockState) SetLastAccepted(arg0 ids.ID)
- func (m *MockState) SetTimestamp(arg0 time.Time)
- func (m *MockState) SetUptime(arg0 ids.NodeID, arg1 time.Duration, arg2 time.Time) error
- func (m *MockState) ShouldInit() (bool, error)
- func (m *MockState) SyncGenesis(arg0 ids.ID, arg1 *genesis.State) error
- func (m *MockState) UTXOIDs(arg0 []byte, arg1 ids.ID, arg2 int) ([]ids.ID, error)
- func (m *MockState) ValidatorSet(arg0 ids.ID) (validators.Set, error)
- func (m *MockState) Write(arg0 uint64) error
- type MockStateMockRecorder
- func (mr *MockStateMockRecorder) AddChain(arg0 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) AddRewardUTXO(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) AddSubnet(arg0 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) AddTx(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) AddUTXO(arg0 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) Close() *gomock.Call
- func (mr *MockStateMockRecorder) DeleteCurrentDelegator(arg0 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) DeleteCurrentValidator(arg0 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) DeletePendingDelegator(arg0 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) DeletePendingValidator(arg0 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) DeleteUTXO(arg0 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) DoneInit() *gomock.Call
- func (mr *MockStateMockRecorder) GetChains(arg0 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) GetCurrentDelegatorIterator(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) GetCurrentStakerIterator() *gomock.Call
- func (mr *MockStateMockRecorder) GetCurrentSupply() *gomock.Call
- func (mr *MockStateMockRecorder) GetCurrentValidator(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) GetLastAccepted() *gomock.Call
- func (mr *MockStateMockRecorder) GetPendingDelegatorIterator(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) GetPendingStakerIterator() *gomock.Call
- func (mr *MockStateMockRecorder) GetPendingValidator(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) GetRewardUTXOs(arg0 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) GetStartTime(arg0 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) GetSubnets() *gomock.Call
- func (mr *MockStateMockRecorder) GetTimestamp() *gomock.Call
- func (mr *MockStateMockRecorder) GetTx(arg0 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) GetUTXO(arg0 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) GetUptime(arg0 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) GetValidatorWeightDiffs(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) Load() *gomock.Call
- func (mr *MockStateMockRecorder) PutCurrentDelegator(arg0 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) PutCurrentValidator(arg0 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) PutPendingDelegator(arg0 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) PutPendingValidator(arg0 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) SetCurrentSupply(arg0 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) SetLastAccepted(arg0 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) SetTimestamp(arg0 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) SetUptime(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) ShouldInit() *gomock.Call
- func (mr *MockStateMockRecorder) SyncGenesis(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) UTXOIDs(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) ValidatorSet(arg0 interface{}) *gomock.Call
- func (mr *MockStateMockRecorder) Write(arg0 interface{}) *gomock.Call
- type MockVersions
- type MockVersionsMockRecorder
- type PendingStakers
- type Priority
- type Staker
- type StakerDiffIterator
- type StakerIterator
- type Stakers
- type State
- type UTXOAdder
- type UTXODeleter
- type UTXOGetter
- type ValidatorWeightDiff
- type Versions
Constants ¶
This section is empty.
Variables ¶
var (
ErrDelegatorSubset = errors.New("delegator's time range must be a subset of the validator's time range")
)
var PendingToCurrentPriorities = []Priority{ PrimaryNetworkValidatorPendingPriority: PrimaryNetworkValidatorCurrentPriority, PrimaryNetworkDelegatorPendingPriority: PrimaryNetworkDelegatorCurrentPriority, SubnetValidatorPendingPriority: SubnetValidatorCurrentPriority, SubnetDelegatorPendingPriority: SubnetDelegatorCurrentPriority, }
Functions ¶
This section is empty.
Types ¶
type Chain ¶
type Chain interface { Stakers UTXOAdder UTXOGetter UTXODeleter GetTimestamp() time.Time SetTimestamp(tm time.Time) GetCurrentSupply() uint64 SetCurrentSupply(cs uint64) GetRewardUTXOs(txID ids.ID) ([]*avax.UTXO, error) AddRewardUTXO(txID ids.ID, utxo *avax.UTXO) GetSubnets() ([]*txs.Tx, error) AddSubnet(createSubnetTx *txs.Tx) GetChains(subnetID ids.ID) ([]*txs.Tx, error) AddChain(createChainTx *txs.Tx) GetTx(txID ids.ID) (*txs.Tx, status.Status, error) AddTx(tx *txs.Tx, status status.Status) }
Chain collects all methods to manage the state of the chain for block execution.
type CurrentStakers ¶
type CurrentStakers interface { // GetCurrentValidator returns the [staker] describing the validator on // [subnetID] with [nodeID]. If the validator does not exist, // [database.ErrNotFound] is returned. GetCurrentValidator(subnetID ids.ID, nodeID ids.NodeID) (*Staker, error) // PutCurrentValidator adds the [staker] describing a validator to the // staker set. PutCurrentValidator(staker *Staker) // DeleteCurrentValidator removes the [staker] describing a validator from // the staker set. DeleteCurrentValidator(staker *Staker) // GetCurrentDelegatorIterator returns the delegators associated with the // validator on [subnetID] with [nodeID]. Delegators are sorted by their // removal from current staker set. GetCurrentDelegatorIterator(subnetID ids.ID, nodeID ids.NodeID) (StakerIterator, error) // PutCurrentDelegator adds the [staker] describing a delegator to the // staker set. PutCurrentDelegator(staker *Staker) // DeleteCurrentDelegator removes the [staker] describing a delegator from // the staker set. DeleteCurrentDelegator(staker *Staker) // GetCurrentStakerIterator returns stakers in order of their removal from // the current staker set. GetCurrentStakerIterator() (StakerIterator, error) }
type MockStakerIterator ¶ added in v1.7.15
type MockStakerIterator struct {
// contains filtered or unexported fields
}
MockStakerIterator is a mock of StakerIterator interface
func NewMockStakerIterator ¶ added in v1.7.15
func NewMockStakerIterator(ctrl *gomock.Controller) *MockStakerIterator
NewMockStakerIterator creates a new mock instance
func (*MockStakerIterator) EXPECT ¶ added in v1.7.15
func (m *MockStakerIterator) EXPECT() *MockStakerIteratorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockStakerIterator) Next ¶ added in v1.7.15
func (m *MockStakerIterator) Next() bool
Next mocks base method
func (*MockStakerIterator) Release ¶ added in v1.7.15
func (m *MockStakerIterator) Release()
Release mocks base method
func (*MockStakerIterator) Value ¶ added in v1.7.15
func (m *MockStakerIterator) Value() *Staker
Value mocks base method
type MockStakerIteratorMockRecorder ¶ added in v1.7.15
type MockStakerIteratorMockRecorder struct {
// contains filtered or unexported fields
}
MockStakerIteratorMockRecorder is the mock recorder for MockStakerIterator
func (*MockStakerIteratorMockRecorder) Next ¶ added in v1.7.15
func (mr *MockStakerIteratorMockRecorder) Next() *gomock.Call
Next indicates an expected call of Next
func (*MockStakerIteratorMockRecorder) Release ¶ added in v1.7.15
func (mr *MockStakerIteratorMockRecorder) Release() *gomock.Call
Release indicates an expected call of Release
func (*MockStakerIteratorMockRecorder) Value ¶ added in v1.7.15
func (mr *MockStakerIteratorMockRecorder) Value() *gomock.Call
Value indicates an expected call of Value
type MockState ¶ added in v1.7.15
type MockState struct {
// contains filtered or unexported fields
}
MockState is a mock of State interface
func NewMockState ¶ added in v1.7.15
func NewMockState(ctrl *gomock.Controller) *MockState
NewMockState creates a new mock instance
func (*MockState) AddRewardUTXO ¶ added in v1.7.15
AddRewardUTXO mocks base method
func (*MockState) DeleteCurrentDelegator ¶ added in v1.7.15
DeleteCurrentDelegator mocks base method
func (*MockState) DeleteCurrentValidator ¶ added in v1.7.15
DeleteCurrentValidator mocks base method
func (*MockState) DeletePendingDelegator ¶ added in v1.7.15
DeletePendingDelegator mocks base method
func (*MockState) DeletePendingValidator ¶ added in v1.7.15
DeletePendingValidator mocks base method
func (*MockState) DeleteUTXO ¶ added in v1.7.15
DeleteUTXO mocks base method
func (*MockState) EXPECT ¶ added in v1.7.15
func (m *MockState) EXPECT() *MockStateMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockState) GetCurrentDelegatorIterator ¶ added in v1.7.15
func (m *MockState) GetCurrentDelegatorIterator(arg0 ids.ID, arg1 ids.NodeID) (StakerIterator, error)
GetCurrentDelegatorIterator mocks base method
func (*MockState) GetCurrentStakerIterator ¶ added in v1.7.15
func (m *MockState) GetCurrentStakerIterator() (StakerIterator, error)
GetCurrentStakerIterator mocks base method
func (*MockState) GetCurrentSupply ¶ added in v1.7.15
GetCurrentSupply mocks base method
func (*MockState) GetCurrentValidator ¶ added in v1.7.15
GetCurrentValidator mocks base method
func (*MockState) GetLastAccepted ¶ added in v1.7.15
GetLastAccepted mocks base method
func (*MockState) GetPendingDelegatorIterator ¶ added in v1.7.15
func (m *MockState) GetPendingDelegatorIterator(arg0 ids.ID, arg1 ids.NodeID) (StakerIterator, error)
GetPendingDelegatorIterator mocks base method
func (*MockState) GetPendingStakerIterator ¶ added in v1.7.15
func (m *MockState) GetPendingStakerIterator() (StakerIterator, error)
GetPendingStakerIterator mocks base method
func (*MockState) GetPendingValidator ¶ added in v1.7.15
GetPendingValidator mocks base method
func (*MockState) GetRewardUTXOs ¶ added in v1.7.15
GetRewardUTXOs mocks base method
func (*MockState) GetStartTime ¶ added in v1.7.15
GetStartTime mocks base method
func (*MockState) GetSubnets ¶ added in v1.7.15
GetSubnets mocks base method
func (*MockState) GetTimestamp ¶ added in v1.7.15
GetTimestamp mocks base method
func (*MockState) GetValidatorWeightDiffs ¶ added in v1.7.15
func (m *MockState) GetValidatorWeightDiffs(arg0 uint64, arg1 ids.ID) (map[ids.NodeID]*ValidatorWeightDiff, error)
GetValidatorWeightDiffs mocks base method
func (*MockState) PutCurrentDelegator ¶ added in v1.7.15
PutCurrentDelegator mocks base method
func (*MockState) PutCurrentValidator ¶ added in v1.7.15
PutCurrentValidator mocks base method
func (*MockState) PutPendingDelegator ¶ added in v1.7.15
PutPendingDelegator mocks base method
func (*MockState) PutPendingValidator ¶ added in v1.7.15
PutPendingValidator mocks base method
func (*MockState) SetCurrentSupply ¶ added in v1.7.15
SetCurrentSupply mocks base method
func (*MockState) SetLastAccepted ¶ added in v1.7.15
SetLastAccepted mocks base method
func (*MockState) SetTimestamp ¶ added in v1.7.15
SetTimestamp mocks base method
func (*MockState) ShouldInit ¶ added in v1.7.15
ShouldInit mocks base method
func (*MockState) SyncGenesis ¶ added in v1.7.15
SyncGenesis mocks base method
func (*MockState) ValidatorSet ¶ added in v1.7.15
ValidatorSet mocks base method
type MockStateMockRecorder ¶ added in v1.7.15
type MockStateMockRecorder struct {
// contains filtered or unexported fields
}
MockStateMockRecorder is the mock recorder for MockState
func (*MockStateMockRecorder) AddChain ¶ added in v1.7.15
func (mr *MockStateMockRecorder) AddChain(arg0 interface{}) *gomock.Call
AddChain indicates an expected call of AddChain
func (*MockStateMockRecorder) AddRewardUTXO ¶ added in v1.7.15
func (mr *MockStateMockRecorder) AddRewardUTXO(arg0, arg1 interface{}) *gomock.Call
AddRewardUTXO indicates an expected call of AddRewardUTXO
func (*MockStateMockRecorder) AddSubnet ¶ added in v1.7.15
func (mr *MockStateMockRecorder) AddSubnet(arg0 interface{}) *gomock.Call
AddSubnet indicates an expected call of AddSubnet
func (*MockStateMockRecorder) AddTx ¶ added in v1.7.15
func (mr *MockStateMockRecorder) AddTx(arg0, arg1 interface{}) *gomock.Call
AddTx indicates an expected call of AddTx
func (*MockStateMockRecorder) AddUTXO ¶ added in v1.7.15
func (mr *MockStateMockRecorder) AddUTXO(arg0 interface{}) *gomock.Call
AddUTXO indicates an expected call of AddUTXO
func (*MockStateMockRecorder) Close ¶ added in v1.7.15
func (mr *MockStateMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close
func (*MockStateMockRecorder) DeleteCurrentDelegator ¶ added in v1.7.15
func (mr *MockStateMockRecorder) DeleteCurrentDelegator(arg0 interface{}) *gomock.Call
DeleteCurrentDelegator indicates an expected call of DeleteCurrentDelegator
func (*MockStateMockRecorder) DeleteCurrentValidator ¶ added in v1.7.15
func (mr *MockStateMockRecorder) DeleteCurrentValidator(arg0 interface{}) *gomock.Call
DeleteCurrentValidator indicates an expected call of DeleteCurrentValidator
func (*MockStateMockRecorder) DeletePendingDelegator ¶ added in v1.7.15
func (mr *MockStateMockRecorder) DeletePendingDelegator(arg0 interface{}) *gomock.Call
DeletePendingDelegator indicates an expected call of DeletePendingDelegator
func (*MockStateMockRecorder) DeletePendingValidator ¶ added in v1.7.15
func (mr *MockStateMockRecorder) DeletePendingValidator(arg0 interface{}) *gomock.Call
DeletePendingValidator indicates an expected call of DeletePendingValidator
func (*MockStateMockRecorder) DeleteUTXO ¶ added in v1.7.15
func (mr *MockStateMockRecorder) DeleteUTXO(arg0 interface{}) *gomock.Call
DeleteUTXO indicates an expected call of DeleteUTXO
func (*MockStateMockRecorder) DoneInit ¶ added in v1.7.15
func (mr *MockStateMockRecorder) DoneInit() *gomock.Call
DoneInit indicates an expected call of DoneInit
func (*MockStateMockRecorder) GetChains ¶ added in v1.7.15
func (mr *MockStateMockRecorder) GetChains(arg0 interface{}) *gomock.Call
GetChains indicates an expected call of GetChains
func (*MockStateMockRecorder) GetCurrentDelegatorIterator ¶ added in v1.7.15
func (mr *MockStateMockRecorder) GetCurrentDelegatorIterator(arg0, arg1 interface{}) *gomock.Call
GetCurrentDelegatorIterator indicates an expected call of GetCurrentDelegatorIterator
func (*MockStateMockRecorder) GetCurrentStakerIterator ¶ added in v1.7.15
func (mr *MockStateMockRecorder) GetCurrentStakerIterator() *gomock.Call
GetCurrentStakerIterator indicates an expected call of GetCurrentStakerIterator
func (*MockStateMockRecorder) GetCurrentSupply ¶ added in v1.7.15
func (mr *MockStateMockRecorder) GetCurrentSupply() *gomock.Call
GetCurrentSupply indicates an expected call of GetCurrentSupply
func (*MockStateMockRecorder) GetCurrentValidator ¶ added in v1.7.15
func (mr *MockStateMockRecorder) GetCurrentValidator(arg0, arg1 interface{}) *gomock.Call
GetCurrentValidator indicates an expected call of GetCurrentValidator
func (*MockStateMockRecorder) GetLastAccepted ¶ added in v1.7.15
func (mr *MockStateMockRecorder) GetLastAccepted() *gomock.Call
GetLastAccepted indicates an expected call of GetLastAccepted
func (*MockStateMockRecorder) GetPendingDelegatorIterator ¶ added in v1.7.15
func (mr *MockStateMockRecorder) GetPendingDelegatorIterator(arg0, arg1 interface{}) *gomock.Call
GetPendingDelegatorIterator indicates an expected call of GetPendingDelegatorIterator
func (*MockStateMockRecorder) GetPendingStakerIterator ¶ added in v1.7.15
func (mr *MockStateMockRecorder) GetPendingStakerIterator() *gomock.Call
GetPendingStakerIterator indicates an expected call of GetPendingStakerIterator
func (*MockStateMockRecorder) GetPendingValidator ¶ added in v1.7.15
func (mr *MockStateMockRecorder) GetPendingValidator(arg0, arg1 interface{}) *gomock.Call
GetPendingValidator indicates an expected call of GetPendingValidator
func (*MockStateMockRecorder) GetRewardUTXOs ¶ added in v1.7.15
func (mr *MockStateMockRecorder) GetRewardUTXOs(arg0 interface{}) *gomock.Call
GetRewardUTXOs indicates an expected call of GetRewardUTXOs
func (*MockStateMockRecorder) GetStartTime ¶ added in v1.7.15
func (mr *MockStateMockRecorder) GetStartTime(arg0 interface{}) *gomock.Call
GetStartTime indicates an expected call of GetStartTime
func (*MockStateMockRecorder) GetSubnets ¶ added in v1.7.15
func (mr *MockStateMockRecorder) GetSubnets() *gomock.Call
GetSubnets indicates an expected call of GetSubnets
func (*MockStateMockRecorder) GetTimestamp ¶ added in v1.7.15
func (mr *MockStateMockRecorder) GetTimestamp() *gomock.Call
GetTimestamp indicates an expected call of GetTimestamp
func (*MockStateMockRecorder) GetTx ¶ added in v1.7.15
func (mr *MockStateMockRecorder) GetTx(arg0 interface{}) *gomock.Call
GetTx indicates an expected call of GetTx
func (*MockStateMockRecorder) GetUTXO ¶ added in v1.7.15
func (mr *MockStateMockRecorder) GetUTXO(arg0 interface{}) *gomock.Call
GetUTXO indicates an expected call of GetUTXO
func (*MockStateMockRecorder) GetUptime ¶ added in v1.7.15
func (mr *MockStateMockRecorder) GetUptime(arg0 interface{}) *gomock.Call
GetUptime indicates an expected call of GetUptime
func (*MockStateMockRecorder) GetValidatorWeightDiffs ¶ added in v1.7.15
func (mr *MockStateMockRecorder) GetValidatorWeightDiffs(arg0, arg1 interface{}) *gomock.Call
GetValidatorWeightDiffs indicates an expected call of GetValidatorWeightDiffs
func (*MockStateMockRecorder) Load ¶ added in v1.7.15
func (mr *MockStateMockRecorder) Load() *gomock.Call
Load indicates an expected call of Load
func (*MockStateMockRecorder) PutCurrentDelegator ¶ added in v1.7.15
func (mr *MockStateMockRecorder) PutCurrentDelegator(arg0 interface{}) *gomock.Call
PutCurrentDelegator indicates an expected call of PutCurrentDelegator
func (*MockStateMockRecorder) PutCurrentValidator ¶ added in v1.7.15
func (mr *MockStateMockRecorder) PutCurrentValidator(arg0 interface{}) *gomock.Call
PutCurrentValidator indicates an expected call of PutCurrentValidator
func (*MockStateMockRecorder) PutPendingDelegator ¶ added in v1.7.15
func (mr *MockStateMockRecorder) PutPendingDelegator(arg0 interface{}) *gomock.Call
PutPendingDelegator indicates an expected call of PutPendingDelegator
func (*MockStateMockRecorder) PutPendingValidator ¶ added in v1.7.15
func (mr *MockStateMockRecorder) PutPendingValidator(arg0 interface{}) *gomock.Call
PutPendingValidator indicates an expected call of PutPendingValidator
func (*MockStateMockRecorder) SetCurrentSupply ¶ added in v1.7.15
func (mr *MockStateMockRecorder) SetCurrentSupply(arg0 interface{}) *gomock.Call
SetCurrentSupply indicates an expected call of SetCurrentSupply
func (*MockStateMockRecorder) SetLastAccepted ¶ added in v1.7.15
func (mr *MockStateMockRecorder) SetLastAccepted(arg0 interface{}) *gomock.Call
SetLastAccepted indicates an expected call of SetLastAccepted
func (*MockStateMockRecorder) SetTimestamp ¶ added in v1.7.15
func (mr *MockStateMockRecorder) SetTimestamp(arg0 interface{}) *gomock.Call
SetTimestamp indicates an expected call of SetTimestamp
func (*MockStateMockRecorder) SetUptime ¶ added in v1.7.15
func (mr *MockStateMockRecorder) SetUptime(arg0, arg1, arg2 interface{}) *gomock.Call
SetUptime indicates an expected call of SetUptime
func (*MockStateMockRecorder) ShouldInit ¶ added in v1.7.15
func (mr *MockStateMockRecorder) ShouldInit() *gomock.Call
ShouldInit indicates an expected call of ShouldInit
func (*MockStateMockRecorder) SyncGenesis ¶ added in v1.7.15
func (mr *MockStateMockRecorder) SyncGenesis(arg0, arg1 interface{}) *gomock.Call
SyncGenesis indicates an expected call of SyncGenesis
func (*MockStateMockRecorder) UTXOIDs ¶ added in v1.7.15
func (mr *MockStateMockRecorder) UTXOIDs(arg0, arg1, arg2 interface{}) *gomock.Call
UTXOIDs indicates an expected call of UTXOIDs
func (*MockStateMockRecorder) ValidatorSet ¶ added in v1.7.15
func (mr *MockStateMockRecorder) ValidatorSet(arg0 interface{}) *gomock.Call
ValidatorSet indicates an expected call of ValidatorSet
func (*MockStateMockRecorder) Write ¶ added in v1.7.15
func (mr *MockStateMockRecorder) Write(arg0 interface{}) *gomock.Call
Write indicates an expected call of Write
type MockVersions ¶ added in v1.7.15
type MockVersions struct {
// contains filtered or unexported fields
}
MockVersions is a mock of Versions interface
func NewMockVersions ¶ added in v1.7.15
func NewMockVersions(ctrl *gomock.Controller) *MockVersions
NewMockVersions creates a new mock instance
func (*MockVersions) DeleteState ¶ added in v1.7.15
func (m *MockVersions) DeleteState(arg0 ids.ID)
DeleteState mocks base method
func (*MockVersions) EXPECT ¶ added in v1.7.15
func (m *MockVersions) EXPECT() *MockVersionsMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockVersionsMockRecorder ¶ added in v1.7.15
type MockVersionsMockRecorder struct {
// contains filtered or unexported fields
}
MockVersionsMockRecorder is the mock recorder for MockVersions
func (*MockVersionsMockRecorder) DeleteState ¶ added in v1.7.15
func (mr *MockVersionsMockRecorder) DeleteState(arg0 interface{}) *gomock.Call
DeleteState indicates an expected call of DeleteState
func (*MockVersionsMockRecorder) GetState ¶ added in v1.7.15
func (mr *MockVersionsMockRecorder) GetState(arg0 interface{}) *gomock.Call
GetState indicates an expected call of GetState
func (*MockVersionsMockRecorder) SetState ¶ added in v1.7.15
func (mr *MockVersionsMockRecorder) SetState(arg0, arg1 interface{}) *gomock.Call
SetState indicates an expected call of SetState
type PendingStakers ¶
type PendingStakers interface { // GetPendingValidator returns the Staker describing the validator on // [subnetID] with [nodeID]. If the validator does not exist, // [database.ErrNotFound] is returned. GetPendingValidator(subnetID ids.ID, nodeID ids.NodeID) (*Staker, error) // PutPendingValidator adds the [staker] describing a validator to the // staker set. PutPendingValidator(staker *Staker) // DeletePendingValidator removes the [staker] describing a validator from // the staker set. DeletePendingValidator(staker *Staker) // GetPendingDelegatorIterator returns the delegators associated with the // validator on [subnetID] with [nodeID]. Delegators are sorted by their // removal from pending staker set. GetPendingDelegatorIterator(subnetID ids.ID, nodeID ids.NodeID) (StakerIterator, error) // PutPendingDelegator adds the [staker] describing a delegator to the // staker set. PutPendingDelegator(staker *Staker) // DeletePendingDelegator removes the [staker] describing a delegator from // the staker set. DeletePendingDelegator(staker *Staker) // GetPendingStakerIterator returns stakers in order of their removal from // the pending staker set. GetPendingStakerIterator() (StakerIterator, error) }
type Priority ¶ added in v1.7.15
type Priority byte
const ( // First subnet delegators are removed from the current validator set, SubnetDelegatorCurrentPriority Priority = iota + 1 // then subnet validators, SubnetValidatorCurrentPriority // then primary network delegators, PrimaryNetworkDelegatorCurrentPriority // then primary network validators. PrimaryNetworkValidatorCurrentPriority )
const ( // First primary network delegators are moved from the pending to the // current validator set, PrimaryNetworkDelegatorPendingPriority Priority = iota + 1 // then primary network validators, PrimaryNetworkValidatorPendingPriority // then subnet validators, SubnetValidatorPendingPriority // then subnet delegators. SubnetDelegatorPendingPriority )
type Staker ¶ added in v1.7.15
type Staker struct { TxID ids.ID NodeID ids.NodeID SubnetID ids.ID Weight uint64 StartTime time.Time EndTime time.Time PotentialReward uint64 // NextTime is the next time this staker will be moved from a validator set. // If the staker is in the pending validator set, NextTime will equal // StartTime. If the staker is in the current validator set, NextTime will // equal EndTime. NextTime time.Time // Priority specifies how to break ties between stakers with the same // NextTime. This ensures that stakers created by the same transaction type // are grouped together. The ordering of these groups is documented in // [priorities.go] and depends on if the stakers are in the pending or // current validator set. Priority Priority }
Staker contains all information required to represent a validator or delegator in the current and pending validator sets.
func NewPrimaryNetworkStaker ¶ added in v1.7.15
func NewSubnetStaker ¶ added in v1.7.15
func NewSubnetStaker(txID ids.ID, vdr *validator.SubnetValidator) *Staker
func (*Staker) Less ¶ added in v1.7.15
A *Staker is considered to be less than another *Staker when:
- If its NextTime is before the other's.
- If the NextTimes are the same, the *Staker with the lesser priority is the lesser one.
- If the priorities are also the same, the one with the lesser txID is lesser.
Invariant: [thanIntf] is a *Staker.
type StakerDiffIterator ¶ added in v1.7.15
type StakerDiffIterator interface { Next() bool // Returns: // - The staker that is changing // - True if the staker is being added to the current staker set, false if // the staker is being removed from the current staker set Value() (*Staker, bool) Release() }
StakerDiffIterator is an iterator that iterates over the events that will be performed on the current staker set.
There are two event types affecting current staker set, removal of an existing staker and addition of a new staker from the pending set.
The ordering of operations is:
- Staker operations are performed in order of their [NextTime].
- If operations have the same [NextTime], stakers are first added to the current staker set, then removed.
- Further ties are broken by *Staker.Less(), returning the lesser staker first.
func NewStakerDiffIterator ¶ added in v1.7.15
func NewStakerDiffIterator(currentIterator, pendingIterator StakerIterator) StakerDiffIterator
type StakerIterator ¶ added in v1.7.15
type StakerIterator interface { // Next attempts to move the iterator to the next staker. It returns false // once there are no more stakers to return. Next() bool // Value returns the current staker. Value should only be called after a // call to Next which returned true. Value() *Staker // Release any resources associated with the iterator. This must be called // after the interator is no longer needed. Release() }
StakerIterator defines an interface for iterating over a set of stakers.
var EmptyIterator StakerIterator = emptyIterator{}
EmptyIterator contains no stakers.
func NewMaskedIterator ¶ added in v1.7.15
func NewMaskedIterator(parentIterator StakerIterator, maskedStakers map[ids.ID]*Staker) StakerIterator
NewMaskedIterator returns a new iterator that skips the stakers in [parentIterator] that are present in [maskedStakers].
func NewMergedIterator ¶ added in v1.7.15
func NewMergedIterator(stakers ...StakerIterator) StakerIterator
Returns an iterator that returns all of the elements of [stakers] in order.
func NewTreeIterator ¶ added in v1.7.15
func NewTreeIterator(tree *btree.BTree) StakerIterator
NewTreeIterator returns a new iterator of the stakers in [tree] in ascending order.
type Stakers ¶
type Stakers interface { CurrentStakers PendingStakers }
type State ¶
type State interface { Chain uptime.State avax.UTXOReader // TODO: remove ShouldInit and DoneInit and perform them in New ShouldInit() (bool, error) DoneInit() error GetLastAccepted() ids.ID SetLastAccepted(ids.ID) GetValidatorWeightDiffs(height uint64, subnetID ids.ID) (map[ids.NodeID]*ValidatorWeightDiff, error) // Return the current validator set of [subnetID]. ValidatorSet(subnetID ids.ID) (validators.Set, error) // SyncGenesis initializes the state with the genesis state. SyncGenesis(genesisBlkID ids.ID, genesisState *genesis.State) error // Load pulls data previously stored on disk that is expected to be in // memory. Load() error Write(height uint64) error Close() error }
func New ¶
func New( baseDB database.Database, metrics prometheus.Registerer, cfg *config.Config, ctx *snow.Context, localStake prometheus.Gauge, totalStake prometheus.Gauge, rewards reward.Calculator, ) (State, error)