how to write better code here?
According to Documentation.
Since a contract running on the chain will typically not be able to recover from panics, and error traces are not reported, it is useful not to bloat code size with them. Setting
panic=abort
will make it so that the compiler will generate simpleWasm
traps on any panic that occurs. This option can be specified either in.cargo/config
as exemplified in counter/.cargo/config, or in theCargo.toml
file as