Skip to content

consider how to support zero-padding bytes to buy contract compute budget #412

Description

@mr-zwets

consider if/how to support syntax for zero-padding bytes to buy contract compute budget

in the docs we suggest zero-byte padding but offer no native way to do this

Buying compute budget

Since longer input scripts allow for a larger compute budget, some contracts use zero-padding (adding non-functional bytes) to "buy" more computation power without changing logic. You can find the exact op-cost per operation in the op-cost-table.

we could do it with an unused modifier for function args as proposed in #125

  contract Example() {
    function spend(int a, int b, bytes unused zeroPadding) {
        require(verify(a, b));
    }
  }

nice thing is that it is flexible per function and uses a generally requested keyword, not something "buy compute padding" specific
also it fits nicely into the current artifact and SDK structure

Metadata

Metadata

Assignees

No one assigned

    Labels

    cashc-compilerRelates to the cashc compiler

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions