Currently the way that the contractActionIndexOfCurrentFrame is tracked inside OpcodeTracer is not exactly how it is done in the HederaTracer, where the list of contract actions is built and we are still using the mono code in the web3 module, so we need to refactor this to be identical to what is done in HederaTracer. We need to copy the logic from there and increment the contractActionIndexOfCurrentFrame in the places where items are pushed to the allActions list in HederaTracer.
Solution
Copy the way contract actions are added to the allActions list in HederaTracer
Looks like actions are generated in init, tracePrecompileResult, traceAccountCreationResult, and tracePostExecution
And also copy the needed logic from CustomMessageCallProcessor, which handles the precompile calls, updates the state of the message frames, sets an exceptional halt reason and also calls the tracePrecompileResult method from the HederaOperationTracer interface.
Test that there are no regressions in the eth_call, eth_estimateGas and debug_traceTransaction methods
Verify that OpcodeTracer returns the correct revert reason for reverting HTS calls by taking the right contract action with the index that is tracked:
try to locally deploy a test contract which does different nested contract calls, some of which are reverting HTS calls, and then hit the contract/results/{transactionIdOrHash}/opcodes endpoint to replay the transaction and debug the OpcodeTracer to verify that the contractActionIndexOfCurrentFrame is correct when we hit the tracePrecompileCall method for the HTS calls
Problem
Currently the way that the
contractActionIndexOfCurrentFrame
is tracked insideOpcodeTracer
is not exactly how it is done in theHederaTracer
, where the list of contract actions is built and we are still using the mono code in theweb3
module, so we need to refactor this to be identical to what is done inHederaTracer
. We need to copy the logic from there and increment thecontractActionIndexOfCurrentFrame
in the places where items are pushed to theallActions
list inHederaTracer
.Solution
Copy the way contract actions are added to the
allActions
list in HederaTracerinit
,tracePrecompileResult
,traceAccountCreationResult
, andtracePostExecution
eth_call
,eth_estimateGas
anddebug_traceTransaction
methodsOpcodeTracer
returns the correct revert reason for reverting HTS calls by taking the right contract action with the index that is tracked:contract/results/{transactionIdOrHash}/opcodes
endpoint to replay the transaction and debug theOpcodeTracer
to verify that thecontractActionIndexOfCurrentFrame
is correct when we hit thetracePrecompileCall
method for the HTS callsAlternatives
No response