Skip to content

Commit

Permalink
fix lint err
Browse files Browse the repository at this point in the history
  • Loading branch information
trestinlsd committed Feb 17, 2025
1 parent d7f38b1 commit 4ee8f68
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 25 deletions.
8 changes: 4 additions & 4 deletions precompiles/avs/IAVSManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct TaskInfo {
address taskContractAddress;
string name;
bytes hash;
uint64 taskId;
uint64 taskID;
uint64 taskResponsePeriod;
uint64 taskStatisticalPeriod;
uint64 taskChallengePeriod;
Expand Down Expand Up @@ -85,13 +85,13 @@ interface IAVSManager {
event OperatorLeft(address indexed avsAddress, address sender);
event TaskCreated(
address indexed taskContractAddress,
uint64 indexed taskId,
uint64 indexed taskID,
address sender,
string name,
bytes hash,
uint64 taskResponsePeriod,
uint64 taskChallengePeriod,
uint64 thresholdPercentage,
uint8 thresholdPercentage,
uint64 taskStatisticalPeriod
);
event ChallengeInitiated(
Expand All @@ -100,7 +100,7 @@ interface IAVSManager {
event PublicKeyRegistered(address sender, address avsAddress);
event TaskSubmittedByOperator(
address indexed taskContractAddress,
uint64 indexed taskId,
uint64 indexed taskID,
address sender,
bytes taskResponse,
bytes blsSignature,
Expand Down
10 changes: 5 additions & 5 deletions precompiles/avs/abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
{
"indexed": true,
"internalType": "uint64",
"name": "taskId",
"name": "taskID",
"type": "uint64"
},
{
Expand Down Expand Up @@ -215,9 +215,9 @@
},
{
"indexed": false,
"internalType": "uint64",
"internalType": "uint8",
"name": "thresholdPercentage",
"type": "uint64"
"type": "uint8"
},
{
"indexed": false,
Expand All @@ -241,7 +241,7 @@
{
"indexed": true,
"internalType": "uint64",
"name": "taskId",
"name": "taskID",
"type": "uint64"
},
{
Expand Down Expand Up @@ -590,7 +590,7 @@
},
{
"internalType": "uint64",
"name": "taskId",
"name": "taskID",
"type": "uint64"
},
{
Expand Down
13 changes: 5 additions & 8 deletions precompiles/avs/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ func (p Precompile) GetOptedInOperatorAccAddresses(
}

list, err := p.avsKeeper.GetOperatorKeeper().GetOptedInOperatorListByAVS(ctx, strings.ToLower(avsaddress.String()))

var commonAddressList []common.Address
if err != nil {
return nil, err
}
commonAddressList := make([]common.Address, 0)
for _, operatorAddressStr := range list {
acc, err := sdk.AccAddressFromBech32(operatorAddressStr)
if err != nil {
Expand All @@ -83,10 +85,6 @@ func (p Precompile) GetOptedInOperatorAccAddresses(
operatorAddress := common.BytesToAddress(acc)
commonAddressList = append(commonAddressList, operatorAddress)
}

if err != nil {
return nil, err
}
return method.Outputs.Pack(commonAddressList)
}

Expand Down Expand Up @@ -224,7 +222,7 @@ func (p Precompile) GetTaskInfo(
TaskContractAddress: common.HexToAddress(task.TaskContractAddress),
Name: task.Name,
Hash: task.Hash,
TaskId: task.TaskId,
TaskID: task.TaskId,
TaskResponsePeriod: task.TaskResponsePeriod,
TaskStatisticalPeriod: task.TaskStatisticalPeriod,
TaskChallengePeriod: task.TaskChallengePeriod,
Expand All @@ -242,7 +240,6 @@ func (p Precompile) GetTaskInfo(
EligibleSlashOperators: p.stringToAddress(task.EligibleSlashOperators),
}
return method.Outputs.Pack(result)

}

func ParseActivePower(list []*avstype.OperatorActivePowerInfo) []OperatorActivePower {
Expand Down
2 changes: 1 addition & 1 deletion precompiles/avs/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ func (suite *AVSManagerPrecompileSuite) TestGetTaskInfo() {
TaskContractAddress common.Address `json:"taskContractAddress"`
Name string `json:"name"`
Hash []byte `json:"hash"`
TaskId uint64 `json:"taskId"`
TaskID uint64 `json:"taskID"`
TaskResponsePeriod uint64 `json:"taskResponsePeriod"`
TaskStatisticalPeriod uint64 `json:"taskStatisticalPeriod"`
TaskChallengePeriod uint64 `json:"taskChallengePeriod"`
Expand Down
4 changes: 2 additions & 2 deletions precompiles/avs/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (p Precompile) GetTaskParamsFromInputs(_ sdk.Context, args []interface{}) (
if !ok || thresholdPercentage > 100 {
return nil, fmt.Errorf(exocmn.ErrContractInputParamOrType, 5, "uint64", thresholdPercentage)
}
taskParams.ThresholdPercentage = uint64(thresholdPercentage)
taskParams.ThresholdPercentage = thresholdPercentage

taskStatisticalPeriod, ok := args[6].(uint64)
if !ok {
Expand Down Expand Up @@ -210,7 +210,7 @@ type TaskInfo struct {
TaskContractAddress common.Address
Name string
Hash []byte
TaskId uint64
TaskID uint64
TaskResponsePeriod uint64
TaskStatisticalPeriod uint64
TaskChallengePeriod uint64
Expand Down
8 changes: 4 additions & 4 deletions x/avs/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func (k Keeper) CreateAVSTask(ctx sdk.Context, params *types.TaskInfoParams) (ui
TaskContractAddress: strings.ToLower(params.TaskContractAddress.String()),
TaskId: params.TaskID,
TaskChallengePeriod: params.TaskChallengePeriod,
ThresholdPercentage: params.ThresholdPercentage,
ThresholdPercentage: uint64(params.ThresholdPercentage),
TaskResponsePeriod: params.TaskResponsePeriod,
TaskStatisticalPeriod: params.TaskStatisticalPeriod,
StartingEpoch: uint64(epoch.CurrentEpoch + 1),
Expand Down Expand Up @@ -430,7 +430,7 @@ func (k Keeper) RaiseAndResolveChallenge(ctx sdk.Context, params *types.Challeng
return errorsmod.Wrap(
types.ErrInconsistentParams,
fmt.Sprintf("Task response does not match the one recorded,task addr: %s ,(TaskContractAddress: %s)"+
",(TaskId: %d),(TaskResponseHash: %s)",
",(TaskID: %d),(TaskResponseHash: %s)",
params.OperatorAddress, params.TaskContractAddress, params.TaskID, params.TaskResponseHash),
)
}
Expand Down Expand Up @@ -581,7 +581,7 @@ func (k Keeper) SubmitTaskResult(ctx sdk.Context, addr string, info *types.TaskR
return errorsmod.Wrap(
types.ErrInconsistentParams,
fmt.Sprintf("SetTaskResultInfo: invalid param OperatorAddress: %s ,(TaskContractAddress: %s)"+
",(TaskId: %d),(BlsSignature: %s)",
",(TaskID: %d),(BlsSignature: %s)",
info.OperatorAddress, info.TaskContractAddress, info.TaskId, info.BlsSignature),
)
}
Expand All @@ -608,7 +608,7 @@ func (k Keeper) SubmitTaskResult(ctx sdk.Context, addr string, info *types.TaskR
if err != nil || info.TaskId != resp.TaskID {
return errorsmod.Wrap(
types.ErrInconsistentParams,
fmt.Sprintf("SetTaskResultInfo: invalid TaskId param value:%s", info.TaskResponse),
fmt.Sprintf("SetTaskResultInfo: invalid TaskID param value:%s", info.TaskResponse),
)
}
// check bls sig
Expand Down
2 changes: 1 addition & 1 deletion x/avs/types/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type TaskInfoParams struct {
TaskResponsePeriod uint64 `json:"task_response_period"`
TaskStatisticalPeriod uint64 `json:"task_statistical_period"`
TaskChallengePeriod uint64 `json:"task_challenge_period"`
ThresholdPercentage uint64 `json:"threshold_percentage"`
ThresholdPercentage uint8 `json:"threshold_percentage"`
StartingEpoch uint64 `json:"starting_epoch"`
OperatorAddress sdk.AccAddress `json:"operator_address"`
TaskResponseHash string `json:"task_response_hash"`
Expand Down

0 comments on commit 4ee8f68

Please sign in to comment.