Fix description of --prune=r flag (#5193)

* Fix description of --prune=r flag

* Small correction
This commit is contained in:
Andrew Ashikhmin 2022-08-26 13:36:31 +02:00 committed by GitHub
parent d33096eaa7
commit 465c586ef4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 28 deletions

View File

@ -231,23 +231,7 @@ http.api : ["eth","debug","net"]
### Beacon Chain (Consensus Layer)
Erigon can be used as an Execution Layer (EL) for Consensus Layer clients (CL). Default configuration is OK. CL
relies on availability of receipts don't prune them: don't add character `r` to `--prune` flag. However, old receipts
are not needed for CL and you can safely prune them with `--prune htc`.
## ETH2 Deposit Contract Block Number
- Mainnnet: 11052984
- Sepolia: 1273020
- Goerli: 4367322
## ETH2 Deposit Contract Address
- Mainnet: 0x00000000219ab540356cBB839Cbe05303d7705Fa
- Sepolia: 0x7f02C3E3c98b133055B8B348B2Ac625669Ed295D
- Goerli: 0xff50ed3d0ec03aC01D4C79aAd74928BFF48a7b2b
Erigon can be used as an Execution Layer (EL) for Consensus Layer clients (CL). Default configuration is OK.
If your CL client is on a different device, add `--authrpc.addr 0.0.0.0` ([Engine API] listens on localhost by default)
as well as `--authrpc.vhosts <CL host>`.

View File

@ -1,6 +1,7 @@
package prune
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
@ -79,11 +80,10 @@ func FromCli(chainId uint64, flags string, exactHistory, exactReceipts, exactTxI
}
}
mode.Receipts = Before(beforeR)
} else {
if exactReceipts == 0 && mode.Receipts.Enabled() {
} else if exactReceipts == 0 && mode.Receipts.Enabled() && pruneBlockBefore != 0 {
// Default --prune=r to pruning receipts before the Beacon Chain genesis
mode.Receipts = Before(pruneBlockBefore)
}
}
if beforeT > 0 {
mode.TxIndex = Before(beforeT)
}
@ -309,6 +309,10 @@ func EnsureNotChanged(tx kv.GetPut, pruneMode Mode) (Mode, error) {
if pruneMode.Initialised {
// If storage mode is not explicitly specified, we take whatever is in the database
if !reflect.DeepEqual(pm, pruneMode) {
if bytes.Equal(pm.Receipts.dbType(), kv.PruneTypeOlder) && bytes.Equal(pruneMode.Receipts.dbType(), kv.PruneTypeBefore) {
log.Error("--prune=r flag has been changed to mean pruning of receipts before the Beacon Chain genesis. Please re-sync Erigon from scratch. " +
"Alternatively, enforce the old behaviour explicitly by --prune.r.older=90000 flag at the risk of breaking the Consensus Layer.")
}
return pm, errors.New("not allowed change of --prune flag, last time you used: " + pm.String())
}
}

View File

@ -64,26 +64,28 @@ var (
r - prune receipts (Receipts, Logs, LogTopicIndex, LogAddressIndex - used by eth_getLogs and similar RPC methods)
t - prune transaction by it's hash index
c - prune call traces (used by trace_filter method)
Does delete data older than 90K blocks, --prune=h is shortcut for: --prune.h.older=90_000
If item is NOT in the list - means NO pruning for this data.
Example: --prune=hrtc`,
Does delete data older than 90K blocks, --prune=h is shortcut for: --prune.h.older=90000.
Similarly, --prune=t is shortcut for: --prune.t.older=90000 and --prune=c is shortcut for: --prune.c.older=90000.
However, --prune=r means to prune receipts before the Beacon Chain genesis (Consensus Layer might need receipts after that).
If an item is NOT on the list - means NO pruning for this data.
Example: --prune=htc`,
Value: "disabled",
}
PruneHistoryFlag = cli.Uint64Flag{
Name: "prune.h.older",
Usage: `Prune data after this amount of blocks (if --prune flag has 'h', then default is 90K)`,
Usage: `Prune data older than this number of blocks from the tip of the chain (if --prune flag has 'h', then default is 90K)`,
}
PruneReceiptFlag = cli.Uint64Flag{
Name: "prune.r.older",
Usage: `Prune data after this amount of blocks (if --prune flag has 'r', then default is 90K)`,
Usage: `Prune data older than this number of blocks from the tip of the chain`,
}
PruneTxIndexFlag = cli.Uint64Flag{
Name: "prune.t.older",
Usage: `Prune data after this amount of blocks (if --prune flag has 't', then default is 90K)`,
Usage: `Prune data older than this number of blocks from the tip of the chain (if --prune flag has 't', then default is 90K)`,
}
PruneCallTracesFlag = cli.Uint64Flag{
Name: "prune.c.older",
Usage: `Prune data after this amount of blocks (if --prune flag has 'c', then default is 90K)`,
Usage: `Prune data older than this number of blocks from the tip of the chain (if --prune flag has 'c', then default is 90K)`,
}
PruneHistoryBeforeFlag = cli.Uint64Flag{