Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/beacon/beacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func Initialize(
logger,
beaconChain,
sortition.DefaultStatusCheckTick,
sortition.UnconditionalJoinPolicy,
sortition.NewBetaOperatorPolicy(beaconChain, logger),
)
if err != nil {
return fmt.Errorf(
Expand Down
27 changes: 19 additions & 8 deletions pkg/chain/ethereum/beacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,17 @@ func (bc *BeaconChain) RestoreRewardEligibility() error {
return err
}

// Returns true if the chaosnet phase is active, false otherwise.
func (bc *BeaconChain) IsChaosnetActive() (bool, error) {
return bc.sortitionPool.IsChaosnetActive()
}

// Returns true if operator is a beta operator, false otherwise.
// Chaosnet status does not matter.
func (bc *BeaconChain) IsBetaOperator() (bool, error) {
return bc.sortitionPool.IsBetaOperator(bc.key.Address)
}

// SelectGroup returns the group members for the group generated by
// the given seed. This function can return an error if the beacon chain's
// state does not allow for group selection at the moment.
Expand Down Expand Up @@ -281,17 +292,17 @@ func (bc *BeaconChain) IsStaleGroup(groupPublicKey []byte) (bool, error) {
}

// TODO: Implement a real OnDKGStarted event subscription. The current
// implementation generates a fake event every 500th block where the
// seed is the keccak256 of the block number.
// implementation generates a fake event every 500th block where the
// seed is the keccak256 of the block number.
func (bc *BeaconChain) OnDKGStarted(
handler func(event *event.DKGStarted),
) subscription.EventSubscription {
return bc.mockRandomBeacon.OnDKGStarted(handler)
}

// TODO: Implement a real SubmitDKGResult action. The current implementation
// just creates and pipes the DKG submission event to the handlers
// registered in the dkgResultSubmissionHandlers map.
// just creates and pipes the DKG submission event to the handlers
// registered in the dkgResultSubmissionHandlers map.
func (bc *BeaconChain) SubmitDKGResult(
participantIndex beaconchain.GroupMemberIndex,
dkgResult *beaconchain.DKGResult,
Expand All @@ -305,9 +316,9 @@ func (bc *BeaconChain) SubmitDKGResult(
}

// TODO: Implement a real OnDKGResultSubmitted event subscription. The current
// implementation just pipes the DKG submission event generated within
// SubmitDKGResult to the handlers registered in the
// dkgResultSubmissionHandlers map.
// implementation just pipes the DKG submission event generated within
// SubmitDKGResult to the handlers registered in the
// dkgResultSubmissionHandlers map.
func (bc *BeaconChain) OnDKGResultSubmitted(
handler func(event *event.DKGResultSubmission),
) subscription.EventSubscription {
Expand Down Expand Up @@ -422,7 +433,7 @@ func (bc *BeaconChain) CurrentRequestGroupPublicKey() ([]byte, error) {
}

// TODO: Temporary mock that simulates the behavior of the RandomBeacon
// contract. Should be removed eventually.
// contract. Should be removed eventually.
type mockRandomBeacon struct {
blockCounter chain.BlockCounter

Expand Down
560 changes: 559 additions & 1 deletion pkg/chain/ethereum/beacon/gen/abi/BeaconSortitionPool.go

Large diffs are not rendered by default.

225 changes: 225 additions & 0 deletions pkg/chain/ethereum/beacon/gen/cmd/BeaconSortitionPool.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading