Skip to content

Commit

Permalink
#1748 fixing compatibiliti with geth prestate
Browse files Browse the repository at this point in the history
  • Loading branch information
kladkogex committed Dec 26, 2023
1 parent 818c7fe commit ac749be
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions libhistoric/AlethStandardTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ void AlethStandardTrace::processFunctionCallOrReturnIfHappened(
STATE_CHECK( currentDepth == m_lastOpRecord.m_depth )
}
}
const Address& AlethStandardTrace::getFrom() const {
return m_from;
}

vector< uint8_t > AlethStandardTrace::extractSmartContractMemoryByteArrayFromStackPointer(
const LegacyVM* _vm ) {
Expand Down
1 change: 1 addition & 0 deletions libhistoric/AlethStandardTrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class AlethStandardTrace {


static string toGethCompatibleCompactHexPrefixed( const u256& _value );
const Address& getFrom() const;

private:
// this operator will be executed by skaled on each EVM instruction
Expand Down
4 changes: 2 additions & 2 deletions libhistoric/PrestateTracePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ void PrestateTracePrinter::printAllAccessedAccountPreValues(

auto balance = _statePre.balance( _address );

if (m_standardTrace.isCall()) {
if (m_standardTrace.isCall() && _address == m_standardTrace.getFrom()) {
// take into account that for calls balance is modified in the state before execution
balance = m_standardTrace.getOriginalFromBalance();
}

storagePreValues["balance"] =
AlethStandardTrace::toGethCompatibleCompactHexPrefixed( _statePre.balance( _address ) );
AlethStandardTrace::toGethCompatibleCompactHexPrefixed( balance );
storagePreValues["nonce"] = ( uint64_t ) _statePre.getNonce( _address );

bytes const& code = _statePre.code( _address );
Expand Down

0 comments on commit ac749be

Please sign in to comment.