Contract size limit of 100kb too small

This is a follow-up to @sandusky’s reply here:

HI there @theAusicist
It is not possible to deploy contracts beyond gas limit.

Please be aware that during our testnet, the limit will be 100kb as seen here .

imo, this is too small a bytecode size limit especially considering the Sway compiler spits out quite large bytecode (even with the --release flag) .

as already expressed above, I have a contract which is approx ~0.5-0.6mb in size (final release bytecode size). This obv crosses the new 100kb limit restriction.

As an example, for a contract method approx 160 lines (no external contract calls; fair amount of storage reads/writes…), the Sway compiler outputs a bytecode of size 80kb which is getting close to the new 100kb limit – must I have one contract deployed per fn? To effectively, have the same contract I have, but be within the size limit, I’d need to have 1 access-restricted storage read/write hub, and 5 other contracts with one fn each and external contract calls to read/write to the storage hub. seems quite limiting.

something like a 1-2Mb limit seems rather appropriate, but what do y’all think? This is the currently the largest bottleneck hindering us from deploying on testnet following a 5 month development period.

related: Compiled contracts are large

would love to get your inputs on this @calldelegation @bitzoic @sandusky

In the short-term, I’d suggest getting in touch with us over DM if you can’t share the code publicly. We can advise on how to resolve your size issues, either by a different design or by trying to figure out a strategy that will work along the roadmap.

On the roadmap, in the short-term the compiler team is working on generally reducing code size due to encoding changes. In the mid-term we are looking at better support for loading external code. In the long-term, we should have some very good library and external code loading strategies which should work for you.

hi @nick – great to hear from you.

ordinarily, I’d be happy to wait this out. Building something like this is no joke and takes time, but we’d like to get something out as soon as possible, and this is currently our biggest limitation.

how can I best reach out? Discord?

Just shot you a DM @theAusicist

1 Like