Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UTC Time to slots conversion function #5130

Merged
merged 1 commit into from
Apr 26, 2023

Conversation

carbolymer
Copy link
Contributor

@carbolymer carbolymer commented Apr 19, 2023

Description

This is a part of #4928 . This changeset introduces a conversion function: UTC time -> slot number.

The function was tested in #5142

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. These may include:
    • golden tests
    • property tests
    • roundtrip tests
    • integration tests
      See Runnings tests for more details
  • Any changes are noted in the CHANGELOG.md for affected package
  • The version bounds in .cabal files are updated
  • Code is linted with hlint. See .github/workflows/check-hlint.yml for to get the hlint version
  • Code is formatted with stylish-haskell. See .github/workflows/stylish-haskell.yml for to get the stylish-haskell version
  • Self-reviewed the diff

@carbolymer carbolymer force-pushed the mgalazyn/feature/get-slot-from-timestamp branch from d3bf90c to 5a7f583 Compare April 21, 2023 16:14
@carbolymer carbolymer force-pushed the mgalazyn/feature/get-slot-from-timestamp branch from 5a7f583 to 5b6fd2f Compare April 24, 2023 10:37
@carbolymer carbolymer marked this pull request as ready for review April 24, 2023 10:38
Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Update the changelog and tidy the commits 👍

cardano-api/src/Cardano/Api/Query.hs Show resolved Hide resolved
@newhoggy
Copy link
Contributor

I think this can be one commit, or two commits: one for api changes and one for cli changes.

@carbolymer carbolymer force-pushed the mgalazyn/feature/get-slot-from-timestamp branch from 19a85b5 to 55b14d2 Compare April 26, 2023 11:08
Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work 👍

@@ -1422,6 +1424,41 @@ toTentativeEpochInfo (EraHistory _ interpreter) =
$ hoistEpochInfo (first (Text.pack . show) . runExcept)
$ Consensus.interpreterToEpochInfo (Consensus.unsafeExtendSafeZone interpreter)


-- | Get slot number for timestamp, or an error if the UTC timestamp is before 'SystemStart' or after N+1 era
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

N being the current era right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this function should work for current and next eras.

@carbolymer carbolymer added this pull request to the merge queue Apr 26, 2023
Merged via the queue into master with commit 4a455c0 Apr 26, 2023
@iohk-bors iohk-bors bot deleted the mgalazyn/feature/get-slot-from-timestamp branch April 26, 2023 14:00
@saratomaz saratomaz restored the mgalazyn/feature/get-slot-from-timestamp branch May 11, 2023 14:51
@Jimbo4350 Jimbo4350 deleted the mgalazyn/feature/get-slot-from-timestamp branch May 11, 2023 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants