Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge upstream 20231030 #62

Merged
merged 48 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
0a8bda7
mbps (#8564)
elee1766 Oct 23, 2023
dd89200
readme: faq on public rpc api (#8541)
AskAlexSharov Oct 24, 2023
e42642e
rpctest: Fix error mgt from bench1 to bench9 (#8548)
lupin012 Oct 24, 2023
c1697ca
Update Readme - gnosis size (#8538)
somnathb1 Oct 24, 2023
b9a8c2d
sentry: error checking fix (#8566)
dvovk Oct 24, 2023
d7448fd
Added functional beacon snapshots reader and generator to Caplin (#8570)
Giulio2002 Oct 24, 2023
3d3c0be
downloader: log.Trace non-important log messages instead of skipping …
AskAlexSharov Oct 25, 2023
52c4489
sapshots: remove modtime protection (#8573)
AskAlexSharov Oct 25, 2023
95424b5
fix nil error in bor devnet (#8578)
anshalshukla Oct 25, 2023
38e9180
Revert "Move validator set snapshot computation to bor_heimdall stage…
yperbasis Oct 25, 2023
656c3d2
params: remove dev from v2.53.0 (#8581)
yperbasis Oct 25, 2023
7aa79a5
TestState: share db (#8576)
AskAlexSharov Oct 25, 2023
0e1fa8d
blocksReadAheadFunc: to calc `engine.Author` in background (#8499)
AskAlexSharov Oct 25, 2023
e1c71bd
params: begin 2.54 release cycle (#8582)
yperbasis Oct 25, 2023
043ccef
Fix null ptr in debug_traceTx (#8585)
somnathb1 Oct 26, 2023
f1c81dc
devnet: fix node startup on macOS (#8569)
battlmonstr Oct 26, 2023
f36d090
make db-tools: suspend enum-int linter error (#8598)
AskAlexSharov Oct 27, 2023
9adf31b
bytes transfet separated by capability and category (#8568)
dvovk Oct 27, 2023
0e5af0a
Added beacon snapshots download (#8601)
Giulio2002 Oct 28, 2023
5bb91bb
"erigon snapshots retire": prune, then retire, then prune (#8606)
AskAlexSharov Oct 29, 2023
216f20d
batch flush can without read tx (#8597)
yyjia Oct 29, 2023
60b3f1e
bind-ipc (#8590)
elee1766 Oct 29, 2023
8231cda
downloader: less webseed logs (#8586) (#8607)
yperbasis Oct 29, 2023
8f67a8c
Txpool: db unlimited grow fix (#8596) (#8608)
yperbasis Oct 29, 2023
b311da9
downloader: webseed better error messages (#8611)
AskAlexSharov Oct 30, 2023
c23e5a1
downloader: preparations for reducing blocks merge limit (#8612)
AskAlexSharov Oct 30, 2023
513fd50
Compress snapshots for Caplin with lz4 level=1 (#8609)
Giulio2002 Oct 30, 2023
83bbe0d
Fix Agra hf scheduling on Mumbai (#8620)
anshalshukla Oct 30, 2023
26ee3c6
Merge remote-tracking branch 'origin/devel' into jyellick/merge-upstr…
jyellick Oct 30, 2023
c90bff7
mdbx: use release tag (#8628)
AskAlexSharov Oct 31, 2023
d8d7d8d
Enable h2c for http handler. add https handler for http2 (#8610)
elee1766 Oct 31, 2023
cabd2b2
Mumbai: fix fork ID for Agra (#8630)
yperbasis Oct 31, 2023
a106f2c
Merge remote-tracking branch 'origin/devel' into jyellick/merge-upstr…
jyellick Oct 31, 2023
0459d63
Merge remote-tracking branch 'boba/boba-develop' into jyellick/merge-…
jyellick Oct 31, 2023
c20af7d
Add code to handle close/cancel semantics (#8633)
mh0lt Oct 31, 2023
eb65ffb
config: avoid OOM in docker using cgroups v2 limit (#6646) (#8632)
battlmonstr Nov 1, 2023
22332f7
fix: batch close confict with flush (#8613)
yyjia Nov 1, 2023
d4b19b3
pool: limit broadcast tx size by 4kb (#8634)
AskAlexSharov Nov 1, 2023
b5ea87d
mdbx_empty_kv_dup (#8635)
AskAlexSharov Nov 1, 2023
8e54a96
webseed: don't download .torrent files (#8629)
AskAlexSharov Nov 1, 2023
3698e7f
devnet: configuration fixes (#8592)
battlmonstr Nov 1, 2023
35696af
tests: test that erigon can be used as a library (#8494)
battlmonstr Nov 1, 2023
329d18e
snapshots: reduce merge limit of blocks to 100K (#8614)
AskAlexSharov Nov 1, 2023
d92898a
p2p: silkworm sentry (#8527)
battlmonstr Nov 2, 2023
714fa0f
mainnet 18.3M snaps (#8639)
AskAlexSharov Nov 2, 2023
902dc3c
Merge remote-tracking branch 'origin/devel' into jyellick/merge-upstr…
jyellick Nov 2, 2023
de9f888
Update external test replace directives
jyellick Nov 2, 2023
7683572
Slightly enlarge the 'heavy' struct size
jyellick Nov 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ jobs:
- name: test-integration
run: make test-integration

- name: Test erigon as a library
env:
GIT_COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
run: make test-erigon-ext GIT_COMMIT=$GIT_COMMIT

# name: history-v3-test-integration
# run: make test3-integration

Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ linters-settings:
rules: "rules.go"
hugeParam:
# size in bytes that makes the warning trigger (default 80)
sizeThreshold: 1000
sizeThreshold: 1100
rangeExprCopy:
# size in bytes that makes the warning trigger (default 512)
sizeThreshold: 512
Expand Down
21 changes: 11 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ CGO_CFLAGS += -DMDBX_FORCE_ASSERTIONS=0 # Enable MDBX's asserts by default in 'd
#CGO_CFLAGS += -DMDBX_ENV_CHECKPID=0 # Erigon doesn't do fork() syscall
CGO_CFLAGS += -O
CGO_CFLAGS += -D__BLST_PORTABLE__
CGO_CFLAGS += -Wno-unknown-warning-option -Wno-enum-int-mismatch -Wno-strict-prototypes
#CGO_CFLAGS += -Wno-error=strict-prototypes # for Clang15, remove it when can https://github.com/ledgerwatch/erigon/issues/6113#issuecomment-1359526277
CGO_CFLAGS += -Wno-unknown-warning-option -Wno-enum-int-mismatch -Wno-strict-prototypes -Wno-unused-but-set-variable

# about netgo see: https://github.com/golang/go/issues/30310#issuecomment-471669125 and https://github.com/golang/go/issues/57757
BUILD_TAGS = nosqlite,noboltdb
Expand Down Expand Up @@ -142,22 +141,24 @@ db-tools:
rm -rf vendor
@echo "Run \"$(GOBIN)/mdbx_stat -h\" to get info about mdbx db file."

## test: run unit tests with a 100s timeout
test:
test-erigon-lib:
@cd erigon-lib && $(MAKE) test

test-erigon-ext:
@cd tests/erigon-ext-test && ./test.sh $(GIT_COMMIT)

## test: run unit tests with a 100s timeout
test: test-erigon-lib
$(GOTEST) --timeout 10m

test3:
@cd erigon-lib && $(MAKE) test
test3: test-erigon-lib
$(GOTEST) --timeout 10m -tags $(BUILD_TAGS),e3

## test-integration: run integration tests with a 30m timeout
test-integration:
@cd erigon-lib && $(MAKE) test
test-integration: test-erigon-lib
$(GOTEST) --timeout 240m -tags $(BUILD_TAGS),integration

test3-integration:
@cd erigon-lib && $(MAKE) test
test3-integration: test-erigon-lib
$(GOTEST) --timeout 240m -tags $(BUILD_TAGS),integration,e3

## lint-deps: install lint dependencies
Expand Down
79 changes: 41 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ System Requirements

* Goerli Full node (see `--prune*` flags): 189GB on Beta, 114GB on Alpha (April 2022).

* Gnosis Chain Archive: 370GB (January 2023).
* Gnosis Chain Archive: 600GB (October 2023).

* Polygon Mainnet Archive: 5TB. (April 2022). `--prune.*.older 15768000`: 5.1Tb (Sept 2023). Polygon Mumbai Archive: 1TB. (April 2022).
* Polygon Mainnet Archive: 5TB. (April 2022). `--prune.*.older 15768000`: 5.1Tb (Sept 2023). Polygon Mumbai Archive:
1TB. (April 2022).

SSD or NVMe. Do not recommend HDD - on HDD Erigon will always stay N blocks behind chain tip, but not fall behind.
Bear in mind that SSD performance deteriorates when close to capacity.
Expand Down Expand Up @@ -111,7 +112,8 @@ Running `make help` will list and describe the convenience commands available in
### Datadir structure

- chaindata: recent blocks, state, recent state history. low-latency disk recommended.
- snapshots: old blocks, old state history. can symlink/mount it to cheaper disk. mostly immutable. must have ~100gb free space (for merge recent files to bigger one).
- snapshots: old blocks, old state history. can symlink/mount it to cheaper disk. mostly immutable. must have ~100gb
free space (for merge recent files to bigger one).
- temp: can grow to ~100gb, but usually empty. can symlink/mount it to cheaper disk.
- txpool: pending transactions. safe to remove.
- nodes: p2p peers. safe to remove.
Expand Down Expand Up @@ -141,7 +143,9 @@ int value specifying the highest output log level:
LvlTrace = 5
```

To set an output dir for logs to be collected on disk, please set `--log.dir.path` If you want to change the filename produced from `erigon` you should also set the `--log.dir.prefix` flag to an alternate name. The flag `--log.dir.verbosity` is
To set an output dir for logs to be collected on disk, please set `--log.dir.path` If you want to change the filename
produced from `erigon` you should also set the `--log.dir.prefix` flag to an alternate name. The
flag `--log.dir.verbosity` is
also available to control the verbosity of this logging, with the same int value as above, or the string value e.g. '
debug' or 'info'. Default verbosity is 'debug' (4), for disk logging.

Expand Down Expand Up @@ -530,13 +534,10 @@ Detailed explanation: [./docs/programmers_guide/db_faq.md](./docs/programmers_gu

### Default Ports and Firewalls



#### `erigon` ports


| Component | Port | Protocol | Purpose | Should Expose |
| --------- | ----- | --------- | --------------------------- | ------------- |
|-----------|-------|-----------|-----------------------------|---------------|
| engine | 9090 | TCP | gRPC Server | Private |
| engine | 42069 | TCP & UDP | Snap sync (Bittorrent) | Public |
| engine | 8551 | TCP | Engine API (JWT auth) | Private |
Expand All @@ -545,40 +546,31 @@ Detailed explanation: [./docs/programmers_guide/db_faq.md](./docs/programmers_gu
| sentry | 9091 | TCP | incoming gRPC Connections | Private |
| rpcdaemon | 8545 | TCP | HTTP & WebSockets & GraphQL | Private |




Typically, 30303 and 30304 are exposed to the internet to allow incoming peering connections. 9090 is exposed only
internally for rpcdaemon or other connections, (e.g. rpcdaemon -> erigon).
Port 8551 (JWT authenticated) is exposed only internally for [Engine API] JSON-RPC queries from the Consensus Layer
node.





#### `caplin` ports

| Component | Port | Protocol | Purpose | Should Expose |
| --------- | ---- | -------- | ---------------- | ------------- |
|-----------|------|----------|------------------|---------------|
| sentinel | 4000 | UDP | Peering | Public |
| sentinel | 4001 | TCP | Peering | Public |

If you are using `--internalcl` aka `caplin` as your consensus client, then also look at the chart above


#### `shared` ports

| Component | Port | Protocol | Purpose | Should Expose |
| --------- | ----- | --------- | --------------------------- | ------------- |
| all | 6060 | TCP | pprof | Private |
| all | 6060 | TCP | metrics | Private |

| Component | Port | Protocol | Purpose | Should Expose |
|-----------|------|----------|---------|---------------|
| all | 6060 | TCP | pprof | Private |
| all | 6060 | TCP | metrics | Private |

Optional flags can be enabled that enable pprof or metrics (or both) - however, they both run on 6060 by default, so

you'll have to change one if you want to run both at the same time. use `--help` with the binary for more info.


#### `other` ports

Reserved for future use: **gRPC ports**: `9092` consensus engine, `9093` snapshot downloader, `9094` TxPool
Expand Down Expand Up @@ -606,15 +598,16 @@ Device Benchmark Testing RFC 2544
RFC 922, Section 7
```

Same in [IpTables syntax](https://ethereum.stackexchange.com/questions/6386/how-to-prevent-being-blacklisted-for-running-an-ethereum-client/13068#13068)
Same
in [IpTables syntax](https://ethereum.stackexchange.com/questions/6386/how-to-prevent-being-blacklisted-for-running-an-ethereum-client/13068#13068)

### How to get diagnostic for bug report?

- Get stack trace: `kill -SIGUSR1 <pid>`, get trace and stop: `kill -6 <pid>`
- Get CPU profiling: add `--pprof flag`
run `go tool pprof -png http://127.0.0.1:6060/debug/pprof/profile\?seconds\=20 > cpu.png`
run `go tool pprof -png http://127.0.0.1:6060/debug/pprof/profile\?seconds\=20 > cpu.png`
- Get RAM profiling: add `--pprof flag`
run `go tool pprof -inuse_space -png http://127.0.0.1:6060/debug/pprof/heap > mem.png`
run `go tool pprof -inuse_space -png http://127.0.0.1:6060/debug/pprof/heap > mem.png`

### How to run local devnet?

Expand All @@ -628,6 +621,13 @@ UID/GID (1000).
More details
in [post](https://www.fullstaq.com/knowledge-hub/blogs/docker-and-the-host-filesystem-owner-matching-problem)

### How to run public RPC api

- `--txpool.nolocals=true`
- don't add `admin` in `--http.api` list
- to increase throughput may need
increase/decrease: `--db.read.concurrency`, `--rpc.batch.concurrency`, `--rpc.batch.limit`

### Run RaspberyPI

https://github.com/mathMakesArt/Erigon-on-RPi-4
Expand All @@ -642,7 +642,8 @@ Getting in touch

### Erigon Discord Server

The main discussions are happening on our Discord server. To get an invite, send an email to `bloxster [at] proton.me` with
The main discussions are happening on our Discord server. To get an invite, send an email to `bloxster [at] proton.me`
with
your name, occupation, a brief explanation of why you want to join the Discord, and how you heard about Erigon.

### Reporting security issues/concerns
Expand All @@ -669,20 +670,22 @@ Next tools show correct memory usage of Erigon:

- `vmmap -summary PID | grep -i "Physical footprint"`. Without `grep` you can see details
- `section MALLOC ZONE column Resident Size` shows App memory usage, `section REGION TYPE column Resident Size`
shows OS pages cache size.
shows OS pages cache size.
- `Prometheus` dashboard shows memory of Go app without OS pages cache (`make prometheus`, open in
browser `localhost:3000`, credentials `admin/admin`)
browser `localhost:3000`, credentials `admin/admin`)
- `cat /proc/<PID>/smaps`

Erigon uses ~4Gb of RAM during genesis sync and ~1Gb during normal work. OS pages cache can utilize unlimited amount of
memory.

**Warning:** Multiple instances of Erigon on same machine will touch Disk concurrently, it impacts performance - one of
main Erigon optimisations: "reduce Disk random access".
"Blocks Execution stage" still does many random reads - this is reason why it's slowest stage. We do not recommend
running
multiple genesis syncs on same Disk. If genesis sync passed, then it's fine to run multiple Erigon instances on same
Disk.
Erigon uses ~4Gb of RAM during genesis sync and ~1Gb during normal work. OS pages cache can utilize unlimited amount
of
memory.

**Warning:** Multiple instances of Erigon on same machine will touch Disk concurrently, it impacts performance - one
of
main Erigon optimisations: "reduce Disk random access".
"Blocks Execution stage" still does many random reads - this is reason why it's slowest stage. We do not recommend
running
multiple genesis syncs on same Disk. If genesis sync passed, then it's fine to run multiple Erigon instances on same
Disk.

### Blocks Execution is slow on cloud-network-drives

Expand Down
6 changes: 5 additions & 1 deletion cl/cltypes/beacon_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ func NewBeaconBlock(beaconCfg *clparams.BeaconChainConfig) *BeaconBlock {
}

func NewBeaconBody(beaconCfg *clparams.BeaconChainConfig) *BeaconBody {
return &BeaconBody{beaconCfg: beaconCfg}
return &BeaconBody{
beaconCfg: beaconCfg,
}
}

// Version returns beacon block version.
Expand Down Expand Up @@ -172,6 +174,8 @@ func (b *BeaconBody) DecodeSSZ(buf []byte, version int) error {
return fmt.Errorf("[BeaconBody] err: %s", ssz.ErrLowBufferSize)
}

b.ExecutionPayload = NewEth1Block(b.Version, b.beaconCfg)

err := ssz2.UnmarshalSSZ(buf, version, b.getSchema(false)...)
return err
}
Expand Down
31 changes: 28 additions & 3 deletions cl/persistence/format/chunk_encoding/chunks.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,40 @@ func WriteChunk(w io.Writer, buf []byte, t DataType) error {
return nil
}

func ReadChunk(r io.Reader) (buf []byte, t DataType, err error) {
func ReadChunk(r io.Reader, out io.Writer) (t DataType, err error) {
prefix := make([]byte, 8)
if _, err := r.Read(prefix); err != nil {
return DataType(0), err
}
t = DataType(prefix[0])
prefix[0] = 0

bufLen := binary.BigEndian.Uint64(prefix)
if bufLen == 0 {
return
}

if _, err = io.CopyN(out, r, int64(bufLen)); err != nil {
return
}
return
}

func ReadChunkToBytes(r io.Reader) (b []byte, t DataType, err error) {
prefix := make([]byte, 8)
if _, err := r.Read(prefix); err != nil {
return nil, DataType(0), err
}
t = DataType(prefix[0])
prefix[0] = 0
buf = make([]byte, binary.BigEndian.Uint64(prefix))
if _, err = r.Read(buf); err != nil {

bufLen := binary.BigEndian.Uint64(prefix)
if bufLen == 0 {
return
}
b = make([]byte, bufLen)

if _, err = r.Read(b); err != nil {
return
}
return
Expand Down
Loading
Loading