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

R4R: Codespaces as Strings #2821

Merged
merged 12 commits into from
Nov 16, 2018
Merged

R4R: Codespaces as Strings #2821

merged 12 commits into from
Nov 16, 2018

Conversation

sunnya97
Copy link
Member

Matches ABCI update

  • Targeted PR against correct branch (see CONTRIBUTING.md)

  • Linked to github-issue with discussion and accepted design OR link to spec that describes this work.

  • Wrote tests

  • Updated relevant documentation (docs/)

  • Added entries in PENDING.md with issue #

  • rereviewed Files changed in the github PR explorer


For Admin Use:

  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)
  • Reviewers Assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@sunnya97 sunnya97 changed the title WIP: Codespaces as Strings R4R: Codespaces as Strings Nov 15, 2018
@codecov
Copy link

codecov bot commented Nov 16, 2018

Codecov Report

Merging #2821 into develop will decrease coverage by 0.06%.
The diff coverage is 60%.

@@             Coverage Diff             @@
##           develop    #2821      +/-   ##
===========================================
- Coverage    56.75%   56.68%   -0.07%     
===========================================
  Files          131      131              
  Lines         8554     8536      -18     
===========================================
- Hits          4855     4839      -16     
+ Misses        3366     3364       -2     
  Partials       333      333

Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

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

Possible typo and a few nits.

@@ -124,19 +124,19 @@ func NewGaiaApp(logger log.Logger, db dbm.DB, traceStore io.Writer, baseAppOptio
app.keyDistr,
app.paramsKeeper.Subspace(distr.DefaultParamspace),
app.bankKeeper, &stakeKeeper, app.feeCollectionKeeper,
app.RegisterCodespace(stake.DefaultCodespace),
stake.DefaultCodespace,
Copy link
Contributor

Choose a reason for hiding this comment

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

distr.DefaultCodespace ?

@@ -107,7 +107,7 @@ func handleMsgSend(key *sdk.KVStoreKey) sdk.Handler {
if !ok {
// Create custom error message and return result
// Note: Using unreserved error codespace
return sdk.NewError(2, 1, "MsgSend is malformed").Result()
return sdk.NewError("bank", 1, "MsgSend is malformed").Result()
Copy link
Contributor

Choose a reason for hiding this comment

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

Can "bank" be a constant?

@@ -137,7 +137,7 @@ func handleFrom(store sdk.KVStore, from sdk.AccAddress, amt sdk.Coins) sdk.Resul
accBytes := store.Get(from)
if accBytes == nil {
// Account was not added to store. Return the result of the error.
return sdk.NewError(2, 101, "Account not added to store").Result()
return sdk.NewError("bank", 101, "Account not added to store").Result()
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto, should be a constant

@@ -126,7 +126,7 @@ func handleMsgIssue(keyIssue *sdk.KVStoreKey, keyAcc *sdk.KVStoreKey) sdk.Handle
return func(ctx sdk.Context, msg sdk.Msg) sdk.Result {
issueMsg, ok := msg.(MsgIssue)
if !ok {
return sdk.NewError(2, 1, "MsgIssue is malformed").Result()
return sdk.NewError("bank", 1, "MsgIssue is malformed").Result()
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be a constant

@@ -10,7 +10,7 @@ type CodeType = sdk.CodeType

const (
// Default slashing codespace
DefaultCodespace sdk.CodespaceType = 10
DefaultCodespace sdk.CodespaceType = MsgRoute
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, although sharing the variable is better reading through this line doesn't make a lot of sense (what does the codespace have to do with the msg route) - maybe we should declare const ModuleName = "slashing" and assign both MsgRoute and DefaultCodespace to ModuleName, what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

++

Copy link
Contributor

Choose a reason for hiding this comment

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

Just setting new strings that are capitalized instead, so as to differentiate.

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

Changes LGTM -- just a few minor tidbits that @cwgoes pointed out.

@@ -10,7 +10,7 @@ type CodeType = sdk.CodeType

const (
// Default slashing codespace
DefaultCodespace sdk.CodespaceType = 10
DefaultCodespace sdk.CodespaceType = MsgRoute
Copy link
Contributor

Choose a reason for hiding this comment

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

++

@jaekwon jaekwon merged commit 8d6b092 into develop Nov 16, 2018
@cwgoes cwgoes deleted the sunny/codespacer-strings branch November 16, 2018 18:40
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.

5 participants