Skip to content

gRPC: add tip timestamp to ChainPoint response#1134

Open
carbolymer wants to merge 1 commit intomasterfrom
mgalazyn/fix/add-tip-timestamp
Open

gRPC: add tip timestamp to ChainPoint response#1134
carbolymer wants to merge 1 commit intomasterfrom
mgalazyn/fix/add-tip-timestamp

Conversation

@carbolymer
Copy link
Contributor

@carbolymer carbolymer commented Mar 13, 2026

Changelog

- description: |
    gRPC: add tip timestamp to ChainPoint response
# uncomment types applicable to the change:
  type:
  # - feature        # introduces a new feature
  # - breaking       # the API has changed in a breaking way
  # - compatible     # the API has changed but is non-breaking
  # - optimisation   # measurable performance improvements
  # - refactoring    # QoL changes
   - bugfix         # fixes a defect
  # - test           # fixes/modifies tests
  # - maintenance    # not directly related to the code
  # - release        # related to a new release preparation
  # - documentation  # change in code docs, haddocks...
# uncomment at least one main project this PR is associated with
  projects:
  # - cardano-api
  # - cardano-api-gen
   - cardano-rpc
  # - cardano-wasm

Context

Tested in:

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. See Running tests for more details
  • Self-reviewed the diff

@carbolymer carbolymer self-assigned this Mar 13, 2026
@carbolymer carbolymer linked an issue Mar 13, 2026 that may be closed by this pull request
@carbolymer carbolymer force-pushed the mgalazyn/fix/add-tip-timestamp branch 3 times, most recently from d65f369 to 12b6502 Compare March 16, 2026 22:09
@carbolymer carbolymer force-pushed the mgalazyn/fix/add-tip-timestamp branch from 12b6502 to ca2340d Compare March 16, 2026 22:40
@carbolymer carbolymer marked this pull request as ready for review March 16, 2026 22:42
Copilot AI review requested due to automatic review settings March 16, 2026 22:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the previously-unpopulated timestamp field in gRPC ChainPoint responses by computing tip time from SystemStart + EraHistory, and updates the encoding/decoding utilities and tests accordingly.

Changes:

  • Populate ChainPoint.timestamp in readParams / readUtxos by querying SystemStart and EraHistory and converting the tip slot to POSIX milliseconds.
  • Extend mkChainPointMsg to accept a timestamp and add a corresponding decoder (utxoRpcChainPointMsgToChainPoint).
  • Add a Hedgehog roundtrip property for ChainPoint including the timestamp field; add required time dependency.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
cardano-rpc/src/Cardano/Rpc/Server/Internal/UtxoRpc/Query.hs Queries SystemStart/EraHistory, computes tip timestamp, passes it into mkChainPointMsg.
cardano-rpc/src/Cardano/Rpc/Server/Internal/UtxoRpc/Type.hs Adds timestamp field to mkChainPointMsg and introduces a corresponding decode helper.
cardano-rpc/test/cardano-rpc-test/Test/Cardano/Rpc/Type.hs Adds a ChainPoint protobuf roundtrip property including timestamp.
cardano-rpc/cardano-rpc.cabal Adds time as a library dependency.
cardano-api/src/Cardano/Api/Query/Internal/Type/QueryInMode.hs Introduces slotToUTCTime conversion helper.
cardano-api/src/Cardano/Api/Query.hs Re-exports slotToUTCTime.
cardano-api/src/Cardano/Api/Internal/Orphans/Misc.hs Adds Error PastHorizonException instance to support error handling in callers.

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.

gRPC: Populate timestamp field in ChainPoint RPC responses

2 participants