-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Description This PR provides everything needed for making the services work on Sepolia. This almost exclusively means populating the contract crate with relevant addresses on Sepolia and directly related changes. The main problem with Sepolia is the lack of liquidity, even compared to Görli. The only liquidity source we have available is a third-party Uniswap v2 deployment where I deployed some liquidity myself. We also have Balancer, but I need to sort things out with the subgraph URL (see [2139](#2139)) so this will happen in a later PR. # Changes - New contract addresses for Sepolia. - New Uniswapv2-like liquidity source on Sepolia (`TestnetUniswapV2`) and related ignored test. Router, factory and pair are exactly the same as on vanilla mainnet except for two things: - The Sepolia factory has an extra line `bytes32 public constant INIT_CODE_HASH = keccak256(abi.encodePacked(type(UniswapV2Pair).creationCode));`. - the [compilation metadata](https://docs.soliditylang.org/en/v0.8.23/metadata.html#encoding-of-the-metadata-hash-in-the-bytecode) is different, which in turn causes the init hash to be different, but this has no impact on the actual functionality of the contract. - Removed `SolverTrampoline`. It was introduced [here](704fb32) for [this feature](8b875ed) but it wasn't removed when that feature was removed [here](2ec435c). - New comment on how to compute the init code hash of an unknown Uniswapv2 deployment. - Removed broken Uniswapv2 address on Gnosis Chain (this is address `0x1b02da8cb0d097eb8d57a175b88c7d8b47997506`, which is actually the _Sushiswap_ address and since the init code hash is different it wouldn't be working if enabled). - Update domain separator test to use new deployment on Sepolia. ## Not included - Update API urls to include Sepolia (will do that once the API is available). - Balancer support (because of the subgraph issue). - Univ3 liquidity (available but I didn't find a subgraph we can trust and I'm unsure what happens if we use an unreliable subgraph). ## How to test Try to run the entire setup locally. I tried with autopilot, orderbook, baseline solver and driver in colocation mode. [Here](https://sepolia.etherscan.io/tx/0x545bc8df347f2859a45b5e3d869b39c8eea7b9a08be30e7d91a0508152774821) is an executed settlement. <details><summary>Here is what I did.</summary> Create the following files. <details><summary>./sepolia-addressbook-orderbook.env</summary> ``` export NODE_URL='https://ethereum-sepolia.publicnode.com' export NATIVE_PRICE_ESTIMATORS='Baseline' export GAS_ESTIMATORS=native weth_balancer='0x7b79995e5f793a07bc00c21412e50ecae098e7f9' weth_uniswap='0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14' export BASE_TOKENS="$weth_uniswap" export BASELINE_SOURCES='TestnetUniswapV2' export CHAIN_ID=11155111 export AMOUNT_TO_ESTIMATE_PRICES_WITH=100000000000000000 export ETHFLOW_CONTRACT='0x2671994c7D224ac4799ac2cf6Ef9EF187d42C69f' export ETHFLOW_INDEXING_START='4718695' export DRIVERS='baseline|http://127.0.0.1:12345/baseline/' export ENABLE_COLOCATION=true ``` </details> <details><summary>./sepolia-baseline-solver-engine.toml</summary> ``` base-tokens = ['0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14'] chain-id = '11155111' max-hops = 1 max-partial-attempts = 5 risk-parameters = [0, 0, 0, 30] ``` </details> <details><summary>./sepolia-driver.toml (but you need to add a valid solver secret key here, search in 1password for "Sepolia test solver PK")</summary> ``` [contracts] [liquidity] base-tokens = ['0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14'] [[liquidity.uniswap-v2]] preset = 'testnet-uniswap-v2' [[solver]] account = '0x77927c2c3E6977badeAB8bd1d74051d1fEB36f88' # replace address with the actual secret key! endpoint = 'http://127.0.0.2:23456' name = 'baseline' relative-slippage = '0.01' [submission] additional-tip-percentage = 0.05 gas-price-cap = 1000000000000.0 max-confirm-time-secs = 120 [[submission.mempool]] mempool = 'public' revert-protection = false ``` </details> Run the following commands (each group in different terminals). ```sh docker-compose up --build db migrations ``` (You can clear everything with with `docker-compose down --remove-orphans --volumes`.) ```sh cargo run --bin solvers -- --addr 127.0.0.2:23456 baseline --config ./sepolia-baseline-solver-engine.toml ``` ```sh cargo run --bin driver -- --config ./sepolia-driver.toml --addr '127.0.0.1:12345' --ethrpc 'https://ethereum-sepolia.publicnode.com' ``` ```sh source sepolia-autopilot-orderbook.env && cargo run --bin orderbook ``` ```sh source sepolia-autopilot-orderbook.env && cargo run --bin autopilot ``` To create a new order I used the code [here](https://github.com/cowprotocol/contracts/tree/test-sepolia-order). Install and run `export PK=<your own pk>; bash order.sh` after getting a few WETH (at least 2, find them in the team test fund safe [here](https://app.safe.global/transactions/queue?safe=sep:0x01B94B667236a7896aC85D5bccdF23f26b10e6Cc)) and approving the vault relayer. </details>
- Loading branch information
Showing
16 changed files
with
243 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
IUniswapLikeRouter.json |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters