-
Notifications
You must be signed in to change notification settings - Fork 326
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
ADR 009: ChainEndpoint/ChainHandle Consolidation #2108
ADR 009: ChainEndpoint/ChainHandle Consolidation #2108
Conversation
Please let me know if you can think of better names for |
In my understanding, One potential concern with this change is that it may introduce unnecessary coupling between the client side and the runtime mechanics. For example, in a future async rewrite we might choose to convert components to async piecemeal or even leave some of them synchronous. Use of a common trait would make that process unnecessarily complicated. That said, I'm all for reducing the surface area of the traits by deduplicating methods, using auxiliary data types, etc. |
This is a very good point. It is highlighted also in our of older ADRs (005). The runtime backends are described here. The API client side can also be seen as a "relayer application" which uses the One advantage of this 2-sided architecture is that we can customize handlers (relayer application logic) independently of runtimes. A concrete example is in the caching layer implementation, which was added as a custom chain handle. |
One more input we should take into account in the redesign of Runtime/Handlers is the need for supporting parallel queries in the runtime. The problem is as follows: Whenever a relayer object ( Can we fulfil this requirement with the proposed redesign, or can we accommodate it? |
Good point @mzabaluev. How I see it, nothing needs to change in the ADR other than having both @adizere IIUC, you're referring to the problem that |
@adizere When we get an async tendermint-rs, we could start with converting the runtime (and |
``` | ||
|
||
|
||
### Procedural macro |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I agree that implementing these query_
methods is fairly repetitive and boilerplaty, I would rather not introduce a macro-based solution at this stage. Let's keep the code simple and readable and only fallback on macros if absolutely necessary.
Meta: removed this PR from milestone 0.14 (we're using milestones for issues, not PRs). It's OK to push this work into next release train (0.15). |
## Decision | ||
|
||
### Query methods parameters | ||
There are currently discrepancies between how methods take their arguments. Some take a `request` object, and others take fine-grained arguments that will be used to build a `request` object in the implementation of the method. For example, `query_consensus_state()` takes arguments that will be used to build a request object, whereas `query_consensus_states()` takes a request object directly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think most of the places where we're taking a request
object is because the underlying RPC method relies on gRPC. Where we lack Request*
it's often because we rely on ABCI (called rcp_client
) underlying transport.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed with @romac, this ADR would have each method have a domain Request*
type, irrespective of if it ends up using RPC, gRPC, etc, effectively abstracting that away.
docs/architecture/adr-008-chain-endpoint-handle-consolidation.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to merge Philippe. Nice consolidation!
* adr 8 proposal * updated README * Update ADR given comments
Description
This PR proposes ADR 8, which aims to reduce the code duplication between the
ChainEndpoint
andChainHandle
traits.PR author checklist:
unclog
.docs/
).Reviewer checklist:
Files changed
in the GitHub PR explorer.