EOSIO / eosio.contracts

Smart contracts that provide some of the basic functions of the EOSIO blockchain
https://eosio.github.io/eosio.contracts/latest
MIT License
326 stars 415 forks source link

Add setalimits onto system contract #45

Closed wanderingbort closed 6 years ago

wanderingbort commented 6 years ago

Relayed for @jchung00 from EOSIO/eos#5174

Currently, there doesn't seem to be a way to grant new accounts in the network unlimited resources (once the system contract has been deployed to eosio). Therefore, new eosio.* accounts such as eosio.sudo and eosio.wps will need tokens to be staked and RAM bought separately.

We've tested that the setpriv action doesn't actually grant an account unlimited resources. Even though the account will show up as privileged, it will still run into problems when not enough tokens are staked and/or insufficient RAM has been bought for the account. (Check screenshot)

screen shot 2018-08-09 at 5 05 30 pm

Accounts such as eosio.token and eosio.names are not privileged. However, they were created by the eosio account during launch, when the eosio was set to the eosio.bios contract. The resource limits for these accounts were set to -1, which gives them unlimited network resources.

In order to allow new community owned eosio.* accounts to receive unlimited network resources, there has to be some action in the system contract that calls the set_resource_limits function. It seems like setalimits actually exists in the abi of the system contract (https://github.com/EOSIO/eos/blob/369c7e31e17630e1327a48869b832635352a27f4/contracts/eosio.system/eosio.system.abi#L506).

However, the action isn't implemented in the system contract-- it is only defined in the eosio.bios contract here: https://github.com/EOSIO/eos/blob/7271924b476fb58c82e2481bb2d06c558bb74215/contracts/eosio.bios/eosio.bios.hpp#L16

Would it make sense to define the setalimits action in the system contract as well (with require_auth(_self);), in order to make it possible for newly created eosio.* accounts to receive unlimited network resources by using eosio permissions?**

jchung00 commented 6 years ago

Has there been any progress on this? What are the thoughts?

wanderingbort commented 6 years ago

In #54 , we ended up going in a different direction which was to consider the concept of unlimited accounts dangerous on a chain that implements the RAM market and CPU/NET staking paradigm. We added in setalimits however, it can only be used to manage the resources of the grandfathered accounts on a chain and more specifically to limit them to their needs as opposed to making them unlimited.

We have also made several structural changes to the other contracts as a result of the decision to back away from unlimited accounts so that they operate more clearly WRT resources.

At this time, I do not think we will support direct management of the resource allocation for an account that participates in the market(s) as it adds too much complexity.