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
Testing a smart contract on-chain is currently very hard.
There are no debuggers available nor can a developer currently even make use of simple println debugging.
By adding a println external function we could at least fairly easy implement some println debugging facilities - better than nothing!
However, having those println calls in real on-chain smart contracts would be catastrophic.
They must not be used in non---dev chains - this should be checked in an upcoming eDSL as well as on the substrate side upon PUT_CODE.
For this to implement we need to also adjust the substrate SRML-contracts interface and workings.
A simple approach would be to add another flag to SRML-contracts indicating whether ext_println should be enabled. This must only be true if the current environment is a --dev chain.
The eDSL must make sure that ext_println is only available if there was a debug opt-in.
To do this we need to add another crate feature that smart contract developers could enable to actually make use of ext_println. Otherwise using ext_println will be a compile error.
The text was updated successfully, but these errors were encountered:
Contract is able to raise custom events now, is it possible to repurpose it to emit logging events?
So there will be a a log macro that does nothing in release build but emit a logging event in debug build
For debuggability we cannot rely on events since they do not guarantee ordered dispatch.
So @ascjones is currently implementing the ext_println mechanics that are going to be dev chain only.
I think we could more or less rely on the ordering, however, the more apparent problem is that events are discarded when the execution fails which might not be useful for debugging failures : )
Testing a smart contract on-chain is currently very hard.
There are no debuggers available nor can a developer currently even make use of simple
println
debugging.By adding a
println
external function we could at least fairly easy implement someprintln
debugging facilities - better than nothing!However, having those
println
calls in real on-chain smart contracts would be catastrophic.They must not be used in non-
--dev
chains - this should be checked in an upcoming eDSL as well as on the substrate side uponPUT_CODE
.For this to implement we need to also adjust the substrate SRML-contracts interface and workings.
A simple approach would be to add another flag to SRML-contracts indicating whether
ext_println
should be enabled. This must only be true if the current environment is a--dev
chain.The eDSL must make sure that
ext_println
is only available if there was adebug
opt-in.To do this we need to add another crate feature that smart contract developers could enable to actually make use of
ext_println
. Otherwise usingext_println
will be a compile error.The text was updated successfully, but these errors were encountered: