Experimental ABI Encoder

Hi all! I wanted to ask general opinions about using the Experimental ABI Encoder in production apps. I asked on the Discord, and was told this would be the better forum.

The first obvious gain of the encoder is being able to return structs normally. I honestly don’t know much else about it.

In general, putting something labelled “experimental” in production, especially on Ethereum where the stakes are more immutable on oftentimes high, I’m curious what those better versed in security than me.


1 Like

Hi @wschwab,

Welcome to the community :wave:

Thanks for posting in the forum.

According to the Solidity documentation:

Because the ABI coder v2 is not considered experimental anymore, it can be selected via pragma abicoder v2 (please see above) since Solidity 0.7.4.

From: https://docs.soliditylang.org/en/v0.8.2/layout-of-source-files.html?highlight=experimental#abiencoderv2

lol, I’d missed that.

Why doesn’t it ship by default then? Returning structs is pretty useful.

1 Like

Actually, the docs you linked cover that too:

It might produce less optimal code and has not received as much testing as the old encoder

I assume “less optimal code” means less optimized bytecode?

1 Like

Hi @wschwab,

I assume potentially more expensive in terms of gas.

This might be a good question for the Solidity forum: https://forum.soliditylang.org/

1 Like