From c81863bd050eb0ba8747daafc27f282f09dcaf32 Mon Sep 17 00:00:00 2001 From: Geoff Lee Date: Fri, 1 Apr 2022 14:57:49 +0900 Subject: [PATCH] disallow to send MsgVerifyInvariant --- src/core/crisis/MsgVerifyInvariant.spec.ts | 19 ++++++++++--------- src/core/crisis/MsgVerifyInvariant.ts | 17 ++--------------- 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/core/crisis/MsgVerifyInvariant.spec.ts b/src/core/crisis/MsgVerifyInvariant.spec.ts index dc46c01a9..4c7425e4f 100644 --- a/src/core/crisis/MsgVerifyInvariant.spec.ts +++ b/src/core/crisis/MsgVerifyInvariant.spec.ts @@ -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', () => { @@ -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/); + }); }); diff --git a/src/core/crisis/MsgVerifyInvariant.ts b/src/core/crisis/MsgVerifyInvariant.ts index eadcd6ccf..c19a51c11 100644 --- a/src/core/crisis/MsgVerifyInvariant.ts +++ b/src/core/crisis/MsgVerifyInvariant.ts @@ -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 { @@ -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 {