Commit 9374643
Add an utility function to get the first timestamp of a slot (#5316)
# Description
Add `starting_timestamp` function for `Slot` type.
## Integration
This is an addition of public function to a type, so integration should
be seamless for idiomatic use of Rust.
## Review Notes
Since `Slot` is just a slot number, the it's starting timestamp depends
on `SlotDuration` which is a parameter to the added function. This
function can be seen as dual to existing `fn from_timestamp`.
Because there is a potential for overflow, the return type is `Option`.
Q1: should I introduce tests for in this crate and add cases for both
case: overflow (`None`) and no overflow (`Some`)?
Q2: How can I add labels? IMO they should be `T0-node` and `D0-easy` but
I cannot add them using GH interface.
# Checklist
* [x] My PR includes a detailed description as outlined in the
"Description" and its two subsections above.
* [ ] My PR follows the [labeling requirements](CONTRIBUTING.md#Process)
of this project (at minimum one label for `T`
required)
* External contributors: ask maintainers to put the right label on your
PR.
* [ ] I have made corresponding changes to the documentation (if
applicable)
* [ ] I have added tests that prove my fix is effective or that my
feature works (if applicable)
---------
Co-authored-by: Squirrel <giles.cope@iohk.io>
Co-authored-by: Davide Galassi <davxy@datawok.net>1 parent a67d623 commit 9374643
File tree
2 files changed
+18
-0
lines changed- prdoc
- substrate/primitives/consensus/slots/src
2 files changed
+18
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
94 | 101 | | |
95 | 102 | | |
96 | 103 | | |
| |||
0 commit comments