Skip to content
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

Auto Sequencing, Error Cleanup, Bash Tests Cleanup #177

Merged
merged 5 commits into from
Jul 19, 2017

Conversation

rigelrozanski
Copy link
Contributor

No description provided.

@rigelrozanski rigelrozanski changed the title Auto Sequencing and Error Cleanup Auto Sequencing, Error Cleanup, Bash Tests Cleanup Jul 19, 2017
Copy link
Contributor

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job. I'll merge soon, take a look at the comments if you wish.

errUnknownModule = fmt.Errorf("Unknown module")
errExpired = fmt.Errorf("Tx expired")
errUnknownKey = fmt.Errorf("Unknown key")
errDecoding = fmt.Errorf("Error decoding input")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, very correct with moving the errors

}

func doAccountQuery(cmd *cobra.Command, args []string) error {
func accountQueryCmd(cmd *cobra.Command, args []string) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i forgot the naming scheme

@@ -80,3 +81,11 @@ func ErrNoOutputs() errors.TMError {
func IsNoOutputsErr(err error) bool {
return errors.IsSameError(errNoOutputs, err)
}

func ErrUnknownKey(mod string) errors.TMError {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also do: return errors.WithMessage(mod, errUnknownKey, unknownRequest) just using the basecoin.errors package

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh awesome I was mostly copying and pasting code from the other files, changing now. cleaner as now need to import pkg/errors

@@ -6,9 +6,10 @@ import (
"github.com/pkg/errors"
"github.com/spf13/cobra"

lc "github.com/tendermint/light-client"
"github.com/tendermint/basecoin"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need a re-ordering of the imports... light-client and other tendermint together, then basecoin stuff...

I know they are all a bit mixed up after the merge.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good eye, done

if len(args) == 0 {
return errors.New("Missing required argument [address]")
}
addr := strings.Join(args, ",")
act, err := parseActors(addr)

var signers []basecoin.Actor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to define signers here when you do a := below. I think it is clear without the var, but if you use it, change the := to =

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, thanks, relic

@@ -67,13 +69,28 @@ func parseActors(key string) (signers []basecoin.Actor, err error) {
return
}

func readSequence() (uint32, error) {
// read the sequence from the flag or query for it if flag is -1
func readSequence(signers []basecoin.Actor) (seq uint32, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks very good

@@ -53,7 +53,8 @@ test02SendTxWithFee() {
SENDER=$(getAddr $RICH)
RECV=$(getAddr $POOR)

TX=$(echo qwertyuiop | ${CLIENT_EXE} tx send --amount=90mycoin --fee=10mycoin --sequence=2 --to=$RECV --name=$RICH)
# Test to see if the auto-sequencing works, the sequence here should be calculated to be 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice.

@@ -4,103 +4,103 @@ CLIENT_EXE=basecli
SERVER_EXE=basecoin

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the change you made here on all the lines? tabs to spaces?

let's get things straight with our editors to not have this issue in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, please use 4 spaces as tabs on bash files you were using two. More in the coding guide: https://github.com/tendermint/coding/blob/master/Coding_Standard.md#non-golang-code
I have this automatically built in to format when I save a .sh in vim

@ethanfrey ethanfrey merged commit 29273e5 into feature/cli-cleanup-aka-confuse-rigel Jul 19, 2017
@ethanfrey ethanfrey deleted the feature/104-autoseq branch July 19, 2017 10:36
Thunnini referenced this pull request in Thunnini/cosmos-sdk May 15, 2022
(cherry picked from commit 66442bf)

Co-authored-by: Roman <34196718+p0mvn@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants