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

Submit a vote timestamp every vote #10630

Merged
merged 3 commits into from
Aug 21, 2020
Merged

Conversation

mvines
Copy link
Member

@mvines mvines commented Jun 16, 2020

getBlockTime has been unreliable in a heavily forking cluster, likely due to slots with timestamped votes not getting confirmed. There doesn't seem to be a strong argument for not including a timestamp more frequently. Doing so should mean that block time is always available and simplifies the implementation

@mvines mvines force-pushed the ts branch 5 times, most recently from d958165 to 62b4f10 Compare June 16, 2020 20:42
@ryoqun
Copy link
Member

ryoqun commented Jun 17, 2020

@mvines To fix docs ci failure, you needs this: https://github.com/solana-labs/solana/pull/10640/files Sorry for inconvenience..

@mvines
Copy link
Member Author

mvines commented Jun 17, 2020

@mvines To fix docs ci failure, you needs this: https://github.com/solana-labs/solana/pull/10640/files Sorry for inconvenience..

thanks!

CriesofCarrots
CriesofCarrots previously approved these changes Jun 17, 2020
Copy link
Contributor

@CriesofCarrots CriesofCarrots left a comment

Choose a reason for hiding this comment

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

lgtm!

@mergify mergify bot dismissed CriesofCarrots’s stale review June 17, 2020 05:09

Pull request has been modified.

@mvines mvines force-pushed the ts branch 2 times, most recently from 43136dd to 584e6b6 Compare June 17, 2020 19:36
@mvines mvines added the noCI Suppress CI on this Pull Request label Jun 17, 2020
@mvines
Copy link
Member Author

mvines commented Jun 17, 2020

Good news! I've managed to construct a real dependency on #9902 (@ryoqun 👋) with this PR.

The test_restart_node local cluster test fails:

$ cd local-cluster/
$ RUST_LOG=solana=info,local_cluster=trace RUST_BACKTRACE=1 cargo test --release test_restart_node 

because when the node restarts, it drops its tower and re-sends votes for slots it has already voted on. The introduction of a timestamp in each vote causes these duplicate votes to be rejected with VoteError::TimestampTooOld, whereas before the duplicate votes were silently ignored.

Rather than adapting the vote program to handle this case, I think we should just fix #9902 :)

@mvines mvines added blocked Unable to proceed and removed v1.1 labels Jun 17, 2020
@ryoqun
Copy link
Member

ryoqun commented Jun 19, 2020

Good news! I've managed to construct a real dependency on #9902 (@ryoqun wave) with this PR.

test_restart_node test passes by cherry-picking this pr onto #10718.

So, your findings should be correct and persistent tower fixes the test failure indeed!

core/src/consensus.rs Outdated Show resolved Hide resolved
@@ -347,6 +345,22 @@ impl Tower {
last_vote
}

fn maybe_timestamp(&mut self, current_slot: Slot) -> Option<UnixTimestamp> {
Copy link
Member

@ryoqun ryoqun Jun 23, 2020

Choose a reason for hiding this comment

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

nits: no longer maybe_?

Copy link
Member Author

Choose a reason for hiding this comment

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

I considered removing the maybe_ (even did it locally once) but the function does still return an Option because the function will not add a timestamp to a slot that's older than the latest slot that has been timestamped.
(although this behaviour might be unnecessary once tower save/restore is working...)

ryoqun
ryoqun previously requested changes Jun 23, 2020
Copy link
Member

@ryoqun ryoqun left a comment

Choose a reason for hiding this comment

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

I'm pretty sure I've found a bug...

@mergify mergify bot dismissed ryoqun’s stale review June 29, 2020 16:55

Pull request has been modified.

@mvines mvines changed the title Submit a timestamp for every vote Submit a timestamp for every vote every second Jun 29, 2020
@mvines mvines changed the title Submit a timestamp for every vote every second Submit a vote timestamp every second Jun 29, 2020
@CriesofCarrots
Copy link
Contributor

@mvines , how do you feel about this one now? I removed the backport labels to do that manually after the vote-program changes are released? (Couldn't figure out how to remove the broken backport rules, though :( )

core/src/rpc.rs Outdated
@@ -625,7 +625,7 @@ impl JsonRpcRequestProcessor {
self.check_slot_cleaned_up(&result, slot)?;
Ok(result.ok())
} else {
Ok(None)
Err(RpcCustomError::BlockNotAvailable { slot }.into())
Copy link
Member Author

Choose a reason for hiding this comment

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

We actually could break out these rpc error-handling changes and get them landed sooner. I guess I could have done that in June in retrospect!

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, good call. I'll pull that out to land & backport first.

@mvines
Copy link
Member Author

mvines commented Aug 20, 2020

how do you feel about this one now?

looks good, just gotta deal with the rollout

@mvines
Copy link
Member Author

mvines commented Aug 20, 2020

how do you feel about this one now?

looks good, just gotta deal with the rollout

image

@t-nelson
Copy link
Contributor

@Mergifyio refresh ?

@mergify
Copy link
Contributor

mergify bot commented Aug 20, 2020

Command refresh ?: success

@CriesofCarrots CriesofCarrots changed the title Submit a vote timestamp every second Submit a vote timestamp every vote Aug 21, 2020
@CriesofCarrots CriesofCarrots merged commit 247f27a into solana-labs:master Aug 21, 2020
This was referenced Aug 26, 2020
CriesofCarrots added a commit to CriesofCarrots/solana that referenced this pull request Sep 23, 2020
* Submit a timestamp for every vote

* Submit at most one vote timestamp per second

* Submit a timestamp for every new vote

Co-authored-by: Tyera Eulberg <[email protected]>
CriesofCarrots added a commit that referenced this pull request Sep 23, 2020
* Submit a vote timestamp every vote (#10630)

* Submit a timestamp for every vote

* Submit at most one vote timestamp per second

* Submit a timestamp for every new vote

Co-authored-by: Tyera Eulberg <[email protected]>

* Timestamp first vote (#11856)

* Cache block time in Blockstore (#11955)

* Add blockstore column to cache block times

* Add method to cache block time

* Add service to cache block time

* Update rpc getBlockTime to use new method, and refactor blockstore slightly

* Return block_time with confirmed block, if available

* Add measure and warning to cache-block-time

Co-authored-by: Michael Vines <[email protected]>
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.

6 participants