Skip to content

Commit

Permalink
fix some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
trestinlsd committed Sep 2, 2024
1 parent f4e3819 commit 29297ee
Show file tree
Hide file tree
Showing 14 changed files with 170 additions and 169 deletions.
6 changes: 3 additions & 3 deletions precompiles/avs/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (p Precompile) RegisterAVS(
avsParams.AvsAddress = contract.CallerAddress.String()
avsParams.Action = avskeeper.RegisterAction
// Finally, update the AVS information in the keeper.
err = p.avsKeeper.AVSInfoUpdate(ctx, avsParams)
err = p.avsKeeper.UpdateAVSInfo(ctx, avsParams)
if err != nil {
fmt.Println("Failed to update AVS info", err)
return nil, err
Expand Down Expand Up @@ -82,7 +82,7 @@ func (p Precompile) DeregisterAVS(
// validates that this is owner
avsParams.CallerAddress = sdk.AccAddress(origin[:]).String()

err := p.avsKeeper.AVSInfoUpdate(ctx, avsParams)
err := p.avsKeeper.UpdateAVSInfo(ctx, avsParams)
if err != nil {
return nil, err
}
Expand All @@ -106,7 +106,7 @@ func (p Precompile) UpdateAVS(
avsParams.AvsAddress = contract.CallerAddress.String()
avsParams.CallerAddress = sdk.AccAddress(origin[:]).String()
avsParams.Action = avskeeper.UpdateAction
err = p.avsKeeper.AVSInfoUpdate(ctx, avsParams)
err = p.avsKeeper.UpdateAVSInfo(ctx, avsParams)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion precompiles/avs/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (suite *AVSManagerPrecompileSuite) prepare() {
}

func (suite *AVSManagerPrecompileSuite) prepareAvs(assetIDs []string) {
err := suite.App.AVSManagerKeeper.AVSInfoUpdate(suite.Ctx, &avstypes.AVSRegisterOrDeregisterParams{
err := suite.App.AVSManagerKeeper.UpdateAVSInfo(suite.Ctx, &avstypes.AVSRegisterOrDeregisterParams{
Action: avskeeper.RegisterAction,
EpochIdentifier: epochstypes.HourEpochID,
AvsAddress: suite.avsAddr,
Expand Down
7 changes: 4 additions & 3 deletions proto/exocore/operator/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,14 @@ message OperatorConsAddrPair {

// QueryAllOperatorsWithOptInAVSRequest is the request to obtain all opt-in operator addresses
// for a specific avs with pagination.
message QueryAllOperatorsWithOptInAVSRequest {
message QueryAllOperatorsByOptInAVSRequest {
// avs address
string avs = 1;
}

// QueryAllOperatorsWithOptInAVSResponse is the response that includes a list of all avs
// for a specified operator address.
message QueryAllOperatorsWithOptInAVSResponse {
message QueryAllOperatorsByOptInAVSResponse {
// operator_list is a list of operator addresses.
repeated string operator_list = 1;
}
Expand Down Expand Up @@ -281,7 +281,8 @@ service Query {
}

// QueryAllOperatorsWithOptInAVS queries operator list by avs.
rpc QueryAllOperatorsWithOptInAVS(QueryAllOperatorsWithOptInAVSRequest) returns (QueryAllOperatorsWithOptInAVSResponse) {
rpc QueryAllOperatorsWithOptInAVS(QueryAllOperatorsByOptInAVSRequest) returns (
QueryAllOperatorsByOptInAVSResponse) {
option (google.api.http) = {
get: "/exocore/operator/v1/opt/operator_list/{avs}"
};
Expand Down
4 changes: 2 additions & 2 deletions x/avs/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func QuerySubmitTaskResult() *cobra.Command {
Use: "SubmitTaskResult <task-address-in-hex> <task-id> <operator-addreess>",
Short: "Query the SubmitTaskResult by taskAddr taskID operatorAddr",
Long: "Query the currently submitted Task Result",
Args: cobra.ExactArgs(2),
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error {
if !common.IsHexAddress(args[0]) {
return xerrors.Errorf("invalid address,err:%s", types.ErrInvalidAddr)
Expand Down Expand Up @@ -162,7 +162,7 @@ func QueryChallengeInfo() *cobra.Command {
Use: "ChallengeInfo <task-address-in-hex> <task-id> <operator-addreess>",
Short: "Query the ChallengeInfo by taskAddr taskID operatorAddr",
Long: "Query the currently Challenge Info ",
Args: cobra.ExactArgs(2),
Args: cobra.ExactArgs(3),
RunE: func(cmd *cobra.Command, args []string) error {
if !common.IsHexAddress(args[0]) {
return xerrors.Errorf("invalid task address,err:%s", types.ErrInvalidAddr)
Expand Down
2 changes: 1 addition & 1 deletion x/avs/keeper/avs.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (k Keeper) RegisterAVSWithChainID(
params.AvsAddress = avsAddr.String()
params.Action = RegisterAction

if err := k.AVSInfoUpdate(ctx, params); err != nil {
if err := k.UpdateAVSInfo(ctx, params); err != nil {
return common.Address{}, err
}
return avsAddr, nil
Expand Down
10 changes: 5 additions & 5 deletions x/avs/keeper/avs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ func (suite *AVSTestSuite) TestAVSInfoUpdate_Register() {
EpochIdentifier: epochstypes.DayEpochID,
}

err := suite.App.AVSManagerKeeper.AVSInfoUpdate(suite.Ctx, avsParams)
err := suite.App.AVSManagerKeeper.UpdateAVSInfo(suite.Ctx, avsParams)
suite.NoError(err)

info, err := suite.App.AVSManagerKeeper.GetAVSInfo(suite.Ctx, avsAddres)

suite.NoError(err)
suite.Equal(avsAddres, info.GetInfo().AvsAddress)

err = suite.App.AVSManagerKeeper.AVSInfoUpdate(suite.Ctx, avsParams)
err = suite.App.AVSManagerKeeper.UpdateAVSInfo(suite.Ctx, avsParams)
suite.Error(err)
suite.Contains(err.Error(), types.ErrAlreadyRegistered.Error())
}
Expand All @@ -108,19 +108,19 @@ func (suite *AVSTestSuite) TestAVSInfoUpdate_DeRegister() {
EpochIdentifier: epochstypes.DayEpochID,
}

err := suite.App.AVSManagerKeeper.AVSInfoUpdate(suite.Ctx, avsParams)
err := suite.App.AVSManagerKeeper.UpdateAVSInfo(suite.Ctx, avsParams)
suite.Error(err)
suite.Contains(err.Error(), types.ErrUnregisterNonExistent.Error())

avsParams.Action = avstypes.RegisterAction
err = suite.App.AVSManagerKeeper.AVSInfoUpdate(suite.Ctx, avsParams)
err = suite.App.AVSManagerKeeper.UpdateAVSInfo(suite.Ctx, avsParams)
suite.NoError(err)
info, err := suite.App.AVSManagerKeeper.GetAVSInfo(suite.Ctx, avsAddres)
suite.Equal(avsAddres, info.GetInfo().AvsAddress)

avsParams.Action = avstypes.DeRegisterAction
avsParams.CallerAddress = "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr"
err = suite.App.AVSManagerKeeper.AVSInfoUpdate(suite.Ctx, avsParams)
err = suite.App.AVSManagerKeeper.UpdateAVSInfo(suite.Ctx, avsParams)
suite.NoError(err)
info, err = suite.App.AVSManagerKeeper.GetAVSInfo(suite.Ctx, avsAddres)
suite.Error(err)
Expand Down
2 changes: 1 addition & 1 deletion x/avs/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (k Keeper) GetOperatorKeeper() types.OperatorKeeper {
return k.operatorKeeper
}

func (k Keeper) AVSInfoUpdate(ctx sdk.Context, params *types.AVSRegisterOrDeregisterParams) error {
func (k Keeper) UpdateAVSInfo(ctx sdk.Context, params *types.AVSRegisterOrDeregisterParams) error {
avsInfo, _ := k.GetAVSInfo(ctx, params.AvsAddress)
action := params.Action
epochIdentifier := params.EpochIdentifier
Expand Down
2 changes: 1 addition & 1 deletion x/avs/keeper/multi_operator_submit_task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (suite *AVSTestSuite) prepareMulDelegation(operatorAddress sdk.AccAddress,
}

func (suite *AVSTestSuite) prepareMulAvs(assetIDs []string) {
err := suite.App.AVSManagerKeeper.AVSInfoUpdate(suite.Ctx, &avstypes.AVSRegisterOrDeregisterParams{
err := suite.App.AVSManagerKeeper.UpdateAVSInfo(suite.Ctx, &avstypes.AVSRegisterOrDeregisterParams{
AvsName: "avs01",
Action: avskeeper.RegisterAction,
EpochIdentifier: epochstypes.HourEpochID,
Expand Down
2 changes: 1 addition & 1 deletion x/avs/keeper/submit_task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (suite *AVSTestSuite) prepareDelegation(isDelegation bool, assetAddr common
suite.NoError(err)
}
func (suite *AVSTestSuite) prepareAvs(assetIDs []string) {
err := suite.App.AVSManagerKeeper.AVSInfoUpdate(suite.Ctx, &avstypes.AVSRegisterOrDeregisterParams{
err := suite.App.AVSManagerKeeper.UpdateAVSInfo(suite.Ctx, &avstypes.AVSRegisterOrDeregisterParams{
AvsName: "avs01",
Action: avskeeper.RegisterAction,
EpochIdentifier: epochstypes.HourEpochID,
Expand Down
14 changes: 7 additions & 7 deletions x/operator/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,9 @@ func QueryOperatorSlashInfo() *cobra.Command {
// QueryAllOperatorsWithOptInAVS queries all operators
func QueryAllOperatorsWithOptInAVS() *cobra.Command {
cmd := &cobra.Command{
Use: "get-operator-list-by-avs <avsAddr>",
Short: "get-operatorList",
Long: "Get operator list by avs",
Use: "get-operatorList",
Short: "Get list of operators by AVS",
Long: "Get the list of operators who have opted in to the specified AVS",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
if !common.IsHexAddress(args[0]) {
Expand All @@ -368,7 +368,7 @@ func QueryAllOperatorsWithOptInAVS() *cobra.Command {
}

queryClient := operatortypes.NewQueryClient(clientCtx)
req := operatortypes.QueryAllOperatorsWithOptInAVSRequest{
req := operatortypes.QueryAllOperatorsByOptInAVSRequest{
Avs: args[0],
}
res, err := queryClient.QueryAllOperatorsWithOptInAVS(context.Background(), &req)
Expand All @@ -385,9 +385,9 @@ func QueryAllOperatorsWithOptInAVS() *cobra.Command {
// QueryAllAVSsByOperator queries all avs
func QueryAllAVSsByOperator() *cobra.Command {
cmd := &cobra.Command{
Use: "get-avsList",
Short: "get-avsList",
Long: "get-avsList by operator",
Use: "get-avs-list <operatorAddr>",
Short: "Get list of AVSs by operator",
Long: "Get a list of AVSs to which an operator has opted in",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
addr, err := sdk.AccAddressFromBech32(args[0])
Expand Down
4 changes: 2 additions & 2 deletions x/operator/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,13 @@ func (k *Keeper) QueryOperatorSlashInfo(goCtx context.Context, req *types.QueryO
}, nil
}

func (k *Keeper) QueryAllOperatorsWithOptInAVS(goCtx context.Context, req *types.QueryAllOperatorsWithOptInAVSRequest) (*types.QueryAllOperatorsWithOptInAVSResponse, error) {
func (k *Keeper) QueryAllOperatorsWithOptInAVS(goCtx context.Context, req *types.QueryAllOperatorsByOptInAVSRequest) (*types.QueryAllOperatorsByOptInAVSResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
operatorList, err := k.GetOptedInOperatorListByAVS(ctx, req.Avs)
if err != nil {
return nil, err
}
return &types.QueryAllOperatorsWithOptInAVSResponse{
return &types.QueryAllOperatorsByOptInAVSResponse{
OperatorList: operatorList,
}, nil
}
Expand Down
2 changes: 1 addition & 1 deletion x/operator/keeper/opt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (suite *OperatorTestSuite) prepare() {
}

func (suite *OperatorTestSuite) prepareAvs(assetIDs []string) {
err := suite.App.AVSManagerKeeper.AVSInfoUpdate(suite.Ctx, &avstypes.AVSRegisterOrDeregisterParams{
err := suite.App.AVSManagerKeeper.UpdateAVSInfo(suite.Ctx, &avstypes.AVSRegisterOrDeregisterParams{
Action: avskeeper.RegisterAction,
EpochIdentifier: epochstypes.HourEpochID,
AvsAddress: suite.avsAddr,
Expand Down
Loading

0 comments on commit 29297ee

Please sign in to comment.