mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Represent slots in secs instead of millisecs (#2163)
## Issue Addressed NA ## Proposed Changes Copied from #2083, changes the config milliseconds_per_slot to seconds_per_slot to avoid errors when slot duration is not a multiple of a second. To avoid deserializing old serialized data (with milliseconds instead of seconds) the Serialize and Deserialize derive got removed from the Spec struct (isn't currently used anyway). This PR replaces #2083 for the purpose of fixing a merge conflict without requiring the input of @blacktemplar. ## Additional Info NA Co-authored-by: blacktemplar <blacktemplar@a1.net>
This commit is contained in:
@@ -360,7 +360,7 @@ impl Config {
|
||||
pub fn set_block_cache_truncation<E: EthSpec>(&mut self, spec: &ChainSpec) {
|
||||
// Compute the number of eth1 blocks in an eth1 voting period.
|
||||
let seconds_per_voting_period =
|
||||
E::SlotsPerEth1VotingPeriod::to_u64() * spec.milliseconds_per_slot / 1000;
|
||||
E::SlotsPerEth1VotingPeriod::to_u64() * spec.seconds_per_slot;
|
||||
let eth1_blocks_per_voting_period = seconds_per_voting_period / spec.seconds_per_eth1_block;
|
||||
|
||||
// Compute the number of extra blocks we store prior to the voting period start blocks.
|
||||
@@ -1200,8 +1200,7 @@ mod tests {
|
||||
let len = config.block_cache_truncation.unwrap();
|
||||
|
||||
let seconds_per_voting_period =
|
||||
<MainnetEthSpec as EthSpec>::SlotsPerEth1VotingPeriod::to_u64()
|
||||
* (spec.milliseconds_per_slot / 1000);
|
||||
<MainnetEthSpec as EthSpec>::SlotsPerEth1VotingPeriod::to_u64() * spec.seconds_per_slot;
|
||||
let eth1_blocks_per_voting_period = seconds_per_voting_period / spec.seconds_per_eth1_block;
|
||||
let reduce_follow_distance_blocks =
|
||||
config.follow_distance / ETH1_BLOCK_TIME_TOLERANCE_FACTOR;
|
||||
|
||||
Reference in New Issue
Block a user