mattlockyer / composables-998

An implementation and documentation repo for developing the ERC-998 standard for Ethereum.
MIT License
103 stars 64 forks source link

onERC721Received uses too much gas #2

Closed mudgen closed 6 years ago

mudgen commented 6 years ago

onERC721Received calls the childReceived function which writes 5 words to storage which costs 100,000 gas. But the ERC721 standard requires that the onERC721Received function use no more than 50,000 gas

mudgen commented 6 years ago

But it looks like the 50,000 gas limit might get removed from the ERC721 standard: https://github.com/ethereum/EIPs/pull/1125

mattlockyer commented 6 years ago

There's currently no way around the extra book keeping in order to also support enumerability for wallets.

Do you know why the standard has an arbitrary limit of 50k?

Do you have any ideas?

I was thinking of making enumerable abstract for erc20 and erc721 so it would be optional.

At the end of the day, a standard can really only go as far as the interface. If a 998 looks like a 721 and has the same signatures it will be usable by wallets, exchanges and applications all the same.

mudgen commented 6 years ago

I think the arbitrary limit of 50,000 gas is to prevent contracts from abusing the call into them and perhaps to prevent reentry attacks.

I emailed @fulldecent about getting that limit removed.

mudgen commented 6 years ago

The 50,000 gas limit was removed from the ERC721 standard!