-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
Refactor the clients to have proper names and layers #275
Comments
The currently implementation is an artifact of FastPay, which binds Client to a specific account |
An attempt at a diagram to clarify things a bit. Here, the box labeled "client" encompasses several components with distinct functionality. We refer to all of them as "client" today. The colored boxes attempt to give the distinct components descriptive names.
The client service does not manage private keys, or ask the wallet(s) it communicates with to pass along a key.
|
Nice! I was just trying to draw the same diagram on my iPad. |
I am still a bit fuzzy on the concept of ClientService. Is there anything similar to this in any existing blockchains? |
@arun-koshy this might be useful |
I think the most similar concept is a (part of) a wallet. "Wallet" is an overloaded term that encompasses too many things, but there is a part of an Eth wallet that maintains the user's sequence number, balances in various coins, NFT's the user owns, etc. This is analogous to the local state maintained by the ClientService. You might also think of the ClientService as a "sparse" full node that only syncs data relevant to the user's address(es), and but ignores the rest of the data going into the chain. |
i was wrong about the client service though - since it's not a full node / full picture of network state, the block explorer wouldn't run the client service, but something else (i think) |
I agree with this. Conceptually, the block explorer (at least in my mental model) is a client service that:
But that conceptual explanation doesn't mean that it's helpful to implement it that way. Like Stella, my intuition would be to speak directly to the authorities. This avoids needless coupling/exposing the block explorer to concepts/data it doesn't care about (e.g., anything to do with writes). |
@sblackshear a part i'm unclear on is what the explorer will run to keep up-to-date on network state - are authorities the stand-in for a traditional chain's full node, and we can continually talk to them to get a complete picture of state ? |
Hey @stella3d - services that need to maintain a full replica of the state on all fastx authorities will probably have to use a sync API beyond the client API. This sync API is also used to ensure authorities keep up to date with each other and new authorities get the state so far before validating new transactions. |
Here is the task that tracks ideas on how to build sync: #194 |
perfect, this looks like exactly what it would need. |
Thanks for the diagram Sam! So it sounds like the direct comparison to what we are building from the client side is what Infura/Alchemy are doing for Ethereum So would it be fair to say that the end output of our client ecosystem should either provide a way where the customer can manage their own servers & state and use our stateless rest api to call into the network (via the relayer from your diagram) OR they can use our stateful API as a service (client service from your diagram) that maintains all this state for them? |
|
Hey all -- A few thoughts after having slept on our discussion yesterday, and reading @arun-koshy 's REST doc today. I think the diagram above that has a single "client" dotted box (#275 (comment)) is a little simplifying and misleading. Hear me out:
So in effect the REST client is NOT in the same trust boundary as the user client, and its access and interactions with the REST or other services need to be mediated and subject to authentication and authorization. |
Totally agree with this. The oversimplified view applies to what we're shipping for GDC (since there are no web pages, wallets, etc.), but not to any realistic production setup. |
@sblackshear and others that diagram above is really nice and would be tremendously helpful to those getting started, like in some kind of architectural overview or README somewhere. I don't really know what a "relayer" is or for. |
@velvia #275 (comment) has something that's closer to what we have today. Agree that we should put these to a README |
Arch gets updated often but lately it's mostly steady and agreed we need to be on top of documenting |
@oxade I like text-based diagramming tools like Mermaid, so that they can be part of the git history, and now it's officially supported by Github!!!! https://github.blog/2022-02-14-include-diagrams-markdown-files-mermaid/ I volunteer to put diagrams in the README. :D |
This is all done. |
First of all, similar to Ethereum, we should be able to talk to the Authorities in a stateless way, through CLI (similar to geth), REST or RPC. The API at this layer should be stateless (i.e. doesn't represent or own an account), and the CLI can be just called fastx.
Secondly, we then can have a ClientService, which encapsulates stateful APIs that a light client will typically need, to maintain a few accounts and persist objects.
Finally, we can then have a client_cli purely for the purpose of demoing the ClientService. Orthogonally, the ClientService can also expose REST APIs.
The text was updated successfully, but these errors were encountered: