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

[Consensus] fix startup time #1402

Merged
merged 2 commits into from
Oct 1, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 10 additions & 11 deletions cmd/collection/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,29 +143,28 @@ func main() {
"additional fraction of replica timeout that the primary will wait for votes")
flags.DurationVar(&blockRateDelay, "block-rate-delay", 250*time.Millisecond,
"the delay to broadcast block proposal in order to control block production rate")
flags.StringVar(&startupTimeString, "hotstuff-startup-time", cmd.NotSet, "specifies date and time (in ISO 8601 format) after which the consensus participant may enter the first view (e.g 2006-01-02T15:04:05Z07:00)")
flags.StringVar(&startupTimeString, "hotstuff-startup-time", cmd.NotSet, "specifies date and time (in ISO 8601 format) after which the consensus participant may enter the first view (e.g (e.g 1996-04-24T15:04:05-07:00))")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
flags.StringVar(&startupTimeString, "hotstuff-startup-time", cmd.NotSet, "specifies date and time (in ISO 8601 format) after which the consensus participant may enter the first view (e.g (e.g 1996-04-24T15:04:05-07:00))")
flags.StringVar(&startupTimeString, "hotstuff-startup-time", cmd.NotSet, "specifies date and time (in ISO 8601 format) after which the consensus participant may enter the first view (e.g 2006-04-24T15:04:05-07:00)")


// epoch qc contract flags
flags.StringVar(&accessAddress, "access-address", "", "the address of an access node")
flags.StringVar(&secureAccessNodeID, "secure-access-node-id", "", "the node ID of the secure access GRPC server")
flags.BoolVar(&insecureAccessAPI, "insecure-access-api", true, "required if insecure GRPC connection should be used")
}).ValidateFlags(func() error {
if startupTimeString != cmd.NotSet {
t, err := time.Parse(time.RFC3339, startupTimeString)
Copy link
Member

Choose a reason for hiding this comment

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

log the startup time here as well?

if err != nil {
return fmt.Errorf("invalid start-time value: %w", err)
}
startupTime = t
}
return nil
})

if err = nodeBuilder.Initialize(); err != nil {
nodeBuilder.Logger.Fatal().Err(err).Send()
}

nodeBuilder.
ValidateFlags(func() error {
if startupTimeString != cmd.NotSet {
t, err := time.Parse(time.RFC3339, startupTimeString)
if err != nil {
return fmt.Errorf("invalid start-time value: %w", err)
}
startupTime = t
}
return nil
}).
Module("mutable follower state", func(builder cmd.NodeBuilder, node *cmd.NodeConfig) error {
// For now, we only support state implementations from package badger.
// If we ever support different implementations, the following can be replaced by a type-aware factory
Expand Down
23 changes: 12 additions & 11 deletions cmd/consensus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,24 +151,25 @@ func main() {
flags.DurationVar(&dkgControllerConfig.BaseStartDelay, "dkg-controller-base-start-delay", dkgmodule.DefaultBaseStartDelay, "used to define the range for jitter prior to DKG start (eg. 500µs) - the base value is scaled quadratically with the # of DKG participants")
flags.DurationVar(&dkgControllerConfig.BaseHandleFirstBroadcastDelay, "dkg-controller-base-handle-first-broadcast-delay", dkgmodule.DefaultBaseHandleFirstBroadcastDelay, "used to define the range for jitter prior to DKG handling the first broadcast messages (eg. 50ms) - the base value is scaled quadratically with the # of DKG participants")
flags.DurationVar(&dkgControllerConfig.HandleSubsequentBroadcastDelay, "dkg-controller-handle-subsequent-broadcast-delay", dkgmodule.DefaultHandleSubsequentBroadcastDelay, "used to define the constant delay introduced prior to DKG handling subsequent broadcast messages (eg. 2s)")
flags.StringVar(&startupTimeString, "hotstuff-startup-time", cmd.NotSet, "specifies date and time (in ISO 8601 format) after which the consensus participant may enter the first view (e.g 2006-01-02T15:04:05Z07:00)")
flags.StringVar(&startupTimeString, "hotstuff-startup-time", cmd.NotSet, "specifies date and time (in ISO 8601 format) after which the consensus participant may enter the first view (e.g 1996-04-24T15:04:05-07:00)")
}).ValidateFlags(func() error {
nodeBuilder.Logger.Info().Str("startup_time_str", startupTimeString).Msg("got startup_time_str")
if startupTimeString != cmd.NotSet {
t, err := time.Parse(time.RFC3339, startupTimeString)
if err != nil {
return fmt.Errorf("invalid start-time value: %w", err)
}
startupTime = t
nodeBuilder.Logger.Info().Time("startup_time", startupTime).Msg("got startup_time")
}
return nil
})

if err = nodeBuilder.Initialize(); err != nil {
nodeBuilder.Logger.Fatal().Err(err).Send()
}

nodeBuilder.
ValidateFlags(func() error {
if startupTimeString != cmd.NotSet {
t, err := time.Parse(time.RFC3339, startupTimeString)
if err != nil {
return fmt.Errorf("invalid start-time value: %w", err)
}
startupTime = t
}
return nil
}).
Module("consensus node metrics", func(builder cmd.NodeBuilder, node *cmd.NodeConfig) error {
conMetrics = metrics.NewConsensusCollector(node.Tracer, node.MetricsRegisterer)
return nil
Expand Down
4 changes: 2 additions & 2 deletions integration/localnet/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ init-short-epochs:

.PHONY: start
start:
docker-compose -f docker-compose.metrics.yml up -d
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f docker-compose.nodes.yml up --build -d
docker-compose -f docker-compose.metrics.yml up -d --remove-orphans
Copy link
Contributor

Choose a reason for hiding this comment

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

🤩

DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f docker-compose.nodes.yml up --remove-orphans --build -d

.PHONY: logs
logs:
Expand Down