-
-
Notifications
You must be signed in to change notification settings - Fork 811
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
VIP Structs in Events #1170
Comments
@fubuloubu I believe that information included in an event is encoded as arguments of a functional call would be minus any function selector at the beginning. This would include structs which would be encoded as tuples. Source is second sentence in this section of the current ABI spec: https://solidity.readthedocs.io/en/develop/abi-spec.html#argument-encoding |
@fubuloubu I like the syntax for directly outputting a struct but I think the member selection is too magical. Users should have to specify which fields they want to log/index. Re. indexing on a struct, according the EVM spec, each LOG topic is one word, so we would have to apply a map from struct to uint256/bytes32 (e.g. keccak256) and I think that is overfunctioning on behalf of the user. Besides, the topic data is not accessible so I'm having trouble thinking of a case where somebody would want to index a struct but not already have the hash. I think Solidity uses the ABIv2 encoding but I'm not sure if it is packed or unpacked. For compatibility we should use whatever it uses. |
According to solidity team https://gitter.im/ethereum/solidity-dev?at=5c3328241948ad07e8000c16
|
"packed and hashed" hmm. So is it included both as a hash and as an ABI-encoded, unindexed data? |
Not automatically. If you wanted to do that you would have to include it twice, like |
I guess it would be helpful if the struct was a transaction, and you were waiting on it to be confirmed in the contract, sort of like "transaction hash was mined!" |
Simple Summary
Allow emitting structs in events
Abstract
ABIv2 will allow emitting structs inside events.
This behavior is not well-defined (@davesque please confirm).
Motivation
Working with structs as input arguments, it may be useful to emit structs inside events for the client-side to use after a transaction has been mined e.g. a Deposit transaction in Plasma.
As mentioned by @charles-cooper in #1019
Specification
Specification is WIP, but here are a few possibilities:
Directly outputing a struct:
Outputting only certain members of a struct:
Indexing:
Backwards Compatibility
No backwards compatibility issues
Copyright
Copyright and related rights waived via CC0
The text was updated successfully, but these errors were encountered: