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 a contract's constructor-inputs are kept in the artifact as constructorInputs, and not repeated in the bytecode property on the artifact because they are assumed to be put in front of the bytecode (in reversed order).
For developers who want to hand-optimize their contracts, they will often not have these constructorInputs at the beginning.
To support constructorInputs at any place on the stack, we should allow for a templating syntax in the bytecode field.
For hand optimized contracts the debug info will be non existent, so they won't be able to leverage the debug tooling.
This change would make it easy for developers to still continue using the CashScript SDK for transaction building even for hand optimized contracts.
These changes are a precursor to 'enable placing constructor params in any part of function body' (#156) but don't necessarily require any changes to the cashscript contract language itself.
The text was updated successfully, but these errors were encountered:
Because all variables are just inserted once in the contract above, right before their first usage, this could easily be done automatically by the compiler.
Then we don't need a marker for TemplateVariable as all constructor params would get inserted into the contract.
Having multiple insertions of the same constructor variable would still be a manual optimization.
related discussion: 'enable placing constructor params in any part of function body' #156
Another issue is that as soon as there are multiple abi functions, the SDK knows to use a functionIndex unlocking parameter automatically, however hand-optimized contracts will often not have this.
So for proper support of hand optimized/ hand crafted artifact bytecode, there shouldn't be any hidden functionIndex magic going on, everything should be made explicit and opt-out
Currently a contract's constructor-inputs are kept in the artifact as
constructorInputs
, and not repeated in thebytecode
property on the artifact because they are assumed to be put in front of the bytecode (in reversed order).For developers who want to hand-optimize their contracts, they will often not have these
constructorInputs
at the beginning.To support
constructorInputs
at any place on the stack, we should allow for a templating syntax in thebytecode
field.For hand optimized contracts the
debug
info will be non existent, so they won't be able to leverage the debug tooling.This change would make it easy for developers to still continue using the CashScript SDK for transaction building even for hand optimized contracts.
These changes are a precursor to 'enable placing constructor params in any part of function body' (#156) but don't necessarily require any changes to the cashscript contract language itself.
The text was updated successfully, but these errors were encountered: