-
Notifications
You must be signed in to change notification settings - Fork 985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split P2P Topics And Introduce Middleware (Adapters) #421
Merged
rauljordan
merged 32 commits into
prysmaticlabs:master
from
prestonvanloon:p2p_adapters
Aug 29, 2018
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
45b9df2
thinking about adapters
prestonvanloon 0fc242a
more progress on exploring p2p middleware stack
prestonvanloon e3ee2ca
some more progress on the middleware stack idea
prestonvanloon 826afea
added a bit more to the example
prestonvanloon 1978ecf
working on testing
prestonvanloon 393c9b4
working a bit more on tests
prestonvanloon 5f4c379
Merge branch 'master' of github.com:prysmaticlabs/prysm into p2p_adap…
prestonvanloon 54c761d
Merge branch 'master' into p2p_adapters
prestonvanloon daa6014
Merge branch 'p2p_adapters' of github.com:prestonvanloon/prysm into p…
prestonvanloon b02aecc
more progress on p2p abstraction with adapters
prestonvanloon 6caaef2
split topics
prestonvanloon 1da3adb
split topics
prestonvanloon 7bced19
split topics
prestonvanloon 80fe715
add other config
prestonvanloon 41b03c9
Merge branch 'master' into p2p_adapters
prestonvanloon e6c32f3
fix example
prestonvanloon 558139b
newline
prestonvanloon 1a0770d
merge master
prestonvanloon fe95160
fix merge
prestonvanloon 3d8646d
move more after merge
prestonvanloon 55cc0c3
fix godoc
prestonvanloon 23daf90
a bit more tests
prestonvanloon aa77a94
merge assignment
prestonvanloon 91f8352
update from PR feedback
prestonvanloon fe49351
merge and conflicts
prestonvanloon 287839f
PR feedback
prestonvanloon 7f83b6f
another go (func
prestonvanloon 7b3e0ff
PR feedback that I missed
prestonvanloon 0500af6
gofmt
prestonvanloon 3ecf3bd
gazelle
prestonvanloon a683da2
Merge branch 'master' into p2p_adapters
prestonvanloon e13aa0c
Merge branch 'master' into p2p_adapters
rauljordan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package node | ||
|
||
import ( | ||
"github.com/prysmaticlabs/prysm/shared/p2p" | ||
|
||
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" | ||
) | ||
|
||
var topicMappings = map[pb.Topic]interface{}{ | ||
pb.Topic_BEACON_BLOCK_HASH_ANNOUNCE: pb.BeaconBlockHashAnnounce{}, | ||
pb.Topic_BEACON_BLOCK_REQUEST: pb.BeaconBlockRequest{}, | ||
pb.Topic_BEACON_BLOCK_REQUEST_BY_SLOT_NUMBER: pb.BeaconBlockRequestBySlotNumber{}, | ||
pb.Topic_BEACON_BLOCK_RESPONSE: pb.BeaconBlockResponse{}, | ||
pb.Topic_CRYSTALLIZED_STATE_HASH_ANNOUNCE: pb.CrystallizedStateHashAnnounce{}, | ||
pb.Topic_CRYSTALLIZED_STATE_REQUEST: pb.CrystallizedStateRequest{}, | ||
pb.Topic_CRYSTALLIZED_STATE_RESPONSE: pb.CrystallizedStateResponse{}, | ||
pb.Topic_ACTIVE_STATE_HASH_ANNOUNCE: pb.ActiveStateHashAnnounce{}, | ||
pb.Topic_ACTIVE_STATE_REQUEST: pb.ActiveStateRequest{}, | ||
pb.Topic_ACTIVE_STATE_RESPONSE: pb.ActiveStateResponse{}, | ||
} | ||
|
||
func configureP2P() (*p2p.Server, error) { | ||
s, err := p2p.NewServer() | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
// TODO(437, 438): Define default adapters for logging, monitoring, etc. | ||
var adapters []p2p.Adapter | ||
for k, v := range topicMappings { | ||
s.RegisterTopic(k.String(), v, adapters...) | ||
} | ||
|
||
return s, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a few sections here about the p2p middleware stuff for visibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this have to do with protos?