-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 events #14076
Comments
This is a hard dependency for my project and other projects requiring off-chain network IO. As an example, Tron Network nodes have a plugin for piping events into Kafka allowing for off-chain data to be fetched and posted on-chain via handlers calling programs/contracts. With this callback-like functionality data can be persisted on-demand with eventual consistency. Reliable Event-Driven stream processing enables a lot of product development. |
Quite curious @gregl83 , why using RPC subscriptions to certain accounts wouldn't suffice? I'm guessing its because RPC subscriptions don't allow for fine granularity of events? |
Hi @jon-chuang, super new to the project and trying to evaluate an unplanned pivot to Solana for a WIP POC. From what I gather, the RPC subscribe method operates without a guarantee of messages being received at least once (fire-and-forget). That is, if the RPC subscriber experiences downtime or encounters a processing exception, messages can be dropped. Perhaps there is an embedded queue? Additionally, there is a lot of flexibility with event sourcing using a high-throughput and durable message bus like Kafka. Replays, filtering, confirmed receipt, concurrency, ordering etc. |
@gregl83 , I was wondering if the msg macro, which prints to log, serves your needs? I was thinking that the easiest way to get this functionality would be if these logs could be filtered on the RPC server side by program pubkey. |
this isn't exactly what you're asking for, but might help you limp by for now. anchor emit example: |
@buffalu , I believe Just a convenience macro for converting an arbitrary struct to a string. |
@jon-chuang, I believe you're correct, Jon, is there a guarantee that log messages will include metadata such as program id? Do client requests to any node reproduce the log message during replication? If RPC is indeed fire and forget, then has anyone setup something like logstash which can use Kafka as a sink and handle restarts? |
Edit: this issue could be relevant #18197 |
👍 |
Struggling with the same. Anyone can point me to the relevant documentation for emit() substitute? |
@biserd the substitute is use |
@jon-chuang The way I see it, |
note that log based events might be affected by truncation: #23653, coral-xyz/anchor#1613 |
Problem
In Solidity, it possible to emit events. Events are read-only records which are stored on-chain, which can be used for triggering off-chain programs.
Events are ABI encoded so that using the correct ABI, events can be decoded off-chain. For example, Hyperledger Burrow writes the events to an SQL database using vent
From the BPF program's perspective, events are write-only.
Proposed Solution
Provide a BPF syscall which provides a deposit-event/emit-event type functionality.
Provide an RPC which subscribes to events with filtering functionality.
The text was updated successfully, but these errors were encountered: