-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Conversation
Codecov Report
@@ 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 |
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.
Possible typo and a few nits.
cmd/gaia/app/app.go
Outdated
@@ -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, |
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.
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() |
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.
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() |
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.
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() |
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.
Should be a constant
x/slashing/errors.go
Outdated
@@ -10,7 +10,7 @@ type CodeType = sdk.CodeType | |||
|
|||
const ( | |||
// Default slashing codespace | |||
DefaultCodespace sdk.CodespaceType = 10 | |||
DefaultCodespace sdk.CodespaceType = MsgRoute |
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.
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?
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.
Just setting new strings that are capitalized instead, so as to differentiate.
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.
Changes LGTM -- just a few minor tidbits that @cwgoes pointed out.
x/slashing/errors.go
Outdated
@@ -10,7 +10,7 @@ type CodeType = sdk.CodeType | |||
|
|||
const ( | |||
// Default slashing codespace | |||
DefaultCodespace sdk.CodespaceType = 10 | |||
DefaultCodespace sdk.CodespaceType = MsgRoute |
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.
++
…dk into sunny/codespacer-strings
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 explorerFor Admin Use: