Skip to content

Propagate exceptions in outcome - #2467

Open
andreaslyn wants to merge 1 commit into
mainfrom
andreaslyn/outcome-exception
Open

Propagate exceptions in outcome#2467
andreaslyn wants to merge 1 commit into
mainfrom
andreaslyn/outcome-exception

Conversation

@andreaslyn

Copy link
Copy Markdown
Contributor

No description provided.

@andreaslyn
andreaslyn marked this pull request as ready for review July 28, 2026 12:49
Copilot AI review requested due to automatic review settings July 28, 2026 12:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates transaction execution to propagate exceptions reliably across the fiber-based “previous transaction” dependency chain, by (a) using future.get() where rethrow is desired and (b) introducing an Outcome<T> container to carry either a normal Result<T> error or an exception.

Changes:

  • execute_transaction: switch from future.wait() to future.get() so exceptions from the previous transaction are rethrown.
  • execute_block: store per-transaction results as Outcome<Receipt> so exceptions are propagated via outcomes rather than via the final promise get().
  • core/result: add Outcome<T> and helpers to convert between Result<T> and Outcome<T> / rethrow exceptions.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
category/execution/monad/reserve_balance/reserve_balance_contract_test.cpp Renames test-local Outcome enum to avoid clashing with the new monad::Outcome type alias.
category/execution/ethereum/execute_transaction.cpp Uses future.get() to rethrow exceptions from the previous transaction when stalling / early-exiting on validation error.
category/execution/ethereum/execute_block.cpp Tracks each transaction’s completion as an Outcome<Receipt> and defers exception propagation to the aggregation loop.
category/core/result.hpp Introduces Outcome<T> plus conversion helpers; current implementation needs fixes for exception rethrow type and move semantics.
Comments suppressed due to low confidence (1)

category/core/result.hpp:54

  • result_from_outcome_or_throw currently calls boost::rethrow_exception(out.exception()), but out.exception() is std::exception_ptr with the default Outcome alias. This should use std::rethrow_exception. Also, return the value by moving out of out to avoid unintended copies / move-only failures.
template <typename T>
Result<T> result_from_outcome_or_throw(Outcome<T> out)
{
    if (out.has_exception()) {
        boost::rethrow_exception(out.exception());
    }
    if (out.has_error()) {
        return std::move(out).assume_error();
    }
    return out.assume_value();
}

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

Comment thread category/core/result.hpp
Comment thread category/core/result.hpp
Comment thread category/execution/ethereum/execute_block.cpp
Comment thread category/execution/ethereum/execute_block.cpp
@andreaslyn
andreaslyn force-pushed the andreaslyn/outcome-exception branch from 4a4aa60 to 56ecb19 Compare July 28, 2026 13:08
@andreaslyn
andreaslyn force-pushed the andreaslyn/outcome-exception branch from 56ecb19 to 06da81b Compare July 28, 2026 13:15
Comment thread category/execution/ethereum/execute_block.cpp
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.

3 participants