Skip to content
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

added broadcast api call and test #494

Merged
merged 4 commits into from Feb 4, 2019
Merged

Conversation

y0sher
Copy link
Contributor

@y0sher y0sher commented Jan 29, 2019

No description provided.

Copy link
Contributor

@zalmen zalmen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently only messages that are valid according to the specified protocol will be propagated, which isn't what this call is meant to do. You should add a dedicated protocol that will process and approve any message and propagate it

@@ -65,6 +65,16 @@ func (s SpaceMeshGrpcService) SubmitTransaction(ctx context.Context, in *pb.Sign
return &pb.SimpleMessage{Value:"ok"}, nil
}

// P2P API

func (s SpaceMeshGrpcService) Broadcast(ctx context.Context, in *pb.BroadcastMessage) (*pb.SimpleMessage, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's not part of this PR - but it should be Spacemesh and not SpaceMesh

api/pb/api.proto Outdated
string Protocol = 1;
bytes Data = 2;
}

service SpaceMeshService {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment - should be Spacemesh

@y0sher
Copy link
Contributor Author

y0sher commented Feb 4, 2019

addressed your comments @zalmen

app/main.go Outdated
@@ -242,6 +242,10 @@ func (app *SpacemeshApp) startSpacemesh(cmd *cobra.Command, args []string) {
// start p2p services
log.Info("Initializing P2P services")
swarm, err := p2p.New(Ctx, app.Config.P2P)

// Gossip messages are validated before propagating. broadcast test protocol isn't
api.ApproveAPIGossipMessages(Ctx, swarm) // todo: maybe only enable in tests?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the TODO, we wouldn't want to allow anyone to spam the network. It should be configurable with a default to false

@y0sher y0sher merged commit 470b851 into develop Feb 4, 2019
@y0sher y0sher deleted the automation_rpc_broadcast branch June 25, 2019 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants