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

Improve VM trace #785

Merged
merged 2 commits into from Mar 20, 2019

Conversation

Projects
None yet
5 participants
@ajlopezrsk
Copy link
Contributor

commented Mar 18, 2019

If the VM trace is activated in configuration file using:

vm.structured {
    trace = true
    dir = vmtrace
    compressed = false
    initStorageLimit = 10000
}

the output of a contract execution is more aligned to geth debug transaction output (rename fields, new fields, etc):

{
  "contractAddress" : "77045e71a7a2c50903d88e564cd72fab11e82051",
  "initStorage" : {
    "290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563" : "000000000000000000000000cd2a3d9f938e13cd947ec05abc7fe734df8dd826",
    "0000000000000000000000000000000000000000000000000000000000000000" : "0000000000000000000000000000000000000000000000000000000000000003",
    "290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e564" : "0000000000000000000000007986b3df570230288501eea3d890bd66948c9b79",
    "290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e565" : "0000000000000000000000000a3aa774752ec2042c46548456c094a76c7f3a79"
  },
  "structLogs" : [ {
    "op" : "PUSH1",
    "depth" : 0,
    "pc" : 0,
    "gas" : 4977320,
    "gasCost" : 3,
    "memory" : [ ],
    "stack" : [ ],
    "storage" : {
      "0000000000000000000000000000000000000000000000000000000000000000" : "0000000000000000000000000000000000000000000000000000000000000003",
      "290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563" : "000000000000000000000000cd2a3d9f938e13cd947ec05abc7fe734df8dd826",
      "290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e564" : "0000000000000000000000007986b3df570230288501eea3d890bd66948c9b79",
      "290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e565" : "0000000000000000000000000a3aa774752ec2042c46548456c094a76c7f3a79"
    }
  }, {
    "op" : "PUSH1",
    "depth" : 0,
    "pc" : 2,
    "gas" : 4977317,
    "gasCost" : 3,
    "memory" : [ ],
    "stack" : [ "0000000000000000000000000000000000000000000000000000000000000080" ],
    "storage" : {
      "0000000000000000000000000000000000000000000000000000000000000000" : "0000000000000000000000000000000000000000000000000000000000000003",
      "290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563" : "000000000000000000000000cd2a3d9f938e13cd947ec05abc7fe734df8dd826",
      "290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e564" : "0000000000000000000000007986b3df570230288501eea3d890bd66948c9b79",
      "290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e565" : "0000000000000000000000000a3aa774752ec2042c46548456c094a76c7f3a79"
    }
  }, {

  //...
  
    } ],
  "result" : "0000000000000000000000000000000000000000000000000000000000000001",
  "error" : "",
  "storageSize" : 5,
  "currentStorage" : {
    "0000000000000000000000000000000000000000000000000000000000000000" : "0000000000000000000000000000000000000000000000000000000000000004",
    "290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563" : "000000000000000000000000cd2a3d9f938e13cd947ec05abc7fe734df8dd826",
    "290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e566" : "000000000000000000000000cf7cdbbb5f7ba79d3ffe74a0bba13fc0295f6036",
    "290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e564" : "0000000000000000000000007986b3df570230288501eea3d890bd66948c9b79",
    "290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e565" : "0000000000000000000000000a3aa774752ec2042c46548456c094a76c7f3a79"
  }
}


ajlopez added some commits Jan 28, 2019

@rskops

This comment has been minimized.

Copy link

commented Mar 19, 2019

SonarQube analysis reported 21 issues

  • CRITICAL 6 critical
  • MAJOR 11 major
  • MINOR 3 minor
  • INFO 1 info

Top 10 issues

  1. CRITICAL Op.java#L1: Class org.ethereum.vm.trace.Op creates and initializes a collection but never reads or gains information from it rule
  2. CRITICAL Op.java#L1: Class org.ethereum.vm.trace.Op creates and initializes a collection but never reads or gains information from it rule
  3. CRITICAL Op.java#L35: Remove this unused "depth" private field. rule
  4. CRITICAL Op.java#L36: Remove this unused "pc" private field. rule
  5. CRITICAL Op.java#L38: Remove this unused "gasCost" private field. rule
  6. CRITICAL Op.java#L42: Remove this unused "storage" private field. rule
  7. MAJOR VM.java#L1920: The Cyclomatic Complexity of this method "steps" is 11 which is greater than 10 authorized. rule
  8. MAJOR Op.java#L42: Class org.ethereum.vm.trace.Op defines fields that are used only as locals rule
  9. MAJOR Op.java#L42: Unread field: org.ethereum.vm.trace.Op.storage rule
  10. MAJOR Op.java#L53: Class org.ethereum.vm.trace.Op defines fields that are used only as locals rule
@lsebrie
Copy link
Contributor

left a comment

LGTM

@aeidelman aeidelman merged commit 53424ad into master Mar 20, 2019

2 of 3 checks passed

sonarqube SonarQube reported 21 issues, with 6 critical
ci/circleci Your tests passed on CircleCI!
Details
default Build finished.
Details

@aeidelman aeidelman deleted the vmtracemaster branch Mar 20, 2019

@aeidelman aeidelman added this to the Orchid v0.6.2 milestone Apr 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.