Skip to content

Commit 9f207d5

Browse files
authored
register deprecated vault MsgUpdateParams (#2167)
1 parent dadd984 commit 9f207d5

File tree

9 files changed

+390
-40
lines changed

9 files changed

+390
-40
lines changed

indexer/packages/v4-protos/src/codegen/dydxprotocol/vault/tx.ts

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { VaultId, VaultIdSDKType } from "./vault";
22
import { SubaccountId, SubaccountIdSDKType } from "../subaccounts/subaccount";
3-
import { QuotingParams, QuotingParamsSDKType } from "./params";
3+
import { QuotingParams, QuotingParamsSDKType, Params, ParamsSDKType } from "./params";
44
import * as _m0 from "protobufjs/minimal";
55
import { DeepPartial } from "../../helpers";
66
/**
@@ -107,6 +107,32 @@ export interface MsgSetVaultQuotingParamsResponse {}
107107
*/
108108

109109
export interface MsgSetVaultQuotingParamsResponseSDKType {}
110+
/**
111+
* MsgUpdateParams is the Msg/UpdateParams request type.
112+
* Deprecated since v6.x as is replaced by MsgUpdateDefaultQuotingParams.
113+
*/
114+
115+
/** @deprecated */
116+
117+
export interface MsgUpdateParams {
118+
authority: string;
119+
/** The parameters to update. Each field must be set. */
120+
121+
params?: Params;
122+
}
123+
/**
124+
* MsgUpdateParams is the Msg/UpdateParams request type.
125+
* Deprecated since v6.x as is replaced by MsgUpdateDefaultQuotingParams.
126+
*/
127+
128+
/** @deprecated */
129+
130+
export interface MsgUpdateParamsSDKType {
131+
authority: string;
132+
/** The parameters to update. Each field must be set. */
133+
134+
params?: ParamsSDKType;
135+
}
110136

111137
function createBaseMsgDepositToVault(): MsgDepositToVault {
112138
return {
@@ -393,4 +419,59 @@ export const MsgSetVaultQuotingParamsResponse = {
393419
return message;
394420
}
395421

422+
};
423+
424+
function createBaseMsgUpdateParams(): MsgUpdateParams {
425+
return {
426+
authority: "",
427+
params: undefined
428+
};
429+
}
430+
431+
export const MsgUpdateParams = {
432+
encode(message: MsgUpdateParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
433+
if (message.authority !== "") {
434+
writer.uint32(10).string(message.authority);
435+
}
436+
437+
if (message.params !== undefined) {
438+
Params.encode(message.params, writer.uint32(18).fork()).ldelim();
439+
}
440+
441+
return writer;
442+
},
443+
444+
decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams {
445+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
446+
let end = length === undefined ? reader.len : reader.pos + length;
447+
const message = createBaseMsgUpdateParams();
448+
449+
while (reader.pos < end) {
450+
const tag = reader.uint32();
451+
452+
switch (tag >>> 3) {
453+
case 1:
454+
message.authority = reader.string();
455+
break;
456+
457+
case 2:
458+
message.params = Params.decode(reader, reader.uint32());
459+
break;
460+
461+
default:
462+
reader.skipType(tag & 7);
463+
break;
464+
}
465+
}
466+
467+
return message;
468+
},
469+
470+
fromPartial(object: DeepPartial<MsgUpdateParams>): MsgUpdateParams {
471+
const message = createBaseMsgUpdateParams();
472+
message.authority = object.authority ?? "";
473+
message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined;
474+
return message;
475+
}
476+
396477
};

proto/dydxprotocol/vault/tx.proto

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,15 @@ message MsgSetVaultQuotingParams {
8080
// MsgSetVaultQuotingParamsResponse is the Msg/SetVaultQuotingParams response
8181
// type.
8282
message MsgSetVaultQuotingParamsResponse {}
83+
84+
// MsgUpdateParams is the Msg/UpdateParams request type.
85+
// Deprecated since v6.x as is replaced by MsgUpdateDefaultQuotingParams.
86+
message MsgUpdateParams {
87+
option deprecated = true;
88+
// Authority is the address that controls the module.
89+
option (cosmos.msg.v1.signer) = "authority";
90+
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
91+
92+
// The parameters to update. Each field must be set.
93+
Params params = 2 [ (gogoproto.nullable) = false ];
94+
}

protocol/app/msgs/all_msgs.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ var (
245245
"/dydxprotocol.vault.MsgSetVaultQuotingParamsResponse": {},
246246
"/dydxprotocol.vault.MsgUpdateDefaultQuotingParams": {},
247247
"/dydxprotocol.vault.MsgUpdateDefaultQuotingParamsResponse": {},
248+
"/dydxprotocol.vault.MsgUpdateParams": {},
248249

249250
// vest
250251
"/dydxprotocol.vest.MsgSetVestEntry": {},

protocol/app/msgs/unsupported_msgs.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
66
govbeta "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
77
icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"
8+
vaulttypes "github.com/dydxprotocol/v4-chain/protocol/x/vault/types"
89
)
910

1011
var (
@@ -28,5 +29,10 @@ var (
2829
"/ibc.applications.interchain_accounts.controller.v1.MsgUpdateParams": &icacontrollertypes.
2930
MsgUpdateParams{},
3031
"/ibc.applications.interchain_accounts.controller.v1.MsgUpdateParamsResponse": nil,
32+
33+
// vault
34+
// MsgUpdateParams is deprecated since v6.x and replaced by MsgUpdateDefaultQuotingParams.
35+
// nolint:staticcheck
36+
"/dydxprotocol.vault.MsgUpdateParams": &vaulttypes.MsgUpdateParams{},
3137
}
3238
)

protocol/app/msgs/unsupported_msgs_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ func TestUnsupportedMsgSamples_Key(t *testing.T) {
1616
"/cosmos.gov.v1beta1.MsgSubmitProposal",
1717
"/cosmos.gov.v1beta1.MsgSubmitProposalResponse",
1818

19+
"/dydxprotocol.vault.MsgUpdateParams",
20+
1921
// ICA Controller messages
2022
"/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount",
2123
"/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccountResponse",

protocol/lib/ante/nested_msg_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/dydxprotocol/v4-chain/protocol/lib"
1313
"github.com/dydxprotocol/v4-chain/protocol/lib/ante"
1414
testmsgs "github.com/dydxprotocol/v4-chain/protocol/testutil/msgs"
15+
vaulttypes "github.com/dydxprotocol/v4-chain/protocol/x/vault/types"
1516

1617
"github.com/stretchr/testify/require"
1718
)
@@ -70,6 +71,10 @@ func TestIsDydxMsg_Invalid(t *testing.T) {
7071
appmsgs.AppInjectedMsgSamples,
7172
appmsgs.NormalMsgsDydxCustom,
7273
appmsgs.InternalMsgSamplesDydxCustom,
74+
map[string]sdk.Msg{
75+
// nolint:staticcheck
76+
"/dydxprotocol.vault.MsgUpdateParams": &vaulttypes.MsgUpdateParams{},
77+
},
7378
)
7479
allMsgsMinusDydx := lib.MergeAllMapsMustHaveDistinctKeys(appmsgs.AllowMsgs, appmsgs.DisallowMsgs)
7580
for key := range allDydxMsgs {

protocol/lib/ante/unsupported_msgs.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
66
govbeta "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
77
icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"
8+
vaulttypes "github.com/dydxprotocol/v4-chain/protocol/x/vault/types"
89
)
910

1011
// IsUnsupportedMsg returns true if the msg is unsupported by the app.
@@ -18,7 +19,11 @@ func IsUnsupportedMsg(msg sdk.Msg) bool {
1819
// ------- CosmosSDK default modules
1920
// gov
2021
*govbeta.MsgSubmitProposal,
21-
*gov.MsgCancelProposal:
22+
*gov.MsgCancelProposal,
23+
// ------- dYdX custom modules
24+
// vault
25+
// nolint:staticcheck
26+
*vaulttypes.MsgUpdateParams:
2227
return true
2328
}
2429
return false

protocol/x/vault/types/codec.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,22 @@ package types
33
import (
44
"github.com/cosmos/cosmos-sdk/codec"
55
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
6+
sdk "github.com/cosmos/cosmos-sdk/types"
67
"github.com/cosmos/cosmos-sdk/types/msgservice"
8+
"github.com/cosmos/gogoproto/proto"
79
"github.com/dydxprotocol/v4-chain/protocol/app/module"
810
)
911

1012
func RegisterCodec(cdc *codec.LegacyAmino) {}
1113

1214
func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
1315
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
16+
// Register deprecated MsgUpdateParams as it's not part of msg service.
17+
registry.RegisterInterface(
18+
"/"+proto.MessageName(&MsgUpdateParams{}),
19+
(*sdk.Msg)(nil),
20+
&MsgUpdateParams{},
21+
)
1422
}
1523

1624
var (

0 commit comments

Comments
 (0)