Skip to content

Commit 30b23c9

Browse files
MatusKyseltaratorioyperbasisGiulio2002marshalys
authored
Erigon v2.60.1 (#403)
* fix Consensus specification tests CI (erigontech#10391) (erigontech#10396) Cherry-pick: erigontech@bc5fa6f Need this to get PR CI green for v2.60.1 patches, e.g. - erigontech#10390 Co-authored-by: Andrew Ashikhmin <[email protected]> * rpc/handler: do not append null to stream when json may be valid (erigontech#10390) Cherry-pick: erigontech@4d1c954 Relates to: erigontech#10376 * Fixed Bor Log appearing on Ethereum Mainnet (erigontech#10405) (erigontech#10420) Cherry-pick: erigontech@be889f6 Co-authored-by: Giulio rebuffo <[email protected]> * fix gas price not right problem (erigontech#10456) Cherry pick PR erigontech#10451 into the release branch Co-authored-by: mars <[email protected]> * eth_estimateGas: default feeCap to base fee (erigontech#10499) Copy PR erigontech#10495 into the release branch * Add flag for bor waypoint types (erigontech#10501) Cherry pick PR erigontech#10281 into the release branch Co-authored-by: Mark Holt <[email protected]> Co-authored-by: alex.sharov <[email protected]> * try to fix 'method handler crashed' for debug_traceCall of erigontech#9090 (erigontech#10502) Cherry pick PR erigontech#10401 into the release branch Co-authored-by: mars <[email protected]> * diagnostics: cherry pick speedtest disable (erigontech#10509) Cherry pick PR erigontech#10449 into the release branch * Enable DNS p2p discovery on holesky (erigontech#10507) Cherry pick PR erigontech#10460 into the release branch Co-authored-by: Willian Mitsuda <[email protected]> * fix eth_call 'method handler crashed' error when tx has set maxFeePerBlobGas (erigontech#10506) Cherry pick PR erigontech#10452 into the release branch Co-authored-by: mars <[email protected]> * e2: remove overlapped files only after merge (erigontech#10487) Otherwise: if start after `kill -9` in the middle of merge - may remove small files of 1 type of file, but leave small files of another type of files (which merge was not finished) - and leave node in un-mergable state: erigontech#10485 --------- Co-authored-by: awskii <[email protected]> * add flag checking for pruning waypoints (erigontech#10508) Cherry pick PR erigontech#10468 into the release branch Co-authored-by: Mark Holt <[email protected]> * p2p/sentry: sentry doesn't start with ErrNoHead (erigontech#10454) (erigontech#10523) cherry-pick erigontech#10494 to release/2.60 * add lock to purgeMilestoneIDsList (erigontech#10524) Cherry pick PR erigontech#10493 into the release branch Co-authored-by: Mark Holt <[email protected]> * polygon/heimdall: fix checkpoint json marshalling (erigontech#10530) Fixes a recent regression causing unwinds due to checkpoints having zero root hash: ``` [WARN] [05-18|23:58:54.662] [bor] Root hash mismatch while whitelisting checkpoint expected=ac1c57270479250af3ce8eee90075cd8b2ba1bac55353105e063d9a4c87c743e got=0000000000000000000000000000000000000000000000000000000000000000 [WARN] [05-18|23:58:54.662] [bor] Rewinding chain due to checkpoint root hash mismatch number=57125727 ``` Note this has already been fixed on Erigon 3 branch but as part of a non-related PR - https://github.com/ledgerwatch/erigon/pull/10124/files#diff-47d4532f399f2d6a45e6f19944a45c80bac573b4d1b5cb51485d0254229d1b16 * Fix capacity for immediate appends (erigontech#10539) Cherry pick PR erigontech#10528 into the release branch Co-authored-by: Shoham Chakraborty <[email protected]> * core/vm: set tracer-observable value of a delegatecall to match parent value (erigontech#10370) requested by erigontech#9549 port of ethereum/go-ethereum#26632 * params: version 2.60.1 (erigontech#10555) * blobGasPrice should be marshalled as hex (erigontech#10571) Cherry pick PR erigontech#10551 into the release branch * Caplin: Fixed reforwarding of Bls Execution changes (erigontech#10577) Cherry pick PR erigontech#10546 into the release branch Co-authored-by: Giulio rebuffo <[email protected]> * Caplin: Proper "Normalization" of length of ForkVersions to 8 hex characters (erigontech#10578) Cherry pick PR erigontech#10512 into the release branch Co-authored-by: Giulio rebuffo <[email protected]> * Caplin: Update BlobSidecars Beacon API endpoint to the latest specs (erigontech#10580) Cherry pick PR erigontech#10576 into the release branch Co-authored-by: Giulio rebuffo <[email protected]> * bor blocks retire: infinity loop fix (erigontech#10596) Problem: `+1` was added to maxBlockNum instead of minBlockNum for: erigontech#10554 * txpool: EIP-3860 should only apply to create transactions (erigontech#10609) This fixes Issue erigontech#10607 --------- Co-authored-by: milen <[email protected]> Co-authored-by: Andrew Ashikhmin <[email protected]> Co-authored-by: Giulio rebuffo <[email protected]> Co-authored-by: mars <[email protected]> Co-authored-by: Mark Holt <[email protected]> Co-authored-by: alex.sharov <[email protected]> Co-authored-by: Dmytro <[email protected]> Co-authored-by: Willian Mitsuda <[email protected]> Co-authored-by: awskii <[email protected]> Co-authored-by: battlmonstr <[email protected]> Co-authored-by: Shoham Chakraborty <[email protected]>
1 parent 8a68894 commit 30b23c9

File tree

42 files changed

+480
-310
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+480
-310
lines changed

cl/beacon/beaconhttp/args.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"net/http"
66
"regexp"
77
"strconv"
8+
"strings"
89

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

169170
// decode a list of strings from the query params
170171
func StringListFromQueryParams(r *http.Request, name string) ([]string, error) {
171-
str := r.URL.Query().Get(name)
172-
if str == "" {
172+
values := r.URL.Query()[name]
173+
if len(values) == 0 {
173174
return nil, nil
174175
}
176+
177+
// Combine all values into a single string, separating by comma
178+
str := strings.Join(values, ",")
179+
175180
return regexp.MustCompile(`\s*,\s*`).Split(str, -1), nil
176181
}

cl/beacon/handler/blobs.go

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package handler
33
import (
44
"fmt"
55
"net/http"
6+
"strconv"
67

78
"github.com/ledgerwatch/erigon/cl/beacon/beaconhttp"
89
"github.com/ledgerwatch/erigon/cl/cltypes"
@@ -51,13 +52,33 @@ func (a *ApiHandler) GetEthV1BeaconBlobSidecars(w http.ResponseWriter, r *http.R
5152
if err != nil {
5253
return nil, err
5354
}
54-
55+
strIdxs, err := beaconhttp.StringListFromQueryParams(r, "indices")
56+
if err != nil {
57+
return nil, err
58+
}
5559
resp := solid.NewStaticListSSZ[*cltypes.BlobSidecar](696969, blobSidecarSSZLenght)
5660
if !found {
5761
return beaconhttp.NewBeaconResponse(resp), nil
5862
}
59-
for _, v := range out {
60-
resp.Append(v)
63+
if len(strIdxs) == 0 {
64+
for _, v := range out {
65+
resp.Append(v)
66+
}
67+
} else {
68+
included := make(map[uint64]struct{})
69+
for _, idx := range strIdxs {
70+
i, err := strconv.ParseUint(idx, 10, 64)
71+
if err != nil {
72+
return nil, err
73+
}
74+
included[i] = struct{}{}
75+
}
76+
for _, v := range out {
77+
if _, ok := included[v.Index]; ok {
78+
resp.Append(v)
79+
}
80+
}
6181
}
82+
6283
return beaconhttp.NewBeaconResponse(resp), nil
6384
}

cl/clparams/config.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ package clparams
1515

1616
import (
1717
"crypto/rand"
18+
"encoding/binary"
1819
"fmt"
1920
"math"
2021
"math/big"
@@ -315,7 +316,9 @@ func (b ConfigByte) MarshalJSON() ([]byte, error) {
315316
type ConfigForkVersion uint32
316317

317318
func (v ConfigForkVersion) MarshalJSON() ([]byte, error) {
318-
return []byte(fmt.Sprintf("\"0x%x\"", v)), nil
319+
tmp := make([]byte, 4)
320+
binary.BigEndian.PutUint32(tmp, uint32(v))
321+
return []byte(fmt.Sprintf("\"0x%x\"", tmp)), nil
319322
}
320323

321324
// BeaconChainConfig contains constant configs for node to participate in beacon chain.

cl/sentinel/service/service.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ func (s *SentinelServer) PublishGossip(_ context.Context, msg *sentinelrpc.Gossi
9696
gossip.TopicNameVoluntaryExit,
9797
gossip.TopicNameProposerSlashing,
9898
gossip.TopicNameSyncCommitteeContributionAndProof,
99-
gossip.TopicNameAttesterSlashing:
99+
gossip.TopicNameAttesterSlashing,
100+
gossip.TopicNameBlsToExecutionChange:
100101
subscription = manager.GetMatchingSubscription(msg.Name)
101102
default:
102103
// check subnets

cl/spectest/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
tests:
5-
GIT_LFS_SKIP_SMUDGE=1 git clone https://github.com/ethereum/consensus-spec-tests
5+
GIT_LFS_SKIP_SMUDGE=1 GIT_CLONE_PROTECTION_ACTIVE=false git clone https://github.com/ethereum/consensus-spec-tests
66
cd consensus-spec-tests && git checkout 080c96fbbf3be58e75947debfeb9ba3b2b7c9748 && git lfs pull --exclude=tests/general,tests/minimal && cd ..
77
mv consensus-spec-tests/tests .
88
rm -rf consensus-spec-tests

cmd/integration/commands/stages.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,6 +1627,7 @@ func newSync(ctx context.Context, db kv.RwDB, miningConfig *params.MiningConfig,
16271627
chainConfig,
16281628
genesisBlock,
16291629
chainConfig.ChainID.Uint64(),
1630+
logger,
16301631
)
16311632

16321633
maxBlockBroadcastPeers := func(header *types.Header) uint { return 0 }

cmd/snapshots/manifest/manifest.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ import (
1212
"strings"
1313
"time"
1414

15+
"github.com/urfave/cli/v2"
16+
1517
"github.com/ledgerwatch/erigon-lib/downloader"
1618
"github.com/ledgerwatch/erigon-lib/downloader/snaptype"
1719
"github.com/ledgerwatch/erigon/cmd/snapshots/sync"
1820
"github.com/ledgerwatch/erigon/cmd/utils"
1921
"github.com/ledgerwatch/erigon/turbo/logging"
20-
"github.com/urfave/cli/v2"
2122
)
2223

2324
var (
@@ -286,7 +287,7 @@ func verifyManifest(ctx context.Context, srcSession *downloader.RCloneSession, v
286287
var extra string
287288

288289
if len(manifestFiles) != 0 {
289-
files := make([]string, len(manifestFiles))
290+
files := make([]string, 0, len(manifestFiles))
290291

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

298299
if len(dirFiles) != 0 {
299-
files := make([]string, len(dirFiles))
300+
files := make([]string, 0, len(dirFiles))
300301

301302
for file := range dirFiles {
302303
files = append(files, file)

cmd/utils/flags.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ import (
6161
"github.com/ledgerwatch/erigon/p2p/nat"
6262
"github.com/ledgerwatch/erigon/p2p/netutil"
6363
"github.com/ledgerwatch/erigon/params"
64+
borsnaptype "github.com/ledgerwatch/erigon/polygon/bor/snaptype"
6465
"github.com/ledgerwatch/erigon/rpc/rpccfg"
6566
"github.com/ledgerwatch/erigon/turbo/logging"
6667
)
@@ -1024,9 +1025,14 @@ var (
10241025
Usage: "Diagnostics HTTP server listening port",
10251026
Value: 6060,
10261027
}
1028+
DiagSpeedTestFlag = cli.BoolFlag{
1029+
Name: "diagnostics.speedtest",
1030+
Usage: "Enable speed test",
1031+
Value: false,
1032+
}
10271033
)
10281034

1029-
var MetricFlags = []cli.Flag{&MetricsEnabledFlag, &MetricsHTTPFlag, &MetricsPortFlag, &DiagDisabledFlag, &DiagEndpointAddrFlag, &DiagEndpointPortFlag}
1035+
var MetricFlags = []cli.Flag{&MetricsEnabledFlag, &MetricsHTTPFlag, &MetricsPortFlag, &DiagDisabledFlag, &DiagEndpointAddrFlag, &DiagEndpointPortFlag, &DiagSpeedTestFlag}
10301036

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

@@ -1603,6 +1609,7 @@ func setBorConfig(ctx *cli.Context, cfg *ethconfig.Config) {
16031609
cfg.WithoutHeimdall = ctx.Bool(WithoutHeimdallFlag.Name)
16041610
cfg.WithHeimdallMilestones = ctx.Bool(WithHeimdallMilestones.Name)
16051611
cfg.WithHeimdallWaypointRecording = ctx.Bool(WithHeimdallWaypoints.Name)
1612+
borsnaptype.RecordWayPoints(cfg.WithHeimdallWaypointRecording)
16061613
cfg.PolygonSync = ctx.Bool(PolygonSyncFlag.Name)
16071614
}
16081615

core/blockchain.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ func logReceipts(receipts types.Receipts, txns types.Transactions, cc *chain.Con
361361
return
362362
}
363363

364-
marshalled := make([]map[string]interface{}, len(receipts))
364+
marshalled := make([]map[string]interface{}, 0, len(receipts))
365365
for i, receipt := range receipts {
366366
txn := txns[i]
367367
marshalled = append(marshalled, ethutils.MarshalReceipt(receipt, txn, cc, header, txn.Hash(), true))

core/rawdb/accessors_chain.go

Lines changed: 0 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"context"
2222
"encoding/binary"
2323
"encoding/json"
24-
"errors"
2524
"fmt"
2625
"math"
2726
"math/big"
@@ -42,7 +41,6 @@ import (
4241

4342
"github.com/ledgerwatch/erigon/core/types"
4443
"github.com/ledgerwatch/erigon/ethdb/cbor"
45-
"github.com/ledgerwatch/erigon/polygon/heimdall"
4644
"github.com/ledgerwatch/erigon/rlp"
4745
)
4846

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

1099-
// PruneBorBlocks - delete [1, to) old blocks after moving it to snapshots.
1100-
// keeps genesis in db: [1, to)
1101-
// doesn't change sequences of kv.EthTx and kv.NonCanonicalTxs
1102-
// doesn't delete Receipts, Senders, Canonical markers, TotalDifficulty
1103-
func PruneBorBlocks(tx kv.RwTx, blockTo uint64, blocksDeleteLimit int, SpanIdAt func(number uint64) uint64) error {
1104-
c, err := tx.Cursor(kv.BorEventNums)
1105-
if err != nil {
1106-
return err
1107-
}
1108-
defer c.Close()
1109-
var blockNumBytes [8]byte
1110-
binary.BigEndian.PutUint64(blockNumBytes[:], blockTo)
1111-
k, v, err := c.Seek(blockNumBytes[:])
1112-
if err != nil {
1113-
return err
1114-
}
1115-
var eventIdTo uint64 = math.MaxUint64
1116-
if k != nil {
1117-
eventIdTo = binary.BigEndian.Uint64(v)
1118-
}
1119-
c1, err := tx.RwCursor(kv.BorEvents)
1120-
if err != nil {
1121-
return err
1122-
}
1123-
defer c1.Close()
1124-
counter := blocksDeleteLimit
1125-
for k, _, err = c1.First(); err == nil && k != nil && counter > 0; k, _, err = c1.Next() {
1126-
eventId := binary.BigEndian.Uint64(k)
1127-
if eventId >= eventIdTo {
1128-
break
1129-
}
1130-
if err = c1.DeleteCurrent(); err != nil {
1131-
return err
1132-
}
1133-
counter--
1134-
}
1135-
if err != nil {
1136-
return err
1137-
}
1138-
firstSpanToKeep := SpanIdAt(blockTo)
1139-
c2, err := tx.RwCursor(kv.BorSpans)
1140-
if err != nil {
1141-
return err
1142-
}
1143-
defer c2.Close()
1144-
counter = blocksDeleteLimit
1145-
for k, _, err := c2.First(); err == nil && k != nil && counter > 0; k, _, err = c2.Next() {
1146-
spanId := binary.BigEndian.Uint64(k)
1147-
if spanId >= firstSpanToKeep {
1148-
break
1149-
}
1150-
if err = c2.DeleteCurrent(); err != nil {
1151-
return err
1152-
}
1153-
counter--
1154-
}
1155-
1156-
checkpointCursor, err := tx.RwCursor(kv.BorCheckpoints)
1157-
if err != nil {
1158-
return err
1159-
}
1160-
1161-
defer checkpointCursor.Close()
1162-
lastCheckpointToRemove, err := heimdall.CheckpointIdAt(tx, blockTo)
1163-
1164-
if err != nil {
1165-
return err
1166-
}
1167-
1168-
var checkpointIdBytes [8]byte
1169-
binary.BigEndian.PutUint64(checkpointIdBytes[:], uint64(lastCheckpointToRemove))
1170-
for k, _, err := checkpointCursor.Seek(checkpointIdBytes[:]); err == nil && k != nil; k, _, err = checkpointCursor.Prev() {
1171-
if err = checkpointCursor.DeleteCurrent(); err != nil {
1172-
return err
1173-
}
1174-
}
1175-
1176-
milestoneCursor, err := tx.RwCursor(kv.BorMilestones)
1177-
1178-
if err != nil {
1179-
return err
1180-
}
1181-
1182-
defer milestoneCursor.Close()
1183-
1184-
var lastMilestoneToRemove heimdall.MilestoneId
1185-
1186-
for blockCount := 1; err != nil && blockCount < blocksDeleteLimit; blockCount++ {
1187-
lastMilestoneToRemove, err = heimdall.MilestoneIdAt(tx, blockTo-uint64(blockCount))
1188-
1189-
if !errors.Is(err, heimdall.ErrMilestoneNotFound) {
1190-
return err
1191-
} else {
1192-
if blockCount == blocksDeleteLimit-1 {
1193-
return nil
1194-
}
1195-
}
1196-
}
1197-
1198-
var milestoneIdBytes [8]byte
1199-
binary.BigEndian.PutUint64(milestoneIdBytes[:], uint64(lastMilestoneToRemove))
1200-
for k, _, err := milestoneCursor.Seek(milestoneIdBytes[:]); err == nil && k != nil; k, _, err = milestoneCursor.Prev() {
1201-
if err = milestoneCursor.DeleteCurrent(); err != nil {
1202-
return err
1203-
}
1204-
}
1205-
1206-
return nil
1207-
}
1208-
12091097
func TruncateCanonicalChain(ctx context.Context, db kv.RwTx, from uint64) error {
12101098
return db.ForEach(kv.HeaderCanonical, hexutility.EncodeTs(from), func(k, _ []byte) error {
12111099
return db.Delete(kv.HeaderCanonical, k)

0 commit comments

Comments
 (0)