Validate Ethereum IPLD objects in a Postgres database
Go to file
2022-08-03 14:36:47 -04:00
.github/workflows go-quic not 1.19 ready 2022-08-03 14:36:47 -04:00
cmd Feature/update go geth sharding (#13) 2022-06-03 09:28:02 -04:00
environments Make validation process perpetual (#8) 2022-05-31 11:59:49 +05:30
pkg/validator Upgrade dependencies and update referential integrity checks (#17) 2022-07-13 13:12:59 +05:30
scripts Revert changes to perform referential integrity tests (#16) 2022-06-20 14:20:14 +05:30
test Upgrade dependencies and update referential integrity checks (#17) 2022-07-13 13:12:59 +05:30
validator_test Add checks to validate referential integrity in the data (#7) 2022-06-01 11:29:53 +05:30
.gitignore update for go-ethereum 1.10.20 2022-07-19 14:57:44 -04:00
docker-compose.yml Upgrade dependencies and update referential integrity checks (#17) 2022-07-13 13:12:59 +05:30
go.mod ipld-eth-server missed version update 2022-08-03 11:37:55 -04:00
go.sum ipld-eth-server missed version update 2022-08-03 11:37:55 -04:00
LICENSE Make validation process perpetual (#8) 2022-05-31 11:59:49 +05:30
main.go Updates to use v3 ipld-eth-server 2022-05-06 16:51:11 +05:30
Makefile Feature/update go geth sharding (#13) 2022-06-03 09:28:02 -04:00
README.md Add instructions to run integration tests 2022-05-20 16:47:48 +05:30

Table of contents generated with markdown-toc

Overview

This repository contains the validator. The purpose of the validator is to ensure that the data in the Core Postgres database match the data on the blockchain.

Intention for the Validator

The perfect scenario for the validator is as follows:

  1. The validator will have the capacity to perform historical checks for the Core Postgres database. Users can contain these historical checks to specified configurations (block range).
  2. The validator will validate a certain number of trailing blocks, t, trailing the head, n. Therefore the validator will constantly perform real-time validation starting at n and ending at n - t.
  3. The validator validates the IPLD blocks in the Core Database; it will update the core database to indicate that the validator validated it.

Edge Cases

We must consider the following edge cases for the validator.

  • There are three different data types that the validator must account for.

Instructions for Testing

Follow steps in test/README.md

Code Overview

This section will provide some insight into specific files and their purpose.

  • validator_test/chain_maker.go - This file contains the code for creating a “test” blockchain.
  • validator_test/validator_test.go - This file contains testing to validate the validator. It leverages chain_maker.go to create a blockchain to validate.
  • pkg/validator/validator.go - This file contains most of the core logic for the validator.

Known Bugs

  1. The validator is improperly handling missing headers from the database.
    1. Scenario
      1. The IPLD blocks from the mock blockchain are inserted into the Postgres Data.
      2. The validator runs, and all tests pass.
      3. Users manually remove the last few rows from the database.
      4. The validator runs, and all tests pass - This behavior is neither expected nor wanted.

Tests on 03/03/22

The tests highlighted below were conducted to validate the initial behavior of the validator.

Set Up

Below are the steps utilized to set up the test environment.

  1. Run the scripts/run_integration_test.sh script.
    1. First comment outline 130 to 133 from validator_test/validator_test.go
  2. Once the code has completed running, comment out lines 55 to 126, 38 to 40, and 42 to 44.
    1. Make the following change db, err = setupDB() --> db, _ = setupDB()
  3. Run the following command: ginkgo -r validator_test/ -v
    1. All tests should pass

Testing Failures

Once we had populated the database, we tested for failures.

  1. Removing a Transaction from transaction_cids - If we removed a transaction from the database and ran the test, the test would fail. This is the expected behavior.
  2. Removing Headers from eth.header_cids
    1. If we removed a header block sandwiched between two header blocks, the test would fail (For example, we removed the entry for block 4, and the block range is 1-10). This is the expected behavior.
    2. If we removed the tail block(s) from the table, the test would pass (For example, we remove the entry for blocks 8, 9, 10, and the block range is 1-10). This is not the expected behavior.