You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Eduard S d80e3a8988
Merge pull request #648 from hermeznetwork/feature/txsel-forgablepriority
3 years ago
.github/workflows Add action to trigger tests in integration-testing 3 years ago
api Merge pull request #651 from hermeznetwork/feature/total-txs-in-pool 3 years ago
apitypes Store *big.Int as DECIMAL in sql 3 years ago
batchbuilder Add lll to linter checks 3 years ago
cli/node API change names and add poolLoad, add maxFeeUSD 3 years ago
common Merge pull request #631 from hermeznetwork/feature/serveapicli2 3 years ago
config API change names and add poolLoad, add maxFeeUSD 3 years ago
coordinator API change names and add poolLoad, add maxFeeUSD 3 years ago
db Merge pull request #651 from hermeznetwork/feature/total-txs-in-pool 3 years ago
eth Add lll to linter checks 3 years ago
log Fix TxSel sorting, TxManager geth err checking 3 years ago
node API change names and add poolLoad, add maxFeeUSD 3 years ago
priceupdater Allow price update configuration to be specified per token 3 years ago
prover fix some code and comment typos 3 years ago
stateapiupdater Merge pull request #651 from hermeznetwork/feature/total-txs-in-pool 3 years ago
synchronizer API change names and add poolLoad, add maxFeeUSD 3 years ago
test API change names and add poolLoad, add maxFeeUSD 3 years ago
txprocessor Fix TxSel discard tx when ProcessL2Tx gives err 3 years ago
txselector Merge pull request #648 from hermeznetwork/feature/txsel-forgablepriority 3 years ago
.gitignore create a makefile to build, compile and run the binary using ldflags 3 years ago
Makefile create a makefile to build, compile and run the binary using ldflags 3 years ago
README.md create a makefile to build, compile and run the binary using ldflags 3 years ago
go.mod Update to last Poseidon & go-merkletree versions 3 years ago
go.sum Merge pull request #630 from hermeznetwork/feature/update-poseidon 3 years ago

README.md

hermez-node Go Report Card Test Status Lint Status GoDoc

Go implementation of the Hermez node.

Developing

Go version

The hermez-node has been tested with go version 1.14

Build

Build the binary and check the current version:

$ make build
$ bin/node version

Run

First you must edit the default/template config file into cli/node/cfg.buidler.toml, there are more information about the config file into cli/node/README.md

After setting the config, you can build and run the Hermez Node as a synchronizer:

$ make run

Or build and run as a coordinator, and also passing the config file from other location:

$ MODE=sync CONFIG=cli/node/cfg.buidler.toml make run

To check the useful make commands:

$ make help

Unit testing

Running the unit tests requires a connection to a PostgreSQL database. You can run PostgreSQL with docker easily this way (where yourpasswordhere should be your password):

$ POSTGRES_PASS="yourpasswordhere" make run-database-container

Afterward, run the tests with the password as env var:

$ POSTGRES_PASS="yourpasswordhere" make test

NOTE: -p 1 forces execution of package test in serial. Otherwise, they may be executed in parallel, and the test may find unexpected entries in the SQL database because it's shared among all tests.

There is an extra temporary option that allows you to run the API server using the Go tests. It will be removed once the API can be properly initialized with data from the synchronizer. To use this, run:

$ POSTGRES_PASS="yourpasswordhere" make test-api-server

Lint

All Pull Requests need to pass the configured linter.

To run the linter locally, first, install golangci-lint.
Afterward, you can check the lints with this command:

$ make gocilint

Usage

Node

See cli/node/README.md

Proof Server

The node in mode coordinator requires a proof server (a server capable of calculating proofs from the zkInputs). There is a mock proof server CLI at test/proofserver/cli for testing purposes.

Usage of test/proofserver/cli:

USAGE:
    go run ./test/proofserver/cli OPTIONS

OPTIONS:
  -a string
        listen address (default "localhost:3000")
  -d duration
        proving time duration (default 2s)

Also, the Makefile commands can be used to run and stop the proof server in the background:

$ make run-proof-mock
$ make stop-proof-mock

/tmp as tmpfs

For every processed batch, the node builds a temporary exit tree in a key-value DB stored in /tmp. It is highly recommended that /tmp is mounted as a RAM file system in production to avoid unnecessary reads a writes to disk. This can be done by mounting /tmp as tmpfs; for example, by having this line in /etc/fstab:

tmpfs			/tmp		tmpfs		defaults,noatime,mode=1777	0 0