-
Notifications
You must be signed in to change notification settings - Fork 375
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(tm2): make rpc client not depend on goleveldb #1603
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1603 +/- ##
==========================================
- Coverage 47.46% 47.41% -0.05%
==========================================
Files 385 384 -1
Lines 61355 61240 -115
==========================================
- Hits 29123 29040 -83
+ Misses 29797 29771 -26
+ Partials 2435 2429 -6 ☔ View full report in Codecov by Sentry. |
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.
Thank you for resolving this coupling 🙏
Looks great 💯
d8c4555
to
4561ba3
Compare
![image](https://github.com/gnolang/gno/assets/4681308/761f1109-3e0d-4846-b331-3c60b6e803c0) ![image](https://github.com/gnolang/gno/assets/4681308/312b9226-49fa-48ac-b280-f4d704a341df) The PR depends on gnolang#1602 but it's good for review. For ease of reviewing I put that PR's branch as the base branch; once it is merged I will rebase on master. A bunch of changes to get there: - Split `proxy` into `appconn` and `proxy`. `proxy` has a dependency on `kvstore`, which then depends on pkg/db and goleveldb. - Tools for inspecting dependency chains: - `go list -f '{{ join .Deps "\n" }}' github.com/gnolang/gno/tm2/your/pkg` - [`depth`](https://github.com/KyleBanks/depth) The original point of the PR was to not include an entire key-store database as part of `cmd/gno`, but really the better side-effect is that the dependency is no longer in the rpc package. Sadly, `gnoclient` still imports `goleveldb`, but I'll leave understanding why that is the case for another refactor-investigation :)
The original TM2 allows for in-process app and RPC versus separate server configurations. With this change, can we still deploy TM2, the app, and RPC as separate services in production? |
@piux2 The change only affects the RPC client. No breaking change was introduced, and as you mentioned, we can still have separate tm2/app/rpc server. |
Thank you for the clarification. I'm not sure I fully understand the intentions behind this PR for refactoring with all these changes Could you help to clarify a few points?
Why do we set code FastSync and remove setting the consensusReactor for the RPC?
The current implementation only use the on-start state of the consensusReactor
|
@@ -588,6 +589,16 @@ func (n *Node) OnStart() error { | |||
time.Sleep(genTime.Sub(now)) | |||
} | |||
|
|||
// Set up the GLOBAL variables in rpc/core which refer to this node. |
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.
ok!
// functions on a given node, without going through any network connection. | ||
// | ||
// As this connects directly to a Node instance, a Local client only works | ||
// after the Node has been started. Note that the way this works is (alas) |
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.
+1
Thank you Morgan, good work! |
@piux2 please add inline comments next time, it makes answering your questions easier :)
Removes the dependency from rpc/client to
Practically, we're separating concerns between what client/rpc should do. Rather than also set up the connections to make the local client work, rpc/client only provides the client itself, and the responsibility to wire everything up is with the caller.
See rpc/core/consensus.go. However, since only rpc/core with this function will need the function to print it as JSON, I added a separate type in |
Note that in To make it have access to the properties, while not importing
Not really.
I was considering making it a property, but set for making it a getter for the precise reason it could be updated during a node's lifespan.
See answer number 2. |
The PR depends on #1602 but it's good for review. For ease of reviewing I put that PR's branch as the base branch; once it is merged I will rebase on master.
A bunch of changes to get there:
proxy
intoappconn
andproxy
.proxy
has a dependency onkvstore
, which then depends on pkg/db and goleveldb.go list -f '{{ join .Deps "\n" }}' github.com/gnolang/gno/tm2/your/pkg
depth
The original point of the PR was to not include an entire key-store database as part of
cmd/gno
, but really the better side-effect is that the dependency is no longer in the rpc package. Sadly,gnoclient
still importsgoleveldb
, but I'll leave understanding why that is the case for another refactor-investigation :)