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: backports knuu optimizations from 3493 #3515

Merged
merged 39 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
ecc18ea
adds tracing
staheri14 May 29, 2024
60de468
adds tracing config options
staheri14 May 29, 2024
c973daa
adds blobPerSequence param
staheri14 May 29, 2024
1c53b71
backports all the optimization in knuu
staheri14 May 29, 2024
93d5a4e
adds tracing config fields to the Manifest
staheri14 May 29, 2024
248687e
enables local tracing in E2EThroughput tests
staheri14 May 29, 2024
01b9203
updates config based the choice of local tracing
staheri14 May 29, 2024
92cec9f
refactors the code
staheri14 May 29, 2024
9507488
removes remoteHomeDirectory field and getter
staheri14 May 29, 2024
7b8ad0a
includes missing blobPerSequence
staheri14 May 29, 2024
685ee9d
allows specifying path to save the table when pulling round state table
staheri14 May 29, 2024
43fb5ac
checks if local tracing works
staheri14 May 29, 2024
7d628d5
defines pushing traced data in benchmark tests
staheri14 May 29, 2024
33fa9cd
downloads traces if specified so
staheri14 May 29, 2024
8831859
removes unused comments
staheri14 May 29, 2024
566e283
deletes MakeTracePushConfig as it is not used
staheri14 May 29, 2024
1772eb4
resolves linter issues
staheri14 May 29, 2024
c64c811
Merge branch 'sanaz/add-tracing-configs' into sanaz/backport-optimiza…
staheri14 May 29, 2024
1515dea
updates knuu version to v0.13.3
staheri14 May 29, 2024
2df5bf3
addresses first round of comments
staheri14 May 30, 2024
fb66838
Merge branch 'sanaz/add-tracing-configs' into sanaz/backport-optimiza…
staheri14 May 30, 2024
3b6fbd0
Merge remote-tracking branch 'origin/main' into sanaz/add-tracing-con…
staheri14 Jun 3, 2024
102272e
fixes linter complaint
staheri14 Jun 3, 2024
7185d2d
Merge branch 'sanaz/add-tracing-configs' into sanaz/backport-optimiza…
staheri14 Jun 3, 2024
9f19d68
Merge branch 'main' into sanaz/backport-optimization-knuu
staheri14 Jun 4, 2024
df9107f
removes commented codes
staheri14 Jun 4, 2024
f7a0f81
update go mod
staheri14 Jun 4, 2024
c8fc94d
removes node_helpers
staheri14 Jun 4, 2024
77a5b4f
gofumpt node.go
staheri14 Jun 4, 2024
6f25001
Merge remote-tracking branch 'origin/main' into sanaz/backport-optimi…
staheri14 Jun 18, 2024
bb65e2b
renames GlobalMin to NetworkMin
staheri14 Jun 18, 2024
6aab4b4
fixes another instance
staheri14 Jun 18, 2024
c62383b
Merge branch 'sanaz/replace-GlobalMinGasPrice-w-NetworkMinGasPrice' i…
staheri14 Jun 18, 2024
fee3c03
removes unused functions from test_helpers
staheri14 Jun 18, 2024
8fc2775
deletes parts in the benchmark test that attempts rerunning txsims
staheri14 Jun 18, 2024
102406e
Merge branch 'main' into sanaz/backport-optimization-knuu
staheri14 Jun 18, 2024
ed3c96c
Merge branch 'sanaz/fix-txsim-failure' into sanaz/backport-optimizati…
staheri14 Jun 18, 2024
5d72549
Merge branch 'main' into sanaz/backport-optimization-knuu
evan-forbes Jun 19, 2024
817816c
Merge branch 'main' into sanaz/backport-optimization-knuu
staheri14 Jun 19, 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
25 changes: 21 additions & 4 deletions test/e2e/testnet/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,15 @@ func (n *Node) Init(genesis *types.GenesisDoc, peers []string, configOptions ...
return fmt.Errorf("writing address book: %w", err)
}

if err := n.Instance.AddFolder(nodeDir, remoteRootDir, "10001:10001"); err != nil {
return fmt.Errorf("copying over node %s directory: %w", n.Name, err)
err = n.Instance.Commit()
if err != nil {
return fmt.Errorf("committing instance: %w", err)
}

return n.Instance.Commit()
if err = n.Instance.AddFolder(nodeDir, remoteRootDir, "10001:10001"); err != nil {
return fmt.Errorf("copying over node %s directory: %w", n.Name, err)
}
Comment on lines +229 to +231
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we are supposed to add the folder after committing now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK, yes, it is the case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instances do not differ except for the files we add there.

  • If we add the files before committing, it will build a container for each Instance, which takes very long if we want to start 100 validators
  • If we add the files after committing, knuu can use a cached version of the Instance, which speeds up if you want to start many nodes that use the same base, but different files.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the best way to keep track of important details such as this @smuu? we could add a code comment above, but I imagine this would also be important to know when creating tests for node as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created a tracking issue for this #3601

return nil
}

// AddressP2P returns a P2P endpoint address for the node. This is used for
Expand Down Expand Up @@ -296,10 +300,23 @@ func (n Node) Client() (*http.HTTP, error) {
}

func (n *Node) Start() error {
if err := n.Instance.Start(); err != nil {
if err := n.StartAsync(); err != nil {
return err
}
if err := n.WaitUntilStartedAndForwardPorts(); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no more proxy instead of port forward? or that will come later?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good point. What order should this PR be merged in respect to the proxying ports PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is another PR for that: #3505

Once #3505 is merged, we can modify this one.

return err
}
return nil
}

func (n *Node) StartAsync() error {
if err := n.Instance.StartAsync(); err != nil {
return err
}
return nil
}

func (n *Node) WaitUntilStartedAndForwardPorts() error {
staheri14 marked this conversation as resolved.
Show resolved Hide resolved
if err := n.Instance.WaitInstanceIsRunning(); err != nil {
return err
}
Expand Down
11 changes: 11 additions & 0 deletions test/e2e/testnet/test_helpers.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package testnet

import (
"fmt"
"log"
)

Expand All @@ -9,3 +10,13 @@ func NoError(message string, err error) {
log.Fatalf("%s: %v", message, err)
}
}

type JSONRPCError struct {
Code int
Message string
Data string
}

func (e *JSONRPCError) Error() string {
return fmt.Sprintf("JSONRPC Error - Code: %d, Message: %s, Data: %s", e.Code, e.Message, e.Data)
}
staheri14 marked this conversation as resolved.
Show resolved Hide resolved
93 changes: 40 additions & 53 deletions test/e2e/testnet/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,22 +142,21 @@ func (t *Testnet) CreateTxClient(name,
Msg("error creating txsim")
return err
}

// copy over the keyring directory to the txsim instance
err = txsim.Instance.AddFolder(txsimKeyringDir, txsimRootDir, "10001:10001")
err = txsim.Instance.Commit()
if err != nil {
log.Err(err).
Str("directory", txsimKeyringDir).
Str("name", name).
Msg("error adding keyring dir to txsim")
Msg("error committing txsim")
return err
}

err = txsim.Instance.Commit()
// copy over the keyring directory to the txsim instance
err = txsim.Instance.AddFolder(txsimKeyringDir, txsimRootDir, "10001:10001")
if err != nil {
log.Err(err).
Str("directory", txsimKeyringDir).
Str("name", name).
Msg("error committing txsim")
Msg("error adding keyring dir to txsim")
return err
}

Expand All @@ -167,7 +166,7 @@ func (t *Testnet) CreateTxClient(name,

func (t *Testnet) StartTxClients() error {
for _, txsim := range t.txClients {
err := txsim.Instance.Start()
err := txsim.Instance.StartWithoutWait()
if err != nil {
log.Err(err).
Str("name", txsim.Name).
Expand All @@ -178,6 +177,13 @@ func (t *Testnet) StartTxClients() error {
Str("name", txsim.Name).
Msg("txsim started")
}
// wait for txsims to start
for _, txsim := range t.txClients {
err := txsim.Instance.WaitInstanceIsRunning()
if err != nil {
return fmt.Errorf("txsim %s failed to start: %w", txsim.Name, err)
}
}
return nil
}

Expand Down Expand Up @@ -321,8 +327,9 @@ func (t *Testnet) Start() error {
genesisNodes = append(genesisNodes, node)
}
}
// start genesis nodes asynchronously
for _, node := range genesisNodes {
err := node.Start()
err := node.StartAsync()
if err != nil {
return fmt.Errorf("node %s failed to start: %w", node.Name, err)
}
Expand All @@ -331,6 +338,14 @@ func (t *Testnet) Start() error {
if err != nil {
return err
}
// wait for instances to be running
for _, node := range genesisNodes {
err := node.WaitUntilStartedAndForwardPorts()
if err != nil {
return fmt.Errorf("node %s failed to start: %w", node.Name, err)
}
}
// wait for nodes to sync
for _, node := range genesisNodes {
client, err := node.Client()
if err != nil {
Expand All @@ -351,58 +366,30 @@ func (t *Testnet) Start() error {
if i == 9 {
return fmt.Errorf("failed to start node %s", node.Name)
}
time.Sleep(time.Second)
fmt.Printf("node %s is not synced yet, waiting...\n", node.Name)
time.Sleep(100 * time.Millisecond)
}
}
return nil
}

func (t *Testnet) Cleanup() {
for _, node := range t.nodes {
if node.Instance.IsInState(knuu.Started) {
if err := node.Instance.Stop(); err != nil {
log.Err(err).
Str("name", node.Name).
Msg("node failed to stop")
continue
}
if err := node.Instance.WaitInstanceIsStopped(); err != nil {
log.Err(err).
Str("name", node.Name).
Msg("node failed to stop")
continue
}
}
if node.Instance.IsInState(knuu.Started, knuu.Stopped) {
err := node.Instance.Destroy()
if err != nil {
log.Err(err).
Str("name", node.Name).
Msg("node failed to cleanup")
}
// cleanup txsim
for _, txsim := range t.txClients {
err := txsim.Instance.Destroy()
if err != nil {
log.Err(err).
Str("name", txsim.Name).
Msg("txsim failed to cleanup")
}
}
// stop and cleanup txsim
for _, txsim := range t.txClients {
if txsim.Instance.IsInState(knuu.Started) {
err := txsim.Instance.Stop()
if err != nil {
log.Err(err).
Str("name", txsim.Name).
Msg("txsim failed to stop")
}
err = txsim.Instance.WaitInstanceIsStopped()
if err != nil {
log.Err(err).
Str("name", txsim.Name).
Msg("failed to wait for txsim to stop")
}
err = txsim.Instance.Destroy()
if err != nil {
log.Err(err).
Str("name", txsim.Name).
Msg("txsim failed to cleanup")
}
// cleanup nodes
for _, node := range t.nodes {
err := node.Instance.Destroy()
if err != nil {
log.Err(err).
Str("name", node.Name).
Msg("node failed to cleanup")
}
}
}
Expand Down
Loading