There are a few minor issues this change addresses:
1. When we send points to the `MetricsWriter` we are calling
`Instant::now()` twice, using the first result in the metrics stats,
and using the seconds value for `last_write_time`. Yet, on the next
upload, we would use `last_write_time` as a reference point.
We upload metrics using a network call, so it is far from
instantaneous. This creates a minor discrepancy in our time
reporting.
Good news is that we do not really need to call `Instant::now()`
twice at all, as we can use the same value for both stats and
`last_write_time`.
2. We did not report metrics stats if we did not have any points
accumulated. It seems better to always report metric stats,
including when no points have been accumulated. In practice, this
does not happen for the validator, as validators always report
something during a 10-second accumulation interval.
3. We did not upload any points when the metrics thread was existing.
This may cause a short number of metrics not to be reported.
4. `collect_points()` was always converting both `points` and `counters`
into a vector of `DataPoint`, even if the final length was over the
specified `max_points`. In the `mainnet-beta` we have values of up
to 5m points lost, so it could be a small optimization if we drop
them sooner.
The rest of the codebase has `clippy::arithmetic_side_effects` enabled.
While CLI is not as critical as the rest of the validator code base, it
seems nice to be precise about the arithmetic operations, and clippy
helps with that if `arithmetic_side_effects` is enabled.
A blanket disable at the module level is suboptimal. As we have a lot
of operations already written, that generate warnings under
`arithmetic_side_effects`, the first step is to move the lint control
into individual modules, that we can then inspect one by one.
* make the `errors` module available in sbf targets
* move `AuthenticatedEncryptionError` to the `errors` module
* move `ElGamalError` to the `errors` module
For duplicate blocks prevention we want to verify that the last erasure
batch was sufficiently propagated through turbine. This requires
additional bookkeeping because, depending on the erasure coding schema,
the entire batch might be recovered from only a few coding shreds.
In order to simplify above, this commit instead ensures that the last
erasure batch has >= 32 data shreds so that the batch cannot be
recovered unless 32+ shreds are received from turbine or repair.
quic: use smallvec, save one allocation per packet
Use smallvec to hold chunks. Streams are packet-sized so we don't expect
them to have many chunks. This saves us an allocation for each packet.
quic: switch to ordered reads
Unordered reads cause a BTreeMap allocation for each packet inside quinn
in Assembler::ensure_ordering.
Most streams will fit in one datagram and will therefore be ordered by
definition. Switch to ordered reads to avoid the allocation.
* add `deprecated` feature to produce warnings on use of deprecated functions
* replace `is_present` with `try_contains_id`
* replace validator functions
* replace `possible_values` with `value_parser`
* replace `value_of` function
* remove `deprecated` feature
* Fix crash if vote state is malformed
* Fix vote program crash if clock rewinds
Return an instruction error instead of panicking if the vote
program detects the vote program's vote authority history is
newer than the current clock.
---------
Co-authored-by: Richard Patel <ripatel@jumptrading.com>
* Remove rewards-interval-related check_account_access implementation
* Move RewardsInterval to tests module
* Update test to new StakeProgram functionality
* Add new StakeError variant
* Add closure to return error if EpochRewards::active
* Use error_during_epoch_rewards for Instructions that mutate stake accounts
* Use try instead of manually matching Ok/Err
* Consolidate error_during_epoch_rewards check
* Add new test helper
* Add test demonstrating which ix return StakeError::EpochRewardsActive
* Remove single-use fn
* add PacketFlags::FROM_STAKED_NODE
* Only forward packets from staked node
* fix local-cluster test forwarding
* review comment
* tpu_votes get marked as from_staked_node
* corrected to not use hardcoded connections count for unstaked
* Fixed a math problem on max_unstaked_load_in_throttling_window
* Fixed a unit test failure