Skip to content

Commit 239eba9

Browse files
authored
[TT-1800] Fix Reth v1.0.0, bump default eth2 images to latest (#1252)
1 parent 7b9021b commit 239eba9

File tree

7 files changed

+162
-28
lines changed

7 files changed

+162
-28
lines changed

lib/docker/ethereum/images.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@ package ethereum
22

33
const (
44
DefaultBesuEth1Image = "hyperledger/besu:22.1.0"
5-
DefaultBesuEth2Image = "hyperledger/besu:24.5.1"
5+
DefaultBesuEth2Image = "hyperledger/besu:24.10.0"
66
BesuBaseImageName = "hyperledger/besu"
77
besuGitRepo = "hyperledger/besu"
88

99
DefaultErigonEth1Image = "thorax/erigon:v2.40.0"
10-
DefaultErigonEth2Image = "thorax/erigon:v2.59.3" // v.2.60.0 is the latest, but gas estimations using zero address are broken
10+
DefaultErigonEth2Image = "thorax/erigon:2.60.8"
1111
ErigonBaseImageName = "thorax/erigon"
1212
erigonGitRepo = "ledgerwatch/erigon"
1313

1414
DefaultGethEth1Image = "ethereum/client-go:v1.13.8"
15-
DefaultGethEth2Image = "ethereum/client-go:v1.14.3"
15+
DefaultGethEth2Image = "ethereum/client-go:v1.14.11"
1616
GethBaseImageName = "ethereum/client-go"
1717
gethGitRepo = "ethereum/go-ethereum"
1818

1919
DefaultNethermindEth1Image = "nethermind/nethermind:1.16.0"
20-
DefaultNethermindEth2Image = "nethermind/nethermind:1.26.0"
20+
DefaultNethermindEth2Image = "nethermind/nethermind:1.29.1"
2121
NethermindBaseImageName = "nethermind/nethermind"
2222
nethermindGitRepo = "NethermindEth/nethermind"
2323

24-
DefaultRethEth2Image = "ghcr.io/paradigmxyz/reth:v1.0.0"
24+
DefaultRethEth2Image = "ghcr.io/paradigmxyz/reth:v1.1.0"
2525
RethBaseImageName = "ghcr.io/paradigmxyz/reth"
2626
rethGitRepo = "paradigmxyz/reth"
2727
)

lib/docker/test_env/besu_eth2.go

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package test_env
22

33
import (
4+
"bytes"
45
"fmt"
6+
"os"
57
"strings"
8+
"text/template"
69
"time"
710

811
config_types "github.com/smartcontractkit/chainlink-testing-framework/lib/config/types"
@@ -56,7 +59,7 @@ func NewBesuEth2(networks []string, chainConfig *config.EthereumChainConfig, gen
5659
func (g *Besu) getEth2ContainerRequest() (*tc.ContainerRequest, error) {
5760
cmd := []string{
5861
"--data-path=/opt/besu/execution-data",
59-
fmt.Sprintf("--genesis-file=%s/besu.json", g.generatedDataContainerDir),
62+
fmt.Sprintf("--genesis-file=%s/besu.json", "/opt/besu/execution-data"),
6063
fmt.Sprintf("--network-id=%d", g.chainConfig.ChainID),
6164
"--host-allowlist=*",
6265
"--rpc-http-enabled=true",
@@ -102,6 +105,21 @@ func (g *Besu) getEth2ContainerRequest() (*tc.ContainerRequest, error) {
102105
cmd = append(cmd, "--bonsai-limit-trie-logs-enabled=false")
103106
}
104107

108+
initFile, err := os.CreateTemp("", "init.sh")
109+
if err != nil {
110+
return nil, err
111+
}
112+
113+
initScriptContent, err := g.buildPosInitScript(strings.Join(cmd, " "))
114+
if err != nil {
115+
return nil, err
116+
}
117+
118+
_, err = initFile.WriteString(initScriptContent)
119+
if err != nil {
120+
return nil, err
121+
}
122+
105123
return &tc.ContainerRequest{
106124
Name: g.ContainerName,
107125
Image: g.GetImageWithVersion(),
@@ -113,10 +131,20 @@ func (g *Besu) getEth2ContainerRequest() (*tc.ContainerRequest, error) {
113131
WithPollInterval(1 * time.Second)).
114132
WithStartupTimeoutDefault(g.StartupTimeout),
115133
User: "0:0", //otherwise in CI we get "permission denied" error, when trying to access data from mounted volume
116-
Cmd: cmd,
134+
Entrypoint: []string{
135+
"sh",
136+
"/init.sh",
137+
},
117138
Env: map[string]string{
118139
"JAVA_OPTS": "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n",
119140
},
141+
Files: []tc.ContainerFile{
142+
{
143+
HostFilePath: initFile.Name(),
144+
ContainerFilePath: "/init.sh",
145+
FileMode: 0744,
146+
},
147+
},
120148
HostConfigModifier: func(hostConfig *container.HostConfig) {
121149
hostConfig.Mounts = append(hostConfig.Mounts, mount.Mount{
122150
Type: mount.TypeBind,
@@ -133,3 +161,37 @@ func (g *Besu) getEth2ContainerRequest() (*tc.ContainerRequest, error) {
133161
},
134162
}, nil
135163
}
164+
165+
func (g *Besu) buildPosInitScript(params string) (string, error) {
166+
initTemplate := `#!/bin/bash
167+
echo "Copied genesis file to {{.ExecutionDir}}"
168+
mkdir -p {{.ExecutionDir}}
169+
cp {{.GeneratedDataDir}}/besu.json {{.ExecutionDir}}/besu.json
170+
# to avoid permission issues without diving into the details
171+
chmod 777 {{.GeneratedDataDir}}/genesis.json
172+
173+
echo "Starting Besu..."
174+
echo "Running command: {{.Command}}"
175+
{{.Command}}`
176+
177+
data := struct {
178+
GeneratedDataDir string
179+
ExecutionDir string
180+
Command string
181+
}{
182+
GeneratedDataDir: g.generatedDataContainerDir,
183+
ExecutionDir: "/opt/besu/execution-data",
184+
Command: fmt.Sprintf("/opt/besu/bin/besu %s", params),
185+
}
186+
187+
t, err := template.New("init").Parse(initTemplate)
188+
if err != nil {
189+
fmt.Println("Error parsing template:", err)
190+
os.Exit(1)
191+
}
192+
193+
var buf bytes.Buffer
194+
err = t.Execute(&buf, data)
195+
196+
return buf.String(), err
197+
}

lib/docker/test_env/besu_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,30 @@ func TestBesuEth1(t *testing.T) {
4040
require.NoError(t, err, "Couldn't close the client")
4141
}
4242

43+
func TestBesuEth2(t *testing.T) {
44+
l := logging.GetTestLogger(t)
45+
46+
builder := NewEthereumNetworkBuilder()
47+
cfg, err := builder.
48+
WithEthereumVersion(config_types.EthereumVersion_Eth2).
49+
WithExecutionLayer(config_types.ExecutionLayer_Besu).
50+
Build()
51+
require.NoError(t, err, "Builder validation failed")
52+
53+
net, _, err := cfg.Start()
54+
require.NoError(t, err, "Couldn't start PoS network")
55+
56+
c, err := blockchain.ConnectEVMClient(net, l)
57+
require.NoError(t, err, "Couldn't connect to the evm client")
58+
59+
address := common.HexToAddress("0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1")
60+
err = sendAndCompareBalances(testcontext.Get(t), c, address)
61+
require.NoError(t, err, fmt.Sprintf("balance wasn't correctly updated for %s network", net.Name))
62+
63+
err = c.Close()
64+
require.NoError(t, err, "Couldn't close the client")
65+
}
66+
4367
func TestBesuEth2_Deneb(t *testing.T) {
4468
l := logging.GetTestLogger(t)
4569

lib/docker/test_env/erigon_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,30 @@ func TestErigonEth1(t *testing.T) {
4040
require.NoError(t, err, "Couldn't close the client")
4141
}
4242

43+
func TestErigonEth2(t *testing.T) {
44+
l := logging.GetTestLogger(t)
45+
46+
builder := NewEthereumNetworkBuilder()
47+
cfg, err := builder.
48+
WithEthereumVersion(config_types.EthereumVersion_Eth2).
49+
WithExecutionLayer(config_types.ExecutionLayer_Erigon).
50+
Build()
51+
require.NoError(t, err, "Builder validation failed")
52+
53+
net, _, err := cfg.Start()
54+
require.NoError(t, err, "Couldn't start PoS network")
55+
56+
c, err := blockchain.ConnectEVMClient(net, l)
57+
require.NoError(t, err, "Couldn't connect to the evm client")
58+
59+
address := common.HexToAddress("0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1")
60+
err = sendAndCompareBalances(testcontext.Get(t), c, address)
61+
require.NoError(t, err, fmt.Sprintf("balance wasn't correctly updated for %s network", net.Name))
62+
63+
err = c.Close()
64+
require.NoError(t, err, "Couldn't close the client")
65+
}
66+
4367
func TestErigonEth2_Deneb(t *testing.T) {
4468
l := logging.GetTestLogger(t)
4569

lib/docker/test_env/geth_test.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,12 @@ func TestGethEth1(t *testing.T) {
5656
require.NoError(t, err, "Couldn't close the client")
5757
}
5858

59-
func TestGethEth2_Deneb(t *testing.T) {
59+
func TestGethEth2(t *testing.T) {
6060
l := logging.GetTestLogger(t)
6161

6262
builder := NewEthereumNetworkBuilder()
6363
cfg, err := builder.
64-
WithCustomDockerImages(map[config.ContainerType]string{config.ContainerType_ExecutionLayer: "ethereum/client-go:v1.13.12"}).
65-
WithConsensusLayer(config.ConsensusLayer_Prysm).
64+
WithEthereumVersion(config_types.EthereumVersion_Eth2).
6665
WithExecutionLayer(config_types.ExecutionLayer_Geth).
6766
Build()
6867
require.NoError(t, err, "Builder validation failed")
@@ -85,29 +84,15 @@ func TestGethEth2_Deneb(t *testing.T) {
8584
address := common.HexToAddress("0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1")
8685
err = sendAndCompareBalances(ctx, clientOne, address)
8786
require.NoError(t, err, fmt.Sprintf("balance wasn't correctly updated for %s network", nonEip1559Network.Name))
88-
89-
eip1559Network := blockchain.SimulatedEVMNetwork
90-
eip1559Network.Name = "Simulated Geth + Prysm (EIP 1559)"
91-
eip1559Network.SupportsEIP1559 = true
92-
eip1559Network.URLs = eth2.PublicWsUrls()
93-
clientTwo, err := blockchain.ConnectEVMClient(eip1559Network, l)
94-
require.NoError(t, err, "Couldn't connect to the evm client")
95-
96-
t.Cleanup(func() {
97-
err = clientTwo.Close()
98-
require.NoError(t, err, "Couldn't close the client")
99-
})
100-
101-
err = sendAndCompareBalances(ctx, clientTwo, address)
102-
require.NoError(t, err, fmt.Sprintf("balance wasn't correctly updated for %s network", eip1559Network.Name))
10387
}
10488

105-
func TestGethEth2_Shanghai_No_Fork_Setup(t *testing.T) {
89+
func TestGethEth2_Deneb(t *testing.T) {
10690
l := logging.GetTestLogger(t)
10791

10892
builder := NewEthereumNetworkBuilder()
10993
cfg, err := builder.
110-
WithCustomDockerImages(map[config.ContainerType]string{config.ContainerType_ExecutionLayer: "ethereum/client-go:v1.13.11"}).
94+
WithCustomDockerImages(map[config.ContainerType]string{config.ContainerType_ExecutionLayer: "ethereum/client-go:v1.13.12"}).
95+
WithConsensusLayer(config.ConsensusLayer_Prysm).
11196
WithExecutionLayer(config_types.ExecutionLayer_Geth).
11297
Build()
11398
require.NoError(t, err, "Builder validation failed")
@@ -130,6 +115,21 @@ func TestGethEth2_Shanghai_No_Fork_Setup(t *testing.T) {
130115
address := common.HexToAddress("0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1")
131116
err = sendAndCompareBalances(ctx, clientOne, address)
132117
require.NoError(t, err, fmt.Sprintf("balance wasn't correctly updated for %s network", nonEip1559Network.Name))
118+
119+
eip1559Network := blockchain.SimulatedEVMNetwork
120+
eip1559Network.Name = "Simulated Geth + Prysm (EIP 1559)"
121+
eip1559Network.SupportsEIP1559 = true
122+
eip1559Network.URLs = eth2.PublicWsUrls()
123+
clientTwo, err := blockchain.ConnectEVMClient(eip1559Network, l)
124+
require.NoError(t, err, "Couldn't connect to the evm client")
125+
126+
t.Cleanup(func() {
127+
err = clientTwo.Close()
128+
require.NoError(t, err, "Couldn't close the client")
129+
})
130+
131+
err = sendAndCompareBalances(ctx, clientTwo, address)
132+
require.NoError(t, err, fmt.Sprintf("balance wasn't correctly updated for %s network", eip1559Network.Name))
133133
}
134134

135135
func TestGethEth2_Shanghai(t *testing.T) {

lib/docker/test_env/nethermind_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,30 @@ func TestNethermindEth1(t *testing.T) {
4040
require.NoError(t, err, "Couldn't close the client")
4141
}
4242

43+
func TestNethermindEth2(t *testing.T) {
44+
l := logging.GetTestLogger(t)
45+
46+
builder := NewEthereumNetworkBuilder()
47+
cfg, err := builder.
48+
WithEthereumVersion(config_types.EthereumVersion_Eth2).
49+
WithExecutionLayer(config_types.ExecutionLayer_Nethermind).
50+
Build()
51+
require.NoError(t, err, "Builder validation failed")
52+
53+
net, _, err := cfg.Start()
54+
require.NoError(t, err, "Couldn't start PoS network")
55+
56+
c, err := blockchain.ConnectEVMClient(net, l)
57+
require.NoError(t, err, "Couldn't connect to the evm client")
58+
59+
address := common.HexToAddress("0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1")
60+
err = sendAndCompareBalances(testcontext.Get(t), c, address)
61+
require.NoError(t, err, fmt.Sprintf("balance wasn't correctly updated for %s network", net.Name))
62+
63+
err = c.Close()
64+
require.NoError(t, err, "Couldn't close the client")
65+
}
66+
4367
func TestNethermindEth2_Dencun(t *testing.T) {
4468
l := logging.GetTestLogger(t)
4569

lib/docker/test_env/reth_base.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func (g *Reth) WaitUntilChainIsReady(ctx context.Context, waitTime time.Duration
156156
if g.GetEthereumVersion() == config_types.EthereumVersion_Eth1 {
157157
return nil
158158
}
159-
waitForFirstBlock := tcwait.NewLogStrategy("Block added to canonical chain").WithPollInterval(1 * time.Second).WithStartupTimeout(waitTime)
159+
waitForFirstBlock := tcwait.NewLogStrategy("Canonical chain committed").WithPollInterval(1 * time.Second).WithStartupTimeout(waitTime)
160160
return waitForFirstBlock.WaitUntilReady(ctx, *g.GetContainer())
161161
}
162162

0 commit comments

Comments
 (0)