Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(e2e/knuu): use latest release and prepare for node knuu tests #4086

Merged
merged 11 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 8 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
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/celestiaorg/blobstream-contracts/v3 v3.1.0
github.com/celestiaorg/go-square v1.1.1
github.com/celestiaorg/go-square/v2 v2.1.0
github.com/celestiaorg/knuu v0.16.1
github.com/celestiaorg/knuu v0.16.2
github.com/celestiaorg/nmt v0.22.2
github.com/celestiaorg/rsmt2d v0.14.0
github.com/cometbft/cometbft-db v1.0.1
Expand Down Expand Up @@ -227,13 +227,13 @@ require (
go.opentelemetry.io/otel/trace v1.30.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.27.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/crypto v0.29.0 // indirect
golang.org/x/net v0.31.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/term v0.24.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/sync v0.9.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/term v0.26.0 // indirect
golang.org/x/text v0.20.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/api v0.169.0 // indirect
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
Expand Down
32 changes: 16 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ github.com/celestiaorg/go-square v1.1.1 h1:Cy3p8WVspVcyOqHM8BWFuuYPwMitO1pYGe+Im
github.com/celestiaorg/go-square v1.1.1/go.mod h1:1EXMErhDrWJM8B8V9hN7dqJ2kUTClfwdqMOmF9yQUa0=
github.com/celestiaorg/go-square/v2 v2.1.0 h1:ECIvYEeHIWiIJGDCJxQNtzqm5DmnBly7XGhSpLsl+Lw=
github.com/celestiaorg/go-square/v2 v2.1.0/go.mod h1:n3ztrh8CBjWOD6iWYMo3pPOlQIgzLK9yrnqMPcNo6g8=
github.com/celestiaorg/knuu v0.16.1 h1:EOR/c9kvc0jZet/mma2qwAdlvEbl94bW9cC8FItkyBE=
github.com/celestiaorg/knuu v0.16.1/go.mod h1:y20nUmVWVgbzxBKHqmbwp3C0ZJ9J9ovCg1ylHo85hdQ=
github.com/celestiaorg/knuu v0.16.2 h1:OOl2xMf+5ryWtPcSF+M6gmw4YQPEh6lsCA/lTDl8fwI=
github.com/celestiaorg/knuu v0.16.2/go.mod h1:nB7IGCR984YKEDW+j5xHPOidYfbO4DoZI1rDKijvF5E=
github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 h1:CJdIpo8n5MFP2MwK0gSRcOVlDlFdQJO1p+FqdxYzmvc=
github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4/go.mod h1:fzuHnhzj1pUygGz+1ZkB3uQbEUL4htqCGJ4Qs2LwMZA=
github.com/celestiaorg/nmt v0.22.2 h1:JmOMtZL9zWAed1hiwb9DDs+ELcKp/ZQZ3rPverge/V8=
Expand Down Expand Up @@ -1405,8 +1405,8 @@ golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWP
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A=
golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70=
golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Expand Down Expand Up @@ -1514,8 +1514,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo=
golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -1557,8 +1557,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ=
golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -1669,14 +1669,14 @@ golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM=
golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8=
golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU=
golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -1687,8 +1687,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down Expand Up @@ -1761,8 +1761,8 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE=
golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg=
golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o=
golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/benchmark/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type BenchmarkTest struct {

// NewBenchmarkTest wraps around testnet.New to create a new benchmark test.
// It may modify genesis consensus parameters based on manifest.
func NewBenchmarkTest(name string, manifest *Manifest) (*BenchmarkTest, error) {
func NewBenchmarkTest(logger *log.Logger, name string, manifest *Manifest) (*BenchmarkTest, error) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

Expand All @@ -42,8 +42,8 @@ func NewBenchmarkTest(name string, manifest *Manifest) (*BenchmarkTest, error) {

log.Printf("Knuu initialized with scope %s", kn.Scope)

testNet, err := testnet.New(kn, testnet.Options{
Grafana: testnet.GetGrafanaInfoFromEnvVar(),
testNet, err := testnet.New(logger, kn, testnet.Options{
Grafana: testnet.GetGrafanaInfoFromEnvVar(logger),
ChainID: manifest.ChainID,
GenesisModifiers: manifest.GetGenesisModifiers(),
})
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/benchmark/throughput.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func TwoNodeSimple(logger *log.Logger) error {
DisableBBR: true,
}

benchTest, err := NewBenchmarkTest(testName, &manifest)
benchTest, err := NewBenchmarkTest(logger, testName, &manifest)
testnet.NoError("failed to create benchmark test", err)

ctx, cancel := context.WithCancel(context.Background())
Expand All @@ -113,8 +113,8 @@ func TwoNodeSimple(logger *log.Logger) error {
func runBenchmarkTest(logger *log.Logger, testName string, manifest Manifest) error {
logger.Println("Running", testName)
manifest.ChainID = manifest.summary()
log.Println("ChainID: ", manifest.ChainID)
benchTest, err := NewBenchmarkTest(testName, &manifest)
logger.Println("ChainID: ", manifest.ChainID)
benchTest, err := NewBenchmarkTest(logger, testName, &manifest)
testnet.NoError("failed to create benchmark test", err)

ctx, cancel := context.WithCancel(context.Background())
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
if err != nil {
logger.Fatalf("--- ERROR %s: %v", test.Name, err)
}
logger.Printf("--- ✅ PASS: %s \n\n", test.Name)
logger.Println("--- ✅ PASS: %s \n\n", test.Name)

Check failure on line 59 in test/e2e/main.go

View workflow job for this annotation

GitHub Actions / lint / golangci-lint

printf: (*log.Logger).Println call has possible Printf formatting directive %s (govet)

Check failure on line 59 in test/e2e/main.go

View workflow job for this annotation

GitHub Actions / test / test

(*log.Logger).Println call has possible Printf formatting directive %s

Check failure on line 59 in test/e2e/main.go

View workflow job for this annotation

GitHub Actions / test / test-coverage

(*log.Logger).Println call has possible Printf formatting directive %s

Check failure on line 59 in test/e2e/main.go

View workflow job for this annotation

GitHub Actions / test / test-race

(*log.Logger).Println call has possible Printf formatting directive %s

Check failure on line 59 in test/e2e/main.go

View workflow job for this annotation

GitHub Actions / test / test-short

(*log.Logger).Println call has possible Printf formatting directive %s
smuu marked this conversation as resolved.
Show resolved Hide resolved
}

func getTestNames(tests []Test) string {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/major_upgrade_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func MajorUpgradeToV2(logger *log.Logger) error {
logger.Printf("Knuu initialized with scope %s", kn.Scope)

logger.Println("Creating testnet")
testNet, err := testnet.New(kn, testnet.Options{})
testNet, err := testnet.New(logger, kn, testnet.Options{})
testnet.NoError("failed to create testnet", err)

defer testNet.Cleanup(ctx)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/major_upgrade_v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func MajorUpgradeToV3(logger *log.Logger) error {
logger.Printf("Knuu initialized with scope %s", kn.Scope)

logger.Println("Creating testnet")
testNet, err := testnet.New(kn, testnet.Options{})
testNet, err := testnet.New(logger, kn, testnet.Options{})
testnet.NoError("failed to create testnet", err)

defer testNet.Cleanup(ctx)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/minor_version_compatibility.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func MinorVersionCompatibility(logger *log.Logger) error {
kn.HandleStopSignal(ctx)
logger.Printf("Knuu initialized with scope %s", kn.Scope)

testNet, err := testnet.New(kn, testnet.Options{Seed: seed})
testNet, err := testnet.New(logger, kn, testnet.Options{Seed: seed})
testnet.NoError("failed to create testnet", err)

defer testNet.Cleanup(ctx)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func E2ESimple(logger *log.Logger) error {
kn.HandleStopSignal(ctx)
logger.Printf("Knuu initialized with scope %s", kn.Scope)

testNet, err := testnet.New(kn, testnet.Options{})
testNet, err := testnet.New(logger, kn, testnet.Options{})
testnet.NoError("failed to create testnet", err)

defer testNet.Cleanup(ctx)
Expand Down
68 changes: 28 additions & 40 deletions test/e2e/testnet/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ package testnet
import (
"context"
"fmt"
"log"
"os"
"path/filepath"

serverconfig "github.com/cosmos/cosmos-sdk/server/config"
"github.com/rs/zerolog/log"
"github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/p2p"
Expand Down Expand Up @@ -55,13 +55,15 @@ type Node struct {
// FIXME: This does not work currently with the reverse proxy
// grpcProxyHost string
traceProxyHost string

logger *log.Logger
}

// PullRoundStateTraces retrieves the round state traces from a node.
// It will save them to the provided path.
func (n *Node) PullRoundStateTraces(path string) ([]trace.Event[schema.RoundState], error) {
addr := n.AddressTracing()
log.Info().Str("Address", addr).Msg("Pulling round state traces")
n.logger.Println("Pulling round state traces", "address", addr)

err := trace.GetTable(addr, schema.RoundState{}.Table(), path)
if err != nil {
Expand All @@ -74,7 +76,7 @@ func (n *Node) PullRoundStateTraces(path string) ([]trace.Event[schema.RoundStat
// It will save them to the provided path.
func (n *Node) PullBlockSummaryTraces(path string) ([]trace.Event[schema.BlockSummary], error) {
addr := n.AddressTracing()
log.Info().Str("Address", addr).Msg("Pulling block summary traces")
n.logger.Println("Pulling block summary traces", "address", addr)

err := trace.GetTable(addr, schema.BlockSummary{}.Table(), path)
if err != nil {
Expand All @@ -97,6 +99,7 @@ type Resources struct {

func NewNode(
ctx context.Context,
logger *log.Logger,
name string,
version string,
startHeight int64,
Expand Down Expand Up @@ -178,6 +181,7 @@ func NewNode(
NetworkKey: networkKey,
SelfDelegation: selfDelegation,
sidecars: sidecars,
logger: logger,
}, nil
}

Expand All @@ -199,11 +203,13 @@ func (n *Node) Init(ctx context.Context, genesis *types.GenesisDoc, peers []stri
}

// Initialize file directories
rootDir := os.TempDir()
nodeDir := filepath.Join(rootDir, n.Name)
log.Info().Str("name", n.Name).
Str("directory", nodeDir).
Msg("Creating validator's config and data directories")
tmpDir, err := os.MkdirTemp("", "e2e_test_")
if err != nil {
return fmt.Errorf("failed to create temp dir: %w", err)
}
defer os.RemoveAll(tmpDir)
nodeDir := filepath.Join(tmpDir, n.Name)
n.logger.Println("Creating validator's config and data directories", "name", n.Name, "directory", nodeDir)
for _, dir := range []string{
filepath.Join(nodeDir, "config"),
filepath.Join(nodeDir, "data"),
Expand All @@ -214,7 +220,7 @@ func (n *Node) Init(ctx context.Context, genesis *types.GenesisDoc, peers []stri
}

// Create and write the config file
cfg, err := MakeConfig(ctx, n, configOptions...)
cfg, err := MakeConfig(n, peers, configOptions...)
if err != nil {
return fmt.Errorf("making config: %w", err)
}
Expand Down Expand Up @@ -253,12 +259,6 @@ func (n *Node) Init(ctx context.Context, genesis *types.GenesisDoc, peers []stri
pvStatePath := filepath.Join(nodeDir, "data", "priv_validator_state.json")
(privval.NewFilePV(n.SignerKey, pvKeyPath, pvStatePath)).Save()

addrBookFile := filepath.Join(nodeDir, "config", "addrbook.json")
err = WriteAddressBook(peers, addrBookFile)
if err != nil {
return fmt.Errorf("writing address book: %w", err)
}

if err := n.Instance.Build().Commit(ctx); err != nil {
return fmt.Errorf("committing instance: %w", err)
}
Expand All @@ -278,12 +278,9 @@ func (n *Node) Init(ctx context.Context, genesis *types.GenesisDoc, peers []stri
// AddressP2P returns a P2P endpoint address for the node. This is used for
// populating the address book. This will look something like:
// [email protected]:26656
func (n Node) AddressP2P(ctx context.Context, withID bool) string {
ip, err := n.Instance.Network().GetIP(ctx)
if err != nil {
panic(err)
}
addr := fmt.Sprintf("%v:%d", ip, p2pPort)
func (n Node) AddressP2P(withID bool) string {
hostName := n.Instance.Network().HostName()
addr := fmt.Sprintf("%v:%d", hostName, p2pPort)
if withID {
addr = fmt.Sprintf("%x@%v", n.NetworkKey.PubKey().Address().Bytes(), addr)
}
Expand All @@ -304,41 +301,32 @@ func (n Node) AddressRPC() string {
// }

// RemoteAddressGRPC retrieves the gRPC endpoint address of a node within the cluster.
func (n Node) RemoteAddressGRPC(ctx context.Context) (string, error) {
ip, err := n.Instance.Network().GetIP(ctx)
if err != nil {
return "", err
}
return fmt.Sprintf("%s:%d", ip, grpcPort), nil
func (n Node) RemoteAddressGRPC() (string, error) {
hostName := n.Instance.Network().HostName()
return fmt.Sprintf("%s:%d", hostName, grpcPort), nil
}

// RemoteAddressRPC retrieves the RPC endpoint address of a node within the cluster.
func (n Node) RemoteAddressRPC(ctx context.Context) (string, error) {
ip, err := n.Instance.Network().GetIP(ctx)
if err != nil {
return "", err
}
return fmt.Sprintf("%s:%d", ip, rpcPort), nil
func (n Node) RemoteAddressRPC() (string, error) {
hostName := n.Instance.Network().HostName()
return fmt.Sprintf("%s:%d", hostName, rpcPort), nil
}

func (n Node) AddressTracing() string {
return n.traceProxyHost
}

func (n Node) RemoteAddressTracing(ctx context.Context) (string, error) {
ip, err := n.Instance.Network().GetIP(ctx)
if err != nil {
return "", err
}
return fmt.Sprintf("http://%s:26661", ip), nil
func (n Node) RemoteAddressTracing() (string, error) {
hostName := n.Instance.Network().HostName()
return fmt.Sprintf("http://%s:26661", hostName), nil
}

func (n Node) IsValidator() bool {
return n.SelfDelegation != 0
}

func (n Node) Client() (*http.HTTP, error) {
log.Debug().Str("RPC Address", n.AddressRPC()).Msg("Creating HTTP client for node")
n.logger.Println("Creating HTTP client for node", "rpc_address", n.AddressRPC())
return http.New(n.AddressRPC(), "/websocket")
}

Expand Down
6 changes: 2 additions & 4 deletions test/e2e/testnet/setup.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package testnet

import (
"context"
"fmt"
"strings"
"time"
Expand All @@ -13,15 +12,14 @@ import (
"github.com/tendermint/tendermint/p2p/pex"
)

func MakeConfig(ctx context.Context, node *Node, opts ...Option) (*config.Config, error) {
func MakeConfig(node *Node, peers []string, opts ...Option) (*config.Config, error) {
cfg := app.DefaultConsensusConfig()
cfg.TxIndex.Indexer = "kv"
cfg.Consensus.TimeoutPropose = config.DefaultConsensusConfig().TimeoutPropose
cfg.Consensus.TimeoutCommit = config.DefaultConsensusConfig().TimeoutCommit
cfg.Moniker = node.Name
cfg.RPC.ListenAddress = "tcp://0.0.0.0:26657"
cfg.P2P.ExternalAddress = fmt.Sprintf("tcp://%v", node.AddressP2P(ctx, false))
cfg.P2P.PersistentPeers = strings.Join(node.InitialPeers, ",")
cfg.P2P.PersistentPeers = strings.Join(peers, ",")
cfg.Instrumentation.Prometheus = true

for _, opt := range opts {
Expand Down
Loading
Loading