Add High-Volume Delegation Stress Tests and Gas Usage Benchmarking to Votes.test.js #5841
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR enhances the Votes.test.js suite by introducing stress tests to evaluate gas cost and performance under heavy delegation loads.
It addresses the lack of coverage for scenarios involving large numbers of delegation operations in short timeframes, which can be critical in high-traffic voting environments.
Key changes:
Functional Fixes:
Removed ethers.Typed.address() usage and replaced with .address.
Used .connect() for correct signer delegation calls.
New Stress Test Scenarios:
Mass Single-Delegate Delegation: 100+ accounts delegate to a single address, logging total gas usage.
Cross-Delegation: Each account delegates to the next, measuring total gas usage.
Same-Block Delegation: Multiple delegations batched into one block by disabling automining.
Impact:
Enables performance profiling for large-scale delegation events.
Helps identify potential gas optimizations in the delegation logic.
Provides baseline metrics for comparing improvements in future contract iterations.