From c413c7b96286b51e3cfb9a9f3a2974fa2dcaaa03 Mon Sep 17 00:00:00 2001 From: TimmyExogenous Date: Wed, 6 Mar 2024 17:53:33 +0800 Subject: [PATCH] fix the lint error --- app/app.go | 5 +- app/test_helpers.go | 5 +- go.mod | 6 +- go.sum | 4 - precompiles/delegation/delegation_test.go | 3 +- precompiles/delegation/setup_test.go | 3 +- precompiles/deposit/setup_test.go | 3 +- precompiles/reward/setup_test.go | 3 +- precompiles/slash/setup_test.go | 3 +- precompiles/withdraw/setup_test.go | 3 +- proto/exocore/delegation/v1/query.proto | 15 +- proto/exocore/delegation/v1/tx.proto | 2 - proto/exocore/operator/v1/query.proto | 19 +- proto/exocore/operator/v1/tx.proto | 123 ++- .../restaking_assets_manage/v1/tx.proto | 50 +- testutil/utils.go | 8 +- x/delegation/client/cli/tx.go | 2 +- x/delegation/keeper/abci.go | 17 +- x/delegation/keeper/cross_chain_tx_process.go | 28 +- x/delegation/keeper/delegation_op_test.go | 28 +- x/delegation/keeper/delegation_state.go | 26 +- x/delegation/keeper/keeper.go | 2 +- x/delegation/keeper/msg_server.go | 4 +- x/delegation/keeper/setup_test.go | 3 +- x/delegation/types/expected_keepers.go | 10 +- x/delegation/types/keys.go | 3 +- x/delegation/types/query.pb.go | 188 ++-- x/delegation/types/tx.pb.go | 187 ++-- x/deposit/keeper/setup_test.go | 3 +- x/operator/keeper/abci.go | 20 +- x/operator/keeper/avs_operator_shares.go | 78 +- x/operator/keeper/dogfood.go | 186 ++-- x/operator/keeper/grpc_query.go | 12 +- x/operator/keeper/keeper.go | 7 +- x/operator/keeper/msg_server.go | 23 +- x/operator/keeper/operator.go | 12 +- x/operator/keeper/operator_info_test.go | 2 +- x/operator/keeper/operator_slash_state.go | 22 +- x/operator/keeper/setup_test.go | 5 +- x/operator/keeper/state_update.go | 182 ++-- x/operator/keeper/state_update_test.go | 26 +- x/operator/module.go | 11 +- x/operator/types/app_chain_utils.go | 14 +- x/operator/types/codec.go | 13 +- x/operator/types/expected_keepers.go | 22 +- x/operator/types/hooks.go | 12 +- x/operator/types/keys.go | 63 +- x/operator/types/msg.go | 12 +- x/operator/types/query.pb.go | 203 ++-- x/operator/types/query.pb.gw.go | 28 +- x/operator/types/tx.pb.go | 847 +++++++++-------- x/restaking_assets_manage/keeper/app_chain.go | 14 +- .../keeper/grpc_query.go | 4 +- .../keeper/operator_asset.go | 10 +- .../keeper/setup_test.go | 3 +- .../keeper/staker_asset.go | 2 +- x/restaking_assets_manage/types/general.go | 10 +- x/restaking_assets_manage/types/keys.go | 3 +- x/restaking_assets_manage/types/tx.pb.go | 865 +++++++++++++++--- x/reward/keeper/claim_reward.go | 6 +- x/reward/keeper/setup_test.go | 3 +- x/slash/keeper/execute_slash.go | 4 +- x/slash/keeper/setup_test.go | 3 +- x/withdraw/keeper/claim_withdraw.go | 4 +- x/withdraw/keeper/setup_test.go | 3 +- 65 files changed, 2097 insertions(+), 1393 deletions(-) diff --git a/app/app.go b/app/app.go index f97ce2999..e91c77e0f 100644 --- a/app/app.go +++ b/app/app.go @@ -4,14 +4,15 @@ import ( "context" "encoding/json" "fmt" - "github.com/ExocoreNetwork/exocore/x/operator" - operatorKeeper "github.com/ExocoreNetwork/exocore/x/operator/keeper" "io" "net/http" "os" "path/filepath" "sort" + "github.com/ExocoreNetwork/exocore/x/operator" + operatorKeeper "github.com/ExocoreNetwork/exocore/x/operator/keeper" + exoslash "github.com/ExocoreNetwork/exocore/x/slash" slashKeeper "github.com/ExocoreNetwork/exocore/x/slash/keeper" diff --git a/app/test_helpers.go b/app/test_helpers.go index 150ad9914..54de19660 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -2,10 +2,11 @@ package app import ( "encoding/json" - pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types" "os" "time" + pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types" + "cosmossdk.io/simapp" dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" @@ -221,7 +222,7 @@ func SetupTestingApp(chainID string, pruneOpts *pruningtypes.PruningOptions, isP map[int64]bool{}, DefaultNodeHome, 5, cfg, simtestutil.NewAppOptionsWithFlagHome(DefaultNodeHome), - baseAppOptions[:]..., + baseAppOptions..., ) return app, NewDefaultGenesisState(app.appCodec) } diff --git a/go.mod b/go.mod index be0eb43af..ed82aa8bd 100644 --- a/go.mod +++ b/go.mod @@ -31,8 +31,11 @@ require ( go.opencensus.io v0.24.0 golang.org/x/crypto v0.12.0 golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb + golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e google.golang.org/grpc v1.57.1 + google.golang.org/protobuf v1.31.0 + gopkg.in/yaml.v2 v2.4.0 sigs.k8s.io/yaml v1.3.0 ) @@ -196,15 +199,12 @@ require ( golang.org/x/term v0.11.0 // indirect golang.org/x/text v0.12.0 // indirect golang.org/x/tools v0.10.0 // indirect - golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.126.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230815205213-6bfd019c3878 // indirect - google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.7 // indirect pgregory.net/rapid v0.5.5 // indirect diff --git a/go.sum b/go.sum index d33d5c4a7..066feca2a 100644 --- a/go.sum +++ b/go.sum @@ -786,8 +786,6 @@ github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:Htrtb github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM= -github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= github.com/dvsekhvalnov/jose2go v1.5.1-0.20231206184617-48ba0b76bc88 h1:y87odSHhV8WSSnjuFYC+K2V6LpZtEVcjmVWxtUkXZiQ= github.com/dvsekhvalnov/jose2go v1.5.1-0.20231206184617-48ba0b76bc88/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= @@ -2232,8 +2230,6 @@ google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsA google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= -google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= -google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/grpc v1.57.1 h1:upNTNqv0ES+2ZOOqACwVtS3Il8M12/+Hz41RCPzAjQg= google.golang.org/grpc v1.57.1/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= diff --git a/precompiles/delegation/delegation_test.go b/precompiles/delegation/delegation_test.go index 971941845..4b8254ef8 100644 --- a/precompiles/delegation/delegation_test.go +++ b/precompiles/delegation/delegation_test.go @@ -1,10 +1,11 @@ package delegation_test import ( - operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" "math/big" "strings" + operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" + sdkmath "cosmossdk.io/math" "github.com/ExocoreNetwork/exocore/app" diff --git a/precompiles/delegation/setup_test.go b/precompiles/delegation/setup_test.go index b5bec0e9b..4f6fe37f2 100644 --- a/precompiles/delegation/setup_test.go +++ b/precompiles/delegation/setup_test.go @@ -1,9 +1,10 @@ package delegation_test import ( + "testing" + "github.com/ExocoreNetwork/exocore/precompiles/delegation" "github.com/ExocoreNetwork/exocore/testutil" - "testing" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" diff --git a/precompiles/deposit/setup_test.go b/precompiles/deposit/setup_test.go index a489fe03d..4880ccdc5 100644 --- a/precompiles/deposit/setup_test.go +++ b/precompiles/deposit/setup_test.go @@ -1,9 +1,10 @@ package deposit_test import ( - "github.com/ExocoreNetwork/exocore/testutil" "testing" + "github.com/ExocoreNetwork/exocore/testutil" + "github.com/ExocoreNetwork/exocore/precompiles/deposit" . "github.com/onsi/ginkgo/v2" diff --git a/precompiles/reward/setup_test.go b/precompiles/reward/setup_test.go index 9b444815e..74e70a08b 100644 --- a/precompiles/reward/setup_test.go +++ b/precompiles/reward/setup_test.go @@ -1,9 +1,10 @@ package reward_test import ( - "github.com/ExocoreNetwork/exocore/testutil" "testing" + "github.com/ExocoreNetwork/exocore/testutil" + "github.com/ExocoreNetwork/exocore/precompiles/reward" . "github.com/onsi/ginkgo/v2" diff --git a/precompiles/slash/setup_test.go b/precompiles/slash/setup_test.go index dcae7c8ee..8ddec306f 100644 --- a/precompiles/slash/setup_test.go +++ b/precompiles/slash/setup_test.go @@ -1,9 +1,10 @@ package slash_test import ( - "github.com/ExocoreNetwork/exocore/testutil" "testing" + "github.com/ExocoreNetwork/exocore/testutil" + "github.com/ExocoreNetwork/exocore/precompiles/slash" . "github.com/onsi/ginkgo/v2" diff --git a/precompiles/withdraw/setup_test.go b/precompiles/withdraw/setup_test.go index 259b6c0b5..5a79fd128 100644 --- a/precompiles/withdraw/setup_test.go +++ b/precompiles/withdraw/setup_test.go @@ -1,9 +1,10 @@ package withdraw_test import ( - "github.com/ExocoreNetwork/exocore/testutil" "testing" + "github.com/ExocoreNetwork/exocore/testutil" + "github.com/ExocoreNetwork/exocore/precompiles/withdraw" . "github.com/onsi/ginkgo/v2" diff --git a/proto/exocore/delegation/v1/query.proto b/proto/exocore/delegation/v1/query.proto index 4d4316f8d..4eea10b16 100644 --- a/proto/exocore/delegation/v1/query.proto +++ b/proto/exocore/delegation/v1/query.proto @@ -20,8 +20,8 @@ message DelegationInfoReq { // DelegationAmounts is the delegation amount response for a single delegation. message DelegationAmounts { - // can_undelegation_amount is the amount that can be undelegated. - string can_undelegation_amount = 1 + // can_be_undelegated_amount is the amount that can be undelegated. + string can_be_undelegated_amount = 1 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", @@ -34,6 +34,13 @@ message DelegationAmounts { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; + // can_be_undelegated_after_slash is the amount that can be undelegated after slash + string can_be_undelegated_after_slash = 3 + [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; } // QueryDelegationInfoResponse is the response for delegations by staker id and @@ -69,10 +76,6 @@ message QueryOperatorInfoReq { // Query is the service API for the delegation module. service Query { - // OperatorInfo queries the operator information. - rpc QueryOperatorInfo(QueryOperatorInfoReq) returns (OperatorInfo) { - option (google.api.http).get = "/exocore/delegation/v1/GetOperatorInfo"; - } // DelegationInfo queries the delegation information for {stakerID, assetID}. rpc QueryDelegationInfo(DelegationInfoReq) returns (QueryDelegationInfoResponse) { option (cosmos.query.v1.module_query_safe) = true; diff --git a/proto/exocore/delegation/v1/tx.proto b/proto/exocore/delegation/v1/tx.proto index d5b6c4e2a..b4cdb98c9 100644 --- a/proto/exocore/delegation/v1/tx.proto +++ b/proto/exocore/delegation/v1/tx.proto @@ -166,8 +166,6 @@ message UndelegationResponse {} // Msg defines the delegation Msg service. service Msg { option (cosmos.msg.v1.service) = true; - // RegisterOperator registers a new operator. - rpc RegisterOperator(RegisterOperatorReq) returns (RegisterOperatorResponse); // DelegateAssetToOperator delegates asset to operator. rpc DelegateAssetToOperator(MsgDelegation) returns (DelegationResponse); // UndelegateAssetFromOperator undelegates asset from operator. diff --git a/proto/exocore/operator/v1/query.proto b/proto/exocore/operator/v1/query.proto index a638aafda..b4bdd33b1 100644 --- a/proto/exocore/operator/v1/query.proto +++ b/proto/exocore/operator/v1/query.proto @@ -10,27 +10,36 @@ import "tendermint/crypto/keys.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/operator/types"; +// QueryOperatorInfoReq is the request to obtain the operator information. message GetOperatorInfoReq { - string OperatorAddr = 1 + // operator_addr is the operator address. + string operator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } -message QueryOperatorConsKeyForChainIdRequest { +// QueryOperatorConsKeyForChainIDRequest is the request to obtain the consensus public key of the operator +message QueryOperatorConsKeyForChainIDRequest { + // addr is the ACC address of operator string addr = 1; + // chain_id is the id of the chain served by the operator string chain_id = 2; } -message QueryOperatorConsKeyForChainIdResponse { +// QueryOperatorConsKeyForChainIDResponse is the response for QueryOperatorConsKeyForChainId +message QueryOperatorConsKeyForChainIDResponse { + // public_key is the consensus public key of the operator tendermint.crypto.PublicKey public_key = 1 [ (gogoproto.nullable) = false ]; } +// Query defines the gRPC querier service. service Query { + // OperatorInfo queries the operator information. rpc GetOperatorInfo(GetOperatorInfoReq) returns(OperatorInfo){ option (google.api.http).get = "/exocore/delegation/v1/GetOperatorInfo"; } - // add services for dogfood - rpc QueryOperatorConsKeyForChainId(QueryOperatorConsKeyForChainIdRequest) returns (QueryOperatorConsKeyForChainIdResponse) { + // QueryOperatorConsKeyForChainID queries the consensus public key for the operator + rpc QueryOperatorConsKeyForChainID(QueryOperatorConsKeyForChainIDRequest) returns (QueryOperatorConsKeyForChainIDResponse) { option (google.api.http) = { get: "/exocore/operator_consent/v1/GetOperatorConsKey/{addr}/{chain_id}" }; diff --git a/proto/exocore/operator/v1/tx.proto b/proto/exocore/operator/v1/tx.proto index 3be495ba4..4149699f2 100644 --- a/proto/exocore/operator/v1/tx.proto +++ b/proto/exocore/operator/v1/tx.proto @@ -8,46 +8,64 @@ import "amino/amino.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/operator/types"; -message clientChainEarningAddrList { - repeated clientChainEarningAddrInfo EarningInfoList = 1; +// ValueField is a field that holds a value of sdk.LegacyDec type. +message ValueField { + // amount is the USD value of the asset, as an sdk.LegacyDec. + string amount = 1 + [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + +// ClientChainEarningAddrList is the list of client chain earning addresses. +message ClientChainEarningAddrList { + // earning_info_list is the contents of ClientChainEarningAddrList. + repeated ClientChainEarningAddrInfo earning_info_list = 1; } -message clientChainEarningAddrInfo { - uint64 lzClientChainID = 1; - string clientChainEarningAddr = 2; +// ClientChainEarningAddrInfo is the client chain earning address info. +message ClientChainEarningAddrInfo { + // lz_client_chain_id is the layer0 client chain id. + uint64 lz_client_chain_id = 1 [(gogoproto.customname) = "LzClientChainID"]; + // client_chain_earning_addr is the client chain earning address. + string client_chain_earning_addr = 2; } -message OperatorInfo{ - string EarningsAddr = 1; - string ApproveAddr = 2; - string OperatorMetaInfo = 3; - clientChainEarningAddrList ClientChainEarningsAddr = 4; +// OperatorInfo is the operator info. +message OperatorInfo { + // earnings_addr is the earnings address. + string earnings_addr = 1; + // approve_addr is the approve address. + string approve_addr = 2; + // operator_meta_info is the operator meta info. + string operator_meta_info = 3; + // client_chain_earning_addr_list is the client chain earning address list. + ClientChainEarningAddrList client_chain_earnings_addr = 4; } +// OptedInfo is the opted information about operator message OptedInfo { - string SlashContract = 1; - uint64 OptedInHeight = 2; - uint64 OptedOutHeight = 3; + // slash_contract is the slash contract address of AVS opted-in by the operator + string slash_contract = 1; + // opted_in_height is the height at which the operator opted in + uint64 opted_in_height = 2; + // opted_out_height is the height at which the operator opted out + uint64 opted_out_height = 3; } -message AssetOptedInState{ - string Amount = 1 +// OptedInAssetState is the state of opted-in asset +message OptedInAssetState{ + // amount of the opted-in asset + string amount = 1 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - - string Value = 2 - [ - (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; -} - -message ValueField { - string Amount = 1 + // value is the USD value of the opted-in asset + string value = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", @@ -55,13 +73,20 @@ message ValueField { ]; } +// OperatorSlashInfo is the slash info of operator message OperatorSlashInfo { - string SlashContract = 1; - int64 SlashHeight = 2; - int64 OccurredHeight = 3; - int64 ExecuteHeight = 4; - bool IsVeto = 5; - string SlashProportion = 6 + // slash_contract is the address of slash contract + string slash_contract = 1; + // slash_height is the height at which the slash event is submitted + int64 slash_height = 2; + // occurred_height is the height at which the slash event occurs + int64 occurred_height = 3; + // execute_height is the height at which the slash event is executed + int64 execute_height = 4; + // is_veto is a flag to indicate if this slash is vetoed + bool is_veto = 5; + // slash_proportion is the proportion of assets that need to be slashed + string slash_proportion = 6 [ (cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", @@ -69,21 +94,25 @@ message OperatorSlashInfo { ]; } +// RegisterOperatorReq is the request to register a new operator. message RegisterOperatorReq { option (cosmos.msg.v1.signer) = "FromAddress"; option (amino.name) = "cosmos-sdk/OperatorInfo"; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string FromAddress = 1 + // from_address is the address of the operator (sdk.AccAddress). + string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // info is the operator info. OperatorInfo info = 2; } +// RegisterOperatorResponse is the response to a register operator request. message RegisterOperatorResponse{} -// OptInToChainIdRequest defines the OptInToChainId request. -message OptInToChainIdRequest { +// OptInToChainIDRequest defines the OptInToChainID request. +message OptInToChainIDRequest { option (cosmos.msg.v1.signer) = "address"; string address = 1; string chain_id = 2; @@ -94,38 +123,38 @@ message OptInToChainIdRequest { string public_key = 3; } -// OptInToChainIdResponse defines the OptInToChainId response. -message OptInToChainIdResponse { +// OptInToChainIDResponse defines the OptInToChainID response. +message OptInToChainIDResponse { } -// InitiateOptOutFromChainIdRequest defines the InitiateOptOutFromChainId request. -message InitiateOptOutFromChainIdRequest { +// InitiateOptOutFromChainIDRequest defines the InitiateOptOutFromChainID request. +message InitiateOptOutFromChainIDRequest { option (cosmos.msg.v1.signer) = "address"; string address = 1; string chain_id = 2; } -// InitiateOptOutFromChainIdResponse defines the InitiateOptOutFromChainId response. -message InitiateOptOutFromChainIdResponse { +// InitiateOptOutFromChainIDResponse defines the InitiateOptOutFromChainID response. +message InitiateOptOutFromChainIDResponse { } -// Msg defines the delegation Msg service. +// Msg defines the operator Msg service. service Msg { option (cosmos.msg.v1.service) = true; - // CreateClawbackVestingAccount creats a vesting account that is subject to clawback. + // RegisterOperator registers a new operator. rpc RegisterOperator(RegisterOperatorReq) returns (RegisterOperatorResponse); // add services for dogfood - // OptInToChainId acts as opt in method for an operator to + // OptInToChainID acts as opt in method for an operator to // start validatring on a chain. The operator must sign the request with // the key with which they registered in the system. - rpc OptInToChainId(OptInToChainIdRequest) returns (OptInToChainIdResponse) {}; - // InitiateOptOutFromChainId is a method with which an operator can initiate + rpc OptInToChainID(OptInToChainIDRequest) returns (OptInToChainIDResponse) {}; + // InitiateOptOutFromChainID is a method with which an operator can initiate // the opt out process from a chain. The operator must sign the request with // the key with which they registered in the system. The opt-out process takes // as long as the chain's unbonding period to complete, plus some loose change // for message relaying across chains. - rpc InitiateOptOutFromChainId(InitiateOptOutFromChainIdRequest) returns (InitiateOptOutFromChainIdResponse) {}; + rpc InitiateOptOutFromChainID(InitiateOptOutFromChainIDRequest) returns (InitiateOptOutFromChainIDResponse) {}; } diff --git a/proto/exocore/restaking_assets_manage/v1/tx.proto b/proto/exocore/restaking_assets_manage/v1/tx.proto index 49eb87d8f..1b2b4e4f5 100644 --- a/proto/exocore/restaking_assets_manage/v1/tx.proto +++ b/proto/exocore/restaking_assets_manage/v1/tx.proto @@ -8,6 +8,15 @@ import "gogoproto/gogo.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/restaking_assets_manage/types"; +message ValueField { + string Amount = 1 + [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} + // ClientChainInfo defines the client chain information. message ClientChainInfo { // name of the client chain, like "Ethereum". @@ -29,6 +38,20 @@ message ClientChainInfo { uint32 address_length = 8; } +// AppChainInfo is used to store information related to the subscriber app chains we validate. +// The information stored within this module consists only of the chain's identifiers. +// The validation-related information is stored in the coordinator module. +message AppChainInfo { + // name of the chain, for example "ethereum" + string name = 1; + // meta_info is at Exocore's discretion to deter,ome + string meta_info = 2; + // chain_id is used as the primary key + string chain_id = 3; + // exo_core_chain_index is the index of the chain in exocore, so far unused + uint64 exo_core_chain_index = 4; +} + // AssetInfo defines the information for an asset to be used in staking. message AssetInfo { // name of the asset, like "Tether USD" @@ -88,9 +111,9 @@ message StakerSingleAssetOrChangeInfo { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - // wait_undelegation_amount_or_want_change_value is the amount that is waiting for undelegation + // wait_unbonding_amount_or_want_change_value is the amount that is waiting for undelegation // or the amount by which it can change. - string wait_undelegation_amount_or_want_change_value = 3 + string wait_unbonding_amount_or_want_change_value = 3 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", @@ -116,6 +139,7 @@ message OperatorSingleAssetOrChangeInfo { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; + // operator_own_amount_or_want_change_value is the amount that the operator owns // or the amount by which it can change. //todo: the field is used to mark operator's own assets and is not temporarily used now @@ -125,9 +149,27 @@ message OperatorSingleAssetOrChangeInfo { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - // wait_undelegation_amount_or_want_change_value is the amount that is waiting for undelegation + // wait_unbonding_amount_or_want_change_value is the amount that is waiting for unbonding // or the amount by which it can change. - string wait_undelegation_amount_or_want_change_value = 3 + string wait_unbonding_amount_or_want_change_value = 3 + [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + + // operator_own_wait_unbonding_amount is the amount that is owned by operator itself and waiting for unbonding + // or the amount by which it can change + string operator_own_wait_unbonding_amount = 4 + [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + + // operator_can_unbond_after_slash is the amount that is owned by operator itself and can be unbonded after slash + // or the amount by which it can change + string operator_can_unbond_after_slash = 5 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", diff --git a/testutil/utils.go b/testutil/utils.go index 1ddbf5e4a..02ab7135e 100644 --- a/testutil/utils.go +++ b/testutil/utils.go @@ -2,6 +2,8 @@ package testutil import ( "encoding/json" + "time" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/crypto/keyring" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" @@ -9,7 +11,6 @@ import ( "github.com/evmos/evmos/v14/testutil" "github.com/stretchr/testify/suite" "golang.org/x/exp/rand" - "time" testutiltx "github.com/ExocoreNetwork/exocore/testutil/tx" @@ -50,7 +51,7 @@ type BaseTestSuite struct { StateDB *statedb.StateDB QueryClientEVM evmtypes.QueryClient - //needed by test + // needed by test /* operatorAddr sdk.AccAddress avsAddr string assetID string @@ -187,7 +188,8 @@ func (suite *BaseTestSuite) DoSetupTest() { // create AccAddress for test pubBz := make([]byte, ed25519.PubKeySize) pub := &ed25519.PubKey{Key: pubBz} - rand.Read(pub.Key) + _, err = rand.Read(pub.Key) + suite.Require().NoError(err) suite.AccAddress = sdk.AccAddress(pub.Address()) // generate genesis account diff --git a/x/delegation/client/cli/tx.go b/x/delegation/client/cli/tx.go index 951a4341b..3e8854a55 100644 --- a/x/delegation/client/cli/tx.go +++ b/x/delegation/client/cli/tx.go @@ -18,7 +18,7 @@ func NewTxCmd() *cobra.Command { } txCmd.AddCommand( - //add tx commands + // add tx commands ) return txCmd } diff --git a/x/delegation/keeper/abci.go b/x/delegation/keeper/abci.go index b9f38fbdb..74060020b 100644 --- a/x/delegation/keeper/abci.go +++ b/x/delegation/keeper/abci.go @@ -20,7 +20,7 @@ func (k *Keeper) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Valida for _, record := range records { // check if the operator has been slashed or frozen operatorAccAddress := sdk.MustAccAddressFromBech32(record.OperatorAddr) - //todo: don't think about freezing the operator in current implementation + // todo: don't think about freezing the operator in current implementation /* if k.slashKeeper.IsOperatorFrozen(ctx, operatorAccAddress) { // reSet the completed height if the operator is frozen record.CompleteBlockNumber = k.expectedOperatorInterface.GetUnbondingExpirationBlockNumber(ctx, operatorAccAddress, record.BlockNumber) @@ -44,7 +44,10 @@ func (k *Keeper) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Valida panic(err) } // and the other is the fact that it matures at the next block - k.StoreWaitCompleteRecord(ctx, recordKey, record) + err = k.StoreWaitCompleteRecord(ctx, recordKey, record) + if err != nil { + panic(err) + } continue } // operator opt out: since operators can not immediately withdraw their funds, that is, @@ -55,13 +58,13 @@ func (k *Keeper) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Valida // the operator is still active on. the same applies to delegators too. // TODO(mike): ensure that operator is required to perform self delegation to match above. - //calculate the actual canUndelegated asset amount + // calculate the actual canUndelegated asset amount delegationInfo, err := k.GetSingleDelegationInfo(ctx, record.StakerID, record.AssetID, record.OperatorAddr) if err != nil { panic(err) } - if record.Amount.GT(delegationInfo.UndelegatableAmountAfterSlash) { - record.ActualCompletedAmount = delegationInfo.UndelegatableAmountAfterSlash + if record.Amount.GT(delegationInfo.CanBeUndelegatedAfterSlash) { + record.ActualCompletedAmount = delegationInfo.CanBeUndelegatedAfterSlash } else { record.ActualCompletedAmount = record.Amount } @@ -70,8 +73,8 @@ func (k *Keeper) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Valida // update delegation state delegatorAndAmount := make(map[string]*delegationtype.DelegationAmounts) delegatorAndAmount[record.OperatorAddr] = &delegationtype.DelegationAmounts{ - WaitUndelegationAmount: recordAmountNeg, - UndelegatableAmountAfterSlash: record.ActualCompletedAmount.Neg(), + WaitUndelegationAmount: recordAmountNeg, + CanBeUndelegatedAfterSlash: record.ActualCompletedAmount.Neg(), } err = k.UpdateDelegationState(ctx, record.StakerID, record.AssetID, delegatorAndAmount) if err != nil { diff --git a/x/delegation/keeper/cross_chain_tx_process.go b/x/delegation/keeper/cross_chain_tx_process.go index d373aee63..996ebda08 100644 --- a/x/delegation/keeper/cross_chain_tx_process.go +++ b/x/delegation/keeper/cross_chain_tx_process.go @@ -20,7 +20,7 @@ type DelegationOrUndelegationParams struct { OpAmount sdkmath.Int LzNonce uint64 TxHash common.Hash - //todo: The operator approved signature might be needed here in future + // todo: The operator approved signature might be needed here in future } // The event hook process has been deprecated, now we use precompile contract to trigger the calls. @@ -120,16 +120,16 @@ func (k *Keeper) DelegateTo(ctx sdk.Context, params *DelegationOrUndelegationPar return delegationtype.ErrOperatorIsFrozen } - //todo: The operator approved signature might be needed here in future + // todo: The operator approved signature might be needed here in future - //update the related states + // update the related states if params.OpAmount.IsNegative() { return delegationtype.ErrOpAmountIsNegative } stakerID, assetID := types.GetStakeIDAndAssetID(params.ClientChainLzID, params.StakerAddress, params.AssetsAddress) - //check if the staker asset has been deposited and the canWithdraw amount is bigger than the delegation amount + // check if the staker asset has been deposited and the canWithdraw amount is bigger than the delegation amount info, err := k.restakingStateKeeper.GetStakerSpecifiedAssetInfo(ctx, stakerID, assetID) if err != nil { return err @@ -139,7 +139,7 @@ func (k *Keeper) DelegateTo(ctx sdk.Context, params *DelegationOrUndelegationPar return errorsmod.Wrap(delegationtype.ErrDelegationAmountTooBig, fmt.Sprintf("the opAmount is:%s the canWithdraw amount is:%s", params.OpAmount, info.CanWithdrawAmountOrWantChangeValue)) } - //update staker asset state + // update staker asset state err = k.restakingStateKeeper.UpdateStakerAssetState(ctx, stakerID, assetID, types.StakerSingleAssetOrChangeInfo{ CanWithdrawAmountOrWantChangeValue: params.OpAmount.Neg(), }) @@ -156,7 +156,7 @@ func (k *Keeper) DelegateTo(ctx sdk.Context, params *DelegationOrUndelegationPar delegatorAndAmount := make(map[string]*delegationtype.DelegationAmounts) delegatorAndAmount[params.OperatorAddress.String()] = &delegationtype.DelegationAmounts{ - CanUndelegationAmount: params.OpAmount, + CanBeUndelegatedAmount: params.OpAmount, } err = k.UpdateDelegationState(ctx, stakerID, assetID, delegatorAndAmount) if err != nil { @@ -194,11 +194,11 @@ func (k *Keeper) UndelegateFrom(ctx sdk.Context, params *DelegationOrUndelegatio if err != nil { return err } - if params.OpAmount.GT(delegationState.CanUndelegationAmount) { - return errorsmod.Wrap(delegationtype.ErrUndelegationAmountTooBig, fmt.Sprintf("UndelegationAmount:%s,CanUndelegationAmount:%s", params.OpAmount, delegationState.CanUndelegationAmount)) + if params.OpAmount.GT(delegationState.CanBeUndelegatedAmount) { + return errorsmod.Wrap(delegationtype.ErrUndelegationAmountTooBig, fmt.Sprintf("UndelegationAmount:%s,CanBeUndelegatedAmount:%s", params.OpAmount, delegationState.CanBeUndelegatedAmount)) } - //record Undelegation event + // record Undelegation event r := &delegationtype.UndelegationRecord{ StakerID: stakerID, AssetID: assetID, @@ -216,12 +216,12 @@ func (k *Keeper) UndelegateFrom(ctx sdk.Context, params *DelegationOrUndelegatio return err } - //update delegation state + // update delegation state delegatorAndAmount := make(map[string]*delegationtype.DelegationAmounts) delegatorAndAmount[params.OperatorAddress.String()] = &delegationtype.DelegationAmounts{ - CanUndelegationAmount: params.OpAmount.Neg(), - WaitUndelegationAmount: params.OpAmount, - UndelegatableAmountAfterSlash: params.OpAmount, + CanBeUndelegatedAmount: params.OpAmount.Neg(), + WaitUndelegationAmount: params.OpAmount, + CanBeUndelegatedAfterSlash: params.OpAmount, } err = k.UpdateDelegationState(ctx, stakerID, assetID, delegatorAndAmount) if err != nil { @@ -232,7 +232,7 @@ func (k *Keeper) UndelegateFrom(ctx sdk.Context, params *DelegationOrUndelegatio return err } - //update staker and operator assets state + // update staker and operator assets state err = k.restakingStateKeeper.UpdateStakerAssetState(ctx, stakerID, assetID, types.StakerSingleAssetOrChangeInfo{ WaitUnbondingAmountOrWantChangeValue: params.OpAmount, }) diff --git a/x/delegation/keeper/delegation_op_test.go b/x/delegation/keeper/delegation_op_test.go index 1fd155bff..f0c9a5ace 100644 --- a/x/delegation/keeper/delegation_op_test.go +++ b/x/delegation/keeper/delegation_op_test.go @@ -1,9 +1,11 @@ package keeper_test import ( + "fmt" + errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" - "fmt" + keeper2 "github.com/ExocoreNetwork/exocore/x/delegation/keeper" delegationtype "github.com/ExocoreNetwork/exocore/x/delegation/types" "github.com/ExocoreNetwork/exocore/x/deposit/keeper" @@ -72,15 +74,15 @@ func (suite *DelegationTestSuite) TestDelegateTo() { OperatorOwnAmountOrWantChangeValue: sdkmath.NewInt(0), WaitUnbondingAmountOrWantChangeValue: sdkmath.NewInt(0), OperatorOwnWaitUnbondingAmount: sdkmath.NewInt(0), - OperatorUnbondableAmountAfterSlash: sdkmath.NewInt(0), + OperatorCanUnbondAfterSlash: sdkmath.NewInt(0), }, *operatorState) specifiedDelegationAmount, err := suite.App.DelegationKeeper.GetSingleDelegationInfo(suite.Ctx, stakerID, assetID, opAccAddr.String()) suite.NoError(err) suite.Equal(delegationtype.DelegationAmounts{ - CanUndelegationAmount: delegationParams.OpAmount, - WaitUndelegationAmount: sdkmath.NewInt(0), - UndelegatableAmountAfterSlash: sdkmath.NewInt(0), + CanBeUndelegatedAmount: delegationParams.OpAmount, + WaitUndelegationAmount: sdkmath.NewInt(0), + CanBeUndelegatedAfterSlash: sdkmath.NewInt(0), }, *specifiedDelegationAmount) totalDelegationAmount, err := suite.App.DelegationKeeper.GetStakerDelegationTotalAmount(suite.Ctx, stakerID, assetID) @@ -148,15 +150,15 @@ func (suite *DelegationTestSuite) TestUndelegateFrom() { OperatorOwnAmountOrWantChangeValue: sdkmath.NewInt(0), WaitUnbondingAmountOrWantChangeValue: delegationEvent.OpAmount, OperatorOwnWaitUnbondingAmount: sdkmath.NewInt(0), - OperatorUnbondableAmountAfterSlash: sdkmath.NewInt(0), + OperatorCanUnbondAfterSlash: sdkmath.NewInt(0), }, *operatorState) specifiedDelegationAmount, err := suite.App.DelegationKeeper.GetSingleDelegationInfo(suite.Ctx, stakerID, assetID, opAccAddr.String()) suite.NoError(err) suite.Equal(delegationtype.DelegationAmounts{ - CanUndelegationAmount: sdkmath.NewInt(0), - WaitUndelegationAmount: delegationEvent.OpAmount, - UndelegatableAmountAfterSlash: delegationEvent.OpAmount, + CanBeUndelegatedAmount: sdkmath.NewInt(0), + WaitUndelegationAmount: delegationEvent.OpAmount, + CanBeUndelegatedAfterSlash: delegationEvent.OpAmount, }, *specifiedDelegationAmount) totalDelegationAmount, err := suite.App.DelegationKeeper.GetStakerDelegationTotalAmount(suite.Ctx, stakerID, assetID) @@ -253,15 +255,15 @@ func (suite *DelegationTestSuite) TestCompleteUndelegation() { OperatorOwnAmountOrWantChangeValue: sdkmath.NewInt(0), WaitUnbondingAmountOrWantChangeValue: sdkmath.NewInt(0), OperatorOwnWaitUnbondingAmount: sdkmath.NewInt(0), - OperatorUnbondableAmountAfterSlash: sdkmath.NewInt(0), + OperatorCanUnbondAfterSlash: sdkmath.NewInt(0), }, *operatorState) specifiedDelegationAmount, err := suite.App.DelegationKeeper.GetSingleDelegationInfo(suite.Ctx, stakerID, assetID, opAccAddr.String()) suite.NoError(err) suite.Equal(delegationtype.DelegationAmounts{ - CanUndelegationAmount: sdkmath.NewInt(0), - WaitUndelegationAmount: sdkmath.NewInt(0), - UndelegatableAmountAfterSlash: sdkmath.NewInt(0), + CanBeUndelegatedAmount: sdkmath.NewInt(0), + WaitUndelegationAmount: sdkmath.NewInt(0), + CanBeUndelegatedAfterSlash: sdkmath.NewInt(0), }, *specifiedDelegationAmount) totalDelegationAmount, err := suite.App.DelegationKeeper.GetStakerDelegationTotalAmount(suite.Ctx, stakerID, assetID) diff --git a/x/delegation/keeper/delegation_state.go b/x/delegation/keeper/delegation_state.go index ba353d5b5..964415386 100644 --- a/x/delegation/keeper/delegation_state.go +++ b/x/delegation/keeper/delegation_state.go @@ -45,10 +45,10 @@ func (k *Keeper) GetStakerDelegationTotalAmount(ctx sdk.Context, stakerID string isExit := store.Has(prefixKey) if !isExit { return sdkmath.Int{}, errorsmod.Wrap(delegationtype.ErrNoKeyInTheStore, fmt.Sprintf("GetStakerDelegationTotalAmount: key is %s", prefixKey)) - } else { - value := store.Get(prefixKey) - k.cdc.MustUnmarshal(value, &ret) } + value := store.Get(prefixKey) + k.cdc.MustUnmarshal(value, &ret) + return ret.Amount, nil } @@ -56,25 +56,25 @@ func (k *Keeper) GetStakerDelegationTotalAmount(ctx sdk.Context, stakerID string // Compared to `UpdateStakerDelegationTotalAmount`,they use the same kv store, but in this function the store key needs to add the operator address as a suffix. func (k *Keeper) UpdateDelegationState(ctx sdk.Context, stakerID string, assetID string, delegationAmounts map[string]*delegationtype.DelegationAmounts) (err error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), delegationtype.KeyPrefixRestakerDelegationInfo) - //todo: think about the difference between init and update in future + // todo: think about the difference between init and update in future for opAddr, amounts := range delegationAmounts { if amounts == nil { continue } - if amounts.CanUndelegationAmount.IsNil() && amounts.WaitUndelegationAmount.IsNil() { + if amounts.CanBeUndelegatedAmount.IsNil() && amounts.WaitUndelegationAmount.IsNil() { continue } - //check operator address validation + // check operator address validation _, err := sdk.AccAddressFromBech32(opAddr) if err != nil { return delegationtype.OperatorAddrIsNotAccAddr } singleStateKey := stakingtypes.GetJoinedStoreKey(stakerID, assetID, opAddr) delegationState := delegationtype.DelegationAmounts{ - CanUndelegationAmount: sdkmath.NewInt(0), - WaitUndelegationAmount: sdkmath.NewInt(0), - UndelegatableAmountAfterSlash: sdkmath.NewInt(0), + CanBeUndelegatedAmount: sdkmath.NewInt(0), + WaitUndelegationAmount: sdkmath.NewInt(0), + CanBeUndelegatedAfterSlash: sdkmath.NewInt(0), } if store.Has(singleStateKey) { @@ -82,9 +82,9 @@ func (k *Keeper) UpdateDelegationState(ctx sdk.Context, stakerID string, assetID k.cdc.MustUnmarshal(value, &delegationState) } - err = stakingtypes.UpdateAssetValue(&delegationState.CanUndelegationAmount, &amounts.CanUndelegationAmount) + err = stakingtypes.UpdateAssetValue(&delegationState.CanBeUndelegatedAmount, &amounts.CanBeUndelegatedAmount) if err != nil { - return errorsmod.Wrap(err, "UpdateDelegationState CanUndelegationAmount error") + return errorsmod.Wrap(err, "UpdateDelegationState CanBeUndelegatedAmount error") } err = stakingtypes.UpdateAssetValue(&delegationState.WaitUndelegationAmount, &amounts.WaitUndelegationAmount) @@ -92,12 +92,12 @@ func (k *Keeper) UpdateDelegationState(ctx sdk.Context, stakerID string, assetID return errorsmod.Wrap(err, "UpdateDelegationState WaitUndelegationAmount error") } - err = stakingtypes.UpdateAssetValue(&delegationState.UndelegatableAmountAfterSlash, &amounts.UndelegatableAmountAfterSlash) + err = stakingtypes.UpdateAssetValue(&delegationState.CanBeUndelegatedAfterSlash, &amounts.CanBeUndelegatedAfterSlash) if err != nil { return errorsmod.Wrap(err, "UpdateDelegationState CanUsedToUndelegateAmount error") } - //save single operator delegation state + // save single operator delegation state bz := k.cdc.MustMarshal(&delegationState) store.Set(singleStateKey, bz) } diff --git a/x/delegation/keeper/keeper.go b/x/delegation/keeper/keeper.go index 35eb12be1..46cfff188 100644 --- a/x/delegation/keeper/keeper.go +++ b/x/delegation/keeper/keeper.go @@ -18,7 +18,7 @@ type Keeper struct { storeKey storetypes.StoreKey cdc codec.BinaryCodec - //other keepers + // other keepers restakingStateKeeper keeper.Keeper depositKeeper depositkeeper.Keeper slashKeeper delegationtype.ISlashKeeper diff --git a/x/delegation/keeper/msg_server.go b/x/delegation/keeper/msg_server.go index e625c8ed6..f63ceca81 100644 --- a/x/delegation/keeper/msg_server.go +++ b/x/delegation/keeper/msg_server.go @@ -10,10 +10,10 @@ import ( var _ types.MsgServer = &Keeper{} // DelegateAssetToOperator todo: Delegation and Undelegation from exoCore chain directly will be implemented in future.At the moment,they are executed from client chain -func (k *Keeper) DelegateAssetToOperator(ctx context.Context, delegation *types.MsgDelegation) (*types.DelegationResponse, error) { +func (k *Keeper) DelegateAssetToOperator(_ context.Context, _ *types.MsgDelegation) (*types.DelegationResponse, error) { return nil, errorsmod.Wrap(types.ErrNotSupportYet, "func:DelegateAssetToOperator") } -func (k *Keeper) UndelegateAssetFromOperator(ctx context.Context, delegation *types.MsgUndelegation) (*types.UndelegationResponse, error) { +func (k *Keeper) UndelegateAssetFromOperator(_ context.Context, _ *types.MsgUndelegation) (*types.UndelegationResponse, error) { return nil, errorsmod.Wrap(types.ErrNotSupportYet, "func:UndelegateAssetFromOperator") } diff --git a/x/delegation/keeper/setup_test.go b/x/delegation/keeper/setup_test.go index c139e4874..ed6d4580e 100644 --- a/x/delegation/keeper/setup_test.go +++ b/x/delegation/keeper/setup_test.go @@ -1,9 +1,10 @@ package keeper_test import ( - "github.com/ExocoreNetwork/exocore/testutil" "testing" + "github.com/ExocoreNetwork/exocore/testutil" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" diff --git a/x/delegation/types/expected_keepers.go b/x/delegation/types/expected_keepers.go index 9e2e978ed..2062c7d3a 100644 --- a/x/delegation/types/expected_keepers.go +++ b/x/delegation/types/expected_keepers.go @@ -15,24 +15,24 @@ type ISlashKeeper interface { // VirtualISlashKeeper todo: When the actual keeper functionality has not been implemented yet, temporarily use the virtual keeper. type VirtualISlashKeeper struct{} -func (VirtualISlashKeeper) IsOperatorFrozen(ctx sdk.Context, opAddr sdk.AccAddress) bool { +func (VirtualISlashKeeper) IsOperatorFrozen(_ sdk.Context, _ sdk.AccAddress) bool { return false } -func (VirtualISlashKeeper) OperatorAssetSlashedProportion(ctx sdk.Context, opAddr sdk.AccAddress, assetID string, startHeight, endHeight uint64) sdkmath.LegacyDec { +func (VirtualISlashKeeper) OperatorAssetSlashedProportion(_ sdk.Context, _ sdk.AccAddress, _ string, _, _ uint64) sdkmath.LegacyDec { return sdkmath.LegacyNewDec(0) } // DelegationHooks add for dogfood type DelegationHooks interface { - //AfterDelegation we don't want the ability to cancel delegation or undelegation so no return type for + // AfterDelegation we don't want the ability to cancel delegation or undelegation so no return type for // either // for delegation, we only care about the address of the operator to cache the event AfterDelegation(ctx sdk.Context, operator sdk.AccAddress) - //AfterUndelegationStarted for undelegation, we use the address of the operator to figure out the list of impacted + // AfterUndelegationStarted for undelegation, we use the address of the operator to figure out the list of impacted // chains for that operator. and we need the identifier to hold it until confirmed by subscriber AfterUndelegationStarted(ctx sdk.Context, addr sdk.AccAddress, recordKey []byte) - //AfterUndelegationCompleted whenever an undelegation completes, we should update the vote power of the associated operator + // AfterUndelegationCompleted whenever an undelegation completes, we should update the vote power of the associated operator // on all of the chain ids that are impacted AfterUndelegationCompleted(ctx sdk.Context, addr sdk.AccAddress) } diff --git a/x/delegation/types/keys.go b/x/delegation/types/keys.go index 262d9b75d..4ce78ed44 100644 --- a/x/delegation/types/keys.go +++ b/x/delegation/types/keys.go @@ -1,11 +1,12 @@ package types import ( + "strings" + "github.com/ExocoreNetwork/exocore/x/restaking_assets_manage/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "strings" ) // constants diff --git a/x/delegation/types/query.pb.go b/x/delegation/types/query.pb.go index 55dd872d0..22f66891c 100644 --- a/x/delegation/types/query.pb.go +++ b/x/delegation/types/query.pb.go @@ -90,10 +90,12 @@ func (m *DelegationInfoReq) GetAssetID() string { // DelegationAmounts is the delegation amount response for a single delegation. type DelegationAmounts struct { - // can_undelegation_amount is the amount that can be undelegated. - CanUndelegationAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=can_undelegation_amount,json=canUndelegationAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"can_undelegation_amount"` + // can_be_undelegated_amount is the amount that can be undelegated. + CanBeUndelegatedAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=can_be_undelegated_amount,json=canBeUndelegatedAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"can_be_undelegated_amount"` // wait_undelegation_amount is the amount that is waiting to be unbonded. WaitUndelegationAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=wait_undelegation_amount,json=waitUndelegationAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"wait_undelegation_amount"` + // can_be_undelegated_after_slash is the amount that can be undelegated after slash + CanBeUndelegatedAfterSlash github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=can_be_undelegated_after_slash,json=canBeUndelegatedAfterSlash,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"can_be_undelegated_after_slash"` } func (m *DelegationAmounts) Reset() { *m = DelegationAmounts{} } @@ -300,50 +302,50 @@ func init() { func init() { proto.RegisterFile("exocore/delegation/v1/query.proto", fileDescriptor_aab345e1cf20490c) } var fileDescriptor_aab345e1cf20490c = []byte{ - // 676 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4f, 0x4f, 0x13, 0x4f, - 0x18, 0xee, 0x96, 0x1f, 0x3f, 0x60, 0xc0, 0x08, 0x63, 0x81, 0x52, 0xcc, 0x16, 0xd7, 0x84, 0x54, - 0x0c, 0xbb, 0x52, 0x35, 0x31, 0x46, 0x4c, 0x20, 0x25, 0x64, 0x2f, 0x18, 0x97, 0x70, 0xf1, 0xd2, - 0x0c, 0xdd, 0x61, 0xdd, 0xb4, 0xcc, 0x94, 0x99, 0x69, 0xa1, 0x47, 0xf5, 0xe2, 0xd1, 0xc4, 0xf8, - 0x25, 0xf4, 0xe2, 0x81, 0x0f, 0xc1, 0x91, 0xe0, 0xc5, 0x78, 0x68, 0x4c, 0x31, 0xf1, 0x03, 0xf8, - 0x05, 0xcc, 0xce, 0x4e, 0xa1, 0x7f, 0x76, 0x51, 0x22, 0xa7, 0xee, 0xbe, 0x7f, 0x9e, 0xe7, 0x99, - 0xf7, 0x7d, 0x76, 0x0a, 0x6e, 0xe1, 0x03, 0x5a, 0xa2, 0x0c, 0x5b, 0x2e, 0xae, 0x60, 0x0f, 0x09, - 0x9f, 0x12, 0xab, 0xbe, 0x64,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x00, 0xff, 0xff, 0xde, 0x68, 0x9a, 0xc7, - 0x0b, 0x07, 0x00, 0x00, + // 680 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xcf, 0x4f, 0x13, 0x4b, + 0x1c, 0xef, 0x6e, 0xc3, 0x03, 0x06, 0x5e, 0x1e, 0x6f, 0x5e, 0x1f, 0x96, 0x62, 0xb6, 0xd8, 0x03, + 0xa9, 0x24, 0xec, 0x4a, 0xd5, 0xc4, 0x18, 0x31, 0x81, 0x94, 0x90, 0xbd, 0x60, 0xdc, 0x86, 0x8b, + 0x97, 0xcd, 0xd0, 0x9d, 0x2e, 0x9b, 0x2e, 0x33, 0x65, 0x66, 0x5a, 0xe8, 0xcd, 0x78, 0xd1, 0xa3, + 0x89, 0xff, 0x85, 0x5e, 0x3c, 0xf0, 0x47, 0x70, 0x24, 0x78, 0x31, 0x1e, 0x1a, 0x53, 0x4c, 0x3c, + 0x78, 0xf4, 0x1f, 0x30, 0x3b, 0x3b, 0xd0, 0x52, 0xb6, 0x28, 0x11, 0x4f, 0xdd, 0xfd, 0xfe, 0xf8, + 0x7c, 0x3e, 0xdf, 0x5f, 0x5d, 0x70, 0x0b, 0xef, 0xd3, 0x2a, 0x65, 0xd8, 0xf2, 0x70, 0x88, 0x7d, + 0x24, 0x02, 0x4a, 0xac, 0xd6, 0x92, 0xb5, 0xdb, 0xc4, 0xac, 0x6d, 0x36, 0x18, 0x15, 0x14, 0xfe, + 0xaf, 0x42, 0xcc, 0x5e, 0x88, 0xd9, 0x5a, 0xca, 0xcd, 0x56, 0x29, 0xdf, 0xa1, 0x3c, 0x0e, 0x1d, + 0xc8, 0xc9, 0xcd, 0xc4, 0x4e, 0x57, 0xbe, 0x59, 0xf1, 0x8b, 0x72, 0x19, 0xc9, 0x8c, 0x62, 0x5f, + 0xf9, 0x33, 0x3e, 0xf5, 0x69, 0x9c, 0x17, 0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44, 0x25, 0x9f, 0x2a, 0xbd, 0x40, 0xaf, 0x5d, 0x85, 0xbe, 0xf4, + 0x4d, 0x07, 0x23, 0x12, 0x17, 0xbe, 0xd5, 0xc0, 0x7f, 0x09, 0x23, 0x84, 0x3f, 0xef, 0xad, 0x92, + 0x92, 0x2b, 0x5d, 0x7d, 0x31, 0x0a, 0xf7, 0x5f, 0x7d, 0x7d, 0xbf, 0xa0, 0xbd, 0xf8, 0xf0, 0xe5, + 0x8d, 0xbe, 0x00, 0x8b, 0x56, 0xf2, 0xdf, 0xe9, 0x3a, 0x16, 0x03, 0xa2, 0x0e, 0x34, 0x30, 0x23, + 0x61, 0x93, 0x06, 0x08, 0xcd, 0x21, 0x42, 0x86, 0x4c, 0x3b, 0xf7, 0xcb, 0xeb, 0x53, 0x58, 0xee, + 0xc9, 0x2d, 0xc1, 0x3b, 0x43, 0xe4, 0x0e, 0x15, 0xb6, 0xba, 0x71, 0xd8, 0x35, 0xb4, 0xa3, 0xae, + 0xa1, 0x7d, 0xee, 0x1a, 0xda, 0xeb, 0x13, 0x23, 0x75, 0x74, 0x62, 0xa4, 0x3e, 0x9e, 0x18, 0xa9, + 0x67, 0xf7, 0xfa, 0x4e, 0x77, 0x2d, 0x46, 0xdd, 0xc0, 0x62, 0x8f, 0xb2, 0xfa, 0x19, 0xc9, 0x7e, + 0x3f, 0x8d, 0x3c, 0xe6, 0xad, 0xbf, 0xe4, 0x17, 0xe3, 0xee, 0x8f, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x4d, 0xdb, 0x0e, 0x7b, 0xf9, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -358,8 +360,6 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - // OperatorInfo queries the operator information. - QueryOperatorInfo(ctx context.Context, in *QueryOperatorInfoReq, opts ...grpc.CallOption) (*OperatorInfo, error) // DelegationInfo queries the delegation information for {stakerID, assetID}. QueryDelegationInfo(ctx context.Context, in *DelegationInfoReq, opts ...grpc.CallOption) (*QueryDelegationInfoResponse, error) // SingleDelegationInfo queries the single delegation information for @@ -375,15 +375,6 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) QueryOperatorInfo(ctx context.Context, in *QueryOperatorInfoReq, opts ...grpc.CallOption) (*OperatorInfo, error) { - out := new(OperatorInfo) - err := c.cc.Invoke(ctx, "/exocore.delegation.v1.Query/QueryOperatorInfo", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) QueryDelegationInfo(ctx context.Context, in *DelegationInfoReq, opts ...grpc.CallOption) (*QueryDelegationInfoResponse, error) { out := new(QueryDelegationInfoResponse) err := c.cc.Invoke(ctx, "/exocore.delegation.v1.Query/QueryDelegationInfo", in, out, opts...) @@ -404,8 +395,6 @@ func (c *queryClient) QuerySingleDelegationInfo(ctx context.Context, in *SingleD // QueryServer is the server API for Query service. type QueryServer interface { - // OperatorInfo queries the operator information. - QueryOperatorInfo(context.Context, *QueryOperatorInfoReq) (*OperatorInfo, error) // DelegationInfo queries the delegation information for {stakerID, assetID}. QueryDelegationInfo(context.Context, *DelegationInfoReq) (*QueryDelegationInfoResponse, error) // SingleDelegationInfo queries the single delegation information for @@ -417,9 +406,6 @@ type QueryServer interface { type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) QueryOperatorInfo(ctx context.Context, req *QueryOperatorInfoReq) (*OperatorInfo, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryOperatorInfo not implemented") -} func (*UnimplementedQueryServer) QueryDelegationInfo(ctx context.Context, req *DelegationInfoReq) (*QueryDelegationInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryDelegationInfo not implemented") } @@ -431,24 +417,6 @@ func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_QueryOperatorInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryOperatorInfoReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).QueryOperatorInfo(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/exocore.delegation.v1.Query/QueryOperatorInfo", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryOperatorInfo(ctx, req.(*QueryOperatorInfoReq)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_QueryDelegationInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(DelegationInfoReq) if err := dec(in); err != nil { @@ -489,10 +457,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "exocore.delegation.v1.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "QueryOperatorInfo", - Handler: _Query_QueryOperatorInfo_Handler, - }, { MethodName: "QueryDelegationInfo", Handler: _Query_QueryDelegationInfo_Handler, @@ -563,6 +527,16 @@ func (m *DelegationAmounts) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.CanBeUndelegatedAfterSlash.Size() + i -= size + if _, err := m.CanBeUndelegatedAfterSlash.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a { size := m.WaitUndelegationAmount.Size() i -= size @@ -574,9 +548,9 @@ func (m *DelegationAmounts) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 { - size := m.CanUndelegationAmount.Size() + size := m.CanBeUndelegatedAmount.Size() i -= size - if _, err := m.CanUndelegationAmount.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.CanBeUndelegatedAmount.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintQuery(dAtA, i, uint64(size)) @@ -753,10 +727,12 @@ func (m *DelegationAmounts) Size() (n int) { } var l int _ = l - l = m.CanUndelegationAmount.Size() + l = m.CanBeUndelegatedAmount.Size() n += 1 + l + sovQuery(uint64(l)) l = m.WaitUndelegationAmount.Size() n += 1 + l + sovQuery(uint64(l)) + l = m.CanBeUndelegatedAfterSlash.Size() + n += 1 + l + sovQuery(uint64(l)) return n } @@ -969,7 +945,7 @@ func (m *DelegationAmounts) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CanUndelegationAmount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CanBeUndelegatedAmount", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -997,7 +973,7 @@ func (m *DelegationAmounts) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.CanUndelegationAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.CanBeUndelegatedAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1035,6 +1011,40 @@ func (m *DelegationAmounts) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CanBeUndelegatedAfterSlash", 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 + } + if err := m.CanBeUndelegatedAfterSlash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/delegation/types/tx.pb.go b/x/delegation/types/tx.pb.go index 82266f9cf..030d187a4 100644 --- a/x/delegation/types/tx.pb.go +++ b/x/delegation/types/tx.pb.go @@ -835,83 +835,82 @@ func init() { func init() { proto.RegisterFile("exocore/delegation/v1/tx.proto", fileDescriptor_16596a15a828f109) } var fileDescriptor_16596a15a828f109 = []byte{ - // 1207 bytes of a gzipped FileDescriptorProto + // 1187 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xf7, 0xda, 0x69, 0x62, 0x3f, 0x3b, 0x4a, 0x3b, 0x75, 0x62, 0xc7, 0x80, 0xdd, 0x6e, 0xa1, - 0x6a, 0x43, 0x63, 0xab, 0xa1, 0xa2, 0x50, 0x40, 0x22, 0xa9, 0x53, 0x30, 0x34, 0x69, 0xd9, 0x16, + 0x14, 0xf7, 0xc6, 0x69, 0x62, 0x3f, 0x3b, 0x4a, 0x3b, 0x75, 0x62, 0xc7, 0x80, 0xdd, 0x6e, 0xa1, + 0x6a, 0x4b, 0x63, 0xab, 0xa1, 0xa2, 0x50, 0x40, 0x22, 0x89, 0x53, 0x30, 0x34, 0x69, 0xd9, 0x04, 0x0e, 0x48, 0xd5, 0x6a, 0xbd, 0x3b, 0x59, 0x2f, 0x5e, 0xcf, 0x98, 0x9d, 0x71, 0x6a, 0x87, 0x0b, - 0xe2, 0x84, 0x38, 0x71, 0x45, 0x5c, 0xca, 0x17, 0x40, 0x3d, 0xf4, 0x0b, 0x70, 0xeb, 0xb1, 0xea, - 0x09, 0x21, 0x11, 0x21, 0xf7, 0x50, 0x3e, 0x00, 0x47, 0x0e, 0x68, 0x67, 0x76, 0xbd, 0xeb, 0xc6, - 0x6e, 0xa8, 0xc8, 0x81, 0x4b, 0xe2, 0x7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 0x06, 0x75, - 0x6d, 0x4e, 0x28, 0x1b, 0x16, 0xf2, 0x60, 0x89, 0x53, 0x6e, 0xb8, 0xba, 0x15, 0x22, 0xe9, 0x41, - 0xa8, 0xc9, 0x23, 0x08, 0x35, 0x2f, 0xb0, 0x47, 0x41, 0xae, 0x0b, 0x64, 0x34, 0x80, 0x7c, 0x17, - 0x7b, 0x3a, 0xed, 0x62, 0xcf, 0xe0, 0xd4, 0x0b, 0x08, 0x59, 0x31, 0x75, 0x2a, 0x75, 0x2e, 0xbb, - 0xf6, 0x41, 0x75, 0x62, 0xbf, 0xaa, 0xd3, 0x52, 0xad, 0xde, 0xc4, 0xde, 0x8d, 0x00, 0x4a, 0x12, - 0xb0, 0x4d, 0xc2, 0xbd, 0x81, 0x86, 0xba, 0x07, 0x14, 0xa5, 0x16, 0x14, 0xa6, 0x98, 0xa3, 0xe3, - 0x90, 0x6a, 0xe3, 0x81, 0x2c, 0x96, 0xe6, 0xff, 0x44, 0x97, 0xe1, 0xd8, 0xae, 0xdf, 0x44, 0x51, - 0x8a, 0xec, 0xda, 0xe9, 0x29, 0x81, 0x45, 0x8d, 0xd6, 0xa4, 0xfd, 0x95, 0xe4, 0x5b, 0x8a, 0xfa, - 0x15, 0x94, 0xae, 0xba, 0x0e, 0x26, 0xfc, 0x6a, 0xcb, 0x70, 0xc8, 0xa6, 0xe1, 0x11, 0x87, 0xd8, - 0xeb, 0x96, 0xe5, 0x5d, 0x77, 0x18, 0x47, 0x77, 0xe0, 0x04, 0x96, 0x22, 0xdd, 0x21, 0x3b, 0x54, - 0x77, 0x1d, 0xe6, 0x0f, 0x87, 0x9f, 0xff, 0xc5, 0x29, 0x34, 0x93, 0xd1, 0xfc, 0x0a, 0x68, 0x0b, - 0x01, 0x96, 0xff, 0xe0, 0xc3, 0xab, 0x3f, 0x28, 0xd3, 0xd8, 0xc5, 0x70, 0xbc, 0x0f, 0xc8, 0xdd, - 0xd3, 0x4d, 0x61, 0xa0, 0x9b, 0xbe,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4a, 0x89, 0xcf, 0x6f, 0xc6, 0x5a, 0x63, 0x4d, 0xda, + 0xdd, 0xc0, 0xfc, 0x21, 0xf5, 0x5a, 0xd5, 0xf0, 0xc7, 0x40, 0x2f, 0xfe, 0x73, 0x40, 0x34, 0x4b, + 0x63, 0x4a, 0xbc, 0xcd, 0xdf, 0xf8, 0x27, 0x00, 0x00, 0xff, 0xff, 0x48, 0x50, 0x09, 0xb1, 0x31, + 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -926,8 +925,6 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { - // RegisterOperator registers a new operator. - RegisterOperator(ctx context.Context, in *RegisterOperatorReq, opts ...grpc.CallOption) (*RegisterOperatorResponse, error) // DelegateAssetToOperator delegates asset to operator. DelegateAssetToOperator(ctx context.Context, in *MsgDelegation, opts ...grpc.CallOption) (*DelegationResponse, error) // UndelegateAssetFromOperator undelegates asset from operator. @@ -942,15 +939,6 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) RegisterOperator(ctx context.Context, in *RegisterOperatorReq, opts ...grpc.CallOption) (*RegisterOperatorResponse, error) { - out := new(RegisterOperatorResponse) - err := c.cc.Invoke(ctx, "/exocore.delegation.v1.Msg/RegisterOperator", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *msgClient) DelegateAssetToOperator(ctx context.Context, in *MsgDelegation, opts ...grpc.CallOption) (*DelegationResponse, error) { out := new(DelegationResponse) err := c.cc.Invoke(ctx, "/exocore.delegation.v1.Msg/DelegateAssetToOperator", in, out, opts...) @@ -971,8 +959,6 @@ func (c *msgClient) UndelegateAssetFromOperator(ctx context.Context, in *MsgUnde // MsgServer is the server API for Msg service. type MsgServer interface { - // RegisterOperator registers a new operator. - RegisterOperator(context.Context, *RegisterOperatorReq) (*RegisterOperatorResponse, error) // DelegateAssetToOperator delegates asset to operator. DelegateAssetToOperator(context.Context, *MsgDelegation) (*DelegationResponse, error) // UndelegateAssetFromOperator undelegates asset from operator. @@ -983,9 +969,6 @@ type MsgServer interface { type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) RegisterOperator(ctx context.Context, req *RegisterOperatorReq) (*RegisterOperatorResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RegisterOperator not implemented") -} func (*UnimplementedMsgServer) DelegateAssetToOperator(ctx context.Context, req *MsgDelegation) (*DelegationResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DelegateAssetToOperator not implemented") } @@ -997,24 +980,6 @@ func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } -func _Msg_RegisterOperator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RegisterOperatorReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).RegisterOperator(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/exocore.delegation.v1.Msg/RegisterOperator", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).RegisterOperator(ctx, req.(*RegisterOperatorReq)) - } - return interceptor(ctx, in, info, handler) -} - func _Msg_DelegateAssetToOperator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgDelegation) if err := dec(in); err != nil { @@ -1055,10 +1020,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "exocore.delegation.v1.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "RegisterOperator", - Handler: _Msg_RegisterOperator_Handler, - }, { MethodName: "DelegateAssetToOperator", Handler: _Msg_DelegateAssetToOperator_Handler, diff --git a/x/deposit/keeper/setup_test.go b/x/deposit/keeper/setup_test.go index c6b43ccc3..67a7734cd 100644 --- a/x/deposit/keeper/setup_test.go +++ b/x/deposit/keeper/setup_test.go @@ -1,9 +1,10 @@ package keeper_test import ( - "github.com/ExocoreNetwork/exocore/testutil" "testing" + "github.com/ExocoreNetwork/exocore/testutil" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" diff --git a/x/operator/keeper/abci.go b/x/operator/keeper/abci.go index f4fb6f1f3..36ab35301 100644 --- a/x/operator/keeper/abci.go +++ b/x/operator/keeper/abci.go @@ -32,14 +32,14 @@ func (k *Keeper) PriceChangeHandle(ctx sdk.Context) error { if err != nil { return err } - if priceChangeAssets == nil || len(priceChangeAssets) == 0 { + if len(priceChangeAssets) == 0 { return nil } avsOperatorShareChange := make(map[string]sdkmath.LegacyDec, 0) assetsOperatorAVSInfo := make(map[string]map[string]string, 0) assetsDecimal := make(map[string]uint32) for assetID, priceChange := range priceChangeAssets { - //get the decimal of asset + // get the decimal of asset assetInfo, err := k.restakingStateKeeper.GetStakingAssetInfo(ctx, assetID) if err != nil { return err @@ -48,8 +48,8 @@ func (k *Keeper) PriceChangeHandle(ctx sdk.Context) error { if _, ok := assetsOperatorAVSInfo[assetID]; !ok { assetsOperatorAVSInfo[assetID] = make(map[string]string, 0) } - //UpdateStateForAsset - f := func(assetID string, keys []string, state *operatortypes.AssetOptedInState) error { + // UpdateStateForAsset + f := func(assetID string, keys []string, state *operatortypes.OptedInAssetState) error { newAssetUSDValue := CalculateShare(state.Amount, priceChange.NewPrice, assetInfo.AssetBasicInfo.Decimals, priceChange.Decimal) changeValue := newAssetUSDValue.Sub(state.Value) state.Value = newAssetUSDValue @@ -66,13 +66,13 @@ func (k *Keeper) PriceChangeHandle(ctx sdk.Context) error { return err } } - //BatchUpdateShareForAVSAndOperator + // BatchUpdateShareForAVSAndOperator err = k.BatchUpdateShareForAVSAndOperator(ctx, avsOperatorShareChange) if err != nil { return err } - //update staker'suite share + // update staker'suite share sharedParameter := &SharedParameter{ priceChangeAssets: priceChangeAssets, assetsDecimal: assetsDecimal, @@ -80,7 +80,7 @@ func (k *Keeper) PriceChangeHandle(ctx sdk.Context) error { stakerShare: make(map[string]sdkmath.LegacyDec, 0), } stakerShareHandleFunc := func(stakerID, assetID, operatorAddr string, state *delegationtype.DelegationAmounts) error { - UpdateShareOfStakerAndOperator(sharedParameter, assetID, stakerID, operatorAddr, state.CanUndelegationAmount) + UpdateShareOfStakerAndOperator(sharedParameter, assetID, stakerID, operatorAddr, state.CanBeUndelegatedAmount) return nil } err = k.delegationKeeper.IterateDelegationState(ctx, stakerShareHandleFunc) @@ -96,7 +96,7 @@ func (k *Keeper) PriceChangeHandle(ctx sdk.Context) error { if err != nil { return err } - //BatchSetStakerShare + // BatchSetStakerShare err = k.BatchSetStakerShare(ctx, sharedParameter.stakerShare) if err != nil { return err @@ -109,7 +109,7 @@ func (k *Keeper) ClearPreConsensusPK(ctx sdk.Context) error { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator( store, - []byte{operatortypes.BytePrefixForOperatorAndChainIdToPrevConsKey}, + []byte{operatortypes.BytePrefixForOperatorAndChainIDToPrevConsKey}, ) defer iterator.Close() @@ -121,7 +121,7 @@ func (k *Keeper) ClearPreConsensusPK(ctx sdk.Context) error { // EndBlock : update the assets' share when their prices change func (k *Keeper) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - //todo: need to consider the calling order + // todo: need to consider the calling order err := k.PriceChangeHandle(ctx) if err != nil { panic(err) diff --git a/x/operator/keeper/avs_operator_shares.go b/x/operator/keeper/avs_operator_shares.go index eb9f06e27..4fc7f8097 100644 --- a/x/operator/keeper/avs_operator_shares.go +++ b/x/operator/keeper/avs_operator_shares.go @@ -1,9 +1,11 @@ package keeper import ( + "fmt" + errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" - "fmt" + operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" restakingtype "github.com/ExocoreNetwork/exocore/x/restaking_assets_manage/types" "github.com/cosmos/cosmos-sdk/store/prefix" @@ -18,9 +20,8 @@ func (k *Keeper) UpdateOperatorShare(ctx sdk.Context, avsAddr, operatorAddr stri var key []byte if operatorAddr == "" { return errorsmod.Wrap(operatortypes.ErrParameterInvalid, "UpdateOperatorShare the operatorAddr is empty") - } else { - key = restakingtype.GetJoinedStoreKey(avsAddr, operatorAddr) } + key = restakingtype.GetJoinedStoreKey(avsAddr, operatorAddr) totalValue := operatortypes.ValueField{Amount: sdkmath.LegacyNewDec(0)} if store.Has(key) { @@ -41,9 +42,9 @@ func (k *Keeper) DeleteOperatorShare(ctx sdk.Context, avsAddr, operatorAddr stri var key []byte if operatorAddr == "" { return errorsmod.Wrap(operatortypes.ErrParameterInvalid, "UpdateOperatorShare the operatorAddr is empty") - } else { - key = restakingtype.GetJoinedStoreKey(avsAddr, operatorAddr) } + key = restakingtype.GetJoinedStoreKey(avsAddr, operatorAddr) + store.Delete(key) return nil } @@ -54,16 +55,16 @@ func (k *Keeper) GetOperatorShare(ctx sdk.Context, avsAddr, operatorAddr string) var key []byte if operatorAddr == "" { return sdkmath.LegacyDec{}, errorsmod.Wrap(operatortypes.ErrParameterInvalid, "GetOperatorShare the operatorAddr is empty") - } else { - key = restakingtype.GetJoinedStoreKey(avsAddr, operatorAddr) } + key = restakingtype.GetJoinedStoreKey(avsAddr, operatorAddr) + isExist := store.Has(key) if !isExist { return sdkmath.LegacyDec{}, errorsmod.Wrap(operatortypes.ErrNoKeyInTheStore, fmt.Sprintf("GetOperatorShare: key is %suite", key)) - } else { - value := store.Get(key) - k.cdc.MustUnmarshal(value, &ret) } + value := store.Get(key) + k.cdc.MustUnmarshal(value, &ret) + return ret.Amount, nil } @@ -96,7 +97,8 @@ func (k *Keeper) BatchUpdateShareForAVSAndOperator(ctx sdk.Context, avsOperatorC value := store.Get(key) k.cdc.MustUnmarshal(value, &totalValue) } - err := restakingtype.UpdateAssetDecValue(&totalValue.Amount, &opAmount) + tmpOpAmount := opAmount + err := restakingtype.UpdateAssetDecValue(&totalValue.Amount, &tmpOpAmount) if err != nil { return err } @@ -113,53 +115,53 @@ func (k *Keeper) GetAVSShare(ctx sdk.Context, avsAddr string) (sdkmath.LegacyDec isExit := store.Has(key) if !isExit { return sdkmath.LegacyDec{}, errorsmod.Wrap(operatortypes.ErrNoKeyInTheStore, fmt.Sprintf("GetAVSShare: key is %suite", key)) - } else { - value := store.Get(key) - k.cdc.MustUnmarshal(value, &ret) } + value := store.Get(key) + k.cdc.MustUnmarshal(value, &ret) + return ret.Amount, nil } -func (k *Keeper) UpdateStateForAsset(ctx sdk.Context, assetID, avsAddr, operatorAddr string, changeState operatortypes.AssetOptedInState) error { +func (k *Keeper) UpdateStateForAsset(ctx sdk.Context, assetID, avsAddr, operatorAddr string, changeState operatortypes.OptedInAssetState) error { store := prefix.NewStore(ctx.KVStore(k.storeKey), operatortypes.KeyPrefixOperatorAVSSingleAssetState) if changeState.Amount.IsNil() && changeState.Value.IsNil() { return nil } - //check operator address validation + // check operator address validation _, err := sdk.AccAddressFromBech32(operatorAddr) if err != nil { return restakingtype.ErrOperatorAddr } stateKey := restakingtype.GetJoinedStoreKey(assetID, avsAddr, operatorAddr) - assetOptedInState := operatortypes.AssetOptedInState{ + optedInAssetState := operatortypes.OptedInAssetState{ Amount: sdkmath.NewInt(0), Value: sdkmath.LegacyNewDec(0), } if store.Has(stateKey) { value := store.Get(stateKey) - k.cdc.MustUnmarshal(value, &assetOptedInState) + k.cdc.MustUnmarshal(value, &optedInAssetState) } - err = restakingtype.UpdateAssetValue(&assetOptedInState.Amount, &changeState.Amount) + err = restakingtype.UpdateAssetValue(&optedInAssetState.Amount, &changeState.Amount) if err != nil { - return errorsmod.Wrap(err, "UpdateStateForAsset assetOptedInState.Amount error") + return errorsmod.Wrap(err, "UpdateStateForAsset OptedInAssetState.Amount error") } - err = restakingtype.UpdateAssetDecValue(&assetOptedInState.Value, &changeState.Value) + err = restakingtype.UpdateAssetDecValue(&optedInAssetState.Value, &changeState.Value) if err != nil { - return errorsmod.Wrap(err, "UpdateStateForAsset assetOptedInState.Value error") + return errorsmod.Wrap(err, "UpdateStateForAsset OptedInAssetState.Value error") } - //save single operator delegation state - bz := k.cdc.MustMarshal(&assetOptedInState) + // save single operator delegation state + bz := k.cdc.MustMarshal(&optedInAssetState) store.Set(stateKey, bz) return nil } func (k *Keeper) DeleteAssetState(ctx sdk.Context, assetID, avsAddr, operatorAddr string) error { store := prefix.NewStore(ctx.KVStore(k.storeKey), operatortypes.KeyPrefixOperatorAVSSingleAssetState) - //check operator address validation + // check operator address validation _, err := sdk.AccAddressFromBech32(operatorAddr) if err != nil { return restakingtype.ErrOperatorAddr @@ -169,21 +171,21 @@ func (k *Keeper) DeleteAssetState(ctx sdk.Context, assetID, avsAddr, operatorAdd return nil } -func (k *Keeper) GetAssetState(ctx sdk.Context, assetID, avsAddr, operatorAddr string) (changeState *operatortypes.AssetOptedInState, err error) { +func (k *Keeper) GetAssetState(ctx sdk.Context, assetID, avsAddr, operatorAddr string) (changeState *operatortypes.OptedInAssetState, err error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), operatortypes.KeyPrefixOperatorAVSSingleAssetState) stateKey := restakingtype.GetJoinedStoreKey(assetID, avsAddr, operatorAddr) isExit := store.Has(stateKey) - assetOptedInState := operatortypes.AssetOptedInState{} + optedInAssetState := operatortypes.OptedInAssetState{} if isExit { value := store.Get(stateKey) - k.cdc.MustUnmarshal(value, &assetOptedInState) + k.cdc.MustUnmarshal(value, &optedInAssetState) } else { return nil, errorsmod.Wrap(operatortypes.ErrNoKeyInTheStore, fmt.Sprintf("GetAssetState: key is %suite", stateKey)) } - return &assetOptedInState, nil + return &optedInAssetState, nil } -func (k *Keeper) IterateUpdateAssetState(ctx sdk.Context, assetID string, f func(assetID string, keys []string, state *operatortypes.AssetOptedInState) error) (err error) { +func (k *Keeper) IterateUpdateAssetState(ctx sdk.Context, assetID string, f func(assetID string, keys []string, state *operatortypes.OptedInAssetState) error) (err error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), operatortypes.KeyPrefixOperatorAVSSingleAssetState) iterator := sdk.KVStorePrefixIterator(store, []byte(assetID)) defer iterator.Close() @@ -193,13 +195,13 @@ func (k *Keeper) IterateUpdateAssetState(ctx sdk.Context, assetID string, f func if err != nil { return err } - assetOptedInState := &operatortypes.AssetOptedInState{} - k.cdc.MustUnmarshal(iterator.Value(), assetOptedInState) - err = f(assetID, keys, assetOptedInState) + optedInAssetState := &operatortypes.OptedInAssetState{} + k.cdc.MustUnmarshal(iterator.Value(), optedInAssetState) + err = f(assetID, keys, optedInAssetState) if err != nil { return err } - bz := k.cdc.MustMarshal(assetOptedInState) + bz := k.cdc.MustMarshal(optedInAssetState) store.Set(iterator.Key(), bz) } return nil @@ -255,14 +257,14 @@ func (k *Keeper) GetStakerShare(ctx sdk.Context, avsAddr, stakerID, operatorAddr isExit := store.Has(key) if !isExit { return sdkmath.LegacyDec{}, errorsmod.Wrap(operatortypes.ErrNoKeyInTheStore, fmt.Sprintf("GetStakerShare: key is %s", key)) - } else { - value := store.Get(key) - k.cdc.MustUnmarshal(value, &ret) } + value := store.Get(key) + k.cdc.MustUnmarshal(value, &ret) + return ret.Amount, nil } -func (k *Keeper) GetStakerByAVSOperator(ctx sdk.Context, avsAddr, operatorAddr string) (map[string]interface{}, error) { +func (k *Keeper) GetStakerByAVSOperator(ctx sdk.Context, _, _ string) (map[string]interface{}, error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), operatortypes.KeyPrefixAVSOperatorStakerShareState) stakers := make(map[string]interface{}, 0) iterator := sdk.KVStorePrefixIterator(store, nil) diff --git a/x/operator/keeper/dogfood.go b/x/operator/keeper/dogfood.go index 5b5efa0df..ed49c657a 100644 --- a/x/operator/keeper/dogfood.go +++ b/x/operator/keeper/dogfood.go @@ -2,6 +2,7 @@ package keeper import ( "fmt" + "github.com/ExocoreNetwork/exocore/x/operator/types" errorsmod "cosmossdk.io/errors" @@ -19,14 +20,14 @@ func (k *Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } -// SetOperatorConsKeyForChainId sets the (consensus) public key for the given operator address +// SetOperatorConsKeyForChainID sets the (consensus) public key for the given operator address // and chain id. By doing this, an operator is consenting to be an operator on the given chain. // If a key already exists, it will be overwritten and the change in voting power will flow // through to the validator set. -func (k *Keeper) SetOperatorConsKeyForChainId( +func (k *Keeper) SetOperatorConsKeyForChainID( ctx sdk.Context, opAccAddr sdk.AccAddress, - chainId string, + chainID string, // should be tm-ed25519 consKey tmprotocrypto.PublicKey, ) error { @@ -39,11 +40,11 @@ func (k *Keeper) SetOperatorConsKeyForChainId( return delegationtypes.ErrOperatorIsFrozen } // check if the chain id is valid - if !k.restakingStateKeeper.AppChainInfoIsExist(ctx, chainId) { + if !k.restakingStateKeeper.AppChainInfoIsExist(ctx, chainID) { return restakingtypes.ErrNoAppChainKey } // if opting out, do not allow key replacement - if k.IsOperatorOptingOutFromChainId(ctx, opAccAddr, chainId) { + if k.IsOperatorOptingOutFromChainID(ctx, opAccAddr, chainID) { return types.ErrAlreadyOptingOut } // convert to bytes @@ -51,7 +52,7 @@ func (k *Keeper) SetOperatorConsKeyForChainId( if err != nil { return errorsmod.Wrap( err, - "SetOperatorConsKeyForChainId: error occurred when marshal public key", + "SetOperatorConsKeyForChainID: error occurred when marshal public key", ) } // convert to address for reverse lookup @@ -59,20 +60,20 @@ func (k *Keeper) SetOperatorConsKeyForChainId( if err != nil { return errorsmod.Wrap( err, - "SetOperatorConsKeyForChainId: error occurred when convert public key to consensus address", + "SetOperatorConsKeyForChainID: error occurred when convert public key to consensus address", ) } // check if the key is already in use by another operator // operators may call this function with their own key // to unjail themselves, so we will allow that. - keyInUse, existingAddr := k.GetOperatorAddressForChainIdAndConsAddr(ctx, chainId, consAddr) + keyInUse, existingAddr := k.GetOperatorAddressForChainIDAndConsAddr(ctx, chainID, consAddr) if keyInUse { if !existingAddr.Equals(opAccAddr) { return types.ErrConsKeyAlreadyInUse } } // check that such a key is already set. if yes, we will consider it as key replacement. - found, prevKey, err := k.getOperatorConsKeyForChainId(ctx, opAccAddr, chainId) + found, prevKey, err := k.getOperatorConsKeyForChainID(ctx, opAccAddr, chainID) if err != nil { // this should not happen panic(err) @@ -87,28 +88,28 @@ func (k *Keeper) SetOperatorConsKeyForChainId( // if this key is different, we will set the vote power of the old key to 0 // in the validator update. but, we must only do so once in a block, since the // first existing key is the one to replace with 0 vote power and not any others. - alreadyRecorded, _, err = k.getOperatorPrevConsKeyForChainId(ctx, opAccAddr, chainId) + alreadyRecorded, _, err = k.getOperatorPrevConsKeyForChainID(ctx, opAccAddr, chainID) if err != nil { // this should not happen panic(err) } if !alreadyRecorded { - if err := k.setOperatorPrevConsKeyForChainId(ctx, opAccAddr, chainId, prevKey); err != nil { + if err := k.setOperatorPrevConsKeyForChainID(ctx, opAccAddr, chainID, prevKey); err != nil { // this should not happen panic(err) } } } - // k.setOperatorConsKeyForChainId(ctx, opAccAddr, chainId, bz) + // k.setOperatorConsKeyForChainID(ctx, opAccAddr, chainID, bz) // return nil // } - // // setOperatorConsKeyForChainId is the internal private version. It performs + // // setOperatorConsKeyForChainID is the internal private version. It performs // // no error checking of the input. - // func (k Keeper) setOperatorConsKeyForChainId( + // func (k Keeper) setOperatorConsKeyForChainID( // ctx sdk.Context, // opAccAddr sdk.AccAddress, - // chainId string, + // chainID string, // bz []byte, // ) { store := ctx.KVStore(k.storeKey) @@ -117,12 +118,12 @@ func (k *Keeper) SetOperatorConsKeyForChainId( // since it is sorted by operator address, it helps for faster indexing by operator // for example, when an operator is delegated to, we can find all impacted // chain ids and their respective consensus keys - store.Set(types.KeyForOperatorAndChainIdToConsKey(opAccAddr, chainId), bz) + store.Set(types.KeyForOperatorAndChainIDToConsKey(opAccAddr, chainID), bz) // reverse lookups // 1. given chain id and operator address, find the consensus key, // at initial onboarding of an app chain, it will allow us to find all // operators that have opted in and their consensus keys - store.Set(types.KeyForChainIdAndOperatorToConsKey(chainId, opAccAddr), bz) + store.Set(types.KeyForChainIDAndOperatorToConsKey(chainID, opAccAddr), bz) // 2. given a chain id and a consensus addr, find the operator address, // the slashing module asks for an operator to be slashed by their consensus // address, so this will allow us to find the operator address to slash. @@ -130,69 +131,69 @@ func (k *Keeper) SetOperatorConsKeyForChainId( // prune it once the validator set update id matures (if key replacement). // this pruning will be triggered by the app chain module and will not be // recorded here. - store.Set(types.KeyForChainIdAndConsKeyToOperator(chainId, consAddr), opAccAddr.Bytes()) + store.Set(types.KeyForChainIDAndConsKeyToOperator(chainID, consAddr), opAccAddr.Bytes()) if found { if !alreadyRecorded { - k.Hooks().AfterOperatorKeyReplacement(ctx, opAccAddr, prevKey, consKey, chainId) + k.Hooks().AfterOperatorKeyReplacement(ctx, opAccAddr, prevKey, consKey, chainID) } } else { - k.Hooks().AfterOperatorOptIn(ctx, opAccAddr, chainId, consKey) + k.Hooks().AfterOperatorOptIn(ctx, opAccAddr, chainID, consKey) } return nil } -// setOperatorPrevConsKeyForChainId sets the previous (consensus) public key for the given +// setOperatorPrevConsKeyForChainID sets the previous (consensus) public key for the given // operator address and chain id. This is used to track the previous key when a key is replaced. // It is internal-only because such a key must only be set upon key replacement. So it does // not perform any meaningful error checking of the input. -func (k *Keeper) setOperatorPrevConsKeyForChainId( +func (k *Keeper) setOperatorPrevConsKeyForChainID( ctx sdk.Context, opAccAddr sdk.AccAddress, - chainId string, + chainID string, prevKey tmprotocrypto.PublicKey, ) error { bz, err := prevKey.Marshal() if err != nil { return errorsmod.Wrap( err, - "SetOperatorPrevConsKeyForChainId: error occurred when marshal public key", + "SetOperatorPrevConsKeyForChainID: error occurred when marshal public key", ) } store := ctx.KVStore(k.storeKey) - store.Set(types.KeyForOperatorAndChainIdToPrevConsKey(opAccAddr, chainId), bz) + store.Set(types.KeyForOperatorAndChainIDToPrevConsKey(opAccAddr, chainID), bz) return nil } -// GetOperatorPrevConsKeyForChainId gets the previous (consensus) public key for the given +// GetOperatorPrevConsKeyForChainID gets the previous (consensus) public key for the given // operator address and chain id. When such a key is returned, callers should set its vote power // to 0 in the validator update. -func (k *Keeper) GetOperatorPrevConsKeyForChainId( - ctx sdk.Context, opAccAddr sdk.AccAddress, chainId string, +func (k *Keeper) GetOperatorPrevConsKeyForChainID( + ctx sdk.Context, opAccAddr sdk.AccAddress, chainID string, ) (found bool, key tmprotocrypto.PublicKey, err error) { // check if we are an operator if !k.IsOperator(ctx, opAccAddr) { err = delegationtypes.ErrOperatorNotExist return } - if !k.restakingStateKeeper.AppChainInfoIsExist(ctx, chainId) { + if !k.restakingStateKeeper.AppChainInfoIsExist(ctx, chainID) { err = restakingtypes.ErrNoAppChainKey return } // do not check for slashing here - found, key, err = k.getOperatorPrevConsKeyForChainId(ctx, opAccAddr, chainId) + found, key, err = k.getOperatorPrevConsKeyForChainID(ctx, opAccAddr, chainID) return } -// getOperatorPrevConsKeyForChainId is the internal version of -// GetOperatorPrevConsKeyForChainId. +// getOperatorPrevConsKeyForChainID is the internal version of +// GetOperatorPrevConsKeyForChainID. // It performs no error checking of the input. -func (k *Keeper) getOperatorPrevConsKeyForChainId( +func (k *Keeper) getOperatorPrevConsKeyForChainID( ctx sdk.Context, opAccAddr sdk.AccAddress, - chainId string, + chainID string, ) (found bool, key tmprotocrypto.PublicKey, err error) { store := ctx.KVStore(k.storeKey) - res := store.Get(types.KeyForOperatorAndChainIdToPrevConsKey(opAccAddr, chainId)) + res := store.Get(types.KeyForOperatorAndChainIDToPrevConsKey(opAccAddr, chainID)) if res == nil { return } @@ -203,37 +204,37 @@ func (k *Keeper) getOperatorPrevConsKeyForChainId( return } -// GetOperatorConsKeyForChainId gets the (consensus) public key for the given operator address +// GetOperatorConsKeyForChainID gets the (consensus) public key for the given operator address // and chain id. This should be exposed via the query surface. -func (k *Keeper) GetOperatorConsKeyForChainId( +func (k *Keeper) GetOperatorConsKeyForChainID( ctx sdk.Context, opAccAddr sdk.AccAddress, - chainId string, + chainID string, ) (found bool, key tmprotocrypto.PublicKey, err error) { // check if we are an operator if !k.IsOperator(ctx, opAccAddr) { err = delegationtypes.ErrOperatorNotExist return } - if !k.restakingStateKeeper.AppChainInfoIsExist(ctx, chainId) { + if !k.restakingStateKeeper.AppChainInfoIsExist(ctx, chainID) { err = restakingtypes.ErrNoAppChainKey return } // do not check for slashing, since this function will be used to update voting power even // when slashed - found, key, err = k.getOperatorConsKeyForChainId(ctx, opAccAddr, chainId) + found, key, err = k.getOperatorConsKeyForChainID(ctx, opAccAddr, chainID) return } -// getOperatorConsKeyForChainId is the internal version of GetOperatorConsKeyForChainId. It +// getOperatorConsKeyForChainID is the internal version of GetOperatorConsKeyForChainID. It // performs no error checking of the input. -func (k *Keeper) getOperatorConsKeyForChainId( +func (k *Keeper) getOperatorConsKeyForChainID( ctx sdk.Context, opAccAddr sdk.AccAddress, - chainId string, + chainID string, ) (found bool, key tmprotocrypto.PublicKey, err error) { store := ctx.KVStore(k.storeKey) - res := store.Get(types.KeyForOperatorAndChainIdToConsKey(opAccAddr, chainId)) + res := store.Get(types.KeyForOperatorAndChainIDToConsKey(opAccAddr, chainID)) if res == nil { return } @@ -243,20 +244,20 @@ func (k *Keeper) getOperatorConsKeyForChainId( return true, key, nil } -// GetChainIdsAndKeysForOperator gets the chain ids for which the given operator address has set a +// GetChainIDsAndKeysForOperator gets the chain ids for which the given operator address has set a // (consensus) public key. TODO: would it be better to make this a key per operator? // This is intentionally an array of strings because I don't see the utility for the vote power // or the public key here. If we need it, we can add it later. -func (k *Keeper) GetChainIdsAndKeysForOperator( +func (k *Keeper) GetChainIDsAndKeysForOperator( ctx sdk.Context, opAccAddr sdk.AccAddress, -) (chainIds []string, consKeys []tmprotocrypto.PublicKey) { +) (chainIDs []string, consKeys []tmprotocrypto.PublicKey) { // check if we are an operator if !k.IsOperator(ctx, opAccAddr) { return } // do not check for slashing here prefix := types.AppendMany( - []byte{types.BytePrefixForOperatorAndChainIdToConsKey}, + []byte{types.BytePrefixForOperatorAndChainIDToConsKey}, opAccAddr.Bytes(), ) store := ctx.KVStore(k.storeKey) @@ -266,32 +267,32 @@ func (k *Keeper) GetChainIdsAndKeysForOperator( defer iterator.Close() for ; iterator.Valid(); iterator.Next() { // the key returned is the full key, with the prefix. drop the prefix and the length. - chainId := string(iterator.Key()[len(prefix)+8:]) + chainID := string(iterator.Key()[len(prefix)+8:]) var key tmprotocrypto.PublicKey if err := key.Unmarshal(iterator.Value()); err != nil { // grave error because we are the ones who stored this information in the first // place panic(err) } - chainIds = append(chainIds, chainId) + chainIDs = append(chainIDs, chainID) consKeys = append(consKeys, key) } return } -// GetOperatorsForChainId returns a list of {operatorAddr, pubKey} for the given -// chainId. This is used to create or update the validator set. It skips +// GetOperatorsForChainID returns a list of {operatorAddr, pubKey} for the given +// chainID. This is used to create or update the validator set. It skips // jailed or frozen operators. -func (k *Keeper) GetOperatorsForChainId( - ctx sdk.Context, chainId string, +func (k *Keeper) GetOperatorsForChainID( + ctx sdk.Context, chainID string, ) (addrs []sdk.AccAddress, pubKeys []tmprotocrypto.PublicKey) { - if !k.restakingStateKeeper.AppChainInfoIsExist(ctx, chainId) { - return + if !k.restakingStateKeeper.AppChainInfoIsExist(ctx, chainID) { + return nil, nil } - // prefix is the byte prefix and then chainId with length - prefix := types.ChainIdAndAddrKey( - types.BytePrefixForChainIdAndOperatorToConsKey, - chainId, + // prefix is the byte prefix and then chainID with length + prefix := types.ChainIDAndAddrKey( + types.BytePrefixForChainIDAndOperatorToConsKey, + chainID, nil, ) store := ctx.KVStore(k.storeKey) @@ -300,8 +301,8 @@ func (k *Keeper) GetOperatorsForChainId( ) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - // this key is of the format prefix | len | chainId | addr - // and our prefix is of the format prefix | len | chainId + // this key is of the format prefix | len | chainID | addr + // and our prefix is of the format prefix | len | chainID // so just drop it and convert to sdk.AccAddress addr := iterator.Key()[len(prefix):] res := iterator.Value() @@ -312,33 +313,32 @@ func (k *Keeper) GetOperatorsForChainId( } addrs = append(addrs, addr) pubKeys = append(pubKeys, ret) - } - return + return addrs, pubKeys } -func (k *Keeper) GetOperatorAddressForChainIdAndConsAddr( - ctx sdk.Context, chainId string, consAddr sdk.ConsAddress, +func (k *Keeper) GetOperatorAddressForChainIDAndConsAddr( + ctx sdk.Context, chainID string, consAddr sdk.ConsAddress, ) (found bool, addr sdk.AccAddress) { store := ctx.KVStore(k.storeKey) - res := store.Get(types.KeyForChainIdAndConsKeyToOperator(chainId, consAddr)) + res := store.Get(types.KeyForChainIDAndConsKeyToOperator(chainID, consAddr)) if res == nil { return } found = true addr = sdk.AccAddress(res) - return + return found, addr } -// DeleteOperatorAddressForChainIdAndConsAddr is a pruning method used to delete the +// DeleteOperatorAddressForChainIDAndConsAddr is a pruning method used to delete the // mapping from chain id and consensus address to operator address. This mapping is used // to obtain the operator address from its consensus public key, which is sent to the // coordinator chain by a subscriber chain for slashing. -func (k *Keeper) DeleteOperatorAddressForChainIdAndConsAddr( - ctx sdk.Context, chainId string, consAddr sdk.ConsAddress, +func (k *Keeper) DeleteOperatorAddressForChainIDAndConsAddr( + ctx sdk.Context, chainID string, consAddr sdk.ConsAddress, ) { store := ctx.KVStore(k.storeKey) - store.Delete(types.KeyForChainIdAndConsKeyToOperator(chainId, consAddr)) + store.Delete(types.KeyForChainIDAndConsKeyToOperator(chainID, consAddr)) } // SetHooks stores the given hooks implementations. @@ -361,11 +361,11 @@ func (k *Keeper) Hooks() types.OperatorConsentHooks { return k.hooks } -// InitiateOperatorOptOutFromChainId initiates an operator opting out from the given chain id. +// InitiateOperatorOptOutFromChainID initiates an operator opting out from the given chain id. // It validates whether the operator is registered, and that it is not frozen, and that the // chain is present within the system. It also checks if the operator is already opting out. -func (k *Keeper) InitiateOperatorOptOutFromChainId( - ctx sdk.Context, opAccAddr sdk.AccAddress, chainId string, +func (k *Keeper) InitiateOperatorOptOutFromChainID( + ctx sdk.Context, opAccAddr sdk.AccAddress, chainID string, ) error { // check if we are an operator if !k.IsOperator(ctx, opAccAddr) { @@ -376,52 +376,50 @@ func (k *Keeper) InitiateOperatorOptOutFromChainId( return delegationtypes.ErrOperatorIsFrozen } // check if the chain id is valid - if !k.restakingStateKeeper.AppChainInfoIsExist(ctx, chainId) { + if !k.restakingStateKeeper.AppChainInfoIsExist(ctx, chainID) { return restakingtypes.ErrNoAppChainKey } - found, key, err := k.getOperatorConsKeyForChainId(ctx, opAccAddr, chainId) + found, key, err := k.getOperatorConsKeyForChainID(ctx, opAccAddr, chainID) if err != nil { return err } if !found { return types.ErrNotOptedIn } - isAlreadyOptingOut := k.IsOperatorOptingOutFromChainId(ctx, opAccAddr, chainId) + isAlreadyOptingOut := k.IsOperatorOptingOutFromChainID(ctx, opAccAddr, chainID) if isAlreadyOptingOut { return types.ErrAlreadyOptingOut } store := ctx.KVStore(k.storeKey) - store.Set(types.KeyForOperatorOptOutFromChainId(opAccAddr, chainId), []byte{}) - k.Hooks().AfterOperatorOptOutInitiated(ctx, opAccAddr, chainId, key) + store.Set(types.KeyForOperatorOptOutFromChainID(opAccAddr, chainID), []byte{}) + k.Hooks().AfterOperatorOptOutInitiated(ctx, opAccAddr, chainID, key) return nil } -// IsOperatorOptingOutFromChainId returns true if the operator is opting out from the given +// IsOperatorOptingOutFromChainID returns true if the operator is opting out from the given // chain id. -func (k *Keeper) IsOperatorOptingOutFromChainId( - ctx sdk.Context, opAccAddr sdk.AccAddress, chainId string, +func (k *Keeper) IsOperatorOptingOutFromChainID( + ctx sdk.Context, opAccAddr sdk.AccAddress, chainID string, ) bool { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.KeyForOperatorOptOutFromChainId(opAccAddr, chainId)) + bz := store.Get(types.KeyForOperatorOptOutFromChainID(opAccAddr, chainID)) return bz != nil } -// CompleteOperatorOptOutFromChainId completes the operator opting out from the given chain id. +// CompleteOperatorOptOutFromChainID completes the operator opting out from the given chain id. // TODO(mm): would it be better to store as 3 states? (opted in, opting out, opted out) -func (k *Keeper) CompleteOperatorOptOutFromChainId( - ctx sdk.Context, opAccAddr sdk.AccAddress, chainId string, +func (k *Keeper) CompleteOperatorOptOutFromChainID( + ctx sdk.Context, opAccAddr sdk.AccAddress, chainID string, ) { - if !k.IsOperatorOptingOutFromChainId(ctx, opAccAddr, chainId) { + if !k.IsOperatorOptingOutFromChainID(ctx, opAccAddr, chainID) { panic("operator is not opting out") } store := ctx.KVStore(k.storeKey) - store.Delete(types.KeyForOperatorOptOutFromChainId(opAccAddr, chainId)) + store.Delete(types.KeyForOperatorOptOutFromChainID(opAccAddr, chainID)) } -// IsOperatorJailedForChainId add for dogfood -func (k *Keeper) IsOperatorJailedForChainId(sdk.Context, sdk.AccAddress, string) bool { +// IsOperatorJailedForChainID add for dogfood +func (k *Keeper) IsOperatorJailedForChainID(sdk.Context, sdk.AccAddress, string) bool { return false } -func (k *Keeper) Jail(sdk.Context, sdk.ConsAddress, string) { - return -} +func (k *Keeper) Jail(sdk.Context, sdk.ConsAddress, string) {} diff --git a/x/operator/keeper/grpc_query.go b/x/operator/keeper/grpc_query.go index 5856c70ea..a1ec38314 100644 --- a/x/operator/keeper/grpc_query.go +++ b/x/operator/keeper/grpc_query.go @@ -15,17 +15,17 @@ func (k *Keeper) GetOperatorInfo(ctx context.Context, req *operatortypes.GetOper return k.OperatorInfo(c, req.OperatorAddr) } -// QueryOperatorConsKeyForChainId add for dogfood -func (k *Keeper) QueryOperatorConsKeyForChainId( +// QueryOperatorConsKeyForChainID add for dogfood +func (k *Keeper) QueryOperatorConsKeyForChainID( goCtx context.Context, - req *operatortypes.QueryOperatorConsKeyForChainIdRequest, -) (*operatortypes.QueryOperatorConsKeyForChainIdResponse, error) { + req *operatortypes.QueryOperatorConsKeyForChainIDRequest, +) (*operatortypes.QueryOperatorConsKeyForChainIDResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) addr, err := sdk.AccAddressFromBech32(req.Addr) if err != nil { return nil, err } - found, key, err := k.GetOperatorConsKeyForChainId( + found, key, err := k.GetOperatorConsKeyForChainID( ctx, addr, req.ChainId, ) if err != nil { @@ -34,7 +34,7 @@ func (k *Keeper) QueryOperatorConsKeyForChainId( if !found { return nil, errors.New("no key assigned") } - return &operatortypes.QueryOperatorConsKeyForChainIdResponse{ + return &operatortypes.QueryOperatorConsKeyForChainIDResponse{ PublicKey: key, }, nil } diff --git a/x/operator/keeper/keeper.go b/x/operator/keeper/keeper.go index 02739ea00..8319f8c52 100644 --- a/x/operator/keeper/keeper.go +++ b/x/operator/keeper/keeper.go @@ -2,6 +2,7 @@ package keeper import ( "context" + sdkmath "cosmossdk.io/math" operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" "github.com/ExocoreNetwork/exocore/x/restaking_assets_manage/keeper" @@ -14,7 +15,7 @@ type Keeper struct { storeKey storetypes.StoreKey cdc codec.BinaryCodec - //other keepers + // other keepers restakingStateKeeper keeper.Keeper delegationKeeper operatortypes.ExpectDelegationInterface oracleKeeper operatortypes.ExpectOracleInterface @@ -51,7 +52,7 @@ func (k *Keeper) OracleInterface() operatortypes.ExpectOracleInterface { return k.oracleKeeper } -func (k *Keeper) GetUnbondingExpirationBlockNumber(ctx sdk.Context, OperatorAddress sdk.AccAddress, startHeight uint64) uint64 { +func (k *Keeper) GetUnbondingExpirationBlockNumber(_ sdk.Context, _ sdk.AccAddress, startHeight uint64) uint64 { return startHeight + operatortypes.UnbondingExpiration } @@ -70,5 +71,5 @@ type OperatorKeeper interface { OptOut(ctx sdk.Context, OperatorAddress sdk.AccAddress, AVSAddr string) error - Slash(ctx sdk.Context, operatorAddress sdk.AccAddress, AVSAddr, slashContract, slashId string, occurredSateHeight int64, slashProportion sdkmath.LegacyDec) error + Slash(ctx sdk.Context, operatorAddress sdk.AccAddress, AVSAddr, slashContract, slashID string, occurredSateHeight int64, slashProportion sdkmath.LegacyDec) error } diff --git a/x/operator/keeper/msg_server.go b/x/operator/keeper/msg_server.go index cafef0564..26b76052b 100644 --- a/x/operator/keeper/msg_server.go +++ b/x/operator/keeper/msg_server.go @@ -3,6 +3,7 @@ package keeper import ( context "context" "encoding/base64" + tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" "github.com/ExocoreNetwork/exocore/x/operator/types" @@ -20,11 +21,11 @@ func (k *Keeper) RegisterOperator(ctx context.Context, req *types.RegisterOperat return nil, nil } -// OptInToChainId add for dogfood -func (k *Keeper) OptInToChainId( +// OptInToChainID add for dogfood +func (k *Keeper) OptInToChainID( goCtx context.Context, - req *types.OptInToChainIdRequest, -) (*types.OptInToChainIdResponse, error) { + req *types.OptInToChainIDRequest, +) (*types.OptInToChainIDResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) addr, err := sdk.AccAddressFromBech32(req.Address) if err != nil { @@ -34,30 +35,30 @@ func (k *Keeper) OptInToChainId( if err != nil { return nil, err } - err = k.SetOperatorConsKeyForChainId( + err = k.SetOperatorConsKeyForChainID( ctx, addr, req.ChainId, key, ) if err != nil { return nil, err } - return &types.OptInToChainIdResponse{}, nil + return &types.OptInToChainIDResponse{}, nil } -func (k *Keeper) InitiateOptOutFromChainId( +func (k *Keeper) InitiateOptOutFromChainID( goCtx context.Context, - req *types.InitiateOptOutFromChainIdRequest, -) (*types.InitiateOptOutFromChainIdResponse, error) { + req *types.InitiateOptOutFromChainIDRequest, +) (*types.InitiateOptOutFromChainIDResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) addr, err := sdk.AccAddressFromBech32(req.Address) if err != nil { return nil, err } - if err := k.InitiateOperatorOptOutFromChainId( + if err := k.InitiateOperatorOptOutFromChainID( ctx, addr, req.ChainId, ); err != nil { return nil, err } - return &types.InitiateOptOutFromChainIdResponse{}, nil + return &types.InitiateOptOutFromChainIDResponse{}, nil } func stringToPubKey(pubKey string) (key tmprotocrypto.PublicKey, err error) { diff --git a/x/operator/keeper/operator.go b/x/operator/keeper/operator.go index 6f6add31f..338312d28 100644 --- a/x/operator/keeper/operator.go +++ b/x/operator/keeper/operator.go @@ -1,8 +1,10 @@ package keeper import ( - errorsmod "cosmossdk.io/errors" "fmt" + + errorsmod "cosmossdk.io/errors" + operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" restakingtype "github.com/ExocoreNetwork/exocore/x/restaking_assets_manage/types" "github.com/cosmos/cosmos-sdk/store/prefix" @@ -21,7 +23,7 @@ func (k *Keeper) SetOperatorInfo(ctx sdk.Context, addr string, info *operatortyp store := prefix.NewStore(ctx.KVStore(k.storeKey), operatortypes.KeyPrefixOperatorInfo) // todo: think about the difference between init and update in future - //key := common.HexToAddress(incentive.Contract) + // key := common.HexToAddress(incentive.Contract) bz := k.cdc.MustMarshal(info) store.Set(opAccAddr, bz) @@ -34,7 +36,7 @@ func (k *Keeper) OperatorInfo(ctx sdk.Context, addr string) (info *operatortypes return nil, errorsmod.Wrap(err, "GetOperatorInfo: error occurred when parse acc address from Bech32") } store := prefix.NewStore(ctx.KVStore(k.storeKey), operatortypes.KeyPrefixOperatorInfo) - //key := common.HexToAddress(incentive.Contract) + // key := common.HexToAddress(incentive.Contract) isExist := store.Has(opAccAddr) if !isExist { return nil, errorsmod.Wrap(operatortypes.ErrNoKeyInTheStore, fmt.Sprintf("GetOperatorInfo: key is %suite", opAccAddr)) @@ -55,7 +57,7 @@ func (k *Keeper) IsOperator(ctx sdk.Context, addr sdk.AccAddress) bool { func (k *Keeper) UpdateOptedInfo(ctx sdk.Context, operatorAddr, avsAddr string, info *operatortypes.OptedInfo) error { store := prefix.NewStore(ctx.KVStore(k.storeKey), operatortypes.KeyPrefixOperatorOptedAVSInfo) - //check operator address validation + // check operator address validation _, err := sdk.AccAddressFromBech32(operatorAddr) if err != nil { return restakingtype.ErrOperatorAddr @@ -98,7 +100,7 @@ func (k *Keeper) IsOptedIn(ctx sdk.Context, operatorAddr, avsAddr string) bool { } func (k *Keeper) GetOptedInAVSForOperator(ctx sdk.Context, operatorAddr string) ([]string, error) { - //get all opted-in info + // get all opted-in info store := prefix.NewStore(ctx.KVStore(k.storeKey), operatortypes.KeyPrefixOperatorOptedAVSInfo) iterator := sdk.KVStorePrefixIterator(store, []byte(operatorAddr)) defer iterator.Close() diff --git a/x/operator/keeper/operator_info_test.go b/x/operator/keeper/operator_info_test.go index d7b3f720a..d3609e773 100644 --- a/x/operator/keeper/operator_info_test.go +++ b/x/operator/keeper/operator_info_test.go @@ -44,7 +44,7 @@ func (suite *OperatorTestSuite) TestHistoricalOperatorInfo() { err = suite.App.OperatorKeeper.SetOperatorInfo(suite.Ctx, suite.AccAddress.String(), &newInfo) suite.NoError(err) - //get historical operator info + // get historical operator info historicalQueryCtx, err := types.ContextForHistoricalState(suite.Ctx, height) suite.NoError(err) getInfo, err := suite.App.OperatorKeeper.GetOperatorInfo(historicalQueryCtx, &operatortype.GetOperatorInfoReq{ diff --git a/x/operator/keeper/operator_slash_state.go b/x/operator/keeper/operator_slash_state.go index c44e31d40..8c5fdf5ae 100644 --- a/x/operator/keeper/operator_slash_state.go +++ b/x/operator/keeper/operator_slash_state.go @@ -1,9 +1,11 @@ package keeper import ( + "fmt" + errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" - "fmt" + operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" restakingtype "github.com/ExocoreNetwork/exocore/x/restaking_assets_manage/types" "github.com/cosmos/cosmos-sdk/store/prefix" @@ -11,15 +13,15 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" ) -func (k *Keeper) UpdateOperatorSlashInfo(ctx sdk.Context, operatorAddr, avsAddr, slashId string, slashInfo operatortypes.OperatorSlashInfo) error { +func (k *Keeper) UpdateOperatorSlashInfo(ctx sdk.Context, operatorAddr, avsAddr, slashID string, slashInfo operatortypes.OperatorSlashInfo) error { store := prefix.NewStore(ctx.KVStore(k.storeKey), operatortypes.KeyPrefixOperatorSlashInfo) - //check operator address validation + // check operator address validation _, err := sdk.AccAddressFromBech32(operatorAddr) if err != nil { return restakingtype.ErrOperatorAddr } - slashInfoKey := restakingtype.GetJoinedStoreKey(operatorAddr, avsAddr, slashId) + slashInfoKey := restakingtype.GetJoinedStoreKey(operatorAddr, avsAddr, slashID) if store.Has(slashInfoKey) { return errorsmod.Wrap(operatortypes.ErrSlashInfoExist, fmt.Sprintf("slashInfoKey:%suite", slashInfoKey)) } @@ -35,15 +37,15 @@ func (k *Keeper) UpdateOperatorSlashInfo(ctx sdk.Context, operatorAddr, avsAddr, return errorsmod.Wrap(operatortypes.ErrSlashInfo, fmt.Sprintf("err SlashProportion:%v", slashInfo.SlashProportion)) } - //save single operator delegation state + // save single operator delegation state bz := k.cdc.MustMarshal(&slashInfo) store.Set(slashInfoKey, bz) return nil } -func (k *Keeper) GetOperatorSlashInfo(ctx sdk.Context, avsAddr, operatorAddr, slashId string) (changeState *operatortypes.OperatorSlashInfo, err error) { +func (k *Keeper) GetOperatorSlashInfo(ctx sdk.Context, avsAddr, operatorAddr, slashID string) (changeState *operatortypes.OperatorSlashInfo, err error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), operatortypes.KeyPrefixOperatorSlashInfo) - slashInfoKey := restakingtype.GetJoinedStoreKey(operatorAddr, avsAddr, slashId) + slashInfoKey := restakingtype.GetJoinedStoreKey(operatorAddr, avsAddr, slashID) isExit := store.Has(slashInfoKey) operatorSlashInfo := operatortypes.OperatorSlashInfo{} if isExit { @@ -105,9 +107,9 @@ func (k *Keeper) GetSlashAssetsState(ctx sdk.Context, assetID, stakerOrOperator isExit := store.Has(key) if !isExit { return sdkmath.Int{}, errorsmod.Wrap(operatortypes.ErrNoKeyInTheStore, fmt.Sprintf("GetSlashAssetsState: key is %suite", key)) - } else { - value := store.Get(key) - k.cdc.MustUnmarshal(value, &ret) } + value := store.Get(key) + k.cdc.MustUnmarshal(value, &ret) + return ret.Amount, nil } diff --git a/x/operator/keeper/setup_test.go b/x/operator/keeper/setup_test.go index 9c20336be..efb6ca9d3 100644 --- a/x/operator/keeper/setup_test.go +++ b/x/operator/keeper/setup_test.go @@ -1,6 +1,8 @@ package keeper_test import ( + "testing" + sdkmath "cosmossdk.io/math" "github.com/ExocoreNetwork/exocore/testutil" sdk "github.com/cosmos/cosmos-sdk/types" @@ -8,7 +10,6 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/stretchr/testify/suite" - "testing" ) var s *OperatorTestSuite @@ -16,7 +17,7 @@ var s *OperatorTestSuite type OperatorTestSuite struct { testutil.BaseTestSuite - //needed by test + // needed by test operatorAddr sdk.AccAddress avsAddr string assetID string diff --git a/x/operator/keeper/state_update.go b/x/operator/keeper/state_update.go index 0bf229c51..e04199948 100644 --- a/x/operator/keeper/state_update.go +++ b/x/operator/keeper/state_update.go @@ -1,9 +1,11 @@ package keeper import ( + "fmt" + errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" - "fmt" + delegationtype "github.com/ExocoreNetwork/exocore/x/delegation/types" "github.com/ExocoreNetwork/exocore/x/operator/types" types2 "github.com/ExocoreNetwork/exocore/x/restaking_assets_manage/types" @@ -26,39 +28,39 @@ type SlashAssets struct { } func (k *Keeper) UpdateOptedInAssetsState(ctx sdk.Context, stakerID, assetID, operatorAddr string, opAmount sdkmath.Int) error { - //get the AVS opted-in by the operator + // get the AVS opted-in by the operator avsList, err := k.GetOptedInAVSForOperator(ctx, operatorAddr) if err != nil { return err } - //get price and priceDecimal from oracle + // get price and priceDecimal from oracle price, decimal, err := k.oracleKeeper.GetSpecifiedAssetsPrice(ctx, assetID) if err != nil { return err } - //get the decimal of asset + // get the decimal of asset assetInfo, err := k.restakingStateKeeper.GetStakingAssetInfo(ctx, assetID) if err != nil { return err } opUSDValue := CalculateShare(opAmount, price, assetInfo.AssetBasicInfo.Decimals, decimal) for _, avs := range avsList { - //get the assets supported by the AVS + // get the assets supported by the AVS avsSupportedAssets, err := k.avsKeeper.GetAvsSupportedAssets(ctx, avs) if err != nil { return err } if _, ok := avsSupportedAssets[assetID]; ok { - //UpdateStakerShare + // UpdateStakerShare err = k.UpdateStakerShare(ctx, avs, stakerID, operatorAddr, opUSDValue) if err != nil { return err } - //UpdateStateForAsset - changeState := types.AssetOptedInState{ + // UpdateStateForAsset + changeState := types.OptedInAssetState{ Amount: opAmount, Value: opUSDValue, } @@ -67,13 +69,13 @@ func (k *Keeper) UpdateOptedInAssetsState(ctx sdk.Context, stakerID, assetID, op return err } - //UpdateOperatorShare + // UpdateOperatorShare err = k.UpdateOperatorShare(ctx, avs, operatorAddr, opUSDValue) if err != nil { return err } - //UpdateAVSShare + // UpdateAVSShare err = k.UpdateAVSShare(ctx, avs, opUSDValue) if err != nil { return err @@ -84,18 +86,18 @@ func (k *Keeper) UpdateOptedInAssetsState(ctx sdk.Context, stakerID, assetID, op } // OptIn call this function to opt in AVS -func (k *Keeper) OptIn(ctx sdk.Context, operatorAddress sdk.AccAddress, AVSAddr string) error { - //check optedIn info - if k.IsOptedIn(ctx, operatorAddress.String(), AVSAddr) { +func (k *Keeper) OptIn(ctx sdk.Context, operatorAddress sdk.AccAddress, avsAddr string) error { + // check optedIn info + if k.IsOptedIn(ctx, operatorAddress.String(), avsAddr) { return types.ErrAlreadyOptedIn } - //get the assets supported by the AVS - avsSupportedAssets, err := k.avsKeeper.GetAvsSupportedAssets(ctx, AVSAddr) + // get the assets supported by the AVS + avsSupportedAssets, err := k.avsKeeper.GetAvsSupportedAssets(ctx, avsAddr) if err != nil { return err } - //get the Assets opted in the operator + // get the Assets opted in the operator operatorAssets, err := k.restakingStateKeeper.GetOperatorAssetInfos(ctx, operatorAddress, avsSupportedAssets) if err != nil { return err @@ -107,13 +109,13 @@ func (k *Keeper) OptIn(ctx sdk.Context, operatorAddress sdk.AccAddress, AVSAddr assetInfoRecord := make(map[string]*AssetPriceAndDecimal) for assetID, operatorAssetState := range operatorAssets { - //get price and priceDecimal from oracle + // get price and priceDecimal from oracle price, decimal, err := k.oracleKeeper.GetSpecifiedAssetsPrice(ctx, assetID) if err != nil { return err } - //get the decimal of asset + // get the decimal of asset assetInfo, err := k.restakingStateKeeper.GetStakingAssetInfo(ctx, assetID) if err != nil { return err @@ -127,12 +129,12 @@ func (k *Keeper) OptIn(ctx sdk.Context, operatorAddress sdk.AccAddress, AVSAddr operatorUSDValue := CalculateShare(operatorAssetState.OperatorOwnAmountOrWantChangeValue, price, assetInfo.AssetBasicInfo.Decimals, decimal) operatorOwnAssetUSDValue = operatorOwnAssetUSDValue.Add(operatorUSDValue) - //UpdateStateForAsset - changeState := types.AssetOptedInState{ + // UpdateStateForAsset + changeState := types.OptedInAssetState{ Amount: operatorAssetState.TotalAmountOrWantChangeValue, Value: assetUSDValue, } - err = k.UpdateStateForAsset(ctx, assetID, AVSAddr, operatorAddress.String(), changeState) + err = k.UpdateStateForAsset(ctx, assetID, avsAddr, operatorAddress.String(), changeState) if err != nil { return err } @@ -140,24 +142,24 @@ func (k *Keeper) OptIn(ctx sdk.Context, operatorAddress sdk.AccAddress, AVSAddr assetFilter[assetID] = nil } - //update the share value of operator itself, the input stakerID should be empty - err = k.UpdateStakerShare(ctx, AVSAddr, "", operatorAddress.String(), operatorOwnAssetUSDValue) + // update the share value of operator itself, the input stakerID should be empty + err = k.UpdateStakerShare(ctx, avsAddr, "", operatorAddress.String(), operatorOwnAssetUSDValue) if err != nil { return err } - //UpdateAVSShare - err = k.UpdateAVSShare(ctx, AVSAddr, totalAssetUSDValue) + // UpdateAVSShare + err = k.UpdateAVSShare(ctx, avsAddr, totalAssetUSDValue) if err != nil { return err } - //UpdateOperatorShare - err = k.UpdateOperatorShare(ctx, AVSAddr, operatorAddress.String(), totalAssetUSDValue) + // UpdateOperatorShare + err = k.UpdateOperatorShare(ctx, avsAddr, operatorAddress.String(), totalAssetUSDValue) if err != nil { return err } - //UpdateStakerShare + // UpdateStakerShare relatedAssetsState, err := k.delegationKeeper.DelegationStateByOperatorAssets(ctx, operatorAddress.String(), assetFilter) if err != nil { return err @@ -166,18 +168,18 @@ func (k *Keeper) OptIn(ctx sdk.Context, operatorAddress sdk.AccAddress, AVSAddr for stakerID, assetState := range relatedAssetsState { stakerAssetsUSDValue := sdkmath.LegacyNewDec(0) for assetID, amount := range assetState { - singleAssetUSDValue := CalculateShare(amount.CanUndelegationAmount, assetInfoRecord[assetID].Price, assetInfoRecord[assetID].Decimal, assetInfoRecord[assetID].PriceDecimal) + singleAssetUSDValue := CalculateShare(amount.CanBeUndelegatedAmount, assetInfoRecord[assetID].Price, assetInfoRecord[assetID].Decimal, assetInfoRecord[assetID].PriceDecimal) stakerAssetsUSDValue = stakerAssetsUSDValue.Add(singleAssetUSDValue) } - err = k.UpdateStakerShare(ctx, AVSAddr, stakerID, operatorAddress.String(), stakerAssetsUSDValue) + err = k.UpdateStakerShare(ctx, avsAddr, stakerID, operatorAddress.String(), stakerAssetsUSDValue) if err != nil { return err } } - //update opted-in info - slashContract, err := k.avsKeeper.GetAvsSlashContract(ctx, AVSAddr) + // update opted-in info + slashContract, err := k.avsKeeper.GetAvsSlashContract(ctx, avsAddr) if err != nil { return err } @@ -186,7 +188,7 @@ func (k *Keeper) OptIn(ctx sdk.Context, operatorAddress sdk.AccAddress, AVSAddr OptedInHeight: uint64(ctx.BlockHeight()), OptedOutHeight: types.DefaultOptedOutHeight, } - err = k.UpdateOptedInfo(ctx, operatorAddress.String(), AVSAddr, optedInfo) + err = k.UpdateOptedInfo(ctx, operatorAddress.String(), avsAddr, optedInfo) if err != nil { return err } @@ -194,18 +196,18 @@ func (k *Keeper) OptIn(ctx sdk.Context, operatorAddress sdk.AccAddress, AVSAddr } // OptOut call this function to opt out of AVS -func (k *Keeper) OptOut(ctx sdk.Context, operatorAddress sdk.AccAddress, AVSAddr string) error { - //check optedIn info - if !k.IsOptedIn(ctx, operatorAddress.String(), AVSAddr) { +func (k *Keeper) OptOut(ctx sdk.Context, operatorAddress sdk.AccAddress, avsAddr string) error { + // check optedIn info + if !k.IsOptedIn(ctx, operatorAddress.String(), avsAddr) { return types.ErrNotOptedIn } - //get the assets supported by the AVS - avsSupportedAssets, err := k.avsKeeper.GetAvsSupportedAssets(ctx, AVSAddr) + // get the assets supported by the AVS + avsSupportedAssets, err := k.avsKeeper.GetAvsSupportedAssets(ctx, avsAddr) if err != nil { return err } - //get the Assets opted in the operator + // get the Assets opted in the operator operatorAssets, err := k.restakingStateKeeper.GetOperatorAssetInfos(ctx, operatorAddress, avsSupportedAssets) if err != nil { return err @@ -214,14 +216,14 @@ func (k *Keeper) OptOut(ctx sdk.Context, operatorAddress sdk.AccAddress, AVSAddr assetFilter := make(map[string]interface{}) for assetID := range operatorAssets { - err = k.DeleteAssetState(ctx, assetID, AVSAddr, operatorAddress.String()) + err = k.DeleteAssetState(ctx, assetID, avsAddr, operatorAddress.String()) if err != nil { return err } assetFilter[assetID] = nil } - avsOperatorTotalValue, err := k.GetOperatorShare(ctx, AVSAddr, operatorAddress.String()) + avsOperatorTotalValue, err := k.GetOperatorShare(ctx, avsAddr, operatorAddress.String()) if err != nil { return err } @@ -229,42 +231,42 @@ func (k *Keeper) OptOut(ctx sdk.Context, operatorAddress sdk.AccAddress, AVSAddr return errorsmod.Wrap(types.ErrTheValueIsNegative, fmt.Sprintf("OptOut,avsOperatorTotalValue:%suite", avsOperatorTotalValue)) } - //delete the share value of operator itself, the input stakerID should be empty - err = k.DeleteStakerShare(ctx, AVSAddr, "", operatorAddress.String()) + // delete the share value of operator itself, the input stakerID should be empty + err = k.DeleteStakerShare(ctx, avsAddr, "", operatorAddress.String()) if err != nil { return err } - //UpdateAVSShare - err = k.UpdateAVSShare(ctx, AVSAddr, avsOperatorTotalValue.Neg()) + // UpdateAVSShare + err = k.UpdateAVSShare(ctx, avsAddr, avsOperatorTotalValue.Neg()) if err != nil { return err } - //DeleteOperatorShare - err = k.DeleteOperatorShare(ctx, AVSAddr, operatorAddress.String()) + // DeleteOperatorShare + err = k.DeleteOperatorShare(ctx, avsAddr, operatorAddress.String()) if err != nil { return err } - //DeleteStakerShare + // DeleteStakerShare relatedAssetsState, err := k.delegationKeeper.DelegationStateByOperatorAssets(ctx, operatorAddress.String(), assetFilter) if err != nil { return err } for stakerID := range relatedAssetsState { - err = k.DeleteStakerShare(ctx, AVSAddr, stakerID, operatorAddress.String()) + err = k.DeleteStakerShare(ctx, avsAddr, stakerID, operatorAddress.String()) if err != nil { return err } } - //set opted-out height - optedInfo, err := k.GetOptedInfo(ctx, operatorAddress.String(), AVSAddr) + // set opted-out height + optedInfo, err := k.GetOptedInfo(ctx, operatorAddress.String(), avsAddr) if err != nil { return err } optedInfo.OptedOutHeight = uint64(ctx.BlockHeight()) - err = k.UpdateOptedInfo(ctx, operatorAddress.String(), AVSAddr, optedInfo) + err = k.UpdateOptedInfo(ctx, operatorAddress.String(), avsAddr, optedInfo) if err != nil { return err } @@ -272,19 +274,19 @@ func (k *Keeper) OptOut(ctx sdk.Context, operatorAddress sdk.AccAddress, AVSAddr } // GetAssetsAmountToSlash It will slash the assets that are opting into AVS first, and if there isn't enough to slash, then it will slash the assets that have requested to undelegate but still locked. -func (k *Keeper) GetAssetsAmountToSlash(ctx sdk.Context, operatorAddress sdk.AccAddress, AVSAddr string, occurredSateHeight int64, slashProportion sdkmath.LegacyDec) (*SlashAssets, error) { +func (k *Keeper) GetAssetsAmountToSlash(ctx sdk.Context, operatorAddress sdk.AccAddress, avsAddr string, occurredSateHeight int64, slashProportion sdkmath.LegacyDec) (*SlashAssets, error) { ret := &SlashAssets{ slashStakerInfo: make(map[string]map[string]*slashAmounts, 0), slashOperatorInfo: make(map[string]*slashAmounts, 0), } - //get the state when the slash occurred + // get the state when the slash occurred historicalSateCtx, err := types2.ContextForHistoricalState(ctx, occurredSateHeight) if err != nil { return nil, err } - //get assetsInfo supported by AVS - assetsFilter, err := k.avsKeeper.GetAvsSupportedAssets(historicalSateCtx, AVSAddr) + // get assetsInfo supported by AVS + assetsFilter, err := k.avsKeeper.GetAvsSupportedAssets(historicalSateCtx, avsAddr) if err != nil { return nil, err } @@ -293,24 +295,24 @@ func (k *Keeper) GetAssetsAmountToSlash(ctx sdk.Context, operatorAddress sdk.Acc return nil, err } - //get the Assets opted in the operator + // get the Assets opted in the operator historyOperatorAssetsState, err := k.restakingStateKeeper.GetOperatorAssetInfos(historicalSateCtx, operatorAddress, assetsFilter) if err != nil { return nil, err } - //calculate the actual slash amount according to the history and current state + // calculate the actual slash amount according to the history and current state currentStakerAssets, err := k.delegationKeeper.DelegationStateByOperatorAssets(ctx, operatorAddress.String(), assetsFilter) if err != nil { return nil, err } - //get the Assets opted in the operator + // get the Assets opted in the operator currentOperatorAssetsState, err := k.restakingStateKeeper.GetOperatorAssetInfos(ctx, operatorAddress, assetsFilter) if err != nil { return nil, err } - //calculate the actual slash amount for staker + // calculate the actual slash amount for staker for stakerID, assetsState := range currentStakerAssets { if historyAssetState, ok := historyStakerAssets[stakerID]; ok { for assetID, curState := range assetsState { @@ -318,12 +320,12 @@ func (k *Keeper) GetAssetsAmountToSlash(ctx sdk.Context, operatorAddress sdk.Acc if _, exist := ret.slashStakerInfo[stakerID]; !exist { ret.slashStakerInfo[stakerID] = make(map[string]*slashAmounts, 0) } - shouldSlashAmount := slashProportion.MulInt(historyState.CanUndelegationAmount).TruncateInt() - if curState.CanUndelegationAmount.LT(shouldSlashAmount) { - ret.slashStakerInfo[stakerID][assetID].AmountFromOptedIn = curState.CanUndelegationAmount - remainShouldSlash := shouldSlashAmount.Sub(curState.CanUndelegationAmount) - if curState.UndelegatableAmountAfterSlash.LT(remainShouldSlash) { - ret.slashStakerInfo[stakerID][assetID].AmountFromUnbonding = curState.UndelegatableAmountAfterSlash + shouldSlashAmount := slashProportion.MulInt(historyState.CanBeUndelegatedAmount).TruncateInt() + if curState.CanBeUndelegatedAmount.LT(shouldSlashAmount) { + ret.slashStakerInfo[stakerID][assetID].AmountFromOptedIn = curState.CanBeUndelegatedAmount + remainShouldSlash := shouldSlashAmount.Sub(curState.CanBeUndelegatedAmount) + if curState.CanBeUndelegatedAfterSlash.LT(remainShouldSlash) { + ret.slashStakerInfo[stakerID][assetID].AmountFromUnbonding = curState.CanBeUndelegatedAfterSlash } else { ret.slashStakerInfo[stakerID][assetID].AmountFromUnbonding = remainShouldSlash } @@ -335,15 +337,15 @@ func (k *Keeper) GetAssetsAmountToSlash(ctx sdk.Context, operatorAddress sdk.Acc } } - //calculate the actual slash amount for operator + // calculate the actual slash amount for operator for assetID, curAssetState := range currentOperatorAssetsState { if historyAssetState, ok := historyOperatorAssetsState[assetID]; ok { shouldSlashAmount := slashProportion.MulInt(historyAssetState.OperatorOwnAmountOrWantChangeValue).TruncateInt() if curAssetState.OperatorOwnAmountOrWantChangeValue.LT(shouldSlashAmount) { ret.slashOperatorInfo[assetID].AmountFromOptedIn = curAssetState.OperatorOwnAmountOrWantChangeValue remainShouldSlash := shouldSlashAmount.Sub(curAssetState.OperatorOwnAmountOrWantChangeValue) - if curAssetState.OperatorUnbondableAmountAfterSlash.LT(remainShouldSlash) { - ret.slashOperatorInfo[assetID].AmountFromUnbonding = curAssetState.OperatorUnbondableAmountAfterSlash + if curAssetState.OperatorCanUnbondAfterSlash.LT(remainShouldSlash) { + ret.slashOperatorInfo[assetID].AmountFromUnbonding = curAssetState.OperatorCanUnbondAfterSlash } else { ret.slashOperatorInfo[assetID].AmountFromUnbonding = remainShouldSlash } @@ -358,12 +360,12 @@ func (k *Keeper) GetAssetsAmountToSlash(ctx sdk.Context, operatorAddress sdk.Acc func (k *Keeper) SlashStaker(ctx sdk.Context, operatorAddress sdk.AccAddress, slashStakerInfo map[string]map[string]*slashAmounts, executeHeight uint64) error { for stakerID, slashAssets := range slashStakerInfo { for assetID, slashInfo := range slashAssets { - //handle the state that needs to be updated when slashing both opted-in and unbonding assets - //update delegation state + // handle the state that needs to be updated when slashing both opted-in and unbonding assets + // update delegation state delegatorAndAmount := make(map[string]*delegationtype.DelegationAmounts) delegatorAndAmount[operatorAddress.String()] = &delegationtype.DelegationAmounts{ - CanUndelegationAmount: slashInfo.AmountFromOptedIn.Neg(), - UndelegatableAmountAfterSlash: slashInfo.AmountFromUnbonding.Neg(), + CanBeUndelegatedAmount: slashInfo.AmountFromOptedIn.Neg(), + CanBeUndelegatedAfterSlash: slashInfo.AmountFromUnbonding.Neg(), } err := k.delegationKeeper.UpdateDelegationState(ctx, stakerID, assetID, delegatorAndAmount) if err != nil { @@ -375,7 +377,7 @@ func (k *Keeper) SlashStaker(ctx sdk.Context, operatorAddress sdk.AccAddress, sl } slashSumValue := slashInfo.AmountFromUnbonding.Add(slashInfo.AmountFromOptedIn) - //update staker and operator assets state + // update staker and operator assets state err = k.restakingStateKeeper.UpdateStakerAssetState(ctx, stakerID, assetID, types2.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: slashSumValue.Neg(), }) @@ -383,20 +385,20 @@ func (k *Keeper) SlashStaker(ctx sdk.Context, operatorAddress sdk.AccAddress, sl return err } - //Record the slash information for scheduled tasks and send it to the client chain once the veto duration expires. + // Record the slash information for scheduled tasks and send it to the client chain once the veto duration expires. err = k.UpdateSlashAssetsState(ctx, assetID, stakerID, executeHeight, slashSumValue) if err != nil { return err } - //handle the state that needs to be updated when slashing opted-in assets + // handle the state that needs to be updated when slashing opted-in assets err = k.restakingStateKeeper.UpdateOperatorAssetState(ctx, operatorAddress, assetID, types2.OperatorSingleAssetOrChangeInfo{ TotalAmountOrWantChangeValue: slashInfo.AmountFromOptedIn.Neg(), }) if err != nil { return err } - //decrease the related share value + // decrease the related share value err = k.UpdateOptedInAssetsState(ctx, stakerID, assetID, operatorAddress.String(), slashInfo.AmountFromOptedIn.Neg()) if err != nil { return err @@ -409,23 +411,23 @@ func (k *Keeper) SlashStaker(ctx sdk.Context, operatorAddress sdk.AccAddress, sl func (k *Keeper) SlashOperator(ctx sdk.Context, operatorAddress sdk.AccAddress, slashOperatorInfo map[string]*slashAmounts, executeHeight uint64) error { for assetID, slashInfo := range slashOperatorInfo { slashSumValue := slashInfo.AmountFromUnbonding.Add(slashInfo.AmountFromOptedIn) - //handle the state that needs to be updated when slashing both opted-in and unbonding assets + // handle the state that needs to be updated when slashing both opted-in and unbonding assets err := k.restakingStateKeeper.UpdateOperatorAssetState(ctx, operatorAddress, assetID, types2.OperatorSingleAssetOrChangeInfo{ TotalAmountOrWantChangeValue: slashSumValue.Neg(), OperatorOwnAmountOrWantChangeValue: slashInfo.AmountFromOptedIn.Neg(), - OperatorUnbondableAmountAfterSlash: slashInfo.AmountFromUnbonding.Neg(), + OperatorCanUnbondAfterSlash: slashInfo.AmountFromUnbonding.Neg(), }) if err != nil { return err } - //Record the slash information for scheduled tasks and send it to the client chain once the veto duration expires. + // Record the slash information for scheduled tasks and send it to the client chain once the veto duration expires. err = k.UpdateSlashAssetsState(ctx, assetID, operatorAddress.String(), executeHeight, slashSumValue) if err != nil { return err } - //handle the state that needs to be updated when slashing opted-in assets - //decrease the related share value + // handle the state that needs to be updated when slashing opted-in assets + // decrease the related share value err = k.UpdateOptedInAssetsState(ctx, "", assetID, operatorAddress.String(), slashInfo.AmountFromOptedIn.Neg()) if err != nil { return err @@ -435,22 +437,22 @@ func (k *Keeper) SlashOperator(ctx sdk.Context, operatorAddress sdk.AccAddress, } // Slash The occurredSateHeight should be the height that has the latest stable state. -func (k *Keeper) Slash(ctx sdk.Context, operatorAddress sdk.AccAddress, AVSAddr, slashContract, slashId string, occurredSateHeight int64, slashProportion sdkmath.LegacyDec) error { +func (k *Keeper) Slash(ctx sdk.Context, operatorAddress sdk.AccAddress, avsAddr, slashContract, slashID string, occurredSateHeight int64, slashProportion sdkmath.LegacyDec) error { height := ctx.BlockHeight() if occurredSateHeight > height { return errorsmod.Wrap(types.ErrSlashOccurredHeight, fmt.Sprintf("occurredSateHeight:%d,curHeight:%d", occurredSateHeight, height)) } - //get the state when the slash occurred - //get the opted-in info + // get the state when the slash occurred + // get the opted-in info historicalSateCtx, err := types2.ContextForHistoricalState(ctx, occurredSateHeight) if err != nil { return err } - if !k.IsOptedIn(ctx, operatorAddress.String(), AVSAddr) { + if !k.IsOptedIn(ctx, operatorAddress.String(), avsAddr) { return types.ErrNotOptedIn } - optedInfo, err := k.GetOptedInfo(historicalSateCtx, operatorAddress.String(), AVSAddr) + optedInfo, err := k.GetOptedInfo(historicalSateCtx, operatorAddress.String(), avsAddr) if err != nil { return err } @@ -458,7 +460,7 @@ func (k *Keeper) Slash(ctx sdk.Context, operatorAddress sdk.AccAddress, AVSAddr, return errorsmod.Wrap(types.ErrSlashContractNotMatch, fmt.Sprintf("input slashContract:%suite, opted-in slash contract:%suite", slashContract, optedInfo.SlashContract)) } - //todo: recording the slash event might be moved to the slash module + // todo: recording the slash event might be moved to the slash module slashInfo := types.OperatorSlashInfo{ SlashContract: slashContract, SlashHeight: height, @@ -466,13 +468,13 @@ func (k *Keeper) Slash(ctx sdk.Context, operatorAddress sdk.AccAddress, AVSAddr, SlashProportion: slashProportion, ExecuteHeight: height + types.SlashVetoDuration, } - err = k.UpdateOperatorSlashInfo(ctx, operatorAddress.String(), AVSAddr, slashId, slashInfo) + err = k.UpdateOperatorSlashInfo(ctx, operatorAddress.String(), avsAddr, slashID, slashInfo) if err != nil { return err } // get the assets and amounts that should be slashed - assetsSlashInfo, err := k.GetAssetsAmountToSlash(ctx, operatorAddress, AVSAddr, occurredSateHeight, slashProportion) + assetsSlashInfo, err := k.GetAssetsAmountToSlash(ctx, operatorAddress, avsAddr, occurredSateHeight, slashProportion) if err != nil { return err } diff --git a/x/operator/keeper/state_update_test.go b/x/operator/keeper/state_update_test.go index 53f560b1f..09e68b4b1 100644 --- a/x/operator/keeper/state_update_test.go +++ b/x/operator/keeper/state_update_test.go @@ -1,6 +1,8 @@ package keeper_test import ( + "strings" + sdkmath "cosmossdk.io/math" delegationKeeper "github.com/ExocoreNetwork/exocore/x/delegation/keeper" "github.com/ExocoreNetwork/exocore/x/deposit/keeper" @@ -9,14 +11,13 @@ import ( restakingTypes "github.com/ExocoreNetwork/exocore/x/restaking_assets_manage/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common" - "strings" ) type StateForCheck struct { OptedInfo *operatorTypes.OptedInfo AVSTotalShare sdkmath.LegacyDec AVSOperatorShare sdkmath.LegacyDec - AssetState *operatorTypes.AssetOptedInState + AssetState *operatorTypes.OptedInAssetState OperatorShare sdkmath.LegacyDec StakerShare sdkmath.LegacyDec } @@ -37,7 +38,7 @@ func (suite *OperatorTestSuite) prepare() { suite.updatedAmountForOptIn = sdkmath.NewInt(20) suite.stakerID, suite.assetID = restakingTypes.GetStakeIDAndAssetID(suite.clientChainLzID, suite.Address[:], suite.assetAddr[:]) - //staking assets + // staking assets depositParam := &keeper.DepositParams{ ClientChainLzID: suite.clientChainLzID, Action: restakingTypes.Deposit, @@ -48,7 +49,7 @@ func (suite *OperatorTestSuite) prepare() { err = suite.App.DepositKeeper.Deposit(suite.Ctx, depositParam) suite.NoError(err) - //register operator + // register operator registerReq := &operatorTypes.RegisterOperatorReq{ FromAddress: suite.operatorAddr.String(), Info: &operatorTypes.OperatorInfo{ @@ -58,7 +59,7 @@ func (suite *OperatorTestSuite) prepare() { _, err = suite.App.OperatorKeeper.RegisterOperator(suite.Ctx, registerReq) suite.NoError(err) - //delegate to operator + // delegate to operator delegationParam := &delegationKeeper.DelegationOrUndelegationParams{ ClientChainLzID: suite.clientChainLzID, Action: restakingTypes.DelegateTo, @@ -74,7 +75,7 @@ func (suite *OperatorTestSuite) prepare() { } func (suite *OperatorTestSuite) CheckState(expectedState *StateForCheck) { - //check opted info + // check opted info optInfo, err := suite.App.OperatorKeeper.GetOptedInfo(suite.Ctx, suite.operatorAddr.String(), suite.avsAddr) if expectedState.OptedInfo == nil { suite.True(strings.Contains(err.Error(), operatorTypes.ErrNoKeyInTheStore.Error())) @@ -82,7 +83,7 @@ func (suite *OperatorTestSuite) CheckState(expectedState *StateForCheck) { suite.NoError(err) suite.Equal(*expectedState.OptedInfo, *optInfo) } - //check total USD value for AVS and operator + // check total USD value for AVS and operator value, err := suite.App.OperatorKeeper.GetAVSShare(suite.Ctx, suite.avsAddr) if expectedState.AVSTotalShare.IsNil() { suite.True(strings.Contains(err.Error(), operatorTypes.ErrNoKeyInTheStore.Error())) @@ -99,7 +100,7 @@ func (suite *OperatorTestSuite) CheckState(expectedState *StateForCheck) { suite.Equal(expectedState.AVSOperatorShare, value) } - //check assets state for AVS and operator + // check assets state for AVS and operator assetState, err := suite.App.OperatorKeeper.GetAssetState(suite.Ctx, suite.assetID, suite.avsAddr, suite.operatorAddr.String()) if expectedState.AssetState == nil { suite.True(strings.Contains(err.Error(), operatorTypes.ErrNoKeyInTheStore.Error())) @@ -108,7 +109,7 @@ func (suite *OperatorTestSuite) CheckState(expectedState *StateForCheck) { suite.Equal(*expectedState.AssetState, *assetState) } - //check asset USD share for staker and operator + // check asset USD share for staker and operator operatorShare, err := suite.App.OperatorKeeper.GetStakerShare(suite.Ctx, suite.avsAddr, "", suite.operatorAddr.String()) if expectedState.OperatorShare.IsNil() { suite.True(strings.Contains(err.Error(), operatorTypes.ErrNoKeyInTheStore.Error())) @@ -129,7 +130,7 @@ func (suite *OperatorTestSuite) TestOptIn() { suite.prepare() err := suite.App.OperatorKeeper.OptIn(suite.Ctx, suite.operatorAddr, suite.avsAddr) suite.NoError(err) - //check if the related state is correct + // check if the related state is correct price, decimal, err := suite.App.OperatorKeeper.OracleInterface().GetSpecifiedAssetsPrice(suite.Ctx, suite.assetID) share := operatorKeeper.CalculateShare(suite.delegationAmount, price, suite.assetDecimal, decimal) expectedState := &StateForCheck{ @@ -139,7 +140,7 @@ func (suite *OperatorTestSuite) TestOptIn() { }, AVSTotalShare: share, AVSOperatorShare: share, - AssetState: &operatorTypes.AssetOptedInState{ + AssetState: &operatorTypes.OptedInAssetState{ Amount: suite.delegationAmount, Value: share, }, @@ -206,7 +207,7 @@ func (suite *OperatorTestSuite) TestUpdateOptedInAssetsState() { }, AVSTotalShare: newShare, AVSOperatorShare: newShare, - AssetState: &operatorTypes.AssetOptedInState{ + AssetState: &operatorTypes.OptedInAssetState{ Amount: suite.delegationAmount.Add(suite.updatedAmountForOptIn), Value: newShare, }, @@ -228,5 +229,4 @@ func (suite *OperatorTestSuite) TestSlash() { suite.NextBlock() } suite.Equal(runToHeight, suite.Ctx.BlockHeight()) - } diff --git a/x/operator/module.go b/x/operator/module.go index f14f48755..cf870c535 100644 --- a/x/operator/module.go +++ b/x/operator/module.go @@ -2,6 +2,7 @@ package operator import ( "context" + "github.com/ExocoreNetwork/exocore/x/operator/client/cli" "github.com/ExocoreNetwork/exocore/x/operator/keeper" operatortypes "github.com/ExocoreNetwork/exocore/x/operator/types" @@ -16,8 +17,6 @@ import ( "github.com/spf13/cobra" ) -const consensusVersion = 0 - // type check to ensure the interface is properly implemented var ( _ module.AppModule = AppModule{} @@ -58,7 +57,7 @@ type AppModule struct { keeper keeper.Keeper } -func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { +func NewAppModule(_ codec.Codec, keeper keeper.Keeper) AppModule { return AppModule{ AppModuleBasic: AppModuleBasic{}, keeper: keeper, @@ -77,13 +76,13 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { operatortypes.RegisterQueryServer(cfg.QueryServer(), &am.keeper) } -func (am AppModule) GenerateGenesisState(input *module.SimulationState) { +func (am AppModule) GenerateGenesisState(_ *module.SimulationState) { } -func (am AppModule) RegisterStoreDecoder(registry sdk.StoreDecoderRegistry) { +func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { } -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { +func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { return []simtypes.WeightedOperation{} } diff --git a/x/operator/types/app_chain_utils.go b/x/operator/types/app_chain_utils.go index 9c3a96e9c..6073d38c1 100644 --- a/x/operator/types/app_chain_utils.go +++ b/x/operator/types/app_chain_utils.go @@ -16,16 +16,16 @@ func AppendMany(byteses ...[]byte) (out []byte) { return out } -// ChainIdWithLenKey returns the key with the following format: +// ChainIDWithLenKey returns the key with the following format: // bytePrefix | len(chainId) | chainId // This is similar to Solidity's ABI encoding. -func ChainIdWithLenKey(chainId string) []byte { - chainIdL := len(chainId) +func ChainIDWithLenKey(chainID string) []byte { + chainIDL := len(chainID) return AppendMany( - // Append the chainId length - sdk.Uint64ToBigEndian(uint64(chainIdL)), - // Append the chainId - []byte(chainId), + // Append the chainID length + sdk.Uint64ToBigEndian(uint64(chainIDL)), + // Append the chainID + []byte(chainID), ) } diff --git a/x/operator/types/codec.go b/x/operator/types/codec.go index 71e40f49e..89bd73c1a 100644 --- a/x/operator/types/codec.go +++ b/x/operator/types/codec.go @@ -21,11 +21,6 @@ var ( AminoCdc = codec.NewAminoCodec(amino) ) -const ( - // Amino names - registerOperator = "exocore/RegisterOperatorReq" -) - // NOTE: This is required for the GetSignBytes function func init() { RegisterLegacyAminoCodec(amino) @@ -37,8 +32,8 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { registry.RegisterImplementations( (*sdk.Msg)(nil), &RegisterOperatorReq{}, - &OptInToChainIdRequest{}, - &InitiateOptOutFromChainIdRequest{}, + &OptInToChainIDRequest{}, + &InitiateOptOutFromChainIDRequest{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } @@ -46,6 +41,6 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { // RegisterLegacyAminoCodec registers the necessary x/revenue interfaces and // concrete types on the provided LegacyAmino codec. These types are used for // Amino JSON serialization and EIP-712 compatibility. -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - //cdc.RegisterConcrete(&RegisterOperatorReq{}, registerOperator, nil) +func RegisterLegacyAminoCodec(_ *codec.LegacyAmino) { + // cdc.RegisterConcrete(&RegisterOperatorReq{}, registerOperator, nil) } diff --git a/x/operator/types/expected_keepers.go b/x/operator/types/expected_keepers.go index ebd102cb9..21099becf 100644 --- a/x/operator/types/expected_keepers.go +++ b/x/operator/types/expected_keepers.go @@ -21,18 +21,18 @@ type PriceChange struct { Decimal uint8 } type ExpectOracleInterface interface { - GetSpecifiedAssetsPrice(ctx sdk.Context, assetsId string) (sdkmath.Int, uint8, error) + GetSpecifiedAssetsPrice(ctx sdk.Context, assetsID string) (sdkmath.Int, uint8, error) GetPriceChangeAssets(ctx sdk.Context) (map[string]*PriceChange, error) } type MockOracle struct{} -func (MockOracle) GetSpecifiedAssetsPrice(ctx sdk.Context, assetsId string) (sdkmath.Int, uint8, error) { +func (MockOracle) GetSpecifiedAssetsPrice(_ sdk.Context, _ string) (sdkmath.Int, uint8, error) { return sdkmath.NewInt(1), 0, nil } -func (MockOracle) GetPriceChangeAssets(ctx sdk.Context) (map[string]*PriceChange, error) { - //use USDT as the mock asset +func (MockOracle) GetPriceChangeAssets(_ sdk.Context) (map[string]*PriceChange, error) { + // use USDT as the mock asset ret := make(map[string]*PriceChange, 0) usdtAssetID := "0xdac17f958d2ee523a2206206994597c13d831ec7_0x65" ret[usdtAssetID] = &PriceChange{ @@ -45,15 +45,15 @@ func (MockOracle) GetPriceChangeAssets(ctx sdk.Context) (map[string]*PriceChange type MockAVS struct{} -func (MockAVS) GetAvsSupportedAssets(ctx sdk.Context, avsAddr string) (map[string]interface{}, error) { - //set USDT as the default asset supported by AVS +func (MockAVS) GetAvsSupportedAssets(_ sdk.Context, _ string) (map[string]interface{}, error) { + // set USDT as the default asset supported by AVS ret := make(map[string]interface{}) usdtAssetID := "0xdac17f958d2ee523a2206206994597c13d831ec7_0x65" ret[usdtAssetID] = nil return ret, nil } -func (MockAVS) GetAvsSlashContract(ctx sdk.Context, avsAddr string) (string, error) { +func (MockAVS) GetAvsSlashContract(_ sdk.Context, _ string) (string, error) { return "", nil } @@ -69,7 +69,7 @@ type SlashKeeper interface { } type RedelegationKeeper interface { - AppChainInfoIsExist(ctx sdk.Context, chainId string) bool + AppChainInfoIsExist(ctx sdk.Context, chainID string) bool } type OperatorConsentHooks interface { @@ -77,7 +77,7 @@ type OperatorConsentHooks interface { AfterOperatorOptIn( ctx sdk.Context, addr sdk.AccAddress, - chainId string, + chainID string, pubKey tmprotocrypto.PublicKey, ) // This hook is called when an operator's consensus key is replaced for @@ -87,13 +87,13 @@ type OperatorConsentHooks interface { addr sdk.AccAddress, oldKey tmprotocrypto.PublicKey, newKey tmprotocrypto.PublicKey, - chainId string, + chainID string, ) // This hook is called when an operator opts out of a chain. AfterOperatorOptOutInitiated( ctx sdk.Context, addr sdk.AccAddress, - chainId string, + chainID string, key tmprotocrypto.PublicKey, ) } diff --git a/x/operator/types/hooks.go b/x/operator/types/hooks.go index 66a6465b2..0c3441ab6 100644 --- a/x/operator/types/hooks.go +++ b/x/operator/types/hooks.go @@ -16,11 +16,11 @@ func NewMultiOperatorConsentHooks(hooks ...OperatorConsentHooks) MultiOperatorCo func (hooks MultiOperatorConsentHooks) AfterOperatorOptIn( ctx sdk.Context, addr sdk.AccAddress, - chainId string, + chainID string, pubKey tmprotocrypto.PublicKey, ) { for _, hook := range hooks { - hook.AfterOperatorOptIn(ctx, addr, chainId, pubKey) + hook.AfterOperatorOptIn(ctx, addr, chainID, pubKey) } } @@ -29,17 +29,17 @@ func (hooks MultiOperatorConsentHooks) AfterOperatorKeyReplacement( addr sdk.AccAddress, oldKey tmprotocrypto.PublicKey, newAddr tmprotocrypto.PublicKey, - chainId string, + chainID string, ) { for _, hook := range hooks { - hook.AfterOperatorKeyReplacement(ctx, addr, oldKey, newAddr, chainId) + hook.AfterOperatorKeyReplacement(ctx, addr, oldKey, newAddr, chainID) } } func (hooks MultiOperatorConsentHooks) AfterOperatorOptOutInitiated( - ctx sdk.Context, addr sdk.AccAddress, chainId string, key tmprotocrypto.PublicKey, + ctx sdk.Context, addr sdk.AccAddress, chainID string, key tmprotocrypto.PublicKey, ) { for _, hook := range hooks { - hook.AfterOperatorOptOutInitiated(ctx, addr, chainId, key) + hook.AfterOperatorOptOutInitiated(ctx, addr, chainID, key) } } diff --git a/x/operator/types/keys.go b/x/operator/types/keys.go index e4130c014..e83781e8f 100644 --- a/x/operator/types/keys.go +++ b/x/operator/types/keys.go @@ -1,10 +1,11 @@ package types import ( + "math" + sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/ethereum/go-ethereum/common" - "math" ) // constants @@ -49,12 +50,12 @@ const ( prefixSlashAssetsState - //add keys for dogfood - BytePrefixForOperatorAndChainIdToConsKey = iota - BytePrefixForOperatorAndChainIdToPrevConsKey - BytePrefixForChainIdAndOperatorToConsKey - BytePrefixForChainIdAndConsKeyToOperator - BytePrefixForOperatorOptOutFromChainId + // add keys for dogfood + BytePrefixForOperatorAndChainIDToConsKey = iota + BytePrefixForOperatorAndChainIDToPrevConsKey + BytePrefixForChainIDAndOperatorToConsKey + BytePrefixForChainIDAndConsKeyToOperator + BytePrefixForOperatorOptOutFromChainID ) var ( @@ -71,7 +72,7 @@ var ( KeyPrefixAVSOperatorAssetsTotalValue = []byte{prefixAVSOperatorAssetsTotalValue} // KeyPrefixOperatorAVSSingleAssetState key-value: - // assetID + '/' + AVSAddr + '/' + operatorAddr -> AssetOptedInState + // assetID + '/' + AVSAddr + '/' + operatorAddr -> OptedInAssetState KeyPrefixOperatorAVSSingleAssetState = []byte{prefixOperatorAVSSingleAssetState} // KeyPrefixAVSOperatorStakerShareState key-value: @@ -94,8 +95,8 @@ func KeyPrefix(p string) []byte { return []byte(p) } -func AddrAndChainIdKey(prefix byte, addr sdk.AccAddress, chainId string) []byte { - partialKey := ChainIdWithLenKey(chainId) +func AddrAndChainIDKey(prefix byte, addr sdk.AccAddress, chainID string) []byte { + partialKey := ChainIDWithLenKey(chainID) return AppendMany( // Append the prefix []byte{prefix}, @@ -107,50 +108,50 @@ func AddrAndChainIdKey(prefix byte, addr sdk.AccAddress, chainId string) []byte ) } -func ChainIdAndAddrKey(prefix byte, chainId string, addr sdk.AccAddress) []byte { - partialKey := ChainIdWithLenKey(chainId) +func ChainIDAndAddrKey(prefix byte, chainID string, addr sdk.AccAddress) []byte { + partialKey := ChainIDWithLenKey(chainID) return AppendMany( // Append the prefix []byte{prefix}, // Append the partialKey so that we can look for any operator keys - // corresponding to this chainId easily. + // corresponding to this chainID easily. partialKey, addr, ) } -func KeyForOperatorAndChainIdToConsKey(addr sdk.AccAddress, chainId string) []byte { - return AddrAndChainIdKey( - BytePrefixForOperatorAndChainIdToConsKey, - addr, chainId, +func KeyForOperatorAndChainIDToConsKey(addr sdk.AccAddress, chainID string) []byte { + return AddrAndChainIDKey( + BytePrefixForOperatorAndChainIDToConsKey, + addr, chainID, ) } -func KeyForOperatorAndChainIdToPrevConsKey(addr sdk.AccAddress, chainId string) []byte { - return AddrAndChainIdKey( - BytePrefixForOperatorAndChainIdToPrevConsKey, - addr, chainId, +func KeyForOperatorAndChainIDToPrevConsKey(addr sdk.AccAddress, chainID string) []byte { + return AddrAndChainIDKey( + BytePrefixForOperatorAndChainIDToPrevConsKey, + addr, chainID, ) } -func KeyForChainIdAndOperatorToConsKey(chainId string, addr sdk.AccAddress) []byte { - return ChainIdAndAddrKey( - BytePrefixForChainIdAndOperatorToConsKey, - chainId, addr, +func KeyForChainIDAndOperatorToConsKey(chainID string, addr sdk.AccAddress) []byte { + return ChainIDAndAddrKey( + BytePrefixForChainIDAndOperatorToConsKey, + chainID, addr, ) } -func KeyForChainIdAndConsKeyToOperator(chainId string, addr sdk.ConsAddress) []byte { +func KeyForChainIDAndConsKeyToOperator(chainID string, addr sdk.ConsAddress) []byte { return AppendMany( - []byte{BytePrefixForChainIdAndConsKeyToOperator}, - ChainIdWithLenKey(chainId), + []byte{BytePrefixForChainIDAndConsKeyToOperator}, + ChainIDWithLenKey(chainID), addr, ) } -func KeyForOperatorOptOutFromChainId(addr sdk.AccAddress, chainId string) []byte { +func KeyForOperatorOptOutFromChainID(addr sdk.AccAddress, chainID string) []byte { return AppendMany( - []byte{BytePrefixForOperatorOptOutFromChainId}, addr, - ChainIdWithLenKey(chainId), + []byte{BytePrefixForOperatorOptOutFromChainID}, addr, + ChainIDWithLenKey(chainID), ) } diff --git a/x/operator/types/msg.go b/x/operator/types/msg.go index 52cfd2738..8d2bb19e5 100644 --- a/x/operator/types/msg.go +++ b/x/operator/types/msg.go @@ -9,8 +9,8 @@ var ( _ sdk.Msg = &RegisterOperatorReq{} // add for dogfood - _ sdk.Msg = &OptInToChainIdRequest{} - _ sdk.Msg = &InitiateOptOutFromChainIdRequest{} + _ sdk.Msg = &OptInToChainIDRequest{} + _ sdk.Msg = &InitiateOptOutFromChainIDRequest{} ) // GetSigners returns the expected signers for a MsgUpdateParams message. @@ -32,24 +32,24 @@ func (m *RegisterOperatorReq) GetSignBytes() []byte { return nil } -func (m *OptInToChainIdRequest) GetSigners() []sdk.AccAddress { +func (m *OptInToChainIDRequest) GetSigners() []sdk.AccAddress { addr := sdk.MustAccAddressFromBech32(m.Address) return []sdk.AccAddress{addr} } -func (m *OptInToChainIdRequest) ValidateBasic() error { +func (m *OptInToChainIDRequest) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(m.Address); err != nil { return errorsmod.Wrap(err, "invalid from address") } return nil } -func (m *InitiateOptOutFromChainIdRequest) GetSigners() []sdk.AccAddress { +func (m *InitiateOptOutFromChainIDRequest) GetSigners() []sdk.AccAddress { addr := sdk.MustAccAddressFromBech32(m.Address) return []sdk.AccAddress{addr} } -func (m *InitiateOptOutFromChainIdRequest) ValidateBasic() error { +func (m *InitiateOptOutFromChainIDRequest) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(m.Address); err != nil { return errorsmod.Wrap(err, "invalid from address") } diff --git a/x/operator/types/query.pb.go b/x/operator/types/query.pb.go index 0cc75c5ff..f80ee229b 100644 --- a/x/operator/types/query.pb.go +++ b/x/operator/types/query.pb.go @@ -32,8 +32,10 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// QueryOperatorInfoReq is the request to obtain the operator information. type GetOperatorInfoReq struct { - OperatorAddr string `protobuf:"bytes,1,opt,name=OperatorAddr,proto3" json:"OperatorAddr,omitempty"` + // operator_addr is the operator address. + OperatorAddr string `protobuf:"bytes,1,opt,name=operator_addr,json=operatorAddr,proto3" json:"operator_addr,omitempty"` } func (m *GetOperatorInfoReq) Reset() { *m = GetOperatorInfoReq{} } @@ -76,23 +78,26 @@ func (m *GetOperatorInfoReq) GetOperatorAddr() string { return "" } -type QueryOperatorConsKeyForChainIdRequest struct { - Addr string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"` +// QueryOperatorConsKeyForChainIDRequest is the request to obtain the consensus public key of the operator +type QueryOperatorConsKeyForChainIDRequest struct { + // addr is the ACC address of operator + Addr string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"` + // chain_id is the id of the chain served by the operator ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` } -func (m *QueryOperatorConsKeyForChainIdRequest) Reset() { *m = QueryOperatorConsKeyForChainIdRequest{} } -func (m *QueryOperatorConsKeyForChainIdRequest) String() string { return proto.CompactTextString(m) } -func (*QueryOperatorConsKeyForChainIdRequest) ProtoMessage() {} -func (*QueryOperatorConsKeyForChainIdRequest) Descriptor() ([]byte, []int) { +func (m *QueryOperatorConsKeyForChainIDRequest) Reset() { *m = QueryOperatorConsKeyForChainIDRequest{} } +func (m *QueryOperatorConsKeyForChainIDRequest) String() string { return proto.CompactTextString(m) } +func (*QueryOperatorConsKeyForChainIDRequest) ProtoMessage() {} +func (*QueryOperatorConsKeyForChainIDRequest) Descriptor() ([]byte, []int) { return fileDescriptor_f91e795a3cecbdbf, []int{1} } -func (m *QueryOperatorConsKeyForChainIdRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryOperatorConsKeyForChainIDRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryOperatorConsKeyForChainIdRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryOperatorConsKeyForChainIDRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryOperatorConsKeyForChainIdRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryOperatorConsKeyForChainIDRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -102,50 +107,52 @@ func (m *QueryOperatorConsKeyForChainIdRequest) XXX_Marshal(b []byte, determinis return b[:n], nil } } -func (m *QueryOperatorConsKeyForChainIdRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryOperatorConsKeyForChainIdRequest.Merge(m, src) +func (m *QueryOperatorConsKeyForChainIDRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOperatorConsKeyForChainIDRequest.Merge(m, src) } -func (m *QueryOperatorConsKeyForChainIdRequest) XXX_Size() int { +func (m *QueryOperatorConsKeyForChainIDRequest) XXX_Size() int { return m.Size() } -func (m *QueryOperatorConsKeyForChainIdRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryOperatorConsKeyForChainIdRequest.DiscardUnknown(m) +func (m *QueryOperatorConsKeyForChainIDRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOperatorConsKeyForChainIDRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryOperatorConsKeyForChainIdRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryOperatorConsKeyForChainIDRequest proto.InternalMessageInfo -func (m *QueryOperatorConsKeyForChainIdRequest) GetAddr() string { +func (m *QueryOperatorConsKeyForChainIDRequest) GetAddr() string { if m != nil { return m.Addr } return "" } -func (m *QueryOperatorConsKeyForChainIdRequest) GetChainId() string { +func (m *QueryOperatorConsKeyForChainIDRequest) GetChainId() string { if m != nil { return m.ChainId } return "" } -type QueryOperatorConsKeyForChainIdResponse struct { +// QueryOperatorConsKeyForChainIDResponse is the response for QueryOperatorConsKeyForChainId +type QueryOperatorConsKeyForChainIDResponse struct { + // public_key is the consensus public key of the operator PublicKey crypto.PublicKey `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key"` } -func (m *QueryOperatorConsKeyForChainIdResponse) Reset() { - *m = QueryOperatorConsKeyForChainIdResponse{} +func (m *QueryOperatorConsKeyForChainIDResponse) Reset() { + *m = QueryOperatorConsKeyForChainIDResponse{} } -func (m *QueryOperatorConsKeyForChainIdResponse) String() string { return proto.CompactTextString(m) } -func (*QueryOperatorConsKeyForChainIdResponse) ProtoMessage() {} -func (*QueryOperatorConsKeyForChainIdResponse) Descriptor() ([]byte, []int) { +func (m *QueryOperatorConsKeyForChainIDResponse) String() string { return proto.CompactTextString(m) } +func (*QueryOperatorConsKeyForChainIDResponse) ProtoMessage() {} +func (*QueryOperatorConsKeyForChainIDResponse) Descriptor() ([]byte, []int) { return fileDescriptor_f91e795a3cecbdbf, []int{2} } -func (m *QueryOperatorConsKeyForChainIdResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryOperatorConsKeyForChainIDResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryOperatorConsKeyForChainIdResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryOperatorConsKeyForChainIDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryOperatorConsKeyForChainIdResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryOperatorConsKeyForChainIDResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -155,19 +162,19 @@ func (m *QueryOperatorConsKeyForChainIdResponse) XXX_Marshal(b []byte, determini return b[:n], nil } } -func (m *QueryOperatorConsKeyForChainIdResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryOperatorConsKeyForChainIdResponse.Merge(m, src) +func (m *QueryOperatorConsKeyForChainIDResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOperatorConsKeyForChainIDResponse.Merge(m, src) } -func (m *QueryOperatorConsKeyForChainIdResponse) XXX_Size() int { +func (m *QueryOperatorConsKeyForChainIDResponse) XXX_Size() int { return m.Size() } -func (m *QueryOperatorConsKeyForChainIdResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryOperatorConsKeyForChainIdResponse.DiscardUnknown(m) +func (m *QueryOperatorConsKeyForChainIDResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOperatorConsKeyForChainIDResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryOperatorConsKeyForChainIdResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryOperatorConsKeyForChainIDResponse proto.InternalMessageInfo -func (m *QueryOperatorConsKeyForChainIdResponse) GetPublicKey() crypto.PublicKey { +func (m *QueryOperatorConsKeyForChainIDResponse) GetPublicKey() crypto.PublicKey { if m != nil { return m.PublicKey } @@ -176,45 +183,45 @@ func (m *QueryOperatorConsKeyForChainIdResponse) GetPublicKey() crypto.PublicKey func init() { proto.RegisterType((*GetOperatorInfoReq)(nil), "exocore.operator.v1.GetOperatorInfoReq") - proto.RegisterType((*QueryOperatorConsKeyForChainIdRequest)(nil), "exocore.operator.v1.QueryOperatorConsKeyForChainIdRequest") - proto.RegisterType((*QueryOperatorConsKeyForChainIdResponse)(nil), "exocore.operator.v1.QueryOperatorConsKeyForChainIdResponse") + proto.RegisterType((*QueryOperatorConsKeyForChainIDRequest)(nil), "exocore.operator.v1.QueryOperatorConsKeyForChainIDRequest") + proto.RegisterType((*QueryOperatorConsKeyForChainIDResponse)(nil), "exocore.operator.v1.QueryOperatorConsKeyForChainIDResponse") } func init() { proto.RegisterFile("exocore/operator/v1/query.proto", fileDescriptor_f91e795a3cecbdbf) } var fileDescriptor_f91e795a3cecbdbf = []byte{ - // 490 bytes of a gzipped FileDescriptorProto + // 495 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0x8d, 0xa3, 0xf2, 0xd1, 0x05, 0x09, 0x69, 0xe9, 0x21, 0x0d, 0x95, 0x0b, 0x96, 0x28, 0xbd, - 0xb0, 0xab, 0x86, 0x1b, 0x70, 0x49, 0x22, 0x40, 0x51, 0x11, 0x1f, 0x46, 0xe2, 0xc0, 0x25, 0x72, - 0xec, 0xc1, 0x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 0xd0, 0xf4, 0x79, + 0xf6, 0x95, 0x43, 0x9b, 0x1b, 0x11, 0x62, 0x34, 0x04, 0xee, 0x27, 0x31, 0xf7, 0x85, 0x40, 0xed, + 0xeb, 0x18, 0x85, 0x2a, 0xba, 0xd7, 0x03, 0x54, 0x23, 0x54, 0x39, 0x79, 0x45, 0xa5, 0xb9, 0x9e, + 0x37, 0xbd, 0x9c, 0x33, 0x3f, 0x94, 0xac, 0xcb, 0x6e, 0xa8, 0xa7, 0x65, 0x57, 0x83, 0x08, 0x41, + 0x8e, 0x62, 0xa1, 0x79, 0x20, 0xd3, 0x44, 0x23, 0x1f, 0x40, 0x5a, 0xcc, 0x3a, 0x7b, 0x84, 0x3e, + 0x01, 0xfd, 0xbc, 0x18, 0xec, 0x89, 0x37, 0xe8, 0xc2, 0x98, 0x3e, 0x20, 0x57, 0x4a, 0x2e, 0xcf, + 0x0f, 0x43, 0xd9, 0xb0, 0x6e, 0x58, 0xdb, 0xab, 0x9d, 0xc6, 0xe7, 0x4f, 0x77, 0xd6, 0x0a, 0xe9, + 0x76, 0x18, 0x4a, 0x50, 0x6a, 0x4f, 0xcb, 0x58, 0x44, 0xee, 0xe5, 0x12, 0x9e, 0x95, 0x9d, 0x57, + 0xe4, 0xd6, 0xcb, 0xec, 0xea, 0x25, 0x6d, 0x17, 0x85, 0xda, 0x85, 0xf4, 0x31, 0xca, 0xee, 0xbe, + 0x1f, 0x8b, 0xde, 0x43, 0x17, 0xc6, 0x13, 0x50, 0x9a, 0x52, 0xb2, 0xb2, 0xa0, 0x77, 0xcd, 0x37, + 0x5d, 0x27, 0x17, 0x83, 0x0c, 0xe5, 0xc5, 0x61, 0xa3, 0x6e, 0xea, 0x17, 0xcc, 0xb9, 0x17, 0x3a, + 0x03, 0xb2, 0xf5, 0x2f, 0x5e, 0x95, 0xa0, 0x50, 0x40, 0xdb, 0x84, 0x24, 0x93, 0xfe, 0x30, 0x0e, + 0xbc, 0x01, 0xa4, 0x86, 0xfe, 0x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, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -229,9 +236,10 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { + // OperatorInfo queries the operator information. GetOperatorInfo(ctx context.Context, in *GetOperatorInfoReq, opts ...grpc.CallOption) (*OperatorInfo, error) - // add services for dogfood - QueryOperatorConsKeyForChainId(ctx context.Context, in *QueryOperatorConsKeyForChainIdRequest, opts ...grpc.CallOption) (*QueryOperatorConsKeyForChainIdResponse, error) + // QueryOperatorConsKeyForChainID queries the consensus public key for the operator + QueryOperatorConsKeyForChainID(ctx context.Context, in *QueryOperatorConsKeyForChainIDRequest, opts ...grpc.CallOption) (*QueryOperatorConsKeyForChainIDResponse, error) } type queryClient struct { @@ -251,9 +259,9 @@ func (c *queryClient) GetOperatorInfo(ctx context.Context, in *GetOperatorInfoRe return out, nil } -func (c *queryClient) QueryOperatorConsKeyForChainId(ctx context.Context, in *QueryOperatorConsKeyForChainIdRequest, opts ...grpc.CallOption) (*QueryOperatorConsKeyForChainIdResponse, error) { - out := new(QueryOperatorConsKeyForChainIdResponse) - err := c.cc.Invoke(ctx, "/exocore.operator.v1.Query/QueryOperatorConsKeyForChainId", in, out, opts...) +func (c *queryClient) QueryOperatorConsKeyForChainID(ctx context.Context, in *QueryOperatorConsKeyForChainIDRequest, opts ...grpc.CallOption) (*QueryOperatorConsKeyForChainIDResponse, error) { + out := new(QueryOperatorConsKeyForChainIDResponse) + err := c.cc.Invoke(ctx, "/exocore.operator.v1.Query/QueryOperatorConsKeyForChainID", in, out, opts...) if err != nil { return nil, err } @@ -262,9 +270,10 @@ func (c *queryClient) QueryOperatorConsKeyForChainId(ctx context.Context, in *Qu // QueryServer is the server API for Query service. type QueryServer interface { + // OperatorInfo queries the operator information. GetOperatorInfo(context.Context, *GetOperatorInfoReq) (*OperatorInfo, error) - // add services for dogfood - QueryOperatorConsKeyForChainId(context.Context, *QueryOperatorConsKeyForChainIdRequest) (*QueryOperatorConsKeyForChainIdResponse, error) + // QueryOperatorConsKeyForChainID queries the consensus public key for the operator + QueryOperatorConsKeyForChainID(context.Context, *QueryOperatorConsKeyForChainIDRequest) (*QueryOperatorConsKeyForChainIDResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -274,8 +283,8 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) GetOperatorInfo(ctx context.Context, req *GetOperatorInfoReq) (*OperatorInfo, error) { return nil, status.Errorf(codes.Unimplemented, "method GetOperatorInfo not implemented") } -func (*UnimplementedQueryServer) QueryOperatorConsKeyForChainId(ctx context.Context, req *QueryOperatorConsKeyForChainIdRequest) (*QueryOperatorConsKeyForChainIdResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryOperatorConsKeyForChainId not implemented") +func (*UnimplementedQueryServer) QueryOperatorConsKeyForChainID(ctx context.Context, req *QueryOperatorConsKeyForChainIDRequest) (*QueryOperatorConsKeyForChainIDResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryOperatorConsKeyForChainID not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { @@ -300,20 +309,20 @@ func _Query_GetOperatorInfo_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } -func _Query_QueryOperatorConsKeyForChainId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryOperatorConsKeyForChainIdRequest) +func _Query_QueryOperatorConsKeyForChainID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryOperatorConsKeyForChainIDRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).QueryOperatorConsKeyForChainId(ctx, in) + return srv.(QueryServer).QueryOperatorConsKeyForChainID(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/exocore.operator.v1.Query/QueryOperatorConsKeyForChainId", + FullMethod: "/exocore.operator.v1.Query/QueryOperatorConsKeyForChainID", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryOperatorConsKeyForChainId(ctx, req.(*QueryOperatorConsKeyForChainIdRequest)) + return srv.(QueryServer).QueryOperatorConsKeyForChainID(ctx, req.(*QueryOperatorConsKeyForChainIDRequest)) } return interceptor(ctx, in, info, handler) } @@ -327,8 +336,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_GetOperatorInfo_Handler, }, { - MethodName: "QueryOperatorConsKeyForChainId", - Handler: _Query_QueryOperatorConsKeyForChainId_Handler, + MethodName: "QueryOperatorConsKeyForChainID", + Handler: _Query_QueryOperatorConsKeyForChainID_Handler, }, }, Streams: []grpc.StreamDesc{}, @@ -365,7 +374,7 @@ func (m *GetOperatorInfoReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryOperatorConsKeyForChainIdRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryOperatorConsKeyForChainIDRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -375,12 +384,12 @@ func (m *QueryOperatorConsKeyForChainIdRequest) Marshal() (dAtA []byte, err erro return dAtA[:n], nil } -func (m *QueryOperatorConsKeyForChainIdRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryOperatorConsKeyForChainIDRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryOperatorConsKeyForChainIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryOperatorConsKeyForChainIDRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -402,7 +411,7 @@ func (m *QueryOperatorConsKeyForChainIdRequest) MarshalToSizedBuffer(dAtA []byte return len(dAtA) - i, nil } -func (m *QueryOperatorConsKeyForChainIdResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryOperatorConsKeyForChainIDResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -412,12 +421,12 @@ func (m *QueryOperatorConsKeyForChainIdResponse) Marshal() (dAtA []byte, err err return dAtA[:n], nil } -func (m *QueryOperatorConsKeyForChainIdResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryOperatorConsKeyForChainIDResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryOperatorConsKeyForChainIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryOperatorConsKeyForChainIDResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -459,7 +468,7 @@ func (m *GetOperatorInfoReq) Size() (n int) { return n } -func (m *QueryOperatorConsKeyForChainIdRequest) Size() (n int) { +func (m *QueryOperatorConsKeyForChainIDRequest) Size() (n int) { if m == nil { return 0 } @@ -476,7 +485,7 @@ func (m *QueryOperatorConsKeyForChainIdRequest) Size() (n int) { return n } -func (m *QueryOperatorConsKeyForChainIdResponse) Size() (n int) { +func (m *QueryOperatorConsKeyForChainIDResponse) Size() (n int) { if m == nil { return 0 } @@ -575,7 +584,7 @@ func (m *GetOperatorInfoReq) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryOperatorConsKeyForChainIdRequest) Unmarshal(dAtA []byte) error { +func (m *QueryOperatorConsKeyForChainIDRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -598,10 +607,10 @@ func (m *QueryOperatorConsKeyForChainIdRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryOperatorConsKeyForChainIdRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryOperatorConsKeyForChainIDRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryOperatorConsKeyForChainIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryOperatorConsKeyForChainIDRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -689,7 +698,7 @@ func (m *QueryOperatorConsKeyForChainIdRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryOperatorConsKeyForChainIdResponse) Unmarshal(dAtA []byte) error { +func (m *QueryOperatorConsKeyForChainIDResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -712,10 +721,10 @@ func (m *QueryOperatorConsKeyForChainIdResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryOperatorConsKeyForChainIdResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryOperatorConsKeyForChainIDResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryOperatorConsKeyForChainIdResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryOperatorConsKeyForChainIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/x/operator/types/query.pb.gw.go b/x/operator/types/query.pb.gw.go index f5076602c..87ca8026e 100644 --- a/x/operator/types/query.pb.gw.go +++ b/x/operator/types/query.pb.gw.go @@ -69,8 +69,8 @@ func local_request_Query_GetOperatorInfo_0(ctx context.Context, marshaler runtim } -func request_Query_QueryOperatorConsKeyForChainId_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryOperatorConsKeyForChainIdRequest +func request_Query_QueryOperatorConsKeyForChainID_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOperatorConsKeyForChainIDRequest var metadata runtime.ServerMetadata var ( @@ -102,13 +102,13 @@ func request_Query_QueryOperatorConsKeyForChainId_0(ctx context.Context, marshal return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) } - msg, err := client.QueryOperatorConsKeyForChainId(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.QueryOperatorConsKeyForChainID(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_QueryOperatorConsKeyForChainId_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryOperatorConsKeyForChainIdRequest +func local_request_Query_QueryOperatorConsKeyForChainID_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOperatorConsKeyForChainIDRequest var metadata runtime.ServerMetadata var ( @@ -140,7 +140,7 @@ func local_request_Query_QueryOperatorConsKeyForChainId_0(ctx context.Context, m return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) } - msg, err := server.QueryOperatorConsKeyForChainId(ctx, &protoReq) + msg, err := server.QueryOperatorConsKeyForChainID(ctx, &protoReq) return msg, metadata, err } @@ -174,7 +174,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_QueryOperatorConsKeyForChainId_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryOperatorConsKeyForChainID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -185,7 +185,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QueryOperatorConsKeyForChainId_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_QueryOperatorConsKeyForChainID_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 { @@ -193,7 +193,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QueryOperatorConsKeyForChainId_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryOperatorConsKeyForChainID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -258,7 +258,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_QueryOperatorConsKeyForChainId_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_QueryOperatorConsKeyForChainID_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) @@ -267,14 +267,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QueryOperatorConsKeyForChainId_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_QueryOperatorConsKeyForChainID_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_QueryOperatorConsKeyForChainId_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryOperatorConsKeyForChainID_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -284,11 +284,11 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie var ( pattern_Query_GetOperatorInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"exocore", "delegation", "v1", "GetOperatorInfo"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_QueryOperatorConsKeyForChainId_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"exocore", "operator_consent", "v1", "GetOperatorConsKey", "addr", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueryOperatorConsKeyForChainID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"exocore", "operator_consent", "v1", "GetOperatorConsKey", "addr", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_GetOperatorInfo_0 = runtime.ForwardResponseMessage - forward_Query_QueryOperatorConsKeyForChainId_0 = runtime.ForwardResponseMessage + forward_Query_QueryOperatorConsKeyForChainID_0 = runtime.ForwardResponseMessage ) diff --git a/x/operator/types/tx.pb.go b/x/operator/types/tx.pb.go index 4bae48d47..1f31f2e3a 100644 --- a/x/operator/types/tx.pb.go +++ b/x/operator/types/tx.pb.go @@ -32,15 +32,56 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// ValueField is a field that holds a value of sdk.LegacyDec type. +type ValueField struct { + // amount is the USD value of the asset, as an sdk.LegacyDec. + Amount github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"amount"` +} + +func (m *ValueField) Reset() { *m = ValueField{} } +func (m *ValueField) String() string { return proto.CompactTextString(m) } +func (*ValueField) ProtoMessage() {} +func (*ValueField) Descriptor() ([]byte, []int) { + return fileDescriptor_b229d5663e4df167, []int{0} +} +func (m *ValueField) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ValueField) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ValueField.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 *ValueField) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValueField.Merge(m, src) +} +func (m *ValueField) XXX_Size() int { + return m.Size() +} +func (m *ValueField) XXX_DiscardUnknown() { + xxx_messageInfo_ValueField.DiscardUnknown(m) +} + +var xxx_messageInfo_ValueField proto.InternalMessageInfo + +// ClientChainEarningAddrList is the list of client chain earning addresses. type ClientChainEarningAddrList struct { - EarningInfoList []*ClientChainEarningAddrInfo `protobuf:"bytes,1,rep,name=EarningInfoList,proto3" json:"EarningInfoList,omitempty"` + // earning_info_list is the contents of ClientChainEarningAddrList. + EarningInfoList []*ClientChainEarningAddrInfo `protobuf:"bytes,1,rep,name=earning_info_list,json=earningInfoList,proto3" json:"earning_info_list,omitempty"` } func (m *ClientChainEarningAddrList) Reset() { *m = ClientChainEarningAddrList{} } func (m *ClientChainEarningAddrList) String() string { return proto.CompactTextString(m) } func (*ClientChainEarningAddrList) ProtoMessage() {} func (*ClientChainEarningAddrList) Descriptor() ([]byte, []int) { - return fileDescriptor_b229d5663e4df167, []int{0} + return fileDescriptor_b229d5663e4df167, []int{1} } func (m *ClientChainEarningAddrList) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -76,16 +117,19 @@ func (m *ClientChainEarningAddrList) GetEarningInfoList() []*ClientChainEarningA return nil } +// ClientChainEarningAddrInfo is the client chain earning address info. type ClientChainEarningAddrInfo struct { - LzClientChainID uint64 `protobuf:"varint,1,opt,name=lzClientChainID,proto3" json:"lzClientChainID,omitempty"` - ClientChainEarningAddr string `protobuf:"bytes,2,opt,name=clientChainEarningAddr,proto3" json:"clientChainEarningAddr,omitempty"` + // lz_client_chain_id is the layer0 client chain id. + LzClientChainID uint64 `protobuf:"varint,1,opt,name=lz_client_chain_id,json=lzClientChainId,proto3" json:"lz_client_chain_id,omitempty"` + // client_chain_earning_addr is the client chain earning address. + ClientChainEarningAddr string `protobuf:"bytes,2,opt,name=client_chain_earning_addr,json=clientChainEarningAddr,proto3" json:"client_chain_earning_addr,omitempty"` } func (m *ClientChainEarningAddrInfo) Reset() { *m = ClientChainEarningAddrInfo{} } func (m *ClientChainEarningAddrInfo) String() string { return proto.CompactTextString(m) } func (*ClientChainEarningAddrInfo) ProtoMessage() {} func (*ClientChainEarningAddrInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_b229d5663e4df167, []int{1} + return fileDescriptor_b229d5663e4df167, []int{2} } func (m *ClientChainEarningAddrInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -128,18 +172,23 @@ func (m *ClientChainEarningAddrInfo) GetClientChainEarningAddr() string { return "" } +// OperatorInfo is the operator info. type OperatorInfo struct { - EarningsAddr string `protobuf:"bytes,1,opt,name=EarningsAddr,proto3" json:"EarningsAddr,omitempty"` - ApproveAddr string `protobuf:"bytes,2,opt,name=ApproveAddr,proto3" json:"ApproveAddr,omitempty"` - OperatorMetaInfo string `protobuf:"bytes,3,opt,name=OperatorMetaInfo,proto3" json:"OperatorMetaInfo,omitempty"` - ClientChainEarningsAddr *ClientChainEarningAddrList `protobuf:"bytes,4,opt,name=ClientChainEarningsAddr,proto3" json:"ClientChainEarningsAddr,omitempty"` + // earnings_addr is the earnings address. + EarningsAddr string `protobuf:"bytes,1,opt,name=earnings_addr,json=earningsAddr,proto3" json:"earnings_addr,omitempty"` + // approve_addr is the approve address. + ApproveAddr string `protobuf:"bytes,2,opt,name=approve_addr,json=approveAddr,proto3" json:"approve_addr,omitempty"` + // operator_meta_info is the operator meta info. + OperatorMetaInfo string `protobuf:"bytes,3,opt,name=operator_meta_info,json=operatorMetaInfo,proto3" json:"operator_meta_info,omitempty"` + // client_chain_earning_addr_list is the client chain earning address list. + ClientChainEarningsAddr *ClientChainEarningAddrList `protobuf:"bytes,4,opt,name=client_chain_earnings_addr,json=clientChainEarningsAddr,proto3" json:"client_chain_earnings_addr,omitempty"` } func (m *OperatorInfo) Reset() { *m = OperatorInfo{} } func (m *OperatorInfo) String() string { return proto.CompactTextString(m) } func (*OperatorInfo) ProtoMessage() {} func (*OperatorInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_b229d5663e4df167, []int{2} + return fileDescriptor_b229d5663e4df167, []int{3} } func (m *OperatorInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -196,17 +245,21 @@ func (m *OperatorInfo) GetClientChainEarningsAddr() *ClientChainEarningAddrList return nil } +// OptedInfo is the opted information about operator type OptedInfo struct { - SlashContract string `protobuf:"bytes,1,opt,name=SlashContract,proto3" json:"SlashContract,omitempty"` - OptedInHeight uint64 `protobuf:"varint,2,opt,name=OptedInHeight,proto3" json:"OptedInHeight,omitempty"` - OptedOutHeight uint64 `protobuf:"varint,3,opt,name=OptedOutHeight,proto3" json:"OptedOutHeight,omitempty"` + // slash_contract is the slash contract address of AVS opted-in by the operator + SlashContract string `protobuf:"bytes,1,opt,name=slash_contract,json=slashContract,proto3" json:"slash_contract,omitempty"` + // opted_in_height is the height at which the operator opted in + OptedInHeight uint64 `protobuf:"varint,2,opt,name=opted_in_height,json=optedInHeight,proto3" json:"opted_in_height,omitempty"` + // opted_out_height is the height at which the operator opted out + OptedOutHeight uint64 `protobuf:"varint,3,opt,name=opted_out_height,json=optedOutHeight,proto3" json:"opted_out_height,omitempty"` } func (m *OptedInfo) Reset() { *m = OptedInfo{} } func (m *OptedInfo) String() string { return proto.CompactTextString(m) } func (*OptedInfo) ProtoMessage() {} func (*OptedInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_b229d5663e4df167, []int{3} + return fileDescriptor_b229d5663e4df167, []int{4} } func (m *OptedInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -256,60 +309,26 @@ func (m *OptedInfo) GetOptedOutHeight() uint64 { return 0 } -type AssetOptedInState struct { - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=Amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"Amount"` - Value github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=Value,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"Value"` -} - -func (m *AssetOptedInState) Reset() { *m = AssetOptedInState{} } -func (m *AssetOptedInState) String() string { return proto.CompactTextString(m) } -func (*AssetOptedInState) ProtoMessage() {} -func (*AssetOptedInState) Descriptor() ([]byte, []int) { - return fileDescriptor_b229d5663e4df167, []int{4} -} -func (m *AssetOptedInState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AssetOptedInState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AssetOptedInState.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 *AssetOptedInState) XXX_Merge(src proto.Message) { - xxx_messageInfo_AssetOptedInState.Merge(m, src) -} -func (m *AssetOptedInState) XXX_Size() int { - return m.Size() -} -func (m *AssetOptedInState) XXX_DiscardUnknown() { - xxx_messageInfo_AssetOptedInState.DiscardUnknown(m) -} - -var xxx_messageInfo_AssetOptedInState proto.InternalMessageInfo - -type ValueField struct { - Amount github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=Amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"Amount"` +// OptedInAssetState is the state of opted-in asset +type OptedInAssetState struct { + // amount of the opted-in asset + Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + // value is the USD value of the opted-in asset + Value github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=value,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"value"` } -func (m *ValueField) Reset() { *m = ValueField{} } -func (m *ValueField) String() string { return proto.CompactTextString(m) } -func (*ValueField) ProtoMessage() {} -func (*ValueField) Descriptor() ([]byte, []int) { +func (m *OptedInAssetState) Reset() { *m = OptedInAssetState{} } +func (m *OptedInAssetState) String() string { return proto.CompactTextString(m) } +func (*OptedInAssetState) ProtoMessage() {} +func (*OptedInAssetState) Descriptor() ([]byte, []int) { return fileDescriptor_b229d5663e4df167, []int{5} } -func (m *ValueField) XXX_Unmarshal(b []byte) error { +func (m *OptedInAssetState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ValueField) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *OptedInAssetState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ValueField.Marshal(b, m, deterministic) + return xxx_messageInfo_OptedInAssetState.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -319,25 +338,32 @@ func (m *ValueField) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *ValueField) XXX_Merge(src proto.Message) { - xxx_messageInfo_ValueField.Merge(m, src) +func (m *OptedInAssetState) XXX_Merge(src proto.Message) { + xxx_messageInfo_OptedInAssetState.Merge(m, src) } -func (m *ValueField) XXX_Size() int { +func (m *OptedInAssetState) XXX_Size() int { return m.Size() } -func (m *ValueField) XXX_DiscardUnknown() { - xxx_messageInfo_ValueField.DiscardUnknown(m) +func (m *OptedInAssetState) XXX_DiscardUnknown() { + xxx_messageInfo_OptedInAssetState.DiscardUnknown(m) } -var xxx_messageInfo_ValueField proto.InternalMessageInfo +var xxx_messageInfo_OptedInAssetState proto.InternalMessageInfo +// OperatorSlashInfo is the slash info of operator type OperatorSlashInfo struct { - SlashContract string `protobuf:"bytes,1,opt,name=SlashContract,proto3" json:"SlashContract,omitempty"` - SlashHeight int64 `protobuf:"varint,2,opt,name=SlashHeight,proto3" json:"SlashHeight,omitempty"` - OccurredHeight int64 `protobuf:"varint,3,opt,name=OccurredHeight,proto3" json:"OccurredHeight,omitempty"` - ExecuteHeight int64 `protobuf:"varint,4,opt,name=ExecuteHeight,proto3" json:"ExecuteHeight,omitempty"` - IsVeto bool `protobuf:"varint,5,opt,name=IsVeto,proto3" json:"IsVeto,omitempty"` - SlashProportion github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=SlashProportion,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"SlashProportion"` + // slash_contract is the address of slash contract + SlashContract string `protobuf:"bytes,1,opt,name=slash_contract,json=slashContract,proto3" json:"slash_contract,omitempty"` + // slash_height is the height at which the slash event is submitted + SlashHeight int64 `protobuf:"varint,2,opt,name=slash_height,json=slashHeight,proto3" json:"slash_height,omitempty"` + // occurred_height is the height at which the slash event occurs + OccurredHeight int64 `protobuf:"varint,3,opt,name=occurred_height,json=occurredHeight,proto3" json:"occurred_height,omitempty"` + // execute_height is the height at which the slash event is executed + ExecuteHeight int64 `protobuf:"varint,4,opt,name=execute_height,json=executeHeight,proto3" json:"execute_height,omitempty"` + // is_veto is a flag to indicate if this slash is vetoed + IsVeto bool `protobuf:"varint,5,opt,name=is_veto,json=isVeto,proto3" json:"is_veto,omitempty"` + // slash_proportion is the proportion of assets that need to be slashed + SlashProportion github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=slash_proportion,json=slashProportion,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"slash_proportion"` } func (m *OperatorSlashInfo) Reset() { *m = OperatorSlashInfo{} } @@ -408,9 +434,12 @@ func (m *OperatorSlashInfo) GetIsVeto() bool { return false } +// RegisterOperatorReq is the request to register a new operator. type RegisterOperatorReq struct { - FromAddress string `protobuf:"bytes,1,opt,name=FromAddress,proto3" json:"FromAddress,omitempty"` - Info *OperatorInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` + // 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 operator info. + Info *OperatorInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` } func (m *RegisterOperatorReq) Reset() { *m = RegisterOperatorReq{} } @@ -446,6 +475,7 @@ func (m *RegisterOperatorReq) XXX_DiscardUnknown() { var xxx_messageInfo_RegisterOperatorReq proto.InternalMessageInfo +// RegisterOperatorResponse is the response to a register operator request. type RegisterOperatorResponse struct { } @@ -482,8 +512,8 @@ func (m *RegisterOperatorResponse) XXX_DiscardUnknown() { var xxx_messageInfo_RegisterOperatorResponse proto.InternalMessageInfo -// OptInToChainIdRequest defines the OptInToChainId request. -type OptInToChainIdRequest struct { +// OptInToChainIDRequest defines the OptInToChainID request. +type OptInToChainIDRequest struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` // `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}` @@ -493,18 +523,18 @@ type OptInToChainIdRequest struct { PublicKey string `protobuf:"bytes,3,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` } -func (m *OptInToChainIdRequest) Reset() { *m = OptInToChainIdRequest{} } -func (m *OptInToChainIdRequest) String() string { return proto.CompactTextString(m) } -func (*OptInToChainIdRequest) ProtoMessage() {} -func (*OptInToChainIdRequest) Descriptor() ([]byte, []int) { +func (m *OptInToChainIDRequest) Reset() { *m = OptInToChainIDRequest{} } +func (m *OptInToChainIDRequest) String() string { return proto.CompactTextString(m) } +func (*OptInToChainIDRequest) ProtoMessage() {} +func (*OptInToChainIDRequest) Descriptor() ([]byte, []int) { return fileDescriptor_b229d5663e4df167, []int{9} } -func (m *OptInToChainIdRequest) XXX_Unmarshal(b []byte) error { +func (m *OptInToChainIDRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *OptInToChainIdRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *OptInToChainIDRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_OptInToChainIdRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_OptInToChainIDRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -514,55 +544,55 @@ func (m *OptInToChainIdRequest) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *OptInToChainIdRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_OptInToChainIdRequest.Merge(m, src) +func (m *OptInToChainIDRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_OptInToChainIDRequest.Merge(m, src) } -func (m *OptInToChainIdRequest) XXX_Size() int { +func (m *OptInToChainIDRequest) XXX_Size() int { return m.Size() } -func (m *OptInToChainIdRequest) XXX_DiscardUnknown() { - xxx_messageInfo_OptInToChainIdRequest.DiscardUnknown(m) +func (m *OptInToChainIDRequest) XXX_DiscardUnknown() { + xxx_messageInfo_OptInToChainIDRequest.DiscardUnknown(m) } -var xxx_messageInfo_OptInToChainIdRequest proto.InternalMessageInfo +var xxx_messageInfo_OptInToChainIDRequest proto.InternalMessageInfo -func (m *OptInToChainIdRequest) GetAddress() string { +func (m *OptInToChainIDRequest) GetAddress() string { if m != nil { return m.Address } return "" } -func (m *OptInToChainIdRequest) GetChainId() string { +func (m *OptInToChainIDRequest) GetChainId() string { if m != nil { return m.ChainId } return "" } -func (m *OptInToChainIdRequest) GetPublicKey() string { +func (m *OptInToChainIDRequest) GetPublicKey() string { if m != nil { return m.PublicKey } return "" } -// OptInToChainIdResponse defines the OptInToChainId response. -type OptInToChainIdResponse struct { +// OptInToChainIDResponse defines the OptInToChainID response. +type OptInToChainIDResponse struct { } -func (m *OptInToChainIdResponse) Reset() { *m = OptInToChainIdResponse{} } -func (m *OptInToChainIdResponse) String() string { return proto.CompactTextString(m) } -func (*OptInToChainIdResponse) ProtoMessage() {} -func (*OptInToChainIdResponse) Descriptor() ([]byte, []int) { +func (m *OptInToChainIDResponse) Reset() { *m = OptInToChainIDResponse{} } +func (m *OptInToChainIDResponse) String() string { return proto.CompactTextString(m) } +func (*OptInToChainIDResponse) ProtoMessage() {} +func (*OptInToChainIDResponse) Descriptor() ([]byte, []int) { return fileDescriptor_b229d5663e4df167, []int{10} } -func (m *OptInToChainIdResponse) XXX_Unmarshal(b []byte) error { +func (m *OptInToChainIDResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *OptInToChainIdResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *OptInToChainIDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_OptInToChainIdResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_OptInToChainIDResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -572,36 +602,36 @@ func (m *OptInToChainIdResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *OptInToChainIdResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_OptInToChainIdResponse.Merge(m, src) +func (m *OptInToChainIDResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_OptInToChainIDResponse.Merge(m, src) } -func (m *OptInToChainIdResponse) XXX_Size() int { +func (m *OptInToChainIDResponse) XXX_Size() int { return m.Size() } -func (m *OptInToChainIdResponse) XXX_DiscardUnknown() { - xxx_messageInfo_OptInToChainIdResponse.DiscardUnknown(m) +func (m *OptInToChainIDResponse) XXX_DiscardUnknown() { + xxx_messageInfo_OptInToChainIDResponse.DiscardUnknown(m) } -var xxx_messageInfo_OptInToChainIdResponse proto.InternalMessageInfo +var xxx_messageInfo_OptInToChainIDResponse proto.InternalMessageInfo -// InitiateOptOutFromChainIdRequest defines the InitiateOptOutFromChainId request. -type InitiateOptOutFromChainIdRequest struct { +// InitiateOptOutFromChainIDRequest defines the InitiateOptOutFromChainID request. +type InitiateOptOutFromChainIDRequest struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` } -func (m *InitiateOptOutFromChainIdRequest) Reset() { *m = InitiateOptOutFromChainIdRequest{} } -func (m *InitiateOptOutFromChainIdRequest) String() string { return proto.CompactTextString(m) } -func (*InitiateOptOutFromChainIdRequest) ProtoMessage() {} -func (*InitiateOptOutFromChainIdRequest) Descriptor() ([]byte, []int) { +func (m *InitiateOptOutFromChainIDRequest) Reset() { *m = InitiateOptOutFromChainIDRequest{} } +func (m *InitiateOptOutFromChainIDRequest) String() string { return proto.CompactTextString(m) } +func (*InitiateOptOutFromChainIDRequest) ProtoMessage() {} +func (*InitiateOptOutFromChainIDRequest) Descriptor() ([]byte, []int) { return fileDescriptor_b229d5663e4df167, []int{11} } -func (m *InitiateOptOutFromChainIdRequest) XXX_Unmarshal(b []byte) error { +func (m *InitiateOptOutFromChainIDRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *InitiateOptOutFromChainIdRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *InitiateOptOutFromChainIDRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_InitiateOptOutFromChainIdRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_InitiateOptOutFromChainIDRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -611,48 +641,48 @@ func (m *InitiateOptOutFromChainIdRequest) XXX_Marshal(b []byte, deterministic b return b[:n], nil } } -func (m *InitiateOptOutFromChainIdRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_InitiateOptOutFromChainIdRequest.Merge(m, src) +func (m *InitiateOptOutFromChainIDRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_InitiateOptOutFromChainIDRequest.Merge(m, src) } -func (m *InitiateOptOutFromChainIdRequest) XXX_Size() int { +func (m *InitiateOptOutFromChainIDRequest) XXX_Size() int { return m.Size() } -func (m *InitiateOptOutFromChainIdRequest) XXX_DiscardUnknown() { - xxx_messageInfo_InitiateOptOutFromChainIdRequest.DiscardUnknown(m) +func (m *InitiateOptOutFromChainIDRequest) XXX_DiscardUnknown() { + xxx_messageInfo_InitiateOptOutFromChainIDRequest.DiscardUnknown(m) } -var xxx_messageInfo_InitiateOptOutFromChainIdRequest proto.InternalMessageInfo +var xxx_messageInfo_InitiateOptOutFromChainIDRequest proto.InternalMessageInfo -func (m *InitiateOptOutFromChainIdRequest) GetAddress() string { +func (m *InitiateOptOutFromChainIDRequest) GetAddress() string { if m != nil { return m.Address } return "" } -func (m *InitiateOptOutFromChainIdRequest) GetChainId() string { +func (m *InitiateOptOutFromChainIDRequest) GetChainId() string { if m != nil { return m.ChainId } return "" } -// InitiateOptOutFromChainIdResponse defines the InitiateOptOutFromChainId response. -type InitiateOptOutFromChainIdResponse struct { +// InitiateOptOutFromChainIDResponse defines the InitiateOptOutFromChainID response. +type InitiateOptOutFromChainIDResponse struct { } -func (m *InitiateOptOutFromChainIdResponse) Reset() { *m = InitiateOptOutFromChainIdResponse{} } -func (m *InitiateOptOutFromChainIdResponse) String() string { return proto.CompactTextString(m) } -func (*InitiateOptOutFromChainIdResponse) ProtoMessage() {} -func (*InitiateOptOutFromChainIdResponse) Descriptor() ([]byte, []int) { +func (m *InitiateOptOutFromChainIDResponse) Reset() { *m = InitiateOptOutFromChainIDResponse{} } +func (m *InitiateOptOutFromChainIDResponse) String() string { return proto.CompactTextString(m) } +func (*InitiateOptOutFromChainIDResponse) ProtoMessage() {} +func (*InitiateOptOutFromChainIDResponse) Descriptor() ([]byte, []int) { return fileDescriptor_b229d5663e4df167, []int{12} } -func (m *InitiateOptOutFromChainIdResponse) XXX_Unmarshal(b []byte) error { +func (m *InitiateOptOutFromChainIDResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *InitiateOptOutFromChainIdResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *InitiateOptOutFromChainIDResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_InitiateOptOutFromChainIdResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_InitiateOptOutFromChainIDResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -662,94 +692,99 @@ func (m *InitiateOptOutFromChainIdResponse) XXX_Marshal(b []byte, deterministic return b[:n], nil } } -func (m *InitiateOptOutFromChainIdResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_InitiateOptOutFromChainIdResponse.Merge(m, src) +func (m *InitiateOptOutFromChainIDResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_InitiateOptOutFromChainIDResponse.Merge(m, src) } -func (m *InitiateOptOutFromChainIdResponse) XXX_Size() int { +func (m *InitiateOptOutFromChainIDResponse) XXX_Size() int { return m.Size() } -func (m *InitiateOptOutFromChainIdResponse) XXX_DiscardUnknown() { - xxx_messageInfo_InitiateOptOutFromChainIdResponse.DiscardUnknown(m) +func (m *InitiateOptOutFromChainIDResponse) XXX_DiscardUnknown() { + xxx_messageInfo_InitiateOptOutFromChainIDResponse.DiscardUnknown(m) } -var xxx_messageInfo_InitiateOptOutFromChainIdResponse proto.InternalMessageInfo +var xxx_messageInfo_InitiateOptOutFromChainIDResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*ClientChainEarningAddrList)(nil), "exocore.operator.v1.clientChainEarningAddrList") - proto.RegisterType((*ClientChainEarningAddrInfo)(nil), "exocore.operator.v1.clientChainEarningAddrInfo") + proto.RegisterType((*ValueField)(nil), "exocore.operator.v1.ValueField") + proto.RegisterType((*ClientChainEarningAddrList)(nil), "exocore.operator.v1.ClientChainEarningAddrList") + proto.RegisterType((*ClientChainEarningAddrInfo)(nil), "exocore.operator.v1.ClientChainEarningAddrInfo") proto.RegisterType((*OperatorInfo)(nil), "exocore.operator.v1.OperatorInfo") proto.RegisterType((*OptedInfo)(nil), "exocore.operator.v1.OptedInfo") - proto.RegisterType((*AssetOptedInState)(nil), "exocore.operator.v1.AssetOptedInState") - proto.RegisterType((*ValueField)(nil), "exocore.operator.v1.ValueField") + proto.RegisterType((*OptedInAssetState)(nil), "exocore.operator.v1.OptedInAssetState") proto.RegisterType((*OperatorSlashInfo)(nil), "exocore.operator.v1.OperatorSlashInfo") proto.RegisterType((*RegisterOperatorReq)(nil), "exocore.operator.v1.RegisterOperatorReq") proto.RegisterType((*RegisterOperatorResponse)(nil), "exocore.operator.v1.RegisterOperatorResponse") - proto.RegisterType((*OptInToChainIdRequest)(nil), "exocore.operator.v1.OptInToChainIdRequest") - proto.RegisterType((*OptInToChainIdResponse)(nil), "exocore.operator.v1.OptInToChainIdResponse") - proto.RegisterType((*InitiateOptOutFromChainIdRequest)(nil), "exocore.operator.v1.InitiateOptOutFromChainIdRequest") - proto.RegisterType((*InitiateOptOutFromChainIdResponse)(nil), "exocore.operator.v1.InitiateOptOutFromChainIdResponse") + proto.RegisterType((*OptInToChainIDRequest)(nil), "exocore.operator.v1.OptInToChainIDRequest") + proto.RegisterType((*OptInToChainIDResponse)(nil), "exocore.operator.v1.OptInToChainIDResponse") + proto.RegisterType((*InitiateOptOutFromChainIDRequest)(nil), "exocore.operator.v1.InitiateOptOutFromChainIDRequest") + proto.RegisterType((*InitiateOptOutFromChainIDResponse)(nil), "exocore.operator.v1.InitiateOptOutFromChainIDResponse") } func init() { proto.RegisterFile("exocore/operator/v1/tx.proto", fileDescriptor_b229d5663e4df167) } var fileDescriptor_b229d5663e4df167 = []byte{ - // 892 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x41, 0x6f, 0xdc, 0x44, - 0x14, 0x5e, 0x67, 0x37, 0x69, 0xf3, 0x12, 0x48, 0x33, 0x2d, 0x89, 0x63, 0xc1, 0xc6, 0x35, 0xa8, - 0x5a, 0x2d, 0xca, 0x5a, 0x0d, 0xb4, 0x87, 0x88, 0x4b, 0x9a, 0xa4, 0x62, 0x45, 0xcb, 0xa2, 0x49, - 0x55, 0x09, 0x2e, 0x91, 0x63, 0x4f, 0x9d, 0xd1, 0xee, 0x7a, 0xdc, 0x99, 0x71, 0x9a, 0x70, 0x00, - 0xc4, 0x09, 0x21, 0x0e, 0xfc, 0x84, 0x5e, 0xb9, 0xe5, 0xd0, 0x2b, 0x9c, 0x7b, 0xac, 0x7a, 0x42, - 0x1c, 0x2a, 0x94, 0x1c, 0x82, 0xc4, 0x99, 0x3b, 0xf2, 0x78, 0xac, 0x3a, 0x8e, 0x17, 0xba, 0x6a, - 0x2f, 0xbb, 0x9e, 0xef, 0x7d, 0xef, 0x7b, 0x6f, 0xde, 0x7b, 0x33, 0x1a, 0x78, 0x97, 0x1c, 0x30, - 0x9f, 0x71, 0xe2, 0xb2, 0x98, 0x70, 0x4f, 0x32, 0xee, 0xee, 0x5f, 0x77, 0xe5, 0x41, 0x27, 0xe6, - 0x4c, 0x32, 0x74, 0x59, 0x5b, 0x3b, 0xb9, 0xb5, 0xb3, 0x7f, 0xdd, 0x5a, 0xf4, 0x99, 0x18, 0x32, - 0xe1, 0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31, 0xdf, 0x9d, 0x52, 0x4f, 0x90, 0x8f, 0xfe, 0x0d, - 0x00, 0x00, 0xff, 0xff, 0x7c, 0x63, 0xa1, 0xfe, 0x14, 0x09, 0x00, 0x00, + // 975 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xf6, 0xc6, 0x4e, 0xd2, 0x3c, 0x3b, 0x76, 0x32, 0x29, 0x8d, 0x63, 0x81, 0x9d, 0x6c, 0xd5, + 0x62, 0x05, 0x62, 0xab, 0x81, 0x22, 0x51, 0x38, 0x90, 0x1f, 0xad, 0xb0, 0x48, 0x31, 0xda, 0x54, + 0x3d, 0xc0, 0x61, 0xb5, 0xd9, 0x9d, 0xac, 0x47, 0x5e, 0xef, 0x6c, 0x77, 0x66, 0x4d, 0xdc, 0x13, + 0x42, 0x1c, 0x10, 0xe2, 0xc0, 0x95, 0x5b, 0xff, 0x03, 0x72, 0xe8, 0x15, 0x71, 0xed, 0xb1, 0xea, + 0x09, 0x71, 0x88, 0x50, 0x72, 0x08, 0x67, 0x24, 0xee, 0x68, 0x67, 0x66, 0xdb, 0x4d, 0xba, 0x81, + 0x46, 0xcd, 0x25, 0xf1, 0x7c, 0xf3, 0xbd, 0x5f, 0xdf, 0x7b, 0x6f, 0xb4, 0xf0, 0x26, 0xde, 0xa3, + 0x36, 0x0d, 0x71, 0x9b, 0x06, 0x38, 0xb4, 0x38, 0x0d, 0xdb, 0xc3, 0x1b, 0x6d, 0xbe, 0xd7, 0x0a, + 0x42, 0xca, 0x29, 0x9a, 0x53, 0xb7, 0xad, 0xe4, 0xb6, 0x35, 0xbc, 0x51, 0x9b, 0xb7, 0x29, 0x1b, + 0x50, 0xd6, 0x1e, 0x30, 0x37, 0x26, 0x0f, 0x98, 0x2b, 0xd9, 0xb5, 0x05, 0x79, 0x61, 0x8a, 0x53, + 0x5b,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7, 0xc6, + 0xbf, 0xe3, 0xf3, 0x64, 0xfc, 0x91, 0x01, 0xe3, 0xc3, 0x78, 0xc5, 0x64, 0xab, 0x5e, 0x73, 0xa7, + 0xa4, 0x2b, 0xfd, 0x97, 0xb1, 0x38, 0x7f, 0xd9, 0x8a, 0xed, 0x58, 0xab, 0xf3, 0xc8, 0xb9, 0x04, + 0x25, 0x49, 0x4b, 0x69, 0x99, 0x37, 0x8a, 0x02, 0x53, 0x4a, 0xbe, 0x0d, 0x15, 0x6a, 0xdb, 0x51, + 0x18, 0x62, 0x27, 0x2d, 0x64, 0xde, 0x28, 0x27, 0xb0, 0x22, 0x5e, 0x83, 0x32, 0xde, 0xc3, 0x76, + 0xc4, 0x71, 0xc2, 0x2b, 0x08, 0xde, 0xb4, 0x42, 0x15, 0x6d, 0x1e, 0x26, 0x09, 0x33, 0x87, 0x98, + 0xd3, 0xea, 0xf8, 0xa2, 0xd6, 0xbc, 0x64, 0x4c, 0x10, 0x76, 0x1f, 0x73, 0x8a, 0x5c, 0x98, 0x91, + 0xb9, 0x04, 0x21, 0x0d, 0x68, 0xc8, 0x09, 0xf5, 0xab, 0x13, 0x17, 0xa0, 0x53, 0x45, 0x78, 0xfd, + 0xe2, 0xb9, 0x53, 0xfd, 0x37, 0x0d, 0xe6, 0x0c, 0xec, 0x12, 0xc6, 0x71, 0x98, 0x28, 0x67, 0xe0, + 0x07, 0xe8, 0x23, 0x28, 0xed, 0x86, 0x74, 0x20, 0xa6, 0x1d, 0x33, 0xa6, 0x3a, 0x5f, 0x7d, 0xf6, + 0x78, 0xe5, 0xb2, 0x72, 0xb7, 0x26, 0x6f, 0xb6, 0x79, 0x48, 0x7c, 0xd7, 0x28, 0xc6, 0x6c, 0x05, + 0xa1, 0x9b, 0x50, 0x10, 0xbb, 0x35, 0x26, 0xb6, 0x64, 0x29, 0x73, 0x4b, 0xd2, 0x2b, 0x6e, 0x08, + 0xfa, 0xad, 0xf7, 0xbf, 0x7f, 0xd4, 0xc8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0x53, 0xfb, 0xe0, + 0xbc, 0x66, 0x49, 0x3a, 0xb5, 0xf1, 0x6f, 0x8e, 0xf7, 0x97, 0xb5, 0xf5, 0xad, 0x27, 0x87, 0x75, + 0xed, 0xe9, 0x61, 0x5d, 0xfb, 0xf3, 0xb0, 0xae, 0xfd, 0x74, 0x54, 0xcf, 0x3d, 0x3d, 0xaa, 0xe7, + 0x7e, 0x3f, 0xaa, 0xe7, 0xbe, 0x5c, 0x4d, 0xed, 0xf5, 0x6d, 0x19, 0xe4, 0x73, 0xcc, 0xbf, 0xa6, + 0x61, 0xbf, 0x9d, 0x7c, 0x23, 0xed, 0xbd, 0xf8, 0x4a, 0x12, 0x7b, 0xbe, 0x33, 0x21, 0x3e, 0x5a, + 0xde, 0xfb, 0x37, 0x00, 0x00, 0xff, 0xff, 0xd4, 0xb5, 0xaf, 0x8e, 0x46, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -764,19 +799,19 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { - // CreateClawbackVestingAccount creats a vesting account that is subject to clawback. + // RegisterOperator registers a new operator. RegisterOperator(ctx context.Context, in *RegisterOperatorReq, opts ...grpc.CallOption) (*RegisterOperatorResponse, error) // add services for dogfood - // OptInToChainId acts as opt in method for an operator to + // OptInToChainID acts as opt in method for an operator to // start validatring on a chain. The operator must sign the request with // the key with which they registered in the system. - OptInToChainId(ctx context.Context, in *OptInToChainIdRequest, opts ...grpc.CallOption) (*OptInToChainIdResponse, error) - // InitiateOptOutFromChainId is a method with which an operator can initiate + OptInToChainID(ctx context.Context, in *OptInToChainIDRequest, opts ...grpc.CallOption) (*OptInToChainIDResponse, error) + // InitiateOptOutFromChainID is a method with which an operator can initiate // the opt out process from a chain. The operator must sign the request with // the key with which they registered in the system. The opt-out process takes // as long as the chain's unbonding period to complete, plus some loose change // for message relaying across chains. - InitiateOptOutFromChainId(ctx context.Context, in *InitiateOptOutFromChainIdRequest, opts ...grpc.CallOption) (*InitiateOptOutFromChainIdResponse, error) + InitiateOptOutFromChainID(ctx context.Context, in *InitiateOptOutFromChainIDRequest, opts ...grpc.CallOption) (*InitiateOptOutFromChainIDResponse, error) } type msgClient struct { @@ -796,18 +831,18 @@ func (c *msgClient) RegisterOperator(ctx context.Context, in *RegisterOperatorRe return out, nil } -func (c *msgClient) OptInToChainId(ctx context.Context, in *OptInToChainIdRequest, opts ...grpc.CallOption) (*OptInToChainIdResponse, error) { - out := new(OptInToChainIdResponse) - err := c.cc.Invoke(ctx, "/exocore.operator.v1.Msg/OptInToChainId", in, out, opts...) +func (c *msgClient) OptInToChainID(ctx context.Context, in *OptInToChainIDRequest, opts ...grpc.CallOption) (*OptInToChainIDResponse, error) { + out := new(OptInToChainIDResponse) + err := c.cc.Invoke(ctx, "/exocore.operator.v1.Msg/OptInToChainID", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) InitiateOptOutFromChainId(ctx context.Context, in *InitiateOptOutFromChainIdRequest, opts ...grpc.CallOption) (*InitiateOptOutFromChainIdResponse, error) { - out := new(InitiateOptOutFromChainIdResponse) - err := c.cc.Invoke(ctx, "/exocore.operator.v1.Msg/InitiateOptOutFromChainId", in, out, opts...) +func (c *msgClient) InitiateOptOutFromChainID(ctx context.Context, in *InitiateOptOutFromChainIDRequest, opts ...grpc.CallOption) (*InitiateOptOutFromChainIDResponse, error) { + out := new(InitiateOptOutFromChainIDResponse) + err := c.cc.Invoke(ctx, "/exocore.operator.v1.Msg/InitiateOptOutFromChainID", in, out, opts...) if err != nil { return nil, err } @@ -816,19 +851,19 @@ func (c *msgClient) InitiateOptOutFromChainId(ctx context.Context, in *InitiateO // MsgServer is the server API for Msg service. type MsgServer interface { - // CreateClawbackVestingAccount creats a vesting account that is subject to clawback. + // RegisterOperator registers a new operator. RegisterOperator(context.Context, *RegisterOperatorReq) (*RegisterOperatorResponse, error) // add services for dogfood - // OptInToChainId acts as opt in method for an operator to + // OptInToChainID acts as opt in method for an operator to // start validatring on a chain. The operator must sign the request with // the key with which they registered in the system. - OptInToChainId(context.Context, *OptInToChainIdRequest) (*OptInToChainIdResponse, error) - // InitiateOptOutFromChainId is a method with which an operator can initiate + OptInToChainID(context.Context, *OptInToChainIDRequest) (*OptInToChainIDResponse, error) + // InitiateOptOutFromChainID is a method with which an operator can initiate // the opt out process from a chain. The operator must sign the request with // the key with which they registered in the system. The opt-out process takes // as long as the chain's unbonding period to complete, plus some loose change // for message relaying across chains. - InitiateOptOutFromChainId(context.Context, *InitiateOptOutFromChainIdRequest) (*InitiateOptOutFromChainIdResponse, error) + InitiateOptOutFromChainID(context.Context, *InitiateOptOutFromChainIDRequest) (*InitiateOptOutFromChainIDResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -838,11 +873,11 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) RegisterOperator(ctx context.Context, req *RegisterOperatorReq) (*RegisterOperatorResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RegisterOperator not implemented") } -func (*UnimplementedMsgServer) OptInToChainId(ctx context.Context, req *OptInToChainIdRequest) (*OptInToChainIdResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method OptInToChainId not implemented") +func (*UnimplementedMsgServer) OptInToChainID(ctx context.Context, req *OptInToChainIDRequest) (*OptInToChainIDResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method OptInToChainID not implemented") } -func (*UnimplementedMsgServer) InitiateOptOutFromChainId(ctx context.Context, req *InitiateOptOutFromChainIdRequest) (*InitiateOptOutFromChainIdResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method InitiateOptOutFromChainId not implemented") +func (*UnimplementedMsgServer) InitiateOptOutFromChainID(ctx context.Context, req *InitiateOptOutFromChainIDRequest) (*InitiateOptOutFromChainIDResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InitiateOptOutFromChainID not implemented") } func RegisterMsgServer(s grpc1.Server, srv MsgServer) { @@ -867,38 +902,38 @@ func _Msg_RegisterOperator_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } -func _Msg_OptInToChainId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(OptInToChainIdRequest) +func _Msg_OptInToChainID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OptInToChainIDRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).OptInToChainId(ctx, in) + return srv.(MsgServer).OptInToChainID(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/exocore.operator.v1.Msg/OptInToChainId", + FullMethod: "/exocore.operator.v1.Msg/OptInToChainID", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).OptInToChainId(ctx, req.(*OptInToChainIdRequest)) + return srv.(MsgServer).OptInToChainID(ctx, req.(*OptInToChainIDRequest)) } return interceptor(ctx, in, info, handler) } -func _Msg_InitiateOptOutFromChainId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(InitiateOptOutFromChainIdRequest) +func _Msg_InitiateOptOutFromChainID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InitiateOptOutFromChainIDRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).InitiateOptOutFromChainId(ctx, in) + return srv.(MsgServer).InitiateOptOutFromChainID(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/exocore.operator.v1.Msg/InitiateOptOutFromChainId", + FullMethod: "/exocore.operator.v1.Msg/InitiateOptOutFromChainID", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).InitiateOptOutFromChainId(ctx, req.(*InitiateOptOutFromChainIdRequest)) + return srv.(MsgServer).InitiateOptOutFromChainID(ctx, req.(*InitiateOptOutFromChainIDRequest)) } return interceptor(ctx, in, info, handler) } @@ -912,18 +947,51 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Handler: _Msg_RegisterOperator_Handler, }, { - MethodName: "OptInToChainId", - Handler: _Msg_OptInToChainId_Handler, + MethodName: "OptInToChainID", + Handler: _Msg_OptInToChainID_Handler, }, { - MethodName: "InitiateOptOutFromChainId", - Handler: _Msg_InitiateOptOutFromChainId_Handler, + MethodName: "InitiateOptOutFromChainID", + Handler: _Msg_InitiateOptOutFromChainID_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "exocore/operator/v1/tx.proto", } +func (m *ValueField) 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 *ValueField) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValueField) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *ClientChainEarningAddrList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1092,7 +1160,7 @@ func (m *OptedInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *AssetOptedInState) Marshal() (dAtA []byte, err error) { +func (m *OptedInAssetState) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1102,12 +1170,12 @@ func (m *AssetOptedInState) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *AssetOptedInState) MarshalTo(dAtA []byte) (int, error) { +func (m *OptedInAssetState) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *AssetOptedInState) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *OptedInAssetState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1135,39 +1203,6 @@ func (m *AssetOptedInState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ValueField) 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 *ValueField) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ValueField) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Amount.Size() - i -= size - if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - func (m *OperatorSlashInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1298,7 +1333,7 @@ func (m *RegisterOperatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *OptInToChainIdRequest) Marshal() (dAtA []byte, err error) { +func (m *OptInToChainIDRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1308,12 +1343,12 @@ func (m *OptInToChainIdRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *OptInToChainIdRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *OptInToChainIDRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *OptInToChainIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *OptInToChainIDRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1342,7 +1377,7 @@ func (m *OptInToChainIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *OptInToChainIdResponse) Marshal() (dAtA []byte, err error) { +func (m *OptInToChainIDResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1352,12 +1387,12 @@ func (m *OptInToChainIdResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *OptInToChainIdResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *OptInToChainIDResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *OptInToChainIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *OptInToChainIDResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1365,7 +1400,7 @@ func (m *OptInToChainIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *InitiateOptOutFromChainIdRequest) Marshal() (dAtA []byte, err error) { +func (m *InitiateOptOutFromChainIDRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1375,12 +1410,12 @@ func (m *InitiateOptOutFromChainIdRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *InitiateOptOutFromChainIdRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *InitiateOptOutFromChainIDRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *InitiateOptOutFromChainIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *InitiateOptOutFromChainIDRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1402,7 +1437,7 @@ func (m *InitiateOptOutFromChainIdRequest) MarshalToSizedBuffer(dAtA []byte) (in return len(dAtA) - i, nil } -func (m *InitiateOptOutFromChainIdResponse) Marshal() (dAtA []byte, err error) { +func (m *InitiateOptOutFromChainIDResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1412,12 +1447,12 @@ func (m *InitiateOptOutFromChainIdResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *InitiateOptOutFromChainIdResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *InitiateOptOutFromChainIDResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *InitiateOptOutFromChainIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *InitiateOptOutFromChainIDResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1436,6 +1471,17 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *ValueField) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + func (m *ClientChainEarningAddrList) Size() (n int) { if m == nil { return 0 @@ -1511,7 +1557,7 @@ func (m *OptedInfo) Size() (n int) { return n } -func (m *AssetOptedInState) Size() (n int) { +func (m *OptedInAssetState) Size() (n int) { if m == nil { return 0 } @@ -1524,17 +1570,6 @@ func (m *AssetOptedInState) Size() (n int) { return n } -func (m *ValueField) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - func (m *OperatorSlashInfo) Size() (n int) { if m == nil { return 0 @@ -1588,7 +1623,7 @@ func (m *RegisterOperatorResponse) Size() (n int) { return n } -func (m *OptInToChainIdRequest) Size() (n int) { +func (m *OptInToChainIDRequest) Size() (n int) { if m == nil { return 0 } @@ -1609,7 +1644,7 @@ func (m *OptInToChainIdRequest) Size() (n int) { return n } -func (m *OptInToChainIdResponse) Size() (n int) { +func (m *OptInToChainIDResponse) Size() (n int) { if m == nil { return 0 } @@ -1618,7 +1653,7 @@ func (m *OptInToChainIdResponse) Size() (n int) { return n } -func (m *InitiateOptOutFromChainIdRequest) Size() (n int) { +func (m *InitiateOptOutFromChainIDRequest) Size() (n int) { if m == nil { return 0 } @@ -1635,7 +1670,7 @@ func (m *InitiateOptOutFromChainIdRequest) Size() (n int) { return n } -func (m *InitiateOptOutFromChainIdResponse) Size() (n int) { +func (m *InitiateOptOutFromChainIDResponse) Size() (n int) { if m == nil { return 0 } @@ -1650,6 +1685,90 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *ValueField) 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: ValueField: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValueField: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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 + } + if err := m.Amount.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 *ClientChainEarningAddrList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1673,10 +1792,10 @@ func (m *ClientChainEarningAddrList) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: clientChainEarningAddrList: wiretype end group for non-group") + return fmt.Errorf("proto: ClientChainEarningAddrList: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: clientChainEarningAddrList: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ClientChainEarningAddrList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1757,10 +1876,10 @@ func (m *ClientChainEarningAddrInfo) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: clientChainEarningAddrInfo: wiretype end group for non-group") + return fmt.Errorf("proto: ClientChainEarningAddrInfo: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: clientChainEarningAddrInfo: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ClientChainEarningAddrInfo: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2137,7 +2256,7 @@ func (m *OptedInfo) Unmarshal(dAtA []byte) error { } return nil } -func (m *AssetOptedInState) Unmarshal(dAtA []byte) error { +func (m *OptedInAssetState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2160,10 +2279,10 @@ func (m *AssetOptedInState) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: AssetOptedInState: wiretype end group for non-group") + return fmt.Errorf("proto: OptedInAssetState: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: AssetOptedInState: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: OptedInAssetState: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2255,90 +2374,6 @@ func (m *AssetOptedInState) Unmarshal(dAtA []byte) error { } return nil } -func (m *ValueField) 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: ValueField: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ValueField: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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 - } - if err := m.Amount.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 *OperatorSlashInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2700,7 +2735,7 @@ func (m *RegisterOperatorResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *OptInToChainIdRequest) Unmarshal(dAtA []byte) error { +func (m *OptInToChainIDRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2723,10 +2758,10 @@ func (m *OptInToChainIdRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: OptInToChainIdRequest: wiretype end group for non-group") + return fmt.Errorf("proto: OptInToChainIDRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: OptInToChainIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: OptInToChainIDRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2846,7 +2881,7 @@ func (m *OptInToChainIdRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *OptInToChainIdResponse) Unmarshal(dAtA []byte) error { +func (m *OptInToChainIDResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2869,10 +2904,10 @@ func (m *OptInToChainIdResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: OptInToChainIdResponse: wiretype end group for non-group") + return fmt.Errorf("proto: OptInToChainIDResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: OptInToChainIdResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: OptInToChainIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2896,7 +2931,7 @@ func (m *OptInToChainIdResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *InitiateOptOutFromChainIdRequest) Unmarshal(dAtA []byte) error { +func (m *InitiateOptOutFromChainIDRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2919,10 +2954,10 @@ func (m *InitiateOptOutFromChainIdRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: InitiateOptOutFromChainIdRequest: wiretype end group for non-group") + return fmt.Errorf("proto: InitiateOptOutFromChainIDRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: InitiateOptOutFromChainIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: InitiateOptOutFromChainIDRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3010,7 +3045,7 @@ func (m *InitiateOptOutFromChainIdRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *InitiateOptOutFromChainIdResponse) Unmarshal(dAtA []byte) error { +func (m *InitiateOptOutFromChainIDResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3033,10 +3068,10 @@ func (m *InitiateOptOutFromChainIdResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: InitiateOptOutFromChainIdResponse: wiretype end group for non-group") + return fmt.Errorf("proto: InitiateOptOutFromChainIDResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: InitiateOptOutFromChainIdResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: InitiateOptOutFromChainIDResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/x/restaking_assets_manage/keeper/app_chain.go b/x/restaking_assets_manage/keeper/app_chain.go index 915c9fe35..ea26b3e04 100644 --- a/x/restaking_assets_manage/keeper/app_chain.go +++ b/x/restaking_assets_manage/keeper/app_chain.go @@ -19,22 +19,22 @@ func (k Keeper) SetAppChainInfo( } // AppChainInfoIsExist returns whether the app chain info for the specified chainId exists -func (k Keeper) AppChainInfoIsExist(ctx sdk.Context, chainId string) bool { +func (k Keeper) AppChainInfoIsExist(ctx sdk.Context, chainID string) bool { store := prefix.NewStore(ctx.KVStore(k.storeKey), restakingtype.KeyPrefixAppChainInfo) - return store.Has([]byte(chainId)) + return store.Has([]byte(chainID)) } -// GetAppChainInfoByChainId gets the app chain info for the specified chainId, if it exists -func (k Keeper) GetAppChainInfoByChainId( +// GetAppChainInfoByChainID gets the app chain info for the specified chainId, if it exists +func (k Keeper) GetAppChainInfoByChainID( ctx sdk.Context, - chainId string, + chainID string, ) (info restakingtype.AppChainInfo, err error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), restakingtype.KeyPrefixAppChainInfo) - ifExist := store.Has([]byte(chainId)) + ifExist := store.Has([]byte(chainID)) if !ifExist { return restakingtype.AppChainInfo{}, restakingtype.ErrNoAppChainKey } - value := store.Get([]byte(chainId)) + value := store.Get([]byte(chainID)) ret := restakingtype.AppChainInfo{} k.cdc.MustUnmarshal(value, &ret) return ret, nil diff --git a/x/restaking_assets_manage/keeper/grpc_query.go b/x/restaking_assets_manage/keeper/grpc_query.go index e82ab10ff..c4dde8f0e 100644 --- a/x/restaking_assets_manage/keeper/grpc_query.go +++ b/x/restaking_assets_manage/keeper/grpc_query.go @@ -85,9 +85,9 @@ func (k Keeper) QueOperatorSpecifiedAssetAmount(ctx context.Context, req *restak // QueStakerExoCoreAddr outdated,will be deprecated func (k Keeper) QueStakerExoCoreAddr(ctx context.Context, req *restakingtype.QueryStakerExCoreAddr) (*restakingtype.QueryStakerExCoreAddrResponse, error) { c := sdk.UnwrapSDKContext(ctx) - exoCoreAddr, err := k.GetStakerExoCoreAddr(c, req.StakerID) + exoCoreAddr, err := k.GetStakerExoCoreAddr(c, req.Staker) if err != nil { return nil, err } - return &restakingtype.QueryStakerExCoreAddrResponse{ExCoreAddr: exoCoreAddr}, nil + return &restakingtype.QueryStakerExCoreAddrResponse{ExoCoreAddr: exoCoreAddr}, nil } diff --git a/x/restaking_assets_manage/keeper/operator_asset.go b/x/restaking_assets_manage/keeper/operator_asset.go index d46fc5ca6..a48f83c9c 100644 --- a/x/restaking_assets_manage/keeper/operator_asset.go +++ b/x/restaking_assets_manage/keeper/operator_asset.go @@ -10,7 +10,7 @@ import ( // This file provides all functions about operator assets state management. -func (k Keeper) GetOperatorAssetInfos(ctx sdk.Context, operatorAddr sdk.Address, assetsFilter map[string]interface{}) (assetsInfo map[string]*restakingtype.OperatorSingleAssetOrChangeInfo, err error) { +func (k Keeper) GetOperatorAssetInfos(ctx sdk.Context, operatorAddr sdk.Address, _ map[string]interface{}) (assetsInfo map[string]*restakingtype.OperatorSingleAssetOrChangeInfo, err error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), restakingtype.KeyPrefixOperatorAssetInfos) // the key is the operator address in the bech32 format key := []byte(operatorAddr.String()) @@ -51,7 +51,7 @@ func (k Keeper) GetOperatorSpecifiedAssetInfo(ctx sdk.Context, operatorAddr sdk. // The function will be called when there is delegation or undelegation related to the operator. In the future,it will also be called when the operator deposit their own assets. func (k Keeper) UpdateOperatorAssetState(ctx sdk.Context, operatorAddr sdk.Address, assetID string, changeAmount restakingtype.OperatorSingleAssetOrChangeInfo) (err error) { - //get the latest state,use the default initial state if the state hasn't been stored + // get the latest state,use the default initial state if the state hasn't been stored store := prefix.NewStore(ctx.KVStore(k.storeKey), restakingtype.KeyPrefixOperatorAssetInfos) key := restakingtype.GetJoinedStoreKey(operatorAddr.String(), assetID) assetState := restakingtype.OperatorSingleAssetOrChangeInfo{ @@ -59,7 +59,7 @@ func (k Keeper) UpdateOperatorAssetState(ctx sdk.Context, operatorAddr sdk.Addre OperatorOwnAmountOrWantChangeValue: math.NewInt(0), WaitUnbondingAmountOrWantChangeValue: math.NewInt(0), OperatorOwnWaitUnbondingAmount: math.NewInt(0), - OperatorUnbondableAmountAfterSlash: math.NewInt(0), + OperatorCanUnbondAfterSlash: math.NewInt(0), } if store.Has(key) { value := store.Get(key) @@ -83,12 +83,12 @@ func (k Keeper) UpdateOperatorAssetState(ctx sdk.Context, operatorAddr sdk.Addre if err != nil { return errorsmod.Wrap(err, "UpdateOperatorAssetState OperatorOwnWaitUnbondingAmount error") } - err = restakingtype.UpdateAssetValue(&assetState.OperatorUnbondableAmountAfterSlash, &changeAmount.OperatorUnbondableAmountAfterSlash) + err = restakingtype.UpdateAssetValue(&assetState.OperatorCanUnbondAfterSlash, &changeAmount.OperatorCanUnbondAfterSlash) if err != nil { return errorsmod.Wrap(err, "UpdateOperatorAssetState OperatorOwnWaitUnbondingAmount error") } - //store the updated state + // store the updated state bz := k.cdc.MustMarshal(&assetState) store.Set(key, bz) return nil diff --git a/x/restaking_assets_manage/keeper/setup_test.go b/x/restaking_assets_manage/keeper/setup_test.go index 21d80f32f..51349b55c 100644 --- a/x/restaking_assets_manage/keeper/setup_test.go +++ b/x/restaking_assets_manage/keeper/setup_test.go @@ -1,9 +1,10 @@ package keeper_test import ( - "github.com/ExocoreNetwork/exocore/testutil" "testing" + "github.com/ExocoreNetwork/exocore/testutil" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" diff --git a/x/restaking_assets_manage/keeper/staker_asset.go b/x/restaking_assets_manage/keeper/staker_asset.go index 9991e5601..b79e2ea2c 100644 --- a/x/restaking_assets_manage/keeper/staker_asset.go +++ b/x/restaking_assets_manage/keeper/staker_asset.go @@ -48,7 +48,7 @@ func (k Keeper) GetStakerSpecifiedAssetInfo(ctx sdk.Context, stakerID string, as // The input `changeAmount` represents the values that you want to add or decrease,using positive or negative values for increasing and decreasing,respectively. The function will calculate and update new state after a successful check. // The function will be called when there is deposit or withdraw related to the specified staker. func (k Keeper) UpdateStakerAssetState(ctx sdk.Context, stakerID string, assetID string, changeAmount restakingtype.StakerSingleAssetOrChangeInfo) (err error) { - //get the latest state,use the default initial state if the state hasn't been stored + // get the latest state,use the default initial state if the state hasn't been stored store := prefix.NewStore(ctx.KVStore(k.storeKey), restakingtype.KeyPrefixReStakerAssetInfos) key := restakingtype.GetJoinedStoreKey(stakerID, assetID) assetState := restakingtype.StakerSingleAssetOrChangeInfo{ diff --git a/x/restaking_assets_manage/types/general.go b/x/restaking_assets_manage/types/general.go index a9f6ea5a4..98fad4821 100644 --- a/x/restaking_assets_manage/types/general.go +++ b/x/restaking_assets_manage/types/general.go @@ -1,13 +1,15 @@ package types import ( + "fmt" + "strings" + errorsmod "cosmossdk.io/errors" "cosmossdk.io/math" - "fmt" + "github.com/cosmos/cosmos-sdk/store/rootmulti" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "strings" "github.com/ethereum/go-ethereum/common/hexutil" ) @@ -131,7 +133,7 @@ func ContextForHistoricalState(ctx sdk.Context, height int64) (sdk.Context, erro cacheMS, err := cms.CacheMultiStoreWithVersion(height) if err != nil { return sdk.Context{}, - sdkerrors.Wrapf( + errorsmod.Wrapf( sdkerrors.ErrInvalidRequest, "failed to load state at height %d; %s (latest height: %d)", height, err, lastBlockHeight, ) @@ -146,7 +148,7 @@ func ContextForHistoricalState(ctx sdk.Context, height int64) (sdk.Context, erro if ok { cInfo, err := rms.GetCommitInfo(height) if cInfo != nil && err == nil { - ctx = ctx.WithBlockTime(cInfo.Timestamp) + historicalStateCtx = historicalStateCtx.WithBlockTime(cInfo.Timestamp) } } } diff --git a/x/restaking_assets_manage/types/keys.go b/x/restaking_assets_manage/types/keys.go index 83df033b1..205c5e8ef 100644 --- a/x/restaking_assets_manage/types/keys.go +++ b/x/restaking_assets_manage/types/keys.go @@ -2,9 +2,10 @@ package types import ( "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" "strings" + sdk "github.com/cosmos/cosmos-sdk/types" + errorsmod "cosmossdk.io/errors" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/ethereum/go-ethereum/common" diff --git a/x/restaking_assets_manage/types/tx.pb.go b/x/restaking_assets_manage/types/tx.pb.go index b287edae2..683c9387e 100644 --- a/x/restaking_assets_manage/types/tx.pb.go +++ b/x/restaking_assets_manage/types/tx.pb.go @@ -32,6 +32,43 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type ValueField struct { + Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=Amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"Amount"` +} + +func (m *ValueField) Reset() { *m = ValueField{} } +func (m *ValueField) String() string { return proto.CompactTextString(m) } +func (*ValueField) ProtoMessage() {} +func (*ValueField) Descriptor() ([]byte, []int) { + return fileDescriptor_b24e66e530cc30d1, []int{0} +} +func (m *ValueField) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ValueField) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ValueField.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 *ValueField) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValueField.Merge(m, src) +} +func (m *ValueField) XXX_Size() int { + return m.Size() +} +func (m *ValueField) XXX_DiscardUnknown() { + xxx_messageInfo_ValueField.DiscardUnknown(m) +} + +var xxx_messageInfo_ValueField proto.InternalMessageInfo + // ClientChainInfo defines the client chain information. type ClientChainInfo struct { // name of the client chain, like "Ethereum". @@ -57,7 +94,7 @@ func (m *ClientChainInfo) Reset() { *m = ClientChainInfo{} } func (m *ClientChainInfo) String() string { return proto.CompactTextString(m) } func (*ClientChainInfo) ProtoMessage() {} func (*ClientChainInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_b24e66e530cc30d1, []int{0} + return fileDescriptor_b24e66e530cc30d1, []int{1} } func (m *ClientChainInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -142,6 +179,81 @@ func (m *ClientChainInfo) GetAddressLength() uint32 { return 0 } +// AppChainInfo is used to store information related to the subscriber app chains we validate. +// The information stored within this module consists only of the chain's identifiers. +// The validation-related information is stored in the coordinator module. +type AppChainInfo struct { + // name of the chain, for example "ethereum" + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // meta_info is at Exocore's discretion to deter,ome + MetaInfo string `protobuf:"bytes,2,opt,name=meta_info,json=metaInfo,proto3" json:"meta_info,omitempty"` + // chain_id is used as the primary key + ChainId string `protobuf:"bytes,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // exo_core_chain_index is the index of the chain in exocore, so far unused + ExoCoreChainIndex uint64 `protobuf:"varint,4,opt,name=exo_core_chain_index,json=exoCoreChainIndex,proto3" json:"exo_core_chain_index,omitempty"` +} + +func (m *AppChainInfo) Reset() { *m = AppChainInfo{} } +func (m *AppChainInfo) String() string { return proto.CompactTextString(m) } +func (*AppChainInfo) ProtoMessage() {} +func (*AppChainInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_b24e66e530cc30d1, []int{2} +} +func (m *AppChainInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AppChainInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AppChainInfo.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 *AppChainInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_AppChainInfo.Merge(m, src) +} +func (m *AppChainInfo) XXX_Size() int { + return m.Size() +} +func (m *AppChainInfo) XXX_DiscardUnknown() { + xxx_messageInfo_AppChainInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_AppChainInfo proto.InternalMessageInfo + +func (m *AppChainInfo) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *AppChainInfo) GetMetaInfo() string { + if m != nil { + return m.MetaInfo + } + return "" +} + +func (m *AppChainInfo) GetChainId() string { + if m != nil { + return m.ChainId + } + return "" +} + +func (m *AppChainInfo) GetExoCoreChainIndex() uint64 { + if m != nil { + return m.ExoCoreChainIndex + } + return 0 +} + // AssetInfo defines the information for an asset to be used in staking. type AssetInfo struct { // name of the asset, like "Tether USD" @@ -166,7 +278,7 @@ func (m *AssetInfo) Reset() { *m = AssetInfo{} } func (m *AssetInfo) String() string { return proto.CompactTextString(m) } func (*AssetInfo) ProtoMessage() {} func (*AssetInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_b24e66e530cc30d1, []int{1} + return fileDescriptor_b24e66e530cc30d1, []int{3} } func (m *AssetInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -256,7 +368,7 @@ func (m *StakingAssetInfo) Reset() { *m = StakingAssetInfo{} } func (m *StakingAssetInfo) String() string { return proto.CompactTextString(m) } func (*StakingAssetInfo) ProtoMessage() {} func (*StakingAssetInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_b24e66e530cc30d1, []int{2} + return fileDescriptor_b24e66e530cc30d1, []int{4} } func (m *StakingAssetInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -303,16 +415,16 @@ type StakerSingleAssetOrChangeInfo struct { // can_withdraw_amount_or_want_change_value is the amount that can be withdrawn // or the amount by which it can change. CanWithdrawAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=can_withdraw_amount_or_want_change_value,json=canWithdrawAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"can_withdraw_amount_or_want_change_value"` - // wait_undelegation_amount_or_want_change_value is the amount that is waiting for undelegation + // wait_unbonding_amount_or_want_change_value is the amount that is waiting for undelegation // or the amount by which it can change. - WaitUndelegationAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=wait_undelegation_amount_or_want_change_value,json=waitUndelegationAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"wait_undelegation_amount_or_want_change_value"` + WaitUnbondingAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=wait_unbonding_amount_or_want_change_value,json=waitUnbondingAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"wait_unbonding_amount_or_want_change_value"` } func (m *StakerSingleAssetOrChangeInfo) Reset() { *m = StakerSingleAssetOrChangeInfo{} } func (m *StakerSingleAssetOrChangeInfo) String() string { return proto.CompactTextString(m) } func (*StakerSingleAssetOrChangeInfo) ProtoMessage() {} func (*StakerSingleAssetOrChangeInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_b24e66e530cc30d1, []int{3} + return fileDescriptor_b24e66e530cc30d1, []int{5} } func (m *StakerSingleAssetOrChangeInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -352,7 +464,7 @@ func (m *StakerAllAssetsInfo) Reset() { *m = StakerAllAssetsInfo{} } func (m *StakerAllAssetsInfo) String() string { return proto.CompactTextString(m) } func (*StakerAllAssetsInfo) ProtoMessage() {} func (*StakerAllAssetsInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_b24e66e530cc30d1, []int{4} + return fileDescriptor_b24e66e530cc30d1, []int{6} } func (m *StakerAllAssetsInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -398,16 +510,22 @@ type OperatorSingleAssetOrChangeInfo struct { // or the amount by which it can change. // todo: the field is used to mark operator's own assets and is not temporarily used now OperatorOwnAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=operator_own_amount_or_want_change_value,json=operatorOwnAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"operator_own_amount_or_want_change_value"` - // wait_undelegation_amount_or_want_change_value is the amount that is waiting for undelegation + // wait_unbonding_amount_or_want_change_value is the amount that is waiting for unbonding // or the amount by which it can change. - WaitUndelegationAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=wait_undelegation_amount_or_want_change_value,json=waitUndelegationAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"wait_undelegation_amount_or_want_change_value"` + WaitUnbondingAmountOrWantChangeValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=wait_unbonding_amount_or_want_change_value,json=waitUnbondingAmountOrWantChangeValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"wait_unbonding_amount_or_want_change_value"` + // operator_own_wait_unbonding_amount is the amount that is owned by operator itself and waiting for unbonding + // or the amount by which it can change + OperatorOwnWaitUnbondingAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=operator_own_wait_unbonding_amount,json=operatorOwnWaitUnbondingAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"operator_own_wait_unbonding_amount"` + // operator_can_unbond_after_slash is the amount that is owned by operator itself and can be unbonded after slash + // or the amount by which it can change + OperatorCanUnbondAfterSlash github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=operator_can_unbond_after_slash,json=operatorCanUnbondAfterSlash,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"operator_can_unbond_after_slash"` } func (m *OperatorSingleAssetOrChangeInfo) Reset() { *m = OperatorSingleAssetOrChangeInfo{} } func (m *OperatorSingleAssetOrChangeInfo) String() string { return proto.CompactTextString(m) } func (*OperatorSingleAssetOrChangeInfo) ProtoMessage() {} func (*OperatorSingleAssetOrChangeInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_b24e66e530cc30d1, []int{5} + return fileDescriptor_b24e66e530cc30d1, []int{7} } func (m *OperatorSingleAssetOrChangeInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -447,7 +565,7 @@ func (m *OperatorAllAssetsInfo) Reset() { *m = OperatorAllAssetsInfo{} } func (m *OperatorAllAssetsInfo) String() string { return proto.CompactTextString(m) } func (*OperatorAllAssetsInfo) ProtoMessage() {} func (*OperatorAllAssetsInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_b24e66e530cc30d1, []int{6} + return fileDescriptor_b24e66e530cc30d1, []int{8} } func (m *OperatorAllAssetsInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -503,7 +621,7 @@ func (m *MsgSetExoCoreAddr) Reset() { *m = MsgSetExoCoreAddr{} } func (m *MsgSetExoCoreAddr) String() string { return proto.CompactTextString(m) } func (*MsgSetExoCoreAddr) ProtoMessage() {} func (*MsgSetExoCoreAddr) Descriptor() ([]byte, []int) { - return fileDescriptor_b24e66e530cc30d1, []int{7} + return fileDescriptor_b24e66e530cc30d1, []int{9} } func (m *MsgSetExoCoreAddr) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -541,7 +659,7 @@ func (m *MsgSetExoCoreAddrResponse) Reset() { *m = MsgSetExoCoreAddrResp func (m *MsgSetExoCoreAddrResponse) String() string { return proto.CompactTextString(m) } func (*MsgSetExoCoreAddrResponse) ProtoMessage() {} func (*MsgSetExoCoreAddrResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b24e66e530cc30d1, []int{8} + return fileDescriptor_b24e66e530cc30d1, []int{10} } func (m *MsgSetExoCoreAddrResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -582,7 +700,7 @@ func (m *RegisterClientChainReq) Reset() { *m = RegisterClientChainReq{} func (m *RegisterClientChainReq) String() string { return proto.CompactTextString(m) } func (*RegisterClientChainReq) ProtoMessage() {} func (*RegisterClientChainReq) Descriptor() ([]byte, []int) { - return fileDescriptor_b24e66e530cc30d1, []int{9} + return fileDescriptor_b24e66e530cc30d1, []int{11} } func (m *RegisterClientChainReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -619,7 +737,7 @@ func (m *RegisterClientChainResponse) Reset() { *m = RegisterClientChain func (m *RegisterClientChainResponse) String() string { return proto.CompactTextString(m) } func (*RegisterClientChainResponse) ProtoMessage() {} func (*RegisterClientChainResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b24e66e530cc30d1, []int{10} + return fileDescriptor_b24e66e530cc30d1, []int{12} } func (m *RegisterClientChainResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -661,7 +779,7 @@ func (m *RegisterAssetReq) Reset() { *m = RegisterAssetReq{} } func (m *RegisterAssetReq) String() string { return proto.CompactTextString(m) } func (*RegisterAssetReq) ProtoMessage() {} func (*RegisterAssetReq) Descriptor() ([]byte, []int) { - return fileDescriptor_b24e66e530cc30d1, []int{11} + return fileDescriptor_b24e66e530cc30d1, []int{13} } func (m *RegisterAssetReq) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -698,7 +816,7 @@ func (m *RegisterAssetResponse) Reset() { *m = RegisterAssetResponse{} } func (m *RegisterAssetResponse) String() string { return proto.CompactTextString(m) } func (*RegisterAssetResponse) ProtoMessage() {} func (*RegisterAssetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b24e66e530cc30d1, []int{12} + return fileDescriptor_b24e66e530cc30d1, []int{14} } func (m *RegisterAssetResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -728,7 +846,9 @@ func (m *RegisterAssetResponse) XXX_DiscardUnknown() { var xxx_messageInfo_RegisterAssetResponse proto.InternalMessageInfo func init() { + proto.RegisterType((*ValueField)(nil), "exocore.restaking_assets_manage.v1.ValueField") proto.RegisterType((*ClientChainInfo)(nil), "exocore.restaking_assets_manage.v1.ClientChainInfo") + proto.RegisterType((*AppChainInfo)(nil), "exocore.restaking_assets_manage.v1.AppChainInfo") proto.RegisterType((*AssetInfo)(nil), "exocore.restaking_assets_manage.v1.AssetInfo") proto.RegisterType((*StakingAssetInfo)(nil), "exocore.restaking_assets_manage.v1.StakingAssetInfo") proto.RegisterType((*StakerSingleAssetOrChangeInfo)(nil), "exocore.restaking_assets_manage.v1.StakerSingleAssetOrChangeInfo") @@ -750,86 +870,91 @@ func init() { } var fileDescriptor_b24e66e530cc30d1 = []byte{ - // 1251 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x57, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xf7, 0xda, 0x69, 0x93, 0x8c, 0x9b, 0xd6, 0xd9, 0xb8, 0xad, 0xe3, 0x52, 0xbb, 0x18, 0x01, - 0x21, 0x10, 0x5b, 0x4d, 0x29, 0xa2, 0x29, 0x08, 0x39, 0x6e, 0x40, 0x11, 0x0d, 0x91, 0xd6, 0x85, - 0x88, 0x72, 0x58, 0x4d, 0x76, 0x27, 0x9b, 0x55, 0x76, 0x67, 0xcc, 0xce, 0x38, 0xb6, 0x7b, 0xaa, - 0x10, 0x20, 0x84, 0x38, 0x20, 0xe0, 0x82, 0xc4, 0xa1, 0x1f, 0x21, 0x12, 0xfd, 0x10, 0xe5, 0x56, - 0xe5, 0x84, 0x40, 0x44, 0x25, 0x39, 0x04, 0xf1, 0x29, 0xd0, 0xfc, 0x59, 0xc7, 0xdb, 0xd8, 0xa9, - 0xf3, 0xa7, 0x07, 0x2e, 0xc9, 0xce, 0xbc, 0x7f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, 0x8b, - 0x3d, 0xde, 0xc9, 0xc5, 0x7e, 0xdf, 0xc9, 0xc5, 0xee, 0x96, 0x3b, 0x1e, 0xab, 0x39, 0x19, 0xe5, - 0x23, 0xc4, 0x1a, 0x24, 0x58, 0x2b, 0x85, 0x77, 0x40, 0xb3, 0xe7, 0x2f, 0x72, 0xf1, 0x96, 0x2d, - 0x9f, 0x16, 0xbf, 0x88, 0xaf, 0xfd, 0x17, 0x00, 0x00, 0xff, 0xff, 0x0b, 0x33, 0xb6, 0xf5, 0xc1, - 0x0f, 0x00, 0x00, + // 1338 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0x5b, 0x6f, 0x1b, 0xc5, + 0x17, 0xcf, 0xda, 0xb9, 0x1e, 0x37, 0xad, 0xb3, 0x49, 0x5b, 0xc7, 0xf9, 0xd7, 0xee, 0x7f, 0xb9, + 0x28, 0x04, 0x62, 0xab, 0x29, 0x45, 0x34, 0x05, 0x21, 0xc7, 0x6d, 0x51, 0x44, 0x4b, 0xa4, 0x75, + 0x21, 0xa2, 0x3c, 0xac, 0xc6, 0xde, 0xc9, 0x66, 0x95, 0xf5, 0x8c, 0xd9, 0x19, 0xd7, 0x76, 0x9f, + 0xaa, 0x0a, 0x50, 0x05, 0x3c, 0x20, 0x40, 0x48, 0xbc, 0xf5, 0x23, 0x54, 0xa2, 0x1f, 0xa2, 0xbc, + 0x55, 0x7d, 0x42, 0x20, 0x55, 0x25, 0x45, 0x0a, 0x1f, 0x03, 0xcd, 0xcc, 0xae, 0xe3, 0x6d, 0xec, + 0xd6, 0x49, 0xdc, 0x07, 0x5e, 0x12, 0xcf, 0xb9, 0xfe, 0xce, 0x65, 0xce, 0x1c, 0x1b, 0xde, 0xc4, + 0x4d, 0x5a, 0xa1, 0x3e, 0xce, 0xfb, 0x98, 0x71, 0xb4, 0xe5, 0x12, 0xc7, 0x42, 0x8c, 0x61,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 0x6a, 0x21, 0x2c, 0xf1, 0xa4, 0x4e, 0x77, 0xa9, 0x8d, 0xbe, 0xdc, + 0x8f, 0xd9, 0xee, 0x1d, 0x9b, 0xfe, 0xe0, 0xc0, 0xba, 0x01, 0xa8, 0x5b, 0x1a, 0x4c, 0x46, 0xb2, + 0xa8, 0xbf, 0xbd, 0x1f, 0x93, 0x61, 0x0f, 0xa5, 0xcf, 0x1f, 0x40, 0x4b, 0x41, 0x48, 0x8f, 0xdc, + 0xda, 0xb9, 0xb7, 0xa0, 0xad, 0x7c, 0xfe, 0x60, 0x3b, 0xa3, 0x3d, 0xdc, 0xce, 0x68, 0x4f, 0xb6, + 0x33, 0xda, 0xf7, 0x4f, 0x33, 0x43, 0x0f, 0x9f, 0x66, 0x86, 0x7e, 0x7f, 0x9a, 0x19, 0xba, 0x5e, + 0xe8, 0x78, 0xa0, 0x2e, 0x29, 0x2f, 0x1f, 0x63, 0xde, 0xa0, 0xfe, 0x56, 0x3e, 0x9c, 0x01, 0xcd, + 0x9e, 0xbf, 0xc3, 0xc8, 0xf7, 0xab, 0x3c, 0x2a, 0x7f, 0x07, 0x39, 0xfb, 0x6f, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xe6, 0x1c, 0xb2, 0xa5, 0xb7, 0x11, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -990,6 +1115,39 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Metadata: "exocore/restaking_assets_manage/v1/tx.proto", } +func (m *ValueField) 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 *ValueField) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValueField) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *ClientChainInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1059,6 +1217,55 @@ func (m *ClientChainInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *AppChainInfo) 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 *AppChainInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AppChainInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ExoCoreChainIndex != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ExoCoreChainIndex)) + i-- + dAtA[i] = 0x20 + } + if len(m.ChainId) > 0 { + i -= len(m.ChainId) + copy(dAtA[i:], m.ChainId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ChainId))) + i-- + dAtA[i] = 0x1a + } + if len(m.MetaInfo) > 0 { + i -= len(m.MetaInfo) + copy(dAtA[i:], m.MetaInfo) + i = encodeVarintTx(dAtA, i, uint64(len(m.MetaInfo))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *AssetInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1201,9 +1408,9 @@ func (m *StakerSingleAssetOrChangeInfo) MarshalToSizedBuffer(dAtA []byte) (int, var l int _ = l { - size := m.WaitUndelegationAmountOrWantChangeValue.Size() + size := m.WaitUnbondingAmountOrWantChangeValue.Size() i -= size - if _, err := m.WaitUndelegationAmountOrWantChangeValue.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.WaitUnbondingAmountOrWantChangeValue.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintTx(dAtA, i, uint64(size)) @@ -1303,9 +1510,29 @@ func (m *OperatorSingleAssetOrChangeInfo) MarshalToSizedBuffer(dAtA []byte) (int var l int _ = l { - size := m.WaitUndelegationAmountOrWantChangeValue.Size() + size := m.OperatorCanUnbondAfterSlash.Size() + i -= size + if _, err := m.OperatorCanUnbondAfterSlash.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size := m.OperatorOwnWaitUnbondingAmount.Size() + i -= size + if _, err := m.OperatorOwnWaitUnbondingAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.WaitUnbondingAmountOrWantChangeValue.Size() i -= size - if _, err := m.WaitUndelegationAmountOrWantChangeValue.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.WaitUnbondingAmountOrWantChangeValue.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintTx(dAtA, i, uint64(size)) @@ -1604,6 +1831,17 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *ValueField) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + func (m *ClientChainInfo) Size() (n int) { if m == nil { return 0 @@ -1640,6 +1878,30 @@ func (m *ClientChainInfo) Size() (n int) { return n } +func (m *AppChainInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.MetaInfo) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.ExoCoreChainIndex != 0 { + n += 1 + sovTx(uint64(m.ExoCoreChainIndex)) + } + return n +} + func (m *AssetInfo) Size() (n int) { if m == nil { return 0 @@ -1701,7 +1963,7 @@ func (m *StakerSingleAssetOrChangeInfo) Size() (n int) { n += 1 + l + sovTx(uint64(l)) l = m.CanWithdrawAmountOrWantChangeValue.Size() n += 1 + l + sovTx(uint64(l)) - l = m.WaitUndelegationAmountOrWantChangeValue.Size() + l = m.WaitUnbondingAmountOrWantChangeValue.Size() n += 1 + l + sovTx(uint64(l)) return n } @@ -1738,7 +2000,11 @@ func (m *OperatorSingleAssetOrChangeInfo) Size() (n int) { n += 1 + l + sovTx(uint64(l)) l = m.OperatorOwnAmountOrWantChangeValue.Size() n += 1 + l + sovTx(uint64(l)) - l = m.WaitUndelegationAmountOrWantChangeValue.Size() + l = m.WaitUnbondingAmountOrWantChangeValue.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.OperatorOwnWaitUnbondingAmount.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.OperatorCanUnbondAfterSlash.Size() n += 1 + l + sovTx(uint64(l)) return n } @@ -1860,7 +2126,7 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *ClientChainInfo) Unmarshal(dAtA []byte) error { +func (m *ValueField) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1883,15 +2149,15 @@ func (m *ClientChainInfo) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ClientChainInfo: wiretype end group for non-group") + return fmt.Errorf("proto: ValueField: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ClientChainInfo: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ValueField: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1919,42 +2185,126 @@ func (m *ClientChainInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetaInfo", 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 - } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + intStringLen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthTx } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - m.MetaInfo = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ClientChainInfo) 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: ClientChainInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClientChainInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaInfo", 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.MetaInfo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) } m.ChainId = 0 @@ -2101,6 +2451,171 @@ func (m *ClientChainInfo) Unmarshal(dAtA []byte) error { } return nil } +func (m *AppChainInfo) 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: AppChainInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AppChainInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetaInfo", 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.MetaInfo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + 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 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.ChainId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExoCoreChainIndex", wireType) + } + m.ExoCoreChainIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExoCoreChainIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + 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 *AssetInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2589,7 +3104,7 @@ func (m *StakerSingleAssetOrChangeInfo) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WaitUndelegationAmountOrWantChangeValue", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field WaitUnbondingAmountOrWantChangeValue", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2617,7 +3132,7 @@ func (m *StakerSingleAssetOrChangeInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.WaitUndelegationAmountOrWantChangeValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.WaitUnbondingAmountOrWantChangeValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2920,7 +3435,75 @@ func (m *OperatorSingleAssetOrChangeInfo) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WaitUndelegationAmountOrWantChangeValue", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field WaitUnbondingAmountOrWantChangeValue", 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 + } + if err := m.WaitUnbondingAmountOrWantChangeValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorOwnWaitUnbondingAmount", 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 + } + if err := m.OperatorOwnWaitUnbondingAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorCanUnbondAfterSlash", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2948,7 +3531,7 @@ func (m *OperatorSingleAssetOrChangeInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.WaitUndelegationAmountOrWantChangeValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.OperatorCanUnbondAfterSlash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/reward/keeper/claim_reward.go b/x/reward/keeper/claim_reward.go index 71867efbc..ff7a64529 100644 --- a/x/reward/keeper/claim_reward.go +++ b/x/reward/keeper/claim_reward.go @@ -85,12 +85,12 @@ func getRewardParamsFromEventLog(log *ethtypes.Log) (*RewardParams, error) { func getStakeIDAndAssetID(params *RewardParams) (stakeID string, assetID string) { clientChainLzIDStr := hexutil.EncodeUint64(params.ClientChainLzID) - stakeID = strings.Join([]string{hexutil.Encode(params.WithdrawRewardAddress[:]), clientChainLzIDStr}, "_") - assetID = strings.Join([]string{hexutil.Encode(params.AssetsAddress[:]), clientChainLzIDStr}, "_") + stakeID = strings.Join([]string{hexutil.Encode(params.WithdrawRewardAddress), clientChainLzIDStr}, "_") + assetID = strings.Join([]string{hexutil.Encode(params.AssetsAddress), clientChainLzIDStr}, "_") return } -func (k Keeper) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error { +func (k Keeper) PostTxProcessing(ctx sdk.Context, _ core.Message, receipt *ethtypes.Receipt) error { // TODO check if contract address is valid layerZero relayer address // check if log address and topicId is valid params, err := k.GetParams(ctx) diff --git a/x/reward/keeper/setup_test.go b/x/reward/keeper/setup_test.go index 1927a5b17..4cb58894d 100644 --- a/x/reward/keeper/setup_test.go +++ b/x/reward/keeper/setup_test.go @@ -1,9 +1,10 @@ package keeper_test import ( - "github.com/ExocoreNetwork/exocore/testutil" "testing" + "github.com/ExocoreNetwork/exocore/testutil" + //nolint:revive // dot imports are fine for Ginkgo . "github.com/onsi/ginkgo/v2" //nolint:revive // dot imports are fine for Ginkgo diff --git a/x/slash/keeper/execute_slash.go b/x/slash/keeper/execute_slash.go index eacc1fb33..d6c238791 100644 --- a/x/slash/keeper/execute_slash.go +++ b/x/slash/keeper/execute_slash.go @@ -115,8 +115,8 @@ func (k Keeper) getParamsFromEventLog(ctx sdk.Context, log *ethtypes.Log) (*Slas func getStakeIDAndAssetID(params *SlashParams) (stakeID string, assetID string) { clientChainLzIDStr := hexutil.EncodeUint64(params.ClientChainLzID) - stakeID = strings.Join([]string{hexutil.Encode(params.StakerAddress[:]), clientChainLzIDStr}, "_") - assetID = strings.Join([]string{hexutil.Encode(params.AssetsAddress[:]), clientChainLzIDStr}, "_") + stakeID = strings.Join([]string{hexutil.Encode(params.StakerAddress), clientChainLzIDStr}, "_") + assetID = strings.Join([]string{hexutil.Encode(params.AssetsAddress), clientChainLzIDStr}, "_") return } diff --git a/x/slash/keeper/setup_test.go b/x/slash/keeper/setup_test.go index cf45470b0..70c6d6239 100644 --- a/x/slash/keeper/setup_test.go +++ b/x/slash/keeper/setup_test.go @@ -1,9 +1,10 @@ package keeper_test import ( - "github.com/ExocoreNetwork/exocore/testutil" "testing" + "github.com/ExocoreNetwork/exocore/testutil" + //nolint:revive // dot imports are fine for Ginkgo . "github.com/onsi/ginkgo/v2" //nolint:revive // dot imports are fine for Ginkgo diff --git a/x/withdraw/keeper/claim_withdraw.go b/x/withdraw/keeper/claim_withdraw.go index 2c59da081..1b4275352 100644 --- a/x/withdraw/keeper/claim_withdraw.go +++ b/x/withdraw/keeper/claim_withdraw.go @@ -77,8 +77,8 @@ type WithdrawParams struct { func getStakeIDAndAssetID(params *WithdrawParams) (stakeID string, assetID string) { clientChainLzIDStr := hexutil.EncodeUint64(params.ClientChainLzID) - stakeID = strings.Join([]string{hexutil.Encode(params.WithdrawAddress[:]), clientChainLzIDStr}, "_") - assetID = strings.Join([]string{hexutil.Encode(params.AssetsAddress[:]), clientChainLzIDStr}, "_") + stakeID = strings.Join([]string{hexutil.Encode(params.WithdrawAddress), clientChainLzIDStr}, "_") + assetID = strings.Join([]string{hexutil.Encode(params.AssetsAddress), clientChainLzIDStr}, "_") return } diff --git a/x/withdraw/keeper/setup_test.go b/x/withdraw/keeper/setup_test.go index 9dd0c641a..f2304a2b8 100644 --- a/x/withdraw/keeper/setup_test.go +++ b/x/withdraw/keeper/setup_test.go @@ -1,9 +1,10 @@ package keeper_test import ( - "github.com/ExocoreNetwork/exocore/testutil" "testing" + "github.com/ExocoreNetwork/exocore/testutil" + //nolint:revive // dot imports are fine for Ginkgo . "github.com/onsi/ginkgo/v2" //nolint:revive // dot imports are fine for Ginkgo