Skip to content

Commit

Permalink
disallow to send MsgVerifyInvariant
Browse files Browse the repository at this point in the history
  • Loading branch information
Geoff Lee authored and hanjukim committed Apr 11, 2022
1 parent bb65e95 commit c81863b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 24 deletions.
19 changes: 10 additions & 9 deletions src/core/crisis/MsgVerifyInvariant.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@ describe('MsgVerifyInvariant', () => {
invariantModuleName: 'bank',
invariantRoute: 'nonnegative-outstanding-supply',
});

expect(send.toAmino()).toMatchObject({
type: 'crisis/MsgVerifyInvariant',
value: {
sender: 'terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v',
invariantModuleName: 'bank',
invariantRoute: 'nonnegative-outstanding-supply',
},
});
});

it('deserialize correctly proto', () => {
Expand All @@ -48,4 +39,14 @@ describe('MsgVerifyInvariant', () => {
invariantRoute: 'nonnegative-outstanding-supply',
});
});

it('not allowed conversion to amino/proto', () => {
const Msg = new MsgVerifyInvariant(
'terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v',
'bank',
'nonnegative-outstanding-supply'
);
expect(Msg.toAmino).toThrow(/MsgVerifyInvarant is not allowed to send/);
expect(Msg.toProto).toThrow(/MsgVerifyInvarant is not allowed to send/);
});
});
17 changes: 2 additions & 15 deletions src/core/crisis/MsgVerifyInvariant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,7 @@ export class MsgVerifyInvariant extends JSONSerializable<
}

public toAmino(): MsgVerifyInvariant.Amino {
const { sender, invariantModuleName, invariantRoute } = this;
return {
type: 'crisis/MsgVerifyInvariant',
value: {
sender,
invariantModuleName,
invariantRoute,
},
};
throw new Error('MsgVerifyInvarant is not allowed to send');
}

public static fromData(data: MsgVerifyInvariant.Data): MsgVerifyInvariant {
Expand Down Expand Up @@ -68,12 +60,7 @@ export class MsgVerifyInvariant extends JSONSerializable<
}

public toProto(): MsgVerifyInvariant.Proto {
const { sender, invariantModuleName, invariantRoute } = this;
return MsgVerifyInvariant_pb.fromPartial({
sender,
invariantModuleName,
invariantRoute,
});
throw new Error('MsgVerifyInvarant is not allowed to send');
}

public packAny(): Any {
Expand Down

0 comments on commit c81863b

Please sign in to comment.