diff --git a/app/app.go b/app/app.go index af2795712..c125b7b98 100644 --- a/app/app.go +++ b/app/app.go @@ -663,7 +663,7 @@ func NewExocoreApp( app.WithdrawKeeper = *withdrawKeeper.NewKeeper(appCodec, keys[withdrawTypes.StoreKey], app.AssetsKeeper, app.DepositKeeper) app.RewardKeeper = *rewardKeeper.NewKeeper(appCodec, keys[rewardTypes.StoreKey], app.AssetsKeeper) app.ExoSlashKeeper = slashKeeper.NewKeeper(appCodec, keys[exoslashTypes.StoreKey], app.AssetsKeeper) - app.AVSManagerKeeper = *avsManagerKeeper.NewKeeper(appCodec, keys[avsManagerTypes.StoreKey], &app.OperatorKeeper) + app.AVSManagerKeeper = *avsManagerKeeper.NewKeeper(appCodec, keys[avsManagerTypes.StoreKey], &app.OperatorKeeper, app.AssetsKeeper) // We call this after setting the hooks to ensure that the hooks are set on the keeper evmKeeper.WithPrecompiles( evmkeeper.AvailablePrecompiles( diff --git a/precompiles/avs/abi.json b/precompiles/avs/abi.json index 82afbc291..f3e0eb9cd 100644 --- a/precompiles/avs/abi.json +++ b/precompiles/avs/abi.json @@ -7,14 +7,14 @@ "type": "string" }, { - "internalType": "bytes", + "internalType": "string", "name": "avsAddress", - "type": "bytes" + "type": "string" }, { - "internalType": "bytes", + "internalType": "string", "name": "operatorAddress", - "type": "bytes" + "type": "string" }, { "internalType": "uint64", @@ -22,7 +22,7 @@ "type": "uint64" } ], - "name": "AVSInfoRegisterOrDeregister", + "name": "AVSAction", "outputs": [ { "internalType": "bool", diff --git a/precompiles/avs/avs.sol b/precompiles/avs/avs.sol index 4f8453b05..5605d23c3 100644 --- a/precompiles/avs/avs.sol +++ b/precompiles/avs/avs.sol @@ -13,10 +13,10 @@ IAVSManager constant AVSMANAGER_CONTRACT = IAVSManager( /// @dev The interface through which solidity contracts will interact with AVS-Manager /// @custom:address 0x0000000000000000000000000000000000000902 interface IAVSManager { - function AVSInfoRegisterOrDeregister( + function AVSAction( string memory avsName, - bytes memory avsAddress, - bytes memory operatorAddress, + string memory avsAddress, + string memory operatorAddress, uint64 action ) external returns (bool success); diff --git a/precompiles/avs/avs_test.go b/precompiles/avs/avs_test.go new file mode 100644 index 000000000..45d3e2512 --- /dev/null +++ b/precompiles/avs/avs_test.go @@ -0,0 +1,156 @@ +package avs_test + +import ( + "math/big" + + "github.com/ExocoreNetwork/exocore/app" + "github.com/ExocoreNetwork/exocore/precompiles/avs" + avskeeper "github.com/ExocoreNetwork/exocore/x/avs/keeper" + operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/core/vm" + evmtypes "github.com/evmos/evmos/v14/x/evm/types" +) + +func (s *AVSManagerPrecompileSuite) TestIsTransaction() { + testCases := []struct { + name string + method string + isTx bool + }{ + { + avs.MethodAVSAction, + s.precompile.Methods[avs.MethodAVSAction].Name, + true, + }, + { + "invalid", + "invalid", + false, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + s.Require().Equal(s.precompile.IsTransaction(tc.method), tc.isTx) + }) + } +} + +func (s *AVSManagerPrecompileSuite) TestAVSManager() { + avsName, avsAddres, operatorAddress := "avsTest", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr" + avsAction := avskeeper.RegisterAction + registerOperator := func() { + registerReq := &operatortypes.RegisterOperatorReq{ + FromAddress: operatorAddress, + Info: &operatortypes.OperatorInfo{ + EarningsAddr: operatorAddress, + }, + } + _, err := s.App.OperatorKeeper.RegisterOperator(s.Ctx, registerReq) + s.NoError(err) + } + commonMalleate := func() (common.Address, []byte) { + // prepare the call input for delegation test + input, err := s.precompile.Pack( + avs.MethodAVSAction, + avsName, + avsAddres, + operatorAddress, + uint64(avsAction), + ) + s.Require().NoError(err, "failed to pack input") + return s.Address, input + } + successRet, err := s.precompile.Methods[avs.MethodAVSAction].Outputs.Pack(true) + s.Require().NoError(err) + + testcases := []struct { + name string + malleate func() (common.Address, []byte) + readOnly bool + expPass bool + errContains string + returnBytes []byte + }{ + { + name: "pass for avs-manager", + malleate: func() (common.Address, []byte) { + registerOperator() + return commonMalleate() + }, + readOnly: false, + expPass: true, + returnBytes: successRet, + }, + } + + for _, tc := range testcases { + tc := tc + s.Run(tc.name, func() { + // setup basic test suite + s.SetupTest() + + baseFee := s.App.FeeMarketKeeper.GetBaseFee(s.Ctx) + + // malleate testcase + caller, input := tc.malleate() + + contract := vm.NewPrecompile(vm.AccountRef(caller), s.precompile, big.NewInt(0), uint64(1e6)) + contract.Input = input + + contractAddr := contract.Address() + // Build and sign Ethereum transaction + txArgs := evmtypes.EvmTxArgs{ + ChainID: s.App.EvmKeeper.ChainID(), + Nonce: 0, + To: &contractAddr, + Amount: nil, + GasLimit: 100000, + GasPrice: app.MainnetMinGasPrices.BigInt(), + GasFeeCap: baseFee, + GasTipCap: big.NewInt(1), + Accesses: ðtypes.AccessList{}, + } + msgEthereumTx := evmtypes.NewTx(&txArgs) + + msgEthereumTx.From = s.Address.String() + err := msgEthereumTx.Sign(s.EthSigner, s.Signer) + s.Require().NoError(err, "failed to sign Ethereum message") + + // Instantiate config + proposerAddress := s.Ctx.BlockHeader().ProposerAddress + cfg, err := s.App.EvmKeeper.EVMConfig(s.Ctx, proposerAddress, s.App.EvmKeeper.ChainID()) + s.Require().NoError(err, "failed to instantiate EVM config") + + msg, err := msgEthereumTx.AsMessage(s.EthSigner, baseFee) + s.Require().NoError(err, "failed to instantiate Ethereum message") + + // Instantiate EVM + evm := s.App.EvmKeeper.NewEVM( + s.Ctx, msg, cfg, nil, s.StateDB, + ) + + params := s.App.EvmKeeper.GetParams(s.Ctx) + activePrecompiles := params.GetActivePrecompilesAddrs() + precompileMap := s.App.EvmKeeper.Precompiles(activePrecompiles...) + err = vm.ValidatePrecompiles(precompileMap, activePrecompiles) + s.Require().NoError(err, "invalid precompiles", activePrecompiles) + evm.WithPrecompiles(precompileMap, activePrecompiles) + + // Run precompiled contract + bz, err := s.precompile.Run(evm, contract, tc.readOnly) + + // Check results + if tc.expPass { + s.Require().NoError(err, "expected no error when running the precompile") + s.Require().Equal(tc.returnBytes, bz, "the return doesn't match the expected result") + } else { + s.Require().Error(err, "expected error to be returned when running the precompile") + s.Require().Nil(bz, "expected returned bytes to be nil") + s.Require().ErrorContains(err, tc.errContains) + } + }) + } +} diff --git a/precompiles/avs/setup_test.go b/precompiles/avs/setup_test.go new file mode 100644 index 000000000..c47cb2192 --- /dev/null +++ b/precompiles/avs/setup_test.go @@ -0,0 +1,35 @@ +package avs_test + +import ( + "testing" + + "github.com/ExocoreNetwork/exocore/precompiles/avs" + "github.com/ExocoreNetwork/exocore/testutil" + "github.com/stretchr/testify/suite" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +var s *AVSManagerPrecompileSuite + +type AVSManagerPrecompileSuite struct { + testutil.BaseTestSuite + precompile *avs.Precompile +} + +func TestPrecompileTestSuite(t *testing.T) { + s = new(AVSManagerPrecompileSuite) + suite.Run(t, s) + + // Run Ginkgo integration tests + RegisterFailHandler(Fail) + RunSpecs(t, "AVSManager Precompile Suite") +} + +func (s *AVSManagerPrecompileSuite) SetupTest() { + s.DoSetupTest() + precompile, err := avs.NewPrecompile(s.App.AVSManagerKeeper, s.App.AuthzKeeper) + s.Require().NoError(err) + s.precompile = precompile +} diff --git a/precompiles/avs/tx.go b/precompiles/avs/tx.go index e4174ca4f..b614ab8ef 100644 --- a/precompiles/avs/tx.go +++ b/precompiles/avs/tx.go @@ -10,7 +10,7 @@ import ( const ( // AVSRegister defines the ABI method name for the avs // related transaction. - MethodAVSAction = "avsAction" + MethodAVSAction = "AVSAction" ) // AVSInfoRegister register the avs related information and change the state in avs keeper module. diff --git a/precompiles/avs/types.go b/precompiles/avs/types.go index 870f9f707..01e1683a0 100644 --- a/precompiles/avs/types.go +++ b/precompiles/avs/types.go @@ -8,33 +8,45 @@ import ( "golang.org/x/xerrors" ) -func (p Precompile) GetAVSParamsFromInputs(ctx sdk.Context, args []interface{}) (*keeper.AVSParams, error) { - if len(args) != 4 { +func (p Precompile) GetAVSParamsFromInputs(ctx sdk.Context, args []interface{}) (*keeper.AVSRegisterOrDeregisterParams, error) { + if len(args) != 6 { return nil, xerrors.Errorf(cmn.ErrInvalidNumberOfArgs, 4, len(args)) } - avsParams := &keeper.AVSParams{} + avsParams := &keeper.AVSRegisterOrDeregisterParams{} avsName, ok := args[0].(string) if !ok { return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 0, "string", avsName) } avsParams.AVSName = avsName - avsAddress, ok := args[1].([]byte) - if !ok || avsAddress == nil { + avsAddress, ok := args[1].(string) + if !ok { return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 1, "[]byte", avsAddress) } avsParams.AVSAddress = avsAddress - operatorAddress, ok := args[2].([]byte) - if !ok || operatorAddress == nil { + operatorAddress, ok := args[2].(string) + if !ok || operatorAddress == "" { return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 2, "[]byte", operatorAddress) } avsParams.OperatorAddress = operatorAddress action, ok := args[3].(uint64) - if !ok || action != keeper.RegisterAction || action != keeper.DeRegisterAction { + if !ok || (action != keeper.RegisterAction && action != keeper.DeRegisterAction) { return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 3, "uint64", action) } avsParams.Action = action + + avsOwnerAddress, ok := args[4].(string) + if !ok || avsOwnerAddress == "" { + return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 4, "string", avsOwnerAddress) + } + avsParams.AVSOwnerAddress = avsOwnerAddress + + assetID, ok := args[5].(string) + if !ok || assetID == "" { + return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 3, "uint64", action) + } + avsParams.AssetID = assetID return avsParams, nil } diff --git a/proto/exocore/avs/genesis.proto b/proto/exocore/avs/genesis.proto deleted file mode 100644 index 0231fb278..000000000 --- a/proto/exocore/avs/genesis.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -package exocore.avs; - -import "gogoproto/gogo.proto"; -import "exocore/avs/params.proto"; - -option go_package = "github.com/ExocoreNetwork/exocore/x/avs/types"; - -// GenesisState defines the avs module's genesis state. -message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; -} diff --git a/proto/exocore/avs/params.proto b/proto/exocore/avs/params.proto deleted file mode 100644 index bbc7d1796..000000000 --- a/proto/exocore/avs/params.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -package exocore.avs; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/ExocoreNetwork/exocore/x/avs/types"; - -// Params defines the parameters for the module. -message Params { - option (gogoproto.goproto_stringer) = false; - -} diff --git a/proto/exocore/avs/query.proto b/proto/exocore/avs/query.proto index 8803a1699..4f6a28668 100644 --- a/proto/exocore/avs/query.proto +++ b/proto/exocore/avs/query.proto @@ -4,23 +4,23 @@ package exocore.avs; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; -import "exocore/avs/params.proto"; +import "exocore/avs/tx.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/avs/types"; +message QueryAVSInfoReq { + string avs_address = 1 [(gogoproto.customname) = "AVSAddres"]; +} + +message QueryAVSInfoResponse { + AVSInfo info = 1; +} + + // Query defines the gRPC querier service. service Query { // Parameters queries the parameters of the module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/ExocoreNetwork/exocore/avs/params"; + rpc QueryAVSInfo(QueryAVSInfoReq) returns (QueryAVSInfoResponse) { + option (google.api.http).get = "/ExocoreNetwork/exocore/avs/QueryAVSInfo"; } -} - -// QueryParamsRequest is request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is response type for the Query/Params RPC method. -message QueryParamsResponse { - // params holds all the parameters of this module. - Params params = 1 [(gogoproto.nullable) = false]; } \ No newline at end of file diff --git a/proto/exocore/avs/tx.proto b/proto/exocore/avs/tx.proto index 017702e4b..8dcf300ad 100644 --- a/proto/exocore/avs/tx.proto +++ b/proto/exocore/avs/tx.proto @@ -4,7 +4,8 @@ import "amino/amino.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "exocore/delegation/v1/tx.proto"; -import "exocore/avs/params.proto"; +import "exocore/assets/v1/tx.proto"; +import "gogoproto/gogo.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/avs/types"; @@ -12,11 +13,9 @@ message AVSInfo { string name = 1; string AVSAddress = 2; repeated string operatorAddress = 3; - -} - -message AVSManager { - map AVSOperatorRelation = 1; + string AVSOwnerAddress = 4; + // asset_basic_info is all the basic asset information of the avs. + repeated string AssetID = 5; } message RegisterAVSReq { @@ -54,20 +53,4 @@ service Msg { rpc RegisterAVS (RegisterAVSReq) returns (RegisterAVSResponse); // DelegateAssetToOperator delegates asset to operator. rpc DeRegisterAVS (DeRegisterAVSReq) returns (DeRegisterAVSResponse); -} - -// MsgUpdateParams is the Msg/UpdateParams request type for Erc20 parameters. -message MsgUpdateParams { - // todo: temporarily not update configuration through gov module - option (cosmos.msg.v1.signer) = "authority"; - // authority is the address of the governance account. - string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // params defines the x/evm parameters to update. - // NOTE: All parameters must be supplied. - Params params = 2; - } - -// MsgUpdateParamsResponse defines the response structure for executing a -// MsgUpdateParams message. -message MsgUpdateParamsResponse {} \ No newline at end of file +} \ No newline at end of file diff --git a/x/avs/client/cli/query.go b/x/avs/client/cli/query.go index bdf0577b8..c8eddd10d 100644 --- a/x/avs/client/cli/query.go +++ b/x/avs/client/cli/query.go @@ -1,12 +1,16 @@ package cli import ( + "context" "fmt" + // "strings" "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + // "github.com/cosmos/cosmos-sdk/client/flags" // sdk "github.com/cosmos/cosmos-sdk/types" @@ -24,9 +28,33 @@ func GetQueryCmd(queryRoute string) *cobra.Command { RunE: client.ValidateCmd, } - cmd.AddCommand(CmdQueryParams()) - // this line is used by starport scaffolding # 1 - - return cmd + cmd.AddCommand(QueryAVSInfo()) + return cmd } +func QueryAVSInfo() *cobra.Command { + cmd := &cobra.Command{ + Use: "AVSInfo query", + Short: "AVSInfo query", + Long: "AVSInfo query for current registered AVS", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + req := &types.QueryAVSInfoReq{ + AVSAddres: args[0], + } + res, err := queryClient.QueryAVSInfo(context.Background(), req) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/avs/client/cli/query_params.go b/x/avs/client/cli/query_params.go deleted file mode 100644 index 91d3ce7f1..000000000 --- a/x/avs/client/cli/query_params.go +++ /dev/null @@ -1,36 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/ExocoreNetwork/exocore/x/avs/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/avs/client/cli/tx.go b/x/avs/client/cli/tx.go index 2cec62353..e60522222 100644 --- a/x/avs/client/cli/tx.go +++ b/x/avs/client/cli/tx.go @@ -33,8 +33,6 @@ func GetTxCmd() *cobra.Command { RunE: client.ValidateCmd, } - // this line is used by starport scaffolding # 1 - return cmd } @@ -42,7 +40,7 @@ func RegisterAVS() *cobra.Command { cmd := &cobra.Command{ Use: "RegisterAVS: AVSName, AVSAddress, OperatorAddress", Short: "register to be an avs", - Args: cobra.MinimumNArgs(4), + Args: cobra.MinimumNArgs(3), RunE: func(cmd *cobra.Command, args []string) error { cliCtx, err := client.GetClientTxContext(cmd) if err != nil { diff --git a/x/avs/keeper/avs_test.go b/x/avs/keeper/avs_test.go new file mode 100644 index 000000000..fa70c256e --- /dev/null +++ b/x/avs/keeper/avs_test.go @@ -0,0 +1,7 @@ +package keeper_test + +func (suite *AVSTestSuite) TestAVS() { + avsName, avsAddres, operatorAddress, assetID := "avsTest", "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", "exo18h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", "" + err := suite.App.AVSManagerKeeper.SetAVSInfo(suite.Ctx, avsName, avsAddres, operatorAddress, assetID) + suite.NoError(err) +} diff --git a/x/avs/keeper/keeper.go b/x/avs/keeper/keeper.go index 93a448552..fc5070e33 100644 --- a/x/avs/keeper/keeper.go +++ b/x/avs/keeper/keeper.go @@ -4,7 +4,9 @@ import ( "fmt" errorsmod "cosmossdk.io/errors" + assettypes "github.com/ExocoreNetwork/exocore/x/assets/keeper" delegationtypes "github.com/ExocoreNetwork/exocore/x/delegation/types" + deposittypes "github.com/ExocoreNetwork/exocore/x/deposit/types" "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store/prefix" @@ -19,6 +21,8 @@ type ( cdc codec.BinaryCodec storeKey storetypes.StoreKey operatorKeeper delegationtypes.OperatorKeeper + // other keepers + assetsKeeper assettypes.Keeper } ) @@ -26,12 +30,14 @@ func NewKeeper( cdc codec.BinaryCodec, storeKey storetypes.StoreKey, operatorKeeper delegationtypes.OperatorKeeper, + assetKeeper assettypes.Keeper, ) *Keeper { return &Keeper{ cdc: cdc, storeKey: storeKey, operatorKeeper: operatorKeeper, + assetsKeeper: assetKeeper, } } @@ -39,32 +45,43 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } -func (k Keeper) AVSInfoUpdate(ctx sdk.Context, params *AVSParams) error { +func (k Keeper) AVSInfoUpdate(ctx sdk.Context, params *AVSRegisterOrDeregisterParams) error { operatorAddress := params.OperatorAddress - opAccAddr, err := sdk.AccAddressFromBech32(string(operatorAddress)) + opAccAddr, err := sdk.AccAddressFromBech32(operatorAddress) if err != nil { return errorsmod.Wrap(err, fmt.Sprintf("error occurred when parse acc address from Bech32,the addr is:%s", operatorAddress)) } if !k.operatorKeeper.IsOperator(ctx, opAccAddr) { return errorsmod.Wrap(delegationtypes.ErrOperatorNotExist, "AVSInfoUpdate: invalid operator address") } + + if !k.assetsKeeper.IsStakingAsset(ctx, params.AssetID) { + return errorsmod.Wrap(deposittypes.ErrDepositAssetNotExist, "AVSInfoUpdate: invalid asset") + } action := params.Action if action == RegisterAction { - return k.SetAVSInfo(ctx, params.AVSName, string(params.AVSAddress), string(operatorAddress)) + return k.SetAVSInfo(ctx, params.AVSName, string(params.AVSAddress), string(operatorAddress), string(params.AssetID)) } else { - return k.DeleteAVSInfo(ctx, string(params.AVSAddress)) + avsInfo, err := k.GetAVSInfo(ctx, params.AVSAddress) + if err != nil { + return errorsmod.Wrap(err, fmt.Sprintf("error occurred when get avs info", avsInfo)) + } + if avsInfo.Info.AVSOwnerAddress != params.AVSOwnerAddress { + return errorsmod.Wrap(err, fmt.Sprintf("not qualified to deregister", avsInfo)) + } + return k.DeleteAVSInfo(ctx, params.AVSAddress) } } -func (k Keeper) SetAVSInfo(ctx sdk.Context, AVSName string, AVSAddress string, OperatorAddress string) (err error) { +func (k Keeper) SetAVSInfo(ctx sdk.Context, AVSName, AVSAddress, OperatorAddress, AssetID string) (err error) { avsAddr, err := sdk.AccAddressFromBech32(AVSAddress) if err != nil { - return errorsmod.Wrap(err, "GetAVSInfo: error occurred when parse acc address from Bech32") + return errorsmod.Wrap(err, "SetAVSInfo: error occurred when parse acc address from Bech32") } store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixAVSInfo) if !store.Has(avsAddr) { - AVSInfo := &types.AVSInfo{Name: AVSName, AVSAddress: AVSAddress, OperatorAddress: []string{OperatorAddress}} + AVSInfo := &types.AVSInfo{Name: AVSName, AVSAddress: AVSAddress, OperatorAddress: []string{OperatorAddress}, AssetID: []string{AssetID}} bz := k.cdc.MustMarshal(AVSInfo) store.Set(avsAddr, bz) return nil @@ -73,11 +90,12 @@ func (k Keeper) SetAVSInfo(ctx sdk.Context, AVSName string, AVSAddress string, O ret := &types.AVSInfo{} k.cdc.MustUnmarshal(value, ret) ret.OperatorAddress = append(ret.OperatorAddress, OperatorAddress) + ret.AssetID = append(ret.AssetID, AssetID) return nil } } -func (k Keeper) GetAVSInfo(ctx sdk.Context, addr string) (*types.AVSInfo, error) { +func (k Keeper) GetAVSInfo(ctx sdk.Context, addr string) (*types.QueryAVSInfoResponse, error) { avsAddr, err := sdk.AccAddressFromBech32(addr) if err != nil { return nil, errorsmod.Wrap(err, "GetAVSInfo: error occurred when parse acc address from Bech32") @@ -90,7 +108,10 @@ func (k Keeper) GetAVSInfo(ctx sdk.Context, addr string) (*types.AVSInfo, error) value := store.Get(avsAddr) ret := types.AVSInfo{} k.cdc.MustUnmarshal(value, &ret) - return &ret, nil + res := &types.QueryAVSInfoResponse{ + Info: &ret, + } + return res, nil } func (k Keeper) DeleteAVSInfo(ctx sdk.Context, addr string) error { diff --git a/x/avs/keeper/params.go b/x/avs/keeper/params.go index 255a88b24..2622e9169 100644 --- a/x/avs/keeper/params.go +++ b/x/avs/keeper/params.go @@ -31,11 +31,13 @@ func (k Keeper) SetParams(ctx sdk.Context, params *types.Params) error { return nil } -type AVSParams struct { +type AVSRegisterOrDeregisterParams struct { AVSName string - AVSAddress []byte - OperatorAddress []byte + AVSAddress string + OperatorAddress string Action uint64 + AVSOwnerAddress string + AssetID string } const ( diff --git a/x/avs/keeper/query.go b/x/avs/keeper/query.go index f6f9fd320..c976ca358 100644 --- a/x/avs/keeper/query.go +++ b/x/avs/keeper/query.go @@ -1,7 +1,15 @@ package keeper import ( + "context" + "github.com/ExocoreNetwork/exocore/x/avs/types" + sdk "github.com/cosmos/cosmos-sdk/types" ) var _ types.QueryServer = Keeper{} + +func (k Keeper) QueryAVSInfo(ctx context.Context, req *types.QueryAVSInfoReq) (*types.QueryAVSInfoResponse, error) { + c := sdk.UnwrapSDKContext(ctx) + return k.GetAVSInfo(c, req.AVSAddres) +} diff --git a/x/avs/keeper/query_params.go b/x/avs/keeper/query_params.go deleted file mode 100644 index 98c778e6c..000000000 --- a/x/avs/keeper/query_params.go +++ /dev/null @@ -1,22 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/ExocoreNetwork/exocore/x/avs/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - params, err := k.GetParams(ctx) - if err != nil { - return nil, err - } - return &types.QueryParamsResponse{Params: *params}, nil -} diff --git a/x/avs/keeper/setup_test.go b/x/avs/keeper/setup_test.go new file mode 100644 index 000000000..898322afc --- /dev/null +++ b/x/avs/keeper/setup_test.go @@ -0,0 +1,29 @@ +package keeper_test + +import ( + "testing" + + "github.com/ExocoreNetwork/exocore/testutil" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + "github.com/stretchr/testify/suite" +) + +type AVSTestSuite struct { + testutil.BaseTestSuite +} + +var s *AVSTestSuite + +func TestKeeperTestSuite(t *testing.T) { + s = new(AVSTestSuite) + suite.Run(t, s) + + // Run Ginkgo integration tests + RegisterFailHandler(Fail) + RunSpecs(t, "Keeper Suite") +} + +func (suite *AVSTestSuite) SetupTest() { + suite.DoSetupTest() +} diff --git a/x/avs/module.go b/x/avs/module.go index bb8556817..fe5329772 100644 --- a/x/avs/module.go +++ b/x/avs/module.go @@ -64,7 +64,9 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } } // GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module diff --git a/x/avs/types/codec.go b/x/avs/types/codec.go index b353cdd0c..ee3718049 100644 --- a/x/avs/types/codec.go +++ b/x/avs/types/codec.go @@ -3,7 +3,6 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" // this line is used by starport scaffolding # 1 "github.com/cosmos/cosmos-sdk/types/msgservice" @@ -11,22 +10,14 @@ import ( const ( // Amino names - updateParamsName = "exocore/MsgUpdateParams" + updateParamsName = "exocore/MsgUpdateParamsForAVS" ) func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - registry.RegisterImplementations( - (*sdk.Msg)(nil), - &MsgUpdateParams{}, - ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } -// RegisterLegacyAminoCodec registers the necessary x/revenue interfaces and -// concrete types on the provided LegacyAmino codec. These types are used for -// Amino JSON serialization and EIP-712 compatibility. func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgUpdateParams{}, updateParamsName, nil) } var ( diff --git a/x/avs/types/query.pb.go b/x/avs/types/query.pb.go index 1e76f2c7b..63c2f80d8 100644 --- a/x/avs/types/query.pb.go +++ b/x/avs/types/query.pb.go @@ -30,22 +30,22 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// QueryParamsRequest is request type for the Query/Params RPC method. -type QueryParamsRequest struct { +type QueryAVSInfoReq struct { + AVSAddres string `protobuf:"bytes,1,opt,name=avs_address,json=avsAddress,proto3" json:"avs_address,omitempty"` } -func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } -func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamsRequest) ProtoMessage() {} -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { +func (m *QueryAVSInfoReq) Reset() { *m = QueryAVSInfoReq{} } +func (m *QueryAVSInfoReq) String() string { return proto.CompactTextString(m) } +func (*QueryAVSInfoReq) ProtoMessage() {} +func (*QueryAVSInfoReq) Descriptor() ([]byte, []int) { return fileDescriptor_d9df5f5965203ddc, []int{0} } -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryAVSInfoReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAVSInfoReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAVSInfoReq.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -55,36 +55,41 @@ func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) +func (m *QueryAVSInfoReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAVSInfoReq.Merge(m, src) } -func (m *QueryParamsRequest) XXX_Size() int { +func (m *QueryAVSInfoReq) XXX_Size() int { return m.Size() } -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +func (m *QueryAVSInfoReq) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAVSInfoReq.DiscardUnknown(m) } -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryAVSInfoReq proto.InternalMessageInfo -// QueryParamsResponse is response type for the Query/Params RPC method. -type QueryParamsResponse struct { - // params holds all the parameters of this module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +func (m *QueryAVSInfoReq) GetAVSAddres() string { + if m != nil { + return m.AVSAddres + } + return "" } -func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } -func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryParamsResponse) ProtoMessage() {} -func (*QueryParamsResponse) Descriptor() ([]byte, []int) { +type QueryAVSInfoResponse struct { + Info *AVSInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"` +} + +func (m *QueryAVSInfoResponse) Reset() { *m = QueryAVSInfoResponse{} } +func (m *QueryAVSInfoResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAVSInfoResponse) ProtoMessage() {} +func (*QueryAVSInfoResponse) Descriptor() ([]byte, []int) { return fileDescriptor_d9df5f5965203ddc, []int{1} } -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryAVSInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAVSInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAVSInfoResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -94,53 +99,55 @@ func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) +func (m *QueryAVSInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAVSInfoResponse.Merge(m, src) } -func (m *QueryParamsResponse) XXX_Size() int { +func (m *QueryAVSInfoResponse) XXX_Size() int { return m.Size() } -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +func (m *QueryAVSInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAVSInfoResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryAVSInfoResponse proto.InternalMessageInfo -func (m *QueryParamsResponse) GetParams() Params { +func (m *QueryAVSInfoResponse) GetInfo() *AVSInfo { if m != nil { - return m.Params + return m.Info } - return Params{} + return nil } func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "exocore.avs.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "exocore.avs.QueryParamsResponse") + proto.RegisterType((*QueryAVSInfoReq)(nil), "exocore.avs.QueryAVSInfoReq") + proto.RegisterType((*QueryAVSInfoResponse)(nil), "exocore.avs.QueryAVSInfoResponse") } func init() { proto.RegisterFile("exocore/avs/query.proto", fileDescriptor_d9df5f5965203ddc) } var fileDescriptor_d9df5f5965203ddc = []byte{ - // 300 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0x41, 0x4b, 0xf3, 0x30, - 0x18, 0xc7, 0x9b, 0x97, 0xd7, 0x1d, 0xb2, 0x5b, 0x36, 0x70, 0x14, 0xc9, 0x46, 0xf1, 0x20, 0x03, - 0x1b, 0x3a, 0xbf, 0xc1, 0x40, 0xf4, 0x24, 0xba, 0xa3, 0xb7, 0xb4, 0x84, 0x58, 0xb4, 0x7d, 0xb2, - 0x26, 0xed, 0xb6, 0x9b, 0xf8, 0x09, 0x04, 0xbf, 0xd4, 0x8e, 0x03, 0x2f, 0x9e, 0x44, 0x5a, 0x3f, - 0x88, 0x2c, 0xe9, 0x61, 0x63, 0xec, 0x56, 0xfe, 0xcf, 0xef, 0xff, 0xeb, 0xf3, 0x04, 0x9f, 0x8a, - 0x25, 0x24, 0x50, 0x08, 0xc6, 0x2b, 0xcd, 0xe6, 0xa5, 0x28, 0x56, 0xa1, 0x2a, 0xc0, 0x00, 0xe9, - 0xb6, 0x83, 0x90, 0x57, 0xda, 0xef, 0x4b, 0x90, 0x60, 0x73, 0xb6, 0xfd, 0x72, 0x88, 0x7f, 0x26, - 0x01, 0xe4, 0x8b, 0x60, 0x5c, 0xa5, 0x8c, 0xe7, 0x39, 0x18, 0x6e, 0x52, 0xc8, 0x75, 0x3b, 0x1d, - 0x27, 0xa0, 0x33, 0xd0, 0x2c, 0xe6, 0x5a, 0x38, 0x33, 0xab, 0xa2, 0x58, 0x18, 0x1e, 0x31, 0xc5, - 0x65, 0x9a, 0x5b, 0xb8, 0x65, 0x07, 0xbb, 0x5b, 0x28, 0x5e, 0xf0, 0xac, 0xb5, 0x04, 0x7d, 0x4c, - 0x1e, 0xb6, 0xdd, 0x7b, 0x1b, 0xce, 0xc4, 0xbc, 0x14, 0xda, 0x04, 0xb7, 0xb8, 0xb7, 0x97, 0x6a, - 0x05, 0xb9, 0x16, 0x24, 0xc2, 0x1d, 0x57, 0x1e, 0xa0, 0x11, 0xba, 0xe8, 0x4e, 0x7a, 0xe1, 0xce, - 0x11, 0xa1, 0x83, 0xa7, 0xff, 0xd7, 0xdf, 0x43, 0x6f, 0xd6, 0x82, 0x93, 0x57, 0x84, 0x4f, 0xac, - 0x8a, 0x2c, 0x70, 0xc7, 0x11, 0x64, 0xb8, 0x57, 0x3b, 0xfc, 0xbd, 0x3f, 0x3a, 0x0e, 0xb8, 0x4d, - 0x82, 0xf1, 0xdb, 0xe7, 0xef, 0xc7, 0xbf, 0x73, 0x12, 0xb0, 0x6b, 0x47, 0xde, 0x09, 0xb3, 0x80, - 0xe2, 0x99, 0x1d, 0x1e, 0x3a, 0xbd, 0x59, 0xd7, 0x14, 0x6d, 0x6a, 0x8a, 0x7e, 0x6a, 0x8a, 0xde, - 0x1b, 0xea, 0x6d, 0x1a, 0xea, 0x7d, 0x35, 0xd4, 0x7b, 0xbc, 0x94, 0xa9, 0x79, 0x2a, 0xe3, 0x30, - 0x81, 0xec, 0x98, 0x67, 0x69, 0x4d, 0x66, 0xa5, 0x84, 0x8e, 0x3b, 0xf6, 0xc9, 0xae, 0xfe, 0x02, - 0x00, 0x00, 0xff, 0xff, 0x78, 0xe2, 0x4e, 0x16, 0xd4, 0x01, 0x00, 0x00, + // 331 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0xc1, 0x4b, 0x3a, 0x41, + 0x14, 0xc7, 0x9d, 0x1f, 0xbf, 0x02, 0xc7, 0x22, 0x58, 0x16, 0x0a, 0x91, 0xad, 0x3c, 0x89, 0xd0, + 0x4e, 0xda, 0x3f, 0xd0, 0x0a, 0x11, 0x5d, 0x82, 0x14, 0x3c, 0x74, 0x89, 0x59, 0x1d, 0xa7, 0xa5, + 0x9c, 0xb7, 0xee, 0x1b, 0x37, 0x3d, 0xd6, 0xb5, 0x4b, 0xd0, 0x3f, 0xd5, 0x51, 0xe8, 0xd2, 0x29, + 0x62, 0xed, 0x0f, 0x09, 0x67, 0x0c, 0xd6, 0xa0, 0x6e, 0xc3, 0x7b, 0x9f, 0xf7, 0xe1, 0x3b, 0x5f, + 0xba, 0x2d, 0x26, 0xd0, 0x83, 0x44, 0x30, 0x9e, 0x22, 0x1b, 0x8d, 0x45, 0x32, 0xf5, 0xe3, 0x04, + 0x34, 0x38, 0xa5, 0xe5, 0xc2, 0xe7, 0x29, 0x96, 0x5d, 0x09, 0x12, 0xcc, 0x9c, 0x2d, 0x5e, 0x16, + 0x29, 0x57, 0x24, 0x80, 0xbc, 0x15, 0x8c, 0xc7, 0x11, 0xe3, 0x4a, 0x81, 0xe6, 0x3a, 0x02, 0x85, + 0xcb, 0x6d, 0xbd, 0x07, 0x38, 0x04, 0x64, 0x21, 0x47, 0x61, 0xcd, 0x2c, 0x6d, 0x84, 0x42, 0xf3, + 0x06, 0x8b, 0xb9, 0x8c, 0x94, 0x81, 0x97, 0xac, 0x9b, 0x4f, 0xa1, 0x27, 0x76, 0x5a, 0x0d, 0xe8, + 0xd6, 0xc5, 0xe2, 0x2e, 0xe8, 0x76, 0xce, 0xd4, 0x00, 0xda, 0x62, 0xe4, 0xf8, 0xb4, 0xc4, 0x53, + 0xbc, 0xe2, 0xfd, 0x7e, 0x22, 0x10, 0x77, 0xc8, 0x1e, 0xa9, 0x15, 0x5b, 0x9b, 0xd9, 0xfb, 0x6e, + 0x31, 0xe8, 0x76, 0x02, 0x33, 0x6d, 0x53, 0x9e, 0xa2, 0x7d, 0x62, 0xf5, 0x98, 0xba, 0xab, 0x0a, + 0x8c, 0x41, 0xa1, 0x70, 0x6a, 0xf4, 0x7f, 0xa4, 0x06, 0x60, 0x04, 0xa5, 0xa6, 0xeb, 0xe7, 0x3e, + 0xeb, 0x7f, 0xb3, 0x86, 0x68, 0x3e, 0x12, 0xba, 0x66, 0x14, 0xce, 0x3d, 0xa1, 0x1b, 0x79, 0x99, + 0x53, 0x59, 0x39, 0xfb, 0x11, 0xb5, 0xbc, 0xff, 0xc7, 0xd6, 0xa6, 0xa8, 0x1e, 0x3e, 0xbc, 0x7e, + 0x3e, 0xff, 0xab, 0x3b, 0x35, 0x76, 0x62, 0xd1, 0x73, 0xa1, 0xef, 0x20, 0xb9, 0x61, 0xf9, 0x3a, + 0xf2, 0x97, 0xad, 0xd3, 0x97, 0xcc, 0x23, 0xb3, 0xcc, 0x23, 0x1f, 0x99, 0x47, 0x9e, 0xe6, 0x5e, + 0x61, 0x36, 0xf7, 0x0a, 0x6f, 0x73, 0xaf, 0x70, 0x79, 0x20, 0x23, 0x7d, 0x3d, 0x0e, 0xfd, 0x1e, + 0x0c, 0x7f, 0xb3, 0x4d, 0x6c, 0xbd, 0xd3, 0x58, 0x60, 0xb8, 0x6e, 0x2a, 0x3e, 0xfa, 0x0a, 0x00, + 0x00, 0xff, 0xff, 0x92, 0x55, 0xdd, 0xc2, 0x00, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -156,7 +163,7 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { // Parameters queries the parameters of the module. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + QueryAVSInfo(ctx context.Context, in *QueryAVSInfoReq, opts ...grpc.CallOption) (*QueryAVSInfoResponse, error) } type queryClient struct { @@ -167,9 +174,9 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/exocore.avs.Query/Params", in, out, opts...) +func (c *queryClient) QueryAVSInfo(ctx context.Context, in *QueryAVSInfoReq, opts ...grpc.CallOption) (*QueryAVSInfoResponse, error) { + out := new(QueryAVSInfoResponse) + err := c.cc.Invoke(ctx, "/exocore.avs.Query/QueryAVSInfo", in, out, opts...) if err != nil { return nil, err } @@ -179,35 +186,35 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . // QueryServer is the server API for Query service. type QueryServer interface { // Parameters queries the parameters of the module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + QueryAVSInfo(context.Context, *QueryAVSInfoReq) (*QueryAVSInfoResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +func (*UnimplementedQueryServer) QueryAVSInfo(ctx context.Context, req *QueryAVSInfoReq) (*QueryAVSInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryAVSInfo not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) +func _Query_QueryAVSInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAVSInfoReq) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) + return srv.(QueryServer).QueryAVSInfo(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/exocore.avs.Query/Params", + FullMethod: "/exocore.avs.Query/QueryAVSInfo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + return srv.(QueryServer).QueryAVSInfo(ctx, req.(*QueryAVSInfoReq)) } return interceptor(ctx, in, info, handler) } @@ -217,15 +224,15 @@ var _Query_serviceDesc = grpc.ServiceDesc{ HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "Params", - Handler: _Query_Params_Handler, + MethodName: "QueryAVSInfo", + Handler: _Query_QueryAVSInfo_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "exocore/avs/query.proto", } -func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryAVSInfoReq) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -235,20 +242,27 @@ func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAVSInfoReq) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAVSInfoReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if len(m.AVSAddres) > 0 { + i -= len(m.AVSAddres) + copy(dAtA[i:], m.AVSAddres) + i = encodeVarintQuery(dAtA, i, uint64(len(m.AVSAddres))) + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryAVSInfoResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -258,26 +272,28 @@ func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAVSInfoResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAVSInfoResponse) 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 + if m.Info != nil { + { + size, err := m.Info.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -292,23 +308,29 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *QueryParamsRequest) Size() (n int) { +func (m *QueryAVSInfoReq) Size() (n int) { if m == nil { return 0 } var l int _ = l + l = len(m.AVSAddres) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } -func (m *QueryParamsResponse) Size() (n int) { +func (m *QueryAVSInfoResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.Info != nil { + l = m.Info.Size() + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -318,7 +340,7 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAVSInfoReq) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -341,12 +363,44 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAVSInfoReq: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAVSInfoReq: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AVSAddres", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AVSAddres = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -368,7 +422,7 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAVSInfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -391,15 +445,15 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAVSInfoResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAVSInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -426,7 +480,10 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.Info == nil { + m.Info = &AVSInfo{} + } + if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/avs/types/query.pb.gw.go b/x/avs/types/query.pb.gw.go index 47246d466..b2855b174 100644 --- a/x/avs/types/query.pb.gw.go +++ b/x/avs/types/query.pb.gw.go @@ -31,20 +31,38 @@ var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest +var ( + filter_Query_QueryAVSInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_QueryAVSInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAVSInfoReq var metadata runtime.ServerMetadata - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryAVSInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.QueryAVSInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest +func local_request_Query_QueryAVSInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAVSInfoReq var metadata runtime.ServerMetadata - msg, err := server.Params(ctx, &protoReq) + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryAVSInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.QueryAVSInfo(ctx, &protoReq) return msg, metadata, err } @@ -55,7 +73,7 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal // Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryAVSInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -64,14 +82,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_QueryAVSInfo_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryAVSInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -116,7 +134,7 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryAVSInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -125,14 +143,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_QueryAVSInfo_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryAVSInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -140,9 +158,9 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ExocoreNetwork", "exocore", "avs", "params"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueryAVSInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"ExocoreNetwork", "exocore", "avs", "QueryAVSInfo"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage + forward_Query_QueryAVSInfo_0 = runtime.ForwardResponseMessage ) diff --git a/x/avs/types/tx.pb.go b/x/avs/types/tx.pb.go index 5d6a3d78d..91342970d 100644 --- a/x/avs/types/tx.pb.go +++ b/x/avs/types/tx.pb.go @@ -6,10 +6,12 @@ package types import ( context "context" fmt "fmt" + _ "github.com/ExocoreNetwork/exocore/x/assets/types" _ "github.com/ExocoreNetwork/exocore/x/delegation/types" _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" @@ -35,6 +37,9 @@ type AVSInfo struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` AVSAddress string `protobuf:"bytes,2,opt,name=AVSAddress,proto3" json:"AVSAddress,omitempty"` OperatorAddress []string `protobuf:"bytes,3,rep,name=operatorAddress,proto3" json:"operatorAddress,omitempty"` + AVSOwnerAddress string `protobuf:"bytes,4,opt,name=AVSOwnerAddress,proto3" json:"AVSOwnerAddress,omitempty"` + // asset_basic_info is all the basic asset information of the avs. + AssetID []string `protobuf:"bytes,5,rep,name=AssetID,proto3" json:"AssetID,omitempty"` } func (m *AVSInfo) Reset() { *m = AVSInfo{} } @@ -91,46 +96,16 @@ func (m *AVSInfo) GetOperatorAddress() []string { return nil } -type AVSManager struct { - AVSOperatorRelation map[string]string `protobuf:"bytes,1,rep,name=AVSOperatorRelation,proto3" json:"AVSOperatorRelation,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (m *AVSManager) Reset() { *m = AVSManager{} } -func (m *AVSManager) String() string { return proto.CompactTextString(m) } -func (*AVSManager) ProtoMessage() {} -func (*AVSManager) Descriptor() ([]byte, []int) { - return fileDescriptor_c92b5dfe90086a66, []int{1} -} -func (m *AVSManager) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AVSManager) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AVSManager.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 *AVSInfo) GetAVSOwnerAddress() string { + if m != nil { + return m.AVSOwnerAddress } + return "" } -func (m *AVSManager) XXX_Merge(src proto.Message) { - xxx_messageInfo_AVSManager.Merge(m, src) -} -func (m *AVSManager) XXX_Size() int { - return m.Size() -} -func (m *AVSManager) XXX_DiscardUnknown() { - xxx_messageInfo_AVSManager.DiscardUnknown(m) -} - -var xxx_messageInfo_AVSManager proto.InternalMessageInfo -func (m *AVSManager) GetAVSOperatorRelation() map[string]string { +func (m *AVSInfo) GetAssetID() []string { if m != nil { - return m.AVSOperatorRelation + return m.AssetID } return nil } @@ -144,7 +119,7 @@ func (m *RegisterAVSReq) Reset() { *m = RegisterAVSReq{} } func (m *RegisterAVSReq) String() string { return proto.CompactTextString(m) } func (*RegisterAVSReq) ProtoMessage() {} func (*RegisterAVSReq) Descriptor() ([]byte, []int) { - return fileDescriptor_c92b5dfe90086a66, []int{2} + return fileDescriptor_c92b5dfe90086a66, []int{1} } func (m *RegisterAVSReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -196,7 +171,7 @@ func (m *RegisterAVSResponse) Reset() { *m = RegisterAVSResponse{} } func (m *RegisterAVSResponse) String() string { return proto.CompactTextString(m) } func (*RegisterAVSResponse) ProtoMessage() {} func (*RegisterAVSResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c92b5dfe90086a66, []int{3} + return fileDescriptor_c92b5dfe90086a66, []int{2} } func (m *RegisterAVSResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -248,7 +223,7 @@ func (m *DeRegisterAVSReq) Reset() { *m = DeRegisterAVSReq{} } func (m *DeRegisterAVSReq) String() string { return proto.CompactTextString(m) } func (*DeRegisterAVSReq) ProtoMessage() {} func (*DeRegisterAVSReq) Descriptor() ([]byte, []int) { - return fileDescriptor_c92b5dfe90086a66, []int{4} + return fileDescriptor_c92b5dfe90086a66, []int{3} } func (m *DeRegisterAVSReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -300,7 +275,7 @@ func (m *DeRegisterAVSResponse) Reset() { *m = DeRegisterAVSResponse{} } func (m *DeRegisterAVSResponse) String() string { return proto.CompactTextString(m) } func (*DeRegisterAVSResponse) ProtoMessage() {} func (*DeRegisterAVSResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c92b5dfe90086a66, []int{5} + return fileDescriptor_c92b5dfe90086a66, []int{4} } func (m *DeRegisterAVSResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -343,152 +318,48 @@ func (m *DeRegisterAVSResponse) GetInfo() *AVSInfo { return nil } -// MsgUpdateParams is the Msg/UpdateParams request type for Erc20 parameters. -type MsgUpdateParams struct { - // authority is the address of the governance account. - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // params defines the x/evm parameters to update. - // NOTE: All parameters must be supplied. - Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` -} - -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_c92b5dfe90086a66, []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 nil -} - -// MsgUpdateParamsResponse defines the response structure for executing a -// MsgUpdateParams message. -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_c92b5dfe90086a66, []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((*AVSInfo)(nil), "exocore.avs.AVSInfo") - proto.RegisterType((*AVSManager)(nil), "exocore.avs.AVSManager") - proto.RegisterMapType((map[string]string)(nil), "exocore.avs.AVSManager.AVSOperatorRelationEntry") proto.RegisterType((*RegisterAVSReq)(nil), "exocore.avs.RegisterAVSReq") proto.RegisterType((*RegisterAVSResponse)(nil), "exocore.avs.RegisterAVSResponse") proto.RegisterType((*DeRegisterAVSReq)(nil), "exocore.avs.DeRegisterAVSReq") proto.RegisterType((*DeRegisterAVSResponse)(nil), "exocore.avs.DeRegisterAVSResponse") - proto.RegisterType((*MsgUpdateParams)(nil), "exocore.avs.MsgUpdateParams") - proto.RegisterType((*MsgUpdateParamsResponse)(nil), "exocore.avs.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("exocore/avs/tx.proto", fileDescriptor_c92b5dfe90086a66) } var fileDescriptor_c92b5dfe90086a66 = []byte{ - // 564 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0x41, 0x6b, 0x13, 0x41, - 0x14, 0xce, 0x34, 0x6d, 0x25, 0x2f, 0xd8, 0xc6, 0x49, 0xa4, 0xdb, 0x15, 0x97, 0xb0, 0xa7, 0x50, - 0xe9, 0xae, 0x46, 0x10, 0xc9, 0x2d, 0xc5, 0x56, 0x04, 0xa3, 0xb2, 0xc1, 0x1c, 0xbc, 0xc8, 0x24, - 0x99, 0x6e, 0x97, 0x66, 0x77, 0xd6, 0x99, 0x49, 0x4c, 0x6e, 0xe2, 0x41, 0x44, 0x10, 0xfd, 0x25, - 0xd2, 0x83, 0x07, 0x7f, 0x82, 0xc7, 0xe2, 0xc9, 0xa3, 0x24, 0x87, 0xfe, 0x0d, 0xc9, 0xee, 0x2c, - 0xd9, 0x0d, 0xad, 0x1e, 0xdb, 0x4b, 0x32, 0x33, 0xdf, 0xfb, 0xbe, 0xf9, 0xde, 0x7b, 0x3b, 0x0f, - 0x2a, 0x74, 0xcc, 0x7a, 0x8c, 0x53, 0x9b, 0x8c, 0x84, 0x2d, 0xc7, 0x56, 0xc8, 0x99, 0x64, 0xb8, - 0xa8, 0x4e, 0x2d, 0x32, 0x12, 0xfa, 0x0d, 0xe2, 0x7b, 0x01, 0xb3, 0xa3, 0xdf, 0x18, 0xd7, 0xb7, - 0x7a, 0x4c, 0xf8, 0x4c, 0xd8, 0xbe, 0x70, 0xed, 0xd1, 0xbd, 0xf9, 0x9f, 0x02, 0xb6, 0x63, 0xe0, - 0x75, 0xb4, 0xb3, 0xe3, 0x8d, 0x82, 0x8c, 0xe4, 0xa6, 0x3e, 0x1d, 0x50, 0x97, 0x48, 0x8f, 0x05, - 0x73, 0x6e, 0x72, 0xa7, 0xae, 0xa5, 0x9d, 0x84, 0x84, 0x13, 0x5f, 0x31, 0x4d, 0x17, 0xae, 0x35, - 0x3b, 0xed, 0x27, 0xc1, 0x21, 0xc3, 0x18, 0x56, 0x03, 0xe2, 0x53, 0x0d, 0x55, 0x51, 0xad, 0xe0, - 0x44, 0x6b, 0x6c, 0x00, 0x34, 0x3b, 0xed, 0x66, 0xbf, 0xcf, 0xa9, 0x10, 0xda, 0x4a, 0x84, 0xa4, - 0x4e, 0x70, 0x0d, 0x36, 0x59, 0x48, 0x39, 0x91, 0x8c, 0x27, 0x41, 0xf9, 0x6a, 0xbe, 0x56, 0x70, - 0x96, 0x8f, 0xcd, 0x1f, 0x28, 0x92, 0x6a, 0x91, 0x80, 0xb8, 0x94, 0xe3, 0x2e, 0x94, 0x9b, 0x9d, - 0xf6, 0x73, 0x15, 0xe4, 0xd0, 0x41, 0x64, 0x5a, 0x43, 0xd5, 0x7c, 0xad, 0x58, 0xbf, 0x6b, 0xa5, - 0x6a, 0x64, 0x2d, 0x58, 0xd6, 0x39, 0x94, 0xfd, 0x40, 0xf2, 0x89, 0x73, 0x9e, 0x98, 0x7e, 0x00, - 0xda, 0x45, 0x04, 0x5c, 0x82, 0xfc, 0x31, 0x9d, 0xa8, 0x5c, 0xe7, 0x4b, 0x5c, 0x81, 0xb5, 0x11, - 0x19, 0x0c, 0xa9, 0xca, 0x32, 0xde, 0x34, 0x56, 0x1e, 0x22, 0xf3, 0x23, 0x82, 0x0d, 0x87, 0xba, - 0x9e, 0x90, 0x94, 0x37, 0x3b, 0x6d, 0x87, 0xbe, 0xc1, 0x0d, 0x28, 0x1e, 0x70, 0xe6, 0x27, 0x39, - 0x47, 0x32, 0x7b, 0xda, 0xaf, 0xef, 0xbb, 0x15, 0xd5, 0x17, 0x85, 0xb4, 0x25, 0xf7, 0x02, 0xd7, - 0x49, 0x07, 0xe3, 0x1a, 0xac, 0x7a, 0xc1, 0x21, 0x8b, 0xee, 0x29, 0xd6, 0x2b, 0xcb, 0xb9, 0xce, - 0x7b, 0xe1, 0x44, 0x11, 0x8d, 0xd2, 0xfb, 0xb3, 0x93, 0x9d, 0x34, 0xd7, 0xfc, 0x8c, 0xa0, 0x9c, - 0xb1, 0x22, 0x42, 0x16, 0x08, 0x7a, 0x69, 0x7e, 0x3e, 0x21, 0x28, 0x3d, 0xa2, 0x57, 0xa4, 0x38, - 0x5f, 0x10, 0xdc, 0x5c, 0x32, 0x73, 0xc9, 0xe5, 0xf9, 0x80, 0x60, 0xb3, 0x25, 0xdc, 0x97, 0x61, - 0x9f, 0x48, 0xfa, 0x22, 0x7a, 0x77, 0xf8, 0x01, 0x14, 0xc8, 0x50, 0x1e, 0x31, 0xee, 0xc9, 0xc9, - 0x7f, 0x9d, 0x2c, 0x42, 0xf1, 0x1d, 0x58, 0x8f, 0x5f, 0xae, 0x72, 0x52, 0xce, 0x38, 0x89, 0xc5, - 0x1d, 0x15, 0xd2, 0xd8, 0x98, 0x5b, 0x59, 0x90, 0xcd, 0x6d, 0xd8, 0x5a, 0xf2, 0x91, 0xd4, 0xa6, - 0xfe, 0x0d, 0x41, 0xbe, 0x25, 0x5c, 0xfc, 0x14, 0x8a, 0xa9, 0xd2, 0xe1, 0x5b, 0x19, 0xf9, 0x6c, - 0x87, 0xf5, 0xea, 0xc5, 0xa0, 0xaa, 0xb8, 0x03, 0xd7, 0x33, 0xad, 0xc0, 0xb7, 0x33, 0x94, 0xe5, - 0x6f, 0x46, 0x37, 0xff, 0x05, 0xc7, 0x9a, 0xfa, 0xda, 0xbb, 0xb3, 0x93, 0x1d, 0xb4, 0xf7, 0xf8, - 0xe7, 0xd4, 0x40, 0xa7, 0x53, 0x03, 0xfd, 0x99, 0x1a, 0xe8, 0xeb, 0xcc, 0xc8, 0x9d, 0xce, 0x8c, - 0xdc, 0xef, 0x99, 0x91, 0x7b, 0xb5, 0xeb, 0x7a, 0xf2, 0x68, 0xd8, 0xb5, 0x7a, 0xcc, 0xb7, 0xf7, - 0x63, 0xb9, 0x67, 0x54, 0xbe, 0x65, 0xfc, 0xd8, 0x4e, 0x06, 0xe0, 0x38, 0x1e, 0xc6, 0x93, 0x90, - 0x8a, 0xee, 0x7a, 0x34, 0x02, 0xef, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x2e, 0xf9, 0x90, 0x0d, - 0xa8, 0x05, 0x00, 0x00, + // 468 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0xcf, 0x6b, 0xd4, 0x40, + 0x14, 0xde, 0x71, 0xb7, 0x96, 0xbe, 0x45, 0xad, 0xe3, 0x8a, 0x31, 0x62, 0x58, 0xf6, 0xb4, 0x14, + 0x9a, 0x60, 0xbd, 0xf5, 0x96, 0x52, 0x95, 0x82, 0x3f, 0x20, 0x81, 0x3d, 0x78, 0x91, 0x74, 0xf7, + 0x35, 0x06, 0x4d, 0xde, 0x3a, 0x33, 0x6e, 0xd7, 0x9b, 0x78, 0x12, 0x41, 0xf4, 0xff, 0x10, 0xa4, + 0x07, 0xff, 0x08, 0x8f, 0xc5, 0x93, 0x47, 0xd9, 0x3d, 0xf4, 0xdf, 0x90, 0xcc, 0x24, 0x25, 0x09, + 0xe8, 0x75, 0x7b, 0x49, 0xe6, 0xbd, 0xef, 0xbd, 0x6f, 0xbe, 0xf7, 0x0d, 0x33, 0xd0, 0xc3, 0x39, + 0x8d, 0x49, 0xa0, 0x17, 0xcd, 0xa4, 0xa7, 0xe6, 0xee, 0x54, 0x90, 0x22, 0xde, 0x2d, 0xb2, 0x6e, + 0x34, 0x93, 0xf6, 0xf5, 0x28, 0x4d, 0x32, 0xf2, 0xf4, 0xd7, 0xe0, 0xf6, 0xad, 0x31, 0xc9, 0x94, + 0xa4, 0x97, 0xca, 0xd8, 0x9b, 0xdd, 0xcb, 0x7f, 0x05, 0x70, 0xdb, 0x00, 0x2f, 0x74, 0xe4, 0x99, + 0xa0, 0x80, 0x9c, 0x72, 0xa7, 0x09, 0xbe, 0xc6, 0x38, 0x52, 0x09, 0x65, 0x79, 0x6f, 0xb9, 0xa7, + 0x6d, 0x9f, 0x2b, 0x91, 0x12, 0x95, 0xac, 0x61, 0xbd, 0x98, 0x62, 0x32, 0x9c, 0xf9, 0xca, 0x64, + 0x07, 0xdf, 0x18, 0xac, 0xfb, 0xa3, 0xf0, 0x20, 0x3b, 0x22, 0xce, 0xa1, 0x93, 0x45, 0x29, 0x5a, + 0xac, 0xcf, 0x86, 0x1b, 0x81, 0x5e, 0x73, 0x07, 0xc0, 0x1f, 0x85, 0xfe, 0x64, 0x22, 0x50, 0x4a, + 0xeb, 0x92, 0x46, 0x2a, 0x19, 0x3e, 0x84, 0x6b, 0x34, 0x45, 0x11, 0x29, 0x12, 0x65, 0x51, 0xbb, + 0xdf, 0x1e, 0x6e, 0x04, 0xcd, 0x74, 0x5e, 0xe9, 0x8f, 0xc2, 0x67, 0xc7, 0x19, 0x9e, 0x57, 0x76, + 0x34, 0x5d, 0x33, 0xcd, 0x2d, 0x58, 0xf7, 0x73, 0xfd, 0x07, 0xfb, 0xd6, 0x9a, 0xe6, 0x2a, 0xc3, + 0xc1, 0x47, 0x06, 0x57, 0x03, 0x8c, 0x13, 0xa9, 0x50, 0xf8, 0xa3, 0x30, 0xc0, 0x37, 0x7c, 0x17, + 0xba, 0x0f, 0x05, 0xa5, 0x25, 0xa5, 0xd6, 0xbe, 0x67, 0xfd, 0xfa, 0xb1, 0xdd, 0x2b, 0x9c, 0x2b, + 0x90, 0x50, 0x89, 0x24, 0x8b, 0x83, 0x6a, 0x31, 0x1f, 0x42, 0x27, 0xc9, 0x8e, 0x48, 0x8f, 0xd5, + 0xdd, 0xe9, 0xb9, 0x95, 0x13, 0x73, 0x0b, 0x53, 0x02, 0x5d, 0xb1, 0xbb, 0xf9, 0xe1, 0xec, 0x64, + 0xab, 0xda, 0x3b, 0xf8, 0xcc, 0xe0, 0x46, 0x4d, 0x8a, 0x9c, 0x52, 0x26, 0x71, 0x65, 0x7a, 0x3e, + 0x31, 0xd8, 0xdc, 0xc7, 0x0b, 0x62, 0xce, 0x17, 0x06, 0x37, 0x1b, 0x62, 0x56, 0x6b, 0xcf, 0xce, + 0x77, 0x06, 0xed, 0x27, 0x32, 0xe6, 0x8f, 0xa1, 0x5b, 0x91, 0xc5, 0xef, 0xd4, 0x48, 0xea, 0xee, + 0xd9, 0xfd, 0x7f, 0x83, 0xc5, 0x34, 0x01, 0x5c, 0xa9, 0x8d, 0xc9, 0xef, 0xd6, 0x5a, 0x9a, 0xe7, + 0x61, 0x0f, 0xfe, 0x07, 0x1b, 0x4e, 0x7b, 0xed, 0xfd, 0xd9, 0xc9, 0x16, 0xdb, 0x7b, 0xf4, 0x73, + 0xe1, 0xb0, 0xd3, 0x85, 0xc3, 0xfe, 0x2c, 0x1c, 0xf6, 0x75, 0xe9, 0xb4, 0x4e, 0x97, 0x4e, 0xeb, + 0xf7, 0xd2, 0x69, 0x3d, 0xdf, 0x8e, 0x13, 0xf5, 0xf2, 0xed, 0xa1, 0x3b, 0xa6, 0xd4, 0x7b, 0x60, + 0xe8, 0x9e, 0xa2, 0x3a, 0x26, 0xf1, 0xca, 0x2b, 0xaf, 0xff, 0xdc, 0x3c, 0x45, 0xef, 0xa6, 0x28, + 0x0f, 0x2f, 0xeb, 0x8b, 0x7e, 0xff, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe7, 0x23, 0x87, 0x64, + 0xa6, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -631,6 +502,22 @@ func (m *AVSInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.AssetID) > 0 { + for iNdEx := len(m.AssetID) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.AssetID[iNdEx]) + copy(dAtA[i:], m.AssetID[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.AssetID[iNdEx]))) + i-- + dAtA[i] = 0x2a + } + } + if len(m.AVSOwnerAddress) > 0 { + i -= len(m.AVSOwnerAddress) + copy(dAtA[i:], m.AVSOwnerAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.AVSOwnerAddress))) + i-- + dAtA[i] = 0x22 + } if len(m.OperatorAddress) > 0 { for iNdEx := len(m.OperatorAddress) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.OperatorAddress[iNdEx]) @@ -657,48 +544,6 @@ func (m *AVSInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *AVSManager) 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 *AVSManager) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AVSManager) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.AVSOperatorRelation) > 0 { - for k := range m.AVSOperatorRelation { - v := m.AVSOperatorRelation[k] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarintTx(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarintTx(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarintTx(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - func (m *RegisterAVSReq) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -867,71 +712,6 @@ func (m *DeRegisterAVSResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { 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 - if m.Params != nil { - { - 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 @@ -963,21 +743,14 @@ func (m *AVSInfo) Size() (n int) { n += 1 + l + sovTx(uint64(l)) } } - return n -} - -func (m *AVSManager) Size() (n int) { - if m == nil { - return 0 + l = len(m.AVSOwnerAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) } - var l int - _ = l - if len(m.AVSOperatorRelation) > 0 { - for k, v := range m.AVSOperatorRelation { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sovTx(uint64(len(k))) + 1 + len(v) + sovTx(uint64(len(v))) - n += mapEntrySize + 1 + sovTx(uint64(mapEntrySize)) + if len(m.AssetID) > 0 { + for _, s := range m.AssetID { + l = len(s) + n += 1 + l + sovTx(uint64(l)) } } return n @@ -1051,32 +824,6 @@ func (m *DeRegisterAVSResponse) 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)) - } - if m.Params != nil { - 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 } @@ -1208,236 +955,9 @@ func (m *AVSInfo) Unmarshal(dAtA []byte) error { } m.OperatorAddress = append(m.OperatorAddress, string(dAtA[iNdEx:postIndex])) 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 *AVSManager) 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: AVSManager: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AVSManager: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AVSOperatorRelation", 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 m.AVSOperatorRelation == nil { - m.AVSOperatorRelation = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := 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) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthTx - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthTx - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLengthTx - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLengthTx - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.AVSOperatorRelation[mapkey] = mapvalue - 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 *RegisterAVSReq) 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: RegisterAVSReq: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RegisterAVSReq: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AVSOwnerAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1465,13 +985,13 @@ func (m *RegisterAVSReq) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.FromAddress = string(dAtA[iNdEx:postIndex]) + m.AVSOwnerAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AssetID", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1481,27 +1001,23 @@ func (m *RegisterAVSReq) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Info == nil { - m.Info = &AVSInfo{} - } - if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.AssetID = append(m.AssetID, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -1524,7 +1040,7 @@ func (m *RegisterAVSReq) Unmarshal(dAtA []byte) error { } return nil } -func (m *RegisterAVSResponse) Unmarshal(dAtA []byte) error { +func (m *RegisterAVSReq) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1547,10 +1063,10 @@ func (m *RegisterAVSResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RegisterAVSResponse: wiretype end group for non-group") + return fmt.Errorf("proto: RegisterAVSReq: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RegisterAVSResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: RegisterAVSReq: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1642,7 +1158,7 @@ func (m *RegisterAVSResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeRegisterAVSReq) Unmarshal(dAtA []byte) error { +func (m *RegisterAVSResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1665,10 +1181,10 @@ func (m *DeRegisterAVSReq) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeRegisterAVSReq: wiretype end group for non-group") + return fmt.Errorf("proto: RegisterAVSResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeRegisterAVSReq: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: RegisterAVSResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1760,7 +1276,7 @@ func (m *DeRegisterAVSReq) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeRegisterAVSResponse) Unmarshal(dAtA []byte) error { +func (m *DeRegisterAVSReq) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1783,10 +1299,10 @@ func (m *DeRegisterAVSResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeRegisterAVSResponse: wiretype end group for non-group") + return fmt.Errorf("proto: DeRegisterAVSReq: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeRegisterAVSResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DeRegisterAVSReq: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1878,7 +1394,7 @@ func (m *DeRegisterAVSResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { +func (m *DeRegisterAVSResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1901,15 +1417,15 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + return fmt.Errorf("proto: DeRegisterAVSResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DeRegisterAVSResponse: 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) + return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1937,11 +1453,11 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Authority = string(dAtA[iNdEx:postIndex]) + m.FromAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1968,10 +1484,10 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Params == nil { - m.Params = &Params{} + if m.Info == nil { + m.Info = &AVSInfo{} } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1996,56 +1512,6 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } 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 diff --git a/x/deposit/keeper/cross_chain_tx_process.go b/x/deposit/keeper/cross_chain_tx_process.go index 6d3422f73..831dd88e6 100644 --- a/x/deposit/keeper/cross_chain_tx_process.go +++ b/x/deposit/keeper/cross_chain_tx_process.go @@ -6,7 +6,7 @@ import ( errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" "github.com/ExocoreNetwork/exocore/x/assets/types" - despoittypes "github.com/ExocoreNetwork/exocore/x/deposit/types" + deposittypes "github.com/ExocoreNetwork/exocore/x/deposit/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -126,12 +126,12 @@ func (k Keeper) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *eth func (k Keeper) Deposit(ctx sdk.Context, params *DepositParams) error { // check params parameter before executing deposit operation if params.OpAmount.IsNegative() { - return errorsmod.Wrap(despoittypes.ErrDepositAmountIsNegative, fmt.Sprintf("the amount is:%s", params.OpAmount)) + return errorsmod.Wrap(deposittypes.ErrDepositAmountIsNegative, fmt.Sprintf("the amount is:%s", params.OpAmount)) } stakeID, assetID := types.GetStakeIDAndAssetID(params.ClientChainLzID, params.StakerAddress, params.AssetsAddress) // check if asset exist if !k.assetsKeeper.IsStakingAsset(ctx, assetID) { - return errorsmod.Wrap(despoittypes.ErrDepositAssetNotExist, fmt.Sprintf("the assetID is:%s", assetID)) + return errorsmod.Wrap(deposittypes.ErrDepositAssetNotExist, fmt.Sprintf("the assetID is:%s", assetID)) } changeAmount := types.StakerSingleAssetChangeInfo{ TotalDepositAmount: params.OpAmount,