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 gRPC query to get all contract specs and record specs for a scope spec #677

Closed
4 tasks
minxylynx opened this issue Feb 24, 2022 · 3 comments · Fixed by #1399
Closed
4 tasks

Add gRPC query to get all contract specs and record specs for a scope spec #677

minxylynx opened this issue Feb 24, 2022 · 3 comments · Fixed by #1399
Assignees
Labels
enhancement New feature or request metadata Metadata Module
Milestone

Comments

@minxylynx
Copy link
Contributor

Summary

There a several gRPC queries used by Explorer to fetch spec data. However, there is not a one and done query to get all contract and record specs under a scope spec, as there is for sessions and records under a scope. This would add a query that gives all requested information under a scope spec.

Proposal


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@iramiller iramiller added this to the v1.9.0 milestone Mar 2, 2022
@iramiller iramiller modified the milestones: v1.13.0, v1.14.0 Sep 21, 2022
@iramiller iramiller moved this from Todo to Backlog in Provenance Core Protocol Team Dec 12, 2022
@iramiller iramiller modified the milestones: v1.14.0, v1.15.0 Jan 25, 2023
@egaxhaj egaxhaj self-assigned this Feb 13, 2023
@egaxhaj egaxhaj added enhancement New feature or request metadata Metadata Module labels Feb 13, 2023
@egaxhaj egaxhaj moved this from Backlog to Todo in Provenance Core Protocol Team Feb 13, 2023
@SpicyLemon
Copy link
Contributor

SpicyLemon commented Mar 2, 2023

I just got some counts of specs on mainnet.

Scope Specs: 22
Contract Specs: 7609
Record Specs: 24983

Ave record specs per contract spec = 24983/7609 = 3.28334866605336
Ave contract specs per scope spec = 7609/22 = 345.863636363636
Ave record specs per contract spec = 24983/22 = 1135.59090909091

So the average result would have 1 scope spec + 3 contract specs + 1136 record specs = 1140 things in the result.

That's a pretty big result.

Furthermore, since there's only 22 scopes, I grabbed them all to get contract spec counts for each. Here's the distribution:

scope specs number of contract specs
15 1
1 5
1 9
1 30
1 112
1 129
1 747
1 2401

That scope spec with 2401 contract specs probably has 2401 * 3.28334866605336 = 7883.32014719412 records. That's 1 scope + 2401 contract specs + 7883 record specs = 10285 things in the result. That's more than likely a problem.

Pagination doesn't make sense for this query since we're returning three different types of things. I guess only two might need pagination, but that's still complicated.

Testnet has more of each spec type, but the averages and that max are pretty similar.

I guess this is something to consider, and keep an eye on, but it's possible the query just doesn't work for some scope specs (or takes multiple tries).

@SpicyLemon
Copy link
Contributor

Also, rather than adding a new query for this, it's probably best to just enhance the ScopeSpecification query to behave similar to the Scope query.

@SpicyLemon
Copy link
Contributor

Also consider enhancing the ContractSpecification query to be able to also include the records specs for it. A contract spec can be used by multiple scope specs. If we have an index for getting scope specs by contract spec id, it might be worth possibly including the scope specs there too. If we don't have such an index, definitely don't include scope specs here.

The only enhancement I would consider for the RecordSpecification query is possibly including its ContractSpecification too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request metadata Metadata Module
Projects
Development

Successfully merging a pull request may close this issue.

4 participants