test(evm): add comprehensive Solidity test contracts and performance benchmarks#375
Draft
starwarfan wants to merge 2 commits intoDTVMStack:mainfrom
Draft
test(evm): add comprehensive Solidity test contracts and performance benchmarks#375starwarfan wants to merge 2 commits intoDTVMStack:mainfrom
starwarfan wants to merge 2 commits intoDTVMStack:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes two issues in the EVM contract benchmarks: (1) it adds an untimed warmup call before the benchmark loop to avoid measuring JIT compilation overhead, and (2) it introduces dynamic calldata construction (using buildCalldata/encodeConstructorParams) so that test cases with address arguments resolve correctly at runtime instead of requiring pre-baked hex calldata strings.
Changes:
- Introduces a new
EVMCBenchmarkHostclass that wraps anevmc::VMto support recursive CALL dispatch during benchmarks. - Replaces fixed calldata hex with a dynamic
buildCalldatahelper that constructs ABI-encoded calldata with forward-resolved contract addresses. - Adds a warmup call before the timed benchmark loop to trigger JIT compilation.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
⚡ Performance Regression Check Results✅ Performance Check Passed (interpreter)Performance Benchmark Results (threshold: 20%)
Summary: 194 benchmarks, 1 regressions ✅ Performance Check Passed (multipass)Performance Benchmark Results (threshold: 20%)
Summary: 194 benchmarks, 0 regressions |
8535d53 to
4cace88
Compare
Made-with: Cursor
806eadd to
20bc225
Compare
Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 introduces comprehensive EVM contract test suites and dedicated performance benchmarks to accurately measure execution efficiency.
Key Changes
Extensive Solidity Test Contracts: Added a wide variety of real-world contract scenarios under
tests/evm_solidity/, including:These suites include wrapper contracts and
test_cases.jsondefinitions to automatically build dynamic calldata arrays for specific setup operations.Benchmark Accuracy Improvements:
benchmark::DoNotOptimize) prior to the benchmark's main inner loop. This guarantees thatevmoneor DTVM has populated caches and triggered any deferred JIT compilations, making the benchmark reflective of strictly pure-execution cost.buildCalldata,encodeConstructorParams) directly into the custom benchmark runner (benchmarks/evm_contract_benchmark.cpp). This allows complex test setups (such as transferring tokens before swapping) to correctly compute and format the raw calldata.CI/Build adjustments:
ZEN_ENABLE_EVM_GAS_REGISTERworkflow checks.These changes ensure that our testing and benchmarking framework reflects real-world EVM usage and accurately assesses runtime efficiency instead of first-execution JIT overhead.
1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):
2. What is the scope of this PR (e.g. component or file name):
benchmarks/evm_contract_benchmark.cpp,tests/evm_solidity/3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):
4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):
5. Provide a description of the tests:
Verified locally on x86_64:
evm-contract-benchmarksuccessfully run and complete.ERC20BenchWrapper,MultiSigWallet, etc).Made with Cursor