solana/core/benches
behzad nouri 1ac2a8cfa5
removes delayed crds inserts when upserting gossip table (#16806)
It is crucial that VersionedCrdsValue::insert_timestamp does not go
backward in time:
https://github.com/solana-labs/solana/blob/ec37a843a/core/src/crds.rs#L67-L79

Otherwise methods such as get_votes and get_epoch_slots_since will
break, which will break their downstream flow, including vote-listener
and optimistic confirmation:
https://github.com/solana-labs/solana/blob/ec37a843a/core/src/cluster_info.rs#L1197-L1215
https://github.com/solana-labs/solana/blob/ec37a843a/core/src/cluster_info.rs#L1274-L1298

For that, Crds::new_versioned is intended to be called "atomically" with
Crds::insert_verioned (as the comment already says so):
https://github.com/solana-labs/solana/blob/ec37a843a/core/src/crds.rs#L126-L129

However, currently this is violated in the code. For example,
filter_pull_responses creates VersionedCrdsValues (with the current
timestamp), then acquires an exclusive lock on gossip, then
process_pull_responses writes those values to the crds table:
https://github.com/solana-labs/solana/blob/ec37a843a/core/src/cluster_info.rs#L2375-L2392

Depending on the workload and lock contention, the insert_timestamps may
well be in the past when these values finally are inserted into gossip.

To avoid such scenarios, this commit:
  * removes Crds::new_versioned and Crd::insert_versioned.
  * makes VersionedCrdsValue constructor private, only invoked in
    Crds::insert, so that insert_timestamp is populated right before
    insert.

This will improve insert_timestamp monotonicity as long as Crds::insert
is not called with a stalled timestamp. Following commits may further
improve this by calling timestamp() inside Crds::insert, and/or
switching to std::time::Instant which guarantees monotonicity.
2021-04-28 11:56:13 +00:00
..
banking_stage.rs Merge pull request from GHSA-8v47-8c53-wwrc 2021-04-13 00:28:08 -06:00
blockstore.rs Re-allow clippy::integer_arithmetic at crate-level 2021-02-17 13:55:08 -07:00
cluster_info.rs removes redundant epoch stakes cache in retransmit (#14781) 2021-01-24 21:15:09 +00:00
consensus.rs Persistent tower (#10718) 2020-09-19 14:03:54 +09:00
crds.rs indexes nodes' contact infos in crds table (#13553) 2020-11-15 16:38:04 +00:00
crds_gossip_pull.rs indexes nodes' contact infos in crds table (#13553) 2020-11-15 16:38:04 +00:00
crds_shards.rs removes delayed crds inserts when upserting gossip table (#16806) 2021-04-28 11:56:13 +00:00
gen_keys.rs
poh.rs PoH batch size calibration (#15717) 2021-03-05 16:01:21 -08:00
poh_verify.rs Simd poh (#10604) 2020-06-16 23:03:26 -07:00
retransmit_stage.rs expands number of erasure coding shreds in the last batch in slots (#16484) 2021-04-21 12:47:50 +00:00
shredder.rs removes first_coding_index from erasure recovery code (#16646) 2021-04-23 12:00:37 +00:00
sigverify_stage.rs Clippy cleanup for all targets and nighly rust (also support 1.44.0) (#10445) 2020-06-09 09:38:14 +09:00