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

Erigon v2.60.1 #403

Merged
merged 25 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ce8b757
fix Consensus specification tests CI (#10391) (#10396)
taratorio May 17, 2024
c2934dc
rpc/handler: do not append null to stream when json may be valid (#10…
taratorio May 18, 2024
6d4a614
Fixed Bor Log appearing on Ethereum Mainnet (#10405) (#10420)
taratorio May 20, 2024
7fced9f
fix gas price not right problem (#10456)
yperbasis May 24, 2024
c0be07d
eth_estimateGas: default feeCap to base fee (#10499)
yperbasis May 27, 2024
2e500bd
Add flag for bor waypoint types (#10501)
yperbasis May 27, 2024
b0df97f
try to fix 'method handler crashed' for debug_traceCall of #9090 (#10…
yperbasis May 27, 2024
7e1adef
diagnostics: cherry pick speedtest disable (#10509)
dvovk May 27, 2024
7b5653b
Enable DNS p2p discovery on holesky (#10507)
yperbasis May 27, 2024
d3af203
fix eth_call 'method handler crashed' error when tx has set maxFeePer…
yperbasis May 27, 2024
608a940
e2: remove overlapped files only after merge (#10487)
AskAlexSharov May 28, 2024
e9840ad
add flag checking for pruning waypoints (#10508)
yperbasis May 28, 2024
9501f93
p2p/sentry: sentry doesn't start with ErrNoHead (#10454) (#10523)
battlmonstr May 28, 2024
128f015
add lock to purgeMilestoneIDsList (#10524)
yperbasis May 28, 2024
f13762b
polygon/heimdall: fix checkpoint json marshalling (#10530)
taratorio May 28, 2024
b672fcb
Fix capacity for immediate appends (#10539)
yperbasis May 29, 2024
c33912c
core/vm: set tracer-observable value of a delegatecall to match paren…
AskAlexSharov May 29, 2024
7a39ee5
params: version 2.60.1 (#10555)
yperbasis May 30, 2024
efed89b
blobGasPrice should be marshalled as hex (#10571)
yperbasis May 31, 2024
c3fcd76
Caplin: Fixed reforwarding of Bls Execution changes (#10577)
yperbasis May 31, 2024
2e3d061
Caplin: Proper "Normalization" of length of ForkVersions to 8 hex cha…
yperbasis May 31, 2024
b29d137
Caplin: Update BlobSidecars Beacon API endpoint to the latest specs (…
yperbasis May 31, 2024
5bbcc7a
bor blocks retire: infinity loop fix (#10596)
AskAlexSharov Jun 3, 2024
9471c44
txpool: EIP-3860 should only apply to create transactions (#10609)
yperbasis Jun 4, 2024
ccda636
Merge tag 'v2.60.1' into erigon-v2.60.1
MatusKysel Jun 5, 2024
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
9 changes: 7 additions & 2 deletions cl/beacon/beaconhttp/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"net/http"
"regexp"
"strconv"
"strings"

"github.com/go-chi/chi/v5"
"github.com/ledgerwatch/erigon-lib/common"
Expand Down Expand Up @@ -168,9 +169,13 @@ func Uint64FromQueryParams(r *http.Request, name string) (*uint64, error) {

// decode a list of strings from the query params
func StringListFromQueryParams(r *http.Request, name string) ([]string, error) {
str := r.URL.Query().Get(name)
if str == "" {
values := r.URL.Query()[name]
if len(values) == 0 {
return nil, nil
}

// Combine all values into a single string, separating by comma
str := strings.Join(values, ",")

return regexp.MustCompile(`\s*,\s*`).Split(str, -1), nil
}
27 changes: 24 additions & 3 deletions cl/beacon/handler/blobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package handler
import (
"fmt"
"net/http"
"strconv"

"github.com/ledgerwatch/erigon/cl/beacon/beaconhttp"
"github.com/ledgerwatch/erigon/cl/cltypes"
Expand Down Expand Up @@ -51,13 +52,33 @@ func (a *ApiHandler) GetEthV1BeaconBlobSidecars(w http.ResponseWriter, r *http.R
if err != nil {
return nil, err
}

strIdxs, err := beaconhttp.StringListFromQueryParams(r, "indices")
if err != nil {
return nil, err
}
resp := solid.NewStaticListSSZ[*cltypes.BlobSidecar](696969, blobSidecarSSZLenght)
if !found {
return beaconhttp.NewBeaconResponse(resp), nil
}
for _, v := range out {
resp.Append(v)
if len(strIdxs) == 0 {
for _, v := range out {
resp.Append(v)
}
} else {
included := make(map[uint64]struct{})
for _, idx := range strIdxs {
i, err := strconv.ParseUint(idx, 10, 64)
if err != nil {
return nil, err
}
included[i] = struct{}{}
}
for _, v := range out {
if _, ok := included[v.Index]; ok {
resp.Append(v)
}
}
}

return beaconhttp.NewBeaconResponse(resp), nil
}
5 changes: 4 additions & 1 deletion cl/clparams/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package clparams

import (
"crypto/rand"
"encoding/binary"
"fmt"
"math"
"math/big"
Expand Down Expand Up @@ -315,7 +316,9 @@ func (b ConfigByte) MarshalJSON() ([]byte, error) {
type ConfigForkVersion uint32

func (v ConfigForkVersion) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf("\"0x%x\"", v)), nil
tmp := make([]byte, 4)
binary.BigEndian.PutUint32(tmp, uint32(v))
return []byte(fmt.Sprintf("\"0x%x\"", tmp)), nil
}

// BeaconChainConfig contains constant configs for node to participate in beacon chain.
Expand Down
3 changes: 2 additions & 1 deletion cl/sentinel/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ func (s *SentinelServer) PublishGossip(_ context.Context, msg *sentinelrpc.Gossi
gossip.TopicNameVoluntaryExit,
gossip.TopicNameProposerSlashing,
gossip.TopicNameSyncCommitteeContributionAndProof,
gossip.TopicNameAttesterSlashing:
gossip.TopicNameAttesterSlashing,
gossip.TopicNameBlsToExecutionChange:
subscription = manager.GetMatchingSubscription(msg.Name)
default:
// check subnets
Expand Down
2 changes: 1 addition & 1 deletion cl/spectest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


tests:
GIT_LFS_SKIP_SMUDGE=1 git clone https://github.com/ethereum/consensus-spec-tests
GIT_LFS_SKIP_SMUDGE=1 GIT_CLONE_PROTECTION_ACTIVE=false git clone https://github.com/ethereum/consensus-spec-tests
cd consensus-spec-tests && git checkout 080c96fbbf3be58e75947debfeb9ba3b2b7c9748 && git lfs pull --exclude=tests/general,tests/minimal && cd ..
mv consensus-spec-tests/tests .
rm -rf consensus-spec-tests
Expand Down
1 change: 1 addition & 0 deletions cmd/integration/commands/stages.go
Original file line number Diff line number Diff line change
Expand Up @@ -1627,6 +1627,7 @@ func newSync(ctx context.Context, db kv.RwDB, miningConfig *params.MiningConfig,
chainConfig,
genesisBlock,
chainConfig.ChainID.Uint64(),
logger,
)

maxBlockBroadcastPeers := func(header *types.Header) uint { return 0 }
Expand Down
7 changes: 4 additions & 3 deletions cmd/snapshots/manifest/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ import (
"strings"
"time"

"github.com/urfave/cli/v2"

"github.com/ledgerwatch/erigon-lib/downloader"
"github.com/ledgerwatch/erigon-lib/downloader/snaptype"
"github.com/ledgerwatch/erigon/cmd/snapshots/sync"
"github.com/ledgerwatch/erigon/cmd/utils"
"github.com/ledgerwatch/erigon/turbo/logging"
"github.com/urfave/cli/v2"
)

var (
Expand Down Expand Up @@ -286,7 +287,7 @@ func verifyManifest(ctx context.Context, srcSession *downloader.RCloneSession, v
var extra string

if len(manifestFiles) != 0 {
files := make([]string, len(manifestFiles))
files := make([]string, 0, len(manifestFiles))

for file := range manifestFiles {
files = append(files, file)
Expand All @@ -296,7 +297,7 @@ func verifyManifest(ctx context.Context, srcSession *downloader.RCloneSession, v
}

if len(dirFiles) != 0 {
files := make([]string, len(dirFiles))
files := make([]string, 0, len(dirFiles))

for file := range dirFiles {
files = append(files, file)
Expand Down
9 changes: 8 additions & 1 deletion cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import (
"github.com/ledgerwatch/erigon/p2p/nat"
"github.com/ledgerwatch/erigon/p2p/netutil"
"github.com/ledgerwatch/erigon/params"
borsnaptype "github.com/ledgerwatch/erigon/polygon/bor/snaptype"
"github.com/ledgerwatch/erigon/rpc/rpccfg"
"github.com/ledgerwatch/erigon/turbo/logging"
)
Expand Down Expand Up @@ -1024,9 +1025,14 @@ var (
Usage: "Diagnostics HTTP server listening port",
Value: 6060,
}
DiagSpeedTestFlag = cli.BoolFlag{
Name: "diagnostics.speedtest",
Usage: "Enable speed test",
Value: false,
}
)

var MetricFlags = []cli.Flag{&MetricsEnabledFlag, &MetricsHTTPFlag, &MetricsPortFlag, &DiagDisabledFlag, &DiagEndpointAddrFlag, &DiagEndpointPortFlag}
var MetricFlags = []cli.Flag{&MetricsEnabledFlag, &MetricsHTTPFlag, &MetricsPortFlag, &DiagDisabledFlag, &DiagEndpointAddrFlag, &DiagEndpointPortFlag, &DiagSpeedTestFlag}

var DiagnosticsFlags = []cli.Flag{&DiagnosticsURLFlag, &DiagnosticsURLFlag, &DiagnosticsSessionsFlag}

Expand Down Expand Up @@ -1603,6 +1609,7 @@ func setBorConfig(ctx *cli.Context, cfg *ethconfig.Config) {
cfg.WithoutHeimdall = ctx.Bool(WithoutHeimdallFlag.Name)
cfg.WithHeimdallMilestones = ctx.Bool(WithHeimdallMilestones.Name)
cfg.WithHeimdallWaypointRecording = ctx.Bool(WithHeimdallWaypoints.Name)
borsnaptype.RecordWayPoints(cfg.WithHeimdallWaypointRecording)
cfg.PolygonSync = ctx.Bool(PolygonSyncFlag.Name)
}

Expand Down
2 changes: 1 addition & 1 deletion core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ func logReceipts(receipts types.Receipts, txns types.Transactions, cc *chain.Con
return
}

marshalled := make([]map[string]interface{}, len(receipts))
marshalled := make([]map[string]interface{}, 0, len(receipts))
for i, receipt := range receipts {
txn := txns[i]
marshalled = append(marshalled, ethutils.MarshalReceipt(receipt, txn, cc, header, txn.Hash(), true))
Expand Down
112 changes: 0 additions & 112 deletions core/rawdb/accessors_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"context"
"encoding/binary"
"encoding/json"
"errors"
"fmt"
"math"
"math/big"
Expand All @@ -42,7 +41,6 @@ import (

"github.com/ledgerwatch/erigon/core/types"
"github.com/ledgerwatch/erigon/ethdb/cbor"
"github.com/ledgerwatch/erigon/polygon/heimdall"
"github.com/ledgerwatch/erigon/rlp"
)

Expand Down Expand Up @@ -1096,116 +1094,6 @@ func PruneBlocks(tx kv.RwTx, blockTo uint64, blocksDeleteLimit int) error {
return nil
}

// PruneBorBlocks - delete [1, to) old blocks after moving it to snapshots.
// keeps genesis in db: [1, to)
// doesn't change sequences of kv.EthTx and kv.NonCanonicalTxs
// doesn't delete Receipts, Senders, Canonical markers, TotalDifficulty
func PruneBorBlocks(tx kv.RwTx, blockTo uint64, blocksDeleteLimit int, SpanIdAt func(number uint64) uint64) error {
c, err := tx.Cursor(kv.BorEventNums)
if err != nil {
return err
}
defer c.Close()
var blockNumBytes [8]byte
binary.BigEndian.PutUint64(blockNumBytes[:], blockTo)
k, v, err := c.Seek(blockNumBytes[:])
if err != nil {
return err
}
var eventIdTo uint64 = math.MaxUint64
if k != nil {
eventIdTo = binary.BigEndian.Uint64(v)
}
c1, err := tx.RwCursor(kv.BorEvents)
if err != nil {
return err
}
defer c1.Close()
counter := blocksDeleteLimit
for k, _, err = c1.First(); err == nil && k != nil && counter > 0; k, _, err = c1.Next() {
eventId := binary.BigEndian.Uint64(k)
if eventId >= eventIdTo {
break
}
if err = c1.DeleteCurrent(); err != nil {
return err
}
counter--
}
if err != nil {
return err
}
firstSpanToKeep := SpanIdAt(blockTo)
c2, err := tx.RwCursor(kv.BorSpans)
if err != nil {
return err
}
defer c2.Close()
counter = blocksDeleteLimit
for k, _, err := c2.First(); err == nil && k != nil && counter > 0; k, _, err = c2.Next() {
spanId := binary.BigEndian.Uint64(k)
if spanId >= firstSpanToKeep {
break
}
if err = c2.DeleteCurrent(); err != nil {
return err
}
counter--
}

checkpointCursor, err := tx.RwCursor(kv.BorCheckpoints)
if err != nil {
return err
}

defer checkpointCursor.Close()
lastCheckpointToRemove, err := heimdall.CheckpointIdAt(tx, blockTo)

if err != nil {
return err
}

var checkpointIdBytes [8]byte
binary.BigEndian.PutUint64(checkpointIdBytes[:], uint64(lastCheckpointToRemove))
for k, _, err := checkpointCursor.Seek(checkpointIdBytes[:]); err == nil && k != nil; k, _, err = checkpointCursor.Prev() {
if err = checkpointCursor.DeleteCurrent(); err != nil {
return err
}
}

milestoneCursor, err := tx.RwCursor(kv.BorMilestones)

if err != nil {
return err
}

defer milestoneCursor.Close()

var lastMilestoneToRemove heimdall.MilestoneId

for blockCount := 1; err != nil && blockCount < blocksDeleteLimit; blockCount++ {
lastMilestoneToRemove, err = heimdall.MilestoneIdAt(tx, blockTo-uint64(blockCount))

if !errors.Is(err, heimdall.ErrMilestoneNotFound) {
return err
} else {
if blockCount == blocksDeleteLimit-1 {
return nil
}
}
}

var milestoneIdBytes [8]byte
binary.BigEndian.PutUint64(milestoneIdBytes[:], uint64(lastMilestoneToRemove))
for k, _, err := milestoneCursor.Seek(milestoneIdBytes[:]); err == nil && k != nil; k, _, err = milestoneCursor.Prev() {
if err = milestoneCursor.DeleteCurrent(); err != nil {
return err
}
}

return nil
}

func TruncateCanonicalChain(ctx context.Context, db kv.RwTx, from uint64) error {
return db.ForEach(kv.HeaderCanonical, hexutility.EncodeTs(from), func(k, _ []byte) error {
return db.Delete(kv.HeaderCanonical, k)
Expand Down
3 changes: 2 additions & 1 deletion core/rawdb/blockio/block_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon-lib/kv/rawdbv3"
"github.com/ledgerwatch/erigon/core/rawdb"
"github.com/ledgerwatch/erigon/polygon/bor/bordb"
"github.com/ledgerwatch/log/v3"
)

Expand Down Expand Up @@ -116,5 +117,5 @@ func (w *BlockWriter) PruneBlocks(ctx context.Context, tx kv.RwTx, blockTo uint6
// doesn't change sequences of kv.EthTx and kv.NonCanonicalTxs
// doesn't delete Receipts, Senders, Canonical markers, TotalDifficulty
func (w *BlockWriter) PruneBorBlocks(ctx context.Context, tx kv.RwTx, blockTo uint64, blocksDeleteLimit int, SpanIdAt func(number uint64) uint64) error {
return rawdb.PruneBorBlocks(tx, blockTo, blocksDeleteLimit, SpanIdAt)
return bordb.PruneBorBlocks(tx, blockTo, blocksDeleteLimit, SpanIdAt)
}
6 changes: 6 additions & 0 deletions core/vm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,12 @@ func (evm *EVM) call(typ OpCode, caller ContractRef, addr libcommon.Address, inp
v := value
if typ == STATICCALL {
v = nil
} else if typ == DELEGATECALL {
// NOTE: caller must, at all times be a contract. It should never happen
// that caller is something other than a Contract.
parent := caller.(*Contract)
// DELEGATECALL inherits value from parent call
v = parent.value
}
if depth == 0 {
evm.config.Tracer.CaptureStart(evm, caller.Address(), addr, isPrecompile, false /* create */, input, gas, v, code)
Expand Down
2 changes: 1 addition & 1 deletion diagnostics/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func writeLogsList(w http.ResponseWriter, dirPath string) {
Size int64 `json:"size"`
}

files := make([]file, len(infos))
files := make([]file, 0, len(infos))

for _, fileInfo := range infos {
files = append(files, file{Name: fileInfo.Name(), Size: fileInfo.Size()})
Expand Down
5 changes: 4 additions & 1 deletion diagnostics/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var (
metricsPortFlag = "metrics.port"
pprofPortFlag = "pprof.port"
pprofAddrFlag = "pprof.addr"
diagnoticsSpeedTestFlag = "diagnostics.speedtest"
)

func Setup(ctx *cli.Context, node *node.ErigonNode, metricsMux *http.ServeMux, pprofMux *http.ServeMux) {
Expand Down Expand Up @@ -48,7 +49,9 @@ func Setup(ctx *cli.Context, node *node.ErigonNode, metricsMux *http.ServeMux, p
diagMux = SetupDiagnosticsEndpoint(nil, diagAddress)
}

diagnostic := diaglib.NewDiagnosticClient(diagMux, node.Backend().DataDir())
speedTest := ctx.Bool(diagnoticsSpeedTestFlag)

diagnostic := diaglib.NewDiagnosticClient(diagMux, node.Backend().DataDir(), speedTest)
diagnostic.Setup()

SetupEndpoints(ctx, node, diagMux, diagnostic)
Expand Down
4 changes: 3 additions & 1 deletion erigon-lib/diagnostics/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
type DiagnosticClient struct {
metricsMux *http.ServeMux
dataDirPath string
speedTest bool

syncStats SyncStatistics
snapshotFileList SnapshoFilesList
Expand All @@ -26,10 +27,11 @@ type DiagnosticClient struct {
networkSpeedMutex sync.Mutex
}

func NewDiagnosticClient(metricsMux *http.ServeMux, dataDirPath string) *DiagnosticClient {
func NewDiagnosticClient(metricsMux *http.ServeMux, dataDirPath string, speedTest bool) *DiagnosticClient {
return &DiagnosticClient{
metricsMux: metricsMux,
dataDirPath: dataDirPath,
speedTest: speedTest,
syncStats: SyncStatistics{},
hardwareInfo: HardwareInfo{},
snapshotFileList: SnapshoFilesList{},
Expand Down
Loading
Loading