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 8c3649c commit 93daad8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 26 deletions.
15 changes: 12 additions & 3 deletions precompiles/avs/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func (p Precompile) RegisterBLSPublicKey(

pubkeyBz, ok := args[2].([]byte)
if !ok {
return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 3, "[]byte", pubkeyBz)
return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 2, "[]byte", pubkeyBz)
}
blsParams.PubKey = pubkeyBz

Expand Down Expand Up @@ -350,7 +350,7 @@ func (p Precompile) OperatorSubmitTask(

taskID, ok := args[1].(uint64)
if !ok {
return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 1, "uint64", taskID)
return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 1, "uint64", args[1])
}
resultParams.TaskID = taskID

Expand Down Expand Up @@ -379,7 +379,16 @@ func (p Precompile) OperatorSubmitTask(
resultParams.Stage = stage

resultParams.OperatorAddress = resultParams.CallerAddress
err := p.avsKeeper.SubmitTaskResult(ctx, resultParams)

result := &avstypes.TaskResultInfo{
TaskId: resultParams.TaskID,
OperatorAddress: resultParams.OperatorAddress,
TaskContractAddress: resultParams.TaskContractAddress.String(),
TaskResponse: resultParams.TaskResponse,
BlsSignature: resultParams.BlsSignature,
Stage: resultParams.Stage,
}
err := p.avsKeeper.SetTaskResultInfo(ctx, resultParams.OperatorAddress, result)
if err != nil {
return nil, err
}
Expand Down
12 changes: 0 additions & 12 deletions x/avs/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,15 +445,3 @@ func (k Keeper) RaiseAndResolveChallenge(ctx sdk.Context, params *types.Challeng
return k.SetTaskChallengedInfo(ctx, params.TaskID, params.OperatorAddress.String(), params.CallerAddress,
params.TaskContractAddress)
}

func (k Keeper) SubmitTaskResult(ctx sdk.Context, params *types.TaskResultParams) error {
result := &types.TaskResultInfo{
TaskId: params.TaskID,
OperatorAddress: params.OperatorAddress,
TaskContractAddress: params.TaskContractAddress.String(),
TaskResponse: params.TaskResponse,
BlsSignature: params.BlsSignature,
Stage: params.Stage,
}
return k.SetTaskResultInfo(ctx, params.OperatorAddress, result)
}
22 changes: 11 additions & 11 deletions x/avs/types/stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ const (
)

type OperatorOptParams struct {
Name string
BlsPublicKey string
IsRegistered bool
Action uint64
OperatorAddress string
Status string
AvsAddress string
Name string `json:"name"`
BlsPublicKey string `json:"bls_public_key"`
IsRegistered bool `json:"is_registered"`
Action uint64 `json:"action"`
OperatorAddress string `json:"operator_address"`
Status string `json:"status"`
AvsAddress string `json:"avs_address"`
}

type TaskInfoParams struct {
Expand Down Expand Up @@ -93,8 +93,8 @@ type TaskResultParams struct {
}

type OperatorParams struct {
EarningsAddr string `json:"earnings_addr"`
ApproveAddr string `json:"approve_addr"`
OperatorMetaInfo string `json:"operator_meta_info"`
CallerAddress string `json:"caller_address"`
EarningsAddr string `json:"earnings_addr"`
ApproveAddr string `json:"approve_addr"`
OperatorMetaInfo string `json:"operator_meta_info"`
CallerAddress sdk.AccAddress `json:"caller_address"`
}

0 comments on commit 93daad8

Please sign in to comment.