Documentation ¶
Overview ¶
Package eligibility is a generated GoMock package.
nolint
Index ¶
- Constants
- Variables
- func GenVRF(ctx context.Context, signer *signing.VRFSigner, beacon types.Beacon, ...) types.VrfSignature
- type Config
- type MockRolacle
- func (m *MockRolacle) CalcEligibility(arg0 context.Context, arg1 types.LayerID, arg2 uint32, arg3 int, ...) (uint16, error)
- func (m *MockRolacle) EXPECT() *MockRolacleMockRecorder
- func (m *MockRolacle) Proof(arg0 context.Context, arg1 *signing.VRFSigner, arg2 types.LayerID, arg3 uint32) (types.VrfSignature, error)
- func (m *MockRolacle) Validate(arg0 context.Context, arg1 types.LayerID, arg2 uint32, arg3 int, ...) (bool, error)
- type MockRolacleCalcEligibilityCall
- type MockRolacleMockRecorder
- func (mr *MockRolacleMockRecorder) CalcEligibility(arg0, arg1, arg2, arg3, arg4, arg5 any) *MockRolacleCalcEligibilityCall
- func (mr *MockRolacleMockRecorder) Proof(arg0, arg1, arg2, arg3 any) *MockRolacleProofCall
- func (mr *MockRolacleMockRecorder) Validate(arg0, arg1, arg2, arg3, arg4, arg5, arg6 any) *MockRolacleValidateCall
- type MockRolacleProofCall
- type MockRolacleValidateCall
- type MockactiveSetCache
- type MockactiveSetCacheAddCall
- func (c *MockactiveSetCacheAddCall) Do(f func(types.EpochID, *cachedActiveSet) bool) *MockactiveSetCacheAddCall
- func (c *MockactiveSetCacheAddCall) DoAndReturn(f func(types.EpochID, *cachedActiveSet) bool) *MockactiveSetCacheAddCall
- func (c *MockactiveSetCacheAddCall) Return(evicted bool) *MockactiveSetCacheAddCall
- type MockactiveSetCacheGetCall
- func (c *MockactiveSetCacheGetCall) Do(f func(types.EpochID) (*cachedActiveSet, bool)) *MockactiveSetCacheGetCall
- func (c *MockactiveSetCacheGetCall) DoAndReturn(f func(types.EpochID) (*cachedActiveSet, bool)) *MockactiveSetCacheGetCall
- func (c *MockactiveSetCacheGetCall) Return(value *cachedActiveSet, ok bool) *MockactiveSetCacheGetCall
- type MockactiveSetCacheMockRecorder
- type MockvrfVerifier
- type MockvrfVerifierMockRecorder
- type MockvrfVerifierVerifyCall
- func (c *MockvrfVerifierVerifyCall) Do(f func(types.NodeID, []byte, types.VrfSignature) bool) *MockvrfVerifierVerifyCall
- func (c *MockvrfVerifierVerifyCall) DoAndReturn(f func(types.NodeID, []byte, types.VrfSignature) bool) *MockvrfVerifierVerifyCall
- func (c *MockvrfVerifierVerifyCall) Return(arg0 bool) *MockvrfVerifierVerifyCall
- type Opt
- type Oracle
- func (o *Oracle) ActiveSet(ctx context.Context, targetEpoch types.EpochID) ([]types.ATXID, error)
- func (o *Oracle) CalcEligibility(ctx context.Context, layer types.LayerID, round uint32, committeeSize int, ...) (uint16, error)
- func (o *Oracle) IsIdentityActiveOnConsensusView(ctx context.Context, edID types.NodeID, layer types.LayerID) (bool, error)
- func (o *Oracle) Proof(ctx context.Context, signer *signing.VRFSigner, layer types.LayerID, ...) (types.VrfSignature, error)
- func (o *Oracle) SetSync(sync system.SyncStateProvider)
- func (o *Oracle) UpdateActiveSet(epoch types.EpochID, activeSet []types.ATXID)
- func (o *Oracle) Validate(ctx context.Context, layer types.LayerID, round uint32, committeeSize int, ...) (bool, error)
- type Rolacle
- type VrfMessage
Constants ¶
const ( // CertifyRound is not part of the hare protocol, but it shares the same oracle for eligibility. CertifyRound uint32 = math.MaxUint32 >> 1 )
Variables ¶
var (
ErrNotActive = errors.New("oracle: miner is not active in epoch")
)
Functions ¶
Types ¶
type Config ¶
type Config struct { // ConfidenceParam specifies how many layers into the epoch hare uses active set generated in the previous epoch. // For example, if epoch size is 100 and confidence is 10 hare will use previous active set for layers 0-9 // and then generate a new activeset. // // This was done like that so that we have higher `confidence` that hare will succeed atleast // once during this interval. If it doesn't we have to provide centralized fallback. ConfidenceParam uint32 `mapstructure:"eligibility-confidence-param"` }
Config is the configuration of the oracle package.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default configuration for the oracle package.
func (*Config) MarshalLogObject ¶
func (c *Config) MarshalLogObject(encoder zapcore.ObjectEncoder) error
type MockRolacle ¶
type MockRolacle struct {
// contains filtered or unexported fields
}
MockRolacle is a mock of Rolacle interface.
func NewMockRolacle ¶
func NewMockRolacle(ctrl *gomock.Controller) *MockRolacle
NewMockRolacle creates a new mock instance.
func (*MockRolacle) CalcEligibility ¶
func (m *MockRolacle) CalcEligibility(arg0 context.Context, arg1 types.LayerID, arg2 uint32, arg3 int, arg4 types.NodeID, arg5 types.VrfSignature) (uint16, error)
CalcEligibility mocks base method.
func (*MockRolacle) EXPECT ¶
func (m *MockRolacle) EXPECT() *MockRolacleMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockRolacleCalcEligibilityCall ¶
MockRolacleCalcEligibilityCall wrap *gomock.Call
func (*MockRolacleCalcEligibilityCall) Do ¶
func (c *MockRolacleCalcEligibilityCall) Do(f func(context.Context, types.LayerID, uint32, int, types.NodeID, types.VrfSignature) (uint16, error)) *MockRolacleCalcEligibilityCall
Do rewrite *gomock.Call.Do
func (*MockRolacleCalcEligibilityCall) DoAndReturn ¶
func (c *MockRolacleCalcEligibilityCall) DoAndReturn(f func(context.Context, types.LayerID, uint32, int, types.NodeID, types.VrfSignature) (uint16, error)) *MockRolacleCalcEligibilityCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockRolacleCalcEligibilityCall) Return ¶
func (c *MockRolacleCalcEligibilityCall) Return(arg0 uint16, arg1 error) *MockRolacleCalcEligibilityCall
Return rewrite *gomock.Call.Return
type MockRolacleMockRecorder ¶
type MockRolacleMockRecorder struct {
// contains filtered or unexported fields
}
MockRolacleMockRecorder is the mock recorder for MockRolacle.
func (*MockRolacleMockRecorder) CalcEligibility ¶
func (mr *MockRolacleMockRecorder) CalcEligibility(arg0, arg1, arg2, arg3, arg4, arg5 any) *MockRolacleCalcEligibilityCall
CalcEligibility indicates an expected call of CalcEligibility.
func (*MockRolacleMockRecorder) Proof ¶
func (mr *MockRolacleMockRecorder) Proof(arg0, arg1, arg2, arg3 any) *MockRolacleProofCall
Proof indicates an expected call of Proof.
func (*MockRolacleMockRecorder) Validate ¶
func (mr *MockRolacleMockRecorder) Validate(arg0, arg1, arg2, arg3, arg4, arg5, arg6 any) *MockRolacleValidateCall
Validate indicates an expected call of Validate.
type MockRolacleProofCall ¶
MockRolacleProofCall wrap *gomock.Call
func (*MockRolacleProofCall) Do ¶
func (c *MockRolacleProofCall) Do(f func(context.Context, *signing.VRFSigner, types.LayerID, uint32) (types.VrfSignature, error)) *MockRolacleProofCall
Do rewrite *gomock.Call.Do
func (*MockRolacleProofCall) DoAndReturn ¶
func (c *MockRolacleProofCall) DoAndReturn(f func(context.Context, *signing.VRFSigner, types.LayerID, uint32) (types.VrfSignature, error)) *MockRolacleProofCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockRolacleProofCall) Return ¶
func (c *MockRolacleProofCall) Return(arg0 types.VrfSignature, arg1 error) *MockRolacleProofCall
Return rewrite *gomock.Call.Return
type MockRolacleValidateCall ¶
MockRolacleValidateCall wrap *gomock.Call
func (*MockRolacleValidateCall) Do ¶
func (c *MockRolacleValidateCall) Do(f func(context.Context, types.LayerID, uint32, int, types.NodeID, types.VrfSignature, uint16) (bool, error)) *MockRolacleValidateCall
Do rewrite *gomock.Call.Do
func (*MockRolacleValidateCall) DoAndReturn ¶
func (c *MockRolacleValidateCall) DoAndReturn(f func(context.Context, types.LayerID, uint32, int, types.NodeID, types.VrfSignature, uint16) (bool, error)) *MockRolacleValidateCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockRolacleValidateCall) Return ¶
func (c *MockRolacleValidateCall) Return(arg0 bool, arg1 error) *MockRolacleValidateCall
Return rewrite *gomock.Call.Return
type MockactiveSetCache ¶
type MockactiveSetCache struct {
// contains filtered or unexported fields
}
MockactiveSetCache is a mock of activeSetCache interface.
func NewMockactiveSetCache ¶
func NewMockactiveSetCache(ctrl *gomock.Controller) *MockactiveSetCache
NewMockactiveSetCache creates a new mock instance.
func (*MockactiveSetCache) Add ¶
func (m *MockactiveSetCache) Add(key types.EpochID, value *cachedActiveSet) bool
Add mocks base method.
func (*MockactiveSetCache) EXPECT ¶
func (m *MockactiveSetCache) EXPECT() *MockactiveSetCacheMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockactiveSetCacheAddCall ¶
MockactiveSetCacheAddCall wrap *gomock.Call
func (*MockactiveSetCacheAddCall) Do ¶
func (c *MockactiveSetCacheAddCall) Do(f func(types.EpochID, *cachedActiveSet) bool) *MockactiveSetCacheAddCall
Do rewrite *gomock.Call.Do
func (*MockactiveSetCacheAddCall) DoAndReturn ¶
func (c *MockactiveSetCacheAddCall) DoAndReturn(f func(types.EpochID, *cachedActiveSet) bool) *MockactiveSetCacheAddCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockactiveSetCacheAddCall) Return ¶
func (c *MockactiveSetCacheAddCall) Return(evicted bool) *MockactiveSetCacheAddCall
Return rewrite *gomock.Call.Return
type MockactiveSetCacheGetCall ¶
MockactiveSetCacheGetCall wrap *gomock.Call
func (*MockactiveSetCacheGetCall) Do ¶
func (c *MockactiveSetCacheGetCall) Do(f func(types.EpochID) (*cachedActiveSet, bool)) *MockactiveSetCacheGetCall
Do rewrite *gomock.Call.Do
func (*MockactiveSetCacheGetCall) DoAndReturn ¶
func (c *MockactiveSetCacheGetCall) DoAndReturn(f func(types.EpochID) (*cachedActiveSet, bool)) *MockactiveSetCacheGetCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockactiveSetCacheGetCall) Return ¶
func (c *MockactiveSetCacheGetCall) Return(value *cachedActiveSet, ok bool) *MockactiveSetCacheGetCall
Return rewrite *gomock.Call.Return
type MockactiveSetCacheMockRecorder ¶
type MockactiveSetCacheMockRecorder struct {
// contains filtered or unexported fields
}
MockactiveSetCacheMockRecorder is the mock recorder for MockactiveSetCache.
func (*MockactiveSetCacheMockRecorder) Add ¶
func (mr *MockactiveSetCacheMockRecorder) Add(key, value any) *MockactiveSetCacheAddCall
Add indicates an expected call of Add.
func (*MockactiveSetCacheMockRecorder) Get ¶
func (mr *MockactiveSetCacheMockRecorder) Get(key any) *MockactiveSetCacheGetCall
Get indicates an expected call of Get.
type MockvrfVerifier ¶
type MockvrfVerifier struct {
// contains filtered or unexported fields
}
MockvrfVerifier is a mock of vrfVerifier interface.
func NewMockvrfVerifier ¶
func NewMockvrfVerifier(ctrl *gomock.Controller) *MockvrfVerifier
NewMockvrfVerifier creates a new mock instance.
func (*MockvrfVerifier) EXPECT ¶
func (m *MockvrfVerifier) EXPECT() *MockvrfVerifierMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockvrfVerifier) Verify ¶
func (m *MockvrfVerifier) Verify(nodeID types.NodeID, msg []byte, sig types.VrfSignature) bool
Verify mocks base method.
type MockvrfVerifierMockRecorder ¶
type MockvrfVerifierMockRecorder struct {
// contains filtered or unexported fields
}
MockvrfVerifierMockRecorder is the mock recorder for MockvrfVerifier.
func (*MockvrfVerifierMockRecorder) Verify ¶
func (mr *MockvrfVerifierMockRecorder) Verify(nodeID, msg, sig any) *MockvrfVerifierVerifyCall
Verify indicates an expected call of Verify.
type MockvrfVerifierVerifyCall ¶
MockvrfVerifierVerifyCall wrap *gomock.Call
func (*MockvrfVerifierVerifyCall) Do ¶
func (c *MockvrfVerifierVerifyCall) Do(f func(types.NodeID, []byte, types.VrfSignature) bool) *MockvrfVerifierVerifyCall
Do rewrite *gomock.Call.Do
func (*MockvrfVerifierVerifyCall) DoAndReturn ¶
func (c *MockvrfVerifierVerifyCall) DoAndReturn(f func(types.NodeID, []byte, types.VrfSignature) bool) *MockvrfVerifierVerifyCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockvrfVerifierVerifyCall) Return ¶
func (c *MockvrfVerifierVerifyCall) Return(arg0 bool) *MockvrfVerifierVerifyCall
Return rewrite *gomock.Call.Return
type Oracle ¶
type Oracle struct {
// contains filtered or unexported fields
}
Oracle is the hare eligibility oracle.
func New ¶
func New( beacons system.BeaconGetter, db sql.Executor, atxsdata *atxsdata.Data, vrfVerifier vrfVerifier, layersPerEpoch uint32, opts ...Opt, ) (*Oracle, error)
New returns a new eligibility oracle instance.
func (*Oracle) CalcEligibility ¶
func (o *Oracle) CalcEligibility( ctx context.Context, layer types.LayerID, round uint32, committeeSize int, id types.NodeID, vrfSig types.VrfSignature, ) (uint16, error)
CalcEligibility calculates the number of eligibilities of ID on the given Layer where msg is the VRF message, sig is the role proof and assuming commSize as the expected committee size.
func (*Oracle) IsIdentityActiveOnConsensusView ¶
func (o *Oracle) IsIdentityActiveOnConsensusView( ctx context.Context, edID types.NodeID, layer types.LayerID, ) (bool, error)
IsIdentityActiveOnConsensusView returns true if the provided identity is active on the consensus view derived from the specified layer, false otherwise.
func (*Oracle) Proof ¶
func (o *Oracle) Proof( ctx context.Context, signer *signing.VRFSigner, layer types.LayerID, round uint32, ) (types.VrfSignature, error)
Proof returns the role proof for the current Layer & Round.
func (*Oracle) SetSync ¶
func (o *Oracle) SetSync(sync system.SyncStateProvider)
func (*Oracle) UpdateActiveSet ¶
func (*Oracle) Validate ¶
func (o *Oracle) Validate( ctx context.Context, layer types.LayerID, round uint32, committeeSize int, id types.NodeID, sig types.VrfSignature, eligibilityCount uint16, ) (bool, error)
Validate validates the number of eligibilities of ID on the given Layer where msg is the VRF message, sig is the role proof and assuming commSize as the expected committee size.
type Rolacle ¶
type Rolacle interface { Validate(context.Context, types.LayerID, uint32, int, types.NodeID, types.VrfSignature, uint16) (bool, error) CalcEligibility(context.Context, types.LayerID, uint32, int, types.NodeID, types.VrfSignature) (uint16, error) Proof(context.Context, *signing.VRFSigner, types.LayerID, uint32) (types.VrfSignature, error) }
Rolacle is the roles oracle provider.
type VrfMessage ¶
type VrfMessage struct { Type types.EligibilityType // always types.EligibilityHare Beacon types.Beacon Round uint32 Layer types.LayerID }
VrfMessage is a verification message. It is also the payload for the signature in `types.HareEligibility`.
func (*VrfMessage) DecodeScale ¶
func (t *VrfMessage) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*VrfMessage) EncodeScale ¶
func (t *VrfMessage) EncodeScale(enc *scale.Encoder) (total int, err error)