diff --git a/README.md b/README.md index b804463..9520e97 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,75 @@ +# mev-inspect -### Local setup +## Running locally +Setup Docker -Requirements: +Start the services with Docker Compose +``` +docker compose up +``` +or to run in the background +``` +docker compose up -d +``` -* python3 and pip3 +To stop the services +``` +docker compose down +``` -Instructions to run: +## Executing scripts +To run a command, prefix it with +``` +docker compose exec mev-inspect +``` -* Setup a virtual enviroment to manage dependencies (optional) - * `python3 -m venv env` -* Activate it - * `. env/bin/activate` (exit with `deactivate`) -* web3 build-related dependencies (on Ubuntu 20.04) - * `sudo apt-get install libevent-dev libpython3.8-dev python3.8-dev libssl-dev` -* Install python libraries - * `pip3 install -r requirements.txt` -* Run tests for token flow - * `python -m unittest tests/tokenflow_test.py` +For example, to run `testing_file.py`: +``` +docker compose exec mev-inspect python testing_file.py \ + -block_number 11931271 \ + -rpc 'http://111.11.11.111:8545' +``` -If contributing: -* Install dev libraries - * `pip3 install -r requirements_dev.txt` -* Setup pre-commit - * `pre-commit install` -* Install dependencies and verify it's working - * `pre-commit run --all-files` - * If you see "failed to find interpreter for..." it means you're missing the correct python version - * The current version is python3.9 - [pyenv](https://github.com/pyenv/pyenv) is a great option for managing python versions +Or to run the tests: +``` +docker compose exec mev-inspect python -m unittest test/*py +``` + +## Rebuilding containers +After changes to the app's Dockerfile, rebuild with +``` +docker compose build +``` + +## Contributing +Contributing requires installing the pre-commit hooks + +1 . Ensure you're using python 3.9 + +If not, [pyenv](https://github.com/pyenv/pyenv) is a great option for managing python versions + +2. Create a virtualenv +``` +python3 -m venv venv +``` + +3. Activate it +``` +. venv/bin/activate +``` +(exit with `deactivate`) + +4. Install dev libraries +``` +pip install -r requirements_dev.txt +``` + +5. Install pre-commit +``` +pre-commit install +``` + +6. Install pre-commit's dependencies and ensure it's working +``` +pre-commit run --all-files +``` diff --git a/docker-compose.yml b/docker-compose.yml index daac090..a82f926 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,5 @@ services: - app: + mev-inspect: build: . depends_on: - db