substrate icon indicating copy to clipboard operation
substrate copied to clipboard

Remove `seal_` prefixes from `contracts` API function identifiers

Open cmichi opened this issue 3 years ago • 2 comments

Introduce seal2 with the only change of removing the seal_ prefix from all pallet-contracts Wasm API functions.

Since all functions are prefixed with it anyway, the prefix is unnecessary and storing it on-chain as part of the function identifier is increasing the storage + user deposit + gas costs. The prefix is also an irritating thing for people looking into the pallet, we regularly get questions about this.

We would also get our ink! contracts a tiny bit smaller, for erc1155 it's about 50 bytes.

cmichi avatar May 18 '22 05:05 cmichi

Please keep in mind that we can't actually rename as this would break existing contracts. We would need to add another version with the prefix removed that does the same thing. Since that would add a lot of repetitive code it should be solved in the macro (like allowing alias names for a function). We probably want to solve https://github.com/paritytech/substrate/issues/11344 first.

athei avatar Jul 04 '22 07:07 athei

Blocked on #11344

athei avatar Jul 28 '22 00:07 athei

No longer blocked.

athei avatar Aug 22 '22 13:08 athei

Please keep in mind that we can't actually rename as this would break existing contracts.

Do we need to keep the seal_ prefixed aliases for __unstable__ versions though?

(for other versions the approach is nicely described here,
tl;dr: yes, we need it for all seal0,seal1,... versions of currently implemented host functions)

agryaznov avatar Aug 26 '22 15:08 agryaznov

No. We are allowed to break __unstable__ versions. So no need to generate versions with prefixes for backwards compatible.

athei avatar Aug 26 '22 15:08 athei

@athei @agryaznov This issue is closed, is this correct? If so, could you then please create a follow-up issues in ink for removing the seal_ prefixes from the FFI?

cmichi avatar Nov 05 '22 13:11 cmichi