nimbus-eth1/fluffy
Adam Spitz fad3ed64cf
Time based forking (#1465)
* Refactoring in preparation for time-based forking.

* Timestamp-based hard-fork-transition.

* Workaround SideEffect issue / compiler bug for both failing locations in Portal history code

---------

Co-authored-by: kdeme <kim.demey@gmail.com>
2023-02-16 12:40:07 +01:00
..
common Reduce Nim 1.6 compiler warnings & hints 2023-01-31 13:38:08 +01:00
docs Add first iteration of a fluffy beacon bridge for block data (#1437) 2023-01-19 09:33:11 +01:00
eth_data Time based forking (#1465) 2023-02-16 12:40:07 +01:00
grafana Adjust Grafana dashboard to represent the one used for the fleet (#1139) 2022-06-22 17:22:07 +02:00
network Time based forking (#1465) 2023-02-16 12:40:07 +01:00
network_data/testnet0 Update two of the Fluffy bootstrap nodes for testnet (#1389) 2022-12-16 21:11:34 +01:00
rpc Reduce Nim 1.6 compiler warnings & hints 2023-01-31 13:38:08 +01:00
scripts Reduce Nim 1.6 compiler warnings & hints 2023-01-31 13:38:08 +01:00
tests Time based forking (#1465) 2023-02-16 12:40:07 +01:00
tools Avoid raw Exception raises by moving confutils config load (#1461) 2023-02-07 17:21:12 +01:00
README.md Update Fluffy docs on how to seed data (#1408) 2023-01-09 17:57:55 +01:00
beacon_light_client_bridge.nim Reduce Nim 1.6 compiler warnings & hints 2023-01-31 13:38:08 +01:00
conf.nim Reduce Nim 1.6 compiler warnings & hints 2023-01-31 13:38:08 +01:00
content_db.nim Reduce Nim 1.6 compiler warnings & hints 2023-01-31 13:38:08 +01:00
fluffy.nim Reduce Nim 1.6 compiler warnings & hints 2023-01-31 13:38:08 +01:00
network_metadata.nim Reduce Nim 1.6 compiler warnings & hints 2023-01-31 13:38:08 +01:00
nim.cfg StyleCheck fixes for Fluffy and lcproxy (#1220) 2022-09-10 21:00:27 +02:00
seed_db.nim Reduce Nim 1.6 compiler warnings & hints 2023-01-31 13:38:08 +01:00

README.md

Fluffy: The Nimbus Portal Network Client

Fluffy CI Stability: experimental License: Apache License: MIT

Discord: Nimbus Status: #nimbus-general

Introduction

This folder holds the development of the Nimbus client implementation supporting the Portal Network: Fluffy. The Portal Network is a project still heavily in research phase and fully in flux. This client is thus still highly experimental.

Current status of specifications can be found in the portal-network-specs repository.

Development Updates

Monthly development updates are shared here.

To keep up to date with changes and development progress, follow the Nimbus blog.

How to Build & Run

Prerequisites

  • GNU Make, Bash and the usual POSIX utilities. Git 2.9.4 or newer.

Build the Fluffy client

git clone git@github.com:status-im/nimbus-eth1.git
cd nimbus-eth1
make fluffy

# See available command line options
./build/fluffy --help

# Example command: Run the client and connect to a bootstrap node.
./build/fluffy --bootstrap-node:enr:<base64 encoding of ENR>

Update and rebuild the Fluffy client

# From the nimbus-eth1 repository
git pull
# To bring the git submodules up to date
make update

make fluffy

Run a Fluffy client on the public testnet

There is a public Portal testnet which contains nodes of different clients. We run a fleet of Fluffy nodes that are part of this testnet.

Provide the --network:testnet0 option to join this network.

# Connect to the Portal testnet and enable the JSON-RPC APIs
./build/fluffy --network:testnet0 --rpc --table-ip-limit:1024 --bucket-ip-limit:24

The table-ip-limit and bucket-ip-limit options are needed to allow more nodes with the same IPs in the routing tables. The default limits are there as security measure. It is currently needed to increase the limits for the testnet because the fleet of Fluffy nodes runs on only 2 machines / network interfaces.

Note: The --network option selects automatically a static set of specific bootstrap nodes belonging to a "testnet". Currently testnet0 is the only option, which results in connecting to the testnet bootstrap nodes. It should be noted that there is currently no real way to distinguish a "specific" Portal network, and as long as the same Portal protocols are supported, nodes can simply connect to it and no real separation can be made.

The testnet is currently storing only the first 25000 mainnet blocks. This can be tested by using the JSON-RPC call eth_getBlockByHash:

# Get the hash of a block from your favorite block explorer, e.g.:
# 0x8dda3a641653c0454569c3b5be529f58b14d2a5b5d87956664c746ce1e367c21
# Run command to get this block:
curl -s -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":"1","method":"eth_getBlockByHash","params":["0x8dda3a641653c0454569c3b5be529f58b14d2a5b5d87956664c746ce1e367c21", false]}' http://localhost:8545 | jq

One can also use the blockwalk tool to walk down the blocks one by one, e.g:

make fluffy-tools

./build/blockwalk --block-hash:0xf6bfad56d1a45d1661506343dd1e511b5d7e17565b3ec293125ff0890b9709e5

Run Fluffy test suite

# From the nimbus-eth1 repository
make fluffy-test

Run Fluffy local testnet script

./fluffy/scripts/launch_local_testnet.sh

Find more details on the usage and workings of the local testnet script here.

Windows support

Follow the steps outlined here to build fluffy on Windows.

Development tools and documentation

The basics for developers

When working on this repository, you can run the env.sh script to run a command with the right environment variables set. This means the vendored Nim and Nim modules will be used, just as when you use make.

E.g.:

# start a new interactive shell with the right env vars set
./env.sh bash

More development tips can be found on the general nimbus-eth1 readme.

The code follows the Status Nim Style Guide.

Metrics and their visualisation

To enable metrics run Fluffy with the --metrics flag:

./build/fluffy --metrics

Default the metrics are available at http://127.0.0.1:8008/metrics.

The address can be changed with the --metrics-address and --metrics-port options.

This provides only a snapshot of the current metrics. In order track the metrics over time and to also visualise them one can use for example Prometheus and Grafana.

The steps on how to set up such system is explained in this guide.

A Fluffy specific dashboard can be found here.

This is the dashboard used for our Fluffy testnet fleet. In order to use it locally, you will have to remove the {job="nimbus-fluffy-metrics"} part from the instance and container variables queries in the dashboard settings. Or they can also be changed to a constant value.

The other option would be to remove those variables and remove their usage in each panel query.

License

Licensed and distributed under either of

or

at your option. These files may not be copied, modified, or distributed except according to those terms.