-
Notifications
You must be signed in to change notification settings - Fork 925
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(daser): use functional options pattern to configure daser #1225
Conversation
bcce6d6
to
76f3ee1
Compare
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.
Looks good to me. Like your functional approach with options to remove dependancy on nodebuilder
. There are 2 things that I think could be improved:
- types in structs could be better aligned with their usage to avoid extra conversions.
- we need to set up default values inside DASer in case missing options scenario.
Besides that looks legit.
1579caf
to
9ac8dbd
Compare
@walldiss I've addressed your comments about typing to do away with conversions in operations, however, I would still like to understand why are the compared-with variables |
7cdf799
to
69d019c
Compare
Codecov Report
@@ Coverage Diff @@
## main #1225 +/- ##
==========================================
- Coverage 56.34% 55.68% -0.67%
==========================================
Files 160 164 +4
Lines 9935 10079 +144
==========================================
+ Hits 5598 5612 +14
- Misses 3783 3906 +123
- Partials 554 561 +7
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Also @derrandz can you check all your godocs on the methods you've implemented and make it according to godoc style? for example:
should be
|
61103ed
to
5fd623b
Compare
720417e
to
93c72d3
Compare
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.
Thanks for bringing this over the finish line. This PR was a great way for us to develop the configuration pattern for our codebase and get everyone onboarded with it.
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.
Looks amazing, Great work!
9c79cd4
to
daa6840
Compare
daa6840
to
a83715b
Compare
Overview
The DAS module is currently reliant on default constant global variables acting as configuration variables.
This makes changing configuration values for the DAS module non-trivial, as it requires code changes and binary re-building.
In this PR, we refactor the global configuration variables used in the DAS module to use the functional options pattern, which will trivialize the process of configuring a Celestia node.
Reference Issue
#1063
#709
Impact / Change
The
das
package is now configurable using a set of functional options, namely:This allows the
das
package to be configured with values other than the default parameters defined indas/options.go:29
An example of the
das
package being configured with these options and instantiated with them is:nodebuilder/das/module.go:22
Owners
@derrandz