Skip to content

Commit

Permalink
feat: integrate
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebraver committed Apr 5, 2024
1 parent 6bce504 commit 6f1b321
Show file tree
Hide file tree
Showing 17 changed files with 517 additions and 330 deletions.
15 changes: 13 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -267,6 +270,7 @@ var (
withdraw.AppModuleBasic{},
reward.AppModuleBasic{},
exoslash.AppModuleBasic{},
avs.AppModuleBasic{},
)

// module account permissions
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -441,6 +445,7 @@ func NewExocoreApp(
rewardTypes.StoreKey,
exoslashTypes.StoreKey,
operatorTypes.StoreKey,
avsManagerTypes.StoreKey,
)

// Add the EVM transient store key
Expand Down Expand Up @@ -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(
Expand All @@ -645,6 +651,7 @@ func NewExocoreApp(
app.WithdrawKeeper,
app.ExoSlashKeeper,
app.RewardKeeper,
app.AVSManagerKeeper,
),
)
epochsKeeper := epochskeeper.NewKeeper(appCodec, keys[epochstypes.StoreKey])
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
18 changes: 17 additions & 1 deletion proto/exocore/avs/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Check failure on line 6 in proto/exocore/avs/tx.proto

View workflow job for this annotation

GitHub Actions / lint

Import "exocore/delegation/v1/tx.proto" is unused.
import "exocore/avs/params.proto";

option go_package = "github.com/ExocoreNetwork/exocore/x/avs/types";

Expand Down Expand Up @@ -54,4 +55,19 @@ service Msg {
// 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 {}
52 changes: 0 additions & 52 deletions testutil/keeper/avs.go

This file was deleted.

52 changes: 0 additions & 52 deletions testutil/keeper/taskmanageravs.go

This file was deleted.

2 changes: 1 addition & 1 deletion x/avs/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func RegisterAVS() *cobra.Command {
Info: &types.AVSInfo{
Name: args[0],
AVSAddress: args[1],
OperatorAddress: args[2],
OperatorAddress: []string{args[2]},
},
}

Expand Down
23 changes: 0 additions & 23 deletions x/avs/genesis.go

This file was deleted.

31 changes: 0 additions & 31 deletions x/avs/genesis_test.go

This file was deleted.

20 changes: 5 additions & 15 deletions x/avs/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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,
}
}

Expand Down
24 changes: 20 additions & 4 deletions x/avs/keeper/params.go
Original file line number Diff line number Diff line change
@@ -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, &params)
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 {
Expand Down
18 changes: 0 additions & 18 deletions x/avs/keeper/params_test.go

This file was deleted.

Loading

0 comments on commit 6f1b321

Please sign in to comment.