-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into dev_actor_adjust
- Loading branch information
Showing
20 changed files
with
208 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
Blockchain/Sources/Blockchain/Config/ProtocolConfig+Timing.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import Foundation | ||
import Utils | ||
|
||
extension ProtocolConfigRef { | ||
// TODO: determine appropriate values | ||
public var authoringStartTimeDelta: TimeInterval { | ||
-TimeInterval(value.slotPeriodSeconds) | ||
} | ||
|
||
public var authoringDeadline: TimeInterval { | ||
TimeInterval(value.slotPeriodSeconds) / 3 | ||
} | ||
|
||
public var guaranteeingStartTimeDelta: TimeInterval { | ||
authoringStartTimeDelta - TimeInterval(value.slotPeriodSeconds) | ||
} | ||
|
||
public var guaranteeingDeadline: TimeInterval { | ||
TimeInterval(value.slotPeriodSeconds) / 3 * 2 | ||
} | ||
|
||
public var prepareEpochStartTimeDelta: TimeInterval { | ||
-TimeInterval(value.slotPeriodSeconds) * 3 | ||
} | ||
|
||
public func scheduleTimeForAuthoring(timeslot: TimeslotIndex) -> TimeInterval { | ||
TimeInterval(timeslot.timeslotToTime(config: self)) + authoringStartTimeDelta | ||
} | ||
|
||
public func scheduleTimeForGuaranteeing(timeslot: TimeslotIndex) -> TimeInterval { | ||
TimeInterval(timeslot.timeslotToTime(config: self)) + guaranteeingStartTimeDelta | ||
} | ||
|
||
public func scheduleTimeForPrepareEpoch(epoch: EpochIndex) -> TimeInterval { | ||
let timeslot = epoch.epochToTimeslotIndex(config: self) | ||
return TimeInterval(timeslot.timeslotToTime(config: self)) + prepareEpochStartTimeDelta | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.