From dcd700ec147b0cd9137ea28d382fdd0377dfe75e Mon Sep 17 00:00:00 2001 From: Stan Kladko <13399135+kladkogex@users.noreply.github.com> Date: Tue, 26 Dec 2023 12:15:28 +0000 Subject: [PATCH] #1748 fixing compatibiliti with geth prestate --- .../geth_traces/Tracer.getBalance.callTracer.json | 2 +- .../Tracer.getBalance.prestateTracer.json | 8 ++++---- test/historicstate/hardhat/scripts/trace.ts | 13 +++++++++++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/test/historicstate/hardhat/scripts/geth_traces/Tracer.getBalance.callTracer.json b/test/historicstate/hardhat/scripts/geth_traces/Tracer.getBalance.callTracer.json index d807a56c0..113ac0544 100644 --- a/test/historicstate/hardhat/scripts/geth_traces/Tracer.getBalance.callTracer.json +++ b/test/historicstate/hardhat/scripts/geth_traces/Tracer.getBalance.callTracer.json @@ -1,5 +1,5 @@ { - "from": "0xce5c7ca85f8cb94fa284a303348ef42add23f5e7", + "from": "CALL.address", "gas": "0x2faf080", "gasUsed": "0x5bb7", "to": "Tracer.address", diff --git a/test/historicstate/hardhat/scripts/geth_traces/Tracer.getBalance.prestateTracer.json b/test/historicstate/hardhat/scripts/geth_traces/Tracer.getBalance.prestateTracer.json index 6cbc29ce3..5e22495a6 100644 --- a/test/historicstate/hardhat/scripts/geth_traces/Tracer.getBalance.prestateTracer.json +++ b/test/historicstate/hardhat/scripts/geth_traces/Tracer.getBalance.prestateTracer.json @@ -1,9 +1,6 @@ { "0x0000000000000000000000000000000000000000": { - "balance": "0x3852c5" - }, - "0xce5c7ca85f8cb94fa284a303348ef42add23f5e7": { - "balance": "0x0" + "balance": "0xb85475" }, "Tracer.address": { "balance": "0x0", @@ -12,5 +9,8 @@ "storage": { "0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000000" } + }, + "CALL.address": { + "balance": "0x0" } } \ No newline at end of file diff --git a/test/historicstate/hardhat/scripts/trace.ts b/test/historicstate/hardhat/scripts/trace.ts index 334d717d8..955cfe1db 100644 --- a/test/historicstate/hardhat/scripts/trace.ts +++ b/test/historicstate/hardhat/scripts/trace.ts @@ -223,10 +223,14 @@ async function callDebugTraceCall(_deployedContract: any, _tracer: string, _trac writeFileSync(SKALE_TRACES_DIR + _traceFileName, traceResult); let deployedContractAddressLowerCase = _deployedContract.address.toString().toLowerCase(); + let callAddressLowerCase = CALL_ADDRESS.toLowerCase(); await replaceStringInFile(SKALE_TRACES_DIR + _traceFileName , deployedContractAddressLowerCase, TEST_CONTRACT_NAME + ".address"); + await replaceStringInFile(SKALE_TRACES_DIR + _traceFileName , + callAddressLowerCase, "CALL.address"); + let ownerAddressLowerCase = OWNER_ADDRESS.toLowerCase(); await replaceStringInFile(SKALE_TRACES_DIR + _traceFileName , @@ -402,6 +406,15 @@ async function verifyPrestateTraceAgainstGethTrace(_fileName: string) { let key = difference.path![1]; if (address == ZERO_ADDRESS && key == "balance") return; + + if (address == "CALL.address" && key == "balance") + return; + } + + if (difference.kind == "D" && difference.path!.length == 1) { + let address = difference.path![0]; + if (address == ZERO_ADDRESS) + return; }