Removing or Increasing the Contract Size Limit

I am still wrangling with the data on the stateless client, to complete my post, but I would propose (in the 4th version of State fees/rent proposal) to only introduce stateless clients approach for contract storage items. I am currently missing data on whether size of the block proofs (witnesses) for contract storage eventually overtook the block proof for accounts and for the code size, because at the block 5.4m those 3 components were roughly on par. That is it to say, that byte codes played significant part in the block proof, and increasing contract sizes can push it up even further.
Even if we were to go with the pagination approach, we need still look at the compilers to try to optimise the code so that the code of specific functions are partitioned well (i.e. usual function calls do not end up touching all the pages).

In general, I would approach this proposal with caution, and also in the context of other EIPs that propose to change EVM, most notable EIP-615. I would definitely welcome more research.

For example, it was noted that the code of the contract is inflated by the PUSHx opcodes storing data inline in the code. Perhaps, the solution to this is to use DATA segment approach that has been introduced into EIP-615?

Another point - some of the desire to put lots of code into a single contract stems from the fact that this code wishes to access the same storage, without calling wrapper contracts. Currently, it is very appealing, because reading storage (SLOAD) cots 200 gas, and any call to a wrapper adds an extra cost of 700 gas to that, so it ends up being 900. But the cost of SLOAD is likely to be increased 4x or 5x, because it is overpriced, so the relative win from co-locating the storage would decrease.

2 Likes

For example, it was noted that the code of the contract is inflated by the PUSHx opcodes storing data inline in the code. Perhaps, the solution to this is to use DATA segment approach that has been introduced into EIP-615?

As I understand, the DATA will still be part of the code and require to be fetched so it shouldn’t really affect the total code size by much. It will reduce the verification time though.

reading storage (SLOAD) cots 200 gas, and any call to a wrapper adds an extra cost of 700 gas to that, so it ends up being 900

Actual overhead is around 1500-2500 because we can’t directly access the storage of other contracts. We need to call a function in the external contract that will return the data we need (Applies to delegatecalls as well). The copying of data also ads to the cost. even if SLOAD costs are increased to 1000, it will still be 50% cheaper.

In general, I would approach this proposal with caution, and also in the context of other EIPs that propose to change EVM, most notable EIP-615. I would definitely welcome more research.

I totally agree with this.

IELE provides just the natural numbers, but I think it has fused mod operators like the EVM to work in any fixed modulus. Since the hardware supports fixed-width scalars and vectors of power-of-two sizes it makes sense to abstract that model, but EIP-616 is on hold as we wait for the Wasm spec for wide SIMD. eWasm will get SIMD by default when Wasm does; natural numbers could be coded as HLL libraries.

Part of the problem is that the higher-level concept corresponding to contracts with delegatecall isn’t the subroutine but the coroutine. So you can’t directly translate a program consisting of subroutines into a collection of contracts, even in languages like Go and Python that support coroutines. But subroutines are a subset of coroutines, so it should be doable.

Because many times it’s mathematically impossible to work with this limit.
I got stuck trying to develop an simple state machine with minimum functionallity to represent a “quite-simple” business contract. Even after spliting/refactoring/proxyfing I found an stupid limit that doesn’t let me to make anything useful with Ethereum.
Paying more gas for more resources is the way to go, instead of arbitrary limits. Gas is a great idea, no need for anything else.

3 Likes