Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Submit a vote timestamp every vote#10630

Merged
CriesofCarrots merged 3 commits into
solana-labs:masterfrom
mvines:ts
Aug 21, 2020
Merged

Submit a vote timestamp every vote#10630
CriesofCarrots merged 3 commits into
solana-labs:masterfrom
mvines:ts

Conversation

@mvines
Copy link
Copy Markdown
Contributor

@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
Comment thread programs/vote/src/vote_state/mod.rs
@ryoqun
Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor 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
Copy Markdown
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
Copy Markdown
Contributor 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
Copy Markdown
Contributor

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!

Comment thread core/src/consensus.rs Outdated
Comment thread core/src/consensus.rs
last_vote
}

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

@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
Copy Markdown
Contributor 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
Copy Markdown
Contributor

@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
Copy Markdown
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 :( )

Comment thread core/src/rpc.rs
Ok(result.ok())
} else {
Ok(None)
Err(RpcCustomError::BlockNotAvailable { slot }.into())
Copy link
Copy Markdown
Contributor 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
Copy Markdown
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
Copy Markdown
Contributor 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
Copy Markdown
Contributor 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
Copy Markdown
Contributor

@Mergifyio refresh ?

@mergify
Copy link
Copy Markdown
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 pushed 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 <tyera@solana.com>
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 <tyera@solana.com>

* 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 <mvines@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants