Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/c29r3/mina-snark-stopper
Tool for Mina Protocol
https://github.com/c29r3/mina-snark-stopper
mina-protocol mina-snark-stopper snark-worker
Last synced: 11 days ago
JSON representation
Tool for Mina Protocol
- Host: GitHub
- URL: https://github.com/c29r3/mina-snark-stopper
- Owner: c29r3
- License: gpl-3.0
- Created: 2020-02-03T23:27:32.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-03-28T10:59:02.000Z (over 2 years ago)
- Last Synced: 2024-10-12T05:27:25.147Z (27 days ago)
- Topics: mina-protocol, mina-snark-stopper, snark-worker
- Language: Python
- Homepage:
- Size: 92.8 KB
- Stars: 25
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mina-snark-stopper
Tool for Mina Protocol## Description
This tool can be useful for Mina validators who run node at same time as block producer and snark worker.
Worker can take up all processor time, which negatively affects block producer. When less than `STOP_WORKER_BEFORE_MIN` minutes remain before the next proposal, the script disconnects the worker and starts it after `STOP_WORKER_FOR_MIN` minutes.## Requirements
Python ver. 3.6+## Install
*Your snark worker must be RUNNED. Otherwise, the script will take the Block producer public key*
*Check the configuration file. There are some options you might want to reassign*
**If you run mina daemon through docker, then you need to add the flag `-p 127.0.0.1:3085:3085`**### Tmux
Install
```
sudo apt-get update \
&& sudo apt-get install python3-venv tmux git -y \
&& git clone https://github.com/c29r3/mina-snark-stopper.git \
&& cd mina-snark-stopper \
&& python3 -m venv venv \
&& source ./venv/bin/activate \
&& pip3 install -r requirements.txt
```
Run
```
tmux new -s snark-stopper -d venv/bin/python3 snark-stopper.py
```You can watch the snark-stopper work
`tmux attach -t snark-stopper`Press to exit `ctrl + b` and then `d`
### Docker
1. Download config file and change the parameters to suit you
```
curl -s https://raw.githubusercontent.com/c29r3/mina-snark-stopper/master/config.yml > config.yml
```2. Run docker container
```
sudo docker run -d \
--volume $(pwd)/config.yml:/mina/config.yml \
--volume $(pwd)/snark_stopper.log:/mina/snark_stopper.log \
--net=host \
--restart always \
--user $(id -u):$(id -g) \
--name snark-stopper \
c29r3/snark-stopper
```3. Check logs
`docker logs -f snark-stopper`
If you want to change some parameteres - change it in config file and then restart docker container
`docker restart snark-stopper`## Troubleshooting
If the snark-stopper can't connect to port `3085`:
1. Check port availability
`nc -t -vv localhost 3085`
Output should be something like this:
`Connection to localhost 3085 port [tcp/*] succeeded!`If the connection hangs, then the following options are possible:
- Access to port `3085` is blocked via ufw\iptables
- You did not add a docker container flag `-p 127.0.0.1:3085:3085`
- Node is not synced yet. For this reason the stopper can't connect2. Port responds, but the stopper still can't connect
`iptables -D OUTPUT -d 172.16.0.0/12 -j DROP`
it's because of the blocking of private subnets that the docker uses#### Update docker image
After running the command below, go to step 2
```
docker rm -f snark-stopper; \
curl -s https://raw.githubusercontent.com/c29r3/mina-snark-stopper/master/config.yml > config.yml; \
docker pull c29r3/snark-stopper
```## Uninstall
```
rm -rf mina-snark-stopper; \
docker rm -f snark-stopper; \
docker system prune -af
```