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

Falsely says sender account has 0? #102

Closed
simondlr opened this issue Nov 2, 2016 · 6 comments
Closed

Falsely says sender account has 0? #102

simondlr opened this issue Nov 2, 2016 · 6 comments

Comments

@simondlr
Copy link

simondlr commented Nov 2, 2016

Hi. Not entirely sure where to post this, but I assume it's a vm error.

I updated testrpc to contain the latest version of ethereumjs-vm (2.0.1) in order to get around these issues I started encountering wrt invalid jumps (trufflesuite/ganache-cli-archive#196, #88).

However, now I get this error. I verified that all accounts have funds in them. So not sure where the issue is coming from. Either testrpc isn't passing the right address through OR the vm is screwing up here?

Error: Error: sender doesn't have enough funds to send tx. The upfront cost is: 471238800000000000 and the senders account only has: 0
    at runCall (/Users/simondlr/.nvm/versions/node/v6.9.1/lib/node_modules/ethereumjs-testrpc/node_modules/ethereumjs-vm/lib/runTx.js:97:10)

Any help?

@axic
Copy link
Member

axic commented Nov 2, 2016

Can you double check tx.from? And perhaps check with the git master? (It has some other cleanup regarding the padding - leading zeroes.)

@simondlr
Copy link
Author

simondlr commented Nov 2, 2016

I tried master and didn't work. Trying to debug further now, but I don't quite understand the buffers.

Using --deterministic on testrpc. Thus the first account is:

(0) 0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1

And when tx.from & fromAccount I get:

from:
<Buffer 90 f8 bf 6a 47 9f 32 0e ad 07 44 11 a4 b0 e7 94 4e a8 c9 c1>
from2:
{ raw:
   [ <Buffer >,
     <Buffer >,
     <Buffer 56 e8 1f 17 1b cc 55 a6 ff 83 45 e6 92 c0 f8 6e 5b 48 e0 1b 99 6c ad c0 01 62 2f b5 e3 63 b4 21>,
     <Buffer c5 d2 46 01 86 f7 23 3c 92 7e 7d b2 dc c7 03 c0 e5 00 b6 53 ca 82 27 3b 7b fa d8 04 5d 85 a4 70> ],
  _fields: [ 'nonce', 'balance', 'stateRoot', 'codeHash' ],
  toJSON: [Function],
  serialize: [Function: serialize],
  nonce: [Getter/Setter],
  balance: [Getter/Setter],
  stateRoot: [Getter/Setter],
  codeHash: [Getter/Setter],
  exists: false }

I'm assuming the first buffer (tx.from) means it is actually sending the right address through. I'm not sure what the second log gives me.

This is after: var fromAccount = self.stateManager.cache.get(tx.from)

I used Metamask to check the balance, and it confirms that it has ETH in it.

@mhhf
Copy link
Contributor

mhhf commented Nov 2, 2016

@simondlr
I had this problem myself and resolved it on my branch: trufflesuite/ganache-cli-archive#179

I think this was the solution: https://github.com/nexusdev/testrpc/blob/feature/persistent/lib/blockchain_double.js#L125
but I'm not 100% sure about this. Can look it up if this don't work for you.

@simondlr
Copy link
Author

simondlr commented Nov 2, 2016

@mhhf glad to hear you had the same problem! The current testrpc blockchain_double to your blockchain_double is very different. Added that line at the end of initialize in blockchain_double, but didn't help. Next bet is to use your fork + new vm to see if that works.

The reason why I believe it is the vm vs testrpc is because installing the new vm version (2.0.1) for testrpc caused this error to start occurring.

Any further help is appreciated.

@simondlr
Copy link
Author

simondlr commented Nov 2, 2016

Thanks a lot for your help @mhhf. I fixed it. The interface did indeed change and I opened up an issue in testrpc.

trufflesuite/ganache-cli-archive#197

@simondlr simondlr closed this as completed Nov 2, 2016
@guisantos
Copy link

I have the same issue when i'm trying to send a transaction, any guidance?
image

holgerd77 added a commit that referenced this issue Mar 11, 2021
…sers-2.2.6

Update karma-detect-browsers to the latest version 🚀
ryanio added a commit that referenced this issue Jan 10, 2022
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