diff --git a/.github/workflows/node_e2e_sysgo_tests.yaml b/.github/workflows/node_e2e_sysgo_tests.yaml index 21210fe793..9b1a9b895a 100644 --- a/.github/workflows/node_e2e_sysgo_tests.yaml +++ b/.github/workflows/node_e2e_sysgo_tests.yaml @@ -42,6 +42,6 @@ jobs: - name: common tests for node with sysgo orchestrator run: just test-e2e-sysgo node/common - - name: sysgo specific tests for node with sysgo orchestrator - run: just test-e2e-sysgo node/sysgo + - name: restart tests for node with sysgo orchestrator + run: just test-e2e-sysgo node/restart diff --git a/tests/go.mod b/tests/go.mod index c962b99515..61a865740e 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -15,7 +15,10 @@ require github.com/libp2p/go-libp2p v0.36.2 require github.com/kurtosis-tech/kurtosis/api/golang v1.8.2-0.20250602144112-2b7d06430e48 -require golang.org/x/sync v0.14.0 +require ( + github.com/docker/docker v27.5.1+incompatible + golang.org/x/sync v0.14.0 +) require ( github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect @@ -47,6 +50,8 @@ require ( github.com/consensys/bavard v0.1.27 // indirect github.com/consensys/gnark-crypto v0.16.0 // indirect github.com/containerd/cgroups v1.1.0 // indirect + github.com/containerd/fifo v1.1.0 // indirect + github.com/containerd/log v0.1.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect github.com/crate-crypto/go-eth-kzg v1.3.0 // indirect @@ -59,8 +64,8 @@ require ( github.com/deepmap/oapi-codegen v1.8.2 // indirect github.com/distribution/reference v0.6.0 // indirect github.com/dlclark/regexp2 v1.7.0 // indirect - github.com/docker/docker v27.5.1+incompatible // indirect github.com/docker/go-connections v0.5.0 // indirect + github.com/docker/go-metrics v0.0.1 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 // indirect github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect @@ -159,6 +164,9 @@ require ( github.com/mitchellh/pointerstructure v1.2.1 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect + github.com/moby/sys/userns v0.1.0 // indirect + github.com/moby/term v0.5.2 // indirect + github.com/morikuni/aec v1.0.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/multiformats/go-base32 v0.1.0 // indirect github.com/multiformats/go-base36 v0.2.0 // indirect @@ -282,4 +290,4 @@ require ( replace github.com/ethereum/go-ethereum => github.com/ethereum-optimism/op-geth v1.101511.1-dev.1.0.20250608235258-6005dd53e1b5 -replace github.com/ethereum-optimism/optimism => github.com/theochap/optimism v0.0.0-20250821094606-dcf1d4ae79e2 +replace github.com/ethereum-optimism/optimism => github.com/theochap/optimism v0.0.0-20250821131302-b9d84951d8a2 diff --git a/tests/go.sum b/tests/go.sum index 3961804734..70c4408d40 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -123,6 +123,8 @@ github.com/consensys/gnark-crypto v0.16.0/go.mod h1:Ke3j06ndtPTVvo++PhGNgvm+lgpL github.com/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= +github.com/containerd/fifo v1.1.0 h1:4I2mbh5stb1u6ycIABlBw9zgtlK8viPI9QkQNRQEEmY= +github.com/containerd/fifo v1.1.0/go.mod h1:bmC4NWMbXlt2EZ0Hc7Fx7QzTFxgPID13eH0Qu+MAb2o= github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= @@ -140,6 +142,8 @@ github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a/go.mod h1:sTwz github.com/crate-crypto/go-kzg-4844 v1.1.0 h1:EN/u9k2TF6OWSHrCCDBBU6GLNMq88OspHHlMnHfoyU4= github.com/crate-crypto/go-kzg-4844 v1.1.0/go.mod h1:JolLjpSff1tCCJKaJx4psrlEdlXuJEC996PL3tTAFks= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= +github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -174,6 +178,8 @@ github.com/docker/docker v27.5.1+incompatible h1:4PYU5dnBYqRQi0294d1FBECqT9ECWeQ github.com/docker/docker v27.5.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= +github.com/docker/go-metrics v0.0.1 h1:AgB/0SvBxihN0X8OR4SjsblXkbMvalQ8cjmtKQ2rQV8= +github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= @@ -415,6 +421,7 @@ github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJS github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -548,6 +555,8 @@ github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqky github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= +github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g= +github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= github.com/moby/term v0.5.2 h1:6qk3FJAFDs6i/q3W/pQ97SX192qKfZgGjCQqfCJkgzQ= github.com/moby/term v0.5.2/go.mod h1:d3djjFCrjnB+fl8NJux+EJzu0msscUP+f8it8hPkFLc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -695,6 +704,7 @@ github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:Om github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= @@ -707,6 +717,7 @@ github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNw github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= @@ -715,6 +726,7 @@ github.com/prometheus/common v0.62.0/go.mod h1:vyBcEuLSvWos9B1+CyL7JZ2up+uFzXhkq github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= @@ -820,8 +832,8 @@ github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45 github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= -github.com/theochap/optimism v0.0.0-20250821094606-dcf1d4ae79e2 h1:jm3hRbJ/gGCacYL3hLXhNeEkcERM/b0PtG8Ln0AibK4= -github.com/theochap/optimism v0.0.0-20250821094606-dcf1d4ae79e2/go.mod h1:e3NFRvdqDjley6QNvYcB9u03VHRfrGbH8q2vD2O784o= +github.com/theochap/optimism v0.0.0-20250821131302-b9d84951d8a2 h1:01cSLnxifF2C4P7T/UdvUoi2sei+7lGZlkXabbiHToI= +github.com/theochap/optimism v0.0.0-20250821131302-b9d84951d8a2/go.mod h1:e3NFRvdqDjley6QNvYcB9u03VHRfrGbH8q2vD2O784o= github.com/tklauser/go-sysconf v0.3.14 h1:g5vzr9iPFFz24v2KZXs/pvpvh8/V9Fw6vQK5ZZb78yU= github.com/tklauser/go-sysconf v0.3.14/go.mod h1:1ym4lWMLUOhuBOPGtRcJm7tEGX4SCYNEEEtghGG/8uY= github.com/tklauser/numcpus v0.8.0 h1:Mx4Wwe/FjZLeQsK/6kt2EOepwwSl7SmJrK5bV/dXYgY= @@ -1012,6 +1024,7 @@ golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190316082340-a2f829d7f35f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/tests/node/common/conductor_test.go b/tests/node/common/conductor_test.go index 1554c9ec64..dbc58d8706 100644 --- a/tests/node/common/conductor_test.go +++ b/tests/node/common/conductor_test.go @@ -13,7 +13,7 @@ import ( "github.com/ethereum-optimism/optimism/op-devstack/stack" "github.com/ethereum-optimism/optimism/op-service/testlog" "github.com/ethereum/go-ethereum/log" - kona_presets "github.com/op-rs/kona/node/presets" + node_utils "github.com/op-rs/kona/node/utils" "github.com/stretchr/testify/require" ) @@ -27,7 +27,7 @@ func TestConductorLeadershipTransfer(gt *testing.T) { t := devtest.SerialT(gt) logger := testlog.Logger(t, log.LevelInfo).With("Test", "TestConductorLeadershipTransfer") - sys := kona_presets.NewMixedOpKonaWithConductors(t) + sys := node_utils.NewMixedOpKonaWithConductors(t) tracer := t.Tracer() ctx := t.Ctx() logger.Info("Started Conductor Leadership Transfer test") diff --git a/tests/node/common/init_test.go b/tests/node/common/init_test.go index 4e7841dff7..a30c74f2f5 100644 --- a/tests/node/common/init_test.go +++ b/tests/node/common/init_test.go @@ -4,10 +4,10 @@ import ( "testing" "github.com/ethereum-optimism/optimism/op-devstack/presets" - kona_presets "github.com/op-rs/kona/node/presets" + node_utils "github.com/op-rs/kona/node/utils" ) // TestMain creates the test-setups against the shared backend func TestMain(m *testing.M) { - presets.DoMain(m, kona_presets.WithMixedOpKona(0, 1, 0, 2)) + presets.DoMain(m, node_utils.WithMixedOpKona(0, 1, 0, 2)) } diff --git a/tests/node/common/p2p_test.go b/tests/node/common/p2p_test.go index 9787bba140..713706ae40 100644 --- a/tests/node/common/p2p_test.go +++ b/tests/node/common/p2p_test.go @@ -9,7 +9,7 @@ import ( "github.com/ethereum-optimism/optimism/op-service/apis" "github.com/ethereum-optimism/optimism/op-supervisor/supervisor/types" "github.com/libp2p/go-libp2p/core/peer" - kona_presets "github.com/op-rs/kona/node/presets" + node_utils "github.com/op-rs/kona/node/utils" "github.com/stretchr/testify/require" ) @@ -58,7 +58,7 @@ func arePeers(t devtest.T, node *dsl.L2CLNode, otherNodeId peer.ID) { func TestP2PMinimal(gt *testing.T) { t := devtest.ParallelT(gt) - out := kona_presets.NewMixedOpKona(t) + out := node_utils.NewMixedOpKona(t) nodes := out.L2CLNodes() firstNode := nodes[0] @@ -83,7 +83,7 @@ func TestP2PMinimal(gt *testing.T) { func TestP2PProtocols(gt *testing.T) { t := devtest.ParallelT(gt) - out := kona_presets.NewMixedOpKona(t) + out := node_utils.NewMixedOpKona(t) nodes := out.L2CLNodes() @@ -97,7 +97,7 @@ func TestP2PProtocols(gt *testing.T) { func TestP2PChainID(gt *testing.T) { t := devtest.ParallelT(gt) - out := kona_presets.NewMixedOpKona(t) + out := node_utils.NewMixedOpKona(t) nodes := out.L2CLKonaNodes() chainID := nodes[0].PeerInfo().ChainID @@ -120,7 +120,7 @@ func TestP2PChainID(gt *testing.T) { func TestNetworkConnectivity(gt *testing.T) { t := devtest.ParallelT(gt) - out := kona_presets.NewMixedOpKona(t) + out := node_utils.NewMixedOpKona(t) nodes := out.L2CLNodes() numNodes := len(nodes) diff --git a/tests/node/common/rpc_test.go b/tests/node/common/rpc_test.go index e95082b247..8f6fe6a375 100644 --- a/tests/node/common/rpc_test.go +++ b/tests/node/common/rpc_test.go @@ -9,7 +9,7 @@ import ( "github.com/ethereum-optimism/optimism/op-node/rollup" "github.com/ethereum-optimism/optimism/op-service/apis" "github.com/ethereum/go-ethereum/common" - kona_presets "github.com/op-rs/kona/node/presets" + node_utils "github.com/op-rs/kona/node/utils" "github.com/stretchr/testify/require" ) @@ -17,7 +17,7 @@ import ( func TestP2PPeers(gt *testing.T) { t := devtest.SerialT(gt) - out := kona_presets.NewMixedOpKona(t) + out := node_utils.NewMixedOpKona(t) p2pPeersAndPeerStats(t, out) @@ -27,19 +27,19 @@ func TestP2PPeers(gt *testing.T) { } // Ensure that the `opp2p_peers` and `opp2p_self` RPC endpoints return the same information. -func p2pSelfAndPeers(t devtest.T, out *kona_presets.MixedOpKonaPreset) { +func p2pSelfAndPeers(t devtest.T, out *node_utils.MixedOpKonaPreset) { nodes := out.L2CLKonaNodes() var wg sync.WaitGroup for _, node := range nodes { wg.Add(1) go func(node *dsl.L2CLNode) { defer wg.Done() - clRPC := GetNodeRPCEndpoint(node) + clRPC := node_utils.GetNodeRPCEndpoint(node) clName := node.Escape().ID().Key() // Gather the peers for the node. peers := &apis.PeerDump{} - require.NoError(t, SendRPCRequest(clRPC, "opp2p_peers", peers, true), "failed to send RPC request to node %s: %s", clName) + require.NoError(t, node_utils.SendRPCRequest(clRPC, "opp2p_peers", peers, true), "failed to send RPC request to node %s: %s", clName) // Check that every peer's info matches the node's info. for _, peer := range peers.Peers { @@ -48,9 +48,9 @@ func p2pSelfAndPeers(t devtest.T, out *kona_presets.MixedOpKonaPreset) { for _, node := range nodes { // We get the peer's info. otherPeerInfo := &apis.PeerInfo{} - otherCLRPC := GetNodeRPCEndpoint(&node) + otherCLRPC := node_utils.GetNodeRPCEndpoint(&node) otherCLName := node.Escape().ID().Key() - require.NoError(t, SendRPCRequest(otherCLRPC, "opp2p_self", otherPeerInfo), "failed to send RPC request to node %s: %s", clName) + require.NoError(t, node_utils.SendRPCRequest(otherCLRPC, "opp2p_self", otherPeerInfo), "failed to send RPC request to node %s: %s", clName) // These checks fail for the op-node. It seems that their p2p handler is flaky and doesn't always return the correct peer info. if otherPeerInfo.PeerID == peer.PeerID { @@ -85,21 +85,21 @@ func p2pSelfAndPeers(t devtest.T, out *kona_presets.MixedOpKonaPreset) { } // Check that the `opp2p_peers` and `opp2p_peerStats` RPC endpoints return coherent information. -func p2pPeersAndPeerStats(t devtest.T, out *kona_presets.MixedOpKonaPreset) { +func p2pPeersAndPeerStats(t devtest.T, out *node_utils.MixedOpKonaPreset) { nodes := out.L2CLNodes() var wg sync.WaitGroup for _, node := range nodes { wg.Add(1) go func(node *dsl.L2CLNode) { defer wg.Done() - clRPC := GetNodeRPCEndpoint(node) + clRPC := node_utils.GetNodeRPCEndpoint(node) clName := node.Escape().ID().Key() peers := &apis.PeerDump{} - require.NoError(t, SendRPCRequest(clRPC, "opp2p_peers", peers, true), "failed to send RPC request to node %s: %s", clName) + require.NoError(t, node_utils.SendRPCRequest(clRPC, "opp2p_peers", peers, true), "failed to send RPC request to node %s: %s", clName) peerStats := &apis.PeerStats{} - require.NoError(t, SendRPCRequest(clRPC, "opp2p_peerStats", peerStats), "failed to send RPC request to node %s: %s", clName) + require.NoError(t, node_utils.SendRPCRequest(clRPC, "opp2p_peerStats", peerStats), "failed to send RPC request to node %s: %s", clName) require.Equal(t, peers.TotalConnected, peerStats.Connected, "totalConnected mismatch node %s", clName) require.Equal(t, len(peers.Peers), int(peers.TotalConnected), "peer count mismatch node %s", clName) @@ -108,14 +108,14 @@ func p2pPeersAndPeerStats(t devtest.T, out *kona_presets.MixedOpKonaPreset) { wg.Wait() } -func p2pBanPeer(t devtest.T, out *kona_presets.MixedOpKonaPreset) { +func p2pBanPeer(t devtest.T, out *node_utils.MixedOpKonaPreset) { nodes := out.L2CLNodes() for _, node := range nodes { - clRPC := GetNodeRPCEndpoint(&node) + clRPC := node_utils.GetNodeRPCEndpoint(&node) clName := node.Escape().ID().Key() peers := &apis.PeerDump{} - require.NoError(t, SendRPCRequest(clRPC, "opp2p_peers", peers, true), "failed to send RPC request to node %s: %s", clName) + require.NoError(t, node_utils.SendRPCRequest(clRPC, "opp2p_peers", peers, true), "failed to send RPC request to node %s: %s", clName) connectedPeers := peers.TotalConnected @@ -129,11 +129,11 @@ func p2pBanPeer(t devtest.T, out *kona_presets.MixedOpKonaPreset) { require.NotEmpty(t, peerToBan, "no connected peer found") - require.NoError(t, SendRPCRequest[any](clRPC, "opp2p_blockPeer", nil, peerToBan), "failed to send RPC request to node %s: %s", clName) + require.NoError(t, node_utils.SendRPCRequest[any](clRPC, "opp2p_blockPeer", nil, peerToBan), "failed to send RPC request to node %s: %s", clName) // Check that the peer is banned. peersAfterBan := &apis.PeerDump{} - require.NoError(t, SendRPCRequest(clRPC, "opp2p_peers", peersAfterBan, true), "failed to send RPC request to node %s: %s", clName) + require.NoError(t, node_utils.SendRPCRequest(clRPC, "opp2p_peers", peersAfterBan, true), "failed to send RPC request to node %s: %s", clName) require.Equal(t, connectedPeers, peersAfterBan.TotalConnected, "totalConnected mismatch node %s", clName) @@ -149,11 +149,11 @@ func p2pBanPeer(t devtest.T, out *kona_presets.MixedOpKonaPreset) { require.True(t, contains, "peer %s not banned", peerToBan) // Try to unban the peer. - require.NoError(t, SendRPCRequest[any](clRPC, "opp2p_unblockPeer", nil, peerToBan), "failed to send RPC request to node %s: %s", clName) + require.NoError(t, node_utils.SendRPCRequest[any](clRPC, "opp2p_unblockPeer", nil, peerToBan), "failed to send RPC request to node %s: %s", clName) // Check that the peer is unbanned. peersAfterUnban := &apis.PeerDump{} - require.NoError(t, SendRPCRequest(clRPC, "opp2p_peers", peersAfterUnban, true), "failed to send RPC request to node %s: %s", clName) + require.NoError(t, node_utils.SendRPCRequest(clRPC, "opp2p_peers", peersAfterUnban, true), "failed to send RPC request to node %s: %s", clName) require.Equal(t, connectedPeers, peersAfterUnban.TotalConnected, "totalConnected mismatch node %s", clName) require.NotContains(t, peersAfterUnban.BannedPeers, peerToBan, "peer %s is banned", peerToBan) @@ -161,11 +161,11 @@ func p2pBanPeer(t devtest.T, out *kona_presets.MixedOpKonaPreset) { } func rollupConfig(t devtest.T, node *dsl.L2CLNode) *rollup.Config { - clRPC := GetNodeRPCEndpoint(node) + clRPC := node_utils.GetNodeRPCEndpoint(node) clName := node.Escape().ID().Key() rollupConfig := &rollup.Config{} - require.NoError(t, SendRPCRequest(clRPC, "optimism_rollupConfig", rollupConfig), "failed to send RPC request to node %s: %s", clName) + require.NoError(t, node_utils.SendRPCRequest(clRPC, "optimism_rollupConfig", rollupConfig), "failed to send RPC request to node %s: %s", clName) return rollupConfig } @@ -181,7 +181,7 @@ func rollupConfigMatches(t devtest.T, configA *rollup.Config, configB *rollup.Co func TestRollupConfig(gt *testing.T) { t := devtest.ParallelT(gt) - out := kona_presets.NewMixedOpKona(t) + out := node_utils.NewMixedOpKona(t) rollupConfigs := make([]*rollup.Config, 0) diff --git a/tests/node/common/sync_test.go b/tests/node/common/sync_test.go index d6acad39ce..074462fb1e 100644 --- a/tests/node/common/sync_test.go +++ b/tests/node/common/sync_test.go @@ -8,14 +8,14 @@ import ( "github.com/ethereum-optimism/optimism/op-devstack/devtest" "github.com/ethereum-optimism/optimism/op-devstack/dsl" "github.com/ethereum-optimism/optimism/op-supervisor/supervisor/types" - kona_presets "github.com/op-rs/kona/node/presets" + node_utils "github.com/op-rs/kona/node/utils" ) // Check that all the nodes in the network are synced to the local safe block and can catch up to the sequencer node. func TestL2SafeSync(gt *testing.T) { t := devtest.ParallelT(gt) - out := kona_presets.NewMixedOpKona(t) + out := node_utils.NewMixedOpKona(t) nodes := out.L2CLNodes() @@ -33,7 +33,7 @@ func TestL2SafeSync(gt *testing.T) { func TestL2UnsafeSync(gt *testing.T) { t := devtest.ParallelT(gt) - out := kona_presets.NewMixedOpKona(t) + out := node_utils.NewMixedOpKona(t) nodes := out.L2CLNodes() @@ -52,7 +52,7 @@ func TestL2FinalizedSync(gt *testing.T) { t := devtest.ParallelT(gt) t.Skip("Skipping finalized sync test") - out := kona_presets.NewMixedOpKona(t) + out := node_utils.NewMixedOpKona(t) nodes := out.L2CLNodes() @@ -66,7 +66,7 @@ func TestL2FinalizedSync(gt *testing.T) { } func isSequencer(node *dsl.L2CLNode) bool { - return strings.Contains(node.Escape().ID().Key(), string(kona_presets.Sequencer)) + return strings.Contains(node.Escape().ID().Key(), string(node_utils.Sequencer)) } func filterSequencer(nodes []dsl.L2CLNode) []dsl.L2CLNode { @@ -82,7 +82,7 @@ func filterSequencer(nodes []dsl.L2CLNode) []dsl.L2CLNode { func TestSyncWithSequencer(gt *testing.T) { t := devtest.ParallelT(gt) - out := kona_presets.NewMixedOpKona(t) + out := node_utils.NewMixedOpKona(t) nodes := out.L2CLValidatorNodes() diff --git a/tests/node/kurtosis/cpu_monitor_test.go b/tests/node/kurtosis/cpu_monitor_test.go index 3281d5410e..fa350ef7dd 100644 --- a/tests/node/kurtosis/cpu_monitor_test.go +++ b/tests/node/kurtosis/cpu_monitor_test.go @@ -12,7 +12,7 @@ import ( "github.com/ethereum-optimism/optimism/op-devstack/dsl" "github.com/ethereum-optimism/optimism/op-supervisor/supervisor/types" "github.com/kurtosis-tech/kurtosis/api/golang/engine/lib/kurtosis_context" - kona_presets "github.com/op-rs/kona/node/presets" + node_utils "github.com/op-rs/kona/node/utils" "github.com/stretchr/testify/require" ) @@ -59,7 +59,7 @@ func GetCPUStats(t devtest.T, ctx context.Context, serviceName string) { // Run this test only in kurtosis. func TestKurtosisCPUMonitor(gt *testing.T) { t := devtest.ParallelT(gt) - out := kona_presets.NewMixedOpKona(t) + out := node_utils.NewMixedOpKona(t) out.T.Gate().Equal(os.Getenv("DEVSTACK_ORCHESTRATOR"), "sysext", "this test is only valid in kurtosis") diff --git a/tests/node/kurtosis/engine_test.go b/tests/node/kurtosis/engine_test.go index fe57590b4f..4e51307092 100644 --- a/tests/node/kurtosis/engine_test.go +++ b/tests/node/kurtosis/engine_test.go @@ -8,14 +8,14 @@ import ( "github.com/ethereum-optimism/optimism/op-devstack/devtest" "github.com/ethereum-optimism/optimism/op-devstack/dsl" "github.com/ethereum-optimism/optimism/op-supervisor/supervisor/types" - kona_presets "github.com/op-rs/kona/node/presets" + node_utils "github.com/op-rs/kona/node/utils" "github.com/stretchr/testify/require" ) func TestEngine(gt *testing.T) { t := devtest.ParallelT(gt) - out := kona_presets.NewMixedOpKona(t) + out := node_utils.NewMixedOpKona(t) out.T.Gate().Equal(os.Getenv("DEVSTACK_ORCHESTRATOR"), "sysext", "this test is only valid in kurtosis") diff --git a/tests/node/kurtosis/init_test.go b/tests/node/kurtosis/init_test.go index f81b5905bd..23096ecd9c 100644 --- a/tests/node/kurtosis/init_test.go +++ b/tests/node/kurtosis/init_test.go @@ -4,10 +4,10 @@ import ( "testing" "github.com/ethereum-optimism/optimism/op-devstack/presets" - kona_presets "github.com/op-rs/kona/node/presets" + node_utils "github.com/op-rs/kona/node/utils" ) // TestMain creates the test-setups against the shared backend func TestMain(m *testing.M) { - presets.DoMain(m, kona_presets.WithMixedOpKona(0, 1, 0, 2)) + presets.DoMain(m, node_utils.WithMixedOpKona(0, 1, 0, 2)) } diff --git a/tests/node/kurtosis/sync_ws_test.go b/tests/node/kurtosis/sync_ws_test.go index 197720ac61..fab2c67ebe 100644 --- a/tests/node/kurtosis/sync_ws_test.go +++ b/tests/node/kurtosis/sync_ws_test.go @@ -10,7 +10,7 @@ import ( "github.com/ethereum-optimism/optimism/op-devstack/dsl" "github.com/ethereum-optimism/optimism/op-service/eth" "github.com/ethereum/go-ethereum/common/hexutil" - kona_presets "github.com/op-rs/kona/node/presets" + node_utils "github.com/op-rs/kona/node/utils" "github.com/stretchr/testify/require" ) @@ -25,7 +25,7 @@ func TestSyncUnsafeBecomesSafe(gt *testing.T) { t := devtest.ParallelT(gt) - out := kona_presets.NewMixedOpKona(t) + out := node_utils.NewMixedOpKona(t) out.T.Gate().Equal(os.Getenv("DEVSTACK_ORCHESTRATOR"), "sysext", "this test is only valid in kurtosis") @@ -78,7 +78,7 @@ func TestSyncUnsafeBecomesSafe(gt *testing.T) { func TestSyncUnsafe(gt *testing.T) { t := devtest.ParallelT(gt) - out := kona_presets.NewMixedOpKona(t) + out := node_utils.NewMixedOpKona(t) out.T.Gate().Equal(os.Getenv("DEVSTACK_ORCHESTRATOR"), "sysext", "this test is only valid in kurtosis") @@ -134,7 +134,7 @@ func TestSyncUnsafe(gt *testing.T) { func TestSyncSafe(gt *testing.T) { t := devtest.ParallelT(gt) - out := kona_presets.NewMixedOpKona(t) + out := node_utils.NewMixedOpKona(t) out.T.Gate().Equal(os.Getenv("DEVSTACK_ORCHESTRATOR"), "sysext", "this test is only valid in kurtosis") @@ -190,7 +190,7 @@ func TestSyncSafe(gt *testing.T) { func TestSyncFinalized(gt *testing.T) { t := devtest.ParallelT(gt) - out := kona_presets.NewMixedOpKona(t) + out := node_utils.NewMixedOpKona(t) out.T.Gate().Equal(os.Getenv("DEVSTACK_ORCHESTRATOR"), "sysext", "this test is only valid in kurtosis") diff --git a/tests/node/restart/conn_drop_test.go b/tests/node/restart/conn_drop_test.go new file mode 100644 index 0000000000..8aabed00cb --- /dev/null +++ b/tests/node/restart/conn_drop_test.go @@ -0,0 +1,99 @@ +package node_restart + +import ( + "fmt" + "testing" + "time" + + "github.com/ethereum-optimism/optimism/op-devstack/devtest" + "github.com/ethereum-optimism/optimism/op-devstack/dsl" + "github.com/ethereum-optimism/optimism/op-service/retry" + "github.com/ethereum-optimism/optimism/op-supervisor/supervisor/types" + node_utils "github.com/op-rs/kona/node/utils" +) + +// Ensure that kona-nodes reconnect to the sequencer and sync properly when the connection is dropped. +func TestConnDropSync(gt *testing.T) { + t := devtest.SerialT(gt) + + out := node_utils.NewMixedOpKona(t) + + nodes := out.L2CLValidatorNodes() + sequencerNodes := out.L2CLSequencerNodes() + t.Gate().Greater(len(nodes), 0, "expected at least one validator node") + t.Gate().Greater(len(sequencerNodes), 0, "expected at least one sequencer node") + + sequencer := sequencerNodes[0] + + var postDisconnectCheckFuns []dsl.CheckFunc + for _, node := range nodes { + clName := node.Escape().ID().Key() + + node.DisconnectPeer(&sequencer) + + // Ensure that the node is no longer connected to the sequencer + seqPeers := sequencer.Peers() + for _, peer := range seqPeers.Peers { + t.Require().NotEqual(peer.PeerID, node.PeerInfo().PeerID, "expected node %s to be disconnected from sequencer %s", clName, sequencer.Escape().ID().Key()) + } + + // Check that... + // - the node's safe head is advancing + // - the node's unsafe head is advancing (through consolidation) + // - the node's safe head's number is catching up with the unsafe head's number + // - the node's unsafe head is strictly lagging behind the sequencer's unsafe head + postDisconnectCheckFuns = append(postDisconnectCheckFuns, node.AdvancedFn(types.LocalSafe, 50, 200), node.AdvancedFn(types.LocalUnsafe, 50, 200), SafeUnsafeMatchedFn(t, node, 50)) + } + + postDisconnectCheckFuns = append(postDisconnectCheckFuns, sequencer.AdvancedFn(types.LocalUnsafe, 50, 200)) + + dsl.CheckAll(t, postDisconnectCheckFuns...) + + var postReconnectCheckFuns []dsl.CheckFunc + for _, node := range nodes { + clName := node.Escape().ID().Key() + + node.ConnectPeer(&sequencer) + + // Check that the node is connected to the reference node + peers := node.Peers() + t.Require().Greater(len(peers.Peers), 0, "expected at least one peer") + + // Check that there is at least a peer with the same ID as the ref node + found := false + for _, peer := range peers.Peers { + if peer.PeerID == sequencer.PeerInfo().PeerID { + t.Logf("node %s is connected to reference node %s", clName, sequencer.Escape().ID().Key()) + found = true + break + } + } + + t.Require().True(found, "expected node %s to be connected to reference node %s", clName, sequencer.Escape().ID().Key()) + + // Check that the node is resyncing with the unsafe head network + postReconnectCheckFuns = append(postReconnectCheckFuns, node.MatchedFn(&sequencer, types.LocalSafe, 50), node.MatchedFn(&sequencer, types.LocalUnsafe, 50)) + } + + dsl.CheckAll(t, postReconnectCheckFuns...) +} + +// MatchedFn returns a lambda that checks the baseNode head with given safety level is matched with the refNode chain sync status provider +// Composable with other lambdas to wait in parallel +func SafeUnsafeMatchedFn(t devtest.T, clNode dsl.L2CLNode, attempts int) dsl.CheckFunc { + logger := t.Logger() + chainID := clNode.ChainID() + return func() error { + return retry.Do0(t.Ctx(), attempts, &retry.FixedStrategy{Dur: 2 * time.Second}, + func() error { + base := clNode.ChainSyncStatus(chainID, types.LocalSafe) + ref := clNode.ChainSyncStatus(chainID, types.LocalUnsafe) + if ref.Hash == base.Hash && ref.Number == base.Number { + logger.Info("Node safe and unsafe heads matched", "ref", ref.Number, "base", base.Number) + return nil + } + logger.Info("Node safe and unsafe heads not matched", "safe", base.Number, "unsafe", ref.Number, "ref", ref.Hash, "base", base.Hash) + return fmt.Errorf("expected safe and unsafe heads to match") + }) + } +} diff --git a/tests/node/restart/init_test.go b/tests/node/restart/init_test.go new file mode 100644 index 0000000000..4a4096cdc3 --- /dev/null +++ b/tests/node/restart/init_test.go @@ -0,0 +1,13 @@ +package node_restart + +import ( + "testing" + + "github.com/ethereum-optimism/optimism/op-devstack/presets" + node_utils "github.com/op-rs/kona/node/utils" +) + +// TestMain creates the test-setups against the shared backend +func TestMain(m *testing.M) { + presets.DoMain(m, node_utils.WithMixedOpKona(0, 1, 0, 2)) +} diff --git a/tests/node/restart/restart_test.go b/tests/node/restart/restart_test.go new file mode 100644 index 0000000000..0ee482102e --- /dev/null +++ b/tests/node/restart/restart_test.go @@ -0,0 +1,84 @@ +package node_restart + +import ( + "context" + "testing" + + "github.com/ethereum-optimism/optimism/op-devstack/devtest" + "github.com/ethereum-optimism/optimism/op-devstack/dsl" + "github.com/ethereum-optimism/optimism/op-service/eth" + "github.com/ethereum-optimism/optimism/op-supervisor/supervisor/types" + node_utils "github.com/op-rs/kona/node/utils" +) + +// Ensure that kona-nodes reconnect to the sequencer and sync properly when the connection is dropped. +func TestRestartSync(gt *testing.T) { + t := devtest.SerialT(gt) + + out := node_utils.NewMixedOpKona(t) + + nodes := out.L2CLKonaValidatorNodes + sequencerNodes := out.L2CLSequencerNodes() + t.Gate().Greater(len(nodes), 0, "expected at least one validator node") + t.Gate().Greater(len(sequencerNodes), 0, "expected at least one sequencer node") + + sequencer := sequencerNodes[0] + + var preStopCheckFuns []dsl.CheckFunc + for _, node := range nodes { + t.Logf("testing restarts for node %s", node.Escape().ID().Key()) + clName := node.Escape().ID().Key() + nodePeerId := node.PeerInfo().PeerID + + t.Logf("stopping node %s", clName) + node.Stop() + + // Ensure that the node is no longer connected to the sequencer + seqPeers := sequencer.Peers() + for _, peer := range seqPeers.Peers { + t.Require().NotEqual(peer.PeerID, nodePeerId, "expected node %s to be disconnected from sequencer %s", clName, sequencer.Escape().ID().Key()) + } + + // Ensure that the node is stopped + // Check that calling any rpc method returns an error + rpc := node_utils.GetNodeRPCEndpoint(&node) + var out *eth.SyncStatus + err := rpc.CallContext(context.Background(), &out, "opp2p_syncStatus") + t.Require().Error(err, "expected node %s to be stopped", clName) + + // Ensure that the sequencer's head is advancing. + preStopCheckFuns = append(preStopCheckFuns, sequencer.AdvancedFn(types.LocalUnsafe, 50, 200)) + } + + dsl.CheckAll(t, preStopCheckFuns...) + + var postStartCheckFuns []dsl.CheckFunc + for _, node := range nodes { + clName := node.Escape().ID().Key() + t.Logf("starting node %s", clName) + node.Start() + + node.ConnectPeer(&sequencer) + + // Check that the node is resyncing with the network + postStartCheckFuns = append(postStartCheckFuns, node.MatchedFn(&sequencer, types.LocalSafe, 50), node.MatchedFn(&sequencer, types.LocalUnsafe, 50)) + + // Check that the node is connected to the reference node + peers := node.Peers() + t.Require().Greater(len(peers.Peers), 0, "expected at least one peer") + + // Check that there is at least a peer with the same ID as the ref node + found := false + for _, peer := range peers.Peers { + if peer.PeerID == sequencer.PeerInfo().PeerID { + t.Logf("node %s is connected to reference node %s", clName, sequencer.Escape().ID().Key()) + found = true + break + } + } + + t.Require().True(found, "expected node %s to be connected to reference node %s", clName, sequencer.Escape().ID().Key()) + } + + dsl.CheckAll(t, postStartCheckFuns...) +} diff --git a/tests/node/sysgo/init_test.go b/tests/node/sysgo/init_test.go index 19711632e3..aa97da2cd6 100644 --- a/tests/node/sysgo/init_test.go +++ b/tests/node/sysgo/init_test.go @@ -4,10 +4,10 @@ import ( "testing" "github.com/ethereum-optimism/optimism/op-devstack/presets" - kona_presets "github.com/op-rs/kona/node/presets" + node_utils "github.com/op-rs/kona/node/utils" ) // TestMain creates the test-setups against the shared backend func TestMain(m *testing.M) { - presets.DoMain(m, kona_presets.WithMixedOpKona(0, 1, 0, 2)) + presets.DoMain(m, node_utils.WithMixedOpKona(0, 1, 0, 2)) } diff --git a/tests/node/presets/mixed_preset.go b/tests/node/utils/mixed_preset.go similarity index 99% rename from tests/node/presets/mixed_preset.go rename to tests/node/utils/mixed_preset.go index 980aa28c6f..8931b68f19 100644 --- a/tests/node/presets/mixed_preset.go +++ b/tests/node/utils/mixed_preset.go @@ -1,4 +1,4 @@ -package kona_presets +package node_utils import ( "fmt" diff --git a/tests/node/presets/mixed_preset_with_conductor.go b/tests/node/utils/mixed_preset_with_conductor.go similarity index 98% rename from tests/node/presets/mixed_preset_with_conductor.go rename to tests/node/utils/mixed_preset_with_conductor.go index 2a493b86b2..e8b11c82de 100644 --- a/tests/node/presets/mixed_preset_with_conductor.go +++ b/tests/node/utils/mixed_preset_with_conductor.go @@ -1,4 +1,4 @@ -package kona_presets +package node_utils import ( "github.com/ethereum-optimism/optimism/op-devstack/devtest" diff --git a/tests/node/common/mod.go b/tests/node/utils/mod.go similarity index 99% rename from tests/node/common/mod.go rename to tests/node/utils/mod.go index 617654dc22..0d86e1d43b 100644 --- a/tests/node/common/mod.go +++ b/tests/node/utils/mod.go @@ -1,4 +1,4 @@ -package node +package node_utils import ( "context"