Constants vs expressions โ
It is usually quite natural when an expression needs to be computed on-chain versus a readily available constant.
By default, SmartPy fully computes at compile time expressions that are put in the storage.
However, this behavior is not always desired or even possible.
Some specific expressions (such as sp.make_signature
, see Signatures) need to be computed at compile time since there is no corresponding construction in Michelson. This is done automatically for mandatory cases.
This computation can be forced by using sp.resolve(..)
.
python
sp.resolve(e)
Forces computation of e
at compile time.