-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/admin module sdk47 NTRN-70 #2
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
Conversation
4a6d7c0 to
1b19d62
Compare
1b19d62 to
c46b4db
Compare
04c76e4 to
cc4fc04
Compare
cc4fc04 to
97f3b41
Compare
Co-authored-by: sotnikov-s <[email protected]>
|
|
||
| clientCtx, err := client.GetClientTxContext(cmd) | ||
| if err != nil { | ||
| return err |
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.
add more info to the errors pls
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.
Literally any x/ (both neutron & non-neutron) cmd function written this way. is there a reason to do this in a single one?
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.
let's do our best to not increase this chaos. I'd like our code to be well-written. I don't ask you to rewrite all x/ returned errors this way, just to make the ones you write like that
|
is it feasible to fix unit tests for this module? right now i'm getting compilation errors on |
| if m.Proposer == "" { | ||
| return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, m.Proposer) | ||
| } | ||
|
|
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.
wyt about adding a simple validation here e.g. len(m.Messages) > 0, m.Messages are of sdk.Msg type, maybe something else?
| func (m *MsgSubmitProposalLegacy) SetContent(content govtypesv1b1.Content) error { | ||
| msg, ok := content.(proto.Message) | ||
| if !ok { | ||
| return fmt.Errorf("can't proto marshal %T", msg) |
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't proto marshal? I think it would be better to phrase it like "failed to cast proposal content of type %T to proto.Message" or something
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 is the way how it's done in current admin module & x/gov in sdk. So there his no point to rewrite legacy code
| // ValidateBasic implements Msg | ||
| func (m *MsgSubmitProposalLegacy) ValidateBasic() error { | ||
| if m.Proposer == "" { | ||
| return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, m.Proposer) |
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.
what's the point of using an empty address as a description? I'd rather put there something like "empty proposer field"
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 is the way how it's done in current admin module & x/gov in sdk. So there his no point to rewrite legacy code
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 strongly disagree with this statement and I find it distructive. It doesn't matter what is the origin of a bad piece of code, I think we are responsible for making it good as long as we own and maintain it.
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.
anyway I fixed that c:
NeverHappened
left a comment
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.
LGTM! Few minor comments.
I also would appreciate create separate tasks for keeper unit tests and renaming SubmitProposal names everywhere
TASK
Admin module PR
Neutron PR
Neutron SDK PR