Skip to content

Commit

Permalink
ci(geth): bump geth to v1-15-2 (#3084)
Browse files Browse the repository at this point in the history
Bump geth to v1.15.2.

Note that geth config.toml now supports the previously flags-only
`--nat` and `--metrics`:
```
[Node.P2P]
NAT = any|extip:1.2.3.4

[Metrics]
Enabled = true
```

issue: #3024
  • Loading branch information
corverroos authored Feb 17, 2025
1 parent 9cda789 commit 8aa728c
Show file tree
Hide file tree
Showing 22 changed files with 126 additions and 69 deletions.
2 changes: 0 additions & 2 deletions cli/cmd/compose.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ services:
- --verbosity={{.GethVerbosity}} # Log level (1=error,2=warn,3=info,4=debug)
{{ if .GethArchive }}- --gcmode=archive{{ end }}
# Flags not available via config.toml
#- --nat=extip:<my-external-ip> # External IP for P2P via NAT
#- --metrics # Enable prometheus metrics
#- --pprof # Enable prometheus metrics
#- --pprof.addr=0.0.0.0 # Enable prometheus metrics
healthcheck:
Expand Down
10 changes: 8 additions & 2 deletions e2e/app/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package geth
import (
"encoding/hex"
"math/big"
"net"
"os"
"path/filepath"
"time"
Expand All @@ -13,7 +14,8 @@ import (

"github.com/ethereum/go-ethereum/core"
ethcrypto "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth/downloader"
"github.com/ethereum/go-ethereum/eth/ethconfig"
"github.com/ethereum/go-ethereum/p2p/nat"
"github.com/ethereum/go-ethereum/params"
)

Expand Down Expand Up @@ -81,14 +83,15 @@ func WriteConfigTOML(conf Config, path string) error {
// MakeGethConfig returns the full omni geth config for the provided custom config.
func MakeGethConfig(conf Config) FullConfig {
cfg := defaultGethConfig()
cfg.Metrics.Enabled = true
cfg.Eth.GPO.MaxPrice = big.NewInt(params.GWei) // Very low gas tip cap (1gwei), blocks are far from half full.
cfg.Eth.NetworkId = conf.ChainID
cfg.Node.DataDir = "/geth" // Mount inside docker container
cfg.Node.IPCPath = "/geth/geth.ipc"

// Use syncmode=full. Since default "snap" sync has race condition on startup. Where engineAPI newPayload fails
// if snapsync has not completed. Should probably wait for snapsync to complete before starting engineAPI?
cfg.Eth.SyncMode = downloader.FullSync
cfg.Eth.SyncMode = ethconfig.FullSync

// Disable pruning for archive nodes.
// Note that runtime flags are also required for archive nodes, specifically:
Expand All @@ -114,6 +117,9 @@ func MakeGethConfig(conf Config) FullConfig {
cfg.Node.P2P.BootstrapNodesV5 = conf.BootNodes
cfg.Node.P2P.BootstrapNodes = conf.BootNodes
cfg.Node.P2P.TrustedNodes = conf.TrustedNodes
if conf.AdvertisedIP != "" {
cfg.Node.P2P.NAT = nat.ExtIP(net.ParseIP(conf.AdvertisedIP))
}

// Bind listen addresses to all interfaces inside the container.
const allInterfaces = "0.0.0.0"
Expand Down
6 changes: 4 additions & 2 deletions e2e/app/geth/config_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ func TestWriteConfigTOML(t *testing.T) {
name string
isArchive bool
snapShotCacheMB int
advertiseIP string
}{
{"archive", true, 0},
{"full", false, 999},
{"archive", true, 0, ""},
{"full", false, 999, "1.2.3.4"},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
Expand All @@ -67,6 +68,7 @@ func TestWriteConfigTOML(t *testing.T) {
ChainID: 15651,
IsArchive: test.isArchive,
SnapshotCacheMB: test.snapShotCacheMB,
AdvertisedIP: test.advertiseIP,
}

tempFile := filepath.Join(t.TempDir(), test.name+".toml")
Expand Down
2 changes: 2 additions & 0 deletions e2e/app/geth/testdata/TestWriteConfigTOML_archive.golden
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ StaticNodes = []
TrustedNodes = ["enode://3a514176466fa815ed481ffad09110a2d344f6c9b78c1d14afc351c3a51be33d8072e77939dc03ba44790779b7a1025baf3003f6732430e20cd9b76d953391b3@127.0.0.1:1", "enode://3a514176466fa815ed481ffad09110a2d344f6c9b78c1d14afc351c3a51be33d8072e77939dc03ba44790779b7a1025baf3003f6732430e20cd9b76d953391b3@127.0.0.2:2"]
ListenAddr = "0.0.0.0:30303"
DiscAddr = ""
NAT = "any"
EnableMsgEvents = false

[Node.HTTPTimeouts]
Expand All @@ -95,6 +96,7 @@ WriteTimeout = 30000000000
IdleTimeout = 120000000000

[Metrics]
Enabled = true
HTTP = "127.0.0.1"
Port = 6060
InfluxDBEndpoint = "http://localhost:8086"
Expand Down
2 changes: 2 additions & 0 deletions e2e/app/geth/testdata/TestWriteConfigTOML_full.golden
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ StaticNodes = []
TrustedNodes = ["enode://3a514176466fa815ed481ffad09110a2d344f6c9b78c1d14afc351c3a51be33d8072e77939dc03ba44790779b7a1025baf3003f6732430e20cd9b76d953391b3@127.0.0.1:1", "enode://3a514176466fa815ed481ffad09110a2d344f6c9b78c1d14afc351c3a51be33d8072e77939dc03ba44790779b7a1025baf3003f6732430e20cd9b76d953391b3@127.0.0.2:2"]
ListenAddr = "0.0.0.0:30303"
DiscAddr = ""
NAT = "extip:1.2.3.4"
EnableMsgEvents = false

[Node.HTTPTimeouts]
Expand All @@ -95,6 +96,7 @@ WriteTimeout = 30000000000
IdleTimeout = 120000000000

[Metrics]
Enabled = true
HTTP = "127.0.0.1"
Port = 6060
InfluxDBEndpoint = "http://localhost:8086"
Expand Down
2 changes: 2 additions & 0 deletions e2e/app/geth/testdata/default_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ StaticNodes = []
TrustedNodes = []
ListenAddr = "0.0.0.0:30303"
DiscAddr = ""
NAT = "any"
EnableMsgEvents = false

[Node.HTTPTimeouts]
Expand All @@ -93,6 +94,7 @@ WriteTimeout = 30000000000
IdleTimeout = 120000000000

[Metrics]
Enabled = true
HTTP = "127.0.0.1"
Port = 6060
InfluxDBEndpoint = "http://localhost:8086"
Expand Down
6 changes: 4 additions & 2 deletions e2e/app/geth/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import (
)

// Version defines the geth version deployed to all networks.
const Version = "v1.14.13"
const Version = "v1.15.2"

// SupportedVersions are the supported older geth versions.
// These are tested in backwards.toml.
var SupportedVersions = []string{
"v1.14.13",
"v1.14.12",
"v1.14.11",
"v1.14.8",
"v1.14.7",
}

// Config is the configurable options for the standard omni geth config.
Expand All @@ -39,6 +39,8 @@ type Config struct {
TrustedNodes []*enode.Node
// SnapshotCacheMB overrides the default snapshot cache size in MB if not zero.
SnapshotCacheMB int
// AdvertisedIP defines the external NAT advertised IP address.
AdvertisedIP string
}

// defaultGethConfig returns the default geth config.
Expand Down
2 changes: 0 additions & 2 deletions e2e/docker/compose.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,8 @@ services:
command:
- --config=/geth/config.toml
# Flags not available via config.toml
- --nat=extip:{{ .AdvertisedIP }}
- --pprof
- --pprof.addr=0.0.0.0
- --metrics
- --graphql
- --verbosity={{$.GethVerbosity}} # Log level (1=error,2=warn,3=info,4=debug)
{{ if .IsArchive }}- --gcmode=archive{{ end }}
Expand Down
4 changes: 1 addition & 3 deletions e2e/docker/testdata/TestComposeTemplate_commit.golden
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,13 @@ services:
labels:
e2e: true
container_name: omni_evm_0
image: ethereum/client-go:v1.14.13
image: ethereum/client-go:v1.15.2
restart: unless-stopped
command:
- --config=/geth/config.toml
# Flags not available via config.toml
- --nat=extip:10.186.73.0
- --pprof
- --pprof.addr=0.0.0.0
- --metrics
- --graphql
- --verbosity=3 # Log level (1=error,2=warn,3=info,4=debug)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,13 @@ services:
labels:
e2e: true
container_name: omni_evm_0
image: ethereum/client-go:v1.14.12 # Upgrade omni_evm_0:ethereum/client-go:v1.14.13
image: ethereum/client-go:v1.14.13 # Upgrade omni_evm_0:ethereum/client-go:v1.15.2
restart: unless-stopped
command:
- --config=/geth/config.toml
# Flags not available via config.toml
- --nat=extip:10.186.73.0
- --pprof
- --pprof.addr=0.0.0.0
- --metrics
- --graphql
- --verbosity=3 # Log level (1=error,2=warn,3=info,4=debug)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,13 @@ services:
labels:
e2e: true
container_name: omni_evm_0
image: ethereum/client-go:v1.14.13
image: ethereum/client-go:v1.15.2
restart: unless-stopped
command:
- --config=/geth/config.toml
# Flags not available via config.toml
- --nat=extip:10.186.73.0
- --pprof
- --pprof.addr=0.0.0.0
- --metrics
- --graphql
- --verbosity=3 # Log level (1=error,2=warn,3=info,4=debug)

Expand Down
15 changes: 8 additions & 7 deletions e2e/test/geth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"time"

"github.com/omni-network/omni/e2e/app/geth"
"github.com/omni-network/omni/halo/genutil/evm"
"github.com/omni-network/omni/lib/anvil"
"github.com/omni-network/omni/lib/errors"
"github.com/omni-network/omni/lib/ethclient"
Expand Down Expand Up @@ -50,17 +51,17 @@ func TestBlobTx(t *testing.T) {
t.Parallel()
testOmniEVM(t, func(t *testing.T, client ethclient.Client) {
t.Helper()
err := sendBlobTx(context.Background(), client)
err := sendBlobTx(context.Background(), client, evm.DefaultChainConfig(netconf.Devnet))
require.NoError(t, err)
})
}

func sendBlobTx(ctx context.Context, client ethclient.Client) error {
func sendBlobTx(ctx context.Context, client ethclient.Client, config *params.ChainConfig) error {
privKey := anvil.DevPrivateKey1()
addr := crypto.PubkeyToAddress(privKey.PublicKey)

// Create a blob tx
blobTx, err := makeUnsignedBlobTx(ctx, client, addr)
blobTx, err := makeUnsignedBlobTx(ctx, client, config, addr)
if err != nil {
return err
}
Expand Down Expand Up @@ -92,13 +93,13 @@ func sendBlobTx(ctx context.Context, client ethclient.Client) error {
// makeUnsignedBlobTx is a utility method to construct a random blob transaction
// without signing it.
// Reference: github.com/ethereum/go-ethereum@v1.14.11/core/txpool/blobpool/blobpool_test.go:184.
func makeUnsignedBlobTx(ctx context.Context, client ethclient.Client, from common.Address) (*ethtypes.BlobTx, error) {
func makeUnsignedBlobTx(ctx context.Context, client ethclient.Client, config *params.ChainConfig, from common.Address) (*ethtypes.BlobTx, error) {
nonce, err := client.NonceAt(ctx, from, nil)
if err != nil {
return nil, errors.Wrap(err, "nonce")
}

tipCap, baseFee, blobFee, err := estimateGasPrice(ctx, client)
tipCap, baseFee, blobFee, err := estimateGasPrice(ctx, client, config)
if err != nil {
return nil, errors.Wrap(err, "estimate gas price")
}
Expand Down Expand Up @@ -130,7 +131,7 @@ func makeUnsignedBlobTx(ctx context.Context, client ethclient.Client, from commo
}, nil
}

func estimateGasPrice(ctx context.Context, backend ethclient.Client) (*big.Int, *big.Int, *big.Int, error) {
func estimateGasPrice(ctx context.Context, backend ethclient.Client, config *params.ChainConfig) (*big.Int, *big.Int, *big.Int, error) {
tip, err := backend.SuggestGasTipCap(ctx)
if err != nil {
return nil, nil, nil, err
Expand All @@ -152,7 +153,7 @@ func estimateGasPrice(ctx context.Context, backend ethclient.Client) (*big.Int,

var blobFee *big.Int
if head.ExcessBlobGas != nil {
blobFee = eip4844.CalcBlobFee(*head.ExcessBlobGas)
blobFee = eip4844.CalcBlobFee(config, head)
}

// The tip must be at most the base fee.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@ services:
labels:
e2e: true
container_name: validator01_evm
image: ethereum/client-go:v1.14.13
image: ethereum/client-go:v1.15.2
restart: unless-stopped
command:
- --config=/geth/config.toml
# Flags not available via config.toml
- --nat=extip:127.0.0.1
- --pprof
- --pprof.addr=0.0.0.0
- --metrics
- --graphql
- --verbosity=3 # Log level (1=error,2=warn,3=info,4=debug)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@ services:
labels:
e2e: true
container_name: validator02_evm
image: ethereum/client-go:v1.14.13
image: ethereum/client-go:v1.15.2
restart: unless-stopped
command:
- --config=/geth/config.toml
# Flags not available via config.toml
- --nat=extip:127.0.0.2
- --pprof
- --pprof.addr=0.0.0.0
- --metrics
- --graphql
- --verbosity=3 # Log level (1=error,2=warn,3=info,4=debug)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@ services:
labels:
e2e: true
container_name: seed01_evm
image: ethereum/client-go:v1.14.13
image: ethereum/client-go:v1.15.2
restart: unless-stopped
command:
- --config=/geth/config.toml
# Flags not available via config.toml
- --nat=extip:127.0.0.4
- --pprof
- --pprof.addr=0.0.0.0
- --metrics
- --graphql
- --verbosity=3 # Log level (1=error,2=warn,3=info,4=debug)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@ services:
labels:
e2e: true
container_name: fullnode01_evm
image: ethereum/client-go:v1.14.13
image: ethereum/client-go:v1.15.2
restart: unless-stopped
command:
- --config=/geth/config.toml
# Flags not available via config.toml
- --nat=extip:127.0.0.5
- --pprof
- --pprof.addr=0.0.0.0
- --metrics
- --graphql
- --verbosity=3 # Log level (1=error,2=warn,3=info,4=debug)

Expand Down
Loading

0 comments on commit 8aa728c

Please sign in to comment.