diff --git a/app/app.go b/app/app.go index 1fa133918..bda9871be 100644 --- a/app/app.go +++ b/app/app.go @@ -10,11 +10,14 @@ import ( "path/filepath" "sort" + "github.com/ExocoreNetwork/exocore/x/avs" "github.com/ExocoreNetwork/exocore/x/operator" operatorKeeper "github.com/ExocoreNetwork/exocore/x/operator/keeper" exoslash "github.com/ExocoreNetwork/exocore/x/slash" + avsManagerKeeper "github.com/ExocoreNetwork/exocore/x/avs/keeper" + avsManagerTypes "github.com/ExocoreNetwork/exocore/x/avs/types" slashKeeper "github.com/ExocoreNetwork/exocore/x/slash/keeper" exoslashTypes "github.com/ExocoreNetwork/exocore/x/slash/types" @@ -267,6 +270,7 @@ var ( withdraw.AppModuleBasic{}, reward.AppModuleBasic{}, exoslash.AppModuleBasic{}, + avs.AppModuleBasic{}, ) // module account permissions @@ -358,8 +362,8 @@ type ExocoreApp struct { WithdrawKeeper withdrawKeeper.Keeper RewardKeeper rewardKeeper.Keeper OperatorKeeper operatorKeeper.Keeper - - ExoSlashKeeper slashKeeper.Keeper + ExoSlashKeeper slashKeeper.Keeper + AVSManagerKeeper avsManagerKeeper.Keeper // the module manager mm *module.Manager @@ -441,6 +445,7 @@ func NewExocoreApp( rewardTypes.StoreKey, exoslashTypes.StoreKey, operatorTypes.StoreKey, + avsManagerTypes.StoreKey, ) // Add the EVM transient store key @@ -630,6 +635,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) // We call this after setting the hooks to ensure that the hooks are set on the keeper evmKeeper.WithPrecompiles( evmkeeper.AvailablePrecompiles( @@ -645,6 +651,7 @@ func NewExocoreApp( app.WithdrawKeeper, app.ExoSlashKeeper, app.RewardKeeper, + app.AVSManagerKeeper, ), ) epochsKeeper := epochskeeper.NewKeeper(appCodec, keys[epochstypes.StoreKey]) @@ -804,6 +811,7 @@ func NewExocoreApp( withdraw.NewAppModule(appCodec, app.WithdrawKeeper), reward.NewAppModule(appCodec, app.RewardKeeper), exoslash.NewAppModule(appCodec, app.ExoSlashKeeper), + avs.NewAppModule(appCodec, app.AVSManagerKeeper), ) // During begin block slashing happens after distr.BeginBlocker so that @@ -851,6 +859,7 @@ func NewExocoreApp( withdrawTypes.ModuleName, rewardTypes.ModuleName, exoslashTypes.ModuleName, + avsManagerTypes.ModuleName, ) // NOTE: fee market module must go last in order to retrieve the block gas used. @@ -894,6 +903,7 @@ func NewExocoreApp( withdrawTypes.ModuleName, rewardTypes.ModuleName, exoslashTypes.ModuleName, + avsManagerTypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -946,6 +956,7 @@ func NewExocoreApp( // NOTE: crisis module must go at the end to check for invariants on each module crisistypes.ModuleName, consensusparamtypes.ModuleName, + avsManagerTypes.ModuleName, ) app.mm.RegisterInvariants(&app.CrisisKeeper) diff --git a/proto/exocore/avs/tx.proto b/proto/exocore/avs/tx.proto index a43bf6132..017702e4b 100644 --- a/proto/exocore/avs/tx.proto +++ b/proto/exocore/avs/tx.proto @@ -4,6 +4,7 @@ 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"; option go_package = "github.com/ExocoreNetwork/exocore/x/avs/types"; @@ -54,4 +55,19 @@ service Msg { // DelegateAssetToOperator delegates asset to operator. rpc DeRegisterAVS (DeRegisterAVSReq) returns (DeRegisterAVSResponse); } - \ No newline at end of file + +// 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 diff --git a/testutil/keeper/avs.go b/testutil/keeper/avs.go deleted file mode 100644 index a6e704191..000000000 --- a/testutil/keeper/avs.go +++ /dev/null @@ -1,52 +0,0 @@ -package keeper - -import ( - "testing" - - "github.com/ExocoreNetwork/exocore/x/avs/keeper" - "github.com/ExocoreNetwork/exocore/x/avs/types" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/stretchr/testify/require" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - tmdb "github.com/cometbft/cometbft-db" -) - -func AvsKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - - db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) - require.NoError(t, stateStore.LoadLatestVersion()) - - registry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(registry) - - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "AvsParams", - ) - k := keeper.NewKeeper( - cdc, - storeKey, - memStoreKey, - paramsSubspace, - ) - - ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) - - // Initialize params - k.SetParams(ctx, types.DefaultParams()) - - return k, ctx -} diff --git a/testutil/keeper/taskmanageravs.go b/testutil/keeper/taskmanageravs.go deleted file mode 100644 index 451ba400b..000000000 --- a/testutil/keeper/taskmanageravs.go +++ /dev/null @@ -1,52 +0,0 @@ -package keeper - -import ( - "testing" - - "github.com/ExocoreNetwork/exocore/x/taskmanageravs/keeper" - "github.com/ExocoreNetwork/exocore/x/taskmanageravs/types" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/stretchr/testify/require" - "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - tmdb "github.com/cometbft/cometbft-db" -) - -func TaskmanageravsKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { - storeKey := sdk.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - - db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db) - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) - require.NoError(t, stateStore.LoadLatestVersion()) - - registry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(registry) - - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "TaskmanageravsParams", - ) - k := keeper.NewKeeper( - cdc, - storeKey, - memStoreKey, - paramsSubspace, - ) - - ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) - - // Initialize params - k.SetParams(ctx, types.DefaultParams()) - - return k, ctx -} diff --git a/x/avs/client/cli/tx.go b/x/avs/client/cli/tx.go index 8e7985870..2cec62353 100644 --- a/x/avs/client/cli/tx.go +++ b/x/avs/client/cli/tx.go @@ -56,7 +56,7 @@ func RegisterAVS() *cobra.Command { Info: &types.AVSInfo{ Name: args[0], AVSAddress: args[1], - OperatorAddress: args[2], + OperatorAddress: []string{args[2]}, }, } diff --git a/x/avs/genesis.go b/x/avs/genesis.go deleted file mode 100644 index 5cf1bc578..000000000 --- a/x/avs/genesis.go +++ /dev/null @@ -1,23 +0,0 @@ -package avs - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/ExocoreNetwork/exocore/x/avs/keeper" - "github.com/ExocoreNetwork/exocore/x/avs/types" -) - -// InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) -} - -// ExportGenesis returns the module's exported genesis -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) - - // this line is used by starport scaffolding # genesis/module/export - - return genesis -} diff --git a/x/avs/genesis_test.go b/x/avs/genesis_test.go deleted file mode 100644 index 497681a15..000000000 --- a/x/avs/genesis_test.go +++ /dev/null @@ -1,31 +0,0 @@ -package avs_test - -import ( - "testing" - - keepertest "github.com/ExocoreNetwork/exocore/testutil/keeper" - "github.com/ExocoreNetwork/exocore/testutil/nullify" - "github.com/ExocoreNetwork/exocore/x/avs" - "github.com/ExocoreNetwork/exocore/x/avs/types" - "github.com/stretchr/testify/require" -) - -func TestGenesis(t *testing.T) { - genesisState := types.GenesisState{ - Params: types.DefaultParams(), - - // this line is used by starport scaffolding # genesis/test/state - } - - k, ctx := keepertest.AvsKeeper(t) - avs.InitGenesis(ctx, *k, genesisState) - got := avs.ExportGenesis(ctx, *k) - require.NotNil(t, got) - - nullify.Fill(&genesisState) - nullify.Fill(got) - - - - // this line is used by starport scaffolding # genesis/test/assert -} diff --git a/x/avs/keeper/keeper.go b/x/avs/keeper/keeper.go index 7c363e166..93a448552 100644 --- a/x/avs/keeper/keeper.go +++ b/x/avs/keeper/keeper.go @@ -10,7 +10,6 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/ExocoreNetwork/exocore/x/avs/types" ) @@ -19,29 +18,20 @@ type ( Keeper struct { cdc codec.BinaryCodec storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace operatorKeeper delegationtypes.OperatorKeeper } ) func NewKeeper( cdc codec.BinaryCodec, - storeKey, - memKey storetypes.StoreKey, - ps paramtypes.Subspace, - + storeKey storetypes.StoreKey, + operatorKeeper delegationtypes.OperatorKeeper, ) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramstore: ps, + cdc: cdc, + storeKey: storeKey, + operatorKeeper: operatorKeeper, } } diff --git a/x/avs/keeper/params.go b/x/avs/keeper/params.go index 5cb190464..255a88b24 100644 --- a/x/avs/keeper/params.go +++ b/x/avs/keeper/params.go @@ -1,18 +1,34 @@ package keeper import ( + "fmt" + "github.com/ExocoreNetwork/exocore/x/avs/types" + "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" ) // GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() +func (k Keeper) GetParams(ctx sdk.Context) (*types.Params, error) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixParams) + ifExist := store.Has(types.ParamsKey) + if !ifExist { + return nil, fmt.Errorf("params %s not found", types.KeyPrefixParams) + } + + value := store.Get(types.ParamsKey) + + ret := &types.Params{} + k.cdc.MustUnmarshal(value, ret) + return ret, nil } // SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) +func (k Keeper) SetParams(ctx sdk.Context, params *types.Params) error { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixParams) + bz := k.cdc.MustMarshal(params) + store.Set(types.ParamsKey, bz) + return nil } type AVSParams struct { diff --git a/x/avs/keeper/params_test.go b/x/avs/keeper/params_test.go deleted file mode 100644 index abe54c450..000000000 --- a/x/avs/keeper/params_test.go +++ /dev/null @@ -1,18 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - testkeeper "github.com/ExocoreNetwork/exocore/testutil/keeper" - "github.com/ExocoreNetwork/exocore/x/avs/types" -) - -func TestGetParams(t *testing.T) { - k, ctx := testkeeper.AvsKeeper(t) - params := types.DefaultParams() - - k.SetParams(ctx, params) - - require.EqualValues(t, params, k.GetParams(ctx)) -} diff --git a/x/avs/keeper/query_params.go b/x/avs/keeper/query_params.go index 437c0aa3a..98c778e6c 100644 --- a/x/avs/keeper/query_params.go +++ b/x/avs/keeper/query_params.go @@ -3,8 +3,8 @@ package keeper import ( "context" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ExocoreNetwork/exocore/x/avs/types" + sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) @@ -14,6 +14,9 @@ func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*t return nil, status.Error(codes.InvalidArgument, "invalid request") } ctx := sdk.UnwrapSDKContext(goCtx) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil + params, err := k.GetParams(ctx) + if err != nil { + return nil, err + } + return &types.QueryParamsResponse{Params: *params}, nil } diff --git a/x/avs/keeper/query_params_test.go b/x/avs/keeper/query_params_test.go deleted file mode 100644 index 84338c827..000000000 --- a/x/avs/keeper/query_params_test.go +++ /dev/null @@ -1,21 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - testkeeper "github.com/ExocoreNetwork/exocore/testutil/keeper" - "github.com/ExocoreNetwork/exocore/x/avs/types" -) - -func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.AvsKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - params := types.DefaultParams() - keeper.SetParams(ctx, params) - - response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) - require.NoError(t, err) - require.Equal(t, &types.QueryParamsResponse{Params: params}, response) -} diff --git a/x/avs/module.go b/x/avs/module.go index 52c1f6d29..bb8556817 100644 --- a/x/avs/module.go +++ b/x/avs/module.go @@ -1,54 +1,46 @@ package avs import ( - "context" + "context" "encoding/json" "fmt" - // this line is used by starport scaffolding # 1 + + // this line is used by starport scaffolding # 1 "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - abci "github.com/cometbft/cometbft/abci/types" - + "github.com/ExocoreNetwork/exocore/x/avs/client/cli" + "github.com/ExocoreNetwork/exocore/x/avs/keeper" + "github.com/ExocoreNetwork/exocore/x/avs/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/ExocoreNetwork/exocore/x/avs/keeper" - "github.com/ExocoreNetwork/exocore/x/avs/types" - "github.com/ExocoreNetwork/exocore/x/avs/client/cli" - + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" ) +// type check to ensure the interface is properly implemented var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} - + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} + _ module.AppModuleSimulation = AppModule{} ) // ---------------------------------------------------------------------------- // AppModuleBasic // ---------------------------------------------------------------------------- -// AppModuleBasic implements the AppModuleBasic interface that defines the independent methods a Cosmos SDK module needs to implement. -type AppModuleBasic struct { - cdc codec.BinaryCodec -} - -func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { - return AppModuleBasic{cdc: cdc} -} +type AppModuleBasic struct{} // Name returns the name of the module as a string func (AppModuleBasic) Name() string { return types.ModuleName } -// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) +func (b AppModuleBasic) RegisterLegacyAminoCodec(amino *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(amino) } // RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message @@ -72,17 +64,17 @@ 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)) + types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) } // 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 func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() + return cli.GetTxCmd() } // GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by end-users to generate new queries to the subset of the state defined by the module func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd(types.StoreKey) + return cli.GetQueryCmd(types.StoreKey) } // ---------------------------------------------------------------------------- @@ -93,58 +85,31 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command { type AppModule struct { AppModuleBasic - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper + keeper keeper.Keeper } -func NewAppModule( - cdc codec.Codec, - keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, -) AppModule { +func NewAppModule(_ codec.Codec, keeper keeper.Keeper) AppModule { return AppModule{ - AppModuleBasic: NewAppModuleBasic(cdc), + AppModuleBasic: AppModuleBasic{}, keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, } } -// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries +// RegisterServices registers module services. func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + types.RegisterMsgServer(cfg.MsgServer(), &am.keeper) + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) } -// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the module's genesis initialization. It returns no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { - var genState types.GenesisState - // Initialize global index to index in genesis state - cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, genState) - - return []abci.ValidatorUpdate{} +// RegisterStoreDecoder registers a decoder for inflation module's types. +func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { } -// ExportGenesis returns the module's exported genesis state as raw JSON bytes. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) - return cdc.MustMarshalJSON(genState) +// WeightedOperations doesn't return any inflation module operation. +func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { + return []simtypes.WeightedOperation{} } -// ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1 -func (AppModule) ConsensusVersion() uint64 { return 1 } - -// BeginBlock contains the logic that is automatically triggered at the beginning of each block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} - -// EndBlock contains the logic that is automatically triggered at the end of each block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +// GenerateGenesisState creates a randomized GenState of the inflation module. +func (am AppModule) GenerateGenesisState(_ *module.SimulationState) { } diff --git a/x/avs/types/codec.go b/x/avs/types/codec.go index fb6871d22..b353cdd0c 100644 --- a/x/avs/types/codec.go +++ b/x/avs/types/codec.go @@ -2,22 +2,34 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + 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" ) -func RegisterCodec(cdc *codec.LegacyAmino) { - // this line is used by starport scaffolding # 2 -} +const ( + // Amino names + updateParamsName = "exocore/MsgUpdateParams" +) func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - // this line is used by starport scaffolding # 3 - + 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 ( - Amino = codec.NewLegacyAmino() + Amino = codec.NewLegacyAmino() ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) ) diff --git a/x/avs/types/keys.go b/x/avs/types/keys.go index bf062a701..202abc78d 100644 --- a/x/avs/types/keys.go +++ b/x/avs/types/keys.go @@ -20,6 +20,7 @@ const ( MemStoreKey = "mem_avs" prefixAVSInfo = iota + 1 prefixAVSOperatorInfo + prefixParams ) // ModuleAddress is the native module address for EVM @@ -27,6 +28,8 @@ var ( ModuleAddress common.Address KeyPrefixAVSInfo = []byte{prefixAVSInfo} KeyPrefixAVSOperatorInfo = []byte{prefixAVSOperatorInfo} + KeyPrefixParams = []byte{prefixParams} + ParamsKey = []byte("Params") ) func init() { diff --git a/x/avs/types/tx.pb.go b/x/avs/types/tx.pb.go index 621140951..5d6a3d78d 100644 --- a/x/avs/types/tx.pb.go +++ b/x/avs/types/tx.pb.go @@ -343,6 +343,100 @@ 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") @@ -351,43 +445,50 @@ func init() { 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{ - // 495 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0x31, 0x6f, 0xd3, 0x40, - 0x14, 0xce, 0xd5, 0x2d, 0xa8, 0xcf, 0x02, 0xc2, 0x35, 0x08, 0x63, 0x84, 0x15, 0x79, 0xb2, 0x2a, - 0xd5, 0x86, 0xb0, 0xa0, 0x6c, 0xae, 0x68, 0x11, 0x12, 0x05, 0xc9, 0x96, 0x32, 0xb0, 0x20, 0x27, - 0x79, 0x35, 0x56, 0x63, 0x5f, 0xb8, 0x73, 0x43, 0xb2, 0x21, 0x26, 0x84, 0x84, 0xe0, 0x97, 0xa0, - 0x0e, 0x0c, 0xfc, 0x04, 0xc6, 0x8a, 0x89, 0x11, 0x25, 0x43, 0xff, 0x06, 0xca, 0xf9, 0x2c, 0xec, - 0xa8, 0x65, 0x2d, 0x8b, 0x7d, 0xf7, 0xbe, 0xf7, 0x7d, 0xef, 0x7d, 0xef, 0xa4, 0x07, 0x2d, 0x9c, - 0xb2, 0x01, 0xe3, 0xe8, 0x45, 0x13, 0xe1, 0xe5, 0x53, 0x77, 0xcc, 0x59, 0xce, 0xa8, 0xae, 0xa2, - 0x6e, 0x34, 0x11, 0xe6, 0xcd, 0x28, 0x4d, 0x32, 0xe6, 0xc9, 0x6f, 0x81, 0x9b, 0xb7, 0x07, 0x4c, - 0xa4, 0x4c, 0x78, 0xa9, 0x88, 0xbd, 0xc9, 0x83, 0xe5, 0x4f, 0x01, 0x77, 0x0a, 0xe0, 0x95, 0xbc, - 0x79, 0xc5, 0x45, 0x41, 0x56, 0x59, 0x69, 0x88, 0x23, 0x8c, 0xa3, 0x3c, 0x61, 0xd9, 0x92, 0x5b, - 0xd6,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, 0xf7, 0x67, 0x27, 0xdb, 0x55, 0xae, 0xfd, 0x89, - 0xc0, 0x56, 0xad, 0x15, 0x31, 0x66, 0x99, 0xc0, 0x4b, 0xeb, 0xe7, 0x23, 0x81, 0xe6, 0x63, 0xfc, - 0x4f, 0x86, 0xf3, 0x99, 0xc0, 0xad, 0x95, 0x66, 0x2e, 0x77, 0x3c, 0x9d, 0xaf, 0x04, 0xb4, 0x03, - 0x11, 0xd3, 0x67, 0xa0, 0x57, 0xda, 0xa2, 0x77, 0x6b, 0x22, 0xf5, 0xe9, 0x99, 0xed, 0x8b, 0x41, - 0xe5, 0x26, 0x80, 0x6b, 0x35, 0x9b, 0xf4, 0x5e, 0x8d, 0xb2, 0xfa, 0x1e, 0xa6, 0xfd, 0x2f, 0xb8, - 0xd0, 0x34, 0x37, 0xde, 0x9d, 0x9d, 0x6c, 0x93, 0xdd, 0x27, 0x3f, 0xe6, 0x16, 0x39, 0x9d, 0x5b, - 0xe4, 0xf7, 0xdc, 0x22, 0x5f, 0x16, 0x56, 0xe3, 0x74, 0x61, 0x35, 0x7e, 0x2d, 0xac, 0xc6, 0xcb, - 0x9d, 0x38, 0xc9, 0x5f, 0x1f, 0xf7, 0xdd, 0x01, 0x4b, 0xbd, 0xbd, 0x42, 0xee, 0x39, 0xe6, 0x6f, - 0x19, 0x3f, 0xf2, 0xca, 0x15, 0x33, 0x2d, 0xd6, 0xd9, 0x6c, 0x8c, 0xa2, 0x7f, 0x45, 0xae, 0x97, - 0x87, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xd0, 0x5e, 0xa4, 0x50, 0xea, 0x04, 0x00, 0x00, + // 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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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, } // Reference imports to suppress errors if they are not otherwise used. @@ -766,6 +867,71 @@ 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 @@ -885,6 +1051,32 @@ 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 } @@ -1686,6 +1878,174 @@ func (m *DeRegisterAVSResponse) 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 m.Params == nil { + m.Params = &Params{} + } + 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 diff --git a/x/evm/keeper/precompiles.go b/x/evm/keeper/precompiles.go index a26d157bc..8d50e7b8d 100644 --- a/x/evm/keeper/precompiles.go +++ b/x/evm/keeper/precompiles.go @@ -7,11 +7,13 @@ import ( rewardKeeper "github.com/ExocoreNetwork/exocore/x/reward/keeper" withdrawKeeper "github.com/ExocoreNetwork/exocore/x/withdraw/keeper" + avsManagerKeeper "github.com/ExocoreNetwork/exocore/x/avs/keeper" delegationKeeper "github.com/ExocoreNetwork/exocore/x/delegation/keeper" depositKeeper "github.com/ExocoreNetwork/exocore/x/deposit/keeper" "golang.org/x/exp/maps" + avsManagerPrecompile "github.com/ExocoreNetwork/exocore/precompiles/avs" delegationprecompile "github.com/ExocoreNetwork/exocore/precompiles/delegation" depositprecompile "github.com/ExocoreNetwork/exocore/precompiles/deposit" rewardPrecompile "github.com/ExocoreNetwork/exocore/precompiles/reward" @@ -47,6 +49,7 @@ func AvailablePrecompiles( withdrawKeeper withdrawKeeper.Keeper, slashKeeper exoslashKeeper.Keeper, rewardKeeper rewardKeeper.Keeper, + avsManagerKeeper avsManagerKeeper.Keeper, ) map[common.Address]vm.PrecompiledContract { // Clone the mapping from the latest EVM fork. precompiles := maps.Clone(vm.PrecompiledContractsBerlin) @@ -82,21 +85,26 @@ func AvailablePrecompiles( } withdrawPrecompile, err := withdrawPrecompile.NewPrecompile(stakingStateKeeper, withdrawKeeper, authzKeeper) if err != nil { - panic(fmt.Errorf("failed to load withdraw precompile: %w", err)) + panic(fmt.Errorf("failed to load withdraw precompile: %w", err)) } slashPrecompile, err := slashPrecompile.NewPrecompile(stakingStateKeeper, slashKeeper, authzKeeper) if err != nil { - panic(fmt.Errorf("failed to load slash precompile: %w", err)) + panic(fmt.Errorf("failed to load slash precompile: %w", err)) } rewardPrecompile, err := rewardPrecompile.NewPrecompile(stakingStateKeeper, rewardKeeper, authzKeeper) if err != nil { - panic(fmt.Errorf("failed to load reward precompile: %w", err)) + panic(fmt.Errorf("failed to load reward precompile: %w", err)) + } + avsManagerPrecompile, err := avsManagerPrecompile.NewPrecompile(avsManagerKeeper, authzKeeper) + if err != nil { + panic(fmt.Errorf("failed to load avsManager precompile: %w", err)) } precompiles[slashPrecompile.Address()] = slashPrecompile precompiles[rewardPrecompile.Address()] = rewardPrecompile precompiles[withdrawPrecompile.Address()] = withdrawPrecompile precompiles[depositPrecompile.Address()] = depositPrecompile precompiles[delegationPrecompile.Address()] = delegationPrecompile + precompiles[avsManagerPrecompile.Address()] = avsManagerPrecompile precompiles[stakingPrecompile.Address()] = stakingPrecompile precompiles[distributionPrecompile.Address()] = distributionPrecompile