Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.

eosio::buyrambytes doesn't provide the exact amount requested #30

Open
aaroncox opened this issue Feb 2, 2021 · 1 comment
Open

eosio::buyrambytes doesn't provide the exact amount requested #30

aaroncox opened this issue Feb 2, 2021 · 1 comment

Comments

@aaroncox
Copy link

aaroncox commented Feb 2, 2021

We recently discovered that when trying to buy precise amounts of RAM, the amount of RAM actually provided from eosio::buyrambytes is less than what was requested.

Based on the comment here, I assume the intention is to provide a precise way to purchase a specific amount of RAM:

https://github.com/EOSIO/eosio.contracts/blob/d7bc0a5cc8c0c2edd4dc61b0126517d0cb46fd94/contracts/eosio.system/src/delegate_bandwidth.cpp#L22-L25

This transaction:

https://bloks.io/transaction/44d1367ce6918fcff4c7b0ef8905aafc2aea0ce4f2e0730d32799fe01a84a004

{
  "account": "eosio",
  "name": "buyrambytes",
  "authorization": [
    {
      "actor": "test.gm",
      "permission": "active"
    }
  ],
  "data": {
    "bytes": 400,
    "payer": "test.gm",
    "receiver": "test.gm"
  }
}

Resulted in the purchase of 396 bytes of RAM. I am assuming this has to do both with the token precision (4,EOS) and potentially the 0.5% system fee from purchasing.

We very recently have begun systematically purchasing precise amounts of RAM for use as a Resource Provider (before and after account creation) and the inability to accurately purchase amounts of RAM has caused a few problems.

If there's an upcoming system contract upgrade that a fix for this could be included in - it would be appreciated!

@deckb deckb transferred this issue from EOSIO/eosio.contracts Apr 21, 2021
@deckb
Copy link
Contributor

deckb commented Apr 21, 2021

Transferring to new repo.

Also found this little nugget.

* It seems impossible to write this test, because buyrambytes action doesn't give you exact amount of bytes requested

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

No branches or pull requests

2 participants