Skip to content

Commit

Permalink
#1750 multiple transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
kladkogex committed Jan 12, 2024
1 parent 0f8a2fb commit 5901d5b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion libethereum/Block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ ExecutionResult Block::executeHistoricCall( LastBlockHashesFace const& _lh, Tran
auto resultReceipt = m_state.mutableHistoricState().execute(
envInfo, *m_sealEngine, _t, skale::Permanence::Uncommitted, onOp );
HistoricState stateAfter( m_state.mutableHistoricState() );
_tracer->finalizeTrace( resultReceipt.first, stateBefore, stateAfter );
_tracer->finalizeAndPrintTrace( resultReceipt.first, stateBefore, stateAfter );
return resultReceipt.first;
} else {
auto resultReceipt = m_state.mutableHistoricState().execute(
Expand Down
18 changes: 10 additions & 8 deletions libhistoric/AlethStandardTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ string AlethStandardTrace::toGethCompatibleCompactHexPrefixed( const u256& _valu
return "0x" + hexStr;
}

// execution completed. Now use the tracer that the user requested
// to print the resulting trace
void eth::AlethStandardTrace::finalizeTrace(
// execution completed. Now finalize the trace and use the tracer that the user requested
// to print the resulting trace to json
void eth::AlethStandardTrace::finalizeAndPrintTrace(
ExecutionResult& _er, HistoricState& _statePre, HistoricState& _statePost ) {
auto totalGasUsed = ( uint64_t ) _er.gasUsed;
auto statusCode = AlethExtVM::transactionExceptionToEvmcStatusCode( _er.excepted );
Expand All @@ -379,9 +379,14 @@ void eth::AlethStandardTrace::finalizeTrace(

// record return of the top function.
recordFunctionReturned( statusCode, _er.output, totalGasUsed );

// we are done. Set the trace to finalized
STATE_CHECK( !m_isFinalized.exchange( true ) )
// now print trace
printTrace( _er, _statePre, _statePost );
}
void eth::AlethStandardTrace::printTrace( ExecutionResult& _er, const HistoricState& _statePre,
const HistoricState& _statePost ) { // now print the trace
m_jsonTrace = Json::Value( Json::objectValue );

// now run the trace that the user wants based on options provided
if ( m_tracePrinters.count( m_options.tracerType ) > 0 ) {
m_tracePrinters.at( m_options.tracerType ).print( m_jsonTrace, _er, _statePre, _statePost );
Expand All @@ -391,9 +396,6 @@ void eth::AlethStandardTrace::finalizeTrace(
// this should never happen
STATE_CHECK( false );
}

// we are done. Set the trace to finalized.
STATE_CHECK( !m_isFinalized.exchange( true ) )
}

// print all supported traces. This is useful for testing.
Expand Down
4 changes: 3 additions & 1 deletion libhistoric/AlethStandardTrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class AlethStandardTrace {
}

// this function will be called at the end of executions
void finalizeTrace( ExecutionResult& _er, HistoricState& _statePre, HistoricState& _statePost );
void finalizeAndPrintTrace( ExecutionResult& _er, HistoricState& _statePre, HistoricState& _statePost );


// this is to set original from balance for calls
Expand Down Expand Up @@ -168,5 +168,7 @@ class AlethStandardTrace {
u256 m_minerPayment;
u256 m_originalFromBalance;
bool m_isCall;
void printTrace(
ExecutionResult& _er, const HistoricState& _statePre, const HistoricState& _statePost );
};
} // namespace dev::eth

0 comments on commit 5901d5b

Please sign in to comment.