Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1751 trace multiple transactions in a single block #1783

Merged
merged 42 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
3550f29
#1750 multiple transactions
kladkogex Jan 12, 2024
0f8a2fb
#1750 multiple transactions
kladkogex Jan 12, 2024
5901d5b
#1750 multiple transactions
kladkogex Jan 12, 2024
ace6fa6
#1750 multiple transactions
kladkogex Jan 12, 2024
14c56e6
#1750 multiple transactions
kladkogex Jan 12, 2024
67ba4c0
#1750 multiple transactions
kladkogex Jan 12, 2024
fce9fcb
#1750 multiple transactions
kladkogex Jan 12, 2024
4188e5f
1751 Adding exceptions
kladkogex Jan 15, 2024
8141ca5
#1750 multiple transactions
kladkogex Jan 15, 2024
8416726
#1751 multiple transactions
kladkogex Jan 15, 2024
689b7e2
#1751 multiple transactions
kladkogex Jan 15, 2024
31c4e62
#1751 multiple transactions
kladkogex Jan 15, 2024
8f51d17
#1751 multiple transactions
kladkogex Jan 15, 2024
028f6ba
#1751 multiple transactions
kladkogex Jan 15, 2024
e6f7572
#1751 multiple transactions
kladkogex Jan 15, 2024
3995d47
#1751 multiple transactions
kladkogex Jan 15, 2024
d7d2274
#1751 case where no contract is called
kladkogex Jan 15, 2024
8f3a34c
#1751 case where no contract is called
kladkogex Jan 15, 2024
7f92009
#1751 case where no contract is called
kladkogex Jan 15, 2024
238fe85
#1751 case where no contract is called
kladkogex Jan 15, 2024
fb7493b
#1751 case where no contract is called
kladkogex Jan 16, 2024
bce8a66
#1751 case where no contract is called
kladkogex Jan 16, 2024
6c8d897
#1751 case where no contract is called
kladkogex Jan 16, 2024
4174a67
#1751 case where no contract is called
kladkogex Jan 16, 2024
99a7d3d
#1751 case where no contract is called
kladkogex Jan 16, 2024
2a87706
#1751 case where no contract is called
kladkogex Jan 16, 2024
385c049
#1751 case where no contract is called
kladkogex Jan 16, 2024
4f2ea73
#1751 case where no contract is called
kladkogex Jan 17, 2024
5843bc4
#1751 case where no contract is called
kladkogex Jan 17, 2024
64f4b5b
#1751 case where no contract is called
kladkogex Jan 17, 2024
51d2ce6
#1751 case where no contract is called
kladkogex Jan 17, 2024
e557439
#1751 case where no contract is called
kladkogex Jan 17, 2024
706cd92
#1751 case where no contract is called
kladkogex Jan 17, 2024
a557989
#1751 case where no contract is called
kladkogex Jan 17, 2024
d620e7c
#1751 case where no contract is called
kladkogex Jan 17, 2024
940d5dc
#1751 case where no contract is called
kladkogex Jan 17, 2024
94fd7c1
#1751 case where no contract is called
kladkogex Jan 17, 2024
64be1d1
#1751 case where no contract is called
kladkogex Jan 17, 2024
ec245b0
#1751 case where no contract is called
kladkogex Jan 17, 2024
8f6e7b1
#1751 case where no contract is called
kladkogex Jan 17, 2024
1a06864
#1751 case where no contract is called
kladkogex Jan 22, 2024
cd21227
#1751 case where no contract is called
kladkogex Jan 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 43 additions & 23 deletions libethereum/Block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -795,36 +795,56 @@
#ifdef HISTORIC_STATE
ExecutionResult Block::executeHistoricCall( LastBlockHashesFace const& _lh, Transaction const& _t,
std::shared_ptr< AlethStandardTrace > _tracer, uint64_t _transactionIndex ) {
auto onOp = OnOpFunc();
try {
auto onOp = OnOpFunc();

Check warning on line 799 in libethereum/Block.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Block.cpp#L799

Added line #L799 was not covered by tests

if ( _tracer ) {
onOp = _tracer->functionToExecuteOnEachOperation();
}
if ( _tracer ) {
onOp = _tracer->functionToExecuteOnEachOperation();

Check warning on line 802 in libethereum/Block.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Block.cpp#L801-L802

Added lines #L801 - L802 were not covered by tests
}


if ( isSealed() )
BOOST_THROW_EXCEPTION( InvalidOperationOnSealedBlock() );
if ( isSealed() )
BOOST_THROW_EXCEPTION( InvalidOperationOnSealedBlock() );

Check warning on line 807 in libethereum/Block.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Block.cpp#L806-L807

Added lines #L806 - L807 were not covered by tests

// Uncommitting is a non-trivial operation - only do it once we've verified as much of the
// transaction as possible.
uncommitToSeal();
uncommitToSeal();

Check warning on line 809 in libethereum/Block.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Block.cpp#L809

Added line #L809 was not covered by tests

u256 const gasUsed =
_transactionIndex ? receipt( _transactionIndex - 1 ).cumulativeGasUsed() : 0;
STATE_CHECK( _transactionIndex <= m_receipts.size() )

Check warning on line 811 in libethereum/Block.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Block.cpp#L811

Added line #L811 was not covered by tests

EnvInfo const envInfo{ info(), _lh, gasUsed, m_sealEngine->chainParams().chainID };
u256 const gasUsed =
_transactionIndex ? receipt( _transactionIndex - 1 ).cumulativeGasUsed() : 0;

Check warning on line 814 in libethereum/Block.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Block.cpp#L814

Added line #L814 was not covered by tests

if ( _tracer ) {
HistoricState stateBefore( m_state.mutableHistoricState() );
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 );
return resultReceipt.first;
} else {
auto resultReceipt = m_state.mutableHistoricState().execute(
envInfo, *m_sealEngine, _t, skale::Permanence::Reverted, onOp );
return resultReceipt.first;
EnvInfo const envInfo{ info(), _lh, gasUsed, m_sealEngine->chainParams().chainID };

Check warning on line 816 in libethereum/Block.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Block.cpp#L816

Added line #L816 was not covered by tests

if ( _tracer ) {

Check warning on line 818 in libethereum/Block.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Block.cpp#L818

Added line #L818 was not covered by tests
try {
HistoricState stateBefore( m_state.mutableHistoricState() );

Check warning on line 820 in libethereum/Block.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Block.cpp#L820

Added line #L820 was not covered by tests

auto resultReceipt = m_state.mutableHistoricState().execute(
envInfo, *m_sealEngine, _t, skale::Permanence::Uncommitted, onOp );
HistoricState stateAfter( m_state.mutableHistoricState() );
_tracer->finalizeAndPrintTrace( resultReceipt.first, stateBefore, stateAfter );

Check warning on line 825 in libethereum/Block.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Block.cpp#L822-L825

Added lines #L822 - L825 were not covered by tests
// for tracing the entire block is traced therefore, we save transaction receipt
// as it is used for execution of the next transaction
m_receipts.push_back( resultReceipt.second );
return resultReceipt.first;
} catch ( std::exception& e ) {
throw dev::eth::VMTracingError( "Exception doing trace for transaction index:" +
std::to_string( _transactionIndex ) + ":" +
e.what() );

Check warning on line 833 in libethereum/Block.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Block.cpp#L828-L833

Added lines #L828 - L833 were not covered by tests
}
} else {
auto resultReceipt = m_state.mutableHistoricState().execute(
envInfo, *m_sealEngine, _t, skale::Permanence::Reverted, onOp );
return resultReceipt.first;

Check warning on line 838 in libethereum/Block.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Block.cpp#L836-L838

Added lines #L836 - L838 were not covered by tests
}
} catch ( std::exception& e ) {
BOOST_THROW_EXCEPTION(

Check warning on line 841 in libethereum/Block.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Block.cpp#L840-L841

Added lines #L840 - L841 were not covered by tests
std::runtime_error( "Could not execute historic call for transactionIndex:" +
to_string( _transactionIndex ) + ":" + e.what() ) );
} catch ( ... ) {
BOOST_THROW_EXCEPTION(

Check warning on line 845 in libethereum/Block.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Block.cpp#L844-L845

Added lines #L844 - L845 were not covered by tests
std::runtime_error( "Could not execute historic call for transactionIndex:" +
to_string( _transactionIndex ) + ": unknown error" ) );
}
}
#endif
Expand Down
63 changes: 34 additions & 29 deletions libethereum/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1346,43 +1346,48 @@


Json::Value Client::traceBlock( BlockNumber _blockNumber, Json::Value const& _jsonTraceConfig ) {
Block previousBlock = blockByNumber( _blockNumber - 1 );
Block historicBlock = blockByNumber( _blockNumber );
try {
Block previousBlock = blockByNumber( _blockNumber - 1 );
Block historicBlock = blockByNumber( _blockNumber );

Check warning on line 1351 in libethereum/Client.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Client.cpp#L1350-L1351

Added lines #L1350 - L1351 were not covered by tests

Json::Value traces( Json::arrayValue );
Json::Value traces( Json::arrayValue );

Check warning on line 1353 in libethereum/Client.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Client.cpp#L1353

Added line #L1353 was not covered by tests

auto hash = ClientBase::hashFromNumber( _blockNumber );
Transactions transactions = this->transactions( hash );
auto hash = ClientBase::hashFromNumber( _blockNumber );
Transactions transactions = this->transactions( hash );

Check warning on line 1356 in libethereum/Client.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Client.cpp#L1355-L1356

Added lines #L1355 - L1356 were not covered by tests

auto traceOptions = TraceOptions::make( _jsonTraceConfig );
auto traceOptions = TraceOptions::make( _jsonTraceConfig );

Check warning on line 1358 in libethereum/Client.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Client.cpp#L1358

Added line #L1358 was not covered by tests

// cache results for better peformance
string key = to_string( _blockNumber ) + traceOptions.toString();
// cache results for better peformance
string key = to_string( _blockNumber ) + traceOptions.toString();

Check warning on line 1361 in libethereum/Client.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Client.cpp#L1361

Added line #L1361 was not covered by tests

auto cachedResult = m_blockTraceCache.getIfExists( key );
if ( cachedResult.has_value() ) {
return std::any_cast< Json::Value >( cachedResult );
}
auto cachedResult = m_blockTraceCache.getIfExists( key );
if ( cachedResult.has_value() ) {
return std::any_cast< Json::Value >( cachedResult );

Check warning on line 1365 in libethereum/Client.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Client.cpp#L1363-L1365

Added lines #L1363 - L1365 were not covered by tests
}

for ( unsigned k = 0; k < transactions.size(); k++ ) {
Json::Value transactionLog( Json::objectValue );
Transaction tx = transactions.at( k );
auto hashString = toHexPrefixed( tx.sha3() );
transactionLog["txHash"] = hashString;
tx.checkOutExternalGas( chainParams().externalGasDifficulty );
auto tracer =
std::make_shared< AlethStandardTrace >( tx, historicBlock.author(), traceOptions );
auto executionResult =
previousBlock.executeHistoricCall( bc().lastBlockHashes(), tx, tracer, k );
auto result = tracer->getJSONResult();
transactionLog["result"] = result;
traces.append( transactionLog );
}
for ( unsigned k = 0; k < transactions.size(); k++ ) {
Json::Value transactionLog( Json::objectValue );
Transaction tx = transactions.at( k );
auto hashString = toHexPrefixed( tx.sha3() );
transactionLog["txHash"] = hashString;
tx.checkOutExternalGas( chainParams().externalGasDifficulty );

Check warning on line 1373 in libethereum/Client.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Client.cpp#L1368-L1373

Added lines #L1368 - L1373 were not covered by tests
auto tracer =
std::make_shared< AlethStandardTrace >( tx, historicBlock.author(), traceOptions );

Check warning on line 1375 in libethereum/Client.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Client.cpp#L1375

Added line #L1375 was not covered by tests
auto executionResult =
previousBlock.executeHistoricCall( bc().lastBlockHashes(), tx, tracer, k );
auto result = tracer->getJSONResult();
transactionLog["result"] = result;
traces.append( transactionLog );

Check warning on line 1380 in libethereum/Client.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Client.cpp#L1377-L1380

Added lines #L1377 - L1380 were not covered by tests
}

auto tracesSize = traces.toStyledString().size();
m_blockTraceCache.put( key, traces, tracesSize );
auto tracesSize = traces.toStyledString().size();
m_blockTraceCache.put( key, traces, tracesSize );

Check warning on line 1384 in libethereum/Client.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Client.cpp#L1383-L1384

Added lines #L1383 - L1384 were not covered by tests

return traces;
return traces;
} catch ( std::exception& e ) {
BOOST_THROW_EXCEPTION( std::runtime_error(

Check warning on line 1388 in libethereum/Client.cpp

View check run for this annotation

Codecov / codecov/patch

libethereum/Client.cpp#L1386-L1388

Added lines #L1386 - L1388 were not covered by tests
"Could not trace block:" + to_string( _blockNumber ) + ":" + e.what() ) );
}
}

#endif
Expand Down
85 changes: 70 additions & 15 deletions libhistoric/AlethStandardTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
namespace dev::eth {

TraceOptions eth::AlethStandardTrace::getOptions() const {
STATE_CHECK( m_isFinalized )

Check warning on line 30 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L30

Added line #L30 was not covered by tests
return m_options;
}

Expand All @@ -35,6 +36,7 @@
const LegacyVM* _vm ) {
STATE_CHECK( _face )
STATE_CHECK( _vm )
STATE_CHECK( !m_isFinalized )

Check warning on line 39 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L39

Added line #L39 was not covered by tests

// check if instruction depth changed. This means a function has been called or has returned
processFunctionCallOrReturnIfHappened( _ext, _vm, ( uint64_t ) _gasRemaining );
Expand Down Expand Up @@ -105,6 +107,7 @@
// record the instruction
m_lastOpRecord = OpExecutionRecord( _ext.depth, _inst, _gasRemaining, _lastOpGas );
}

void AlethStandardTrace::processFunctionCallOrReturnIfHappened(
const AlethExtVM& _ext, const LegacyVM* _vm, uint64_t _gasRemaining ) {
STATE_CHECK( !m_isFinalized )
Expand All @@ -128,6 +131,7 @@
}
}
const Address& AlethStandardTrace::getFrom() const {
STATE_CHECK( m_isFinalized )

Check warning on line 134 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L134

Added line #L134 was not covered by tests
return m_from;
}

Expand All @@ -147,7 +151,6 @@
return result;
}


void AlethStandardTrace::recordFunctionIsCalled( const Address& _from, const Address& _to,
uint64_t _gasLimit, const vector< uint8_t >& _inputData, const u256& _value ) {
STATE_CHECK( !m_isFinalized )
Expand Down Expand Up @@ -178,13 +181,15 @@
void AlethStandardTrace::setTopFunctionCall(
const shared_ptr< FunctionCallRecord >& _topFunctionCall ) {
STATE_CHECK( _topFunctionCall )
STATE_CHECK( !m_isFinalized )

Check warning on line 184 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L184

Added line #L184 was not covered by tests
m_topFunctionCall = _topFunctionCall;
}

void AlethStandardTrace::recordFunctionReturned(
evmc_status_code _status, const vector< uint8_t >& _returnData, uint64_t _gasUsed ) {
STATE_CHECK( m_lastOpRecord.m_gasRemaining >= m_lastOpRecord.m_opGas )
STATE_CHECK( m_currentlyExecutingFunctionCall )
STATE_CHECK( !m_isFinalized )

Check warning on line 192 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L192

Added line #L192 was not covered by tests

// record return values
getCurrentlyExecutingFunctionCall()->setReturnValues( _status, _returnData, _gasUsed );
Expand All @@ -203,7 +208,6 @@
// the getter functions are called by printer classes after the trace has been generated
const shared_ptr< FunctionCallRecord >& AlethStandardTrace::getTopFunctionCall() const {
STATE_CHECK( m_isFinalized )
STATE_CHECK( m_topFunctionCall );
return m_topFunctionCall;
}

Expand All @@ -214,6 +218,11 @@
return m_jsonTrace;
}

uint64_t AlethStandardTrace::getTotalGasUsed() const {
STATE_CHECK( m_isFinalized )
return m_totalGasUsed;

Check warning on line 223 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L221-L223

Added lines #L221 - L223 were not covered by tests
}

AlethStandardTrace::AlethStandardTrace(
Transaction& _t, const Address& _blockAuthor, const TraceOptions& _options, bool _isCall )
: m_defaultOpTrace{ std::make_shared< Json::Value >() },
Expand Down Expand Up @@ -243,12 +252,22 @@
{ TraceType::FOUR_BYTE_TRACER, m_fourByteTracePrinter },
{ TraceType::NOOP_TRACER, m_noopTracePrinter } },
m_blockAuthor( _blockAuthor ),
m_isCall( _isCall ) {
m_isCall( _isCall ),
m_value( _t.value() ),
m_gasLimit( _t.gas() ),
m_inputData( _t.data() ),
m_gasPrice( _t.gasPrice() ) {

Check warning on line 259 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L258-L259

Added lines #L258 - L259 were not covered by tests
// mark from and to accounts as accessed
m_accessedAccounts.insert( m_from );
m_accessedAccounts.insert( m_to );
}

const u256& AlethStandardTrace::getGasLimit() const {
STATE_CHECK( m_isFinalized )
return m_gasLimit;

Check warning on line 267 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L265-L267

Added lines #L265 - L267 were not covered by tests
}
void AlethStandardTrace::setOriginalFromBalance( const u256& _originalFromBalance ) {
STATE_CHECK( !m_isFinalized )

Check warning on line 270 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L270

Added line #L270 was not covered by tests
m_originalFromBalance = _originalFromBalance;
}

Expand Down Expand Up @@ -361,24 +380,30 @@
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(

Check warning on line 385 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L385

Added line #L385 was not covered by tests
ExecutionResult& _er, HistoricState& _statePre, HistoricState& _statePost ) {
auto totalGasUsed = ( uint64_t ) _er.gasUsed;
auto statusCode = AlethExtVM::transactionExceptionToEvmcStatusCode( _er.excepted );
m_totalGasUsed = ( uint64_t ) _er.gasUsed;

Check warning on line 387 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L387

Added line #L387 was not covered by tests

// we are done. Set the trace to finalized.
STATE_CHECK( !m_isFinalized.exchange( true ) )
auto statusCode = AlethExtVM::transactionExceptionToEvmcStatusCode( _er.excepted );

Check warning on line 389 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L389

Added line #L389 was not covered by tests

STATE_CHECK( m_topFunctionCall )
STATE_CHECK( m_topFunctionCall == m_currentlyExecutingFunctionCall )

// if transaction is not just ETH transfer
// record return of the top function.
recordFunctionReturned( statusCode, _er.output, totalGasUsed );
if ( m_topFunctionCall ) {
recordFunctionReturned( statusCode, _er.output, m_totalGasUsed );

Check warning on line 396 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L395-L396

Added lines #L395 - L396 were not covered by tests
}
// we are done. Set the trace to finalized
STATE_CHECK( !m_isFinalized.exchange( true ) )

Check warning on line 399 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L399

Added line #L399 was not covered by tests
// now print trace
printTrace( _er, _statePre, _statePost );
}

Check warning on line 402 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L401-L402

Added lines #L401 - L402 were not covered by tests

void eth::AlethStandardTrace::printTrace( ExecutionResult& _er, const HistoricState& _statePre,

Check warning on line 404 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L404

Added line #L404 was not covered by tests
DmytroNazarenko marked this conversation as resolved.
Show resolved Hide resolved
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 Down Expand Up @@ -427,33 +452,63 @@

const shared_ptr< FunctionCallRecord >& AlethStandardTrace::getCurrentlyExecutingFunctionCall()
const {
STATE_CHECK( !m_isFinalized )

Check warning on line 455 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L455

Added line #L455 was not covered by tests
STATE_CHECK( m_currentlyExecutingFunctionCall )
return m_currentlyExecutingFunctionCall;
}

void AlethStandardTrace::setCurrentlyExecutingFunctionCall(
const shared_ptr< FunctionCallRecord >& _currentlyExecutingFunctionCall ) {
STATE_CHECK( !m_isFinalized )

Check warning on line 462 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L462

Added line #L462 was not covered by tests
STATE_CHECK( _currentlyExecutingFunctionCall )
m_currentlyExecutingFunctionCall = _currentlyExecutingFunctionCall;
}

const Address& AlethStandardTrace::getBlockAuthor() const {
STATE_CHECK( m_isFinalized )

Check warning on line 468 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L468

Added line #L468 was not covered by tests
return m_blockAuthor;
}

const u256& AlethStandardTrace::getMinerPayment() const {
STATE_CHECK( m_isFinalized )

Check warning on line 473 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L473

Added line #L473 was not covered by tests
return m_minerPayment;
}

void AlethStandardTrace::recordMinerPayment( u256 _minerGasPayment ) {
this->m_minerPayment = _minerGasPayment;
STATE_CHECK( !m_isFinalized )
m_minerPayment = _minerGasPayment;

Check warning on line 479 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L478-L479

Added lines #L478 - L479 were not covered by tests
// add miner to the list of accessed accounts, since the miner is paid
// transaction fee
this->m_accessedAccounts.insert( m_blockAuthor );
m_accessedAccounts.insert( m_blockAuthor );

Check warning on line 482 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L482

Added line #L482 was not covered by tests
}

bool AlethStandardTrace::isCall() const {
STATE_CHECK( m_isFinalized )

Check warning on line 486 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L486

Added line #L486 was not covered by tests
return m_isCall;
}

const u256& AlethStandardTrace::getOriginalFromBalance() const {
STATE_CHECK( m_isFinalized )

Check warning on line 491 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L491

Added line #L491 was not covered by tests
return m_originalFromBalance;
}

DmytroNazarenko marked this conversation as resolved.
Show resolved Hide resolved
const bytes& AlethStandardTrace::getInputData() const {
STATE_CHECK( m_isFinalized )
return m_inputData;

Check warning on line 497 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L495-L497

Added lines #L495 - L497 were not covered by tests
}
const u256& AlethStandardTrace::getValue() const {
STATE_CHECK( m_isFinalized )
return m_value;

Check warning on line 501 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L499-L501

Added lines #L499 - L501 were not covered by tests
}
const Address& AlethStandardTrace::getTo() const {
STATE_CHECK( m_isFinalized )
return m_to;

Check warning on line 505 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L503-L505

Added lines #L503 - L505 were not covered by tests
}

const u256& AlethStandardTrace::getGasPrice() const {
STATE_CHECK( m_isFinalized )
return m_gasPrice;

Check warning on line 510 in libhistoric/AlethStandardTrace.cpp

View check run for this annotation

Codecov / codecov/patch

libhistoric/AlethStandardTrace.cpp#L508-L510

Added lines #L508 - L510 were not covered by tests
}
} // namespace dev::eth

#endif
Loading
Loading