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

Return the block timestamp #381

Open
JoeCap08055 opened this issue Aug 14, 2024 · 1 comment
Open

Return the block timestamp #381

JoeCap08055 opened this issue Aug 14, 2024 · 1 comment
Labels

Comments

@JoeCap08055
Copy link
Contributor

JoeCap08055 commented Aug 14, 2024

Description

As a Gateway client developer, I want to know, as accurately as possible given the available data, the time at which a given piece of content was posted to the chain. This allows the application to choose which timestamp.

Acceptance Criteria

  • Add a blockTimestamp field to the content watcher webhook

Prior Discussion

Elaboration

We have some TODOs in the code; one of them is to come up with a reasonable timestamp to attach to content display. For now, we've been encoding the time that the content (Parquet file) was retrieved from IPFS by the SAT backend; obviously this is not acceptable by any means, as it would be different for different backends. It's also not reasonable to expect a client to convert a block number to a time, because:

  • Block times now with async backing are not consistent enough
  • Don't want to force the client to interact directly with the chain, or have to provide an endpoint to do block number → timestamp conversion. Also if the goal is to insulate web2 developers from needing to grok web3 concepts, forcing them to deal with block numbers is the opposite of that.

My initial thought is that content-watcher should get the timestamp inherent from the block when it retrieves content, and include that in the webhook payload when it sends out the content notifications. Reasons?

  • content-publisher is not the right place, because it would require a DSNP spec change, or at minimum a Frequency extension to the spec
  • Forcing the client to do it subverts the purpose of Gateway (see above)

Discussion?

@aramikm pointed out below that the actual content does contain a published datetime. However, this raises a further issue: currently, content-watcher only broadcasts the on-chain content announcement, not the content itself. It's left to the client to retrieve the Parquet batch file and validate/decode it.

In discussion with @wilwade , it was suggested that perhaps it would be better (and more in line with the goal of the Gateway services) to have content-watcher fetch, decode and validate the batched Parquet content and broadcast the individual message content, instead of just an announcement of the content.

@JoeCap08055 JoeCap08055 added the enhancement New feature or request label Aug 14, 2024
@aramikm
Copy link
Contributor

aramikm commented Aug 14, 2024

We do have a published date field on content activity. https://spec.dsnp.org/ActivityContent/Types/Note.html

@wilwade wilwade changed the title Display timestamp with posted content Return the block timestamp Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants