Skip to content

Commit

Permalink
fix some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
trestinlsd committed Oct 24, 2024
1 parent b39619c commit 6c7fe34
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 1 addition & 2 deletions precompiles/avs/IAVSManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ interface IAVSManager {
event TaskSubmittedByOperator(address indexed sender, uint64 taskID, string taskResponse,
string blsSignature, string taskContractAddress, string stage, bool success);

enum SubmissionStage { Stage1, Stage2 }

/// @dev Register AVS contract to EXO.
/// @param sender The external address for calling this method.
Expand Down Expand Up @@ -173,7 +172,7 @@ interface IAVSManager {
bytes calldata taskResponse,
bytes calldata blsSignature,
address taskContractAddress,
SubmissionStage stage
string memory stage
) external returns (bool success);

/// QUERIES
Expand Down
12 changes: 6 additions & 6 deletions x/avs/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,27 +228,27 @@ func (k Keeper) UpdateAVSInfo(ctx sdk.Context, params *types.AVSRegisterOrDeregi
func (k Keeper) CreateAVSTask(ctx sdk.Context, params *types.TaskInfoParams) (uint64, error) {
avsInfo := k.GetAVSInfoByTaskAddress(ctx, params.TaskContractAddress)
if avsInfo.AvsAddress == "" {
return 0, errorsmod.Wrap(types.ErrUnregisterNonExistent, fmt.Sprintf("the taskaddr is :%s", params.TaskContractAddress))
return types.InvalidTaskID, errorsmod.Wrap(types.ErrUnregisterNonExistent, fmt.Sprintf("the taskaddr is :%s", params.TaskContractAddress))
}
// If avs CreateAVSTask check CallerAddress
if !slices.Contains(avsInfo.AvsOwnerAddress, params.CallerAddress) {
return 0, errorsmod.Wrap(types.ErrCallerAddressUnauthorized, fmt.Sprintf("this caller not qualified to CreateAVSTask %s", params.CallerAddress))
return types.InvalidTaskID, errorsmod.Wrap(types.ErrCallerAddressUnauthorized, fmt.Sprintf("this caller not qualified to CreateAVSTask %s", params.CallerAddress))
}
taskPowerTotal, err := k.operatorKeeper.GetAVSUSDValue(ctx, avsInfo.AvsAddress)
if err != nil {
return 0, errorsmod.Wrap(err, "failed to get AVS USD value")
return types.InvalidTaskID, errorsmod.Wrap(err, "failed to get AVS USD value")
}
if taskPowerTotal.IsZero() || taskPowerTotal.IsNegative() {
return 0, errorsmod.Wrap(types.ErrVotingPowerIncorrect, fmt.Sprintf("the voting power of AVS is zero or negative, AVS address: %s", avsInfo.AvsAddress))
return types.InvalidTaskID, errorsmod.Wrap(types.ErrVotingPowerIncorrect, fmt.Sprintf("the voting power of AVS is zero or negative, AVS address: %s", avsInfo.AvsAddress))
}

epoch, found := k.epochsKeeper.GetEpochInfo(ctx, avsInfo.EpochIdentifier)
if !found {
return 0, errorsmod.Wrap(types.ErrEpochNotFound, fmt.Sprintf("epoch info not found %s", avsInfo.EpochIdentifier))
return types.InvalidTaskID, errorsmod.Wrap(types.ErrEpochNotFound, fmt.Sprintf("epoch info not found %s", avsInfo.EpochIdentifier))
}

if k.IsExistTask(ctx, strconv.FormatUint(params.TaskID, 10), params.TaskContractAddress) {
return 0, errorsmod.Wrap(types.ErrAlreadyExists, fmt.Sprintf("the task is :%s", strconv.FormatUint(params.TaskID, 10)))
return types.InvalidTaskID, errorsmod.Wrap(types.ErrAlreadyExists, fmt.Sprintf("the task is :%s", strconv.FormatUint(params.TaskID, 10)))
}
operatorList, err := k.operatorKeeper.GetOptedInOperatorListByAVS(ctx, avsInfo.AvsAddress)
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions x/avs/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ var (
ChainIDPrefix = []byte("chain-id-prefix")
)

const InvalidTaskID = 0

type AVSRegisterOrDeregisterParams struct {
// AvsName is the name of the AVS as an arbitrary string.
AvsName string
Expand Down

0 comments on commit 6c7fe34

Please sign in to comment.