-
Notifications
You must be signed in to change notification settings - Fork 1
Conversation
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! No blocker from my side. One minor thing is that could we copy the CI thing here as well?
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.
Nice work! The main comments are around the dependency of this repository to the vigilante one, which I think should not happen.
Also, do you think it would be better if we rename instances of client
to rpcclient
? I think it would make the point of this repository much clearer.
A README with some details about how this can be built and used would also be appreciated but it can happen on another PR.
.gitconfig
Outdated
@@ -0,0 +1,2 @@ | |||
[url "ssh://[email protected]/"] | |||
insteadOf = https://github.com/ |
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 would say this does not have a place in this repository. If someone wants to use this replacement rule, we can add instructions on how this can happen on the repository README
.
MOCKGEN_REPO=github.com/golang/mock/mockgen | ||
MOCKGEN_VERSION=v1.6.0 | ||
MOCKGEN_CMD=go run ${MOCKGEN_REPO}@${MOCKGEN_VERSION} | ||
|
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.
Rules for building would also be useful.
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.
Actually, is there a usecase in which someone uses this client directly from this repository without anything else? Currently, I do not think we have such a usecase so a build
rule might not be needed.
In the future, I can envision this client also providing a CLI interface in which someone can interact with a remote Babylon node (although the same can be accomplished through babylond
commands so this would be a wrapper).
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.
Agreed. We should implement it as a command line tool just like lens did.
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.
Sounds good! An issue for that would be appreciated
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.
Done.
MOCKGEN_VERSION=v1.6.0 | ||
MOCKGEN_CMD=go run ${MOCKGEN_REPO}@${MOCKGEN_VERSION} | ||
|
||
test: |
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.
Shouldn't this depend on the mocks getting generated by mock-gen
? Not entirely familiar with the mockgen
package.
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.
Are you saying we should re-generate mock files every time before we run tests? Not sure about that. It seems we can manually generate mock files once and upload them in the repo so that others do not need to generate them again, just like the protobuf files.
client/client.go
Outdated
return nil, err | ||
} | ||
log.Debugf("Babylon key directory: %v", cfg.KeyDirectory) | ||
log.Debugf("All Babylon addresses: %v", addrs) |
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.
Why do we retrieve the Babylon addresses? Is this some kind of sanity check? As they are not used anywhere else in this function.
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.
It seems like a sanity check. Any thoughts @SebastianElvis?
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.
Reporter uses this address to submit txs to Babylon. The logs and thus retrieving addresses can be omitted though.
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.
Just making sure: Do we need to execute cc.ListAddresses()
here? I don't see the addrs
being used elsewhere other than logging here.
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.
No need, the accounts are retrieved just for logging.
client/client.go
Outdated
"fmt" | ||
"time" | ||
|
||
"github.com/babylonchain/vigilante/config" |
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.
If the vigilante depends on the babylon client and the client depends on the vigilante, this might introduce a cyclic dependency.
|
||
// adapted from https://github.com/strangelove-ventures/lens/blob/v0.5.1/client/chain_client.go#L48-L63 | ||
// The notable difference is parsing the key directory | ||
// TODO: key directory support for different types of keyring backend |
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.
We can add a Github issue for that for easier tracking.
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.
@SebastianElvis Not sure about this description. Could you please revisit this TODO and create an issue for tracking if it is needed?
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.
Sure, created #2
client/query.go
Outdated
@@ -0,0 +1,173 @@ | |||
package client |
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 the client aims to be able to perform all queries related to our modules, maybe we can have different query files for each one of the modules we implement.
client/query_test.go
Outdated
@@ -0,0 +1,3 @@ | |||
package client_test | |||
|
|||
// TODO: mocks on queries for testing reporter/*.go |
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.
reporter/.*go
does not exist here.
client/tx_test.go
Outdated
@@ -0,0 +1,3 @@ | |||
package client_test | |||
|
|||
// TODO: mocks on txs for testing reporter/*.go |
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.
Same here.
go.mod
Outdated
|
||
require ( | ||
github.com/babylonchain/babylon v0.1.0 | ||
github.com/babylonchain/vigilante v0.1.2 |
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.
This dependency should not exist imo.
5cc08b6
to
99e9fd2
Compare
Thanks, @SebastianElvis and @vitsalis for your comments. Please see the latest changes:
|
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, thanks for the updates! Also, please enable CircleCI for the repository (looks like only the admin can do this -- which is probably you since you created the repo 😄 )
MOCKGEN_REPO=github.com/golang/mock/mockgen | ||
MOCKGEN_VERSION=v1.6.0 | ||
MOCKGEN_CMD=go run ${MOCKGEN_REPO}@${MOCKGEN_VERSION} | ||
|
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.
Sounds good! An issue for that would be appreciated
|
||
// QueryStakingParams queries staking module's parameters via ChainClient | ||
// code is adapted from https://github.com/strangelove-ventures/lens/blob/v0.5.1/cmd/staking.go#L128-L149 | ||
func (c *Client) QueryStakingParams() (*stakingtypes.Params, error) { |
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.
Why can't we use this?
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.
It is used here
* add new queries * add rpc * add more rpc * more methods * add comments * remove space * add comments * add another arg
This PR creates a vanilla implementation of Babylon rpc client with most of the code copied from https://github.com/babylonchain/vigilante/blob/965384cd3a659e63662c7fa417c5ed51c0580a5b/babylonclient/client.go