Skip to content
This repository was archived by the owner on Oct 20, 2024. It is now read-only.
This repository was archived by the owner on Oct 20, 2024. It is now read-only.

Add support for structs in huff interface definition #303

@AmadiMichael

Description

@AmadiMichael

Currently huffc does not compile when functions with struct parameters are in the interface definition, this means that anyone looking to use huff and uses functions with struct args will have to manually calculate function sigs themselves since __FUNC_SIG(funcName) won't be possible.

e.g
Take this solidity function

struct Info{
  string name;
  uint256 age;
}

function storeInfo(Info calldata info) external {
  ... do something
}

And in huff

/// INTERFACES
#define function storeInfo((string name, uint256 age)) nonpayable returns()

#define macro MAIN() = {
  0x00 calldataload 0xe0 shr
  dup1 __FUNC_SIG(storeInfo) eq STORE_INFO_IMPL jumpi
  0x00 0x00 revert

  STORE_INFO_IMPL:
              ... do something
}

Something like the above won't compile in huff and the dev would have to do this in chisel manually bytes4(keccak256("storeInfo((string,uint256))")).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions