diff --git a/gen/rollup/module/v1/module.pb.go b/gen/rollup/module/v1/module.pb.go index 8c4ed5a1..42009cd1 100644 --- a/gen/rollup/module/v1/module.pb.go +++ b/gen/rollup/module/v1/module.pb.go @@ -25,6 +25,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Module is the config object for the x/rollup module. type Module struct { + // authority defines the custom module authority. If not set, defaults to the governance module. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` } func (m *Module) Reset() { *m = Module{} } @@ -60,6 +62,13 @@ func (m *Module) XXX_DiscardUnknown() { var xxx_messageInfo_Module proto.InternalMessageInfo +func (m *Module) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + func init() { proto.RegisterType((*Module)(nil), "rollup.module.v1.Module") } @@ -67,19 +76,20 @@ func init() { func init() { proto.RegisterFile("rollup/module/v1/module.proto", fileDescriptor_5510ebceb64c57ed) } var fileDescriptor_5510ebceb64c57ed = []byte{ - // 180 bytes of a gzipped FileDescriptorProto + // 202 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2d, 0xca, 0xcf, 0xc9, 0x29, 0x2d, 0xd0, 0xcf, 0xcd, 0x4f, 0x29, 0xcd, 0x49, 0xd5, 0x2f, 0x33, 0x84, 0xb2, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x04, 0x20, 0xd2, 0x7a, 0x50, 0xc1, 0x32, 0x43, 0x29, 0x85, 0xe4, 0xfc, 0xe2, 0xdc, 0xfc, 0x62, 0xfd, 0xc4, 0x82, 0x02, 0xfd, 0x32, 0xc3, 0xc4, 0x9c, 0x82, 0x8c, - 0x44, 0x54, 0x3d, 0x4a, 0x16, 0x5c, 0x6c, 0xbe, 0x60, 0xbe, 0x95, 0xde, 0xae, 0x03, 0xd3, 0x6e, - 0x31, 0x6a, 0x70, 0xa9, 0xa5, 0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8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, + 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x6b, 0xfc, 0x26, 0xa4, 0xa7, 0xe6, 0xe9, + 0xa3, 0x7b, 0xd3, 0x1a, 0xc2, 0x2a, 0x33, 0x4c, 0x62, 0x03, 0xbb, 0xda, 0x18, 0x10, 0x00, 0x00, + 0xff, 0xff, 0x83, 0x1b, 0xcb, 0x99, 0x0a, 0x01, 0x00, 0x00, } func (m *Module) Marshal() (dAtA []byte, err error) { @@ -102,6 +112,13 @@ func (m *Module) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintModule(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } @@ -122,6 +139,10 @@ func (m *Module) Size() (n int) { } var l int _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovModule(uint64(l)) + } return n } @@ -160,6 +181,38 @@ func (m *Module) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModule + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthModule + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthModule + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipModule(dAtA[iNdEx:]) diff --git a/proto/rollup/module/v1/module.proto b/proto/rollup/module/v1/module.proto index 6a621822..a3dd8152 100644 --- a/proto/rollup/module/v1/module.proto +++ b/proto/rollup/module/v1/module.proto @@ -11,4 +11,7 @@ message Module { option (cosmos.app.v1alpha1.module) = { go_import: "github.com/polymerdao/monomer/x/rollup" }; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 1; } diff --git a/proto/rollup/v1/tx.proto b/proto/rollup/v1/tx.proto index e34e1f64..27e3d9f4 100644 --- a/proto/rollup/v1/tx.proto +++ b/proto/rollup/v1/tx.proto @@ -6,6 +6,7 @@ import "amino/amino.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; +import "rollup/v1/rollup.proto"; option go_package = "github.com/polymerdao/monomer/x/rollup/types"; @@ -20,6 +21,9 @@ service Msg { // InitiateFeeWithdrawal defines a method for initiating a withdrawal of fees from L2 to the L1 fee recipient address. rpc InitiateFeeWithdrawal(MsgInitiateFeeWithdrawal) returns (MsgInitiateFeeWithdrawalResponse); + + // UpdateParams defines a method for updating the x/rollup module parameters. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgApplyL1Txs defines the message for applying all L1 system and user deposit txs. @@ -66,3 +70,18 @@ message MsgInitiateFeeWithdrawal { // MsgInitiateFeeWithdrawalResponse defines the Msg/InitiateFeeWithdrawal response type. message MsgInitiateFeeWithdrawalResponse {} + +// MsgUpdateParams defines a Msg for updating the x/rollup module parameters. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address of the admin account. + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the x/rollup parameters to update. + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgUpdateParamsResponse defines the Msg/MsgUpdateParams response type. +message MsgUpdateParamsResponse {} diff --git a/x/rollup/keeper/grpc_query.go b/x/rollup/keeper/grpc_query.go index 68e73e48..f4f86a83 100644 --- a/x/rollup/keeper/grpc_query.go +++ b/x/rollup/keeper/grpc_query.go @@ -10,10 +10,21 @@ import ( "google.golang.org/grpc/status" ) -var _ types.QueryServer = (*Keeper)(nil) +type Querier struct { + Keeper +} + +var _ types.QueryServer = &Keeper{} + +func NewQuerier(keeper *Keeper) Querier { + return Querier{Keeper: *keeper} +} // L1BlockInfo implements the Query/L1BlockInfo gRPC method -func (k *Keeper) L1BlockInfo(ctx context.Context, req *types.QueryL1BlockInfoRequest) (*types.QueryL1BlockInfoResponse, error) { +func (k Keeper) L1BlockInfo( //nolint:gocritic // hugeParam + ctx context.Context, + req *types.QueryL1BlockInfoRequest, +) (*types.QueryL1BlockInfoResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -25,7 +36,10 @@ func (k *Keeper) L1BlockInfo(ctx context.Context, req *types.QueryL1BlockInfoReq } // Params implements the Query/Params gRPC method -func (k *Keeper) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (k Keeper) Params( //nolint:gocritic // hugeParam + ctx context.Context, + req *types.QueryParamsRequest, +) (*types.QueryParamsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } diff --git a/x/rollup/keeper/keeper.go b/x/rollup/keeper/keeper.go index 8e82cc61..ec2e8ed2 100644 --- a/x/rollup/keeper/keeper.go +++ b/x/rollup/keeper/keeper.go @@ -14,6 +14,7 @@ import ( type Keeper struct { cdc codec.BinaryCodec storeService store.KVStoreService + authority sdk.AccAddress rollupCfg *rollup.Config bankkeeper types.BankKeeper accountkeeper types.AccountKeeper @@ -22,6 +23,7 @@ type Keeper struct { func NewKeeper( cdc codec.BinaryCodec, storeService store.KVStoreService, + authority sdk.AccAddress, // dependencies bankKeeper types.BankKeeper, accountKeeper types.AccountKeeper, @@ -32,6 +34,7 @@ func NewKeeper( bankkeeper: bankKeeper, accountkeeper: accountKeeper, rollupCfg: &rollup.Config{}, + authority: authority, } } diff --git a/x/rollup/keeper/keeper_test.go b/x/rollup/keeper/keeper_test.go index 7b6d2fc5..492ac493 100644 --- a/x/rollup/keeper/keeper_test.go +++ b/x/rollup/keeper/keeper_test.go @@ -11,6 +11,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/polymerdao/monomer/x/rollup/keeper" rolluptestutil "github.com/polymerdao/monomer/x/rollup/testutil" "github.com/polymerdao/monomer/x/rollup/types" @@ -51,6 +52,7 @@ func (s *KeeperTestSuite) setup() { s.rollupKeeper = keeper.NewKeeper( moduletestutil.MakeTestEncodingConfig().Codec, runtime.NewKVStoreService(storeKey), + authtypes.NewModuleAddress(govtypes.ModuleName), s.bankKeeper, s.accountKeeper, ) diff --git a/x/rollup/keeper/msg_server.go b/x/rollup/keeper/msg_server.go index c4b4c51e..6355b909 100644 --- a/x/rollup/keeper/msg_server.go +++ b/x/rollup/keeper/msg_server.go @@ -146,3 +146,24 @@ func (k *Keeper) InitiateFeeWithdrawal( return &types.MsgInitiateFeeWithdrawalResponse{}, nil } + +func (k *Keeper) UpdateParams( + goCtx context.Context, + msg *types.MsgUpdateParams, +) (*types.MsgUpdateParamsResponse, error) { + if k.authority.String() != msg.Authority { + return nil, types.WrapError(types.ErrUpdateParams, "invalid authority: expected %s, got %s", k.authority.String(), msg.Authority) + } + + params := &msg.Params + if err := params.Validate(); err != nil { + return nil, types.WrapError(types.ErrUpdateParams, "validate params: %w", err) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.SetParams(ctx, &msg.Params); err != nil { + return nil, types.WrapError(types.ErrUpdateParams, "set params: %w", err) + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/rollup/keeper/msg_server_test.go b/x/rollup/keeper/msg_server_test.go index 8a5bf1e3..7e931f0e 100644 --- a/x/rollup/keeper/msg_server_test.go +++ b/x/rollup/keeper/msg_server_test.go @@ -5,6 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/ethereum-optimism/optimism/op-service/eth" gethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/golang/mock/gomock" @@ -279,3 +280,52 @@ func (s *KeeperTestSuite) TestInitiateFeeWithdrawal() { }) } } + +func (s *KeeperTestSuite) TestUpdateParams() { + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + validParams := types.DefaultParams() + invalidParams := types.Params{} + + tests := map[string]struct { + authority sdk.AccAddress + params types.Params + shouldError bool + }{ + "valid authority with valid params": { + authority: authority, + params: validParams, + shouldError: false, + }, + "invalid authority": { + authority: sdk.AccAddress("invalid_authority"), + params: validParams, + shouldError: true, + }, + "valid authority with invalid params": { + authority: authority, + params: invalidParams, + shouldError: true, + }, + } + + for name, test := range tests { + s.Run(name, func() { + resp, err := s.rollupKeeper.UpdateParams(s.ctx, &types.MsgUpdateParams{ + Authority: test.authority.String(), + Params: test.params, + }) + + if test.shouldError { + s.Require().Error(err) + s.Require().Nil(resp) + } else { + s.Require().NoError(err) + s.Require().NotNil(resp) + + params, err := s.rollupKeeper.GetParams(sdk.UnwrapSDKContext(s.ctx)) + s.Require().NoError(err) + s.Require().Equal(test.params, *params) + } + }) + } +} diff --git a/x/rollup/module.go b/x/rollup/module.go index 93cc05a5..8d2c0dcb 100644 --- a/x/rollup/module.go +++ b/x/rollup/module.go @@ -14,7 +14,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" protov1 "github.com/golang/protobuf/proto" //nolint:staticcheck "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -29,6 +31,7 @@ import ( type ModuleInputs struct { depinject.In + Config *modulev1.Module Codec codec.Codec StoreService store.KVStoreService BankKeeper bankkeeper.Keeper @@ -57,7 +60,13 @@ func ProvideCustomGetSigner() signing.CustomGetSigner { } func ProvideModule(in ModuleInputs) ModuleOutputs { //nolint:gocritic // hugeParam - k := keeper.NewKeeper(in.Codec, in.StoreService, in.BankKeeper, in.AccountKeeper) + // default to governance authority if not provided + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + if in.Config.Authority != "" { + authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) + } + + k := keeper.NewKeeper(in.Codec, in.StoreService, authority, in.BankKeeper, in.AccountKeeper) return ModuleOutputs{ Keeper: k, Module: NewAppModule(in.Codec, k), diff --git a/x/rollup/tests/integration/rollup_test.go b/x/rollup/tests/integration/rollup_test.go index 878451eb..05eed162 100644 --- a/x/rollup/tests/integration/rollup_test.go +++ b/x/rollup/tests/integration/rollup_test.go @@ -21,6 +21,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/ethereum/go-ethereum/common" gethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/polymerdao/monomer" @@ -35,7 +36,8 @@ const initialFeeCollectorBalance = 1_000_000 func TestRollup(t *testing.T) { integrationApp, feeCollectorAddr := setupIntegrationApp(t) - queryClient := banktypes.NewQueryClient(integrationApp.QueryHelper()) + bankQueryClient := banktypes.NewQueryClient(integrationApp.QueryHelper()) + rollupQueryClient := rolluptypes.NewQueryClient(integrationApp.QueryHelper()) erc20tokenAddr := common.HexToAddress("0xabcdef123456") erc20userAddr := common.HexToAddress("0x123456abcdef") @@ -60,15 +62,15 @@ func TestRollup(t *testing.T) { require.NoError(t, err) // query the mint address ETH balance and assert it's zero - require.Equal(t, math.ZeroInt(), queryETHBalance(t, queryClient, mintAddr, integrationApp)) + require.Equal(t, math.ZeroInt(), queryETHBalance(t, bankQueryClient, mintAddr, integrationApp)) // query the recipient address ETH balance and assert it's zero - require.Equal(t, math.ZeroInt(), queryETHBalance(t, queryClient, userCosmosAddr, integrationApp)) + require.Equal(t, math.ZeroInt(), queryETHBalance(t, bankQueryClient, userCosmosAddr, integrationApp)) // query the user's ERC20 balance and assert it's zero erc20userCosmosAddr, err := monomer.CosmosETHAddress(erc20userAddr).Encode(sdk.GetConfig().GetBech32AccountAddrPrefix()) require.NoError(t, err) - require.Equal(t, math.ZeroInt(), queryERC20Balance(t, queryClient, erc20userCosmosAddr, erc20tokenAddr, integrationApp)) + require.Equal(t, math.ZeroInt(), queryERC20Balance(t, bankQueryClient, erc20userCosmosAddr, erc20tokenAddr, integrationApp)) // send an invalid MsgApplyL1Txs and assert error _, err = integrationApp.RunMsg(&rolluptypes.MsgApplyL1Txs{ @@ -83,13 +85,13 @@ func TestRollup(t *testing.T) { require.NoError(t, err) // query the mint address ETH balance and assert it's equal to the mint amount minus the transfer amount - require.Equal(t, new(big.Int).Sub(mintAmount, transferAmount), queryETHBalance(t, queryClient, mintAddr, integrationApp).BigInt()) + require.Equal(t, new(big.Int).Sub(mintAmount, transferAmount), queryETHBalance(t, bankQueryClient, mintAddr, integrationApp).BigInt()) // query the recipient address ETH balance and assert it's equal to the transfer amount - require.Equal(t, transferAmount, queryETHBalance(t, queryClient, userCosmosAddr, integrationApp).BigInt()) + require.Equal(t, transferAmount, queryETHBalance(t, bankQueryClient, userCosmosAddr, integrationApp).BigInt()) // query the user's ERC20 balance and assert it's equal to the deposit amount - require.Equal(t, erc20depositAmount, queryERC20Balance(t, queryClient, erc20userCosmosAddr, erc20tokenAddr, integrationApp).BigInt()) + require.Equal(t, erc20depositAmount, queryERC20Balance(t, bankQueryClient, erc20userCosmosAddr, erc20tokenAddr, integrationApp).BigInt()) // try to withdraw more than deposited and assert error _, err = integrationApp.RunMsg(&rolluptypes.MsgInitiateWithdrawal{ @@ -112,10 +114,10 @@ func TestRollup(t *testing.T) { require.NoError(t, err) // query the recipient address ETH balance and assert it's zero - require.Equal(t, math.ZeroInt(), queryETHBalance(t, queryClient, userCosmosAddr, integrationApp)) + require.Equal(t, math.ZeroInt(), queryETHBalance(t, bankQueryClient, userCosmosAddr, integrationApp)) // query the fee collector's ETH balance and assert it's equal to the initial mint amount - require.Equal(t, math.NewInt(initialFeeCollectorBalance), queryETHBalance(t, queryClient, feeCollectorAddr, integrationApp)) + require.Equal(t, math.NewInt(initialFeeCollectorBalance), queryETHBalance(t, bankQueryClient, feeCollectorAddr, integrationApp)) // send a successful MsgInitiateFeeWithdrawal _, err = integrationApp.RunMsg(&rolluptypes.MsgInitiateFeeWithdrawal{ @@ -124,7 +126,30 @@ func TestRollup(t *testing.T) { require.NoError(t, err) // query the fee collector's ETH balance and assert it's zero - require.Equal(t, math.ZeroInt(), queryETHBalance(t, queryClient, feeCollectorAddr, integrationApp)) + require.Equal(t, math.ZeroInt(), queryETHBalance(t, bankQueryClient, feeCollectorAddr, integrationApp)) + + // query the current x/rollup params and assert they're the default params + paramsResp, err := rollupQueryClient.Params(integrationApp.Context(), &rolluptypes.QueryParamsRequest{}) + require.NoError(t, err) + require.Equal(t, rolluptypes.DefaultParams(), paramsResp.Params) + + // send a successful MsgUpdateParams + updatedParams := rolluptypes.Params{ + L1FeeRecipient: common.HexToAddress("0x123456abcdef").String(), + L1CrossDomainMessenger: common.HexToAddress("0xabcdef123456").String(), + MinFeeWithdrawalAmount: 5, + FeeWithdrawalGasLimit: 5, + } + _, err = integrationApp.RunMsg(&rolluptypes.MsgUpdateParams{ + Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + Params: updatedParams, + }) + require.NoError(t, err) + + // query the updated x/rollup params and assert they're the updated params + updatedParamsResp, err := rollupQueryClient.Params(integrationApp.Context(), &rolluptypes.QueryParamsRequest{}) + require.NoError(t, err) + require.Equal(t, updatedParams, updatedParamsResp.Params) } func setupIntegrationApp(t *testing.T) (*integration.App, string) { @@ -159,6 +184,7 @@ func setupIntegrationApp(t *testing.T) (*integration.App, string) { rollupKeeper := rollupkeeper.NewKeeper( encodingCfg.Codec, runtime.NewKVStoreService(keys[rolluptypes.StoreKey]), + authtypes.NewModuleAddress(govtypes.ModuleName), bankKeeper, accountKeeper, ) @@ -185,6 +211,7 @@ func setupIntegrationApp(t *testing.T) (*integration.App, string) { }, ) rolluptypes.RegisterMsgServer(integrationApp.MsgServiceRouter(), rollupKeeper) + rolluptypes.RegisterQueryServer(integrationApp.QueryHelper(), rollupkeeper.NewQuerier(rollupKeeper)) banktypes.RegisterQueryServer(integrationApp.QueryHelper(), bankkeeper.NewQuerier(&bankKeeper)) return integrationApp, accountKeeper.GetModuleAddress(authtypes.FeeCollectorName).String() diff --git a/x/rollup/types/errors.go b/x/rollup/types/errors.go index dabfc5bc..741eda91 100644 --- a/x/rollup/types/errors.go +++ b/x/rollup/types/errors.go @@ -19,6 +19,7 @@ var ( ErrProcessL1UserDepositTxs = registerErr("failed to process L1 user deposit txs") ErrProcessL1SystemDepositTx = registerErr("failed to process L1 system deposit tx") ErrInitiateFeeWithdrawal = registerErr("failed to initiate fee withdrawal") + ErrUpdateParams = registerErr("failed to updated params") ) // register new errors without hard-coding error codes diff --git a/x/rollup/types/tx.pb.go b/x/rollup/types/tx.pb.go index d0a6aa40..36fc90b3 100644 --- a/x/rollup/types/tx.pb.go +++ b/x/rollup/types/tx.pb.go @@ -311,6 +311,99 @@ func (m *MsgInitiateFeeWithdrawalResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgInitiateFeeWithdrawalResponse proto.InternalMessageInfo +// MsgUpdateParams defines a Msg for updating the x/rollup module parameters. +type MsgUpdateParams struct { + // authority is the address of the admin account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/rollup parameters to update. + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_106533843870de0f, []int{6} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the Msg/MsgUpdateParams response type. +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_106533843870de0f, []int{7} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgApplyL1Txs)(nil), "rollup.v1.MsgApplyL1Txs") proto.RegisterType((*MsgApplyL1TxsResponse)(nil), "rollup.v1.MsgApplyL1TxsResponse") @@ -318,44 +411,52 @@ func init() { proto.RegisterType((*MsgInitiateWithdrawalResponse)(nil), "rollup.v1.MsgInitiateWithdrawalResponse") proto.RegisterType((*MsgInitiateFeeWithdrawal)(nil), "rollup.v1.MsgInitiateFeeWithdrawal") proto.RegisterType((*MsgInitiateFeeWithdrawalResponse)(nil), "rollup.v1.MsgInitiateFeeWithdrawalResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "rollup.v1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "rollup.v1.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("rollup/v1/tx.proto", fileDescriptor_106533843870de0f) } var fileDescriptor_106533843870de0f = []byte{ - // 501 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0x3f, 0x6f, 0x13, 0x31, - 0x1c, 0xcd, 0x35, 0x4d, 0x68, 0x4c, 0x19, 0xb0, 0x1a, 0x7a, 0x3d, 0xc4, 0xe5, 0x74, 0x2c, 0x51, - 0xa0, 0xe7, 0x06, 0x36, 0xb6, 0x66, 0x88, 0x88, 0xd4, 0x2e, 0x07, 0x12, 0x82, 0x25, 0x38, 0x3d, - 0xcb, 0xb1, 0x38, 0x9f, 0x4f, 0xb6, 0x13, 0x2e, 0x1b, 0xe2, 0x13, 0xf0, 0x1d, 0x58, 0x18, 0x3b, - 0xf4, 0x43, 0x74, 0xac, 0x3a, 0x21, 0x86, 0x0a, 0x25, 0x43, 0xbe, 0x06, 0xba, 0x3f, 0x89, 0x1a, - 0x48, 0x04, 0x12, 0xcb, 0xc9, 0xef, 0xf7, 0xde, 0xef, 0x3d, 0x9f, 0x7f, 0x36, 0x80, 0x52, 0x84, - 0xe1, 0x28, 0x46, 0xe3, 0x36, 0xd2, 0x89, 0x17, 0x4b, 0xa1, 0x05, 0xac, 0xe5, 0x35, 0x6f, 0xdc, - 0xb6, 0xee, 0x63, 0xce, 0x22, 0x81, 0xb2, 0x6f, 0xce, 0x5a, 0xfb, 0x67, 0x42, 0x71, 0xa1, 0x10, - 0x57, 0x34, 0xed, 0xe2, 0x8a, 0x16, 0xc4, 0x41, 0x4e, 0xf4, 0x33, 0x84, 0x72, 0x50, 0x50, 0x7b, - 0x54, 0x50, 0x91, 0xd7, 0xd3, 0x55, 0x5e, 0x75, 0x5b, 0xe0, 0xde, 0xa9, 0xa2, 0xc7, 0x71, 0x1c, - 0x4e, 0x4e, 0xda, 0xaf, 0x13, 0x05, 0x0f, 0xc0, 0x8e, 0x4e, 0xfa, 0x83, 0x89, 0x26, 0xca, 0x34, - 0x9c, 0x72, 0x73, 0xd7, 0xbf, 0xa3, 0x93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0xb2, 0x5e, 0xc4, 0x3f, - 0xfb, 0xba, 0x05, 0xca, 0xa7, 0x8a, 0xc2, 0x97, 0x00, 0xdc, 0x9a, 0xa9, 0xe9, 0x2d, 0x6f, 0x93, - 0xb7, 0x32, 0x41, 0xcb, 0xd9, 0xc4, 0x2c, 0x1c, 0xe1, 0x7b, 0x00, 0xd7, 0xcc, 0xf5, 0xb7, 0xbe, - 0x3f, 0x15, 0x56, 0xf3, 0x6f, 0x8a, 0x65, 0x02, 0x03, 0xf5, 0xf5, 0xe7, 0xf5, 0x78, 0xbd, 0xc5, - 0x8a, 0xc8, 0x7a, 0xf2, 0x0f, 0xa2, 0x45, 0x94, 0x55, 0xf9, 0x94, 0x5e, 0x85, 0x4e, 0xf7, 0x72, - 0x6a, 0x1b, 0x57, 0x53, 0xdb, 0xf8, 0x39, 0xb5, 0x8d, 0x2f, 0x33, 0xbb, 0x74, 0x35, 0xb3, 0x4b, - 0xdf, 0x67, 0x76, 0xe9, 0xdd, 0x53, 0xca, 0xf4, 0x70, 0x34, 0xf0, 0xce, 0x04, 0x47, 0xb1, 0x08, - 0x27, 0x9c, 0xc8, 0x00, 0x0b, 0xc4, 0x45, 0x24, 0x38, 0x91, 0x28, 0x41, 0xc5, 0x53, 0xd5, 0x93, - 0x98, 0xa8, 0x41, 0x35, 0x7b, 0x43, 0xcf, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0x36, 0x89, 0x04, - 0x91, 0xc1, 0x03, 0x00, 0x00, + // 594 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0x8d, 0xfb, 0x93, 0xaf, 0xb9, 0xed, 0x07, 0xea, 0xa8, 0x6d, 0x1c, 0x23, 0x9c, 0xc8, 0x6c, + 0xa2, 0x40, 0xed, 0xa6, 0x20, 0x16, 0xdd, 0x35, 0x8b, 0x88,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 0xd6, 0x04, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -376,6 +477,8 @@ type MsgClient interface { InitiateWithdrawal(ctx context.Context, in *MsgInitiateWithdrawal, opts ...grpc.CallOption) (*MsgInitiateWithdrawalResponse, error) // InitiateFeeWithdrawal defines a method for initiating a withdrawal of fees from L2 to the L1 fee recipient address. InitiateFeeWithdrawal(ctx context.Context, in *MsgInitiateFeeWithdrawal, opts ...grpc.CallOption) (*MsgInitiateFeeWithdrawalResponse, error) + // UpdateParams defines a method for updating the x/rollup module parameters. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -413,6 +516,15 @@ func (c *msgClient) InitiateFeeWithdrawal(ctx context.Context, in *MsgInitiateFe return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/rollup.v1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // ApplyL1Txs defines a method for applying applying all L1 system and user deposit txs. @@ -421,6 +533,8 @@ type MsgServer interface { InitiateWithdrawal(context.Context, *MsgInitiateWithdrawal) (*MsgInitiateWithdrawalResponse, error) // InitiateFeeWithdrawal defines a method for initiating a withdrawal of fees from L2 to the L1 fee recipient address. InitiateFeeWithdrawal(context.Context, *MsgInitiateFeeWithdrawal) (*MsgInitiateFeeWithdrawalResponse, error) + // UpdateParams defines a method for updating the x/rollup module parameters. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -436,6 +550,9 @@ func (*UnimplementedMsgServer) InitiateWithdrawal(ctx context.Context, req *MsgI func (*UnimplementedMsgServer) InitiateFeeWithdrawal(ctx context.Context, req *MsgInitiateFeeWithdrawal) (*MsgInitiateFeeWithdrawalResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method InitiateFeeWithdrawal not implemented") } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -495,6 +612,24 @@ func _Msg_InitiateFeeWithdrawal_Handler(srv interface{}, ctx context.Context, de return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rollup.v1.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "rollup.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -511,6 +646,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "InitiateFeeWithdrawal", Handler: _Msg_InitiateFeeWithdrawal_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "rollup/v1/tx.proto", @@ -708,6 +847,69 @@ func (m *MsgInitiateFeeWithdrawalResponse) MarshalToSizedBuffer(dAtA []byte) (in return len(dAtA) - i, nil } +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -801,6 +1003,30 @@ func (m *MsgInitiateFeeWithdrawalResponse) Size() (n int) { return n } +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1337,6 +1563,171 @@ func (m *MsgInitiateFeeWithdrawalResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0