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

add new Api to get beacon chain aggregate #746

Conversation

tenmoves
Copy link
Contributor

@tenmoves tenmoves commented Dec 6, 2022

Description

Since the PR #559 beacon and beacon summaries are not anymore transactions. Before we could get these transaction using graphql API networkTransaction, but now we don't have any way to get the summary data.

We create a new schema in graphql like beaconSummary with a timestamp in parameter which returns the beacon aggregate for this date.
If the date is the last summary date, API should use beacon summary and not beacon aggregate as it is done in explorer.

example graphql query

{
  beaconChainSummary(timestamp: 1670369760) {
    version
    p2pAvailabilities
    summaryTime
    availabilityAddingTime
    transactionSummaries(limit: 1, pagingOffset: 2) {
      fee
      type
      timestamp
      address
      movementsAddresses
    }
  }
}

Fixes #639

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Tested locally in graphiQl
  • Unit tests

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@tenmoves tenmoves self-assigned this Dec 6, 2022
@tenmoves tenmoves marked this pull request as ready for review December 7, 2022 14:59
@tenmoves tenmoves added feature New feature request beacon chain Involve BeaconChain API Involve API facing user core team Assigned to the core team labels Dec 7, 2022
@samuelmanzanera
Copy link
Member

I think there is a problem with the summary time

image

The summary should not be DateTime.utc_now but the next summary time.
This is causing the no display of the last transactions recorded.

lib/archethic_web/graphql_schema/resolver.ex Outdated Show resolved Hide resolved
lib/archethic_web/graphql_schema/resolver.ex Outdated Show resolved Hide resolved
lib/archethic_web/graphql_schema/resolver.ex Outdated Show resolved Hide resolved
@tenmoves tenmoves force-pushed the create_new_api_to_get_beacon_aggregate branch from 322e0ab to ea01aaa Compare January 4, 2023 16:20
@bchamagne
Copy link
Member

I think there's something wrong with the dates (I might be wrong)

Screenshot 2023-01-05 at 12-08-41 GraphiQL Workspace
No timestamp given: I can see my transfer

Screenshot 2023-01-05 at 12-09-29 GraphiQL Workspace
I added the timestamp that is the date of the transfer: there is nothing

Screenshot 2023-01-05 at 12-10-45 GraphiQL Workspace
Same timestamp as above but a minute later (1 slot later): the date changed to slot - 1

@tenmoves tenmoves force-pushed the create_new_api_to_get_beacon_aggregate branch from d8f58d1 to f72dbc0 Compare January 10, 2023 09:50
@tenmoves
Copy link
Contributor Author

tenmoves commented Jan 10, 2023

@bchamagne the behaviour you have detected is because you only have a single node running.
I tested with multiple nodes and it seem to work (after I fixed other unrelated issues).

@Neylix Neylix merged commit add0748 into archethic-foundation:develop Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Involve API facing user beacon chain Involve BeaconChain core team Assigned to the core team feature New feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add new API to get beacon aggregate
4 participants