smartcontractkit / near-protocol-contracts

MIT License
26 stars 8 forks source link

Clarify storage fees #6

Open krebernisak opened 4 years ago

krebernisak commented 4 years ago

An extra storage fee payment was added in Update fungible token, fix u64 pull request, to compensate for and prevent a denial of service attack on the contract by taking all available storage. This storage fee is additional to the gas fee paid for transaction processing.

This is the comment by @mikedotexe on the PR:

... takes special care to make sure end users cannot bloat the contract with data such that it can be exploited to where the cost of storage on the PoS becomes prohibitively expensive. To add state to this contract, the end-user must essentially "pay their way" essentially.

This is the comment by the NEAR team:

There are several reasons. One is the storage write cost, at the current gas price, is significantly lower than the price per byte for occupying the storage. If you are talking about the gas cost rebate, you need the transaction cost to be 3x higher than the cost of occupying storage to make it work. I don’t think we are close to that by any means

And here is another perspective from @thodges-gh:

If possible, we should set a reasonable but somewhat high default for this, and not yet require extra payment for additional storage. For context, in the CL node, we hard-code a gas limit of 500k when responding to requests. We've had a discussion about allowing requesters to specify a callback gasLimit, but there are economic concerns around how to implement that (like how much to charge and in LINK or ETH?).

Let's open this issue for discussion.

mikedotexe commented 4 years ago

So I believe paying for storage with gas is not possible, but I wasn't able to get a lot more information out of folks. One suggestion from a core member at NEAR suggested an alternative might be to "pay" for storage with the fungible token (NEAR LINK) It's my opinion that we should keep paying with NEAR tokens for storage. Sorry I don't have the greatest information on this, but I tried. :)