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 23, 2024
1 parent 64993ff commit 6ccf100
Show file tree
Hide file tree
Showing 21 changed files with 205 additions and 577 deletions.
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,10 @@ replace (
github.com/evmos/evmos/v16 => github.com/ExocoreNetwork/evmos/v16 v16.0.3-0.20240828081344-d5cfcd34a812
// Security Advisory https://github.com/advisories/GHSA-h395-qcrw-5vmq
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1
github.com/ledgerwatch/interfaces => github.com/ledgerwatch/interfaces v0.0.0-20240911002112-53ce6989bb37
// replace broken goleveldb
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
//fix cosmos-sdk error
golang.org/x/exp => golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc
nhooyr.io/websocket => nhooyr.io/websocket v1.8.17

)
60 changes: 2 additions & 58 deletions go.sum

Large diffs are not rendered by default.

26 changes: 0 additions & 26 deletions precompiles/avs/IAVSManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,6 @@ interface IAVSManager {
string blsSignature, string taskContractAddress, string stage, bool success);


struct TaskInfo {
string taskContractAddress;
string name;
bytes hash;
uint64 taskId;
uint64 taskResponsePeriod;
uint64 taskStatisticalPeriod;
uint64 taskChallengePeriod;
uint64 thresholdPercentage;
uint64 startingEpoch;
uint64 actualThreshold;
string[] optInOperators;
string[] signedOperators;
string[] noSignedOperators;
string[] errSignedOperators;
string taskTotalPower;
// OperatorActivePowerList is not defined here as it's not clear from the provided message
}
/// @dev Register AVS contract to EXO.
/// @param sender The external address for calling this method.
/// @param avsName The name of AVS.
Expand Down Expand Up @@ -177,14 +159,6 @@ interface IAVSManager {
bytes calldata pubkeyRegistrationMessageHash
) external returns (bool success);

/// @dev registerOperatorToExocore , this function enables a precompile handler for creating a RegisterOperatorReq.
/// @param sender The external address for calling this method.
/// @param metaInfo The data supplied by the contract, usually ABI-encoded.
function registerOperatorToExocore(
address sender,
string memory metaInfo
) external returns (bool success);

/// @dev operatorSubmitTask , this function enables a operator submit a task result.
/// @param sender The external address for calling this method.
/// @param taskID The id of task.
Expand Down
24 changes: 0 additions & 24 deletions precompiles/avs/abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -789,30 +789,6 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "string",
"name": "metaInfo",
"type": "string"
}
],
"name": "registerOperatorToExocore",
"outputs": [
{
"internalType": "bool",
"name": "success",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
Expand Down
27 changes: 13 additions & 14 deletions precompiles/avs/avs.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz [
bz, err = p.CreateAVSTask(ctx, evm.Origin, contract, stateDB, method, args)
if err != nil {
ctx.Logger().Error("internal error when calling avs precompile", "module", "avs precompile", "method", method.Name, "err", err)
bz, err = method.Outputs.Pack(false)
bz, err = method.Outputs.Pack(false, uint64(0))
}
case MethodRegisterBLSPublicKey:
bz, err = p.RegisterBLSPublicKey(ctx, evm.Origin, contract, stateDB, method, args)
Expand All @@ -135,19 +135,19 @@ func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz [
bz, err = p.GetOptedInOperatorAccAddrs(ctx, contract, method, args)
if err != nil {
ctx.Logger().Error("internal error when calling avs precompile", "module", "avs precompile", "method", method.Name, "err", err)
bz, err = method.Outputs.Pack(false)
bz, err = method.Outputs.Pack([]string(nil))
}
case MethodGetAVSInfo:
bz, err = p.GetAVSInfo(ctx, contract, method, args)
if err != nil {
ctx.Logger().Error("internal error when calling avs precompile", "module", "avs precompile", "method", method.Name, "err", err)
bz, err = method.Outputs.Pack(false)
bz, err = method.Outputs.Pack("")
}
case MethodGetTaskInfo:
bz, err = p.GetTaskInfo(ctx, contract, method, args)
if err != nil {
ctx.Logger().Error("internal error when calling avs precompile", "module", "avs precompile", "method", method.Name, "err", err)
bz, err = method.Outputs.Pack(false)
bz, err = method.Outputs.Pack([]uint64(nil))
}
case MethodIsOperator:
bz, err = p.IsOperator(ctx, contract, method, args)
Expand All @@ -162,6 +162,13 @@ func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz [
ctx.Logger().Error("internal error when calling avs precompile", "module", "avs precompile", "method", method.Name, "err", err)
bz, err = method.Outputs.Pack(common.Big0)
}

case MethodGetRegisteredPubkey:
bz, err = p.GetRegisteredPubkey(ctx, contract, method, args)
if err != nil {
ctx.Logger().Error("internal error when calling avs precompile", "module", "avs precompile", "method", method.Name, "err", err)
bz, err = method.Outputs.Pack([]byte(nil))
}
case MethodGetOperatorOptedUSDValue:
bz, err = p.GetOperatorOptedUSDValue(ctx, contract, method, args)
if err != nil {
Expand All @@ -172,7 +179,7 @@ func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz [
bz, err = p.GetCurrentEpoch(ctx, contract, method, args)
if err != nil {
ctx.Logger().Error("internal error when calling avs precompile", "module", "avs precompile", "method", method.Name, "err", err)
bz, err = method.Outputs.Pack(false)
bz, err = method.Outputs.Pack(int64(0))
}
case MethodChallenge:
bz, err = p.Challenge(ctx, evm.Origin, contract, stateDB, method, args)
Expand All @@ -181,13 +188,6 @@ func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz [
bz, err = method.Outputs.Pack(false)
}

case MethodRegisterOperatorToExocore:
bz, err = p.RegisterOperatorToExocore(ctx, evm.Origin, contract, stateDB, method, args)
if err != nil {
ctx.Logger().Error("internal error when calling avs precompile", "module", "avs precompile", "method", method.Name, "err", err)
bz, err = method.Outputs.Pack(false)
}

case MethodOperatorSubmitTask:
bz, err = p.OperatorSubmitTask(ctx, evm.Origin, contract, stateDB, method, args)
if err != nil {
Expand Down Expand Up @@ -216,8 +216,7 @@ func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz [
func (Precompile) IsTransaction(methodID string) bool {
switch methodID {
case MethodRegisterAVS, MethodDeregisterAVS, MethodUpdateAVS, MethodRegisterOperatorToAVS,
MethodDeregisterOperatorFromAVS, MethodCreateAVSTask, MethodRegisterBLSPublicKey, MethodChallenge,
MethodRegisterOperatorToExocore, MethodOperatorSubmitTask:
MethodDeregisterOperatorFromAVS, MethodCreateAVSTask, MethodRegisterBLSPublicKey, MethodChallenge, MethodOperatorSubmitTask:
return true
case MethodGetRegisteredPubkey, MethodGetOptinOperators, MethodGetAVSUSDValue, MethodGetOperatorOptedUSDValue,
MethodGetAVSInfo, MethodGetTaskInfo, MethodIsOperator, MethodGetCurrentEpoch:
Expand Down
Loading

0 comments on commit 6ccf100

Please sign in to comment.