Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
Signed-off-by: Pranay Valson <pranay.valson@gmail.com>
  • Loading branch information
noslav committed Jul 10, 2023
1 parent a269524 commit a3156d4
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# BSP Finalizer

Finalisation and reward processor for consensus block specimens sessions and block results session using the covalent db and proofchain. It functions at the end of the BSP stack within the following pipeline `bsp-geth -> bsp-agent -> bsp-staking -> bsp-finalizer -> rudder/refiner`
Finalisation and reward processor for consensus block specimens sessions and block results session using the covalent db and proofchain. It functions at the end of the BSP stack within the following pipeline `bsp-geth -> bsp-agent -> bsp-staking -> bsp-finalizer -> rudder/refiner -> bsp-finalizer`

The "finalizer" fns for the network can be called by anyone with gas available in their account. The function is a simple call to the proof chain smart contract with chain ID and the block height being finalized for block specimens whose sessions have been started by a submission and the submissions period has ended (so no more participants can submit a valid hash). A valid session is created for each hash that is submitted by an operator.
The "finalizer" functions for the network on proof-chain smart contracts can be called by anyone with gas available in their account. The function is a simple call to the proof chain smart contract with chain ID and the block height being finalized for block specimens/block results whose sessions have been started by a submission and the submissions period has ended (so no more participants can submit a valid hash). A valid session is created for each hash that is submitted by an operator.

Three issues are possible during submission -

- "Session not past deadline" - trying to finalize a session that's not reached a deadline for submissions yet
- "Session cannot be finalized" - issues on the proofchain contract end
- "Session not started" - trying to finalize a session for a block number that's not been started by any parrticipant yet.
- "Session not started" - trying to finalize a session for a block number that's not been started by any participant yet.

The process of finalization invokes the reward paid out to all the contributors to the consensus blocks and also produces a finalization hash which is then indexed by the covalent db. The covalent db is used as a reference point for finalized vs un-finalized blocks and any gaps in the indexing of finalized hashes will result in interim hiccups in this process.

Expand All @@ -28,10 +28,10 @@ In order to run access to the covalent db is required. Please ask the code owner

1. Place appropriate values in an `.envrc` or `.env` file:

```envrc
```bash
export RPC_ENDPOINT="http://endpoint-to-where-proofchain-is-deployed"
export BLOCK_ID_START="1910104892088990000"
export PROOFCHAIN_ADDRESS="0x19492a5019B30471aA8fa2c6D9d39c99b5Cda20C"
export PROOFCHAIN_ADDRESS="<<ASK-ON-DISCORD>>"
export FINALIZER_PRIVATE_KEY="0xprivatekeyoffinalizerwithgas"
export FINALIZER_ADDRESS="0xpublicaddressofaboveprivatekey"
export DB_USER="db_access_user"
Expand All @@ -43,19 +43,19 @@ In order to run access to the covalent db is required. Please ask the code owner
export GAS_LIMIT=300000
```

2. Load environment variables:
1. Load environment variables:

```bash
direnv allow .
```

3. Create directories for logging:
1. Create directories for logging:

```bash
mkdir -p logs/{Contract,Finalizer,DB}
```

4. Install python packages (virtualenv):
1. Install python packages (virtualenv):

```bash
python3 -m virtualenv ./.venv
Expand All @@ -64,37 +64,37 @@ In order to run access to the covalent db is required. Please ask the code owner
export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib"; pip install -r requirements.txt
```

5. Run the script:
1. Run the script:

```bash
python3 src/main.py
```

## Docker run

Login to GCR for docker images with -
1. Login to GCR for docker images with -

```bash
gcloud auth print-access-token | docker login -u oauth2accesstoken --password-stdin https://gcr.io
```

Add an `.env` file with all the env variables mentioned above.
1. Add an `.env` file with all the env variables mentioned above.

Pull the images and run (arm64) -

```bash
docker pull gcr.io/covalent-project/bsp-finalizer:latest-arm64
docker run --env-file .env gcr.io/covalent-project/bsp-finalizer:latest-arm64
docker pull gcr.io/covalent-project/bsp-finalizer:latest
docker run --env-file .env gcr.io/covalent-project/bsp-finalizer:latest
```

Pull the images and run (amd64) -
1. Pull the images and run (amd64) -

```bash
docker pull gcr.io/covalent-project/bsp-finalizer:latest
docker run --env-file .env gcr.io/covalent-project/bsp-finalizer:latest
```

If the run is successful you should see logs such as below.
1. If the run is successful you should see logs such as below.

```log
INFO DB (dbmanager.py:74) - Connecting to the database...
Expand Down

0 comments on commit a3156d4

Please sign in to comment.