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

feat: change subgraph constructor to use full urls #2381

Merged
merged 35 commits into from
Mar 22, 2024

Conversation

fredmarques
Copy link
Contributor

Description

This PR fixes #2105

Changes

Subgraph constrictor now uses full urls

How to test

All unit tests still pass

Related Issues

Fixes #2105

@fredmarques fredmarques requested a review from a team as a code owner February 6, 2024 23:19
Copy link

github-actions bot commented Feb 6, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@fredmarques
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

Copy link
Contributor

@MartinquaXD MartinquaXD 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 your contribution!
Looks good so far. It's just that we have to pass in 1 additional argument because we need to use 2 different URLs for balancer and uniswap.

Copy link
Contributor

@fleupold fleupold left a comment

Choose a reason for hiding this comment

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

crates/driver/src/infra/config/file/mod.rs also needs to get the url on both the BalancerV2 as well as the Uniswapv3 struct. Can we also make sure the existing integration tests (not part of CI) are still working?

@fredmarques
Copy link
Contributor Author

Thanks for the the directions @fleupold
All tests are green now.

  • ✅ test-db
  • ✅ test-driver
  • ✅ test-local-node
  • ✅ unit-tests

FYI: this is my first time doing some rust after reading the Rust Book so I much appreciate the patience on providing some directions.

Copy link
Contributor

@MartinquaXD MartinquaXD left a comment

Choose a reason for hiding this comment

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

Also thanks for being patient with our feedback. We know that all the config code is not the easiest to maneuver. :)

Only thing left is to move the config arguments to the right location for the driver.
In the end you should be able to configure something like:

[[liquidity.balancer-v2]]
vault = "0x..."
# ...other balancer args
graph-url = "https://..."

instead of:

[liquidity]
balancer-graph-url = "https://..."

[[liquidity.balancer-v2]]
# args without graph-url

Copy link
Contributor

@fleupold fleupold left a comment

Choose a reason for hiding this comment

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

Hi @fredmarques, this PR looks pretty good already, only missing thing seems to be to move uniswap_v3_graph_url into the UniswapV3Config struct (and balancer_v2_graph_url into BalancerV2Config).

Are you still planning to do this change?

@fredmarques
Copy link
Contributor Author

Oh yes! I was fixing some tests and something else required my attention. Let me finalize it.

@fredmarques
Copy link
Contributor Author

I'm facing this issue:

error[E0658]: use of unstable library feature 'arc_unwrap_or_clone'
  --> crates/shared/src/price_estimation/trade_finder.rs:58:15
   |
58 |             ..Arc::unwrap_or_clone(self.inner)
   |               ^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #93610 <https://github.com/rust-lang/rust/issues/93610> for more information

For more information about this error, try `rustc --explain E0658`.

Are we using nightly rust?

@MartinquaXD
Copy link
Contributor

Are we using nightly rust?
Nope, but this function was stabilized in the most recent Rust version. Try updating your Rust to 1.76.

@fredmarques
Copy link
Contributor Author

that must be it. I'm on 1.75.
updating...

@fredmarques
Copy link
Contributor Author

I'm trying to run test-forked-node with

FORK_URL_MAINNET="https://eth.merkle.io" FORK_URL_GNOSIS="https://rpc.gnosischain.com/"  cargo nextest run -p e2e forked_node --nocapture --run-ignored ignored-only

I'm getting this error:

Failed to create genesis: GetAccount(0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266, Server returned an error response: ErrorPayload code -32002, message: "No state available for block 32070725 (0x942186094b13c1670898d24c9449f7bce4f26bd216a64839501fd03a5c8d6142)", contains payload: true

I assume my FORK_URL_GNOSIS is wrong.

@fredmarques
Copy link
Contributor Author

We should have this documented. If not, with public URLs (I don't know why it's a secret on Git Hub Actions), at least the step-by-step procedure on how to obtain such URLs.

@fredmarques fredmarques requested a review from fleupold February 27, 2024 13:49
@fleupold
Copy link
Contributor

For forked tests you need an archive node. If you don't have access to one (I don't know of a free version for Gnosis Chain), don't worry we can let the CI run those tests (they are unlikely to fail due to this code change)

@fredmarques
Copy link
Contributor Author

Great! Now I only see outdated conversationi so can we run the CI one more time? I got all green tests on my local.

Copy link

This pull request has been marked as stale because it has been inactive a while. Please update this pull request or it will be automatically closed.

@github-actions github-actions bot added the stale label Mar 18, 2024
@fredmarques
Copy link
Contributor Author

@fleupold could you do another review?

@github-actions github-actions bot removed the stale label Mar 19, 2024
Copy link
Contributor

@fleupold fleupold left a comment

Choose a reason for hiding this comment

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

Sorry for the delay here. Will re-run the tests. Unfortunately I noticed a configuration issue that I'm not happy with (somewhat silently failing with default values on other chains).

I'm not sure if you still have energy to work through that. Otherwise I'll try to amend this PR sometime this week.

#[clap(
long,
env,
default_value = "https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-v2"
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not great that this default now only works for mainnet.
I wonder if it would be better to make this value Option and implement the default based on the current connected chain similar to how we have it currently

Copy link
Contributor

Choose a reason for hiding this comment

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

Since the graph is shutting down for good there is no public URL that we could be using for these defaults.
Will make all values optional and only enable the liquidity source if the URLs have been set. Also there are a bunch of old and ignored tests that need the public URLs. I will delete them since they will no longer be functional.

@MartinquaXD
Copy link
Contributor

Hi, since the graph apparently actually shut down the old hosted graphs for good we need this PR merged now ASAP to be able to index balancer and uniswap v3 liquidity again.
I will push your PR over the finish line. Thanks for your contribution anyway. 🚀

@MartinquaXD MartinquaXD enabled auto-merge (squash) March 22, 2024 13:29
@MartinquaXD MartinquaXD requested a review from fleupold March 22, 2024 13:33
@MartinquaXD MartinquaXD dismissed fleupold’s stale review March 22, 2024 13:39

changes addressed and this hotfix is urgent

@MartinquaXD MartinquaXD merged commit 6ff4eda into cowprotocol:main Mar 22, 2024
8 of 9 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Mar 22, 2024
@fredmarques fredmarques deleted the configurable-subgraph-urls branch March 22, 2024 14:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: Make subgraph URL's configurable
5 participants