Documentation ¶
Index ¶
- func ProtocolAddr() address.Address
- type Option
- type Protocol
- func (p *Protocol) ForceRegister(r *protocol.Registry) error
- func (p *Protocol) GetEpochHeight(epochNum uint64) uint64
- func (p *Protocol) GetEpochLastBlockHeight(epochNum uint64) uint64
- func (p *Protocol) GetEpochNum(height uint64) uint64
- func (p *Protocol) GetSubEpochNum(height uint64) uint64
- func (p *Protocol) Handle(context.Context, action.Action, protocol.StateManager) (*action.Receipt, error)
- func (p *Protocol) Name() string
- func (p *Protocol) NumCandidateDelegates() uint64
- func (p *Protocol) NumDelegates() uint64
- func (p *Protocol) NumSubEpochs(height uint64) uint64
- func (p *Protocol) ProductivityByEpoch(epochNum uint64, tipHeight uint64, ...) (uint64, map[string]uint64, error)
- func (p *Protocol) ReadState(ctx context.Context, sr protocol.StateReader, method []byte, args ...[]byte) ([]byte, uint64, error)
- func (p *Protocol) Register(r *protocol.Registry) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProtocolAddr ¶ added in v1.7.1
ProtocolAddr returns the address generated from protocol id
Types ¶
type Option ¶ added in v0.10.0
Option is optional setting for epoch protocol
func EnableDardanellesSubEpoch ¶ added in v0.10.0
EnableDardanellesSubEpoch will set give numSubEpochs at give height.
type Protocol ¶
type Protocol struct {
// contains filtered or unexported fields
}
Protocol defines an epoch protocol
func FindProtocol ¶ added in v0.11.0
FindProtocol return a registered protocol from registry
func MustGetProtocol ¶ added in v0.11.0
MustGetProtocol return a registered protocol from registry
func NewProtocol ¶
func NewProtocol(numCandidateDelegates, numDelegates, numSubEpochs uint64, opts ...Option) *Protocol
NewProtocol returns a new rolldpos protocol
func (*Protocol) ForceRegister ¶ added in v0.11.0
ForceRegister registers the protocol with a unique ID and force replacing the previous protocol if it exists
func (*Protocol) GetEpochHeight ¶
GetEpochHeight returns the start height of an epoch
func (*Protocol) GetEpochLastBlockHeight ¶
GetEpochLastBlockHeight returns the last height of an epoch
func (*Protocol) GetEpochNum ¶
GetEpochNum returns the number of the epoch for a given height
func (*Protocol) GetSubEpochNum ¶
GetSubEpochNum returns the sub epoch number of a block height
func (*Protocol) Handle ¶
func (p *Protocol) Handle(context.Context, action.Action, protocol.StateManager) (*action.Receipt, error)
Handle handles a modification
func (*Protocol) NumCandidateDelegates ¶
NumCandidateDelegates returns the number of delegate candidates for an epoch
func (*Protocol) NumDelegates ¶
NumDelegates returns the number of delegates in an epoch
func (*Protocol) NumSubEpochs ¶
NumSubEpochs returns the number of subEpochs given a block height
func (*Protocol) ProductivityByEpoch ¶ added in v1.0.0
func (p *Protocol) ProductivityByEpoch( epochNum uint64, tipHeight uint64, productivity func(uint64, uint64) (map[string]uint64, error), ) (uint64, map[string]uint64, error)
ProductivityByEpoch read the productivity in an epoch