From 36cd238bb50ff2df92992098530f80adfcb16844 Mon Sep 17 00:00:00 2001 From: trestin798 <138697728+trestinlsd@users.noreply.github.com> Date: Tue, 24 Sep 2024 17:50:03 +0800 Subject: [PATCH] feat(avs):Implement on-chain aggregation signature (#167) * feat:Add task ID auto increment 1 method * convert the assetID to lowercase format when set oracle parameter * feat:add task end epoch process logic * Implement task result statistics in epoch end * replace evm.origin with sender address * fix apphash mismatch caused by unordered grouping of maps * fix task ID call failure occupying sequence number * fix query blsKey issuse and add sig verify * fix division by votingpower zero * fix remove submit task param response-hash * fix the prompt information returned --------- Co-authored-by: TimmyExogenous <144751317+TimmyExogenous@users.noreply.github.com> Co-authored-by: Max <82761650+MaxMustermann2@users.noreply.github.com> --- precompiles/assets/types.go | 1 + precompiles/avs/{avs.sol => IAVSManager.sol} | 178 +- precompiles/avs/abi.json | 338 +-- precompiles/avs/avs.go | 8 +- precompiles/avs/avs_test.go | 94 +- precompiles/avs/events.go | 20 +- precompiles/avs/query.go | 8 +- precompiles/avs/query_test.go | 5 +- precompiles/avs/tx.go | 118 +- precompiles/avs/types.go | 139 +- precompiles/avs/utils_test.go | 16 +- proto/exocore/avs/v1/query.proto | 42 + proto/exocore/avs/v1/tx.proto | 93 +- proto/exocore/operator/v1/query.proto | 43 + x/avs/client/cli/query.go | 95 +- x/avs/client/cli/tx.go | 124 +- x/avs/keeper/avs.go | 29 +- x/avs/keeper/bls_test.go | 121 + x/avs/keeper/epoch_test.go | 47 + x/avs/keeper/impl_epoch_hook.go | 85 +- x/avs/keeper/keeper.go | 144 +- x/avs/keeper/miscellaneous_test.go | 95 + x/avs/keeper/msg_server.go | 53 +- .../keeper/multi_operator_submit_task_test.go | 234 ++ x/avs/keeper/params.go | 42 +- x/avs/keeper/query.go | 27 + x/avs/keeper/setup_test.go | 43 +- x/avs/keeper/submit_task_test.go | 216 ++ x/avs/keeper/task.go | 304 ++- x/avs/keeper/task_test.go | 42 +- x/avs/module.go | 2 +- x/avs/simulation/helpers.go | 15 - x/avs/types/codec.go | 14 +- x/avs/types/errors.go | 57 +- x/avs/types/keys.go | 6 + x/avs/types/msg.go | 34 + x/avs/types/query.pb.go | 1283 +++++++-- x/avs/types/query.pb.gw.go | 166 ++ x/avs/types/stage.go | 8 + x/avs/types/tx.pb.go | 2312 ++++++++++++++--- x/avs/types/tx.pb.gw.go | 83 + x/avs/types/types.go | 87 + x/operator/client/cli/query.go | 69 + x/operator/keeper/grpc_query.go | 22 + x/operator/types/query.pb.go | 966 ++++++- x/operator/types/query.pb.gw.go | 202 ++ x/oracle/keeper/params.go | 2 +- 47 files changed, 6844 insertions(+), 1288 deletions(-) rename precompiles/avs/{avs.sol => IAVSManager.sol} (54%) create mode 100644 x/avs/keeper/bls_test.go create mode 100644 x/avs/keeper/epoch_test.go create mode 100644 x/avs/keeper/miscellaneous_test.go create mode 100644 x/avs/keeper/multi_operator_submit_task_test.go create mode 100644 x/avs/keeper/submit_task_test.go delete mode 100644 x/avs/simulation/helpers.go create mode 100644 x/avs/types/stage.go diff --git a/precompiles/assets/types.go b/precompiles/assets/types.go index 78297bd47..4a0c671d6 100644 --- a/precompiles/assets/types.go +++ b/precompiles/assets/types.go @@ -232,6 +232,7 @@ func (p Precompile) UpdateTokenFromInputs( if !ok || assetAddr == nil { return 0, "", "", fmt.Errorf(exocmn.ErrContractInputParaOrType, 1, "[]byte", args[1]) } + // #nosec G115 if uint32(len(assetAddr)) < clientChainAddrLength { return 0, "", "", fmt.Errorf(exocmn.ErrInvalidAddrLength, len(assetAddr), clientChainAddrLength) } diff --git a/precompiles/avs/avs.sol b/precompiles/avs/IAVSManager.sol similarity index 54% rename from precompiles/avs/avs.sol rename to precompiles/avs/IAVSManager.sol index 548e28406..b5c1bdca5 100644 --- a/precompiles/avs/avs.sol +++ b/precompiles/avs/IAVSManager.sol @@ -14,6 +14,7 @@ IAVSManager constant AVSMANAGER_CONTRACT = IAVSManager( /// @custom:address 0x0000000000000000000000000000000000000901 interface IAVSManager { /// @dev Register AVS contract to EXO. + /// @param sender The external address for calling this method. /// @param avsName The name of AVS. /// @param minStakeAmount The minimum amount of funds staked by each operator. /// @param taskAddr The task address of AVS. @@ -29,6 +30,7 @@ interface IAVSManager { ///3.avsReward The proportion of reward for AVS. ///4.avsSlash The proportion of slash for AVS. function registerAVS( + address sender, string memory avsName, uint64 minStakeAmount, address taskAddr, @@ -43,6 +45,7 @@ interface IAVSManager { ) external returns (bool success); /// @dev Update AVS info to EXO. + /// @param sender The external address for calling this method. /// @param avsName The name of AVS. /// @param minStakeAmount The minimum amount of funds staked by each operator. /// @param taskAddr The task address of AVS. @@ -58,6 +61,7 @@ interface IAVSManager { ///3.avsReward The proportion of reward for AVS. ///4.avsSlash The proportion of slash for AVS. function updateAVS( + address sender, string memory avsName, uint64 minStakeAmount, address taskAddr, @@ -72,36 +76,60 @@ interface IAVSManager { ) external returns (bool success); /// @dev Deregister avs from exo + /// @param sender The external address for calling this method. /// @param avsName The name of AVS. function deregisterAVS( + address sender, string memory avsName ) external returns (bool success); /// @dev RegisterOperatorToAVS operator opt in current avs + /// @param sender The external address for calling this method. function registerOperatorToAVS( + address sender ) external returns (bool success); /// @dev DeregisterOperatorFromAVS operator opt out current avs + /// @param sender The external address for calling this method. function deregisterOperatorFromAVS( + address sender ) external returns (bool success); /// @dev CreateTask , avs owner create a new task + /// @param sender The external address for calling this method. /// @param name The name of the task. - /// @param data The data supplied by the contract, usually ABI-encoded. - /// @param taskId The task ID of the task. + /// @param hash The data supplied by the contract, usually ABI-encoded. /// @param taskResponsePeriod The deadline for task response. /// @param taskChallengePeriod The challenge period for the task. /// @param thresholdPercentage The signature threshold percentage. + /// @param taskStatisticalPeriod The statistical period for the task. function createTask( + address sender, string memory name, - bytes calldata data, - string memory taskId, + bytes calldata hash, uint64 taskResponsePeriod, uint64 taskChallengePeriod, - uint64 thresholdPercentage + uint64 thresholdPercentage, + uint64 taskStatisticalPeriod ) external returns (bool success); + /// @dev challenge , this function enables a challenger to raise and resolve a challenge. + /// @param sender The external address for calling this method. + /// @param taskHash The data supplied by the contract, usually ABI-encoded. + /// @param taskID The id of task. + /// @param taskResponseHash The hash of task response. + /// @param operatorAddress operator address. + function challenge( + address sender, + bytes calldata taskHash, + uint64 taskID, + bytes calldata taskResponseHash, + string memory operatorAddress + ) external returns (bool success); + + + /// @dev SubmitProof ,After processing the task contract, aggregate the signature and submit the processed proof /// @param taskId The task ID of the task. /// @param taskContractAddress The contract address of AVSTask. @@ -118,13 +146,13 @@ interface IAVSManager { /// @dev Called by the avs manager service register an operator as the owner of a BLS public key. - /// @param operator is the operator for whom the key is being registered + /// @param sender The external address for calling this method. /// @param name the name of public keys /// @param pubKey the public keys of the operator /// @param pubkeyRegistrationSignature the public keys of the operator /// @param pubkeyRegistrationMessageHash the public keys of the operator function registerBLSPublicKey( - string memory operator, + address sender, string calldata name, bytes calldata pubKey, bytes calldata pubkeyRegistrationSignature, @@ -135,11 +163,11 @@ interface IAVSManager { /// @dev Returns the pubkey and pubkey hash of an operator /// @param operator is the operator for whom the key is being registered - function getRegisteredPubkey(string memory operator) external returns (bytes calldata pubkey); + function getRegisteredPubkey(string memory operator) external pure returns (bytes memory pubkey); /// @dev Returns the operators of all opt-in in the current avs /// @param avsAddress avs address - function getOptInOperators(address avsAddress) external returns (string[] calldata operators); + function getOptInOperators(address avsAddress) external returns (string[] memory operators); /// @dev getAVSUSDValue is a function to retrieve the USD share of specified Avs. /// @param avsAddr The address of the avs @@ -157,132 +185,14 @@ interface IAVSManager { string memory operatorAddr ) external view returns (uint256 amount); - /// @dev RegisterBLSPublicKey Emitted when `operator` registers with the public keys `pubKey`. - /// @param operator the address of the delegator - /// @param pubKey the address of the validator - event RegisterBLSPublicKey( - string indexed operator, - string name, - bytes pubKey, - bytes pubkeyRegistrationSignature, - bytes pubkeyRegistrationMessageHash - ); - - /// @dev RegisterAVS Emitted when `avs` register to exocore. - /// @dev Register AVS contract to EXO. - /// @param avsAddress The address of AVS. - /// @param avsName The name of AVS. - /// @param minStakeAmount The minimum amount of funds staked by each operator. - /// @param taskAddr The task address of AVS. - /// @param slashAddr The slash address of AVS. - /// @param rewardAddr The reward address of AVS. - /// @param avsOwnerAddress The owners who have permission for AVS. - /// @param assetIds The basic asset information of AVS. - /// @param avsUnbondingPeriod The unbonding duration of AVS. - /// @param minSelfDelegation The minimum delegation amount for an operator. - /// @param epochIdentifier The AVS epoch identifier. - /// @param params 1.miniOptInOperators The minimum number of opt-in operators. - ///2.minTotalStakeAmount The minimum total amount of stake by all operators. - ///3.avsReward The proportion of reward for AVS. - ///4.avsSlash The proportion of slash for AVS. - event RegisterAVS( - string indexed avsAddress, - string avsName, - uint64 minStakeAmount, - address taskAddr, - address slashAddr, - address rewardAddr, - address[] avsOwnerAddress, - string[] assetIds, - uint64 avsUnbondingPeriod, - uint64 minSelfDelegation, - string epochIdentifier, - uint64[] params - ); - - /// @dev UpdateAVS Emitted when `avs` update to exocore. - /// @param avsAddress The address of AVS. - /// @param avsName The name of AVS. - /// @param minStakeAmount The minimum amount of funds staked by each operator. - /// @param taskAddr The task address of AVS. - /// @param slashAddr The slash address of AVS. - /// @param rewardAddr The reward address of AVS. - /// @param avsOwnerAddress The owners who have permission for AVS. - /// @param assetIds The basic asset information of AVS. - /// @param avsUnbondingPeriod The unbonding duration of AVS. - /// @param minSelfDelegation The minimum delegation amount for an operator. - /// @param epochIdentifier The AVS epoch identifier. - /// @param params 1.miniOptInOperators The minimum number of opt-in operators. - ///2.minTotalStakeAmount The minimum total amount of stake by all operators. - ///3.avsReward The proportion of reward for AVS. - ///4.avsSlash The proportion of slash for AVS. - event UpdateAVS( - string indexed avsAddress, - string avsName, - uint64 minStakeAmount, - address taskAddr, - address slashAddr, - address rewardAddr, - address[] avsOwnerAddress, - string[] assetIds, - uint64 avsUnbondingPeriod, - uint64 minSelfDelegation, - string epochIdentifier, - uint64[] params - ); - - /// @dev DeregisterAVS Emitted when `avs` Deregister to exocore. - /// @param avsAddress The address of AVS. - /// @param avsName The name of AVS. - event DeregisterAVS( - string indexed avsAddress, - string avsName - ); - - /// @dev RegisterOperatorToAVS Emitted when `operator` opt-in to avs. - /// @param operator address. - /// @param avsAddress The address of AVS. - event RegisterOperatorToAVS( - string indexed operator, - string indexed avsAddress - ); - - /// @dev DeregisterOperatorFromAVS Emitted when `operator` opt-out to avs. - /// @param operator address. - /// @param avsAddress The address of AVS. - event DeregisterOperatorFromAVS( - string indexed operator, - string indexed avsAddress - ); - - /// @dev CreateTask Emitted when `avs` CreateTask. - /// @param taskContractAddress The contract address of AVSTask. - /// @param taskId The task ID of the task. - /// @param name The name of the task. - /// @param data The data supplied by the contract, usually ABI-encoded. - /// @param taskResponsePeriod The deadline for task response. - /// @param taskChallengePeriod The challenge period for the task. - /// @param thresholdPercentage The signature threshold percentage. - event CreateTask( - string indexed taskContractAddress, - string indexed taskId, + event TaskCreated( + uint64 taskId, + string taskContractAddress, string name, - bytes data, + bytes hash, uint64 taskResponsePeriod, uint64 taskChallengePeriod, - uint64 thresholdPercentage - ); - /// @dev SubmitProof Emitted when task contract submit proof. - /// @param taskContractAddress The contract address of AVSTask. - /// @param taskId The task ID of the task. - /// @param aggregator The aggregator address. - /// @param avsAddress The address of AVS. - /// @param operatorStatuses The status and proof of operators. - event SubmitProof( - string indexed taskContractAddress, - string indexed taskId, - string aggregator, - string avsAddress, - bytes operatorStatuses + uint64 thresholdPercentage, + uint64 taskStatisticalPeriod ); -} + } diff --git a/precompiles/avs/abi.json b/precompiles/avs/abi.json index a41261e6b..ca475f27d 100644 --- a/precompiles/avs/abi.json +++ b/precompiles/avs/abi.json @@ -3,15 +3,15 @@ "anonymous": false, "inputs": [ { - "indexed": true, - "internalType": "string", - "name": "taskContractAddress", - "type": "string" + "indexed": false, + "internalType": "uint64", + "name": "taskId", + "type": "uint64" }, { - "indexed": true, + "indexed": false, "internalType": "string", - "name": "taskId", + "name": "taskContractAddress", "type": "string" }, { @@ -23,7 +23,7 @@ { "indexed": false, "internalType": "bytes", - "name": "data", + "name": "hash", "type": "bytes" }, { @@ -43,302 +43,63 @@ "internalType": "uint64", "name": "thresholdPercentage", "type": "uint64" - } - ], - "name": "CreateTask", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "string", - "name": "avsAddress", - "type": "string" - }, - { - "indexed": false, - "internalType": "string", - "name": "avsName", - "type": "string" - } - ], - "name": "DeregisterAVS", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "string", - "name": "operator", - "type": "string" - }, - { - "indexed": true, - "internalType": "string", - "name": "avsAddress", - "type": "string" - } - ], - "name": "DeregisterOperatorFromAVS", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "string", - "name": "avsAddress", - "type": "string" - }, - { - "indexed": false, - "internalType": "string", - "name": "avsName", - "type": "string" }, { "indexed": false, "internalType": "uint64", - "name": "minStakeAmount", + "name": "taskStatisticalPeriod", "type": "uint64" - }, - { - "indexed": false, - "internalType": "address", - "name": "taskAddr", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "slashAddr", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "rewardAddr", - "type": "address" - }, - { - "indexed": false, - "internalType": "address[]", - "name": "avsOwnerAddress", - "type": "address[]" - }, - { - "indexed": false, - "internalType": "string[]", - "name": "assetIds", - "type": "string[]" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "avsUnbondingPeriod", - "type": "uint64" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "minSelfDelegation", - "type": "uint64" - }, - { - "indexed": false, - "internalType": "string", - "name": "epochIdentifier", - "type": "string" - }, - { - "indexed": false, - "internalType": "uint64[]", - "name": "params", - "type": "uint64[]" } ], - "name": "RegisterAVS", + "name": "TaskCreated", "type": "event" }, { - "anonymous": false, "inputs": [ { - "indexed": true, - "internalType": "string", - "name": "operator", - "type": "string" - }, - { - "indexed": false, - "internalType": "string", - "name": "name", - "type": "string" + "internalType": "address", + "name": "sender", + "type": "address" }, { - "indexed": false, "internalType": "bytes", - "name": "pubKey", + "name": "taskHash", "type": "bytes" }, { - "indexed": false, - "internalType": "bytes", - "name": "pubkeyRegistrationSignature", - "type": "bytes" + "internalType": "uint64", + "name": "taskID", + "type": "uint64" }, { - "indexed": false, "internalType": "bytes", - "name": "pubkeyRegistrationMessageHash", + "name": "taskResponseHash", "type": "bytes" - } - ], - "name": "RegisterBLSPublicKey", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "string", - "name": "operator", - "type": "string" }, { - "indexed": true, "internalType": "string", - "name": "avsAddress", + "name": "operatorAddress", "type": "string" } ], - "name": "RegisterOperatorToAVS", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "string", - "name": "taskContractAddress", - "type": "string" - }, - { - "indexed": true, - "internalType": "string", - "name": "taskId", - "type": "string" - }, - { - "indexed": false, - "internalType": "string", - "name": "aggregator", - "type": "string" - }, - { - "indexed": false, - "internalType": "string", - "name": "avsAddress", - "type": "string" - }, + "name": "challenge", + "outputs": [ { - "indexed": false, - "internalType": "bytes", - "name": "operatorStatuses", - "type": "bytes" + "internalType": "bool", + "name": "success", + "type": "bool" } ], - "name": "SubmitProof", - "type": "event" + "stateMutability": "nonpayable", + "type": "function" }, { - "anonymous": false, "inputs": [ { - "indexed": true, - "internalType": "string", - "name": "avsAddress", - "type": "string" - }, - { - "indexed": false, - "internalType": "string", - "name": "avsName", - "type": "string" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "minStakeAmount", - "type": "uint64" - }, - { - "indexed": false, - "internalType": "address", - "name": "taskAddr", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "slashAddr", - "type": "address" - }, - { - "indexed": false, "internalType": "address", - "name": "rewardAddr", + "name": "sender", "type": "address" }, - { - "indexed": false, - "internalType": "address[]", - "name": "avsOwnerAddress", - "type": "address[]" - }, - { - "indexed": false, - "internalType": "string[]", - "name": "assetIds", - "type": "string[]" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "avsUnbondingPeriod", - "type": "uint64" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "minSelfDelegation", - "type": "uint64" - }, - { - "indexed": false, - "internalType": "string", - "name": "epochIdentifier", - "type": "string" - }, - { - "indexed": false, - "internalType": "uint64[]", - "name": "params", - "type": "uint64[]" - } - ], - "name": "UpdateAVS", - "type": "event" - }, - { - "inputs": [ { "internalType": "string", "name": "name", @@ -346,14 +107,9 @@ }, { "internalType": "bytes", - "name": "data", + "name": "hash", "type": "bytes" }, - { - "internalType": "string", - "name": "taskId", - "type": "string" - }, { "internalType": "uint64", "name": "taskResponsePeriod", @@ -368,6 +124,11 @@ "internalType": "uint64", "name": "thresholdPercentage", "type": "uint64" + }, + { + "internalType": "uint64", + "name": "taskStatisticalPeriod", + "type": "uint64" } ], "name": "createTask", @@ -383,6 +144,11 @@ }, { "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, { "internalType": "string", "name": "avsName", @@ -402,7 +168,11 @@ }, { "inputs": [ - + { + "internalType": "address", + "name": "sender", + "type": "address" + } ], "name": "deregisterOperatorFromAVS", "outputs": [ @@ -493,11 +263,16 @@ "type": "bytes" } ], - "stateMutability": "nonpayable", + "stateMutability": "pure", "type": "function" }, { "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, { "internalType": "string", "name": "avsName", @@ -568,9 +343,9 @@ { "inputs": [ { - "internalType": "string", - "name": "operator", - "type": "string" + "internalType": "address", + "name": "sender", + "type": "address" }, { "internalType": "string", @@ -606,7 +381,11 @@ }, { "inputs": [ - + { + "internalType": "address", + "name": "sender", + "type": "address" + } ], "name": "registerOperatorToAVS", "outputs": [ @@ -660,6 +439,11 @@ }, { "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, { "internalType": "string", "name": "avsName", diff --git a/precompiles/avs/avs.go b/precompiles/avs/avs.go index 926bee5ee..fbb8d230e 100644 --- a/precompiles/avs/avs.go +++ b/precompiles/avs/avs.go @@ -153,6 +153,12 @@ 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 MethodChallenge: + bz, err = p.Challenge(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) + } } if err != nil { @@ -175,7 +181,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, MethodSubmitProof: + MethodDeregisterOperatorFromAVS, MethodCreateAVSTask, MethodRegisterBLSPublicKey, MethodSubmitProof, MethodChallenge: return true case MethodGetRegisteredPubkey, MethodGetOptinOperators, MethodGetAVSUSDValue, MethodGetOperatorOptedUSDValue: return false diff --git a/precompiles/avs/avs_test.go b/precompiles/avs/avs_test.go index 88973834c..a58200713 100644 --- a/precompiles/avs/avs_test.go +++ b/precompiles/avs/avs_test.go @@ -1,11 +1,14 @@ package avs_test import ( + sdkmath "cosmossdk.io/math" + assetstype "github.com/ExocoreNetwork/exocore/x/assets/types" + operatorKeeper "github.com/ExocoreNetwork/exocore/x/operator/keeper" "math/big" + "time" "github.com/ExocoreNetwork/exocore/app" "github.com/ExocoreNetwork/exocore/precompiles/avs" - "github.com/ExocoreNetwork/exocore/x/avs/types" epochstypes "github.com/ExocoreNetwork/exocore/x/epochs/types" operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" "github.com/cometbft/cometbft/libs/rand" @@ -99,6 +102,7 @@ func (suite *AVSManagerPrecompileSuite) TestRegisterAVS() { commonMalleate := func() (common.Address, []byte) { input, err := suite.precompile.Pack( avs.MethodRegisterAVS, + suite.Address, avsName, minStakeAmount, common.HexToAddress(taskAddr), @@ -210,6 +214,7 @@ func (suite *AVSManagerPrecompileSuite) TestDeregisterAVS() { // prepare the call input for delegation test input, err := suite.precompile.Pack( avs.MethodDeregisterAVS, + suite.Address, avsName, ) suite.Require().NoError(err, "failed to pack input") @@ -312,13 +317,14 @@ func (suite *AVSManagerPrecompileSuite) TestUpdateAVS() { sdk.AccAddress(utiltx.GenerateAddress().Bytes()).String(), } assetID := []string{"11", "22", "33"} - minStakeAmount, taskAddr := uint64(3), "0xDF907c29719154eb9872f021d21CAE6E5025d7aB" + minStakeAmount, taskAddr := uint64(3), "0x3e108c058e8066DA635321Dc3018294cA82ddEdf" avsUnbondingPeriod, minSelfDelegation := uint64(3), uint64(3) epochIdentifier := epochstypes.DayEpochID params := []uint64{2, 3, 4, 4} commonMalleate := func() (common.Address, []byte) { input, err := suite.precompile.Pack( avs.MethodUpdateAVS, + suite.Address, avsName, minStakeAmount, common.HexToAddress(taskAddr), @@ -441,6 +447,7 @@ func (suite *AVSManagerPrecompileSuite) TestRegisterOperatorToAVS() { commonMalleate := func() (common.Address, []byte) { input, err := suite.precompile.Pack( avs.MethodRegisterOperatorToAVS, + suite.Address, ) suite.Require().NoError(err, "failed to pack input") return common.HexToAddress("0x3e108c058e8066DA635321Dc3018294cA82ddEdf"), input @@ -536,22 +543,10 @@ func (suite *AVSManagerPrecompileSuite) TestRegisterOperatorToAVS() { } func (suite *AVSManagerPrecompileSuite) TestDeregisterOperatorFromAVS() { - // from := s.Address - // operatorAddress, err := util.ProcessAddress(from.String()) - - // registerOperator := func() { - // registerReq := &operatortypes.RegisterOperatorReq{ - // FromAddress: operatorAddress, - // Info: &operatortypes.OperatorInfo{ - // EarningsAddr: operatorAddress, - // }, - // } - // _, err := s.OperatorMsgServer.RegisterOperator(sdk.WrapSDKContext(s.Ctx), registerReq) - // s.NoError(err) - // } commonMalleate := func() (common.Address, []byte) { input, err := suite.precompile.Pack( avs.MethodDeregisterOperatorFromAVS, + suite.Address, ) suite.Require().NoError(err, "failed to pack input") return common.HexToAddress("0x3e108c058e8066DA635321Dc3018294cA82ddEdf"), input @@ -649,40 +644,55 @@ func (suite *AVSManagerPrecompileSuite) TestDeregisterOperatorFromAVS() { // TestRun tests the precompiles Run method reg avstask. func (suite *AVSManagerPrecompileSuite) TestRunRegTaskInfo() { taskAddr := utiltx.GenerateAddress() - registerAVS := func() { - avsName := "avsTest" - avsOwnerAddress := []string{ - sdk.AccAddress(suite.Address.Bytes()).String(), - "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", - "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkj2", - } - assetID := []string{"11", "22", "33"} - avsInfo := &types.AVSInfo{ - Name: avsName, - AvsAddress: utiltx.GenerateAddress().String(), - SlashAddr: utiltx.GenerateAddress().String(), - AvsOwnerAddress: avsOwnerAddress, - AssetIDs: assetID, - AvsUnbondingPeriod: 7, - MinSelfDelegation: 10, - EpochIdentifier: epochstypes.DayEpochID, - StartingEpoch: 1, - MinOptInOperators: 100, - MinTotalStakeAmount: 1000, - AvsSlash: sdk.MustNewDecFromStr("0.001"), - AvsReward: sdk.MustNewDecFromStr("0.002"), - TaskAddr: taskAddr.String(), + setUp := func() { + suite.prepare() + // register the new token + usdcAddr := common.HexToAddress("0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48") + usdcClientChainAsset := assetstype.AssetInfo{ + Name: "USD coin", + Symbol: "USDC", + Address: usdcAddr.String(), + Decimals: 6, + LayerZeroChainID: 101, + MetaInfo: "USDC", } - - err := suite.App.AVSManagerKeeper.SetAVSInfo(suite.Ctx, avsInfo) + err := suite.App.AssetsKeeper.SetStakingAssetInfo( + suite.Ctx, + &assetstype.StakingAssetInfo{ + AssetBasicInfo: usdcClientChainAsset, + StakingTotalAmount: sdkmath.NewInt(0), + }, + ) suite.NoError(err) + // register the new AVS + suite.prepareAvs([]string{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48_0x65", "0xdac17f958d2ee523a2206206994597c13d831ec7_0x65"}, taskAddr.String()) + // opt in + err = suite.App.OperatorKeeper.OptIn(suite.Ctx, suite.operatorAddr, suite.avsAddr) + suite.NoError(err) + usdtPrice, err := suite.App.OperatorKeeper.OracleInterface().GetSpecifiedAssetsPrice(suite.Ctx, suite.assetID) + suite.NoError(err) + operatorKeeper.CalculateUSDValue(suite.delegationAmount, usdtPrice.Value, suite.assetDecimal, usdtPrice.Decimal) + // deposit and delegate another asset to the operator + suite.NoError(err) + suite.prepareDeposit(usdcAddr, sdkmath.NewInt(1e8)) + usdcPrice, err := suite.App.OperatorKeeper.OracleInterface().GetSpecifiedAssetsPrice(suite.Ctx, suite.assetID) + suite.NoError(err) + delegatedAmount := sdkmath.NewIntWithDecimal(8, 7) + suite.prepareDelegation(true, usdcAddr, delegatedAmount) + + // updating the new voting power + operatorKeeper.CalculateUSDValue(suite.delegationAmount, usdcPrice.Value, suite.assetDecimal, usdcPrice.Decimal) + suite.CommitAfter(time.Hour*1 + time.Nanosecond) + suite.CommitAfter(time.Hour*1 + time.Nanosecond) + suite.CommitAfter(time.Hour*1 + time.Nanosecond) } commonMalleate := func() (common.Address, []byte) { input, err := suite.precompile.Pack( avs.MethodCreateAVSTask, + suite.Address, "test-avstask", rand.Bytes(3), - "3", + uint64(3), uint64(3), uint64(3), uint64(3), @@ -704,7 +714,7 @@ func (suite *AVSManagerPrecompileSuite) TestRunRegTaskInfo() { name: "pass - avstask via pre-compiles", malleate: func() (common.Address, []byte) { suite.Require().NoError(err) - registerAVS() + setUp() return commonMalleate() }, returnBytes: successRet, diff --git a/precompiles/avs/events.go b/precompiles/avs/events.go index 1bdc8294c..ff26f0fe2 100644 --- a/precompiles/avs/events.go +++ b/precompiles/avs/events.go @@ -6,38 +6,28 @@ import ( "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" - cmn "github.com/evmos/evmos/v16/precompiles/common" ) const ( // EventTypeRegisterAVSTask defines the event type for the avs CreateAVSTask transaction. - EventTypeRegisterAVSTask = "CreateTask" + EventTypeRegisterAVSTask = "TaskCreated" ) // EmitCreateAVSTaskEvent creates a new event emitted on a EmitCreateAVSTaskEvent transaction. -func (p Precompile) EmitCreateAVSTaskEvent(ctx sdk.Context, stateDB vm.StateDB, task *avskeep.TaskParams) error { +func (p Precompile) EmitCreateAVSTaskEvent(ctx sdk.Context, stateDB vm.StateDB, task *avskeep.TaskInfoParams) error { // Prepare the event topics event := p.ABI.Events[EventTypeRegisterAVSTask] - topics := make([]common.Hash, 3) + topics := make([]common.Hash, 1) // The first topic is always the signature of the event. topics[0] = event.ID var err error - topics[1], err = cmn.MakeTopic(common.HexToAddress(task.TaskContractAddress)) - if err != nil { - return err - } - - topics[2], err = cmn.MakeTopic(task.TaskID) - if err != nil { - return err - } // Pack the arguments to be used as the Data field - arguments := event.Inputs[2:7] - packed, err := arguments.Pack(task.TaskName, task.Data, task.TaskResponsePeriod, task.TaskChallengePeriod, task.ThresholdPercentage) + arguments := event.Inputs[0:8] + packed, err := arguments.Pack(task.TaskID, task.TaskContractAddress, task.TaskName, task.Hash, task.TaskResponsePeriod, task.TaskChallengePeriod, task.ThresholdPercentage, task.TaskStatisticalPeriod) if err != nil { return err } diff --git a/precompiles/avs/query.go b/precompiles/avs/query.go index a3a6d627f..72cea06eb 100644 --- a/precompiles/avs/query.go +++ b/precompiles/avs/query.go @@ -25,18 +25,18 @@ func (p Precompile) GetRegisteredPubkey( args []interface{}, ) ([]byte, error) { if len(args) != len(p.ABI.Methods[MethodGetRegisteredPubkey].Inputs) { - return nil, fmt.Errorf(cmn.ErrInvalidNumberOfArgs, len(p.ABI.Methods[MethodRegisterAVS].Inputs), len(args)) + return nil, fmt.Errorf(cmn.ErrInvalidNumberOfArgs, len(p.ABI.Methods[MethodGetRegisteredPubkey].Inputs), len(args)) } // the key is set using the operator's acc address so the same logic should apply here addr, ok := args[0].(string) if !ok { return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 0, "string", addr) } - pubkey, err := p.avsKeeper.GetOperatorPubKey(ctx, addr) + blsPubkeyInfo, err := p.avsKeeper.GetOperatorPubKey(ctx, addr) if err != nil { return nil, err } - return method.Outputs.Pack(pubkey) + return method.Outputs.Pack(blsPubkeyInfo.PubKey) } func (p Precompile) GetOptedInOperatorAccAddrs( @@ -46,7 +46,7 @@ func (p Precompile) GetOptedInOperatorAccAddrs( args []interface{}, ) ([]byte, error) { if len(args) != len(p.ABI.Methods[MethodGetOptinOperators].Inputs) { - return nil, fmt.Errorf(cmn.ErrInvalidNumberOfArgs, len(p.ABI.Methods[MethodRegisterAVS].Inputs), len(args)) + return nil, fmt.Errorf(cmn.ErrInvalidNumberOfArgs, len(p.ABI.Methods[MethodGetOptinOperators].Inputs), len(args)) } addr, ok := args[0].(common.Address) diff --git a/precompiles/avs/query_test.go b/precompiles/avs/query_test.go index 1f204bd1e..e7abe88a8 100644 --- a/precompiles/avs/query_test.go +++ b/precompiles/avs/query_test.go @@ -2,6 +2,7 @@ package avs_test import ( "fmt" + utiltx "github.com/ExocoreNetwork/exocore/testutil/tx" "math/big" "time" @@ -160,7 +161,7 @@ func (suite *AVSManagerPrecompileSuite) TestAVSUSDValue() { ) suite.NoError(err) // register the new AVS - suite.prepareAvs([]string{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48_0x65", "0xdac17f958d2ee523a2206206994597c13d831ec7_0x65"}) + suite.prepareAvs([]string{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48_0x65", "0xdac17f958d2ee523a2206206994597c13d831ec7_0x65"}, utiltx.GenerateAddress().String()) // opt in err = suite.App.OperatorKeeper.OptIn(suite.Ctx, suite.operatorAddr, suite.avsAddr) suite.NoError(err) @@ -248,7 +249,7 @@ func (suite *AVSManagerPrecompileSuite) TestGetOperatorOptedUSDValue() { ) suite.NoError(err) // register the new AVS - suite.prepareAvs([]string{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48_0x65", "0xdac17f958d2ee523a2206206994597c13d831ec7_0x65"}) + suite.prepareAvs([]string{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48_0x65", "0xdac17f958d2ee523a2206206994597c13d831ec7_0x65"}, utiltx.GenerateAddress().String()) // opt in err = suite.App.OperatorKeeper.OptIn(suite.Ctx, suite.operatorAddr, suite.avsAddr) suite.NoError(err) diff --git a/precompiles/avs/tx.go b/precompiles/avs/tx.go index e9558a710..265e38864 100644 --- a/precompiles/avs/tx.go +++ b/precompiles/avs/tx.go @@ -1,3 +1,4 @@ +//nolint:dupl package avs import ( @@ -25,12 +26,13 @@ const ( MethodCreateAVSTask = "createTask" MethodSubmitProof = "submitProof" MethodRegisterBLSPublicKey = "registerBLSPublicKey" + MethodChallenge = "challenge" ) // AVSInfoRegister register the avs related information and change the state in avs keeper module. func (p Precompile) RegisterAVS( ctx sdk.Context, - origin common.Address, + _ common.Address, contract *vm.Contract, _ vm.StateDB, method *abi.Method, @@ -41,7 +43,7 @@ func (p Precompile) RegisterAVS( if err != nil { return nil, errorsmod.Wrap(err, "parse args error") } - if !slices.Contains(avsParams.AvsOwnerAddress, sdk.AccAddress(origin.Bytes()).String()) { + if !slices.Contains(avsParams.AvsOwnerAddress, avsParams.CallerAddress) { return nil, errorsmod.Wrap(err, "not qualified to registerOrDeregister") } // The AVS registration is done by the calling contract. @@ -59,7 +61,7 @@ func (p Precompile) RegisterAVS( func (p Precompile) DeregisterAVS( ctx sdk.Context, - origin common.Address, + _ common.Address, contract *vm.Contract, _ vm.StateDB, method *abi.Method, @@ -69,17 +71,20 @@ func (p Precompile) DeregisterAVS( return nil, fmt.Errorf(cmn.ErrInvalidNumberOfArgs, len(p.ABI.Methods[MethodDeregisterAVS].Inputs), len(args)) } avsParams := &avstypes.AVSRegisterOrDeregisterParams{} - - avsName, ok := args[0].(string) + callerAddress, ok := args[0].(common.Address) + if !ok || (callerAddress == common.Address{}) { + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 0, "common.Address", callerAddress) + } + avsParams.CallerAddress = sdk.AccAddress(callerAddress[:]).String() + avsName, ok := args[1].(string) if !ok || avsName == "" { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 0, "string", avsName) + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 1, "string", avsName) } avsParams.AvsName = avsName avsParams.AvsAddress = contract.CallerAddress.String() avsParams.Action = avskeeper.DeRegisterAction // validates that this is owner - avsParams.CallerAddress = sdk.AccAddress(origin[:]).String() err := p.avsKeeper.UpdateAVSInfo(ctx, avsParams) if err != nil { @@ -90,7 +95,7 @@ func (p Precompile) DeregisterAVS( func (p Precompile) UpdateAVS( ctx sdk.Context, - origin common.Address, + _ common.Address, contract *vm.Contract, _ vm.StateDB, method *abi.Method, @@ -103,7 +108,6 @@ func (p Precompile) UpdateAVS( } avsParams.AvsAddress = contract.CallerAddress.String() - avsParams.CallerAddress = sdk.AccAddress(origin[:]).String() avsParams.Action = avskeeper.UpdateAction previousAVSInfo, err := p.avsKeeper.GetAVSInfo(ctx, avsParams.AvsAddress) if err != nil { @@ -123,14 +127,22 @@ func (p Precompile) UpdateAVS( func (p Precompile) BindOperatorToAVS( ctx sdk.Context, - origin common.Address, + _ common.Address, contract *vm.Contract, _ vm.StateDB, method *abi.Method, - _ []interface{}, + args []interface{}, ) ([]byte, error) { + if len(args) != len(p.ABI.Methods[MethodRegisterOperatorToAVS].Inputs) { + return nil, fmt.Errorf(cmn.ErrInvalidNumberOfArgs, len(p.ABI.Methods[MethodRegisterOperatorToAVS].Inputs), len(args)) + } + callerAddress, ok := args[0].(common.Address) + if !ok || (callerAddress == common.Address{}) { + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 0, "common.Address", callerAddress) + } + operatorParams := &avskeeper.OperatorOptParams{} - operatorParams.OperatorAddress = sdk.AccAddress(origin[:]).String() + operatorParams.OperatorAddress = sdk.AccAddress(callerAddress[:]).String() operatorParams.AvsAddress = contract.CallerAddress.String() operatorParams.Action = avskeeper.RegisterAction err := p.avsKeeper.OperatorOptAction(ctx, operatorParams) @@ -142,14 +154,21 @@ func (p Precompile) BindOperatorToAVS( func (p Precompile) UnbindOperatorToAVS( ctx sdk.Context, - origin common.Address, + _ common.Address, contract *vm.Contract, _ vm.StateDB, method *abi.Method, - _ []interface{}, + args []interface{}, ) ([]byte, error) { + if len(args) != len(p.ABI.Methods[MethodRegisterOperatorToAVS].Inputs) { + return nil, fmt.Errorf(cmn.ErrInvalidNumberOfArgs, len(p.ABI.Methods[MethodRegisterOperatorToAVS].Inputs), len(args)) + } + callerAddress, ok := args[0].(common.Address) + if !ok || (callerAddress == common.Address{}) { + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 0, "common.Address", callerAddress) + } operatorParams := &avskeeper.OperatorOptParams{} - operatorParams.OperatorAddress = sdk.AccAddress(origin[:]).String() + operatorParams.OperatorAddress = sdk.AccAddress(callerAddress[:]).String() operatorParams.AvsAddress = contract.CallerAddress.String() operatorParams.Action = avskeeper.DeRegisterAction err := p.avsKeeper.OperatorOptAction(ctx, operatorParams) @@ -162,7 +181,7 @@ func (p Precompile) UnbindOperatorToAVS( // CreateAVSTask Middleware uses exocore's default avstask template to create tasks in avstask module. func (p Precompile) CreateAVSTask( ctx sdk.Context, - origin common.Address, + _ common.Address, contract *vm.Contract, stateDB vm.StateDB, method *abi.Method, @@ -173,7 +192,6 @@ func (p Precompile) CreateAVSTask( return nil, err } params.TaskContractAddress = contract.CallerAddress.String() - params.CallerAddress = sdk.AccAddress(origin[:]).String() err = p.avsKeeper.CreateAVSTask(ctx, params) if err != nil { return nil, err @@ -184,10 +202,66 @@ func (p Precompile) CreateAVSTask( return method.Outputs.Pack(true) } +// Challenge Middleware uses exocore's default avstask template to create tasks in avstask module. +func (p Precompile) Challenge( + ctx sdk.Context, + _ common.Address, + contract *vm.Contract, + _ vm.StateDB, + method *abi.Method, + args []interface{}, +) ([]byte, error) { + if len(args) != len(p.ABI.Methods[MethodChallenge].Inputs) { + return nil, fmt.Errorf(cmn.ErrInvalidNumberOfArgs, len(p.ABI.Methods[MethodChallenge].Inputs), len(args)) + } + challengeParams := &avskeeper.ChallengeParams{} + challengeParams.TaskContractAddress = contract.CallerAddress + callerAddress, ok := args[0].(common.Address) + if !ok || (callerAddress == common.Address{}) { + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 0, "common.Address", callerAddress) + } + challengeParams.CallerAddress = sdk.AccAddress(callerAddress[:]).String() + + taskHash, ok := args[1].([]byte) + if !ok { + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 1, "[]byte", taskHash) + } + challengeParams.TaskHash = taskHash + + taskID, ok := args[2].(uint64) + if !ok { + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 2, "uint64", taskID) + } + challengeParams.TaskID = taskID + + taskResponseHash, ok := args[3].([]byte) + if !ok { + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 3, "[]byte", taskResponseHash) + } + challengeParams.TaskResponseHash = taskResponseHash + + operatorAddress, ok := args[4].(string) + if !ok || operatorAddress == "" { + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 4, "string", operatorAddress) + } + operator, err := sdk.AccAddressFromBech32(operatorAddress) + if err != nil { + return nil, err + } + + challengeParams.OperatorAddress = operator + err = p.avsKeeper.RaiseAndResolveChallenge(ctx, challengeParams) + if err != nil { + return nil, err + } + + return method.Outputs.Pack(true) +} + // RegisterBLSPublicKey func (p Precompile) RegisterBLSPublicKey( ctx sdk.Context, - origin common.Address, + _ common.Address, _ *vm.Contract, _ vm.StateDB, method *abi.Method, @@ -197,7 +271,11 @@ func (p Precompile) RegisterBLSPublicKey( return nil, fmt.Errorf(cmn.ErrInvalidNumberOfArgs, len(p.ABI.Methods[MethodRegisterBLSPublicKey].Inputs), len(args)) } blsParams := &avskeeper.BlsParams{} - blsParams.Operator = sdk.AccAddress(origin[:]).String() + callerAddress, ok := args[0].(common.Address) + if !ok || (callerAddress == common.Address{}) { + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 0, "common.Address", callerAddress) + } + blsParams.Operator = sdk.AccAddress(callerAddress[:]).String() name, ok := args[1].(string) if !ok || name == "" { return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 1, "string", name) @@ -206,7 +284,7 @@ func (p Precompile) RegisterBLSPublicKey( pubkeyBz, ok := args[2].([]byte) if !ok { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 2, "[]byte", pubkeyBz) + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 3, "[]byte", pubkeyBz) } blsParams.PubKey = pubkeyBz diff --git a/precompiles/avs/types.go b/precompiles/avs/types.go index e26cba10e..b34a61d61 100644 --- a/precompiles/avs/types.go +++ b/precompiles/avs/types.go @@ -17,82 +17,90 @@ func (p Precompile) GetAVSParamsFromInputs(_ sdk.Context, args []interface{}) (* return nil, fmt.Errorf(cmn.ErrInvalidNumberOfArgs, len(p.ABI.Methods[MethodRegisterAVS].Inputs), len(args)) } avsParams := &avstypes.AVSRegisterOrDeregisterParams{} - avsName, ok := args[0].(string) + // we'd better not use evm.Origin but let the precompile caller pass in the sender address, + // since tx.origin has some security issue and might not be supported + // in a long term: https://docs.soliditylang.org/en/latest/security-considerations.html#tx-origin + callerAddress, ok := args[0].(common.Address) + if !ok || (callerAddress == common.Address{}) { + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 0, "common.Address", callerAddress) + } + avsParams.CallerAddress = sdk.AccAddress(callerAddress[:]).String() + avsName, ok := args[1].(string) if !ok || avsName == "" { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 0, "string", avsName) + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 1, "string", avsName) } avsParams.AvsName = avsName // When creating tasks in AVS, check the minimum requirements,minStakeAmount at least greater than 0 - minStakeAmount, ok := args[1].(uint64) + minStakeAmount, ok := args[2].(uint64) if !ok || minStakeAmount == 0 { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 1, "uint64", minStakeAmount) + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 2, "uint64", minStakeAmount) } avsParams.MinStakeAmount = minStakeAmount - taskAddr, ok := args[2].(common.Address) + taskAddr, ok := args[3].(common.Address) if !ok || taskAddr == (common.Address{}) { - return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 2, "common.Address", taskAddr) + return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 3, "common.Address", taskAddr) } avsParams.TaskAddr = taskAddr.String() - slashContractAddr, ok := args[3].(common.Address) + slashContractAddr, ok := args[4].(common.Address) if !ok || (slashContractAddr == common.Address{}) { - return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 3, "common.Address", slashContractAddr) + return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 4, "common.Address", slashContractAddr) } avsParams.SlashContractAddr = slashContractAddr.String() - rewardContractAddr, ok := args[4].(common.Address) + rewardContractAddr, ok := args[5].(common.Address) if !ok || (rewardContractAddr == common.Address{}) { - return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 4, "common.Address", rewardContractAddr) + return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 5, "common.Address", rewardContractAddr) } avsParams.RewardContractAddr = rewardContractAddr.String() // bech32 - avsOwnerAddress, ok := args[5].([]string) + avsOwnerAddress, ok := args[6].([]string) if !ok || avsOwnerAddress == nil { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 5, "[]string", avsOwnerAddress) + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 6, "[]string", avsOwnerAddress) } exoAddresses := make([]string, len(avsOwnerAddress)) for i, addr := range avsOwnerAddress { accAddr, err := sdk.AccAddressFromBech32(addr) if err != nil { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 5, "[]string", avsOwnerAddress) + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 6, "[]string", avsOwnerAddress) } exoAddresses[i] = accAddr.String() } avsParams.AvsOwnerAddress = exoAddresses // string, since it is the address_id representation - assetID, ok := args[6].([]string) + assetID, ok := args[7].([]string) if !ok || len(assetID) == 0 { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 6, "[]string", assetID) + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 7, "[]string", assetID) } avsParams.AssetID = assetID - unbondingPeriod, ok := args[7].(uint64) + unbondingPeriod, ok := args[8].(uint64) if !ok || unbondingPeriod == 0 { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 7, "uint64", unbondingPeriod) + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 8, "uint64", unbondingPeriod) } avsParams.UnbondingPeriod = unbondingPeriod - minSelfDelegation, ok := args[8].(uint64) - if !ok || minSelfDelegation == 0 { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 8, "uint64", minSelfDelegation) + minSelfDelegation, ok := args[9].(uint64) + if !ok { + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 9, "uint64", minSelfDelegation) } avsParams.MinSelfDelegation = minSelfDelegation - epochIdentifier, ok := args[9].(string) + epochIdentifier, ok := args[10].(string) if !ok || epochIdentifier == "" { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 9, "string", epochIdentifier) + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 10, "string", epochIdentifier) } avsParams.EpochIdentifier = epochIdentifier // The parameters below are used when creating tasks, to ensure that the minimum criteria are met by the set // of operators. - taskParam, ok := args[10].([]uint64) + taskParam, ok := args[11].([]uint64) if !ok || taskParam == nil || len(taskParam) != 4 { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 10, "[]string", taskParam) + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 11, "[]string", taskParam) } minOptInOperators := taskParam[0] avsParams.MinOptInOperators = minOptInOperators @@ -114,82 +122,88 @@ func (p Precompile) GetAVSParamsFromUpdateInputs(_ sdk.Context, args []interface return nil, fmt.Errorf(cmn.ErrInvalidNumberOfArgs, len(p.ABI.Methods[MethodRegisterAVS].Inputs), len(args)) } avsParams := &avstypes.AVSRegisterOrDeregisterParams{} - avsName, ok := args[0].(string) + callerAddress, ok := args[0].(common.Address) + if !ok || (callerAddress == common.Address{}) { + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 0, "common.Address", callerAddress) + } + avsParams.CallerAddress = sdk.AccAddress(callerAddress[:]).String() + + avsName, ok := args[1].(string) if !ok { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 0, "string", avsName) + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 1, "string", avsName) } avsParams.AvsName = avsName // When creating tasks in AVS, check the minimum requirements,minStakeAmount at least greater than 0 - minStakeAmount, ok := args[1].(uint64) + minStakeAmount, ok := args[2].(uint64) if !ok { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 1, "uint64", minStakeAmount) + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 2, "uint64", minStakeAmount) } avsParams.MinStakeAmount = minStakeAmount - taskAddr, ok := args[2].(common.Address) + taskAddr, ok := args[3].(common.Address) if !ok || taskAddr == (common.Address{}) { - return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 2, "common.Address", taskAddr) + return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 3, "common.Address", taskAddr) } avsParams.TaskAddr = taskAddr.String() - slashContractAddr, ok := args[3].(common.Address) + slashContractAddr, ok := args[4].(common.Address) if !ok { - return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 3, "common.Address", slashContractAddr) + return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 4, "common.Address", slashContractAddr) } avsParams.SlashContractAddr = slashContractAddr.String() - rewardContractAddr, ok := args[4].(common.Address) + rewardContractAddr, ok := args[5].(common.Address) if !ok { - return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 4, "common.Address", rewardContractAddr) + return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 5, "common.Address", rewardContractAddr) } avsParams.RewardContractAddr = rewardContractAddr.String() // bech32 - avsOwnerAddress, ok := args[5].([]string) + avsOwnerAddress, ok := args[6].([]string) if !ok { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 5, "[]string", avsOwnerAddress) + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 6, "[]string", avsOwnerAddress) } exoAddresses := make([]string, len(avsOwnerAddress)) for i, addr := range avsOwnerAddress { accAddr, err := sdk.AccAddressFromBech32(addr) if err != nil { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 5, "[]string", avsOwnerAddress) + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 7, "[]string", avsOwnerAddress) } exoAddresses[i] = accAddr.String() } avsParams.AvsOwnerAddress = exoAddresses // string, since it is the address_id representation - assetID, ok := args[6].([]string) + assetID, ok := args[7].([]string) if !ok { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 6, "[]string", assetID) + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 7, "[]string", assetID) } avsParams.AssetID = assetID - unbondingPeriod, ok := args[7].(uint64) + unbondingPeriod, ok := args[8].(uint64) if !ok { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 7, "uint64", unbondingPeriod) + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 8, "uint64", unbondingPeriod) } avsParams.UnbondingPeriod = unbondingPeriod - minSelfDelegation, ok := args[8].(uint64) + minSelfDelegation, ok := args[9].(uint64) if !ok { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 8, "uint64", minSelfDelegation) + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 9, "uint64", minSelfDelegation) } avsParams.MinSelfDelegation = minSelfDelegation - epochIdentifier, ok := args[9].(string) + epochIdentifier, ok := args[10].(string) if !ok { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 9, "string", epochIdentifier) + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 10, "string", epochIdentifier) } avsParams.EpochIdentifier = epochIdentifier // The parameters below are used when creating tasks, to ensure that the minimum criteria are met by the set // of operators. - taskParam, ok := args[10].([]uint64) + taskParam, ok := args[11].([]uint64) if !ok || taskParam == nil || len(taskParam) != 4 { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 10, "[]string", taskParam) + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 11, "[]string", taskParam) } minOptInOperators := taskParam[0] avsParams.MinOptInOperators = minOptInOperators @@ -206,29 +220,27 @@ func (p Precompile) GetAVSParamsFromUpdateInputs(_ sdk.Context, args []interface return avsParams, nil } -func (p Precompile) GetTaskParamsFromInputs(_ sdk.Context, args []interface{}) (*avskeep.TaskParams, error) { +func (p Precompile) GetTaskParamsFromInputs(_ sdk.Context, args []interface{}) (*avskeep.TaskInfoParams, error) { if len(args) != len(p.ABI.Methods[MethodCreateAVSTask].Inputs) { return nil, fmt.Errorf(cmn.ErrInvalidNumberOfArgs, 3, len(args)) } - taskParams := &avskeep.TaskParams{} - - name, ok := args[0].(string) + taskParams := &avskeep.TaskInfoParams{} + callerAddress, ok := args[0].(common.Address) + if !ok || (callerAddress == common.Address{}) { + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 0, "common.Address", callerAddress) + } + taskParams.CallerAddress = sdk.AccAddress(callerAddress[:]).String() + name, ok := args[1].(string) if !ok || name == "" { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 0, "string", name) + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 1, "string", name) } taskParams.TaskName = name - data, ok := args[1].([]byte) + hash, ok := args[2].([]byte) if !ok { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 1, "[]byte", data) + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 2, "[]byte", hash) } - taskParams.Data = data - - taskID, ok := args[2].(string) - if !ok || taskID == "" { - return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 2, "string", taskID) - } - taskParams.TaskID = taskID + taskParams.Hash = hash taskResponsePeriod, ok := args[3].(uint64) if !ok { @@ -248,5 +260,10 @@ func (p Precompile) GetTaskParamsFromInputs(_ sdk.Context, args []interface{}) ( } taskParams.ThresholdPercentage = thresholdPercentage + taskStatisticalPeriod, ok := args[6].(uint64) + if !ok { + return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 6, "uint64", taskStatisticalPeriod) + } + taskParams.TaskStatisticalPeriod = taskStatisticalPeriod return taskParams, nil } diff --git a/precompiles/avs/utils_test.go b/precompiles/avs/utils_test.go index 916b590c2..ef5563151 100644 --- a/precompiles/avs/utils_test.go +++ b/precompiles/avs/utils_test.go @@ -2,6 +2,7 @@ package avs_test import ( "fmt" + utiltx "github.com/ExocoreNetwork/exocore/testutil/tx" "strings" "time" @@ -93,12 +94,19 @@ func (suite *AVSManagerPrecompileSuite) prepare() { suite.prepareDelegation(true, usdtAddress, delegationAmount) } -func (suite *AVSManagerPrecompileSuite) prepareAvs(assetIDs []string) { +func (suite *AVSManagerPrecompileSuite) prepareAvs(assetIDs []string, task string) { + avsOwnerAddress := []string{ + sdk.AccAddress(suite.Address.Bytes()).String(), + "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr", + "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkj2", + } err := suite.App.AVSManagerKeeper.UpdateAVSInfo(suite.Ctx, &avstypes.AVSRegisterOrDeregisterParams{ Action: avskeeper.RegisterAction, EpochIdentifier: epochstypes.HourEpochID, AvsAddress: suite.avsAddr, AssetID: assetIDs, + TaskAddr: task, + AvsOwnerAddress: avsOwnerAddress, }) suite.NoError(err) } @@ -133,7 +141,7 @@ func (suite *AVSManagerPrecompileSuite) CheckState(expectedState *StateForCheck) func (suite *AVSManagerPrecompileSuite) TestOptIn() { suite.prepare() - suite.prepareAvs([]string{"0xdac17f958d2ee523a2206206994597c13d831ec7_0x65"}) + suite.prepareAvs([]string{"0xdac17f958d2ee523a2206206994597c13d831ec7_0x65"}, utiltx.GenerateAddress().String()) err := suite.App.OperatorKeeper.OptIn(suite.Ctx, suite.operatorAddr, suite.avsAddr) suite.NoError(err) // check if the related state is correct @@ -161,7 +169,7 @@ func (suite *AVSManagerPrecompileSuite) TestOptIn() { func (suite *AVSManagerPrecompileSuite) TestOptInList() { suite.prepare() - suite.prepareAvs([]string{"0xdac17f958d2ee523a2206206994597c13d831ec7_0x65"}) + suite.prepareAvs([]string{"0xdac17f958d2ee523a2206206994597c13d831ec7_0x65"}, utiltx.GenerateAddress().String()) err := suite.App.OperatorKeeper.OptIn(suite.Ctx, suite.operatorAddr, suite.avsAddr) suite.NoError(err) // check if the related state is correct @@ -177,7 +185,7 @@ func (suite *AVSManagerPrecompileSuite) TestOptInList() { func (suite *AVSManagerPrecompileSuite) TestOptOut() { suite.prepare() - suite.prepareAvs([]string{"0xdac17f958d2ee523a2206206994597c13d831ec7_0x65"}) + suite.prepareAvs([]string{"0xdac17f958d2ee523a2206206994597c13d831ec7_0x65"}, utiltx.GenerateAddress().String()) err := suite.App.OperatorKeeper.OptOut(suite.Ctx, suite.operatorAddr, suite.avsAddr) suite.EqualError(err, operatorTypes.ErrNotOptedIn.Error()) diff --git a/proto/exocore/avs/v1/query.proto b/proto/exocore/avs/v1/query.proto index 99015e6c1..3c4cb11f0 100644 --- a/proto/exocore/avs/v1/query.proto +++ b/proto/exocore/avs/v1/query.proto @@ -37,9 +37,43 @@ message QueryAVSTaskInfoReq { // task_addr is the task contract address,its type should be a sdk.AccAddress string task_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // task_id is the task identifier + string task_id = 2 ; +} + +// QuerySubmitTaskResultReq is the request to obtain the task information. +message QuerySubmitTaskResultReq { + // task_addr is the task contract address,its type should be a sdk.AccAddress + string task_addr = 1 [(gogoproto.customname) = "TaskAddress"]; + // task_id is the task identifier + string task_id = 2 ; + // operator_addr is the operator address,its type should be a sdk.AccAddress + string operator_addr = 3 + [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// QueryChallengeInfoReq is the request to obtain the task information. +message QueryChallengeInfoReq { + // task_addr is the task contract address,its type should be a sdk.AccAddress + string task_addr = 1 [(gogoproto.customname) = "TaskAddress"]; + // task_id is the task identifier string task_id = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // operator_addr is the operator address,its type should be a sdk.AccAddress + string operator_addr = 3 + [(cosmos_proto.scalar) = "cosmos.AddressString"]; } + +// QuerySubmitTaskResultResponse is the response of avs related information +message QuerySubmitTaskResultResponse { + // info is the taskResult. + TaskResultInfo info = 1; +} + +// QueryChallengeInfoResponse is the response of avs related information +message QueryChallengeInfoResponse { + // challenge_addr is the challenge address,its type should be a common.HexAddress. + string challenge_addr = 1; +} // Query defines the gRPC querier service. service Query { // Parameters queries the parameters of the module. @@ -54,4 +88,12 @@ service Query { rpc QueryAVSAddrByChainID(QueryAVSAddrByChainIDReq) returns (QueryAVSAddrByChainIDResponse) { option (google.api.http).get = "/exocore/avs/QueryAVSAddrByChainID"; } + // Parameters queries the parameters of the module. + rpc QuerySubmitTaskResult(QuerySubmitTaskResultReq) returns (QuerySubmitTaskResultResponse) { + option (google.api.http).get = "/exocore/avs/QuerySubmitTaskResult"; + } + // Parameters queries the parameters of the module. + rpc QueryChallengeInfo(QueryChallengeInfoReq) returns (QueryChallengeInfoResponse) { + option (google.api.http).get = "/exocore/avs/QueryChallengeInfo"; + } } \ No newline at end of file diff --git a/proto/exocore/avs/v1/tx.proto b/proto/exocore/avs/v1/tx.proto index f5ff9d60c..5a368b727 100644 --- a/proto/exocore/avs/v1/tx.proto +++ b/proto/exocore/avs/v1/tx.proto @@ -81,20 +81,65 @@ message TaskInfo { // name of task string name = 2; // data which is supplied by the contract, usually ABI-encoded - bytes data = 3; + bytes hash = 3; // task_id of task - string task_id = 4; + uint64 task_id = 4; // Deadline for task response uint64 task_response_period = 5; + // Statistical period: threshold calculation, signature verification, + // nosig quantity statistics, operator submits messages corresponding to signatures + uint64 task_statistical_period = 6; //challenge period for task - uint64 task_challenge_period = 6; + uint64 task_challenge_period = 7; //Signature threshold percentage - uint64 threshold_percentage = 7; + uint64 threshold_percentage = 8; // Effective current epoch, accounting for current_epoch + 1 // and current_epoch is the integer identifier of the epoch module - uint64 starting_epoch = 8; + uint64 starting_epoch = 9; + + + // actual_threshold is the Actual threshold + uint64 actual_threshold = 10; + // opt_in_count when creating a task, the actual opt-in operator counts at this moment + repeated string opt_in_operators = 11; + // signed_count is Actual number of signatures already signed + repeated string signed_operators = 12; + // no_signed_count is the final number of unsigned operators + repeated string no_signed_operators = 13; + // err_signed_count is the number of operators with final incorrect signatures + repeated string err_signed_operators = 14; + // task_total_power is the USD value owned by the avs task itself. + string task_total_power = 15 + [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false, + (gogoproto.customname) = "TaskTotalPower" + ]; + // operator_active_power_list is a power list of operators opt-in to the current task + OperatorActivePowerList operator_active_power= 16; +} +// OperatorActivePowerList is the power list of operators opt-in to the current task. +// Because power is always changing, record the power of all operators +// who have completed tasks and submitted results by the task deadline +message OperatorActivePowerList { + // operator_power_list is a power list of operators. + repeated OperatorActivePowerInfo operator_power_list = 1; } +// OperatorActivePowerInfo is the operator power info. +message OperatorActivePowerInfo { + // operator_addr is the operator address. + string operator_addr = 1; + // active_power is the USD value owned by the operator itself. + string active_power = 2 + [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false, + (gogoproto.customname) = "SelfActivePower" + ]; +} // BlsPubKeyInfo is the task info. message BlsPubKeyInfo { // operator address @@ -164,6 +209,40 @@ message DeRegisterAVSResponse { AVSInfo info = 2; } +// TaskResultInfo is the operator sign task info result. +message TaskResultInfo { + // operator_address operator address + string operator_address = 1; + // task_response_hash is the task_response msg hash. + string task_response_hash = 2; + // task_response is the task response data. + bytes task_response = 3; + // bls_signature is the operator bls sig info. + bytes bls_signature = 4; + // task_contract_address is contract address of task + string task_contract_address = 5; + // task_id is the task id + uint64 task_id = 6; + // stage this field is used to solve the problem of task results being copied by other operators. + // It is a two-stage submission with two values, 1 and 2 + string stage = 7; +} + +// SubmitTaskResultReq is the request to submit task results. +message SubmitTaskResultReq { + option (cosmos.msg.v1.signer) = "FromAddress"; + option (amino.name) = "cosmos-sdk/OperatorInfo"; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // from_address is the address of the operator (sdk.AccAddress). + string from_address = 1 + [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // info is the taskResult. + TaskResultInfo info = 2; +} +// SubmitTaskResultResponse is the response to submit task results. +message SubmitTaskResultResponse {} // Msg defines the AVS related Msg service. service Msg { option (cosmos.msg.v1.service) = true; @@ -179,4 +258,8 @@ service Msg { rpc RegisterAVSTask(RegisterAVSTaskReq) returns (RegisterAVSTaskResponse) { option (google.api.http).post = "/exocore/avs/v1/tx/RegisterAVSTask"; }; + // SubmitTaskResult operator submit task results . + rpc SubmitTaskResult (SubmitTaskResultReq) returns (SubmitTaskResultResponse) { + option (google.api.http).post = "/exocore/avs/v1/tx/SubmitTaskResult"; + }; } \ No newline at end of file diff --git a/proto/exocore/operator/v1/query.proto b/proto/exocore/operator/v1/query.proto index 44ad4720c..05740969f 100644 --- a/proto/exocore/operator/v1/query.proto +++ b/proto/exocore/operator/v1/query.proto @@ -185,6 +185,34 @@ message OperatorConsAddrPair { bool opting_out = 3; } + +// QueryAllOperatorsWithOptInAVSRequest is the request to obtain all opt-in operator addresses +// for a specific avs with pagination. +message QueryAllOperatorsByOptInAVSRequest { + // avs address + string avs = 1; +} + +// QueryAllOperatorsWithOptInAVSResponse is the response that includes a list of all avs +// for a specified operator address. +message QueryAllOperatorsByOptInAVSResponse { + // operator_list is a list of operator addresses. + repeated string operator_list = 1; +} + +// QueryAllAVSsByOperatorRequest is the request to obtain all operator addresses +// and consensus keys for a specific chain ID, with pagination. +message QueryAllAVSsByOperatorRequest { + // operator address. + string operator = 1; +} + +// QueryAllAVSsByOperatorResponse is the response that includes a list of all operators +// and their consensus keys for a specified chain ID. +message QueryAllAVSsByOperatorResponse { + // avs_list is a list of avs addresses . + repeated string avs_list = 1; +} // Query defines the gRPC querier service. service Query { // QueryOperatorInfo queries the operator information. @@ -251,4 +279,19 @@ service Query { get: "/exocore/operator/v1/all_operator_cons_addrs/{chain}" }; } + + // QueryAllOperatorsWithOptInAVS queries operator list by avs. + rpc QueryAllOperatorsWithOptInAVS(QueryAllOperatorsByOptInAVSRequest) returns ( + QueryAllOperatorsByOptInAVSResponse) { + option (google.api.http) = { + get: "/exocore/operator/v1/opt/operator_list/{avs}" + }; + } + + // QueryAllAVSsByOperator queries avs list. + rpc QueryAllAVSsByOperator(QueryAllAVSsByOperatorRequest) returns (QueryAllAVSsByOperatorResponse) { + option (google.api.http) = { + get: "/exocore/operator/v1/opt/avs_list/{operator}" + }; + } } \ No newline at end of file diff --git a/x/avs/client/cli/query.go b/x/avs/client/cli/query.go index 153b6db1c..7d869c76d 100644 --- a/x/avs/client/cli/query.go +++ b/x/avs/client/cli/query.go @@ -1,3 +1,4 @@ +//nolint:dupl package cli import ( @@ -25,18 +26,23 @@ func GetQueryCmd(_ string) *cobra.Command { RunE: client.ValidateCmd, } - cmd.AddCommand(QueryAVSInfo()) - cmd.AddCommand(QueryAVSAddrByChainID()) - cmd.AddCommand(QueryTaskInfo()) + cmd.AddCommand( + QueryAVSInfo(), + QueryAVSAddrByChainID(), + QueryTaskInfo(), + QueryChallengeInfo(), + QuerySubmitTaskResult(), + ) return cmd } func QueryAVSInfo() *cobra.Command { cmd := &cobra.Command{ - Use: "AVSInfo query", - Short: "AVSInfo query", - Long: "AVSInfo query for current registered AVS", - Args: cobra.ExactArgs(1), + Use: "AVSInfo query ", + Short: "AVSInfo query", + Long: "AVSInfo query for current registered AVS", + Example: "exocored query avs AVSInfo 0x598ACcB5e7F83cA6B19D70592Def9E5b25B978CA", + Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { if !common.IsHexAddress(args[0]) { return xerrors.Errorf("invalid avs address,err:%s", types.ErrInvalidAddr) @@ -92,10 +98,11 @@ func QueryAVSAddrByChainID() *cobra.Command { func QueryTaskInfo() *cobra.Command { cmd := &cobra.Command{ - Use: "TaskInfo ", - Short: "Query the TaskInfo by its address and ID", - Long: "Query the currently registered tasks for an AVS by the task's address and ID", - Args: cobra.ExactArgs(2), + Use: "TaskInfo ", + Short: "Query the TaskInfo by its address and ID", + Long: "Query the currently registered tasks for an AVS by the task's address and ID", + Example: "exocored query avs TaskInfo 0x96949787E6a209AFb4dE035754F79DC9982D3F2a 2", + Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { if !common.IsHexAddress(args[0]) { return xerrors.Errorf("invalid task address,err:%s", types.ErrInvalidAddr) @@ -120,3 +127,69 @@ func QueryTaskInfo() *cobra.Command { flags.AddQueryFlagsToCmd(cmd) return cmd } + +func QuerySubmitTaskResult() *cobra.Command { + cmd := &cobra.Command{ + Use: "SubmitTaskResult ", + Short: "Query the SubmitTaskResult by taskAddr taskID operatorAddr", + Long: "Query the currently submitted Task Result", + Example: "exocored query avs ChallengeInfo 0x96949787E6a209AFb4dE035754F79DC9982D3F2a 2 exo1mq6pj6f5tafmgkk6lehew5radfq3w20gpegzs5", + 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) + } + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + req := types.QuerySubmitTaskResultReq{ + TaskAddress: args[0], + TaskId: args[1], + OperatorAddr: args[2], + } + res, err := queryClient.QuerySubmitTaskResult(context.Background(), &req) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +func QueryChallengeInfo() *cobra.Command { + cmd := &cobra.Command{ + Use: "ChallengeInfo ", + Short: "Query the ChallengeInfo by taskAddr taskID operatorAddr", + Long: "Query the currently Challenge Info ", + Example: "exocored query avs ChallengeInfo 0x96949787E6a209AFb4dE035754F79DC9982D3F2a 2 exo1mq6pj6f5tafmgkk6lehew5radfq3w20gpegzs5", + 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) + } + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + req := types.QueryChallengeInfoReq{ + TaskAddress: args[0], + TaskId: args[1], + OperatorAddr: args[2], + } + res, err := queryClient.QueryChallengeInfo(context.Background(), &req) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/avs/client/cli/tx.go b/x/avs/client/cli/tx.go index 8b6e84a5e..269c791e5 100644 --- a/x/avs/client/cli/tx.go +++ b/x/avs/client/cli/tx.go @@ -1,10 +1,10 @@ package cli import ( + "encoding/hex" "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" - "golang.org/x/xerrors" + "github.com/spf13/pflag" "github.com/ExocoreNetwork/exocore/x/avs/types" "github.com/cosmos/cosmos-sdk/client" @@ -13,63 +13,113 @@ import ( "github.com/spf13/cobra" ) +const ( + FlagOperatorAddress = "operator-address" + FlagTaskResponse = "task-response" + FlagBlsSignature = "bls-signature" + FlagTaskContractAddress = "task-contract-address" + FlagTaskID = "task-id" + FlagStage = "stage" +) + // GetTxCmd returns the transaction commands for this module func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ + txCmd := &cobra.Command{ Use: types.ModuleName, Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), DisableFlagParsing: true, SuggestionsMinimumDistance: 2, RunE: client.ValidateCmd, } - - return cmd + txCmd.AddCommand( + CmdSubmitTaskResult(), + ) + return txCmd } -func RegisterAVS() *cobra.Command { +// CmdSubmitTaskResult returns a CLI command handler for submit a TaskResult +// transaction. +func CmdSubmitTaskResult() *cobra.Command { cmd := &cobra.Command{ - Use: "RegisterAVS: AvsName, AvsAddress, OperatorAddress, AvsOwnerAddress, AssetId", - Short: "register to be an avs", - Args: cobra.MinimumNArgs(5), - RunE: func(cmd *cobra.Command, args []string) error { - cliCtx, err := client.GetClientTxContext(cmd) + Use: "submit-task-result", + Short: "submit task result", + RunE: func(cmd *cobra.Command, _ []string) error { + clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err } - sender := cliCtx.GetFromAddress() - fromAddress := sender.String() - // Validate parameters - _, err = sdk.AccAddressFromBech32(args[1]) - if err != nil { - return xerrors.Errorf("invalid address,err:%s", err.Error()) - } - - _, err = sdk.AccAddressFromBech32(args[2]) - if err != nil { - return xerrors.Errorf("invalid address,err:%s", err.Error()) - } - - _, err = sdk.AccAddressFromBech32(args[3]) + txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) if err != nil { - return xerrors.Errorf("invalid address,err:%s", err.Error()) + return err } - msg := &types.RegisterAVSReq{ - FromAddress: fromAddress, - Info: &types.AVSInfo{ - Name: args[0], - AvsAddress: args[1], - SlashAddr: args[2], - AvsOwnerAddress: []string{args[3]}, - AssetIDs: []string{args[4]}, - }, - } + msg := newBuildMsg(clientCtx, cmd.Flags()) - return tx.GenerateOrBroadcastTxCLI(cliCtx, cmd.Flags(), msg) + // this calls ValidateBasic internally so we don't need to do that. + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) }, } + f := cmd.Flags() + f.String( + FlagOperatorAddress, "", "The address of the operator being queried "+ + " If not provided, it will default to the sender's address.", + ) + f.String( + FlagTaskResponse, "", "The task response data", + ) + f.String( + FlagBlsSignature, "", "The operator bls sig info", + ) + f.String( + FlagTaskContractAddress, "", "The contract address of task", + ) + f.Uint64( + FlagTaskID, 1, "The task id", + ) + f.String( + FlagStage, "", "The stage is a two-stage submission with two values, 1 and 2", + ) + // #nosec G703 // this only errors if the flag isn't defined. + _ = cmd.MarkFlagRequired(FlagTaskID) + _ = cmd.MarkFlagRequired(FlagBlsSignature) + _ = cmd.MarkFlagRequired(FlagTaskContractAddress) + _ = cmd.MarkFlagRequired(FlagStage) + + // transaction level flags from the SDK flags.AddTxFlagsToCmd(cmd) + return cmd } + +func newBuildMsg( + clientCtx client.Context, fs *pflag.FlagSet, +) *types.SubmitTaskResultReq { + sender := clientCtx.GetFromAddress() + operatorAddress, _ := fs.GetString(FlagOperatorAddress) + if operatorAddress == "" { + operatorAddress = sender.String() + } + taskResponse, _ := fs.GetString(FlagTaskResponse) + taskRes, _ := hex.DecodeString(taskResponse) + blsSignature, _ := fs.GetString(FlagBlsSignature) + sig, _ := hex.DecodeString(blsSignature) + taskContractAddress, _ := fs.GetString(FlagTaskContractAddress) + + taskID, _ := fs.GetUint64(FlagTaskID) + stage, _ := fs.GetString(FlagStage) + + msg := &types.SubmitTaskResultReq{ + FromAddress: sender.String(), + Info: &types.TaskResultInfo{ + OperatorAddress: operatorAddress, + TaskResponse: taskRes, + BlsSignature: sig, + TaskContractAddress: taskContractAddress, + TaskId: taskID, + Stage: stage, + }, + } + return msg +} diff --git a/x/avs/keeper/avs.go b/x/avs/keeper/avs.go index 0ae2b0b18..d803e6bae 100644 --- a/x/avs/keeper/avs.go +++ b/x/avs/keeper/avs.go @@ -3,6 +3,7 @@ package keeper import ( "fmt" "math/big" + "strconv" errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" @@ -80,8 +81,12 @@ func (k *Keeper) GetEpochEndAVSs(ctx sdk.Context, epochIdentifier string, ending } // GetAVSInfoByTaskAddress returns the AVS which containing this task address +// TODO:this function is frequently used while its implementation iterates over existing avs to find the target avs by task contract address, we should use a reverse mapping to avoid iteration func (k *Keeper) GetAVSInfoByTaskAddress(ctx sdk.Context, taskAddr string) types.AVSInfo { avs := types.AVSInfo{} + if taskAddr == "" { + return avs + } k.IterateAVSInfo(ctx, func(_ int64, avsInfo types.AVSInfo) (stop bool) { if taskAddr == avsInfo.GetTaskAddr() { avs = avsInfo @@ -91,19 +96,25 @@ func (k *Keeper) GetAVSInfoByTaskAddress(ctx sdk.Context, taskAddr string) types return avs } -// GetTaskChallengeEpochEndAVSs returns the task list where the current block marks the end of their challenge period. -func (k *Keeper) GetTaskChallengeEpochEndAVSs(ctx sdk.Context, epochIdentifier string, epochNumber int64) []types.TaskInfo { - var taskList []types.TaskInfo - k.IterateTaskAVSInfo(ctx, func(_ int64, taskInfo types.TaskInfo) (stop bool) { - avsInfo := k.GetAVSInfoByTaskAddress(ctx, taskInfo.TaskContractAddress) - // Determine if the challenge period has passed, the range of the challenge period is the num marked (StartingEpoch) add TaskChallengePeriod +// GetTaskStatisticalEpochEndAVSs returns the task list where the current block marks the end of their statistical period. +func (k *Keeper) GetTaskStatisticalEpochEndAVSs(ctx sdk.Context, epochIdentifier string, epochNumber int64) []types.TaskResultInfo { + var taskResList []types.TaskResultInfo + k.IterateResultInfo(ctx, func(_ int64, info types.TaskResultInfo) (stop bool) { + avsInfo := k.GetAVSInfoByTaskAddress(ctx, info.TaskContractAddress) + taskInfo, err := k.GetTaskInfo(ctx, strconv.FormatUint(info.TaskId, 10), info.TaskContractAddress) + if err != nil { + return false + } + // Determine if the statistical period has passed, the range of the statistical period is the num marked (StartingEpoch) add TaskStatisticalPeriod // #nosec G115 - if epochIdentifier == avsInfo.EpochIdentifier && epochNumber > int64(taskInfo.TaskChallengePeriod)+int64(taskInfo.StartingEpoch) { - taskList = append(taskList, taskInfo) + if epochIdentifier == avsInfo.EpochIdentifier && epochNumber == + // #nosec G115 + int64(taskInfo.StartingEpoch)+int64(taskInfo.TaskResponsePeriod)+int64(taskInfo.TaskStatisticalPeriod) { + taskResList = append(taskResList, info) } return false }) - return taskList + return taskResList } // RegisterAVSWithChainID registers an AVS by its chainID. diff --git a/x/avs/keeper/bls_test.go b/x/avs/keeper/bls_test.go new file mode 100644 index 000000000..25417f215 --- /dev/null +++ b/x/avs/keeper/bls_test.go @@ -0,0 +1,121 @@ +package keeper_test + +import ( + "encoding/hex" + "fmt" + "github.com/ExocoreNetwork/exocore/x/avs/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/prysmaticlabs/prysm/v4/crypto/bls/blst" + blscommon "github.com/prysmaticlabs/prysm/v4/crypto/bls/common" + "math/big" +) + +func (suite *AVSTestSuite) TestOperator_pubkey() { + operatorAddr := "exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr" + + privateKey, err := blst.RandKey() + fmt.Println("privateKey:", hex.EncodeToString(privateKey.Marshal())) + + publicKey := privateKey.PublicKey() + blsPub := &types.BlsPubKeyInfo{ + Operator: operatorAddr, + PubKey: publicKey.Marshal(), + Name: "", + } + fmt.Println("pubkey:", hex.EncodeToString(publicKey.Marshal())) + err = suite.App.AVSManagerKeeper.SetOperatorPubKey(suite.Ctx, blsPub) + suite.NoError(err) + + pub, err := suite.App.AVSManagerKeeper.GetOperatorPubKey(suite.Ctx, operatorAddr) + suite.NoError(err) + suite.Equal(publicKey.Marshal(), pub.PubKey) + + taskRes := types.TaskResponse{TaskID: 1, NumberSum: big.NewInt(1000)} + + hash, _ := types.GetTaskResponseDigestEncodeByjson(taskRes) + + msgBytes := hash[:] + fmt.Println("ResHash:", hex.EncodeToString(msgBytes)) + + sig := privateKey.Sign(msgBytes) + fmt.Println("sig:", hex.EncodeToString(sig.Marshal())) + + valid := sig.Verify(publicKey, msgBytes) + suite.True(valid) + + valid1, _ := blst.VerifySignature(sig.Marshal(), hash, publicKey) + suite.NoError(err) + + suite.True(valid1) + + jsonData, err := types.MarshalTaskResponse(taskRes) + fmt.Println("jsondata:", hex.EncodeToString(jsonData)) +} + +func (suite *AVSTestSuite) Test_hash() { + taskres := types.TaskResponse{TaskID: 1, NumberSum: big.NewInt(100)} + jsonData, err := types.MarshalTaskResponse(taskres) + suite.NoError(err) + hash := crypto.Keccak256Hash(jsonData) + taskResponseDigest := hash.Bytes() + suite.Equal(len(taskResponseDigest), 32) +} + +// For deterministic result(msg), aggregate signatures and verify them +func (suite *AVSTestSuite) Test_bls_agg() { + taskres := types.TaskResponse{TaskID: 1, NumberSum: big.NewInt(100)} + jsonData, _ := types.MarshalTaskResponse(taskres) + msg := crypto.Keccak256Hash(jsonData) + privateKeys := make([]blscommon.SecretKey, 4) + publicKeys := make([]blscommon.PublicKey, 4) + + sigs := make([]blscommon.Signature, 4) + for i := 0; i < 4; i++ { + privateKey, _ := blst.RandKey() + privateKeys[i] = privateKey + publicKeys[i] = privateKey.PublicKey() + sigs[i] = privateKey.Sign(msg[:]) + } + + aggPublicKey := blst.AggregateMultiplePubkeys(publicKeys) + + aggSignature := blst.AggregateSignatures(sigs) + + valid := aggSignature.Verify(aggPublicKey, msg.Bytes()) + + suite.True(valid, "Signature verification failed") + + valid1 := aggSignature.FastAggregateVerify(publicKeys, msg) + suite.True(valid1, "Signature verification failed") +} + +// For uncertain results, i.e. multiple msgs, the test aggregation signature verification fails +func (suite *AVSTestSuite) Test_bls_agg_uncertainMsgs() { + privateKeys := make([]blscommon.SecretKey, 4) + publicKeys := make([]blscommon.PublicKey, 4) + msgs := make([][]byte, 4) + sigs := make([]blscommon.Signature, 4) + for i := 0; i < 4; i++ { + privateKey, _ := blst.RandKey() + privateKeys[i] = privateKey + publicKeys[i] = privateKey.PublicKey() + msgs[i] = []byte{byte(i)} + sigs[i] = privateKey.Sign([]byte{byte(i)}) + } + + aggPublicKey := blst.AggregateMultiplePubkeys(publicKeys) + + aggSignature := blst.AggregateSignatures(sigs) + + valid := aggSignature.Verify(aggPublicKey, msgs[1]) + + suite.False(valid, "Signature verification failed") + + var array32 [32]byte + + // Copy data into the 32-byte array + copy(array32[:], msgs[1]) + valid1 := aggSignature.FastAggregateVerify(publicKeys, array32) + suite.False(valid1, "Signature verification failed") + +} diff --git a/x/avs/keeper/epoch_test.go b/x/avs/keeper/epoch_test.go new file mode 100644 index 000000000..d5c0eac41 --- /dev/null +++ b/x/avs/keeper/epoch_test.go @@ -0,0 +1,47 @@ +package keeper_test + +import ( + avstypes "github.com/ExocoreNetwork/exocore/x/avs/types" + "github.com/ethereum/go-ethereum/common" + "strconv" +) + +func (suite *AVSTestSuite) Test_GroupStatistics() { + tasks := []avstypes.TaskResultInfo{ + {OperatorAddress: "addr1", TaskResponseHash: "hash1", TaskResponse: []byte("response1"), BlsSignature: []byte("sig1"), TaskContractAddress: "contract1", TaskId: 1}, + {OperatorAddress: "addr2", TaskResponseHash: "hash2", TaskResponse: []byte("response2"), BlsSignature: []byte("sig2"), TaskContractAddress: "contract2", TaskId: 2}, + {OperatorAddress: "addr3", TaskResponseHash: "hash3", TaskResponse: []byte("response3"), BlsSignature: []byte("sig3"), TaskContractAddress: "contract1", TaskId: 1}, + } + + groupedTasks := suite.App.AVSManagerKeeper.GroupTasksByIDAndAddress(tasks) + suite.Equal(2, len(groupedTasks["contract1_1"])) +} +func (suite *AVSTestSuite) TestEpochEnd_TaskCalculation() { + suite.TestSubmitTask_OnlyPhaseTwo_Mul() + suite.CommitAfter(suite.EpochDuration) + suite.CommitAfter(suite.EpochDuration) + suite.CommitAfter(suite.EpochDuration) + info, err := suite.App.AVSManagerKeeper.GetTaskInfo(suite.Ctx, strconv.FormatUint(suite.taskId, 10), common.Address(suite.taskAddress.Bytes()).String()) + suite.NoError(err) + expectInfo := &avstypes.TaskInfo{ + TaskContractAddress: suite.taskAddress.String(), + Name: "test-avsTask", + TaskId: suite.taskId, + Hash: []byte("req-struct"), + TaskResponsePeriod: 2, + TaskStatisticalPeriod: 1, + TaskChallengePeriod: 2, + ThresholdPercentage: 90, + StartingEpoch: 20, + OptInOperators: suite.operatorAddresses, + NoSignedOperators: nil, + SignedOperators: suite.operatorAddresses, + ActualThreshold: 7766279631452241920, + } + diff := avstypes.Difference(expectInfo.SignedOperators, info.SignedOperators) + + suite.Equal(0, len(diff)) + suite.Equal(expectInfo.NoSignedOperators, info.NoSignedOperators) + suite.Equal(expectInfo.ActualThreshold, info.ActualThreshold) + +} diff --git a/x/avs/keeper/impl_epoch_hook.go b/x/avs/keeper/impl_epoch_hook.go index 60f7c9d10..73d619b86 100644 --- a/x/avs/keeper/impl_epoch_hook.go +++ b/x/avs/keeper/impl_epoch_hook.go @@ -1,6 +1,11 @@ package keeper import ( + "strconv" + + "github.com/ExocoreNetwork/exocore/x/avs/types" + + sdkmath "cosmossdk.io/math" epochstypes "github.com/ExocoreNetwork/exocore/x/epochs/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -22,12 +27,84 @@ func (k *Keeper) EpochsHooks() EpochsHooksWrapper { // AfterEpochEnd is called after an epoch ends. It is called during the BeginBlock function. func (wrapper EpochsHooksWrapper) AfterEpochEnd( - _ sdk.Context, _ string, _ int64, + ctx sdk.Context, epochIdentifier string, epochNumber int64, ) { - // get all the avs address bypass the epoch end - // _ = wrapper.keeper.GetEpochEndAVSs(ctx, epochIdentifier, epochNumber) + // get all the task info bypass the epoch end + // threshold calculation, signature verification, nosig quantity statistics + taskResList := wrapper.keeper.GetTaskStatisticalEpochEndAVSs(ctx, epochIdentifier, epochNumber) + // TODO:There should be a retry mechanism or compensation mechanism to handle cases of failure + if len(taskResList) != 0 { + groupedTasks := wrapper.keeper.GroupTasksByIDAndAddress(taskResList) + for _, value := range groupedTasks { + var signedOperatorList []string + var taskID uint64 + var taskAddr string + var avsAddr string + var operatorPowers []*types.OperatorActivePowerInfo + operatorPowerTotal := sdkmath.LegacyNewDec(0) + for _, res := range value { + // Find signed operators + if res.BlsSignature != nil { + signedOperatorList = append(signedOperatorList, res.OperatorAddress) + if avsAddr == "" { + avsInfo := wrapper.keeper.GetAVSInfoByTaskAddress(ctx, res.TaskContractAddress) + avsAddr = avsInfo.AvsAddress + } + if taskID == 0 { + taskID = res.TaskId + } + if taskAddr == "" { + taskAddr = res.TaskContractAddress + } + power, err := wrapper.keeper.operatorKeeper.GetOperatorOptedUSDValue(ctx, avsAddr, res.OperatorAddress) + if err != nil || power.ActiveUSDValue.IsNegative() { + ctx.Logger().Error("Failed to update task result statistics,GetOperatorOptedUSDValue call failed!", "task result", taskAddr, "error", err) + // Handle the error gracefully, continue to the next + // continue + } + + operatorSelfPower := &types.OperatorActivePowerInfo{ + OperatorAddr: res.OperatorAddress, + SelfActivePower: power.ActiveUSDValue, + } + operatorPowers = append(operatorPowers, operatorSelfPower) + operatorPowerTotal = operatorPowerTotal.Add(power.ActiveUSDValue) + } + } + taskInfo, err := wrapper.keeper.GetTaskInfo(ctx, strconv.FormatUint(taskID, 10), taskAddr) + if err != nil { + ctx.Logger().Error("Failed to update task result statistics,GetTaskInfo call failed!", "task result", taskAddr, "error", err) + // Handle the error gracefully, continue to the next + // continue + } + diff := types.Difference(taskInfo.OptInOperators, signedOperatorList) + taskInfo.SignedOperators = signedOperatorList + taskInfo.NoSignedOperators = diff + taskInfo.OperatorActivePower = &types.OperatorActivePowerList{OperatorPowerList: operatorPowers} + // Calculate actual threshold + taskPowerTotal, err := wrapper.keeper.operatorKeeper.GetAVSUSDValue(ctx, avsAddr) + + if err != nil || taskPowerTotal.IsZero() || operatorPowerTotal.IsZero() { + ctx.Logger().Error("Failed to update task result statistics,GetAVSUSDValue call failed!", "task result", taskAddr, "error", err) + // Handle the error gracefully, continue to the next + // continue + } + taskInfo.TaskTotalPower = taskPowerTotal + + if !taskPowerTotal.IsZero() && !operatorPowerTotal.IsZero() { + actualThreshold := taskPowerTotal.Quo(operatorPowerTotal).Mul(sdk.NewDec(100)) + taskInfo.ActualThreshold = actualThreshold.BigInt().Uint64() + } - // _ = wrapper.keeper.GetTaskChallengeEpochEndAVSs(ctx, epochIdentifier, epochNumber) + // Update the taskInfo in the state + err = wrapper.keeper.SetTaskInfo(ctx, taskInfo) + if err != nil { + ctx.Logger().Error("Failed to update task result statistics,SetTaskInfo call failed!", "task result", taskAddr, "error", err) + // Handle the error gracefully, continue to the next + // continue + } + } + } } // BeforeEpochStart is called before an epoch starts. diff --git a/x/avs/keeper/keeper.go b/x/avs/keeper/keeper.go index 5a7cd0355..db697dc87 100644 --- a/x/avs/keeper/keeper.go +++ b/x/avs/keeper/keeper.go @@ -1,8 +1,13 @@ package keeper import ( + "encoding/hex" "fmt" "slices" + "strconv" + + "github.com/prysmaticlabs/prysm/v4/crypto/bls" + "github.com/prysmaticlabs/prysm/v4/crypto/bls/blst" "github.com/ethereum/go-ethereum/common" @@ -73,6 +78,9 @@ func (k Keeper) UpdateAVSInfo(ctx sdk.Context, params *types.AVSRegisterOrDeregi if avsInfo != nil { return errorsmod.Wrap(types.ErrAlreadyRegistered, fmt.Sprintf("the avsaddress is :%s", params.AvsAddress)) } + if k.GetAVSInfoByTaskAddress(ctx, params.TaskAddr).AvsAddress != "" { + return errorsmod.Wrap(types.ErrAlreadyRegistered, fmt.Sprintf("this TaskAddr has already been used by other AVS,the TaskAddr is :%s", params.TaskAddr)) + } startingEpoch := uint64(epoch.CurrentEpoch + 1) if params.ChainID == types.ChainIDWithoutRevision(ctx.ChainID()) { // TODO: handle this better @@ -94,8 +102,10 @@ func (k Keeper) UpdateAVSInfo(ctx sdk.Context, params *types.AVSRegisterOrDeregi TaskAddr: params.TaskAddr, MinStakeAmount: params.MinStakeAmount, // Effective at CurrentEpoch+1, avoid immediate effects and ensure that the first epoch time of avs is equal to a normal identifier MinTotalStakeAmount: params.MinTotalStakeAmount, - AvsSlash: sdk.NewDecWithPrec(int64(params.AvsSlash), 2), // #nosec G115 - AvsReward: sdk.NewDecWithPrec(int64(params.AvsReward), 2), // #nosec G115 + // #nosec G115 + AvsSlash: sdk.NewDecWithPrec(int64(params.AvsSlash), 2), + // #nosec G115 + AvsReward: sdk.NewDecWithPrec(int64(params.AvsReward), 2), } return k.SetAVSInfo(ctx, avs) @@ -123,11 +133,18 @@ func (k Keeper) UpdateAVSInfo(ctx sdk.Context, params *types.AVSRegisterOrDeregi if avsInfo == nil { return errorsmod.Wrap(types.ErrUnregisterNonExistent, fmt.Sprintf("the avsaddress is :%s", params.AvsAddress)) } + if k.GetAVSInfoByTaskAddress(ctx, params.TaskAddr).AvsAddress != "" { + return errorsmod.Wrap(types.ErrAlreadyRegistered, fmt.Sprintf("this TaskAddr has already been used by other AVS,the TaskAddr is :%s", params.TaskAddr)) + } // TODO: The AvsUnbondingPeriod is used for undelegation, but this check currently blocks updates to AVS information. Remove this check to allow AVS updates, while detailed control mechanisms for updates should be considered and implemented in the future. // If avs UpdateAction check UnbondingPeriod - /* if int64(avsInfo.Info.AvsUnbondingPeriod) < (epoch.CurrentEpoch - int64(avsInfo.GetInfo().StartingEpoch)) { - return errorsmod.Wrap(types.ErrUnbondingPeriod, fmt.Sprintf("not qualified to update %s", avsInfo)) - }*/ + + // #nosec G115 + // if int64(avsInfo.Info.AvsUnbondingPeriod) < (epoch.CurrentEpoch - int64(avsInfo.GetInfo().StartingEpoch)) { + // return errorsmod.Wrap(types.ErrUnbondingPeriod, fmt.Sprintf("not qualified to deregister %s", avsInfo)) + // } + // If avs UpdateAction check CallerAddress + avs := avsInfo.Info if params.AvsName != "" { @@ -155,9 +172,9 @@ func (k Keeper) UpdateAVSInfo(ctx sdk.Context, params *types.AVSRegisterOrDeregi if params.UnbondingPeriod > 0 { avs.AvsUnbondingPeriod = params.UnbondingPeriod } - if params.MinSelfDelegation > 0 { - avs.MinSelfDelegation = params.MinSelfDelegation - } + + avs.MinSelfDelegation = params.MinSelfDelegation + if params.EpochIdentifier != "" { avs.EpochIdentifier = params.EpochIdentifier } @@ -169,10 +186,12 @@ func (k Keeper) UpdateAVSInfo(ctx sdk.Context, params *types.AVSRegisterOrDeregi avs.MinTotalStakeAmount = params.MinTotalStakeAmount } if params.AvsSlash > 0 { - avs.AvsSlash = sdk.NewDecWithPrec(int64(params.AvsSlash), 2) // #nosec G115 + // #nosec G115 + avs.AvsSlash = sdk.NewDecWithPrec(int64(params.AvsSlash), 2) } if params.AvsReward > 0 { - avs.AvsReward = sdk.NewDecWithPrec(int64(params.AvsReward), 2) // #nosec G115 + // #nosec G115 + avs.AvsReward = sdk.NewDecWithPrec(int64(params.AvsReward), 2) } avs.AvsAddress = params.AvsAddress avs.StartingEpoch = uint64(epoch.CurrentEpoch + 1) @@ -183,7 +202,7 @@ func (k Keeper) UpdateAVSInfo(ctx sdk.Context, params *types.AVSRegisterOrDeregi } } -func (k Keeper) CreateAVSTask(ctx sdk.Context, params *TaskParams) error { +func (k Keeper) CreateAVSTask(ctx sdk.Context, params *TaskInfoParams) error { avsInfo := k.GetAVSInfoByTaskAddress(ctx, params.TaskContractAddress) if avsInfo.AvsAddress == "" { return errorsmod.Wrap(types.ErrUnregisterNonExistent, fmt.Sprintf("the taskaddr is :%s", params.TaskContractAddress)) @@ -192,31 +211,51 @@ func (k Keeper) CreateAVSTask(ctx sdk.Context, params *TaskParams) error { if !slices.Contains(avsInfo.AvsOwnerAddress, params.CallerAddress) { return 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 || taskPowerTotal.IsZero() || taskPowerTotal.IsNegative() { + return errorsmod.Wrap(types.ErrVotingPowerIncorrect, fmt.Sprintf("the votingpower of avs is <<=0,avs addr is:%s", avsInfo.AvsAddress)) + } epoch, found := k.epochsKeeper.GetEpochInfo(ctx, avsInfo.EpochIdentifier) if !found { return errorsmod.Wrap(types.ErrEpochNotFound, fmt.Sprintf("epoch info not found %s", avsInfo.EpochIdentifier)) } - if k.IsExistTask(ctx, params.TaskID, params.TaskContractAddress) { - return errorsmod.Wrap(types.ErrAlreadyExists, fmt.Sprintf("the task is :%s", params.TaskID)) + if k.IsExistTask(ctx, strconv.FormatUint(params.TaskID, 10), params.TaskContractAddress) { + return errorsmod.Wrap(types.ErrAlreadyExists, fmt.Sprintf("the task is :%s", strconv.FormatUint(params.TaskID, 10))) + } + operatorList, err := k.GetOptInOperators(ctx, avsInfo.AvsAddress) + if err != nil { + return errorsmod.Wrap(err, "CreateAVSTask: failed to get opt-in operators") } + params.TaskID = k.GetTaskID(ctx, common.HexToAddress(params.TaskContractAddress)) task := &types.TaskInfo{ - Name: params.TaskName, - Data: params.Data, - TaskContractAddress: params.TaskContractAddress, - TaskId: params.TaskID, - TaskChallengePeriod: params.TaskChallengePeriod, - ThresholdPercentage: params.ThresholdPercentage, - TaskResponsePeriod: params.TaskResponsePeriod, - StartingEpoch: uint64(epoch.CurrentEpoch + 1), + Name: params.TaskName, + Hash: params.Hash, + TaskContractAddress: params.TaskContractAddress, + TaskId: params.TaskID, + TaskChallengePeriod: params.TaskChallengePeriod, + ThresholdPercentage: params.ThresholdPercentage, + TaskResponsePeriod: params.TaskResponsePeriod, + TaskStatisticalPeriod: params.TaskStatisticalPeriod, + StartingEpoch: uint64(epoch.CurrentEpoch + 1), + ActualThreshold: 0, + OptInOperators: operatorList, } return k.SetTaskInfo(ctx, task) } func (k Keeper) RegisterBLSPublicKey(ctx sdk.Context, params *BlsParams) error { - // TODO:check bls signature to prevent rogue key attacks - // params.pubkeyRegistrationSignature == key.sig(params.pubkeyRegistrationMessageHash) + // check bls signature to prevent rogue key attacks + sig := params.PubkeyRegistrationSignature + msgHash := params.PubkeyRegistrationMessageHash + pubKey, _ := bls.PublicKeyFromBytes(params.PubKey) + valid, err := blst.VerifySignature(sig, [32]byte(msgHash), pubKey) + if err != nil || !valid { + return errorsmod.Wrap(types.ErrSigNotMatchPubKey, fmt.Sprintf("the operator is :%s", params.Operator)) + } + if k.IsExistPubKey(ctx, params.Operator) { return errorsmod.Wrap(types.ErrAlreadyExists, fmt.Sprintf("the operator is :%s", params.Operator)) } @@ -328,3 +367,62 @@ func (k Keeper) IterateAVSInfo(ctx sdk.Context, fn func(index int64, avsInfo typ i++ } } + +func (k Keeper) RaiseAndResolveChallenge(ctx sdk.Context, params *ChallengeParams) error { + taskInfo, err := k.GetTaskInfo(ctx, strconv.FormatUint(params.TaskID, 10), params.TaskContractAddress.String()) + if err != nil { + return fmt.Errorf("task does not exist,this task address: %s", params.TaskContractAddress) + } + // check Task + if hex.EncodeToString(taskInfo.Hash) != hex.EncodeToString(params.TaskHash) { + return errorsmod.Wrap(err, fmt.Sprintf("error Task hasn't been responded to yet: %s", params.TaskContractAddress)) + } + // check Task result + res, err := k.GetTaskResultInfo(ctx, params.OperatorAddress.String(), params.TaskContractAddress.String(), + params.TaskID) + if err != nil { + return fmt.Errorf("task result does not exist, this task address: %s", params.TaskContractAddress) + } + taskRes, err := types.UnmarshalTaskResponse(res.TaskResponse) + if err != nil { + return errorsmod.Wrap(err, fmt.Sprintf("error occurred when unmarshal task response, this task address: %s", params.TaskContractAddress)) + } + hash, err := types.GetTaskResponseDigestEncodeByAbi(taskRes) + + if err != nil || res.TaskId != params.TaskID || hex.EncodeToString(hash[:]) != hex.EncodeToString(params.TaskResponseHash) { + return errorsmod.Wrap( + types.ErrInconsistentParams, + fmt.Sprintf("Task response does not match the one recorded,task addr: %s ,(TaskContractAddress: %s)"+ + ",(TaskId: %d),(TaskResponseHash: %s)", + params.OperatorAddress, params.TaskContractAddress, params.TaskID, params.TaskResponseHash), + ) + } + // check challenge record + if k.IsExistTaskChallengedInfo(ctx, params.OperatorAddress.String(), + params.TaskContractAddress.String(), params.TaskID) { + return errorsmod.Wrap(types.ErrAlreadyExists, fmt.Sprintf("the challenge has been raised: %s", params.TaskContractAddress)) + } + + // check challenge period + // check epoch,The challenge must be within the challenge window period + avsInfo := k.GetAVSInfoByTaskAddress(ctx, taskInfo.TaskContractAddress) + epoch, found := k.epochsKeeper.GetEpochInfo(ctx, avsInfo.EpochIdentifier) + if !found { + return errorsmod.Wrap(types.ErrEpochNotFound, fmt.Sprintf("epoch info not found %s", + avsInfo.EpochIdentifier)) + } + if epoch.CurrentEpoch <= int64(taskInfo.StartingEpoch)+int64(taskInfo.TaskResponsePeriod)+int64(taskInfo.TaskStatisticalPeriod) { + return errorsmod.Wrap( + types.ErrSubmitTooLateError, + fmt.Sprintf("SetTaskResultInfo:the challenge period has not started , CurrentEpoch:%d", epoch.CurrentEpoch), + ) + } + if epoch.CurrentEpoch > int64(taskInfo.StartingEpoch)+int64(taskInfo.TaskResponsePeriod)+int64(taskInfo.TaskStatisticalPeriod)+int64(taskInfo.TaskChallengePeriod) { + return errorsmod.Wrap( + types.ErrSubmitTooLateError, + fmt.Sprintf("SetTaskResultInfo:submit too late, CurrentEpoch:%d", epoch.CurrentEpoch), + ) + } + return k.SetTaskChallengedInfo(ctx, params.TaskID, params.OperatorAddress.String(), params.CallerAddress, + params.TaskContractAddress) +} diff --git a/x/avs/keeper/miscellaneous_test.go b/x/avs/keeper/miscellaneous_test.go new file mode 100644 index 000000000..a035a8f64 --- /dev/null +++ b/x/avs/keeper/miscellaneous_test.go @@ -0,0 +1,95 @@ +package keeper_test + +import ( + "fmt" + utiltx "github.com/ExocoreNetwork/exocore/testutil/tx" + "github.com/ExocoreNetwork/exocore/x/avs/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/crypto" + "math/big" + "testing" +) + +func TestReceiptMarshalBinary(t *testing.T) { + + task := types.TaskResponse{ + TaskID: 10, + NumberSum: big.NewInt(1000), + } + + packed, err := types.Args.Pack(&task) + if err != nil { + fmt.Println("bad bad ", err) + return + } else { + fmt.Println("abi encoded", hexutil.Encode(packed)) + } + + var args = make(map[string]interface{}) + + err = types.Args.UnpackIntoMap(args, packed) + result, _ := types.Args.Unpack(packed) + fmt.Println("unpacked", result[0]) + hash := crypto.Keccak256Hash(packed) + fmt.Println("hash:", hash.String()) + + key := args["TaskResponse"] + fmt.Println("key", key) + for _, elem := range result { + switch v := elem.(type) { + case uint64: + fmt.Println("Found uint64:", v) + case *big.Int: + fmt.Println("Found *big.Int:", v) + case *types.TaskResponse: + fmt.Println("types.TaskResponse type found") + default: + fmt.Println("Unknown type found") + } + } + taskNew, _ := result[0].(*types.TaskResponse) + fmt.Println("hash:", taskNew) + + var taskResponse types.TaskResponse + + if err := types.Args.Copy(&taskResponse, result); err != nil { + fmt.Println("unpacked", result) + } + fmt.Println("taskResponse", taskResponse) + +} + +func Test_difference(t *testing.T) { + arr1 := []string{"apple", "banana", "cherry"} + arr2 := []string{"apple", "cherry", "date"} + + diff := types.Difference(arr1, arr2) + fmt.Println("Differences:", diff) + num1 := sdk.MustNewDecFromStr("1.3") + num2 := sdk.MustNewDecFromStr("12.3") + + // Perform division + result := num1.Quo(num2) + + // Convert result to percentage + percentage := result.Mul(sdk.NewDec(100)) + + // Print the result + fmt.Print(percentage) +} + +func Test_genKey(t *testing.T) { + addresses := make([]string, 5) + + for i := 0; i < 5; i++ { + address := utiltx.GenerateAddress() + exoAddress := sdk.AccAddress(address.Bytes()).String() + addresses[i] = exoAddress + } + + fmt.Println("Generated EXO addresses:") + for _, address := range addresses { + fmt.Println(address) + } +} diff --git a/x/avs/keeper/msg_server.go b/x/avs/keeper/msg_server.go index a30ff96a2..bf0811448 100644 --- a/x/avs/keeper/msg_server.go +++ b/x/avs/keeper/msg_server.go @@ -4,36 +4,39 @@ import ( "context" "github.com/ExocoreNetwork/exocore/x/avs/types" + sdk "github.com/cosmos/cosmos-sdk/types" ) -var _ types.MsgServer = &Keeper{} - -func (k Keeper) RegisterAVS(_ context.Context, _ *types.RegisterAVSReq) (*types.RegisterAVSResponse, error) { - // Disable cosmos transaction temporarily - // c := sdk.UnwrapSDKContext(ctx) - // fromAddress := req.FromAddress - // operatorAddress := req.Info.OperatorAddress - // for _, opAddr := range operatorAddress { - // if fromAddress == opAddr { - // // Set purely for AVS itself information. - // if err := k.SetAVSInfo(c, req.Info); err != nil { - // return nil, err - // } - // } - // } - return nil, nil +type MsgServerImpl struct { + keeper Keeper } -func (k Keeper) DeRegisterAVS(_ context.Context, _ *types.DeRegisterAVSReq) (*types.DeRegisterAVSResponse, error) { - // Disable cosmos transaction temporarily - // c := sdk.UnwrapSDKContext(ctx) - // if err := k.DeleteAVSInfo(c, req.Info); err != nil { - // return nil, err - // } +func NewMsgServerImpl(keeper Keeper) *MsgServerImpl { + return &MsgServerImpl{keeper: keeper} +} + +var _ types.MsgServer = &MsgServerImpl{} + +func (m MsgServerImpl) SubmitTaskResult(goCtx context.Context, req *types.SubmitTaskResultReq) (*types.SubmitTaskResultResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if err := m.keeper.SetTaskResultInfo(ctx, req.FromAddress, req.Info); err != nil { + return nil, err + } + return &types.SubmitTaskResultResponse{}, nil +} + +func (m MsgServerImpl) RegisterAVS(_ context.Context, _ *types.RegisterAVSReq) (*types.RegisterAVSResponse, error) { + // TODO implement me + panic("implement me") +} - return nil, nil +func (m MsgServerImpl) DeRegisterAVS(_ context.Context, _ *types.DeRegisterAVSReq) (*types.DeRegisterAVSResponse, error) { + // TODO implement me + panic("implement me") } -func (k Keeper) RegisterAVSTask(_ context.Context, _ *types.RegisterAVSTaskReq) (*types.RegisterAVSTaskResponse, error) { - return nil, nil +func (m MsgServerImpl) RegisterAVSTask(_ context.Context, _ *types.RegisterAVSTaskReq) (*types.RegisterAVSTaskResponse, error) { + // TODO implement me + panic("implement me") } diff --git a/x/avs/keeper/multi_operator_submit_task_test.go b/x/avs/keeper/multi_operator_submit_task_test.go new file mode 100644 index 000000000..742a7323d --- /dev/null +++ b/x/avs/keeper/multi_operator_submit_task_test.go @@ -0,0 +1,234 @@ +package keeper_test + +import ( + sdkmath "cosmossdk.io/math" + assetskeeper "github.com/ExocoreNetwork/exocore/x/assets/keeper" + assetstypes "github.com/ExocoreNetwork/exocore/x/assets/types" + avskeeper "github.com/ExocoreNetwork/exocore/x/avs/keeper" + avstypes "github.com/ExocoreNetwork/exocore/x/avs/types" + delegationtype "github.com/ExocoreNetwork/exocore/x/delegation/types" + epochstypes "github.com/ExocoreNetwork/exocore/x/epochs/types" + operatorTypes "github.com/ExocoreNetwork/exocore/x/operator/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" + "github.com/prysmaticlabs/prysm/v4/crypto/bls/blst" + blscommon "github.com/prysmaticlabs/prysm/v4/crypto/bls/common" + "math/big" + "time" +) + +func (suite *AVSTestSuite) prepareOperators() { + for _, operatorAddress := range suite.operatorAddresses { + opAccAddr, err := sdk.AccAddressFromBech32(operatorAddress) + suite.Require().NoError(err) + + // register operator + registerReq := &operatorTypes.RegisterOperatorReq{ + FromAddress: opAccAddr.String(), + Info: &operatorTypes.OperatorInfo{ + EarningsAddr: opAccAddr.String(), + }, + } + _, err = suite.OperatorMsgServer.RegisterOperator(suite.Ctx, registerReq) + suite.Require().NoError(err) + } +} + +func (suite *AVSTestSuite) prepareMulDeposit(assetAddr common.Address, amount sdkmath.Int) { + clientChainLzID := uint64(101) + suite.avsAddr = common.BytesToAddress([]byte("avsTestAddr")).String() + suite.assetAddr = assetAddr + suite.assetDecimal = 6 + suite.clientChainLzID = clientChainLzID + suite.depositAmount = amount + suite.updatedAmountForOptIn = sdkmath.NewInt(2000) + suite.stakerID, suite.assetID = assetstypes.GetStakeIDAndAssetID(suite.clientChainLzID, suite.Address[:], suite.assetAddr[:]) + // staking assets + depositParam := &assetskeeper.DepositWithdrawParams{ + ClientChainLzID: suite.clientChainLzID, + Action: assetstypes.Deposit, + StakerAddress: suite.Address[:], + OpAmount: suite.depositAmount, + AssetsAddress: assetAddr[:], + } + err := suite.App.AssetsKeeper.PerformDepositOrWithdraw(suite.Ctx, depositParam) + suite.NoError(err) +} + +func (suite *AVSTestSuite) prepareDelegations() { + assetAddr := common.HexToAddress("0xdAC17F958D2ee523a2206206994597C13D831ec7") + delegationAmount := sdkmath.NewInt(100) + + for _, operatorAddress := range suite.operatorAddresses { + addr, err := sdk.AccAddressFromBech32(operatorAddress) + suite.NoError(err) + suite.prepareMulDelegation(addr, assetAddr, delegationAmount) + } +} + +func (suite *AVSTestSuite) prepareMulDelegation(operatorAddress sdk.AccAddress, assetAddr common.Address, amount sdkmath.Int) { + param := &delegationtype.DelegationOrUndelegationParams{ + ClientChainID: suite.clientChainLzID, + AssetsAddress: assetAddr[:], + OperatorAddress: operatorAddress, + StakerAddress: suite.Address[:], + OpAmount: amount, + LzNonce: 0, + TxHash: common.HexToHash("0x24c4a315d757249c12a7a1d7b6fb96261d49deee26f06a3e1787d008b445c3ac"), + } + + err := suite.App.DelegationKeeper.DelegateTo(suite.Ctx, param) + suite.NoError(err) +} + +func (suite *AVSTestSuite) prepareMulAvs(assetIDs []string) { + err := suite.App.AVSManagerKeeper.UpdateAVSInfo(suite.Ctx, &avstypes.AVSRegisterOrDeregisterParams{ + AvsName: "avs01", + Action: avskeeper.RegisterAction, + EpochIdentifier: epochstypes.HourEpochID, + AvsAddress: suite.avsAddr, + AssetID: assetIDs, + TaskAddr: suite.taskAddress.String(), + SlashContractAddr: "", + RewardContractAddr: "", + MinSelfDelegation: 0, + AvsOwnerAddress: nil, + UnbondingPeriod: 7, + MinOptInOperators: 3, + MinStakeAmount: 2, + MinTotalStakeAmount: 2, + AvsSlash: 2, + AvsReward: 3, + }) + + suite.NoError(err) +} +func (suite *AVSTestSuite) prepareMulOptIn() { + for _, operatorAddress := range suite.operatorAddresses { + addr, err := sdk.AccAddressFromBech32(operatorAddress) + suite.NoError(err) + err = suite.App.OperatorKeeper.OptIn(suite.Ctx, addr, suite.avsAddr) + suite.NoError(err) + suite.CommitAfter(time.Hour*1 + time.Nanosecond) + suite.CommitAfter(time.Hour*1 + time.Nanosecond) + suite.CommitAfter(time.Hour*1 + time.Nanosecond) + } + + suite.CommitAfter(time.Hour*1 + time.Nanosecond) + suite.CommitAfter(time.Hour*1 + time.Nanosecond) + suite.CommitAfter(time.Hour*1 + time.Nanosecond) +} +func (suite *AVSTestSuite) prepareMulOperatorubkey() { + suite.blsKeys = make([]blscommon.SecretKey, len(suite.operatorAddresses)) + for index, operatorAddress := range suite.operatorAddresses { + privateKey, err := blst.RandKey() + suite.blsKeys[index] = privateKey + suite.Require().NoError(err) + publicKey := privateKey.PublicKey() + blsPub := &avstypes.BlsPubKeyInfo{ + Operator: operatorAddress, + PubKey: publicKey.Marshal(), + Name: "", + } + err = suite.App.AVSManagerKeeper.SetOperatorPubKey(suite.Ctx, blsPub) + suite.Require().NoError(err) + } +} +func (suite *AVSTestSuite) prepareMulTaskInfo() { + suite.taskId = suite.App.AVSManagerKeeper.GetTaskID(suite.Ctx, suite.taskAddress) + epoch, _ := suite.App.EpochsKeeper.GetEpochInfo(suite.Ctx, epochstypes.HourEpochID) + operatorList, err := suite.App.OperatorKeeper.GetOptedInOperatorListByAVS(suite.Ctx, suite.avsAddr) + + info := &avstypes.TaskInfo{ + TaskContractAddress: suite.taskAddress.String(), + Name: "test-avsTask", + TaskId: suite.taskId, + Hash: []byte("req-struct"), + TaskResponsePeriod: 2, + TaskStatisticalPeriod: 1, + TaskChallengePeriod: 2, + ThresholdPercentage: 60, + StartingEpoch: uint64(epoch.CurrentEpoch + 1), + ActualThreshold: 0, + OptInOperators: operatorList, + } + err = suite.App.AVSManagerKeeper.SetTaskInfo(suite.Ctx, info) + suite.NoError(err) +} +func (suite *AVSTestSuite) prepareMul() { + usdtAddress := common.HexToAddress("0xdAC17F958D2ee523a2206206994597C13D831ec7") + depositAmount := sdkmath.NewInt(500) + //delegationAmount := sdkmath.NewInt(100) + suite.prepareOperators() + suite.prepareMulDeposit(usdtAddress, depositAmount) + suite.prepareDelegations() + suite.prepareMulAvs([]string{"0xdac17f958d2ee523a2206206994597c13d831ec7_0x65"}) + suite.prepareMulOptIn() + suite.prepareMulOperatorubkey() + suite.prepareMulTaskInfo() + suite.App.OperatorKeeper.SetAVSUSDValue(suite.Ctx, suite.avsAddr, sdkmath.LegacyNewDec(500)) + for _, operatorAddress := range suite.operatorAddresses { + delta := operatorTypes.DeltaOperatorUSDInfo{ + SelfUSDValue: sdkmath.LegacyNewDec(100), + TotalUSDValue: sdkmath.LegacyNewDec(100), + ActiveUSDValue: sdkmath.LegacyNewDec(100), + } + suite.App.OperatorKeeper.UpdateOperatorUSDValue(suite.Ctx, suite.avsAddr, operatorAddress, delta) + } + + suite.CommitAfter(time.Hour*1 + time.Nanosecond) + suite.CommitAfter(time.Hour*1 + time.Nanosecond) + suite.CommitAfter(time.Hour*1 + time.Nanosecond) +} + +func (suite *AVSTestSuite) TestSubmitTask_OnlyPhaseOne_Mul() { + suite.prepareMul() + for index, operatorAddress := range suite.operatorAddresses { + taskRes := avstypes.TaskResponse{TaskID: 1, NumberSum: big.NewInt(100)} + msg, _ := avstypes.GetTaskResponseDigestEncodeByjson(taskRes) + msgBytes := msg[:] + sig := suite.blsKeys[index].Sign(msgBytes) + + info := &avstypes.TaskResultInfo{ + TaskContractAddress: suite.taskAddress.String(), + OperatorAddress: operatorAddress, + TaskId: suite.taskId, + TaskResponseHash: "", + TaskResponse: nil, + BlsSignature: sig.Marshal(), + Stage: avstypes.TwoPhaseCommitOne, + } + err := suite.App.AVSManagerKeeper.SetTaskResultInfo(suite.Ctx, operatorAddress, info) + suite.Require().NoError(err) + } + +} + +func (suite *AVSTestSuite) TestSubmitTask_OnlyPhaseTwo_Mul() { + suite.TestSubmitTask_OnlyPhaseOne_Mul() + suite.CommitAfter(suite.EpochDuration) + for index, operatorAddress := range suite.operatorAddresses { + taskRes := avstypes.TaskResponse{TaskID: 1, NumberSum: big.NewInt(100)} + jsonData, err := avstypes.MarshalTaskResponse(taskRes) + suite.NoError(err) + hash := crypto.Keccak256Hash(jsonData) + // pub, err := suite.App.AVSManagerKeeper.GetOperatorPubKey(suite.Ctx, suite.operatorAddr.String()) + suite.NoError(err) + msg, _ := avstypes.GetTaskResponseDigestEncodeByjson(taskRes) + msgBytes := msg[:] + sig := suite.blsKeys[index].Sign(msgBytes) + + info := &avstypes.TaskResultInfo{ + TaskContractAddress: suite.taskAddress.String(), + OperatorAddress: operatorAddress, + TaskId: suite.taskId, + TaskResponseHash: hash.String(), + TaskResponse: jsonData, + BlsSignature: sig.Marshal(), + Stage: avstypes.TwoPhaseCommitTwo, + } + err = suite.App.AVSManagerKeeper.SetTaskResultInfo(suite.Ctx, operatorAddress, info) + suite.NoError(err) + } +} diff --git a/x/avs/keeper/params.go b/x/avs/keeper/params.go index 1f282c36d..5db1b8d13 100644 --- a/x/avs/keeper/params.go +++ b/x/avs/keeper/params.go @@ -3,6 +3,8 @@ package keeper import ( "fmt" + "github.com/ethereum/go-ethereum/common" + "github.com/ExocoreNetwork/exocore/x/avs/types" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" @@ -41,16 +43,27 @@ type OperatorOptParams struct { AvsAddress string } -type TaskParams struct { - TaskContractAddress string - TaskName string - StartingEpoch string - Data []byte - TaskID string - TaskResponsePeriod uint64 - TaskChallengePeriod uint64 - ThresholdPercentage uint64 - CallerAddress string +type TaskInfoParams struct { + TaskContractAddress string `json:"task_contract_address"` + TaskName string `json:"name"` + Hash []byte `json:"hash"` + TaskID uint64 `json:"task_id"` + TaskResponsePeriod uint64 `json:"task_response_period"` + TaskStatisticalPeriod uint64 `json:"task_statistical_period"` + TaskChallengePeriod uint64 `json:"task_challenge_period"` + ThresholdPercentage uint64 `json:"threshold_percentage"` + StartingEpoch uint64 `json:"starting_epoch"` + OperatorAddress string `json:"operator_address"` + TaskResponseHash string `json:"task_response_hash"` + TaskResponse []byte `json:"task_response"` + BlsSignature []byte `json:"bls_signature"` + Stage string `json:"stage"` + ActualThreshold uint64 `json:"actual_threshold"` + OptInCount uint64 `json:"opt_in_count"` + SignedCount uint64 `json:"signed_count"` + NoSignedCount uint64 `json:"no_signed_count"` + ErrSignedCount uint64 `json:"err_signed_count"` + CallerAddress string `json:"caller_address"` } type BlsParams struct { Operator string @@ -79,3 +92,12 @@ const ( DeRegisterAction = 2 UpdateAction = 3 ) + +type ChallengeParams struct { + TaskContractAddress common.Address `json:"task_contract_address"` + TaskHash []byte `json:"hash"` + TaskID uint64 `json:"task_id"` + OperatorAddress sdk.AccAddress `json:"operator_address"` + TaskResponseHash []byte `json:"task_response_hash"` + CallerAddress string `json:"caller_address"` +} diff --git a/x/avs/keeper/query.go b/x/avs/keeper/query.go index db70877ce..94b32532f 100644 --- a/x/avs/keeper/query.go +++ b/x/avs/keeper/query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "strconv" "github.com/ExocoreNetwork/exocore/x/avs/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -28,3 +29,29 @@ func (k Keeper) QueryAVSAddrByChainID(ctx context.Context, req *types.QueryAVSAd } return &types.QueryAVSAddrByChainIDResponse{AVSAddress: avsAddr}, nil } + +func (k Keeper) QuerySubmitTaskResult(ctx context.Context, req *types.QuerySubmitTaskResultReq) (*types.QuerySubmitTaskResultResponse, error) { + c := sdk.UnwrapSDKContext(ctx) + id, err := strconv.ParseUint(req.TaskId, 10, 64) + if err != nil { + return &types.QuerySubmitTaskResultResponse{}, err + } + + info, err := k.GetTaskResultInfo(c, req.OperatorAddr, req.TaskAddress, id) + return &types.QuerySubmitTaskResultResponse{ + Info: info, + }, err +} + +func (k Keeper) QueryChallengeInfo(ctx context.Context, req *types.QueryChallengeInfoReq) (*types.QueryChallengeInfoResponse, error) { + c := sdk.UnwrapSDKContext(ctx) + id, err := strconv.ParseUint(req.TaskId, 10, 64) + if err != nil { + return &types.QueryChallengeInfoResponse{}, err + } + + addr, err := k.GetTaskChallengedInfo(c, req.OperatorAddr, req.TaskAddress, id) + return &types.QueryChallengeInfoResponse{ + ChallengeAddr: addr, + }, err +} diff --git a/x/avs/keeper/setup_test.go b/x/avs/keeper/setup_test.go index a87deb4cb..4668f687c 100644 --- a/x/avs/keeper/setup_test.go +++ b/x/avs/keeper/setup_test.go @@ -1,7 +1,10 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" + blscommon "github.com/prysmaticlabs/prysm/v4/crypto/bls/common" "testing" + "time" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common" @@ -18,11 +21,29 @@ import ( type AVSTestSuite struct { testutil.BaseTestSuite - ctx sdk.Context - app *app.Evmos - queryClientEvm evm.QueryClient - consAddress sdk.ConsAddress - avsAddress common.Address + // needed by test + operatorAddr sdk.AccAddress + avsAddr string + assetID string + stakerID string + assetAddr common.Address + assetDecimal uint32 + clientChainLzID uint64 + depositAmount sdkmath.Int + delegationAmount sdkmath.Int + updatedAmountForOptIn sdkmath.Int + + ctx sdk.Context + app *app.Evmos + queryClientEvm evm.QueryClient + consAddress sdk.ConsAddress + avsAddress common.Address + taskAddress common.Address + taskId uint64 + blsKey blscommon.SecretKey + EpochDuration time.Duration + operatorAddresses []string + blsKeys []blscommon.SecretKey } var s *AVSTestSuite @@ -39,4 +60,16 @@ func TestKeeperTestSuite(t *testing.T) { func (suite *AVSTestSuite) SetupTest() { suite.DoSetupTest() suite.avsAddress = utiltx.GenerateAddress() + suite.taskAddress = utiltx.GenerateAddress() + epochID := suite.App.StakingKeeper.GetEpochIdentifier(suite.Ctx) + epochInfo, _ := suite.App.EpochsKeeper.GetEpochInfo(suite.Ctx, epochID) + suite.EpochDuration = epochInfo.Duration + time.Nanosecond // extra buffer + suite.operatorAddresses = []string{ + "exo1ve9s2u8c7u44la93pen79hwdd4zse2zku73cjp", + "exo1edwpx7243z5ls7qehmzwwsnnvtm8ms0dgr6ukq", + "exo1x28fd5v0mxjpevll60j5lf2jz4ksrpsdvck43r", + "exo1pkeqsekm0wsu4d5wqntf32t9l0sn35xquk65kz", + "exo1wsqzfdkmv5a4wu7788uw7zjaqfj6rcrm7q69dg", + } + } diff --git a/x/avs/keeper/submit_task_test.go b/x/avs/keeper/submit_task_test.go new file mode 100644 index 000000000..0bcdc4f62 --- /dev/null +++ b/x/avs/keeper/submit_task_test.go @@ -0,0 +1,216 @@ +package keeper_test + +import ( + sdkmath "cosmossdk.io/math" + assetskeeper "github.com/ExocoreNetwork/exocore/x/assets/keeper" + assetstypes "github.com/ExocoreNetwork/exocore/x/assets/types" + avskeeper "github.com/ExocoreNetwork/exocore/x/avs/keeper" + avstypes "github.com/ExocoreNetwork/exocore/x/avs/types" + delegationtype "github.com/ExocoreNetwork/exocore/x/delegation/types" + epochstypes "github.com/ExocoreNetwork/exocore/x/epochs/types" + operatorTypes "github.com/ExocoreNetwork/exocore/x/operator/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" + "github.com/prysmaticlabs/prysm/v4/crypto/bls/blst" + "math/big" + "strconv" + "time" +) + +func (suite *AVSTestSuite) prepareOperator() { + opAccAddr, err := sdk.AccAddressFromBech32("exo13h6xg79g82e2g2vhjwg7j4r2z2hlncelwutkjr") + suite.operatorAddr = opAccAddr + suite.NoError(err) + // register operator + registerReq := &operatorTypes.RegisterOperatorReq{ + FromAddress: suite.operatorAddr.String(), + Info: &operatorTypes.OperatorInfo{ + EarningsAddr: suite.operatorAddr.String(), + }, + } + _, err = s.OperatorMsgServer.RegisterOperator(s.Ctx, registerReq) + suite.NoError(err) +} + +func (suite *AVSTestSuite) prepareDeposit(assetAddr common.Address, amount sdkmath.Int) { + clientChainLzID := uint64(101) + suite.avsAddr = common.BytesToAddress([]byte("avsTestAddr")).String() + suite.assetAddr = assetAddr + suite.assetDecimal = 6 + suite.clientChainLzID = clientChainLzID + suite.depositAmount = amount + suite.updatedAmountForOptIn = sdkmath.NewInt(20) + suite.stakerID, suite.assetID = assetstypes.GetStakeIDAndAssetID(suite.clientChainLzID, suite.Address[:], suite.assetAddr[:]) + // staking assets + depositParam := &assetskeeper.DepositWithdrawParams{ + ClientChainLzID: suite.clientChainLzID, + Action: assetstypes.Deposit, + StakerAddress: suite.Address[:], + OpAmount: suite.depositAmount, + AssetsAddress: assetAddr[:], + } + err := suite.App.AssetsKeeper.PerformDepositOrWithdraw(suite.Ctx, depositParam) + suite.NoError(err) +} + +func (suite *AVSTestSuite) prepareDelegation(isDelegation bool, assetAddr common.Address, amount sdkmath.Int) { + suite.delegationAmount = amount + param := &delegationtype.DelegationOrUndelegationParams{ + ClientChainID: suite.clientChainLzID, + AssetsAddress: assetAddr[:], + OperatorAddress: suite.operatorAddr, + StakerAddress: suite.Address[:], + OpAmount: amount, + LzNonce: 0, + TxHash: common.HexToHash("0x24c4a315d757249c12a7a1d7b6fb96261d49deee26f06a3e1787d008b445c3ac"), + } + var err error + if isDelegation { + err = suite.App.DelegationKeeper.DelegateTo(suite.Ctx, param) + } else { + err = suite.App.DelegationKeeper.UndelegateFrom(suite.Ctx, param) + } + suite.NoError(err) +} +func (suite *AVSTestSuite) prepareAvs(assetIDs []string) { + err := suite.App.AVSManagerKeeper.UpdateAVSInfo(suite.Ctx, &avstypes.AVSRegisterOrDeregisterParams{ + AvsName: "avs01", + Action: avskeeper.RegisterAction, + EpochIdentifier: epochstypes.HourEpochID, + AvsAddress: suite.avsAddr, + AssetID: assetIDs, + TaskAddr: suite.taskAddress.String(), + SlashContractAddr: "", + RewardContractAddr: "", + MinSelfDelegation: 3, + AvsOwnerAddress: nil, + UnbondingPeriod: 7, + MinOptInOperators: 0, + MinStakeAmount: 2, + MinTotalStakeAmount: 2, + AvsSlash: 2, + AvsReward: 3, + }) + + suite.NoError(err) +} +func (suite *AVSTestSuite) prepareOptIn() { + err := suite.App.OperatorKeeper.OptIn(suite.Ctx, suite.operatorAddr, suite.avsAddr) + suite.NoError(err) + suite.CommitAfter(time.Hour*1 + time.Nanosecond) + suite.CommitAfter(time.Hour*1 + time.Nanosecond) + suite.CommitAfter(time.Hour*1 + time.Nanosecond) +} +func (suite *AVSTestSuite) prepareOperatorubkey() { + privateKey, err := blst.RandKey() + suite.blsKey = privateKey + publicKey := privateKey.PublicKey() + blsPub := &avstypes.BlsPubKeyInfo{ + Operator: suite.operatorAddr.String(), + PubKey: publicKey.Marshal(), + Name: "", + } + + err = suite.App.AVSManagerKeeper.SetOperatorPubKey(suite.Ctx, blsPub) + suite.NoError(err) +} +func (suite *AVSTestSuite) prepareTaskInfo() { + suite.taskId = suite.App.AVSManagerKeeper.GetTaskID(suite.Ctx, suite.taskAddress) + epoch, _ := suite.App.EpochsKeeper.GetEpochInfo(suite.Ctx, epochstypes.HourEpochID) + operatorList, err := suite.App.OperatorKeeper.GetOptedInOperatorListByAVS(suite.Ctx, suite.avsAddr) + + info := &avstypes.TaskInfo{ + TaskContractAddress: suite.taskAddress.String(), + Name: "test-avsTask", + TaskId: suite.taskId, + Hash: []byte("req-struct"), + TaskResponsePeriod: 2, + TaskStatisticalPeriod: 1, + TaskChallengePeriod: 2, + ThresholdPercentage: 60, + StartingEpoch: uint64(epoch.CurrentEpoch + 1), + ActualThreshold: 0, + OptInOperators: operatorList, + TaskTotalPower: sdk.Dec(sdkmath.NewInt(0)), + } + err = suite.App.AVSManagerKeeper.SetTaskInfo(suite.Ctx, info) + suite.NoError(err) + + getTaskInfo, err := suite.App.AVSManagerKeeper.GetTaskInfo(suite.Ctx, strconv.FormatUint(suite.taskId, 10), common.Address(suite.taskAddress.Bytes()).String()) + suite.NoError(err) + suite.Equal(*info, *getTaskInfo) +} +func (suite *AVSTestSuite) prepare() { + usdtAddress := common.HexToAddress("0xdAC17F958D2ee523a2206206994597C13D831ec7") + depositAmount := sdkmath.NewInt(100) + delegationAmount := sdkmath.NewInt(50) + suite.prepareOperator() + suite.prepareDeposit(usdtAddress, depositAmount) + suite.prepareDelegation(true, usdtAddress, delegationAmount) + suite.prepareAvs([]string{"0xdac17f958d2ee523a2206206994597c13d831ec7_0x65"}) + suite.prepareOptIn() + suite.prepareOperatorubkey() + suite.prepareTaskInfo() + suite.CommitAfter(time.Hour*1 + time.Nanosecond) + suite.CommitAfter(time.Hour*1 + time.Nanosecond) + suite.CommitAfter(time.Hour*1 + time.Nanosecond) +} + +func (suite *AVSTestSuite) TestSubmitTask_OnlyPhaseOne() { + suite.prepare() + taskRes := avstypes.TaskResponse{TaskID: 1, NumberSum: big.NewInt(100)} + jsonData, err := avstypes.MarshalTaskResponse(taskRes) + suite.NoError(err) + _ = crypto.Keccak256Hash(jsonData) + + // pub, err := suite.App.AVSManagerKeeper.GetOperatorPubKey(suite.Ctx, suite.operatorAddr.String()) + suite.NoError(err) + + msg, _ := avstypes.GetTaskResponseDigestEncodeByjson(taskRes) + msgBytes := msg[:] + sig := suite.blsKey.Sign(msgBytes) + + info := &avstypes.TaskResultInfo{ + TaskContractAddress: suite.taskAddress.String(), + OperatorAddress: suite.operatorAddr.String(), + TaskId: suite.taskId, + TaskResponseHash: "", + TaskResponse: nil, + BlsSignature: sig.Marshal(), + Stage: avstypes.TwoPhaseCommitOne, + } + err = suite.App.AVSManagerKeeper.SetTaskResultInfo(suite.Ctx, suite.operatorAddr.String(), info) + suite.NoError(err) + +} + +func (suite *AVSTestSuite) TestSubmitTask_OnlyPhaseTwo() { + suite.TestSubmitTask_OnlyPhaseOne() + suite.CommitAfter(suite.EpochDuration) + + taskRes := avstypes.TaskResponse{TaskID: 1, NumberSum: big.NewInt(100)} + jsonData, err := avstypes.MarshalTaskResponse(taskRes) + suite.NoError(err) + hash := crypto.Keccak256Hash(jsonData) + + // pub, err := suite.App.AVSManagerKeeper.GetOperatorPubKey(suite.Ctx, suite.operatorAddr.String()) + suite.NoError(err) + + msg, _ := avstypes.GetTaskResponseDigestEncodeByjson(taskRes) + msgBytes := msg[:] + sig := suite.blsKey.Sign(msgBytes) + + info := &avstypes.TaskResultInfo{ + TaskContractAddress: suite.taskAddress.String(), + OperatorAddress: suite.operatorAddr.String(), + TaskId: suite.taskId, + TaskResponseHash: hash.String(), + TaskResponse: jsonData, + BlsSignature: sig.Marshal(), + Stage: avstypes.TwoPhaseCommitTwo, + } + err = suite.App.AVSManagerKeeper.SetTaskResultInfo(suite.Ctx, suite.operatorAddr.String(), info) + suite.NoError(err) + +} diff --git a/x/avs/keeper/task.go b/x/avs/keeper/task.go index 9ba787697..f479af502 100644 --- a/x/avs/keeper/task.go +++ b/x/avs/keeper/task.go @@ -1,16 +1,22 @@ package keeper import ( + "bytes" "fmt" + "sort" + "strconv" - assetstype "github.com/ExocoreNetwork/exocore/x/assets/types" - "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" errorsmod "cosmossdk.io/errors" + assetstype "github.com/ExocoreNetwork/exocore/x/assets/types" "github.com/ExocoreNetwork/exocore/x/avs/types" + delegationtypes "github.com/ExocoreNetwork/exocore/x/delegation/types" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" + "github.com/prysmaticlabs/prysm/v4/crypto/bls/blst" ) func (k Keeper) SetTaskInfo(ctx sdk.Context, task *types.TaskInfo) (err error) { @@ -18,7 +24,7 @@ func (k Keeper) SetTaskInfo(ctx sdk.Context, task *types.TaskInfo) (err error) { return types.ErrInvalidAddr } store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixAVSTaskInfo) - infoKey := assetstype.GetJoinedStoreKey(task.TaskContractAddress, task.TaskId) + infoKey := assetstype.GetJoinedStoreKey(task.TaskContractAddress, strconv.FormatUint(task.TaskId, 10)) bz := k.cdc.MustMarshal(task) store.Set(infoKey, bz) return nil @@ -32,7 +38,8 @@ func (k *Keeper) GetTaskInfo(ctx sdk.Context, taskID, taskContractAddress string infoKey := assetstype.GetJoinedStoreKey(taskContractAddress, taskID) value := store.Get(infoKey) if value == nil { - return nil, errorsmod.Wrap(types.ErrNoKeyInTheStore, fmt.Sprintf("GetTaskInfo: key is %s", taskContractAddress)) + return nil, errorsmod.Wrap(types.ErrNoKeyInTheStore, + fmt.Sprintf("GetTaskInfo: key not found for task ID %s at contract address %s", taskID, taskContractAddress)) } ret := types.TaskInfo{} @@ -61,13 +68,14 @@ func (k *Keeper) SetOperatorPubKey(ctx sdk.Context, pub *types.BlsPubKeyInfo) (e func (k *Keeper) GetOperatorPubKey(ctx sdk.Context, addr string) (pub *types.BlsPubKeyInfo, err error) { opAccAddr, err := sdk.AccAddressFromBech32(addr) if err != nil { - return nil, errorsmod.Wrap(err, "GetOperatorPubKey: error occurred when parse acc address from Bech32") + return nil, errorsmod.Wrap(err, "GetOperatorPubKey: error occurred when parsing account address from Bech32: "+addr) } store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixOperatePub) // key := common.HexToAddress(incentive.Contract) isExist := store.Has(opAccAddr) if !isExist { - return nil, errorsmod.Wrap(types.ErrNoKeyInTheStore, fmt.Sprintf("GetOperatorPubKey: key is %s", opAccAddr)) + return nil, errorsmod.Wrap(types.ErrNoKeyInTheStore, + fmt.Sprintf("GetOperatorPubKey: public key not found for address %s", opAccAddr)) } value := store.Get(opAccAddr) ret := types.BlsPubKeyInfo{} @@ -102,3 +110,287 @@ func (k Keeper) IterateTaskAVSInfo(ctx sdk.Context, fn func(index int64, taskInf i++ } } + +// GetTaskID Increase the task ID by 1 each time. +func (k Keeper) GetTaskID(ctx sdk.Context, taskAddr common.Address) uint64 { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixLatestTaskNum) + var id uint64 + if store.Has(taskAddr.Bytes()) { + bz := store.Get(taskAddr.Bytes()) + id = sdk.BigEndianToUint64(bz) + id++ + } else { + id = 1 + } + store.Set(taskAddr.Bytes(), sdk.Uint64ToBigEndian(id)) + return id +} + +// SetTaskResultInfo is used to store the operator's sign task information. +func (k *Keeper) SetTaskResultInfo( + ctx sdk.Context, addr string, info *types.TaskResultInfo, +) (err error) { + // the operator's `addr` must match the from address. + if addr != info.OperatorAddress { + return errorsmod.Wrap( + types.ErrInvalidAddr, + "SetTaskResultInfo:from address is not equal to the operator address", + ) + } + opAccAddr, _ := sdk.AccAddressFromBech32(info.OperatorAddress) + // check operator + if !k.operatorKeeper.IsOperator(ctx, opAccAddr) { + return errorsmod.Wrap( + delegationtypes.ErrOperatorNotExist, + fmt.Sprintf("SetTaskResultInfo:invalid operator address:%s", opAccAddr), + ) + } + // check operator bls pubkey + keyInfo, err := k.GetOperatorPubKey(ctx, info.OperatorAddress) + if err != nil || keyInfo.PubKey == nil { + return errorsmod.Wrap( + types.ErrPubKeyIsNotExists, + fmt.Sprintf("SetTaskResultInfo:get operator address:%s", opAccAddr), + ) + } + pubKey, err := blst.PublicKeyFromBytes(keyInfo.PubKey) + if err != nil || pubKey == nil { + return errorsmod.Wrap( + types.ErrParsePubKey, + fmt.Sprintf("SetTaskResultInfo:get operator address:%s", opAccAddr), + ) + } + // check task contract + task, err := k.GetTaskInfo(ctx, strconv.FormatUint(info.TaskId, 10), info.TaskContractAddress) + if err != nil || task.TaskContractAddress == "" { + return errorsmod.Wrap( + types.ErrTaskIsNotExists, + fmt.Sprintf("SetTaskResultInfo: task info not found: %s (Task ID: %d)", + info.TaskContractAddress, info.TaskId), + ) + } + + // check prescribed period + // If submitted in the first stage, in order to avoid plagiarism by other operators, + // TaskResponse and TaskResponseHash must be null values + // At the same time, it must be submitted within the response deadline in the first stage + avsInfo := k.GetAVSInfoByTaskAddress(ctx, info.TaskContractAddress) + epoch, found := k.epochsKeeper.GetEpochInfo(ctx, avsInfo.EpochIdentifier) + if !found { + return errorsmod.Wrap(types.ErrEpochNotFound, fmt.Sprintf("epoch info not found %s", + avsInfo.EpochIdentifier)) + } + + switch info.Stage { + case types.TwoPhaseCommitOne: + if k.IsExistTaskResultInfo(ctx, info.OperatorAddress, info.TaskContractAddress, info.TaskId) { + return errorsmod.Wrap( + types.ErrResAlreadyExists, + fmt.Sprintf("SetTaskResultInfo: task result is already exists, "+ + "OperatorAddress: %s (TaskContractAddress: %s),(Task ID: %d)", + info.OperatorAddress, info.TaskContractAddress, info.TaskId), + ) + } + // check parameters + if info.BlsSignature == nil { + return errorsmod.Wrap( + types.ErrParamNotEmptyError, + fmt.Sprintf("SetTaskResultInfo: invalid param BlsSignature is not be null (BlsSignature: %s)", info.BlsSignature), + ) + } + if info.TaskResponseHash != "" || info.TaskResponse != nil { + return errorsmod.Wrap( + types.ErrParamNotEmptyError, + fmt.Sprintf("SetTaskResultInfo: invalid param TaskResponseHash: %s (TaskResponse: %d)", + info.TaskResponseHash, info.TaskResponse), + ) + } + // check epoch,The first stage submission must be within the response window period + // #nosec G115 + if epoch.CurrentEpoch > int64(task.StartingEpoch)+int64(task.TaskResponsePeriod) { + return errorsmod.Wrap( + types.ErrSubmitTooLateError, + fmt.Sprintf("SetTaskResultInfo:submit too late, CurrentEpoch:%d", epoch.CurrentEpoch), + ) + } + infoKey := assetstype.GetJoinedStoreKey(info.OperatorAddress, info.TaskContractAddress, + strconv.FormatUint(info.TaskId, 10)) + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixTaskResult) + bz := k.cdc.MustMarshal(info) + store.Set(infoKey, bz) + return nil + + case types.TwoPhaseCommitTwo: + // check task response + if info.TaskResponse == nil { + return errorsmod.Wrap( + types.ErrNotNull, + fmt.Sprintf("SetTaskResultInfo: invalid param (TaskResponse: %d)", + info.TaskResponse), + ) + } + // check parameters + res, err := k.GetTaskResultInfo(ctx, info.OperatorAddress, info.TaskContractAddress, info.TaskId) + if err != nil || !bytes.Equal(res.BlsSignature, info.BlsSignature) { + return errorsmod.Wrap( + types.ErrInconsistentParams, + fmt.Sprintf("SetTaskResultInfo: invalid param OperatorAddress: %s ,(TaskContractAddress: %s)"+ + ",(TaskId: %d),(BlsSignature: %s)", + info.OperatorAddress, info.TaskContractAddress, info.TaskId, info.BlsSignature), + ) + } + // check epoch,The second stage submission must be within the statistical window period + // #nosec G115 + if epoch.CurrentEpoch <= int64(task.StartingEpoch)+int64(task.TaskResponsePeriod) { + return errorsmod.Wrap( + types.ErrSubmitTooLateError, + fmt.Sprintf("SetTaskResultInfo:the TaskResponse period has not started , CurrentEpoch:%d", epoch.CurrentEpoch), + ) + } + if epoch.CurrentEpoch > int64(task.StartingEpoch)+int64(task.TaskResponsePeriod)+int64(task.TaskStatisticalPeriod) { + return errorsmod.Wrap( + types.ErrSubmitTooLateError, + fmt.Sprintf("SetTaskResultInfo:submit too late, CurrentEpoch:%d", epoch.CurrentEpoch), + ) + } + + // calculate hash by original task + taskResponseDigest := crypto.Keccak256Hash(info.TaskResponse) + info.TaskResponseHash = taskResponseDigest.String() + // check taskID + resp, err := types.UnmarshalTaskResponse(info.TaskResponse) + if err != nil || info.TaskId != resp.TaskID { + return errorsmod.Wrap( + types.ErrInconsistentParams, + fmt.Sprintf("SetTaskResultInfo: invalid TaskId param value:%s", info.TaskResponse), + ) + } + // check bls sig + flag, err := blst.VerifySignature(info.BlsSignature, taskResponseDigest, pubKey) + if !flag || err != nil { + return errorsmod.Wrap( + types.ErrSigVerifyError, + fmt.Sprintf("SetTaskResultInfo: invalid task address: %s (Task ID: %d)", info.TaskContractAddress, info.TaskId), + ) + } + + infoKey := assetstype.GetJoinedStoreKey(info.OperatorAddress, info.TaskContractAddress, strconv.FormatUint(info.TaskId, 10)) + + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixTaskResult) + bz := k.cdc.MustMarshal(info) + store.Set(infoKey, bz) + return nil + default: + return errorsmod.Wrap( + types.ErrParamError, + fmt.Sprintf("SetTaskResultInfo: invalid param value:%s", info.Stage), + ) + } +} + +func (k *Keeper) IsExistTaskResultInfo(ctx sdk.Context, operatorAddress, taskContractAddress string, taskID uint64) bool { + infoKey := assetstype.GetJoinedStoreKey(operatorAddress, taskContractAddress, + strconv.FormatUint(taskID, 10)) + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixTaskResult) + return store.Has(infoKey) +} + +func (k *Keeper) GetTaskResultInfo(ctx sdk.Context, operatorAddress, taskContractAddress string, taskID uint64) (info *types.TaskResultInfo, err error) { + if !common.IsHexAddress(taskContractAddress) { + return nil, types.ErrInvalidAddr + } + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixTaskResult) + infoKey := assetstype.GetJoinedStoreKey(operatorAddress, taskContractAddress, + strconv.FormatUint(taskID, 10)) + value := store.Get(infoKey) + if value == nil { + return nil, errorsmod.Wrap(types.ErrNoKeyInTheStore, + fmt.Sprintf("GetTaskResultInfo: key is %s", infoKey)) + } + + ret := types.TaskResultInfo{} + if err := k.cdc.Unmarshal(value, &ret); err != nil { + return nil, errorsmod.Wrap(err, "GetTaskResultInfo: failed to unmarshal task result info") + } + return &ret, nil +} + +// IterateResultInfo iterate through task result info +func (k Keeper) IterateResultInfo(ctx sdk.Context, fn func(index int64, info types.TaskResultInfo) (stop bool)) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixTaskResult) + + iterator := sdk.KVStorePrefixIterator(store, nil) + defer iterator.Close() + + i := int64(0) + + for ; iterator.Valid(); iterator.Next() { + task := types.TaskResultInfo{} + k.cdc.MustUnmarshal(iterator.Value(), &task) + + stop := fn(i, task) + + if stop { + break + } + i++ + } +} + +func (k Keeper) GroupTasksByIDAndAddress(tasks []types.TaskResultInfo) map[string][]types.TaskResultInfo { + taskMap := make(map[string][]types.TaskResultInfo) + for _, task := range tasks { + key := task.TaskContractAddress + "_" + strconv.FormatUint(task.TaskId, 10) + taskMap[key] = append(taskMap[key], task) + } + + // Sort tasks in each group by OperatorAddress + for key, taskGroup := range taskMap { + sort.Slice(taskGroup, func(i, j int) bool { + return taskGroup[i].OperatorAddress < taskGroup[j].OperatorAddress + }) + taskMap[key] = taskGroup + } + return taskMap +} + +// SetTaskChallengedInfo is used to store the challenger's challenge information. +func (k *Keeper) SetTaskChallengedInfo( + ctx sdk.Context, taskID uint64, operatorAddress, challengeAddr string, + taskAddr common.Address, +) (err error) { + infoKey := assetstype.GetJoinedStoreKey(operatorAddress, taskAddr.String(), + strconv.FormatUint(taskID, 10)) + + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixTaskChallengeResult) + key, err := sdk.AccAddressFromBech32(challengeAddr) + if err != nil { + return err + } + store.Set(infoKey, key) + + return nil +} + +func (k *Keeper) IsExistTaskChallengedInfo(ctx sdk.Context, operatorAddress, taskContractAddress string, taskID uint64) bool { + infoKey := assetstype.GetJoinedStoreKey(operatorAddress, taskContractAddress, + strconv.FormatUint(taskID, 10)) + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixTaskChallengeResult) + return store.Has(infoKey) +} + +func (k *Keeper) GetTaskChallengedInfo(ctx sdk.Context, operatorAddress, taskContractAddress string, taskID uint64) (addr string, err error) { + if !common.IsHexAddress(taskContractAddress) { + return "", types.ErrInvalidAddr + } + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixTaskChallengeResult) + infoKey := assetstype.GetJoinedStoreKey(operatorAddress, taskContractAddress, + strconv.FormatUint(taskID, 10)) + value := store.Get(infoKey) + if value == nil { + return "", errorsmod.Wrap(types.ErrNoKeyInTheStore, + fmt.Sprintf("GetTaskChallengedInfo: key is %s", infoKey)) + } + + return common.Bytes2Hex(value), nil +} diff --git a/x/avs/keeper/task_test.go b/x/avs/keeper/task_test.go index e7a6e00b8..e5e0fdb62 100644 --- a/x/avs/keeper/task_test.go +++ b/x/avs/keeper/task_test.go @@ -1,39 +1,53 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" types "github.com/ExocoreNetwork/exocore/x/avs/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common" + "strconv" ) func (suite *AVSTestSuite) TestTaskInfo() { info := &types.TaskInfo{ TaskContractAddress: common.Address(suite.AccAddress.Bytes()).String(), Name: "test-avstask-01", - TaskId: "avstask01", - Data: []byte("active"), + TaskId: 3, + Hash: []byte("active"), TaskResponsePeriod: 10000, TaskChallengePeriod: 5000, ThresholdPercentage: 60, + TaskTotalPower: sdk.Dec(sdkmath.NewInt(0)), } err := suite.App.AVSManagerKeeper.SetTaskInfo(suite.Ctx, info) suite.NoError(err) - getTaskInfo, err := suite.App.AVSManagerKeeper.GetTaskInfo(suite.Ctx, "avstask01", common.Address(suite.AccAddress.Bytes()).String()) + getTaskInfo, err := suite.App.AVSManagerKeeper.GetTaskInfo(suite.Ctx, strconv.Itoa(3), common.Address(suite.AccAddress.Bytes()).String()) suite.NoError(err) suite.Equal(*info, *getTaskInfo) } -func (suite *AVSTestSuite) TestOperator_pubkey() { - blsPub := &types.BlsPubKeyInfo{ - Operator: "exo1j9ly7f0jynscjgvct0enevaa659te58k3xztc8", - PubKey: []byte("pubkey"), - Name: "pubkey", - } +func (suite *AVSTestSuite) TestGetTaskId() { + addr := common.Address(suite.AccAddress.Bytes()) - err := suite.App.AVSManagerKeeper.SetOperatorPubKey(suite.Ctx, blsPub) - suite.NoError(err) + taskId := suite.App.AVSManagerKeeper.GetTaskID(suite.Ctx, addr) + suite.Equal(uint64(1), taskId) + + taskId = suite.App.AVSManagerKeeper.GetTaskID(suite.Ctx, addr) + suite.Equal(uint64(2), taskId) + taskId = suite.App.AVSManagerKeeper.GetTaskID(suite.Ctx, addr) + suite.Equal(uint64(3), taskId) + + addr = common.Address(suite.avsAddress.Bytes()) + + taskId = suite.App.AVSManagerKeeper.GetTaskID(suite.Ctx, addr) + suite.Equal(uint64(1), taskId) + + taskId = suite.App.AVSManagerKeeper.GetTaskID(suite.Ctx, addr) + suite.Equal(uint64(2), taskId) +} +func (suite *AVSTestSuite) TestTaskChallengedInfo() { + suite.TestEpochEnd_TaskCalculation() + suite.CommitAfter(suite.EpochDuration) - pub, err := suite.App.AVSManagerKeeper.GetOperatorPubKey(suite.Ctx, "exo1j9ly7f0jynscjgvct0enevaa659te58k3xztc8") - suite.NoError(err) - suite.Equal([]byte("pubkey"), pub.PubKey) } diff --git a/x/avs/module.go b/x/avs/module.go index 8787e70be..05aeeb72d 100644 --- a/x/avs/module.go +++ b/x/avs/module.go @@ -99,7 +99,7 @@ func NewAppModule(_ codec.Codec, keeper keeper.Keeper) AppModule { // RegisterServices registers module services. func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), &am.keeper) + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) } diff --git a/x/avs/simulation/helpers.go b/x/avs/simulation/helpers.go deleted file mode 100644 index 92c437c0d..000000000 --- a/x/avs/simulation/helpers.go +++ /dev/null @@ -1,15 +0,0 @@ -package simulation - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -// FindAccount find a specific address from an account list -func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { - creator, err := sdk.AccAddressFromBech32(address) - if err != nil { - panic(err) - } - return simtypes.FindAccount(accs, creator) -} diff --git a/x/avs/types/codec.go b/x/avs/types/codec.go index 0d191313b..a78ebe455 100644 --- a/x/avs/types/codec.go +++ b/x/avs/types/codec.go @@ -3,15 +3,12 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" // this line is used by starport scaffolding # 1 "github.com/cosmos/cosmos-sdk/types/msgservice" ) -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - func RegisterLegacyAminoCodec(_ *codec.LegacyAmino) { } @@ -19,3 +16,12 @@ var ( Amino = codec.NewLegacyAmino() ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) ) + +// RegisterInterfaces register implementations +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &SubmitTaskResultReq{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} diff --git a/x/avs/types/errors.go b/x/avs/types/errors.go index 046975df5..2f7877feb 100644 --- a/x/avs/types/errors.go +++ b/x/avs/types/errors.go @@ -16,7 +16,7 @@ var ( ) ErrUnregisterNonExistent = errorsmod.Register( ModuleName, 4, - "Error: No available avs to DeRegisterAction", + "Error: No available avs ", ) ErrInvalidAction = errorsmod.Register( @@ -45,7 +45,7 @@ var ( ) ErrNotNull = errorsmod.Register( ModuleName, 11, - "Error: this chainID shouldn't be null", + "Error: param shouldn't be null", ) ErrInvalidAddr = errorsmod.Register( @@ -54,6 +54,57 @@ var ( ) ErrAlreadyExists = errorsmod.Register( ModuleName, 13, - "The task already exists", + "The record already exists", + ) + ErrTaskIsNotExists = errorsmod.Register( + ModuleName, 14, + "The task does not exist", + ) + ErrHashValue = errorsmod.Register( + ModuleName, 15, + "The task response hash does not match the expected value.", + ) + + ErrPubKeyIsNotExists = errorsmod.Register( + ModuleName, 16, + "The pubKey does not exist", + ) + ErrSigVerifyError = errorsmod.Register( + ModuleName, 17, + "Signature verification error", + ) + + ErrParamError = errorsmod.Register( + ModuleName, 18, + "The parameter must be 1 or 2", + ) + + ErrParamNotEmptyError = errorsmod.Register( + ModuleName, 19, + "In the first stage, the parameter must be empty.", + ) + ErrSubmitTooLateError = errorsmod.Register( + ModuleName, 20, + " The response was submitted too late.", + ) + ErrResAlreadyExists = errorsmod.Register( + ModuleName, 21, + "The submit result already exists", + ) + ErrInconsistentParams = errorsmod.Register( + ModuleName, 22, + "Inconsistent parameters", + ) + ErrVotingPowerIncorrect = errorsmod.Register( + ModuleName, 23, + "Voting power must be greater than 0", + ) + ErrSigNotMatchPubKey = errorsmod.Register( + ModuleName, 24, + "Signature and pubkey do not match", + ) + ErrParsePubKey = errorsmod.Register( + ModuleName, 25, + "The pubKey parsing failed", ) ) diff --git a/x/avs/types/keys.go b/x/avs/types/keys.go index a13eba2b8..4459e5586 100644 --- a/x/avs/types/keys.go +++ b/x/avs/types/keys.go @@ -24,6 +24,9 @@ const ( prefixAVSTaskInfo = iota + 1 prefixOperatePub prefixAVSAddressToChainID + LatestTaskNum + TaskResult + TaskChallengeResult ) // ModuleAddress is the native module address for EVM @@ -36,6 +39,9 @@ var ( KeyPrefixOperatePub = []byte{prefixOperatePub} // KeyPrefixAVSAddressToChainID is used to store the reverse lookup from AVS address to chainID. KeyPrefixAVSAddressToChainID = []byte{prefixAVSAddressToChainID} + KeyPrefixLatestTaskNum = []byte{LatestTaskNum} + KeyPrefixTaskResult = []byte{TaskResult} + KeyPrefixTaskChallengeResult = []byte{TaskChallengeResult} ) func init() { diff --git a/x/avs/types/msg.go b/x/avs/types/msg.go index d80a98ef3..ccf84e792 100644 --- a/x/avs/types/msg.go +++ b/x/avs/types/msg.go @@ -10,6 +10,40 @@ var ( _ sdk.Msg = &DeRegisterAVSReq{} ) +const ( + // TypeSubmitTaskResultReq is the type for the RegisterOperatorReq message. + TypeSubmitTaskResultReq = "register_operator" +) + +// GetSigners returns the expected signers for the message. +func (m *SubmitTaskResultReq) GetSigners() []sdk.AccAddress { + addr := sdk.MustAccAddressFromBech32(m.FromAddress) + return []sdk.AccAddress{addr} +} + +// ValidateBasic does a sanity check of the provided data +func (m *SubmitTaskResultReq) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.FromAddress); err != nil { + return errorsmod.Wrap(err, "invalid from address") + } + return nil +} + +// Route returns the transaction route. +func (m *SubmitTaskResultReq) Route() string { + return RouterKey +} + +// Type returns the transaction type. +func (m *SubmitTaskResultReq) Type() string { + return TypeSubmitTaskResultReq +} + +// GetSignBytes returns the bytes all expected signers must sign over. +func (m *SubmitTaskResultReq) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(m)) +} + // GetSigners returns the expected signers for a MsgUpdateParams message. func (m *RegisterAVSReq) GetSigners() []sdk.AccAddress { addr := sdk.MustAccAddressFromBech32(m.FromAddress) diff --git a/x/avs/types/query.pb.go b/x/avs/types/query.pb.go index 5aa43fe71..3b6c36b2d 100644 --- a/x/avs/types/query.pb.go +++ b/x/avs/types/query.pb.go @@ -269,50 +269,284 @@ func (m *QueryAVSTaskInfoReq) GetTaskId() string { return "" } +// QuerySubmitTaskResultReq is the request to obtain the task information. +type QuerySubmitTaskResultReq struct { + // task_addr is the task contract address,its type should be a sdk.AccAddress + TaskAddress string `protobuf:"bytes,1,opt,name=task_addr,json=taskAddr,proto3" json:"task_addr,omitempty"` + // task_id is the task identifier + TaskId string `protobuf:"bytes,2,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + // operator_addr is the operator address,its type should be a sdk.AccAddress + OperatorAddr string `protobuf:"bytes,3,opt,name=operator_addr,json=operatorAddr,proto3" json:"operator_addr,omitempty"` +} + +func (m *QuerySubmitTaskResultReq) Reset() { *m = QuerySubmitTaskResultReq{} } +func (m *QuerySubmitTaskResultReq) String() string { return proto.CompactTextString(m) } +func (*QuerySubmitTaskResultReq) ProtoMessage() {} +func (*QuerySubmitTaskResultReq) Descriptor() ([]byte, []int) { + return fileDescriptor_fd804655b77429f2, []int{5} +} +func (m *QuerySubmitTaskResultReq) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySubmitTaskResultReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySubmitTaskResultReq.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QuerySubmitTaskResultReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySubmitTaskResultReq.Merge(m, src) +} +func (m *QuerySubmitTaskResultReq) XXX_Size() int { + return m.Size() +} +func (m *QuerySubmitTaskResultReq) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySubmitTaskResultReq.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySubmitTaskResultReq proto.InternalMessageInfo + +func (m *QuerySubmitTaskResultReq) GetTaskAddress() string { + if m != nil { + return m.TaskAddress + } + return "" +} + +func (m *QuerySubmitTaskResultReq) GetTaskId() string { + if m != nil { + return m.TaskId + } + return "" +} + +func (m *QuerySubmitTaskResultReq) GetOperatorAddr() string { + if m != nil { + return m.OperatorAddr + } + return "" +} + +// QueryChallengeInfoReq is the request to obtain the task information. +type QueryChallengeInfoReq struct { + // task_addr is the task contract address,its type should be a sdk.AccAddress + TaskAddress string `protobuf:"bytes,1,opt,name=task_addr,json=taskAddr,proto3" json:"task_addr,omitempty"` + // task_id is the task identifier + TaskId string `protobuf:"bytes,2,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + // operator_addr is the operator address,its type should be a sdk.AccAddress + OperatorAddr string `protobuf:"bytes,3,opt,name=operator_addr,json=operatorAddr,proto3" json:"operator_addr,omitempty"` +} + +func (m *QueryChallengeInfoReq) Reset() { *m = QueryChallengeInfoReq{} } +func (m *QueryChallengeInfoReq) String() string { return proto.CompactTextString(m) } +func (*QueryChallengeInfoReq) ProtoMessage() {} +func (*QueryChallengeInfoReq) Descriptor() ([]byte, []int) { + return fileDescriptor_fd804655b77429f2, []int{6} +} +func (m *QueryChallengeInfoReq) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryChallengeInfoReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryChallengeInfoReq.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryChallengeInfoReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryChallengeInfoReq.Merge(m, src) +} +func (m *QueryChallengeInfoReq) XXX_Size() int { + return m.Size() +} +func (m *QueryChallengeInfoReq) XXX_DiscardUnknown() { + xxx_messageInfo_QueryChallengeInfoReq.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryChallengeInfoReq proto.InternalMessageInfo + +func (m *QueryChallengeInfoReq) GetTaskAddress() string { + if m != nil { + return m.TaskAddress + } + return "" +} + +func (m *QueryChallengeInfoReq) GetTaskId() string { + if m != nil { + return m.TaskId + } + return "" +} + +func (m *QueryChallengeInfoReq) GetOperatorAddr() string { + if m != nil { + return m.OperatorAddr + } + return "" +} + +// QuerySubmitTaskResultResponse is the response of avs related information +type QuerySubmitTaskResultResponse struct { + // info is the taskResult. + Info *TaskResultInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"` +} + +func (m *QuerySubmitTaskResultResponse) Reset() { *m = QuerySubmitTaskResultResponse{} } +func (m *QuerySubmitTaskResultResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySubmitTaskResultResponse) ProtoMessage() {} +func (*QuerySubmitTaskResultResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_fd804655b77429f2, []int{7} +} +func (m *QuerySubmitTaskResultResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySubmitTaskResultResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySubmitTaskResultResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QuerySubmitTaskResultResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySubmitTaskResultResponse.Merge(m, src) +} +func (m *QuerySubmitTaskResultResponse) XXX_Size() int { + return m.Size() +} +func (m *QuerySubmitTaskResultResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySubmitTaskResultResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySubmitTaskResultResponse proto.InternalMessageInfo + +func (m *QuerySubmitTaskResultResponse) GetInfo() *TaskResultInfo { + if m != nil { + return m.Info + } + return nil +} + +// QueryChallengeInfoResponse is the response of avs related information +type QueryChallengeInfoResponse struct { + // challenge_addr is the challenge address,its type should be a common.HexAddress. + ChallengeAddr string `protobuf:"bytes,1,opt,name=challenge_addr,json=challengeAddr,proto3" json:"challenge_addr,omitempty"` +} + +func (m *QueryChallengeInfoResponse) Reset() { *m = QueryChallengeInfoResponse{} } +func (m *QueryChallengeInfoResponse) String() string { return proto.CompactTextString(m) } +func (*QueryChallengeInfoResponse) ProtoMessage() {} +func (*QueryChallengeInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_fd804655b77429f2, []int{8} +} +func (m *QueryChallengeInfoResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryChallengeInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryChallengeInfoResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryChallengeInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryChallengeInfoResponse.Merge(m, src) +} +func (m *QueryChallengeInfoResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryChallengeInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryChallengeInfoResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryChallengeInfoResponse proto.InternalMessageInfo + +func (m *QueryChallengeInfoResponse) GetChallengeAddr() string { + if m != nil { + return m.ChallengeAddr + } + return "" +} + func init() { proto.RegisterType((*QueryAVSInfoReq)(nil), "exocore.avs.v1.QueryAVSInfoReq") proto.RegisterType((*QueryAVSInfoResponse)(nil), "exocore.avs.v1.QueryAVSInfoResponse") proto.RegisterType((*QueryAVSAddrByChainIDReq)(nil), "exocore.avs.v1.QueryAVSAddrByChainIDReq") proto.RegisterType((*QueryAVSAddrByChainIDResponse)(nil), "exocore.avs.v1.QueryAVSAddrByChainIDResponse") proto.RegisterType((*QueryAVSTaskInfoReq)(nil), "exocore.avs.v1.QueryAVSTaskInfoReq") + proto.RegisterType((*QuerySubmitTaskResultReq)(nil), "exocore.avs.v1.QuerySubmitTaskResultReq") + proto.RegisterType((*QueryChallengeInfoReq)(nil), "exocore.avs.v1.QueryChallengeInfoReq") + proto.RegisterType((*QuerySubmitTaskResultResponse)(nil), "exocore.avs.v1.QuerySubmitTaskResultResponse") + proto.RegisterType((*QueryChallengeInfoResponse)(nil), "exocore.avs.v1.QueryChallengeInfoResponse") } func init() { proto.RegisterFile("exocore/avs/v1/query.proto", fileDescriptor_fd804655b77429f2) } var fileDescriptor_fd804655b77429f2 = []byte{ - // 502 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0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 0xdf, 0x5e, 0x44, 0x9f, 0xc9, 0xc9, 0x32, - 0xcb, 0xa2, 0xbc, 0xe8, 0x34, 0xd5, 0xb1, 0xf7, 0xf0, 0x9d, 0xd9, 0x63, 0xe5, 0x9d, 0xe5, 0x44, - 0xef, 0x32, 0x51, 0x0a, 0xfc, 0xa3, 0x81, 0xae, 0xce, 0x7d, 0x5a, 0xbc, 0xb5, 0xc8, 0x47, 0x79, - 0x8a, 0xac, 0xe6, 0x3f, 0x2a, 0x75, 0x30, 0xf7, 0x95, 0xc3, 0x4d, 0xec, 0xcc, 0x0d, 0xa6, 0xd0, - 0xe3, 0xed, 0x7e, 0x49, 0x6d, 0xe3, 0x34, 0xb5, 0x8d, 0x1f, 0xa9, 0x6d, 0xbc, 0x9f, 0xda, 0x95, - 0xd3, 0xa9, 0x5d, 0xf9, 0x3e, 0xb5, 0x2b, 0x2f, 0x9b, 0x41, 0x28, 0x0e, 0x4f, 0xf6, 0xdd, 0x01, - 0x1c, 0x91, 0x27, 0x19, 0xe7, 0x29, 0x13, 0xaf, 0x21, 0x1e, 0xfe, 0xc6, 0x8e, 0x15, 0x58, 0x4c, - 0x46, 0x8c, 0xef, 0x2f, 0xab, 0xbf, 0xf2, 0xe1, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb9, 0x08, - 0xbb, 0xb7, 0x2b, 0x04, 0x00, 0x00, + // 669 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0xc7, 0xeb, 0x42, 0xbf, 0x36, 0xfd, 0x40, 0x4b, 0x51, 0x53, 0x03, 0x0e, 0x35, 0x2d, 0xad, + 0x0a, 0xb1, 0xd5, 0x22, 0x8e, 0x1c, 0x9a, 0x80, 0xaa, 0x5c, 0x10, 0x38, 0x55, 0x0f, 0x5c, 0xaa, + 0x6d, 0xbc, 0x75, 0xad,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, 0x12, 0x2a, 0xdb, 0xdf, 0x42, 0x4d, 0x39, 0x0f, 0x35, 0xe5, 0x77, + 0xa8, 0x29, 0x67, 0x5d, 0x6d, 0xe4, 0xbc, 0xab, 0x8d, 0xfc, 0xea, 0x6a, 0x23, 0x6f, 0xcb, 0x8e, + 0xcb, 0x0e, 0xdb, 0xfb, 0x46, 0x83, 0x1c, 0x9b, 0x2f, 0x23, 0x91, 0x57, 0x98, 0xbd, 0x23, 0xfe, + 0x51, 0x4f, 0xb3, 0x23, 0x54, 0xd9, 0x69, 0x0b, 0xd3, 0xfd, 0x71, 0xf1, 0x27, 0xf5, 0xf4, 0x6f, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xd1, 0x2f, 0x76, 0x3f, 0x3a, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -333,6 +567,10 @@ type QueryClient interface { QueryAVSTaskInfo(ctx context.Context, in *QueryAVSTaskInfoReq, opts ...grpc.CallOption) (*TaskInfo, error) // QueryAVSAddrByChainID queries the avs address by chain id QueryAVSAddrByChainID(ctx context.Context, in *QueryAVSAddrByChainIDReq, opts ...grpc.CallOption) (*QueryAVSAddrByChainIDResponse, error) + // Parameters queries the parameters of the module. + QuerySubmitTaskResult(ctx context.Context, in *QuerySubmitTaskResultReq, opts ...grpc.CallOption) (*QuerySubmitTaskResultResponse, error) + // Parameters queries the parameters of the module. + QueryChallengeInfo(ctx context.Context, in *QueryChallengeInfoReq, opts ...grpc.CallOption) (*QueryChallengeInfoResponse, error) } type queryClient struct { @@ -370,6 +608,24 @@ func (c *queryClient) QueryAVSAddrByChainID(ctx context.Context, in *QueryAVSAdd return out, nil } +func (c *queryClient) QuerySubmitTaskResult(ctx context.Context, in *QuerySubmitTaskResultReq, opts ...grpc.CallOption) (*QuerySubmitTaskResultResponse, error) { + out := new(QuerySubmitTaskResultResponse) + err := c.cc.Invoke(ctx, "/exocore.avs.v1.Query/QuerySubmitTaskResult", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) QueryChallengeInfo(ctx context.Context, in *QueryChallengeInfoReq, opts ...grpc.CallOption) (*QueryChallengeInfoResponse, error) { + out := new(QueryChallengeInfoResponse) + err := c.cc.Invoke(ctx, "/exocore.avs.v1.Query/QueryChallengeInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Parameters queries the parameters of the module. @@ -378,6 +634,10 @@ type QueryServer interface { QueryAVSTaskInfo(context.Context, *QueryAVSTaskInfoReq) (*TaskInfo, error) // QueryAVSAddrByChainID queries the avs address by chain id QueryAVSAddrByChainID(context.Context, *QueryAVSAddrByChainIDReq) (*QueryAVSAddrByChainIDResponse, error) + // Parameters queries the parameters of the module. + QuerySubmitTaskResult(context.Context, *QuerySubmitTaskResultReq) (*QuerySubmitTaskResultResponse, error) + // Parameters queries the parameters of the module. + QueryChallengeInfo(context.Context, *QueryChallengeInfoReq) (*QueryChallengeInfoResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -393,6 +653,12 @@ func (*UnimplementedQueryServer) QueryAVSTaskInfo(ctx context.Context, req *Quer func (*UnimplementedQueryServer) QueryAVSAddrByChainID(ctx context.Context, req *QueryAVSAddrByChainIDReq) (*QueryAVSAddrByChainIDResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryAVSAddrByChainID not implemented") } +func (*UnimplementedQueryServer) QuerySubmitTaskResult(ctx context.Context, req *QuerySubmitTaskResultReq) (*QuerySubmitTaskResultResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QuerySubmitTaskResult not implemented") +} +func (*UnimplementedQueryServer) QueryChallengeInfo(ctx context.Context, req *QueryChallengeInfoReq) (*QueryChallengeInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryChallengeInfo not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -452,6 +718,42 @@ func _Query_QueryAVSAddrByChainID_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _Query_QuerySubmitTaskResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySubmitTaskResultReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QuerySubmitTaskResult(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.avs.v1.Query/QuerySubmitTaskResult", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QuerySubmitTaskResult(ctx, req.(*QuerySubmitTaskResultReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_QueryChallengeInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryChallengeInfoReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryChallengeInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.avs.v1.Query/QueryChallengeInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryChallengeInfo(ctx, req.(*QueryChallengeInfoReq)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "exocore.avs.v1.Query", HandlerType: (*QueryServer)(nil), @@ -468,6 +770,14 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "QueryAVSAddrByChainID", Handler: _Query_QueryAVSAddrByChainID_Handler, }, + { + MethodName: "QuerySubmitTaskResult", + Handler: _Query_QuerySubmitTaskResult_Handler, + }, + { + MethodName: "QueryChallengeInfo", + Handler: _Query_QueryChallengeInfo_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "exocore/avs/v1/query.proto", @@ -635,56 +945,209 @@ func (m *QueryAVSTaskInfoReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *QuerySubmitTaskResultReq) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *QueryAVSInfoReq) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.AVSAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n + +func (m *QuerySubmitTaskResultReq) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAVSInfoResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QuerySubmitTaskResultReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.Info != nil { - l = m.Info.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.OperatorAddr) > 0 { + i -= len(m.OperatorAddr) + copy(dAtA[i:], m.OperatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OperatorAddr))) + i-- + dAtA[i] = 0x1a } - return n + if len(m.TaskId) > 0 { + i -= len(m.TaskId) + copy(dAtA[i:], m.TaskId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.TaskId))) + i-- + dAtA[i] = 0x12 + } + if len(m.TaskAddress) > 0 { + i -= len(m.TaskAddress) + copy(dAtA[i:], m.TaskAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.TaskAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *QueryAVSAddrByChainIDReq) Size() (n int) { - if m == nil { - return 0 +func (m *QueryChallengeInfoReq) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryChallengeInfoReq) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryChallengeInfoReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.ChainID) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.OperatorAddr) > 0 { + i -= len(m.OperatorAddr) + copy(dAtA[i:], m.OperatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OperatorAddr))) + i-- + dAtA[i] = 0x1a } - return n -} - + if len(m.TaskId) > 0 { + i -= len(m.TaskId) + copy(dAtA[i:], m.TaskId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.TaskId))) + i-- + dAtA[i] = 0x12 + } + if len(m.TaskAddress) > 0 { + i -= len(m.TaskAddress) + copy(dAtA[i:], m.TaskAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.TaskAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QuerySubmitTaskResultResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QuerySubmitTaskResultResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySubmitTaskResultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Info != nil { + { + size, err := m.Info.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryChallengeInfoResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryChallengeInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryChallengeInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ChallengeAddr) > 0 { + i -= len(m.ChallengeAddr) + copy(dAtA[i:], m.ChallengeAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ChallengeAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryAVSInfoReq) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AVSAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAVSInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Info != nil { + l = m.Info.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAVSAddrByChainIDReq) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainID) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func (m *QueryAVSAddrByChainIDResponse) Size() (n int) { if m == nil { return 0 @@ -712,16 +1175,416 @@ func (m *QueryAVSTaskInfoReq) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - return n -} + return n +} + +func (m *QuerySubmitTaskResultReq) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TaskAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.TaskId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.OperatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryChallengeInfoReq) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TaskAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.TaskId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.OperatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QuerySubmitTaskResultResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Info != nil { + l = m.Info.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryChallengeInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChallengeAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryAVSInfoReq) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAVSInfoReq: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAVSInfoReq: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AVSAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AVSAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAVSInfoResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAVSInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAVSInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Info == nil { + m.Info = &AVSInfo{} + } + if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAVSAddrByChainIDReq) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAVSAddrByChainIDReq: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAVSAddrByChainIDReq: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAVSAddrByChainIDResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAVSAddrByChainIDResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAVSAddrByChainIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AVSAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AVSAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } -func (m *QueryAVSInfoReq) Unmarshal(dAtA []byte) error { +func (m *QueryAVSTaskInfoReq) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -744,15 +1607,15 @@ func (m *QueryAVSInfoReq) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAVSInfoReq: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAVSTaskInfoReq: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAVSInfoReq: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAVSTaskInfoReq: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AVSAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TaskAddr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -780,7 +1643,39 @@ func (m *QueryAVSInfoReq) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.AVSAddress = string(dAtA[iNdEx:postIndex]) + m.TaskAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TaskId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TaskId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -803,7 +1698,7 @@ func (m *QueryAVSInfoReq) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAVSInfoResponse) Unmarshal(dAtA []byte) error { +func (m *QuerySubmitTaskResultReq) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -826,17 +1721,17 @@ func (m *QueryAVSInfoResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAVSInfoResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QuerySubmitTaskResultReq: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAVSInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QuerySubmitTaskResultReq: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TaskAddress", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -846,27 +1741,87 @@ func (m *QueryAVSInfoResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Info == nil { - m.Info = &AVSInfo{} + m.TaskAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TaskId", wireType) } - if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TaskId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF } + m.OperatorAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -889,7 +1844,7 @@ func (m *QueryAVSInfoResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAVSAddrByChainIDReq) Unmarshal(dAtA []byte) error { +func (m *QueryChallengeInfoReq) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -912,15 +1867,15 @@ func (m *QueryAVSAddrByChainIDReq) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAVSAddrByChainIDReq: wiretype end group for non-group") + return fmt.Errorf("proto: QueryChallengeInfoReq: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAVSAddrByChainIDReq: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryChallengeInfoReq: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TaskAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -948,7 +1903,71 @@ func (m *QueryAVSAddrByChainIDReq) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainID = string(dAtA[iNdEx:postIndex]) + m.TaskAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TaskId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TaskId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OperatorAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -971,7 +1990,7 @@ func (m *QueryAVSAddrByChainIDReq) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAVSAddrByChainIDResponse) Unmarshal(dAtA []byte) error { +func (m *QuerySubmitTaskResultResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -994,17 +2013,17 @@ func (m *QueryAVSAddrByChainIDResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAVSAddrByChainIDResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QuerySubmitTaskResultResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAVSAddrByChainIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QuerySubmitTaskResultResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AVSAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -1014,23 +2033,27 @@ func (m *QueryAVSAddrByChainIDResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.AVSAddress = string(dAtA[iNdEx:postIndex]) + if m.Info == nil { + m.Info = &TaskResultInfo{} + } + if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -1053,7 +2076,7 @@ func (m *QueryAVSAddrByChainIDResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAVSTaskInfoReq) Unmarshal(dAtA []byte) error { +func (m *QueryChallengeInfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1076,47 +2099,15 @@ func (m *QueryAVSTaskInfoReq) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAVSTaskInfoReq: wiretype end group for non-group") + return fmt.Errorf("proto: QueryChallengeInfoResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAVSTaskInfoReq: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryChallengeInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TaskAddr", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TaskAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TaskId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChallengeAddr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1144,7 +2135,7 @@ func (m *QueryAVSTaskInfoReq) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TaskId = string(dAtA[iNdEx:postIndex]) + m.ChallengeAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/avs/types/query.pb.gw.go b/x/avs/types/query.pb.gw.go index 5a6a3469c..2e24ae868 100644 --- a/x/avs/types/query.pb.gw.go +++ b/x/avs/types/query.pb.gw.go @@ -141,6 +141,78 @@ func local_request_Query_QueryAVSAddrByChainID_0(ctx context.Context, marshaler } +var ( + filter_Query_QuerySubmitTaskResult_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_QuerySubmitTaskResult_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySubmitTaskResultReq + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QuerySubmitTaskResult_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.QuerySubmitTaskResult(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QuerySubmitTaskResult_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySubmitTaskResultReq + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QuerySubmitTaskResult_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.QuerySubmitTaskResult(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_QueryChallengeInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_QueryChallengeInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryChallengeInfoReq + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryChallengeInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.QueryChallengeInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryChallengeInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryChallengeInfoReq + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_QueryChallengeInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.QueryChallengeInfo(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -216,6 +288,52 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_QuerySubmitTaskResult_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QuerySubmitTaskResult_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QuerySubmitTaskResult_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryChallengeInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryChallengeInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryChallengeInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -317,6 +435,46 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_QuerySubmitTaskResult_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QuerySubmitTaskResult_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QuerySubmitTaskResult_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryChallengeInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryChallengeInfo_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryChallengeInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -326,6 +484,10 @@ var ( pattern_Query_QueryAVSTaskInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"exocore", "avstask", "v1", "GetAVSTaskInfoReq"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_QueryAVSAddrByChainID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"exocore", "avs", "QueryAVSAddrByChainID"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QuerySubmitTaskResult_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"exocore", "avs", "QuerySubmitTaskResult"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryChallengeInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"exocore", "avs", "QueryChallengeInfo"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -334,4 +496,8 @@ var ( forward_Query_QueryAVSTaskInfo_0 = runtime.ForwardResponseMessage forward_Query_QueryAVSAddrByChainID_0 = runtime.ForwardResponseMessage + + forward_Query_QuerySubmitTaskResult_0 = runtime.ForwardResponseMessage + + forward_Query_QueryChallengeInfo_0 = runtime.ForwardResponseMessage ) diff --git a/x/avs/types/stage.go b/x/avs/types/stage.go new file mode 100644 index 000000000..3486737c7 --- /dev/null +++ b/x/avs/types/stage.go @@ -0,0 +1,8 @@ +package types + +const ( + // TwoPhaseCommitOne The first stage of the two-stage submission. + TwoPhaseCommitOne = "1" + // TwoPhaseCommitTwo The second stage of submission. + TwoPhaseCommitTwo = "2" +) diff --git a/x/avs/types/tx.pb.go b/x/avs/types/tx.pb.go index 9846ab4ad..ed3f8986a 100644 --- a/x/avs/types/tx.pb.go +++ b/x/avs/types/tx.pb.go @@ -362,18 +362,35 @@ type TaskInfo struct { // name of task Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // data which is supplied by the contract, usually ABI-encoded - Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` + Hash []byte `protobuf:"bytes,3,opt,name=hash,proto3" json:"hash,omitempty"` // task_id of task - TaskId string `protobuf:"bytes,4,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + TaskId uint64 `protobuf:"varint,4,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` // Deadline for task response TaskResponsePeriod uint64 `protobuf:"varint,5,opt,name=task_response_period,json=taskResponsePeriod,proto3" json:"task_response_period,omitempty"` + // Statistical period: threshold calculation, signature verification, + // nosig quantity statistics, operator submits messages corresponding to signatures + TaskStatisticalPeriod uint64 `protobuf:"varint,6,opt,name=task_statistical_period,json=taskStatisticalPeriod,proto3" json:"task_statistical_period,omitempty"` // challenge period for task - TaskChallengePeriod uint64 `protobuf:"varint,6,opt,name=task_challenge_period,json=taskChallengePeriod,proto3" json:"task_challenge_period,omitempty"` + TaskChallengePeriod uint64 `protobuf:"varint,7,opt,name=task_challenge_period,json=taskChallengePeriod,proto3" json:"task_challenge_period,omitempty"` // Signature threshold percentage - ThresholdPercentage uint64 `protobuf:"varint,7,opt,name=threshold_percentage,json=thresholdPercentage,proto3" json:"threshold_percentage,omitempty"` + ThresholdPercentage uint64 `protobuf:"varint,8,opt,name=threshold_percentage,json=thresholdPercentage,proto3" json:"threshold_percentage,omitempty"` // Effective current epoch, accounting for current_epoch + 1 // and current_epoch is the integer identifier of the epoch module - StartingEpoch uint64 `protobuf:"varint,8,opt,name=starting_epoch,json=startingEpoch,proto3" json:"starting_epoch,omitempty"` + StartingEpoch uint64 `protobuf:"varint,9,opt,name=starting_epoch,json=startingEpoch,proto3" json:"starting_epoch,omitempty"` + // actual_threshold is the Actual threshold + ActualThreshold uint64 `protobuf:"varint,10,opt,name=actual_threshold,json=actualThreshold,proto3" json:"actual_threshold,omitempty"` + // opt_in_count when creating a task, the actual opt-in operator counts at this moment + OptInOperators []string `protobuf:"bytes,11,rep,name=opt_in_operators,json=optInOperators,proto3" json:"opt_in_operators,omitempty"` + // signed_count is Actual number of signatures already signed + SignedOperators []string `protobuf:"bytes,12,rep,name=signed_operators,json=signedOperators,proto3" json:"signed_operators,omitempty"` + // no_signed_count is the final number of unsigned operators + NoSignedOperators []string `protobuf:"bytes,13,rep,name=no_signed_operators,json=noSignedOperators,proto3" json:"no_signed_operators,omitempty"` + // err_signed_count is the number of operators with final incorrect signatures + ErrSignedOperators []string `protobuf:"bytes,14,rep,name=err_signed_operators,json=errSignedOperators,proto3" json:"err_signed_operators,omitempty"` + // task_total_power is the USD value owned by the avs task itself. + TaskTotalPower github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,15,opt,name=task_total_power,json=taskTotalPower,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"task_total_power"` + // operator_active_power_list is a power list of operators opt-in to the current task + OperatorActivePower *OperatorActivePowerList `protobuf:"bytes,16,opt,name=operator_active_power,json=operatorActivePower,proto3" json:"operator_active_power,omitempty"` } func (m *TaskInfo) Reset() { *m = TaskInfo{} } @@ -423,18 +440,18 @@ func (m *TaskInfo) GetName() string { return "" } -func (m *TaskInfo) GetData() []byte { +func (m *TaskInfo) GetHash() []byte { if m != nil { - return m.Data + return m.Hash } return nil } -func (m *TaskInfo) GetTaskId() string { +func (m *TaskInfo) GetTaskId() uint64 { if m != nil { return m.TaskId } - return "" + return 0 } func (m *TaskInfo) GetTaskResponsePeriod() uint64 { @@ -444,6 +461,13 @@ func (m *TaskInfo) GetTaskResponsePeriod() uint64 { return 0 } +func (m *TaskInfo) GetTaskStatisticalPeriod() uint64 { + if m != nil { + return m.TaskStatisticalPeriod + } + return 0 +} + func (m *TaskInfo) GetTaskChallengePeriod() uint64 { if m != nil { return m.TaskChallengePeriod @@ -465,6 +489,144 @@ func (m *TaskInfo) GetStartingEpoch() uint64 { return 0 } +func (m *TaskInfo) GetActualThreshold() uint64 { + if m != nil { + return m.ActualThreshold + } + return 0 +} + +func (m *TaskInfo) GetOptInOperators() []string { + if m != nil { + return m.OptInOperators + } + return nil +} + +func (m *TaskInfo) GetSignedOperators() []string { + if m != nil { + return m.SignedOperators + } + return nil +} + +func (m *TaskInfo) GetNoSignedOperators() []string { + if m != nil { + return m.NoSignedOperators + } + return nil +} + +func (m *TaskInfo) GetErrSignedOperators() []string { + if m != nil { + return m.ErrSignedOperators + } + return nil +} + +func (m *TaskInfo) GetOperatorActivePower() *OperatorActivePowerList { + if m != nil { + return m.OperatorActivePower + } + return nil +} + +// OperatorActivePowerList is the power list of operators opt-in to the current task. +// Because power is always changing, record the power of all operators +// who have completed tasks and submitted results by the task deadline +type OperatorActivePowerList struct { + // operator_power_list is a power list of operators. + OperatorPowerList []*OperatorActivePowerInfo `protobuf:"bytes,1,rep,name=operator_power_list,json=operatorPowerList,proto3" json:"operator_power_list,omitempty"` +} + +func (m *OperatorActivePowerList) Reset() { *m = OperatorActivePowerList{} } +func (m *OperatorActivePowerList) String() string { return proto.CompactTextString(m) } +func (*OperatorActivePowerList) ProtoMessage() {} +func (*OperatorActivePowerList) Descriptor() ([]byte, []int) { + return fileDescriptor_ef1ed06249b07d86, []int{4} +} +func (m *OperatorActivePowerList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OperatorActivePowerList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OperatorActivePowerList.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *OperatorActivePowerList) XXX_Merge(src proto.Message) { + xxx_messageInfo_OperatorActivePowerList.Merge(m, src) +} +func (m *OperatorActivePowerList) XXX_Size() int { + return m.Size() +} +func (m *OperatorActivePowerList) XXX_DiscardUnknown() { + xxx_messageInfo_OperatorActivePowerList.DiscardUnknown(m) +} + +var xxx_messageInfo_OperatorActivePowerList proto.InternalMessageInfo + +func (m *OperatorActivePowerList) GetOperatorPowerList() []*OperatorActivePowerInfo { + if m != nil { + return m.OperatorPowerList + } + return nil +} + +// OperatorActivePowerInfo is the operator power info. +type OperatorActivePowerInfo struct { + // operator_addr is the operator address. + OperatorAddr string `protobuf:"bytes,1,opt,name=operator_addr,json=operatorAddr,proto3" json:"operator_addr,omitempty"` + // active_power is the USD value owned by the operator itself. + SelfActivePower github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=active_power,json=activePower,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"active_power"` +} + +func (m *OperatorActivePowerInfo) Reset() { *m = OperatorActivePowerInfo{} } +func (m *OperatorActivePowerInfo) String() string { return proto.CompactTextString(m) } +func (*OperatorActivePowerInfo) ProtoMessage() {} +func (*OperatorActivePowerInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_ef1ed06249b07d86, []int{5} +} +func (m *OperatorActivePowerInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OperatorActivePowerInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OperatorActivePowerInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *OperatorActivePowerInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_OperatorActivePowerInfo.Merge(m, src) +} +func (m *OperatorActivePowerInfo) XXX_Size() int { + return m.Size() +} +func (m *OperatorActivePowerInfo) XXX_DiscardUnknown() { + xxx_messageInfo_OperatorActivePowerInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_OperatorActivePowerInfo proto.InternalMessageInfo + +func (m *OperatorActivePowerInfo) GetOperatorAddr() string { + if m != nil { + return m.OperatorAddr + } + return "" +} + // BlsPubKeyInfo is the task info. type BlsPubKeyInfo struct { // operator address @@ -479,7 +641,7 @@ func (m *BlsPubKeyInfo) Reset() { *m = BlsPubKeyInfo{} } func (m *BlsPubKeyInfo) String() string { return proto.CompactTextString(m) } func (*BlsPubKeyInfo) ProtoMessage() {} func (*BlsPubKeyInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ef1ed06249b07d86, []int{4} + return fileDescriptor_ef1ed06249b07d86, []int{6} } func (m *BlsPubKeyInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -541,7 +703,7 @@ func (m *RegisterAVSTaskReq) Reset() { *m = RegisterAVSTaskReq{} } func (m *RegisterAVSTaskReq) String() string { return proto.CompactTextString(m) } func (*RegisterAVSTaskReq) ProtoMessage() {} func (*RegisterAVSTaskReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ef1ed06249b07d86, []int{5} + return fileDescriptor_ef1ed06249b07d86, []int{7} } func (m *RegisterAVSTaskReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -578,7 +740,7 @@ func (m *RegisterAVSTaskResponse) Reset() { *m = RegisterAVSTaskResponse func (m *RegisterAVSTaskResponse) String() string { return proto.CompactTextString(m) } func (*RegisterAVSTaskResponse) ProtoMessage() {} func (*RegisterAVSTaskResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ef1ed06249b07d86, []int{6} + return fileDescriptor_ef1ed06249b07d86, []int{8} } func (m *RegisterAVSTaskResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -619,7 +781,7 @@ func (m *RegisterAVSReq) Reset() { *m = RegisterAVSReq{} } func (m *RegisterAVSReq) String() string { return proto.CompactTextString(m) } func (*RegisterAVSReq) ProtoMessage() {} func (*RegisterAVSReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ef1ed06249b07d86, []int{7} + return fileDescriptor_ef1ed06249b07d86, []int{9} } func (m *RegisterAVSReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -674,7 +836,7 @@ func (m *RegisterAVSResponse) Reset() { *m = RegisterAVSResponse{} } func (m *RegisterAVSResponse) String() string { return proto.CompactTextString(m) } func (*RegisterAVSResponse) ProtoMessage() {} func (*RegisterAVSResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ef1ed06249b07d86, []int{8} + return fileDescriptor_ef1ed06249b07d86, []int{10} } func (m *RegisterAVSResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -729,7 +891,7 @@ func (m *DeRegisterAVSReq) Reset() { *m = DeRegisterAVSReq{} } func (m *DeRegisterAVSReq) String() string { return proto.CompactTextString(m) } func (*DeRegisterAVSReq) ProtoMessage() {} func (*DeRegisterAVSReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ef1ed06249b07d86, []int{9} + return fileDescriptor_ef1ed06249b07d86, []int{11} } func (m *DeRegisterAVSReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -784,7 +946,7 @@ func (m *DeRegisterAVSResponse) Reset() { *m = DeRegisterAVSResponse{} } func (m *DeRegisterAVSResponse) String() string { return proto.CompactTextString(m) } func (*DeRegisterAVSResponse) ProtoMessage() {} func (*DeRegisterAVSResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ef1ed06249b07d86, []int{10} + return fileDescriptor_ef1ed06249b07d86, []int{12} } func (m *DeRegisterAVSResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -827,11 +989,192 @@ func (m *DeRegisterAVSResponse) GetInfo() *AVSInfo { return nil } +// TaskResultInfo is the operator sign task info result. +type TaskResultInfo struct { + // operator_address operator address + OperatorAddress string `protobuf:"bytes,1,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` + // task_response_hash is the task_response msg hash. + TaskResponseHash string `protobuf:"bytes,2,opt,name=task_response_hash,json=taskResponseHash,proto3" json:"task_response_hash,omitempty"` + // task_response is the task response data. + TaskResponse []byte `protobuf:"bytes,3,opt,name=task_response,json=taskResponse,proto3" json:"task_response,omitempty"` + // bls_signature is the operator bls sig info. + BlsSignature []byte `protobuf:"bytes,4,opt,name=bls_signature,json=blsSignature,proto3" json:"bls_signature,omitempty"` + // task_contract_address is contract address of task + TaskContractAddress string `protobuf:"bytes,5,opt,name=task_contract_address,json=taskContractAddress,proto3" json:"task_contract_address,omitempty"` + // task_id is the task id + TaskId uint64 `protobuf:"varint,6,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + // stage this field is used to solve the problem of task results being copied by other operators. + // It is a two-stage submission with two values, 1 and 2 + Stage string `protobuf:"bytes,7,opt,name=stage,proto3" json:"stage,omitempty"` +} + +func (m *TaskResultInfo) Reset() { *m = TaskResultInfo{} } +func (m *TaskResultInfo) String() string { return proto.CompactTextString(m) } +func (*TaskResultInfo) ProtoMessage() {} +func (*TaskResultInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_ef1ed06249b07d86, []int{13} +} +func (m *TaskResultInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TaskResultInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TaskResultInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TaskResultInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_TaskResultInfo.Merge(m, src) +} +func (m *TaskResultInfo) XXX_Size() int { + return m.Size() +} +func (m *TaskResultInfo) XXX_DiscardUnknown() { + xxx_messageInfo_TaskResultInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_TaskResultInfo proto.InternalMessageInfo + +func (m *TaskResultInfo) GetOperatorAddress() string { + if m != nil { + return m.OperatorAddress + } + return "" +} + +func (m *TaskResultInfo) GetTaskResponseHash() string { + if m != nil { + return m.TaskResponseHash + } + return "" +} + +func (m *TaskResultInfo) GetTaskResponse() []byte { + if m != nil { + return m.TaskResponse + } + return nil +} + +func (m *TaskResultInfo) GetBlsSignature() []byte { + if m != nil { + return m.BlsSignature + } + return nil +} + +func (m *TaskResultInfo) GetTaskContractAddress() string { + if m != nil { + return m.TaskContractAddress + } + return "" +} + +func (m *TaskResultInfo) GetTaskId() uint64 { + if m != nil { + return m.TaskId + } + return 0 +} + +func (m *TaskResultInfo) GetStage() string { + if m != nil { + return m.Stage + } + return "" +} + +// SubmitTaskResultReq is the request to submit task results. +type SubmitTaskResultReq struct { + // from_address is the address of the operator (sdk.AccAddress). + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + // info is the taskResult. + Info *TaskResultInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` +} + +func (m *SubmitTaskResultReq) Reset() { *m = SubmitTaskResultReq{} } +func (m *SubmitTaskResultReq) String() string { return proto.CompactTextString(m) } +func (*SubmitTaskResultReq) ProtoMessage() {} +func (*SubmitTaskResultReq) Descriptor() ([]byte, []int) { + return fileDescriptor_ef1ed06249b07d86, []int{14} +} +func (m *SubmitTaskResultReq) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SubmitTaskResultReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SubmitTaskResultReq.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SubmitTaskResultReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_SubmitTaskResultReq.Merge(m, src) +} +func (m *SubmitTaskResultReq) XXX_Size() int { + return m.Size() +} +func (m *SubmitTaskResultReq) XXX_DiscardUnknown() { + xxx_messageInfo_SubmitTaskResultReq.DiscardUnknown(m) +} + +var xxx_messageInfo_SubmitTaskResultReq proto.InternalMessageInfo + +// SubmitTaskResultResponse is the response to submit task results. +type SubmitTaskResultResponse struct { +} + +func (m *SubmitTaskResultResponse) Reset() { *m = SubmitTaskResultResponse{} } +func (m *SubmitTaskResultResponse) String() string { return proto.CompactTextString(m) } +func (*SubmitTaskResultResponse) ProtoMessage() {} +func (*SubmitTaskResultResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ef1ed06249b07d86, []int{15} +} +func (m *SubmitTaskResultResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SubmitTaskResultResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SubmitTaskResultResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SubmitTaskResultResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SubmitTaskResultResponse.Merge(m, src) +} +func (m *SubmitTaskResultResponse) XXX_Size() int { + return m.Size() +} +func (m *SubmitTaskResultResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SubmitTaskResultResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SubmitTaskResultResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*AVSInfo)(nil), "exocore.avs.v1.AVSInfo") proto.RegisterType((*OperatorStatus)(nil), "exocore.avs.v1.OperatorStatus") proto.RegisterType((*RewardSlashProof)(nil), "exocore.avs.v1.RewardSlashProof") proto.RegisterType((*TaskInfo)(nil), "exocore.avs.v1.TaskInfo") + proto.RegisterType((*OperatorActivePowerList)(nil), "exocore.avs.v1.OperatorActivePowerList") + proto.RegisterType((*OperatorActivePowerInfo)(nil), "exocore.avs.v1.OperatorActivePowerInfo") proto.RegisterType((*BlsPubKeyInfo)(nil), "exocore.avs.v1.BlsPubKeyInfo") proto.RegisterType((*RegisterAVSTaskReq)(nil), "exocore.avs.v1.RegisterAVSTaskReq") proto.RegisterType((*RegisterAVSTaskResponse)(nil), "exocore.avs.v1.RegisterAVSTaskResponse") @@ -839,87 +1182,115 @@ func init() { proto.RegisterType((*RegisterAVSResponse)(nil), "exocore.avs.v1.RegisterAVSResponse") proto.RegisterType((*DeRegisterAVSReq)(nil), "exocore.avs.v1.DeRegisterAVSReq") proto.RegisterType((*DeRegisterAVSResponse)(nil), "exocore.avs.v1.DeRegisterAVSResponse") + proto.RegisterType((*TaskResultInfo)(nil), "exocore.avs.v1.TaskResultInfo") + proto.RegisterType((*SubmitTaskResultReq)(nil), "exocore.avs.v1.SubmitTaskResultReq") + proto.RegisterType((*SubmitTaskResultResponse)(nil), "exocore.avs.v1.SubmitTaskResultResponse") } func init() { proto.RegisterFile("exocore/avs/v1/tx.proto", fileDescriptor_ef1ed06249b07d86) } var fileDescriptor_ef1ed06249b07d86 = []byte{ - // 1185 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xc1, 0x6f, 0x1b, 0xc5, - 0x17, 0xce, 0x26, 0x4e, 0x62, 0x3f, 0x27, 0x8e, 0x33, 0x75, 0xeb, 0xad, 0xfb, 0xfb, 0xd9, 0xd6, - 0x42, 0x8b, 0x1b, 0xa8, 0xb7, 0x4d, 0x2f, 0xa8, 0x9c, 0x12, 0x52, 0x2a, 0xab, 0x2a, 0x8d, 0xd6, - 0xa1, 0x42, 0x5c, 0x56, 0x13, 0xef, 0x78, 0xbd, 0x8a, 0xbd, 0x63, 0x76, 0xc6, 0x6e, 0xcb, 0x09, - 0xf5, 0x84, 0x2a, 0x84, 0x40, 0xbd, 0x71, 0xea, 0x9f, 0xd0, 0x03, 0x17, 0x4e, 0x5c, 0x7b, 0xac, - 0xe0, 0x82, 0x38, 0x54, 0x28, 0x45, 0x2a, 0x1c, 0xf8, 0x1f, 0xd0, 0xbc, 0x9d, 0x5d, 0x6c, 0x27, - 0x6d, 0x25, 0x38, 0x94, 0x8b, 0xbd, 0xf3, 0xbe, 0xf7, 0xde, 0x7e, 0xef, 0x9b, 0xf7, 0x66, 0x07, - 0xca, 0xec, 0x0e, 0xef, 0xf0, 0x88, 0xd9, 0x74, 0x2c, 0xec, 0xf1, 0x25, 0x5b, 0xde, 0x69, 0x0e, - 0x23, 0x2e, 0x39, 0x29, 0x68, 0xa0, 0x49, 0xc7, 0xa2, 0x39, 0xbe, 0x54, 0x59, 0xa7, 0x83, 0x20, - 0xe4, 0x36, 0xfe, 0xc6, 0x2e, 0x95, 0x72, 0x87, 0x8b, 0x01, 0x17, 0xf6, 0x40, 0xf8, 0x2a, 0x74, - 0x20, 0x7c, 0x0d, 0x9c, 0x8e, 0x01, 0x17, 0x57, 0x76, 0xbc, 0xd0, 0x50, 0xc9, 0xe7, 0x3e, 0x8f, - 0xed, 0xea, 0x49, 0x5b, 0xff, 0xe7, 0x73, 0xee, 0xf7, 0x99, 0x4d, 0x87, 0x81, 0x4d, 0xc3, 0x90, - 0x4b, 0x2a, 0x03, 0x1e, 0xea, 0x18, 0xeb, 0xcf, 0x45, 0x58, 0xde, 0xba, 0xd5, 0x6e, 0x85, 0x5d, - 0x4e, 0x08, 0x64, 0x42, 0x3a, 0x60, 0xa6, 0x51, 0x37, 0x1a, 0x39, 0x07, 0x9f, 0x49, 0x0d, 0xf2, - 0x74, 0x2c, 0x5c, 0xea, 0x79, 0x11, 0x13, 0xc2, 0x9c, 0x47, 0x08, 0xe8, 0x58, 0x6c, 0xc5, 0x16, - 0xd2, 0x80, 0xe2, 0x20, 0x08, 0x5d, 0x21, 0xe9, 0x01, 0x73, 0xe9, 0x80, 0x8f, 0x42, 0x69, 0x2e, - 0xd4, 0x8d, 0x46, 0xc6, 0x29, 0x0c, 0x82, 0xb0, 0xad, 0xcc, 0x5b, 0x68, 0x25, 0x67, 0x20, 0x27, - 0xa9, 0x38, 0xc0, 0x5c, 0x66, 0x06, 0x13, 0x65, 0x95, 0x41, 0x65, 0x22, 0xff, 0x07, 0x10, 0x7d, - 0x2a, 0x7a, 0x31, 0xba, 0x88, 0x68, 0x0e, 0x2d, 0x08, 0xd7, 0x20, 0x1f, 0xb1, 0xdb, 0x34, 0xf2, - 0x62, 0x7c, 0x29, 0xa6, 0x11, 0x9b, 0xd0, 0x61, 0x03, 0xd6, 0x15, 0x4f, 0x7e, 0x3b, 0x64, 0x51, - 0xca, 0x76, 0xb9, 0xbe, 0xd0, 0xc8, 0x39, 0x6b, 0x74, 0x2c, 0x6e, 0x2a, 0x7b, 0x42, 0xf9, 0x3c, - 0xe4, 0xa8, 0x10, 0x4c, 0xba, 0x81, 0x27, 0xcc, 0xac, 0xf2, 0xd9, 0x5e, 0x39, 0x7c, 0x5a, 0xcb, - 0x6e, 0x29, 0x63, 0x6b, 0x47, 0x38, 0x59, 0x84, 0x5b, 0x9e, 0x20, 0x17, 0xa1, 0xa4, 0xd2, 0x8e, - 0xc2, 0x7d, 0x1e, 0x7a, 0x41, 0xe8, 0xbb, 0x43, 0x16, 0x05, 0xdc, 0x33, 0x73, 0x58, 0x21, 0xa1, - 0x63, 0xf1, 0x51, 0x02, 0xed, 0x22, 0x42, 0x9a, 0x70, 0x02, 0xf5, 0x60, 0xfd, 0xae, 0xeb, 0xb1, - 0x3e, 0xf3, 0x51, 0x6e, 0x13, 0x30, 0x60, 0x5d, 0x49, 0xc2, 0xfa, 0xdd, 0x9d, 0x14, 0x20, 0xe7, - 0xa1, 0xc8, 0x86, 0xbc, 0xd3, 0x73, 0x03, 0x8f, 0x85, 0x32, 0xe8, 0x06, 0x2c, 0x32, 0xf3, 0x58, - 0xde, 0x1a, 0xda, 0x5b, 0xa9, 0x99, 0xd8, 0x50, 0x52, 0xa9, 0xf9, 0x50, 0xba, 0xf8, 0xc7, 0x22, - 0x2a, 0x79, 0x24, 0xcc, 0x95, 0x34, 0xf7, 0xcd, 0xa1, 0x6c, 0x85, 0x37, 0x13, 0x80, 0x5c, 0x86, - 0x53, 0x2a, 0x40, 0x72, 0x49, 0xfb, 0xd3, 0x3b, 0xb4, 0x8a, 0x21, 0x8a, 0xe9, 0x9e, 0x02, 0x27, - 0xb7, 0xe9, 0x2c, 0x14, 0x84, 0xa4, 0x91, 0x54, 0xd5, 0x22, 0x03, 0xb3, 0x80, 0xce, 0xab, 0x89, - 0xf5, 0xaa, 0x32, 0x92, 0xd3, 0x90, 0xed, 0xf4, 0x68, 0x10, 0xba, 0x81, 0x67, 0xae, 0x21, 0xdf, - 0x65, 0x5c, 0xb7, 0x3c, 0x72, 0x03, 0x54, 0x83, 0xb8, 0xf1, 0xee, 0x98, 0x45, 0x05, 0x6e, 0x37, - 0x1f, 0x3f, 0xad, 0xcd, 0xfd, 0xf2, 0xb4, 0x76, 0xce, 0x0f, 0x64, 0x6f, 0xb4, 0xdf,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xea, 0x40, 0x79, 0x61, 0x29, 0xc6, 0x8b, 0x4b, 0x49, 0x0e, 0xa1, - 0xf9, 0x89, 0x43, 0x88, 0x40, 0x66, 0x42, 0x59, 0x7c, 0x9e, 0xd4, 0x2f, 0x33, 0xa5, 0xdf, 0x45, - 0x28, 0x21, 0x10, 0x31, 0x31, 0xe4, 0xa1, 0x60, 0xc9, 0xc8, 0x2e, 0xc6, 0x23, 0xab, 0x30, 0x47, - 0x43, 0x7a, 0x64, 0x53, 0x9a, 0x3d, 0xda, 0xef, 0xb3, 0xd0, 0x4f, 0x43, 0x96, 0xe2, 0x29, 0x41, - 0x9a, 0x09, 0xa6, 0x63, 0x2e, 0x41, 0x49, 0xf6, 0x22, 0x26, 0x7a, 0xbc, 0xef, 0x29, 0xf7, 0x0e, - 0x0b, 0x25, 0xf5, 0x99, 0xb9, 0xac, 0x43, 0x12, 0x6c, 0x37, 0x85, 0x8e, 0x19, 0xac, 0xec, 0x31, - 0x83, 0x65, 0x7d, 0x0c, 0xab, 0xdb, 0x7d, 0xb1, 0x3b, 0xda, 0xbf, 0xce, 0xee, 0xa2, 0x8a, 0x15, - 0xc8, 0x26, 0x22, 0x6b, 0xe1, 0xd2, 0xf5, 0xb1, 0x6a, 0x95, 0x61, 0x79, 0x38, 0xda, 0x77, 0x0f, - 0xd8, 0x5d, 0x2d, 0xd8, 0xd2, 0x10, 0x93, 0x59, 0xdf, 0x1b, 0x40, 0x1c, 0xe6, 0x07, 0x42, 0xb2, - 0x68, 0xeb, 0x56, 0x7b, 0x0f, 0x95, 0xf8, 0x94, 0xbc, 0x07, 0x2b, 0xdd, 0x88, 0x0f, 0xa6, 0x37, - 0x67, 0xdb, 0xfc, 0xf1, 0xbb, 0x0b, 0x25, 0xfd, 0x79, 0xd1, 0x7b, 0xd3, 0x96, 0x51, 0x10, 0xfa, - 0x4e, 0x5e, 0x79, 0x27, 0xdb, 0xf5, 0x0e, 0x64, 0x94, 0x3c, 0x48, 0x20, 0xbf, 0x69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0xaa, 0xd4, 0x47, 0x49, 0xe5, 0xad, 0x57, 0xfa, 0x68, 0x2a, 0x1b, 0x48, 0xe5, - 0x4d, 0xcb, 0x7a, 0xb9, 0x1a, 0x2a, 0xa6, 0xb2, 0xf8, 0xf9, 0xf3, 0x47, 0x1b, 0xc6, 0xf6, 0xb5, - 0xc7, 0x87, 0x55, 0xe3, 0xc9, 0x61, 0xd5, 0xf8, 0xf5, 0xb0, 0x6a, 0x7c, 0xfd, 0xac, 0x3a, 0xf7, - 0xe4, 0x59, 0x75, 0xee, 0xe7, 0x67, 0xd5, 0xb9, 0x4f, 0x2e, 0x4c, 0xdc, 0x02, 0xae, 0xc6, 0xe9, - 0x3e, 0x64, 0xf2, 0x36, 0x8f, 0x0e, 0xd2, 0xec, 0x77, 0x30, 0x3f, 0x5e, 0x08, 0xf6, 0x97, 0xf0, - 0xe6, 0x7b, 0xf9, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xab, 0xe0, 0x75, 0x96, 0x9f, 0x0b, 0x00, - 0x00, + // 1592 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0x4f, 0x6f, 0x23, 0x49, + 0x15, 0x4f, 0x27, 0x8e, 0x63, 0x3f, 0x3b, 0x8e, 0xd3, 0xf1, 0xac, 0x7b, 0xbc, 0x60, 0x47, 0x1d, + 0x66, 0x37, 0xc9, 0x6e, 0xec, 0x99, 0x2c, 0x42, 0x68, 0x39, 0x25, 0x64, 0x59, 0xa2, 0x65, 0x37, + 0x51, 0x3b, 0x2c, 0x08, 0x0e, 0xad, 0xb2, 0xbb, 0xd2, 0x6e, 0xa5, 0xdd, 0x65, 0xba, 0xca, 0x4e, + 0x86, 0x13, 0x9a, 0x13, 0x5a, 0x21, 0x04, 0x5a, 0x89, 0xf3, 0xde, 0xb9, 0x44, 0x68, 0x2f, 0x48, + 0x7c, 0x80, 0x3d, 0xae, 0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9f, 0xd6, 0xe7, 0xfe, 0xf6, 0xb4, 0x3e, 0xf7, 0xb3, + 0x9d, 0xc4, 0x63, 0xe0, 0xbd, 0x28, 0xde, 0x47, 0x54, 0x9c, 0xb3, 0xf0, 0x6c, 0x1c, 0xfe, 0x02, + 0x37, 0xc0, 0x77, 0x41, 0x27, 0x8b, 0x7f, 0x98, 0x78, 0xe7, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, + 0xc7, 0x48, 0xf6, 0x4f, 0x3e, 0x11, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -940,6 +1311,8 @@ type MsgClient interface { DeRegisterAVS(ctx context.Context, in *DeRegisterAVSReq, opts ...grpc.CallOption) (*DeRegisterAVSResponse, error) // RegisterAVSTask registers a new task. RegisterAVSTask(ctx context.Context, in *RegisterAVSTaskReq, opts ...grpc.CallOption) (*RegisterAVSTaskResponse, error) + // SubmitTaskResult operator submit task results . + SubmitTaskResult(ctx context.Context, in *SubmitTaskResultReq, opts ...grpc.CallOption) (*SubmitTaskResultResponse, error) } type msgClient struct { @@ -977,6 +1350,15 @@ func (c *msgClient) RegisterAVSTask(ctx context.Context, in *RegisterAVSTaskReq, return out, nil } +func (c *msgClient) SubmitTaskResult(ctx context.Context, in *SubmitTaskResultReq, opts ...grpc.CallOption) (*SubmitTaskResultResponse, error) { + out := new(SubmitTaskResultResponse) + err := c.cc.Invoke(ctx, "/exocore.avs.v1.Msg/SubmitTaskResult", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // RegisterAVS registers a new AVS with corresponding operator. @@ -985,6 +1367,8 @@ type MsgServer interface { DeRegisterAVS(context.Context, *DeRegisterAVSReq) (*DeRegisterAVSResponse, error) // RegisterAVSTask registers a new task. RegisterAVSTask(context.Context, *RegisterAVSTaskReq) (*RegisterAVSTaskResponse, error) + // SubmitTaskResult operator submit task results . + SubmitTaskResult(context.Context, *SubmitTaskResultReq) (*SubmitTaskResultResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -1000,6 +1384,9 @@ func (*UnimplementedMsgServer) DeRegisterAVS(ctx context.Context, req *DeRegiste func (*UnimplementedMsgServer) RegisterAVSTask(ctx context.Context, req *RegisterAVSTaskReq) (*RegisterAVSTaskResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RegisterAVSTask not implemented") } +func (*UnimplementedMsgServer) SubmitTaskResult(ctx context.Context, req *SubmitTaskResultReq) (*SubmitTaskResultResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubmitTaskResult not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -1059,6 +1446,24 @@ func _Msg_RegisterAVSTask_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _Msg_SubmitTaskResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SubmitTaskResultReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SubmitTaskResult(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.avs.v1.Msg/SubmitTaskResult", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SubmitTaskResult(ctx, req.(*SubmitTaskResultReq)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "exocore.avs.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -1075,6 +1480,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "RegisterAVSTask", Handler: _Msg_RegisterAVSTask_Handler, }, + { + MethodName: "SubmitTaskResult", + Handler: _Msg_SubmitTaskResult_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "exocore/avs/v1/tx.proto", @@ -1353,37 +1762,105 @@ func (m *TaskInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.StartingEpoch != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.StartingEpoch)) + if m.OperatorActivePower != nil { + { + size, err := m.OperatorActivePower.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0x40 - } - if m.ThresholdPercentage != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.ThresholdPercentage)) + dAtA[i] = 0x1 i-- - dAtA[i] = 0x38 + dAtA[i] = 0x82 } - if m.TaskChallengePeriod != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.TaskChallengePeriod)) - i-- - dAtA[i] = 0x30 + { + size := m.TaskTotalPower.Size() + i -= size + if _, err := m.TaskTotalPower.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) } - if m.TaskResponsePeriod != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.TaskResponsePeriod)) - i-- - dAtA[i] = 0x28 + i-- + dAtA[i] = 0x7a + if len(m.ErrSignedOperators) > 0 { + for iNdEx := len(m.ErrSignedOperators) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ErrSignedOperators[iNdEx]) + copy(dAtA[i:], m.ErrSignedOperators[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.ErrSignedOperators[iNdEx]))) + i-- + dAtA[i] = 0x72 + } } - if len(m.TaskId) > 0 { - i -= len(m.TaskId) - copy(dAtA[i:], m.TaskId) - i = encodeVarintTx(dAtA, i, uint64(len(m.TaskId))) + if len(m.NoSignedOperators) > 0 { + for iNdEx := len(m.NoSignedOperators) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.NoSignedOperators[iNdEx]) + copy(dAtA[i:], m.NoSignedOperators[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.NoSignedOperators[iNdEx]))) + i-- + dAtA[i] = 0x6a + } + } + if len(m.SignedOperators) > 0 { + for iNdEx := len(m.SignedOperators) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.SignedOperators[iNdEx]) + copy(dAtA[i:], m.SignedOperators[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.SignedOperators[iNdEx]))) + i-- + dAtA[i] = 0x62 + } + } + if len(m.OptInOperators) > 0 { + for iNdEx := len(m.OptInOperators) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.OptInOperators[iNdEx]) + copy(dAtA[i:], m.OptInOperators[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.OptInOperators[iNdEx]))) + i-- + dAtA[i] = 0x5a + } + } + if m.ActualThreshold != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ActualThreshold)) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x50 + } + if m.StartingEpoch != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.StartingEpoch)) + i-- + dAtA[i] = 0x48 + } + if m.ThresholdPercentage != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ThresholdPercentage)) + i-- + dAtA[i] = 0x40 + } + if m.TaskChallengePeriod != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.TaskChallengePeriod)) + i-- + dAtA[i] = 0x38 + } + if m.TaskStatisticalPeriod != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.TaskStatisticalPeriod)) + i-- + dAtA[i] = 0x30 } - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + if m.TaskResponsePeriod != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.TaskResponsePeriod)) + i-- + dAtA[i] = 0x28 + } + if m.TaskId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.TaskId)) + i-- + dAtA[i] = 0x20 + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintTx(dAtA, i, uint64(len(m.Hash))) i-- dAtA[i] = 0x1a } @@ -1404,6 +1881,83 @@ func (m *TaskInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *OperatorActivePowerList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *OperatorActivePowerList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OperatorActivePowerList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OperatorPowerList) > 0 { + for iNdEx := len(m.OperatorPowerList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.OperatorPowerList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *OperatorActivePowerInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *OperatorActivePowerInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OperatorActivePowerInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.SelfActivePower.Size() + i -= size + if _, err := m.SelfActivePower.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.OperatorAddr) > 0 { + i -= len(m.OperatorAddr) + copy(dAtA[i:], m.OperatorAddr) + i = encodeVarintTx(dAtA, i, uint64(len(m.OperatorAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *BlsPubKeyInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1681,6 +2235,141 @@ func (m *DeRegisterAVSResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *TaskResultInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TaskResultInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TaskResultInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Stage) > 0 { + i -= len(m.Stage) + copy(dAtA[i:], m.Stage) + i = encodeVarintTx(dAtA, i, uint64(len(m.Stage))) + i-- + dAtA[i] = 0x3a + } + if m.TaskId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.TaskId)) + i-- + dAtA[i] = 0x30 + } + if len(m.TaskContractAddress) > 0 { + i -= len(m.TaskContractAddress) + copy(dAtA[i:], m.TaskContractAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.TaskContractAddress))) + i-- + dAtA[i] = 0x2a + } + if len(m.BlsSignature) > 0 { + i -= len(m.BlsSignature) + copy(dAtA[i:], m.BlsSignature) + i = encodeVarintTx(dAtA, i, uint64(len(m.BlsSignature))) + i-- + dAtA[i] = 0x22 + } + if len(m.TaskResponse) > 0 { + i -= len(m.TaskResponse) + copy(dAtA[i:], m.TaskResponse) + i = encodeVarintTx(dAtA, i, uint64(len(m.TaskResponse))) + i-- + dAtA[i] = 0x1a + } + if len(m.TaskResponseHash) > 0 { + i -= len(m.TaskResponseHash) + copy(dAtA[i:], m.TaskResponseHash) + i = encodeVarintTx(dAtA, i, uint64(len(m.TaskResponseHash))) + i-- + dAtA[i] = 0x12 + } + if len(m.OperatorAddress) > 0 { + i -= len(m.OperatorAddress) + copy(dAtA[i:], m.OperatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.OperatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SubmitTaskResultReq) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SubmitTaskResultReq) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SubmitTaskResultReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Info != nil { + { + size, err := m.Info.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.FromAddress) > 0 { + i -= len(m.FromAddress) + copy(dAtA[i:], m.FromAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.FromAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SubmitTaskResultResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SubmitTaskResultResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SubmitTaskResultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -1829,17 +2518,19 @@ func (m *TaskInfo) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Data) + l = len(m.Hash) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.TaskId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if m.TaskId != 0 { + n += 1 + sovTx(uint64(m.TaskId)) } if m.TaskResponsePeriod != 0 { n += 1 + sovTx(uint64(m.TaskResponsePeriod)) } + if m.TaskStatisticalPeriod != 0 { + n += 1 + sovTx(uint64(m.TaskStatisticalPeriod)) + } if m.TaskChallengePeriod != 0 { n += 1 + sovTx(uint64(m.TaskChallengePeriod)) } @@ -1849,6 +2540,69 @@ func (m *TaskInfo) Size() (n int) { if m.StartingEpoch != 0 { n += 1 + sovTx(uint64(m.StartingEpoch)) } + if m.ActualThreshold != 0 { + n += 1 + sovTx(uint64(m.ActualThreshold)) + } + if len(m.OptInOperators) > 0 { + for _, s := range m.OptInOperators { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + if len(m.SignedOperators) > 0 { + for _, s := range m.SignedOperators { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + if len(m.NoSignedOperators) > 0 { + for _, s := range m.NoSignedOperators { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + if len(m.ErrSignedOperators) > 0 { + for _, s := range m.ErrSignedOperators { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + l = m.TaskTotalPower.Size() + n += 1 + l + sovTx(uint64(l)) + if m.OperatorActivePower != nil { + l = m.OperatorActivePower.Size() + n += 2 + l + sovTx(uint64(l)) + } + return n +} + +func (m *OperatorActivePowerList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.OperatorPowerList) > 0 { + for _, e := range m.OperatorPowerList { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *OperatorActivePowerInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OperatorAddr) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.SelfActivePower.Size() + n += 1 + l + sovTx(uint64(l)) return n } @@ -1967,11 +2721,73 @@ func (m *DeRegisterAVSResponse) Size() (n int) { return n } -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func (m *TaskResultInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OperatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.TaskResponseHash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.TaskResponse) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.BlsSignature) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.TaskContractAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.TaskId != 0 { + n += 1 + sovTx(uint64(m.TaskId)) + } + l = len(m.Stage) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *SubmitTaskResultReq) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FromAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Info != nil { + l = m.Info.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *SubmitTaskResultResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (m *AVSInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) @@ -2948,7 +3764,7 @@ func (m *TaskInfo) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -2975,16 +3791,16 @@ func (m *TaskInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} } iNdEx = postIndex case 4: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TaskId", wireType) } - var stringLen uint64 + m.TaskId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2994,24 +3810,11 @@ func (m *TaskInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.TaskId |= uint64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TaskId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TaskResponsePeriod", wireType) @@ -3032,6 +3835,25 @@ func (m *TaskInfo) Unmarshal(dAtA []byte) error { } } case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TaskStatisticalPeriod", wireType) + } + m.TaskStatisticalPeriod = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TaskStatisticalPeriod |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field TaskChallengePeriod", wireType) } @@ -3050,7 +3872,7 @@ func (m *TaskInfo) Unmarshal(dAtA []byte) error { break } } - case 7: + case 8: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ThresholdPercentage", wireType) } @@ -3069,7 +3891,7 @@ func (m *TaskInfo) Unmarshal(dAtA []byte) error { break } } - case 8: + case 9: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field StartingEpoch", wireType) } @@ -3088,59 +3910,28 @@ func (m *TaskInfo) Unmarshal(dAtA []byte) error { break } } - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BlsPubKeyInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ActualThreshold", wireType) } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + m.ActualThreshold = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ActualThreshold |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BlsPubKeyInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BlsPubKeyInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 11: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OptInOperators", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3168,11 +3959,11 @@ func (m *BlsPubKeyInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Operator = string(dAtA[iNdEx:postIndex]) + m.OptInOperators = append(m.OptInOperators, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 2: + case 12: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SignedOperators", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3200,13 +3991,13 @@ func (m *BlsPubKeyInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Name = string(dAtA[iNdEx:postIndex]) + m.SignedOperators = append(m.SignedOperators, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 3: + case 13: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NoSignedOperators", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3216,79 +4007,27 @@ func (m *BlsPubKeyInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.PubKey = append(m.PubKey[:0], dAtA[iNdEx:postIndex]...) - if m.PubKey == nil { - m.PubKey = []byte{} - } + m.NoSignedOperators = append(m.NoSignedOperators, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RegisterAVSTaskReq) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RegisterAVSTaskReq: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RegisterAVSTaskReq: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 14: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ErrSignedOperators", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3316,13 +4055,13 @@ func (m *RegisterAVSTaskReq) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.FromAddress = string(dAtA[iNdEx:postIndex]) + m.ErrSignedOperators = append(m.ErrSignedOperators, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 2: + case 15: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Task", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TaskTotalPower", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3332,33 +4071,67 @@ func (m *RegisterAVSTaskReq) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Task == nil { - m.Task = &TaskInfo{} - } - if err := m.Task.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.TaskTotalPower.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorActivePower", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OperatorActivePower == nil { + m.OperatorActivePower = &OperatorActivePowerList{} + } + if err := m.OperatorActivePower.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err } if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthTx @@ -3375,7 +4148,7 @@ func (m *RegisterAVSTaskReq) Unmarshal(dAtA []byte) error { } return nil } -func (m *RegisterAVSTaskResponse) Unmarshal(dAtA []byte) error { +func (m *OperatorActivePowerList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3398,12 +4171,46 @@ func (m *RegisterAVSTaskResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RegisterAVSTaskResponse: wiretype end group for non-group") + return fmt.Errorf("proto: OperatorActivePowerList: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RegisterAVSTaskResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: OperatorActivePowerList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorPowerList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OperatorPowerList = append(m.OperatorPowerList, &OperatorActivePowerInfo{}) + if err := m.OperatorPowerList[len(m.OperatorPowerList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3425,7 +4232,7 @@ func (m *RegisterAVSTaskResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *RegisterAVSReq) Unmarshal(dAtA []byte) error { +func (m *OperatorActivePowerInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3448,15 +4255,15 @@ func (m *RegisterAVSReq) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RegisterAVSReq: wiretype end group for non-group") + return fmt.Errorf("proto: OperatorActivePowerInfo: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RegisterAVSReq: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: OperatorActivePowerInfo: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3484,13 +4291,13 @@ func (m *RegisterAVSReq) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.FromAddress = string(dAtA[iNdEx:postIndex]) + m.OperatorAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SelfActivePower", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3500,25 +4307,23 @@ func (m *RegisterAVSReq) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Info == nil { - m.Info = &AVSInfo{} - } - if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.SelfActivePower.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3543,7 +4348,7 @@ func (m *RegisterAVSReq) Unmarshal(dAtA []byte) error { } return nil } -func (m *RegisterAVSResponse) Unmarshal(dAtA []byte) error { +func (m *BlsPubKeyInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3566,15 +4371,15 @@ func (m *RegisterAVSResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RegisterAVSResponse: wiretype end group for non-group") + return fmt.Errorf("proto: BlsPubKeyInfo: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RegisterAVSResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: BlsPubKeyInfo: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3602,13 +4407,13 @@ func (m *RegisterAVSResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.FromAddress = string(dAtA[iNdEx:postIndex]) + m.Operator = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3618,26 +4423,56 @@ func (m *RegisterAVSResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Info == nil { - m.Info = &AVSInfo{} + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) } - if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PubKey = append(m.PubKey[:0], dAtA[iNdEx:postIndex]...) + if m.PubKey == nil { + m.PubKey = []byte{} } iNdEx = postIndex default: @@ -3661,7 +4496,7 @@ func (m *RegisterAVSResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeRegisterAVSReq) Unmarshal(dAtA []byte) error { +func (m *RegisterAVSTaskReq) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3684,10 +4519,10 @@ func (m *DeRegisterAVSReq) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeRegisterAVSReq: wiretype end group for non-group") + return fmt.Errorf("proto: RegisterAVSTaskReq: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeRegisterAVSReq: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: RegisterAVSTaskReq: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3724,7 +4559,7 @@ func (m *DeRegisterAVSReq) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Task", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3751,10 +4586,10 @@ func (m *DeRegisterAVSReq) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Info == nil { - m.Info = &AVSInfo{} + if m.Task == nil { + m.Task = &TaskInfo{} } - if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Task.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3779,7 +4614,7 @@ func (m *DeRegisterAVSReq) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeRegisterAVSResponse) Unmarshal(dAtA []byte) error { +func (m *RegisterAVSTaskResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3802,10 +4637,60 @@ func (m *DeRegisterAVSResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeRegisterAVSResponse: wiretype end group for non-group") + return fmt.Errorf("proto: RegisterAVSTaskResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeRegisterAVSResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: RegisterAVSTaskResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RegisterAVSReq) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RegisterAVSReq: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RegisterAVSReq: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3897,6 +4782,793 @@ func (m *DeRegisterAVSResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *RegisterAVSResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RegisterAVSResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RegisterAVSResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FromAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Info == nil { + m.Info = &AVSInfo{} + } + if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeRegisterAVSReq) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeRegisterAVSReq: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeRegisterAVSReq: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FromAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Info == nil { + m.Info = &AVSInfo{} + } + if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeRegisterAVSResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeRegisterAVSResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeRegisterAVSResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FromAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Info == nil { + m.Info = &AVSInfo{} + } + if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TaskResultInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TaskResultInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TaskResultInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OperatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TaskResponseHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TaskResponseHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TaskResponse", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TaskResponse = append(m.TaskResponse[:0], dAtA[iNdEx:postIndex]...) + if m.TaskResponse == nil { + m.TaskResponse = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlsSignature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlsSignature = append(m.BlsSignature[:0], dAtA[iNdEx:postIndex]...) + if m.BlsSignature == nil { + m.BlsSignature = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TaskContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TaskContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TaskId", wireType) + } + m.TaskId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TaskId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stage", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Stage = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SubmitTaskResultReq) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SubmitTaskResultReq: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SubmitTaskResultReq: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FromAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Info == nil { + m.Info = &TaskResultInfo{} + } + if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SubmitTaskResultResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SubmitTaskResultResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SubmitTaskResultResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/avs/types/tx.pb.gw.go b/x/avs/types/tx.pb.gw.go index 4132c208a..f003b9aee 100644 --- a/x/avs/types/tx.pb.gw.go +++ b/x/avs/types/tx.pb.gw.go @@ -141,6 +141,42 @@ func local_request_Msg_RegisterAVSTask_0(ctx context.Context, marshaler runtime. } +var ( + filter_Msg_SubmitTaskResult_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_SubmitTaskResult_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SubmitTaskResultReq + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_SubmitTaskResult_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SubmitTaskResult(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_SubmitTaskResult_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SubmitTaskResultReq + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_SubmitTaskResult_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.SubmitTaskResult(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". // UnaryRPC :call MsgServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -216,6 +252,29 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server }) + mux.Handle("POST", pattern_Msg_SubmitTaskResult_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_SubmitTaskResult_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_SubmitTaskResult_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -317,6 +376,26 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client }) + mux.Handle("POST", pattern_Msg_SubmitTaskResult_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Msg_SubmitTaskResult_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_SubmitTaskResult_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -326,6 +405,8 @@ var ( pattern_Msg_DeRegisterAVS_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"exocore", "avs", "v1", "tx", "DeRegisterAVS"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Msg_RegisterAVSTask_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"exocore", "avs", "v1", "tx", "RegisterAVSTask"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Msg_SubmitTaskResult_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"exocore", "avs", "v1", "tx", "SubmitTaskResult"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -334,4 +415,6 @@ var ( forward_Msg_DeRegisterAVS_0 = runtime.ForwardResponseMessage forward_Msg_RegisterAVSTask_0 = runtime.ForwardResponseMessage + + forward_Msg_SubmitTaskResult_0 = runtime.ForwardResponseMessage ) diff --git a/x/avs/types/types.go b/x/avs/types/types.go index 6cc3f71b7..5a031c568 100644 --- a/x/avs/types/types.go +++ b/x/avs/types/types.go @@ -1,8 +1,15 @@ package types import ( + "encoding/hex" + "encoding/json" + "fmt" + "math/big" + "sort" "strings" + "github.com/ethereum/go-ethereum/accounts/abi" + ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" @@ -70,6 +77,17 @@ type AVSRegisterOrDeregisterParams struct { Action uint64 } +var ( + taskResponseType, _ = abi.NewType("tuple", "struct", []abi.ArgumentMarshaling{ + {Name: "TaskID", Type: "uint64"}, + {Name: "NumberSum", Type: "uint256"}, + }) + + Args = abi.Arguments{ + {Type: taskResponseType, Name: "TaskResponse"}, + } +) + // ChainIDWithoutRevision returns the chainID without the revision number. // For example, "exocoretestnet_233-1" returns "exocoretestnet_233". func ChainIDWithoutRevision(chainID string) string { @@ -93,3 +111,72 @@ func GenerateAVSAddr(chainID string) string { ) return strings.ToLower(avsAddr.String()) } + +type TaskResponse struct { + TaskID uint64 + NumberSum *big.Int +} + +// GetTaskResponseDigestEncodeByjson returns the hash of the TaskResponse, which is what operators sign over +// MarshalTaskResponse marshals the TaskResponse struct into JSON bytes. +func MarshalTaskResponse(h TaskResponse) ([]byte, error) { + return json.Marshal(h) +} + +// UnmarshalTaskResponse unmarshals the JSON bytes into a TaskResponse struct. +func UnmarshalTaskResponse(jsonData []byte) (TaskResponse, error) { + var taskResponse TaskResponse + err := json.Unmarshal(jsonData, &taskResponse) + return taskResponse, err +} + +// GetTaskResponseDigestEncodeByjson returns the hash of the TaskResponse, which is what operators sign over. +func GetTaskResponseDigestEncodeByjson(h TaskResponse) ([32]byte, error) { + jsonData, err := MarshalTaskResponse(h) + if err != nil { + return [32]byte{}, err + } + taskResponseDigest := crypto.Keccak256Hash(jsonData) + return taskResponseDigest, nil +} + +// GetTaskResponseDigestEncodeByAbi returns the hash of the TaskResponse, which is what operators sign over. +func GetTaskResponseDigestEncodeByAbi(h TaskResponse) ([32]byte, error) { + packed, err := Args.Pack(&h) + if err != nil { + return [32]byte{}, err + } + fmt.Println("Res:", hex.EncodeToString(packed)) + hashAbi := crypto.Keccak256Hash(packed) + return hashAbi, nil +} + +func Difference(a, b []string) []string { + var different []string //nolint:prealloc + + diffMap := make(map[string]bool) + + // Add all elements of a to the map + for _, item := range a { + diffMap[item] = true + } + + // Remove elements found in b from the map and collect differences + for _, item := range b { + if diffMap[item] { + delete(diffMap, item) + } else { + different = append(different, item) + } + } + + // Add remaining elements from the map to different + for item := range diffMap { + different = append(different, item) + } + + // Sort the different slice + sort.Strings(different) + + return different +} diff --git a/x/operator/client/cli/query.go b/x/operator/client/cli/query.go index 743f80b69..d258907bf 100644 --- a/x/operator/client/cli/query.go +++ b/x/operator/client/cli/query.go @@ -3,7 +3,9 @@ package cli import ( "context" + "github.com/ExocoreNetwork/exocore/x/avs/types" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" "golang.org/x/xerrors" operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" @@ -33,6 +35,8 @@ func GetQueryCmd() *cobra.Command { QueryOperatorUSDValue(), QueryAVSUSDValue(), QueryOperatorSlashInfo(), + QueryAllOperatorsWithOptInAVS(), + QueryAllAVSsByOperator(), ) return cmd } @@ -346,3 +350,68 @@ func QueryOperatorSlashInfo() *cobra.Command { flags.AddQueryFlagsToCmd(cmd) return cmd } + +// QueryAllOperatorsWithOptInAVS queries all operators +func QueryAllOperatorsWithOptInAVS() *cobra.Command { + cmd := &cobra.Command{ + Use: "get-operator-list ", + Short: "Get list of operators by AVS", + Long: "Get the list of operators who have opted in to the specified AVS", + Example: "exocored query operator get-operator-list 0x598ACcB5e7F83cA6B19D70592Def9E5b25B978CA", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + if !common.IsHexAddress(args[0]) { + return xerrors.Errorf("invalid address,err:%s", types.ErrInvalidAddr) + } + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := operatortypes.NewQueryClient(clientCtx) + req := operatortypes.QueryAllOperatorsByOptInAVSRequest{ + Avs: args[0], + } + res, err := queryClient.QueryAllOperatorsWithOptInAVS(context.Background(), &req) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// QueryAllAVSsByOperator queries all avs +func QueryAllAVSsByOperator() *cobra.Command { + cmd := &cobra.Command{ + Use: "get-avs-list ", + Short: "Get list of AVSs by operator", + Long: "Get a list of AVSs to which an operator has opted in", + Example: "exocored query operator get-avs-list exo1mq6pj6f5tafmgkk6lehew5radfq3w20gpegzs5", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + addr, err := sdk.AccAddressFromBech32(args[0]) + if err != nil { + return xerrors.Errorf("invalid address,err:%s", types.ErrInvalidAddr) + } + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := operatortypes.NewQueryClient(clientCtx) + req := operatortypes.QueryAllAVSsByOperatorRequest{ + Operator: addr.String(), + } + res, err := queryClient.QueryAllAVSsByOperator(context.Background(), &req) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/operator/keeper/grpc_query.go b/x/operator/keeper/grpc_query.go index cb41ed15e..f66730b44 100644 --- a/x/operator/keeper/grpc_query.go +++ b/x/operator/keeper/grpc_query.go @@ -225,3 +225,25 @@ func (k *Keeper) QueryOperatorSlashInfo(goCtx context.Context, req *types.QueryO Pagination: pageRes, }, nil } + +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.QueryAllOperatorsByOptInAVSResponse{ + OperatorList: operatorList, + }, nil +} + +func (k *Keeper) QueryAllAVSsByOperator(goCtx context.Context, req *types.QueryAllAVSsByOperatorRequest) (*types.QueryAllAVSsByOperatorResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + avsList, err := k.GetOptedInAVSForOperator(ctx, req.Operator) + if err != nil { + return nil, err + } + return &types.QueryAllAVSsByOperatorResponse{ + AvsList: avsList, + }, nil +} diff --git a/x/operator/types/query.pb.go b/x/operator/types/query.pb.go index a11b544c8..1fd10f155 100644 --- a/x/operator/types/query.pb.go +++ b/x/operator/types/query.pb.go @@ -1137,6 +1137,196 @@ func (m *OperatorConsAddrPair) GetOptingOut() bool { return false } +// QueryAllOperatorsWithOptInAVSRequest is the request to obtain all opt-in operator addresses +// +// for a specific avs with pagination. +type QueryAllOperatorsByOptInAVSRequest struct { + // avs address + Avs string `protobuf:"bytes,1,opt,name=avs,proto3" json:"avs,omitempty"` +} + +func (m *QueryAllOperatorsByOptInAVSRequest) Reset() { *m = QueryAllOperatorsByOptInAVSRequest{} } +func (m *QueryAllOperatorsByOptInAVSRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllOperatorsByOptInAVSRequest) ProtoMessage() {} +func (*QueryAllOperatorsByOptInAVSRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f91e795a3cecbdbf, []int{20} +} +func (m *QueryAllOperatorsByOptInAVSRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllOperatorsByOptInAVSRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllOperatorsByOptInAVSRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllOperatorsByOptInAVSRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllOperatorsByOptInAVSRequest.Merge(m, src) +} +func (m *QueryAllOperatorsByOptInAVSRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllOperatorsByOptInAVSRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllOperatorsByOptInAVSRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllOperatorsByOptInAVSRequest proto.InternalMessageInfo + +func (m *QueryAllOperatorsByOptInAVSRequest) GetAvs() string { + if m != nil { + return m.Avs + } + return "" +} + +// QueryAllOperatorsWithOptInAVSResponse is the response that includes a list of all avs +// +// for a specified operator address. +type QueryAllOperatorsByOptInAVSResponse struct { + // operator_list is a list of operator addresses. + OperatorList []string `protobuf:"bytes,1,rep,name=operator_list,json=operatorList,proto3" json:"operator_list,omitempty"` +} + +func (m *QueryAllOperatorsByOptInAVSResponse) Reset() { *m = QueryAllOperatorsByOptInAVSResponse{} } +func (m *QueryAllOperatorsByOptInAVSResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllOperatorsByOptInAVSResponse) ProtoMessage() {} +func (*QueryAllOperatorsByOptInAVSResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f91e795a3cecbdbf, []int{21} +} +func (m *QueryAllOperatorsByOptInAVSResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllOperatorsByOptInAVSResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllOperatorsByOptInAVSResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllOperatorsByOptInAVSResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllOperatorsByOptInAVSResponse.Merge(m, src) +} +func (m *QueryAllOperatorsByOptInAVSResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllOperatorsByOptInAVSResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllOperatorsByOptInAVSResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllOperatorsByOptInAVSResponse proto.InternalMessageInfo + +func (m *QueryAllOperatorsByOptInAVSResponse) GetOperatorList() []string { + if m != nil { + return m.OperatorList + } + return nil +} + +// QueryAllAVSsByOperatorRequest is the request to obtain all operator addresses +// and consensus keys for a specific chain ID, with pagination. +type QueryAllAVSsByOperatorRequest struct { + // operator address. + Operator string `protobuf:"bytes,1,opt,name=operator,proto3" json:"operator,omitempty"` +} + +func (m *QueryAllAVSsByOperatorRequest) Reset() { *m = QueryAllAVSsByOperatorRequest{} } +func (m *QueryAllAVSsByOperatorRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllAVSsByOperatorRequest) ProtoMessage() {} +func (*QueryAllAVSsByOperatorRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f91e795a3cecbdbf, []int{22} +} +func (m *QueryAllAVSsByOperatorRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllAVSsByOperatorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllAVSsByOperatorRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllAVSsByOperatorRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllAVSsByOperatorRequest.Merge(m, src) +} +func (m *QueryAllAVSsByOperatorRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllAVSsByOperatorRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllAVSsByOperatorRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllAVSsByOperatorRequest proto.InternalMessageInfo + +func (m *QueryAllAVSsByOperatorRequest) GetOperator() string { + if m != nil { + return m.Operator + } + return "" +} + +// QueryAllAVSsByOperatorResponse is the response that includes a list of all operators +// and their consensus keys for a specified chain ID. +type QueryAllAVSsByOperatorResponse struct { + // avs_list is a list of avs addresses . + AvsList []string `protobuf:"bytes,1,rep,name=avs_list,json=avsList,proto3" json:"avs_list,omitempty"` +} + +func (m *QueryAllAVSsByOperatorResponse) Reset() { *m = QueryAllAVSsByOperatorResponse{} } +func (m *QueryAllAVSsByOperatorResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllAVSsByOperatorResponse) ProtoMessage() {} +func (*QueryAllAVSsByOperatorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f91e795a3cecbdbf, []int{23} +} +func (m *QueryAllAVSsByOperatorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllAVSsByOperatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllAVSsByOperatorResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAllAVSsByOperatorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllAVSsByOperatorResponse.Merge(m, src) +} +func (m *QueryAllAVSsByOperatorResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllAVSsByOperatorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllAVSsByOperatorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllAVSsByOperatorResponse proto.InternalMessageInfo + +func (m *QueryAllAVSsByOperatorResponse) GetAvsList() []string { + if m != nil { + return m.AvsList + } + return nil +} + func init() { proto.RegisterType((*GetOperatorInfoReq)(nil), "exocore.operator.v1.GetOperatorInfoReq") proto.RegisterType((*QueryAllOperatorsRequest)(nil), "exocore.operator.v1.QueryAllOperatorsRequest") @@ -1158,91 +1348,105 @@ func init() { proto.RegisterType((*QueryAllOperatorConsAddrsByChainIDRequest)(nil), "exocore.operator.v1.QueryAllOperatorConsAddrsByChainIDRequest") proto.RegisterType((*QueryAllOperatorConsAddrsByChainIDResponse)(nil), "exocore.operator.v1.QueryAllOperatorConsAddrsByChainIDResponse") proto.RegisterType((*OperatorConsAddrPair)(nil), "exocore.operator.v1.OperatorConsAddrPair") + proto.RegisterType((*QueryAllOperatorsByOptInAVSRequest)(nil), "exocore.operator.v1.QueryAllOperatorsByOptInAVSRequest") + proto.RegisterType((*QueryAllOperatorsByOptInAVSResponse)(nil), "exocore.operator.v1.QueryAllOperatorsByOptInAVSResponse") + proto.RegisterType((*QueryAllAVSsByOperatorRequest)(nil), "exocore.operator.v1.QueryAllAVSsByOperatorRequest") + proto.RegisterType((*QueryAllAVSsByOperatorResponse)(nil), "exocore.operator.v1.QueryAllAVSsByOperatorResponse") } func init() { proto.RegisterFile("exocore/operator/v1/query.proto", fileDescriptor_f91e795a3cecbdbf) } var fileDescriptor_f91e795a3cecbdbf = []byte{ - // 1255 bytes of a gzipped FileDescriptorProto + // 1422 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x4f, 0x73, 0xdb, 0x44, - 0x14, 0xcf, 0xa6, 0x2d, 0xad, 0x5f, 0xda, 0xd2, 0x6c, 0x52, 0x48, 0xdc, 0xd4, 0x4e, 0x35, 0xd0, - 0xa4, 0x26, 0x91, 0x88, 0x93, 0x72, 0x68, 0x29, 0x4c, 0x1c, 0x37, 0x25, 0x0d, 0x43, 0x82, 0x3c, - 0x64, 0x80, 0x03, 0x1e, 0x59, 0xda, 0x3a, 0x9a, 0x28, 0x5a, 0x47, 0x2b, 0x9b, 0x78, 0x32, 0x61, - 0x18, 0x4e, 0x30, 0x5c, 0x18, 0x7a, 0x64, 0xe0, 0x3b, 0xc0, 0x30, 0x5c, 0xf8, 0x00, 0xf4, 0xc0, - 0x21, 0xc0, 0x85, 0x53, 0x60, 0x1c, 0x3e, 0x08, 0xa3, 0xd5, 0xca, 0x7f, 0x14, 0xf9, 0x5f, 0xf0, - 0x70, 0xb3, 0x56, 0xef, 0xed, 0xfb, 0xfd, 0x7e, 0xef, 0xbd, 0x7d, 0x2b, 0x43, 0x92, 0xec, 0x53, - 0x9d, 0x3a, 0x44, 0xa1, 0x25, 0xe2, 0x68, 0x2e, 0x75, 0x94, 0xca, 0x82, 0xb2, 0x57, 0x26, 0x4e, - 0x55, 0x2e, 0x39, 0xd4, 0xa5,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, 0xed, 0x05, + 0xb9, 0x37, 0x38, 0xb9, 0xcb, 0x68, 0xa9, 0xcf, 0x44, 0xe7, 0xc3, 0x4c, 0x98, 0xe9, 0x8f, 0x95, + 0x66, 0x13, 0x0d, 0x8f, 0xf2, 0xf7, 0x6d, 0xb6, 0x29, 0x5b, 0x32, 0x7a, 0xad, 0xbf, 0xe3, 0xbf, + 0xa3, 0xf9, 0xa7, 0x5f, 0x1f, 0xdc, 0x50, 0x50, 0x5a, 0xe2, 0x94, 0x34, 0x34, 0x97, 0x70, 0x5a, + 0x31, 0xbd, 0x6d, 0x38, 0xd0, 0xb7, 0xcc, 0x3a, 0xdd, 0x46, 0xbf, 0xc8, 0x4c, 0xeb, 0x68, 0xe9, + 0xdd, 0x32, 0x2d, 0x69, 0x78, 0xe8, 0x96, 0x69, 0x89, 0x33, 0x43, 0x1f, 0xc8, 0xe5, 0x48, 0xd1, + 0x3c, 0x61, 0xb7, 0xf3, 0x77, 0x1e, 0xef, 0x66, 0x94, 0xa7, 0xbb, 0x19, 0xe5, 0xef, 0xdd, 0x8c, + 0xf2, 0xf5, 0x5e, 0x66, 0xe8, 0xe9, 0x5e, 0x66, 0xe8, 0xcf, 0xbd, 0xcc, 0xd0, 0x47, 0xd9, 0x8a, + 0xcd, 0x36, 0x6b, 0x1b, 0x9a, 0x45, 0xee, 0xeb, 0xd7, 0x83, 0x1d, 0xdf, 0xc1, 0xec, 0x13, 0xe2, + 0xdd, 0x0b, 0x1d, 0x3c, 0x6c, 0xba, 0x60, 0x8d, 0x2a, 0xa6, 0x1b, 0xcf, 0xf1, 0xff, 0x07, 0x17, + 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xc6, 0x74, 0x13, 0xe9, 0x0e, 0x15, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1277,6 +1481,10 @@ type QueryClient interface { // QueryAllOperatorConsAddrsByChainID queries all operators and their consensus addresses // for a specific chain ID QueryAllOperatorConsAddrsByChainID(ctx context.Context, in *QueryAllOperatorConsAddrsByChainIDRequest, opts ...grpc.CallOption) (*QueryAllOperatorConsAddrsByChainIDResponse, error) + // QueryAllOperatorsWithOptInAVS queries operator list by avs. + QueryAllOperatorsWithOptInAVS(ctx context.Context, in *QueryAllOperatorsByOptInAVSRequest, opts ...grpc.CallOption) (*QueryAllOperatorsByOptInAVSResponse, error) + // QueryAllAVSsByOperator queries avs list. + QueryAllAVSsByOperator(ctx context.Context, in *QueryAllAVSsByOperatorRequest, opts ...grpc.CallOption) (*QueryAllAVSsByOperatorResponse, error) } type queryClient struct { @@ -1368,6 +1576,24 @@ func (c *queryClient) QueryAllOperatorConsAddrsByChainID(ctx context.Context, in return out, nil } +func (c *queryClient) QueryAllOperatorsWithOptInAVS(ctx context.Context, in *QueryAllOperatorsByOptInAVSRequest, opts ...grpc.CallOption) (*QueryAllOperatorsByOptInAVSResponse, error) { + out := new(QueryAllOperatorsByOptInAVSResponse) + err := c.cc.Invoke(ctx, "/exocore.operator.v1.Query/QueryAllOperatorsWithOptInAVS", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) QueryAllAVSsByOperator(ctx context.Context, in *QueryAllAVSsByOperatorRequest, opts ...grpc.CallOption) (*QueryAllAVSsByOperatorResponse, error) { + out := new(QueryAllAVSsByOperatorResponse) + err := c.cc.Invoke(ctx, "/exocore.operator.v1.Query/QueryAllAVSsByOperator", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // QueryOperatorInfo queries the operator information. @@ -1390,6 +1616,10 @@ type QueryServer interface { // QueryAllOperatorConsAddrsByChainID queries all operators and their consensus addresses // for a specific chain ID QueryAllOperatorConsAddrsByChainID(context.Context, *QueryAllOperatorConsAddrsByChainIDRequest) (*QueryAllOperatorConsAddrsByChainIDResponse, error) + // QueryAllOperatorsWithOptInAVS queries operator list by avs. + QueryAllOperatorsWithOptInAVS(context.Context, *QueryAllOperatorsByOptInAVSRequest) (*QueryAllOperatorsByOptInAVSResponse, error) + // QueryAllAVSsByOperator queries avs list. + QueryAllAVSsByOperator(context.Context, *QueryAllAVSsByOperatorRequest) (*QueryAllAVSsByOperatorResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1423,6 +1653,12 @@ func (*UnimplementedQueryServer) QueryOperatorSlashInfo(ctx context.Context, req func (*UnimplementedQueryServer) QueryAllOperatorConsAddrsByChainID(ctx context.Context, req *QueryAllOperatorConsAddrsByChainIDRequest) (*QueryAllOperatorConsAddrsByChainIDResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryAllOperatorConsAddrsByChainID not implemented") } +func (*UnimplementedQueryServer) QueryAllOperatorsWithOptInAVS(ctx context.Context, req *QueryAllOperatorsByOptInAVSRequest) (*QueryAllOperatorsByOptInAVSResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryAllOperatorsWithOptInAVS not implemented") +} +func (*UnimplementedQueryServer) QueryAllAVSsByOperator(ctx context.Context, req *QueryAllAVSsByOperatorRequest) (*QueryAllAVSsByOperatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryAllAVSsByOperator not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1590,6 +1826,42 @@ func _Query_QueryAllOperatorConsAddrsByChainID_Handler(srv interface{}, ctx cont return interceptor(ctx, in, info, handler) } +func _Query_QueryAllOperatorsWithOptInAVS_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllOperatorsByOptInAVSRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryAllOperatorsWithOptInAVS(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.operator.v1.Query/QueryAllOperatorsWithOptInAVS", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryAllOperatorsWithOptInAVS(ctx, req.(*QueryAllOperatorsByOptInAVSRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_QueryAllAVSsByOperator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllAVSsByOperatorRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryAllAVSsByOperator(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.operator.v1.Query/QueryAllAVSsByOperator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryAllAVSsByOperator(ctx, req.(*QueryAllAVSsByOperatorRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "exocore.operator.v1.Query", HandlerType: (*QueryServer)(nil), @@ -1630,6 +1902,14 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "QueryAllOperatorConsAddrsByChainID", Handler: _Query_QueryAllOperatorConsAddrsByChainID_Handler, }, + { + MethodName: "QueryAllOperatorsWithOptInAVS", + Handler: _Query_QueryAllOperatorsWithOptInAVS_Handler, + }, + { + MethodName: "QueryAllAVSsByOperator", + Handler: _Query_QueryAllAVSsByOperator_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "exocore/operator/v1/query.proto", @@ -2457,6 +2737,130 @@ func (m *OperatorConsAddrPair) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *QueryAllOperatorsByOptInAVSRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllOperatorsByOptInAVSRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllOperatorsByOptInAVSRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Avs) > 0 { + i -= len(m.Avs) + copy(dAtA[i:], m.Avs) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Avs))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllOperatorsByOptInAVSResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllOperatorsByOptInAVSResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllOperatorsByOptInAVSResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OperatorList) > 0 { + for iNdEx := len(m.OperatorList) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.OperatorList[iNdEx]) + copy(dAtA[i:], m.OperatorList[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OperatorList[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryAllAVSsByOperatorRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllAVSsByOperatorRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllAVSsByOperatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Operator) > 0 { + i -= len(m.Operator) + copy(dAtA[i:], m.Operator) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Operator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllAVSsByOperatorResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAllAVSsByOperatorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllAVSsByOperatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AvsList) > 0 { + for iNdEx := len(m.AvsList) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.AvsList[iNdEx]) + copy(dAtA[i:], m.AvsList[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.AvsList[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -2798,16 +3202,72 @@ func (m *OperatorConsAddrPair) Size() (n int) { return n } -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GetOperatorInfoReq) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { +func (m *QueryAllOperatorsByOptInAVSRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Avs) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllOperatorsByOptInAVSResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.OperatorList) > 0 { + for _, s := range m.OperatorList { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryAllAVSsByOperatorRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Operator) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllAVSsByOperatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.AvsList) > 0 { + for _, s := range m.AvsList { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GetOperatorInfoReq) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { @@ -4999,6 +5459,334 @@ func (m *OperatorConsAddrPair) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryAllOperatorsByOptInAVSRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllOperatorsByOptInAVSRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllOperatorsByOptInAVSRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Avs", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Avs = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllOperatorsByOptInAVSResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllOperatorsByOptInAVSResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllOperatorsByOptInAVSResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorList", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OperatorList = append(m.OperatorList, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllAVSsByOperatorRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllAVSsByOperatorRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllAVSsByOperatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Operator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllAVSsByOperatorResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllAVSsByOperatorResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllAVSsByOperatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AvsList", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AvsList = append(m.AvsList, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/operator/types/query.pb.gw.go b/x/operator/types/query.pb.gw.go index dd2a98902..25774bec1 100644 --- a/x/operator/types/query.pb.gw.go +++ b/x/operator/types/query.pb.gw.go @@ -527,6 +527,114 @@ func local_request_Query_QueryAllOperatorConsAddrsByChainID_0(ctx context.Contex } +func request_Query_QueryAllOperatorsWithOptInAVS_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllOperatorsByOptInAVSRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["avs"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "avs") + } + + protoReq.Avs, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "avs", err) + } + + msg, err := client.QueryAllOperatorsWithOptInAVS(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryAllOperatorsWithOptInAVS_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllOperatorsByOptInAVSRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["avs"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "avs") + } + + protoReq.Avs, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "avs", err) + } + + msg, err := server.QueryAllOperatorsWithOptInAVS(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_QueryAllAVSsByOperator_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllAVSsByOperatorRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["operator"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator") + } + + protoReq.Operator, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator", err) + } + + msg, err := client.QueryAllAVSsByOperator(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryAllAVSsByOperator_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllAVSsByOperatorRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["operator"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator") + } + + protoReq.Operator, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator", err) + } + + msg, err := server.QueryAllAVSsByOperator(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -740,6 +848,52 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_QueryAllOperatorsWithOptInAVS_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryAllOperatorsWithOptInAVS_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryAllOperatorsWithOptInAVS_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryAllAVSsByOperator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryAllAVSsByOperator_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryAllAVSsByOperator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -961,6 +1115,46 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_QueryAllOperatorsWithOptInAVS_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryAllOperatorsWithOptInAVS_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryAllOperatorsWithOptInAVS_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QueryAllAVSsByOperator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryAllAVSsByOperator_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryAllAVSsByOperator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -982,6 +1176,10 @@ var ( pattern_Query_QueryOperatorSlashInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"exocore", "operator", "v1", "QueryOperatorSlashInfo"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_QueryAllOperatorConsAddrsByChainID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"exocore", "operator", "v1", "all_operator_cons_addrs", "chain"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryAllOperatorsWithOptInAVS_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"exocore", "operator", "v1", "opt", "operator_list", "avs"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryAllAVSsByOperator_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 1}, []string{"exocore", "operator", "v1", "opt", "avs_list"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -1002,4 +1200,8 @@ var ( forward_Query_QueryOperatorSlashInfo_0 = runtime.ForwardResponseMessage forward_Query_QueryAllOperatorConsAddrsByChainID_0 = runtime.ForwardResponseMessage + + forward_Query_QueryAllOperatorsWithOptInAVS_0 = runtime.ForwardResponseMessage + + forward_Query_QueryAllAVSsByOperator_0 = runtime.ForwardResponseMessage ) diff --git a/x/oracle/keeper/params.go b/x/oracle/keeper/params.go index ce152dcbe..f9eeaa657 100644 --- a/x/oracle/keeper/params.go +++ b/x/oracle/keeper/params.go @@ -83,7 +83,7 @@ func (k Keeper) RegisterNewTokenAndSetTokenFeeder(ctx sdk.Context, oInfo *types. Name: oInfo.Token.Name, ChainID: chainID, ContractAddress: oInfo.Token.Contract, - Decimal: int32(decimalInt), + Decimal: int32(decimalInt), // #nosec G115 Active: true, AssetID: oInfo.AssetID, })