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

EVM-778 Debug Transaction endpoint - use one structure for logs #1817

Merged
merged 1 commit into from
Aug 16, 2023

Conversation

igorcrevar
Copy link
Contributor

@igorcrevar igorcrevar commented Aug 16, 2023

Description

Use only one structure for logs to reduce memory consumption.

Prior to these changes, there was an additional slice of objects that stored information about each step's execution. That slice was later on converted into json response slice of different objects. That caused additional memory consumption without any special reason.

Additionally, omitempty is added for fields

Stack           []string          `json:"stack,omitempty"`
Memory       []string          `json:"memory,omitempty"`
Storage       map[string]string `json:"storage,omitempty"`

and that will reduce json output in case when those fields are empty or disabled by json request input parameters (disableStack, disableStorage, enableMemory).

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)

Checklist

  • I have assigned this PR to myself
  • I have added at least 1 reviewer
  • I have added the relevant labels
  • I have updated the official documentation
  • I have added sufficient documentation in code

Testing

  • I have tested this code with the official test suite
  • I have tested this code manually

Manual tests

Start cluster, deploy smart contract(s) and transaction that calls some of those sc. 0x09e60436fc2344c03ef2c721dcb179d2e9cb4cecf535f1217f25abe24ea37dc6 is hash of that transaction and that is the tx you want to debug.
Try to execute following endpoint request. You should get the same json response as with old code (minus that in newest version empty fields will be omitted)

[{
	"jsonrpc":"2.0",
	"method":"debug_traceTransaction",
	"params":[
        "0x09e60436fc2344c03ef2c721dcb179d2e9cb4cecf535f1217f25abe24ea37dc6",
        {
            "timeout": "30s",
            "disableStack": false,
            "disableStorage": false,
            "enableMemory": true,
            "enableReturnData": true
        }
	],
	"id":1
}]

@igorcrevar igorcrevar added the feature New update to Polygon Edge label Aug 16, 2023
@igorcrevar igorcrevar requested a review from a team August 16, 2023 08:12
@igorcrevar igorcrevar self-assigned this Aug 16, 2023
@Nemanja0x Nemanja0x self-requested a review August 16, 2023 10:46
@igorcrevar igorcrevar merged commit b302fdb into develop Aug 16, 2023
6 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Aug 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New update to Polygon Edge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants