webb-tools / gadget

A framework for building modular AVS and Tangle Blueprints: https://docs.tangle.tools/developers/blueprints.
https://tangle.tools
MIT License
5 stars 1 forks source link

[TASK] Abstract away on_finality_notification and client #146

Open tbraun96 opened 1 month ago

tbraun96 commented 1 month ago

To ensure maximum flexibility with other systems, on_finality_notification should be on_event or a similar yet generalized name. For example, a user may want to listen to a stream of events from a web server or another blockchain.

Additionally, the OnlineClient (subxt) and in general, the Client trait, should be abstracted further to generalize for the aforementioned reasons. For example, the client may check a webserver for a status, submit results, etc.

Both these requirements can be expressed using a SourceConnection or a similarly-named trait.

At the protocol-level (i.e., at the current moment, what we call the "external repository" that holds the protocol source code), the SourceConnection trait should be defined.

We will also want to add a pre-defined trait for tangle. For example:

pub struct TangleConnection { .. }
impl SourceConnection for TangleConnection { .. }
drewstone commented 1 month ago

Might consider a different naming convention than Connection, maybe something to do with EventListener EventDispatcher.