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

Add event limits section #390

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/build/smart-contract/basic-concepts/events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ In Massa's smart contracts, events provide a way to emit runtime messages that c
In Massa, events are not stored in the blockchain ledger, meaning they are ephemeral. Therefore, events should not be used as a source of persistent data. Instead, they are suitable for temporary tasks such as monitoring, logging, or providing real-time feedback.
For use cases that require persistent data, storage should be used.

## Limits

Due to the high throughput and low hardware requirements of Massa, memory usage linked to event emission needs to be capped. To achieve this, several limits need to be respected:
* Up to 25 events can be emitted in total during one execution (operation, async message or deferred call) regardless of the number of sub-calls happening. Attempting to emit more events results in a runtime exception being raised causing the execution to fail & revert. Note that this limit only applies to events explicitly emitted by smart contract code using the `generateEvent` ABI or similar. System events such as execution failure notifications are not subject to this limit.
* The maximum size of the event message is 512 bytes. Any attempt to emit a longer message by smart contract code using the `generateEvent` ABI or similar results in an exception being raised causing the execution to fail & revert. For system events (not explicitly emitted by smart contract code), any overflowing message is silently truncated down to 512 bytes.


## Emitting a custom event
To emit a custom event in a smart contract, you can use the generateEvent function (assuming this utility is available in your environment):

Expand Down
Loading