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

Example run-transactions-complete, not printing storage content #234

Closed
blintgit opened this issue Nov 20, 2017 · 7 comments
Closed

Example run-transactions-complete, not printing storage content #234

blintgit opened this issue Nov 20, 2017 · 7 comments

Comments

@blintgit
Copy link

Running the example mentioned in the title, there is no output after the "---Storage---" line. According to my understanding, there should be a null_radix stored at the created address. (running gives no exceptions)
Please correct me if I'm wrong! Thanks

@blintgit
Copy link
Author

[update]

At the following part of the example at the runTx function I've noticed that we refresh the createdAddress variable at every transaction even though it doesn't register a new contract. Therefore it leaves us with the loss of our contract's address and the readStorage function won't print any output.

I've fixed it by checking the createdAddress property for null before saving the value.

if (returns.createdAddress) {
  createdAddress = results.createdAddress
  console.log('address created: ' +
      createdAddress.toString('hex'))
}

@holgerd77 holgerd77 changed the title examples run-transaction complete, not printing storage content examples run-transactions-complete, not printing storage content Nov 21, 2017
@holgerd77 holgerd77 changed the title examples run-transactions-complete, not printing storage content Example run-transactions-complete, not printing storage content Nov 21, 2017
@holgerd77
Copy link
Member

Hi @blintgit, maybe wait up a couple of more contributions before talking in the "we" form, this is a bit irritating. :-)

That said: good catch, can you prepare a PR with your proposed changes?

@blintgit
Copy link
Author

Yes, I'm preparing the PR asap. Thanks

@hswick
Copy link

hswick commented Dec 14, 2017

returns is not a defined variable, believe you meant results. However, this doesn't seem to fix the issue for me.

@rosulucian
Copy link

rosulucian commented Jan 4, 2018

same as @hswick :
i added
if (!createdAddress) { createdAddress = results.createdAddress }

so the address would not reset but I stil get an empty trie and no storage is printed

@rosulucian
Copy link

rosulucian commented Jan 5, 2018

I had another look at it and after calling runCode I tried getting the account so I can read it`s trie by calling either stateTrie.get(createdAddress) or res.runState.stateManager.getAccount(res.runState.address) but I only get an empty account, i.e. codehash is SHA3_NULL_S and stateRoot is SHA3_RLP_S.

Then I tried to get the storage trie through res.runState.stateManager._getStorageTrie(res.runState.address) and for some reason you can still find it in the state manager (idk why it has two caches?!) it just didn`t commit somehow.

@holgerd77
Copy link
Member

Fixed by #550, will close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants