From f51f6e0cd34248f1fb160e4367a1b60dda9ae879 Mon Sep 17 00:00:00 2001 From: Charlie Chen <34498985+ws4charlie@users.noreply.github.com> Date: Wed, 11 Oct 2023 11:40:40 -0500 Subject: [PATCH 1/3] fix: feed sataoshi/B to zetacore and check actual outTx size (#1243) * feed sataoshi/B to zetacore and check size limit * removed fee cap * replaced magic number 1000 with constant bytesPerKB * put lowerbound, upperbound limit on sizeLimit * use actual txSize for fee calculation --------- Co-authored-by: charliec --- zetaclient/bitcoin_client.go | 7 +++--- zetaclient/btc_signer.go | 43 +++++++++++++++++++++++++----------- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/zetaclient/bitcoin_client.go b/zetaclient/bitcoin_client.go index 72bce508cb..943ae8710b 100644 --- a/zetaclient/bitcoin_client.go +++ b/zetaclient/bitcoin_client.go @@ -73,6 +73,7 @@ const ( minConfirmations = 0 maxHeightDiff = 10000 dustOffset = 2000 + bytesPerKB = 1000 ) func (ob *BitcoinChainClient) SetCoreParams(params observertypes.CoreParams) { @@ -459,14 +460,14 @@ func (ob *BitcoinChainClient) PostGasPrice() error { if feeResult.Errors != nil || feeResult.FeeRate == nil { return fmt.Errorf("error getting gas price: %s", feeResult.Errors) } - gasPrice := big.NewFloat(0) - gasPriceU64, _ := gasPrice.Mul(big.NewFloat(*feeResult.FeeRate), big.NewFloat(1e8)).Uint64() + feeRate := new(big.Int).SetInt64(int64(*feeResult.FeeRate * 1e8)) + feeRatePerByte := new(big.Int).Div(feeRate, big.NewInt(bytesPerKB)) bn, err := ob.rpcClient.GetBlockCount() if err != nil { return err } // #nosec G701 always positive - zetaHash, err := ob.zetaClient.PostGasPrice(ob.chain, gasPriceU64, "100", uint64(bn)) + zetaHash, err := ob.zetaClient.PostGasPrice(ob.chain, feeRatePerByte.Uint64(), "100", uint64(bn)) if err != nil { ob.logger.WatchGasPrice.Err(err).Msg("PostGasPrice:") return err diff --git a/zetaclient/btc_signer.go b/zetaclient/btc_signer.go index 625c4faef6..07cf24df92 100644 --- a/zetaclient/btc_signer.go +++ b/zetaclient/btc_signer.go @@ -23,6 +23,13 @@ import ( const ( maxNoOfInputsPerTx = 20 + outTxBytesMin = 400 // 500B is a conservative estimate for a 2-input, 3-output SegWit tx + outTxBytesMax = 4_000 // 4KB is a conservative estimate for a 21-input, 3-output SegWit tx + outTxBytesCap = 10_000 // in case of accident + + // for ZRC20 configuration + bytesPerInput = 150 // each input is about 150 bytes + ZRC20GasLimit = outTxBytesMin + bytesPerInput*8 // 1600B a suggested ZRC20 GAS_LIMIT for a 10-input, 3-output SegWit tx ) type BTCSigner struct { @@ -59,9 +66,9 @@ func NewBTCSigner(cfg config.BTCConfig, tssSigner TSSSigner, logger zerolog.Logg } // SignWithdrawTx receives utxos sorted by value, amount in BTC, feeRate in BTC per Kb -func (signer *BTCSigner) SignWithdrawTx(to *btcutil.AddressWitnessPubKeyHash, amount float64, gasPrice *big.Int, btcClient *BitcoinChainClient, height uint64, nonce uint64, chain *common.Chain) (*wire.MsgTx, error) { - estimateFee := 0.0001 // 10,000 sats, should be good for testnet - minFee := 0.00005 +func (signer *BTCSigner) SignWithdrawTx(to *btcutil.AddressWitnessPubKeyHash, amount float64, gasPrice *big.Int, sizeLimit uint64, + btcClient *BitcoinChainClient, height uint64, nonce uint64, chain *common.Chain) (*wire.MsgTx, error) { + estimateFee := float64(gasPrice.Uint64()) * outTxBytesMax / 1e8 nonceMark := NonceMarkAmount(nonce) // refresh unspent UTXOs and continue with keysign regardless of error @@ -93,16 +100,25 @@ func (signer *BTCSigner) SignWithdrawTx(to *btcutil.AddressWitnessPubKeyHash, am return nil, err } - // fee checking - fees := new(big.Int).Mul(big.NewInt(int64(tx.SerializeSize())), gasPrice) - fees.Div(fees, big.NewInt(1000)) //FIXME: feeRate KB is 1000B or 1024B? - // #nosec G701 always in range - if fees.Int64() < int64(minFee*1e8) { - fmt.Printf("fees %d is less than minFee %f; use minFee", fees, minFee*1e8) - // #nosec G701 always in range - fees = big.NewInt(int64(minFee * 1e8)) + // size checking + txSize := uint64(tx.SerializeSize()) + if txSize > sizeLimit { // ZRC20 'withdraw' charged less fee from end user + signer.logger.Info().Msgf("sizeLimit %d is less than txSize %d for nonce %d", sizeLimit, txSize, nonce) + } + if txSize < outTxBytesMin { // outbound shouldn't be blocked a low sizeLimit + signer.logger.Warn().Msgf("sizeLimit %d is less than outTxBytesMin %d; use outTxBytesMin", sizeLimit, outTxBytesMin) + txSize = outTxBytesMin + } + if txSize > outTxBytesCap { // in case of accident + signer.logger.Warn().Msgf("sizeLimit %d is greater than outTxBytesCap %d; use outTxBytesCap", sizeLimit, outTxBytesCap) + txSize = outTxBytesCap } + // fee calculation + fees := new(big.Int).Mul(big.NewInt(int64(txSize)), gasPrice) + fees.Div(fees, big.NewInt(bytesPerKB)) + signer.logger.Info().Msgf("bitcoin outTx nonce %d gasPrice %s size %d fees %s", nonce, gasPrice.String(), txSize, fees.String()) + // calculate remaining btc to TSS self tssAddrWPKH := signer.tssSigner.BTCAddressWitnessPubkeyHash() payToSelf, err := payToWitnessPubKeyHashScript(tssAddrWPKH.WitnessProgram()) @@ -253,8 +269,9 @@ func (signer *BTCSigner) TryProcessOutTx(send *types.CrossChainTx, outTxMan *Out return } + sizelimit := params.OutboundTxGasLimit gasprice, ok := new(big.Int).SetString(params.OutboundTxGasPrice, 10) - if !ok { + if !ok || gasprice.Cmp(big.NewInt(0)) < 0 { logger.Error().Msgf("cannot convert gas price %s ", params.OutboundTxGasPrice) return } @@ -273,7 +290,7 @@ func (signer *BTCSigner) TryProcessOutTx(send *types.CrossChainTx, outTxMan *Out logger.Info().Msgf("SignWithdrawTx: to %s, value %d sats", addr.EncodeAddress(), params.Amount.Uint64()) logger.Info().Msgf("using utxos: %v", btcClient.utxos) - tx, err := signer.SignWithdrawTx(to, float64(params.Amount.Uint64())/1e8, gasprice, btcClient, height, + tx, err := signer.SignWithdrawTx(to, float64(params.Amount.Uint64())/1e8, gasprice, sizelimit, btcClient, height, outboundTxTssNonce, &btcClient.chain) if err != nil { logger.Warn().Err(err).Msgf("SignOutboundTx error: nonce %d chain %d", outboundTxTssNonce, params.ReceiverChainId) From 32b135ac4d4276b3829854910fd5ca3fb792f5bd Mon Sep 17 00:00:00 2001 From: Charlie Chen <34498985+ws4charlie@users.noreply.github.com> Date: Thu, 12 Oct 2023 00:06:11 -0500 Subject: [PATCH 2/3] fix: cherry pick all hotfix from v10.0.x (zero-amount, precision, etc.) (#1235) * cherry pick all hotfix from v10.0.x * adjusted code to for nosec * adusted error handling and code comments according to PR review feedback * cherry pick hotfix for bitcoin outbound performance and updated some log prints * cherry pick mock mainnet hotfix for duplicate payment on nonce 0 --------- Co-authored-by: charliec --- zetaclient/bitcoin_client.go | 56 ++++++++++++++++----------------- zetaclient/evm_client.go | 14 ++++----- zetaclient/zetacore_observer.go | 7 ++++- 3 files changed, 41 insertions(+), 36 deletions(-) diff --git a/zetaclient/bitcoin_client.go b/zetaclient/bitcoin_client.go index 943ae8710b..217abaa0a7 100644 --- a/zetaclient/bitcoin_client.go +++ b/zetaclient/bitcoin_client.go @@ -293,9 +293,12 @@ func (ob *BitcoinChainClient) observeInTx() error { for _, inTx := range inTxs { ob.logger.WatchInTx.Debug().Msgf("Processing inTx: %s", inTx.TxHash) - amount := big.NewFloat(inTx.Value) - amount = amount.Mul(amount, big.NewFloat(1e8)) - amountInt, _ := amount.Int(nil) + sats, err := getSatoshis(inTx.Value) + if err != nil { + ob.logger.WatchInTx.Error().Err(err).Msgf("getSatoshis error: %s", err) + continue + } + amountInt := big.NewInt(sats) message := hex.EncodeToString(inTx.MemoBytes) zetaHash, err := ob.zetaClient.PostSend( inTx.FromAddress, @@ -347,22 +350,31 @@ func (ob *BitcoinChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64 res, included := ob.includedTxResults[outTxID] ob.mu.Unlock() + // Get original cctx parameters + params, err := ob.GetPendingCctxParams(nonce) + if err != nil { + ob.logger.ObserveOutTx.Info().Msgf("IsSendOutTxProcessed: can't find pending cctx for nonce %d", nonce) + return false, false, err + } + if !included { if !broadcasted { return false, false, nil } - // Get original cctx parameters - params, err := ob.GetPendingCctxParams(nonce) - if err != nil { - ob.logger.ObserveOutTx.Info().Msgf("IsSendOutTxProcessed: can't find pending cctx for nonce %d", nonce) - return false, false, nil + // If the broadcasted outTx is nonce 0, just wait for inclusion and don't schedule more keysign + // Schedule more than one keysign for nonce 0 can lead to duplicate payments. + // One purpose of nonce mark UTXO is to avoid duplicate payment based on the fact that Bitcoin + // prevents double spending of same UTXO. However, for nonce 0, we don't have a prior nonce (e.g., -1) + // for the signer to check against when making the payment. Signer treats nonce 0 as a special case in downstream code. + if nonce == 0 { + return true, false, nil } // Try including this outTx broadcasted by myself inMempool, err := ob.checkNSaveIncludedTx(txnHash, params) if err != nil { ob.logger.ObserveOutTx.Error().Err(err).Msg("IsSendOutTxProcessed: checkNSaveIncludedTx failed") - return false, false, nil + return false, false, err } if inMempool { // to avoid unnecessary Tss keysign ob.logger.ObserveOutTx.Info().Msgf("IsSendOutTxProcessed: outTx %s is still in mempool", outTxID) @@ -379,27 +391,16 @@ func (ob *BitcoinChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64 ob.logger.ObserveOutTx.Info().Msgf("IsSendOutTxProcessed: checkNSaveIncludedTx succeeded for outTx %s", outTxID) } - var amount float64 - if res.Amount > 0 { - ob.logger.ObserveOutTx.Warn().Msg("IsSendOutTxProcessed: res.Amount > 0") - amount = res.Amount - } else if res.Amount == 0 { - ob.logger.ObserveOutTx.Error().Msg("IsSendOutTxProcessed: res.Amount == 0") - return false, false, nil - } else { - amount = -res.Amount - } - - amountInSat, _ := big.NewFloat(amount * 1e8).Int(nil) + // It's safe to use cctx's amount to post confirmation because it has already been verified in observeOutTx() + amountInSat := params.Amount.BigInt() if res.Confirmations < ob.ConfirmationsThreshold(amountInSat) { return true, false, nil } - logger.Debug().Msgf("Bitcoin outTx confirmed: txid %s, amount %f\n", res.TxID, res.Amount) + logger.Debug().Msgf("Bitcoin outTx confirmed: txid %s, amount %s\n", res.TxID, amountInSat.String()) zetaHash, err := ob.zetaClient.PostReceiveConfirmation( sendHash, res.TxID, - // #nosec G701 always positive uint64(res.BlockIndex), 0, // gas used not used with Bitcoin nil, // gas price not used with Bitcoin @@ -663,10 +664,9 @@ func (ob *BitcoinChainClient) refreshPendingNonce() { pendingNonce := ob.pendingNonce ob.mu.Unlock() - // #nosec G701 always positive + // #nosec G701 always non-negative nonceLow := uint64(p.NonceLow) - - if nonceLow > 0 && nonceLow >= pendingNonce { + if nonceLow > pendingNonce { // get the last included outTx hash txid, err := ob.getOutTxidByNonce(nonceLow-1, false) if err != nil { @@ -888,9 +888,9 @@ func (ob *BitcoinChainClient) checkNSaveIncludedTx(txHash string, params types.O ob.includedTxHashes[txHash] = params.OutboundTxTssNonce ob.includedTxResults[outTxID] = *getTxResult if params.OutboundTxTssNonce >= ob.pendingNonce { // try increasing pending nonce on every newly included outTx - ob.pendingNonce = params.OutboundTxTssNonce + ob.pendingNonce = params.OutboundTxTssNonce + 1 } - ob.logger.ObserveOutTx.Info().Msgf("checkNSaveIncludedTx: included new bitcoin outTx %s outTxID %s", txHash, outTxID) + ob.logger.ObserveOutTx.Info().Msgf("checkNSaveIncludedTx: included new bitcoin outTx %s outTxID %s pending nonce %d", txHash, outTxID, ob.pendingNonce) } // update saved tx result as confirmations may increase if foundHash && foundRes { diff --git a/zetaclient/evm_client.go b/zetaclient/evm_client.go index 6f0058a2c0..5bc89ae547 100644 --- a/zetaclient/evm_client.go +++ b/zetaclient/evm_client.go @@ -257,7 +257,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co if err != nil { logger.Error().Err(err).Msg("error posting confirmation to meta core") } - logger.Info().Msgf("Zeta tx hash: %s\n", zetaHash) + logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaHash, sendHash, nonce) return true, true, nil } else if cointype == common.CoinType_Gas { // the outbound is a regular Ether/BNB/Matic transfer; no need to check events @@ -278,7 +278,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co if err != nil { logger.Error().Err(err).Msg("error posting confirmation to meta core") } - logger.Info().Msgf("Zeta tx hash: %s\n", zetaHash) + logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaHash, sendHash, nonce) return true, true, nil } else if receipt.Status == 0 { // the same as below events flow logger.Info().Msgf("Found (failed tx) sendHash %s on chain %s txhash %s", sendHash, ob.chain.String(), receipt.TxHash.Hex()) @@ -298,7 +298,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co if err != nil { logger.Error().Err(err).Msgf("PostReceiveConfirmation error in WatchTxHashWithTimeout; zeta tx hash %s", zetaTxHash) } - logger.Info().Msgf("Zeta tx hash: %s", zetaTxHash) + logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaTxHash, sendHash, nonce) return true, true, nil } } else if cointype == common.CoinType_Zeta { // the outbound is a Zeta transfer; need to check events ZetaReceived @@ -344,7 +344,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co logger.Error().Err(err).Msg("error posting confirmation to meta core") continue } - logger.Info().Msgf("Zeta tx hash: %s\n", zetaHash) + logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaHash, sendHash, nonce) return true, true, nil } // #nosec G701 always in range @@ -380,7 +380,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co logger.Err(err).Msg("error posting confirmation to meta core") continue } - logger.Info().Msgf("Zeta tx hash: %s", metaHash) + logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", metaHash, sendHash, nonce) return true, true, nil } // #nosec G701 always in range @@ -407,7 +407,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co if err != nil { logger.Error().Err(err).Msgf("PostReceiveConfirmation error in WatchTxHashWithTimeout; zeta tx hash %s", zetaTxHash) } - logger.Info().Msgf("Zeta tx hash: %s", zetaTxHash) + logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaTxHash, sendHash, nonce) return true, true, nil } } else if cointype == common.CoinType_ERC20 { @@ -446,7 +446,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co logger.Error().Err(err).Msg("error posting confirmation to meta core") continue } - logger.Info().Msgf("Zeta tx hash: %s\n", zetaHash) + logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaHash, sendHash, nonce) return true, true, nil } // #nosec G701 always in range diff --git a/zetaclient/zetacore_observer.go b/zetaclient/zetacore_observer.go index 343228004a..1b6ecaec26 100644 --- a/zetaclient/zetacore_observer.go +++ b/zetaclient/zetacore_observer.go @@ -172,7 +172,12 @@ func (co *CoreObserver) startSendScheduler() { outTxID := fmt.Sprintf("%s-%d-%d", cctx.Index, params.ReceiverChainId, nonce) // would outTxID a better ID? // Process Bitcoin OutTx - if common.IsBitcoinChain(c.ChainId) && !outTxMan.IsOutTxActive(outTxID) { + if common.IsBitcoinChain(c.ChainId) { + if outTxMan.IsOutTxActive(outTxID) { + // bitcoun outTx is processed sequencially by nonce + // if the current outTx is being processed, there is no need to process outTx with future nonces + break + } // #nosec G701 positive if stop := co.processBitcoinOutTx(outTxMan, uint64(idx), cctx, signer, ob, currentHeight); stop { break From 0001806c17fe62fddc4eb97cc296eb26f8bc1fab Mon Sep 17 00:00:00 2001 From: Tanmay Date: Thu, 12 Oct 2023 10:09:09 -0400 Subject: [PATCH 3/3] fix: register emissions grpc server (#1257) --- docs/openapi/openapi.swagger.yaml | 8 +- proto/emissions/query.proto | 8 +- .../client/cli/query_get_emmisons_factors.go | 4 +- .../client/tests/observer_rewards_test.go | 4 +- .../keeper/grpc_query_get_emmisons_factors.go | 4 +- x/emissions/module.go | 7 +- x/emissions/types/query.pb.go | 208 +++++++++--------- x/emissions/types/query.pb.gw.go | 28 +-- 8 files changed, 138 insertions(+), 133 deletions(-) diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index 39fa7d46df..493ed11c53 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -27677,15 +27677,15 @@ paths: $ref: '#/definitions/googlerpcStatus' tags: - Query - /zeta-chain/zetacore/emissions/get_emmisons_factors: + /zeta-chain/zetacore/emissions/get_emissions_factors: get: summary: Queries a list of GetEmmisonsFactors items. - operationId: Query_GetEmmisonsFactors + operationId: Query_GetEmissionsFactors responses: "200": description: A successful response. schema: - $ref: '#/definitions/emissionsQueryGetEmmisonsFactorsResponse' + $ref: '#/definitions/emissionsQueryGetEmissionsFactorsResponse' default: description: An unexpected error response. schema: @@ -50752,7 +50752,7 @@ definitions: type: string proved: type: boolean - emissionsQueryGetEmmisonsFactorsResponse: + emissionsQueryGetEmissionsFactorsResponse: type: object properties: reservesFactor: diff --git a/proto/emissions/query.proto b/proto/emissions/query.proto index a386ae322e..fcfa34fb76 100644 --- a/proto/emissions/query.proto +++ b/proto/emissions/query.proto @@ -20,8 +20,8 @@ service Query { } // Queries a list of GetEmmisonsFactors items. - rpc GetEmmisonsFactors(QueryGetEmmisonsFactorsRequest) returns (QueryGetEmmisonsFactorsResponse) { - option (google.api.http).get = "/zeta-chain/zetacore/emissions/get_emmisons_factors"; + rpc GetEmissionsFactors(QueryGetEmissionsFactorsRequest) returns (QueryGetEmissionsFactorsResponse) { + option (google.api.http).get = "/zeta-chain/zetacore/emissions/get_emissions_factors"; } // Queries a list of ShowAvailableEmissions items. @@ -49,9 +49,9 @@ message QueryListPoolAddressesResponse { string emission_module_address = 3; } -message QueryGetEmmisonsFactorsRequest {} +message QueryGetEmissionsFactorsRequest {} -message QueryGetEmmisonsFactorsResponse { +message QueryGetEmissionsFactorsResponse { string reservesFactor = 1; string bondFactor = 2; string durationFactor = 3; diff --git a/x/emissions/client/cli/query_get_emmisons_factors.go b/x/emissions/client/cli/query_get_emmisons_factors.go index 12051c7084..0749d33218 100644 --- a/x/emissions/client/cli/query_get_emmisons_factors.go +++ b/x/emissions/client/cli/query_get_emmisons_factors.go @@ -21,9 +21,9 @@ func CmdGetEmmisonsFactors() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) - params := &types.QueryGetEmmisonsFactorsRequest{} + params := &types.QueryGetEmissionsFactorsRequest{} - res, err := queryClient.GetEmmisonsFactors(cmd.Context(), params) + res, err := queryClient.GetEmissionsFactors(cmd.Context(), params) if err != nil { return err } diff --git a/x/emissions/client/tests/observer_rewards_test.go b/x/emissions/client/tests/observer_rewards_test.go index 427dec3c6c..c3113deb87 100644 --- a/x/emissions/client/tests/observer_rewards_test.go +++ b/x/emissions/client/tests/observer_rewards_test.go @@ -38,7 +38,7 @@ func (s *CliTestSuite) TestObserverRewards() { s.Require().NoError(s.network.WaitForNextBlock()) // Collect parameter values and build assertion map for the randomised ballot set created - emissionFactors := emmisonstypes.QueryGetEmmisonsFactorsResponse{} + emissionFactors := emmisonstypes.QueryGetEmissionsFactorsResponse{} out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, emmisonscli.CmdGetEmmisonsFactors(), []string{"--output", "json"}) s.Require().NoError(err) s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &emissionFactors)) @@ -53,7 +53,7 @@ func (s *CliTestSuite) TestObserverRewards() { _, err = s.network.WaitForHeight(s.ballots[0].BallotCreationHeight + observerParams.Params.BallotMaturityBlocks) s.Require().NoError(err) out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, emmisonscli.CmdGetEmmisonsFactors(), []string{"--output", "json"}) - resFactorsNewBlocks := emmisonstypes.QueryGetEmmisonsFactorsResponse{} + resFactorsNewBlocks := emmisonstypes.QueryGetEmissionsFactorsResponse{} s.Require().NoError(err) s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &resFactorsNewBlocks)) // Duration factor is calculated in the same block,so we need to query based from the committed state at which the distribution is done diff --git a/x/emissions/keeper/grpc_query_get_emmisons_factors.go b/x/emissions/keeper/grpc_query_get_emmisons_factors.go index a78fb8801d..032c68c176 100644 --- a/x/emissions/keeper/grpc_query_get_emmisons_factors.go +++ b/x/emissions/keeper/grpc_query_get_emmisons_factors.go @@ -7,11 +7,11 @@ import ( "github.com/zeta-chain/zetacore/x/emissions/types" ) -func (k Keeper) GetEmmisonsFactors(goCtx context.Context, _ *types.QueryGetEmmisonsFactorsRequest) (*types.QueryGetEmmisonsFactorsResponse, error) { +func (k Keeper) GetEmissionsFactors(goCtx context.Context, _ *types.QueryGetEmissionsFactorsRequest) (*types.QueryGetEmissionsFactorsResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) reservesFactor, bondFactor, durationFactor := k.GetBlockRewardComponents(ctx) - return &types.QueryGetEmmisonsFactorsResponse{ + return &types.QueryGetEmissionsFactorsResponse{ ReservesFactor: reservesFactor.String(), BondFactor: bondFactor.String(), DurationFactor: durationFactor.String(), diff --git a/x/emissions/module.go b/x/emissions/module.go index c9614c6ab4..02c7e9437d 100644 --- a/x/emissions/module.go +++ b/x/emissions/module.go @@ -1,6 +1,7 @@ package emissions import ( + "context" "encoding/json" "fmt" @@ -75,7 +76,11 @@ func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) { } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *runtime.ServeMux) { +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) + if err != nil { + fmt.Println("RegisterQueryHandlerClient err: %w", err) + } } // GetTxCmd returns the emissions module's root tx command. diff --git a/x/emissions/types/query.pb.go b/x/emissions/types/query.pb.go index 66a7fcbfeb..b68ff65280 100644 --- a/x/emissions/types/query.pb.go +++ b/x/emissions/types/query.pb.go @@ -210,21 +210,21 @@ func (m *QueryListPoolAddressesResponse) GetEmissionModuleAddress() string { return "" } -type QueryGetEmmisonsFactorsRequest struct { +type QueryGetEmissionsFactorsRequest struct { } -func (m *QueryGetEmmisonsFactorsRequest) Reset() { *m = QueryGetEmmisonsFactorsRequest{} } -func (m *QueryGetEmmisonsFactorsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetEmmisonsFactorsRequest) ProtoMessage() {} -func (*QueryGetEmmisonsFactorsRequest) Descriptor() ([]byte, []int) { +func (m *QueryGetEmissionsFactorsRequest) Reset() { *m = QueryGetEmissionsFactorsRequest{} } +func (m *QueryGetEmissionsFactorsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetEmissionsFactorsRequest) ProtoMessage() {} +func (*QueryGetEmissionsFactorsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_6e578782beb6ef82, []int{4} } -func (m *QueryGetEmmisonsFactorsRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryGetEmissionsFactorsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetEmmisonsFactorsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetEmissionsFactorsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetEmmisonsFactorsRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetEmissionsFactorsRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -234,36 +234,36 @@ func (m *QueryGetEmmisonsFactorsRequest) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } -func (m *QueryGetEmmisonsFactorsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetEmmisonsFactorsRequest.Merge(m, src) +func (m *QueryGetEmissionsFactorsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetEmissionsFactorsRequest.Merge(m, src) } -func (m *QueryGetEmmisonsFactorsRequest) XXX_Size() int { +func (m *QueryGetEmissionsFactorsRequest) XXX_Size() int { return m.Size() } -func (m *QueryGetEmmisonsFactorsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetEmmisonsFactorsRequest.DiscardUnknown(m) +func (m *QueryGetEmissionsFactorsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetEmissionsFactorsRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetEmmisonsFactorsRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryGetEmissionsFactorsRequest proto.InternalMessageInfo -type QueryGetEmmisonsFactorsResponse struct { +type QueryGetEmissionsFactorsResponse struct { ReservesFactor string `protobuf:"bytes,1,opt,name=reservesFactor,proto3" json:"reservesFactor,omitempty"` BondFactor string `protobuf:"bytes,2,opt,name=bondFactor,proto3" json:"bondFactor,omitempty"` DurationFactor string `protobuf:"bytes,3,opt,name=durationFactor,proto3" json:"durationFactor,omitempty"` } -func (m *QueryGetEmmisonsFactorsResponse) Reset() { *m = QueryGetEmmisonsFactorsResponse{} } -func (m *QueryGetEmmisonsFactorsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetEmmisonsFactorsResponse) ProtoMessage() {} -func (*QueryGetEmmisonsFactorsResponse) Descriptor() ([]byte, []int) { +func (m *QueryGetEmissionsFactorsResponse) Reset() { *m = QueryGetEmissionsFactorsResponse{} } +func (m *QueryGetEmissionsFactorsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetEmissionsFactorsResponse) ProtoMessage() {} +func (*QueryGetEmissionsFactorsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_6e578782beb6ef82, []int{5} } -func (m *QueryGetEmmisonsFactorsResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryGetEmissionsFactorsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetEmmisonsFactorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetEmissionsFactorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetEmmisonsFactorsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetEmissionsFactorsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -273,33 +273,33 @@ func (m *QueryGetEmmisonsFactorsResponse) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } -func (m *QueryGetEmmisonsFactorsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetEmmisonsFactorsResponse.Merge(m, src) +func (m *QueryGetEmissionsFactorsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetEmissionsFactorsResponse.Merge(m, src) } -func (m *QueryGetEmmisonsFactorsResponse) XXX_Size() int { +func (m *QueryGetEmissionsFactorsResponse) XXX_Size() int { return m.Size() } -func (m *QueryGetEmmisonsFactorsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetEmmisonsFactorsResponse.DiscardUnknown(m) +func (m *QueryGetEmissionsFactorsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetEmissionsFactorsResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetEmmisonsFactorsResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryGetEmissionsFactorsResponse proto.InternalMessageInfo -func (m *QueryGetEmmisonsFactorsResponse) GetReservesFactor() string { +func (m *QueryGetEmissionsFactorsResponse) GetReservesFactor() string { if m != nil { return m.ReservesFactor } return "" } -func (m *QueryGetEmmisonsFactorsResponse) GetBondFactor() string { +func (m *QueryGetEmissionsFactorsResponse) GetBondFactor() string { if m != nil { return m.BondFactor } return "" } -func (m *QueryGetEmmisonsFactorsResponse) GetDurationFactor() string { +func (m *QueryGetEmissionsFactorsResponse) GetDurationFactor() string { if m != nil { return m.DurationFactor } @@ -399,8 +399,8 @@ func init() { proto.RegisterType((*QueryParamsResponse)(nil), "zetachain.zetacore.emissions.QueryParamsResponse") proto.RegisterType((*QueryListPoolAddressesRequest)(nil), "zetachain.zetacore.emissions.QueryListPoolAddressesRequest") proto.RegisterType((*QueryListPoolAddressesResponse)(nil), "zetachain.zetacore.emissions.QueryListPoolAddressesResponse") - proto.RegisterType((*QueryGetEmmisonsFactorsRequest)(nil), "zetachain.zetacore.emissions.QueryGetEmmisonsFactorsRequest") - proto.RegisterType((*QueryGetEmmisonsFactorsResponse)(nil), "zetachain.zetacore.emissions.QueryGetEmmisonsFactorsResponse") + proto.RegisterType((*QueryGetEmissionsFactorsRequest)(nil), "zetachain.zetacore.emissions.QueryGetEmissionsFactorsRequest") + proto.RegisterType((*QueryGetEmissionsFactorsResponse)(nil), "zetachain.zetacore.emissions.QueryGetEmissionsFactorsResponse") proto.RegisterType((*QueryShowAvailableEmissionsRequest)(nil), "zetachain.zetacore.emissions.QueryShowAvailableEmissionsRequest") proto.RegisterType((*QueryShowAvailableEmissionsResponse)(nil), "zetachain.zetacore.emissions.QueryShowAvailableEmissionsResponse") } @@ -408,49 +408,49 @@ func init() { func init() { proto.RegisterFile("emissions/query.proto", fileDescriptor_6e578782beb6ef82) } var fileDescriptor_6e578782beb6ef82 = []byte{ - // 661 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcd, 0x6e, 0xd3, 0x4c, - 0x14, 0x8d, 0xfb, 0x7d, 0x04, 0x31, 0x48, 0x48, 0x0c, 0xa5, 0x54, 0x51, 0x71, 0x2a, 0x53, 0x28, - 0x42, 0x6a, 0xdc, 0x1f, 0x95, 0x4d, 0x29, 0x22, 0x41, 0x05, 0xf1, 0x27, 0x4a, 0x81, 0x05, 0x6c, - 0xac, 0x71, 0x3c, 0x38, 0x23, 0xd9, 0x33, 0xa9, 0xef, 0xb8, 0xa5, 0x20, 0x36, 0x3c, 0x01, 0x88, - 0x2d, 0x4f, 0xc0, 0x7b, 0x20, 0x75, 0x85, 0x2a, 0xb1, 0x61, 0x85, 0x50, 0xcb, 0x82, 0x87, 0x60, - 0x81, 0x32, 0xbe, 0x4e, 0x9b, 0xa4, 0x49, 0x4b, 0xd9, 0x8d, 0xef, 0xdc, 0x73, 0xee, 0x39, 0xd7, - 0xc7, 0x32, 0x39, 0xcb, 0x63, 0x01, 0x20, 0x94, 0x04, 0x77, 0x35, 0xe5, 0xc9, 0x46, 0xa5, 0x99, - 0x28, 0xad, 0xe8, 0xd8, 0x2b, 0xae, 0x59, 0xbd, 0xc1, 0x84, 0xac, 0x98, 0x93, 0x4a, 0x78, 0xa5, - 0xdd, 0x59, 0xba, 0x52, 0x57, 0x10, 0x2b, 0x70, 0x7d, 0x06, 0x3c, 0x83, 0xb9, 0x6b, 0x33, 0x3e, - 0xd7, 0x6c, 0xc6, 0x6d, 0xb2, 0x50, 0x48, 0xa6, 0x85, 0x92, 0x19, 0x53, 0x69, 0x64, 0x77, 0x40, - 0x93, 0x25, 0x2c, 0x06, 0xac, 0x0f, 0x87, 0x2a, 0x54, 0xe6, 0xe8, 0xb6, 0x4e, 0x58, 0x1d, 0x0b, - 0x95, 0x0a, 0x23, 0xee, 0xb2, 0xa6, 0x70, 0x99, 0x94, 0x4a, 0x1b, 0x2a, 0xc4, 0x38, 0xc3, 0x84, - 0x3e, 0x6a, 0x4d, 0x5b, 0x36, 0x44, 0x2b, 0x7c, 0x35, 0xe5, 0xa0, 0x9d, 0x67, 0xe4, 0x4c, 0x47, - 0x15, 0x9a, 0x4a, 0x02, 0xa7, 0x35, 0x52, 0xcc, 0x06, 0x8e, 0x5a, 0xe3, 0xd6, 0xe5, 0x93, 0xb3, - 0x13, 0x95, 0x41, 0x9e, 0x2a, 0x19, 0xba, 0xf6, 0xff, 0xe6, 0xf7, 0x72, 0x61, 0x05, 0x91, 0x4e, - 0x99, 0x9c, 0x37, 0xd4, 0xf7, 0x05, 0xe8, 0x65, 0xa5, 0xa2, 0x6a, 0x10, 0x24, 0x1c, 0x80, 0xb7, - 0x67, 0xff, 0xb6, 0x88, 0xdd, 0xaf, 0x03, 0x75, 0x3c, 0x25, 0x93, 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52, 0x57, 0xf1, 0xbe, 0x63, 0x5e, 0xee, 0x19, 0xa4, 0x37, - 0x9a, 0x1c, 0xfc, 0xa2, 0xf9, 0x8b, 0xcc, 0xfd, 0x09, 0x00, 0x00, 0xff, 0xff, 0x28, 0x09, 0x13, - 0xb9, 0xf4, 0x06, 0x00, 0x00, + // 660 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4f, 0x4f, 0xd4, 0x4e, + 0x18, 0xde, 0xf2, 0xfb, 0xb9, 0xc6, 0x31, 0x31, 0x71, 0x40, 0x24, 0x0d, 0x76, 0xb1, 0xa2, 0x18, + 0x13, 0x3a, 0x80, 0xca, 0x45, 0x20, 0xee, 0x1a, 0x35, 0xfe, 0x8b, 0x88, 0x7a, 0xd0, 0x4b, 0x33, + 0xdd, 0x8e, 0xdd, 0x49, 0xda, 0x4e, 0xe9, 0x3b, 0x05, 0xd1, 0x78, 0xf1, 0x13, 0x18, 0xbd, 0xfa, + 0x19, 0xfc, 0x16, 0x26, 0x1c, 0x89, 0x5e, 0x3c, 0x19, 0x03, 0x1e, 0xfc, 0x10, 0x1e, 0xcc, 0x4e, + 0xa7, 0x85, 0x5d, 0xd8, 0x05, 0xf1, 0x36, 0xf3, 0xf6, 0x7d, 0x9e, 0xf7, 0x79, 0xde, 0x3e, 0x4d, + 0xd1, 0x29, 0x16, 0x71, 0x00, 0x2e, 0x62, 0x20, 0xcb, 0x19, 0x4b, 0xd7, 0x9c, 0x24, 0x15, 0x52, + 0xe0, 0xd1, 0x57, 0x4c, 0xd2, 0x66, 0x8b, 0xf2, 0xd8, 0x51, 0x27, 0x91, 0x32, 0xa7, 0xec, 0x34, + 0x2f, 0x35, 0x05, 0x44, 0x02, 0x88, 0x47, 0x81, 0xe5, 0x30, 0xb2, 0x32, 0xed, 0x31, 0x49, 0xa7, + 0x49, 0x42, 0x03, 0x1e, 0x53, 0xc9, 0x45, 0x9c, 0x33, 0x99, 0xc3, 0xdb, 0x03, 0x12, 0x9a, 0xd2, + 0x08, 0x74, 0x7d, 0x28, 0x10, 0x81, 0x50, 0x47, 0xd2, 0x3e, 0xe9, 0xea, 0x68, 0x20, 0x44, 0x10, + 0x32, 0x42, 0x13, 0x4e, 0x68, 0x1c, 0x0b, 0xa9, 0xa8, 0x34, 0xc6, 0x1e, 0x42, 0xf8, 0x51, 0x7b, + 0xda, 0xa2, 0x22, 0x5a, 0x62, 0xcb, 0x19, 0x03, 0x69, 0x3f, 0x43, 0x83, 0x1d, 0x55, 0x48, 0x44, + 0x0c, 0x0c, 0x37, 0x50, 0x35, 0x1f, 0x38, 0x62, 0x8c, 0x19, 0x17, 0x8f, 0xcf, 0x8c, 0x3b, 0xfd, + 0x3c, 0x39, 0x39, 0xba, 0xf1, 0xff, 0xfa, 0xf7, 0x5a, 0x65, 0x49, 0x23, 0xed, 0x1a, 0x3a, 0xa3, + 0xa8, 0xef, 0x73, 0x90, 0x8b, 0x42, 0x84, 0x75, 0xdf, 0x4f, 0x19, 0x00, 0x2b, 0x67, 0xff, 0x36, + 0x90, 0xd5, 0xab, 0x43, 0xeb, 0x78, 0x8a, 0x26, 0xb2, 0xd8, 0xe7, 0x20, 0x53, 0xee, 0x65, 0x92, + 0xf9, 0xae, 0xf0, 0x80, 0xa5, 0x2b, 0x2c, 0x75, 0x3d, 0x1a, 0xd2, 0xb8, 0xc9, 0xc0, 0xa5, 0x39, + 0x48, 0x09, 0x3d, 0xb6, 0x34, 0xde, 0xd1, 0xfe, 0x50, 0x77, 0x37, 0x74, 0xb3, 0x1e, 0x80, 0xef, + 0x21, 0xbb, 0x93, 0x56, 0x02, 0xec, 0x66, 0x1c, 0x50, 0x8c, 0xb5, 0x8e, 0xce, 0x27, 0x00, 0xdd, + 0x64, 0xb3, 0xe8, 0x74, 0xb1, 0x09, 0x37, 0x12, 0x7e, 0x16, 0xb2, 0x92, 0xe1, 0x3f, 0xc5, 0x50, + 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x43, 0x0e, 0xb2, 0x88, 0x30, 0x03, 0xfc, 0xc5, 0x40, 0x83, 0x7b, + 0xe4, 0x0f, 0xcf, 0x1f, 0x40, 0x4c, 0xef, 0x6c, 0x9b, 0x0b, 0x87, 0x85, 0x6b, 0x37, 0x73, 0xca, + 0xcd, 0x2c, 0xbe, 0xb2, 0x8f, 0x9b, 0x80, 0x49, 0xb7, 0xbc, 0xb9, 0x2f, 0xb4, 0xf8, 0x5f, 0x06, + 0x1a, 0xde, 0x3b, 0x80, 0xf8, 0xfa, 0x01, 0x84, 0xf5, 0xcd, 0xbe, 0x59, 0xff, 0x07, 0x06, 0xed, + 0xee, 0x8e, 0x72, 0x77, 0x03, 0xd7, 0xf7, 0x71, 0x07, 0x2d, 0xb1, 0xea, 0xd2, 0x82, 0x67, 0xdb, + 0x28, 0x79, 0xad, 0x5f, 0xe0, 0x9b, 0xc6, 0xdd, 0xf5, 0x4d, 0xcb, 0xd8, 0xd8, 0xb4, 0x8c, 0x1f, + 0x9b, 0x96, 0xf1, 0x6e, 0xcb, 0xaa, 0x6c, 0x6c, 0x59, 0x95, 0x6f, 0x5b, 0x56, 0xe5, 0xf9, 0x54, + 0xc0, 0x65, 0x2b, 0xf3, 0x9c, 0xa6, 0x88, 0xf6, 0x1c, 0xf3, 0x72, 0xc7, 0x20, 0xb9, 0x96, 0x30, + 0xf0, 0xaa, 0xea, 0x5f, 0x72, 0xf9, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x52, 0x66, 0xde, 0xc2, + 0xfa, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -470,7 +470,7 @@ type QueryClient interface { // Queries a list of ListBalances items. ListPoolAddresses(ctx context.Context, in *QueryListPoolAddressesRequest, opts ...grpc.CallOption) (*QueryListPoolAddressesResponse, error) // Queries a list of GetEmmisonsFactors items. - GetEmmisonsFactors(ctx context.Context, in *QueryGetEmmisonsFactorsRequest, opts ...grpc.CallOption) (*QueryGetEmmisonsFactorsResponse, error) + GetEmissionsFactors(ctx context.Context, in *QueryGetEmissionsFactorsRequest, opts ...grpc.CallOption) (*QueryGetEmissionsFactorsResponse, error) // Queries a list of ShowAvailableEmissions items. ShowAvailableEmissions(ctx context.Context, in *QueryShowAvailableEmissionsRequest, opts ...grpc.CallOption) (*QueryShowAvailableEmissionsResponse, error) } @@ -501,9 +501,9 @@ func (c *queryClient) ListPoolAddresses(ctx context.Context, in *QueryListPoolAd return out, nil } -func (c *queryClient) GetEmmisonsFactors(ctx context.Context, in *QueryGetEmmisonsFactorsRequest, opts ...grpc.CallOption) (*QueryGetEmmisonsFactorsResponse, error) { - out := new(QueryGetEmmisonsFactorsResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.emissions.Query/GetEmmisonsFactors", in, out, opts...) +func (c *queryClient) GetEmissionsFactors(ctx context.Context, in *QueryGetEmissionsFactorsRequest, opts ...grpc.CallOption) (*QueryGetEmissionsFactorsResponse, error) { + out := new(QueryGetEmissionsFactorsResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.emissions.Query/GetEmissionsFactors", in, out, opts...) if err != nil { return nil, err } @@ -526,7 +526,7 @@ type QueryServer interface { // Queries a list of ListBalances items. ListPoolAddresses(context.Context, *QueryListPoolAddressesRequest) (*QueryListPoolAddressesResponse, error) // Queries a list of GetEmmisonsFactors items. - GetEmmisonsFactors(context.Context, *QueryGetEmmisonsFactorsRequest) (*QueryGetEmmisonsFactorsResponse, error) + GetEmissionsFactors(context.Context, *QueryGetEmissionsFactorsRequest) (*QueryGetEmissionsFactorsResponse, error) // Queries a list of ShowAvailableEmissions items. ShowAvailableEmissions(context.Context, *QueryShowAvailableEmissionsRequest) (*QueryShowAvailableEmissionsResponse, error) } @@ -541,8 +541,8 @@ func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsReq func (*UnimplementedQueryServer) ListPoolAddresses(ctx context.Context, req *QueryListPoolAddressesRequest) (*QueryListPoolAddressesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListPoolAddresses not implemented") } -func (*UnimplementedQueryServer) GetEmmisonsFactors(ctx context.Context, req *QueryGetEmmisonsFactorsRequest) (*QueryGetEmmisonsFactorsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetEmmisonsFactors not implemented") +func (*UnimplementedQueryServer) GetEmissionsFactors(ctx context.Context, req *QueryGetEmissionsFactorsRequest) (*QueryGetEmissionsFactorsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetEmissionsFactors not implemented") } func (*UnimplementedQueryServer) ShowAvailableEmissions(ctx context.Context, req *QueryShowAvailableEmissionsRequest) (*QueryShowAvailableEmissionsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ShowAvailableEmissions not implemented") @@ -588,20 +588,20 @@ func _Query_ListPoolAddresses_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } -func _Query_GetEmmisonsFactors_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetEmmisonsFactorsRequest) +func _Query_GetEmissionsFactors_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetEmissionsFactorsRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).GetEmmisonsFactors(ctx, in) + return srv.(QueryServer).GetEmissionsFactors(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/zetachain.zetacore.emissions.Query/GetEmmisonsFactors", + FullMethod: "/zetachain.zetacore.emissions.Query/GetEmissionsFactors", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetEmmisonsFactors(ctx, req.(*QueryGetEmmisonsFactorsRequest)) + return srv.(QueryServer).GetEmissionsFactors(ctx, req.(*QueryGetEmissionsFactorsRequest)) } return interceptor(ctx, in, info, handler) } @@ -637,8 +637,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_ListPoolAddresses_Handler, }, { - MethodName: "GetEmmisonsFactors", - Handler: _Query_GetEmmisonsFactors_Handler, + MethodName: "GetEmissionsFactors", + Handler: _Query_GetEmissionsFactors_Handler, }, { MethodName: "ShowAvailableEmissions", @@ -772,7 +772,7 @@ func (m *QueryListPoolAddressesResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *QueryGetEmmisonsFactorsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryGetEmissionsFactorsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -782,12 +782,12 @@ func (m *QueryGetEmmisonsFactorsRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryGetEmmisonsFactorsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryGetEmissionsFactorsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetEmmisonsFactorsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryGetEmissionsFactorsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -795,7 +795,7 @@ func (m *QueryGetEmmisonsFactorsRequest) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *QueryGetEmmisonsFactorsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryGetEmissionsFactorsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -805,12 +805,12 @@ func (m *QueryGetEmmisonsFactorsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryGetEmmisonsFactorsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryGetEmissionsFactorsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetEmmisonsFactorsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryGetEmissionsFactorsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -960,7 +960,7 @@ func (m *QueryListPoolAddressesResponse) Size() (n int) { return n } -func (m *QueryGetEmmisonsFactorsRequest) Size() (n int) { +func (m *QueryGetEmissionsFactorsRequest) Size() (n int) { if m == nil { return 0 } @@ -969,7 +969,7 @@ func (m *QueryGetEmmisonsFactorsRequest) Size() (n int) { return n } -func (m *QueryGetEmmisonsFactorsResponse) Size() (n int) { +func (m *QueryGetEmissionsFactorsResponse) Size() (n int) { if m == nil { return 0 } @@ -1351,7 +1351,7 @@ func (m *QueryListPoolAddressesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetEmmisonsFactorsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetEmissionsFactorsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1374,10 +1374,10 @@ func (m *QueryGetEmmisonsFactorsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetEmmisonsFactorsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetEmissionsFactorsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetEmmisonsFactorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetEmissionsFactorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1401,7 +1401,7 @@ func (m *QueryGetEmmisonsFactorsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetEmmisonsFactorsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetEmissionsFactorsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1424,10 +1424,10 @@ func (m *QueryGetEmmisonsFactorsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetEmmisonsFactorsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetEmissionsFactorsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetEmmisonsFactorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetEmissionsFactorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/x/emissions/types/query.pb.gw.go b/x/emissions/types/query.pb.gw.go index 3ae17dca8b..36f6e4d9b9 100644 --- a/x/emissions/types/query.pb.gw.go +++ b/x/emissions/types/query.pb.gw.go @@ -69,20 +69,20 @@ func local_request_Query_ListPoolAddresses_0(ctx context.Context, marshaler runt } -func request_Query_GetEmmisonsFactors_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetEmmisonsFactorsRequest +func request_Query_GetEmissionsFactors_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetEmissionsFactorsRequest var metadata runtime.ServerMetadata - msg, err := client.GetEmmisonsFactors(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.GetEmissionsFactors(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_GetEmmisonsFactors_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetEmmisonsFactorsRequest +func local_request_Query_GetEmissionsFactors_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetEmissionsFactorsRequest var metadata runtime.ServerMetadata - msg, err := server.GetEmmisonsFactors(ctx, &protoReq) + msg, err := server.GetEmissionsFactors(ctx, &protoReq) return msg, metadata, err } @@ -193,7 +193,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_GetEmmisonsFactors_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GetEmissionsFactors_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -204,7 +204,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_GetEmmisonsFactors_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_GetEmissionsFactors_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 { @@ -212,7 +212,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_GetEmmisonsFactors_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GetEmissionsFactors_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -320,7 +320,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_GetEmmisonsFactors_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GetEmissionsFactors_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) @@ -329,14 +329,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_GetEmmisonsFactors_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_GetEmissionsFactors_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_GetEmmisonsFactors_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GetEmissionsFactors_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -368,7 +368,7 @@ var ( pattern_Query_ListPoolAddresses_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"zeta-chain", "zetacore", "emissions", "list_addresses"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_GetEmmisonsFactors_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"zeta-chain", "zetacore", "emissions", "get_emmisons_factors"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_GetEmissionsFactors_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"zeta-chain", "zetacore", "emissions", "get_emissions_factors"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_ShowAvailableEmissions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"zeta-chain", "zetacore", "emissions", "show_available_emissions", "address"}, "", runtime.AssumeColonVerbOpt(false))) ) @@ -378,7 +378,7 @@ var ( forward_Query_ListPoolAddresses_0 = runtime.ForwardResponseMessage - forward_Query_GetEmmisonsFactors_0 = runtime.ForwardResponseMessage + forward_Query_GetEmissionsFactors_0 = runtime.ForwardResponseMessage forward_Query_ShowAvailableEmissions_0 = runtime.ForwardResponseMessage )