Skip to content

Latest commit

 

History

History
61 lines (47 loc) · 2.13 KB

README.md

File metadata and controls

61 lines (47 loc) · 2.13 KB

Benchmark find route algorithms

Prerequisites

  • Go 1.17+
  • Redis

Quick Starts guide

From the root folder of the project:

Start Redis

  • Ensure that redis server which run in localhost has existing find route data crawled from ethereum-network scanners.
  • Note that this quickstart guide is used only for Ethereum mainnet network

Prepare old kyberswap algorithm

  1. Clone project
git clone https://github.com/KyberNetwork/kyberswap-aggregator
go mod download
  1. Edit bindAddress in internal/pkg/config/ethereum.yaml to :8081
  2. Run project
go run ./cmd/app -c internal/pkg/config/ethereum.yaml api

Prepare new brute-force kyberswap algorithm

  1. Clone project
git clone -b fix/find-route-algorithm https://github.com/KyberNetwork/kyberswap-aggregator
go mod download
  1. Edit bindAddress in internal/pkg/config/ethereum.yaml to :8080
  2. Run project
go run ./cmd/app -c internal/pkg/config/ethereum.yaml api

Run benchmark script

  1. Clone project
git clone https://github.com/datluongductuan/benchmark-findroute-algorithms
go mod download
  1. Edit parameters in internal/pkg/entity/constants.go as you want, note that increasing in MaxPaths and MaxHops will result in larger complexity. Recommend to use MaxHops = 5 and MaxPaths = 2, this config will give good result when run with amountIn <= 100ETH
  2. Edit parameters in new-algorithm-project at step 4 (project kyberswap-aggreagator, branch fix/find-route-algorithm)
  • In service/route.go, line 628 and 630, edit value of MathPaths and MaxHops as same as the edited values at Step 8.
go run ./cmd/main.go 

Note that every time you changed config at Step 8 and Step 9, you need to restart new-algortihm-project.

  1. Result will save in test.db file at root project directory. You should install SQLite Extension to view/query.

See my benchmark result