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

test(e2e benchmark): adds network latency #3494

Merged
merged 42 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
35cacc5
defines config options
staheri14 Apr 26, 2024
b1d6861
adds configOpts parameter to the Init func
staheri14 Apr 26, 2024
eb5d379
extends Setup parameter with config options
staheri14 Apr 26, 2024
f4c81f7
passes options through setup method
staheri14 Apr 26, 2024
c4e0b3b
allows passing genesis modifiers and consensus parameters in the test…
staheri14 Apr 26, 2024
ed1fddf
adds manifest struct
staheri14 Apr 26, 2024
cb63664
defines BenchTest
staheri14 Apr 26, 2024
05ecc53
make consensus params effective
staheri14 Apr 26, 2024
80c26e9
fixes getConsensusParams
staheri14 Apr 26, 2024
9af78d7
fixxes set consensus parameters by calling it after tesnet initiation
staheri14 Apr 26, 2024
94f8ef0
makes txsim image creation faster
staheri14 Apr 26, 2024
b4ae352
fixes changes to the order of AddFolder and Commit
staheri14 Apr 26, 2024
bd9fe31
obtains parameters from manifest
staheri14 Apr 26, 2024
8fd5d1f
reads txClient pars from manifest
staheri14 Apr 26, 2024
425b98f
fixes stale comments
staheri14 Apr 26, 2024
dd96cdc
removes private methods
staheri14 Apr 26, 2024
a944670
fixes linter issues
staheri14 Apr 26, 2024
4e26505
gets the remainder of the test parameters from the manifest
staheri14 Apr 26, 2024
25f4026
some reordering and refactoring
staheri14 Apr 26, 2024
2a978b8
Merge remote-tracking branch 'origin/main' into sanaz/manifest-first-…
staheri14 Apr 26, 2024
fe832f3
refactors the code
staheri14 Apr 26, 2024
e1a6e2d
resolves linter issues and returns error from benchTest methods
staheri14 Apr 26, 2024
c1e7d86
removes early return
staheri14 Apr 26, 2024
976ddca
Merge remote-tracking branch 'origin/main' into sanaz/refactor-E2EThr…
staheri14 Apr 29, 2024
4ed25aa
defines a separate go file for the BenchTest type and methods
staheri14 Apr 30, 2024
c2c7dfa
moves manifest to the benchmark package
staheri14 Apr 30, 2024
b2ac5f3
refactors the code to rename bench to benchmark
staheri14 May 17, 2024
193efd9
replaces txsim with txclient
staheri14 May 17, 2024
fac0034
Merge remote-tracking branch 'origin/main' into sanaz/refactor-E2EThr…
staheri14 May 17, 2024
db224b8
removes a redundant word
staheri14 May 17, 2024
e94ae4d
adds godoc for the BenchmarkTest methods
staheri14 May 17, 2024
a45e048
deletes old manifest file under the testnet package
staheri14 May 17, 2024
15b200c
fixes chain ID
staheri14 May 17, 2024
4ddedd0
adds LatencyParams to the manifest
staheri14 May 17, 2024
c8978b9
adds ForwardBitTwisterPort
staheri14 May 17, 2024
2d5855d
moves ForwardBittwisterPort to the node file
staheri14 May 17, 2024
eedc2e8
adds EnableLatency flag to the manifest
staheri14 May 17, 2024
44f7ce8
sets up nodes with latency
staheri14 May 17, 2024
2469df9
adds network latency to the nodes after being started
staheri14 May 17, 2024
049048d
checks the error from enabling bit twister
staheri14 May 17, 2024
cfa4754
Merge remote-tracking branch 'origin/main' into sanaz/add-net-latency
staheri14 May 17, 2024
9e3c437
adds clarifying comments about latency params
staheri14 May 17, 2024
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
22 changes: 21 additions & 1 deletion test/e2e/benchmark/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ func (b *BenchmarkTest) SetupNodes() error {
b.manifest.CelestiaAppVersion, b.manifest.SelfDelegation,
b.manifest.UpgradeHeight, b.manifest.ValidatorResource))

// enable latency if specified in the manifest
if b.manifest.EnableLatency {
for _, node := range b.Nodes() {
if err := node.Instance.EnableBitTwister(); err != nil {
return fmt.Errorf("failed to enable bit twister: %v", err)
}
}
}
// obtain the GRPC endpoints of the validators
gRPCEndpoints, err := b.RemoteGRPCEndpoints()
testnet.NoError("failed to get validators GRPC endpoints", err)
Expand All @@ -49,7 +57,6 @@ func (b *BenchmarkTest) SetupNodes() error {
b.manifest.TxClientsResource, gRPCEndpoints)
testnet.NoError("failed to create tx clients", err)

// set up the testnet
log.Println("Setting up testnet")
testnet.NoError("failed to setup testnet", b.Setup(
testnet.WithPerPeerBandwidth(b.manifest.PerPeerBandwidth),
Expand All @@ -68,6 +75,19 @@ func (b *BenchmarkTest) Run() error {
return fmt.Errorf("failed to start testnet: %v", err)
}

// add latency if specified in the manifest
if b.manifest.EnableLatency {
for _, node := range b.Nodes() {
if err = node.ForwardBitTwisterPort(); err != nil {
return fmt.Errorf("failed to forward bit twister port: %v", err)
}
if err = node.Instance.SetLatencyAndJitter(b.manifest.LatencyParams.
Latency, b.manifest.LatencyParams.Jitter); err != nil {
return fmt.Errorf("failed to set latency and jitter: %v", err)
}
}
}

// once the testnet is up, start tx clients
log.Println("Starting tx clients")
err = b.StartTxClients()
Expand Down
11 changes: 11 additions & 0 deletions test/e2e/benchmark/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ import (
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
)

type LatencyParams struct {
// Latency in milliseconds
Latency int64
// Jitter in milliseconds
Jitter int64
}

// Manifest defines the parameters for a testnet.
type Manifest struct {
ChainID string
Expand All @@ -30,6 +37,10 @@ type Manifest struct {
ValidatorResource testnet.Resources
// Resource requirements for a tx client
TxClientsResource testnet.Resources
// EnableLatency enables network latency for the validators
EnableLatency bool
// LatencyParams defines the network latency parameters
LatencyParams LatencyParams

// tx client settings
// Number of blobs per sequence
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/benchmark/throughput.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ func E2EThroughput() error {
SelfDelegation: 10000000,
CelestiaAppVersion: latestVersion,
TxClientVersion: testnet.TxsimVersion,
EnableLatency: true,
LatencyParams: LatencyParams{100, 10}, // in milliseconds
BlobsPerSeq: 1,
BlobSequences: 1,
BlobSizes: "10000-10000",
Expand Down
11 changes: 11 additions & 0 deletions test/e2e/testnet/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,17 @@ func (n *Node) forwardPorts() error {
return nil
}

func (n *Node) ForwardBitTwisterPort() error {
fwdBtPort, err := n.Instance.PortForwardTCP(n.Instance.BitTwister.Port())
if err != nil {
return err
}
n.Instance.BitTwister.SetPort(fwdBtPort)
n.Instance.BitTwister.SetNewClientByIPAddr("http://localhost")
log.Info().Str("address", fmt.Sprintf("http://localhost:%d", fwdBtPort)).Msg("BitTwister is listening")
return nil
}

func DockerImageName(version string) string {
return fmt.Sprintf("%s:%s", dockerSrcURL, version)
}
Expand Down
Loading