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

Add support for structs in huff interface definition #303

Open
AmadiMichael opened this issue Oct 4, 2023 · 0 comments
Open

Add support for structs in huff interface definition #303

AmadiMichael opened this issue Oct 4, 2023 · 0 comments

Comments

@AmadiMichael
Copy link

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))")).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant