-
Notifications
You must be signed in to change notification settings - Fork 33
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
[CLI] Consistent config/flag parsing & common helpers #891
Conversation
f888ea0
to
7bc433b
Compare
7bc433b
to
2348968
Compare
3acfbc8
to
8199ab5
Compare
2348968
to
309fabc
Compare
8199ab5
to
7cc20c4
Compare
309fabc
to
af3eee6
Compare
7cc20c4
to
3f0dd91
Compare
af3eee6
to
00dc9bf
Compare
3f0dd91
to
44a2750
Compare
00dc9bf
to
3e9adaa
Compare
44a2750
to
8bfecbf
Compare
3e9adaa
to
e0f409f
Compare
8bfecbf
to
6f87169
Compare
e0f409f
to
def32d3
Compare
## @Reviewer This PR may be more digestible / reviewable on a commit-by-commit basis. Commits are organized logically and any given line is only modified in a single commit, with few exceptions*. *(In the interest of preserving the git-time-continuum :police_officer::rotating_light:, this applies in batches of commits between comments or reviews *by humans*, only once "in review") --- ## Description Refactor P2P module dependencies as submodules, ultimately to support usage P2P module usage in the CLI. ## Issue Related: - #730 Dependant(s): - #891 - #801 - #892 ## Type of change Please mark the relevant option(s): - [ ] New feature, functionality or library - [ ] Bug fix - [x] Code health or cleanup - [ ] Major breaking change - [ ] Documentation - [ ] Other <!-- add details here if it a different type of change --> ## List of changes - decoupled P2P module dependencies from Consensus module (disambiguates modules registry names) - added "current_height_provider" module registry slot - promoted `CurrentHeightProvider` to a submodule interface type - added `consensusCurrentHeightProvider` implementation - promoted `Router` interface to a submodule interface type - added "staked_actor_router" modules registry slot - added "unstaked_actor_router" modules registry slot - converted `backgroundRouter` implementation to submodule - converted `rainTreeRouter` implementation to submodule - simplified router base config ## Testing - [x] `make develop_test`; if any code changes were made - [x] `make test_e2e` on [k8s LocalNet](https://github.com/pokt-network/pocket/blob/main/build/localnet/README.md); if any code changes were made - [x] `e2e-devnet-test` passes tests on [DevNet](https://pocketnetwork.notion.site/How-to-DevNet-ff1598f27efe44c09f34e2aa0051f0dd); if any code was changed - [ ] [Docker Compose LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md); if any major functionality was changed or introduced - [x] [k8s LocalNet](https://github.com/pokt-network/pocket/blob/main/build/localnet/README.md); if any infrastructure or configuration changes were made <!-- REMOVE this comment block after following the instructions If you added additional tests or infrastructure, describe it here. Bonus points for images and videos or gifs. --> ## Required Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have added, or updated, [`godoc` format comments](https://go.dev/blog/godoc) on touched members (see: [tip.golang.org/doc/comment](https://tip.golang.org/doc/comment)) - [x] I have tested my changes using the available tooling - [ ] I have updated the corresponding CHANGELOG ### If Applicable Checklist - [ ] I have updated the corresponding README(s); local and/or global - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have added, or updated, [mermaid.js](https://mermaid-js.github.io) diagrams in the corresponding README(s) - [ ] I have added, or updated, documentation and [mermaid.js](https://mermaid-js.github.io) diagrams in `shared/docs/*` if I updated `shared/*`README(s) --------- Co-authored-by: Daniel Olshansky <[email protected]>
5e963be
to
f7ec8d8
Compare
f7ec8d8
to
04dc0aa
Compare
app/client/cli/helpers/setup.go
Outdated
"github.com/pokt-network/pocket/shared/modules" | ||
) | ||
|
||
// TODO_THIS_COMMIT: add godoc comment explaining what this **is** and **is not** |
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.
// TODO_THIS_COMMIT: add godoc comment explaining what this **is** and **is not** | |
// TODO_IN_THIS_COMMIT: add godoc comment explaining what this **is** and **is not** |
OPTIONAL: Update build/linters/blockers.go
so we capture other regexes 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.
Added a comment here to capture the meaning of the var
app/client/cli/debug.go
Outdated
@@ -210,51 +190,16 @@ func sendDebugMessage(cmd *cobra.Command, debugMsg *messaging.DebugMessage) { | |||
} | |||
|
|||
// if the message needs to be broadcast, it'll be handled by the business logic of the message handler | |||
// | |||
// DISCUSS_THIS_COMMIT: The statement above is false. Using `#Send()` will only |
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.
Things have definitely changed/evolved so I'll provide some context & pointers, but would like to get your thoughts/ideas on what the right thing to do is.
For example, take this target to send a tx:
.PHONY: send_local_tx
send_local_tx: ## A hardcoded send tx to make LocalNet debugging easier
go run -tags=debug app/client/*.go Account Send --non_interactive 00104055c00bed7c983a48aac7dc6335d7c607a7 00204737d2a165ebe4be3a7d5b0af905b0ea91d8 1000
- We sent it to one address
- That one address adds it to the mempool
- It needs to be gossiped through the network
In utility/utility_message_handler.go
, we handle a TxGossip
like so where HandleTransaction
just adds it to the local mempool.
func (u *utilityModule) HandleUtilityMessage(message *anypb.Any) error {
switch message.MessageName() {
case messaging.TxGossipMessageContentType:
msg, err := codec.GetCodec().FromAny(message)
// ...
if txGossipMsg, ok := msg.(*typesUtil.TxGossipMessage); !ok {
return fmt.Errorf("failed to cast message to UtilityMessage")
} else if err := u.HandleTransaction(txGossipMsg.Tx); err != nil {
return err
}
// ...
default:
return coreTypes.ErrUnknownMessageType(message.MessageName())
}
// ...
}
Our goal is: Gossip TxGossip
throughout the network
Question: WHat do we change to make it happen? Account Send
? s/Send/Broadcast
? How we handle case messaging.TxGossipMessageContentType
? Wdyt?
app/client/cli/helpers/common.go
Outdated
if err != nil { | ||
return nil, err | ||
} | ||
// TECHDEBT(#810, #811): use `bus.GetPeerstoreProvider()` after peerstore provider |
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.
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.
@h5law One tiny lingering comment (going to merge it in myself).
When you squash & merge this to main, make sure to copy-paste your attribution below the message
Co-authored-by: harry <[email protected]>
Co-authored-by: harry <[email protected]> Co-authored-by: Daniel Olshansky <[email protected]>
@Reviewer
This PR may be more digestible / reviewable on a commit-by-commit basis. Commits are organized logically and any given line is only modified in a single commit, with few exceptions*.
*(In the interest of preserving the git-time-continuum 👮🚨, this applies in batches of commits between comments or reviews by humans, only once "in review")
Description
I discovered some inconsistencies in how/whether we parse the config in different subcommands.
There was also some code that turns out to be common between some existing commands and the ones I'm adding for #730.
Issue
Related:
Dependents:
peer list
subcommand #892peer connections
subcommand #801Type of change
Please mark the relevant option(s):
List of changes
FetchPeerstore()
GetBusFromCmd()
Testing
make develop_test
; if any code changes were mademake test_e2e
on k8s LocalNet; if any code changes were madee2e-devnet-test
passes tests on DevNet; if any code was changedRequired Checklist
godoc
format comments on touched members (see: tip.golang.org/doc/comment)If Applicable Checklist
shared/docs/*
if I updatedshared/*
README(s)