Giter Site home page Giter Site logo

bp-auditor's Introduction

bp-auditor

bp-auditor is a Python package that allows users to monitor the compliance of block producers on the Telos blockchain network with the Telos Blockchain Network Operating Agreement (TBNOA). The package has two main parts:

  • Data Gatherer: a fully asynchronous process using the trio structured concurrency framework. Once pointed to a antelope chain main load balancer endpoint, it will query the top block producers by vote and analyze their compliance with the network operation agreement. It can do 10 producers at once by default, but this is configurable. The data gathered gets timestamped and stored into a SQLite3 database ("reports.db" by default) and is meant to be run every day at a specific time (we recommend 00:00 UTC).

  • Data Producer: the second part of the package produces an excel sheet which acts as a monthly report, in this report all the previously gathered daily reports from this month are shown in an user-friendly way, for easier evaluation by the compliance officer.

Installation

To install the package, simply run:

pip install -e .

Usage

The package provides the following commands:

Usage: bpaudit [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  gather      Run the data gatherer
  install     Systemd unit installer
  produce     Produce the monthly report

Each sub command has it's own --help text.

To run the data gatherer, simply run:

bpaudit gather

To produce the monthly report, simply run:

bpaudit produce

Systemd Integration

You can use the bpaudit install command to generate systemd unit and timer files to set up the data gatherer to run automatically at a specific time.

This will allow the data gatherer to run automatically without the need for manual interaction.

Virtualenv

It is recommended to use a virtual environment when installing and running bp-auditor. A virtual environment is an isolated Python environment where you can install packages without affecting the system's Python installation. This allows you to have a specific version of Python and specific packages for your project, without interfering with other projects on the same system.

To set up a virtual environment, you can use the venv module that comes with Python 3 or a third-party package such as virtualenv.

To create a virtual environment with the venv module, run the following command in your terminal:

python3 -m venv venv

This will create a new folder called venv in your current directory, where the isolated Python environment will be located.

To activate the virtual environment, run the following command:

source venv/bin/activate

You will now see the name of your virtual environment in the command prompt, indicating that it is active.

Once the virtual environment is activated, you can install bp-auditor by running pip install bp-auditor and then use the package as described in the usage section. When you're done using the package, you can deactivate the virtual environment by running deactivate.

bp-auditor's People

Contributors

guilledk avatar

Stargazers

Seth@Boid.com avatar

Watchers

James Cloos avatar Jesse Schulman avatar  avatar J.T. Buice avatar  avatar Seth@Boid.com avatar

Forkers

thatzprem mchosc

bp-auditor's Issues

Failing to join certain urls with chains.json

Due to misuse of urljoin function from python std lib we are failing a few bps that have urls like:

urljoin("https://infinitybloc.io/s", "chains.json") returns -> "https://infinitybloc.io/chains.json"

TypeError: 'type' object is not subscriptable

Getting the below error when running gather.

(venv) root@test:/opt/bp-auditor# bpaudit gather

Traceback (most recent call last):
File "/opt/bp-auditor/venv/bin/bpaudit", line 11, in
load_entry_point('bp-auditor', 'console_scripts', 'bpaudit')()
File "/opt/bp-auditor/venv/lib/python3.8/site-packages/pkg_resources/init.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/opt/bp-auditor/venv/lib/python3.8/site-packages/pkg_resources/init.py", line 2852, in load_entry_point
return ep.load()
File "/opt/bp-auditor/venv/lib/python3.8/site-packages/pkg_resources/init.py", line 2443, in load
return self.resolve()
File "/opt/bp-auditor/venv/lib/python3.8/site-packages/pkg_resources/init.py", line 2449, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "/opt/bp-auditor/bp_auditor/cli.py", line 10, in
from .db import store_reports
File "/opt/bp-auditor/bp_auditor/db.py", line 9, in
def store_reports(db_location: str, reports: list[dict]):
TypeError: 'type' object is not subscriptable

BP auditor crashes on malformed p2p endpoint info

Overview

A bp changed its bp json config on p2p endpoints to start with http:// this broke the current parser and made the whole tool stop producing dailty reports

Acceptance criteria

Fix this particular parsing error but made the scripts more resiliant so that such errors dont break the dailiy data collection, the error must be logged and reported on the work sheet.

Failing ssl checks randomly

From @I_Seth on telegram:

Seth@Boid|BlockBase |Animus Labs, [5/3/23 5:31 PM]
I think the issue is from what I understand by looking in the code is that you are only considering

"api_endpoint" and not "ssl_endpoint"

Seth@Boid|BlockBase |Animus Labs, [5/3/23 5:32 PM]
so many bps would not be showing it properly because they are not providing http

Seth@Boid|BlockBase |Animus Labs, [5/3/23 5:32 PM]
we only provide https

Seth@Boid|BlockBase |Animus Labs, [5/3/23 5:33 PM]
https://github.com/telosnetwork/bp-auditor/blob/0e8fae4cdda7cc17282d105b3f1aee60ec77e786/bp_auditor/audit.py#L89

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.