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

Use DeploymentId type from toolshed repo #63

Merged
merged 4 commits into from
Oct 11, 2023
Merged

Conversation

Jannis
Copy link
Collaborator

@Jannis Jannis commented Sep 29, 2023

This drops the custom SubgraphDeploymentID type in favor of the DeploymentId type from the https://github.com/edgeandnode/toolshed repository, which we're working on making sort of a Graph standard utility library.

Saves a bunch of code and is one more isolated piece of #54.

@Jannis Jannis force-pushed the jannis/clean-up-types branch 2 times, most recently from 362f30a to 2a2a635 Compare September 29, 2023 19:51
@Jannis Jannis marked this pull request as ready for review September 29, 2023 19:51
@Jannis Jannis changed the title Use types from toolshed repo Use DeploymentId from toolshed repo Sep 29, 2023
@Jannis Jannis changed the title Use DeploymentId from toolshed repo Use DeploymentId typefrom toolshed repo Sep 29, 2023
@Jannis Jannis changed the title Use DeploymentId typefrom toolshed repo Use DeploymentId type from toolshed repo Sep 29, 2023
@Jannis Jannis force-pushed the jannis/clean-up-types branch from 2a2a635 to d271e84 Compare September 29, 2023 19:54
@Jannis Jannis requested review from aasseman and hopeyen September 29, 2023 19:59
@Jannis Jannis force-pushed the jannis/clean-up-types branch from d271e84 to a2c115b Compare September 29, 2023 20:10
@Jannis Jannis changed the title Use DeploymentId type from toolshed repo Use DeploymentId type from toolshed repo [WIP, DO NOT REVIEW] Sep 29, 2023
@Jannis Jannis force-pushed the jannis/clean-up-types branch 3 times, most recently from 39240d8 to ce104b1 Compare September 29, 2023 21:14
@Jannis Jannis changed the title Use DeploymentId type from toolshed repo [WIP, DO NOT REVIEW] Use DeploymentId type from toolshed repo Sep 29, 2023
@aasseman aasseman added size:medium Medium p2 Medium priority type:refactor Changes not visible to users labels Sep 29, 2023
hopeyen
hopeyen previously approved these changes Oct 10, 2023
Copy link
Collaborator

@hopeyen hopeyen left a comment

Choose a reason for hiding this comment

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

lgtm, just need to pass the formatting check

aasseman
aasseman previously approved these changes Oct 11, 2023
Copy link
Contributor

@aasseman aasseman left a comment

Choose a reason for hiding this comment

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

Looks great, though I didn't really look into what's going on with service/src/common/indexer_management/mod.rs.

@Jannis Jannis dismissed stale reviews from aasseman and hopeyen via bdc158d October 11, 2023 14:44
@Jannis
Copy link
Collaborator Author

Jannis commented Oct 11, 2023

Looks great, though I didn't really look into what's going on with service/src/common/indexer_management/mod.rs.

@aasseman There's two main changes there:

  1. There were a few issues between the deployments filter for cost models and what was returned (and merged with the global cost model).
  2. I tried to strongly type the deployment field of the CostModel type and still make deserialization from the database work but gave up after two days (among other things, the special "global" deployment ID in the cost model table was annoying. So now there's three types:
  • DbCostModel is an internal type and is what is returned by the db queries, with deployment IDs being String ("0x...").
  • CostModel is the public type returned by the cost_models() and cost_model() functions; this never includes "global" as the deployment, so DeploymentId worked well here.
  • GqlCostModel is a helper type to serialize deployments in cost models to IPFS hashes.

@Jannis Jannis force-pushed the jannis/clean-up-types branch from bdc158d to cff89d4 Compare October 11, 2023 15:48
@hopeyen
Copy link
Collaborator

hopeyen commented Oct 11, 2023

There were a few issues between the deployments filter for cost models and what was returned (and merged with the global cost model).

Could you describe what the issues were for the previous cost model responses? I read through the test cases and they seemed to match with my understanding of how it worked

So now there's three types

I can't seem to find GqlCostModel here or in toolshed, could you help me locate it 🤔 ?

@Jannis
Copy link
Collaborator Author

Jannis commented Oct 11, 2023

There were a few issues between the deployments filter for cost models and what was returned (and merged with the global cost model).

Could you describe what the issues were for the previous cost model responses? I read through the test cases and they seemed to match with my understanding of how it worked

One was that if you provided no deployments filter for cost_model(), it would return all existing cost models (including the "global" one, I think) without merging in the global model (https://github.com/graphops/indexer-service-rs/pull/63/files#diff-21ab5cb781d51883665196101d048fe83b746acdd69253df92bdedcfcf6cbba9L85).

It may be that that was the only one related to the database. Another was that the error handling around invalid deployment IDs passed in via GraphQL was a bit sketchy, and the conversion between IPFS hashes (required for the GraphQL API) and hex strings (required for the database) wasn't very robust. I tried to make those parts more obvious and robust.

So now there's three types

I can't seem to find GqlCostModel here or in toolshed, could you help me locate it 🤔 ?

@hopeyen Ooops, it's called GraphQlCostModel: https://github.com/graphops/indexer-service-rs/pull/63/files#diff-30f1dd4cff74e5decaff51bc44c6cea8ddc6f74813106dbe1c0fe609d5ca6b6bR19

@aasseman
Copy link
Contributor

Looks great, though I didn't really look into what's going on with service/src/common/indexer_management/mod.rs.

@aasseman There's two main changes there:

  1. There were a few issues between the deployments filter for cost models and what was returned (and merged with the global cost model).
  2. I tried to strongly type the deployment field of the CostModel type and still make deserialization from the database work but gave up after two days (among other things, the special "global" deployment ID in the cost model table was annoying. So now there's three types:
  • DbCostModel is an internal type and is what is returned by the db queries, with deployment IDs being String ("0x...").
  • CostModel is the public type returned by the cost_models() and cost_model() functions; this never includes "global" as the deployment, so DeploymentId worked well here.
  • GqlCostModel is a helper type to serialize deployments in cost models to IPFS hashes.

Thanks 🙏 !

@aasseman aasseman requested review from aasseman and hopeyen October 11, 2023 17:29
Copy link
Collaborator

@hopeyen hopeyen left a comment

Choose a reason for hiding this comment

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

thanks for the explanation. looks good!

@Jannis Jannis merged commit 5ad15ec into main Oct 11, 2023
4 checks passed
@Jannis Jannis deleted the jannis/clean-up-types branch October 11, 2023 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2 Medium priority size:medium Medium type:refactor Changes not visible to users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants