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

include block height, timestamp in chain-streams #5508

Closed
dckc opened this issue Jun 3, 2022 · 9 comments · Fixed by #5942
Closed

include block height, timestamp in chain-streams #5508

dckc opened this issue Jun 3, 2022 · 9 comments · Fixed by #5942
Assignees
Labels
cosmic-swingset package: cosmic-swingset enhancement New feature or request notifier
Milestone

Comments

@dckc
Copy link
Member

dckc commented Jun 3, 2022

What is the Problem Being Solved?

Consumers of tick data require block_number, timestamp as part of borrow and lend positions

{account_address, token_symbol, supply_balance, borrow_balance, block_number,  timestamp}

Description of the Design

I leave that to later.

Security Considerations

Test Plan

cc @michaelfig

@dckc dckc added enhancement New feature or request cosmic-swingset package: cosmic-swingset notifier labels Jun 3, 2022
@dckc
Copy link
Member Author

dckc commented Jun 16, 2022

I learned from @michaelfig that cosmjs doesn't currently expose this, so we may have some upstream work to do.

@dckc
Copy link
Member Author

dckc commented Jul 21, 2022

I was going to make an upstream feature request, but I see the question has already been asked and answered:

@dckc dckc assigned gibson042 and unassigned michaelfig Jul 21, 2022
@Tartuffo
Copy link
Contributor

Time consuming because we have to tweak the Go code and not break existing consumers in the process.

@dckc
Copy link
Member Author

dckc commented Jul 28, 2022

we have to tweak the Go code

Really? how so? The go code already produces the block number and timestamp, no?
The only problem I see is that the cosmjs library doesn't expose it.

@dckc dckc changed the title include block number, timestamp in chain-streams include block height, timestamp in chain-streams Aug 12, 2022
@dckc
Copy link
Member Author

dckc commented Aug 12, 2022

looks like get-flattened-publication.sh from #5878 includes a work-around.

@gibson042
Copy link
Member

Yes, to some extent. It reports the block height of the RPC response, but not of the data itself.

@dckc
Copy link
Member Author

dckc commented Aug 12, 2022

Ah. thanks for clarifying.

@dckc
Copy link
Member Author

dckc commented Aug 23, 2022

@gibson042 I'm struggling to find a timestamp. Help?

"value": "{\"blockHeight\":\"17\",\"values\":[\"{\\\"body\\...

@gibson042
Copy link
Member

gibson042 commented Aug 23, 2022

We are not currently duplicating block timestamp in published data since time is available in the header of each block.

$ curl -sS https://xnet.rpc.agoric.net/ -X POST -H 'Content-Type: application/json' \
  --data '{ "jsonrpc": "2.0", "id": 1, "method": "block", "params": {} }' | \
  jq '.result.block.header'
{
  "version": {
    "block": "11"
  },
  "chain_id": "agoricxnet-13",
  "height": "77063",
  "time": "2022-08-23T16:35:47.681142362Z",
  "last_block_id": {
    "hash": "06E0AB8D1794FBA24D2709CFD31AB1289607E9CA618EB20BF238A9D3609233E4",
    "parts": {
      "total": 1,
      "hash": "1A3E5E2F4E4617061BC68DC52670DFFA1966AB5DBE1E021128DA626951E7F45B"
    }
  },
  "last_commit_hash": "33668043EB5F83D635DA07A838478C0E8066917CC5032A8B606A4284AE26CF5D",
  "data_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855",
  "validators_hash": "DED39EA80CF103DACB8B374AFF7824B66C46826E9543A3AF5DDD7FF5736E3C1E",
  "next_validators_hash": "DED39EA80CF103DACB8B374AFF7824B66C46826E9543A3AF5DDD7FF5736E3C1E",
  "consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F",
  "app_hash": "C744487BCFE8D883354A54AEFE699C6DF678AD2E2733F252CADEF08FEF7F593D",
  "last_results_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855",
  "evidence_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855",
  "proposer_address": "BFDCF84240F368658855C5BF04C8D8CA54915565"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cosmic-swingset package: cosmic-swingset enhancement New feature or request notifier
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants