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

Implement opcode logger tracing logic #8173

Open
Tracked by #6781
georgi-l95 opened this issue Apr 25, 2024 · 0 comments
Open
Tracked by #6781

Implement opcode logger tracing logic #8173

georgi-l95 opened this issue Apr 25, 2024 · 0 comments
Assignees
Labels
enhancement Type: New feature limechain Work planned for the LimeChain team web3 Area: Web3 API

Comments

@georgi-l95
Copy link
Contributor

georgi-l95 commented Apr 25, 2024

We are currently able to simulate transaction using the web3 module in the mirror-node. However we does not track and set anywhere the logs from executions in the form of opcodes.
As first step we should create a new list in the ContractCallContext, which is a list of objects with the following fields:

pc — the current program counter of the transaction, which represents the location of the current opcode being executed. A register that keeps track of the address of the next instruction to be executed in a program.
op — the current being executed, such as PUSH1, ADD, or SWAP1. A code that represents a specific operation or instruction that a computer or processor can understand and execute.
gas — the amount of gas remaining in the transaction at the current step of execution.
gasCost — the amount of gas consumed by the current opcode being executed.
depth — the current depth of the call stack for the transaction, reflecting the number of active frames representing nested function calls.
stack — the contents of the EVM stack at the current step of the transaction's execution. The stack is a data structure used by the EVM to manage and manipulate data during the execution of opcodes
memory — the contents of the memory at the current step of execution. A temporary data storage location that is available to smart contracts during execution.

We can reuse most of the flow used for calls, but we'd have to have our own implementation of the tracePrecompileCall, which will happen when we implement OperationTracer interface. Then for the current stack we can get the opcode using currentFrame.getCurrentOperation().getOpcode() and push inside the list we previously created in the ContractCallContext.

For Hedera Precompiles is more complex, as this approach won't work. If they are not successfull, we will populate wrong opcodes, therefore we'd need to check the sidecars for their result and set the opreration as REVERT at the right moment, in order to simulate the transaction 100% correctly.

@georgi-l95 georgi-l95 added web3 Area: Web3 API limechain Work planned for the LimeChain team enhancement Type: New feature labels Apr 25, 2024
@konstantinabl konstantinabl linked a pull request May 7, 2024 that will close this issue
2 tasks
victor-yanev added a commit that referenced this issue May 15, 2024
Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
victor-yanev added a commit that referenced this issue May 15, 2024
Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
victor-yanev added a commit that referenced this issue May 15, 2024
Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Type: New feature limechain Work planned for the LimeChain team web3 Area: Web3 API
Projects
Status: Tasks In Progress
Development

Successfully merging a pull request may close this issue.

3 participants