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] Implement startup-time flag #1304

Merged
merged 8 commits into from Sep 25, 2021

Conversation

synzhu
Copy link
Contributor

@synzhu synzhu commented Sep 16, 2021

@codecov-commenter
Copy link

codecov-commenter commented Sep 16, 2021

Codecov Report

Merging #1304 (c9940ab) into master (8a733c6) will increase coverage by 1.21%.
The diff coverage is 40.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1304      +/-   ##
==========================================
+ Coverage   55.01%   56.22%   +1.21%     
==========================================
  Files         501      500       -1     
  Lines       31739    31073     -666     
==========================================
+ Hits        17460    17471      +11     
+ Misses      11922    11237     -685     
- Partials     2357     2365       +8     
Flag Coverage Δ
unittests 56.22% <40.00%> (+1.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
consensus/config.go 0.00% <0.00%> (ø)
consensus/participant.go 15.95% <0.00%> (ø)
consensus/hotstuff/event_loop.go 52.00% <100.00%> (+14.16%) ⬆️
module/epochs/machine_account.go 45.79% <0.00%> (-27.34%) ⬇️
engine/consensus/compliance/core.go 75.79% <0.00%> (-5.07%) ⬇️
...sus/approvals/assignment_collector_statemachine.go 42.30% <0.00%> (-4.81%) ⬇️
...execution-state-extract/execution_state_extract.go 55.88% <0.00%> (-3.50%) ⬇️
model/flow/identifier.go 72.46% <0.00%> (-3.30%) ⬇️
engine/execution/computation/computer/computer.go 84.33% <0.00%> (-2.83%) ⬇️
module/builder/collection/builder.go 77.95% <0.00%> (-2.19%) ⬇️
... and 37 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8a733c6...c9940ab. Read the comment docs.

Copy link
Member

@zhangchiqing zhangchiqing left a comment

Choose a reason for hiding this comment

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

Nice work.
Had some minor suggestions and better to add a test case for verify

cmd/consensus/main.go Show resolved Hide resolved
cmd/collection/main.go Outdated Show resolved Hide resolved
consensus/hotstuff/event_loop_test.go Show resolved Hide resolved
consensus/hotstuff/event_loop.go Outdated Show resolved Hide resolved
cmd/collection/main.go Show resolved Hide resolved
cmd/collection/main.go Outdated Show resolved Hide resolved
Copy link
Member

@durkmurder durkmurder left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -139,13 +141,25 @@ 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, "startup-time", cmd.NotSet,
"specifies date and time (in ISO 8601 format) when the consensus participant enters the first view (e.g 2006-01-02T15:04:05Z07:00)")
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need this flag for collection cluster.

Do we? @AlexHentschel

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The original issue says we need it for both.

@@ -143,8 +145,19 @@ func main() {
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")
flags.StringVar(&startupTimeString, "startup-time", cmd.NotSet, "specifies date and time (in ISO 8601 format) when the consensus participant enters the first view")
Copy link
Member

Choose a reason for hiding this comment

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

Please also add the time format in the comment here as well.

Also it's better to mention that if this startup time is a time in the past, then the node will start up right away.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated doc to reflect that start-time is the data after which the first view may be entered. Therefore if the start-time is in the past, then the first view may be entered immediately

cmd/collection/main.go Outdated Show resolved Hide resolved
@synzhu
Copy link
Contributor Author

synzhu commented Sep 22, 2021

yeah, I like @durkmurder 's idea of using timestamp.

The example 2006-01-02T15:04:05Z07:00 here is still confusing to me. Like the Z07:00 part.

A timestamp like 1632245321894 is easier.

@zhangchiqing @durkmurder so personally, I think the ISO format makes more sense because it is human readable, and it is also the most commonly used time format on the internet.

The Z0:700 is just the time Zone.

In the end it doesn't matter too much, but I'd like to push back at least a little bit on the idea that timestamps are better. They are easier and make more sense to our engineering brains, but they are more confusing and error prone for users. For example, if node operator needs to go back and check what the start time was, they can look at the command line options the node was started with. If we use timestamps, they cannot tell right away, they need to then take the timestamp and put into some tool to get human readable format.

A user would definitely need to use some tool to generate the timestamp, whereas they could easily write the ISO formatted date by hand.

Copy link
Member

@zhangchiqing zhangchiqing left a comment

Choose a reason for hiding this comment

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

Looks good to me. Better if @AlexHentschel also give a look

cmd/collection/main.go Outdated Show resolved Hide resolved
@synzhu
Copy link
Contributor Author

synzhu commented Sep 25, 2021

bors merge

@bors
Copy link
Contributor

bors bot commented Sep 25, 2021

@bors bors bot merged commit 2a21b49 into master Sep 25, 2021
@bors bors bot deleted the smnzhu/operator-specified-startup-time branch September 25, 2021 05:13
@AlexHentschel
Copy link
Member

looks good.

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

5 participants