Refactor stellar-relay-lib
and vault/oracle
crate implementations
#372
Labels
stellar-relay-lib
and vault/oracle
crate implementations
#372
Context
Our Spacewalk vault clients need to be able to communicate with Stellar's overlay network in order to be able to receive consensus messages. For this, we created the
stellar-relay-lib
crate. This crate can be used to establish a connection to a Stellar validator node in the overlay network and listen to and send messages to it. On the other hand, we have thevault/oracle
crate, which facilitates the implementation of the proof building, which is very specific to Spacewalk and should not live in the 'generalized'stellar-relay-lib
crate.However, it appears that the overall structure of the code and the interfaces they expose are not always intuitive to use as a developer so we should consider refactoring them.
Refactorings
stellar-relay-lib
The implementation of the
stellar-relay-lib
crate was based on the JavaScript implementation of the js-stellar-node-connector project. The main component that is exposed to interact with the overlay network is theStellarOverlayConnection
struct. The exposed interface/methods of theStellarOverlayConnection
look good but the internal implementation could be improved. For example, the connect method is confusing because it creates some channels and spawns two services where it's not immediately clear why these are necessary. Also, some namings could be improved, e.g. what's aConnector
, etc.I'd propose we:
StellarOverlayConnection
. Try to simplify/remove/reduce the usage of tokio channels. Maybe we can't get rid of them entirely but we can at least rewrite the code to be easier to read/understandThe rest of the architecture can stay as is.
vault/oracle
This crate implements a so-called
OracleAgent
which is used by the vault client to build necessary consensus proofs for the stellar-relay pallet. It should be as easy to use as possible, ie. the interface should only expose the functions that are required by the vault client. Taking a step back from the current implementation and only thinking about what we'd wish for from the vault client side.The
OracleAgent
should:The text was updated successfully, but these errors were encountered: