Conversation
SkymanOne
reviewed
Jan 8, 2024
| When an event is emitted, 0 or more topics can be associated with it. The event is then indexed | ||
| together with other events with the same topic value. | ||
|
|
||
| An event's fields can be annotated with `#[ink(topic)]` (see example), which will result in a |
Contributor
There was a problem hiding this comment.
Suggested change
| An event's fields can be annotated with `#[ink(topic)]` (see example), which will result in a | |
| An event's field can be annotated with `#[ink(topic)]` (see example), which will result in a |
Collaborator
Author
There was a problem hiding this comment.
It is meant to convey that multiple individual fields can be annotated with the topic.
| An event's fields can be annotated with `#[ink(topic)]` (see example), which will result in a | ||
| topic derived from the value of that field being emitted together with the event. | ||
|
|
||
| Topics are by default a 32 byte array (`[u8; 32]`), although this is configurable on the |
Contributor
There was a problem hiding this comment.
Is it actually configurable? I thought ink is hardcoded to use blake 256 still
Collaborator
Author
There was a problem hiding this comment.
The type of the resulting topic is configurable yes. So if it is shorter I guess it will be truncated and longer padded.
Our way of generating the topic value itself is hardcoded to blake2.
cmichi
approved these changes
Jan 18, 2024
Collaborator
cmichi
left a comment
There was a problem hiding this comment.
Just some style remarks for consistency with existing docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For events 2.0 use-ink/ink#1827