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

Events 2.0: manually specify signature topic #1838

Closed
ascjones opened this issue Jul 5, 2023 · 3 comments · Fixed by #2031
Closed

Events 2.0: manually specify signature topic #1838

ascjones opened this issue Jul 5, 2023 · 3 comments · Fixed by #2031
Assignees
Labels
A-ink_lang [ink_lang] Work item B-enhancement New feature or request C-discussion An issue for discussion for a given topic.

Comments

@ascjones
Copy link
Collaborator

ascjones commented Jul 5, 2023

How about allowing to manually specify the signature topic? If for whatever reason, the exact definition of types can not be used, we can at least allow to specify the topic manually. We are doing that with custom selectors, why not do it with the event signatures?

Originally posted by @SkymanOne in #1827 (comment)

How it might look:

#[derive(ink::Event)]
#[ink(signature_topic = 0x000...]
pub struct Event {}

The type of the signature topic should be [u8; 32], although we may need to consider making this configurable to Environment::Hash.

@ascjones ascjones mentioned this issue Jul 5, 2023
@SkymanOne
Copy link
Contributor

What we can do is take some string and hash using blake2x256 or allow the user to specify the hash manually.

@SkymanOne SkymanOne added B-enhancement New feature or request C-discussion An issue for discussion for a given topic. A-ink_lang [ink_lang] Work item labels Jul 5, 2023
@SkymanOne
Copy link
Contributor

How it might look:

I think the best approach is to keep it consistent with custom selectors:

#[ink(event, signature_topic = 0xDEADBEEF)]
pub struct Event {}

or

#[ink::event]
#[ink::signature_topic = 0xDEADBEEF]
pub struct Event {}

@ascjones
Copy link
Collaborator Author

For ink::event it should be an option e.g.

#[ink::event(signature_topic = 0xDEADBEEF)]
pub struct Event {}

@SkymanOne SkymanOne self-assigned this Dec 7, 2023
@SkymanOne SkymanOne mentioned this issue Dec 21, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ink_lang [ink_lang] Work item B-enhancement New feature or request C-discussion An issue for discussion for a given topic.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants