You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently ink! messages and constructors are required to be Sized and scale::Decode.
This means that ink! messages and constructors that take simple references are not allowed, e.g.:
This is a downside with respect to Wasm file sizes since in Wasm references are 32-bit sizes while types such as Balance and AccountId have massive sizes that force Wasm to costly put them on the shadow stack. This produces badly performing Wasm code as well as bloats the resulting Wasm binary.
In order to counteract this slightly users currently can add private methods that take their arguments by references where the ink! messages and constructors immediately forward to. This has the downside of mostly repeating the APIs over and over again in those common cases.
For ink! we should do better and allow ink! messages and constructors to take their arguments as references.
This could work by making ink! aware of input reference parameters and adjust ink! codegen in a way that the ink! message and constructor decoders forward their arguments in ExecuteMessage and ExecuteConstructor by reference using the ref Rust keyword.
This requires to adjust the ink_lang_ir and ink_lang_codegen crates.
The text was updated successfully, but these errors were encountered:
Currently ink! messages and constructors are required to be
Sized
andscale::Decode
.This means that ink! messages and constructors that take simple references are not allowed, e.g.:
This is a downside with respect to Wasm file sizes since in Wasm references are 32-bit sizes while types such as
Balance
andAccountId
have massive sizes that force Wasm to costly put them on the shadow stack. This produces badly performing Wasm code as well as bloats the resulting Wasm binary.In order to counteract this slightly users currently can add private methods that take their arguments by references where the ink! messages and constructors immediately forward to. This has the downside of mostly repeating the APIs over and over again in those common cases.
For ink! we should do better and allow ink! messages and constructors to take their arguments as references.
This could work by making ink! aware of input reference parameters and adjust ink! codegen in a way that the ink! message and constructor decoders forward their arguments in
ExecuteMessage
andExecuteConstructor
by reference using theref
Rust keyword.This requires to adjust the
ink_lang_ir
andink_lang_codegen
crates.The text was updated successfully, but these errors were encountered: