feat: add padding keyword to increase program size - #226
Conversation
|
I'm not wild about it, but do see how it could be useful 🤷
It seems maybe the fee output value is being hardcoded either here or in hal-simplicity, while it should be calculated from If you're using |
|
Thanks, I managed to adjust the fee |
|
Concept ACK. Later when we fix this properly we can simply make the new keyword be a no-op. I think this is a good interim solution. |
67ceaa2 to
0c670f8
Compare
0c670f8 to
1b38ed5
Compare
|
Update: Changed the padding to use Also applied some changes suggested by LLM, such as the MaxPadding, which would cause a stack overflow. |
|
Amusingly this form of padding will be entirely stripped by one form of optimization pass that I'd like to add (delete any compositions with But maybe we can delay optimization passes until after we've gotten ElementsProject/elements#1539 in. |
|
I did consider this, but I think optimisation should always be optional |
This might be controversial, but I wanted to see if this was possible and what it might look like.
The problem I'm aiming to solve is the annex padding issue, which basically boils down to the transaction being padded with some data increase the budget for the CPU cost of the program.
It doesn't really make sense to increase the simplicity program size, however, developers who are unaware of this problem might add random code to the simplicity program. This adds formal syntax to SimplicityHL in the hopes that developers will find this keyword instead of adding random code. This allows us to remove this padding in future compilers cleanly.
A very common set of programs that need padding are ones using
for_while.Here is the example
hashloopprogramThe addition of
paddingin this case avoids the error of "Program's execution cost could exceed budget" , however it is still not relayed due toRPC error -26: min relay fee not met, 100 < 1226, which I'll investigate further. This could just be some setting inhal-simplicityI am missing.The instructions that
paddingadds at the moment are fairly arbitrary. If we decide to go ahead with this, I'm open to suggestions.For this program (p2pkh.simf):
The program without padding:
And with padding: