Skip to content

Conversation

@quasisamurai
Copy link

@quasisamurai quasisamurai commented Aug 3, 2023

@quasisamurai quasisamurai force-pushed the feat/admin-module-sdk47 branch from 4a6d7c0 to 1b19d62 Compare August 16, 2023 07:52
@quasisamurai quasisamurai force-pushed the feat/admin-module-sdk47 branch from 1b19d62 to c46b4db Compare August 16, 2023 08:04
@quasisamurai quasisamurai changed the title Feat/admin module sdk47 Feat/admin module sdk47 NTRN-70 Aug 17, 2023
@quasisamurai quasisamurai marked this pull request as ready for review August 17, 2023 08:21
@quasisamurai quasisamurai force-pushed the feat/admin-module-sdk47 branch from 04c76e4 to cc4fc04 Compare August 25, 2023 07:52
@quasisamurai quasisamurai force-pushed the feat/admin-module-sdk47 branch from cc4fc04 to 97f3b41 Compare August 25, 2023 07:54

clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err

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

Copy link
Author

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?

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

@NeverHappened
Copy link

is it feasible to fix unit tests for this module? right now i'm getting compilation errors on make test

if m.Proposer == "" {
return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, m.Proposer)
}

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)

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

Copy link
Author

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)

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"

Copy link
Author

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

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.

Copy link
Author

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:

Copy link

@NeverHappened NeverHappened left a 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

@pr0n00gler pr0n00gler merged commit d5cd5ae into update-sdk47 Sep 7, 2023
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.

6 participants