Skip to content

chore(tests/load): C-chain load testing #3914

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

Merged
merged 238 commits into from
Jun 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
238 commits
Select commit Hold shift + click to select a range
b713278
initial commit
qdm12 Apr 24, 2025
863adcc
Split listeners in poll and subscription depending if connection is w…
qdm12 Apr 24, 2025
c6030db
Always generate keys except for the prefunded key
qdm12 Apr 28, 2025
a560a94
Lower poll period from 1s to 50ms
qdm12 Apr 28, 2025
7942c76
Abort fund distribution if no key needs it
qdm12 Apr 28, 2025
f6e300c
Ginkgo setup
qdm12 Apr 28, 2025
a934818
Define client interfaces for poll and subscriber eth clients
qdm12 Apr 28, 2025
8224d4e
Observe block times working for both polling and websocket
qdm12 Apr 28, 2025
57ad33b
Use ginkgo context
qdm12 Apr 28, 2025
29502bd
Fail ginkgo properly using `ginkgo.GinkgoT().Error`
qdm12 Apr 28, 2025
a213610
Rely on ginkgo to handle OS signals
qdm12 Apr 28, 2025
2a859a2
Simplify unneeded run function
qdm12 Apr 28, 2025
2be38c1
Remove unneeded dependencies.go file
qdm12 Apr 28, 2025
8701f17
Unexport symbols
qdm12 Apr 28, 2025
e5f2f79
Use all prefunded keys instead of only one
qdm12 Apr 28, 2025
ee6132e
Thread safe tracker
qdm12 Apr 28, 2025
35450dc
CI setup
qdm12 Apr 28, 2025
5ea102a
Split issuer and listener
qdm12 Apr 29, 2025
3be8f03
Rename package names issuer and generator to issue and generate
qdm12 Apr 29, 2025
0251e6f
Mark remaining in flight transactions as failed when exiting listener
qdm12 Apr 29, 2025
8658ca0
Fix listener poll implementation
qdm12 Apr 29, 2025
66eb147
Use env network default nodes directly
qdm12 Apr 29, 2025
50095f6
Limit number of nodes to 1
qdm12 Apr 29, 2025
92616fc
Fix block production
michaelkaplan13 Apr 30, 2025
c2ebb6f
Fix listen subscription exit
qdm12 Apr 30, 2025
e323368
Minor comment fixes
qdm12 Apr 30, 2025
e13e3ae
Log out average duration per block at the end
qdm12 Apr 30, 2025
46b4e0d
Ignore load tests in unit tests
qdm12 Apr 30, 2025
b758aa5
Add load testing to readme
qdm12 Apr 30, 2025
f595e15
Fix double cancelation of listener subscription
qdm12 Apr 30, 2025
aed6ec4
Change metrics route to /ext/metrics
qdm12 Apr 30, 2025
1ce8f95
Fix distribution of funds
qdm12 Apr 30, 2025
b711dd0
Remove listener polling
qdm12 Apr 30, 2025
a7d46f7
Wait 3s after fund distribution to check for balances
qdm12 Apr 30, 2025
2514b3c
Do not track block durations
qdm12 Apr 30, 2025
20d972b
Merge branch 'master' into qdm12/tests/load
qdm12 Apr 30, 2025
3172d41
Tidy dependencies 🤷
qdm12 Apr 30, 2025
aa49787
Use initially created network
qdm12 Apr 30, 2025
15065c4
Replace in flight txs gauge with issued counter
qdm12 May 2, 2025
3cf8af8
Remove issuing detail metrics as likely unneeded
qdm12 May 2, 2025
8270efb
Unexport metrics fields
qdm12 May 2, 2025
55fdfdf
Change metrics to match hypersdk ones
qdm12 May 2, 2025
238dcff
Remove unneeded address field for issuer
qdm12 May 2, 2025
baabe22
Always set max tip cap to 1
qdm12 May 2, 2025
ea16ed3
Require largest balance address to remain with min funds
qdm12 May 2, 2025
ba4e377
Prevent new head subscriber race condition on exit
qdm12 May 2, 2025
db3010a
Fix minimum funds calculation
qdm12 May 2, 2025
f22abad
issue period configuration option
qdm12 May 5, 2025
77086f4
Final timeout config option
qdm12 May 5, 2025
c4fa76c
Add Prometheus and grafana instructions and configs
qdm12 May 5, 2025
435a0f1
Log tracker stats every 10s
qdm12 May 5, 2025
e2dd77f
Change counter tracker to noop tracker
qdm12 May 5, 2025
19d3b3a
Merge generator and issuer together
qdm12 May 6, 2025
b812419
Remove unneeded constant issuePeriod
qdm12 May 6, 2025
8aa1b53
init
RodrigoVillar May 6, 2025
f34d312
lint
RodrigoVillar May 6, 2025
1155cd0
issue: add C chain opcode simulator issuer
qdm12 May 7, 2025
1f9b865
Generate contract using libevm abigen
qdm12 May 7, 2025
30961af
Merge branch 'master' into qdm12/tests/load
qdm12 May 7, 2025
4a4b7d7
migrate
RodrigoVillar May 7, 2025
7497d56
Merge branch 'master' into add-load-framework
RodrigoVillar May 7, 2025
98957e6
Pre-adapt to add-load-framework branch
qdm12 May 7, 2025
0faf824
Move issuers to c/issuers
qdm12 May 7, 2025
1f366f3
Move listener code to c/listener
qdm12 May 7, 2025
8ccb800
Update grafana dashboard
qdm12 May 7, 2025
a9e7e0f
Fix logging using avalanchego's logger
qdm12 May 7, 2025
97a154d
Fix gci linting
qdm12 May 8, 2025
ccaff10
relax generic type constraint
RodrigoVillar May 8, 2025
855bfb9
remove unused logger from burst orchestrator
RodrigoVillar May 8, 2025
eed3292
MD => md
RodrigoVillar May 8, 2025
c2e2b01
Update tests/load/gradual_orchestrator.go
RodrigoVillar May 8, 2025
b5faf4f
nits
RodrigoVillar May 8, 2025
c33e894
Update tests/load/gradual_orchestrator.go
RodrigoVillar May 8, 2025
480e4bc
remove named return parameters
RodrigoVillar May 8, 2025
8e19faa
lint
RodrigoVillar May 8, 2025
9385b6e
remove duplicate MD
RodrigoVillar May 8, 2025
672f377
remove unnecessary errors from orchestrator constructors
RodrigoVillar May 8, 2025
5ef5660
Update tests/load/gradual_orchestrator.go
RodrigoVillar May 8, 2025
0595e31
make observerGroup a pointer
RodrigoVillar May 8, 2025
3e2294f
default => new
RodrigoVillar May 8, 2025
781bf60
convert tracker from interface to impl
RodrigoVillar May 9, 2025
b0ae321
single generic on gradual orchestrator
RodrigoVillar May 9, 2025
4daa6b0
merge burst into gradual
RodrigoVillar May 9, 2025
4232002
remove unnecessary orchestrator interface
RodrigoVillar May 9, 2025
3ba6372
rm dependencies.go
RodrigoVillar May 9, 2025
a35ceef
rename gradual orchestrator to just orchestrator
RodrigoVillar May 9, 2025
9f9eebd
add doc for NewOrchestratorConfig()
RodrigoVillar May 9, 2025
c1e5ace
use int64 throughout orchestrator
RodrigoVillar May 9, 2025
8549ec2
use type constraint for txIDs
RodrigoVillar May 9, 2025
3b1632a
Merge branch 'add-load-framework' into qdm12/tests/load
qdm12 May 12, 2025
d521e30
Unexport Distribute
qdm12 May 12, 2025
8113fd2
Update dashboard
qdm12 May 12, 2025
2963c89
Update dashboard
qdm12 May 12, 2025
ad060bb
Issuer implementation as config option
qdm12 May 12, 2025
ae437f3
Remove periodic log of tracker
qdm12 May 13, 2025
7064e1d
Lower tx rate multiplier to 1.05
qdm12 May 13, 2025
84c6ac1
Increase nodes count from 1 to 3
qdm12 May 13, 2025
f199d84
Reset sustained time to default 20s
qdm12 May 13, 2025
14c44f9
Remove unneeded logger from tracker
qdm12 May 13, 2025
a72032b
Fix copyright notices
qdm12 May 13, 2025
f2ddaf5
Fix ginkgo command for C chain tests
qdm12 May 13, 2025
be69a42
Add CI step to check contract bindings are up to date
qdm12 May 13, 2025
8217ce4
Ignore .bindings.go for copyright check
qdm12 May 13, 2025
2f05785
Run with 5 nodes at least
qdm12 May 14, 2025
e057026
Format solidity contract
qdm12 May 15, 2025
4f6ea60
Emit storage update for simulate call depth function
qdm12 May 15, 2025
7c32918
createAgent helper function
qdm12 May 15, 2025
a594234
createAgents helping function
qdm12 May 15, 2025
4cb0924
parallel agents creation
qdm12 May 15, 2025
8bfb800
Add intro to readme
qdm12 May 15, 2025
064c91e
Add contract creation testing
qdm12 May 16, 2025
4990e24
Add solhint to contract bindings generation script
qdm12 May 16, 2025
b86e904
Fix orchestrator bug
qdm12 May 16, 2025
0521a48
Add pure compute contract function
qdm12 May 16, 2025
1a6fab1
load/c/issuers/opcode: remove unused field lastIssue
qdm12 May 16, 2025
395676e
Large event emission simulation function
qdm12 May 16, 2025
7ba62b9
External contract call simulation function
qdm12 May 16, 2025
a100eb1
Remove unneeded ensureKey calls
qdm12 May 16, 2025
53e717a
Rename `config` to `loadConfig`
qdm12 May 19, 2025
4114688
Use max possible fee cap for simple txs
qdm12 May 20, 2025
201be41
Use coreth with high gas limit
qdm12 May 20, 2025
2a68455
Distribute uses the max fee cap (100 eth) to send its transactions
qdm12 May 20, 2025
41125d7
Set pre-funded keys to the number of agents
qdm12 May 20, 2025
564610a
Remove now unneeded distribution
qdm12 May 20, 2025
33b8146
Use secp256k1.PrivateKey to simplify code
qdm12 May 20, 2025
b778684
ci: load test monitoring (#3959)
Elvis339 May 20, 2025
559c39a
Bump rate multiplier to 1.1
qdm12 May 20, 2025
3aa0e99
Set config values that pass
qdm12 May 20, 2025
b24bf80
Try (fail) setting the gas limit without touching coreth
qdm12 May 20, 2025
26c8f3f
Remove unneeded EnsureKeys
qdm12 May 20, 2025
49ee4fe
ci: rename e2e_load to load_tests
qdm12 May 20, 2025
87faf42
taskfile: rename test-e2e-load to test-load
qdm12 May 20, 2025
8cc8864
Rename ginkgo_test.go to load_test.go
qdm12 May 20, 2025
a9b13cc
Use avalanche-monitoring grafana dashboard json
qdm12 May 21, 2025
9380693
Revert "Try (fail) setting the gas limit without touching coreth"
qdm12 May 21, 2025
3a6809d
Update readme for both remote and local visualization
qdm12 May 21, 2025
a657afc
Update readme for remote grafana
qdm12 May 21, 2025
c9cb787
fix(metrics): set server address for Prometheus scrape config
qdm12 May 21, 2025
35c13d1
Merge branch 'master' into qdm12/tests/load
qdm12 May 21, 2025
5aeb776
Import libevm instead of coreth for params package
qdm12 May 21, 2025
3de4dda
c/issuers/simple: remove unused lastIssue field
qdm12 May 21, 2025
7c0b301
c/readme: fix path to entrypoint as load_test.go
qdm12 May 21, 2025
d067e02
Use `task test-load`
qdm12 May 21, 2025
e2ecc1c
Fix CI workflow to run test-load task
qdm12 May 21, 2025
a60a5e8
ci: remove `filter_by_owner` field
qdm12 May 21, 2025
0a58664
Run generate-load-contract-bindings as part of load test task
qdm12 May 21, 2025
aa6e241
Remove load test command from e2e readme
qdm12 May 21, 2025
bb97a1e
ci: remove Contract bindings are up to date since it's already part o…
qdm12 May 21, 2025
9c79e06
Use abigen from go.mod libevm version
qdm12 May 22, 2025
de7dd40
Change ci artificat prefix to load
qdm12 May 22, 2025
93b5eef
Reduce flake.nix solc comment
qdm12 May 22, 2025
8d55364
Restrict contract bindings generation to c directory
qdm12 May 22, 2025
6f138ca
Restrict unit test exclusion from tests/load to tests/load/c
qdm12 May 22, 2025
b079371
`BuildMetricsURLForNetwork` -> `BuildMonitoringURLForNetwork`
qdm12 May 22, 2025
615eab7
Remove redundant comment on network_uuid presence
qdm12 May 22, 2025
daebfdc
Remove _test.go suffix from contract bindings generate file
qdm12 May 22, 2025
abd5354
Add --start-collectors flag to test-load task
qdm12 May 22, 2025
3a47e2d
Update load/c/readme to use nix and the test-load task
qdm12 May 22, 2025
26dc86a
Change wording to "CI monitoring stack"
qdm12 May 22, 2025
66fa3a4
Improve wording for step 1 of private remote instance
qdm12 May 22, 2025
fc1251b
readme: prometheus -> monitoring (prometheus+loki)
qdm12 May 22, 2025
69bb305
Replace --start-collectors with `--start-metrics-collector --start-lo…
qdm12 May 22, 2025
d8896cc
Export and use `tmpnet.GetServiceDiscoveryDir`
qdm12 May 22, 2025
da8b904
Shorten GenerateMonitoringConfig comment
qdm12 May 22, 2025
c7d2beb
Use github.com/ava-labs/avalanchego/utils/perms
qdm12 May 22, 2025
45d4f86
Use require.NoError in load_test.go
qdm12 May 22, 2025
2aba1cd
Remove unneeded network.Nodes[:nodesCount]
qdm12 May 22, 2025
d3d8661
Remove unneeded logger from metrics server
qdm12 May 22, 2025
d45e40b
Use test context logger
qdm12 May 22, 2025
e21dfbd
Use two DeferCleanup
qdm12 May 22, 2025
eeb7581
Remove unused fields in c/issuers/opcode
qdm12 May 22, 2025
4c00861
Remove unneeded maxTipCap
qdm12 May 22, 2025
fd97d80
Remove unneeded NonceAt method in client interface
qdm12 May 22, 2025
4f22990
Issuer picks a tx type according to a weight
qdm12 May 22, 2025
e742788
Merge both load types together
qdm12 May 22, 2025
4ce9359
chore: newTxOpts always set max tip cap to 1
qdm12 May 22, 2025
5736025
Max fee cap set per transaction type in issuer
qdm12 May 22, 2025
7e6af87
Adjust max fee cap for zero self transfers
qdm12 May 22, 2025
177cbbe
Adjust weights to lower contract deployment
qdm12 May 22, 2025
4d61ab1
Fix pinning of libevm/cmd/abigen
qdm12 May 22, 2025
75a659a
More conservative min and max TPS
qdm12 May 22, 2025
72c67d1
Add `test-load-local` task for local monitoring
qdm12 May 22, 2025
d9ea754
Move body of SynchronizedBeforeSuite to BeforeAll
qdm12 May 22, 2025
3952c3a
Revert unrelated auto-formatting diffs
qdm12 May 22, 2025
5c6221b
Update local monitoring instructions to not pollute the source tree
qdm12 May 22, 2025
c1bda80
Merge branch 'master' into qdm12/tests/load
qdm12 May 22, 2025
308e096
Fix pinning of abigen (again)
qdm12 May 22, 2025
3b5e69a
remove ginkgo from load tests
RodrigoVillar May 23, 2025
3d211a7
single test-load task
RodrigoVillar May 23, 2025
ffad23f
remove network owner label
RodrigoVillar May 23, 2025
0e1e388
lint
RodrigoVillar May 23, 2025
9a9ef0f
clean func signatures
RodrigoVillar May 27, 2025
9e3feb2
Merge branch 'master' into qdm12/tests/load
RodrigoVillar May 28, 2025
b73f387
clean up issuer
RodrigoVillar May 28, 2025
2cfd882
fix go mod
RodrigoVillar May 28, 2025
a5dea94
simplify generateMetricsLink func header
RodrigoVillar May 28, 2025
ba5a4ab
remove default owner
RodrigoVillar May 28, 2025
fcfe214
remove interfaces in favor of impls
RodrigoVillar May 28, 2025
e547ac1
simplify createAgents
RodrigoVillar May 28, 2025
3e54ce4
clean up issuer
RodrigoVillar May 28, 2025
9332d24
switch from UTs to func main()
RodrigoVillar May 28, 2025
7b36a45
listener nit
RodrigoVillar May 28, 2025
b3048d6
nit
RodrigoVillar May 28, 2025
4ddce71
nit
RodrigoVillar May 28, 2025
8fb6954
close channel upon exiting
RodrigoVillar May 28, 2025
86e6128
lint
RodrigoVillar May 28, 2025
f1f472d
revert serviceDiscovery diff
RodrigoVillar May 28, 2025
4c1cf15
update Taskfile
RodrigoVillar May 28, 2025
988eef2
add ci check for up-to-date contract bindings
RodrigoVillar May 28, 2025
fa54feb
update GetNodeWebsocketURIs
RodrigoVillar May 28, 2025
d3db384
ci nit
RodrigoVillar May 28, 2025
0993b0f
fix README
RodrigoVillar May 28, 2025
9280c11
simplify prefunded keys
RodrigoVillar May 28, 2025
c945695
fix Taskfile
RodrigoVillar May 29, 2025
bc70bd3
add cleanup
RodrigoVillar May 29, 2025
e3d6645
remove metrics link
RodrigoVillar May 29, 2025
68fd3e4
merge execute into main
RodrigoVillar May 29, 2025
a2e2c91
reduce load
RodrigoVillar May 29, 2025
1888cf7
readme => README
RodrigoVillar May 29, 2025
d28d8d4
remove local monitoring
RodrigoVillar May 29, 2025
b2793ce
reduce diff
RodrigoVillar May 29, 2025
5a6dc97
Merge branch 'master' into qdm12/tests/load
RodrigoVillar May 30, 2025
d71c4db
args nit
RodrigoVillar May 30, 2025
3f8b97c
README nit
RodrigoVillar May 30, 2025
0bbf887
add support for skipping bind generation
RodrigoVillar May 30, 2025
b825e8c
Merge branch 'master' into qdm12/tests/load
RodrigoVillar May 30, 2025
8538f69
use network monitoring labels
RodrigoVillar May 30, 2025
19052cb
defer => tc.DeferCleanup
RodrigoVillar May 30, 2025
b5ac0d8
README nix nit
RodrigoVillar May 30, 2025
001b36d
ci nit
RodrigoVillar May 30, 2025
24a6050
prometheus func nit
RodrigoVillar May 30, 2025
1bcdfa3
lint
RodrigoVillar May 30, 2025
24cc663
ci nit
RodrigoVillar May 30, 2025
7bc4636
Merge branch 'master' into qdm12/tests/load
RodrigoVillar May 30, 2025
275c9e4
del go mod diff
RodrigoVillar May 30, 2025
c94d8b0
revert go sum change
RodrigoVillar May 30, 2025
1bc9f67
uri => URI
RodrigoVillar May 30, 2025
0027884
standardize err messages
RodrigoVillar May 30, 2025
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
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,15 @@ jobs:
- uses: ./.github/actions/setup-go-for-project
- shell: bash
run: ./scripts/run_task.sh check-generate-canoto
check_contract_bindings:
name: Up-to-date contract bindings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-go-for-project
- uses: ./.github/actions/install-nix
- shell: nix develop --command bash -x {0}
run: task check-generate-load-contract-bindings
go_mod_tidy:
name: Up-to-date go.mod and go.sum
runs-on: ubuntu-latest
Expand Down Expand Up @@ -227,3 +236,20 @@ jobs:
- name: Run e2e tests
shell: bash
run: nix develop --command ./scripts/run_task.sh test-bootstrap-monitor-e2e
load_tests:
name: load tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup-go-for-project
- uses: ./.github/actions/install-nix
- uses: ./.github/actions/run-monitored-tmpnet-cmd
with:
run: ./scripts/run_task.sh test-load
artifact_prefix: load
prometheus_username: ${{ secrets.PROMETHEUS_ID || '' }}
prometheus_password: ${{ secrets.PROMETHEUS_PASSWORD || '' }}
loki_username: ${{ secrets.LOKI_ID || '' }}
loki_password: ${{ secrets.LOKI_PASSWORD || '' }}
19 changes: 19 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ tasks:
- task: generate-canoto
- task: check-clean-branch

check-generate-load-contract-bindings:
desc: Checks that generated load contract bindings are up-to-date (requires a clean git working tree)
cmds:
- task: generate-load-contract-bindings
- task: check-clean-branch

check-generate-mocks:
desc: Checks that generated mocks are up-to-date (requires a clean git working tree)
cmds:
Expand Down Expand Up @@ -89,6 +95,12 @@ tasks:
desc: Generates canoto
cmd: go generate -run "github.com/StephenButtolph/canoto/canoto" ./...

generate-load-contract-bindings:
desc: Generates load contract bindings
cmds:
- cmd: grep -lr -E '^// Code generated - DO NOT EDIT\.$' tests/load/c | xargs -r rm
- cmd: go generate ./tests/load/c/...

generate-protobuf:
desc: Generates protobuf
cmd: ./scripts/protobuf_codegen.sh
Expand Down Expand Up @@ -214,6 +226,13 @@ tasks:
FUZZTIME: '{{.FUZZTIME| default "900"}}'
cmd: ./scripts/build_fuzz.sh {{.FUZZTIME}} ./x/merkledb

test-load:
desc: Runs load tests
cmds:
- task: generate-load-contract-bindings
- task: build
- cmd: go run ./tests/load/c/main --avalanchego-path=./build/avalanchego {{.CLI_ARGS}}

test-unit:
desc: Runs unit tests
# Invoking with bash ensures compatibility with CI execution on Windows
Expand Down
3 changes: 3 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
buf
protoc-gen-go
protoc-gen-go-grpc

# Solidity compiler
solc
] ++ lib.optionals stdenv.isDarwin [
# macOS-specific frameworks
darwin.apple_sdk.frameworks.Security
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,10 @@ github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM=
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/glog v1.2.1 h1:OptwRhECazUx5ix5TTWC3EZhsZEHWcYWY4FQHTIubm4=
github.com/golang/glog v1.2.1/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w=
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ AVALANCHE_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd )
# Load the constants
source "$AVALANCHE_PATH"/scripts/constants.sh

EXCLUDED_TARGETS="| grep -v /mocks | grep -v proto | grep -v tests/e2e | grep -v tests/upgrade | grep -v tests/fixture/bootstrapmonitor/e2e"
EXCLUDED_TARGETS="| grep -v /mocks | grep -v proto | grep -v tests/e2e | grep -v tests/load/c | grep -v tests/upgrade | grep -v tests/fixture/bootstrapmonitor/e2e"

if [[ "$(go env GOOS)" == "windows" ]]; then
# Test discovery for the antithesis test setups is broken due to
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function test_golangci_lint {
_addlicense_flags=${ADDLICENSE_FLAGS:-"--verify --debug"}
function test_license_header {
local files=()
while IFS= read -r line; do files+=("$line"); done < <(find . -type f -name '*.go' ! -name '*.pb.go' ! -name 'mock_*.go' ! -name 'mocks_*.go' ! -path './**/*mock/*.go' ! -name '*.canoto.go')
while IFS= read -r line; do files+=("$line"); done < <(find . -type f -name '*.go' ! -name '*.pb.go' ! -name 'mock_*.go' ! -name 'mocks_*.go' ! -path './**/*mock/*.go' ! -name '*.canoto.go' ! -name '*.bindings.go')

# shellcheck disable=SC2086
go run github.com/palantir/[email protected] \
Expand Down
6 changes: 6 additions & 0 deletions tests/fixture/tmpnet/monitor_processes.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,12 @@ func getWorkingDir(cmdName string) (string, error) {
return filepath.Join(tmpnetDir, cmdName), nil
}

// GetPrometheusServiceDiscoveryDir returns the path for prometheus file-based
// service discovery configuration.
func GetPrometheusServiceDiscoveryDir() (string, error) {
return getServiceDiscoveryDir(prometheusCmd)
}

func getServiceDiscoveryDir(cmdName string) (string, error) {
tmpnetDir, err := getTmpnetPath()
if err != nil {
Expand Down
6 changes: 5 additions & 1 deletion tests/fixture/tmpnet/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ const (

// eth address: 0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC
HardHatKeyStr = "56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027"

// grafanaURI is remote Grafana URI
grafanaURI = "grafana-poc.avax-dev.network"
)

var (
Expand Down Expand Up @@ -1103,7 +1106,8 @@ func MetricsLinkForNetwork(networkUUID string, startTime string, endTime string)
endTime = "now"
}
return fmt.Sprintf(
"https://grafana-poc.avax-dev.network/d/kBQpRdWnk/avalanche-main-dashboard?&var-filter=network_uuid%%7C%%3D%%7C%s&var-filter=is_ephemeral_node%%7C%%3D%%7Cfalse&from=%s&to=%s",
"https://%s/d/kBQpRdWnk/avalanche-main-dashboard?&var-filter=network_uuid%%7C%%3D%%7C%s&var-filter=is_ephemeral_node%%7C%%3D%%7Cfalse&from=%s&to=%s",
grafanaURI,
networkUUID,
startTime,
endTime,
Expand Down
26 changes: 26 additions & 0 deletions tests/fixture/tmpnet/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"errors"
"fmt"
"net"
"net/url"
"os"
"syscall"
"time"
Expand Down Expand Up @@ -91,6 +92,31 @@ func FilterAvailableNodes(nodes []*Node) []*Node {
return filteredNodes
}

// GetNodeWebsocketURIs returns a list of websocket URIs for the given nodes and
// blockchain ID, in the form "ws://<node-uri>/ext/bc/<blockchain-id>/ws".
// Ephemeral and stopped nodes are ignored.
func GetNodeWebsocketURIs(
ctx context.Context,
nodes []*Node,
blockchainID string,
deferCleanupFunc func(func()),
) ([]string, error) {
nodeURIs, err := GetNodeURIs(ctx, nodes, deferCleanupFunc)
if err != nil {
return nil, fmt.Errorf("failed to get node URIs: %w", err)
}
wsURIs := make([]string, len(nodeURIs))
for i := range nodeURIs {
uri, err := url.Parse(nodeURIs[i].URI)
if err != nil {
return nil, fmt.Errorf("failed to parse node URI: %w", err)
}
uri.Scheme = "ws" // use websocket to be able to stream events
wsURIs[i] = fmt.Sprintf("%s/ext/bc/%s/ws", uri, blockchainID)
}
return wsURIs, nil
}

// Marshal to json with default prefix and indent.
func DefaultJSONMarshal(v interface{}) ([]byte, error) {
return json.MarshalIndent(v, "", " ")
Expand Down
69 changes: 69 additions & 0 deletions tests/load/c/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Load testing

The C-chain load test entrypoint is in [main.go](main/main.go).

It runs with 5 nodes and 5 "agents".

Each "agent" runs a transaction issuer and a transaction listener asynchronously,
and is assigned uniformly to the nodes available, via websocket connections.

The load test picks at weighted random a transaction type to generate and issue, defined in [issuer.go](issuer.go).

For some transaction types, [this contract](contracts/EVMLoadSimulator.sol) is deployed and transactions call functions of this contract. This contract has different functions, each testing a particular performance aspect of the EVM, for example memory writes.

From the load test perspective, only the TPS (transactions per second) is logged out. Metrics available are:

- total transactions issued `txs_issued`
- total transactions confirmed `txs_confirmed`
- total transactions failed `txs_failed`
- transaction latency histogram `tx_latency`

There are more interesting metrics available from the tmpnet nodes being load tested.

Finally, to run the load test, run:

```bash
# Install nix (skip this step if nix is already installed)
./scripts/run_task.sh install-nix
# Start the dev shell
nix develop
# Start the load test
task test-load
```

## Visualize metrics in Grafana

### Private remote instances

If you have the credentials (internal to Ava Labs) for the CI monitoring stack, you can visualize the metrics following these steps:

1. Start a dev shell to ensure `prometheus` and `promtail` binaries are available to the test runner so it can use them to collect metrics and logs:

```bash
nix develop
```

2. Set your monitoring credentials using the credentials you can find in your password manager

```bash
export PROMETHEUS_USERNAME=<username>
export PROMETHEUS_PASSWORD=<password>
export LOKI_USERNAME=<username>
export LOKI_PASSWORD=<password>
```

3. Run the load test:

```bash
task test-load
```

4. Prior to the test beginning, you will see the following log:

```log
INFO metrics and logs available via grafana (collectors must be running) {"uri": "https://grafana-poc.avax-dev.network/d/eabddd1d-0a06-4ba1-8e68-a44504e37535/C-Chain%20Load?from=1747817500582&to=1747817952631&var-filter=network_uuid%7C%3D%7C4f419e3a-dba5-4ccd-b2fd-bda15f9826ff"}
```

5. Open the URL in your browser, and log in with the Grafana credentials which you can find in your password manager.

For reference, see [the tmpnet monitoring section](../../fixture/tmpnet/README.md#monitoring)
32 changes: 32 additions & 0 deletions tests/load/c/contracts/Dummy.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.21;

/// @notice Dummy is a contract used only for simulating the load
/// of contract creation operations in the EVM. It has state variables,
/// a constructor and simple functions to have a real-like deployed size.
contract Dummy {
uint256 public value;
address public owner;
Copy link
Contributor

Choose a reason for hiding this comment

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

owner is only used in the constructor, is this needed?

mapping(uint256 => uint256) public data;

event ValueUpdated(uint256 newValue);
Copy link
Contributor

Choose a reason for hiding this comment

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

This event is never used, is that intentional?

event DataWritten(uint256 key, uint256 value);

constructor() {
value = 42;
owner = msg.sender;
}

function updateValue(uint256 newValue) external {
value = newValue;
}

function writeData(uint256 key, uint256 val) external {
data[key] = val;
emit DataWritten(key, val);
}

function readData(uint256 key) external view returns (uint256) {
return data[key];
}
}
Loading