Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into ds/merge_upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
dshiell committed Jul 15, 2023
2 parents 115a3c8 + 490bd22 commit 6fe0efd
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 22 deletions.
1 change: 0 additions & 1 deletion beacon-chain/blockchain/chain_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ type HeadFetcher interface {

// ForkFetcher retrieves the current fork information of the Ethereum beacon chain.
type ForkFetcher interface {
ForkChoicer() forkchoice.ForkChoicer
CurrentFork() *ethpb.Fork
GenesisFetcher
TimeFetcher
Expand Down
5 changes: 0 additions & 5 deletions beacon-chain/blockchain/testing/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ func (s *ChainService) Ancestor(ctx context.Context, root []byte, slot primitive
return r[:], err
}

// ForkChoicer mocks the same method in the chain service
func (s *ChainService) ForkChoicer() forkchoice.ForkChoicer {
return s.ForkChoiceStore
}

// StateNotifier mocks the same method in the chain service.
func (s *ChainService) StateNotifier() statefeed.Notifier {
if s.stateNotifier == nil {
Expand Down
4 changes: 2 additions & 2 deletions beacon-chain/core/feed/state/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ const (
FinalizedCheckpoint
// NewHead of the chain event.
NewHead
// MissedSlot is sent when we need to notify users that a slot was missed.
MissedSlot
// LightClientFinalityUpdate event
LightClientFinalityUpdate
// LightClientOptimisticUpdate event
LightClientOptimisticUpdate
// MissedSlot is sent when we need to notify users that a slot was missed.
MissedSlot
)

// BlockProcessedData is the data sent with BlockProcessed events.
Expand Down
8 changes: 4 additions & 4 deletions beacon-chain/rpc/apimiddleware/custom_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,6 @@ func receiveEvents(eventChan <-chan *sse.Event, w http.ResponseWriter, req *http
data = &SignedContributionAndProofJson{}
case events.BLSToExecutionChangeTopic:
data = &SignedBLSToExecutionChangeJson{}
case events.LightClientFinalityUpdateTopic:
data = &LightClientFinalityUpdateResponseJson{}
case events.LightClientOptimisticUpdateTopic:
data = &LightClientOptimisticUpdateResponseJson{}
case events.PayloadAttributesTopic:
dataSubset := &dataSubset{}
if err := json.Unmarshal(msg.Data, dataSubset); err != nil {
Expand All @@ -435,6 +431,10 @@ func receiveEvents(eventChan <-chan *sse.Event, w http.ResponseWriter, req *http
default:
return apimiddleware.InternalServerError(errors.New("payload version unsupported"))
}
case events.LightClientFinalityUpdateTopic:
data = &LightClientFinalityUpdateResponseJson{}
case events.LightClientOptimisticUpdateTopic:
data = &LightClientOptimisticUpdateResponseJson{}
case "error":
data = &EventErrorJson{}
default:
Expand Down
1 change: 1 addition & 0 deletions beacon-chain/rpc/eth/beacon/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ go_library(
"blinded_blocks.go",
"blocks.go",
"config.go",
"handlers.go",
"lightclient.go",
"handlers.go",
"log.go",
Expand Down
6 changes: 3 additions & 3 deletions beacon-chain/rpc/eth/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ const (
SyncCommitteeContributionTopic = "contribution_and_proof"
// BLSToExecutionChangeTopic represents a new received BLS to execution change event topic.
BLSToExecutionChangeTopic = "bls_to_execution_change"
// PayloadAttributesTopic represents a new payload attributes for execution payload building event topic.
PayloadAttributesTopic = "payload_attributes"
// LightClientFinalityUpdateTopic represents a new light client finality update event topic.
LightClientFinalityUpdateTopic = "light_client_finality_update"
// LightClientOptimisticUpdateTopic represents a new light client optimistic update event topic.
LightClientOptimisticUpdateTopic = "light_client_optimistic_update"
// PayloadAttributesTopic represents a new payload attributes for execution payload building event topic.
PayloadAttributesTopic = "payload_attributes"
)

var casesHandled = map[string]bool{
Expand All @@ -60,9 +60,9 @@ var casesHandled = map[string]bool{
ChainReorgTopic: true,
SyncCommitteeContributionTopic: true,
BLSToExecutionChangeTopic: true,
PayloadAttributesTopic: true,
LightClientFinalityUpdateTopic: true,
LightClientOptimisticUpdateTopic: true,
PayloadAttributesTopic: true,
}

// StreamEvents allows requesting all events from a set of topics defined in the Ethereum consensus API standard.
Expand Down
11 changes: 6 additions & 5 deletions beacon-chain/sync/fork_watcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package sync

import (
"context"
"github.com/libp2p/go-libp2p/core/protocol"
"testing"
"time"

"github.com/libp2p/go-libp2p/core/protocol"

"github.com/prysmaticlabs/prysm/v4/async/abool"
mockChain "github.com/prysmaticlabs/prysm/v4/beacon-chain/blockchain/testing"
"github.com/prysmaticlabs/prysm/v4/beacon-chain/p2p"
Expand Down Expand Up @@ -96,7 +97,7 @@ func TestService_CheckForNextEpochFork(t *testing.T) {
assert.Equal(t, true, s.subHandler.digestExists(digest))
rpcMap := make(map[protocol.ID]bool)
for _, p := range s.cfg.p2p.Host().Mux().Protocols() {
rpcMap[string(p)] = true
rpcMap[p] = true
}
assert.Equal(t, true, rpcMap[protocol.ID(p2p.RPCBlocksByRangeTopicV2+s.cfg.p2p.Encoding().ProtocolSuffix())], "topic doesn't exist")
assert.Equal(t, true, rpcMap[protocol.ID(p2p.RPCBlocksByRootTopicV2+s.cfg.p2p.Encoding().ProtocolSuffix())], "topic doesn't exist")
Expand Down Expand Up @@ -140,7 +141,7 @@ func TestService_CheckForNextEpochFork(t *testing.T) {
assert.Equal(t, true, s.subHandler.digestExists(digest))
rpcMap := make(map[protocol.ID]bool)
for _, p := range s.cfg.p2p.Host().Mux().Protocols() {
rpcMap[string(p)] = true
rpcMap[p] = true
}
},
},
Expand Down Expand Up @@ -196,7 +197,7 @@ func TestService_CheckForPreviousEpochFork(t *testing.T) {
ptcls := s.cfg.p2p.Host().Mux().Protocols()
pMap := make(map[protocol.ID]bool)
for _, p := range ptcls {
pMap[string(p)] = true
pMap[p] = true
}
assert.Equal(t, true, pMap[protocol.ID(p2p.RPCGoodByeTopicV1+s.cfg.p2p.Encoding().ProtocolSuffix())])
assert.Equal(t, true, pMap[protocol.ID(p2p.RPCStatusTopicV1+s.cfg.p2p.Encoding().ProtocolSuffix())])
Expand Down Expand Up @@ -267,7 +268,7 @@ func TestService_CheckForPreviousEpochFork(t *testing.T) {
ptcls := s.cfg.p2p.Host().Mux().Protocols()
pMap := make(map[protocol.ID]bool)
for _, p := range ptcls {
pMap[string(p)] = true
pMap[p] = true
}
assert.Equal(t, true, pMap[protocol.ID(p2p.RPCGoodByeTopicV1+s.cfg.p2p.Encoding().ProtocolSuffix())])
assert.Equal(t, true, pMap[protocol.ID(p2p.RPCStatusTopicV1+s.cfg.p2p.Encoding().ProtocolSuffix())])
Expand Down
5 changes: 3 additions & 2 deletions proto/eth/v2/sync_committee.pb.go

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

0 comments on commit 6fe0efd

Please sign in to comment.