Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support structs, enums and tuples in sha3() and other "accept arbitrary parameters" functions #980

Closed
5 tasks
axic opened this issue Aug 31, 2016 · 4 comments
Closed
5 tasks

Comments

@axic
Copy link
Member

axic commented Aug 31, 2016

  • support structs
  • support enums
  • support tuples
  • support contracts (encoded as addresses)
  • disallow anything else as part of the type checker
contract test {

    struct TestStruct {
        uint a;
    }

    function test() {
        TestStruct memory testing = TestStruct({a: 1});
        sha3(testing);
    }
}

(Follow up from #332)

@axic axic added this to the 5-functionality milestone Aug 31, 2016
@chriseth
Copy link
Contributor

chriseth commented Sep 1, 2016

This is most likely a duplicate of #595

@chriseth chriseth changed the title Support structs in sha3() Support structs, enums and tuples in sha3() and other "accept arbitrary parameters" functions Sep 1, 2016
@pirapira
Copy link
Member

pirapira commented Sep 5, 2016

I added "tuples" in the description because the title says "tuples".

@chriseth
Copy link
Contributor

Since we only support bytes memory in those functions in the future, and everything else has to use abi.encode, this can be closed.

@krzkaczor
Copy link

If anyone is still wondering how to do this, use abi.encodePacked:

keccak256(abi.encodePacked(struct.a, struct.b, struct.c));

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

No branches or pull requests

4 participants