Skip to content

Commit

Permalink
#1751 case where no contract is called
Browse files Browse the repository at this point in the history
  • Loading branch information
kladkogex committed Jan 17, 2024
1 parent 5843bc4 commit 64f4b5b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
7 changes: 2 additions & 5 deletions libhistoric/PrestateTracePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ void PrestateTracePrinter::printPre( Json::Value& _jsonTrace, const HistoricStat
printAllAccessedAccountPreValues( _jsonTrace, _statePre, item );
};


if ( !m_trace.isCall() )
return;

// when in call trace geth always prints the balance of block miner balance
// geth always prints the balance of block miner balance

auto minerAddress = m_trace.getBlockAuthor();
auto minerBalance = _statePre.balance( minerAddress );
Expand All @@ -56,6 +52,7 @@ void PrestateTracePrinter::printPre( Json::Value& _jsonTrace, const HistoricStat

_jsonTrace[toHexPrefixed( minerAddress )]["balance"] =
AlethStandardTrace::toGethCompatibleCompactHexPrefixed( minerBalance );
std::cerr << _jsonTrace << "!!!" << std::endl;
}


Expand Down
16 changes: 10 additions & 6 deletions test/historicstate/hardhat/scripts/trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,14 @@ async function verifyPrestateTransferTraceAgainstGethTrace(_fileName: string) {
return;
}
}

if (difference.kind == "E" && difference.path!.length == 2) {
let address = difference.path![0];
if (address == ZERO_ADDRESS && difference.path![1] == "balance") {
return;
}
}

foundDiffs = true;
});
}
Expand Down Expand Up @@ -612,10 +620,9 @@ async function main(): Promise<void> {

const transferHash: string = await callTestContractRun(deployedContract);

await getAndPrintCommittedTransactionTrace(transferHash, PRESTATE_TRACER, TEST_TRANSFER_PRESTATETRACER_FILE_NAME);
await getAndPrintCommittedTransactionTrace(transferHash, CALL_TRACER, TEST_TRANSFER_CALLTRACER_FILE_NAME);
await getAndPrintCommittedTransactionTrace(transferHash, DEFAULT_TRACER, TEST_TRANSFER_DEFAULTTRACER_FILE_NAME);
await getAndPrintCommittedTransactionTrace(transferHash, PRESTATE_TRACER, TEST_TRANSFER_PRESTATETRACER_FILE_NAME);


await callDebugTraceCall(deployedContract, DEFAULT_TRACER, TEST_CONTRACT_CALL_DEFAULTTRACER_FILE_NAME);
await callDebugTraceCall(deployedContract, CALL_TRACER, TEST_CONTRACT_CALL_CALLTRACER_FILE_NAME);
Expand All @@ -629,11 +636,10 @@ async function main(): Promise<void> {
await callDebugTraceCall(deployedContract, REPLAY_TRACER, TEST_CONTRACT_CALL_REPLAYTRACER_FILE_NAME);
}

await verifyPrestateTransferTraceAgainstGethTrace(TEST_TRANSFER_PRESTATETRACER_FILE_NAME);

await verifyTransferTraceAgainstGethTrace(TEST_TRANSFER_DEFAULTTRACER_FILE_NAME);
await verifyTransferTraceAgainstGethTrace(TEST_TRANSFER_CALLTRACER_FILE_NAME);
await verifyPrestateTransferTraceAgainstGethTrace(TEST_TRANSFER_PRESTATETRACER_FILE_NAME);


await verifyDefaultTraceAgainstGethTrace(TEST_CONTRACT_DEPLOY_FILE_NAME);
await verifyDefaultTraceAgainstGethTrace(TEST_CONTRACT_RUN_FILE_NAME);
Expand All @@ -642,8 +648,6 @@ async function main(): Promise<void> {
await verifyFourByteTraceAgainstGethTrace(TEST_CONTRACT_CALL_FOURBYTETRACER_FILE_NAME);
await verifyPrestateTraceAgainstGethTrace(TEST_CONTRACT_CALL_PRESTATETRACER_FILE_NAME);
await verifyPrestateDiffTraceAgainstGethTrace(TEST_CONTRACT_CALL_PRESTATEDIFFTRACER_FILE_NAME);


}


Expand Down

0 comments on commit 64f4b5b

Please sign in to comment.