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

[LoadTest] Revamp load test suite #1002

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

[LoadTest] Revamp load test suite #1002

wants to merge 11 commits into from

Conversation

red-0ne
Copy link
Contributor

@red-0ne red-0ne commented Dec 11, 2024

Summary

This pull request includes several updates to the load-testing configuration and test files, as well as improvements to the relay stress test suite. The most important changes include updating funding account addresses, modifying gateway configurations, and refactoring various test functions for better accuracy.

Type of change

Select one or more from the following:

Testing

  • Unit Tests: make go_develop_and_test
  • LocalNet E2E Tests: make test_e2e
  • DevNet E2E Tests: Add the devnet-test-e2e label to the PR.

Sanity Checklist

  • I have tested my changes using the available tooling
  • I have commented my code
  • I have performed a self-review of my own code; both comments & source code
  • I create and reference any new tickets, if applicable
  • I have left TODOs throughout the codebase, if applicable

@red-0ne red-0ne added the loadtest Work related to load testing label Dec 11, 2024
@red-0ne red-0ne added this to the Shannon Beta TestNet Support milestone Dec 11, 2024
@red-0ne red-0ne requested a review from okdas December 11, 2024 16:59
@red-0ne red-0ne self-assigned this Dec 11, 2024
@Olshansk
Copy link
Member

@red-0ne Lmk if you need me to take a look at this as well.

@red-0ne red-0ne marked this pull request as ready for review December 17, 2024 12:47
Copy link
Member

@Olshansk Olshansk left a comment

Choose a reason for hiding this comment

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

@red-0ne Partial review.

This is great work but load-testing/tests/relays_stress_helpers_test.go is really hard to review right now with lots of big inline functions.

Do you mind doing a self passthrough and finding ways to make it a bit more readable & maintainable for others?

@@ -2,16 +2,16 @@
# It is intended to target a remote environment, such as a devnet or testnet.
is_ephemeral_chain: false

# testnet_node is the URL of the node that the load test will use to query the
# pocket_node is the URL of the node that the load test will use to query the
Copy link
Member

Choose a reason for hiding this comment

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

Can we rename this to full_node or rpc_node?


# The service ID to request relays from.
service_id: "anvil"

# The address of the account that will be used to fund the application accounts
# so that they can stake on the network.
funding_account_address: pokt1awtlw5sjmw2f5lgj8ekdkaqezphgz88rdk93sk # address for faucet account
funding_account_address: pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw # address for faucet account
Copy link
Member

Choose a reason for hiding this comment

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

#PUC which network this is the faucet on. Alpha? Beta? Local?

@@ -3,12 +3,16 @@

is_ephemeral_chain: true # This should be `true` for LocalNet as it is an ephemeral network

# pocket_node is the URL of the node that the load test will use to query the
# chain and submit transactions.
pocket_node: http://localhost:26657
Copy link
Member

Choose a reason for hiding this comment

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

ditto

# The service ID to use for the load test.
service_id: anvil

# The address of the account that will be used to fund the application,
# gateway and supplier accounts so that they can stake on the network.
funding_account_address: pokt1awtlw5sjmw2f5lgj8ekdkaqezphgz88rdk93sk # address for faucet account
funding_account_address: pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw # address for faucet account
Copy link
Member

Choose a reason for hiding this comment

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

ditto

# TODO_FOLLOWUP(@red-0ne): Implement the following steps
# Then "0" over servicing events are observed
# And "0" slashing events are observed
Copy link
Member

Choose a reason for hiding this comment

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

Can you describe (for future implementation potential by an AI agent):

  • A test w/ over servicing?
  • A test w/ slashing?

@@ -631,7 +651,8 @@ func (s *relaysSuite) getAppFundingAmount(currentBlockHeight int64) sdk.Coin {
// based on the number of relays it needs to send. Theoretically, `+1` should
// be enough, but probabilistic and time based mechanisms make it hard
// to predict exactly.
appFundingAmount := s.relayRatePerApp * s.relayCoinAmountCost * currentTestDuration * blockDuration * 2
amountToSpend := s.relayRatePerApp * s.relayCoinAmountCost * currentTestDuration * blockDuration
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
amountToSpend := s.relayRatePerApp * s.relayCoinAmountCost * currentTestDuration * blockDuration
relayCostDuringTestPOKT := s.relayRatePerApp * s.relayCoinAmountCost * currentTestDuration * blockDuration

@@ -631,7 +651,8 @@ func (s *relaysSuite) getAppFundingAmount(currentBlockHeight int64) sdk.Coin {
// based on the number of relays it needs to send. Theoretically, `+1` should
// be enough, but probabilistic and time based mechanisms make it hard
// to predict exactly.
appFundingAmount := s.relayRatePerApp * s.relayCoinAmountCost * currentTestDuration * blockDuration * 2
amountToSpend := s.relayRatePerApp * s.relayCoinAmountCost * currentTestDuration * blockDuration
appFundingAmount := math.Max(amountToSpend, s.appParams.MinStake.Amount.Int64()*2)
Copy link
Member

Choose a reason for hiding this comment

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

Move the comment starting with Multiply by 2 above so it's above this line instead.

strings.NewReader(payload),
)
go func(gwURL, appAddr, payload string) {
gwURL = gwURL + "/"
Copy link
Member

Choose a reason for hiding this comment

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

Can we just call it gatewayURL without the shortening?

gwURL = gwURL + "/"
req, err := http.NewRequest("POST", gwURL, strings.NewReader(payload))

req.Header.Add("X-App-Address", appAddr)
Copy link
Member

Choose a reason for hiding this comment

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

  1. TODO_TECHDEBT to remove x-
  2. #PUC why we need this

if res.StatusCode != http.StatusOK {
s.failedRelays.Add(1)
}
}(s.gatewayUrls[gateway.address], application.address, relayPayload)
Copy link
Member

Choose a reason for hiding this comment

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

What if you do something like:

inlineFunc := func(...) {..}
gatewayURL := s.gatewayUrls[...]
go inlineFunc(gatewayURL, ...)

You'll need better names, but it'll be easier to maintain.,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
loadtest Work related to load testing
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

2 participants