This application will capture all the BeaconState's and SignedBeaconBlock's from the consensus chain on Ethereum.
Go to file
Abdul Rabbani 90cb1d3414
Boot application with tests (#14)
* Update cobra to require `head` or `historic` when using `capture`.

* A very generic package for implementing PGX driver

I copied most of the code from the `statediff` service from within geth. The idea is that I can create formal DB packages, that can be utilized in other projects down the road.

* Put PGX and other future Postgres Drivers behind SQL package

This PR makes allows users to provide a config, along with a driver string. It will then provide the respective driver.

* Add DB Connection and Logging

* Utilize LogRus
* Create a DB connection using PGX.
* Create an internal boot package for starting the application.

* Code clean up + Beacon Chain Connection

This concludes all the code needed to connect to the DB and beacon node. We will no longer reference the lighthouse client because this application should work interchangeably with any beacon node.

I have also standardized logging.

* Last second clean ups

* Utilize Ginkgo toreplace `testing` library, and add CI/CD. (#9)

* Utilize Ginkgo and replace `testing` library.

* Add TOC to docs

* Add Docker specific files

* Remove -e

* Update on-pr-manual.yml

* Add depth

* Add repositories

* Remove $ from path

* Update path for make

* Setup Go and Ginkgo

* Use go mod download

* Use go install

* Update on-pr-manual.yml

* Use latest

* Remove install of GINKGO

* Add explicit gopath

* Explicitly specify the gopath

* Update on-pr-manual.yml

* Update on-pr-manual.yml

* Update on-pr-manual.yml

* Update on-pr-manual.yml

* Update on-pr-manual.yml

* Update on-pr-manual.yml

* Use which ginkgo

* Try with make now

* Final working Make

* Feature/11 testing add tests for boot (#12)

* Utilize Versioning

* Update Testing and CI/CD

* Update Testing

* Add Linting and Remove timeout

* Update Lint

* handle errors to make the linter happy

* Utilized interfaces for DB

* Update Manual Testing CI/CD

* Try combining everything into one pipeline (#13)

* Try combining everything into one pipeline

* Update on-pr-manual.yml

* Remove PAth for testing

* Combine single YML workflow file for PR

* Add a comment
2022-04-22 17:12:10 -04:00
.github Boot application with tests (#14) 2022-04-22 17:12:10 -04:00
cmd Feature/11 testing add tests for boot (#12) 2022-04-22 12:27:54 -04:00
internal/boot Utilized interfaces for DB 2022-04-22 13:02:14 -04:00
pkg Feature/11 testing add tests for boot (#12) 2022-04-22 12:27:54 -04:00
.gitignore Testing, CI/CD and DB connections (#10) 2022-04-22 08:31:57 -04:00
application_component.md Testing, CI/CD and DB connections (#10) 2022-04-22 08:31:57 -04:00
Dockerfile Testing, CI/CD and DB connections (#10) 2022-04-22 08:31:57 -04:00
entrypoint.sh Testing, CI/CD and DB connections (#10) 2022-04-22 08:31:57 -04:00
go.mod Feature/11 testing add tests for boot (#12) 2022-04-22 12:27:54 -04:00
go.sum Feature/11 testing add tests for boot (#12) 2022-04-22 12:27:54 -04:00
LICENSE Initial commit 2022-04-19 14:42:32 -04:00
main.go Utilize Cobra 2022-04-19 17:09:59 -04:00
Makefile Feature/11 testing add tests for boot (#12) 2022-04-22 12:27:54 -04:00
README.md Feature/11 testing add tests for boot (#12) 2022-04-22 12:27:54 -04:00

Table of contents generated with markdown-toc

ipld-ethcl-indexer

This application will capture all the BeaconState's and SignedBeaconBlock's from the consensus chain on Ethereum. This application is going to connect to the lighthouse client, but hypothetically speaking, it should be interchangeable with any eth2 beacon node.

To learn more about the applications individual components, please read the application components.

Running the Application

To run the application, utilize the following command, and update the values as needed.

go run main.go capture head --db.address localhost \
  --db.password password \
  --db.port 8077 \
  --db.username vdbm \
  --db.name vulcanize_testing \
  --db.driver PGX \
  --bc.address localhost \
  --bc.port 5052 \
  --log.level info

Development Patterns

This section will cover some generic development patterns utilizes.

Logging

For logging, please keep the following in mind:

  • Utilize logrus.
  • Use log.Debug to highlight that you are about to do something.
  • Use log.Info-Fatal when the thing you were about to do has been completed, along with the result.
log.Debug("Adding 1 + 2")
a := 1 + 2
log.Info("1 + 2 successfully Added, outcome is: ", a)
  • loghelper.LogError(err) is a pretty wrapper to output errors.

Testing

This project utilizes ginkgo for testing. A few notes on testing:

  • All tests within this code base will test public methods only.
  • All test packages are named {base_package}_test. This ensures we only test the public methods.
  • If there is a need to test a private method, please include why in the testing file.
  • Unit tests must contain the Label("unit").
  • Unit tests should not rely on any running service. If a running service is needed. Utilize an integration test.
  • Integration tests must contain the Label("integration").

Contribution

If you want to contribute please make sure you do the following:

  • Create a Github issue before starting your work.
  • Follow the branching structure.
  • Delete your branch once it has been merged.
    • Do not delete the develop branch. We can add branch protection once we make the branch public.

Branching Structure

The branching structure is as follows: main <-- develop <-- your-branch.

It is adviced that your-branch follows the following structure: {type}/{issue-number}-{description}.

  • type - This can be anything identifying the reason for this PR, for example: bug, feature, release.
  • issue-number - This is the issue number of the GitHub issue. It will help users easily find a full description of the issue you are trying to solve.
  • description - A few words to identify your issue.