Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1884 +/- ##
==========================================
+ Coverage 98.21% 98.23% +0.01%
==========================================
Files 189 191 +2
Lines 17410 17423 +13
Branches 3976 3977 +1
==========================================
+ Hits 17099 17115 +16
+ Misses 239 237 -2
+ Partials 72 71 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Merging this PR will regress 1 benchmark1 warning
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
There was a problem hiding this comment.
🟢 Approved
No active review issues are reported for the release-build contract and resource-exhaustion checks.
No open issues 🎉
What changed in this PR
Adds release-build checks for API contract violations and resource exhaustion, with consistent diagnostics before aborting.
Changes:
- Introduces
abort_unless()and an out-of-linefatal_error()handler. - Applies fatal checks to excessive call depth and memory allocation failure.
- Adds a death test for call depth above 1024.
| File | Description |
|---|---|
| test/unittests/evmone_test.cpp | Tests rejection of excessive call depth. |
| lib/evmone/vm_context.cpp | Checks depth in all builds. |
| lib/evmone/fatal_error.hpp | Declares fatal handling and defines abort_unless(). |
| lib/evmone/fatal_error.cpp | Prints diagnostics to stderr and aborts. |
| lib/evmone/execution_state.hpp | Routes allocation failure through the fatal handler. |
| lib/evmone/CMakeLists.txt | Registers the new source files. |
Review effort: Balanced
Add abort_unless(condition, message), an inline test that calls the cold, out-of-line fatal_error(), which prints the message to stderr and aborts. Unlike assert(), it stays in release builds. Use it for violations of the API contract by the caller and for resource exhaustion. Check the call depth of an execution: a caller passing a message with depth above 1024 now aborts the process. Previously, the execution state was taken from outside the reserved storage. The memory allocation failure now aborts via fatal_error() instead of std::terminate().
Add abort_unless(condition, message), an inline test that calls the cold, out-of-line fatal_error(), which prints the message to stderr and aborts. Unlike assert(), it stays in release builds. Use it for violations of the API contract by the caller and for resource exhaustion.
Check the call depth of an execution: a caller passing a message with depth above 1024 now aborts the process. Previously, the execution state was taken from outside the reserved storage. The memory allocation failure now aborts via fatal_error() instead of std::terminate().