Skip to content

eth: fix debug.storageRangeAt return value#15476

Merged
fjl merged 2 commits into
ethereum:masterfrom
mexskican:fix-storage-range
Dec 6, 2017
Merged

eth: fix debug.storageRangeAt return value#15476
fjl merged 2 commits into
ethereum:masterfrom
mexskican:fix-storage-range

Conversation

@mexskican
Copy link
Copy Markdown
Contributor

This PR Fixes #15196

  • debug.storageRangeAt uses the rlp.Split function to return the content of the RLP values.
  • Modify the test function in the case Split returns an error.

To test this PR I deployed on Rinkeby this contract:

contract test {
    uint v = 128;
}

The modification can be checked with this call:

> debug.storageRangeAt("0xd1a9569e5b5a482db6ac6c2a9fc9eddc58f49be1b8c4bff7c638239993708ceb", 0, "0xb9f998b90b2bfe93f0f34a2db45c3f70938d4fb7", "0x", 1)

It should return 0x80 instead of 0x8180 before.

StorageRangeAt use the Split function to decode the values.
@holiman
Copy link
Copy Markdown
Contributor

holiman commented Nov 15, 2017

Could you check (with the fix) the values returned for empty value?

@holiman holiman requested a review from fjl November 15, 2017 08:57
@mexskican
Copy link
Copy Markdown
Contributor Author

With the fix an empty value returns an empty storage array:

contract Test {
    string name = "";
}

Deployed on Rinkeby at : 0x649167b3818bd0a017f84a6321ea6b1755595aa5

> debug.storageRangeAt("0xa30c48206acf4da0e770df44d9f5a3ff59c742ede5362d3e2035ab2ce46c795c", 0, "0x649167b3818bd0a017f84a6321ea6b1755595aa5", "0x", 1)
{
  nextKey: null,
  storage: {}
}

This is the expected behavior right?

Copy link
Copy Markdown
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but @fjl please verify

@mexskican
Copy link
Copy Markdown
Contributor Author

ping @fjl

@fjl fjl merged commit eab2201 into ethereum:master Dec 6, 2017
@karalabe karalabe added this to the 1.8.0 milestone Dec 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants