Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 1 addition & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,5 @@ jobs:
with:
go-version: '1.25'

- name: Install golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: 'v2.8.0'

- run: go tool golangci-lint version
- run: make lint
Empty file added .golangci-lint-version
Empty file.
15 changes: 6 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ ifeq ($(CGO_CXXFLAGS),)
CGO_CXXFLAGS += -g
CGO_CXXFLAGS += -O2
endif
export CGO_CXXFLAGS

BUILD_TAGS =

Expand All @@ -83,9 +84,9 @@ GO_BUILD_ENV = GOARCH=${GOARCH} ${CPU_ARCH} CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLA
GOBUILD = $(GO_BUILD_ENV) $(GO) build $(GO_RELEASE_FLAGS) $(GO_FLAGS) -tags $(BUILD_TAGS)
DLV_GO_FLAGS := -gcflags='all="-N -l" -trimpath=false'
GO_BUILD_DEBUG = $(GO_BUILD_ENV) CGO_CFLAGS="$(CGO_CFLAGS) -DMDBX_DEBUG=1" $(GO) build $(DLV_GO_FLAGS) $(GO_FLAGS) -tags $(BUILD_TAGS),debug
GOTEST = $(GO_BUILD_ENV) CGO_CXXFLAGS="$(CGO_CXXFLAGS)" GODEBUG=cgocheck=0 GOTRACEBACK=1 GOEXPERIMENT=synctest $(GO) test $(GO_FLAGS) ./...
GOTEST = $(GO_BUILD_ENV) GODEBUG=cgocheck=0 GOTRACEBACK=1 GOEXPERIMENT=synctest $(GO) test $(GO_FLAGS) ./...

GOINSTALL = CGO_CXXFLAGS="$(CGO_CXXFLAGS)" go install -trimpath
GOINSTALL = go install -trimpath

OS = $(shell uname -s)
ARCH = $(shell uname -m)
Expand Down Expand Up @@ -335,17 +336,13 @@ kurtosis-cleanup:
@echo "-----------------------------------\n"
kurtosis enclave rm -f makefile-kurtosis-testnet

## lint-deps: install lint dependencies
lint-deps:
@./tools/golangci_lint.sh --install-deps

## lintci: run golangci-lint linters
lintci:
@CGO_CXXFLAGS="$(CGO_CXXFLAGS)" ./tools/golangci_lint.sh
@GOEXPERIMENT=synctest go tool golangci-lint run

## lint: run all linters
lint:
@./tools/golangci_lint.sh
lint:
@GOEXPERIMENT=synctest go tool golangci-lint run
@./tools/mod_tidy_check.sh

## tidy: `go mod tidy`
Expand Down
6 changes: 3 additions & 3 deletions cl/p2p/p2p_localnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ func newLocalNode(
tmpDir string,
logger log.Logger,
) (*enode.LocalNode, error) {
db, err := enode.OpenDB(ctx, "", tmpDir, logger)
db, err := enode.OpenDBEx(ctx, "", tmpDir, logger)
if err != nil {
return nil, fmt.Errorf("could not open node's peer database: %w", err)
}
localNode := enode.NewLocalNode(db, privKey, logger)
localNode := enode.NewLocalNode(db, privKey)

ipEntry := enr.IP(ipAddr)
udpEntry := enr.UDP(udpPort)
Expand Down Expand Up @@ -75,7 +75,7 @@ func NewUDPv5Listener(ctx context.Context, cfg *P2PConfig, discCfg discover.Conf
}

// Start stream handlers
net, err := discover.ListenV5(ctx, "any", conn, localNode, discCfg)
net, err := discover.ListenV5(conn, localNode, discCfg)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions cl/sentinel/handlers/heartbeats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ func newkey() *ecdsa.PrivateKey {
}

func testLocalNode() *enode.LocalNode {
db, err := enode.OpenDB(context.TODO(), "", "", log.Root())
db, err := enode.OpenDBEx(context.TODO(), "", "", log.Root())
if err != nil {
panic(err)
}
ln := enode.NewLocalNode(db, newkey(), log.Root())
ln := enode.NewLocalNode(db, newkey())
ln.Set(enr.WithEntry("attnets", attnetsTestVal))
ln.Set(enr.WithEntry("syncnets", syncnetsTestVal))
return ln
Expand Down
8 changes: 4 additions & 4 deletions cmd/bootnode/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,22 +122,22 @@ func main() {
ctx, cancel := common.RootContext()
defer cancel()

db, err := enode.OpenDB(ctx, "" /* path */, "" /* tmpDir */, logger)
db, err := enode.OpenDBEx(ctx, "" /* path */, "" /* tmpDir */, logger)
if err != nil {
panic(err)
}
ln := enode.NewLocalNode(db, nodeKey, logger)
ln := enode.NewLocalNode(db, nodeKey)
cfg := discover.Config{
PrivateKey: nodeKey,
NetRestrict: restrictList,
}

if *runv5 {
if _, err := discover.ListenV5(ctx, "any", conn, ln, cfg); err != nil {
if _, err := discover.ListenV5(conn, ln, cfg); err != nil {
utils.Fatalf("%v", err)
}
} else {
if _, err := discover.ListenUDP(ctx, "any", conn, ln, cfg); err != nil {
if _, err := discover.ListenUDP(conn, ln, cfg); err != nil {
utils.Fatalf("%v", err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/integration/commands/commitment.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ func benchHistoryLookup(ctx context.Context, logger log.Logger) error {

// benchSnapshotsHistoryLookup benchmarks history lookups across snapshot files
func benchSnapshotsHistoryLookup(ctx context.Context, tx kv.TemporalTx, historyFiles []dbstate.VisibleFile, compactKey []byte, samplePct float64, rng *rand.Rand, logger log.Logger) ([]HistoryBenchStats, error) {
var allFileStats []HistoryBenchStats
allFileStats := make([]HistoryBenchStats, 0, len(historyFiles))

for _, f := range historyFiles {
fpath := f.Fullpath()
Expand Down
2 changes: 1 addition & 1 deletion cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ import (
"github.com/erigontech/erigon/common"
libkzg "github.com/erigontech/erigon/common/crypto/kzg"
"github.com/erigontech/erigon/common/log/v3"
"github.com/erigontech/erigon/common/metrics"
"github.com/erigontech/erigon/db/datadir"
"github.com/erigontech/erigon/db/downloader/downloadercfg"
"github.com/erigontech/erigon/db/snapcfg"
"github.com/erigontech/erigon/db/state/statecfg"
"github.com/erigontech/erigon/db/version"
"github.com/erigontech/erigon/diagnostics/metrics"
"github.com/erigontech/erigon/execution/builder/buildercfg"
"github.com/erigontech/erigon/execution/chain/networkname"
chainspec "github.com/erigontech/erigon/execution/chain/spec"
Expand Down
19 changes: 19 additions & 0 deletions common/crypto/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ var (

var errInvalidPubkey = errors.New("invalid secp256k1 public key")

// EllipticCurve contains curve operations.
type EllipticCurve interface {
elliptic.Curve

// Point marshaling/unmarshaing.
Marshal(x, y *big.Int) []byte
Unmarshal(data []byte) (x, y *big.Int)
}

// KeccakState wraps sha3.state. In addition to the usual hash methods, it also supports
// Read to get a variable amount of data from the hash state. Read is faster than Sum
// because it doesn't copy the internal state, but also modifies the internal state.
Expand Down Expand Up @@ -204,6 +213,16 @@ func MarshalPubkey(pubkey *ecdsa.PublicKey) []byte {
return keyBytes[1:]
}

// FromECDSAPub converts a secp256k1 public key to bytes.
// Note: it does not use the curve from pub, instead it always
// encodes using secp256k1.
func FromECDSAPub(pub *ecdsa.PublicKey) []byte {
if pub == nil || pub.X == nil || pub.Y == nil {
return nil
}
return S256().Marshal(pub.X, pub.Y)
}

// HexToECDSA parses a secp256k1 private key.
func HexToECDSA(hexkey string) (*ecdsa.PrivateKey, error) {
b, err := hex.DecodeString(hexkey)
Expand Down
2 changes: 1 addition & 1 deletion common/crypto/signature_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ func CompressPubkey(pubkey *ecdsa.PublicKey) []byte {
}

// S256 returns an instance of the secp256k1 curve.
func S256() elliptic.Curve {
func S256() EllipticCurve {
return secp256k1.S256()
}
129 changes: 0 additions & 129 deletions common/mclock/mclock.go

This file was deleted.

1 change: 0 additions & 1 deletion common/mclock/mclock.s

This file was deleted.

Loading