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

Add multi beacon client support #876

Merged
merged 46 commits into from
Dec 22, 2021

Conversation

emmanuelm41
Copy link
Contributor

No description provided.

client/grpc/client.go Show resolved Hide resolved
cmd/client/lib/cli.go Show resolved Hide resolved
cmd/relay/main.go Show resolved Hide resolved
common/beacon.go Show resolved Hide resolved
core/drand_daemon.go Outdated Show resolved Hide resolved
http/server.go Outdated Show resolved Hide resolved
http/server.go Outdated Show resolved Hide resolved
http/server.go Outdated Show resolved Hide resolved
client/grpc/client.go Outdated Show resolved Hide resolved
common/beacon.go Show resolved Hide resolved
Copy link
Collaborator

@nikkolasg nikkolasg left a comment

Choose a reason for hiding this comment

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

I want to let @willscott have a pass now

@@ -7,6 +7,8 @@ import (
"fmt"
"time"

"github.com/drand/drand/protobuf/common"
Copy link
Member

Choose a reason for hiding this comment

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

why is this in a separate import block and not next to protobuf/drand below?

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed

@@ -6,12 +6,14 @@ import (
"fmt"
"sync"

"github.com/drand/drand/chain"
Copy link
Member

Choose a reason for hiding this comment

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

why is this in a new block?

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed

go.mod Outdated
@@ -58,26 +57,31 @@ require (
google.golang.org/protobuf v1.27.1
)

require (
Copy link
Member

Choose a reason for hiding this comment

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

is it really canonical in golang 1.17 to have 3 require blocks?

Copy link
Contributor

Choose a reason for hiding this comment

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

No need to... I've unified all the packages under one require block

}

mux := http.NewServeMux()
//TODO: aggregated bulk round responses.
mux := chi.NewMux()
Copy link
Member

Choose a reason for hiding this comment

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

what are you getting out of chi mux versus the stdlib one?

you're not refactoring the routes to idiomatic chi (mux.With(commonHeaders).Get('/health', handler.Health).
The templating of the chainHashParamKey below feels suspect.

Copy link
Contributor

Choose a reason for hiding this comment

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

The main advantage that we make use in chi is the param extract util with chi.URLParam(r, chainHashParamKey).
Since it's compatible with stdlib, we saw no need to change the already established routes.
I can change them to be chi idiomatic as you wrote if that is the case.

http/server.go Outdated
chainHashStr = common.DefaultChainHash
}

h.state.Lock()
Copy link
Member

Choose a reason for hiding this comment

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

This is going to get called on every inbound http client request.
This structure is going to have lock contention.
It at least needs to be an RWMutex because you are only Rlock ing it here, not needing to acquire an exclusive lock.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, fixed it

@willscott
Copy link
Member

try running go mod tidy? CI is complaining that File go.mod not in sync

@willscott
Copy link
Member

i see:

2021-12-20T12:22:17.041Z	ERROR	beacon/chain.go:192		{"beacon_id": "", "chain_store": "error storing beacon", "err": "invalid round inserted: last 1, new 1"}
--- FAIL: TestDrandPublicStreamProxy (11.37s)

Is this an indication of some edge case where it's possible for multiple beacons to potentially collide?

@willscott willscott merged commit 2c63d68 into drand:master Dec 22, 2021
@emmanuelm41 emmanuelm41 deleted the eze/multibeacon_client_support branch December 23, 2021 12:05
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

4 participants