aionnetwork / AVM

Enabling Java code to run in a blockchain environment
https://theoan.com/
MIT License
49 stars 25 forks source link

Energy value balance of one account increases after this account deploys and calls one dapp #339

Closed zhikezhang closed 5 years ago

zhikezhang commented 5 years ago

Reproducing it in this way:

  1. create a new account.
  2. transfer energy 1.0×10¹⁸ to this account from primined account.
  3. use this account to deploy one dapp.
  4. use this account to call the dapp just deployed. Finally, check the balance of this account as the following. You would see the balance is 0x110b541b6392b000 which is 1.2281678×10¹⁸ . It is bigger than before.

    $ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0xa02740b2fefc1c174ba97bee879e87e2a13a9cc4b68ab589ce846cc74414078b", "latest"],"id":1}' 127.0.0.1:8545 {"result":"0x110b541b6392b000","id":1,"jsonrpc":"2.0"}

aionick commented 5 years ago

I will try producing this using various accounts. It could be that the sender is a miner and in that time has collected enough mining fees to negative the value it transferred, and then some.

aionick commented 5 years ago

This is a bug on the kernel side. The kernel refunds the sender after the transaction finishes; however, the AVM is supposed to take care of this (and it does). So we get a double refund, actually increasing your account balance.

I will post the fix to this on the kernel side, on the branch we are using for the avm testnet.