Code Monkey home page Code Monkey logo

viewpoint's Introduction

Viewpoint

End-to-end framework to test Ethereum network clients.

Build

$ go build -o viewpoint cmd/main.go

Quickstart

Start the server:

$ viewpoint server --name test [--genesis-time 1m] [--num-genesis-validators 10] [--min-genesis-validator-count 10] [--num-tranches 1]
2022-07-15T20:48:31.093+0200 [INFO]  viewpoint: eth1 server deployed: addr=http://127.0.0.1:8001
2022-07-15T20:48:31.093+0200 [INFO]  viewpoint: deposit contract deployed: addr=0xB96198679b67b455FD654aEfC91bF31DC9C0886D
2022-07-15T20:48:35.017+0200 [INFO]  viewpoint: GRPC Server started: addr=localhost:5555

The server command starts the Viewpoint agent which handles the lifecycle of an Ethereum (post-merge) network. At startup, it generates an initial set of validator accounts (num-genesis-validators), splits them in tranches (num-tranches) and creates a genesis.ssz file. Each validator client will own a single tranche of accounts.

The deployment of the nodes is done using Docker containers which are stopped once the server process is over. The agent creates an e2e-<name> folder in the root directory where all the metadata, specs and node logs are stored.

Now, lets deploy a validator client for the network.

$ viewpoint node deploy validator --type [prysm|lighthouse|teku] --tranche 0 --beacon --beacon-count 2

The validator will use the accounts in the tranche 0 (the only one created), which is enough to start the network once the genesis time is reached.

The node deploy validator command includes the --beacon and --beacon-count flags as a convenience method to pre-deploy a set of beacon nodes (with the same consensus client) to which the validator can connect to join the network.

At any point we can deploy another beacon node with:

$ viewpoint node deploy beacon --type [prysm|lighthouse|teku]

Commands

Server

$ viewpoint server

The server command starts the Viewpoint agent.

Flags:

  • name (test): Name of the execution round.
  • num-genesis-validators (10): Number of active validator accounts at genesis.
  • min-genesis-validator-count (10): Number of required active validators to start the chain at genesis.
  • genesis-time (1m): Amount of time from now when the genesis starts.
  • num-tranches (1): Number of tranches. It has to be an exact multiple of genesis-validator-count.
  • altair (null): Enable the Altair hard fork at a given epoch. Disabled by default.

Deposit create

$ viewpoint deposit create

The deposit create command creates a new tranche with num-validators. For each one, it sends a deposit transaction to the deposit smart contract on the execution node (Geth). Eventually, those accounts will be active on the consensus layer.

Flags:

  • num-validators: Number of accounts for the tranche.

Deposit list

$ viewpoint deposit list

The deposit list command lists all the tranches.

Node deploy beacon

$ viewpoint deploy beacon

The deploy beacon command deploys multiple beacon node clients. The nodes use a bootnode to discover each other.

Flags:

  • type: Client type of the beacon node (Prysm, Lighthouse or Teku).
  • count (1): Number of beacon nodes to deploy.
  • repo: Override to the default Docker repository for the client.
  • tag: Override for the default Docker image tag for the client.

Node deploy validator

$ viewpoint deploy validator

The deploy validator command deploys a validator client.

Flags:

  • type: Client type of the validator (Prysm, Lighthouse or Teku).
  • num-validators (0): If set, Viewpoint will create a new tranche of num-validators accounts (with the deposits).
  • tranche (0): Index of the tranche to use by the validator. It does not take effect if num-validators is set.
  • beacon (false): If enabled, pre-deploy a set of beacon nodes to which the validator will connect.
  • beacon-count (1): Number of beacon nodes to deploy if --beacon enabled.
  • repo: Override to the default Docker repository for the client.
  • tag: Override for the default Docker image tag for the client.

Node list

$ viewpoint node list

The node list command lists all the running nodes.

Node status

$ viewpoint node status <name>

The node status command queries the state of a specific node name.

viewpoint's People

Contributors

ferranbt avatar

Stargazers

Victor Castell avatar  avatar  avatar

Watchers

 avatar

viewpoint's Issues

Run beacon-clients with genesis state

umbracle/eth2-validator#17

Right now, it is necessary to deploy an eth1 client, deploy the deposit contract and make a deposit transaction before starting the eth2 beacon clients. Though this workflow is required for some types of tests (i.e. validator waiting to be validated), most of the tests would benefit from a genesis state with the validators.

Multi-node e2e cluster

umbracle/eth2-validator#15

As of now, the testutil framework only deploys single node (1 beacon, 1 validator) devnets. The framework should be able to provision and configure multi-node devnets both with the same client and multi-client.

Teku cannot connect with Prysm bootnode

Problem

Teku cannot connect and use Prysm bootnode for discovery.

Version

  • Teku: consensys/teku:22.4.0

Steps

Start the viewpoint server (which starts a Prysm bootnode and an eth1 client):

$ go run cmd/main.go server --name teku-bootnode --genesis-time 1m

Start two Teku nodes (both start with the bootnode in --p2p-discovery-bootnodes):

$ go run cmd/main.go node --beacon-node --node-type teku
$ go run cmd/main.go node --beacon-node --node-type teku

Curl for the peers endpoint in both nodes is always empty:

$ curl http://127.0.0.1:7001/eth/v1/node/peers | jq .
$ curl http://127.0.0.1:7001/eth/v1/node/peers | jq .

The workflow works if the Teku nodes connect with any other blockchain client instead. The same setup works on both Prysm and Lighthouse.

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.