Replies: 4 comments 3 replies
-
Disclaimer: I tried to provide the tradeoffs above in an unbiased way though my personal preference is for having semantic configurations. I personally believe it will help the long-term vision health of the project as the team and external contributors grow, and make future features easier to ship. |
Beta Was this translation helpful? Give feedback.
-
Thank you for this! I think we all agreed that config paths are not the way to go, at the same time I feel the need for using interfaces while we figure out our testing framework. I have put together PR #235 just to show what I think we could do, I would love if you (@andrewnguyen22 , @Olshansk and really anyone who wants to jump in and comment) could give it a quick scan to at least agree if this is going on the right path or it's a complete no-go. |
Beta Was this translation helpful? Give feedback.
-
Reviewed here #235 (review) I added several comments to underscore this point: It's arguable whether or not
I would have structured the tradeoff table more like this: Config TradeoffsLegend
I removed
|
Beta Was this translation helpful? Give feedback.
-
The core team had an internal discussion & meeting about this, so I just wanted to highlight a few of the major takeaways. In addition to the original considerations listed above, we discussed whether the Pocket Node should be treated as a After reviewing #235 together, the conclusions we came to are:
A couple of action items (just for thought but outside the scope of this discussion) that are enabled by shared interfaces are:
These would be swappable based on implementation, but a shared contract will still exist. |
Beta Was this translation helpful? Give feedback.
-
Module Configuration Design
Goal
The goal of this discussion is to make a decision on how configurations should be designed and passed into their respective modules.
Why now?
The foundation for config management will likely spread throughout the entire codebase and set the foundation for all future work, with a very high cost being modified/refactored at a later point in time.
V0
In V0, the config was structured like so:
With
TendermintConfig
designed like so:Though every config was a separate independent structure, their existence in the same
types
package led to an implicit interdependency which made it extremely difficult, sometimes non-feasible, to make certain changes. Examples of this are outside the scope of this discussion.NOTE: We're using consensus as an example but the same applies to other modules as well
V1 - Initial Proof-Of-Concept
The first implementation of V1 added a factory function so:
That leveraged a shared config protobuf in
shared/types/genesis/proto/config.proto
This was just an initial approach that made sense to get things running but was always planned to be revisited in the future.
V1 - Today
In PR #178, we tended to issue #163, which aimed at taking a step forward in removing unnecessarily shared dependencies. The new factory function now looks like so:
Moving the onus of configuration validation and parsing to each individual module.
V1 - Today - Temp
Some "shortcuts" were done to iterate faster on main. Even though the consensus config protobuf is encapsualted in
consensus/types/proto
:A shared interface still exists in
shared/modules/types
that is intended to be deleted in the future:Some issues have been seen with the new approach, so the tradeoffs of both needs to be compared before moving forward
Config Tradeoffs
Legend
1. Config cross-contamination
As discussed in this GH comment, we want to have the optionality of being able to freely swap one consensus module for another without risking cross-module dependency.
It is easy to start creating cross-module dependencies, and it will practically not be possible to refactor this out once the project is mature (i.e. see Tendermint)
2. Config injection/mocking
With the string approach, injecting custom/testing configs requires:
With the semantic configs approach, we can:
Or Altneratively:
consensusConfig.EXPECT().GetTimeout().Return(10)
)3. Semantic configs
This point is a matter of developer preference, including but not limited to the following questions:
Create
function header to view the configs?4. Code clarity
There is nothing Pocket specific about code clarity, code quality or code health and is also a function of developer preference.
For example, there are a handful of places where there is a lot of copy-pasted code with this approach.
Generally, code clarity is a focus because:
5. Config ownership
This is a tradeoff of having one place deserialize and validate all the configs and having each module expect functional/validated configs being provided to them, versus moving that responsibility to each individual module.
Tradeoff Summary
Though everything can be done with each approach, a summary of the tradeoffs is:
In favour of:
EDIT 1:
We updated the poll, which cancelled previous votes after the team had a discussion with this output: #234 (comment)
7 votes ·
Beta Was this translation helpful? Give feedback.
All reactions