Skip to content

Extract shared frame-exit result construction#1578

Merged
chfast merged 1 commit into
masterfrom
frame_exit
Jul 1, 2026
Merged

Extract shared frame-exit result construction#1578
chfast merged 1 commit into
masterfrom
frame_exit

Conversation

@chfast

@chfast chfast commented Jul 1, 2026

Copy link
Copy Markdown
Member

Use shared procedure for frame exit in Baseline and Advanced.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR extracts the common “frame exit” logic (gas-left/gas-refund/output handling) into a shared helper so both Baseline and Advanced interpreters construct evmc_result consistently.

Changes:

  • Added make_execution_result() helper in execution_state.hpp to centralize frame-exit result construction.
  • Updated Baseline interpreter to use the shared helper instead of duplicating result-building logic.
  • Updated Advanced interpreter to use the shared helper instead of duplicating result-building logic.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
lib/evmone/execution_state.hpp Introduces shared helper for building evmc_result from final frame state and remaining gas.
lib/evmone/baseline_execution.cpp Switches Baseline execution to use the shared result-construction helper.
lib/evmone/advanced_execution.cpp Switches Advanced execution to use the shared result-construction helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/evmone/execution_state.hpp Outdated
Comment on lines +203 to +211
inline evmc_result make_execution_result(ExecutionState& state, int64_t gas) noexcept
{
const auto gas_left = (state.status == EVMC_SUCCESS || state.status == EVMC_REVERT) ? gas : 0;
const auto gas_refund = (state.status == EVMC_SUCCESS) ? state.gas_refund : 0;

assert(state.output_size != 0 || state.output_offset == 0);
return evmc::make_result(state.status, gas_left, gas_refund,
state.output_size != 0 ? &state.memory[state.output_offset] : nullptr, state.output_size);
}
Use shared procedure for frame exit in Baseline and Advanced.
@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.41%. Comparing base (c1a0c7c) to head (fade609).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1578      +/-   ##
==========================================
- Coverage   97.41%   97.41%   -0.01%     
==========================================
  Files         163      163              
  Lines       14680    14677       -3     
  Branches     3407     3404       -3     
==========================================
- Hits        14300    14297       -3     
  Misses        280      280              
  Partials      100      100              
Flag Coverage Δ
eest-develop 89.42% <100.00%> (+<0.01%) ⬆️
eest-develop-gmp 26.08% <87.50%> (+0.01%) ⬆️
eest-legacy 17.51% <87.50%> (+0.01%) ⬆️
eest-libsecp256k1 27.71% <87.50%> (+0.01%) ⬆️
eest-stable 89.40% <100.00%> (+<0.01%) ⬆️
evmone-unittests 92.62% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
core 95.96% <100.00%> (-0.01%) ⬇️
tooling 90.32% <ø> (ø)
tests 99.80% <ø> (ø)
Files with missing lines Coverage Δ
lib/evmone/advanced_execution.cpp 100.00% <100.00%> (ø)
lib/evmone/baseline_execution.cpp 96.03% <100.00%> (-0.13%) ⬇️
lib/evmone/execution_state.hpp 88.37% <100.00%> (+1.88%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@chfast chfast merged commit e64f626 into master Jul 1, 2026
24 checks passed
@chfast chfast deleted the frame_exit branch July 1, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants