diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 935672724c..24d163c925 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -67,7 +67,7 @@ jobs: GOOS: linux GOARCH: ${{ env.CPU_ARCH }} run: | - make install-testnet + make install cp "$HOME"/go/bin/* ./ chmod a+x ./zetacored ./zetacored version @@ -79,7 +79,7 @@ jobs: smoke-test: runs-on: ["zeta-runners"] # 25 minutes - timeout-minutes: 30 + timeout-minutes: 35 steps: - uses: actions/checkout@v3 diff --git a/Dockerfile b/Dockerfile index a5e32fc20a..071b367296 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.20-alpine +FROM golang:1.20-alpine3.18 ENV GOPATH /go ENV GOOS=linux diff --git a/Dockerfile-release b/Dockerfile-release index 8e33cb0529..1d869e73fe 100644 --- a/Dockerfile-release +++ b/Dockerfile-release @@ -1,4 +1,4 @@ -FROM golang:1.20-alpine as builder +FROM golang:1.20-alpine3.18 as builder ENV GOPATH /go ENV GOOS=linux diff --git a/Dockerfile-versioned-source b/Dockerfile-versioned-source new file mode 100644 index 0000000000..a0ee08a782 --- /dev/null +++ b/Dockerfile-versioned-source @@ -0,0 +1,72 @@ +FROM golang:1.19-alpine + +ENV GOPATH /go +ENV GOOS=linux +ENV CGO_ENABLED=1 + +ARG old_version + +RUN apk --no-cache add git make build-base jq openssh libusb-dev linux-headers bash curl tmux +RUN ssh-keygen -b 2048 -t rsa -f /root/.ssh/localtest.pem -q -N "" + +WORKDIR /go/delivery/zeta-node + +RUN mkdir -p $GOPATH/bin/old +RUN mkdir -p $GOPATH/bin/new + +ENV NEW_VERSION=v42.0.0 + +# Build new release from the current source +COPY go.mod /go/delivery/zeta-node/ +COPY go.sum /go/delivery/zeta-node/ +RUN cd /go/delivery/zeta-node/ && go mod download +COPY . /go/delivery/zeta-node/ +RUN cd /go/delivery/zeta-node/ && make install +RUN cd /go/delivery/zeta-node/ && make install-smoketest +RUN cp $GOPATH/bin/zetacored $GOPATH/bin/new/ +RUN cp $GOPATH/bin/zetaclientd $GOPATH/bin/new/ +RUN cp $GOPATH/bin/smoketest $GOPATH/bin/new/ + +# Checkout and build old binary +RUN git clone https://github.com/zeta-chain/node.git +RUN cd node && git fetch + +RUN cd node && git checkout ${old_version} +RUN cd node && make install +RUN cd node && make install-smoketest +RUN cp $GOPATH/bin/zetacored $GOPATH/bin/old/ +RUN cp $GOPATH/bin/zetaclientd $GOPATH/bin/old/ +RUN cp $GOPATH/bin/smoketest $GOPATH/bin/old/ + +RUN git clone https://github.com/zeta-chain/cosmos-sdk.git +RUN cd cosmos-sdk && git checkout zetavisor-v0.1.5 +RUN cd cosmos-sdk/cosmovisor && make zetavisor +# +#FROM golang:1.19-alpine + +#RUN apk --no-cache add openssh jq tmux vim curl bash +RUN ssh-keygen -A +WORKDIR /root + +RUN cp /root/.ssh/localtest.pem.pub /root/.ssh/authorized_keys + +RUN cp /go/bin/zetaclientd /usr/local/bin +RUN cp /go/bin/zetacored /usr/local/bin +RUN cp /go/bin/smoketest /usr/local/bin +RUN cp /go/bin/zetavisor /usr/local/bin + +COPY contrib/localnet/scripts /root +COPY contrib/localnet/preparams /root/preparams +COPY contrib/localnet/ssh_config /root/.ssh/config +COPY contrib/localnet/zetacored /root/zetacored +COPY contrib/localnet/tss /root/tss + +RUN chmod 755 /root/*.sh +RUN chmod 700 /root/.ssh +RUN chmod 600 /root/.ssh/* + +WORKDIR /usr/local/bin +ENV SHELL /bin/sh +EXPOSE 22 + +ENTRYPOINT ["/usr/sbin/sshd", "-D"] diff --git a/Makefile b/Makefile index 425d047d2b..bd0ef9e2fe 100644 --- a/Makefile +++ b/Makefile @@ -18,15 +18,11 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=zetacore \ -X github.com/zeta-chain/zetacore/common.BuildTime=$(BUILDTIME) \ -X github.com/cosmos/cosmos-sdk/types.DBBackend=pebbledb -BUILD_FLAGS := -ldflags '$(ldflags)' -tags PRIVNET,pebbledb,ledger -TESTNET_BUILD_FLAGS := -ldflags '$(ldflags)' -tags TESTNET,pebbledb,ledger -MOCK_MAINNET_BUILD_FLAGS := -ldflags '$(ldflags)' -tags MOCK_MAINNET,pebbledb,ledger -MAINNET_BUILD_FLAGS := -ldflags '$(ldflags)' -tags pebbledb,ledger +BUILD_FLAGS := -ldflags '$(ldflags)' -tags pebbledb,ledger TEST_DIR?="./..." -TEST_BUILD_FLAGS := -tags TESTNET,pebbledb,ledger -PRIV_BUILD_FLAGS := -tags PRIVNET,pebbledb,ledger -HSM_BUILD_FLAGS := -tags TESTNET,pebbled,ledger,hsm_test +TEST_BUILD_FLAGS := -tags pebbledb,ledger +HSM_BUILD_FLAGS := -tags pebbledb,ledger,hsm_test clean: clean-binaries clean-dir clean-test-dir clean-coverage @@ -40,6 +36,22 @@ clean-dir: all: install +go.sum: go.mod + @echo "--> Ensure dependencies have not been modified" + GO111MODULE=on go mod verify + +############################################################################### +### Test commands ### +############################################################################### + +run-test: + @go test ${TEST_BUILD_FLAGS} ${TEST_DIR} + +test :clean-test-dir run-test + +test-hsm: + @go test ${HSM_BUILD_FLAGS} ${TEST_DIR} + test-coverage-exclude-core: @go test ${TEST_BUILD_FLAGS} -v -coverprofile coverage.out $(go list ./... | grep -v /x/zetacore/) @@ -58,24 +70,9 @@ clean-test-dir: @rm -rf x/crosschain/client/querytests/.zetacored @rm -rf x/observer/client/querytests/.zetacored -run-test: - @go test ${TEST_BUILD_FLAGS} ${TEST_DIR} - -test :clean-test-dir run-test - -test-priv: - @go test ${PRIV_BUILD_FLAGS} ${TEST_DIR} - -test-hsm: - @go test ${HSM_BUILD_FLAGS} ${TEST_DIR} - -gosec: - gosec -exclude-dir=localnet ./... - -install-testnet: go.sum - @echo "--> Installing zetacored & zetaclientd" - @go install -mod=readonly $(TESTNET_BUILD_FLAGS) ./cmd/zetacored - @go install -mod=readonly $(TESTNET_BUILD_FLAGS) ./cmd/zetaclientd +############################################################################### +### Install commands ### +############################################################################### build-testnet-ubuntu: go.sum docker build -t zetacore-ubuntu --platform linux/amd64 -f ./Dockerfile-athens3-ubuntu . @@ -89,44 +86,26 @@ install: go.sum @go install -race -mod=readonly $(BUILD_FLAGS) ./cmd/zetacored @go install -race -mod=readonly $(BUILD_FLAGS) ./cmd/zetaclientd -install-mainnet: go.sum - @echo "--> Installing zetacored & zetaclientd" - @go install -mod=readonly $(MAINNET_BUILD_FLAGS) ./cmd/zetacored - @go install -mod=readonly $(MAINNET_BUILD_FLAGS) ./cmd/zetaclientd - -install-mock-mainnet: go.sum - @echo "--> Installing zetacored & zetaclientd" - @go install -mod=readonly $(MOCK_MAINNET_BUILD_FLAGS) ./cmd/zetacored - @go install -mod=readonly $(MOCK_MAINNET_BUILD_FLAGS) ./cmd/zetaclientd - - install-zetaclient: go.sum @echo "--> Installing zetaclientd" @go install -mod=readonly $(BUILD_FLAGS) ./cmd/zetaclientd -# running with race detector on will be slow -install-zetaclient-race-test-only-build: go.sum - @echo "--> Installing zetaclientd" - @go install -race -mod=readonly $(BUILD_FLAGS) ./cmd/zetaclientd - install-zetacore: go.sum @echo "--> Installing zetacored" @go install -mod=readonly $(BUILD_FLAGS) ./cmd/zetacored -install-zetacore-testnet: go.sum - @echo "--> Installing zetacored" - @go install -mod=readonly $(TESTNET_BUILD_FLAGS) ./cmd/zetacored +# running with race detector on will be slow +install-zetaclient-race-test-only-build: go.sum + @echo "--> Installing zetaclientd" + @go install -race -mod=readonly $(BUILD_FLAGS) ./cmd/zetaclientd install-smoketest: go.sum @echo "--> Installing orchestrator" - @go install -mod=readonly $(BUILD_FLAGS) ./contrib/localnet/orchestrator/smoketest - -go.sum: go.mod - @echo "--> Ensure dependencies have not been modified" - GO111MODULE=on go mod verify + @go install -mod=readonly $(BUILD_FLAGS) ./contrib/localnet/orchestrator/smoketest/cmd/smoketest -test-cctx: - ./standalone-network/cctx-creator.sh +############################################################################### +### Local network ### +############################################################################### init: ./standalone-network/init.sh @@ -140,12 +119,12 @@ chain-stop: @killall zetacored @killall tail +test-cctx: + ./standalone-network/cctx-creator.sh -chain-init-testnet: clean install-zetacore-testnet init -chain-run-testnet: clean install-zetacore-testnet init run - -chain-init-mock-mainnet: clean install-mock-mainnet init -chain-run-mock-mainnet: clean install-mock-mainnet init run +############################################################################### +### Linting ### +############################################################################### lint-pre: @test -z $(gofmt -l .) @@ -157,6 +136,13 @@ lint: lint-pre lint-cosmos-gosec: @bash ./scripts/cosmos-gosec.sh +gosec: + gosec -exclude-dir=localnet ./... + +############################################################################### +### Generation commands ### +############################################################################### + proto: @echo "--> Removing old Go types " @find . -name '*.pb.go' -type f -delete @@ -197,7 +183,7 @@ generate: proto openapi specs typescript docs-zetacored .PHONY: generate ############################################################################### -### Docker Images ### +### Smoke tests ### ############################################################################### zetanode: @@ -241,13 +227,19 @@ stateful-upgrade: $(DOCKER) build -t orchestrator -f contrib/localnet/orchestrator/Dockerfile-upgrade.fastbuild . cd contrib/localnet/ && $(DOCKER) compose -f docker-compose-stateful.yml up -d +stateful-upgrade-source: + @echo "--> Starting stateful smoketest" + $(DOCKER) build --build-arg old_version=v10.1.7 -t zetanode -f ./Dockerfile-versioned-source . + $(DOCKER) build -t orchestrator -f contrib/localnet/orchestrator/Dockerfile-upgrade.fastbuild . + cd contrib/localnet/ && $(DOCKER) compose -f docker-compose-stateful.yml up -d + stop-stateful-upgrade: cd contrib/localnet/ && $(DOCKER) compose -f docker-compose-stateful.yml down --remove-orphans - ############################################################################### ### GoReleaser ### ############################################################################### + PACKAGE_NAME := github.com/zeta-chain/node GOLANG_CROSS_VERSION ?= v1.20 GOPATH ?= '$(HOME)/go' diff --git a/app/ante/ante.go b/app/ante/ante.go index e45378b175..7d9586edfb 100644 --- a/app/ante/ante.go +++ b/app/ante/ante.go @@ -19,6 +19,7 @@ import ( "fmt" "runtime/debug" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ethante "github.com/evmos/ethermint/app/ante" cctxtypes "github.com/zeta-chain/zetacore/x/crosschain/types" @@ -96,14 +97,19 @@ func NewAnteHandler(options ethante.HandlerOptions) (sdk.AnteHandler, error) { found := false for _, msg := range tx.GetMsgs() { switch msg.(type) { - // treat these two msg types differently because they might call EVM which results in massive gas consumption + // treat these three msg types differently because they might call EVM which results in massive gas consumption // For these two msg types, we don't check gas limit by using a different ante handler case *cctxtypes.MsgGasPriceVoter, *cctxtypes.MsgVoteOnObservedInboundTx: found = true break + case *stakingtypes.MsgCreateValidator: + if ctx.BlockHeight() == 0 { + found = true + break + } } } - if found { + if len(tx.GetMsgs()) == 1 && found { // this differs newCosmosAnteHandler only in that it doesn't check gas limit // by using an Infinite Gas Meter. anteHandler = newCosmosAnteHandlerNoGasLimit(options) diff --git a/app/ante/fees.go b/app/ante/fees.go new file mode 100644 index 0000000000..adb0fef13d --- /dev/null +++ b/app/ante/fees.go @@ -0,0 +1,239 @@ +// Copyright 2021 Evmos Foundation +// This file is part of Evmos' Ethermint library. +// +// The Ethermint library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The Ethermint library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE + +// Copyright 2023 ZetaChain +// modified to exclude gentx transaction type from the min gas price check +package ante + +import ( + "math/big" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + errortypes "github.com/cosmos/cosmos-sdk/types/errors" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + ethtypes "github.com/ethereum/go-ethereum/core/types" + evmtypes "github.com/evmos/ethermint/x/evm/types" +) + +// MinGasPriceDecorator will check if the transaction's fee is at least as large +// as the MinGasPrices param. If fee is too low, decorator returns error and tx +// is rejected. This applies for both CheckTx and DeliverTx +// If fee is high enough, then call next AnteHandler +// CONTRACT: Tx must implement FeeTx to use MinGasPriceDecorator +type MinGasPriceDecorator struct { + feesKeeper FeeMarketKeeper + evmKeeper EVMKeeper +} + +// EthMinGasPriceDecorator will check if the transaction's fee is at least as large +// as the MinGasPrices param. If fee is too low, decorator returns error and tx +// is rejected. This applies to both CheckTx and DeliverTx and regardless +// if London hard fork or fee market params (EIP-1559) are enabled. +// If fee is high enough, then call next AnteHandler +type EthMinGasPriceDecorator struct { + feesKeeper FeeMarketKeeper + evmKeeper EVMKeeper +} + +// EthMempoolFeeDecorator will check if the transaction's effective fee is at least as large +// as the local validator's minimum gasFee (defined in validator config). +// If fee is too low, decorator returns error and tx is rejected from mempool. +// Note this only applies when ctx.CheckTx = true +// If fee is high enough or not CheckTx, then call next AnteHandler +// CONTRACT: Tx must implement FeeTx to use MempoolFeeDecorator +type EthMempoolFeeDecorator struct { + evmKeeper EVMKeeper +} + +// NewMinGasPriceDecorator creates a new MinGasPriceDecorator instance used only for +// Cosmos transactions. +func NewMinGasPriceDecorator(fk FeeMarketKeeper, ek EVMKeeper) MinGasPriceDecorator { + return MinGasPriceDecorator{feesKeeper: fk, evmKeeper: ek} +} + +// NewEthMinGasPriceDecorator creates a new MinGasPriceDecorator instance used only for +// Ethereum transactions. +func NewEthMinGasPriceDecorator(fk FeeMarketKeeper, ek EVMKeeper) EthMinGasPriceDecorator { + return EthMinGasPriceDecorator{feesKeeper: fk, evmKeeper: ek} +} + +// NewEthMempoolFeeDecorator creates a new NewEthMempoolFeeDecorator instance used only for +// Ethereum transactions. +func NewEthMempoolFeeDecorator(ek EVMKeeper) EthMempoolFeeDecorator { + return EthMempoolFeeDecorator{ + evmKeeper: ek, + } +} + +func (mpd MinGasPriceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { + feeTx, ok := tx.(sdk.FeeTx) + if !ok { + return ctx, errorsmod.Wrapf(errortypes.ErrInvalidType, "invalid transaction type %T, expected sdk.FeeTx", tx) + } + + minGasPrice := mpd.feesKeeper.GetParams(ctx).MinGasPrice + + // Short-circuit if min gas price is 0 or if simulating + if minGasPrice.IsZero() || simulate { + return next(ctx, tx, simulate) + } + + // Short-circuit genesis txs gentx + if len(tx.GetMsgs()) == 1 { + if _, ok := tx.GetMsgs()[0].(*stakingtypes.MsgCreateValidator); ok { + return next(ctx, tx, simulate) + } + } + + evmParams := mpd.evmKeeper.GetParams(ctx) + evmDenom := evmParams.GetEvmDenom() + minGasPrices := sdk.DecCoins{ + { + Denom: evmDenom, + Amount: minGasPrice, + }, + } + + feeCoins := feeTx.GetFee() + gas := feeTx.GetGas() + + requiredFees := make(sdk.Coins, 0) + + // Determine the required fees by multiplying each required minimum gas + // price by the gas limit, where fee = ceil(minGasPrice * gasLimit). + gasLimit := sdk.NewDecFromBigInt(new(big.Int).SetUint64(gas)) + + for _, gp := range minGasPrices { + fee := gp.Amount.Mul(gasLimit).Ceil().RoundInt() + if fee.IsPositive() { + requiredFees = requiredFees.Add(sdk.Coin{Denom: gp.Denom, Amount: fee}) + } + } + + if !feeCoins.IsAnyGTE(requiredFees) { + return ctx, errorsmod.Wrapf(errortypes.ErrInsufficientFee, + "provided fee < minimum global fee (%s < %s). Please increase the gas price.", + feeCoins, + requiredFees) + } + + return next(ctx, tx, simulate) +} + +// AnteHandle ensures that the that the effective fee from the transaction is greater than the +// minimum global fee, which is defined by the MinGasPrice (parameter) * GasLimit (tx argument). +func (empd EthMinGasPriceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { + minGasPrice := empd.feesKeeper.GetParams(ctx).MinGasPrice + + // short-circuit if min gas price is 0 + if minGasPrice.IsZero() { + return next(ctx, tx, simulate) + } + + evmParams := empd.evmKeeper.GetParams(ctx) + chainCfg := evmParams.GetChainConfig() + ethCfg := chainCfg.EthereumConfig(empd.evmKeeper.ChainID()) + baseFee := empd.evmKeeper.GetBaseFee(ctx, ethCfg) + + for _, msg := range tx.GetMsgs() { + ethMsg, ok := msg.(*evmtypes.MsgEthereumTx) + if !ok { + return ctx, errorsmod.Wrapf( + errortypes.ErrUnknownRequest, + "invalid message type %T, expected %T", + msg, (*evmtypes.MsgEthereumTx)(nil), + ) + } + + feeAmt := ethMsg.GetFee() + + // For dynamic transactions, GetFee() uses the GasFeeCap value, which + // is the maximum gas price that the signer can pay. In practice, the + // signer can pay less, if the block's BaseFee is lower. So, in this case, + // we use the EffectiveFee. If the feemarket formula results in a BaseFee + // that lowers EffectivePrice until it is < MinGasPrices, the users must + // increase the GasTipCap (priority fee) until EffectivePrice > MinGasPrices. + // Transactions with MinGasPrices * gasUsed < tx fees < EffectiveFee are rejected + // by the feemarket AnteHandle + + txData, err := evmtypes.UnpackTxData(ethMsg.Data) + if err != nil { + return ctx, errorsmod.Wrapf(err, "failed to unpack tx data %s", ethMsg.Hash) + } + + if txData.TxType() != ethtypes.LegacyTxType { + feeAmt = ethMsg.GetEffectiveFee(baseFee) + } + + gasLimit := sdk.NewDecFromBigInt(new(big.Int).SetUint64(ethMsg.GetGas())) + + requiredFee := minGasPrice.Mul(gasLimit) + fee := sdk.NewDecFromBigInt(feeAmt) + + if fee.LT(requiredFee) { + return ctx, errorsmod.Wrapf( + errortypes.ErrInsufficientFee, + "provided fee < minimum global fee (%d < %d). Please increase the priority tip (for EIP-1559 txs) or the gas prices (for access list or legacy txs)", //nolint:lll + fee.TruncateInt().Int64(), requiredFee.TruncateInt().Int64(), + ) + } + } + + return next(ctx, tx, simulate) +} + +// AnteHandle ensures that the provided fees meet a minimum threshold for the validator. +// This check only for local mempool purposes, and thus it is only run on (Re)CheckTx. +// The logic is also skipped if the London hard fork and EIP-1559 are enabled. +func (mfd EthMempoolFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { + if !ctx.IsCheckTx() || simulate { + return next(ctx, tx, simulate) + } + evmParams := mfd.evmKeeper.GetParams(ctx) + chainCfg := evmParams.GetChainConfig() + ethCfg := chainCfg.EthereumConfig(mfd.evmKeeper.ChainID()) + + baseFee := mfd.evmKeeper.GetBaseFee(ctx, ethCfg) + // skip check as the London hard fork and EIP-1559 are enabled + if baseFee != nil { + return next(ctx, tx, simulate) + } + + evmDenom := evmParams.GetEvmDenom() + minGasPrice := ctx.MinGasPrices().AmountOf(evmDenom) + + for _, msg := range tx.GetMsgs() { + ethMsg, ok := msg.(*evmtypes.MsgEthereumTx) + if !ok { + return ctx, errorsmod.Wrapf(errortypes.ErrUnknownRequest, "invalid message type %T, expected %T", msg, (*evmtypes.MsgEthereumTx)(nil)) + } + + fee := sdk.NewDecFromBigInt(ethMsg.GetFee()) + gasLimit := sdk.NewDecFromBigInt(new(big.Int).SetUint64(ethMsg.GetGas())) + requiredFee := minGasPrice.Mul(gasLimit) + + if fee.LT(requiredFee) { + return ctx, errorsmod.Wrapf( + errortypes.ErrInsufficientFee, + "insufficient fee; got: %s required: %s", + fee, requiredFee, + ) + } + } + + return next(ctx, tx, simulate) +} diff --git a/app/ante/handler_options.go b/app/ante/handler_options.go index 3745b3aad3..5fe40847e9 100644 --- a/app/ante/handler_options.go +++ b/app/ante/handler_options.go @@ -101,7 +101,7 @@ func newCosmosAnteHandlerNoGasLimit(options ethante.HandlerOptions) sdk.AnteHand ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker), ante.NewValidateBasicDecorator(), ante.NewTxTimeoutHeightDecorator(), - ethante.NewMinGasPriceDecorator(options.FeeMarketKeeper, options.EvmKeeper), + NewMinGasPriceDecorator(options.FeeMarketKeeper, options.EvmKeeper), ante.NewValidateMemoDecorator(options.AccountKeeper), ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper), ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker), diff --git a/app/app.go b/app/app.go index c401b2f243..a25a9c7095 100644 --- a/app/app.go +++ b/app/app.go @@ -96,17 +96,17 @@ import ( "github.com/zeta-chain/zetacore/docs/openapi" srvflags "github.com/zeta-chain/zetacore/server/flags" - zetaCoreModule "github.com/zeta-chain/zetacore/x/crosschain" - zetaCoreModuleKeeper "github.com/zeta-chain/zetacore/x/crosschain/keeper" - zetaCoreModuleTypes "github.com/zeta-chain/zetacore/x/crosschain/types" + crosschainmodule "github.com/zeta-chain/zetacore/x/crosschain" + crosschainkeeper "github.com/zeta-chain/zetacore/x/crosschain/keeper" + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" fungibleModule "github.com/zeta-chain/zetacore/x/fungible" fungibleModuleKeeper "github.com/zeta-chain/zetacore/x/fungible/keeper" fungibleModuleTypes "github.com/zeta-chain/zetacore/x/fungible/types" - zetaObserverModule "github.com/zeta-chain/zetacore/x/observer" - zetaObserverModuleKeeper "github.com/zeta-chain/zetacore/x/observer/keeper" - zetaObserverModuleTypes "github.com/zeta-chain/zetacore/x/observer/types" + observermodule "github.com/zeta-chain/zetacore/x/observer" + observerkeeper "github.com/zeta-chain/zetacore/x/observer/keeper" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) const Name = "zetacore" @@ -174,8 +174,8 @@ var ( vesting.AppModuleBasic{}, evm.AppModuleBasic{}, feemarket.AppModuleBasic{}, - zetaCoreModule.AppModuleBasic{}, - zetaObserverModule.AppModuleBasic{}, + crosschainmodule.AppModuleBasic{}, + observermodule.AppModuleBasic{}, fungibleModule.AppModuleBasic{}, emissionsModule.AppModuleBasic{}, groupmodule.AppModuleBasic{}, @@ -189,7 +189,7 @@ var ( stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, govtypes.ModuleName: {authtypes.Burner}, - zetaCoreModuleTypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + crosschaintypes.ModuleName: {authtypes.Minter, authtypes.Burner}, evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, fungibleModuleTypes.ModuleName: {authtypes.Minter, authtypes.Burner}, emissionsModuleTypes.ModuleName: nil, @@ -227,8 +227,8 @@ type App struct { UpgradeKeeper upgradekeeper.Keeper ParamsKeeper paramskeeper.Keeper EvidenceKeeper evidencekeeper.Keeper - ZetaCoreKeeper zetaCoreModuleKeeper.Keeper - ZetaObserverKeeper *zetaObserverModuleKeeper.Keeper + ZetaCoreKeeper crosschainkeeper.Keeper + ZetaObserverKeeper *observerkeeper.Keeper mm *module.Manager sm *module.SimulationManager configurator module.Configurator @@ -269,8 +269,8 @@ func New( group.StoreKey, upgradetypes.StoreKey, evidencetypes.StoreKey, - zetaCoreModuleTypes.StoreKey, - zetaObserverModuleTypes.StoreKey, + crosschaintypes.StoreKey, + observertypes.StoreKey, evmtypes.StoreKey, feemarkettypes.StoreKey, fungibleModuleTypes.StoreKey, emissionsModuleTypes.StoreKey, @@ -326,11 +326,11 @@ func New( app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) - app.ZetaObserverKeeper = zetaObserverModuleKeeper.NewKeeper( + app.ZetaObserverKeeper = observerkeeper.NewKeeper( appCodec, - keys[zetaObserverModuleTypes.StoreKey], - keys[zetaObserverModuleTypes.MemStoreKey], - app.GetSubspace(zetaObserverModuleTypes.ModuleName), + keys[observertypes.StoreKey], + keys[observertypes.MemStoreKey], + app.GetSubspace(observertypes.ModuleName), &stakingKeeper, app.SlashingKeeper, ) @@ -384,12 +384,12 @@ func New( app.ZetaObserverKeeper, ) - app.ZetaCoreKeeper = *zetaCoreModuleKeeper.NewKeeper( + app.ZetaCoreKeeper = *crosschainkeeper.NewKeeper( appCodec, - keys[zetaCoreModuleTypes.StoreKey], - keys[zetaCoreModuleTypes.MemStoreKey], + keys[crosschaintypes.StoreKey], + keys[crosschaintypes.MemStoreKey], &stakingKeeper, - app.GetSubspace(zetaCoreModuleTypes.ModuleName), + app.GetSubspace(crosschaintypes.ModuleName), app.AccountKeeper, app.BankKeeper, app.ZetaObserverKeeper, @@ -464,8 +464,8 @@ func New( groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, interfaceRegistry), evm.NewAppModule(app.EvmKeeper, app.AccountKeeper, evmSs), feemarket.NewAppModule(app.FeeMarketKeeper, feeSs), - zetaCoreModule.NewAppModule(appCodec, app.ZetaCoreKeeper, app.StakingKeeper, app.AccountKeeper), - zetaObserverModule.NewAppModule(appCodec, *app.ZetaObserverKeeper, app.AccountKeeper, app.BankKeeper), + crosschainmodule.NewAppModule(appCodec, app.ZetaCoreKeeper, app.StakingKeeper, app.AccountKeeper), + observermodule.NewAppModule(appCodec, *app.ZetaObserverKeeper, app.AccountKeeper, app.BankKeeper), fungibleModule.NewAppModule(appCodec, app.FungibleKeeper, app.AccountKeeper, app.BankKeeper), emissionsModule.NewAppModule(appCodec, app.EmissionsKeeper, app.AccountKeeper), authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), @@ -492,8 +492,8 @@ func New( group.ModuleName, vestingtypes.ModuleName, feemarkettypes.ModuleName, - zetaCoreModuleTypes.ModuleName, - zetaObserverModuleTypes.ModuleName, + crosschaintypes.ModuleName, + observertypes.ModuleName, fungibleModuleTypes.ModuleName, emissionsModuleTypes.ModuleName, authz.ModuleName, @@ -514,8 +514,8 @@ func New( crisistypes.ModuleName, evmtypes.ModuleName, feemarkettypes.ModuleName, - zetaCoreModuleTypes.ModuleName, - zetaObserverModuleTypes.ModuleName, + crosschaintypes.ModuleName, + observertypes.ModuleName, fungibleModuleTypes.ModuleName, emissionsModuleTypes.ModuleName, authz.ModuleName, @@ -526,6 +526,7 @@ func New( // NOTE: Capability module must occur first so that it can initialize any capabilities // so that other modules that want to create or claim capabilities afterwards in InitChain // can do so safely. + // NOTE: Cross-chain module must be initialized after observer module, as pending nonces in crosschain needs the tss pubkey from observer module app.mm.SetOrderInitGenesis( authtypes.ModuleName, banktypes.ModuleName, @@ -542,8 +543,8 @@ func New( upgradetypes.ModuleName, evidencetypes.ModuleName, vestingtypes.ModuleName, - zetaCoreModuleTypes.ModuleName, - zetaObserverModuleTypes.ModuleName, + observertypes.ModuleName, + crosschaintypes.ModuleName, fungibleModuleTypes.ModuleName, emissionsModuleTypes.ModuleName, authz.ModuleName, @@ -753,8 +754,8 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(evmtypes.ModuleName) paramsKeeper.Subspace(feemarkettypes.ModuleName) paramsKeeper.Subspace(group.ModuleName) - paramsKeeper.Subspace(zetaCoreModuleTypes.ModuleName) - paramsKeeper.Subspace(zetaObserverModuleTypes.ModuleName) + paramsKeeper.Subspace(crosschaintypes.ModuleName) + paramsKeeper.Subspace(observertypes.ModuleName) paramsKeeper.Subspace(fungibleModuleTypes.ModuleName) paramsKeeper.Subspace(emissionsModuleTypes.ModuleName) return paramsKeeper diff --git a/app/setup_handlers.go b/app/setup_handlers.go index 18a8ae1f62..1a8cb053a3 100644 --- a/app/setup_handlers.go +++ b/app/setup_handlers.go @@ -5,10 +5,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/upgrade/types" - observertypes "github.com/zeta-chain/zetacore/x/observer/types" + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" ) -const releaseVersion = "v10.1.0" +const releaseVersion = "v11.0.0" func SetupHandlers(app *App) { app.UpgradeKeeper.SetUpgradeHandler(releaseVersion, func(ctx sdk.Context, plan types.Plan, vm module.VersionMap) (module.VersionMap, error) { @@ -17,7 +17,7 @@ func SetupHandlers(app *App) { for m, mb := range app.mm.Modules { vm[m] = mb.ConsensusVersion() } - vm[observertypes.ModuleName] = vm[observertypes.ModuleName] - 1 + vm[crosschaintypes.ModuleName] = vm[crosschaintypes.ModuleName] - 1 return app.mm.RunMigrations(ctx, app.configurator, vm) }) diff --git a/changelog.md b/changelog.md index c8377bbf16..7f62ab33bb 100644 --- a/changelog.md +++ b/changelog.md @@ -2,23 +2,52 @@ ## Unreleased +### Breaking Changes +- PendingNonces :Changed from `/zeta-chain/crosschain/pendingNonces/{chain_id}/{address}` to `/zeta-chain/observer/pendingNonces/{chain_id}/{address}` . It returns all the pending nonces for a chain id and address. This returns the current pending nonces for the chain. +- ChainNonces : Changed from `/zeta-chain/criosschain/chainNonces/{chain_id}` to`/zeta-chain/observer/chainNonces/{chain_id}` . It returns all the chain nonces for a chain id. This returns the current nonce oof the TSS address for the chain. +- ChainNoncesAll :Changed from `/zeta-chain/observer/chainNonces` to `/zeta-chain/observer/chainNonces` . It returns all the chain nonces for all chains. This returns the current nonce of the TSS address for all chains. + ### Features +* [1395](https://github.com/zeta-chain/node/pull/1395) - Add state variable to track aborted zeta amount * [1387](https://github.com/zeta-chain/node/pull/1387) - Add HSM capability for zetaclient hot key * [1410](https://github.com/zeta-chain/node/pull/1410) - `snapshots` commands +* enable zetaclients to use dynamic gas price on zetachain - enables >0 min_gas_price in feemarket module +* add static chain data for Sepolia testnet +* added metrics to track the burn rate of the hotkey in the telemetry server as well as prometheus ### Fixes - +* fix go-staticcheck warnings for zetaclient +* fix Athens-3 issue - incorrect pending-tx inclusion and incorrect confirmation count +* 6582f6b42f4f0eb0358e6fdefe5278295c791166 - masked zetaclient config at startup +* 1b8fdd3394c35afa47e830a5858b3c5c133fad8e - Added check for redeployment of gas and asset token contracts * [1372](https://github.com/zeta-chain/node/pull/1372) - Include Event Index as part for inbound tx digest * [1367](https://github.com/zeta-chain/node/pull/1367) - fix minRelayTxFee issue and check misuse of bitcoin mainnet/testnet addresses * [1358](https://github.com/zeta-chain/node/pull/1358) - add a new thread to zetaclient which checks zeta supply in all connected chains in every block +* prevent deposits for paused zrc20 * [1406](https://github.com/zeta-chain/node/pull/1406) - improve log prints and speed up evm outtx inclusion +* fix Athens-3 issue - include bitcoin outtx regardless of the cctx status +* set limit for queried pending cctxs +* add check to verify new tss has been produced when triggering tss funds migration +* fix Athens-3 log print issue - avoid posting uncessary outtx confirmation +* fix docker build issues with version: golang:1.20-alpine3.18 ### Refactoring +* [1211](https://github.com/zeta-chain/node/issues/1211) - use `grpc` and `msg` for query and message files +* refactor cctx scheduler - decouple evm cctx scheduler from btc cctx scheduler +* [1391](https://github.com/zeta-chain/node/pull/1391) - consolidate node builds +* update `MsgUpdateContractBytecode` to use code hash instead of contract address +* move tss state from crosschain to observer +* move pending nonces, chain nonces and nonce to cctx to observer +* move tss related cli from crosschain to observer +* reorganize smoke tests structure +* Add pagination to queries which iterate over large data sets InTxTrackerAll ,PendingNoncesAll ,AllBlameRecord ,TssHistory +* GetTssAddress now returns only the current tss address for ETH and BTC +* Add a new query GetTssAddressesByFinalizedBlockHeight to get any other tss addresses for a finalized block height ### Chores ### Tests - +- Add unit tests for adding votes to a ballot ### CI ## Version: v10.1.2 diff --git a/cmd/config_mock_mainnet.go b/cmd/config.go similarity index 82% rename from cmd/config_mock_mainnet.go rename to cmd/config.go index c8f775c61c..978d90c433 100644 --- a/cmd/config_mock_mainnet.go +++ b/cmd/config.go @@ -1,6 +1,3 @@ -//go:build MOCK_MAINNET -// +build MOCK_MAINNET - package cmd const ( @@ -11,6 +8,5 @@ const ( Bech32PrefixConsAddr = "zetac" Bech32PrefixConsPub = "zetacpub" DenomRegex = `[a-zA-Z][a-zA-Z0-9:\\/\\\-\\_\\.]{2,127}` - ZetaChainCoinType uint32 = 60 ZetaChainHDPath string = `m/44'/60'/0'/0/0` ) diff --git a/cmd/config_mainnet.go b/cmd/config_mainnet.go deleted file mode 100644 index dcc8c4f9e2..0000000000 --- a/cmd/config_mainnet.go +++ /dev/null @@ -1,16 +0,0 @@ -//go:build !PRIVNET && !TESTNET && !MOCK_MAINNET -// +build !PRIVNET,!TESTNET,!MOCK_MAINNET - -package cmd - -const ( - Bech32PrefixAccAddr = "zeta" - Bech32PrefixAccPub = "zetapub" - Bech32PrefixValAddr = "zetav" - Bech32PrefixValPub = "zetavpub" - Bech32PrefixConsAddr = "zetac" - Bech32PrefixConsPub = "zetacpub" - DenomRegex = `[a-zA-Z][a-zA-Z0-9:\\/\\\-\\_\\.]{2,127}` - ZetaChainCoinType uint32 = 60 - ZetaChainHDPath string = `m/44'/60'/0'/0/0` -) diff --git a/cmd/config_privnet.go b/cmd/config_privnet.go deleted file mode 100644 index 0f95268c18..0000000000 --- a/cmd/config_privnet.go +++ /dev/null @@ -1,21 +0,0 @@ -//go:build PRIVNET -// +build PRIVNET - -package cmd - -const ( - Bech32PrefixAccAddr = "zeta" - Bech32PrefixAccPub = "zetapub" - Bech32PrefixValAddr = "zetav" - Bech32PrefixValPub = "zetavpub" - Bech32PrefixConsAddr = "zetac" - Bech32PrefixConsPub = "zetacpub" - DenomRegex = `[a-zA-Z][a-zA-Z0-9:\\/\\\-\\_\\.]{2,127}` - ZetaChainCoinType uint32 = 60 - ZetaChainHDPath string = `m/44'/60'/0'/0/0` - NET = "PRIVNET" -) - -var ( - CHAINID = "athens_101-1" -) diff --git a/cmd/config_testnet.go b/cmd/config_testnet.go deleted file mode 100644 index 12f92d7c38..0000000000 --- a/cmd/config_testnet.go +++ /dev/null @@ -1,21 +0,0 @@ -//go:build TESTNET -// +build TESTNET - -package cmd - -const ( - Bech32PrefixAccAddr = "zeta" - Bech32PrefixAccPub = "zetapub" - Bech32PrefixValAddr = "zetav" - Bech32PrefixValPub = "zetavpub" - Bech32PrefixConsAddr = "zetac" - Bech32PrefixConsPub = "zetacpub" - DenomRegex = `[a-zA-Z][a-zA-Z0-9:\\/\\\-\\_\\.]{2,127}` - ZetaChainCoinType uint32 = 60 - ZetaChainHDPath string = `m/44'/60'/0'/0/0` - NET = "TESTNET" -) - -var ( - CHAINID = "athens_7001-1" -) diff --git a/cmd/zetaclientd/aux.go b/cmd/zetaclientd/aux.go index 8f447340ae..d583228d48 100644 --- a/cmd/zetaclientd/aux.go +++ b/cmd/zetaclientd/aux.go @@ -15,7 +15,7 @@ func CreateAuthzSigner(granter string, grantee sdk.AccAddress) { zetaclient.SetupAuthZSignerList(granter, grantee) } -func CreateZetaBridge(cfg *config.Config) (*zetaclient.ZetaCoreBridge, error) { +func CreateZetaBridge(cfg *config.Config, telemetry *zetaclient.TelemetryServer) (*zetaclient.ZetaCoreBridge, error) { hotKey := cfg.AuthzHotkey if cfg.HsmMode { hotKey = cfg.HsmHotKey @@ -35,7 +35,7 @@ func CreateZetaBridge(cfg *config.Config) (*zetaclient.ZetaCoreBridge, error) { k := zetaclient.NewKeysWithKeybase(kb, granterAddreess, cfg.AuthzHotkey) - bridge, err := zetaclient.NewZetaCoreBridge(k, chainIP, hotKey, cfg.ChainID, cfg.HsmMode) + bridge, err := zetaclient.NewZetaCoreBridge(k, chainIP, hotKey, cfg.ChainID, cfg.HsmMode, telemetry) if err != nil { return nil, err } diff --git a/cmd/zetaclientd/debug.go b/cmd/zetaclientd/debug.go index c9ebb3dba4..f2624cc762 100644 --- a/cmd/zetaclientd/debug.go +++ b/cmd/zetaclientd/debug.go @@ -53,7 +53,23 @@ func DebugCmd() *cobra.Command { txHash := args[0] var ballotIdentifier string chainLogger := zerolog.New(io.Discard).Level(zerolog.Disabled) - bridge, err := zetaclient.NewZetaCoreBridge(&zetaclient.Keys{OperatorAddress: sdk.MustAccAddressFromBech32(sample.AccAddress())}, debugArgs.zetaNode, "", debugArgs.zetaChainID, false) + + telemetryServer := zetaclient.NewTelemetryServer() + go func() { + err := telemetryServer.Start() + if err != nil { + panic("telemetryServer error") + } + }() + + bridge, err := zetaclient.NewZetaCoreBridge( + &zetaclient.Keys{OperatorAddress: sdk.MustAccAddressFromBech32(sample.AccAddress())}, + debugArgs.zetaNode, + "", + debugArgs.zetaChainID, + false, + telemetryServer) + if err != nil { return err } diff --git a/cmd/zetaclientd/keygen_tss.go b/cmd/zetaclientd/keygen_tss.go index f30070cb62..0b21f880ff 100644 --- a/cmd/zetaclientd/keygen_tss.go +++ b/cmd/zetaclientd/keygen_tss.go @@ -14,16 +14,40 @@ import ( "github.com/zeta-chain/go-tss/keygen" "github.com/zeta-chain/go-tss/p2p" "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/x/crosschain/types" - observerTypes "github.com/zeta-chain/zetacore/x/observer/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" mc "github.com/zeta-chain/zetacore/zetaclient" "github.com/zeta-chain/zetacore/zetaclient/config" "github.com/zeta-chain/zetacore/zetaclient/metrics" ) -func GenerateTss(logger zerolog.Logger, cfg *config.Config, zetaBridge *mc.ZetaCoreBridge, peers p2p.AddrList, priKey secp256k1.PrivKey, ts *mc.TelemetryServer, tssHistoricalList []types.TSS, metrics *metrics.Metrics) (*mc.TSS, error) { +func GenerateTss(logger zerolog.Logger, + cfg *config.Config, + zetaBridge *mc.ZetaCoreBridge, + peers p2p.AddrList, + priKey secp256k1.PrivKey, + ts *mc.TelemetryServer, + tssHistoricalList []observertypes.TSS, + metrics *metrics.Metrics) (*mc.TSS, error) { keygenLogger := logger.With().Str("module", "keygen").Logger() - tss, err := mc.NewTSS(peers, priKey, preParams, cfg, zetaBridge, tssHistoricalList, metrics) + + // Bitcoin chain ID is currently used for using the correct signature format + // TODO: remove this once we have a better way to determine the signature format + // https://github.com/zeta-chain/node/issues/1397 + bitcoinChainID := common.BtcRegtestChain().ChainId + if cfg.BitcoinConfig != nil { + bitcoinChainID = cfg.BitcoinConfig.ChainId + } + + tss, err := mc.NewTSS( + peers, + priKey, + preParams, + cfg, + zetaBridge, + tssHistoricalList, + metrics, + bitcoinChainID, + ) if err != nil { keygenLogger.Error().Err(err).Msg("NewTSS error") return nil, err @@ -45,16 +69,16 @@ func GenerateTss(logger zerolog.Logger, cfg *config.Config, zetaBridge *mc.ZetaC // If keygen is unsuccessful, it will reset the triedKeygenAtBlock flag and try again at a new keygen block. keyGen := cfg.GetKeygen() - if keyGen.Status == observerTypes.KeygenStatus_KeyGenSuccess { + if keyGen.Status == observertypes.KeygenStatus_KeyGenSuccess { return tss, nil } // Arrive at this stage only if keygen is unsuccessfully reported by every node . This will reset the flag and to try again at a new keygen block - if keyGen.Status == observerTypes.KeygenStatus_KeyGenFailed { + if keyGen.Status == observertypes.KeygenStatus_KeyGenFailed { triedKeygenAtBlock = false continue } // Try generating TSS at keygen block , only when status is pending keygen and generation has not been tried at the block - if keyGen.Status == observerTypes.KeygenStatus_PendingKeygen { + if keyGen.Status == observertypes.KeygenStatus_PendingKeygen { // Return error if RPC is not working currentBlock, err := zetaBridge.GetZetaBlockHeight() if err != nil { @@ -135,7 +159,7 @@ func keygenTss(cfg *config.Config, tss *mc.TSS, keygenLogger zerolog.Logger) err return err } index := fmt.Sprintf("keygen-%s-%d", digest, keyGen.BlockNumber) - zetaHash, err := tss.CoreBridge.PostBlameData(&res.Blame, common.ZetaChain().ChainId, index) + zetaHash, err := tss.CoreBridge.PostBlameData(&res.Blame, tss.CoreBridge.ZetaChain().ChainId, index) if err != nil { keygenLogger.Error().Err(err).Msg("error sending blame data to core") return err diff --git a/cmd/zetaclientd/start.go b/cmd/zetaclientd/start.go index 2b5a4fe934..99173be7ae 100644 --- a/cmd/zetaclientd/start.go +++ b/cmd/zetaclientd/start.go @@ -19,7 +19,6 @@ import ( "github.com/tendermint/tendermint/crypto/secp256k1" "github.com/zeta-chain/go-tss/p2p" "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/x/crosschain/types" observerTypes "github.com/zeta-chain/zetacore/x/observer/types" mc "github.com/zeta-chain/zetacore/zetaclient" "github.com/zeta-chain/zetacore/zetaclient/config" @@ -67,9 +66,18 @@ func start(_ *cobra.Command, _ []string) error { waitForZetaCore(cfg, startLogger) startLogger.Info().Msgf("ZetaCore is ready , Trying to connect to %s", cfg.Peer) + telemetryServer := mc.NewTelemetryServer() + go func() { + err := telemetryServer.Start() + if err != nil { + startLogger.Error().Err(err).Msg("telemetryServer error") + panic("telemetryServer error") + } + }() + // CreateZetaBridge: Zetabridge is used for all communication to zetacore , which this client connects to. // Zetacore accumulates votes , and provides a centralized source of truth for all clients - zetaBridge, err := CreateZetaBridge(cfg) + zetaBridge, err := CreateZetaBridge(cfg, telemetryServer) if err != nil { panic(err) } @@ -77,7 +85,7 @@ func start(_ *cobra.Command, _ []string) error { startLogger.Info().Msgf("ZetaBridge is ready") zetaBridge.SetAccountNumber(common.ZetaClientGranteeKey) - // cross check chainid + // cross-check chainid res, err := zetaBridge.GetNodeInfo() if err != nil { panic(err) @@ -86,7 +94,10 @@ func start(_ *cobra.Command, _ []string) error { if strings.Compare(res.GetDefaultNodeInfo().Network, cfg.ChainID) != 0 { startLogger.Warn().Msgf("chain id mismatch, zeta-core chain id %s, zeta client chain id %s; reset zeta client chain id", res.GetDefaultNodeInfo().Network, cfg.ChainID) cfg.ChainID = res.GetDefaultNodeInfo().Network - zetaBridge.UpdateChainID(cfg.ChainID) + err := zetaBridge.UpdateChainID(cfg.ChainID) + if err != nil { + return err + } } // CreateAuthzSigner : which is used to sign all authz messages . All votes broadcast to zetacore are wrapped in authz exec . @@ -100,7 +111,7 @@ func start(_ *cobra.Command, _ []string) error { startLogger.Error().Err(err).Msg("Error getting core parameters") return err } - startLogger.Info().Msgf("Config is updated from ZetaCore %s", cfg.String()) + startLogger.Info().Msgf("Config is updated from ZetaCore %s", maskCfg(cfg)) // ConfigUpdater: A polling goroutine checks and updates core parameters at every height. Zetacore stores core parameters for all clients go zetaBridge.ConfigUpdater(cfg) @@ -135,15 +146,6 @@ func start(_ *cobra.Command, _ []string) error { } } - telemetryServer := mc.NewTelemetryServer() - go func() { - err := telemetryServer.Start() - if err != nil { - startLogger.Error().Err(err).Msg("telemetryServer error") - panic("telemetryServer error") - } - }() - metrics, err := metrics2.NewMetrics() if err != nil { log.Error().Err(err).Msg("NewMetrics") @@ -151,7 +153,7 @@ func start(_ *cobra.Command, _ []string) error { } metrics.Start() - var tssHistoricalList []types.TSS + var tssHistoricalList []observerTypes.TSS tssHistoricalList, err = zetaBridge.GetTssHistory() if err != nil { startLogger.Error().Err(err).Msg("GetTssHistory error") @@ -243,14 +245,20 @@ func start(_ *cobra.Command, _ []string) error { mo1 := mc.NewCoreObserver(zetaBridge, signerMap, chainClientMap, metrics, masterLogger, cfg, telemetryServer) mo1.MonitorCore() - zetaSupplyChecker, err := mc.NewZetaSupplyChecker(cfg, zetaBridge, masterLogger) - if err != nil { - startLogger.Err(err).Msg("NewZetaSupplyChecker") - } - if err == nil { - zetaSupplyChecker.Start() - defer zetaSupplyChecker.Stop() - } + // start zeta supply checker + // TODO: enable + // https://github.com/zeta-chain/node/issues/1354 + // NOTE: this is disabled for now because we need to determine the frequency on how to handle invalid check + // The method uses GRPC query to the node we might need to improve for performance + //zetaSupplyChecker, err := mc.NewZetaSupplyChecker(cfg, zetaBridge, masterLogger) + //if err != nil { + // startLogger.Err(err).Msg("NewZetaSupplyChecker") + //} + //if err == nil { + // zetaSupplyChecker.Start() + // defer zetaSupplyChecker.Stop() + //} + startLogger.Info().Msgf("awaiting the os.Interrupt, syscall.SIGTERM signals...") ch := make(chan os.Signal, 1) signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM) diff --git a/cmd/zetaclientd/start_utils.go b/cmd/zetaclientd/start_utils.go index b3f08469e1..6367a5e2d8 100644 --- a/cmd/zetaclientd/start_utils.go +++ b/cmd/zetaclientd/start_utils.go @@ -3,6 +3,7 @@ package main import ( "fmt" "net" + "net/url" "strings" "time" @@ -49,3 +50,44 @@ func validatePeer(seedPeer string) error { return nil } + +// maskCfg sensitive fields are masked, currently only the EVM endpoints and bitcoin credentials, +// +// other fields can be added. +func maskCfg(cfg *config.Config) string { + maskedCfg := config.NewConfig() + + // Deep copy since cfg contains some references + *maskedCfg = *cfg + maskedCfg.BitcoinConfig = &config.BTCConfig{ + RPCUsername: cfg.BitcoinConfig.RPCUsername, + RPCPassword: cfg.BitcoinConfig.RPCPassword, + RPCHost: cfg.BitcoinConfig.RPCHost, + RPCParams: cfg.BitcoinConfig.RPCParams, + } + maskedCfg.EVMChainConfigs = map[int64]*config.EVMConfig{} + for key, val := range cfg.EVMChainConfigs { + maskedCfg.EVMChainConfigs[key] = &config.EVMConfig{ + CoreParams: val.CoreParams, + Chain: val.Chain, + Endpoint: val.Endpoint, + } + } + + // Mask Sensitive data + for _, chain := range maskedCfg.EVMChainConfigs { + if chain.Endpoint == "" { + continue + } + endpointURL, err := url.Parse(chain.Endpoint) + if err != nil { + continue + } + chain.Endpoint = endpointURL.Hostname() + } + + maskedCfg.BitcoinConfig.RPCUsername = "" + maskedCfg.BitcoinConfig.RPCPassword = "" + + return maskedCfg.String() +} diff --git a/cmd/zetacored/config/prefix_testnet.go b/cmd/zetacored/config/prefix_testnet.go deleted file mode 100644 index 8f3f628c88..0000000000 --- a/cmd/zetacored/config/prefix_testnet.go +++ /dev/null @@ -1,24 +0,0 @@ -//go:build testnet -// +build testnet - -package config - -import sdk "github.com/cosmos/cosmos-sdk/types" - -const ( - // Bech32Prefix defines the Bech32 prefix used for Cronos Accounts - Bech32Prefix = "tzeta" - - // Bech32PrefixAccAddr defines the Bech32 prefix of an account's address - Bech32PrefixAccAddr = Bech32Prefix - // Bech32PrefixAccPub defines the Bech32 prefix of an account's public key - Bech32PrefixAccPub = Bech32Prefix + sdk.PrefixPublic - // Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address - Bech32PrefixValAddr = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator - // Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key - Bech32PrefixValPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator + sdk.PrefixPublic - // Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address - Bech32PrefixConsAddr = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus - // Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key - Bech32PrefixConsPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic -) diff --git a/cmd/zetacored/config/prefix_mainnet.go b/cmd/zetacored/config/prefixes.go similarity index 96% rename from cmd/zetacored/config/prefix_mainnet.go rename to cmd/zetacored/config/prefixes.go index 5c148c9dd7..a96a4c57bc 100644 --- a/cmd/zetacored/config/prefix_mainnet.go +++ b/cmd/zetacored/config/prefixes.go @@ -1,6 +1,3 @@ -//go:build !testnet -// +build !testnet - package config import sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/cmd/zetacored/observer_accounts.go b/cmd/zetacored/observer_accounts.go index 397146a688..878f97cb15 100644 --- a/cmd/zetacored/observer_accounts.go +++ b/cmd/zetacored/observer_accounts.go @@ -77,6 +77,7 @@ func AddObserverAccountsCmd() *cobra.Command { var nodeAccounts []*types.NodeAccount var keygenPubKeys []string observersForChain := map[int64][]string{} + // DefaultChainsList is based on Build Flags supportedChains := common.DefaultChainsList() var balances []banktypes.Balance @@ -161,26 +162,26 @@ func AddObserverAccountsCmd() *cobra.Command { // Add node accounts to cross chain genesis state zetaCrossChainGenState := crosschaintypes.GetGenesisStateFromAppState(cdc, appState) - + tss := types.TSS{} if keyGenBlock == 0 { operatorList := make([]string, len(nodeAccounts)) for i, nodeAccount := range nodeAccounts { operatorList[i] = nodeAccount.Operator } - tss := crosschaintypes.TSS{ + tss = types.TSS{ TssPubkey: tssPubkey, TssParticipantList: keygenPubKeys, OperatorAddressList: operatorList, FinalizedZetaHeight: 0, KeyGenZetaHeight: 0, } - zetaCrossChainGenState.Tss = &tss } // Add observers to observer genesis state zetaObserverGenState := types.GetGenesisStateFromAppState(cdc, appState) zetaObserverGenState.Observers = observerMapper zetaObserverGenState.NodeAccountList = nodeAccounts + zetaObserverGenState.Tss = &tss keyGenStatus := types.KeygenStatus_PendingKeygen if keyGenBlock == 0 { keyGenStatus = types.KeygenStatus_KeyGenSuccess diff --git a/cmd/zetacored/parsers_test.go b/cmd/zetacored/parsers_test.go index cb7cb62190..f3310717ef 100644 --- a/cmd/zetacored/parsers_test.go +++ b/cmd/zetacored/parsers_test.go @@ -1,6 +1,3 @@ -//go:build PRIVNET -// +build PRIVNET - package main import ( diff --git a/common/address.go b/common/address.go index 592daa0775..032a0b88b0 100644 --- a/common/address.go +++ b/common/address.go @@ -1,7 +1,6 @@ package common import ( - "fmt" "strings" eth "github.com/ethereum/go-ethereum/common" @@ -19,16 +18,12 @@ var ( const ETHAddressLen = 42 // NewAddress create a new Address. Supports Ethereum, BSC, Polygon -func NewAddress(address string, chain Chain) (Address, error) { - +func NewAddress(address string) Address { // Check is eth address - if IsEVMChain(chain.ChainId) { - if eth.IsHexAddress(address) { - return Address(address), nil - } + if eth.IsHexAddress(address) { + return Address(address) } - - return NoAddress, fmt.Errorf("address format not supported: %s", address) + return NoAddress } func (addr Address) AccAddress() (cosmos.AccAddress, error) { diff --git a/common/address_test.go b/common/address_test.go index 17bfe5ce86..4487c48e28 100644 --- a/common/address_test.go +++ b/common/address_test.go @@ -1,44 +1,22 @@ -//go:build TESTNET -// +build TESTNET - package common import ( "testing" + "github.com/stretchr/testify/require" + . "gopkg.in/check.v1" ) func TestPackage(t *testing.T) { TestingT(t) } -type AddressSuite struct{} - -var _ = Suite(&AddressSuite{}) - -func (s *AddressSuite) TestAddress(c *C) { - _, err := NewAddress("bnb1lejrrtta9cgr49fuh7ktu3sddhe0ff7wenlpn6", GoerliChain()) - c.Assert(err, NotNil) - - _, err = NewAddress("1lejrrtta9cgr49fuh7ktu3sddhe0ff7wenlpn6", GoerliChain()) - c.Check(err, NotNil) - _, err = NewAddress("bnb1lejrrtta9cgr49fuh7ktu3sddhe0ff7wenlpn6X", GoerliChain()) - c.Check(err, NotNil) - _, err = NewAddress("bogus", GoerliChain()) - c.Check(err, NotNil) - c.Check(Address("").IsEmpty(), Equals, true) - c.Check(NoAddress.Equals(Address("")), Equals, true) - _, err = NewAddress("", GoerliChain()) - c.Assert(err, NotNil) - - // eth tests - _, err = NewAddress("0x90f2b1ae50e6018230e90a33f98c7844a0ab635a", GoerliChain()) - c.Check(err, IsNil) - // wrong length - _, err = NewAddress("0x90f2b1ae50e6018230e90a33f98c7844a0ab635aaaaaaaaa", GoerliChain()) - c.Check(err, NotNil) +func TestAddress(t *testing.T) { + addr := NewAddress("bnb1lejrrtta9cgr49fuh7ktu3sddhe0ff7wenlpn6") + require.EqualValuesf(t, NoAddress, addr, "address string should be empty") - // good length but not valid hex string - _, err = NewAddress("0x90f2b1ae50e6018230e90a33f98c7844a0ab63zz", GoerliChain()) - c.Check(err, NotNil) + addr = NewAddress("bogus") + require.EqualValuesf(t, NoAddress, addr, "address string should be empty") + addr = NewAddress("0x90f2b1ae50e6018230e90a33f98c7844a0ab635a") + require.EqualValuesf(t, "0x90f2b1ae50e6018230e90a33f98c7844a0ab635a", addr.String(), "address string should be equal") } diff --git a/common/bitcoin.go b/common/bitcoin.go new file mode 100644 index 0000000000..37a52f7986 --- /dev/null +++ b/common/bitcoin.go @@ -0,0 +1,27 @@ +package common + +import ( + "fmt" + + "github.com/btcsuite/btcd/chaincfg" +) + +var ( + BitcoinMainnetParams = &chaincfg.MainNetParams + BitcoinRegnetParams = &chaincfg.RegressionNetParams + BitcoinTestnetParams = &chaincfg.TestNet3Params +) + +// BitcoinNetParamsFromChainID returns the bitcoin net params to be used from the chain id +func BitcoinNetParamsFromChainID(chainID int64) (*chaincfg.Params, error) { + switch chainID { + case BtcRegtestChain().ChainId: + return BitcoinRegnetParams, nil + case BtcMainnetChain().ChainId: + return BitcoinMainnetParams, nil + case BtcTestNetChain().ChainId: + return BitcoinTestnetParams, nil + default: + return nil, fmt.Errorf("no Bitcoin net params for chain ID: %d", chainID) + } +} diff --git a/common/chain.go b/common/chain.go index 2ef7116ede..fe19b302bf 100644 --- a/common/chain.go +++ b/common/chain.go @@ -9,12 +9,7 @@ import ( ethcommon "github.com/ethereum/go-ethereum/common" ) -var ( - SigningAlgoSecp256k1 = SigninAlgo("secp256k1") - SigningAlgoEd25519 = SigninAlgo("ed25519") -) - -// return the ChainName from a string +// ParseChainName returns the ChainName from a string // if no such name exists, returns the empty chain name: ChainName_empty func ParseChainName(chain string) ChainName { c := ChainName_value[chain] @@ -23,28 +18,25 @@ func ParseChainName(chain string) ChainName { type SigninAlgo string -// Chain is an alias of string , represent a block chain -//type Chain string - // Chains represent a slice of Chain type Chains []Chain -// Equals compare two chain to see whether they represent the same chain +// IsEqual compare two chain to see whether they represent the same chain func (chain Chain) IsEqual(c Chain) bool { - if chain.ChainName == c.ChainName && chain.ChainId == c.ChainId { + if chain.ChainId == c.ChainId { return true } return false } func (chain Chain) IsZetaChain() bool { - return chain.IsEqual(ZetaChain()) + return chain.InChainList(ZetaChainList()) } func (chain Chain) IsExternalChain() bool { - return !chain.IsEqual(ZetaChain()) + return !chain.InChainList(ZetaChainList()) } -// bytes representations of address +// EncodeAddress bytes representations of address // on EVM chain, it is 20Bytes // on Bitcoin chain, it is P2WPKH address, []byte(bech32 encoded string) func (chain Chain) EncodeAddress(b []byte) (string, error) { @@ -94,8 +86,16 @@ func (chain Chain) DecodeAddress(addr string) ([]byte, error) { return nil, fmt.Errorf("chain (%d) not supported", chain.ChainId) } +func IsZetaChain(chainID int64) bool { + return ChainIDInChainList(chainID, ZetaChainList()) +} + +// IsEVMChain returns true if the chain is an EVM chain +// TODO: put this information directly in chain object +// https://github.com/zeta-chain/node-private/issues/63 func IsEVMChain(chainID int64) bool { return chainID == 5 || // Goerli + chainID == SepoliaChain().ChainId || // Sepolia chainID == 80001 || // Polygon mumbai chainID == 97 || // BSC testnet chainID == 1001 || // klaytn baobab @@ -105,8 +105,12 @@ func IsEVMChain(chainID int64) bool { chainID == 137 // polygon mainnet } +// IsHeaderSupportedEvmChain returns true if the chain is an EVM chain supporting block header-based verification +// TODO: put this information directly in chain object +// https://github.com/zeta-chain/node-private/issues/63 func IsHeaderSupportedEvmChain(chainID int64) bool { return chainID == 5 || // Goerli + chainID == SepoliaChain().ChainId || // Sepolia chainID == 97 || // BSC testnet chainID == 1337 || // eth privnet chainID == 1 || // eth mainnet @@ -122,15 +126,22 @@ func (chain Chain) SupportMerkleProof() bool { return IsEVMChain(chain.ChainId) || IsBitcoinChain(chain.ChainId) } +// IsBitcoinChain returns true if the chain is a Bitcoin chain +// TODO: put this information directly in chain object +// https://github.com/zeta-chain/node-private/issues/63 func IsBitcoinChain(chainID int64) bool { return chainID == 18444 || // regtest chainID == 18332 || //testnet chainID == 8332 // mainnet } +// IsEthereumChain returns true if the chain is an Ethereum chain +// TODO: put this information directly in chain object +// https://github.com/zeta-chain/node-private/issues/63 func IsEthereumChain(chainID int64) bool { return chainID == 1 || // eth mainnet chainID == 5 || // Goerli + chainID == SepoliaChain().ChainId || // Sepolia chainID == 1337 // eth privnet } @@ -161,21 +172,11 @@ func (chains Chains) Distinct() Chains { } func (chains Chains) Strings() []string { - strings := make([]string, len(chains)) + str := make([]string, len(chains)) for i, c := range chains { - strings[i] = c.String() + str[i] = c.String() } - return strings -} - -func GetChainFromChainName(chainName ChainName) *Chain { - chains := DefaultChainsList() - for _, chain := range chains { - if chainName == chain.ChainName { - return chain - } - } - return nil + return str } func GetChainFromChainID(chainID int64) *Chain { @@ -208,3 +209,18 @@ func GetBTCChainParams(chainID int64) (*chaincfg.Params, error) { return nil, fmt.Errorf("error chainID %d is not a Bitcoin chain", chainID) } } + +// InChainList checks whether the chain is in the chain list +func (chain Chain) InChainList(chainList []*Chain) bool { + return ChainIDInChainList(chain.ChainId, chainList) +} + +// ChainIDInChainList checks whether the chainID is in the chain list +func ChainIDInChainList(chainID int64, chainList []*Chain) bool { + for _, c := range chainList { + if chainID == c.ChainId { + return true + } + } + return false +} diff --git a/common/chain_id.go b/common/chain_id.go new file mode 100644 index 0000000000..1be8a0129a --- /dev/null +++ b/common/chain_id.go @@ -0,0 +1,41 @@ +package common + +import ( + "errors" + "fmt" + "strconv" + "strings" +) + +// CosmosToEthChainID converts a Cosmos chain ID to an Ethereum chain ID +// parse value between _ and - +// e.g. cosmoshub_400-1 -> 400 +func CosmosToEthChainID(chainID string) (int64, error) { + // extract the substring + extracted, err := extractBetweenUnderscoreAndDash(chainID) + if err != nil { + return 0, fmt.Errorf("can't convert cosmos to ethereum chain id: %w", err) + } + + // convert to int64 + ethChainID, err := strconv.ParseInt(extracted, 10, 64) + if err != nil { + return 0, fmt.Errorf("can't convert cosmos to ethereum chain id: %w", err) + } + + return ethChainID, nil +} + +func extractBetweenUnderscoreAndDash(s string) (string, error) { + // Find the position of the underscore and dash + underscoreIndex := strings.Index(s, "_") + dashIndex := strings.Index(s, "-") + + // Check if both characters are found and in the correct order + if underscoreIndex == -1 || dashIndex == -1 || underscoreIndex > dashIndex { + return "", errors.New("value does not contain underscore followed by dash") + } + + // Extract and return the substring + return s[underscoreIndex+1 : dashIndex], nil +} diff --git a/common/chain_id_test.go b/common/chain_id_test.go new file mode 100644 index 0000000000..cd4a18ca18 --- /dev/null +++ b/common/chain_id_test.go @@ -0,0 +1,58 @@ +package common_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/common" +) + +func TestCosmosToEthChainID(t *testing.T) { + t.Parallel() + + testCases := []struct { + name string + chainID string + expected int64 + isErr bool + }{ + { + name: "valid chain ID", + chainID: "cosmoshub_400-1", + expected: 400, + }, + { + name: "another valid chain ID", + chainID: "athens_701-2", + expected: 701, + }, + { + name: "no underscore", + chainID: "athens701-2", + isErr: true, + }, + { + name: "no dash", + chainID: "athens_7012", + isErr: true, + }, + { + name: "wrong pattern", + chainID: "athens-701_2", + isErr: true, + }, + } + + for _, tc := range testCases { + tc := tc + t.Run(tc.name, func(t *testing.T) { + ethChainID, err := common.CosmosToEthChainID(tc.chainID) + if tc.isErr { + require.Error(t, err) + } else { + require.NoError(t, err) + require.Equal(t, tc.expected, ethChainID) + } + }) + } +} diff --git a/common/chain_network.go b/common/chain_network.go deleted file mode 100644 index cb4f386fad..0000000000 --- a/common/chain_network.go +++ /dev/null @@ -1,40 +0,0 @@ -package common - -import ( - "os" - "strings" -) - -// ChainNetwork is to indicate which chain environment THORNode are working with -type ChainNetwork uint8 - -const ( - // TestNet network for test - TestNet ChainNetwork = iota - // MainNet network for main net - MainNet - // MockNet network for main net - MockNet -) - -// GetCurrentChainNetwork determinate what kind of network currently it is working with -func GetCurrentChainNetwork() ChainNetwork { - if strings.EqualFold(os.Getenv("NET"), "mocknet") { - return MockNet - } - if strings.EqualFold(os.Getenv("NET"), "testnet") { - return TestNet - } - return MainNet -} - -// Soft Equals check is mainnet == mainet, or (testnet/mocknet == testnet/mocknet) -func (net ChainNetwork) SoftEquals(net2 ChainNetwork) bool { - if net == MainNet && net2 == MainNet { - return true - } - if net != MainNet && net2 != MainNet { - return true - } - return false -} diff --git a/common/chain_network_test.go b/common/chain_network_test.go deleted file mode 100644 index 9aa804e76e..0000000000 --- a/common/chain_network_test.go +++ /dev/null @@ -1,18 +0,0 @@ -package common - -import ( - . "gopkg.in/check.v1" -) - -type ChainNetworkSuite struct{} - -var _ = Suite(&ChainNetworkSuite{}) - -func (s *ChainNetworkSuite) TestSoftEquals(c *C) { - c.Assert(MainNet.SoftEquals(MainNet), Equals, true) - c.Assert(TestNet.SoftEquals(TestNet), Equals, true) - c.Assert(MockNet.SoftEquals(MockNet), Equals, true) - c.Assert(TestNet.SoftEquals(MockNet), Equals, true) - c.Assert(MainNet.SoftEquals(MockNet), Equals, false) - c.Assert(MainNet.SoftEquals(TestNet), Equals, false) -} diff --git a/common/chain_test.go b/common/chain_test.go index 28ab1be701..f0e3c1ceed 100644 --- a/common/chain_test.go +++ b/common/chain_test.go @@ -7,11 +7,6 @@ import ( ) func TestChain_EncodeAddress(t *testing.T) { - type fields struct { - ChainName ChainName - ChainId int32 - } - tests := []struct { name string chain Chain @@ -53,3 +48,11 @@ func TestChain_EncodeAddress(t *testing.T) { }) } } + +func TestChain_InChainList(t *testing.T) { + require.True(t, ZetaChainMainnet().InChainList(ZetaChainList())) + require.True(t, ZetaMocknetChain().InChainList(ZetaChainList())) + require.True(t, ZetaPrivnetChain().InChainList(ZetaChainList())) + require.True(t, ZetaTestnetChain().InChainList(ZetaChainList())) + require.False(t, EthChain().InChainList(ZetaChainList())) +} diff --git a/common/chains.go b/common/chains.go new file mode 100644 index 0000000000..a689489818 --- /dev/null +++ b/common/chains.go @@ -0,0 +1,227 @@ +package common + +import "fmt" + +// Zeta chains + +func ZetaChainMainnet() Chain { + return Chain{ + ChainName: ChainName_zeta_mainnet, + ChainId: 7000, + } +} + +func ZetaTestnetChain() Chain { + return Chain{ + ChainName: ChainName_zeta_testnet, + ChainId: 7001, + } +} + +func ZetaMocknetChain() Chain { + return Chain{ + ChainName: ChainName_zeta_mainnet, + ChainId: 70000, + } +} + +func ZetaPrivnetChain() Chain { + return Chain{ + ChainName: ChainName_zeta_mainnet, + ChainId: 101, + } +} + +// Mainnet chains + +func EthChain() Chain { + return Chain{ + ChainName: ChainName_eth_mainnet, + ChainId: 1, + } +} + +func BscMainnetChain() Chain { + return Chain{ + ChainName: ChainName_bsc_mainnet, + ChainId: 56, + } +} + +func BtcMainnetChain() Chain { + return Chain{ + ChainName: ChainName_btc_mainnet, + ChainId: 8332, + } +} + +func PolygonChain() Chain { + return Chain{ + ChainName: ChainName_polygon_mainnet, + ChainId: 137, + } +} + +// Testnet chains + +func SepoliaChain() Chain { + return Chain{ + ChainName: ChainName_sepolia_testnet, + ChainId: 11155111, + } +} + +func GoerliChain() Chain { + return Chain{ + ChainName: ChainName_goerli_testnet, + ChainId: 5, + } +} + +func BscTestnetChain() Chain { + return Chain{ + ChainName: ChainName_bsc_testnet, + ChainId: 97, + } +} + +func BtcTestNetChain() Chain { + return Chain{ + ChainName: ChainName_btc_testnet, + ChainId: 18332, + } +} + +func MumbaiChain() Chain { + return Chain{ + ChainName: ChainName_mumbai_testnet, + ChainId: 80001, + } +} + +// Privnet chains + +func BtcRegtestChain() Chain { + return Chain{ + ChainName: ChainName_btc_regtest, + ChainId: 18444, + } +} + +func GoerliLocalnetChain() Chain { + return Chain{ + ChainName: ChainName_goerli_localnet, + ChainId: 1337, + } +} + +func BtcDustOffset() int64 { + return 2000 +} + +// DefaultChainsList returns a list of default chains +func DefaultChainsList() []*Chain { + return chainListPointers([]Chain{ + BtcMainnetChain(), + BscMainnetChain(), + EthChain(), + BtcTestNetChain(), + MumbaiChain(), + BscTestnetChain(), + GoerliChain(), + SepoliaChain(), + BtcRegtestChain(), + GoerliLocalnetChain(), + ZetaChainMainnet(), + ZetaTestnetChain(), + ZetaMocknetChain(), + ZetaPrivnetChain(), + }) +} + +// MainnetChainList returns a list of mainnet chains +func MainnetChainList() []*Chain { + return chainListPointers([]Chain{ + ZetaChainMainnet(), + BtcMainnetChain(), + BscMainnetChain(), + EthChain(), + }) +} + +// TestnetChainList returns a list of testnet chains +func TestnetChainList() []*Chain { + return chainListPointers([]Chain{ + ZetaTestnetChain(), + BtcTestNetChain(), + MumbaiChain(), + BscTestnetChain(), + GoerliChain(), + SepoliaChain(), + }) +} + +// PrivnetChainList returns a list of privnet chains +func PrivnetChainList() []*Chain { + return chainListPointers([]Chain{ + ZetaPrivnetChain(), + BtcRegtestChain(), + GoerliLocalnetChain(), + }) +} + +// ExternalChainList returns a list chains that are not Zeta +func ExternalChainList() []*Chain { + return chainListPointers([]Chain{ + BtcMainnetChain(), + BscMainnetChain(), + EthChain(), + BtcTestNetChain(), + MumbaiChain(), + BscTestnetChain(), + GoerliChain(), + SepoliaChain(), + BtcRegtestChain(), + GoerliLocalnetChain(), + }) +} + +// ZetaChainList returns a list of Zeta chains +func ZetaChainList() []*Chain { + return chainListPointers([]Chain{ + ZetaChainMainnet(), + ZetaTestnetChain(), + ZetaMocknetChain(), + ZetaPrivnetChain(), + }) +} + +// ZetaChainFromChainID returns a ZetaChain chainobject from a Cosmos chain ID +func ZetaChainFromChainID(chainID string) (Chain, error) { + ethChainID, err := CosmosToEthChainID(chainID) + if err != nil { + return Chain{}, err + } + + switch ethChainID { + case ZetaPrivnetChain().ChainId: + return ZetaPrivnetChain(), nil + case ZetaChainMainnet().ChainId: + return ZetaChainMainnet(), nil + case ZetaTestnetChain().ChainId: + return ZetaTestnetChain(), nil + case ZetaMocknetChain().ChainId: + return ZetaMocknetChain(), nil + default: + return Chain{}, fmt.Errorf("chain %d not found", ethChainID) + } +} + +// chainListPointers returns a list of chain pointers +func chainListPointers(chains []Chain) []*Chain { + var c []*Chain + for i := 0; i < len(chains); i++ { + c = append(c, &chains[i]) + } + return c +} diff --git a/common/common.pb.go b/common/common.pb.go index 2f39e69098..76f8d4d9de 100644 --- a/common/common.pb.go +++ b/common/common.pb.go @@ -102,6 +102,7 @@ const ( ChainName_bsc_testnet ChainName = 10 ChainName_zeta_testnet ChainName = 11 ChainName_btc_testnet ChainName = 12 + ChainName_sepolia_testnet ChainName = 13 // LocalNet // zeta_localnet = 13; ChainName_goerli_localnet ChainName = 14 @@ -122,6 +123,7 @@ var ChainName_name = map[int32]string{ 10: "bsc_testnet", 11: "zeta_testnet", 12: "btc_testnet", + 13: "sepolia_testnet", 14: "goerli_localnet", 15: "btc_regtest", } @@ -140,6 +142,7 @@ var ChainName_value = map[string]int32{ "bsc_testnet": 10, "zeta_testnet": 11, "btc_testnet": 12, + "sepolia_testnet": 13, "goerli_localnet": 14, "btc_regtest": 15, } @@ -520,50 +523,51 @@ func init() { func init() { proto.RegisterFile("common/common.proto", fileDescriptor_8f954d82c0b891f6) } var fileDescriptor_8f954d82c0b891f6 = []byte{ - // 682 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x94, 0xcd, 0x6a, 0xdb, 0x4a, - 0x14, 0x80, 0x25, 0xff, 0xeb, 0xd8, 0xb1, 0x75, 0x27, 0x97, 0x7b, 0x73, 0xc3, 0x45, 0x0e, 0xa6, - 0xa5, 0x69, 0xa0, 0x4e, 0xe2, 0xe2, 0xfe, 0xd0, 0x45, 0xc1, 0xee, 0x4f, 0x4a, 0xa1, 0x04, 0x39, - 0xab, 0x6c, 0xcc, 0x48, 0x3a, 0x95, 0x44, 0x2c, 0x8d, 0x91, 0xc7, 0x05, 0x77, 0xd7, 0x37, 0xe8, - 0x2b, 0x14, 0x0a, 0xed, 0xa3, 0x64, 0x99, 0x65, 0x57, 0xa1, 0x38, 0x6f, 0xd1, 0x55, 0x99, 0xd1, - 0x8c, 0x9c, 0xae, 0x74, 0xe6, 0x3b, 0xdf, 0x39, 0x67, 0x46, 0x1a, 0x04, 0xdb, 0x3e, 0x4b, 0x12, - 0x96, 0x1e, 0xe6, 0x8f, 0xfe, 0x3c, 0x63, 0x9c, 0x91, 0x5a, 0xbe, 0xda, 0xfd, 0x5f, 0x25, 0xbd, - 0x98, 0xfb, 0x2c, 0x2e, 0x9e, 0xb9, 0xb5, 0xeb, 0xa8, 0x2c, 0xf2, 0x08, 0x33, 0x5c, 0x26, 0x45, - 0xa0, 0xf2, 0x7f, 0x87, 0x2c, 0x64, 0x32, 0x3c, 0x14, 0x51, 0x4e, 0x7b, 0x11, 0x58, 0xa7, 0x4b, - 0xef, 0x2d, 0xae, 0x26, 0xc8, 0xc9, 0x10, 0xac, 0x05, 0xfa, 0xf3, 0xc1, 0xf0, 0xd1, 0xc5, 0xf1, - 0x8e, 0xb9, 0x67, 0xee, 0x5b, 0xa3, 0x7f, 0xd7, 0xd7, 0x5d, 0x6b, 0xa2, 0xe1, 0xaf, 0xeb, 0x6e, - 0x2d, 0xd7, 0xdd, 0x8d, 0x49, 0xee, 0x40, 0x1d, 0x83, 0xc1, 0x70, 0x78, 0xfc, 0x74, 0xa7, 0x24, - 0x8b, 0xe0, 0x96, 0xa7, 0x53, 0xbd, 0x33, 0xa8, 0x8e, 0x23, 0x1a, 0xa7, 0xe4, 0x08, 0xc0, 0x17, - 0xc1, 0x34, 0xa5, 0x09, 0xca, 0x31, 0xed, 0xc1, 0x5f, 0x7d, 0x75, 0x62, 0xa9, 0xbc, 0xa3, 0x09, - 0xba, 0x96, 0xaf, 0x43, 0xf2, 0x1f, 0x34, 0xf2, 0x8a, 0x38, 0x90, 0x13, 0xca, 0x6e, 0x5d, 0xae, - 0xdf, 0x04, 0xbd, 0x6f, 0x26, 0x34, 0x47, 0x33, 0xe6, 0x5f, 0x9c, 0x20, 0x0d, 0x30, 0x23, 0xff, - 0x40, 0x2d, 0xc2, 0x38, 0x8c, 0xb8, 0x6c, 0x5c, 0x76, 0xd5, 0x8a, 0x10, 0xa8, 0x44, 0x74, 0x11, - 0xc9, 0xf2, 0x96, 0x2b, 0x63, 0xd2, 0x85, 0xe6, 0x9c, 0x66, 0x98, 0xf2, 0xa9, 0x4c, 0x95, 0x65, - 0x0a, 0x72, 0x74, 0x22, 0x84, 0xdb, 0x73, 0x2b, 0x7f, 0xcc, 0x25, 0x47, 0x62, 0x8e, 0x98, 0xb8, - 0x53, 0xdd, 0x33, 0xf7, 0x9b, 0x03, 0xa2, 0x0f, 0x90, 0xef, 0xe3, 0x05, 0xe5, 0x74, 0x54, 0xb9, - 0xbc, 0xee, 0x1a, 0xae, 0xf2, 0x7a, 0x11, 0xc0, 0x26, 0x47, 0xee, 0x43, 0x47, 0x7f, 0x9f, 0xa9, - 0x6a, 0x24, 0x36, 0xdc, 0x3a, 0x31, 0xdc, 0xb6, 0x4e, 0xa8, 0x23, 0xdd, 0x83, 0xb6, 0xfa, 0xd2, - 0xda, 0x2c, 0x29, 0x73, 0x4b, 0xf1, 0x5c, 0x1c, 0xd5, 0xa0, 0x12, 0x50, 0x4e, 0x7b, 0x9f, 0x4c, - 0xa8, 0x9e, 0x66, 0x8c, 0xbd, 0x27, 0x4f, 0xa0, 0x68, 0x36, 0x9d, 0x0b, 0x22, 0x87, 0x34, 0x07, - 0x9d, 0x7e, 0x71, 0x39, 0xa4, 0x28, 0x7a, 0x69, 0x92, 0x57, 0x0e, 0x41, 0x37, 0x57, 0x85, 0x25, - 0x59, 0xd8, 0xee, 0xeb, 0x4b, 0xa7, 0xeb, 0x5a, 0x0a, 0xc8, 0xf5, 0xa8, 0x0e, 0x55, 0xa9, 0x1f, - 0x3c, 0x83, 0x2d, 0x17, 0x7d, 0x8c, 0x3f, 0xe0, 0x84, 0x53, 0xbe, 0x5c, 0x90, 0x26, 0xd4, 0xc7, - 0x19, 0x52, 0x8e, 0x81, 0x6d, 0x88, 0xc5, 0x64, 0xe9, 0xfb, 0xb8, 0x58, 0xd8, 0x26, 0x01, 0xa8, - 0xbd, 0xa2, 0xf1, 0x0c, 0x03, 0xbb, 0xb4, 0x5b, 0xf9, 0xfe, 0xd5, 0x31, 0x0f, 0x1e, 0x43, 0x63, - 0xcc, 0xe2, 0xf4, 0x6c, 0x35, 0x47, 0xd2, 0x80, 0xca, 0x39, 0x72, 0x6a, 0x1b, 0xa4, 0x0e, 0xe5, - 0xd7, 0x54, 0x14, 0x58, 0x50, 0x7d, 0xe9, 0x8e, 0x07, 0x47, 0x76, 0x49, 0xb0, 0x71, 0x12, 0xd8, - 0x65, 0x55, 0xf8, 0xa5, 0x04, 0x56, 0x71, 0x83, 0x84, 0x87, 0xc9, 0x9c, 0xaf, 0x6c, 0x83, 0x74, - 0xa0, 0x89, 0x3c, 0x9a, 0x26, 0x34, 0x4e, 0x53, 0xe4, 0xb6, 0x49, 0x6c, 0x68, 0x7d, 0x44, 0x4e, - 0x0b, 0x52, 0x12, 0x8a, 0xc7, 0xfd, 0x02, 0x94, 0xc9, 0x36, 0x74, 0xe6, 0x6c, 0xb6, 0x0a, 0x59, - 0x5a, 0xc0, 0x8a, 0xb4, 0x16, 0x1b, 0xab, 0x4a, 0x08, 0xb4, 0x43, 0x86, 0xd9, 0x2c, 0x9e, 0x72, - 0x5c, 0x70, 0xc1, 0x6a, 0x82, 0x25, 0xcb, 0xc4, 0xa3, 0x1b, 0x56, 0x17, 0xdd, 0x42, 0x9a, 0x52, - 0x3f, 0xc2, 0x02, 0x36, 0x84, 0xe8, 0x51, 0xe6, 0x51, 0xaf, 0x60, 0x96, 0x9e, 0xa0, 0x01, 0x14, - 0x5b, 0xd5, 0xa4, 0xa9, 0xb7, 0xaa, 0x41, 0x4b, 0x36, 0xcf, 0x37, 0x31, 0x63, 0x3e, 0x9d, 0x09, - 0xd8, 0xd6, 0x56, 0x86, 0xa1, 0x10, 0xed, 0x4e, 0xfe, 0x8e, 0x46, 0xcf, 0x2f, 0xd7, 0x8e, 0x79, - 0xb5, 0x76, 0xcc, 0x9f, 0x6b, 0xc7, 0xfc, 0x7c, 0xe3, 0x18, 0x57, 0x37, 0x8e, 0xf1, 0xe3, 0xc6, - 0x31, 0xce, 0xef, 0x86, 0x31, 0x8f, 0x96, 0x9e, 0xb8, 0xc9, 0x87, 0x62, 0xe2, 0x03, 0x79, 0xd9, - 0x65, 0xe8, 0xb3, 0x0c, 0xd5, 0x4f, 0xc9, 0xab, 0xc9, 0x3f, 0xc7, 0xc3, 0xdf, 0x01, 0x00, 0x00, - 0xff, 0xff, 0x61, 0x31, 0x96, 0x1f, 0xac, 0x04, 0x00, 0x00, + // 693 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x94, 0xcd, 0x6e, 0xd3, 0x4a, + 0x14, 0xc7, 0xed, 0x7c, 0xfb, 0x24, 0x4d, 0x7c, 0xa7, 0x57, 0xf7, 0xf6, 0x56, 0x57, 0x4e, 0x15, + 0x81, 0x28, 0x95, 0x48, 0xdb, 0xa0, 0xf0, 0x21, 0x16, 0x48, 0x09, 0x1f, 0x45, 0x48, 0xa8, 0x72, + 0xba, 0xea, 0x26, 0x1a, 0xdb, 0x07, 0xdb, 0x6a, 0xec, 0xb1, 0xec, 0x09, 0x52, 0xd8, 0xf1, 0x06, + 0x3c, 0x04, 0x12, 0x3c, 0x01, 0xcf, 0xd0, 0x65, 0x97, 0xac, 0x2a, 0x94, 0xbe, 0x05, 0x2b, 0x34, + 0x63, 0x8f, 0x53, 0x56, 0x3e, 0xe7, 0x77, 0xfe, 0xff, 0x73, 0xce, 0xc4, 0x13, 0xc3, 0xb6, 0xcb, + 0xa2, 0x88, 0xc5, 0x87, 0xf9, 0x63, 0x98, 0xa4, 0x8c, 0x33, 0xd2, 0xc8, 0xb3, 0xdd, 0xff, 0x8b, + 0xa2, 0x13, 0x72, 0x97, 0x85, 0xe5, 0x33, 0x57, 0xed, 0x5a, 0x45, 0x15, 0x79, 0x80, 0x29, 0x2e, + 0xa3, 0x32, 0x28, 0xea, 0x7f, 0xfb, 0xcc, 0x67, 0x32, 0x3c, 0x14, 0x51, 0x4e, 0x07, 0x01, 0x18, + 0xa7, 0x4b, 0xe7, 0x2d, 0xae, 0x66, 0xc8, 0xc9, 0x18, 0x8c, 0x0c, 0xdd, 0x64, 0x34, 0x7e, 0x74, + 0x71, 0xbc, 0xa3, 0xef, 0xe9, 0xfb, 0xc6, 0xe4, 0xdf, 0xf5, 0x75, 0xdf, 0x98, 0x29, 0xf8, 0xeb, + 0xba, 0xdf, 0xc8, 0xe5, 0xf6, 0x46, 0x49, 0xee, 0x40, 0x13, 0xbd, 0xd1, 0x78, 0x7c, 0xfc, 0x74, + 0xa7, 0x22, 0x4d, 0x70, 0x4b, 0xa7, 0x4a, 0x83, 0x33, 0xa8, 0x4f, 0x03, 0x1a, 0xc6, 0xe4, 0x08, + 0xc0, 0x15, 0xc1, 0x3c, 0xa6, 0x11, 0xca, 0x31, 0xdd, 0xd1, 0x5f, 0xc3, 0xe2, 0xc4, 0x52, 0xf2, + 0x8e, 0x46, 0x68, 0x1b, 0xae, 0x0a, 0xc9, 0x7f, 0xd0, 0xca, 0x1d, 0xa1, 0x27, 0x27, 0x54, 0xed, + 0xa6, 0xcc, 0xdf, 0x78, 0x83, 0xaf, 0x3a, 0xb4, 0x27, 0x0b, 0xe6, 0x5e, 0x9c, 0x20, 0xf5, 0x30, + 0x25, 0xff, 0x40, 0x23, 0xc0, 0xd0, 0x0f, 0xb8, 0x6c, 0x5c, 0xb5, 0x8b, 0x8c, 0x10, 0xa8, 0x05, + 0x34, 0x0b, 0xa4, 0xbd, 0x63, 0xcb, 0x98, 0xf4, 0xa1, 0x9d, 0xd0, 0x14, 0x63, 0x3e, 0x97, 0xa5, + 0xaa, 0x2c, 0x41, 0x8e, 0x4e, 0x84, 0xe0, 0xf6, 0xdc, 0xda, 0x1f, 0x73, 0xc9, 0x91, 0x98, 0x23, + 0x26, 0xee, 0xd4, 0xf7, 0xf4, 0xfd, 0xf6, 0x88, 0xa8, 0x03, 0xe4, 0x7b, 0xbc, 0xa0, 0x9c, 0x4e, + 0x6a, 0x97, 0xd7, 0x7d, 0xcd, 0x2e, 0x74, 0x83, 0x00, 0x60, 0x53, 0x23, 0xf7, 0xa1, 0xa7, 0xde, + 0xcf, 0xbc, 0x68, 0x24, 0x16, 0xee, 0x9c, 0x68, 0x76, 0x57, 0x15, 0x8a, 0x23, 0xdd, 0x83, 0x6e, + 0xf1, 0xa6, 0x95, 0xb2, 0x52, 0x28, 0xb7, 0x0a, 0x9e, 0x0b, 0x27, 0x0d, 0xa8, 0x79, 0x94, 0xd3, + 0xc1, 0x27, 0x1d, 0xea, 0xa7, 0x29, 0x63, 0xef, 0xc9, 0x13, 0x28, 0x9b, 0xcd, 0x13, 0x41, 0xe4, + 0x90, 0xf6, 0xa8, 0x37, 0x2c, 0x2f, 0x87, 0x14, 0x8a, 0x5e, 0x8a, 0xe4, 0xce, 0x31, 0xa8, 0xe6, + 0x85, 0xb1, 0x22, 0x8d, 0xdd, 0xa1, 0xba, 0x74, 0xca, 0xd7, 0x29, 0x80, 0xcc, 0x27, 0x4d, 0xa8, + 0x4b, 0xf9, 0xc1, 0x33, 0xd8, 0xb2, 0xd1, 0xc5, 0xf0, 0x03, 0xce, 0x38, 0xe5, 0xcb, 0x8c, 0xb4, + 0xa1, 0x39, 0x4d, 0x91, 0x72, 0xf4, 0x4c, 0x4d, 0x24, 0xb3, 0xa5, 0xeb, 0x62, 0x96, 0x99, 0x3a, + 0x01, 0x68, 0xbc, 0xa2, 0xe1, 0x02, 0x3d, 0xb3, 0xb2, 0x5b, 0xfb, 0xf6, 0xc5, 0xd2, 0x0f, 0x1e, + 0x43, 0x6b, 0xca, 0xc2, 0xf8, 0x6c, 0x95, 0x20, 0x69, 0x41, 0xed, 0x1c, 0x39, 0x35, 0x35, 0xd2, + 0x84, 0xea, 0x6b, 0x2a, 0x0c, 0x06, 0xd4, 0x5f, 0xda, 0xd3, 0xd1, 0x91, 0x59, 0x11, 0x6c, 0x1a, + 0x79, 0x66, 0xb5, 0x30, 0x7e, 0xaf, 0x80, 0x51, 0xde, 0x20, 0xa1, 0xc3, 0x28, 0xe1, 0x2b, 0x53, + 0x23, 0x3d, 0x68, 0x23, 0x0f, 0xe6, 0x11, 0x0d, 0xe3, 0x18, 0xb9, 0xa9, 0x13, 0x13, 0x3a, 0x1f, + 0x91, 0xd3, 0x92, 0x54, 0x84, 0xc4, 0xe1, 0x6e, 0x09, 0xaa, 0x64, 0x1b, 0x7a, 0x09, 0x5b, 0xac, + 0x7c, 0x16, 0x97, 0xb0, 0x26, 0x55, 0xd9, 0x46, 0x55, 0x27, 0x04, 0xba, 0x3e, 0xc3, 0x74, 0x11, + 0xce, 0x39, 0x66, 0x5c, 0xb0, 0x86, 0x60, 0xd1, 0x32, 0x72, 0xe8, 0x86, 0x35, 0x45, 0x37, 0x9f, + 0xc6, 0xd4, 0x0d, 0xb0, 0x84, 0x2d, 0x21, 0x74, 0x28, 0x73, 0xa8, 0x53, 0x32, 0x43, 0x4d, 0x50, + 0x00, 0xca, 0x55, 0x15, 0x69, 0xab, 0x55, 0x15, 0xe8, 0x88, 0xe6, 0x19, 0x26, 0x6c, 0x11, 0x6e, + 0x54, 0x5b, 0x72, 0x62, 0xbe, 0xd9, 0x82, 0xb9, 0x74, 0x21, 0x60, 0x57, 0x59, 0x53, 0xf4, 0x85, + 0xd0, 0xec, 0xe5, 0x3f, 0xdc, 0xe4, 0xf9, 0xe5, 0xda, 0xd2, 0xaf, 0xd6, 0x96, 0xfe, 0x73, 0x6d, + 0xe9, 0x9f, 0x6f, 0x2c, 0xed, 0xea, 0xc6, 0xd2, 0x7e, 0xdc, 0x58, 0xda, 0xf9, 0x5d, 0x3f, 0xe4, + 0xc1, 0xd2, 0x11, 0xd7, 0xfb, 0x50, 0xac, 0xf1, 0x40, 0xfe, 0x03, 0x64, 0xe8, 0xb2, 0x14, 0x8b, + 0x2f, 0x95, 0xd3, 0x90, 0x9f, 0x93, 0x87, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x67, 0xf0, 0x01, + 0x28, 0xc1, 0x04, 0x00, 0x00, } func (m *PubKeySet) Marshal() (dAtA []byte, err error) { diff --git a/common/default_chains_mainnet.go b/common/default_chains_mainnet.go deleted file mode 100644 index 62b455e571..0000000000 --- a/common/default_chains_mainnet.go +++ /dev/null @@ -1,74 +0,0 @@ -//go:build !PRIVNET && !TESTNET && !MOCK_MAINNET -// +build !PRIVNET,!TESTNET,!MOCK_MAINNET - -package common - -func EthChain() Chain { - return Chain{ - ChainName: ChainName_eth_mainnet, - ChainId: 1, - } -} - -func BscMainnetChain() Chain { - return Chain{ - ChainName: ChainName_bsc_mainnet, - ChainId: 56, - } -} - -func ZetaChain() Chain { - return Chain{ - ChainName: ChainName_zeta_mainnet, - ChainId: 7000, - } -} - -func BtcMainnetChain() Chain { - return Chain{ - ChainName: ChainName_btc_mainnet, - ChainId: 8332, - } -} - -func BtcChainID() int64 { - return BtcMainnetChain().ChainId -} - -func BtcDustOffset() int64 { - return 2000 -} - -func PolygonChain() Chain { - return Chain{ - ChainName: ChainName_polygon_mainnet, - ChainId: 137, - } -} - -func DefaultChainsList() []*Chain { - chains := []Chain{ - BtcMainnetChain(), - BscMainnetChain(), - EthChain(), - ZetaChain(), - } - var c []*Chain - for i := 0; i < len(chains); i++ { - c = append(c, &chains[i]) - } - return c -} - -func ExternalChainList() []*Chain { - chains := []Chain{ - BtcMainnetChain(), - BscMainnetChain(), - EthChain(), - } - var c []*Chain - for i := 0; i < len(chains); i++ { - c = append(c, &chains[i]) - } - return c -} diff --git a/common/default_chains_mock_mainnet.go b/common/default_chains_mock_mainnet.go deleted file mode 100644 index 7400f48779..0000000000 --- a/common/default_chains_mock_mainnet.go +++ /dev/null @@ -1,74 +0,0 @@ -//go:build MOCK_MAINNET -// +build MOCK_MAINNET - -package common - -func EthChain() Chain { - return Chain{ - ChainName: ChainName_eth_mainnet, - ChainId: 1, - } -} - -func BscMainnetChain() Chain { - return Chain{ - ChainName: ChainName_bsc_mainnet, - ChainId: 56, - } -} - -func ZetaChain() Chain { - return Chain{ - ChainName: ChainName_zeta_mainnet, - ChainId: 70000, - } -} - -func BtcMainnetChain() Chain { - return Chain{ - ChainName: ChainName_btc_mainnet, - ChainId: 8332, - } -} - -func BtcChainID() int64 { - return BtcMainnetChain().ChainId -} - -func BtcDustOffset() int64 { - return 2000 -} - -func PolygonChain() Chain { - return Chain{ - ChainName: ChainName_polygon_mainnet, - ChainId: 137, - } -} - -func DefaultChainsList() []*Chain { - chains := []Chain{ - BtcMainnetChain(), - BscMainnetChain(), - EthChain(), - ZetaChain(), - } - var c []*Chain - for i := 0; i < len(chains); i++ { - c = append(c, &chains[i]) - } - return c -} - -func ExternalChainList() []*Chain { - chains := []Chain{ - BtcMainnetChain(), - BscMainnetChain(), - EthChain(), - } - var c []*Chain - for i := 0; i < len(chains); i++ { - c = append(c, &chains[i]) - } - return c -} diff --git a/common/default_chains_privnet.go b/common/default_chains_privnet.go deleted file mode 100644 index c3cefa0ed4..0000000000 --- a/common/default_chains_privnet.go +++ /dev/null @@ -1,58 +0,0 @@ -//go:build PRIVNET -// +build PRIVNET - -package common - -func GoerliChain() Chain { - return Chain{ - ChainName: ChainName_goerli_localnet, - ChainId: 1337, - } -} - -func ZetaChain() Chain { - return Chain{ - ChainName: ChainName_zeta_mainnet, - ChainId: 101, - } -} - -func BtcRegtestChain() Chain { - return Chain{ - ChainName: ChainName_btc_regtest, - ChainId: 18444, - } -} - -func BtcChainID() int64 { - return BtcRegtestChain().ChainId -} - -func BtcDustOffset() int64 { - return 2000 -} - -func DefaultChainsList() []*Chain { - chains := []Chain{ - BtcRegtestChain(), - GoerliChain(), - ZetaChain(), - } - var c []*Chain - for i := 0; i < len(chains); i++ { - c = append(c, &chains[i]) - } - return c -} - -func ExternalChainList() []*Chain { - chains := []Chain{ - BtcRegtestChain(), - GoerliChain(), - } - var c []*Chain - for i := 0; i < len(chains); i++ { - c = append(c, &chains[i]) - } - return c -} diff --git a/common/default_chains_testnet.go b/common/default_chains_testnet.go deleted file mode 100644 index 86ed783c0d..0000000000 --- a/common/default_chains_testnet.go +++ /dev/null @@ -1,76 +0,0 @@ -//go:build TESTNET -// +build TESTNET - -package common - -func GoerliChain() Chain { - return Chain{ - ChainName: ChainName_goerli_testnet, - ChainId: 5, - } -} - -func BscTestnetChain() Chain { - return Chain{ - ChainName: ChainName_bsc_testnet, - ChainId: 97, - } -} - -func ZetaChain() Chain { - return Chain{ - ChainName: ChainName_zeta_testnet, - ChainId: 7001, - } -} - -func BtcTestNetChain() Chain { - return Chain{ - ChainName: ChainName_btc_testnet, - ChainId: 18332, - } -} - -func BtcChainID() int64 { - return BtcTestNetChain().ChainId -} - -func BtcDustOffset() int64 { - return 2000 -} - -func MumbaiChain() Chain { - return Chain{ - ChainName: ChainName_mumbai_testnet, - ChainId: 80001, - } -} - -func DefaultChainsList() []*Chain { - chains := []Chain{ - BtcTestNetChain(), - MumbaiChain(), - BscTestnetChain(), - GoerliChain(), - ZetaChain(), - } - var c []*Chain - for i := 0; i < len(chains); i++ { - c = append(c, &chains[i]) - } - return c -} - -func ExternalChainList() []*Chain { - chains := []Chain{ - BtcTestNetChain(), - MumbaiChain(), - BscTestnetChain(), - GoerliChain(), - } - var c []*Chain - for i := 0; i < len(chains); i++ { - c = append(c, &chains[i]) - } - return c -} diff --git a/common/headers_test.go b/common/headers_test.go index aa45d6ac2e..218d4a67fb 100644 --- a/common/headers_test.go +++ b/common/headers_test.go @@ -23,16 +23,16 @@ import ( const numHeadersToTest = 100 -func TestGetEthereumHeader(t *testing.T) { +func generateHeader() { rpcclient, _ := ethclient.Dial("https://eth.llamarpc.com") header, _ := rpcclient.HeaderByNumber(context.Background(), big.NewInt(18495266)) - fmt.Printf("Header: %v\n", header) file, _ := os.Create("test_data/eth_header_18495266.json") b, _ := header.MarshalJSON() file.Write(b) } func TestTrueEthereumHeader(t *testing.T) { + generateHeader() var header ethtypes.Header // read file into a byte slice file, err := os.Open("./test_data/eth_header_18495266.json") @@ -41,7 +41,6 @@ func TestTrueEthereumHeader(t *testing.T) { headerBytes := make([]byte, 4096) n, err := file.Read(headerBytes) require.NoError(t, err) - fmt.Printf("Header bytes: %s\n", string(headerBytes[:n])) err = header.UnmarshalJSON(headerBytes[:n]) require.NoError(t, err) var buffer bytes.Buffer @@ -54,6 +53,7 @@ func TestTrueEthereumHeader(t *testing.T) { } func TestFalseEthereumHeader(t *testing.T) { + generateHeader() var header ethtypes.Header // read file into a byte slice file, err := os.Open("./test_data/eth_header_18495266.json") @@ -62,7 +62,6 @@ func TestFalseEthereumHeader(t *testing.T) { headerBytes := make([]byte, 4096) n, err := file.Read(headerBytes) require.NoError(t, err) - fmt.Printf("Header bytes: %s\n", string(headerBytes[:n])) err = header.UnmarshalJSON(headerBytes[:n]) require.NoError(t, err) hash := header.Hash() diff --git a/common/proof_test.go b/common/proof_test.go index 9f3f958504..0bf1244e80 100644 --- a/common/proof_test.go +++ b/common/proof_test.go @@ -105,7 +105,7 @@ func BitcoinMerkleProofLiveTest(t *testing.T) { } } -func validateBitcoinBlock(t *testing.T, header *wire.BlockHeader, headerBytes []byte, blockVerbose *btcjson.GetBlockVerboseTxResult, outTxid string, tssAddress string, nonce uint64) { +func validateBitcoinBlock(t *testing.T, _ *wire.BlockHeader, headerBytes []byte, blockVerbose *btcjson.GetBlockVerboseTxResult, outTxid string, tssAddress string, nonce uint64) { // Deserialization should work for each transaction in the block txns := []*btcutil.Tx{} txBodies := [][]byte{} @@ -118,7 +118,7 @@ func validateBitcoinBlock(t *testing.T, header *wire.BlockHeader, headerBytes [] // Validate Tss SegWit transaction if it's an outTx if res.Txid == outTxid { msg := &crosschaintypes.MsgAddToOutTxTracker{ - ChainId: common.BtcChainID(), + ChainId: common.BtcTestNetChain().ChainId, Nonce: nonce, TxHash: outTxid, } diff --git a/common/pubkey.go b/common/pubkey.go index cf020c84ac..db3af5bc54 100644 --- a/common/pubkey.go +++ b/common/pubkey.go @@ -88,29 +88,34 @@ func (pubKey PubKey) String() string { // GetAddress will return an address for the given chain func (pubKey PubKey) GetAddress(chain Chain) (Address, error) { + if IsEVMChain(chain.ChainId) { + return pubKey.GetEVMAddress() + } + return NoAddress, nil +} + +// GetEVMAddress will return the evm address +func (pubKey PubKey) GetEVMAddress() (Address, error) { if pubKey.IsEmpty() { return NoAddress, nil } - if IsEVMChain(chain.ChainId) { - // retrieve compressed pubkey bytes from bechh32 encoded str - pk, err := cosmos.GetPubKeyFromBech32(cosmos.Bech32PubKeyTypeAccPub, string(pubKey)) - if err != nil { - return NoAddress, err - } - // parse compressed bytes removing 5 first bytes (amino encoding) to get uncompressed - pub, err := secp256k1.ParsePubKey(pk.Bytes()) - if err != nil { - return NoAddress, err - } - str := strings.ToLower(eth.PubkeyToAddress(*pub.ToECDSA()).String()) - return NewAddress(str, chain) + // retrieve compressed pubkey bytes from bechh32 encoded str + pk, err := cosmos.GetPubKeyFromBech32(cosmos.Bech32PubKeyTypeAccPub, string(pubKey)) + if err != nil { + return NoAddress, err } - return NoAddress, nil + // parse compressed bytes removing 5 first bytes (amino encoding) to get uncompressed + pub, err := secp256k1.ParsePubKey(pk.Bytes()) + if err != nil { + return NoAddress, err + } + str := strings.ToLower(eth.PubkeyToAddress(*pub.ToECDSA()).String()) + return NewAddress(str), nil } func (pubKey PubKey) GetZetaAddress() (cosmos.AccAddress, error) { - addr, err := pubKey.GetAddress(ZetaChain()) + addr, err := pubKey.GetEVMAddress() if err != nil { return nil, err } diff --git a/common/pubkey_test.go b/common/pubkey_test.go index 2a8a994e82..9b7b0c5ffd 100644 --- a/common/pubkey_test.go +++ b/common/pubkey_test.go @@ -1,6 +1,3 @@ -//go:build PRIVNET -// +build PRIVNET - package common import ( @@ -107,26 +104,6 @@ func (s *PubKeyTestSuite) TestPubKey(c *C) { c.Assert(pk2.Equals(pk), Equals, true) } -// -//func (s *PubKeyTestSuite) TestPubKeySet(c *C) { -// _, pubKey, _ := testdata.KeyTestPubAddr() -// spk, err := cosmos.Bech32ifyPubKey(cosmos.Bech32PubKeyTypeAccPub, pubKey) -// c.Assert(err, IsNil) -// pk, err := NewPubKey(spk) -// c.Assert(err, IsNil) -// -// c.Check(PubKeySet{}.Contains(pk), Equals, false) -// -// pks := PubKeySet{ -// Secp256k1: pk, -// } -// c.Check(pks.Contains(pk), Equals, true) -// pks = PubKeySet{ -// Ed25519: pk, -// } -// c.Check(pks.Contains(pk), Equals, true) -//} - func (s *PubKeyTestSuite) TestPubKeyGetAddress(c *C) { original := os.Getenv("NET") defer func() { diff --git a/common/tss.go b/common/tss.go new file mode 100644 index 0000000000..e64f206645 --- /dev/null +++ b/common/tss.go @@ -0,0 +1,50 @@ +package common + +import ( + "github.com/btcsuite/btcd/chaincfg" + "github.com/btcsuite/btcutil" + ethcommon "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" + zcommon "github.com/zeta-chain/zetacore/common/cosmos" +) + +// GetTssAddrEVM returns the ethereum address of the tss pubkey +func GetTssAddrEVM(tssPubkey string) (ethcommon.Address, error) { + var keyAddr ethcommon.Address + pubk, err := zcommon.GetPubKeyFromBech32(zcommon.Bech32PubKeyTypeAccPub, tssPubkey) + if err != nil { + return keyAddr, err + } + //keyAddrBytes := pubk.EVMAddress().Bytes() + pubk.Bytes() + decompresspubkey, err := crypto.DecompressPubkey(pubk.Bytes()) + if err != nil { + return keyAddr, err + } + + keyAddr = crypto.PubkeyToAddress(*decompresspubkey) + + return keyAddr, nil +} + +// GetTssAddrBTC returns the bitcoin address of the tss pubkey +func GetTssAddrBTC(tssPubkey string, bitcoinParams *chaincfg.Params) (string, error) { + addrWPKH, err := getKeyAddrBTCWitnessPubkeyHash(tssPubkey, bitcoinParams) + if err != nil { + return "", err + } + + return addrWPKH.EncodeAddress(), nil +} + +func getKeyAddrBTCWitnessPubkeyHash(tssPubkey string, bitcoinParams *chaincfg.Params) (*btcutil.AddressWitnessPubKeyHash, error) { + pubk, err := zcommon.GetPubKeyFromBech32(zcommon.Bech32PubKeyTypeAccPub, tssPubkey) + if err != nil { + return nil, err + } + addr, err := btcutil.NewAddressWitnessPubKeyHash(btcutil.Hash160(pubk.Bytes()), bitcoinParams) + if err != nil { + return nil, err + } + return addr, nil +} diff --git a/contrib/localnet/orchestrator/smoketest/README.md b/contrib/localnet/orchestrator/smoketest/README.md new file mode 100644 index 0000000000..0ac8e82e75 --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/README.md @@ -0,0 +1,63 @@ +# `smoketest` + +`smoketest` is a comprehensive suite of smoke tests designed to validate the integration and functionality of the ZetaChain network, particularly its interactions with Bitcoin and EVM (Ethereum Virtual Machine) networks. This tool is essential for ensuring the robustness and reliability of ZetaChain's cross-chain functionalities. + +## Packages +The smoketest project is organized into several packages, each with a specific role: + +- `cmd`: Contains the main commands to execute the smoke tests. +- `config`: Provides general configuration for smoke tests, including RPC addresses for connected networks, addresses of deployed smart contracts, and account details for test transactions. +- `contracts`: Includes sample Solidity smart contracts used in testing scenarios. +- `runner`: Responsible for executing smoke tests, handling interactions with various network clients. +- `smoketests`: Houses a collection of smoke tests that can be run against the ZetaChain network. +- `txserver`: A minimalistic client for interacting with the ZetaChain RPC interface. +- `utils`: Offers utility functions to facilitate interactions with the different blockchain networks involved in testing. + +## Config + +The smoketest suite utilizes a flexible and comprehensive configuration system defined in the config package, which is central to setting up and customizing your test environments. The configuration is structured as follows: + +A config YAML file can be provided to the smoke test tool via the `--config` flag. If no config file is provided, the tool will use default values for all configuration parameters. + +### Config Structure +- `RPCs`: Defines the RPC endpoints for various networks involved in the testing. +- `Contracts`: Specifies the addresses of pre-deployed smart contracts relevant to the tests. +- `ZetaChainID`: The specific chain ID of the ZetaChain network being tested. + +### RPCs Configuration + +- `Zevm`: RPC endpoint for the ZetaChain EVM. +- `EVM`: RPC endpoint for the Ethereum network. +- `Bitcoin`: RPC endpoint for the Bitcoin network. +- `ZetaCoreGRPC`: GRPC endpoint for ZetaCore. +- `ZetaCoreRPC`: RPC endpoint for ZetaCore. + +### Contracts Configuration: + +**EVM Contracts** +- `ZetaEthAddress`: Address of Zeta token contract on EVM chain. +- `ConnectorEthAddr`: Address of a connector contract on EVM chain. +- `USDT`: Address of the USDT token contract on EVM chain. + +### Config Example + +```yaml +rpcs: + zevm: "http://localhost:8545" + evm: "http://localhost:8546" + bitcoin: "http://localhost:18332" + zetacore_grpc: "localhost:9090" + zetacore_rpc: "http://localhost:26657" +contracts: + evm: + zeta_eth: "0x..." + connector_eth: "0x..." + usdt: "0x..." +zeta_chain_id: "zetachain-1" +``` + +NOTE: config is in progress, contracts on the zEVM must be added + +## Getting Started + +TODO: Add instructions for running the smoketest tool directly from the command line. \ No newline at end of file diff --git a/contrib/localnet/orchestrator/smoketest/cmd/smoketest/local.go b/contrib/localnet/orchestrator/smoketest/cmd/smoketest/local.go new file mode 100644 index 0000000000..19be6bc3bf --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/cmd/smoketest/local.go @@ -0,0 +1,251 @@ +package main + +import ( + "context" + "fmt" + "os" + "time" + + "github.com/btcsuite/btcd/rpcclient" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/spf13/cobra" + "github.com/zeta-chain/zetacore/app" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/config" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/runner" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/smoketests" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/txserver" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/utils" + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" + fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" + "google.golang.org/grpc" +) + +const ( + flagContractsDeployed = "deployed" + flagWaitForHeight = "wait-for" + flagConfigFile = "config" +) + +func NewLocalCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "local", + Short: "Run Local Smoketest", + Run: localSmokeTest, + } + cmd.Flags().Bool( + flagContractsDeployed, + false, + "set to to true if running smoketest again with existing state", + ) + cmd.Flags().Int64( + flagWaitForHeight, + 0, + "block height for smoketest to begin, ex. --wait-for 100", + ) + cmd.Flags().String( + flagConfigFile, + "", + "config file to use for the smoketest", + ) + return cmd +} + +func localSmokeTest(cmd *cobra.Command, _ []string) { + testStartTime := time.Now() + defer func() { + fmt.Println("Smoke test took", time.Since(testStartTime)) + }() + + // start timer + go func() { + time.Sleep(SmokeTestTimeout) + fmt.Println("Smoke test timed out after", SmokeTestTimeout) + os.Exit(1) + }() + + // fetch flags + waitForHeight, err := cmd.Flags().GetInt64(flagWaitForHeight) + if err != nil { + panic(err) + } + contractsDeployed, err := cmd.Flags().GetBool(flagContractsDeployed) + if err != nil { + panic(err) + } + + // initialize smoke tests config + conf, err := getConfig(cmd) + if err != nil { + panic(err) + } + + // wait for a specific height on ZetaChain + if waitForHeight != 0 { + utils.WaitForBlockHeight(waitForHeight, conf.RPCs.ZetaCoreRPC) + } + + // set account prefix to zeta + cosmosConf := sdk.GetConfig() + cosmosConf.SetBech32PrefixForAccount(app.Bech32PrefixAccAddr, app.Bech32PrefixAccPub) + cosmosConf.Seal() + + // initialize clients + // TODO: add connection values to config + // https://github.com/zeta-chain/node-private/issues/41 + connCfg := &rpcclient.ConnConfig{ + Host: conf.RPCs.Bitcoin, + User: "smoketest", + Pass: "123", + HTTPPostMode: true, + DisableTLS: true, + Params: "testnet3", + } + btcRPCClient, err := rpcclient.New(connCfg, nil) + if err != nil { + panic(err) + } + + goerliClient, err := ethclient.Dial(conf.RPCs.EVM) + if err != nil { + panic(err) + } + + chainid, err := goerliClient.ChainID(context.Background()) + if err != nil { + panic(err) + } + deployerPrivkey, err := crypto.HexToECDSA(DeployerPrivateKey) + if err != nil { + panic(err) + } + goerliAuth, err := bind.NewKeyedTransactorWithChainID(deployerPrivkey, chainid) + if err != nil { + panic(err) + } + + grpcConn, err := grpc.Dial(conf.RPCs.ZetaCoreGRPC, grpc.WithInsecure()) + if err != nil { + panic(err) + } + + cctxClient := crosschaintypes.NewQueryClient(grpcConn) + fungibleClient := fungibletypes.NewQueryClient(grpcConn) + authClient := authtypes.NewQueryClient(grpcConn) + bankClient := banktypes.NewQueryClient(grpcConn) + observerClient := observertypes.NewQueryClient(grpcConn) + + // wait for Genesis + time.Sleep(30 * time.Second) + + // initialize client to send messages to ZetaChain + zetaTxServer, err := txserver.NewZetaTxServer( + conf.RPCs.ZetaCoreRPC, + []string{utils.FungibleAdminName}, + []string{FungibleAdminMnemonic}, + conf.ZetaChainID, + ) + if err != nil { + panic(err) + } + + // wait for keygen to be completed. ~ height 30 + for { + time.Sleep(5 * time.Second) + response, err := cctxClient.LastZetaHeight(context.Background(), &crosschaintypes.QueryLastZetaHeightRequest{}) + if err != nil { + fmt.Printf("cctxClient.LastZetaHeight error: %s", err) + continue + } + if response.Height >= 60 { + break + } + fmt.Printf("Last ZetaHeight: %d\n", response.Height) + } + + // setup client and auth for zevm + var zevmClient *ethclient.Client + for { + time.Sleep(5 * time.Second) + fmt.Printf("dialing zevm client: %s\n", conf.RPCs.Zevm) + zevmClient, err = ethclient.Dial(conf.RPCs.Zevm) + if err != nil { + continue + } + break + } + chainid, err = zevmClient.ChainID(context.Background()) + if err != nil { + panic(err) + } + zevmAuth, err := bind.NewKeyedTransactorWithChainID(deployerPrivkey, chainid) + if err != nil { + panic(err) + } + + // initialize smoke test runner + sm := runner.NewSmokeTestRunner( + DeployerAddress, + DeployerPrivateKey, + FungibleAdminMnemonic, + goerliClient, + zevmClient, + cctxClient, + zetaTxServer, + fungibleClient, + authClient, + bankClient, + observerClient, + goerliAuth, + zevmAuth, + btcRPCClient, + ) + + // setting up the networks + startTime := time.Now() + + // setup TSS addresses + sm.SetTSSAddresses() + + // setup the external network + sm.SetupBitcoin() + sm.SetupEVM(contractsDeployed) + + // deploy and set zevm contract + sm.SetZEVMContracts() + + // deposit on ZetaChain + sm.DepositEtherIntoZRC20() + sm.SendZetaIn() + sm.DepositBTC() + + // deploy zevm swap and context apps + sm.SetupZEVMSwapApp() + sm.SetupContextApp() + + fmt.Printf("## Setup takes %s\n", time.Since(startTime)) + + // run all smoke tests + sm.RunSmokeTests(smoketests.AllSmokeTests) + + sm.WG.Wait() +} + +func getConfig(cmd *cobra.Command) (config.Config, error) { + configFile, err := cmd.Flags().GetString(flagConfigFile) + if err != nil { + return config.Config{}, err + } + + // use default config if no config file is specified + if configFile == "" { + return config.DefaultConfig(), nil + } + + return config.ReadConfig(configFile) +} diff --git a/contrib/localnet/orchestrator/smoketest/cmd/smoketest/main.go b/contrib/localnet/orchestrator/smoketest/cmd/smoketest/main.go new file mode 100644 index 0000000000..6b9bde7b42 --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/cmd/smoketest/main.go @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "os" + "time" + + ethcommon "github.com/ethereum/go-ethereum/common" +) + +var ( + // TODO: make these variables configurable + // https://github.com/zeta-chain/node-private/issues/41 + + SmokeTestTimeout = 30 * time.Minute + + DeployerAddress = ethcommon.HexToAddress("0xE5C5367B8224807Ac2207d350E60e1b6F27a7ecC") + DeployerPrivateKey = "d87baf7bf6dc560a252596678c12e41f7d1682837f05b29d411bc3f78ae2c263" // #nosec G101 - used for testing + FungibleAdminMnemonic = "snow grace federal cupboard arrive fancy gym lady uniform rotate exercise either leave alien grass" // #nosec G101 - used for testing +) + +func main() { + rootCmd := NewRootCmd() + if err := rootCmd.Execute(); err != nil { + fmt.Println(err) + os.Exit(-1) + } +} diff --git a/contrib/localnet/orchestrator/smoketest/cmd/smoketest/root.go b/contrib/localnet/orchestrator/smoketest/cmd/smoketest/root.go new file mode 100644 index 0000000000..7f0d513e2a --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/cmd/smoketest/root.go @@ -0,0 +1,13 @@ +package main + +import "github.com/spf13/cobra" + +func NewRootCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "smoketest", + Short: "Smoke Test CLI", + } + cmd.AddCommand(NewLocalCmd()) + + return cmd +} diff --git a/contrib/localnet/orchestrator/smoketest/cmd/smoketest/stress.go b/contrib/localnet/orchestrator/smoketest/cmd/smoketest/stress.go new file mode 100644 index 0000000000..670922056f --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/cmd/smoketest/stress.go @@ -0,0 +1,321 @@ +package main + +//import ( +// "context" +// "errors" +// "fmt" +// "math/big" +// "os" +// "sort" +// "time" +// +// authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" +// banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" +// "github.com/ethereum/go-ethereum/accounts/abi/bind" +// ethcommon "github.com/ethereum/go-ethereum/common" +// "github.com/ethereum/go-ethereum/crypto" +// "github.com/ethereum/go-ethereum/ethclient" +// "github.com/spf13/cobra" +// "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" +// crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" +// fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" +// observertypes "github.com/zeta-chain/zetacore/x/observer/types" +// "google.golang.org/grpc" +//) +// +//const ( +// StatInterval = 5 +// StressTestTimeout = 100 * time.Minute +//) +// +//var ( +// zevmNonce = big.NewInt(1) +//) +// +//var StressCmd = &cobra.Command{ +// Use: "stress", +// Short: "Run Local Stress Test", +// Run: StressTest, +//} +// +//type stressArguments struct { +// ethURL string +// grpcURL string +// zevmURL string +// deployerAddress string +// deployerPrivateKey string +// network string +// txnInterval int64 +//} +// +//var stressTestArgs = stressArguments{} +// +//func init() { +// RootCmd.AddCommand(StressCmd) +// StressCmd.Flags().StringVar(&stressTestArgs.ethURL, "ethURL", "http://eth:8545", "--ethURL http://eth:8545") +// StressCmd.Flags().StringVar(&stressTestArgs.grpcURL, "grpcURL", "zetacore0:9090", "--grpcURL zetacore0:9090") +// StressCmd.Flags().StringVar(&stressTestArgs.zevmURL, "zevmURL", zevmRPC, "--zevmURL http://zetacore0:8545") +// StressCmd.Flags().StringVar(&stressTestArgs.deployerAddress, "addr", "0xE5C5367B8224807Ac2207d350E60e1b6F27a7ecC", "--addr ") +// StressCmd.Flags().StringVar(&stressTestArgs.deployerPrivateKey, "privKey", "d87baf7bf6dc560a252596678c12e41f7d1682837f05b29d411bc3f78ae2c263", "--privKey ") +// StressCmd.Flags().StringVar(&stressTestArgs.network, "network", "PRIVNET", "--network PRIVNET") +// StressCmd.Flags().Int64Var(&stressTestArgs.txnInterval, "tx-interval", 500, "--tx-interval [TIME_INTERVAL_MILLISECONDS]") +// +// DeployerAddress = ethcommon.HexToAddress(stressTestArgs.deployerAddress) +//} +// +//func StressTest(_ *cobra.Command, _ []string) { +// testStartTime := time.Now() +// defer func() { +// fmt.Println("Smoke test took", time.Since(testStartTime)) +// }() +// go func() { +// time.Sleep(StressTestTimeout) +// fmt.Println("Smoke test timed out after", StressTestTimeout) +// os.Exit(1) +// }() +// +// goerliClient, err := ethclient.Dial(stressTestArgs.ethURL) +// if err != nil { +// panic(err) +// } +// +// bal, err := goerliClient.BalanceAt(context.TODO(), DeployerAddress, nil) +// if err != nil { +// panic(err) +// } +// fmt.Printf("Deployer address: %s, balance: %d Wei\n", DeployerAddress.Hex(), bal) +// +// chainid, err := goerliClient.ChainID(context.Background()) +// if err != nil { +// panic(err) +// } +// deployerPrivkey, err := crypto.HexToECDSA(stressTestArgs.deployerPrivateKey) +// if err != nil { +// panic(err) +// } +// goerliAuth, err := bind.NewKeyedTransactorWithChainID(deployerPrivkey, chainid) +// if err != nil { +// panic(err) +// } +// +// grpcConn, err := grpc.Dial(stressTestArgs.grpcURL, grpc.WithInsecure()) +// if err != nil { +// panic(err) +// } +// +// cctxClient := crosschaintypes.NewQueryClient(grpcConn) +// fungibleClient := fungibletypes.NewQueryClient(grpcConn) +// bankClient := banktypes.NewQueryClient(grpcConn) +// authClient := authtypes.NewQueryClient(grpcConn) +// observerClient := observertypes.NewQueryClient(grpcConn) +// +// // Wait for Genesis and keygen to be completed. ~ height 30 +// time.Sleep(20 * time.Second) +// for { +// time.Sleep(5 * time.Second) +// response, err := cctxClient.LastZetaHeight(context.Background(), &crosschaintypes.QueryLastZetaHeightRequest{}) +// if err != nil { +// fmt.Printf("cctxClient.LastZetaHeight error: %s", err) +// continue +// } +// if response.Height >= 30 { +// break +// } +// fmt.Printf("Last ZetaHeight: %d\n", response.Height) +// } +// +// // get the clients for tests +// var zevmClient *ethclient.Client +// for { +// time.Sleep(5 * time.Second) +// fmt.Printf("dialing zevm client: %s\n", stressTestArgs.zevmURL) +// zevmClient, err = ethclient.Dial(stressTestArgs.zevmURL) +// if err != nil { +// continue +// } +// break +// } +// chainid, err = zevmClient.ChainID(context.Background()) +// if err != nil { +// panic(err) +// } +// zevmAuth, err := bind.NewKeyedTransactorWithChainID(deployerPrivkey, chainid) +// if err != nil { +// panic(err) +// } +// +// smokeTest := NewSmokeTest( +// goerliClient, +// zevmClient, +// cctxClient, +// ZetaTxServer{}, // not used in stress test +// fungibleClient, +// authClient, +// bankClient, +// observerClient, +// goerliAuth, +// zevmAuth, +// nil, +// ) +// +// // If stress test is running on local docker environment +// if stressTestArgs.network == "PRIVNET" { +// smokeTest.TestSetupZetaTokenAndConnectorAndZEVMContracts() +// smokeTest.TestDepositEtherIntoZRC20() +// smokeTest.TestSendZetaIn() +// } else if stressTestArgs.network == "TESTNET" { +// ethZRC20Addr, err := smokeTest.SystemContract.GasCoinZRC20ByChainId(&bind.CallOpts{}, big.NewInt(5)) +// if err != nil { +// panic(err) +// } +// smokeTest.ETHZRC20Addr = ethZRC20Addr +// smokeTest.ETHZRC20, err = zrc20.NewZRC20(smokeTest.ETHZRC20Addr, smokeTest.zevmClient) +// if err != nil { +// panic(err) +// } +// } else { +// err := errors.New("invalid network argument: " + stressTestArgs.network) +// panic(err) +// } +// +// // Check zrc20 balance of Deployer address +// ethZRC20Balance, err := smokeTest.ETHZRC20.BalanceOf(nil, DeployerAddress) +// if err != nil { +// panic(err) +// } +// fmt.Printf("eth zrc20 balance: %s Wei \n", ethZRC20Balance.String()) +// +// //Pre-approve ETH withdraw on ZEVM +// fmt.Printf("approving ETH ZRC20...\n") +// ethZRC20 := smokeTest.ETHZRC20 +// tx, err := ethZRC20.Approve(smokeTest.zevmAuth, smokeTest.ETHZRC20Addr, big.NewInt(1e18)) +// if err != nil { +// panic(err) +// } +// receipt := MustWaitForTxReceipt(smokeTest.zevmClient, tx) +// fmt.Printf("eth zrc20 approve receipt: status %d\n", receipt.Status) +// +// // Get current nonce on zevm for DeployerAddress - Need to keep track of nonce at client level +// blockNum, err := smokeTest.zevmClient.BlockNumber(context.Background()) +// if err != nil { +// panic(err) +// } +// +// // #nosec G701 smoketest - always in range +// nonce, err := smokeTest.zevmClient.NonceAt(context.Background(), DeployerAddress, big.NewInt(int64(blockNum))) +// if err != nil { +// panic(err) +// } +// +// // #nosec G701 smoketest - always in range +// zevmNonce = big.NewInt(int64(nonce)) +// +// // -------------- TEST BEGINS ------------------ +// +// fmt.Println("**** STRESS TEST BEGINS ****") +// fmt.Println(" 1. Periodically Withdraw ETH from ZEVM to EVM - goerli") +// fmt.Println(" 2. Display Network metrics to monitor performance [Num Pending outbound tx], [Num Trackers]") +// +// smokeTest.wg.Add(2) +// go smokeTest.WithdrawCCtx() // Withdraw USDT from ZEVM to EVM - goerli +// go smokeTest.EchoNetworkMetrics() // Display Network metrics periodically to monitor performance +// +// smokeTest.wg.Wait() +//} +// +//// WithdrawCCtx withdraw USDT from ZEVM to EVM +//func (sm *SmokeTest) WithdrawCCtx() { +// ticker := time.NewTicker(time.Millisecond * time.Duration(stressTestArgs.txnInterval)) +// for { +// select { +// case <-ticker.C: +// sm.WithdrawETHZRC20() +// } +// } +//} +// +//func (sm *SmokeTest) EchoNetworkMetrics() { +// ticker := time.NewTicker(time.Second * StatInterval) +// var queue = make([]uint64, 0) +// var numTicks = 0 +// var totalMinedTxns = uint64(0) +// var previousMinedTxns = uint64(0) +// +// for { +// select { +// case <-ticker.C: +// numTicks++ +// // Get all pending outbound transactions +// cctxResp, err := sm.cctxClient.CctxListPending(context.Background(), &crosschaintypes.QueryListCctxPendingRequest{ +// ChainId: getChainID(), +// }) +// if err != nil { +// continue +// } +// sends := cctxResp.CrossChainTx +// sort.Slice(sends, func(i, j int) bool { +// return sends[i].GetCurrentOutTxParam().OutboundTxTssNonce < sends[j].GetCurrentOutTxParam().OutboundTxTssNonce +// }) +// if len(sends) > 0 { +// fmt.Printf("pending nonces %d to %d\n", sends[0].GetCurrentOutTxParam().OutboundTxTssNonce, sends[len(sends)-1].GetCurrentOutTxParam().OutboundTxTssNonce) +// } else { +// continue +// } +// // +// // Get all trackers +// trackerResp, err := sm.cctxClient.OutTxTrackerAll(context.Background(), &crosschaintypes.QueryAllOutTxTrackerRequest{}) +// if err != nil { +// continue +// } +// +// currentMinedTxns := sends[0].GetCurrentOutTxParam().OutboundTxTssNonce +// newMinedTxCnt := currentMinedTxns - previousMinedTxns +// previousMinedTxns = currentMinedTxns +// +// // Add new mined txn count to queue and remove the oldest entry +// queue = append(queue, newMinedTxCnt) +// if numTicks > 60/StatInterval { +// totalMinedTxns -= queue[0] +// queue = queue[1:] +// numTicks = 60/StatInterval + 1 //prevent overflow +// } +// +// //Calculate rate -> tx/min +// totalMinedTxns += queue[len(queue)-1] +// rate := totalMinedTxns +// +// numPending := len(cctxResp.CrossChainTx) +// numTrackers := len(trackerResp.OutTxTracker) +// +// fmt.Println("Network Stat => Num of Pending cctx: ", numPending, "Num active trackers: ", numTrackers, "Tx Rate: ", rate, " tx/min") +// } +// } +//} +// +//func (sm *SmokeTest) WithdrawETHZRC20() { +// defer func() { +// zevmNonce.Add(zevmNonce, big.NewInt(1)) +// }() +// +// ethZRC20 := sm.ETHZRC20 +// +// sm.zevmAuth.Nonce = zevmNonce +// _, err := ethZRC20.Withdraw(sm.zevmAuth, DeployerAddress.Bytes(), big.NewInt(100)) +// if err != nil { +// panic(err) +// } +//} +// +//// Get ETH based chain ID - Build flags are conflicting with current lib, need to do this manually +//func getChainID() int64 { +// switch stressTestArgs.network { +// case "PRIVNET": +// return 1337 +// case "TESTNET": +// return 5 +// case "MAINNET": +// return 1 +// default: +// return 1337 +// } +//} diff --git a/contrib/localnet/orchestrator/smoketest/config/config.go b/contrib/localnet/orchestrator/smoketest/config/config.go new file mode 100644 index 0000000000..fd156fd342 --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/config/config.go @@ -0,0 +1,83 @@ +package config + +import ( + "os" + + "gopkg.in/yaml.v2" +) + +// TODO: support pre-deployed addresses for zEVM contracts +// https://github.com/zeta-chain/node-private/issues/41 + +// Config contains the configuration for the smoke test +type Config struct { + RPCs RPCs `yaml:"rpcs"` + Contracts Contracts `yaml:"contracts"` + ZetaChainID string `yaml:"zeta_chain_id"` +} + +// RPCs contains the configuration for the RPC endpoints +type RPCs struct { + Zevm string `yaml:"zevm"` + EVM string `yaml:"evm"` + Bitcoin string `yaml:"bitcoin"` + ZetaCoreGRPC string `yaml:"zetacore_grpc"` + ZetaCoreRPC string `yaml:"zetacore_rpc"` +} + +// Contracts contains the addresses of predeployed contracts +type Contracts struct { + EVM EVM `yaml:"evm"` +} + +// EVM contains the addresses of predeployed contracts on the EVM chain +type EVM struct { + ZetaEthAddress string `yaml:"zeta_eth"` + ConnectorEthAddr string `yaml:"connector_eth"` + USDT string `yaml:"usdt"` +} + +func DefaultConfig() Config { + return Config{ + RPCs: RPCs{ + Zevm: "http://zetacore0:8545", + EVM: "http://eth:8545", + Bitcoin: "bitcoin:18443", + ZetaCoreGRPC: "zetacore0:9090", + ZetaCoreRPC: "http://zetacore0:26657", + }, + ZetaChainID: "athens_101-1", + Contracts: Contracts{ + EVM: EVM{ + USDT: "0xff3135df4F2775f4091b81f4c7B6359CfA07862a", + }, + }, + } +} + +// ReadConfig reads the config file +func ReadConfig(file string) (config Config, err error) { + // #nosec G304 -- this is a config file + b, err := os.ReadFile(file) + if err != nil { + return Config{}, err + } + err = yaml.Unmarshal(b, &config) + if err != nil { + return Config{}, err + } + return +} + +// WriteConfig writes the config file +func WriteConfig(file string, config Config) error { + b, err := yaml.Marshal(config) + if err != nil { + return err + } + err = os.WriteFile(file, b, 0600) + if err != nil { + return err + } + return nil +} diff --git a/contrib/localnet/orchestrator/smoketest/contracts/zevmswap/ZEVMSwapApp.bin b/contrib/localnet/orchestrator/smoketest/contracts/zevmswap/ZEVMSwapApp.bin index 9b241a147f..f512145bdd 100644 --- a/contrib/localnet/orchestrator/smoketest/contracts/zevmswap/ZEVMSwapApp.bin +++ b/contrib/localnet/orchestrator/smoketest/contracts/zevmswap/ZEVMSwapApp.bin @@ -1 +1 @@ -60c06040523480156200001157600080fd5b5060405162001333380380620013338339818101604052810190620000379190620000c4565b8173ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1660601b815250508073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1660601b8152505050506200015e565b600081519050620000be8162000144565b92915050565b60008060408385031215620000de57620000dd6200013f565b5b6000620000ee85828601620000ad565b92505060206200010185828601620000ad565b9150509250929050565b600062000118826200011f565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600080fd5b6200014f816200010b565b81146200015b57600080fd5b50565b60805160601c60a05160601c6111946200019f600039600081816101b201526101fa0152600081816101d60152818161039d015261043101526111946000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063a06ea8bc1461005c578063bb88b7691461008d578063bd00c9c4146100ab578063de43156e146100c9578063df73044e146100e5575b600080fd5b61007660048036038101906100719190610a30565b610115565b604051610084929190610c8d565b60405180910390f35b6100956101b0565b6040516100a29190610c72565b60405180910390f35b6100b36101d4565b6040516100c09190610c72565b60405180910390f35b6100e360048036038101906100de9190610a7d565b6101f8565b005b6100ff60048036038101906100fa919061091a565b61076f565b60405161010c9190610ce6565b60405180910390f35b600060608060008585905090506000868660009060149261013893929190610e4e565b906101439190610f31565b60601c90508686601490809261015b93929190610e4e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505092508083945094505050509250929050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461027d576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000606061028b8484610115565b80925081935050506060600267ffffffffffffffff8111156102b0576102af611097565b5b6040519080825280602002602001820160405280156102de5781602001602082028036833780820191505090505b50905086816000815181106102f6576102f5611068565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828160018151811061034557610344611068565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508673ffffffffffffffffffffffffffffffffffffffff1663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000886040518363ffffffff1660e01b81526004016103da929190610cbd565b602060405180830381600087803b1580156103f457600080fd5b505af1158015610408573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061042c9190610a03565b5060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166338ed17398860008530680100000000000000006040518663ffffffff1660e01b815260040161049a959493929190610d38565b600060405180830381600087803b1580156104b457600080fd5b505af11580156104c8573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906104f191906109ba565b90506000808573ffffffffffffffffffffffffffffffffffffffff1663d9eeebed6040518163ffffffff1660e01b8152600401604080518083038186803b15801561053b57600080fd5b505afa15801561054f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610573919061097a565b915091508173ffffffffffffffffffffffffffffffffffffffff1663095ea7b387836040518363ffffffff1660e01b81526004016105b2929190610cbd565b602060405180830381600087803b1580156105cc57600080fd5b505af11580156105e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106049190610a03565b508573ffffffffffffffffffffffffffffffffffffffff1663095ea7b3878560018151811061063657610635611068565b5b60200260200101516040518363ffffffff1660e01b815260040161065b929190610cbd565b602060405180830381600087803b15801561067557600080fd5b505af1158015610689573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ad9190610a03565b508573ffffffffffffffffffffffffffffffffffffffff1663c70126268683866001815181106106e0576106df611068565b5b60200260200101516106f29190610e89565b6040518363ffffffff1660e01b815260040161070f929190610d08565b602060405180830381600087803b15801561072957600080fd5b505af115801561073d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107619190610a03565b505050505050505050505050565b606083838360405160200161078693929190610c48565b60405160208183030381529060405290509392505050565b60006107b16107ac84610db7565b610d92565b905080838252602082019050828560208602820111156107d4576107d36110df565b5b60005b8581101561080457816107ea8882610905565b8452602084019350602083019250506001810190506107d7565b5050509392505050565b60008135905061081d81611119565b92915050565b60008151905061083281611119565b92915050565b600082601f83011261084d5761084c6110cb565b5b815161085d84826020860161079e565b91505092915050565b60008151905061087581611130565b92915050565b60008083601f840112610891576108906110cb565b5b8235905067ffffffffffffffff8111156108ae576108ad6110c6565b5b6020830191508360018202830111156108ca576108c96110df565b5b9250929050565b6000606082840312156108e7576108e66110d0565b5b81905092915050565b6000813590506108ff81611147565b92915050565b60008151905061091481611147565b92915050565b600080600060408486031215610933576109326110e9565b5b60006109418682870161080e565b935050602084013567ffffffffffffffff811115610962576109616110e4565b5b61096e8682870161087b565b92509250509250925092565b60008060408385031215610991576109906110e9565b5b600061099f85828601610823565b92505060206109b085828601610905565b9150509250929050565b6000602082840312156109d0576109cf6110e9565b5b600082015167ffffffffffffffff8111156109ee576109ed6110e4565b5b6109fa84828501610838565b91505092915050565b600060208284031215610a1957610a186110e9565b5b6000610a2784828501610866565b91505092915050565b60008060208385031215610a4757610a466110e9565b5b600083013567ffffffffffffffff811115610a6557610a646110e4565b5b610a718582860161087b565b92509250509250929050565b600080600080600060808688031215610a9957610a986110e9565b5b600086013567ffffffffffffffff811115610ab757610ab66110e4565b5b610ac3888289016108d1565b9550506020610ad48882890161080e565b9450506040610ae5888289016108f0565b935050606086013567ffffffffffffffff811115610b0657610b056110e4565b5b610b128882890161087b565b92509250509295509295909350565b6000610b2d8383610b39565b60208301905092915050565b610b4281610ebd565b82525050565b610b5181610ebd565b82525050565b610b68610b6382610ebd565b611015565b82525050565b6000610b7982610df3565b610b838185610e21565b9350610b8e83610de3565b8060005b83811015610bbf578151610ba68882610b21565b9750610bb183610e14565b925050600181019050610b92565b5085935050505092915050565b6000610bd88385610e43565b9350610be5838584610fa2565b82840190509392505050565b6000610bfc82610e09565b610c068185610e32565b9350610c16818560208601610fb1565b610c1f816110ee565b840191505092915050565b610c3381610f90565b82525050565b610c4281610f27565b82525050565b6000610c548286610b57565b601482019150610c65828486610bcc565b9150819050949350505050565b6000602082019050610c876000830184610b48565b92915050565b6000604082019050610ca26000830185610b48565b8181036020830152610cb48184610bf1565b90509392505050565b6000604082019050610cd26000830185610b48565b610cdf6020830184610c39565b9392505050565b60006020820190508181036000830152610d008184610bf1565b905092915050565b60006040820190508181036000830152610d228185610bf1565b9050610d316020830184610c39565b9392505050565b600060a082019050610d4d6000830188610c39565b610d5a6020830187610c2a565b8181036040830152610d6c8186610b6e565b9050610d7b6060830185610b48565b610d886080830184610c39565b9695505050505050565b6000610d9c610dad565b9050610da88282610fe4565b919050565b6000604051905090565b600067ffffffffffffffff821115610dd257610dd1611097565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600082905092915050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b60008085851115610e6257610e616110da565b5b83861115610e7357610e726110d5565b5b6001850283019150848603905094509492505050565b6000610e9482610f27565b9150610e9f83610f27565b925082821015610eb257610eb1611039565b5b828203905092915050565b6000610ec882610f07565b9050919050565b60008115159050919050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000610f3d8383610dfe565b82610f488135610edb565b92506014821015610f8857610f837fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008360140360080261110c565b831692505b505092915050565b6000610f9b82610f27565b9050919050565b82818337600083830152505050565b60005b83811015610fcf578082015181840152602081019050610fb4565b83811115610fde576000848401525b50505050565b610fed826110ee565b810181811067ffffffffffffffff8211171561100c5761100b611097565b5b80604052505050565b600061102082611027565b9050919050565b6000611032826110ff565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b600082821b905092915050565b61112281610ebd565b811461112d57600080fd5b50565b61113981610ecf565b811461114457600080fd5b50565b61115081610f27565b811461115b57600080fd5b5056fea264697066735822122077546c2f4741f7d79b7a2e01a3100f966ababfb11046c7872e4f310304d04ce564736f6c63430008070033 +60c06040523480156200001157600080fd5b50604051620012ee380380620012ee833981810160405281019062000037919062000111565b8173ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250508073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1681525050505062000158565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620000d982620000ac565b9050919050565b620000eb81620000cc565b8114620000f757600080fd5b50565b6000815190506200010b81620000e0565b92915050565b600080604083850312156200012b576200012a620000a7565b5b60006200013b85828601620000fa565b92505060206200014e85828601620000fa565b9150509250929050565b60805160a05161115b62000193600039600081816101b101526101f90152600081816101d50152818161039b0152610420015261115b6000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063a06ea8bc1461005c578063bb88b7691461008d578063bd00c9c4146100ab578063de43156e146100c9578063df73044e146100e5575b600080fd5b610076600480360381019061007191906107bc565b610115565b6040516100849291906108da565b60405180910390f35b6100956101af565b6040516100a2919061090a565b60405180910390f35b6100b36101d3565b6040516100c0919061090a565b60405180910390f35b6100e360048036038101906100de91906109ab565b6101f7565b005b6100ff60048036038101906100fa9190610a4f565b610714565b60405161010c9190610aaf565b60405180910390f35b6000606080600080868690509150868660009060149261013793929190610adb565b906101429190610b5a565b60601c90508686601490809261015a93929190610adb565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505092508083945094505050509250929050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461027c576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060608061028b8585610115565b8093508194505050600267ffffffffffffffff8111156102ae576102ad610bb9565b5b6040519080825280602002602001820160405280156102dc5781602001602082028036833780820191505090505b50905086816000815181106102f4576102f3610be8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828160018151811061034357610342610be8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508673ffffffffffffffffffffffffffffffffffffffff1663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000886040518363ffffffff1660e01b81526004016103d8929190610c26565b6020604051808303816000875af11580156103f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041b9190610c87565b5060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166338ed17398860008530680100000000000000006040518663ffffffff1660e01b8152600401610489959493929190610db7565b6000604051808303816000875af11580156104a8573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906104d19190610f35565b90506000808573ffffffffffffffffffffffffffffffffffffffff1663d9eeebed6040518163ffffffff1660e01b81526004016040805180830381865afa158015610520573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105449190610f93565b915091508173ffffffffffffffffffffffffffffffffffffffff1663095ea7b387836040518363ffffffff1660e01b8152600401610583929190610c26565b6020604051808303816000875af11580156105a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c69190610c87565b508573ffffffffffffffffffffffffffffffffffffffff1663095ea7b387600a866001815181106105fa576105f9610be8565b5b602002602001015161060c9190611002565b6040518363ffffffff1660e01b8152600401610629929190610c26565b6020604051808303816000875af1158015610648573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066c9190610c87565b508573ffffffffffffffffffffffffffffffffffffffff1663c7012626868560018151811061069e5761069d610be8565b5b60200260200101516040518363ffffffff1660e01b81526004016106c3929190611044565b6020604051808303816000875af11580156106e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107069190610c87565b505050505050505050505050565b606083838360405160200161072b939291906110fb565b60405160208183030381529060405290509392505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f84011261077c5761077b610757565b5b8235905067ffffffffffffffff8111156107995761079861075c565b5b6020830191508360018202830111156107b5576107b4610761565b5b9250929050565b600080602083850312156107d3576107d261074d565b5b600083013567ffffffffffffffff8111156107f1576107f0610752565b5b6107fd85828601610766565b92509250509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061083482610809565b9050919050565b61084481610829565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610884578082015181840152602081019050610869565b60008484015250505050565b6000601f19601f8301169050919050565b60006108ac8261084a565b6108b68185610855565b93506108c6818560208601610866565b6108cf81610890565b840191505092915050565b60006040820190506108ef600083018561083b565b818103602083015261090181846108a1565b90509392505050565b600060208201905061091f600083018461083b565b92915050565b600080fd5b6000606082840312156109405761093f610925565b5b81905092915050565b61095281610829565b811461095d57600080fd5b50565b60008135905061096f81610949565b92915050565b6000819050919050565b61098881610975565b811461099357600080fd5b50565b6000813590506109a58161097f565b92915050565b6000806000806000608086880312156109c7576109c661074d565b5b600086013567ffffffffffffffff8111156109e5576109e4610752565b5b6109f18882890161092a565b9550506020610a0288828901610960565b9450506040610a1388828901610996565b935050606086013567ffffffffffffffff811115610a3457610a33610752565b5b610a4088828901610766565b92509250509295509295909350565b600080600060408486031215610a6857610a6761074d565b5b6000610a7686828701610960565b935050602084013567ffffffffffffffff811115610a9757610a96610752565b5b610aa386828701610766565b92509250509250925092565b60006020820190508181036000830152610ac981846108a1565b905092915050565b600080fd5b600080fd5b60008085851115610aef57610aee610ad1565b5b83861115610b0057610aff610ad6565b5b6001850283019150848603905094509492505050565b600082905092915050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600082821b905092915050565b6000610b668383610b16565b82610b718135610b21565b92506014821015610bb157610bac7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000083601403600802610b4d565b831692505b505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b610c2081610975565b82525050565b6000604082019050610c3b600083018561083b565b610c486020830184610c17565b9392505050565b60008115159050919050565b610c6481610c4f565b8114610c6f57600080fd5b50565b600081519050610c8181610c5b565b92915050565b600060208284031215610c9d57610c9c61074d565b5b6000610cab84828501610c72565b91505092915050565b6000819050919050565b6000819050919050565b6000610ce3610cde610cd984610cb4565b610cbe565b610975565b9050919050565b610cf381610cc8565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b610d2e81610829565b82525050565b6000610d408383610d25565b60208301905092915050565b6000602082019050919050565b6000610d6482610cf9565b610d6e8185610d04565b9350610d7983610d15565b8060005b83811015610daa578151610d918882610d34565b9750610d9c83610d4c565b925050600181019050610d7d565b5085935050505092915050565b600060a082019050610dcc6000830188610c17565b610dd96020830187610cea565b8181036040830152610deb8186610d59565b9050610dfa606083018561083b565b610e076080830184610c17565b9695505050505050565b610e1a82610890565b810181811067ffffffffffffffff82111715610e3957610e38610bb9565b5b80604052505050565b6000610e4c610743565b9050610e588282610e11565b919050565b600067ffffffffffffffff821115610e7857610e77610bb9565b5b602082029050602081019050919050565b600081519050610e988161097f565b92915050565b6000610eb1610eac84610e5d565b610e42565b90508083825260208201905060208402830185811115610ed457610ed3610761565b5b835b81811015610efd5780610ee98882610e89565b845260208401935050602081019050610ed6565b5050509392505050565b600082601f830112610f1c57610f1b610757565b5b8151610f2c848260208601610e9e565b91505092915050565b600060208284031215610f4b57610f4a61074d565b5b600082015167ffffffffffffffff811115610f6957610f68610752565b5b610f7584828501610f07565b91505092915050565b600081519050610f8d81610949565b92915050565b60008060408385031215610faa57610fa961074d565b5b6000610fb885828601610f7e565b9250506020610fc985828601610e89565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061100d82610975565b915061101883610975565b925082820261102681610975565b9150828204841483151761103d5761103c610fd3565b5b5092915050565b6000604082019050818103600083015261105e81856108a1565b905061106d6020830184610c17565b9392505050565b60008160601b9050919050565b600061108c82611074565b9050919050565b600061109e82611081565b9050919050565b6110b66110b182610829565b611093565b82525050565b600081905092915050565b82818337600083830152505050565b60006110e283856110bc565b93506110ef8385846110c7565b82840190509392505050565b600061110782866110a5565b6014820191506111188284866110d6565b915081905094935050505056fea2646970667358221220e59a6599851c1ec787995687e8a35035524f5024bc92edd5c91793d9c6e77adf64736f6c63430008170033 diff --git a/contrib/localnet/orchestrator/smoketest/contracts/zevmswap/ZEVMSwapApp.go b/contrib/localnet/orchestrator/smoketest/contracts/zevmswap/ZEVMSwapApp.go index 2aa91eb530..b02a69f878 100644 --- a/contrib/localnet/orchestrator/smoketest/contracts/zevmswap/ZEVMSwapApp.go +++ b/contrib/localnet/orchestrator/smoketest/contracts/zevmswap/ZEVMSwapApp.go @@ -26,6 +26,7 @@ var ( _ = common.Big1 _ = types.BloomLookup _ = event.NewSubscription + _ = abi.ConvertType ) // Context is an auto generated low-level Go binding around an user-defined struct. @@ -38,7 +39,7 @@ type Context struct { // ZEVMSwapAppMetaData contains all meta data concerning the ZEVMSwapApp contract. var ZEVMSwapAppMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"router02_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"systemContract_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"InvalidSender\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LowAmount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"decodeMemo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"targetZRC20\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"recipient\",\"type\":\"bytes\"}],\"name\":\"encodeMemo\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"origin\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainID\",\"type\":\"uint256\"}],\"internalType\":\"structContext\",\"name\":\"\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"zrc20\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"onCrossChainCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"router02\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"systemContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x60c06040523480156200001157600080fd5b5060405162001333380380620013338339818101604052810190620000379190620000c4565b8173ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1660601b815250508073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1660601b8152505050506200015e565b600081519050620000be8162000144565b92915050565b60008060408385031215620000de57620000dd6200013f565b5b6000620000ee85828601620000ad565b92505060206200010185828601620000ad565b9150509250929050565b600062000118826200011f565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600080fd5b6200014f816200010b565b81146200015b57600080fd5b50565b60805160601c60a05160601c6111946200019f600039600081816101b201526101fa0152600081816101d60152818161039d015261043101526111946000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063a06ea8bc1461005c578063bb88b7691461008d578063bd00c9c4146100ab578063de43156e146100c9578063df73044e146100e5575b600080fd5b61007660048036038101906100719190610a30565b610115565b604051610084929190610c8d565b60405180910390f35b6100956101b0565b6040516100a29190610c72565b60405180910390f35b6100b36101d4565b6040516100c09190610c72565b60405180910390f35b6100e360048036038101906100de9190610a7d565b6101f8565b005b6100ff60048036038101906100fa919061091a565b61076f565b60405161010c9190610ce6565b60405180910390f35b600060608060008585905090506000868660009060149261013893929190610e4e565b906101439190610f31565b60601c90508686601490809261015b93929190610e4e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505092508083945094505050509250929050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461027d576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000606061028b8484610115565b80925081935050506060600267ffffffffffffffff8111156102b0576102af611097565b5b6040519080825280602002602001820160405280156102de5781602001602082028036833780820191505090505b50905086816000815181106102f6576102f5611068565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828160018151811061034557610344611068565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508673ffffffffffffffffffffffffffffffffffffffff1663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000886040518363ffffffff1660e01b81526004016103da929190610cbd565b602060405180830381600087803b1580156103f457600080fd5b505af1158015610408573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061042c9190610a03565b5060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166338ed17398860008530680100000000000000006040518663ffffffff1660e01b815260040161049a959493929190610d38565b600060405180830381600087803b1580156104b457600080fd5b505af11580156104c8573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906104f191906109ba565b90506000808573ffffffffffffffffffffffffffffffffffffffff1663d9eeebed6040518163ffffffff1660e01b8152600401604080518083038186803b15801561053b57600080fd5b505afa15801561054f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610573919061097a565b915091508173ffffffffffffffffffffffffffffffffffffffff1663095ea7b387836040518363ffffffff1660e01b81526004016105b2929190610cbd565b602060405180830381600087803b1580156105cc57600080fd5b505af11580156105e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106049190610a03565b508573ffffffffffffffffffffffffffffffffffffffff1663095ea7b3878560018151811061063657610635611068565b5b60200260200101516040518363ffffffff1660e01b815260040161065b929190610cbd565b602060405180830381600087803b15801561067557600080fd5b505af1158015610689573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ad9190610a03565b508573ffffffffffffffffffffffffffffffffffffffff1663c70126268683866001815181106106e0576106df611068565b5b60200260200101516106f29190610e89565b6040518363ffffffff1660e01b815260040161070f929190610d08565b602060405180830381600087803b15801561072957600080fd5b505af115801561073d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107619190610a03565b505050505050505050505050565b606083838360405160200161078693929190610c48565b60405160208183030381529060405290509392505050565b60006107b16107ac84610db7565b610d92565b905080838252602082019050828560208602820111156107d4576107d36110df565b5b60005b8581101561080457816107ea8882610905565b8452602084019350602083019250506001810190506107d7565b5050509392505050565b60008135905061081d81611119565b92915050565b60008151905061083281611119565b92915050565b600082601f83011261084d5761084c6110cb565b5b815161085d84826020860161079e565b91505092915050565b60008151905061087581611130565b92915050565b60008083601f840112610891576108906110cb565b5b8235905067ffffffffffffffff8111156108ae576108ad6110c6565b5b6020830191508360018202830111156108ca576108c96110df565b5b9250929050565b6000606082840312156108e7576108e66110d0565b5b81905092915050565b6000813590506108ff81611147565b92915050565b60008151905061091481611147565b92915050565b600080600060408486031215610933576109326110e9565b5b60006109418682870161080e565b935050602084013567ffffffffffffffff811115610962576109616110e4565b5b61096e8682870161087b565b92509250509250925092565b60008060408385031215610991576109906110e9565b5b600061099f85828601610823565b92505060206109b085828601610905565b9150509250929050565b6000602082840312156109d0576109cf6110e9565b5b600082015167ffffffffffffffff8111156109ee576109ed6110e4565b5b6109fa84828501610838565b91505092915050565b600060208284031215610a1957610a186110e9565b5b6000610a2784828501610866565b91505092915050565b60008060208385031215610a4757610a466110e9565b5b600083013567ffffffffffffffff811115610a6557610a646110e4565b5b610a718582860161087b565b92509250509250929050565b600080600080600060808688031215610a9957610a986110e9565b5b600086013567ffffffffffffffff811115610ab757610ab66110e4565b5b610ac3888289016108d1565b9550506020610ad48882890161080e565b9450506040610ae5888289016108f0565b935050606086013567ffffffffffffffff811115610b0657610b056110e4565b5b610b128882890161087b565b92509250509295509295909350565b6000610b2d8383610b39565b60208301905092915050565b610b4281610ebd565b82525050565b610b5181610ebd565b82525050565b610b68610b6382610ebd565b611015565b82525050565b6000610b7982610df3565b610b838185610e21565b9350610b8e83610de3565b8060005b83811015610bbf578151610ba68882610b21565b9750610bb183610e14565b925050600181019050610b92565b5085935050505092915050565b6000610bd88385610e43565b9350610be5838584610fa2565b82840190509392505050565b6000610bfc82610e09565b610c068185610e32565b9350610c16818560208601610fb1565b610c1f816110ee565b840191505092915050565b610c3381610f90565b82525050565b610c4281610f27565b82525050565b6000610c548286610b57565b601482019150610c65828486610bcc565b9150819050949350505050565b6000602082019050610c876000830184610b48565b92915050565b6000604082019050610ca26000830185610b48565b8181036020830152610cb48184610bf1565b90509392505050565b6000604082019050610cd26000830185610b48565b610cdf6020830184610c39565b9392505050565b60006020820190508181036000830152610d008184610bf1565b905092915050565b60006040820190508181036000830152610d228185610bf1565b9050610d316020830184610c39565b9392505050565b600060a082019050610d4d6000830188610c39565b610d5a6020830187610c2a565b8181036040830152610d6c8186610b6e565b9050610d7b6060830185610b48565b610d886080830184610c39565b9695505050505050565b6000610d9c610dad565b9050610da88282610fe4565b919050565b6000604051905090565b600067ffffffffffffffff821115610dd257610dd1611097565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600082905092915050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b60008085851115610e6257610e616110da565b5b83861115610e7357610e726110d5565b5b6001850283019150848603905094509492505050565b6000610e9482610f27565b9150610e9f83610f27565b925082821015610eb257610eb1611039565b5b828203905092915050565b6000610ec882610f07565b9050919050565b60008115159050919050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000610f3d8383610dfe565b82610f488135610edb565b92506014821015610f8857610f837fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008360140360080261110c565b831692505b505092915050565b6000610f9b82610f27565b9050919050565b82818337600083830152505050565b60005b83811015610fcf578082015181840152602081019050610fb4565b83811115610fde576000848401525b50505050565b610fed826110ee565b810181811067ffffffffffffffff8211171561100c5761100b611097565b5b80604052505050565b600061102082611027565b9050919050565b6000611032826110ff565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b600082821b905092915050565b61112281610ebd565b811461112d57600080fd5b50565b61113981610ecf565b811461114457600080fd5b50565b61115081610f27565b811461115b57600080fd5b5056fea264697066735822122077546c2f4741f7d79b7a2e01a3100f966ababfb11046c7872e4f310304d04ce564736f6c63430008070033", + Bin: "0x60c06040523480156200001157600080fd5b50604051620012ee380380620012ee833981810160405281019062000037919062000111565b8173ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250508073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1681525050505062000158565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620000d982620000ac565b9050919050565b620000eb81620000cc565b8114620000f757600080fd5b50565b6000815190506200010b81620000e0565b92915050565b600080604083850312156200012b576200012a620000a7565b5b60006200013b85828601620000fa565b92505060206200014e85828601620000fa565b9150509250929050565b60805160a05161115b62000193600039600081816101b101526101f90152600081816101d50152818161039b0152610420015261115b6000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063a06ea8bc1461005c578063bb88b7691461008d578063bd00c9c4146100ab578063de43156e146100c9578063df73044e146100e5575b600080fd5b610076600480360381019061007191906107bc565b610115565b6040516100849291906108da565b60405180910390f35b6100956101af565b6040516100a2919061090a565b60405180910390f35b6100b36101d3565b6040516100c0919061090a565b60405180910390f35b6100e360048036038101906100de91906109ab565b6101f7565b005b6100ff60048036038101906100fa9190610a4f565b610714565b60405161010c9190610aaf565b60405180910390f35b6000606080600080868690509150868660009060149261013793929190610adb565b906101429190610b5a565b60601c90508686601490809261015a93929190610adb565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505092508083945094505050509250929050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461027c576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060608061028b8585610115565b8093508194505050600267ffffffffffffffff8111156102ae576102ad610bb9565b5b6040519080825280602002602001820160405280156102dc5781602001602082028036833780820191505090505b50905086816000815181106102f4576102f3610be8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828160018151811061034357610342610be8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508673ffffffffffffffffffffffffffffffffffffffff1663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000886040518363ffffffff1660e01b81526004016103d8929190610c26565b6020604051808303816000875af11580156103f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041b9190610c87565b5060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166338ed17398860008530680100000000000000006040518663ffffffff1660e01b8152600401610489959493929190610db7565b6000604051808303816000875af11580156104a8573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906104d19190610f35565b90506000808573ffffffffffffffffffffffffffffffffffffffff1663d9eeebed6040518163ffffffff1660e01b81526004016040805180830381865afa158015610520573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105449190610f93565b915091508173ffffffffffffffffffffffffffffffffffffffff1663095ea7b387836040518363ffffffff1660e01b8152600401610583929190610c26565b6020604051808303816000875af11580156105a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c69190610c87565b508573ffffffffffffffffffffffffffffffffffffffff1663095ea7b387600a866001815181106105fa576105f9610be8565b5b602002602001015161060c9190611002565b6040518363ffffffff1660e01b8152600401610629929190610c26565b6020604051808303816000875af1158015610648573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066c9190610c87565b508573ffffffffffffffffffffffffffffffffffffffff1663c7012626868560018151811061069e5761069d610be8565b5b60200260200101516040518363ffffffff1660e01b81526004016106c3929190611044565b6020604051808303816000875af11580156106e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107069190610c87565b505050505050505050505050565b606083838360405160200161072b939291906110fb565b60405160208183030381529060405290509392505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f84011261077c5761077b610757565b5b8235905067ffffffffffffffff8111156107995761079861075c565b5b6020830191508360018202830111156107b5576107b4610761565b5b9250929050565b600080602083850312156107d3576107d261074d565b5b600083013567ffffffffffffffff8111156107f1576107f0610752565b5b6107fd85828601610766565b92509250509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061083482610809565b9050919050565b61084481610829565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610884578082015181840152602081019050610869565b60008484015250505050565b6000601f19601f8301169050919050565b60006108ac8261084a565b6108b68185610855565b93506108c6818560208601610866565b6108cf81610890565b840191505092915050565b60006040820190506108ef600083018561083b565b818103602083015261090181846108a1565b90509392505050565b600060208201905061091f600083018461083b565b92915050565b600080fd5b6000606082840312156109405761093f610925565b5b81905092915050565b61095281610829565b811461095d57600080fd5b50565b60008135905061096f81610949565b92915050565b6000819050919050565b61098881610975565b811461099357600080fd5b50565b6000813590506109a58161097f565b92915050565b6000806000806000608086880312156109c7576109c661074d565b5b600086013567ffffffffffffffff8111156109e5576109e4610752565b5b6109f18882890161092a565b9550506020610a0288828901610960565b9450506040610a1388828901610996565b935050606086013567ffffffffffffffff811115610a3457610a33610752565b5b610a4088828901610766565b92509250509295509295909350565b600080600060408486031215610a6857610a6761074d565b5b6000610a7686828701610960565b935050602084013567ffffffffffffffff811115610a9757610a96610752565b5b610aa386828701610766565b92509250509250925092565b60006020820190508181036000830152610ac981846108a1565b905092915050565b600080fd5b600080fd5b60008085851115610aef57610aee610ad1565b5b83861115610b0057610aff610ad6565b5b6001850283019150848603905094509492505050565b600082905092915050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600082821b905092915050565b6000610b668383610b16565b82610b718135610b21565b92506014821015610bb157610bac7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000083601403600802610b4d565b831692505b505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b610c2081610975565b82525050565b6000604082019050610c3b600083018561083b565b610c486020830184610c17565b9392505050565b60008115159050919050565b610c6481610c4f565b8114610c6f57600080fd5b50565b600081519050610c8181610c5b565b92915050565b600060208284031215610c9d57610c9c61074d565b5b6000610cab84828501610c72565b91505092915050565b6000819050919050565b6000819050919050565b6000610ce3610cde610cd984610cb4565b610cbe565b610975565b9050919050565b610cf381610cc8565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b610d2e81610829565b82525050565b6000610d408383610d25565b60208301905092915050565b6000602082019050919050565b6000610d6482610cf9565b610d6e8185610d04565b9350610d7983610d15565b8060005b83811015610daa578151610d918882610d34565b9750610d9c83610d4c565b925050600181019050610d7d565b5085935050505092915050565b600060a082019050610dcc6000830188610c17565b610dd96020830187610cea565b8181036040830152610deb8186610d59565b9050610dfa606083018561083b565b610e076080830184610c17565b9695505050505050565b610e1a82610890565b810181811067ffffffffffffffff82111715610e3957610e38610bb9565b5b80604052505050565b6000610e4c610743565b9050610e588282610e11565b919050565b600067ffffffffffffffff821115610e7857610e77610bb9565b5b602082029050602081019050919050565b600081519050610e988161097f565b92915050565b6000610eb1610eac84610e5d565b610e42565b90508083825260208201905060208402830185811115610ed457610ed3610761565b5b835b81811015610efd5780610ee98882610e89565b845260208401935050602081019050610ed6565b5050509392505050565b600082601f830112610f1c57610f1b610757565b5b8151610f2c848260208601610e9e565b91505092915050565b600060208284031215610f4b57610f4a61074d565b5b600082015167ffffffffffffffff811115610f6957610f68610752565b5b610f7584828501610f07565b91505092915050565b600081519050610f8d81610949565b92915050565b60008060408385031215610faa57610fa961074d565b5b6000610fb885828601610f7e565b9250506020610fc985828601610e89565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061100d82610975565b915061101883610975565b925082820261102681610975565b9150828204841483151761103d5761103c610fd3565b5b5092915050565b6000604082019050818103600083015261105e81856108a1565b905061106d6020830184610c17565b9392505050565b60008160601b9050919050565b600061108c82611074565b9050919050565b600061109e82611081565b9050919050565b6110b66110b182610829565b611093565b82525050565b600081905092915050565b82818337600083830152505050565b60006110e283856110bc565b93506110ef8385846110c7565b82840190509392505050565b600061110782866110a5565b6014820191506111188284866110d6565b915081905094935050505056fea2646970667358221220e59a6599851c1ec787995687e8a35035524f5024bc92edd5c91793d9c6e77adf64736f6c63430008170033", } // ZEVMSwapAppABI is the input ABI used to generate the binding from. @@ -163,11 +164,11 @@ func NewZEVMSwapAppFilterer(address common.Address, filterer bind.ContractFilter // bindZEVMSwapApp binds a generic wrapper to an already deployed contract. func bindZEVMSwapApp(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := abi.JSON(strings.NewReader(ZEVMSwapAppABI)) + parsed, err := ZEVMSwapAppMetaData.GetAbi() if err != nil { return nil, err } - return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil } // Call invokes the (constant) contract method with params as input values and diff --git a/contrib/localnet/orchestrator/smoketest/contracts/zevmswap/ZEVMSwapApp.json b/contrib/localnet/orchestrator/smoketest/contracts/zevmswap/ZEVMSwapApp.json index ff164359a6..5c803781fa 100644 --- a/contrib/localnet/orchestrator/smoketest/contracts/zevmswap/ZEVMSwapApp.json +++ b/contrib/localnet/orchestrator/smoketest/contracts/zevmswap/ZEVMSwapApp.json @@ -146,5 +146,5 @@ "type": "function" } ], - "bin": "60c06040523480156200001157600080fd5b5060405162001333380380620013338339818101604052810190620000379190620000c4565b8173ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1660601b815250508073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1660601b8152505050506200015e565b600081519050620000be8162000144565b92915050565b60008060408385031215620000de57620000dd6200013f565b5b6000620000ee85828601620000ad565b92505060206200010185828601620000ad565b9150509250929050565b600062000118826200011f565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600080fd5b6200014f816200010b565b81146200015b57600080fd5b50565b60805160601c60a05160601c6111946200019f600039600081816101b201526101fa0152600081816101d60152818161039d015261043101526111946000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063a06ea8bc1461005c578063bb88b7691461008d578063bd00c9c4146100ab578063de43156e146100c9578063df73044e146100e5575b600080fd5b61007660048036038101906100719190610a30565b610115565b604051610084929190610c8d565b60405180910390f35b6100956101b0565b6040516100a29190610c72565b60405180910390f35b6100b36101d4565b6040516100c09190610c72565b60405180910390f35b6100e360048036038101906100de9190610a7d565b6101f8565b005b6100ff60048036038101906100fa919061091a565b61076f565b60405161010c9190610ce6565b60405180910390f35b600060608060008585905090506000868660009060149261013893929190610e4e565b906101439190610f31565b60601c90508686601490809261015b93929190610e4e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505092508083945094505050509250929050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461027d576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000606061028b8484610115565b80925081935050506060600267ffffffffffffffff8111156102b0576102af611097565b5b6040519080825280602002602001820160405280156102de5781602001602082028036833780820191505090505b50905086816000815181106102f6576102f5611068565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828160018151811061034557610344611068565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508673ffffffffffffffffffffffffffffffffffffffff1663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000886040518363ffffffff1660e01b81526004016103da929190610cbd565b602060405180830381600087803b1580156103f457600080fd5b505af1158015610408573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061042c9190610a03565b5060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166338ed17398860008530680100000000000000006040518663ffffffff1660e01b815260040161049a959493929190610d38565b600060405180830381600087803b1580156104b457600080fd5b505af11580156104c8573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906104f191906109ba565b90506000808573ffffffffffffffffffffffffffffffffffffffff1663d9eeebed6040518163ffffffff1660e01b8152600401604080518083038186803b15801561053b57600080fd5b505afa15801561054f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610573919061097a565b915091508173ffffffffffffffffffffffffffffffffffffffff1663095ea7b387836040518363ffffffff1660e01b81526004016105b2929190610cbd565b602060405180830381600087803b1580156105cc57600080fd5b505af11580156105e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106049190610a03565b508573ffffffffffffffffffffffffffffffffffffffff1663095ea7b3878560018151811061063657610635611068565b5b60200260200101516040518363ffffffff1660e01b815260040161065b929190610cbd565b602060405180830381600087803b15801561067557600080fd5b505af1158015610689573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ad9190610a03565b508573ffffffffffffffffffffffffffffffffffffffff1663c70126268683866001815181106106e0576106df611068565b5b60200260200101516106f29190610e89565b6040518363ffffffff1660e01b815260040161070f929190610d08565b602060405180830381600087803b15801561072957600080fd5b505af115801561073d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107619190610a03565b505050505050505050505050565b606083838360405160200161078693929190610c48565b60405160208183030381529060405290509392505050565b60006107b16107ac84610db7565b610d92565b905080838252602082019050828560208602820111156107d4576107d36110df565b5b60005b8581101561080457816107ea8882610905565b8452602084019350602083019250506001810190506107d7565b5050509392505050565b60008135905061081d81611119565b92915050565b60008151905061083281611119565b92915050565b600082601f83011261084d5761084c6110cb565b5b815161085d84826020860161079e565b91505092915050565b60008151905061087581611130565b92915050565b60008083601f840112610891576108906110cb565b5b8235905067ffffffffffffffff8111156108ae576108ad6110c6565b5b6020830191508360018202830111156108ca576108c96110df565b5b9250929050565b6000606082840312156108e7576108e66110d0565b5b81905092915050565b6000813590506108ff81611147565b92915050565b60008151905061091481611147565b92915050565b600080600060408486031215610933576109326110e9565b5b60006109418682870161080e565b935050602084013567ffffffffffffffff811115610962576109616110e4565b5b61096e8682870161087b565b92509250509250925092565b60008060408385031215610991576109906110e9565b5b600061099f85828601610823565b92505060206109b085828601610905565b9150509250929050565b6000602082840312156109d0576109cf6110e9565b5b600082015167ffffffffffffffff8111156109ee576109ed6110e4565b5b6109fa84828501610838565b91505092915050565b600060208284031215610a1957610a186110e9565b5b6000610a2784828501610866565b91505092915050565b60008060208385031215610a4757610a466110e9565b5b600083013567ffffffffffffffff811115610a6557610a646110e4565b5b610a718582860161087b565b92509250509250929050565b600080600080600060808688031215610a9957610a986110e9565b5b600086013567ffffffffffffffff811115610ab757610ab66110e4565b5b610ac3888289016108d1565b9550506020610ad48882890161080e565b9450506040610ae5888289016108f0565b935050606086013567ffffffffffffffff811115610b0657610b056110e4565b5b610b128882890161087b565b92509250509295509295909350565b6000610b2d8383610b39565b60208301905092915050565b610b4281610ebd565b82525050565b610b5181610ebd565b82525050565b610b68610b6382610ebd565b611015565b82525050565b6000610b7982610df3565b610b838185610e21565b9350610b8e83610de3565b8060005b83811015610bbf578151610ba68882610b21565b9750610bb183610e14565b925050600181019050610b92565b5085935050505092915050565b6000610bd88385610e43565b9350610be5838584610fa2565b82840190509392505050565b6000610bfc82610e09565b610c068185610e32565b9350610c16818560208601610fb1565b610c1f816110ee565b840191505092915050565b610c3381610f90565b82525050565b610c4281610f27565b82525050565b6000610c548286610b57565b601482019150610c65828486610bcc565b9150819050949350505050565b6000602082019050610c876000830184610b48565b92915050565b6000604082019050610ca26000830185610b48565b8181036020830152610cb48184610bf1565b90509392505050565b6000604082019050610cd26000830185610b48565b610cdf6020830184610c39565b9392505050565b60006020820190508181036000830152610d008184610bf1565b905092915050565b60006040820190508181036000830152610d228185610bf1565b9050610d316020830184610c39565b9392505050565b600060a082019050610d4d6000830188610c39565b610d5a6020830187610c2a565b8181036040830152610d6c8186610b6e565b9050610d7b6060830185610b48565b610d886080830184610c39565b9695505050505050565b6000610d9c610dad565b9050610da88282610fe4565b919050565b6000604051905090565b600067ffffffffffffffff821115610dd257610dd1611097565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600082905092915050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b60008085851115610e6257610e616110da565b5b83861115610e7357610e726110d5565b5b6001850283019150848603905094509492505050565b6000610e9482610f27565b9150610e9f83610f27565b925082821015610eb257610eb1611039565b5b828203905092915050565b6000610ec882610f07565b9050919050565b60008115159050919050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000610f3d8383610dfe565b82610f488135610edb565b92506014821015610f8857610f837fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008360140360080261110c565b831692505b505092915050565b6000610f9b82610f27565b9050919050565b82818337600083830152505050565b60005b83811015610fcf578082015181840152602081019050610fb4565b83811115610fde576000848401525b50505050565b610fed826110ee565b810181811067ffffffffffffffff8211171561100c5761100b611097565b5b80604052505050565b600061102082611027565b9050919050565b6000611032826110ff565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b600082821b905092915050565b61112281610ebd565b811461112d57600080fd5b50565b61113981610ecf565b811461114457600080fd5b50565b61115081610f27565b811461115b57600080fd5b5056fea264697066735822122077546c2f4741f7d79b7a2e01a3100f966ababfb11046c7872e4f310304d04ce564736f6c63430008070033" + "bin": "60c06040523480156200001157600080fd5b50604051620012ee380380620012ee833981810160405281019062000037919062000111565b8173ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250508073ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1681525050505062000158565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620000d982620000ac565b9050919050565b620000eb81620000cc565b8114620000f757600080fd5b50565b6000815190506200010b81620000e0565b92915050565b600080604083850312156200012b576200012a620000a7565b5b60006200013b85828601620000fa565b92505060206200014e85828601620000fa565b9150509250929050565b60805160a05161115b62000193600039600081816101b101526101f90152600081816101d50152818161039b0152610420015261115b6000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063a06ea8bc1461005c578063bb88b7691461008d578063bd00c9c4146100ab578063de43156e146100c9578063df73044e146100e5575b600080fd5b610076600480360381019061007191906107bc565b610115565b6040516100849291906108da565b60405180910390f35b6100956101af565b6040516100a2919061090a565b60405180910390f35b6100b36101d3565b6040516100c0919061090a565b60405180910390f35b6100e360048036038101906100de91906109ab565b6101f7565b005b6100ff60048036038101906100fa9190610a4f565b610714565b60405161010c9190610aaf565b60405180910390f35b6000606080600080868690509150868660009060149261013793929190610adb565b906101429190610b5a565b60601c90508686601490809261015a93929190610adb565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505092508083945094505050509250929050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461027c576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060608061028b8585610115565b8093508194505050600267ffffffffffffffff8111156102ae576102ad610bb9565b5b6040519080825280602002602001820160405280156102dc5781602001602082028036833780820191505090505b50905086816000815181106102f4576102f3610be8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828160018151811061034357610342610be8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508673ffffffffffffffffffffffffffffffffffffffff1663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000886040518363ffffffff1660e01b81526004016103d8929190610c26565b6020604051808303816000875af11580156103f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041b9190610c87565b5060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166338ed17398860008530680100000000000000006040518663ffffffff1660e01b8152600401610489959493929190610db7565b6000604051808303816000875af11580156104a8573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906104d19190610f35565b90506000808573ffffffffffffffffffffffffffffffffffffffff1663d9eeebed6040518163ffffffff1660e01b81526004016040805180830381865afa158015610520573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105449190610f93565b915091508173ffffffffffffffffffffffffffffffffffffffff1663095ea7b387836040518363ffffffff1660e01b8152600401610583929190610c26565b6020604051808303816000875af11580156105a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c69190610c87565b508573ffffffffffffffffffffffffffffffffffffffff1663095ea7b387600a866001815181106105fa576105f9610be8565b5b602002602001015161060c9190611002565b6040518363ffffffff1660e01b8152600401610629929190610c26565b6020604051808303816000875af1158015610648573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066c9190610c87565b508573ffffffffffffffffffffffffffffffffffffffff1663c7012626868560018151811061069e5761069d610be8565b5b60200260200101516040518363ffffffff1660e01b81526004016106c3929190611044565b6020604051808303816000875af11580156106e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107069190610c87565b505050505050505050505050565b606083838360405160200161072b939291906110fb565b60405160208183030381529060405290509392505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f84011261077c5761077b610757565b5b8235905067ffffffffffffffff8111156107995761079861075c565b5b6020830191508360018202830111156107b5576107b4610761565b5b9250929050565b600080602083850312156107d3576107d261074d565b5b600083013567ffffffffffffffff8111156107f1576107f0610752565b5b6107fd85828601610766565b92509250509250929050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061083482610809565b9050919050565b61084481610829565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610884578082015181840152602081019050610869565b60008484015250505050565b6000601f19601f8301169050919050565b60006108ac8261084a565b6108b68185610855565b93506108c6818560208601610866565b6108cf81610890565b840191505092915050565b60006040820190506108ef600083018561083b565b818103602083015261090181846108a1565b90509392505050565b600060208201905061091f600083018461083b565b92915050565b600080fd5b6000606082840312156109405761093f610925565b5b81905092915050565b61095281610829565b811461095d57600080fd5b50565b60008135905061096f81610949565b92915050565b6000819050919050565b61098881610975565b811461099357600080fd5b50565b6000813590506109a58161097f565b92915050565b6000806000806000608086880312156109c7576109c661074d565b5b600086013567ffffffffffffffff8111156109e5576109e4610752565b5b6109f18882890161092a565b9550506020610a0288828901610960565b9450506040610a1388828901610996565b935050606086013567ffffffffffffffff811115610a3457610a33610752565b5b610a4088828901610766565b92509250509295509295909350565b600080600060408486031215610a6857610a6761074d565b5b6000610a7686828701610960565b935050602084013567ffffffffffffffff811115610a9757610a96610752565b5b610aa386828701610766565b92509250509250925092565b60006020820190508181036000830152610ac981846108a1565b905092915050565b600080fd5b600080fd5b60008085851115610aef57610aee610ad1565b5b83861115610b0057610aff610ad6565b5b6001850283019150848603905094509492505050565b600082905092915050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600082821b905092915050565b6000610b668383610b16565b82610b718135610b21565b92506014821015610bb157610bac7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000083601403600802610b4d565b831692505b505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b610c2081610975565b82525050565b6000604082019050610c3b600083018561083b565b610c486020830184610c17565b9392505050565b60008115159050919050565b610c6481610c4f565b8114610c6f57600080fd5b50565b600081519050610c8181610c5b565b92915050565b600060208284031215610c9d57610c9c61074d565b5b6000610cab84828501610c72565b91505092915050565b6000819050919050565b6000819050919050565b6000610ce3610cde610cd984610cb4565b610cbe565b610975565b9050919050565b610cf381610cc8565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b610d2e81610829565b82525050565b6000610d408383610d25565b60208301905092915050565b6000602082019050919050565b6000610d6482610cf9565b610d6e8185610d04565b9350610d7983610d15565b8060005b83811015610daa578151610d918882610d34565b9750610d9c83610d4c565b925050600181019050610d7d565b5085935050505092915050565b600060a082019050610dcc6000830188610c17565b610dd96020830187610cea565b8181036040830152610deb8186610d59565b9050610dfa606083018561083b565b610e076080830184610c17565b9695505050505050565b610e1a82610890565b810181811067ffffffffffffffff82111715610e3957610e38610bb9565b5b80604052505050565b6000610e4c610743565b9050610e588282610e11565b919050565b600067ffffffffffffffff821115610e7857610e77610bb9565b5b602082029050602081019050919050565b600081519050610e988161097f565b92915050565b6000610eb1610eac84610e5d565b610e42565b90508083825260208201905060208402830185811115610ed457610ed3610761565b5b835b81811015610efd5780610ee98882610e89565b845260208401935050602081019050610ed6565b5050509392505050565b600082601f830112610f1c57610f1b610757565b5b8151610f2c848260208601610e9e565b91505092915050565b600060208284031215610f4b57610f4a61074d565b5b600082015167ffffffffffffffff811115610f6957610f68610752565b5b610f7584828501610f07565b91505092915050565b600081519050610f8d81610949565b92915050565b60008060408385031215610faa57610fa961074d565b5b6000610fb885828601610f7e565b9250506020610fc985828601610e89565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061100d82610975565b915061101883610975565b925082820261102681610975565b9150828204841483151761103d5761103c610fd3565b5b5092915050565b6000604082019050818103600083015261105e81856108a1565b905061106d6020830184610c17565b9392505050565b60008160601b9050919050565b600061108c82611074565b9050919050565b600061109e82611081565b9050919050565b6110b66110b182610829565b611093565b82525050565b600081905092915050565b82818337600083830152505050565b60006110e283856110bc565b93506110ef8385846110c7565b82840190509392505050565b600061110782866110a5565b6014820191506111188284866110d6565b915081905094935050505056fea2646970667358221220e59a6599851c1ec787995687e8a35035524f5024bc92edd5c91793d9c6e77adf64736f6c63430008170033" } diff --git a/contrib/localnet/orchestrator/smoketest/contracts/zevmswap/ZEVMSwapApp.sol b/contrib/localnet/orchestrator/smoketest/contracts/zevmswap/ZEVMSwapApp.sol index 21be9ab61f..e9f098699d 100644 --- a/contrib/localnet/orchestrator/smoketest/contracts/zevmswap/ZEVMSwapApp.sol +++ b/contrib/localnet/orchestrator/smoketest/contracts/zevmswap/ZEVMSwapApp.sol @@ -17,42 +17,29 @@ interface zContract { bytes calldata message ) external; } + interface IZRC20 { function totalSupply() external view returns (uint256); - function balanceOf(address account) external view returns (uint256); - function transfer(address recipient, uint256 amount) external returns (bool); - function allowance(address owner, address spender) external view returns (uint256); - function approve(address spender, uint256 amount) external returns (bool); - function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); - function deposit(address to, uint256 amount) external returns (bool); - function burn(address account, uint256 amount) external returns (bool); - function withdraw(bytes memory to, uint256 amount) external returns (bool); - function withdrawGasFee() external view returns (address, uint256); - function PROTOCOL_FEE() external view returns (uint256); - event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); event Deposit(bytes from, address indexed to, uint256 value); event Withdrawal(address indexed from, bytes to, uint256 value, uint256 gasFee, uint256 protocolFlatFee); } - - - contract ZEVMSwapApp is zContract { error InvalidSender(); error LowAmount(); @@ -67,44 +54,46 @@ contract ZEVMSwapApp is zContract { } function encodeMemo(address targetZRC20, bytes calldata recipient) pure external returns (bytes memory) { -// return abi.encode(targetZRC20, recipient, minAmountOut); return abi.encodePacked(targetZRC20, recipient); } - // data function decodeMemo(bytes calldata data) pure public returns (address, bytes memory) { bytes memory decodedBytes; uint256 size; - size = data.length; address addr; + + size = data.length; addr = address(uint160(bytes20(data[0:20]))); decodedBytes = data[20:]; return (addr, decodedBytes); } - - // Call this function to perform a cross-chain swap + // Perform a cross-chain swap function onCrossChainCall(Context calldata, address zrc20, uint256 amount, bytes calldata message) external override { if (msg.sender != systemContract) { revert InvalidSender(); } + address targetZRC20; bytes memory recipient; - (targetZRC20, recipient) = decodeMemo(message); address[] memory path; + + (targetZRC20, recipient) = decodeMemo(message); path = new address[](2); path[0] = zrc20; path[1] = targetZRC20; - // Approve the usage of this token by router02 + + // approve the usage of this token by router02 IZRC20(zrc20).approve(address(router02), amount); - // Swap for your target token + + // swap for target token uint256[] memory amounts = IUniswapV2Router02(router02).swapExactTokensForTokens(amount, 0, path, address(this), _DEADLINE); - // this contract subsides withdraw gas fee + // perform withdrawal with the target token (address gasZRC20Addr,uint256 gasFee) = IZRC20(targetZRC20).withdrawGasFee(); IZRC20(gasZRC20Addr).approve(address(targetZRC20), gasFee); - IZRC20(targetZRC20).approve(address(targetZRC20), amounts[1]); // this does not seem to be necessary - IZRC20(targetZRC20).withdraw(recipient, amounts[1]-gasFee); + IZRC20(targetZRC20).approve(address(targetZRC20), amounts[1]*10); + IZRC20(targetZRC20).withdraw(recipient, amounts[1]); } } \ No newline at end of file diff --git a/contrib/localnet/orchestrator/smoketest/contracts/zevmswap/bindings.go b/contrib/localnet/orchestrator/smoketest/contracts/zevmswap/bindings.go index f87b3878ad..493d7a99c5 100644 --- a/contrib/localnet/orchestrator/smoketest/contracts/zevmswap/bindings.go +++ b/contrib/localnet/orchestrator/smoketest/contracts/zevmswap/bindings.go @@ -1,39 +1,6 @@ -// solc/abigen use version 0.8.7 -//go:generate sh -c " solc --evm-version london --allow-paths .., --combined-json abi,bin --base-path .. ZEVMSwapApp.sol | jq '.contracts.\"ZEVMSwapApp.sol:ZEVMSwapApp\"' > ZEVMSwapApp.json" +//go:generate sh -c "solc --evm-version paris ZEVMSwapApp.sol --combined-json abi,bin --allow-paths .. | jq '.contracts.\"ZEVMSwapApp.sol:ZEVMSwapApp\"' > ZEVMSwapApp.json" //go:generate sh -c "cat ZEVMSwapApp.json | jq .abi > ZEVMSwapApp.abi" //go:generate sh -c "cat ZEVMSwapApp.json | jq .bin | tr -d '\"' > ZEVMSwapApp.bin" - //go:generate sh -c "abigen --abi ZEVMSwapApp.abi --bin ZEVMSwapApp.bin --pkg zevmswap --type ZEVMSwapApp --out ZEVMSwapApp.go" package zevmswap - -import ( - _ "embed" - "encoding/json" - - "github.com/ethereum/go-ethereum/accounts/abi" - evmtypes "github.com/evmos/ethermint/x/evm/types" -) - -type CompiledContract struct { - ABI abi.ABI - Bin evmtypes.HexString -} - -var ( - //go:embed ZEVMSwapApp.json - ZEVMSwapAppJSON []byte // nolint: golint - - ZEVMSwapAppContract CompiledContract -) - -func init() { - err := json.Unmarshal(ZEVMSwapAppJSON, &ZEVMSwapAppContract) - if err != nil { - panic(err) - } - - if len(ZEVMSwapAppContract.Bin) == 0 { - panic("load contract failed") - } -} diff --git a/contrib/localnet/orchestrator/smoketest/contracts/interfaces/IUniswapV2Router01.sol b/contrib/localnet/orchestrator/smoketest/contracts/zevmswap/interfaces/IUniswapV2Router01.sol similarity index 100% rename from contrib/localnet/orchestrator/smoketest/contracts/interfaces/IUniswapV2Router01.sol rename to contrib/localnet/orchestrator/smoketest/contracts/zevmswap/interfaces/IUniswapV2Router01.sol diff --git a/contrib/localnet/orchestrator/smoketest/contracts/interfaces/IUniswapV2Router02.sol b/contrib/localnet/orchestrator/smoketest/contracts/zevmswap/interfaces/IUniswapV2Router02.sol similarity index 100% rename from contrib/localnet/orchestrator/smoketest/contracts/interfaces/IUniswapV2Router02.sol rename to contrib/localnet/orchestrator/smoketest/contracts/zevmswap/interfaces/IUniswapV2Router02.sol diff --git a/contrib/localnet/orchestrator/smoketest/main.go b/contrib/localnet/orchestrator/smoketest/main.go deleted file mode 100644 index e5b2e4391c..0000000000 --- a/contrib/localnet/orchestrator/smoketest/main.go +++ /dev/null @@ -1,325 +0,0 @@ -//go:build PRIVNET -// +build PRIVNET - -package main - -import ( - "context" - "fmt" - "math/big" - "os" - "time" - - "github.com/btcsuite/btcd/rpcclient" - "github.com/btcsuite/btcutil" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethclient" - "github.com/spf13/cobra" - "github.com/zeta-chain/zetacore/app" - "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/contracts/contextapp" - "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/contracts/zevmswap" - crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" - fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" - observertypes "github.com/zeta-chain/zetacore/x/observer/types" - "github.com/zeta-chain/zetacore/zetaclient/config" - "google.golang.org/grpc" -) - -var ( - ZetaChainID = "athens_101-1" - DeployerAddress = ethcommon.HexToAddress("0xE5C5367B8224807Ac2207d350E60e1b6F27a7ecC") - DeployerPrivateKey = "d87baf7bf6dc560a252596678c12e41f7d1682837f05b29d411bc3f78ae2c263" - TSSAddress = ethcommon.HexToAddress("0x0Da38EA1B43758F55eB97590D41e244913A00b26") - BTCTSSAddress, _ = btcutil.DecodeAddress("bcrt1q78nlhm7mr7t6z8a93z3y93k75ftppcukt5ayay", config.BitconNetParams) - BigZero = big.NewInt(0) - SmokeTestTimeout = 24 * time.Hour // smoke test fails if timeout is reached - USDTZRC20Addr = "0x48f80608B672DC30DC7e3dbBd0343c5F02C738Eb" - USDTERC20Addr = "0xff3135df4F2775f4091b81f4c7B6359CfA07862a" - ERC20CustodyAddr = "0xD28D6A0b8189305551a0A8bd247a6ECa9CE781Ca" - UniswapV2FactoryAddr = "0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c" - UniswapV2RouterAddr = "0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe" - HexToAddress = ethcommon.HexToAddress - //SystemContractAddr = "0x91d18e54DAf4F677cB28167158d6dd21F6aB3921" - //ZEVMSwapAppAddr = "0x65a45c57636f9BcCeD4fe193A602008578BcA90b" - - // FungibleAdminMnemonic is the mnemonic for the admin account of the fungible module - //nolint:gosec - disable nosec because this is a test account - FungibleAdminMnemonic = "snow grace federal cupboard arrive fancy gym lady uniform rotate exercise either leave alien grass" - FungibleAdminName = "fungibleadmin" - FungibleAdminAddress = "zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk" -) - -var RootCmd = &cobra.Command{ - Use: "smoketest", - Short: "Smoke Test CLI", -} - -var LocalCmd = &cobra.Command{ - Use: "local", - Short: "Run Local Smoketest", - Run: LocalSmokeTest, -} - -type localArgs struct { - contractsDeployed bool - waitForHeight int64 -} - -var localTestArgs = localArgs{} - -func init() { - RootCmd.AddCommand(LocalCmd) - LocalCmd.Flags().BoolVar(&localTestArgs.contractsDeployed, "deployed", false, "set to to true if running smoketest again with existing state") - LocalCmd.Flags().Int64Var(&localTestArgs.waitForHeight, "wait-for", 0, "block height for smoketest to begin, ex. --wait-for 100") -} - -func main() { - if err := RootCmd.Execute(); err != nil { - fmt.Println(err) - os.Exit(-1) - } -} - -func LocalSmokeTest(_ *cobra.Command, _ []string) { - testStartTime := time.Now() - defer func() { - fmt.Println("Smoke test took", time.Since(testStartTime)) - }() - go func() { - time.Sleep(SmokeTestTimeout) - fmt.Println("Smoke test timed out after", SmokeTestTimeout) - os.Exit(1) - }() - - if localTestArgs.waitForHeight != 0 { - WaitForBlockHeight(localTestArgs.waitForHeight) - } - - // set account prefix to zeta - cfg := sdk.GetConfig() - cfg.SetBech32PrefixForAccount(app.Bech32PrefixAccAddr, app.Bech32PrefixAccPub) - cfg.Seal() - - // initialize clients - connCfg := &rpcclient.ConnConfig{ - Host: "bitcoin:18443", - User: "smoketest", - Pass: "123", - HTTPPostMode: true, - DisableTLS: true, - Params: "testnet3", - } - btcRPCClient, err := rpcclient.New(connCfg, nil) - if err != nil { - panic(err) - } - - goerliClient, err := ethclient.Dial("http://eth:8545") - if err != nil { - panic(err) - } - - bal, err := goerliClient.BalanceAt(context.TODO(), DeployerAddress, nil) - if err != nil { - panic(err) - } - fmt.Printf("Deployer address: %s, balance: %d Ether\n", DeployerAddress.Hex(), bal.Div(bal, big.NewInt(1e18))) - - chainid, err := goerliClient.ChainID(context.Background()) - if err != nil { - panic(err) - } - deployerPrivkey, err := crypto.HexToECDSA(DeployerPrivateKey) - if err != nil { - panic(err) - } - goerliAuth, err := bind.NewKeyedTransactorWithChainID(deployerPrivkey, chainid) - if err != nil { - panic(err) - } - - grpcConn, err := grpc.Dial("zetacore0:9090", grpc.WithInsecure()) - if err != nil { - panic(err) - } - - cctxClient := crosschaintypes.NewQueryClient(grpcConn) - fungibleClient := fungibletypes.NewQueryClient(grpcConn) - authClient := authtypes.NewQueryClient(grpcConn) - bankClient := banktypes.NewQueryClient(grpcConn) - observerClient := observertypes.NewQueryClient(grpcConn) - - //Wait for Genesis - time.Sleep(30 * time.Second) - - // initialize client to send messages to ZetaChain - zetaTxServer, err := NewZetaTxServer( - "http://zetacore0:26657", - []string{FungibleAdminName}, - []string{FungibleAdminMnemonic}, - ) - if err != nil { - panic(err) - } - - //Wait for keygen to be completed. ~ height 30 - for { - time.Sleep(5 * time.Second) - response, err := cctxClient.LastZetaHeight(context.Background(), &crosschaintypes.QueryLastZetaHeightRequest{}) - if err != nil { - fmt.Printf("cctxClient.LastZetaHeight error: %s", err) - continue - } - if response.Height >= 60 { - break - } - fmt.Printf("Last ZetaHeight: %d\n", response.Height) - } - - // get the clients for tests - var zevmClient *ethclient.Client - for { - time.Sleep(5 * time.Second) - fmt.Printf("dialing zevm client: http://zetacore0:8545\n") - zevmClient, err = ethclient.Dial("http://zetacore0:8545") - if err != nil { - continue - } - break - } - chainid, err = zevmClient.ChainID(context.Background()) - if err != nil { - panic(err) - } - zevmAuth, err := bind.NewKeyedTransactorWithChainID(deployerPrivkey, chainid) - if err != nil { - panic(err) - } - - smokeTest := NewSmokeTest( - goerliClient, - zevmClient, - cctxClient, - zetaTxServer, - fungibleClient, - authClient, - bankClient, - observerClient, - goerliAuth, - zevmAuth, - btcRPCClient, - ) - - // The following deployment must happen here and in this order, please do not change - // ==================== Deploying contracts ==================== - startTime := time.Now() - - // test the block of increaseAllowance & decreaseAllowance - - smokeTest.TestBitcoinSetup() - smokeTest.TestSetupZetaTokenAndConnectorAndZEVMContracts() - smokeTest.TestDepositEtherIntoZRC20() - - smokeTest.TestSendZetaIn() - - zevmSwapAppAddr, tx, _, err := zevmswap.DeployZEVMSwapApp(smokeTest.zevmAuth, smokeTest.zevmClient, smokeTest.UniswapV2RouterAddr, smokeTest.SystemContractAddr) - if err != nil { - panic(err) - } - receipt := MustWaitForTxReceipt(zevmClient, tx) - if receipt.Status != 1 { - panic("ZEVMSwapApp deployment failed") - } - zevmSwapApp, err := zevmswap.NewZEVMSwapApp(zevmSwapAppAddr, zevmClient) - fmt.Printf("ZEVMSwapApp contract address: %s, tx hash: %s\n", zevmSwapAppAddr.Hex(), tx.Hash().Hex()) - smokeTest.ZEVMSwapAppAddr = zevmSwapAppAddr - smokeTest.ZEVMSwapApp = zevmSwapApp - - //test system contract context upgrade - contextAppAddr, tx, _, err := contextapp.DeployContextApp(smokeTest.zevmAuth, smokeTest.zevmClient) - if err != nil { - panic(err) - } - receipt = MustWaitForTxReceipt(zevmClient, tx) - if receipt.Status != 1 { - panic("ContextApp deployment failed") - } - contextApp, err := contextapp.NewContextApp(contextAppAddr, zevmClient) - if err != nil { - panic(err) - } - fmt.Printf("ContextApp contract address: %s, tx hash: %s\n", contextAppAddr.Hex(), tx.Hash().Hex()) - smokeTest.ContextAppAddr = contextAppAddr - smokeTest.ContextApp = contextApp - - fmt.Printf("## Essential tests takes %s\n", time.Since(startTime)) - fmt.Printf("## The DeployerAddress %s is funded on the following networks:\n", DeployerAddress.Hex()) - fmt.Printf("## Ether on Ethereum private net\n") - fmt.Printf("## ZETA on ZetaChain EVM\n") - fmt.Printf("## ETH ZRC20 on ZetaChain\n") - // The following tests are optional tests; comment out the ones you don't want to run - // temporarily to reduce dev/test cycle turnaround time - - smokeTest.CheckZRC20ReserveAndSupply() - - smokeTest.TestContextUpgrade() - - smokeTest.TestDepositAndCallRefund() - smokeTest.CheckZRC20ReserveAndSupply() - - smokeTest.TestERC20Deposit() - smokeTest.CheckZRC20ReserveAndSupply() - - smokeTest.TestERC20Withdraw() - smokeTest.CheckZRC20ReserveAndSupply() - - smokeTest.TestSendZetaOut() - smokeTest.CheckZRC20ReserveAndSupply() - - smokeTest.TestSendZetaOutBTCRevert() - smokeTest.CheckZRC20ReserveAndSupply() - - smokeTest.TestMessagePassing() - smokeTest.CheckZRC20ReserveAndSupply() - - smokeTest.TestZRC20Swap() - smokeTest.CheckZRC20ReserveAndSupply() - - smokeTest.TestBitcoinWithdraw() - smokeTest.CheckZRC20ReserveAndSupply() - - smokeTest.TestCrosschainSwap() - smokeTest.CheckZRC20ReserveAndSupply() - - smokeTest.TestMessagePassingRevertFail() - smokeTest.CheckZRC20ReserveAndSupply() - - smokeTest.TestMessagePassingRevertSuccess() - smokeTest.CheckZRC20ReserveAndSupply() - - smokeTest.TestPauseZRC20() - smokeTest.CheckZRC20ReserveAndSupply() - - smokeTest.TestERC20DepositAndCallRefund() - smokeTest.CheckZRC20ReserveAndSupply() - - smokeTest.TestUpdateBytecode() - smokeTest.CheckZRC20ReserveAndSupply() - - smokeTest.TestEtherDepositAndCall() - smokeTest.CheckZRC20ReserveAndSupply() - - smokeTest.TestDepositEtherLiquidityCap() - smokeTest.CheckZRC20ReserveAndSupply() - - // add your dev test here - smokeTest.TestMyTest() - smokeTest.TestBlockHeaders() - - smokeTest.wg.Wait() -} diff --git a/contrib/localnet/orchestrator/smoketest/runner/accounting.go b/contrib/localnet/orchestrator/smoketest/runner/accounting.go new file mode 100644 index 0000000000..adcc9eecdb --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/runner/accounting.go @@ -0,0 +1,110 @@ +package runner + +import ( + "context" + "encoding/json" + "fmt" + "io" + "math/big" + "net/http" + + "github.com/ethereum/go-ethereum/accounts/abi/bind" +) + +type Amount struct { + Denom string `json:"denom"` + Amount string `json:"amount"` +} + +type Response struct { + Amount Amount `json:"amount"` +} + +func (sm *SmokeTestRunner) CheckZRC20ReserveAndSupply() { + fmt.Println("Checking ZRC20 Reserve and Supply") + sm.checkEthTSSBalance() + sm.checkBtcTSSBalance() + sm.checkUsdtTSSBalance() + sm.checkZetaTSSBalance() +} + +func (sm *SmokeTestRunner) checkEthTSSBalance() { + tssBal, err := sm.GoerliClient.BalanceAt(context.Background(), sm.TSSAddress, nil) + if err != nil { + panic(err) + } + zrc20Supply, err := sm.ETHZRC20.TotalSupply(&bind.CallOpts{}) + if err != nil { + panic(err) + } + if tssBal.Cmp(zrc20Supply) < 0 { + panic(fmt.Sprintf("ETH: TSS balance (%d) < ZRC20 TotalSupply (%d) ", tssBal, zrc20Supply)) + } + fmt.Printf("ETH: TSS balance (%d) >= ZRC20 TotalSupply (%d)\n", tssBal, zrc20Supply) +} + +func (sm *SmokeTestRunner) checkBtcTSSBalance() { + utxos, err := sm.BtcRPCClient.ListUnspent() + if err != nil { + panic(err) + } + var btcBalance float64 + for _, utxo := range utxos { + if utxo.Address == sm.BTCTSSAddress.EncodeAddress() { + btcBalance += utxo.Amount + } + } + zrc20Supply, err := sm.BTCZRC20.TotalSupply(&bind.CallOpts{}) + if err != nil { + panic(err) + } + // #nosec G701 smoketest - always in range + if int64(btcBalance*1e8) < zrc20Supply.Int64() { + // #nosec G701 smoketest - always in range + panic(fmt.Sprintf("BTC: TSS Balance (%d) < ZRC20 TotalSupply (%d) ", int64(btcBalance*1e8), zrc20Supply)) + } + // #nosec G701 smoketest - always in range + fmt.Printf("BTC: Balance (%d) >= ZRC20 TotalSupply (%d)\n", int64(btcBalance*1e8), zrc20Supply) +} + +func (sm *SmokeTestRunner) checkUsdtTSSBalance() { + usdtBal, err := sm.USDTERC20.BalanceOf(&bind.CallOpts{}, sm.ERC20CustodyAddr) + if err != nil { + panic(err) + } + zrc20Supply, err := sm.USDTZRC20.TotalSupply(&bind.CallOpts{}) + if err != nil { + panic(err) + } + if usdtBal.Cmp(zrc20Supply) < 0 { + panic(fmt.Sprintf("USDT: TSS balance (%d) < ZRC20 TotalSupply (%d) ", usdtBal, zrc20Supply)) + } + fmt.Printf("USDT: TSS balance (%d) >= ZRC20 TotalSupply (%d)\n", usdtBal, zrc20Supply) +} + +func (sm *SmokeTestRunner) checkZetaTSSBalance() { + zetaLocked, err := sm.ConnectorEth.GetLockedAmount(&bind.CallOpts{}) + if err != nil { + panic(err) + } + resp, err := http.Get("http://zetacore0:1317/cosmos/bank/v1beta1/supply/by_denom?denom=azeta") + if err != nil { + panic(err) + } + defer resp.Body.Close() + body, err := io.ReadAll(resp.Body) + if err != nil { + panic(err) + } + var result Response + err = json.Unmarshal(body, &result) + if err != nil { + panic(err) + } + zetaSupply, _ := big.NewInt(0).SetString(result.Amount.Amount, 10) + if zetaLocked.Cmp(zetaSupply) < 0 { + fmt.Printf(fmt.Sprintf("ZETA: TSS balance (%d) < ZRC20 TotalSupply (%d) \n", zetaLocked, zetaSupply)) + } else { + fmt.Printf("ZETA: TSS balance (%d) >= ZRC20 TotalSupply (%d)\n", zetaLocked, zetaSupply) + } +} diff --git a/contrib/localnet/orchestrator/smoketest/runner/bitcoin.go b/contrib/localnet/orchestrator/smoketest/runner/bitcoin.go new file mode 100644 index 0000000000..0e04648676 --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/runner/bitcoin.go @@ -0,0 +1,319 @@ +package runner + +import ( + "bytes" + "context" + "encoding/hex" + "fmt" + "math/big" + "time" + + "github.com/btcsuite/btcd/btcjson" + "github.com/btcsuite/btcd/chaincfg/chainhash" + "github.com/btcsuite/btcd/rpcclient" + "github.com/btcsuite/btcd/txscript" + "github.com/btcsuite/btcd/wire" + "github.com/btcsuite/btcutil" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/rs/zerolog/log" + "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" + "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/common/bitcoin" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/utils" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" + "github.com/zeta-chain/zetacore/zetaclient" +) + +// DepositBTC deposits BTC on ZetaChain +func (sm *SmokeTestRunner) DepositBTC() { + btc := sm.BtcRPCClient + utxos, err := sm.BtcRPCClient.ListUnspent() + if err != nil { + panic(err) + } + spendableAmount := 0.0 + spendableUTXOs := 0 + for _, utxo := range utxos { + if utxo.Spendable { + spendableAmount += utxo.Amount + spendableUTXOs++ + } + } + fmt.Printf("ListUnspent:\n") + fmt.Printf(" spendableAmount: %f\n", spendableAmount) + fmt.Printf(" spendableUTXOs: %d\n", spendableUTXOs) + fmt.Printf("Now sending two txs to TSS address...\n") + amount1 := 1.1 + zetaclient.BtcDepositorFeeMin + txHash1, err := sm.SendToTSSFromDeployerToDeposit(sm.BTCTSSAddress, amount1, utxos[:2], btc, sm.BTCDeployerAddress) + if err != nil { + panic(err) + } + amount2 := 0.05 + zetaclient.BtcDepositorFeeMin + txHash2, err := sm.SendToTSSFromDeployerToDeposit(sm.BTCTSSAddress, amount2, utxos[2:4], btc, sm.BTCDeployerAddress) + if err != nil { + panic(err) + } + _, err = sm.SendToTSSFromDeployerWithMemo(sm.BTCTSSAddress, 0.11, utxos[4:5], btc, []byte(zetaclient.DonationMessage), sm.BTCDeployerAddress) + if err != nil { + panic(err) + } + + fmt.Printf("testing if the deposit into BTC ZRC20 is successful...\n") + + // check if the deposit is successful + BTCZRC20Addr, err := sm.SystemContract.GasCoinZRC20ByChainId(&bind.CallOpts{}, big.NewInt(common.BtcRegtestChain().ChainId)) + if err != nil { + panic(err) + } + sm.BTCZRC20Addr = BTCZRC20Addr + fmt.Printf("BTCZRC20Addr: %s\n", BTCZRC20Addr.Hex()) + BTCZRC20, err := zrc20.NewZRC20(BTCZRC20Addr, sm.ZevmClient) + if err != nil { + panic(err) + } + sm.BTCZRC20 = BTCZRC20 + initialBalance, err := BTCZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) + if err != nil { + panic(err) + } + for { + time.Sleep(5 * time.Second) + balance, err := BTCZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) + if err != nil { + panic(err) + } + diff := big.NewInt(0) + diff.Sub(balance, initialBalance) + fmt.Printf("BTC Difference in balance: %d", diff.Uint64()) + if diff.Cmp(big.NewInt(1.15*btcutil.SatoshiPerBitcoin)) != 0 { + fmt.Printf("waiting for BTC balance to show up in ZRC contract... current bal %d\n", balance) + } else { + fmt.Printf("BTC balance is in ZRC contract! Success\n") + break + } + } + + // prove the two transactions of the deposit + utils.LoudPrintf("Bitcoin Merkle Proof\n") + + sm.ProveBTCTransaction(txHash1) + sm.ProveBTCTransaction(txHash2) +} + +func (sm *SmokeTestRunner) ProveBTCTransaction(txHash *chainhash.Hash) { + // get tx result + btc := sm.BtcRPCClient + txResult, err := btc.GetTransaction(txHash) + if err != nil { + panic("should get outTx result") + } + if txResult.Confirmations <= 0 { + panic("outTx should have already confirmed") + } + txBytes, err := hex.DecodeString(txResult.Hex) + if err != nil { + panic(err) + } + + // get the block with verbose transactions + blockHash, err := chainhash.NewHashFromStr(txResult.BlockHash) + if err != nil { + panic(err) + } + blockVerbose, err := btc.GetBlockVerboseTx(blockHash) + if err != nil { + panic("should get block verbose tx") + } + + // get the block header + header, err := btc.GetBlockHeader(blockHash) + if err != nil { + panic("should get block header") + } + + // collect all the txs in the block + txns := []*btcutil.Tx{} + for _, res := range blockVerbose.Tx { + txBytes, err := hex.DecodeString(res.Hex) + if err != nil { + panic(err) + } + tx, err := btcutil.NewTxFromBytes(txBytes) + if err != nil { + panic(err) + } + txns = append(txns, tx) + } + + // build merkle proof + mk := bitcoin.NewMerkle(txns) + path, index, err := mk.BuildMerkleProof(int(txResult.BlockIndex)) + if err != nil { + panic("should build merkle proof") + } + + // verify merkle proof statically + pass := bitcoin.Prove(*txHash, header.MerkleRoot, path, index) + if !pass { + panic("should verify merkle proof") + } + + hash := header.BlockHash() + for { + _, err := sm.ObserverClient.GetBlockHeaderByHash(context.Background(), &observertypes.QueryGetBlockHeaderByHashRequest{ + BlockHash: hash.CloneBytes(), + }) + if err != nil { + fmt.Printf("waiting for block header to show up in observer... current hash %s; err %s\n", hash.String(), err.Error()) + } + if err == nil { + break + } + time.Sleep(2 * time.Second) + + } + + // verify merkle proof through RPC + res, err := sm.ObserverClient.Prove(context.Background(), &observertypes.QueryProveRequest{ + ChainId: common.BtcRegtestChain().ChainId, + TxHash: txHash.String(), + BlockHash: blockHash.String(), + Proof: common.NewBitcoinProof(txBytes, path, index), + TxIndex: 0, // bitcoin doesn't use txIndex + }) + if err != nil { + panic(err) + } + if !res.Valid { + panic("txProof should be valid") + } + fmt.Printf("OK: txProof verified for inTx: %s\n", txHash.String()) +} + +func (sm *SmokeTestRunner) SendToTSSFromDeployerToDeposit( + to btcutil.Address, + amount float64, + inputUTXOs []btcjson.ListUnspentResult, + btc *rpcclient.Client, + + btcDeployerAddress *btcutil.AddressWitnessPubKeyHash, +) (*chainhash.Hash, error) { + return sm.SendToTSSFromDeployerWithMemo(to, amount, inputUTXOs, btc, sm.DeployerAddress.Bytes(), btcDeployerAddress) +} + +func (sm *SmokeTestRunner) SendToTSSFromDeployerWithMemo( + to btcutil.Address, + amount float64, + inputUTXOs []btcjson.ListUnspentResult, + btc *rpcclient.Client, + memo []byte, + btcDeployerAddress *btcutil.AddressWitnessPubKeyHash, +) (*chainhash.Hash, error) { + utxos := inputUTXOs + + inputs := make([]btcjson.TransactionInput, len(utxos)) + inputSats := btcutil.Amount(0) + amounts := make([]float64, len(utxos)) + scriptPubkeys := make([]string, len(utxos)) + for i, utxo := range utxos { + inputs[i] = btcjson.TransactionInput{utxo.TxID, utxo.Vout} + inputSats += btcutil.Amount(utxo.Amount * btcutil.SatoshiPerBitcoin) + amounts[i] = utxo.Amount + scriptPubkeys[i] = utxo.ScriptPubKey + } + feeSats := btcutil.Amount(0.0001 * btcutil.SatoshiPerBitcoin) + amountSats := btcutil.Amount(amount * btcutil.SatoshiPerBitcoin) + change := inputSats - feeSats - amountSats + if change < 0 { + return nil, fmt.Errorf("not enough input amount in sats; wanted %d, got %d", amountSats+feeSats, inputSats) + } + amountMap := map[btcutil.Address]btcutil.Amount{ + to: amountSats, + btcDeployerAddress: change, + } + tx, err := btc.CreateRawTransaction(inputs, amountMap, nil) + if err != nil { + panic(err) + } + + nulldata, err := txscript.NullDataScript(memo) // this adds a OP_RETURN + single BYTE len prefix to the data + if err != nil { + panic(err) + } + fmt.Printf("nulldata (len %d): %x\n", len(nulldata), nulldata) + if err != nil { + panic(err) + } + memoOutput := wire.TxOut{Value: 0, PkScript: nulldata} + tx.TxOut = append(tx.TxOut, &memoOutput) + tx.TxOut[1], tx.TxOut[2] = tx.TxOut[2], tx.TxOut[1] + + // make sure that TxOut[0] is sent to "to" address; TxOut[2] is change to oneself. TxOut[1] is memo. + if bytes.Compare(tx.TxOut[0].PkScript[2:], to.ScriptAddress()) != 0 { + fmt.Printf("tx.TxOut[0].PkScript: %x\n", tx.TxOut[0].PkScript) + fmt.Printf("to.ScriptAddress(): %x\n", to.ScriptAddress()) + fmt.Printf("swapping txout[0] with txout[2]\n") + tx.TxOut[0], tx.TxOut[2] = tx.TxOut[2], tx.TxOut[0] + } + + fmt.Printf("raw transaction: \n") + for idx, txout := range tx.TxOut { + fmt.Printf("txout %d\n", idx) + fmt.Printf(" value: %d\n", txout.Value) + fmt.Printf(" PkScript: %x\n", txout.PkScript) + } + + inputsForSign := make([]btcjson.RawTxWitnessInput, len(inputs)) + for i, input := range inputs { + inputsForSign[i] = btcjson.RawTxWitnessInput{ + Txid: input.Txid, + Vout: input.Vout, + Amount: &amounts[i], + ScriptPubKey: scriptPubkeys[i], + } + } + + //stx, signed, err := btc.SignRawTransactionWithWallet(tx) + stx, signed, err := btc.SignRawTransactionWithWallet2(tx, inputsForSign) + if err != nil { + panic(err) + } + if !signed { + panic("btc transaction not signed") + } + txid, err := btc.SendRawTransaction(stx, true) + if err != nil { + panic(err) + } + fmt.Printf("txid: %+v\n", txid) + _, err = btc.GenerateToAddress(6, btcDeployerAddress, nil) + if err != nil { + panic(err) + } + gtx, err := btc.GetTransaction(txid) + if err != nil { + panic(err) + } + fmt.Printf("rawtx confirmation: %d\n", gtx.BlockIndex) + rawtx, err := btc.GetRawTransactionVerbose(txid) + if err != nil { + panic(err) + } + + events := zetaclient.FilterAndParseIncomingTx( + []btcjson.TxRawResult{*rawtx}, + 0, + sm.BTCTSSAddress.EncodeAddress(), + &log.Logger, + common.BtcRegtestChain().ChainId, + ) + fmt.Printf("bitcoin intx events:\n") + for _, event := range events { + fmt.Printf(" TxHash: %s\n", event.TxHash) + fmt.Printf(" From: %s\n", event.FromAddress) + fmt.Printf(" To: %s\n", event.ToAddress) + fmt.Printf(" Amount: %f\n", event.Value) + fmt.Printf(" Memo: %x\n", event.MemoBytes) + } + return txid, nil +} diff --git a/contrib/localnet/orchestrator/smoketest/runner/evm.go b/contrib/localnet/orchestrator/smoketest/runner/evm.go new file mode 100644 index 0000000000..ef29b50278 --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/runner/evm.go @@ -0,0 +1,256 @@ +package runner + +import ( + "context" + "fmt" + "math/big" + "time" + + "github.com/ethereum/go-ethereum/accounts/abi/bind" + ethcommon "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" + "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/common/ethereum" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/utils" + "github.com/zeta-chain/zetacore/x/crosschain/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" + "github.com/zeta-chain/zetacore/zetaclient" +) + +func (sm *SmokeTestRunner) DepositERC20(amount *big.Int, msg []byte) ethcommon.Hash { + USDT := sm.USDTERC20 + tx, err := USDT.Mint(sm.GoerliAuth, amount) + if err != nil { + panic(err) + } + receipt := utils.MustWaitForTxReceipt(sm.GoerliClient, tx) + fmt.Printf("Mint receipt tx hash: %s\n", tx.Hash().Hex()) + + tx, err = USDT.Approve(sm.GoerliAuth, sm.ERC20CustodyAddr, amount) + if err != nil { + panic(err) + } + receipt = utils.MustWaitForTxReceipt(sm.GoerliClient, tx) + fmt.Printf("USDT Approve receipt tx hash: %s\n", tx.Hash().Hex()) + + tx, err = sm.ERC20Custody.Deposit(sm.GoerliAuth, sm.DeployerAddress.Bytes(), sm.USDTERC20Addr, amount, msg) + if err != nil { + panic(err) + } + receipt = utils.MustWaitForTxReceipt(sm.GoerliClient, tx) + if receipt.Status == 0 { + panic("deposit failed") + } + fmt.Printf("Deposit receipt tx hash: %s, status %d\n", receipt.TxHash.Hex(), receipt.Status) + for _, log := range receipt.Logs { + event, err := sm.ERC20Custody.ParseDeposited(*log) + if err != nil { + continue + } + fmt.Printf("Deposited event: \n") + fmt.Printf(" Recipient address: %x, \n", event.Recipient) + fmt.Printf(" ERC20 address: %s, \n", event.Asset.Hex()) + fmt.Printf(" Amount: %d, \n", event.Amount) + fmt.Printf(" Message: %x, \n", event.Message) + } + fmt.Printf("gas limit %d\n", sm.ZevmAuth.GasLimit) + return tx.Hash() +} + +// DepositEtherIntoZRC20 sends Ethers into ZEVM +func (sm *SmokeTestRunner) DepositEtherIntoZRC20() { + startTime := time.Now() + defer func() { + fmt.Printf("test finishes in %s\n", time.Since(startTime)) + }() + goerliClient := sm.GoerliClient + utils.LoudPrintf("Deposit Ether into ZEVM\n") + bn, err := goerliClient.BlockNumber(context.Background()) + if err != nil { + panic(err) + } + fmt.Printf("GOERLI block number: %d\n", bn) + bal, err := goerliClient.BalanceAt(context.Background(), sm.DeployerAddress, nil) + if err != nil { + panic(err) + } + fmt.Printf("GOERLI deployer balance: %s\n", bal.String()) + + systemContract := sm.SystemContract + if err != nil { + panic(err) + } + ethZRC20Addr, err := systemContract.GasCoinZRC20ByChainId(&bind.CallOpts{}, big.NewInt(common.GoerliLocalnetChain().ChainId)) + if err != nil { + panic(err) + } + if (ethZRC20Addr == ethcommon.Address{}) { + panic("eth zrc20 not found") + } + sm.ETHZRC20Addr = ethZRC20Addr + fmt.Printf("eth zrc20 address: %s\n", ethZRC20Addr.String()) + ethZRC20, err := zrc20.NewZRC20(ethZRC20Addr, sm.ZevmClient) + if err != nil { + panic(err) + } + sm.ETHZRC20 = ethZRC20 + initialBalance, err := ethZRC20.BalanceOf(nil, sm.DeployerAddress) + if err != nil { + panic(err) + } + + value := big.NewInt(1000000000000000000) // in wei (1 eth) + signedTx, err := sm.SendEther(sm.TSSAddress, value, nil) + if err != nil { + panic(err) + } + + fmt.Printf("GOERLI tx sent: %s; to %s, nonce %d\n", signedTx.Hash().String(), signedTx.To().Hex(), signedTx.Nonce()) + receipt := utils.MustWaitForTxReceipt(sm.GoerliClient, signedTx) + fmt.Printf("GOERLI tx receipt: %d\n", receipt.Status) + fmt.Printf(" tx hash: %s\n", receipt.TxHash.String()) + fmt.Printf(" to: %s\n", signedTx.To().String()) + fmt.Printf(" value: %d\n", signedTx.Value()) + fmt.Printf(" block num: %d\n", receipt.BlockNumber) + + { + utils.LoudPrintf("Merkle Proof\n") + txHash := receipt.TxHash + blockHash := receipt.BlockHash + + // #nosec G701 smoketest - always in range + txIndex := int(receipt.TransactionIndex) + + block, err := sm.GoerliClient.BlockByHash(context.Background(), blockHash) + if err != nil { + panic(err) + } + i := 0 + for { + if i > 20 { + panic("block header not found") + } + _, err := sm.ObserverClient.GetBlockHeaderByHash(context.Background(), &observertypes.QueryGetBlockHeaderByHashRequest{ + BlockHash: blockHash.Bytes(), + }) + if err != nil { + fmt.Printf("WARN: block header not found; retrying... error: %s \n", err.Error()) + time.Sleep(5 * time.Second) + } else { + fmt.Printf("OK: block header found\n") + break + } + i++ + } + + trie := ethereum.NewTrie(block.Transactions()) + if trie.Hash() != block.Header().TxHash { + panic("tx root hash & block tx root mismatch") + } + txProof, err := trie.GenerateProof(txIndex) + if err != nil { + panic("error generating txProof") + } + val, err := txProof.Verify(block.TxHash(), txIndex) + if err != nil { + panic("error verifying txProof") + } + var txx ethtypes.Transaction + err = txx.UnmarshalBinary(val) + if err != nil { + panic("error unmarshalling txProof'd tx") + } + res, err := sm.ObserverClient.Prove(context.Background(), &observertypes.QueryProveRequest{ + BlockHash: blockHash.Hex(), + TxIndex: int64(txIndex), + TxHash: txHash.Hex(), + Proof: common.NewEthereumProof(txProof), + ChainId: common.GoerliLocalnetChain().ChainId, + }) + if err != nil { + panic(err) + } + if !res.Valid { + panic("txProof invalid") // FIXME: don't do this in production + } + fmt.Printf("OK: txProof verified\n") + } + + { + tx, err := sm.SendEther(sm.TSSAddress, big.NewInt(101000000000000000), []byte(zetaclient.DonationMessage)) + if err != nil { + panic(err) + } + receipt := utils.MustWaitForTxReceipt(sm.GoerliClient, tx) + fmt.Printf("GOERLI donation tx receipt: %d\n", receipt.Status) + } + + c := make(chan any) + sm.WG.Add(1) + go func() { + defer sm.WG.Done() + cctx := utils.WaitCctxMinedByInTxHash(signedTx.Hash().Hex(), sm.CctxClient) + if cctx.CctxStatus.Status != types.CctxStatus_OutboundMined { + panic(fmt.Sprintf("expected cctx status to be mined; got %s, message: %s", + cctx.CctxStatus.Status.String(), + cctx.CctxStatus.StatusMessage), + ) + } + c <- 0 + }() + sm.WG.Add(1) + go func() { + defer sm.WG.Done() + <-c + + currentBalance, err := ethZRC20.BalanceOf(nil, sm.DeployerAddress) + if err != nil { + panic(err) + } + diff := big.NewInt(0) + diff.Sub(currentBalance, initialBalance) + fmt.Printf("eth zrc20 balance: %s\n", currentBalance.String()) + if diff.Cmp(value) != 0 { + fmt.Printf("eth zrc20 bal wanted %d, got %d\n", value, diff) + panic("bal mismatch") + } + + }() + sm.WG.Wait() +} + +func (sm *SmokeTestRunner) SendEther(_ ethcommon.Address, value *big.Int, data []byte) (*ethtypes.Transaction, error) { + goerliClient := sm.GoerliClient + + nonce, err := goerliClient.PendingNonceAt(context.Background(), sm.DeployerAddress) + if err != nil { + return nil, err + } + gasLimit := uint64(30000) // in units + gasPrice, err := goerliClient.SuggestGasPrice(context.Background()) + if err != nil { + return nil, err + } + tx := ethtypes.NewTransaction(nonce, sm.TSSAddress, value, gasLimit, gasPrice, data) + chainID, err := goerliClient.NetworkID(context.Background()) + if err != nil { + return nil, err + } + deployerPrivkey, err := crypto.HexToECDSA(sm.DeployerPrivateKey) + if err != nil { + return nil, err + } + + signedTx, err := ethtypes.SignTx(tx, ethtypes.NewEIP155Signer(chainID), deployerPrivkey) + if err != nil { + return nil, err + } + err = goerliClient.SendTransaction(context.Background(), signedTx) + if err != nil { + return nil, err + } + + return signedTx, nil +} diff --git a/contrib/localnet/orchestrator/smoketest/smoketest.go b/contrib/localnet/orchestrator/smoketest/runner/runner.go similarity index 50% rename from contrib/localnet/orchestrator/smoketest/smoketest.go rename to contrib/localnet/orchestrator/smoketest/runner/runner.go index de9146bb3f..526e2e3920 100644 --- a/contrib/localnet/orchestrator/smoketest/smoketest.go +++ b/contrib/localnet/orchestrator/smoketest/runner/runner.go @@ -1,13 +1,7 @@ -//go:build PRIVNET -// +build PRIVNET - -package main +package runner import ( - "context" - "fmt" "sync" - "time" "github.com/btcsuite/btcd/rpcclient" "github.com/btcsuite/btcutil" @@ -26,32 +20,48 @@ import ( "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/contracts/contextapp" "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/contracts/erc20" "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/contracts/zevmswap" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/txserver" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" - "github.com/zeta-chain/zetacore/zetaclient/config" ) -type SmokeTest struct { - zevmClient *ethclient.Client - goerliClient *ethclient.Client - btcRPCClient *rpcclient.Client - zetaTxServer ZetaTxServer - - cctxClient crosschaintypes.QueryClient - fungibleClient fungibletypes.QueryClient - authClient authtypes.QueryClient - bankClient banktypes.QueryClient - observerClient observertypes.QueryClient - - wg sync.WaitGroup - ZetaEth *zetaeth.ZetaEth - ZetaEthAddr ethcommon.Address - ConnectorEth *zetaconnectoreth.ZetaConnectorEth - ConnectorEthAddr ethcommon.Address - goerliAuth *bind.TransactOpts - zevmAuth *bind.TransactOpts +// SmokeTestRunner stores all the clients and addresses needed for smoke test +// Exposes a method to run smoke test +// It also provides some helper functions +type SmokeTestRunner struct { + // accounts + DeployerAddress ethcommon.Address + DeployerPrivateKey string + TSSAddress ethcommon.Address + BTCTSSAddress btcutil.Address + BTCDeployerAddress *btcutil.AddressWitnessPubKeyHash + FungibleAdminMnemonic string + + // rpc clients + ZevmClient *ethclient.Client + GoerliClient *ethclient.Client + BtcRPCClient *rpcclient.Client + + // grpc clients + CctxClient crosschaintypes.QueryClient + FungibleClient fungibletypes.QueryClient + AuthClient authtypes.QueryClient + BankClient banktypes.QueryClient + ObserverClient observertypes.QueryClient + + // zeta client + ZetaTxServer txserver.ZetaTxServer + // evm auth + GoerliAuth *bind.TransactOpts + ZevmAuth *bind.TransactOpts + + // contracts + ZetaEthAddr ethcommon.Address + ZetaEth *zetaeth.ZetaEth + ConnectorEthAddr ethcommon.Address + ConnectorEth *zetaconnectoreth.ZetaConnectorEth ERC20CustodyAddr ethcommon.Address ERC20Custody *erc20custody.ERC20Custody USDTERC20Addr ethcommon.Address @@ -71,16 +81,25 @@ type SmokeTest struct { ZEVMSwapApp *zevmswap.ZEVMSwapApp ContextAppAddr ethcommon.Address ContextApp *contextapp.ContextApp + SystemContractAddr ethcommon.Address + SystemContract *systemcontract.SystemContract - SystemContract *systemcontract.SystemContract - SystemContractAddr ethcommon.Address + // other + WG sync.WaitGroup } -func NewSmokeTest( +// SmokeTest is a function representing a smoke test +// It takes a SmokeTestRunner as an argument +type SmokeTest func(*SmokeTestRunner) + +func NewSmokeTestRunner( + deployerAddress ethcommon.Address, + deployerPrivateKey string, + fungibleAdminMnemonic string, goerliClient *ethclient.Client, zevmClient *ethclient.Client, cctxClient crosschaintypes.QueryClient, - zetaTxServer ZetaTxServer, + zetaTxServer txserver.ZetaTxServer, fungibleClient fungibletypes.QueryClient, authClient authtypes.QueryClient, bankClient banktypes.QueryClient, @@ -88,50 +107,41 @@ func NewSmokeTest( goerliAuth *bind.TransactOpts, zevmAuth *bind.TransactOpts, btcRPCClient *rpcclient.Client, -) *SmokeTest { - // query system contract address - systemContractAddr, err := fungibleClient.SystemContract(context.Background(), &fungibletypes.QueryGetSystemContractRequest{}) - if err != nil { - panic(err) - } - fmt.Printf("System contract address: %s\n", systemContractAddr) +) *SmokeTestRunner { + return &SmokeTestRunner{ + DeployerAddress: deployerAddress, + DeployerPrivateKey: deployerPrivateKey, + FungibleAdminMnemonic: fungibleAdminMnemonic, - SystemContract, err := systemcontract.NewSystemContract(HexToAddress(systemContractAddr.SystemContract.SystemContract), zevmClient) - if err != nil { - panic(err) - } - SystemContractAddr := HexToAddress(systemContractAddr.SystemContract.SystemContract) - - response := &crosschaintypes.QueryGetTssAddressResponse{} - for { - response, err = cctxClient.GetTssAddress(context.Background(), &crosschaintypes.QueryGetTssAddressRequest{}) - if err != nil { - fmt.Printf("cctxClient.TSS error %s\n", err.Error()) - fmt.Printf("TSS not ready yet, waiting for TSS to be appear in zetacore netowrk...\n") - time.Sleep(5 * time.Second) - continue - } - break + ZevmClient: zevmClient, + GoerliClient: goerliClient, + ZetaTxServer: zetaTxServer, + CctxClient: cctxClient, + FungibleClient: fungibleClient, + AuthClient: authClient, + BankClient: bankClient, + ObserverClient: observerClient, + + GoerliAuth: goerliAuth, + ZevmAuth: zevmAuth, + BtcRPCClient: btcRPCClient, + + WG: sync.WaitGroup{}, } +} - TSSAddress = ethcommon.HexToAddress(response.Eth) - BTCTSSAddress, _ = btcutil.DecodeAddress(response.Btc, config.BitconNetParams) - fmt.Printf("TSS EthAddress: %s\n TSS BTC address %s\n", response.GetEth(), response.GetBtc()) - - return &SmokeTest{ - zevmClient: zevmClient, - goerliClient: goerliClient, - zetaTxServer: zetaTxServer, - cctxClient: cctxClient, - fungibleClient: fungibleClient, - authClient: authClient, - bankClient: bankClient, - observerClient: observerClient, - wg: sync.WaitGroup{}, - goerliAuth: goerliAuth, - zevmAuth: zevmAuth, - btcRPCClient: btcRPCClient, - SystemContract: SystemContract, - SystemContractAddr: SystemContractAddr, +// RunSmokeTests runs a list of smoke tests +func (sm *SmokeTestRunner) RunSmokeTests(smokeTests []SmokeTest) { + for _, smokeTest := range smokeTests { + sm.RunSmokeTest(smokeTest) } } + +// RunSmokeTest runs a smoke test +func (sm *SmokeTestRunner) RunSmokeTest(smokeTest SmokeTest) { + // run smoke test + smokeTest(sm) + + // check supplies + sm.CheckZRC20ReserveAndSupply() +} diff --git a/contrib/localnet/orchestrator/smoketest/runner/setup_bitcoin.go b/contrib/localnet/orchestrator/smoketest/runner/setup_bitcoin.go new file mode 100644 index 0000000000..d6b5b7b628 --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/runner/setup_bitcoin.go @@ -0,0 +1,95 @@ +package runner + +import ( + "encoding/hex" + "fmt" + "strings" + "time" + + "github.com/btcsuite/btcd/btcec" + "github.com/btcsuite/btcd/chaincfg" + "github.com/btcsuite/btcd/rpcclient" + "github.com/btcsuite/btcutil" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/utils" +) + +func (sm *SmokeTestRunner) SetupBitcoin() { + utils.LoudPrintf("Setup Bitcoin\n") + startTime := time.Now() + defer func() { + fmt.Printf("Bitcoin setup took %s\n", time.Since(startTime)) + }() + + btc := sm.BtcRPCClient + _, err := btc.CreateWallet("smoketest", rpcclient.WithCreateWalletBlank()) + if err != nil { + if !strings.Contains(err.Error(), "Database already exists") { + panic(err) + } + } + + skBytes, err := hex.DecodeString(sm.DeployerPrivateKey) + if err != nil { + panic(err) + } + sk, _ := btcec.PrivKeyFromBytes(btcec.S256(), skBytes) + privkeyWIF, err := btcutil.NewWIF(sk, &chaincfg.RegressionNetParams, true) + if err != nil { + panic(err) + } + err = btc.ImportPrivKeyRescan(privkeyWIF, "deployer", true) + if err != nil { + panic(err) + } + sm.BTCDeployerAddress, err = btcutil.NewAddressWitnessPubKeyHash( + btcutil.Hash160(privkeyWIF.PrivKey.PubKey().SerializeCompressed()), + &chaincfg.RegressionNetParams, + ) + if err != nil { + panic(err) + } + fmt.Printf("BTCDeployerAddress: %s\n", sm.BTCDeployerAddress.EncodeAddress()) + + err = btc.ImportAddress(sm.BTCTSSAddress.EncodeAddress()) + if err != nil { + panic(err) + } + _, err = btc.GenerateToAddress(101, sm.BTCDeployerAddress, nil) + if err != nil { + panic(err) + } + bal, err := btc.GetBalance("*") + if err != nil { + panic(err) + } + _, err = btc.GenerateToAddress(4, sm.BTCDeployerAddress, nil) + if err != nil { + panic(err) + } + bal, err = btc.GetBalance("*") + if err != nil { + panic(err) + } + fmt.Printf("balance: %f\n", bal.ToBTC()) + + bals, err := btc.GetBalances() + if err != nil { + panic(err) + } + fmt.Printf("balances: \n") + fmt.Printf(" mine (Deployer): %+v\n", bals.Mine) + if bals.WatchOnly != nil { + fmt.Printf(" watchonly (TSSAddress): %+v\n", bals.WatchOnly) + } + fmt.Printf(" TSS Address: %s\n", sm.BTCTSSAddress.EncodeAddress()) + go func() { + // keep bitcoin chain going + for { + _, err = btc.GenerateToAddress(4, sm.BTCDeployerAddress, nil) + if err != nil { + fmt.Println(err) + } + time.Sleep(5 * time.Second) + } + }() +} diff --git a/contrib/localnet/orchestrator/smoketest/runner/setup_evm.go b/contrib/localnet/orchestrator/smoketest/runner/setup_evm.go new file mode 100644 index 0000000000..547622a766 --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/runner/setup_evm.go @@ -0,0 +1,221 @@ +package runner + +import ( + "context" + "fmt" + "math/big" + "time" + + "github.com/ethereum/go-ethereum/accounts/abi/bind" + ethcommon "github.com/ethereum/go-ethereum/common" + "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/erc20custody.sol" + zetaeth "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/zeta.eth.sol" + zetaconnectoreth "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/zetaconnector.eth.sol" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/config" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/contracts/erc20" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/contracts/testdapp" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/utils" +) + +const ( + ContractsConfigFile = "contracts.toml" +) + +// SetEVMContractsFromConfig set EVM contracts for smoke test from the config +func (sm *SmokeTestRunner) SetEVMContractsFromConfig() { + conf, err := config.ReadConfig(ContractsConfigFile) + if err != nil { + panic(err) + } + + // Set ZetaEthAddr + sm.ZetaEthAddr = ethcommon.HexToAddress(conf.Contracts.EVM.ZetaEthAddress) + sm.ZetaEth, err = zetaeth.NewZetaEth(sm.ZetaEthAddr, sm.GoerliClient) + if err != nil { + panic(err) + } + + // Set ConnectorEthAddr + sm.ConnectorEthAddr = ethcommon.HexToAddress(conf.Contracts.EVM.ConnectorEthAddr) + sm.ConnectorEth, err = zetaconnectoreth.NewZetaConnectorEth(sm.ConnectorEthAddr, sm.GoerliClient) + if err != nil { + panic(err) + } +} + +// SetupEVM setup contracts on EVM for smoke test +func (sm *SmokeTestRunner) SetupEVM(contractsDeployed bool) { + startTime := time.Now() + defer func() { + fmt.Printf("test finishes in %s\n", time.Since(startTime)) + }() + + // TODO: put this logic outside of this function + // We use this config to be consistent with the old implementation + // https://github.com/zeta-chain/node-private/issues/41 + if contractsDeployed { + sm.SetEVMContractsFromConfig() + return + } + conf := config.DefaultConfig() + + utils.LoudPrintf("Deploy ZetaETH ConnectorETH ERC20Custody USDT\n") + + // fetch initial nonce to check if it get incremented correctly + initialNonce, err := sm.GoerliClient.PendingNonceAt(context.Background(), sm.DeployerAddress) + if err != nil { + panic(err) + } + + fmt.Printf("Deploying ZetaEth contract\n") + zetaEthAddr, tx, ZetaEth, err := zetaeth.DeployZetaEth(sm.GoerliAuth, sm.GoerliClient, sm.DeployerAddress, big.NewInt(21_000_000_000)) + if err != nil { + panic(err) + } + receipt := utils.MustWaitForTxReceipt(sm.GoerliClient, tx) + if receipt.Status != 1 { + panic("ZetaEth deployment failed") + } + sm.ZetaEth = ZetaEth + sm.ZetaEthAddr = zetaEthAddr + conf.Contracts.EVM.ZetaEthAddress = zetaEthAddr.String() + if err := utils.CheckNonce(sm.GoerliClient, sm.DeployerAddress, initialNonce+1); err != nil { + panic(err) + } + fmt.Printf("ZetaEth contract address: %s, tx hash: %s\n", zetaEthAddr.Hex(), tx.Hash().Hex()) + + fmt.Printf("Deploying ZetaConnectorEth contract\n") + connectorEthAddr, tx, ConnectorEth, err := zetaconnectoreth.DeployZetaConnectorEth( + sm.GoerliAuth, + sm.GoerliClient, + zetaEthAddr, + sm.TSSAddress, + sm.DeployerAddress, + sm.DeployerAddress, + ) + if err != nil { + panic(err) + } + receipt = utils.MustWaitForTxReceipt(sm.GoerliClient, tx) + if receipt.Status != 1 { + panic("ZetaConnectorEth deployment failed") + } + sm.ConnectorEth = ConnectorEth + sm.ConnectorEthAddr = connectorEthAddr + conf.Contracts.EVM.ConnectorEthAddr = connectorEthAddr.String() + + if err := utils.CheckNonce(sm.GoerliClient, sm.DeployerAddress, initialNonce+2); err != nil { + panic(err) + } + fmt.Printf("ZetaConnectorEth contract address: %s, tx hash: %s\n", connectorEthAddr.Hex(), tx.Hash().Hex()) + + fmt.Printf("Deploying ERC20Custody contract\n") + erc20CustodyAddr, tx, ERC20Custody, err := erc20custody.DeployERC20Custody( + sm.GoerliAuth, + sm.GoerliClient, + sm.DeployerAddress, + sm.DeployerAddress, + big.NewInt(0), + big.NewInt(1e18), + ethcommon.HexToAddress("0x"), + ) + if err != nil { + panic(err) + } + receipt = utils.MustWaitForTxReceipt(sm.GoerliClient, tx) + if receipt.Status != 1 { + panic("ERC20Custody deployment failed") + } + sm.ERC20CustodyAddr = erc20CustodyAddr + sm.ERC20Custody = ERC20Custody + if err := utils.CheckNonce(sm.GoerliClient, sm.DeployerAddress, initialNonce+3); err != nil { + panic(err) + } + fmt.Printf("ERC20Custody contract address: %s, tx hash: %s\n", erc20CustodyAddr.Hex(), tx.Hash().Hex()) + + fmt.Printf("Deploying USDT contract\n") + usdtAddr, tx, usdt, err := erc20.DeployUSDT(sm.GoerliAuth, sm.GoerliClient, "USDT", "USDT", 6) + if err != nil { + panic(err) + } + receipt = utils.MustWaitForTxReceipt(sm.GoerliClient, tx) + if receipt.Status != 1 { + panic("USDT deployment failed") + } + sm.USDTERC20 = usdt + sm.USDTERC20Addr = usdtAddr + fmt.Printf("USDT contract address: %s, tx hash: %s\n", usdtAddr.Hex(), tx.Hash().Hex()) + + fmt.Printf("Whitelist USDT\n") + tx, err = ERC20Custody.Whitelist(sm.GoerliAuth, usdtAddr) + if err != nil { + panic(err) + } + receipt = utils.MustWaitForTxReceipt(sm.GoerliClient, tx) + if receipt.Status != 1 { + panic("USDT whitelist failed") + } + + fmt.Printf("Set TSS address\n") + tx, err = ERC20Custody.UpdateTSSAddress(sm.GoerliAuth, sm.TSSAddress) + if err != nil { + panic(err) + } + receipt = utils.MustWaitForTxReceipt(sm.GoerliClient, tx) + if receipt.Status != 1 { + panic("USDT update TSS address failed") + } + fmt.Printf("TSS set receipt tx hash: %s\n", tx.Hash().Hex()) + + // deploy TestDApp contract + sm.setupTestDapp() + + // save config containing contract addresses + // TODO: put this logic outside of this function in a general config + // We use this config to be consistent with the old implementation + // https://github.com/zeta-chain/node-private/issues/41 + if err := config.WriteConfig(ContractsConfigFile, conf); err != nil { + panic(err) + } +} + +// setupTestDapp deploys TestDApp contract +func (sm *SmokeTestRunner) setupTestDapp() { + // deploy TestDApp contract + appAddr, tx, _, err := testdapp.DeployTestDApp(sm.GoerliAuth, sm.GoerliClient, sm.ConnectorEthAddr, sm.ZetaEthAddr) + if err != nil { + panic(err) + } + + fmt.Printf("TestDApp contract address: %s, tx hash: %s\n", appAddr.Hex(), tx.Hash().Hex()) + receipt := utils.MustWaitForTxReceipt(sm.GoerliClient, tx) + if receipt.Status != 1 { + panic("TestDApp deployment failed") + } + + dapp, err := testdapp.NewTestDApp(receipt.ContractAddress, sm.GoerliClient) + if err != nil { + panic(err) + } + + // check contract code + code, err := sm.GoerliClient.CodeAt(context.Background(), receipt.ContractAddress, nil) + if err != nil { + panic(err) + } + fmt.Printf("TestDApp contract code: len %d\n", len(code)) + if len(code) == 0 { + panic("TestDApp contract code is empty") + } + + // check connector deployed + res, err := dapp.Connector(&bind.CallOpts{}) + if err != nil { + panic(err) + } + if res != sm.ConnectorEthAddr { + panic("mismatch of TestDApp connector address") + } + + sm.TestDAppAddr = receipt.ContractAddress +} diff --git a/contrib/localnet/orchestrator/smoketest/runner/setup_zeta.go b/contrib/localnet/orchestrator/smoketest/runner/setup_zeta.go new file mode 100644 index 0000000000..8bdd92dba0 --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/runner/setup_zeta.go @@ -0,0 +1,132 @@ +package runner + +import ( + "context" + "fmt" + "time" + + "github.com/btcsuite/btcutil" + ethcommon "github.com/ethereum/go-ethereum/common" + "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/systemcontract.sol" + "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" + "github.com/zeta-chain/protocol-contracts/pkg/uniswap/v2-core/contracts/uniswapv2factory.sol" + uniswapv2router "github.com/zeta-chain/protocol-contracts/pkg/uniswap/v2-periphery/contracts/uniswapv2router02.sol" + "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/contracts/contextapp" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/contracts/zevmswap" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/utils" + fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" +) + +// SetTSSAddresses set TSS addresses from information queried from ZetaChain +func (sm *SmokeTestRunner) SetTSSAddresses() { + var err error + res := &observertypes.QueryGetTssAddressResponse{} + for { + res, err = sm.ObserverClient.GetTssAddress(context.Background(), &observertypes.QueryGetTssAddressRequest{}) + if err != nil { + fmt.Printf("cctxClient.TSS error %s\n", err.Error()) + fmt.Printf("TSS not ready yet, waiting for TSS to be appear in zetacore network...\n") + time.Sleep(5 * time.Second) + continue + } + break + } + + tssAddress := ethcommon.HexToAddress(res.Eth) + btcTSSAddress, err := btcutil.DecodeAddress(res.Btc, common.BitcoinRegnetParams) + if err != nil { + panic(err) + } + + sm.TSSAddress = tssAddress + sm.BTCTSSAddress = btcTSSAddress +} + +// SetZEVMContracts set contracts for the ZEVM +func (sm *SmokeTestRunner) SetZEVMContracts() { + // deploy system contracts and ZRC20 contracts on ZetaChain + uniswapV2FactoryAddr, uniswapV2RouterAddr, usdtZRC20Addr, err := sm.ZetaTxServer.DeploySystemContractsAndZRC20( + utils.FungibleAdminName, + sm.USDTERC20Addr.Hex(), + ) + if err != nil { + panic(err) + } + + // Set USDTZRC20Addr + sm.USDTZRC20Addr = ethcommon.HexToAddress(usdtZRC20Addr) + sm.USDTZRC20, err = zrc20.NewZRC20(sm.USDTZRC20Addr, sm.ZevmClient) + if err != nil { + panic(err) + } + + // UniswapV2FactoryAddr + sm.UniswapV2FactoryAddr = ethcommon.HexToAddress(uniswapV2FactoryAddr) + sm.UniswapV2Factory, err = uniswapv2factory.NewUniswapV2Factory(sm.UniswapV2FactoryAddr, sm.ZevmClient) + if err != nil { + panic(err) + } + + // UniswapV2RouterAddr + sm.UniswapV2RouterAddr = ethcommon.HexToAddress(uniswapV2RouterAddr) + sm.UniswapV2Router, err = uniswapv2router.NewUniswapV2Router02(sm.UniswapV2RouterAddr, sm.ZevmClient) + if err != nil { + panic(err) + } + + // query system contract address from the chain + systemContractRes, err := sm.FungibleClient.SystemContract( + context.Background(), + &fungibletypes.QueryGetSystemContractRequest{}, + ) + if err != nil { + panic(err) + } + systemContractAddr := ethcommon.HexToAddress(systemContractRes.SystemContract.SystemContract) + + SystemContract, err := systemcontract.NewSystemContract( + systemContractAddr, + sm.ZevmClient, + ) + if err != nil { + panic(err) + } + + sm.SystemContract = SystemContract + sm.SystemContractAddr = systemContractAddr +} + +func (sm *SmokeTestRunner) SetupZEVMSwapApp() { + zevmSwapAppAddr, tx, zevmSwapApp, err := zevmswap.DeployZEVMSwapApp( + sm.ZevmAuth, + sm.ZevmClient, + sm.UniswapV2RouterAddr, + sm.SystemContractAddr, + ) + if err != nil { + panic(err) + } + receipt := utils.MustWaitForTxReceipt(sm.ZevmClient, tx) + if receipt.Status != 1 { + panic("ZEVMSwapApp deployment failed") + } + fmt.Printf("ZEVMSwapApp contract address: %s, tx hash: %s\n", zevmSwapAppAddr.Hex(), tx.Hash().Hex()) + sm.ZEVMSwapAppAddr = zevmSwapAppAddr + sm.ZEVMSwapApp = zevmSwapApp +} + +func (sm *SmokeTestRunner) SetupContextApp() { + contextAppAddr, tx, contextApp, err := contextapp.DeployContextApp(sm.ZevmAuth, sm.ZevmClient) + if err != nil { + panic(err) + } + receipt := utils.MustWaitForTxReceipt(sm.ZevmClient, tx) + if receipt.Status != 1 { + panic("ContextApp deployment failed") + } + fmt.Printf("ContextApp contract address: %s, tx hash: %s\n", contextAppAddr.Hex(), tx.Hash().Hex()) + sm.ContextAppAddr = contextAppAddr + sm.ContextApp = contextApp +} diff --git a/contrib/localnet/orchestrator/smoketest/runner/zeta.go b/contrib/localnet/orchestrator/smoketest/runner/zeta.go new file mode 100644 index 0000000000..ac71047fa3 --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/runner/zeta.go @@ -0,0 +1,95 @@ +package runner + +import ( + "context" + "fmt" + "time" + + "math/big" + + ethcommon "github.com/ethereum/go-ethereum/common" + zetaconnectoreth "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/zetaconnector.eth.sol" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/utils" +) + +func (sm *SmokeTestRunner) SendZetaIn() { + startTime := time.Now() + defer func() { + fmt.Printf("test finishes in %s\n", time.Since(startTime)) + }() + // ==================== Sending ZETA to ZetaChain =================== + amount := big.NewInt(1e18) + amount = amount.Mul(amount, big.NewInt(100)) // 100 Zeta + utils.LoudPrintf("Step 3: Sending ZETA to ZetaChain\n") + tx, err := sm.ZetaEth.Approve(sm.GoerliAuth, sm.ConnectorEthAddr, amount) + if err != nil { + panic(err) + } + fmt.Printf("Approve tx hash: %s\n", tx.Hash().Hex()) + receipt := utils.MustWaitForTxReceipt(sm.GoerliClient, tx) + fmt.Printf("Approve tx receipt: status %d\n", receipt.Status) + tx, err = sm.ConnectorEth.Send(sm.GoerliAuth, zetaconnectoreth.ZetaInterfacesSendInput{ + DestinationChainId: big.NewInt(101), // in dev mode, 101 is the zEVM ChainID + DestinationAddress: sm.DeployerAddress.Bytes(), + DestinationGasLimit: big.NewInt(250_000), + Message: nil, + ZetaValueAndGas: amount, + ZetaParams: nil, + }) + if err != nil { + panic(err) + } + + fmt.Printf("Send tx hash: %s\n", tx.Hash().Hex()) + receipt = utils.MustWaitForTxReceipt(sm.GoerliClient, tx) + fmt.Printf("Send tx receipt: status %d\n", receipt.Status) + fmt.Printf(" Logs:\n") + for _, log := range receipt.Logs { + sentLog, err := sm.ConnectorEth.ParseZetaSent(*log) + if err == nil { + fmt.Printf(" Dest Addr: %s\n", ethcommon.BytesToAddress(sentLog.DestinationAddress).Hex()) + fmt.Printf(" Dest Chain: %d\n", sentLog.DestinationChainId) + fmt.Printf(" Dest Gas: %d\n", sentLog.DestinationGasLimit) + fmt.Printf(" Zeta Value: %d\n", sentLog.ZetaValueAndGas) + fmt.Printf(" Block Num: %d\n", log.BlockNumber) + } + } + + sm.WG.Add(1) + go func() { + bn, err := sm.ZevmClient.BlockNumber(context.Background()) + if err != nil { + panic(err) + } + // #nosec G701 smoketest - always in range + initialBal, err := sm.ZevmClient.BalanceAt(context.Background(), sm.DeployerAddress, big.NewInt(int64(bn))) + if err != nil { + panic(err) + } + fmt.Printf("Zeta block %d, Initial Deployer Zeta balance: %d\n", bn, initialBal) + + defer sm.WG.Done() + for { + time.Sleep(5 * time.Second) + bn, err = sm.ZevmClient.BlockNumber(context.Background()) + if err != nil { + panic(err) + } + // #nosec G701 smoketest - always in range + bal, err := sm.ZevmClient.BalanceAt(context.Background(), sm.DeployerAddress, big.NewInt(int64(bn))) + if err != nil { + panic(err) + } + fmt.Printf("Zeta block %d, Deployer Zeta balance: %d\n", bn, bal) + + diff := big.NewInt(0) + diff.Sub(bal, initialBal) + + if diff.Cmp(amount) == 0 { + fmt.Printf("Expected zeta balance; success!\n") + break + } + } + }() + sm.WG.Wait() +} diff --git a/contrib/localnet/orchestrator/smoketest/smoketests/smoketests.go b/contrib/localnet/orchestrator/smoketest/smoketests/smoketests.go new file mode 100644 index 0000000000..df45222080 --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/smoketests/smoketests.go @@ -0,0 +1,27 @@ +package smoketests + +import "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/runner" + +// AllSmokeTests is an ordered list of all smoke tests +var AllSmokeTests = []runner.SmokeTest{ + TestContextUpgrade, + TestDepositAndCallRefund, + TestERC20Deposit, + TestERC20Withdraw, + TestSendZetaOut, + TestSendZetaOutBTCRevert, + TestMessagePassing, + TestZRC20Swap, + TestBitcoinWithdraw, + TestCrosschainSwap, + TestMessagePassingRevertFail, + TestMessagePassingRevertSuccess, + TestPauseZRC20, + TestERC20DepositAndCallRefund, + TestUpdateBytecode, + TestEtherDepositAndCall, + TestDepositEtherLiquidityCap, + TestBlockHeaders, + TestWhitelistERC20, + TestMyTest, +} diff --git a/contrib/localnet/orchestrator/smoketest/smoketests/test_bitcoin.go b/contrib/localnet/orchestrator/smoketest/smoketests/test_bitcoin.go new file mode 100644 index 0000000000..452df6c64d --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/smoketests/test_bitcoin.go @@ -0,0 +1,275 @@ +package smoketests + +import ( + "fmt" + "math/big" + "time" + + "github.com/btcsuite/btcd/chaincfg/chainhash" + "github.com/btcsuite/btcutil" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + zrc20 "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" + "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/runner" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/utils" +) + +func TestBitcoinWithdraw(sm *runner.SmokeTestRunner) { + startTime := time.Now() + defer func() { + fmt.Printf("Bitcoin withdraw took %s\n", time.Since(startTime)) + }() + utils.LoudPrintf("Testing Bitcoin ZRC20 Withdraw...\n") + // withdraw 0.1 BTC from ZRC20 to BTC address + // first, approve the ZRC20 contract to spend 1 BTC from the deployer address + WithdrawBitcoin(sm) +} + +func WithdrawBitcoin(sm *runner.SmokeTestRunner) { + amount := big.NewInt(0.1 * btcutil.SatoshiPerBitcoin) + + // check if the deposit is successful + BTCZRC20Addr, err := sm.SystemContract.GasCoinZRC20ByChainId(&bind.CallOpts{}, big.NewInt(common.BtcRegtestChain().ChainId)) + if err != nil { + panic(err) + } + fmt.Printf("BTCZRC20Addr: %s\n", BTCZRC20Addr.Hex()) + BTCZRC20, err := zrc20.NewZRC20(BTCZRC20Addr, sm.ZevmClient) + if err != nil { + panic(err) + } + balance, err := BTCZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) + if err != nil { + panic(err) + } + if balance.Cmp(amount) < 0 { + panic(fmt.Errorf("not enough balance in ZRC20 contract")) + } + // approve the ZRC20 contract to spend 1 BTC from the deployer address + { + tx, err := BTCZRC20.Approve(sm.ZevmAuth, BTCZRC20Addr, big.NewInt(amount.Int64()*2)) // approve more to cover withdraw fee + if err != nil { + panic(err) + } + receipt := utils.MustWaitForTxReceipt(sm.ZevmClient, tx) + fmt.Printf("approve receipt: status %d\n", receipt.Status) + if receipt.Status != 1 { + panic(fmt.Errorf("approve receipt status is not 1")) + } + } + go func() { + for { + time.Sleep(5 * time.Second) + _, err = sm.BtcRPCClient.GenerateToAddress(1, sm.BTCDeployerAddress, nil) + if err != nil { + panic(err) + } + } + }() + // withdraw 0.1 BTC from ZRC20 to BTC address + { + _, gasFee, err := BTCZRC20.WithdrawGasFee(&bind.CallOpts{}) + if err != nil { + panic(err) + } + fmt.Printf("withdraw gas fee: %d\n", gasFee) + tx, err := BTCZRC20.Withdraw(sm.ZevmAuth, []byte(sm.BTCDeployerAddress.EncodeAddress()), amount) + if err != nil { + panic(err) + } + receipt := utils.MustWaitForTxReceipt(sm.ZevmClient, tx) + fmt.Printf("withdraw receipt: status %d\n", receipt.Status) + if receipt.Status != 1 { + panic(fmt.Errorf("withdraw receipt status is not 1")) + } + _, err = sm.BtcRPCClient.GenerateToAddress(10, sm.BTCDeployerAddress, nil) + if err != nil { + panic(err) + } + cctx := utils.WaitCctxMinedByInTxHash(receipt.TxHash.Hex(), sm.CctxClient) + outTxHash := cctx.GetCurrentOutTxParam().OutboundTxHash + hash, err := chainhash.NewHashFromStr(outTxHash) + if err != nil { + panic(err) + } + + rawTx, err := sm.BtcRPCClient.GetRawTransactionVerbose(hash) + if err != nil { + panic(err) + } + fmt.Printf("raw tx:\n") + fmt.Printf(" TxIn: %d\n", len(rawTx.Vin)) + for idx, txIn := range rawTx.Vin { + fmt.Printf(" TxIn %d:\n", idx) + fmt.Printf(" TxID:Vout: %s:%d\n", txIn.Txid, txIn.Vout) + fmt.Printf(" ScriptSig: %s\n", txIn.ScriptSig.Hex) + } + fmt.Printf(" TxOut: %d\n", len(rawTx.Vout)) + for _, txOut := range rawTx.Vout { + fmt.Printf(" TxOut %d:\n", txOut.N) + fmt.Printf(" Value: %.8f\n", txOut.Value) + fmt.Printf(" ScriptPubKey: %s\n", txOut.ScriptPubKey.Hex) + } + } +} + +// WithdrawBitcoinMultipleTimes ... +// TODO: define smoke test +// https://github.com/zeta-chain/node-private/issues/79 +func WithdrawBitcoinMultipleTimes(sm *runner.SmokeTestRunner, repeat int64) { + totalAmount := big.NewInt(int64(0.1 * 1e8)) + + // #nosec G701 smoketest - always in range + amount := big.NewInt(int64(0.1 * 1e8 / float64(repeat))) + + // check if the deposit is successful + BTCZRC20Addr, err := sm.SystemContract.GasCoinZRC20ByChainId(&bind.CallOpts{}, big.NewInt(common.BtcRegtestChain().ChainId)) + if err != nil { + panic(err) + } + fmt.Printf("BTCZRC20Addr: %s\n", BTCZRC20Addr.Hex()) + BTCZRC20, err := zrc20.NewZRC20(BTCZRC20Addr, sm.ZevmClient) + if err != nil { + panic(err) + } + balance, err := BTCZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) + if err != nil { + panic(err) + } + if balance.Cmp(totalAmount) < 0 { + panic(fmt.Errorf("not enough balance in ZRC20 contract")) + } + // approve the ZRC20 contract to spend 1 BTC from the deployer address + { + // approve more to cover withdraw fee + tx, err := BTCZRC20.Approve(sm.ZevmAuth, BTCZRC20Addr, totalAmount.Mul(totalAmount, big.NewInt(100))) + if err != nil { + panic(err) + } + receipt := utils.MustWaitForTxReceipt(sm.ZevmClient, tx) + fmt.Printf("approve receipt: status %d\n", receipt.Status) + if receipt.Status != 1 { + panic(fmt.Errorf("approve receipt status is not 1")) + } + } + go func() { + for { + time.Sleep(3 * time.Second) + _, err = sm.BtcRPCClient.GenerateToAddress(1, sm.BTCDeployerAddress, nil) + if err != nil { + panic(err) + } + } + }() + // withdraw 0.1 BTC from ZRC20 to BTC address + for i := int64(0); i < repeat; i++ { + _, gasFee, err := BTCZRC20.WithdrawGasFee(&bind.CallOpts{}) + if err != nil { + panic(err) + } + fmt.Printf("withdraw gas fee: %d\n", gasFee) + tx, err := BTCZRC20.Withdraw(sm.ZevmAuth, []byte(sm.BTCDeployerAddress.EncodeAddress()), amount) + if err != nil { + panic(err) + } + receipt := utils.MustWaitForTxReceipt(sm.ZevmClient, tx) + fmt.Printf("withdraw receipt: status %d\n", receipt.Status) + if receipt.Status != 1 { + panic(fmt.Errorf("withdraw receipt status is not 1")) + } + _, err = sm.BtcRPCClient.GenerateToAddress(10, sm.BTCDeployerAddress, nil) + if err != nil { + panic(err) + } + cctx := utils.WaitCctxMinedByInTxHash(receipt.TxHash.Hex(), sm.CctxClient) + outTxHash := cctx.GetCurrentOutTxParam().OutboundTxHash + hash, err := chainhash.NewHashFromStr(outTxHash) + if err != nil { + panic(err) + } + + rawTx, err := sm.BtcRPCClient.GetRawTransactionVerbose(hash) + if err != nil { + panic(err) + } + fmt.Printf("raw tx:\n") + fmt.Printf(" TxIn: %d\n", len(rawTx.Vin)) + for idx, txIn := range rawTx.Vin { + fmt.Printf(" TxIn %d:\n", idx) + fmt.Printf(" TxID:Vout: %s:%d\n", txIn.Txid, txIn.Vout) + fmt.Printf(" ScriptSig: %s\n", txIn.ScriptSig.Hex) + } + fmt.Printf(" TxOut: %d\n", len(rawTx.Vout)) + for _, txOut := range rawTx.Vout { + fmt.Printf(" TxOut %d:\n", txOut.N) + fmt.Printf(" Value: %.8f\n", txOut.Value) + fmt.Printf(" ScriptPubKey: %s\n", txOut.ScriptPubKey.Hex) + } + } +} + +// DepositBTCRefund ... +// TODO: define smoke test +// https://github.com/zeta-chain/node-private/issues/79 +func DepositBTCRefund(sm *runner.SmokeTestRunner) { + utils.LoudPrintf("Deposit BTC with invalid memo; should be refunded\n") + btc := sm.BtcRPCClient + utxos, err := sm.BtcRPCClient.ListUnspent() + if err != nil { + panic(err) + } + spendableAmount := 0.0 + spendableUTXOs := 0 + for _, utxo := range utxos { + if utxo.Spendable { + spendableAmount += utxo.Amount + spendableUTXOs++ + } + } + fmt.Printf("ListUnspent:\n") + fmt.Printf(" spendableAmount: %f\n", spendableAmount) + fmt.Printf(" spendableUTXOs: %d\n", spendableUTXOs) + fmt.Printf("Now sending two txs to TSS address...\n") + _, err = sm.SendToTSSFromDeployerToDeposit(sm.BTCTSSAddress, 1.1, utxos[:2], btc, sm.BTCDeployerAddress) + if err != nil { + panic(err) + } + _, err = sm.SendToTSSFromDeployerToDeposit(sm.BTCTSSAddress, 0.05, utxos[2:4], btc, sm.BTCDeployerAddress) + if err != nil { + panic(err) + } + + fmt.Printf("testing if the deposit into BTC ZRC20 is successful...\n") + + // check if the deposit is successful + BTCZRC20Addr, err := sm.SystemContract.GasCoinZRC20ByChainId(&bind.CallOpts{}, big.NewInt(common.BtcRegtestChain().ChainId)) + if err != nil { + panic(err) + } + sm.BTCZRC20Addr = BTCZRC20Addr + fmt.Printf("BTCZRC20Addr: %s\n", BTCZRC20Addr.Hex()) + BTCZRC20, err := zrc20.NewZRC20(BTCZRC20Addr, sm.ZevmClient) + if err != nil { + panic(err) + } + sm.BTCZRC20 = BTCZRC20 + initialBalance, err := BTCZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) + if err != nil { + panic(err) + } + for { + time.Sleep(5 * time.Second) + balance, err := BTCZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) + if err != nil { + panic(err) + } + diff := big.NewInt(0) + diff.Sub(balance, initialBalance) + if diff.Cmp(big.NewInt(1.15*btcutil.SatoshiPerBitcoin)) != 0 { + fmt.Printf("waiting for BTC balance to show up in ZRC contract... current bal %d\n", balance) + } else { + fmt.Printf("BTC balance is in ZRC contract! Success\n") + break + } + } +} diff --git a/contrib/localnet/orchestrator/smoketest/test_block_headers.go b/contrib/localnet/orchestrator/smoketest/smoketests/test_block_headers.go similarity index 71% rename from contrib/localnet/orchestrator/smoketest/test_block_headers.go rename to contrib/localnet/orchestrator/smoketest/smoketests/test_block_headers.go index bd0084d891..558b4763a5 100644 --- a/contrib/localnet/orchestrator/smoketest/test_block_headers.go +++ b/contrib/localnet/orchestrator/smoketest/smoketests/test_block_headers.go @@ -1,21 +1,20 @@ -//go:build PRIVNET -// +build PRIVNET - -package main +package smoketests import ( "context" "fmt" "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/runner" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/utils" observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) -func (sm *SmokeTest) TestBlockHeaders() { - LoudPrintf("TESTING BLOCK HEADERS\n") +func TestBlockHeaders(sm *runner.SmokeTestRunner) { + utils.LoudPrintf("TESTING BLOCK HEADERS\n") // test ethereum block headers; should have a chain checkBlock := func(chainID int64) { - bhs, err := sm.observerClient.GetBlockHeaderStateByChain(context.TODO(), &observertypes.QueryGetBlockHeaderStateRequest{ + bhs, err := sm.ObserverClient.GetBlockHeaderStateByChain(context.TODO(), &observertypes.QueryGetBlockHeaderStateRequest{ ChainId: chainID, }) if err != nil { @@ -34,7 +33,7 @@ func (sm *SmokeTest) TestBlockHeaders() { bn := latestBlock currentHash := latestBlockHash for { - bhres, err := sm.observerClient.GetBlockHeaderByHash(context.TODO(), &observertypes.QueryGetBlockHeaderByHashRequest{ + bhres, err := sm.ObserverClient.GetBlockHeaderByHash(context.TODO(), &observertypes.QueryGetBlockHeaderByHashRequest{ BlockHash: currentHash, }) if err != nil { @@ -47,10 +46,9 @@ func (sm *SmokeTest) TestBlockHeaders() { } if bn > earliestBlock { panic(fmt.Sprintf("block header tracing failed; expected at most %d, got %d", earliestBlock, bn)) - } else { - fmt.Printf("block header tracing succeeded; expected at most %d, got %d\n", earliestBlock, bn) } + fmt.Printf("block header tracing succeeded; expected at most %d, got %d\n", earliestBlock, bn) } - checkBlock(common.GoerliChain().ChainId) + checkBlock(common.GoerliLocalnetChain().ChainId) checkBlock(common.BtcRegtestChain().ChainId) } diff --git a/contrib/localnet/orchestrator/smoketest/test_context.go b/contrib/localnet/orchestrator/smoketest/smoketests/test_context.go similarity index 74% rename from contrib/localnet/orchestrator/smoketest/test_context.go rename to contrib/localnet/orchestrator/smoketest/smoketests/test_context.go index 091336daa5..1ec5bda3c5 100644 --- a/contrib/localnet/orchestrator/smoketest/test_context.go +++ b/contrib/localnet/orchestrator/smoketest/smoketests/test_context.go @@ -1,7 +1,4 @@ -//go:build PRIVNET -// +build PRIVNET - -package main +package smoketests import ( "bytes" @@ -11,16 +8,18 @@ import ( "time" "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/runner" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/utils" ) -// this tests sending ZETA out of ZetaChain to Ethereum -func (sm *SmokeTest) TestContextUpgrade() { +// TestContextUpgrade tests sending ZETA out of ZetaChain to Ethereum +func TestContextUpgrade(sm *runner.SmokeTestRunner) { startTime := time.Now() defer func() { fmt.Printf("test finishes in %s\n", time.Since(startTime)) }() - goerliClient := sm.goerliClient - LoudPrintf("Test ContextApp\n") + goerliClient := sm.GoerliClient + utils.LoudPrintf("Test ContextApp\n") bn, err := goerliClient.BlockNumber(context.Background()) if err != nil { panic(err) @@ -32,13 +31,13 @@ func (sm *SmokeTest) TestContextUpgrade() { data = append(data, sm.ContextAppAddr.Bytes()...) data = append(data, []byte("filler")...) // just to make sure that this is a contract call; - signedTx, err := sm.SendEther(TSSAddress, value, data) + signedTx, err := sm.SendEther(sm.TSSAddress, value, data) if err != nil { panic(err) } fmt.Printf("GOERLI tx sent: %s; to %s, nonce %d\n", signedTx.Hash().String(), signedTx.To().Hex(), signedTx.Nonce()) - receipt := MustWaitForTxReceipt(sm.goerliClient, signedTx) + receipt := utils.MustWaitForTxReceipt(sm.GoerliClient, signedTx) fmt.Printf("GOERLI tx receipt: %d\n", receipt.Status) fmt.Printf(" tx hash: %s\n", receipt.TxHash.String()) fmt.Printf(" to: %s\n", signedTx.To().String()) @@ -63,10 +62,10 @@ func (sm *SmokeTest) TestContextUpgrade() { fmt.Printf(" chainid: %d\n", eventIter.Event.ChainID) fmt.Printf(" msgsender: %s\n", eventIter.Event.MsgSender.Hex()) found = true - if bytes.Compare(eventIter.Event.Origin, DeployerAddress.Bytes()) != 0 { + if bytes.Compare(eventIter.Event.Origin, sm.DeployerAddress.Bytes()) != 0 { panic("origin mismatch") } - chainID, err := sm.goerliClient.ChainID(context.Background()) + chainID, err := sm.GoerliClient.ChainID(context.Background()) if err != nil { panic(err) } diff --git a/contrib/localnet/orchestrator/smoketest/test_crosschain_swap.go b/contrib/localnet/orchestrator/smoketest/smoketests/test_crosschain_swap.go similarity index 55% rename from contrib/localnet/orchestrator/smoketest/test_crosschain_swap.go rename to contrib/localnet/orchestrator/smoketest/smoketests/test_crosschain_swap.go index 7e40cb8084..58ad547c6a 100644 --- a/contrib/localnet/orchestrator/smoketest/test_crosschain_swap.go +++ b/contrib/localnet/orchestrator/smoketest/smoketests/test_crosschain_swap.go @@ -1,7 +1,4 @@ -//go:build PRIVNET -// +build PRIVNET - -package main +package smoketests import ( "fmt" @@ -10,33 +7,37 @@ import ( "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/runner" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/utils" "github.com/zeta-chain/zetacore/x/crosschain/types" ) -func (sm *SmokeTest) TestCrosschainSwap() { +func TestCrosschainSwap(sm *runner.SmokeTestRunner) { startTime := time.Now() defer func() { fmt.Printf("test finishes in %s\n", time.Since(startTime)) }() - LoudPrintf("Testing Bitcoin ERC20 crosschain swap...\n") + utils.LoudPrintf("Testing Bitcoin ERC20 crosschain swap...\n") // Firstly, deposit 1.15 BTC into Zeta for liquidity //sm.DepositBTC() // Secondly, deposit 1000.0 USDT into Zeta for liquidity - LoudPrintf("Depositing 1000 USDT & 1.15 BTC for liquidity\n") + utils.LoudPrintf("Depositing 1000 USDT & 1.15 BTC for liquidity\n") txhash := sm.DepositERC20(big.NewInt(1e9), []byte{}) - WaitCctxMinedByInTxHash(txhash.Hex(), sm.cctxClient) + utils.WaitCctxMinedByInTxHash(txhash.Hex(), sm.CctxClient) - sm.zevmAuth.GasLimit = 10000000 - if !localTestArgs.contractsDeployed { - tx, err := sm.UniswapV2Factory.CreatePair(sm.zevmAuth, sm.USDTZRC20Addr, sm.BTCZRC20Addr) - if err != nil { - panic(err) - } - receipt := MustWaitForTxReceipt(sm.zevmClient, tx) + sm.ZevmAuth.GasLimit = 10000000 - fmt.Printf("USDT-BTC pair receipt txhash %s status %d\n", receipt.TxHash, receipt.Status) + // TODO: move into setup and skip it if already initialized + // https://github.com/zeta-chain/node-private/issues/88 + // it is kept as is for now to be consistent with the old implementation + // if the tx fails due to already initialized, it will be ignored + tx, err := sm.UniswapV2Factory.CreatePair(sm.ZevmAuth, sm.USDTZRC20Addr, sm.BTCZRC20Addr) + if err != nil { + panic(err) } + receipt := utils.MustWaitForTxReceipt(sm.ZevmClient, tx) + //fmt.Printf("USDT-BTC pair receipt txhash %s status %d\n", receipt.TxHash, receipt.Status) usdtBtcPair, err := sm.UniswapV2Factory.GetPair(&bind.CallOpts{}, sm.USDTZRC20Addr, sm.BTCZRC20Addr) if err != nil { @@ -44,63 +45,79 @@ func (sm *SmokeTest) TestCrosschainSwap() { } fmt.Printf("USDT-BTC pair addr %s\n", usdtBtcPair.Hex()) - tx, err := sm.USDTZRC20.Approve(sm.zevmAuth, sm.UniswapV2RouterAddr, big.NewInt(1e18)) + tx, err = sm.USDTZRC20.Approve(sm.ZevmAuth, sm.UniswapV2RouterAddr, big.NewInt(1e18)) if err != nil { panic(err) } - receipt := MustWaitForTxReceipt(sm.zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) fmt.Printf("USDT ZRC20 approval receipt txhash %s status %d\n", receipt.TxHash, receipt.Status) - tx, err = sm.BTCZRC20.Approve(sm.zevmAuth, sm.UniswapV2RouterAddr, big.NewInt(1e18)) + tx, err = sm.BTCZRC20.Approve(sm.ZevmAuth, sm.UniswapV2RouterAddr, big.NewInt(1e18)) if err != nil { panic(err) } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) fmt.Printf("BTC ZRC20 approval receipt txhash %s status %d\n", receipt.TxHash, receipt.Status) // Add 100 USDT liq and 0.001 BTC - bal, err := sm.BTCZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) + bal, err := sm.BTCZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) if err != nil { panic(err) } fmt.Printf("balance of deployer on USDT ZRC20: %d\n", bal) - bal, err = sm.USDTZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) + bal, err = sm.USDTZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) if err != nil { panic(err) } fmt.Printf("balance of deployer on USDT ZRC20: %d\n", bal) - tx, err = sm.UniswapV2Router.AddLiquidity(sm.zevmAuth, sm.USDTZRC20Addr, sm.BTCZRC20Addr, big.NewInt(1e8), big.NewInt(1e8), big.NewInt(1e8), big.NewInt(1e5), DeployerAddress, big.NewInt(time.Now().Add(10*time.Minute).Unix())) + tx, err = sm.UniswapV2Router.AddLiquidity( + sm.ZevmAuth, + sm.USDTZRC20Addr, + sm.BTCZRC20Addr, + big.NewInt(1e8), + big.NewInt(1e8), + big.NewInt(1e8), + big.NewInt(1e5), + sm.DeployerAddress, + big.NewInt(time.Now().Add(10*time.Minute).Unix()), + ) if err != nil { fmt.Printf("Error liq %s", err.Error()) panic(err) } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) fmt.Printf("Add liquidity receipt txhash %s status %d\n", receipt.TxHash, receipt.Status) fmt.Printf("Funding contracts ZEVMSwapApp with gas ZRC20s; 1e7 ETH, 1e6 BTC\n") // Fund ZEVMSwapApp with gas ZRC20s - tx, err = sm.ETHZRC20.Transfer(sm.zevmAuth, sm.ZEVMSwapAppAddr, big.NewInt(1e7)) + tx, err = sm.ETHZRC20.Transfer(sm.ZevmAuth, sm.ZEVMSwapAppAddr, big.NewInt(1e7)) if err != nil { panic(err) } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) fmt.Printf(" USDT ZRC20 transfer receipt txhash %s status %d\n", receipt.TxHash, receipt.Status) - bal1, _ := sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, sm.ZEVMSwapAppAddr) + bal1, err := sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, sm.ZEVMSwapAppAddr) + if err != nil { + panic(err) + } fmt.Printf(" ZEVMSwapApp ETHZRC20 balance %d", bal1) - tx, err = sm.BTCZRC20.Transfer(sm.zevmAuth, sm.ZEVMSwapAppAddr, big.NewInt(1e6)) + tx, err = sm.BTCZRC20.Transfer(sm.ZevmAuth, sm.ZEVMSwapAppAddr, big.NewInt(1e6)) if err != nil { panic(err) } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) fmt.Printf(" BTC ZRC20 transfer receipt txhash %s status %d\n", receipt.TxHash, receipt.Status) - bal2, _ := sm.BTCZRC20.BalanceOf(&bind.CallOpts{}, sm.ZEVMSwapAppAddr) + bal2, err := sm.BTCZRC20.BalanceOf(&bind.CallOpts{}, sm.ZEVMSwapAppAddr) + if err != nil { + panic(err) + } fmt.Printf(" ZEVMSwapApp BTCZRC20 balance %d", bal2) // msg would be [ZEVMSwapAppAddr, memobytes] // memobytes is dApp specific; see the contracts/ZEVMSwapApp.sol for details msg := []byte{} msg = append(msg, sm.ZEVMSwapAppAddr.Bytes()...) - memobytes, err := sm.ZEVMSwapApp.EncodeMemo(&bind.CallOpts{}, sm.BTCZRC20Addr, []byte(BTCDeployerAddress.EncodeAddress())) + memobytes, err := sm.ZEVMSwapApp.EncodeMemo(&bind.CallOpts{}, sm.BTCZRC20Addr, []byte(sm.BTCDeployerAddress.EncodeAddress())) if err != nil { panic(err) @@ -111,59 +128,81 @@ func (sm *SmokeTest) TestCrosschainSwap() { fmt.Printf("***** First test: USDT -> BTC\n") // Should deposit USDT for swap, swap for BTC and withdraw BTC txhash = sm.DepositERC20(big.NewInt(8e7), msg) - cctx1 := WaitCctxMinedByInTxHash(txhash.Hex(), sm.cctxClient) + cctx1 := utils.WaitCctxMinedByInTxHash(txhash.Hex(), sm.CctxClient) - _, err = sm.btcRPCClient.GenerateToAddress(10, BTCDeployerAddress, nil) + // check the cctx status + if cctx1.CctxStatus.Status != types.CctxStatus_OutboundMined { + panic(fmt.Sprintf("expected outbound mined status; got %s, message: %s", cctx1.CctxStatus.Status.String(), cctx1.CctxStatus.StatusMessage)) + } + + _, err = sm.BtcRPCClient.GenerateToAddress(10, sm.BTCDeployerAddress, nil) if err != nil { panic(err) } // cctx1 index acts like the inTxHash for the second cctx (the one that withdraws BTC) - cctx2 := WaitCctxMinedByInTxHash(cctx1.Index, sm.cctxClient) - _ = cctx2 + cctx2 := utils.WaitCctxMinedByInTxHash(cctx1.Index, sm.CctxClient) + + // check the cctx status + if cctx2.CctxStatus.Status != types.CctxStatus_OutboundMined { + panic(fmt.Sprintf( + "expected outbound mined status; got %s, message: %s", + cctx2.CctxStatus.Status.String(), + cctx2.CctxStatus.StatusMessage), + ) + } + fmt.Printf("cctx2 outbound tx hash %s\n", cctx2.GetCurrentOutTxParam().OutboundTxHash) fmt.Printf("******* Second test: BTC -> USDT\n") - utxos, err := sm.btcRPCClient.ListUnspent() + utxos, err := sm.BtcRPCClient.ListUnspent() if err != nil { panic(err) } fmt.Printf("#utxos %d\n", len(utxos)) //fmt.Printf("Unimplemented!\n") - memo, err := sm.ZEVMSwapApp.EncodeMemo(&bind.CallOpts{}, sm.USDTZRC20Addr, DeployerAddress.Bytes()) + fmt.Printf("memo address %s\n", sm.USDTZRC20Addr) + memo, err := sm.ZEVMSwapApp.EncodeMemo(&bind.CallOpts{}, sm.USDTZRC20Addr, sm.DeployerAddress.Bytes()) if err != nil { panic(err) } memo = append(sm.ZEVMSwapAppAddr.Bytes(), memo...) fmt.Printf("memo length %d\n", len(memo)) - txid, err := SendToTSSFromDeployerWithMemo(BTCTSSAddress, 0.01, utxos[0:2], sm.btcRPCClient, memo) + txid, err := sm.SendToTSSFromDeployerWithMemo( + sm.BTCTSSAddress, + 0.01, + utxos[0:2], + sm.BtcRPCClient, + memo, + sm.BTCDeployerAddress, + ) fmt.Printf("Sent BTC to TSS txid %s; now mining 10 blocks for confirmation\n", txid) - _, err = sm.btcRPCClient.GenerateToAddress(10, BTCDeployerAddress, nil) + _, err = sm.BtcRPCClient.GenerateToAddress(10, sm.BTCDeployerAddress, nil) if err != nil { panic(err) } - cctx3 := WaitCctxMinedByInTxHash(txid.String(), sm.cctxClient) + cctx3 := utils.WaitCctxMinedByInTxHash(txid.String(), sm.CctxClient) fmt.Printf("cctx3 index %s\n", cctx3.Index) fmt.Printf(" inboudn tx hash %s\n", cctx3.InboundTxParams.InboundTxObservedHash) fmt.Printf(" status %s\n", cctx3.CctxStatus.Status.String()) fmt.Printf(" status msg: %s\n", cctx3.CctxStatus.StatusMessage) - cctx4 := WaitCctxMinedByInTxHash(cctx3.Index, sm.cctxClient) + cctx4 := utils.WaitCctxMinedByInTxHash(cctx3.Index, sm.CctxClient) fmt.Printf("cctx4 index %s\n", cctx4.Index) fmt.Printf(" outbound tx hash %s\n", cctx4.GetCurrentOutTxParam().OutboundTxHash) fmt.Printf(" status %s\n", cctx4.CctxStatus.Status.String()) { fmt.Printf("******* Third test: BTC -> ETH with contract call reverted; should refund BTC\n") - utxos, err := sm.btcRPCClient.ListUnspent() + utxos, err := sm.BtcRPCClient.ListUnspent() if err != nil { panic(err) } fmt.Printf("#utxos %d\n", len(utxos)) // the following memo will result in a revert in the contract call as targetZRC20 is set to DeployerAddress // which is apparently not a ZRC20 contract; the UNISWAP call will revert - memo, err := sm.ZEVMSwapApp.EncodeMemo(&bind.CallOpts{}, DeployerAddress, DeployerAddress.Bytes()) + memo, err := sm.ZEVMSwapApp.EncodeMemo(&bind.CallOpts{}, sm.DeployerAddress, sm.DeployerAddress.Bytes()) if err != nil { panic(err) } @@ -171,14 +210,24 @@ func (sm *SmokeTest) TestCrosschainSwap() { fmt.Printf("memo length %d\n", len(memo)) amount := 0.1 - txid, err := SendToTSSFromDeployerWithMemo(BTCTSSAddress, amount, utxos[0:2], sm.btcRPCClient, memo) + txid, err := sm.SendToTSSFromDeployerWithMemo( + sm.BTCTSSAddress, + amount, + utxos[0:2], + sm.BtcRPCClient, + memo, + sm.BTCDeployerAddress, + ) + if err != nil { + panic(err) + } fmt.Printf("Sent BTC to TSS txid %s; now mining 10 blocks for confirmation\n", txid) - _, err = sm.btcRPCClient.GenerateToAddress(10, BTCDeployerAddress, nil) + _, err = sm.BtcRPCClient.GenerateToAddress(10, sm.BTCDeployerAddress, nil) if err != nil { panic(err) } - cctx := WaitCctxMinedByInTxHash(txid.String(), sm.cctxClient) + cctx := utils.WaitCctxMinedByInTxHash(txid.String(), sm.CctxClient) fmt.Printf("cctx3 index http://localhost:1317/zeta-chain/crosschain/cctx/%s\n", cctx.Index) fmt.Printf(" inboudn tx hash %s\n", cctx.InboundTxParams.InboundTxObservedHash) fmt.Printf(" status %s\n", cctx.CctxStatus.Status.String()) @@ -191,7 +240,7 @@ func (sm *SmokeTest) TestCrosschainSwap() { if err != nil { panic(err) } - txraw, err := sm.btcRPCClient.GetRawTransactionVerbose(outTxHash) + txraw, err := sm.BtcRPCClient.GetRawTransactionVerbose(outTxHash) if err != nil { panic(err) } @@ -200,7 +249,7 @@ func (sm *SmokeTest) TestCrosschainSwap() { fmt.Printf(" vout %d\n", vout.N) fmt.Printf(" value %f\n", vout.Value) fmt.Printf(" scriptPubKey %s\n", vout.ScriptPubKey.Hex) - fmt.Printf(" p2wpkh address: %s\n", ScriptPKToAddress(vout.ScriptPubKey.Hex)) + fmt.Printf(" p2wpkh address: %s\n", utils.ScriptPKToAddress(vout.ScriptPubKey.Hex)) } } } diff --git a/contrib/localnet/orchestrator/smoketest/test_deposit_eth.go b/contrib/localnet/orchestrator/smoketest/smoketests/test_deposit_eth.go similarity index 51% rename from contrib/localnet/orchestrator/smoketest/test_deposit_eth.go rename to contrib/localnet/orchestrator/smoketest/smoketests/test_deposit_eth.go index a792957410..6a730829bc 100644 --- a/contrib/localnet/orchestrator/smoketest/test_deposit_eth.go +++ b/contrib/localnet/orchestrator/smoketest/smoketests/test_deposit_eth.go @@ -1,7 +1,4 @@ -//go:build PRIVNET -// +build PRIVNET - -package main +package smoketests import ( "context" @@ -11,206 +8,53 @@ import ( "time" "cosmossdk.io/math" + "github.com/ethereum/go-ethereum/accounts/abi/bind" ethcommon "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" - zrc20 "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" - "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/common/ethereum" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/runner" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/utils" testcontract "github.com/zeta-chain/zetacore/testutil/contracts" "github.com/zeta-chain/zetacore/x/crosschain/types" fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" - observertypes "github.com/zeta-chain/zetacore/x/observer/types" - "github.com/zeta-chain/zetacore/zetaclient" ) -// this tests sending ZETA out of ZetaChain to Ethereum -func (sm *SmokeTest) TestDepositEtherIntoZRC20() { - startTime := time.Now() - defer func() { - fmt.Printf("test finishes in %s\n", time.Since(startTime)) - }() - goerliClient := sm.goerliClient - LoudPrintf("Deposit Ether into ZEVM\n") - bn, err := goerliClient.BlockNumber(context.Background()) - if err != nil { - panic(err) - } - fmt.Printf("GOERLI block number: %d\n", bn) - bal, err := goerliClient.BalanceAt(context.Background(), DeployerAddress, nil) - if err != nil { - panic(err) - } - fmt.Printf("GOERLI deployer balance: %s\n", bal.String()) - - systemContract := sm.SystemContract - if err != nil { - panic(err) - } - ethZRC20Addr, err := systemContract.GasCoinZRC20ByChainId(&bind.CallOpts{}, big.NewInt(common.GoerliChain().ChainId)) - if err != nil { - panic(err) - } - sm.ETHZRC20Addr = ethZRC20Addr - fmt.Printf("eth zrc20 address: %s\n", ethZRC20Addr.String()) - ethZRC20, err := zrc20.NewZRC20(ethZRC20Addr, sm.zevmClient) - if err != nil { - panic(err) - } - sm.ETHZRC20 = ethZRC20 - initialBalance, err := ethZRC20.BalanceOf(nil, DeployerAddress) - if err != nil { - panic(err) - } - - value := big.NewInt(1000000000000000000) // in wei (1 eth) - signedTx, err := sm.SendEther(TSSAddress, value, nil) - if err != nil { - panic(err) - } - - fmt.Printf("GOERLI tx sent: %s; to %s, nonce %d\n", signedTx.Hash().String(), signedTx.To().Hex(), signedTx.Nonce()) - receipt := MustWaitForTxReceipt(sm.goerliClient, signedTx) - fmt.Printf("GOERLI tx receipt: %d\n", receipt.Status) - fmt.Printf(" tx hash: %s\n", receipt.TxHash.String()) - fmt.Printf(" to: %s\n", signedTx.To().String()) - fmt.Printf(" value: %d\n", signedTx.Value()) - fmt.Printf(" block num: %d\n", receipt.BlockNumber) - - { - LoudPrintf("Merkle Proof\n") - txHash := receipt.TxHash - blockHash := receipt.BlockHash - txIndex := int(receipt.TransactionIndex) - - block, err := sm.goerliClient.BlockByHash(context.Background(), blockHash) - if err != nil { - panic(err) - } - i := 0 - for { - if i > 20 { - panic("block header not found") - } - _, err := sm.observerClient.GetBlockHeaderByHash(context.Background(), &observertypes.QueryGetBlockHeaderByHashRequest{ - BlockHash: blockHash.Bytes(), - }) - if err != nil { - fmt.Printf("WARN: block header not found; retrying... error: %s \n", err.Error()) - time.Sleep(5 * time.Second) - } else { - fmt.Printf("OK: block header found\n") - break - } - i++ - } - - trie := ethereum.NewTrie(block.Transactions()) - if trie.Hash() != block.Header().TxHash { - panic("tx root hash & block tx root mismatch") - } - txProof, err := trie.GenerateProof(txIndex) - if err != nil { - panic("error generating txProof") - } - val, err := txProof.Verify(block.TxHash(), txIndex) - if err != nil { - panic("error verifying txProof") - } - var txx ethtypes.Transaction - err = txx.UnmarshalBinary(val) - if err != nil { - panic("error unmarshalling txProof'd tx") - } - res, err := sm.observerClient.Prove(context.Background(), &observertypes.QueryProveRequest{ - BlockHash: blockHash.Hex(), - TxIndex: int64(txIndex), - TxHash: txHash.Hex(), - Proof: common.NewEthereumProof(txProof), - ChainId: common.GoerliChain().ChainId, - }) - if err != nil { - panic(err) - } - if !res.Valid { - panic("txProof invalid") // FIXME: don't do this in production - } - fmt.Printf("OK: txProof verified\n") - } - - { - tx, err := sm.SendEther(TSSAddress, big.NewInt(101000000000000000), []byte(zetaclient.DonationMessage)) - if err != nil { - panic(err) - } - receipt := MustWaitForTxReceipt(sm.goerliClient, tx) - fmt.Printf("GOERLI donation tx receipt: %d\n", receipt.Status) - } - - c := make(chan any) - sm.wg.Add(1) - go func() { - defer sm.wg.Done() - WaitCctxMinedByInTxHash(signedTx.Hash().Hex(), sm.cctxClient) - c <- 0 - }() - sm.wg.Add(1) - go func() { - defer sm.wg.Done() - <-c - - currentBalance, err := ethZRC20.BalanceOf(nil, DeployerAddress) - if err != nil { - panic(err) - } - diff := big.NewInt(0) - diff.Sub(currentBalance, initialBalance) - fmt.Printf("eth zrc20 balance: %s\n", currentBalance.String()) - if diff.Cmp(value) != 0 { - fmt.Printf("eth zrc20 bal wanted %d, got %d\n", value, diff) - panic("bal mismatch") - } - - }() - sm.wg.Wait() -} - // TestEtherDepositAndCall tests deposit of ethers calling a example contract -func (sm *SmokeTest) TestEtherDepositAndCall() { +func TestEtherDepositAndCall(sm *runner.SmokeTestRunner) { startTime := time.Now() defer func() { fmt.Printf("test finishes in %s\n", time.Since(startTime)) }() - LoudPrintf("Deposit ZRC20 into ZEVM and call a contract\n") + utils.LoudPrintf("Deposit ZRC20 into ZEVM and call a contract\n") fmt.Println("Deploying example contract") - exampleAddr, _, exampleContract, err := testcontract.DeployExample(sm.zevmAuth, sm.zevmClient) + exampleAddr, _, exampleContract, err := testcontract.DeployExample(sm.ZevmAuth, sm.ZevmClient) if err != nil { panic(err) } fmt.Println("Example contract deployed") // preparing tx - goerliClient := sm.goerliClient + goerliClient := sm.GoerliClient value := big.NewInt(1e18) gasLimit := uint64(23000) gasPrice, err := goerliClient.SuggestGasPrice(context.Background()) if err != nil { panic(err) } - nonce, err := goerliClient.PendingNonceAt(context.Background(), DeployerAddress) + nonce, err := goerliClient.PendingNonceAt(context.Background(), sm.DeployerAddress) if err != nil { panic(err) } data := append(exampleAddr.Bytes(), []byte("hello sailors")...) - tx := ethtypes.NewTransaction(nonce, TSSAddress, value, gasLimit, gasPrice, data) + tx := ethtypes.NewTransaction(nonce, sm.TSSAddress, value, gasLimit, gasPrice, data) chainID, err := goerliClient.NetworkID(context.Background()) if err != nil { panic(err) } - deployerPrivkey, err := crypto.HexToECDSA(DeployerPrivateKey) + deployerPrivkey, err := crypto.HexToECDSA(sm.DeployerPrivateKey) if err != nil { panic(err) } @@ -224,11 +68,11 @@ func (sm *SmokeTest) TestEtherDepositAndCall() { if err != nil { panic(err) } - receipt := MustWaitForTxReceipt(sm.goerliClient, signedTx) + receipt := utils.MustWaitForTxReceipt(sm.GoerliClient, signedTx) if receipt.Status == 0 { panic("tx failed") } - cctx := WaitCctxMinedByInTxHash(signedTx.Hash().Hex(), sm.cctxClient) + cctx := utils.WaitCctxMinedByInTxHash(signedTx.Hash().Hex(), sm.CctxClient) if cctx.CctxStatus.Status != types.CctxStatus_OutboundMined { panic(fmt.Sprintf("expected cctx status to be mined; got %s", cctx.CctxStatus.Status)) } @@ -244,7 +88,7 @@ func (sm *SmokeTest) TestEtherDepositAndCall() { fmt.Println("Cross-chain call succeeded") fmt.Println("Deploying reverter contract") - reverterAddr, _, _, err := testcontract.DeployReverter(sm.zevmAuth, sm.zevmClient) + reverterAddr, _, _, err := testcontract.DeployReverter(sm.ZevmAuth, sm.ZevmClient) if err != nil { panic(err) } @@ -255,13 +99,13 @@ func (sm *SmokeTest) TestEtherDepositAndCall() { if err != nil { panic(err) } - nonce, err = goerliClient.PendingNonceAt(context.Background(), DeployerAddress) + nonce, err = goerliClient.PendingNonceAt(context.Background(), sm.DeployerAddress) if err != nil { panic(err) } data = append(reverterAddr.Bytes(), []byte("hello sailors")...) - tx = ethtypes.NewTransaction(nonce, TSSAddress, value, gasLimit, gasPrice, data) + tx = ethtypes.NewTransaction(nonce, sm.TSSAddress, value, gasLimit, gasPrice, data) signedTx, err = ethtypes.SignTx(tx, ethtypes.NewEIP155Signer(chainID), deployerPrivkey) if err != nil { panic(err) @@ -273,11 +117,11 @@ func (sm *SmokeTest) TestEtherDepositAndCall() { panic(err) } - receipt = MustWaitForTxReceipt(sm.goerliClient, signedTx) + receipt = utils.MustWaitForTxReceipt(sm.GoerliClient, signedTx) if receipt.Status == 0 { panic("tx failed") } - cctx = WaitCctxMinedByInTxHash(signedTx.Hash().Hex(), sm.cctxClient) + cctx = utils.WaitCctxMinedByInTxHash(signedTx.Hash().Hex(), sm.CctxClient) if cctx.CctxStatus.Status != types.CctxStatus_Reverted { panic(fmt.Sprintf("expected cctx status to be reverted; got %s", cctx.CctxStatus.Status)) } @@ -290,25 +134,25 @@ func (sm *SmokeTest) TestEtherDepositAndCall() { } } -func (sm *SmokeTest) TestDepositAndCallRefund() { +func TestDepositAndCallRefund(sm *runner.SmokeTestRunner) { startTime := time.Now() defer func() { fmt.Printf("test finishes in %s\n", time.Since(startTime)) }() - LoudPrintf("Deposit ZRC20 into ZEVM and call a contract that reverts; should refund\n") + utils.LoudPrintf("Deposit ZRC20 into ZEVM and call a contract that reverts; should refund\n") - goerliClient := sm.goerliClient + goerliClient := sm.GoerliClient bn, err := goerliClient.BlockNumber(context.Background()) if err != nil { panic(err) } fmt.Printf("GOERLI block number: %d\n", bn) - bal, err := goerliClient.BalanceAt(context.Background(), DeployerAddress, nil) + bal, err := goerliClient.BalanceAt(context.Background(), sm.DeployerAddress, nil) if err != nil { panic(err) } fmt.Printf("GOERLI deployer balance: %s\n", bal.String()) - nonce, err := goerliClient.PendingNonceAt(context.Background(), DeployerAddress) + nonce, err := goerliClient.PendingNonceAt(context.Background(), sm.DeployerAddress) if err != nil { panic(err) } @@ -324,12 +168,12 @@ func (sm *SmokeTest) TestDepositAndCallRefund() { } data := append(sm.BTCZRC20Addr.Bytes(), []byte("hello sailors")...) // this data - tx := ethtypes.NewTransaction(nonce, TSSAddress, value, gasLimit, gasPrice, data) + tx := ethtypes.NewTransaction(nonce, sm.TSSAddress, value, gasLimit, gasPrice, data) chainID, err := goerliClient.NetworkID(context.Background()) if err != nil { panic(err) } - deployerPrivkey, err := crypto.HexToECDSA(DeployerPrivateKey) + deployerPrivkey, err := crypto.HexToECDSA(sm.DeployerPrivateKey) if err != nil { panic(err) } @@ -343,7 +187,7 @@ func (sm *SmokeTest) TestDepositAndCallRefund() { panic(err) } fmt.Printf("GOERLI tx sent: %s; to %s, nonce %d\n", signedTx.Hash().String(), signedTx.To().Hex(), signedTx.Nonce()) - receipt := MustWaitForTxReceipt(sm.goerliClient, signedTx) + receipt := utils.MustWaitForTxReceipt(sm.GoerliClient, signedTx) fmt.Printf("GOERLI tx receipt: %d\n", receipt.Status) fmt.Printf(" tx hash: %s\n", receipt.TxHash.String()) fmt.Printf(" to: %s\n", signedTx.To().String()) @@ -351,16 +195,16 @@ func (sm *SmokeTest) TestDepositAndCallRefund() { fmt.Printf(" block num: %d\n", receipt.BlockNumber) func() { - cctx := WaitCctxMinedByInTxHash(signedTx.Hash().Hex(), sm.cctxClient) + cctx := utils.WaitCctxMinedByInTxHash(signedTx.Hash().Hex(), sm.CctxClient) fmt.Printf("cctx status message: %s", cctx.CctxStatus.StatusMessage) revertTxHash := cctx.GetCurrentOutTxParam().OutboundTxHash fmt.Printf("GOERLI revert tx receipt: status %d\n", receipt.Status) - tx, _, err := sm.goerliClient.TransactionByHash(context.Background(), ethcommon.HexToHash(revertTxHash)) + tx, _, err := sm.GoerliClient.TransactionByHash(context.Background(), ethcommon.HexToHash(revertTxHash)) if err != nil { panic(err) } - receipt, err := sm.goerliClient.TransactionReceipt(context.Background(), ethcommon.HexToHash(revertTxHash)) + receipt, err := sm.GoerliClient.TransactionReceipt(context.Background(), ethcommon.HexToHash(revertTxHash)) if err != nil { panic(err) } @@ -382,9 +226,9 @@ func (sm *SmokeTest) TestDepositAndCallRefund() { panic("expected the revert tx receipt to have status 1; got 0") } - if *tx.To() != DeployerAddress { + if *tx.To() != sm.DeployerAddress { printTxInfo() - panic(fmt.Sprintf("expected tx to %s; got %s", DeployerAddress.Hex(), tx.To().Hex())) + panic(fmt.Sprintf("expected tx to %s; got %s", sm.DeployerAddress.Hex(), tx.To().Hex())) } // the received value must be lower than the original value because of the paid fees for the revert tx @@ -403,12 +247,12 @@ func (sm *SmokeTest) TestDepositAndCallRefund() { } // TestDepositEtherLiquidityCap tests depositing Ethers in a context where a liquidity cap is set -func (sm *SmokeTest) TestDepositEtherLiquidityCap() { +func TestDepositEtherLiquidityCap(sm *runner.SmokeTestRunner) { startTime := time.Now() defer func() { fmt.Printf("test finishes in %s\n", time.Since(startTime)) }() - LoudPrintf("Deposit Ethers into ZEVM with a liquidity cap\n") + utils.LoudPrintf("Deposit Ethers into ZEVM with a liquidity cap\n") supply, err := sm.ETHZRC20.TotalSupply(&bind.CallOpts{}) if err != nil { @@ -419,48 +263,48 @@ func (sm *SmokeTest) TestDepositEtherLiquidityCap() { fmt.Println("Setting a liquidity cap") liquidityCap := math.NewUintFromBigInt(supply).Add(math.NewUint(1e16)) msg := fungibletypes.NewMsgUpdateZRC20LiquidityCap( - FungibleAdminAddress, + sm.ZetaTxServer.GetAccountAddress(0), sm.ETHZRC20Addr.Hex(), liquidityCap, ) - res, err := sm.zetaTxServer.BroadcastTx(FungibleAdminName, msg) + res, err := sm.ZetaTxServer.BroadcastTx(utils.FungibleAdminName, msg) if err != nil { panic(err) } fmt.Printf("set liquidity cap tx hash: %s\n", res.TxHash) fmt.Println("Depositing more than liquidity cap should make cctx reverted") - signedTx, err := sm.SendEther(TSSAddress, big.NewInt(1e17), nil) + signedTx, err := sm.SendEther(sm.TSSAddress, big.NewInt(1e17), nil) if err != nil { panic(err) } - receipt := MustWaitForTxReceipt(sm.goerliClient, signedTx) + receipt := utils.MustWaitForTxReceipt(sm.GoerliClient, signedTx) if receipt.Status == 0 { panic("deposit eth tx failed") } - cctx := WaitCctxMinedByInTxHash(signedTx.Hash().Hex(), sm.cctxClient) + cctx := utils.WaitCctxMinedByInTxHash(signedTx.Hash().Hex(), sm.CctxClient) if cctx.CctxStatus.Status != types.CctxStatus_Reverted { panic(fmt.Sprintf("expected cctx status to be Reverted; got %s", cctx.CctxStatus.Status)) } fmt.Println("CCTX has been reverted") fmt.Println("Depositing less than liquidity cap should still succeed") - initialBal, err := sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) + initialBal, err := sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) if err != nil { panic(err) } - signedTx, err = sm.SendEther(TSSAddress, big.NewInt(1e15), nil) + signedTx, err = sm.SendEther(sm.TSSAddress, big.NewInt(1e15), nil) if err != nil { panic(err) } - receipt = MustWaitForTxReceipt(sm.goerliClient, signedTx) + receipt = utils.MustWaitForTxReceipt(sm.GoerliClient, signedTx) if receipt.Status == 0 { panic("deposit eth tx failed") } - WaitCctxMinedByInTxHash(signedTx.Hash().Hex(), sm.cctxClient) + utils.WaitCctxMinedByInTxHash(signedTx.Hash().Hex(), sm.CctxClient) expectedBalance := big.NewInt(0).Add(initialBal, big.NewInt(1e15)) - bal, err := sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) + bal, err := sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) if err != nil { panic(err) } @@ -471,31 +315,31 @@ func (sm *SmokeTest) TestDepositEtherLiquidityCap() { fmt.Println("Removing the liquidity cap") msg = fungibletypes.NewMsgUpdateZRC20LiquidityCap( - FungibleAdminAddress, + sm.ZetaTxServer.GetAccountAddress(0), sm.ETHZRC20Addr.Hex(), math.ZeroUint(), ) - res, err = sm.zetaTxServer.BroadcastTx(FungibleAdminName, msg) + res, err = sm.ZetaTxServer.BroadcastTx(utils.FungibleAdminName, msg) if err != nil { panic(err) } fmt.Printf("remove liquidity cap tx hash: %s\n", res.TxHash) - initialBal, err = sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) + initialBal, err = sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) if err != nil { panic(err) } - signedTx, err = sm.SendEther(TSSAddress, big.NewInt(1e17), nil) + signedTx, err = sm.SendEther(sm.TSSAddress, big.NewInt(1e17), nil) if err != nil { panic(err) } - receipt = MustWaitForTxReceipt(sm.goerliClient, signedTx) + receipt = utils.MustWaitForTxReceipt(sm.GoerliClient, signedTx) if receipt.Status == 0 { panic("deposit eth tx failed") } - WaitCctxMinedByInTxHash(signedTx.Hash().Hex(), sm.cctxClient) + utils.WaitCctxMinedByInTxHash(signedTx.Hash().Hex(), sm.CctxClient) expectedBalance = big.NewInt(0).Add(initialBal, big.NewInt(1e17)) - bal, err = sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) + bal, err = sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) if err != nil { panic(err) } @@ -504,37 +348,3 @@ func (sm *SmokeTest) TestDepositEtherLiquidityCap() { } fmt.Println("New deposit succeeded") } - -func (sm *SmokeTest) SendEther(to ethcommon.Address, value *big.Int, data []byte) (*ethtypes.Transaction, error) { - goerliClient := sm.goerliClient - - nonce, err := goerliClient.PendingNonceAt(context.Background(), DeployerAddress) - if err != nil { - return nil, err - } - gasLimit := uint64(30000) // in units - gasPrice, err := goerliClient.SuggestGasPrice(context.Background()) - if err != nil { - return nil, err - } - tx := ethtypes.NewTransaction(nonce, TSSAddress, value, gasLimit, gasPrice, data) - chainID, err := goerliClient.NetworkID(context.Background()) - if err != nil { - return nil, err - } - deployerPrivkey, err := crypto.HexToECDSA(DeployerPrivateKey) - if err != nil { - return nil, err - } - - signedTx, err := ethtypes.SignTx(tx, ethtypes.NewEIP155Signer(chainID), deployerPrivkey) - if err != nil { - return nil, err - } - err = goerliClient.SendTransaction(context.Background(), signedTx) - if err != nil { - return nil, err - } - - return signedTx, nil -} diff --git a/contrib/localnet/orchestrator/smoketest/smoketests/test_erc20_deposit.go b/contrib/localnet/orchestrator/smoketest/smoketests/test_erc20_deposit.go new file mode 100644 index 0000000000..6bb70a9bfa --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/smoketests/test_erc20_deposit.go @@ -0,0 +1,121 @@ +package smoketests + +import ( + "fmt" + "math/big" + "time" + + "github.com/ethereum/go-ethereum/accounts/abi/bind" + ethcommon "github.com/ethereum/go-ethereum/common" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/runner" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/utils" + testcontract "github.com/zeta-chain/zetacore/testutil/contracts" +) + +func TestERC20Deposit(sm *runner.SmokeTestRunner) { + startTime := time.Now() + defer func() { + fmt.Printf("test finishes in %s\n", time.Since(startTime)) + }() + utils.LoudPrintf("Deposit USDT ERC20 into ZEVM\n") + + initialBal, err := sm.USDTZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) + if err != nil { + panic(err) + } + txhash := sm.DepositERC20(big.NewInt(1e18), []byte{}) + utils.WaitCctxMinedByInTxHash(txhash.Hex(), sm.CctxClient) + + bal, err := sm.USDTZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) + if err != nil { + panic(err) + } + + diff := big.NewInt(0) + diff.Sub(bal, initialBal) + + fmt.Printf("balance of deployer on USDT ZRC20: %d\n", bal) + supply, err := sm.USDTZRC20.TotalSupply(&bind.CallOpts{}) + if err != nil { + panic(err) + } + fmt.Printf("supply of USDT ZRC20: %d\n", supply) + if diff.Int64() != 1e18 { + panic("balance is not correct") + } + + utils.LoudPrintf("Same-transaction multiple deposit USDT ERC20 into ZEVM\n") + initialBal, err = sm.USDTZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) + if err != nil { + panic(err) + } + txhash = MultipleDeposits(sm, big.NewInt(1e9), big.NewInt(10)) + cctxs := utils.WaitCctxsMinedByInTxHash(txhash.Hex(), sm.CctxClient, 10) + if len(cctxs) != 10 { + panic(fmt.Sprintf("cctxs length is not correct: %d", len(cctxs))) + } + + // check new balance is increased by 1e9 * 10 + bal, err = sm.USDTZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) + if err != nil { + panic(err) + } + diff = big.NewInt(0).Sub(bal, initialBal) + if diff.Int64() != 1e10 { + panic(fmt.Sprintf("balance difference is not correct: %d", diff.Int64())) + } +} + +func MultipleDeposits(sm *runner.SmokeTestRunner, amount, count *big.Int) ethcommon.Hash { + // deploy depositor + depositorAddr, _, depositor, err := testcontract.DeployDepositor(sm.GoerliAuth, sm.GoerliClient, sm.ERC20CustodyAddr) + if err != nil { + panic(err) + } + + fullAmount := big.NewInt(0).Mul(amount, count) + + // mint + tx, err := sm.USDTERC20.Mint(sm.GoerliAuth, fullAmount) + if err != nil { + panic(err) + } + receipt := utils.MustWaitForTxReceipt(sm.GoerliClient, tx) + if receipt.Status == 0 { + panic("mint failed") + } + fmt.Printf("Mint receipt tx hash: %s\n", tx.Hash().Hex()) + + // approve + tx, err = sm.USDTERC20.Approve(sm.GoerliAuth, depositorAddr, fullAmount) + if err != nil { + panic(err) + } + receipt = utils.MustWaitForTxReceipt(sm.GoerliClient, tx) + if receipt.Status == 0 { + panic("approve failed") + } + fmt.Printf("USDT Approve receipt tx hash: %s\n", tx.Hash().Hex()) + + // deposit + tx, err = depositor.RunDeposits(sm.GoerliAuth, sm.DeployerAddress.Bytes(), sm.USDTERC20Addr, amount, []byte{}, count) + if err != nil { + panic(err) + } + receipt = utils.MustWaitForTxReceipt(sm.GoerliClient, tx) + if receipt.Status == 0 { + panic("deposits failed") + } + fmt.Printf("Deposits receipt tx hash: %s\n", tx.Hash().Hex()) + + for _, log := range receipt.Logs { + event, err := sm.ERC20Custody.ParseDeposited(*log) + if err != nil { + continue + } + fmt.Printf("Multiple deposit event: \n") + fmt.Printf(" Amount: %d, \n", event.Amount) + } + fmt.Printf("gas limit %d\n", sm.ZevmAuth.GasLimit) + return tx.Hash() +} diff --git a/contrib/localnet/orchestrator/smoketest/test_erc20_refund.go b/contrib/localnet/orchestrator/smoketest/smoketests/test_erc20_refund.go similarity index 70% rename from contrib/localnet/orchestrator/smoketest/test_erc20_refund.go rename to contrib/localnet/orchestrator/smoketest/smoketests/test_erc20_refund.go index e8d5686313..08171e63e6 100644 --- a/contrib/localnet/orchestrator/smoketest/test_erc20_refund.go +++ b/contrib/localnet/orchestrator/smoketest/smoketests/test_erc20_refund.go @@ -1,7 +1,4 @@ -//go:build PRIVNET -// +build PRIVNET - -package main +package smoketests import ( "context" @@ -12,19 +9,20 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" ethcommon "github.com/ethereum/go-ethereum/common" - + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/runner" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/utils" "github.com/zeta-chain/zetacore/x/crosschain/types" ) -func (sm *SmokeTest) TestERC20DepositAndCallRefund() { +func TestERC20DepositAndCallRefund(sm *runner.SmokeTestRunner) { startTime := time.Now() defer func() { fmt.Printf("test finishes in %s\n", time.Since(startTime)) }() - LoudPrintf("Deposit a non-gas ZRC20 into ZEVM and call a contract that reverts; should refund on ZetaChain if no liquidity pool, should refund on origin if liquidity pool\n") + utils.LoudPrintf("Deposit a non-gas ZRC20 into ZEVM and call a contract that reverts; should refund on ZetaChain if no liquidity pool, should refund on origin if liquidity pool\n") // Get the initial balance of the deployer - initialBal, err := sm.USDTZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) + initialBal, err := sm.USDTZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) if err != nil { panic(err) } @@ -34,19 +32,19 @@ func (sm *SmokeTest) TestERC20DepositAndCallRefund() { amount := big.NewInt(1e4) // send the deposit - inTxHash, err := sm.sendInvalidUSDTDeposit(amount) + inTxHash, err := sendInvalidUSDTDeposit(sm, amount) if err != nil { panic(err) } // There is no liquidity pool, therefore the cctx should abort - cctx := WaitCctxMinedByInTxHash(inTxHash, sm.cctxClient) + cctx := utils.WaitCctxMinedByInTxHash(inTxHash, sm.CctxClient) if cctx.CctxStatus.Status != types.CctxStatus_Aborted { panic(fmt.Sprintf("expected cctx status to be Aborted; got %s", cctx.CctxStatus.Status)) } // Check that the erc20 in the aborted cctx was refunded on ZetaChain - newBalance, err := sm.USDTZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) + newBalance, err := sm.USDTZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) if err != nil { panic(err) } @@ -57,7 +55,7 @@ func (sm *SmokeTest) TestERC20DepositAndCallRefund() { fmt.Println("CCTX has been aborted and the erc20 has been refunded on ZetaChain") amount = big.NewInt(1e7) - goerliBalance, err := sm.USDTERC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) + goerliBalance, err := sm.USDTERC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) if err != nil { panic(err) } @@ -65,20 +63,20 @@ func (sm *SmokeTest) TestERC20DepositAndCallRefund() { fmt.Println("Sending a deposit that should revert with a liquidity pool") fmt.Println("Creating the liquidity pool USTD/ZETA") - err = sm.createZetaERC20LiquidityPool() + err = createZetaERC20LiquidityPool(sm) if err != nil { panic(err) } fmt.Println("Liquidity pool created") // send the deposit - inTxHash, err = sm.sendInvalidUSDTDeposit(amount) + inTxHash, err = sendInvalidUSDTDeposit(sm, amount) if err != nil { panic(err) } // there is a liquidity pool, therefore the cctx should revert - cctx = WaitCctxMinedByInTxHash(inTxHash, sm.cctxClient) + cctx = utils.WaitCctxMinedByInTxHash(inTxHash, sm.CctxClient) // the revert tx creation will fail because the sender, used as the recipient, is not defined in the cctx if cctx.CctxStatus.Status != types.CctxStatus_Reverted { @@ -87,11 +85,11 @@ func (sm *SmokeTest) TestERC20DepositAndCallRefund() { // get revert tx revertTxHash := cctx.GetCurrentOutTxParam().OutboundTxHash - _, _, err = sm.goerliClient.TransactionByHash(context.Background(), ethcommon.HexToHash(revertTxHash)) + _, _, err = sm.GoerliClient.TransactionByHash(context.Background(), ethcommon.HexToHash(revertTxHash)) if err != nil { panic(err) } - receipt, err := sm.goerliClient.TransactionReceipt(context.Background(), ethcommon.HexToHash(revertTxHash)) + receipt, err := sm.GoerliClient.TransactionReceipt(context.Background(), ethcommon.HexToHash(revertTxHash)) if err != nil { panic(err) } @@ -100,7 +98,7 @@ func (sm *SmokeTest) TestERC20DepositAndCallRefund() { } // check that the erc20 in the reverted cctx was refunded on Goerli - newGoerliBalance, err := sm.USDTERC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) + newGoerliBalance, err := sm.USDTERC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) if err != nil { panic(err) } @@ -120,63 +118,63 @@ func (sm *SmokeTest) TestERC20DepositAndCallRefund() { fmt.Println("\tbalance after refund: ", newGoerliBalance.String()) } -func (sm *SmokeTest) createZetaERC20LiquidityPool() error { +func createZetaERC20LiquidityPool(sm *runner.SmokeTestRunner) error { amount := big.NewInt(1e10) txHash := sm.DepositERC20(amount, []byte{}) - WaitCctxMinedByInTxHash(txHash.Hex(), sm.cctxClient) + utils.WaitCctxMinedByInTxHash(txHash.Hex(), sm.CctxClient) - tx, err := sm.USDTZRC20.Approve(sm.zevmAuth, sm.UniswapV2RouterAddr, big.NewInt(1e10)) + tx, err := sm.USDTZRC20.Approve(sm.ZevmAuth, sm.UniswapV2RouterAddr, big.NewInt(1e10)) if err != nil { return err } - receipt := MustWaitForTxReceipt(sm.zevmClient, tx) + receipt := utils.MustWaitForTxReceipt(sm.ZevmClient, tx) if receipt.Status == 0 { return errors.New("approve failed") } - previousValue := sm.zevmAuth.Value - sm.zevmAuth.Value = big.NewInt(1e10) + previousValue := sm.ZevmAuth.Value + sm.ZevmAuth.Value = big.NewInt(1e10) tx, err = sm.UniswapV2Router.AddLiquidityETH( - sm.zevmAuth, + sm.ZevmAuth, sm.USDTZRC20Addr, amount, - BigZero, - BigZero, - DeployerAddress, + big.NewInt(0), + big.NewInt(0), + sm.DeployerAddress, big.NewInt(time.Now().Add(10*time.Minute).Unix()), ) - sm.zevmAuth.Value = previousValue + sm.ZevmAuth.Value = previousValue if err != nil { return err } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) if receipt.Status == 0 { - return errors.New("add liquidity failed") + return fmt.Errorf("add liquidity failed") } return nil } -func (sm *SmokeTest) sendInvalidUSDTDeposit(amount *big.Int) (string, error) { +func sendInvalidUSDTDeposit(sm *runner.SmokeTestRunner, amount *big.Int) (string, error) { // send the tx USDT := sm.USDTERC20 - tx, err := USDT.Mint(sm.goerliAuth, amount) + tx, err := USDT.Mint(sm.GoerliAuth, amount) if err != nil { return "", err } - receipt := MustWaitForTxReceipt(sm.goerliClient, tx) + receipt := utils.MustWaitForTxReceipt(sm.GoerliClient, tx) fmt.Printf("Mint receipt tx hash: %s\n", tx.Hash().Hex()) - tx, err = USDT.Approve(sm.goerliAuth, sm.ERC20CustodyAddr, amount) + tx, err = USDT.Approve(sm.GoerliAuth, sm.ERC20CustodyAddr, amount) if err != nil { return "", err } - receipt = MustWaitForTxReceipt(sm.goerliClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.GoerliClient, tx) fmt.Printf("USDT Approve receipt tx hash: %s\n", tx.Hash().Hex()) tx, err = sm.ERC20Custody.Deposit( - sm.goerliAuth, - DeployerAddress.Bytes(), + sm.GoerliAuth, + sm.DeployerAddress.Bytes(), sm.USDTERC20Addr, amount, []byte("this is an invalid msg that will cause the contract to revert"), @@ -186,7 +184,7 @@ func (sm *SmokeTest) sendInvalidUSDTDeposit(amount *big.Int) (string, error) { } fmt.Printf("GOERLI tx sent: %s; to %s, nonce %d\n", tx.Hash().String(), tx.To().Hex(), tx.Nonce()) - receipt = MustWaitForTxReceipt(sm.goerliClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.GoerliClient, tx) if receipt.Status == 0 { return "", errors.New("expected the tx receipt to have status 1; got 0") } diff --git a/contrib/localnet/orchestrator/smoketest/test_mytest.go b/contrib/localnet/orchestrator/smoketest/smoketests/test_erc20_whitelist.go similarity index 70% rename from contrib/localnet/orchestrator/smoketest/test_mytest.go rename to contrib/localnet/orchestrator/smoketest/smoketests/test_erc20_whitelist.go index 70a6529224..7b70352678 100644 --- a/contrib/localnet/orchestrator/smoketest/test_mytest.go +++ b/contrib/localnet/orchestrator/smoketest/smoketests/test_erc20_whitelist.go @@ -1,7 +1,4 @@ -//go:build PRIVNET -// +build PRIVNET - -package main +package smoketests import ( "context" @@ -11,17 +8,19 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" ethcommon "github.com/ethereum/go-ethereum/common" "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/erc20custody.sol" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/runner" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/utils" observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) -func (sm *SmokeTest) TestMyTest() { - LoudPrintf("Test ERC20 whitelist\n") +func TestWhitelistERC20(sm *runner.SmokeTestRunner) { + utils.LoudPrintf("Test ERC20 whitelist\n") startTime := time.Now() defer func() { fmt.Printf("test finishes in %s\n", time.Since(startTime)) }() - res, err := sm.observerClient.GetCoreParamsForChain(context.Background(), &observertypes.QueryGetCoreParamsForChainRequest{ + res, err := sm.ObserverClient.GetCoreParamsForChain(context.Background(), &observertypes.QueryGetCoreParamsForChainRequest{ ChainId: int64(1337), }) if err != nil { @@ -31,7 +30,7 @@ func (sm *SmokeTest) TestMyTest() { if custodyAddr == (ethcommon.Address{}) { panic("custody address is empty") } - custody, err := erc20custody.NewERC20Custody(custodyAddr, sm.goerliClient) + custody, err := erc20custody.NewERC20Custody(custodyAddr, sm.GoerliClient) if err != nil { panic(err) } diff --git a/contrib/localnet/orchestrator/smoketest/test_erc20_withdraw.go b/contrib/localnet/orchestrator/smoketest/smoketests/test_erc20_withdraw.go similarity index 61% rename from contrib/localnet/orchestrator/smoketest/test_erc20_withdraw.go rename to contrib/localnet/orchestrator/smoketest/smoketests/test_erc20_withdraw.go index fde1079b18..608ac1f79f 100644 --- a/contrib/localnet/orchestrator/smoketest/test_erc20_withdraw.go +++ b/contrib/localnet/orchestrator/smoketest/smoketests/test_erc20_withdraw.go @@ -1,7 +1,4 @@ -//go:build PRIVNET -// +build PRIVNET - -package main +package smoketests import ( "context" @@ -12,18 +9,19 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" ethcommon "github.com/ethereum/go-ethereum/common" zrc20 "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" - "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/contracts/erc20" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/runner" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/utils" testcontract "github.com/zeta-chain/zetacore/testutil/contracts" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" ) -func (sm *SmokeTest) TestERC20Withdraw() { +func TestERC20Withdraw(sm *runner.SmokeTestRunner) { startTime := time.Now() defer func() { fmt.Printf("test finishes in %s\n", time.Since(startTime)) }() - bal, err := sm.USDTZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) + bal, err := sm.USDTZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) if err != nil { panic(err) } @@ -40,11 +38,11 @@ func (sm *SmokeTest) TestERC20Withdraw() { } fmt.Printf("gasZRC20: %s, gasFee: %d\n", gasZRC20.Hex(), gasFee) - ethZRC20, err := zrc20.NewZRC20(gasZRC20, sm.zevmClient) + ethZRC20, err := zrc20.NewZRC20(gasZRC20, sm.ZevmClient) if err != nil { panic(err) } - bal, err = ethZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) + bal, err = ethZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) if err != nil { panic(err) } @@ -53,31 +51,31 @@ func (sm *SmokeTest) TestERC20Withdraw() { panic("not enough ETH ZRC20 balance!") } - LoudPrintf("Withdraw USDT ZRC20\n") - sm.WithdrawERC20(ethZRC20) + utils.LoudPrintf("Withdraw USDT ZRC20\n") + WithdrawERC20(sm, ethZRC20) - LoudPrintf("Multiple withdraws USDT ZRC20\n") - sm.MultipleWithdraws(ethZRC20) + utils.LoudPrintf("Multiple withdraws USDT ZRC20\n") + MultipleWithdraws(sm, ethZRC20) } -func (sm *SmokeTest) WithdrawERC20(ethZRC20 *zrc20.ZRC20) { +func WithdrawERC20(sm *runner.SmokeTestRunner, ethZRC20 *zrc20.ZRC20) { // approve - tx, err := ethZRC20.Approve(sm.zevmAuth, ethcommon.HexToAddress(USDTZRC20Addr), big.NewInt(1e18)) + tx, err := ethZRC20.Approve(sm.ZevmAuth, sm.USDTZRC20Addr, big.NewInt(1e18)) if err != nil { panic(err) } - receipt := MustWaitForTxReceipt(sm.zevmClient, tx) + receipt := utils.MustWaitForTxReceipt(sm.ZevmClient, tx) if receipt.Status == 0 { panic("approve failed") } fmt.Printf("eth zrc20 approve receipt: status %d\n", receipt.Status) // withdraw - tx, err = sm.USDTZRC20.Withdraw(sm.zevmAuth, DeployerAddress.Bytes(), big.NewInt(100)) + tx, err = sm.USDTZRC20.Withdraw(sm.ZevmAuth, sm.DeployerAddress.Bytes(), big.NewInt(100)) if err != nil { panic(err) } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) fmt.Printf("Receipt txhash %s status %d\n", receipt.TxHash, receipt.Status) for _, log := range receipt.Logs { event, err := sm.USDTZRC20.ParseWithdrawal(*log) @@ -88,41 +86,41 @@ func (sm *SmokeTest) WithdrawERC20(ethZRC20 *zrc20.ZRC20) { } // verify the withdraw value - cctx := WaitCctxMinedByInTxHash(receipt.TxHash.Hex(), sm.cctxClient) - sm.verifyTransferAmountFromCCTX(cctx, 100) + cctx := utils.WaitCctxMinedByInTxHash(receipt.TxHash.Hex(), sm.CctxClient) + verifyTransferAmountFromCCTX(sm, cctx, 100) } -func (sm *SmokeTest) MultipleWithdraws(ethZRC20 *zrc20.ZRC20) { +func MultipleWithdraws(sm *runner.SmokeTestRunner, ethZRC20 *zrc20.ZRC20) { // deploy withdrawer - withdrawerAddr, _, withdrawer, err := testcontract.DeployWithdrawer(sm.zevmAuth, sm.zevmClient) + withdrawerAddr, _, withdrawer, err := testcontract.DeployWithdrawer(sm.ZevmAuth, sm.ZevmClient) if err != nil { panic(err) } // approve - tx, err := sm.USDTZRC20.Approve(sm.zevmAuth, withdrawerAddr, big.NewInt(1e18)) + tx, err := sm.USDTZRC20.Approve(sm.ZevmAuth, withdrawerAddr, big.NewInt(1e18)) if err != nil { panic(err) } - receipt := MustWaitForTxReceipt(sm.zevmClient, tx) + receipt := utils.MustWaitForTxReceipt(sm.ZevmClient, tx) if receipt.Status == 0 { panic("approve failed") } fmt.Printf("USDT ZRC20 approve receipt: status %d\n", receipt.Status) // approve gas token - tx, err = ethZRC20.Approve(sm.zevmAuth, withdrawerAddr, big.NewInt(1e18)) + tx, err = ethZRC20.Approve(sm.ZevmAuth, withdrawerAddr, big.NewInt(1e18)) if err != nil { panic(err) } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) if receipt.Status == 0 { panic("approve gas token failed") } fmt.Printf("eth zrc20 approve receipt: status %d\n", receipt.Status) // check the balance - bal, err := sm.USDTZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) + bal, err := sm.USDTZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) if err != nil { panic(err) } @@ -133,43 +131,47 @@ func (sm *SmokeTest) MultipleWithdraws(ethZRC20 *zrc20.ZRC20) { } // withdraw - tx, err = withdrawer.RunWithdraws(sm.zevmAuth, DeployerAddress.Bytes(), sm.USDTZRC20Addr, big.NewInt(100), big.NewInt(10)) + tx, err = withdrawer.RunWithdraws( + sm.ZevmAuth, + sm.DeployerAddress.Bytes(), + sm.USDTZRC20Addr, + big.NewInt(100), + big.NewInt(10), + ) if err != nil { panic(err) } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) if receipt.Status == 0 { panic("withdraw failed") } fmt.Printf("Withdraws receipt: status %d\n", receipt.Status) - cctxs := WaitCctxsMinedByInTxHash(tx.Hash().Hex(), sm.cctxClient) + cctxs := utils.WaitCctxsMinedByInTxHash(tx.Hash().Hex(), sm.CctxClient, 10) if len(cctxs) != 10 { panic(fmt.Sprintf("cctxs length is not correct: %d", len(cctxs))) } // verify the withdraw value for _, cctx := range cctxs { - sm.verifyTransferAmountFromCCTX(cctx, 100) + verifyTransferAmountFromCCTX(sm, cctx, 100) } } // verifyTransferAmountFromCCTX verifies the transfer amount from the CCTX on Goerli -func (sm *SmokeTest) verifyTransferAmountFromCCTX(cctx *crosschaintypes.CrossChainTx, amount int64) { +func verifyTransferAmountFromCCTX(sm *runner.SmokeTestRunner, cctx *crosschaintypes.CrossChainTx, amount int64) { fmt.Printf("outTx hash %s\n", cctx.GetCurrentOutTxParam().OutboundTxHash) - USDTERC20, err := erc20.NewUSDT(ethcommon.HexToAddress(USDTERC20Addr), sm.goerliClient) - if err != nil { - panic(err) - } - - receipt, err := sm.goerliClient.TransactionReceipt(context.Background(), ethcommon.HexToHash(cctx.GetCurrentOutTxParam().OutboundTxHash)) + receipt, err := sm.GoerliClient.TransactionReceipt( + context.Background(), + ethcommon.HexToHash(cctx.GetCurrentOutTxParam().OutboundTxHash), + ) if err != nil { panic(err) } fmt.Printf("Receipt txhash %s status %d\n", receipt.TxHash, receipt.Status) for _, log := range receipt.Logs { - event, err := USDTERC20.ParseTransfer(*log) + event, err := sm.USDTERC20.ParseTransfer(*log) if err != nil { continue } diff --git a/contrib/localnet/orchestrator/smoketest/test_message_passing.go b/contrib/localnet/orchestrator/smoketest/smoketests/test_message_passing.go similarity index 78% rename from contrib/localnet/orchestrator/smoketest/test_message_passing.go rename to contrib/localnet/orchestrator/smoketest/smoketests/test_message_passing.go index c4f0f93da7..ca7e8424e0 100644 --- a/contrib/localnet/orchestrator/smoketest/test_message_passing.go +++ b/contrib/localnet/orchestrator/smoketest/smoketests/test_message_passing.go @@ -1,7 +1,4 @@ -//go:build PRIVNET -// +build PRIVNET - -package main +package smoketests import ( "context" @@ -10,36 +7,37 @@ import ( "time" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - ethcommon "github.com/ethereum/go-ethereum/common" zetaconnectoreth "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/zetaconnector.eth.sol" "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/contracts/testdapp" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/runner" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/utils" cctxtypes "github.com/zeta-chain/zetacore/x/crosschain/types" ) -func (sm *SmokeTest) TestMessagePassing() { +func TestMessagePassing(sm *runner.SmokeTestRunner) { startTime := time.Now() defer func() { fmt.Printf("test finishes in %s\n", time.Since(startTime)) }() // ==================== Interacting with contracts ==================== time.Sleep(10 * time.Second) - LoudPrintf("Goerli->Goerli Message Passing (Sending ZETA only)\n") + utils.LoudPrintf("Goerli->Goerli Message Passing (Sending ZETA only)\n") fmt.Printf("Approving ConnectorEth to spend deployer's ZetaEth\n") amount := big.NewInt(1e18) amount = amount.Mul(amount, big.NewInt(10)) // 10 Zeta - auth := sm.goerliAuth + auth := sm.GoerliAuth tx, err := sm.ZetaEth.Approve(auth, sm.ConnectorEthAddr, amount) if err != nil { panic(err) } fmt.Printf("Approve tx hash: %s\n", tx.Hash().Hex()) - receipt := MustWaitForTxReceipt(sm.goerliClient, tx) + receipt := utils.MustWaitForTxReceipt(sm.GoerliClient, tx) fmt.Printf("Approve tx receipt: %d\n", receipt.Status) fmt.Printf("Calling ConnectorEth.Send\n") tx, err = sm.ConnectorEth.Send(auth, zetaconnectoreth.ZetaInterfacesSendInput{ DestinationChainId: big.NewInt(1337), // in dev mode, GOERLI has chainid 1337 - DestinationAddress: DeployerAddress.Bytes(), + DestinationAddress: sm.DeployerAddress.Bytes(), DestinationGasLimit: big.NewInt(250_000), Message: nil, ZetaValueAndGas: amount, @@ -49,7 +47,7 @@ func (sm *SmokeTest) TestMessagePassing() { panic(err) } fmt.Printf("ConnectorEth.Send tx hash: %s\n", tx.Hash().Hex()) - receipt = MustWaitForTxReceipt(sm.goerliClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.GoerliClient, tx) fmt.Printf("ConnectorEth.Send tx receipt: status %d\n", receipt.Status) fmt.Printf(" Logs:\n") for _, log := range receipt.Logs { @@ -61,13 +59,13 @@ func (sm *SmokeTest) TestMessagePassing() { fmt.Printf(" Zeta Value: %d\n", sentLog.ZetaValueAndGas) } } - sm.wg.Add(1) + sm.WG.Add(1) go func() { - defer sm.wg.Done() + defer sm.WG.Done() fmt.Printf("Waiting for ConnectorEth.Send CCTX to be mined...\n") fmt.Printf(" INTX hash: %s\n", receipt.TxHash.String()) - cctx := WaitCctxMinedByInTxHash(receipt.TxHash.String(), sm.cctxClient) - receipt, err := sm.goerliClient.TransactionReceipt(context.Background(), ethcommon.HexToHash(cctx.GetCurrentOutTxParam().OutboundTxHash)) + cctx := utils.WaitCctxMinedByInTxHash(receipt.TxHash.String(), sm.CctxClient) + receipt, err := sm.GoerliClient.TransactionReceipt(context.Background(), ethcommon.HexToHash(cctx.GetCurrentOutTxParam().OutboundTxHash)) if err != nil { panic(err) } @@ -84,31 +82,31 @@ func (sm *SmokeTest) TestMessagePassing() { } } }() - sm.wg.Wait() + sm.WG.Wait() } -func (sm *SmokeTest) TestMessagePassingRevertFail() { +func TestMessagePassingRevertFail(sm *runner.SmokeTestRunner) { startTime := time.Now() defer func() { fmt.Printf("test finishes in %s\n", time.Since(startTime)) }() // ==================== Interacting with contracts ==================== - LoudPrintf("Goerli->Goerli Message Passing (revert fail)\n") + utils.LoudPrintf("Goerli->Goerli Message Passing (revert fail)\n") fmt.Printf("Approving ConnectorEth to spend deployer's ZetaEth\n") amount := big.NewInt(1e18) amount = amount.Mul(amount, big.NewInt(10)) // 10 Zeta - auth := sm.goerliAuth + auth := sm.GoerliAuth tx, err := sm.ZetaEth.Approve(auth, sm.ConnectorEthAddr, amount) if err != nil { panic(err) } fmt.Printf("Approve tx hash: %s\n", tx.Hash().Hex()) - receipt := MustWaitForTxReceipt(sm.goerliClient, tx) + receipt := utils.MustWaitForTxReceipt(sm.GoerliClient, tx) fmt.Printf("Approve tx receipt: %d\n", receipt.Status) fmt.Printf("Calling ConnectorEth.Send\n") tx, err = sm.ConnectorEth.Send(auth, zetaconnectoreth.ZetaInterfacesSendInput{ DestinationChainId: big.NewInt(1337), // in dev mode, GOERLI has chainid 1337 - DestinationAddress: DeployerAddress.Bytes(), + DestinationAddress: sm.DeployerAddress.Bytes(), DestinationGasLimit: big.NewInt(250_000), Message: []byte("revert"), // non-empty message will cause revert, because the dest address is not a contract ZetaValueAndGas: amount, @@ -118,7 +116,7 @@ func (sm *SmokeTest) TestMessagePassingRevertFail() { panic(err) } fmt.Printf("ConnectorEth.Send tx hash: %s\n", tx.Hash().Hex()) - receipt = MustWaitForTxReceipt(sm.goerliClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.GoerliClient, tx) fmt.Printf("ConnectorEth.Send tx receipt: status %d\n", receipt.Status) fmt.Printf(" Logs:\n") for _, log := range receipt.Logs { @@ -130,12 +128,12 @@ func (sm *SmokeTest) TestMessagePassingRevertFail() { fmt.Printf(" Zeta Value: %d\n", sentLog.ZetaValueAndGas) } } - sm.wg.Add(1) + sm.WG.Add(1) go func() { - defer sm.wg.Done() + defer sm.WG.Done() fmt.Printf("Waiting for ConnectorEth.Send CCTX to be mined...\n") - cctx := WaitCctxMinedByInTxHash(receipt.TxHash.String(), sm.cctxClient) - receipt, err := sm.goerliClient.TransactionReceipt(context.Background(), ethcommon.HexToHash(cctx.GetCurrentOutTxParam().OutboundTxHash)) + cctx := utils.WaitCctxMinedByInTxHash(receipt.TxHash.String(), sm.CctxClient) + receipt, err := sm.GoerliClient.TransactionReceipt(context.Background(), ethcommon.HexToHash(cctx.GetCurrentOutTxParam().OutboundTxHash)) if err != nil { panic(err) } @@ -147,34 +145,34 @@ func (sm *SmokeTest) TestMessagePassingRevertFail() { panic("expected cctx to be aborted") } }() - sm.wg.Wait() + sm.WG.Wait() } -func (sm *SmokeTest) TestMessagePassingRevertSuccess() { +func TestMessagePassingRevertSuccess(sm *runner.SmokeTestRunner) { startTime := time.Now() defer func() { fmt.Printf("test finishes in %s\n", time.Since(startTime)) }() // ==================== Interacting with contracts ==================== - LoudPrintf("Goerli->Goerli Message Passing (revert success)\n") + utils.LoudPrintf("Goerli->Goerli Message Passing (revert success)\n") fmt.Printf("Approving TestDApp to spend deployer's ZetaEth\n") amount := big.NewInt(1e18) amount = amount.Mul(amount, big.NewInt(10)) // 10 Zeta - auth := sm.goerliAuth + auth := sm.GoerliAuth tx, err := sm.ZetaEth.Approve(auth, sm.TestDAppAddr, amount) if err != nil { panic(err) } fmt.Printf("Approve tx hash: %s\n", tx.Hash().Hex()) - receipt := MustWaitForTxReceipt(sm.goerliClient, tx) + receipt := utils.MustWaitForTxReceipt(sm.GoerliClient, tx) fmt.Printf("Approve tx receipt: %d\n", receipt.Status) fmt.Printf("Calling TestDApp.SendHello on contract address %s\n", sm.TestDAppAddr.Hex()) - testDApp, err := testdapp.NewTestDApp(sm.TestDAppAddr, sm.goerliClient) + testDApp, err := testdapp.NewTestDApp(sm.TestDAppAddr, sm.GoerliClient) if err != nil { panic(err) } - res2, err := sm.bankClient.SupplyOf(context.Background(), &banktypes.QuerySupplyOfRequest{ + res2, err := sm.BankClient.SupplyOf(context.Background(), &banktypes.QuerySupplyOfRequest{ Denom: "azeta", }) if err != nil { @@ -187,15 +185,15 @@ func (sm *SmokeTest) TestMessagePassingRevertSuccess() { panic(err) } fmt.Printf("TestDApp.SendHello tx hash: %s\n", tx.Hash().Hex()) - receipt = MustWaitForTxReceipt(sm.goerliClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.GoerliClient, tx) fmt.Printf("TestDApp.SendHello tx receipt: status %d\n", receipt.Status) - cctx := WaitCctxMinedByInTxHash(receipt.TxHash.String(), sm.cctxClient) + cctx := utils.WaitCctxMinedByInTxHash(receipt.TxHash.String(), sm.CctxClient) if cctx.CctxStatus.Status != cctxtypes.CctxStatus_Reverted { panic("expected cctx to be reverted") } outTxHash := cctx.GetCurrentOutTxParam().OutboundTxHash - receipt, err = sm.goerliClient.TransactionReceipt(context.Background(), ethcommon.HexToHash(outTxHash)) + receipt, err = sm.GoerliClient.TransactionReceipt(context.Background(), ethcommon.HexToHash(outTxHash)) if err != nil { panic(err) } @@ -209,7 +207,7 @@ func (sm *SmokeTest) TestMessagePassingRevertSuccess() { fmt.Printf(" Message: %x\n", event.Message) } } - res3, err := sm.bankClient.SupplyOf(context.Background(), &banktypes.QuerySupplyOfRequest{ + res3, err := sm.BankClient.SupplyOf(context.Background(), &banktypes.QuerySupplyOfRequest{ Denom: "azeta", }) if err != nil { diff --git a/contrib/localnet/orchestrator/smoketest/smoketests/test_mytest.go b/contrib/localnet/orchestrator/smoketest/smoketests/test_mytest.go new file mode 100644 index 0000000000..ed891b239f --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/smoketests/test_mytest.go @@ -0,0 +1,19 @@ +package smoketests + +import ( + "fmt" + "time" + + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/runner" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/utils" +) + +func TestMyTest(_ *runner.SmokeTestRunner) { + utils.LoudPrintf("Custom test\n") + startTime := time.Now() + defer func() { + fmt.Printf("test finishes in %s\n", time.Since(startTime)) + }() + + // add your test here +} diff --git a/contrib/localnet/orchestrator/smoketest/test_pause_zrc20.go b/contrib/localnet/orchestrator/smoketest/smoketests/test_pause_zrc20.go similarity index 53% rename from contrib/localnet/orchestrator/smoketest/test_pause_zrc20.go rename to contrib/localnet/orchestrator/smoketest/smoketests/test_pause_zrc20.go index f0d0f43c8b..db293aa9cf 100644 --- a/contrib/localnet/orchestrator/smoketest/test_pause_zrc20.go +++ b/contrib/localnet/orchestrator/smoketest/smoketests/test_pause_zrc20.go @@ -1,7 +1,4 @@ -//go:build PRIVNET -// +build PRIVNET - -package main +package smoketests import ( "context" @@ -10,12 +7,15 @@ import ( "time" "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/contracts/vault" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/runner" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/utils" "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/crosschain/types" fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" ) -func (sm *SmokeTest) TestPauseZRC20() { - LoudPrintf("Test ZRC20 pause\n") +func TestPauseZRC20(sm *runner.SmokeTestRunner) { + utils.LoudPrintf("Test ZRC20 pause\n") startTime := time.Now() defer func() { fmt.Printf("test finishes in %s\n", time.Since(startTime)) @@ -23,24 +23,24 @@ func (sm *SmokeTest) TestPauseZRC20() { // Setup vault used to test zrc20 interactions fmt.Println("Deploying vault") - vaultAddr, _, vaultContract, err := vault.DeployVault(sm.zevmAuth, sm.zevmClient) + vaultAddr, _, vaultContract, err := vault.DeployVault(sm.ZevmAuth, sm.ZevmClient) if err != nil { panic(err) } // Approving vault to spend ZRC20 - tx, err := sm.ETHZRC20.Approve(sm.zevmAuth, vaultAddr, big.NewInt(1e18)) + tx, err := sm.ETHZRC20.Approve(sm.ZevmAuth, vaultAddr, big.NewInt(1e18)) if err != nil { panic(err) } - receipt := MustWaitForTxReceipt(sm.zevmClient, tx) + receipt := utils.MustWaitForTxReceipt(sm.ZevmClient, tx) if receipt.Status == 0 { panic("Vault approval should succeed") } - tx, err = sm.BTCZRC20.Approve(sm.zevmAuth, vaultAddr, big.NewInt(1e18)) + tx, err = sm.BTCZRC20.Approve(sm.ZevmAuth, vaultAddr, big.NewInt(1e18)) if err != nil { panic(err) } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) if receipt.Status == 0 { panic("Vault approval should succeed") } @@ -48,18 +48,18 @@ func (sm *SmokeTest) TestPauseZRC20() { // Pause ETH ZRC20 fmt.Println("Pausing ETH") msg := fungibletypes.NewMsgUpdateZRC20PausedStatus( - FungibleAdminAddress, + sm.ZetaTxServer.GetAccountAddress(0), []string{sm.ETHZRC20Addr.Hex()}, fungibletypes.UpdatePausedStatusAction_PAUSE, ) - res, err := sm.zetaTxServer.BroadcastTx(FungibleAdminName, msg) + res, err := sm.ZetaTxServer.BroadcastTx(utils.FungibleAdminName, msg) if err != nil { panic(err) } fmt.Printf("pause zrc20 tx hash: %s\n", res.TxHash) // Fetch and check pause status - fcRes, err := sm.fungibleClient.ForeignCoins(context.Background(), &fungibletypes.QueryGetForeignCoinsRequest{ + fcRes, err := sm.FungibleClient.ForeignCoins(context.Background(), &fungibletypes.QueryGetForeignCoinsRequest{ Index: sm.ETHZRC20Addr.Hex(), }) if err != nil { @@ -67,36 +67,35 @@ func (sm *SmokeTest) TestPauseZRC20() { } if !fcRes.GetForeignCoins().Paused { panic("ETH should be paused") - } else { - fmt.Printf("ETH is paused\n") } + fmt.Printf("ETH is paused\n") // Try operations with ETH ZRC20 fmt.Println("Can no longer do operations on ETH ZRC20") - tx, err = sm.ETHZRC20.Transfer(sm.zevmAuth, sample.EthAddress(), big.NewInt(1e5)) + tx, err = sm.ETHZRC20.Transfer(sm.ZevmAuth, sample.EthAddress(), big.NewInt(1e5)) if err != nil { panic(err) } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) if receipt.Status == 1 { panic("transfer should fail") } - tx, err = sm.ETHZRC20.Burn(sm.zevmAuth, big.NewInt(1e5)) + tx, err = sm.ETHZRC20.Burn(sm.ZevmAuth, big.NewInt(1e5)) if err != nil { panic(err) } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) if receipt.Status == 1 { panic("burn should fail") } // Operation on a contract that interact with ETH ZRC20 should fail - fmt.Println("Vault contract can no longer interact with ETH ZRC20") - tx, err = vaultContract.Deposit(sm.zevmAuth, sm.ETHZRC20Addr, big.NewInt(1e5)) + fmt.Printf("Vault contract can no longer interact with ETH ZRC20: %s\n", sm.ETHZRC20Addr.Hex()) + tx, err = vaultContract.Deposit(sm.ZevmAuth, sm.ETHZRC20Addr, big.NewInt(1e5)) if err != nil { panic(err) } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) if receipt.Status == 1 { panic("deposit should fail") } @@ -104,38 +103,53 @@ func (sm *SmokeTest) TestPauseZRC20() { // Check we can still interact with BTC ZRC20 fmt.Println("Check other ZRC20 can still be operated") - tx, err = sm.BTCZRC20.Transfer(sm.zevmAuth, sample.EthAddress(), big.NewInt(1e3)) + tx, err = sm.BTCZRC20.Transfer(sm.ZevmAuth, sample.EthAddress(), big.NewInt(1e3)) if err != nil { panic(err) } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) if receipt.Status == 0 { panic("BTC transfer should succeed") } - tx, err = vaultContract.Deposit(sm.zevmAuth, sm.BTCZRC20Addr, big.NewInt(1e3)) + tx, err = vaultContract.Deposit(sm.ZevmAuth, sm.BTCZRC20Addr, big.NewInt(1e3)) if err != nil { panic(err) } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) if receipt.Status == 0 { panic("BTC vault deposit should succeed") } + // Check deposit revert when paused + signedTx, err := sm.SendEther(sm.TSSAddress, big.NewInt(1e17), nil) + if err != nil { + panic(err) + } + receipt = utils.MustWaitForTxReceipt(sm.GoerliClient, signedTx) + if receipt.Status == 0 { + panic("deposit eth tx failed") + } + cctx := utils.WaitCctxMinedByInTxHash(signedTx.Hash().Hex(), sm.CctxClient) + if cctx.CctxStatus.Status != types.CctxStatus_Reverted { + panic(fmt.Sprintf("expected cctx status to be Reverted; got %s", cctx.CctxStatus.Status)) + } + fmt.Println("CCTX has been reverted") + // Unpause ETH ZRC20 fmt.Println("Unpausing ETH") msg = fungibletypes.NewMsgUpdateZRC20PausedStatus( - FungibleAdminAddress, + sm.ZetaTxServer.GetAccountAddress(0), []string{sm.ETHZRC20Addr.Hex()}, fungibletypes.UpdatePausedStatusAction_UNPAUSE, ) - res, err = sm.zetaTxServer.BroadcastTx(FungibleAdminName, msg) + res, err = sm.ZetaTxServer.BroadcastTx(utils.FungibleAdminName, msg) if err != nil { panic(err) } fmt.Printf("unpause zrc20 tx hash: %s\n", res.TxHash) // Fetch and check pause status - fcRes, err = sm.fungibleClient.ForeignCoins(context.Background(), &fungibletypes.QueryGetForeignCoinsRequest{ + fcRes, err = sm.FungibleClient.ForeignCoins(context.Background(), &fungibletypes.QueryGetForeignCoinsRequest{ Index: sm.ETHZRC20Addr.Hex(), }) if err != nil { @@ -143,35 +157,34 @@ func (sm *SmokeTest) TestPauseZRC20() { } if fcRes.GetForeignCoins().Paused { panic("ETH should be unpaused") - } else { - fmt.Printf("ETH is unpaused\n") } + fmt.Printf("ETH is unpaused\n") // Try operations with ETH ZRC20 fmt.Println("Can do operations on ETH ZRC20 again") - tx, err = sm.ETHZRC20.Transfer(sm.zevmAuth, sample.EthAddress(), big.NewInt(1e5)) + tx, err = sm.ETHZRC20.Transfer(sm.ZevmAuth, sample.EthAddress(), big.NewInt(1e5)) if err != nil { panic(err) } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) if receipt.Status == 0 { panic("transfer should succeed") } - tx, err = sm.ETHZRC20.Burn(sm.zevmAuth, big.NewInt(1e5)) + tx, err = sm.ETHZRC20.Burn(sm.ZevmAuth, big.NewInt(1e5)) if err != nil { panic(err) } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) if receipt.Status == 0 { panic("burn should succeed") } // Can deposit tokens into the vault again - tx, err = vaultContract.Deposit(sm.zevmAuth, sm.ETHZRC20Addr, big.NewInt(1e5)) + tx, err = vaultContract.Deposit(sm.ZevmAuth, sm.ETHZRC20Addr, big.NewInt(1e5)) if err != nil { panic(err) } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) if receipt.Status == 0 { panic("deposit should succeed") } diff --git a/contrib/localnet/orchestrator/smoketest/test_update_bytecode.go b/contrib/localnet/orchestrator/smoketest/smoketests/test_update_bytecode.go similarity index 67% rename from contrib/localnet/orchestrator/smoketest/test_update_bytecode.go rename to contrib/localnet/orchestrator/smoketest/smoketests/test_update_bytecode.go index f8350b9a12..2efa1374d7 100644 --- a/contrib/localnet/orchestrator/smoketest/test_update_bytecode.go +++ b/contrib/localnet/orchestrator/smoketest/smoketests/test_update_bytecode.go @@ -1,9 +1,7 @@ -//go:build PRIVNET -// +build PRIVNET - -package main +package smoketests import ( + "context" "fmt" "math/big" "time" @@ -11,35 +9,58 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/contracts/testzrc20" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/runner" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/utils" "github.com/zeta-chain/zetacore/testutil/sample" fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" ) // TestUpdateBytecode tests updating the bytecode of a zrc20 and interact with it -func (sm *SmokeTest) TestUpdateBytecode() { +func TestUpdateBytecode(sm *runner.SmokeTestRunner) { startTime := time.Now() defer func() { fmt.Printf("test finishes in %s\n", time.Since(startTime)) }() - LoudPrintf("Testing updating ZRC20 bytecode swap...\n") + utils.LoudPrintf("Testing updating ZRC20 bytecode swap...\n") // Random approval approved := sample.EthAddress() - tx, err := sm.ETHZRC20.Approve(sm.zevmAuth, approved, big.NewInt(1e10)) + tx, err := sm.ETHZRC20.Approve(sm.ZevmAuth, approved, big.NewInt(1e10)) if err != nil { panic(err) } - receipt := MustWaitForTxReceipt(sm.zevmClient, tx) + receipt := utils.MustWaitForTxReceipt(sm.ZevmClient, tx) if receipt.Status != 1 { panic("approval failed") } // Deploy the TestZRC20 contract fmt.Println("Deploying contract with new bytecode") - newZRC20Address, _, newZRC20Contract, err := testzrc20.DeployTestZRC20(sm.zevmAuth, sm.zevmClient, big.NewInt(5), uint8(common.CoinType_Gas)) + newZRC20Address, tx, newZRC20Contract, err := testzrc20.DeployTestZRC20( + sm.ZevmAuth, + sm.ZevmClient, + big.NewInt(5), + // #nosec G701 smoketest - always in range + uint8(common.CoinType_Gas), + ) + if err != nil { + panic(err) + } + + // Wait for the contract to be deployed + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) + if receipt.Status != 1 { + panic("contract deployment failed") + } + + // Get the code hash of the new contract + codeHashRes, err := sm.FungibleClient.CodeHash(context.Background(), &fungibletypes.QueryCodeHashRequest{ + Address: newZRC20Address.String(), + }) if err != nil { panic(err) } + fmt.Printf("New contract code hash: %s\n", codeHashRes.CodeHash) // Get current info of the ZRC20 name, err := sm.ETHZRC20.Name(&bind.CallOpts{}) @@ -58,22 +79,22 @@ func (sm *SmokeTest) TestUpdateBytecode() { if err != nil { panic(err) } - balance, err := sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) + balance, err := sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) if err != nil { panic(err) } - approval, err := sm.ETHZRC20.Allowance(&bind.CallOpts{}, DeployerAddress, approved) + approval, err := sm.ETHZRC20.Allowance(&bind.CallOpts{}, sm.DeployerAddress, approved) if err != nil { panic(err) } fmt.Println("Updating the bytecode of the ZRC20") msg := fungibletypes.NewMsgUpdateContractBytecode( - FungibleAdminAddress, - sm.ETHZRC20Addr, - newZRC20Address, + sm.ZetaTxServer.GetAccountAddress(0), + sm.ETHZRC20Addr.Hex(), + codeHashRes.CodeHash, ) - res, err := sm.zetaTxServer.BroadcastTx(FungibleAdminName, msg) + res, err := sm.ZetaTxServer.BroadcastTx(utils.FungibleAdminName, msg) if err != nil { panic(err) } @@ -109,14 +130,14 @@ func (sm *SmokeTest) TestUpdateBytecode() { if totalSupply.Cmp(newTotalSupply) != 0 { panic("total supply shouldn't change upon bytecode update") } - newBalance, err := sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) + newBalance, err := sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) if err != nil { panic(err) } if balance.Cmp(newBalance) != 0 { panic("balance shouldn't change upon bytecode update") } - newApproval, err := sm.ETHZRC20.Allowance(&bind.CallOpts{}, DeployerAddress, approved) + newApproval, err := sm.ETHZRC20.Allowance(&bind.CallOpts{}, sm.DeployerAddress, approved) if err != nil { panic(err) } @@ -125,15 +146,15 @@ func (sm *SmokeTest) TestUpdateBytecode() { } fmt.Println("Can interact with the new code of the contract") - testZRC20Contract, err := testzrc20.NewTestZRC20(sm.ETHZRC20Addr, sm.zevmClient) + testZRC20Contract, err := testzrc20.NewTestZRC20(sm.ETHZRC20Addr, sm.ZevmClient) if err != nil { panic(err) } - tx, err = testZRC20Contract.UpdateNewField(sm.zevmAuth, big.NewInt(1e10)) + tx, err = testZRC20Contract.UpdateNewField(sm.ZevmAuth, big.NewInt(1e10)) if err != nil { panic(err) } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) if receipt.Status != 1 { panic("update new field failed") } @@ -146,11 +167,11 @@ func (sm *SmokeTest) TestUpdateBytecode() { } fmt.Println("Interacting with the bytecode contract doesn't disrupt the zrc20 contract") - tx, err = newZRC20Contract.UpdateNewField(sm.zevmAuth, big.NewInt(1e5)) + tx, err = newZRC20Contract.UpdateNewField(sm.ZevmAuth, big.NewInt(1e5)) if err != nil { panic(err) } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) if receipt.Status != 1 { panic("update new field failed") } @@ -171,11 +192,11 @@ func (sm *SmokeTest) TestUpdateBytecode() { // can continue to operate the ZRC20 fmt.Println("Checking the ZRC20 can continue to operate after state change") - tx, err = sm.ETHZRC20.Transfer(sm.zevmAuth, approved, big.NewInt(1e14)) + tx, err = sm.ETHZRC20.Transfer(sm.ZevmAuth, approved, big.NewInt(1e14)) if err != nil { panic(err) } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) if receipt.Status != 1 { panic("transfer failed") } diff --git a/contrib/localnet/orchestrator/smoketest/test_zeta_in_and_out.go b/contrib/localnet/orchestrator/smoketest/smoketests/test_zeta_in_and_out.go similarity index 52% rename from contrib/localnet/orchestrator/smoketest/test_zeta_in_and_out.go rename to contrib/localnet/orchestrator/smoketest/smoketests/test_zeta_in_and_out.go index ced758bad6..7de42e576d 100644 --- a/contrib/localnet/orchestrator/smoketest/test_zeta_in_and_out.go +++ b/contrib/localnet/orchestrator/smoketest/smoketests/test_zeta_in_and_out.go @@ -1,7 +1,4 @@ -//go:build PRIVNET -// +build PRIVNET - -package main +package smoketests import ( "context" @@ -9,91 +6,23 @@ import ( "math/big" "time" - "github.com/zeta-chain/zetacore/common" - ethcommon "github.com/ethereum/go-ethereum/common" - zetaconnectoreth "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/zetaconnector.eth.sol" connectorzevm "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/connectorzevm.sol" wzeta "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/wzeta.sol" + "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/runner" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/utils" ) -func (sm *SmokeTest) TestSendZetaIn() { - startTime := time.Now() - defer func() { - fmt.Printf("test finishes in %s\n", time.Since(startTime)) - }() - // ==================== Sending ZETA to ZetaChain =================== - amount := big.NewInt(1e18) - amount = amount.Mul(amount, big.NewInt(100)) // 100 Zeta - LoudPrintf("Step 3: Sending ZETA to ZetaChain\n") - tx, err := sm.ZetaEth.Approve(sm.goerliAuth, sm.ConnectorEthAddr, amount) - if err != nil { - panic(err) - } - fmt.Printf("Approve tx hash: %s\n", tx.Hash().Hex()) - receipt := MustWaitForTxReceipt(sm.goerliClient, tx) - fmt.Printf("Approve tx receipt: status %d\n", receipt.Status) - tx, err = sm.ConnectorEth.Send(sm.goerliAuth, zetaconnectoreth.ZetaInterfacesSendInput{ - DestinationChainId: big.NewInt(101), // in dev mode, 101 is the zEVM ChainID - DestinationAddress: DeployerAddress.Bytes(), - DestinationGasLimit: big.NewInt(250_000), - Message: nil, - ZetaValueAndGas: amount, - ZetaParams: nil, - }) - if err != nil { - panic(err) - } - - fmt.Printf("Send tx hash: %s\n", tx.Hash().Hex()) - receipt = MustWaitForTxReceipt(sm.goerliClient, tx) - fmt.Printf("Send tx receipt: status %d\n", receipt.Status) - fmt.Printf(" Logs:\n") - for _, log := range receipt.Logs { - sentLog, err := sm.ConnectorEth.ParseZetaSent(*log) - if err == nil { - fmt.Printf(" Dest Addr: %s\n", ethcommon.BytesToAddress(sentLog.DestinationAddress).Hex()) - fmt.Printf(" Dest Chain: %d\n", sentLog.DestinationChainId) - fmt.Printf(" Dest Gas: %d\n", sentLog.DestinationGasLimit) - fmt.Printf(" Zeta Value: %d\n", sentLog.ZetaValueAndGas) - fmt.Printf(" Block Num: %d\n", log.BlockNumber) - } - } - - sm.wg.Add(1) - go func() { - bn, _ := sm.zevmClient.BlockNumber(context.Background()) - initialBal, _ := sm.zevmClient.BalanceAt(context.Background(), DeployerAddress, big.NewInt(int64(bn))) - fmt.Printf("Zeta block %d, Initial Deployer Zeta balance: %d\n", bn, initialBal) - - defer sm.wg.Done() - for { - time.Sleep(5 * time.Second) - bn, _ = sm.zevmClient.BlockNumber(context.Background()) - bal, _ := sm.zevmClient.BalanceAt(context.Background(), DeployerAddress, big.NewInt(int64(bn))) - fmt.Printf("Zeta block %d, Deployer Zeta balance: %d\n", bn, bal) - - diff := big.NewInt(0) - diff.Sub(bal, initialBal) - - if diff.Cmp(amount) == 0 { - fmt.Printf("Expected zeta balance; success!\n") - break - } - } - }() - sm.wg.Wait() -} - -func (sm *SmokeTest) TestSendZetaOut() { +func TestSendZetaOut(sm *runner.SmokeTestRunner) { startTime := time.Now() defer func() { fmt.Printf("test finishes in %s\n", time.Since(startTime)) }() - zevmClient := sm.zevmClient - cctxClient := sm.cctxClient + zevmClient := sm.ZevmClient + cctxClient := sm.CctxClient - LoudPrintf("Step 4: Sending ZETA from ZEVM to Ethereum\n") + utils.LoudPrintf("Step 4: Sending ZETA from ZEVM to Ethereum\n") ConnectorZEVMAddr := ethcommon.HexToAddress("0x239e96c8f17C85c30100AC26F635Ea15f23E9c67") ConnectorZEVM, err := connectorzevm.NewZetaConnectorZEVM(ConnectorZEVMAddr, zevmClient) if err != nil { @@ -101,7 +30,7 @@ func (sm *SmokeTest) TestSendZetaOut() { } wzetaAddr := ethcommon.HexToAddress("0x5F0b1a82749cb4E2278EC87F8BF6B618dC71a8bf") - wzeta, err := wzeta.NewWETH9(wzetaAddr, zevmClient) + wZeta, err := wzeta.NewWETH9(wzetaAddr, zevmClient) if err != nil { panic(err) } @@ -115,28 +44,28 @@ func (sm *SmokeTest) TestSendZetaOut() { amount := big.NewInt(1e18) amount = amount.Mul(amount, big.NewInt(10)) - zauth := sm.zevmAuth + zauth := sm.ZevmAuth zauth.Value = amount - tx, err := wzeta.Deposit(zauth) + tx, err := wZeta.Deposit(zauth) if err != nil { panic(err) } - zauth.Value = BigZero + zauth.Value = big.NewInt(0) fmt.Printf("Deposit tx hash: %s\n", tx.Hash().Hex()) - receipt := MustWaitForTxReceipt(zevmClient, tx) + receipt := utils.MustWaitForTxReceipt(zevmClient, tx) fmt.Printf("Deposit tx receipt: status %d\n", receipt.Status) - tx, err = wzeta.Approve(zauth, ConnectorZEVMAddr, amount) + tx, err = wZeta.Approve(zauth, ConnectorZEVMAddr, amount) if err != nil { panic(err) } fmt.Printf("wzeta.approve tx hash: %s\n", tx.Hash().Hex()) - receipt = MustWaitForTxReceipt(zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(zevmClient, tx) fmt.Printf("approve tx receipt: status %d\n", receipt.Status) tx, err = ConnectorZEVM.Send(zauth, connectorzevm.ZetaInterfacesSendInput{ DestinationChainId: big.NewInt(1337), - DestinationAddress: DeployerAddress.Bytes(), + DestinationAddress: sm.DeployerAddress.Bytes(), DestinationGasLimit: big.NewInt(250_000), Message: nil, ZetaValueAndGas: amount, @@ -146,7 +75,7 @@ func (sm *SmokeTest) TestSendZetaOut() { panic(err) } fmt.Printf("send tx hash: %s\n", tx.Hash().Hex()) - receipt = MustWaitForTxReceipt(zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(zevmClient, tx) fmt.Printf("send tx receipt: status %d\n", receipt.Status) fmt.Printf(" Logs:\n") for _, log := range receipt.Logs { @@ -160,11 +89,11 @@ func (sm *SmokeTest) TestSendZetaOut() { } fmt.Printf("waiting for cctx status to change to final...\n") - sm.wg.Add(1) + sm.WG.Add(1) go func() { - defer sm.wg.Done() - cctx := WaitCctxMinedByInTxHash(tx.Hash().Hex(), cctxClient) - receipt, err := sm.goerliClient.TransactionReceipt(context.Background(), ethcommon.HexToHash(cctx.GetCurrentOutTxParam().OutboundTxHash)) + defer sm.WG.Done() + cctx := utils.WaitCctxMinedByInTxHash(tx.Hash().Hex(), cctxClient) + receipt, err := sm.GoerliClient.TransactionReceipt(context.Background(), ethcommon.HexToHash(cctx.GetCurrentOutTxParam().OutboundTxHash)) if err != nil { panic(err) } @@ -180,17 +109,17 @@ func (sm *SmokeTest) TestSendZetaOut() { } } }() - sm.wg.Wait() + sm.WG.Wait() } -func (sm *SmokeTest) TestSendZetaOutBTCRevert() { +func TestSendZetaOutBTCRevert(sm *runner.SmokeTestRunner) { startTime := time.Now() defer func() { fmt.Printf("test finishes in %s\n", time.Since(startTime)) }() - zevmClient := sm.zevmClient + zevmClient := sm.ZevmClient - LoudPrintf("Step 5: Should revert when sending ZETA from ZEVM to Bitcoin\n") + utils.LoudPrintf("Step 5: Should revert when sending ZETA from ZEVM to Bitcoin\n") ConnectorZEVMAddr := ethcommon.HexToAddress("0x239e96c8f17C85c30100AC26F635Ea15f23E9c67") ConnectorZEVM, err := connectorzevm.NewZetaConnectorZEVM(ConnectorZEVMAddr, zevmClient) if err != nil { @@ -198,7 +127,7 @@ func (sm *SmokeTest) TestSendZetaOutBTCRevert() { } wzetaAddr := ethcommon.HexToAddress("0x5F0b1a82749cb4E2278EC87F8BF6B618dC71a8bf") - wzeta, err := wzeta.NewWETH9(wzetaAddr, zevmClient) + wZeta, err := wzeta.NewWETH9(wzetaAddr, zevmClient) if err != nil { panic(err) } @@ -208,28 +137,28 @@ func (sm *SmokeTest) TestSendZetaOutBTCRevert() { } fmt.Printf("zevm chainid: %d\n", zchainid) - zauth := sm.zevmAuth + zauth := sm.ZevmAuth zauth.Value = big.NewInt(1e18) - tx, err := wzeta.Deposit(zauth) + tx, err := wZeta.Deposit(zauth) if err != nil { panic(err) } - zauth.Value = BigZero + zauth.Value = big.NewInt(0) fmt.Printf("Deposit tx hash: %s\n", tx.Hash().Hex()) - receipt := MustWaitForTxReceipt(zevmClient, tx) + receipt := utils.MustWaitForTxReceipt(zevmClient, tx) fmt.Printf("Deposit tx receipt: status %d\n", receipt.Status) - tx, err = wzeta.Approve(zauth, ConnectorZEVMAddr, big.NewInt(1e18)) + tx, err = wZeta.Approve(zauth, ConnectorZEVMAddr, big.NewInt(1e18)) if err != nil { panic(err) } fmt.Printf("wzeta.approve tx hash: %s\n", tx.Hash().Hex()) - receipt = MustWaitForTxReceipt(zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(zevmClient, tx) fmt.Printf("approve tx receipt: status %d\n", receipt.Status) tx, err = ConnectorZEVM.Send(zauth, connectorzevm.ZetaInterfacesSendInput{ DestinationChainId: big.NewInt(common.BtcRegtestChain().ChainId), - DestinationAddress: DeployerAddress.Bytes(), + DestinationAddress: sm.DeployerAddress.Bytes(), DestinationGasLimit: big.NewInt(250_000), Message: nil, ZetaValueAndGas: big.NewInt(1e17), @@ -239,7 +168,7 @@ func (sm *SmokeTest) TestSendZetaOutBTCRevert() { panic(err) } fmt.Printf("send tx hash: %s\n", tx.Hash().Hex()) - receipt = MustWaitForTxReceipt(zevmClient, tx) + receipt = utils.MustWaitForTxReceipt(zevmClient, tx) fmt.Printf("send tx receipt: status %d\n", receipt.Status) if receipt.Status != 0 { panic("Was able to send ZETA to BTC") diff --git a/contrib/localnet/orchestrator/smoketest/smoketests/test_zrc20_swap.go b/contrib/localnet/orchestrator/smoketest/smoketests/test_zrc20_swap.go new file mode 100644 index 0000000000..686c5b174d --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/smoketests/test_zrc20_swap.go @@ -0,0 +1,103 @@ +package smoketests + +import ( + "fmt" + "math/big" + "time" + + "github.com/ethereum/go-ethereum/accounts/abi/bind" + ethcommon "github.com/ethereum/go-ethereum/common" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/runner" + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/utils" +) + +func TestZRC20Swap(sm *runner.SmokeTestRunner) { + startTime := time.Now() + defer func() { + fmt.Printf("test finishes in %s\n", time.Since(startTime)) + }() + utils.LoudPrintf("Swap ZRC20 USDT for ZRC20 ETH\n") + + // TODO: move into setup and skip it if already initialized + // https://github.com/zeta-chain/node-private/issues/88 + // it is kept as is for now to be consistent with the old implementation + // if the tx fails due to already initialized, it will be ignored + tx, err := sm.UniswapV2Factory.CreatePair(sm.ZevmAuth, sm.USDTZRC20Addr, sm.ETHZRC20Addr) + if err != nil { + panic(err) + } + receipt := utils.MustWaitForTxReceipt(sm.ZevmClient, tx) + //fmt.Printf("USDT-ETH pair receipt txhash %s status %d\n", receipt.TxHash, receipt.Status) + + usdtEthPair, err := sm.UniswapV2Factory.GetPair(&bind.CallOpts{}, sm.USDTZRC20Addr, sm.ETHZRC20Addr) + if err != nil { + panic(err) + } + fmt.Printf("USDT-ETH pair receipt pair addr %s\n", usdtEthPair.Hex()) + + tx, err = sm.USDTZRC20.Approve(sm.ZevmAuth, sm.UniswapV2RouterAddr, big.NewInt(1e18)) + if err != nil { + panic(err) + } + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) + fmt.Printf("USDT ZRC20 approval receipt txhash %s status %d\n", receipt.TxHash, receipt.Status) + + tx, err = sm.ETHZRC20.Approve(sm.ZevmAuth, sm.UniswapV2RouterAddr, big.NewInt(1e18)) + if err != nil { + panic(err) + } + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) + fmt.Printf("ETH ZRC20 approval receipt txhash %s status %d\n", receipt.TxHash, receipt.Status) + + // temporarily increase gas limit to 400000 + previousGasLimit := sm.ZevmAuth.GasLimit + defer func() { + sm.ZevmAuth.GasLimit = previousGasLimit + }() + + sm.ZevmAuth.GasLimit = 400000 + tx, err = sm.UniswapV2Router.AddLiquidity( + sm.ZevmAuth, + sm.USDTZRC20Addr, + sm.ETHZRC20Addr, + big.NewInt(90000), + big.NewInt(1000), + big.NewInt(90000), + big.NewInt(1000), + sm.DeployerAddress, + big.NewInt(time.Now().Add(10*time.Minute).Unix()), + ) + if err != nil { + panic(err) + } + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) + fmt.Printf("Add liquidity receipt txhash %s status %d\n", receipt.TxHash, receipt.Status) + + balETHBefore, err := sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) + if err != nil { + panic(err) + } + ethOutAmout := big.NewInt(1) + tx, err = sm.UniswapV2Router.SwapExactTokensForTokens( + sm.ZevmAuth, + big.NewInt(1000), + ethOutAmout, + []ethcommon.Address{sm.USDTZRC20Addr, sm.ETHZRC20Addr}, + sm.DeployerAddress, + big.NewInt(time.Now().Add(10*time.Minute).Unix()), + ) + if err != nil { + panic(err) + } + receipt = utils.MustWaitForTxReceipt(sm.ZevmClient, tx) + fmt.Printf("Swap USDT for ETH ZRC20 %s status %d\n", receipt.TxHash, receipt.Status) + + balETHAfter, err := sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, sm.DeployerAddress) + if err != nil { + panic(err) + } + ethDiff := big.NewInt(0).Sub(balETHAfter, balETHBefore) + if ethDiff.Cmp(ethOutAmout) < 0 { + panic("swap failed") + } +} diff --git a/contrib/localnet/orchestrator/smoketest/test_accounting.go b/contrib/localnet/orchestrator/smoketest/test_accounting.go deleted file mode 100644 index dbca006899..0000000000 --- a/contrib/localnet/orchestrator/smoketest/test_accounting.go +++ /dev/null @@ -1,95 +0,0 @@ -//go:build PRIVNET -// +build PRIVNET - -package main - -import ( - "context" - "encoding/json" - "fmt" - "io/ioutil" - "math/big" - "net/http" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" -) - -func (sm *SmokeTest) CheckZRC20ReserveAndSupply() { - { - tssBal, _ := sm.goerliClient.BalanceAt(context.Background(), TSSAddress, nil) - zrc20Supply, _ := sm.ETHZRC20.TotalSupply(&bind.CallOpts{}) - if tssBal.Cmp(zrc20Supply) < 0 { - panic(fmt.Sprintf("ETH: TSS balance (%d) < ZRC20 TotalSupply (%d) ", tssBal, zrc20Supply)) - } else { - fmt.Printf("ETH: TSS balance (%d) >= ZRC20 TotalSupply (%d)\n", tssBal, zrc20Supply) - } - } - - { - utxos, err := sm.btcRPCClient.ListUnspent() - if err != nil { - panic(err) - } - var btcBalance float64 - for _, utxo := range utxos { - if utxo.Address == BTCTSSAddress.EncodeAddress() { - btcBalance += utxo.Amount - } - } - zrc20Supply, _ := sm.BTCZRC20.TotalSupply(&bind.CallOpts{}) - if int64(btcBalance*1e8) < zrc20Supply.Int64() { - panic(fmt.Sprintf("BTC: TSS Balance (%d) < ZRC20 TotalSupply (%d) ", int64(btcBalance*1e8), zrc20Supply)) - } else { - fmt.Printf("BTC: Balance (%d) >= ZRC20 TotalSupply (%d)\n", int64(btcBalance*1e8), zrc20Supply) - } - } - - { - usdtBal, err := sm.USDTERC20.BalanceOf(&bind.CallOpts{}, sm.ERC20CustodyAddr) - if err != nil { - panic(err) - } - zrc20Supply, _ := sm.USDTZRC20.TotalSupply(&bind.CallOpts{}) - if usdtBal.Cmp(zrc20Supply) < 0 { - panic(fmt.Sprintf("USDT: TSS balance (%d) < ZRC20 TotalSupply (%d) ", usdtBal, zrc20Supply)) - } else { - fmt.Printf("USDT: TSS balance (%d) >= ZRC20 TotalSupply (%d)\n", usdtBal, zrc20Supply) - } - } - - { - type Amount struct { - Denom string `json:"denom"` - Amount string `json:"amount"` - } - - type Response struct { - Amount Amount `json:"amount"` - } - - zetaLocked, err := sm.ConnectorEth.GetLockedAmount(&bind.CallOpts{}) - if err != nil { - panic(err) - } - resp, err := http.Get("http://zetacore0:1317/cosmos/bank/v1beta1/supply/by_denom?denom=azeta") - if err != nil { - panic(err) - } - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - panic(err) - } - var result Response - err = json.Unmarshal(body, &result) - if err != nil { - panic(err) - } - zetaSupply, _ := big.NewInt(0).SetString(result.Amount.Amount, 10) - if zetaLocked.Cmp(zetaSupply) < 0 { - fmt.Printf(fmt.Sprintf("ZETA: TSS balance (%d) < ZRC20 TotalSupply (%d) \n", zetaLocked, zetaSupply)) - } else { - fmt.Printf("ZETA: TSS balance (%d) >= ZRC20 TotalSupply (%d)\n", zetaLocked, zetaSupply) - } - } -} diff --git a/contrib/localnet/orchestrator/smoketest/test_bitcoin.go b/contrib/localnet/orchestrator/smoketest/test_bitcoin.go deleted file mode 100644 index 597e806d27..0000000000 --- a/contrib/localnet/orchestrator/smoketest/test_bitcoin.go +++ /dev/null @@ -1,627 +0,0 @@ -//go:build PRIVNET -// +build PRIVNET - -package main - -import ( - "bytes" - "context" - "encoding/hex" - "fmt" - "math/big" - "strings" - "time" - - "github.com/btcsuite/btcd/btcec" - "github.com/btcsuite/btcd/btcjson" - "github.com/btcsuite/btcd/chaincfg" - "github.com/btcsuite/btcd/chaincfg/chainhash" - "github.com/btcsuite/btcd/rpcclient" - "github.com/btcsuite/btcd/txscript" - "github.com/btcsuite/btcd/wire" - "github.com/btcsuite/btcutil" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/rs/zerolog/log" - zrc20 "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" - "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/common/bitcoin" - observertypes "github.com/zeta-chain/zetacore/x/observer/types" - "github.com/zeta-chain/zetacore/zetaclient" -) - -var ( - BTCDeployerAddress *btcutil.AddressWitnessPubKeyHash -) - -func (sm *SmokeTest) TestBitcoinSetup() { - LoudPrintf("Setup Bitcoin\n") - startTime := time.Now() - defer func() { - fmt.Printf("Bitcoin setup took %s\n", time.Since(startTime)) - }() - - btc := sm.btcRPCClient - _, err := btc.CreateWallet("smoketest", rpcclient.WithCreateWalletBlank()) - if err != nil { - if !strings.Contains(err.Error(), "Database already exists") { - panic(err) - } - } - - skBytes, err := hex.DecodeString(DeployerPrivateKey) - if err != nil { - panic(err) - } - sk, _ := btcec.PrivKeyFromBytes(btcec.S256(), skBytes) - privkeyWIF, err := btcutil.NewWIF(sk, &chaincfg.RegressionNetParams, true) - if err != nil { - panic(err) - } - err = btc.ImportPrivKeyRescan(privkeyWIF, "deployer", true) - if err != nil { - panic(err) - } - BTCDeployerAddress, err = btcutil.NewAddressWitnessPubKeyHash(btcutil.Hash160(privkeyWIF.PrivKey.PubKey().SerializeCompressed()), &chaincfg.RegressionNetParams) - if err != nil { - panic(err) - } - fmt.Printf("BTCDeployerAddress: %s\n", BTCDeployerAddress.EncodeAddress()) - - err = btc.ImportAddress(BTCTSSAddress.EncodeAddress()) - if err != nil { - panic(err) - } - _, err = btc.GenerateToAddress(101, BTCDeployerAddress, nil) - if err != nil { - panic(err) - } - bal, err := btc.GetBalance("*") - if err != nil { - panic(err) - } - _, err = btc.GenerateToAddress(4, BTCDeployerAddress, nil) - if err != nil { - panic(err) - } - bal, err = btc.GetBalance("*") - if err != nil { - panic(err) - } - fmt.Printf("balance: %f\n", bal.ToBTC()) - - bals, err := btc.GetBalances() - if err != nil { - panic(err) - } - fmt.Printf("balances: \n") - fmt.Printf(" mine (Deployer): %+v\n", bals.Mine) - if bals.WatchOnly != nil { - fmt.Printf(" watchonly (TSSAddress): %+v\n", bals.WatchOnly) - } - fmt.Printf(" TSS Address: %s\n", BTCTSSAddress.EncodeAddress()) - go func() { - // keep bitcoin chain going - for { - _, _ = btc.GenerateToAddress(4, BTCDeployerAddress, nil) - time.Sleep(5 * time.Second) - } - }() - - sm.DepositBTC() -} - -func (sm *SmokeTest) DepositBTC() { - btc := sm.btcRPCClient - utxos, err := sm.btcRPCClient.ListUnspent() - if err != nil { - panic(err) - } - spendableAmount := 0.0 - spendableUTXOs := 0 - for _, utxo := range utxos { - if utxo.Spendable { - spendableAmount += utxo.Amount - spendableUTXOs++ - } - } - fmt.Printf("ListUnspent:\n") - fmt.Printf(" spendableAmount: %f\n", spendableAmount) - fmt.Printf(" spendableUTXOs: %d\n", spendableUTXOs) - fmt.Printf("Now sending two txs to TSS address...\n") - txHash_1, err := SendToTSSFromDeployerToDeposit(BTCTSSAddress, 1.1, utxos[:2], btc) - if err != nil { - panic(err) - } - txHash_2, err := SendToTSSFromDeployerToDeposit(BTCTSSAddress, 0.05, utxos[2:4], btc) - if err != nil { - panic(err) - } - _, err = SendToTSSFromDeployerWithMemo(BTCTSSAddress, 0.11, utxos[4:5], btc, []byte(zetaclient.DonationMessage)) - if err != nil { - panic(err) - } - - fmt.Printf("testing if the deposit into BTC ZRC20 is successful...\n") - - // check if the deposit is successful - BTCZRC20Addr, err := sm.SystemContract.GasCoinZRC20ByChainId(&bind.CallOpts{}, big.NewInt(common.BtcRegtestChain().ChainId)) - if err != nil { - panic(err) - } - sm.BTCZRC20Addr = BTCZRC20Addr - fmt.Printf("BTCZRC20Addr: %s\n", BTCZRC20Addr.Hex()) - BTCZRC20, err := zrc20.NewZRC20(BTCZRC20Addr, sm.zevmClient) - if err != nil { - panic(err) - } - sm.BTCZRC20 = BTCZRC20 - initialBalance, err := BTCZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) - if err != nil { - panic(err) - } - for { - time.Sleep(5 * time.Second) - balance, err := BTCZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) - if err != nil { - panic(err) - } - diff := big.NewInt(0) - diff.Sub(balance, initialBalance) - fmt.Printf("BTC Difference in balance: %d", diff.Uint64()) - if diff.Cmp(big.NewInt(1.15*btcutil.SatoshiPerBitcoin)) != 0 { - fmt.Printf("waiting for BTC balance to show up in ZRC contract... current bal %d\n", balance) - } else { - fmt.Printf("BTC balance is in ZRC contract! Success\n") - break - } - } - - // prove the two transactions of the deposit - LoudPrintf("Bitcoin Merkle Proof\n") - - sm.ProveBTCTransaction(txHash_1) - sm.ProveBTCTransaction(txHash_2) -} - -func (sm *SmokeTest) ProveBTCTransaction(txHash *chainhash.Hash) { - // get tx result - btc := sm.btcRPCClient - txResult, err := btc.GetTransaction(txHash) - if err != nil { - panic("should get outTx result") - } - if txResult.Confirmations <= 0 { - panic("outTx should have already confirmed") - } - txBytes, err := hex.DecodeString(txResult.Hex) - if err != nil { - panic(err) - } - - // get the block with verbose transactions - blockHash, err := chainhash.NewHashFromStr(txResult.BlockHash) - if err != nil { - panic(err) - } - blockVerbose, err := btc.GetBlockVerboseTx(blockHash) - if err != nil { - panic("should get block verbose tx") - } - - // get the block header - header, err := btc.GetBlockHeader(blockHash) - if err != nil { - panic("should get block header") - } - - // collect all the txs in the block - txns := []*btcutil.Tx{} - for _, res := range blockVerbose.Tx { - txBytes, err := hex.DecodeString(res.Hex) - if err != nil { - panic(err) - } - tx, err := btcutil.NewTxFromBytes(txBytes) - if err != nil { - panic(err) - } - txns = append(txns, tx) - } - - // build merkle proof - mk := bitcoin.NewMerkle(txns) - path, index, err := mk.BuildMerkleProof(int(txResult.BlockIndex)) - if err != nil { - panic("should build merkle proof") - } - - // verify merkle proof statically - pass := bitcoin.Prove(*txHash, header.MerkleRoot, path, index) - if !pass { - panic("should verify merkle proof") - } - - hash := header.BlockHash() - for { - _, err := sm.observerClient.GetBlockHeaderByHash(context.Background(), &observertypes.QueryGetBlockHeaderByHashRequest{ - BlockHash: hash.CloneBytes(), - }) - if err != nil { - fmt.Printf("waiting for block header to show up in observer... current hash %s; err %s\n", hash.String(), err.Error()) - } - if err == nil { - break - } - time.Sleep(2 * time.Second) - - } - - // verify merkle proof through RPC - res, err := sm.observerClient.Prove(context.Background(), &observertypes.QueryProveRequest{ - ChainId: common.BtcRegtestChain().ChainId, - TxHash: txHash.String(), - BlockHash: blockHash.String(), - Proof: common.NewBitcoinProof(txBytes, path, index), - TxIndex: 0, // bitcoin doesn't use txIndex - }) - if err != nil { - panic(err) - } - if !res.Valid { - panic("txProof should be valid") - } - fmt.Printf("OK: txProof verified for inTx: %s\n", txHash.String()) -} - -func (sm *SmokeTest) DepositBTCRefund() { - LoudPrintf("Deposit BTC with invalid memo; should be refunded\n") - btc := sm.btcRPCClient - utxos, err := sm.btcRPCClient.ListUnspent() - if err != nil { - panic(err) - } - spendableAmount := 0.0 - spendableUTXOs := 0 - for _, utxo := range utxos { - if utxo.Spendable { - spendableAmount += utxo.Amount - spendableUTXOs++ - } - } - fmt.Printf("ListUnspent:\n") - fmt.Printf(" spendableAmount: %f\n", spendableAmount) - fmt.Printf(" spendableUTXOs: %d\n", spendableUTXOs) - fmt.Printf("Now sending two txs to TSS address...\n") - _, err = SendToTSSFromDeployerToDeposit(BTCTSSAddress, 1.1, utxos[:2], btc) - if err != nil { - panic(err) - } - _, err = SendToTSSFromDeployerToDeposit(BTCTSSAddress, 0.05, utxos[2:4], btc) - if err != nil { - panic(err) - } - - fmt.Printf("testing if the deposit into BTC ZRC20 is successful...\n") - - // check if the deposit is successful - BTCZRC20Addr, err := sm.SystemContract.GasCoinZRC20ByChainId(&bind.CallOpts{}, big.NewInt(common.BtcRegtestChain().ChainId)) - if err != nil { - panic(err) - } - sm.BTCZRC20Addr = BTCZRC20Addr - fmt.Printf("BTCZRC20Addr: %s\n", BTCZRC20Addr.Hex()) - BTCZRC20, err := zrc20.NewZRC20(BTCZRC20Addr, sm.zevmClient) - if err != nil { - panic(err) - } - sm.BTCZRC20 = BTCZRC20 - initialBalance, err := BTCZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) - if err != nil { - panic(err) - } - for { - time.Sleep(5 * time.Second) - balance, err := BTCZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) - if err != nil { - panic(err) - } - diff := big.NewInt(0) - diff.Sub(balance, initialBalance) - if diff.Cmp(big.NewInt(1.15*btcutil.SatoshiPerBitcoin)) != 0 { - fmt.Printf("waiting for BTC balance to show up in ZRC contract... current bal %d\n", balance) - } else { - fmt.Printf("BTC balance is in ZRC contract! Success\n") - break - } - } -} - -func (sm *SmokeTest) TestBitcoinWithdraw() { - startTime := time.Now() - defer func() { - fmt.Printf("Bitcoin withdraw took %s\n", time.Since(startTime)) - }() - LoudPrintf("Testing Bitcoin ZRC20 Withdraw...\n") - // withdraw 0.1 BTC from ZRC20 to BTC address - // first, approve the ZRC20 contract to spend 1 BTC from the deployer address - sm.WithdrawBitcoin() -} - -func (sm *SmokeTest) WithdrawBitcoin() { - amount := big.NewInt(0.1 * btcutil.SatoshiPerBitcoin) - - // check if the deposit is successful - BTCZRC20Addr, err := sm.SystemContract.GasCoinZRC20ByChainId(&bind.CallOpts{}, big.NewInt(common.BtcRegtestChain().ChainId)) - if err != nil { - panic(err) - } - fmt.Printf("BTCZRC20Addr: %s\n", BTCZRC20Addr.Hex()) - BTCZRC20, err := zrc20.NewZRC20(BTCZRC20Addr, sm.zevmClient) - if err != nil { - panic(err) - } - balance, err := BTCZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) - if err != nil { - panic(err) - } - if balance.Cmp(amount) < 0 { - panic(fmt.Errorf("not enough balance in ZRC20 contract")) - } - // approve the ZRC20 contract to spend 1 BTC from the deployer address - { - tx, err := BTCZRC20.Approve(sm.zevmAuth, BTCZRC20Addr, big.NewInt(amount.Int64()*2)) // approve more to cover withdraw fee - if err != nil { - panic(err) - } - receipt := MustWaitForTxReceipt(sm.zevmClient, tx) - fmt.Printf("approve receipt: status %d\n", receipt.Status) - if receipt.Status != 1 { - panic(fmt.Errorf("approve receipt status is not 1")) - } - } - go func() { - for { - time.Sleep(5 * time.Second) - _, err = sm.btcRPCClient.GenerateToAddress(1, BTCDeployerAddress, nil) - if err != nil { - panic(err) - } - } - }() - // withdraw 0.1 BTC from ZRC20 to BTC address - { - _, gasFee, err := BTCZRC20.WithdrawGasFee(&bind.CallOpts{}) - if err != nil { - panic(err) - } - fmt.Printf("withdraw gas fee: %d\n", gasFee) - tx, err := BTCZRC20.Withdraw(sm.zevmAuth, []byte(BTCDeployerAddress.EncodeAddress()), amount) - if err != nil { - panic(err) - } - receipt := MustWaitForTxReceipt(sm.zevmClient, tx) - fmt.Printf("withdraw receipt: status %d\n", receipt.Status) - if receipt.Status != 1 { - panic(fmt.Errorf("withdraw receipt status is not 1")) - } - _, err = sm.btcRPCClient.GenerateToAddress(10, BTCDeployerAddress, nil) - if err != nil { - panic(err) - } - cctx := WaitCctxMinedByInTxHash(receipt.TxHash.Hex(), sm.cctxClient) - outTxHash := cctx.GetCurrentOutTxParam().OutboundTxHash - hash, err := chainhash.NewHashFromStr(outTxHash) - if err != nil { - panic(err) - } - - rawTx, err := sm.btcRPCClient.GetRawTransactionVerbose(hash) - if err != nil { - panic(err) - } - fmt.Printf("raw tx:\n") - fmt.Printf(" TxIn: %d\n", len(rawTx.Vin)) - for idx, txIn := range rawTx.Vin { - fmt.Printf(" TxIn %d:\n", idx) - fmt.Printf(" TxID:Vout: %s:%d\n", txIn.Txid, txIn.Vout) - fmt.Printf(" ScriptSig: %s\n", txIn.ScriptSig.Hex) - } - fmt.Printf(" TxOut: %d\n", len(rawTx.Vout)) - for _, txOut := range rawTx.Vout { - fmt.Printf(" TxOut %d:\n", txOut.N) - fmt.Printf(" Value: %.8f\n", txOut.Value) - fmt.Printf(" ScriptPubKey: %s\n", txOut.ScriptPubKey.Hex) - } - } -} - -func (sm *SmokeTest) WithdrawBitcoinMultipleTimes(repeat int64) { - totalAmount := big.NewInt(int64(0.1 * 1e8)) - amount := big.NewInt(int64(0.1 * 1e8 / float64(repeat))) - - // check if the deposit is successful - BTCZRC20Addr, err := sm.SystemContract.GasCoinZRC20ByChainId(&bind.CallOpts{}, big.NewInt(common.BtcRegtestChain().ChainId)) - if err != nil { - panic(err) - } - fmt.Printf("BTCZRC20Addr: %s\n", BTCZRC20Addr.Hex()) - BTCZRC20, err := zrc20.NewZRC20(BTCZRC20Addr, sm.zevmClient) - if err != nil { - panic(err) - } - balance, err := BTCZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) - if err != nil { - panic(err) - } - if balance.Cmp(totalAmount) < 0 { - panic(fmt.Errorf("not enough balance in ZRC20 contract")) - } - // approve the ZRC20 contract to spend 1 BTC from the deployer address - { - tx, err := BTCZRC20.Approve(sm.zevmAuth, BTCZRC20Addr, totalAmount.Mul(totalAmount, big.NewInt(100))) // approve more to cover withdraw fee - if err != nil { - panic(err) - } - receipt := MustWaitForTxReceipt(sm.zevmClient, tx) - fmt.Printf("approve receipt: status %d\n", receipt.Status) - if receipt.Status != 1 { - panic(fmt.Errorf("approve receipt status is not 1")) - } - } - go func() { - for { - time.Sleep(3 * time.Second) - _, err = sm.btcRPCClient.GenerateToAddress(1, BTCDeployerAddress, nil) - if err != nil { - panic(err) - } - } - }() - // withdraw 0.1 BTC from ZRC20 to BTC address - for i := int64(0); i < repeat; i++ { - _, gasFee, err := BTCZRC20.WithdrawGasFee(&bind.CallOpts{}) - if err != nil { - panic(err) - } - fmt.Printf("withdraw gas fee: %d\n", gasFee) - tx, err := BTCZRC20.Withdraw(sm.zevmAuth, []byte(BTCDeployerAddress.EncodeAddress()), amount) - if err != nil { - panic(err) - } - receipt := MustWaitForTxReceipt(sm.zevmClient, tx) - fmt.Printf("withdraw receipt: status %d\n", receipt.Status) - if receipt.Status != 1 { - panic(fmt.Errorf("withdraw receipt status is not 1")) - } - _, err = sm.btcRPCClient.GenerateToAddress(10, BTCDeployerAddress, nil) - if err != nil { - panic(err) - } - cctx := WaitCctxMinedByInTxHash(receipt.TxHash.Hex(), sm.cctxClient) - outTxHash := cctx.GetCurrentOutTxParam().OutboundTxHash - hash, err := chainhash.NewHashFromStr(outTxHash) - if err != nil { - panic(err) - } - - rawTx, err := sm.btcRPCClient.GetRawTransactionVerbose(hash) - if err != nil { - panic(err) - } - fmt.Printf("raw tx:\n") - fmt.Printf(" TxIn: %d\n", len(rawTx.Vin)) - for idx, txIn := range rawTx.Vin { - fmt.Printf(" TxIn %d:\n", idx) - fmt.Printf(" TxID:Vout: %s:%d\n", txIn.Txid, txIn.Vout) - fmt.Printf(" ScriptSig: %s\n", txIn.ScriptSig.Hex) - } - fmt.Printf(" TxOut: %d\n", len(rawTx.Vout)) - for _, txOut := range rawTx.Vout { - fmt.Printf(" TxOut %d:\n", txOut.N) - fmt.Printf(" Value: %.8f\n", txOut.Value) - fmt.Printf(" ScriptPubKey: %s\n", txOut.ScriptPubKey.Hex) - } - } -} - -func SendToTSSFromDeployerToDeposit(to btcutil.Address, amount float64, inputUTXOs []btcjson.ListUnspentResult, btc *rpcclient.Client) (*chainhash.Hash, error) { - return SendToTSSFromDeployerWithMemo(to, amount, inputUTXOs, btc, DeployerAddress.Bytes()) -} - -func SendToTSSFromDeployerWithMemo(to btcutil.Address, amount float64, inputUTXOs []btcjson.ListUnspentResult, btc *rpcclient.Client, memo []byte) (*chainhash.Hash, error) { - utxos := inputUTXOs - - inputs := make([]btcjson.TransactionInput, len(utxos)) - inputSats := btcutil.Amount(0) - amounts := make([]float64, len(utxos)) - scriptPubkeys := make([]string, len(utxos)) - for i, utxo := range utxos { - inputs[i] = btcjson.TransactionInput{utxo.TxID, utxo.Vout} - inputSats += btcutil.Amount(utxo.Amount * btcutil.SatoshiPerBitcoin) - amounts[i] = utxo.Amount - scriptPubkeys[i] = utxo.ScriptPubKey - } - feeSats := btcutil.Amount(0.0001 * btcutil.SatoshiPerBitcoin) - amountSats := btcutil.Amount(amount * btcutil.SatoshiPerBitcoin) - change := inputSats - feeSats - amountSats - if change < 0 { - return nil, fmt.Errorf("not enough input amount in sats; wanted %d, got %d", amountSats+feeSats, inputSats) - } - amountMap := map[btcutil.Address]btcutil.Amount{ - to: amountSats, - BTCDeployerAddress: change, - } - tx, err := btc.CreateRawTransaction(inputs, amountMap, nil) - if err != nil { - panic(err) - } - - nulldata, err := txscript.NullDataScript(memo) // this adds a OP_RETURN + single BYTE len prefix to the data - if err != nil { - panic(err) - } - fmt.Printf("nulldata (len %d): %x\n", len(nulldata), nulldata) - if err != nil { - panic(err) - } - memoOutput := wire.TxOut{Value: 0, PkScript: nulldata} - tx.TxOut = append(tx.TxOut, &memoOutput) - tx.TxOut[1], tx.TxOut[2] = tx.TxOut[2], tx.TxOut[1] - - // make sure that TxOut[0] is sent to "to" address; TxOut[2] is change to oneself. TxOut[1] is memo. - if bytes.Compare(tx.TxOut[0].PkScript[2:], to.ScriptAddress()) != 0 { - fmt.Printf("tx.TxOut[0].PkScript: %x\n", tx.TxOut[0].PkScript) - fmt.Printf("to.ScriptAddress(): %x\n", to.ScriptAddress()) - fmt.Printf("swapping txout[0] with txout[2]\n") - tx.TxOut[0], tx.TxOut[2] = tx.TxOut[2], tx.TxOut[0] - } - - fmt.Printf("raw transaction: \n") - for idx, txout := range tx.TxOut { - fmt.Printf("txout %d\n", idx) - fmt.Printf(" value: %d\n", txout.Value) - fmt.Printf(" PkScript: %x\n", txout.PkScript) - } - var inputsForSign []btcjson.RawTxWitnessInput - for i, input := range inputs { - inputsForSign = append(inputsForSign, btcjson.RawTxWitnessInput{ - Txid: input.Txid, Vout: input.Vout, Amount: &amounts[i], ScriptPubKey: scriptPubkeys[i]}) - } - //stx, signed, err := btc.SignRawTransactionWithWallet(tx) - stx, signed, err := btc.SignRawTransactionWithWallet2(tx, inputsForSign) - if err != nil { - panic(err) - } - if !signed { - panic("btc transaction not signed") - } - txid, err := btc.SendRawTransaction(stx, true) - if err != nil { - panic(err) - } - fmt.Printf("txid: %+v\n", txid) - _, err = btc.GenerateToAddress(6, BTCDeployerAddress, nil) - if err != nil { - panic(err) - } - gtx, err := btc.GetTransaction(txid) - if err != nil { - panic(err) - } - fmt.Printf("rawtx confirmation: %d\n", gtx.BlockIndex) - rawtx, err := btc.GetRawTransactionVerbose(txid) - if err != nil { - panic(err) - } - - events := zetaclient.FilterAndParseIncomingTx([]btcjson.TxRawResult{*rawtx}, 0, BTCTSSAddress.EncodeAddress(), &log.Logger) - fmt.Printf("bitcoin intx events:\n") - for _, event := range events { - fmt.Printf(" TxHash: %s\n", event.TxHash) - fmt.Printf(" From: %s\n", event.FromAddress) - fmt.Printf(" To: %s\n", event.ToAddress) - fmt.Printf(" Amount: %f\n", event.Value) - fmt.Printf(" Memo: %x\n", event.MemoBytes) - } - return txid, nil -} diff --git a/contrib/localnet/orchestrator/smoketest/test_erc20_deposit.go b/contrib/localnet/orchestrator/smoketest/test_erc20_deposit.go deleted file mode 100644 index 6df4d94647..0000000000 --- a/contrib/localnet/orchestrator/smoketest/test_erc20_deposit.go +++ /dev/null @@ -1,163 +0,0 @@ -//go:build PRIVNET -// +build PRIVNET - -package main - -import ( - "fmt" - "math/big" - "time" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - ethcommon "github.com/ethereum/go-ethereum/common" - testcontract "github.com/zeta-chain/zetacore/testutil/contracts" -) - -func (sm *SmokeTest) TestERC20Deposit() { - startTime := time.Now() - defer func() { - fmt.Printf("test finishes in %s\n", time.Since(startTime)) - }() - LoudPrintf("Deposit USDT ERC20 into ZEVM\n") - - initialBal, err := sm.USDTZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) - if err != nil { - panic(err) - } - txhash := sm.DepositERC20(big.NewInt(1e9), []byte{}) - WaitCctxMinedByInTxHash(txhash.Hex(), sm.cctxClient) - - bal, err := sm.USDTZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) - if err != nil { - panic(err) - } - - diff := big.NewInt(0) - diff.Sub(bal, initialBal) - - fmt.Printf("balance of deployer on USDT ZRC20: %d\n", bal) - supply, err := sm.USDTZRC20.TotalSupply(&bind.CallOpts{}) - if err != nil { - panic(err) - } - fmt.Printf("supply of USDT ZRC20: %d\n", supply) - if diff.Int64() != 1e9 { - panic("balance is not correct") - } - - LoudPrintf("Same-transaction multiple deposit USDT ERC20 into ZEVM\n") - initialBal, err = sm.USDTZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) - if err != nil { - panic(err) - } - txhash = sm.MultipleDeposits(big.NewInt(1e9), big.NewInt(10)) - cctxs := WaitCctxsMinedByInTxHash(txhash.Hex(), sm.cctxClient) - if len(cctxs) != 10 { - panic(fmt.Sprintf("cctxs length is not correct: %d", len(cctxs))) - } - - // check new balance is increased by 1e9 * 10 - bal, err = sm.USDTZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) - if err != nil { - panic(err) - } - diff = big.NewInt(0).Sub(bal, initialBal) - if diff.Int64() != 1e10 { - panic(fmt.Sprintf("balance difference is not correct: %d", diff.Int64())) - } -} - -func (sm *SmokeTest) DepositERC20(amount *big.Int, msg []byte) ethcommon.Hash { - USDT := sm.USDTERC20 - tx, err := USDT.Mint(sm.goerliAuth, big.NewInt(1e10)) - if err != nil { - panic(err) - } - receipt := MustWaitForTxReceipt(sm.goerliClient, tx) - fmt.Printf("Mint receipt tx hash: %s\n", tx.Hash().Hex()) - - tx, err = USDT.Approve(sm.goerliAuth, sm.ERC20CustodyAddr, big.NewInt(1e10)) - if err != nil { - panic(err) - } - receipt = MustWaitForTxReceipt(sm.goerliClient, tx) - fmt.Printf("USDT Approve receipt tx hash: %s\n", tx.Hash().Hex()) - - tx, err = sm.ERC20Custody.Deposit(sm.goerliAuth, DeployerAddress.Bytes(), sm.USDTERC20Addr, amount, msg) - if err != nil { - panic(err) - } - receipt = MustWaitForTxReceipt(sm.goerliClient, tx) - if receipt.Status == 0 { - panic("deposit failed") - } - fmt.Printf("Deposit receipt tx hash: %s, status %d\n", receipt.TxHash.Hex(), receipt.Status) - for _, log := range receipt.Logs { - event, err := sm.ERC20Custody.ParseDeposited(*log) - if err != nil { - continue - } - fmt.Printf("Deposited event: \n") - fmt.Printf(" Recipient address: %x, \n", event.Recipient) - fmt.Printf(" ERC20 address: %s, \n", event.Asset.Hex()) - fmt.Printf(" Amount: %d, \n", event.Amount) - fmt.Printf(" Message: %x, \n", event.Message) - } - fmt.Printf("gas limit %d\n", sm.zevmAuth.GasLimit) - return tx.Hash() -} - -func (sm *SmokeTest) MultipleDeposits(amount, count *big.Int) ethcommon.Hash { - // deploy depositor - depositorAddr, _, depositor, err := testcontract.DeployDepositor(sm.goerliAuth, sm.goerliClient, sm.ERC20CustodyAddr) - if err != nil { - panic(err) - } - - // mint - tx, err := sm.USDTERC20.Mint(sm.goerliAuth, big.NewInt(0).Mul(amount, count)) - if err != nil { - panic(err) - } - receipt := MustWaitForTxReceipt(sm.goerliClient, tx) - if receipt.Status == 0 { - panic("mint failed") - } - fmt.Printf("Mint receipt tx hash: %s\n", tx.Hash().Hex()) - - // approve - tx, err = sm.USDTERC20.Approve(sm.goerliAuth, depositorAddr, big.NewInt(1e10)) - if err != nil { - panic(err) - } - receipt = MustWaitForTxReceipt(sm.goerliClient, tx) - if receipt.Status == 0 { - panic("approve failed") - } - fmt.Printf("USDT Approve receipt tx hash: %s\n", tx.Hash().Hex()) - - // deposit - tx, err = depositor.RunDeposits(sm.goerliAuth, DeployerAddress.Bytes(), sm.USDTERC20Addr, amount, []byte{}, count) - if err != nil { - panic(err) - } - receipt = MustWaitForTxReceipt(sm.goerliClient, tx) - if receipt.Status == 0 { - panic("deposits failed") - } - fmt.Printf("Deposits receipt tx hash: %s\n", tx.Hash().Hex()) - - for _, log := range receipt.Logs { - event, err := sm.ERC20Custody.ParseDeposited(*log) - if err != nil { - continue - } - fmt.Printf("Multiple deposit event: \n") - fmt.Printf(" Recipient address: %x, \n", event.Recipient) - fmt.Printf(" ERC20 address: %s, \n", event.Asset.Hex()) - fmt.Printf(" Amount: %d, \n", event.Amount) - fmt.Printf(" Message: %x, \n", event.Message) - } - fmt.Printf("gas limit %d\n", sm.zevmAuth.GasLimit) - return tx.Hash() -} diff --git a/contrib/localnet/orchestrator/smoketest/test_setup.go b/contrib/localnet/orchestrator/smoketest/test_setup.go deleted file mode 100644 index b2df135a03..0000000000 --- a/contrib/localnet/orchestrator/smoketest/test_setup.go +++ /dev/null @@ -1,322 +0,0 @@ -//go:build PRIVNET -// +build PRIVNET - -package main - -import ( - "context" - "fmt" - "math/big" - "os" - "time" - - "github.com/pelletier/go-toml/v2" - "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/contracts/testdapp" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - erc20custody "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/erc20custody.sol" - zetaeth "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/zeta.eth.sol" - zetaconnectoreth "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/zetaconnector.eth.sol" - zrc20 "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" - uniswapv2factory "github.com/zeta-chain/protocol-contracts/pkg/uniswap/v2-core/contracts/uniswapv2factory.sol" - uniswapv2router "github.com/zeta-chain/protocol-contracts/pkg/uniswap/v2-periphery/contracts/uniswapv2router02.sol" - "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/contracts/erc20" - fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" -) - -const ( - ContractsConfigFile = "contracts.toml" -) - -type Contracts struct { - ZetaEthAddress string - ConnectorEthAddr string -} - -func (sm *SmokeTest) TestSetupZetaTokenAndConnectorAndZEVMContracts() { - contracts := Contracts{} - if localTestArgs.contractsDeployed { - sm.setContracts() - return - } - - startTime := time.Now() - defer func() { - fmt.Printf("test finishes in %s\n", time.Since(startTime)) - }() - - goerliClient := sm.goerliClient - auth := sm.getDeployerAuth() - - LoudPrintf("Deploy ZetaETH ConnectorETH ERC20Custody USDT\n") - - initialNonce, err := goerliClient.PendingNonceAt(context.Background(), DeployerAddress) - if err != nil { - panic(err) - } - - res, err := sm.fungibleClient.ForeignCoinsAll(context.Background(), &fungibletypes.QueryAllForeignCoinsRequest{}) - if err != nil { - panic(err) - } - - if err := CheckNonce(goerliClient, DeployerAddress, initialNonce); err != nil { - panic(err) - } - zetaEthAddr, tx, ZetaEth, err := zetaeth.DeployZetaEth(auth, goerliClient, DeployerAddress, big.NewInt(21_000_000_000)) - if err != nil { - panic(err) - } - fmt.Printf("ZetaEth contract address: %s, tx hash: %s\n", zetaEthAddr.Hex(), tx.Hash().Hex()) - receipt := MustWaitForTxReceipt(goerliClient, tx) - fmt.Printf("ZetaEth contract receipt: contract address %s, status %d\n", receipt.ContractAddress, receipt.Status) - sm.ZetaEth = ZetaEth - sm.ZetaEthAddr = zetaEthAddr - contracts.ZetaEthAddress = zetaEthAddr.String() - - if err := CheckNonce(goerliClient, DeployerAddress, initialNonce+1); err != nil { - panic(err) - } - connectorEthAddr, tx, ConnectorEth, err := zetaconnectoreth.DeployZetaConnectorEth(auth, goerliClient, zetaEthAddr, - TSSAddress, DeployerAddress, DeployerAddress) - if err != nil { - panic(err) - } - receipt = MustWaitForTxReceipt(goerliClient, tx) - fmt.Printf("ZetaConnectorEth contract address: %s, tx hash: %s\n", connectorEthAddr.Hex(), tx.Hash().Hex()) - fmt.Printf("ZetaConnectorEth contract receipt: contract address %s, status %d\n", receipt.ContractAddress, receipt.Status) - sm.ConnectorEth = ConnectorEth - sm.ConnectorEthAddr = connectorEthAddr - contracts.ConnectorEthAddr = connectorEthAddr.String() - - fungibleClient := sm.fungibleClient - fmt.Printf("Deploying ERC20Custody contract\n") - if err := CheckNonce(goerliClient, DeployerAddress, initialNonce+2); err != nil { - panic(err) - } - erc20CustodyAddr, tx, ERC20Custody, err := erc20custody.DeployERC20Custody(auth, goerliClient, DeployerAddress, DeployerAddress, big.NewInt(0), big.NewInt(1e18), ethcommon.HexToAddress("0x")) - if err != nil { - panic(err) - } - fmt.Printf("ERC20Custody contract address: %s, tx hash: %s\n", erc20CustodyAddr.Hex(), tx.Hash().Hex()) - receipt = MustWaitForTxReceipt(goerliClient, tx) - fmt.Printf("ERC20Custody contract receipt: contract address %s, status %d\n", receipt.ContractAddress, receipt.Status) - if erc20CustodyAddr != ethcommon.HexToAddress(ERC20CustodyAddr) { - panic("ERC20Custody contract address mismatch! check order of tx") - } - - sm.ERC20CustodyAddr = erc20CustodyAddr - sm.ERC20Custody = ERC20Custody - - fmt.Printf("Deploying USDT contract\n") - if err := CheckNonce(goerliClient, DeployerAddress, initialNonce+3); err != nil { - panic(err) - } - usdtAddr, tx, _, err := erc20.DeployUSDT(auth, goerliClient, "USDT", "USDT", 6) - if err != nil { - panic(err) - } - fmt.Printf("USDT contract address: %s, tx hash: %s\n", usdtAddr.Hex(), tx.Hash().Hex()) - receipt = MustWaitForTxReceipt(goerliClient, tx) - fmt.Printf("USDT contract receipt: contract address %s, status %d\n", receipt.ContractAddress, receipt.Status) - if receipt.ContractAddress != ethcommon.HexToAddress(USDTERC20Addr) { - panic("USDT contract address mismatch! check order of tx") - } - - fmt.Printf("Step 6: Whitelist USDT\n") - tx, err = ERC20Custody.Whitelist(auth, usdtAddr) - if err != nil { - panic(err) - } - receipt = MustWaitForTxReceipt(goerliClient, tx) - fmt.Printf("Whitelist receipt tx hash: %s\n", tx.Hash().Hex()) - - fmt.Printf("Step 7: Set TSS address\n") - tx, err = ERC20Custody.UpdateTSSAddress(auth, TSSAddress) - if err != nil { - panic(err) - } - receipt = MustWaitForTxReceipt(goerliClient, tx) - fmt.Printf("TSS set receipt tx hash: %s\n", tx.Hash().Hex()) - - fmt.Printf("Checking foreign coins...\n") - res, err = fungibleClient.ForeignCoinsAll(context.Background(), &fungibletypes.QueryAllForeignCoinsRequest{}) - if err != nil { - panic(err) - } - found := false - zrc20addr := "" - for _, fcoin := range res.ForeignCoins { - if fcoin.Asset == USDTERC20Addr { - found = true - zrc20addr = fcoin.Zrc20ContractAddress - } - } - if !found { - fmt.Printf("foreign coins: %v", res.ForeignCoins) - panic(fmt.Sprintf("fungible module does not have foreign coin that represent USDT ERC20 %s", usdtAddr)) - } - fmt.Printf("USDT ZRC20 Address: %s\n", zrc20addr) - if HexToAddress(zrc20addr) != HexToAddress(USDTZRC20Addr) { - panic("mismatch of foreign coin USDT ZRC20 and the USDTZRC20Addr constant in smoketest") - } - - sm.USDTZRC20Addr = ethcommon.HexToAddress(zrc20addr) - sm.USDTZRC20, err = zrc20.NewZRC20(sm.USDTZRC20Addr, sm.zevmClient) - if err != nil { - panic(err) - } - - USDT, err := erc20.NewUSDT(usdtAddr, goerliClient) - if err != nil { - panic(err) - } - sm.USDTERC20 = USDT - sm.USDTERC20Addr = usdtAddr - sm.UniswapV2FactoryAddr = ethcommon.HexToAddress(UniswapV2FactoryAddr) - sm.UniswapV2Factory, err = uniswapv2factory.NewUniswapV2Factory(sm.UniswapV2FactoryAddr, sm.zevmClient) - if err != nil { - panic(err) - } - sm.UniswapV2RouterAddr = ethcommon.HexToAddress(UniswapV2RouterAddr) - sm.UniswapV2Router, err = uniswapv2router.NewUniswapV2Router02(sm.UniswapV2RouterAddr, sm.zevmClient) - if err != nil { - panic(err) - } - - fmt.Printf("UniswapV2FactoryAddr: %s, UniswapV2RouterAddr: %s", sm.UniswapV2FactoryAddr.String(), sm.UniswapV2RouterAddr.String()) - - // deploy TestDApp contract - //auth.GasLimit = 1_000_000 - sm.setupTestDapp(auth) - - // Save contract addresses to toml file - b, err := toml.Marshal(contracts) - if err != nil { - panic(err) - } - err = os.WriteFile(ContractsConfigFile, b, 0666) - if err != nil { - panic(err) - } -} - -// Set existing deployed contracts -func (sm *SmokeTest) setContracts() { - err := error(nil) - var contracts Contracts - - // Read contracts toml file - b, err := os.ReadFile(ContractsConfigFile) - if err != nil { - panic(err) - } - err = toml.Unmarshal(b, &contracts) - if err != nil { - panic(err) - } - - // Set ZetaEthAddr - sm.ZetaEthAddr = ethcommon.HexToAddress(contracts.ZetaEthAddress) - fmt.Println("Connector Eth address: ", contracts.ZetaEthAddress) - sm.ZetaEth, err = zetaeth.NewZetaEth(sm.ZetaEthAddr, sm.goerliClient) - if err != nil { - panic(err) - } - - // Set ConnectorEthAddr - sm.ConnectorEthAddr = ethcommon.HexToAddress(contracts.ConnectorEthAddr) - sm.ConnectorEth, err = zetaconnectoreth.NewZetaConnectorEth(sm.ConnectorEthAddr, sm.goerliClient) - if err != nil { - panic(err) - } - - // Set ERC20CustodyAddr - sm.ERC20CustodyAddr = ethcommon.HexToAddress(ERC20CustodyAddr) - sm.ERC20Custody, err = erc20custody.NewERC20Custody(sm.ERC20CustodyAddr, sm.goerliClient) - if err != nil { - panic(err) - } - - // Set USDTERC20Addr - sm.USDTERC20Addr = ethcommon.HexToAddress(USDTERC20Addr) - sm.USDTERC20, err = erc20.NewUSDT(sm.USDTERC20Addr, sm.goerliClient) - if err != nil { - panic(err) - } - - // Set USDTZRC20Addr - sm.USDTZRC20Addr = ethcommon.HexToAddress(USDTZRC20Addr) - sm.USDTZRC20, err = zrc20.NewZRC20(sm.USDTZRC20Addr, sm.zevmClient) - if err != nil { - panic(err) - } - - // UniswapV2FactoryAddr - sm.UniswapV2FactoryAddr = ethcommon.HexToAddress(UniswapV2FactoryAddr) - sm.UniswapV2Factory, err = uniswapv2factory.NewUniswapV2Factory(sm.UniswapV2FactoryAddr, sm.zevmClient) - if err != nil { - panic(err) - } - - // UniswapV2RouterAddr - sm.UniswapV2RouterAddr = ethcommon.HexToAddress(UniswapV2RouterAddr) - sm.UniswapV2Router, err = uniswapv2router.NewUniswapV2Router02(sm.UniswapV2RouterAddr, sm.zevmClient) - if err != nil { - panic(err) - } - - sm.setupTestDapp(sm.getDeployerAuth()) -} - -func (sm *SmokeTest) setupTestDapp(auth *bind.TransactOpts) { - // deploy TestDApp contract - //auth.GasLimit = 1_000_000 - appAddr, tx, _, err := testdapp.DeployTestDApp(auth, sm.goerliClient, sm.ConnectorEthAddr, sm.ZetaEthAddr) - if err != nil { - panic(err) - } - fmt.Printf("TestDApp contract address: %s, tx hash: %s\n", appAddr.Hex(), tx.Hash().Hex()) - receipt := MustWaitForTxReceipt(sm.goerliClient, tx) - fmt.Printf("TestDApp contract receipt: contract address %s, status %d; used gas %d\n", receipt.ContractAddress, receipt.Status, receipt.GasUsed) - dapp, err := testdapp.NewTestDApp(receipt.ContractAddress, sm.goerliClient) - if err != nil { - panic(err) - } - { - code, err := sm.goerliClient.CodeAt(context.Background(), receipt.ContractAddress, nil) - if err != nil { - panic(err) - } - fmt.Printf("TestDApp contract code: len %d\n", len(code)) - if len(code) == 0 { - panic("TestDApp contract code is empty") - } - res, err := dapp.Connector(&bind.CallOpts{}) - if err != nil { - panic(err) - } - if res != sm.ConnectorEthAddr { - panic("mismatch of TestDApp connector address") - } - } - sm.TestDAppAddr = receipt.ContractAddress -} - -func (sm *SmokeTest) getDeployerAuth() *bind.TransactOpts { - chainid, err := sm.goerliClient.ChainID(context.Background()) - if err != nil { - panic(err) - } - deployerPrivkey, err := crypto.HexToECDSA(DeployerPrivateKey) - if err != nil { - panic(err) - } - auth, err := bind.NewKeyedTransactorWithChainID(deployerPrivkey, chainid) - if err != nil { - panic(err) - } - return auth -} diff --git a/contrib/localnet/orchestrator/smoketest/test_stress.go b/contrib/localnet/orchestrator/smoketest/test_stress.go deleted file mode 100644 index 02a424450d..0000000000 --- a/contrib/localnet/orchestrator/smoketest/test_stress.go +++ /dev/null @@ -1,309 +0,0 @@ -//go:build PRIVNET -// +build PRIVNET - -package main - -import ( - "context" - "errors" - "fmt" - "math/big" - "os" - "sort" - "time" - - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethclient" - "github.com/spf13/cobra" - "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" - "github.com/zeta-chain/zetacore/x/crosschain/types" - types2 "github.com/zeta-chain/zetacore/x/crosschain/types" - fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" - observertypes "github.com/zeta-chain/zetacore/x/observer/types" - "google.golang.org/grpc" -) - -const ( - StatInterval = 5 - StressTestTimeout = 100 * time.Minute -) - -var ( - zevmNonce = big.NewInt(1) -) - -var StressCmd = &cobra.Command{ - Use: "stress", - Short: "Run Local Stress Test", - Run: StressTest, -} - -type stressArguments struct { - ethURL string - grpcURL string - zevmURL string - deployerAddress string - deployerPrivateKey string - network string - txnInterval int64 -} - -var stressTestArgs = stressArguments{} - -func init() { - RootCmd.AddCommand(StressCmd) - StressCmd.Flags().StringVar(&stressTestArgs.ethURL, "ethURL", "http://eth:8545", "--ethURL http://eth:8545") - StressCmd.Flags().StringVar(&stressTestArgs.grpcURL, "grpcURL", "zetacore0:9090", "--grpcURL zetacore0:9090") - StressCmd.Flags().StringVar(&stressTestArgs.zevmURL, "zevmURL", "http://zetacore0:8545", "--zevmURL http://zetacore0:8545") - StressCmd.Flags().StringVar(&stressTestArgs.deployerAddress, "addr", "0xE5C5367B8224807Ac2207d350E60e1b6F27a7ecC", "--addr ") - StressCmd.Flags().StringVar(&stressTestArgs.deployerPrivateKey, "privKey", "d87baf7bf6dc560a252596678c12e41f7d1682837f05b29d411bc3f78ae2c263", "--privKey ") - StressCmd.Flags().StringVar(&stressTestArgs.network, "network", "PRIVNET", "--network PRIVNET") - StressCmd.Flags().Int64Var(&stressTestArgs.txnInterval, "tx-interval", 500, "--tx-interval [TIME_INTERVAL_MILLISECONDS]") - - DeployerAddress = ethcommon.HexToAddress(stressTestArgs.deployerAddress) -} - -func StressTest(_ *cobra.Command, _ []string) { - testStartTime := time.Now() - defer func() { - fmt.Println("Smoke test took", time.Since(testStartTime)) - }() - go func() { - time.Sleep(StressTestTimeout) - fmt.Println("Smoke test timed out after", StressTestTimeout) - os.Exit(1) - }() - - goerliClient, err := ethclient.Dial(stressTestArgs.ethURL) - if err != nil { - panic(err) - } - - bal, err := goerliClient.BalanceAt(context.TODO(), DeployerAddress, nil) - if err != nil { - panic(err) - } - fmt.Printf("Deployer address: %s, balance: %d Wei\n", DeployerAddress.Hex(), bal) - - chainid, err := goerliClient.ChainID(context.Background()) - deployerPrivkey, err := crypto.HexToECDSA(stressTestArgs.deployerPrivateKey) - if err != nil { - panic(err) - } - goerliAuth, err := bind.NewKeyedTransactorWithChainID(deployerPrivkey, chainid) - if err != nil { - panic(err) - } - - grpcConn, err := grpc.Dial(stressTestArgs.grpcURL, grpc.WithInsecure()) - if err != nil { - panic(err) - } - - cctxClient := types.NewQueryClient(grpcConn) - fungibleClient := fungibletypes.NewQueryClient(grpcConn) - bankClient := banktypes.NewQueryClient(grpcConn) - authClient := authtypes.NewQueryClient(grpcConn) - observerClient := observertypes.NewQueryClient(grpcConn) - - // Wait for Genesis and keygen to be completed. ~ height 30 - time.Sleep(20 * time.Second) - for { - time.Sleep(5 * time.Second) - response, err := cctxClient.LastZetaHeight(context.Background(), &types.QueryLastZetaHeightRequest{}) - if err != nil { - fmt.Printf("cctxClient.LastZetaHeight error: %s", err) - continue - } - if response.Height >= 30 { - break - } - fmt.Printf("Last ZetaHeight: %d\n", response.Height) - } - - // get the clients for tests - var zevmClient *ethclient.Client - for { - time.Sleep(5 * time.Second) - fmt.Printf("dialing zevm client: %s\n", stressTestArgs.zevmURL) - zevmClient, err = ethclient.Dial(stressTestArgs.zevmURL) - if err != nil { - continue - } - break - } - chainid, err = zevmClient.ChainID(context.Background()) - if err != nil { - panic(err) - } - zevmAuth, err := bind.NewKeyedTransactorWithChainID(deployerPrivkey, chainid) - if err != nil { - panic(err) - } - - smokeTest := NewSmokeTest( - goerliClient, - zevmClient, - cctxClient, - ZetaTxServer{}, // not used in stress test - fungibleClient, - authClient, - bankClient, - observerClient, - goerliAuth, - zevmAuth, - nil, - ) - - // If stress test is running on local docker environment - if stressTestArgs.network == "PRIVNET" { - smokeTest.TestSetupZetaTokenAndConnectorAndZEVMContracts() - smokeTest.TestDepositEtherIntoZRC20() - smokeTest.TestSendZetaIn() - } else if stressTestArgs.network == "TESTNET" { - ethZRC20Addr, _ := smokeTest.SystemContract.GasCoinZRC20ByChainId(&bind.CallOpts{}, big.NewInt(5)) - smokeTest.ETHZRC20Addr = ethZRC20Addr - smokeTest.ETHZRC20, _ = zrc20.NewZRC20(smokeTest.ETHZRC20Addr, smokeTest.zevmClient) - } else { - err := errors.New("invalid network argument: " + stressTestArgs.network) - panic(err) - } - - // Check zrc20 balance of Deployer address - ethZRC20Balance, err := smokeTest.ETHZRC20.BalanceOf(nil, DeployerAddress) - if err != nil { - panic(err) - } - fmt.Printf("eth zrc20 balance: %s Wei \n", ethZRC20Balance.String()) - - //Pre-approve ETH withdraw on ZEVM - fmt.Printf("approving ETH ZRC20...\n") - ethZRC20 := smokeTest.ETHZRC20 - tx, err := ethZRC20.Approve(smokeTest.zevmAuth, smokeTest.ETHZRC20Addr, big.NewInt(1e18)) - if err != nil { - panic(err) - } - receipt := MustWaitForTxReceipt(smokeTest.zevmClient, tx) - fmt.Printf("eth zrc20 approve receipt: status %d\n", receipt.Status) - - // Get current nonce on zevm for DeployerAddress - Need to keep track of nonce at client level - blockNum, err := smokeTest.zevmClient.BlockNumber(context.Background()) - nonce, err := smokeTest.zevmClient.NonceAt(context.Background(), DeployerAddress, big.NewInt(int64(blockNum))) - if err != nil { - panic(err) - } - zevmNonce = big.NewInt(int64(nonce)) - - // -------------- TEST BEGINS ------------------ - - fmt.Println("**** STRESS TEST BEGINS ****") - fmt.Println(" 1. Periodically Withdraw ETH from ZEVM to EVM - goerli") - fmt.Println(" 2. Display Network metrics to monitor performance [Num Pending outbound tx], [Num Trackers]") - - smokeTest.wg.Add(2) - go smokeTest.WithdrawCCtx() // Withdraw USDT from ZEVM to EVM - goerli - go smokeTest.EchoNetworkMetrics() // Display Network metrics periodically to monitor performance - - smokeTest.wg.Wait() -} - -// WithdrawCCtx withdraw USDT from ZEVM to EVM -func (sm *SmokeTest) WithdrawCCtx() { - ticker := time.NewTicker(time.Millisecond * time.Duration(stressTestArgs.txnInterval)) - for { - select { - case <-ticker.C: - sm.WithdrawETHZRC20() - } - } -} - -func (sm *SmokeTest) EchoNetworkMetrics() { - ticker := time.NewTicker(time.Second * StatInterval) - var queue = make([]uint64, 0) - var numTicks = 0 - var totalMinedTxns = uint64(0) - var previousMinedTxns = uint64(0) - - for { - select { - case <-ticker.C: - numTicks++ - // Get all pending outbound transactions - cctxResp, err := sm.cctxClient.CctxAllPending(context.Background(), &types2.QueryAllCctxPendingRequest{ - ChainId: getChainID(), - }) - if err != nil { - continue - } - sends := cctxResp.CrossChainTx - sort.Slice(sends, func(i, j int) bool { - return sends[i].GetCurrentOutTxParam().OutboundTxTssNonce < sends[j].GetCurrentOutTxParam().OutboundTxTssNonce - }) - if len(sends) > 0 { - fmt.Printf("pending nonces %d to %d\n", sends[0].GetCurrentOutTxParam().OutboundTxTssNonce, sends[len(sends)-1].GetCurrentOutTxParam().OutboundTxTssNonce) - } else { - continue - } - // - // Get all trackers - trackerResp, err := sm.cctxClient.OutTxTrackerAll(context.Background(), &types2.QueryAllOutTxTrackerRequest{}) - if err != nil { - continue - } - - currentMinedTxns := sends[0].GetCurrentOutTxParam().OutboundTxTssNonce - newMinedTxCnt := currentMinedTxns - previousMinedTxns - previousMinedTxns = currentMinedTxns - - // Add new mined txn count to queue and remove the oldest entry - queue = append(queue, newMinedTxCnt) - if numTicks > 60/StatInterval { - totalMinedTxns -= queue[0] - queue = queue[1:] - numTicks = 60/StatInterval + 1 //prevent overflow - } - - //Calculate rate -> tx/min - totalMinedTxns += queue[len(queue)-1] - rate := totalMinedTxns - - numPending := len(cctxResp.CrossChainTx) - numTrackers := len(trackerResp.OutTxTracker) - - fmt.Println("Network Stat => Num of Pending cctx: ", numPending, "Num active trackers: ", numTrackers, "Tx Rate: ", rate, " tx/min") - } - } -} - -func (sm *SmokeTest) WithdrawETHZRC20() { - defer func() { - zevmNonce.Add(zevmNonce, big.NewInt(1)) - }() - - ethZRC20 := sm.ETHZRC20 - - sm.zevmAuth.Nonce = zevmNonce - _, err := ethZRC20.Withdraw(sm.zevmAuth, DeployerAddress.Bytes(), big.NewInt(100)) - if err != nil { - panic(err) - } -} - -// Get ETH based chain ID - Build flags are conflicting with current lib, need to do this manually -func getChainID() int64 { - switch stressTestArgs.network { - case "PRIVNET": - return 1337 - case "TESTNET": - return 5 - case "MAINNET": - return 1 - default: - return 1337 - } -} diff --git a/contrib/localnet/orchestrator/smoketest/test_zrc20_swap.go b/contrib/localnet/orchestrator/smoketest/test_zrc20_swap.go deleted file mode 100644 index 67452cfacf..0000000000 --- a/contrib/localnet/orchestrator/smoketest/test_zrc20_swap.go +++ /dev/null @@ -1,85 +0,0 @@ -//go:build PRIVNET -// +build PRIVNET - -package main - -import ( - "fmt" - "math/big" - "time" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - ethcommon "github.com/ethereum/go-ethereum/common" -) - -func (sm *SmokeTest) TestZRC20Swap() { - startTime := time.Now() - defer func() { - fmt.Printf("test finishes in %s\n", time.Since(startTime)) - }() - LoudPrintf("Swap ZRC20 USDT for ZRC20 ETH\n") - if !localTestArgs.contractsDeployed { - tx, err := sm.UniswapV2Factory.CreatePair(sm.zevmAuth, sm.USDTZRC20Addr, sm.ETHZRC20Addr) - if err != nil { - panic(err) - } - receipt := MustWaitForTxReceipt(sm.zevmClient, tx) - - fmt.Printf("USDT-ETH pair receipt txhash %s status %d pair addr %s\n", receipt.TxHash, receipt.Status) - } - - usdtEthPair, err := sm.UniswapV2Factory.GetPair(&bind.CallOpts{}, sm.USDTZRC20Addr, sm.ETHZRC20Addr) - if err != nil { - panic(err) - } - fmt.Printf("USDT-ETH pair receipt pair addr %s\n", usdtEthPair.Hex()) - - tx, err := sm.USDTZRC20.Approve(sm.zevmAuth, sm.UniswapV2RouterAddr, big.NewInt(1e18)) - if err != nil { - panic(err) - } - receipt := MustWaitForTxReceipt(sm.zevmClient, tx) - fmt.Printf("USDT ZRC20 approval receipt txhash %s status %d\n", receipt.TxHash, receipt.Status) - - tx, err = sm.ETHZRC20.Approve(sm.zevmAuth, sm.UniswapV2RouterAddr, big.NewInt(1e18)) - if err != nil { - panic(err) - } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) - fmt.Printf("ETH ZRC20 approval receipt txhash %s status %d\n", receipt.TxHash, receipt.Status) - - sm.zevmAuth.GasLimit = 400000 - tx, err = sm.UniswapV2Router.AddLiquidity(sm.zevmAuth, sm.USDTZRC20Addr, sm.ETHZRC20Addr, big.NewInt(90000), big.NewInt(1000), big.NewInt(90000), big.NewInt(1000), DeployerAddress, big.NewInt(time.Now().Add(10*time.Minute).Unix())) - if err != nil { - panic(err) - } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) - fmt.Printf("Add liquidity receipt txhash %s status %d\n", receipt.TxHash, receipt.Status) - - balETHBefore, err := sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) - if err != nil { - panic(err) - } - ethOutAmout := big.NewInt(1) - /*usdtEth, err := contracts.NewUniswapV2Pair(usdtEthPair, sm.zevmClient) - if err != nil { - panic(err) - } - res, err := usdtEth.GetReserves(&bind.CallOpts{}) - fmt.Printf("Reserves %s %s\n", res.Reserve0, res.Reserve1)*/ - tx, err = sm.UniswapV2Router.SwapExactTokensForTokens(sm.zevmAuth, big.NewInt(1000), ethOutAmout, []ethcommon.Address{sm.USDTZRC20Addr, sm.ETHZRC20Addr}, DeployerAddress, big.NewInt(time.Now().Add(10*time.Minute).Unix())) - if err != nil { - panic(err) - } - receipt = MustWaitForTxReceipt(sm.zevmClient, tx) - fmt.Printf("Swap USDT for ETH ZRC20 %s status %d\n", receipt.TxHash, receipt.Status) - - balETHAfter, err := sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) - if err != nil { - panic(err) - } - ethDiff := big.NewInt(0).Sub(balETHAfter, balETHBefore) - if ethDiff.Cmp(ethOutAmout) < 0 { - panic("swap failed") - } -} diff --git a/contrib/localnet/orchestrator/smoketest/zeta_tx_server.go b/contrib/localnet/orchestrator/smoketest/txserver/zeta_tx_server.go similarity index 50% rename from contrib/localnet/orchestrator/smoketest/zeta_tx_server.go rename to contrib/localnet/orchestrator/smoketest/txserver/zeta_tx_server.go index fac36b10fb..fee5bcf6c8 100644 --- a/contrib/localnet/orchestrator/smoketest/zeta_tx_server.go +++ b/contrib/localnet/orchestrator/smoketest/txserver/zeta_tx_server.go @@ -1,13 +1,12 @@ -//go:build PRIVNET -// +build PRIVNET - -package main +package txserver import ( "context" + "encoding/json" "errors" "fmt" "os" + "strings" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" @@ -29,9 +28,11 @@ import ( slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + ethcommon "github.com/ethereum/go-ethereum/common" etherminttypes "github.com/evmos/ethermint/types" evmtypes "github.com/evmos/ethermint/x/evm/types" rpchttp "github.com/tendermint/tendermint/rpc/client/http" + "github.com/zeta-chain/zetacore/common" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" emissionstypes "github.com/zeta-chain/zetacore/x/emissions/types" fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" @@ -42,12 +43,19 @@ import ( type ZetaTxServer struct { clientCtx client.Context txFactory tx.Factory + name []string + mnemonic []string + address []string } // NewZetaTxServer returns a new TxServer with provided account -func NewZetaTxServer(rpcAddr string, names []string, mnemonics []string) (ZetaTxServer, error) { +func NewZetaTxServer(rpcAddr string, names []string, mnemonics []string, chainID string) (ZetaTxServer, error) { ctx := context.Background() + if len(names) == 0 { + return ZetaTxServer{}, errors.New("no account provided") + } + if len(names) != len(mnemonics) { return ZetaTxServer{}, errors.New("invalid names and mnemonics") } @@ -67,33 +75,61 @@ func NewZetaTxServer(rpcAddr string, names []string, mnemonics []string) (ZetaTx // initialize keyring kr := keyring.NewInMemory(cdc) + addresses := make([]string, 0, len(names)) + // create accounts for i := range names { r, err := kr.NewAccount(names[i], mnemonics[i], "", sdktypes.FullFundraiserPath, hd.Secp256k1) if err != nil { return ZetaTxServer{}, fmt.Errorf("failed to create account: %s", err.Error()) } - _, err = r.GetAddress() + accAddr, err := r.GetAddress() if err != nil { return ZetaTxServer{}, fmt.Errorf("failed to get account address: %s", err.Error()) } - //fmt.Printf( - // "Added account for Zeta tx server\nname: %s\nmnemonic: %s\naddress: %s\n", - // names[i], - // mnemonics[i], - // addr.String(), - //) + + addresses = append(addresses, accAddr.String()) } - clientCtx := newContext(rpc, cdc, reg, kr) + clientCtx := newContext(rpc, cdc, reg, kr, chainID) txf := newFactory(clientCtx) return ZetaTxServer{ clientCtx: clientCtx, txFactory: txf, + name: names, + mnemonic: mnemonics, + address: addresses, }, nil } +// GetAccountName returns the account name from the given index +// returns empty string if index is out of bound, error should be handled by caller +func (zts ZetaTxServer) GetAccountName(index int) string { + if index >= len(zts.name) { + return "" + } + return zts.name[index] +} + +// GetAccountAddress returns the account address from the given index +// returns empty string if index is out of bound, error should be handled by caller +func (zts ZetaTxServer) GetAccountAddress(index int) string { + if index >= len(zts.address) { + return "" + } + return zts.address[index] +} + +// GetAccountMnemonic returns the account name from the given index +// returns empty string if index is out of bound, error should be handled by caller +func (zts ZetaTxServer) GetAccountMnemonic(index int) string { + if index >= len(zts.mnemonic) { + return "" + } + return zts.mnemonic[index] +} + // BroadcastTx broadcasts a tx to ZetaChain with the provided msg from the account func (zts ZetaTxServer) BroadcastTx(account string, msg sdktypes.Msg) (*sdktypes.TxResponse, error) { // Find number and sequence and set it @@ -130,6 +166,103 @@ func (zts ZetaTxServer) BroadcastTx(account string, msg sdktypes.Msg) (*sdktypes return zts.clientCtx.BroadcastTx(txBytes) } +// DeploySystemContractsAndZRC20 deploys the system contracts and ZRC20 contracts +// returns the addresses of uniswap factory, router and usdt zrc20 +func (zts ZetaTxServer) DeploySystemContractsAndZRC20(account, usdtERC20Addr string) (string, string, string, error) { + // retrieve account + acc, err := zts.clientCtx.Keyring.Key(account) + if err != nil { + return "", "", "", err + } + addr, err := acc.GetAddress() + if err != nil { + return "", "", "", err + } + + // deploy new system contracts + res, err := zts.BroadcastTx(account, fungibletypes.NewMsgDeploySystemContracts(addr.String())) + if err != nil { + return "", "", "", fmt.Errorf("failed to deploy system contracts: %s", err.Error()) + } + fmt.Println("System contracts deployed") + + systemContractAddress, err := fetchAttribute(res, "system_contract") + if err != nil { + return "", "", "", fmt.Errorf("failed to fetch system contract address: %s; rawlog %s", err.Error(), res.RawLog) + } + + // set system contract + _, err = zts.BroadcastTx(account, fungibletypes.NewMsgUpdateSystemContract(addr.String(), systemContractAddress)) + if err != nil { + return "", "", "", fmt.Errorf("failed to set system contract: %s", err.Error()) + } + + // set uniswap contract addresses + uniswapV2FactoryAddr, err := fetchAttribute(res, "uniswap_v2_factory") + if err != nil { + return "", "", "", fmt.Errorf("failed to fetch uniswap v2 factory address: %s", err.Error()) + } + uniswapV2RouterAddr, err := fetchAttribute(res, "uniswap_v2_router") + if err != nil { + return "", "", "", fmt.Errorf("failed to fetch uniswap v2 router address: %s", err.Error()) + } + + // deploy eth zrc20 + _, err = zts.BroadcastTx(account, fungibletypes.NewMsgDeployFungibleCoinZRC20( + addr.String(), + "", + common.GoerliLocalnetChain().ChainId, + 18, + "ETH", + "gETH", + common.CoinType_Gas, + 1000000, + )) + if err != nil { + return "", "", "", fmt.Errorf("failed to deploy eth zrc20: %s", err.Error()) + } + + // deploy btc zrc20 + _, err = zts.BroadcastTx(account, fungibletypes.NewMsgDeployFungibleCoinZRC20( + addr.String(), + "", + common.BtcRegtestChain().ChainId, + 8, + "BTC", + "tBTC", + common.CoinType_Gas, + 1000000, + )) + if err != nil { + return "", "", "", fmt.Errorf("failed to deploy btc zrc20: %s", err.Error()) + } + + // deploy usdt zrc20 + res, err = zts.BroadcastTx(account, fungibletypes.NewMsgDeployFungibleCoinZRC20( + addr.String(), + usdtERC20Addr, + common.GoerliLocalnetChain().ChainId, + 6, + "USDT", + "USDT", + common.CoinType_ERC20, + 1000000, + )) + if err != nil { + return "", "", "", fmt.Errorf("failed to deploy usdt zrc20: %s", err.Error()) + } + + // fetch the usdt zrc20 contract address and remove the quotes + usdtZRC20Addr, err := fetchAttribute(res, "Contract") + if err != nil { + return "", "", "", fmt.Errorf("failed to fetch usdt zrc20 contract address: %s", err.Error()) + } + if !ethcommon.IsHexAddress(usdtZRC20Addr) { + return "", "", "", fmt.Errorf("invalid address in event: %s", usdtZRC20Addr) + } + return uniswapV2FactoryAddr, uniswapV2RouterAddr, usdtZRC20Addr, nil +} + // newCodec returns the codec for msg server func newCodec() (*codec.ProtoCodec, codectypes.InterfaceRegistry) { interfaceRegistry := codectypes.NewInterfaceRegistry() @@ -157,10 +290,16 @@ func newCodec() (*codec.ProtoCodec, codectypes.InterfaceRegistry) { } // newContext returns the client context for msg server -func newContext(rpc *rpchttp.HTTP, cdc *codec.ProtoCodec, reg codectypes.InterfaceRegistry, kr keyring.Keyring) client.Context { +func newContext( + rpc *rpchttp.HTTP, + cdc *codec.ProtoCodec, + reg codectypes.InterfaceRegistry, + kr keyring.Keyring, + chainID string, +) client.Context { txConfig := authtx.NewTxConfig(cdc, authtx.DefaultSignModes) return client.Context{}. - WithChainID(ZetaChainID). + WithChainID(chainID). WithInterfaceRegistry(reg). WithCodec(cdc). WithTxConfig(txConfig). @@ -181,10 +320,56 @@ func newFactory(clientCtx client.Context) tx.Factory { return tx.Factory{}. WithChainID(clientCtx.ChainID). WithKeybase(clientCtx.Keyring). - WithGas(300000). - WithGasAdjustment(1.0). + WithGas(10000000). + WithGasAdjustment(1). WithSignMode(signing.SignMode_SIGN_MODE_UNSPECIFIED). WithAccountRetriever(clientCtx.AccountRetriever). WithTxConfig(clientCtx.TxConfig). - WithFees("50azeta") + WithFees("100000000000000000azeta") +} + +type messageLog struct { + Events []event `json:"events"` +} + +type event struct { + Type string `json:"type"` + Attributes []attribute `json:"attributes"` +} + +type attribute struct { + Key string `json:"key"` + Value string `json:"value"` +} + +// fetchAttribute fetches the attribute from the tx response +func fetchAttribute(res *sdktypes.TxResponse, key string) (string, error) { + var logs []messageLog + err := json.Unmarshal([]byte(res.RawLog), &logs) + if err != nil { + return "", err + } + + var attributes []string + for _, log := range logs { + for _, event := range log.Events { + for _, attr := range event.Attributes { + attributes = append(attributes, attr.Key) + if strings.EqualFold(attr.Key, key) { + address := attr.Value + + if len(address) < 2 { + return "", fmt.Errorf("invalid address: %s", address) + } + + // trim the quotes + address = address[1 : len(address)-1] + + return address, nil + } + } + } + } + + return "", fmt.Errorf("attribute %s not found, attributes: %+v", key, attributes) } diff --git a/contrib/localnet/orchestrator/smoketest/utils.go b/contrib/localnet/orchestrator/smoketest/utils.go deleted file mode 100644 index 866dd8e413..0000000000 --- a/contrib/localnet/orchestrator/smoketest/utils.go +++ /dev/null @@ -1,136 +0,0 @@ -//go:build PRIVNET -// +build PRIVNET - -package main - -import ( - "context" - "encoding/hex" - "errors" - "fmt" - "sync" - "time" - - "github.com/btcsuite/btcd/chaincfg" - "github.com/btcsuite/btcutil" - "github.com/ethereum/go-ethereum" - ethcommon "github.com/ethereum/go-ethereum/common" - ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethclient" - rpchttp "github.com/tendermint/tendermint/rpc/client/http" - coretypes "github.com/tendermint/tendermint/rpc/core/types" - "github.com/zeta-chain/zetacore/x/crosschain/types" -) - -// WaitCctxMinedByInTxHash waits until cctx is mined; returns the cctxIndex (the last one) -func WaitCctxMinedByInTxHash(inTxHash string, cctxClient types.QueryClient) *types.CrossChainTx { - cctxs := WaitCctxsMinedByInTxHash(inTxHash, cctxClient) - return cctxs[len(cctxs)-1] -} - -// WaitCctxsMinedByInTxHash waits until cctx is mined; returns the cctxIndex (the last one) -func WaitCctxsMinedByInTxHash(inTxHash string, cctxClient types.QueryClient) []*types.CrossChainTx { - var cctxIndexes []string - for { - time.Sleep(5 * time.Second) - fmt.Printf("Waiting for cctx to be mined by inTxHash: %s\n", inTxHash) - res, err := cctxClient.InTxHashToCctx(context.Background(), &types.QueryGetInTxHashToCctxRequest{InTxHash: inTxHash}) - if err != nil { - fmt.Println("Error getting cctx by inTxHash: ", err.Error()) - continue - } - cctxIndexes = res.InTxHashToCctx.CctxIndex - fmt.Printf("Deposit receipt cctx index: %v\n", cctxIndexes) - break - } - var wg sync.WaitGroup - var cctxs []*types.CrossChainTx - for _, cctxIndex := range cctxIndexes { - wg.Add(1) - go func() { - defer wg.Done() - for { - time.Sleep(3 * time.Second) - res, err := cctxClient.Cctx(context.Background(), &types.QueryGetCctxRequest{Index: cctxIndex}) - if err == nil && IsTerminalStatus(res.CrossChainTx.CctxStatus.Status) { - fmt.Printf("Deposit receipt cctx status: %+v; The cctx is processed\n", res.CrossChainTx.CctxStatus.Status.String()) - cctxs = append(cctxs, res.CrossChainTx) - break - } else if err != nil { - fmt.Println("Error getting cctx by index: ", err.Error()) - } - } - }() - } - wg.Wait() - return cctxs -} - -func IsTerminalStatus(status types.CctxStatus) bool { - return status == types.CctxStatus_OutboundMined || status == types.CctxStatus_Aborted || status == types.CctxStatus_Reverted -} - -func LoudPrintf(format string, a ...any) { - fmt.Println("=======================================") - fmt.Printf(format, a...) - fmt.Println("=======================================") -} - -func CheckNonce(client *ethclient.Client, addr ethcommon.Address, expectedNonce uint64) error { - nonce, err := client.PendingNonceAt(context.Background(), addr) - if err != nil { - return err - } - if nonce != expectedNonce { - return fmt.Errorf("want nonce %d; got %d", expectedNonce, nonce) - } - return nil -} - -// MustWaitForTxReceipt waits until a broadcasted tx to be mined and return its receipt -// timeout and panic after 30s. -func MustWaitForTxReceipt(client *ethclient.Client, tx *ethtypes.Transaction) *ethtypes.Receipt { - start := time.Now() - for { - if time.Since(start) > 30*time.Second { - panic("waiting tx receipt timeout") - } - time.Sleep(1 * time.Second) - receipt, err := client.TransactionReceipt(context.Background(), tx.Hash()) - if err != nil { - if !errors.Is(err, ethereum.NotFound) { - fmt.Println("fetching tx receipt error: ", err.Error()) - } - continue - } - if receipt != nil { - return receipt - } - } -} - -// ScriptPKToAddress is a hex string for P2WPKH script -func ScriptPKToAddress(scriptPKHex string) string { - pkh, err := hex.DecodeString(scriptPKHex[4:]) - if err == nil { - addr, err := btcutil.NewAddressWitnessPubKeyHash(pkh, &chaincfg.RegressionNetParams) - if err == nil { - return addr.EncodeAddress() - } - } - return "" -} - -func WaitForBlockHeight(height int64) { - // initialize rpc and check status - rpc, err := rpchttp.New("http://zetacore0:26657", "/websocket") - if err != nil { - panic(err) - } - status := &coretypes.ResultStatus{} - for status.SyncInfo.LatestBlockHeight < height { - status, _ = rpc.Status(context.Background()) - time.Sleep(time.Second * 5) - fmt.Printf("waiting for block: %d, current height: %d\n", height, status.SyncInfo.LatestBlockHeight) - } -} diff --git a/contrib/localnet/orchestrator/smoketest/utils/evm.go b/contrib/localnet/orchestrator/smoketest/utils/evm.go new file mode 100644 index 0000000000..dae61543b4 --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/utils/evm.go @@ -0,0 +1,69 @@ +package utils + +import ( + "context" + "errors" + "fmt" + "time" + + "github.com/ethereum/go-ethereum" + ethcommon "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/rpc" +) + +func CheckNonce(client *ethclient.Client, addr ethcommon.Address, expectedNonce uint64) error { + nonce, err := client.PendingNonceAt(context.Background(), addr) + if err != nil { + return err + } + if nonce != expectedNonce { + return fmt.Errorf("want nonce %d; got %d", expectedNonce, nonce) + } + return nil +} + +// MustWaitForTxReceipt waits until a broadcasted tx to be mined and return its receipt +// timeout and panic after 30s. +func MustWaitForTxReceipt(client *ethclient.Client, tx *ethtypes.Transaction) *ethtypes.Receipt { + start := time.Now() + for { + if time.Since(start) > 30*time.Second { + panic("waiting tx receipt timeout") + } + time.Sleep(1 * time.Second) + receipt, err := client.TransactionReceipt(context.Background(), tx.Hash()) + if err != nil { + if !errors.Is(err, ethereum.NotFound) { + fmt.Println("fetching tx receipt error: ", err.Error()) + } + continue + } + if receipt != nil { + return receipt + } + } +} + +// TraceTx traces the tx and returns the trace result +func TraceTx(tx *ethtypes.Transaction, rpcURL string) (string, error) { + rpcClient, err := rpc.Dial(rpcURL) + if err != nil { + return "", err + } + + var result interface{} + txHash := tx.Hash().Hex() + err = rpcClient.CallContext(context.Background(), &result, "debug_traceTransaction", txHash, map[string]interface{}{ + "disableMemory": true, + "disableStack": false, + "disableStorage": false, + "fullStorage": false, + }) + if err != nil { + return "", err + } + + return fmt.Sprintf("Trace result: %+v\n", result), nil +} diff --git a/contrib/localnet/orchestrator/smoketest/utils/utils.go b/contrib/localnet/orchestrator/smoketest/utils/utils.go new file mode 100644 index 0000000000..321df2d549 --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/utils/utils.go @@ -0,0 +1,27 @@ +package utils + +import ( + "encoding/hex" + "fmt" + + "github.com/btcsuite/btcd/chaincfg" + "github.com/btcsuite/btcutil" +) + +// ScriptPKToAddress is a hex string for P2WPKH script +func ScriptPKToAddress(scriptPKHex string) string { + pkh, err := hex.DecodeString(scriptPKHex[4:]) + if err == nil { + addr, err := btcutil.NewAddressWitnessPubKeyHash(pkh, &chaincfg.RegressionNetParams) + if err == nil { + return addr.EncodeAddress() + } + } + return "" +} + +func LoudPrintf(format string, a ...any) { + fmt.Println("=======================================") + fmt.Printf(format, a...) + fmt.Println("=======================================") +} diff --git a/contrib/localnet/orchestrator/smoketest/utils/zetacore.go b/contrib/localnet/orchestrator/smoketest/utils/zetacore.go new file mode 100644 index 0000000000..b4647366f6 --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/utils/zetacore.go @@ -0,0 +1,94 @@ +package utils + +import ( + "context" + "fmt" + "sync" + "time" + + rpchttp "github.com/tendermint/tendermint/rpc/client/http" + coretypes "github.com/tendermint/tendermint/rpc/core/types" + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +const ( + FungibleAdminName = "fungibleadmin" +) + +// WaitCctxMinedByInTxHash waits until cctx is mined; returns the cctxIndex (the last one) +func WaitCctxMinedByInTxHash(inTxHash string, cctxClient crosschaintypes.QueryClient) *crosschaintypes.CrossChainTx { + cctxs := WaitCctxsMinedByInTxHash(inTxHash, cctxClient, 1) + return cctxs[len(cctxs)-1] +} + +// WaitCctxsMinedByInTxHash waits until cctx is mined; returns the cctxIndex (the last one) +func WaitCctxsMinedByInTxHash(inTxHash string, cctxClient crosschaintypes.QueryClient, cctxsCount int) []*crosschaintypes.CrossChainTx { + var cctxIndexes []string + for { + time.Sleep(5 * time.Second) + fmt.Printf("Waiting for cctx to be mined by inTxHash: %s\n", inTxHash) + res, err := cctxClient.InTxHashToCctx(context.Background(), &crosschaintypes.QueryGetInTxHashToCctxRequest{InTxHash: inTxHash}) + if err != nil { + fmt.Println("Error getting cctx by inTxHash: ", err.Error()) + continue + } + if len(res.InTxHashToCctx.CctxIndex) < cctxsCount { + fmt.Printf("Waiting for %d cctxs to be mined; %d cctxs are mined\n", cctxsCount, len(res.InTxHashToCctx.CctxIndex)) + continue + } + cctxIndexes = res.InTxHashToCctx.CctxIndex + fmt.Printf("Deposit receipt cctx index: %v\n", cctxIndexes) + break + } + var wg sync.WaitGroup + var cctxs []*crosschaintypes.CrossChainTx + for _, cctxIndex := range cctxIndexes { + cctxIndex := cctxIndex + wg.Add(1) + go func() { + defer wg.Done() + for { + time.Sleep(3 * time.Second) + res, err := cctxClient.Cctx(context.Background(), &crosschaintypes.QueryGetCctxRequest{Index: cctxIndex}) + if err == nil && IsTerminalStatus(res.CrossChainTx.CctxStatus.Status) { + fmt.Printf("Deposit receipt cctx status: %+v; The cctx is processed\n", res.CrossChainTx.CctxStatus.Status.String()) + cctxs = append(cctxs, res.CrossChainTx) + break + } else if err != nil { + fmt.Println("Error getting cctx by index: ", err.Error()) + } else { + cctxStatus := res.CrossChainTx.CctxStatus + fmt.Printf( + "Deposit receipt cctx status: %s; Message: %s; Waiting for the cctx to be processed\n", + cctxStatus.Status.String(), + cctxStatus.StatusMessage, + ) + } + } + }() + } + wg.Wait() + return cctxs +} + +func IsTerminalStatus(status crosschaintypes.CctxStatus) bool { + return status == crosschaintypes.CctxStatus_OutboundMined || status == crosschaintypes.CctxStatus_Aborted || status == crosschaintypes.CctxStatus_Reverted +} + +// WaitForBlockHeight waits until the block height reaches the given height +func WaitForBlockHeight(height int64, rpcURL string) { + // initialize rpc and check status + rpc, err := rpchttp.New(rpcURL, "/websocket") + if err != nil { + panic(err) + } + status := &coretypes.ResultStatus{} + for status.SyncInfo.LatestBlockHeight < height { + status, err = rpc.Status(context.Background()) + if err != nil { + panic(err) + } + time.Sleep(time.Second * 5) + fmt.Printf("waiting for block: %d, current height: %d\n", height, status.SyncInfo.LatestBlockHeight) + } +} diff --git a/contrib/localnet/scripts/genesis.sh b/contrib/localnet/scripts/genesis.sh index b9d3209588..cd187d39b8 100755 --- a/contrib/localnet/scripts/genesis.sh +++ b/contrib/localnet/scripts/genesis.sh @@ -89,6 +89,7 @@ then cat $HOME/.zetacored/config/genesis.json | jq '.app_state["evm"]["params"]["evm_denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json cat $HOME/.zetacored/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="500000000"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json cat $HOME/.zetacored/config/genesis.json | jq '.app_state["gov"]["voting_params"]["voting_period"]="100s"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json + cat $HOME/.zetacored/config/genesis.json | jq '.app_state["feemarket"]["params"]["min_gas_price"]="10000000000.0000"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json # set admin account zetacored add-genesis-account zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk 100000000000000000000000000azeta @@ -96,7 +97,7 @@ then cat $HOME/.zetacored/config/genesis.json | jq '.app_state["observer"]["params"]["admin_policy"][1]["address"]="zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json # 3. Copy the genesis.json to all the nodes .And use it to create a gentx for every node - zetacored gentx operator 1000000000000000000000azeta --chain-id=$CHAINID --keyring-backend=$KEYRING + zetacored gentx operator 1000000000000000000000azeta --chain-id=$CHAINID --keyring-backend=$KEYRING --gas-prices 20000000000azeta # Copy host gentx to other nodes for NODE in "${NODELIST[@]}"; do ssh $NODE mkdir -p ~/.zetacored/config/gentx/peer/ diff --git a/contrib/localnet/zetacored/zetacored_zetacore0/config/genesis.json b/contrib/localnet/zetacored/zetacored_zetacore0/config/genesis.json index 52ac2072b8..87916c2d09 100644 --- a/contrib/localnet/zetacored/zetacored_zetacore0/config/genesis.json +++ b/contrib/localnet/zetacored/zetacored_zetacore0/config/genesis.json @@ -274,7 +274,7 @@ "elasticity_multiplier": 2, "enable_height": "0", "base_fee": "1000000000", - "min_gas_price": "0.000000000000000000", + "min_gas_price": "10000000000.0", "min_gas_multiplier": "0.500000000000000000" }, "block_gas": "0" diff --git a/contrib/localnet/zetacored/zetacored_zetacore1/config/genesis.json b/contrib/localnet/zetacored/zetacored_zetacore1/config/genesis.json index 52ac2072b8..87916c2d09 100644 --- a/contrib/localnet/zetacored/zetacored_zetacore1/config/genesis.json +++ b/contrib/localnet/zetacored/zetacored_zetacore1/config/genesis.json @@ -274,7 +274,7 @@ "elasticity_multiplier": 2, "enable_height": "0", "base_fee": "1000000000", - "min_gas_price": "0.000000000000000000", + "min_gas_price": "10000000000.0", "min_gas_multiplier": "0.500000000000000000" }, "block_gas": "0" diff --git a/contrib/rpctest/main.go b/contrib/rpctest/main.go index 7d314bc888..202c4bb236 100644 --- a/contrib/rpctest/main.go +++ b/contrib/rpctest/main.go @@ -21,7 +21,7 @@ import ( ) var ( - // #nosec + // #nosec G101 - used for testing only ZetaEthPriv = "9D00E4D7A8A14384E01CD90B83745BCA847A66AD8797A9904A200C28C2648E64" SystemContractAddress = "0x91d18e54DAf4F677cB28167158d6dd21F6aB3921" ) @@ -86,12 +86,10 @@ func main() { if resp.Error != nil { fmt.Printf("Error: %s (code %d)\n", resp.Error.Message, resp.Error.Code) panic(resp.Error.Message) - } else { - //fmt.Printf("Result: %s\n", string(resp.Result)) - err = json.Unmarshal(resp.Result, &jsonObject) - if err != nil { - panic(err) - } + } + err = json.Unmarshal(resp.Result, &jsonObject) + if err != nil { + panic(err) } txs, ok := jsonObject["transactions"].([]interface{}) @@ -154,23 +152,24 @@ func main() { if err != nil { panic(err) } + fmt.Printf("Deploy EthZeta Contract Receipt: %+v\n", receipt) receipt2 := client.EthGetTransactionReceipt(tx2.Hash().Hex()) if receipt2.Error != nil { fmt.Printf("Error: %s (code %d)\n", receipt2.Error.Message, receipt2.Error.Code) panic(tx.Error.Message) - } else { - jsonObject = make(map[string]interface{}) - err = json.Unmarshal(receipt2.Result, &jsonObject) - if err != nil { - panic(err) - } - prettyJSON, err := json.MarshalIndent(jsonObject, "", " ") - if err != nil { - panic(err) - } - fmt.Printf("Result: %s\n", string(prettyJSON)) } + jsonObject = make(map[string]interface{}) + err = json.Unmarshal(receipt2.Result, &jsonObject) + if err != nil { + panic(err) + } + prettyJSON, err := json.MarshalIndent(jsonObject, "", " ") + if err != nil { + panic(err) + } + fmt.Printf("Result: %s\n", string(prettyJSON)) + fmt.Printf("ZetaEth Contract Address: %s\n", zetaContractAddress.Hex()) if zetaContractAddress != receipt.ContractAddress { panic(fmt.Sprintf("Contract address mismatch: wanted %s, got %s", zetaContractAddress, receipt.ContractAddress)) @@ -285,7 +284,8 @@ func (c *EthClient) EthGetBlockByNumber(blockNum uint64, verbose bool) *Response if err != nil { panic(err) } - defer resp.Body.Close() //#nosec + // #nosec G107 - defer close + defer resp.Body.Close() // Decode the response from JSON var rpcResp Response err = json.NewDecoder(resp.Body).Decode(&rpcResp) @@ -326,7 +326,8 @@ func (c *EthClient) EthGetTransactionReceipt(txhash string) *Response { if err != nil { panic(err) } - defer resp.Body.Close() //#nosec + // #nosec G107 - defer close + defer resp.Body.Close() // Decode the response from JSON var rpcResp Response err = json.NewDecoder(resp.Body).Decode(&rpcResp) @@ -367,7 +368,8 @@ func (c *EthClient) EthGetLogs() { //if err != nil { // panic(err) //} - //defer resp.Body.Close() //#nosec + //// #nosec G107 - defer close + //defer resp.Body.Close() //// Decode the response from JSON //var rpcResp Response //err = json.NewDecoder(resp.Body).Decode(&rpcResp) diff --git a/docs/cli/zetacored/zetacored_query_crosschain.md b/docs/cli/zetacored/zetacored_query_crosschain.md index 0ccdb37d15..0f973fe712 100644 --- a/docs/cli/zetacored/zetacored_query_crosschain.md +++ b/docs/cli/zetacored/zetacored_query_crosschain.md @@ -25,24 +25,19 @@ zetacored query crosschain [flags] ### SEE ALSO * [zetacored query](zetacored_query.md) - Querying subcommands -* [zetacored query crosschain get-tss-address](zetacored_query_crosschain_get-tss-address.md) - Query current tss address +* [zetacored query crosschain get-zeta-accounting](zetacored_query_crosschain_get-zeta-accounting.md) - Query zeta accounting * [zetacored query crosschain in-tx-hash-to-cctx-data](zetacored_query_crosschain_in-tx-hash-to-cctx-data.md) - query a cctx data from a in tx hash * [zetacored query crosschain last-zeta-height](zetacored_query_crosschain_last-zeta-height.md) - Query last Zeta Height * [zetacored query crosschain list-all-in-tx-trackers](zetacored_query_crosschain_list-all-in-tx-trackers.md) - shows all inTxTrackers * [zetacored query crosschain list-cctx](zetacored_query_crosschain_list-cctx.md) - list all CCTX -* [zetacored query crosschain list-chain-nonces](zetacored_query_crosschain_list-chain-nonces.md) - list all chainNonces * [zetacored query crosschain list-gas-price](zetacored_query_crosschain_list-gas-price.md) - list all gasPrice * [zetacored query crosschain list-in-tx-hash-to-cctx](zetacored_query_crosschain_list-in-tx-hash-to-cctx.md) - list all inTxHashToCctx * [zetacored query crosschain list-in-tx-tracker](zetacored_query_crosschain_list-in-tx-tracker.md) - shows a list of in tx tracker by chainId * [zetacored query crosschain list-out-tx-tracker](zetacored_query_crosschain_list-out-tx-tracker.md) - list all OutTxTracker * [zetacored query crosschain list-pending-cctx](zetacored_query_crosschain_list-pending-cctx.md) - shows pending CCTX -* [zetacored query crosschain list-pending-nonces](zetacored_query_crosschain_list-pending-nonces.md) - shows a chainNonces -* [zetacored query crosschain list-tss-history](zetacored_query_crosschain_list-tss-history.md) - show historical list of TSS * [zetacored query crosschain params](zetacored_query_crosschain_params.md) - shows the parameters of the module * [zetacored query crosschain show-cctx](zetacored_query_crosschain_show-cctx.md) - shows a CCTX -* [zetacored query crosschain show-chain-nonces](zetacored_query_crosschain_show-chain-nonces.md) - shows a chainNonces * [zetacored query crosschain show-gas-price](zetacored_query_crosschain_show-gas-price.md) - shows a gasPrice * [zetacored query crosschain show-in-tx-hash-to-cctx](zetacored_query_crosschain_show-in-tx-hash-to-cctx.md) - shows a inTxHashToCctx * [zetacored query crosschain show-out-tx-tracker](zetacored_query_crosschain_show-out-tx-tracker.md) - shows a OutTxTracker -* [zetacored query crosschain show-tss](zetacored_query_crosschain_show-tss.md) - shows a TSS diff --git a/docs/cli/zetacored/zetacored_query_crosschain_list-tss-history.md b/docs/cli/zetacored/zetacored_query_crosschain_get-zeta-accounting.md similarity index 84% rename from docs/cli/zetacored/zetacored_query_crosschain_list-tss-history.md rename to docs/cli/zetacored/zetacored_query_crosschain_get-zeta-accounting.md index 47af816847..589865d868 100644 --- a/docs/cli/zetacored/zetacored_query_crosschain_list-tss-history.md +++ b/docs/cli/zetacored/zetacored_query_crosschain_get-zeta-accounting.md @@ -1,9 +1,9 @@ -# query crosschain list-tss-history +# query crosschain get-zeta-accounting -show historical list of TSS +Query zeta accounting ``` -zetacored query crosschain list-tss-history [flags] +zetacored query crosschain get-zeta-accounting [flags] ``` ### Options @@ -12,7 +12,7 @@ zetacored query crosschain list-tss-history [flags] --grpc-addr string the gRPC endpoint to use for this chain --grpc-insecure allow gRPC over insecure channels, if not TLS the server must use TLS --height int Use a specific height to query state at (this can error if the node is pruning state) - -h, --help help for list-tss-history + -h, --help help for get-zeta-accounting --node string [host]:[port] to Tendermint RPC interface for this chain -o, --output string Output format (text|json) ``` diff --git a/docs/cli/zetacored/zetacored_query_crosschain_list-pending-cctx.md b/docs/cli/zetacored/zetacored_query_crosschain_list-pending-cctx.md index 3ac808d77c..7a886b8ec3 100644 --- a/docs/cli/zetacored/zetacored_query_crosschain_list-pending-cctx.md +++ b/docs/cli/zetacored/zetacored_query_crosschain_list-pending-cctx.md @@ -3,7 +3,7 @@ shows pending CCTX ``` -zetacored query crosschain list-pending-cctx [chain-id] [flags] +zetacored query crosschain list-pending-cctx [chain-id] [limit] [flags] ``` ### Options diff --git a/docs/cli/zetacored/zetacored_query_fungible.md b/docs/cli/zetacored/zetacored_query_fungible.md index 284cd10e17..52d7ccc81e 100644 --- a/docs/cli/zetacored/zetacored_query_fungible.md +++ b/docs/cli/zetacored/zetacored_query_fungible.md @@ -25,6 +25,7 @@ zetacored query fungible [flags] ### SEE ALSO * [zetacored query](zetacored_query.md) - Querying subcommands +* [zetacored query fungible code-hash](zetacored_query_fungible_code-hash.md) - shows the code hash of an account * [zetacored query fungible gas-stability-pool-address](zetacored_query_fungible_gas-stability-pool-address.md) - query the address of a gas stability pool * [zetacored query fungible gas-stability-pool-balance](zetacored_query_fungible_gas-stability-pool-balance.md) - query the balance of a gas stability pool for a chain * [zetacored query fungible gas-stability-pool-balances](zetacored_query_fungible_gas-stability-pool-balances.md) - query all gas stability pool balances diff --git a/docs/cli/zetacored/zetacored_query_fungible_code-hash.md b/docs/cli/zetacored/zetacored_query_fungible_code-hash.md new file mode 100644 index 0000000000..8072fa760c --- /dev/null +++ b/docs/cli/zetacored/zetacored_query_fungible_code-hash.md @@ -0,0 +1,33 @@ +# query fungible code-hash + +shows the code hash of an account + +``` +zetacored query fungible code-hash [address] [flags] +``` + +### Options + +``` + --grpc-addr string the gRPC endpoint to use for this chain + --grpc-insecure allow gRPC over insecure channels, if not TLS the server must use TLS + --height int Use a specific height to query state at (this can error if the node is pruning state) + -h, --help help for code-hash + --node string [host]:[port] to Tendermint RPC interface for this chain + -o, --output string Output format (text|json) +``` + +### Options inherited from parent commands + +``` + --chain-id string The network chain ID + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored query fungible](zetacored_query_fungible.md) - Querying commands for the fungible module + diff --git a/docs/cli/zetacored/zetacored_query_observer.md b/docs/cli/zetacored/zetacored_query_observer.md index 609b81f31f..73492a3bf1 100644 --- a/docs/cli/zetacored/zetacored_query_observer.md +++ b/docs/cli/zetacored/zetacored_query_observer.md @@ -25,19 +25,26 @@ zetacored query observer [flags] ### SEE ALSO * [zetacored query](zetacored_query.md) - Querying subcommands +* [zetacored query observer get-historical-tss-address](zetacored_query_observer_get-historical-tss-address.md) - Query tss address by finalized zeta height (for historical tss addresses) +* [zetacored query observer get-tss-address](zetacored_query_observer_get-tss-address.md) - Query current tss address * [zetacored query observer list-blame](zetacored_query_observer_list-blame.md) - Query AllBlameRecords * [zetacored query observer list-blame-by-msg](zetacored_query_observer_list-blame-by-msg.md) - Query AllBlameRecords +* [zetacored query observer list-chain-nonces](zetacored_query_observer_list-chain-nonces.md) - list all chainNonces * [zetacored query observer list-chains](zetacored_query_observer_list-chains.md) - list all SupportedChains * [zetacored query observer list-core-params](zetacored_query_observer_list-core-params.md) - Query GetCoreParams * [zetacored query observer list-node-account](zetacored_query_observer_list-node-account.md) - list all NodeAccount * [zetacored query observer list-observer](zetacored_query_observer_list-observer.md) - Query All Observer Mappers +* [zetacored query observer list-pending-nonces](zetacored_query_observer_list-pending-nonces.md) - shows a chainNonces +* [zetacored query observer list-tss-history](zetacored_query_observer_list-tss-history.md) - show historical list of TSS * [zetacored query observer params](zetacored_query_observer_params.md) - shows the parameters of the module * [zetacored query observer show-ballot](zetacored_query_observer_show-ballot.md) - Query BallotByIdentifier * [zetacored query observer show-blame](zetacored_query_observer_show-blame.md) - Query BlameByIdentifier +* [zetacored query observer show-chain-nonces](zetacored_query_observer_show-chain-nonces.md) - shows a chainNonces * [zetacored query observer show-core-params](zetacored_query_observer_show-core-params.md) - Query GetCoreParamsForChain * [zetacored query observer show-crosschain-flags](zetacored_query_observer_show-crosschain-flags.md) - shows the crosschain flags * [zetacored query observer show-keygen](zetacored_query_observer_show-keygen.md) - shows keygen * [zetacored query observer show-node-account](zetacored_query_observer_show-node-account.md) - shows a NodeAccount * [zetacored query observer show-observer](zetacored_query_observer_show-observer.md) - Query ObserversByChainAndType , Use common.chain for querying * [zetacored query observer show-observer-count](zetacored_query_observer_show-observer-count.md) - Query show-observer-count +* [zetacored query observer show-tss](zetacored_query_observer_show-tss.md) - shows a TSS diff --git a/docs/cli/zetacored/zetacored_query_observer_get-historical-tss-address.md b/docs/cli/zetacored/zetacored_query_observer_get-historical-tss-address.md new file mode 100644 index 0000000000..83de26b9dd --- /dev/null +++ b/docs/cli/zetacored/zetacored_query_observer_get-historical-tss-address.md @@ -0,0 +1,33 @@ +# query observer get-historical-tss-address + +Query tss address by finalized zeta height (for historical tss addresses) + +``` +zetacored query observer get-historical-tss-address [finalizedZetaHeight] [flags] +``` + +### Options + +``` + --grpc-addr string the gRPC endpoint to use for this chain + --grpc-insecure allow gRPC over insecure channels, if not TLS the server must use TLS + --height int Use a specific height to query state at (this can error if the node is pruning state) + -h, --help help for get-historical-tss-address + --node string [host]:[port] to Tendermint RPC interface for this chain + -o, --output string Output format (text|json) +``` + +### Options inherited from parent commands + +``` + --chain-id string The network chain ID + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored query observer](zetacored_query_observer.md) - Querying commands for the observer module + diff --git a/docs/cli/zetacored/zetacored_query_crosschain_get-tss-address.md b/docs/cli/zetacored/zetacored_query_observer_get-tss-address.md similarity index 81% rename from docs/cli/zetacored/zetacored_query_crosschain_get-tss-address.md rename to docs/cli/zetacored/zetacored_query_observer_get-tss-address.md index b75dbc1079..cb763f8510 100644 --- a/docs/cli/zetacored/zetacored_query_crosschain_get-tss-address.md +++ b/docs/cli/zetacored/zetacored_query_observer_get-tss-address.md @@ -1,9 +1,9 @@ -# query crosschain get-tss-address +# query observer get-tss-address Query current tss address ``` -zetacored query crosschain get-tss-address [tss-pubkey] [flags] +zetacored query observer get-tss-address [flags] ``` ### Options @@ -29,5 +29,5 @@ zetacored query crosschain get-tss-address [tss-pubkey] [flags] ### SEE ALSO -* [zetacored query crosschain](zetacored_query_crosschain.md) - Querying commands for the crosschain module +* [zetacored query observer](zetacored_query_observer.md) - Querying commands for the observer module diff --git a/docs/cli/zetacored/zetacored_query_crosschain_list-chain-nonces.md b/docs/cli/zetacored/zetacored_query_observer_list-chain-nonces.md similarity index 87% rename from docs/cli/zetacored/zetacored_query_crosschain_list-chain-nonces.md rename to docs/cli/zetacored/zetacored_query_observer_list-chain-nonces.md index 5fa031861b..b11ee00a5a 100644 --- a/docs/cli/zetacored/zetacored_query_crosschain_list-chain-nonces.md +++ b/docs/cli/zetacored/zetacored_query_observer_list-chain-nonces.md @@ -1,9 +1,9 @@ -# query crosschain list-chain-nonces +# query observer list-chain-nonces list all chainNonces ``` -zetacored query crosschain list-chain-nonces [flags] +zetacored query observer list-chain-nonces [flags] ``` ### Options @@ -35,5 +35,5 @@ zetacored query crosschain list-chain-nonces [flags] ### SEE ALSO -* [zetacored query crosschain](zetacored_query_crosschain.md) - Querying commands for the crosschain module +* [zetacored query observer](zetacored_query_observer.md) - Querying commands for the observer module diff --git a/docs/cli/zetacored/zetacored_query_crosschain_list-pending-nonces.md b/docs/cli/zetacored/zetacored_query_observer_list-pending-nonces.md similarity index 81% rename from docs/cli/zetacored/zetacored_query_crosschain_list-pending-nonces.md rename to docs/cli/zetacored/zetacored_query_observer_list-pending-nonces.md index 0e45b9d2c1..c4828f8b9e 100644 --- a/docs/cli/zetacored/zetacored_query_crosschain_list-pending-nonces.md +++ b/docs/cli/zetacored/zetacored_query_observer_list-pending-nonces.md @@ -1,9 +1,9 @@ -# query crosschain list-pending-nonces +# query observer list-pending-nonces shows a chainNonces ``` -zetacored query crosschain list-pending-nonces [flags] +zetacored query observer list-pending-nonces [flags] ``` ### Options @@ -29,5 +29,5 @@ zetacored query crosschain list-pending-nonces [flags] ### SEE ALSO -* [zetacored query crosschain](zetacored_query_crosschain.md) - Querying commands for the crosschain module +* [zetacored query observer](zetacored_query_observer.md) - Querying commands for the observer module diff --git a/docs/cli/zetacored/zetacored_query_observer_list-tss-history.md b/docs/cli/zetacored/zetacored_query_observer_list-tss-history.md new file mode 100644 index 0000000000..3b59d8a246 --- /dev/null +++ b/docs/cli/zetacored/zetacored_query_observer_list-tss-history.md @@ -0,0 +1,33 @@ +# query observer list-tss-history + +show historical list of TSS + +``` +zetacored query observer list-tss-history [flags] +``` + +### Options + +``` + --grpc-addr string the gRPC endpoint to use for this chain + --grpc-insecure allow gRPC over insecure channels, if not TLS the server must use TLS + --height int Use a specific height to query state at (this can error if the node is pruning state) + -h, --help help for list-tss-history + --node string [host]:[port] to Tendermint RPC interface for this chain + -o, --output string Output format (text|json) +``` + +### Options inherited from parent commands + +``` + --chain-id string The network chain ID + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored query observer](zetacored_query_observer.md) - Querying commands for the observer module + diff --git a/docs/cli/zetacored/zetacored_query_crosschain_show-chain-nonces.md b/docs/cli/zetacored/zetacored_query_observer_show-chain-nonces.md similarity index 81% rename from docs/cli/zetacored/zetacored_query_crosschain_show-chain-nonces.md rename to docs/cli/zetacored/zetacored_query_observer_show-chain-nonces.md index cca85f76cf..682858735f 100644 --- a/docs/cli/zetacored/zetacored_query_crosschain_show-chain-nonces.md +++ b/docs/cli/zetacored/zetacored_query_observer_show-chain-nonces.md @@ -1,9 +1,9 @@ -# query crosschain show-chain-nonces +# query observer show-chain-nonces shows a chainNonces ``` -zetacored query crosschain show-chain-nonces [index] [flags] +zetacored query observer show-chain-nonces [index] [flags] ``` ### Options @@ -29,5 +29,5 @@ zetacored query crosschain show-chain-nonces [index] [flags] ### SEE ALSO -* [zetacored query crosschain](zetacored_query_crosschain.md) - Querying commands for the crosschain module +* [zetacored query observer](zetacored_query_observer.md) - Querying commands for the observer module diff --git a/docs/cli/zetacored/zetacored_query_crosschain_show-tss.md b/docs/cli/zetacored/zetacored_query_observer_show-tss.md similarity index 83% rename from docs/cli/zetacored/zetacored_query_crosschain_show-tss.md rename to docs/cli/zetacored/zetacored_query_observer_show-tss.md index 7fc0f687d3..38f1057671 100644 --- a/docs/cli/zetacored/zetacored_query_crosschain_show-tss.md +++ b/docs/cli/zetacored/zetacored_query_observer_show-tss.md @@ -1,9 +1,9 @@ -# query crosschain show-tss +# query observer show-tss shows a TSS ``` -zetacored query crosschain show-tss [flags] +zetacored query observer show-tss [flags] ``` ### Options @@ -29,5 +29,5 @@ zetacored query crosschain show-tss [flags] ### SEE ALSO -* [zetacored query crosschain](zetacored_query_crosschain.md) - Querying commands for the crosschain module +* [zetacored query observer](zetacored_query_observer.md) - Querying commands for the observer module diff --git a/docs/cli/zetacored/zetacored_tx_crosschain.md b/docs/cli/zetacored/zetacored_tx_crosschain.md index d74024b3ea..a7e2465ab1 100644 --- a/docs/cli/zetacored/zetacored_tx_crosschain.md +++ b/docs/cli/zetacored/zetacored_tx_crosschain.md @@ -32,7 +32,6 @@ zetacored tx crosschain [flags] * [zetacored tx crosschain gas-price-voter](zetacored_tx_crosschain_gas-price-voter.md) - Broadcast message gasPriceVoter * [zetacored tx crosschain inbound-voter](zetacored_tx_crosschain_inbound-voter.md) - Broadcast message sendVoter * [zetacored tx crosschain migrate-tss-funds](zetacored_tx_crosschain_migrate-tss-funds.md) - Migrate TSS funds to the latest TSS address -* [zetacored tx crosschain nonce-voter](zetacored_tx_crosschain_nonce-voter.md) - Broadcast message nonceVoter * [zetacored tx crosschain outbound-voter](zetacored_tx_crosschain_outbound-voter.md) - Broadcast message receiveConfirmation * [zetacored tx crosschain remove-from-out-tx-tracker](zetacored_tx_crosschain_remove-from-out-tx-tracker.md) - Remove a out-tx-tracker * [zetacored tx crosschain update-tss-address](zetacored_tx_crosschain_update-tss-address.md) - Create a new TSSVoter diff --git a/docs/cli/zetacored/zetacored_tx_fungible.md b/docs/cli/zetacored/zetacored_tx_fungible.md index 0ba5834cd3..74f0d5a6a7 100644 --- a/docs/cli/zetacored/zetacored_tx_fungible.md +++ b/docs/cli/zetacored/zetacored_tx_fungible.md @@ -26,6 +26,9 @@ zetacored tx fungible [flags] * [zetacored tx](zetacored_tx.md) - Transactions subcommands * [zetacored tx fungible deploy-fungible-coin-zrc-4](zetacored_tx_fungible_deploy-fungible-coin-zrc-4.md) - Broadcast message DeployFungibleCoinZRC20 +* [zetacored tx fungible deploy-system-contracts](zetacored_tx_fungible_deploy-system-contracts.md) - Broadcast message SystemContracts * [zetacored tx fungible remove-foreign-coin](zetacored_tx_fungible_remove-foreign-coin.md) - Broadcast message RemoveForeignCoin +* [zetacored tx fungible update-contract-bytecode](zetacored_tx_fungible_update-contract-bytecode.md) - Broadcast message UpdateContractBytecode +* [zetacored tx fungible update-system-contract](zetacored_tx_fungible_update-system-contract.md) - Broadcast message UpdateSystemContract * [zetacored tx fungible update-zrc20-liquidity-cap](zetacored_tx_fungible_update-zrc20-liquidity-cap.md) - Broadcast message UpdateZRC20LiquidityCap diff --git a/docs/cli/zetacored/zetacored_tx_crosschain_nonce-voter.md b/docs/cli/zetacored/zetacored_tx_fungible_deploy-system-contracts.md similarity index 91% rename from docs/cli/zetacored/zetacored_tx_crosschain_nonce-voter.md rename to docs/cli/zetacored/zetacored_tx_fungible_deploy-system-contracts.md index edbd3c23e7..c9acde4799 100644 --- a/docs/cli/zetacored/zetacored_tx_crosschain_nonce-voter.md +++ b/docs/cli/zetacored/zetacored_tx_fungible_deploy-system-contracts.md @@ -1,9 +1,9 @@ -# tx crosschain nonce-voter +# tx fungible deploy-system-contracts -Broadcast message nonceVoter +Broadcast message SystemContracts ``` -zetacored tx crosschain nonce-voter [chain] [nonce] [flags] +zetacored tx fungible deploy-system-contracts [flags] ``` ### Options @@ -21,7 +21,7 @@ zetacored tx crosschain nonce-voter [chain] [nonce] [flags] --gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1) --gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom) --generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name) - -h, --help help for nonce-voter + -h, --help help for deploy-system-contracts --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) --keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used --ledger Use a connected Ledger device @@ -48,5 +48,5 @@ zetacored tx crosschain nonce-voter [chain] [nonce] [flags] ### SEE ALSO -* [zetacored tx crosschain](zetacored_tx_crosschain.md) - crosschain transactions subcommands +* [zetacored tx fungible](zetacored_tx_fungible.md) - fungible transactions subcommands diff --git a/docs/cli/zetacored/zetacored_tx_fungible_update-contract-bytecode.md b/docs/cli/zetacored/zetacored_tx_fungible_update-contract-bytecode.md new file mode 100644 index 0000000000..bc97a583b1 --- /dev/null +++ b/docs/cli/zetacored/zetacored_tx_fungible_update-contract-bytecode.md @@ -0,0 +1,52 @@ +# tx fungible update-contract-bytecode + +Broadcast message UpdateContractBytecode + +``` +zetacored tx fungible update-contract-bytecode [contract-address] [new-code-hash] [flags] +``` + +### Options + +``` + -a, --account-number uint The account number of the signing account (offline mode only) + --aux Generate aux signer data instead of sending a tx + -b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) + --dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible) + --fee-granter string Fee granter grants fees for the transaction + --fee-payer string Fee payer pays fees for the transaction instead of deducting from the signer + --fees string Fees to pay along with transaction; eg: 10uatom + --from string Name or address of private key with which to sign + --gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically. Note: "auto" option doesn't always report accurate results. Set a valid coin value to adjust the result. Can be used instead of "fees". (default 200000) + --gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1) + --gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom) + --generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name) + -h, --help help for update-contract-bytecode + --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) + --keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used + --ledger Use a connected Ledger device + --node string [host]:[port] to tendermint rpc interface for this chain + --note string Note to add a description to the transaction (previously --memo) + --offline Offline mode (does not allow any online functionality) + -o, --output string Output format (text|json) + -s, --sequence uint The sequence number of the signing account (offline mode only) + --sign-mode string Choose sign mode (direct|amino-json|direct-aux), this is an advanced feature + --timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height + --tip string Tip is the amount that is going to be transferred to the fee payer on the target chain. This flag is only valid when used with --aux, and is ignored if the target chain didn't enable the TipDecorator + -y, --yes Skip tx broadcasting prompt confirmation +``` + +### Options inherited from parent commands + +``` + --chain-id string The network chain ID + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored tx fungible](zetacored_tx_fungible.md) - fungible transactions subcommands + diff --git a/docs/cli/zetacored/zetacored_tx_fungible_update-system-contract.md b/docs/cli/zetacored/zetacored_tx_fungible_update-system-contract.md new file mode 100644 index 0000000000..c9a3e163ec --- /dev/null +++ b/docs/cli/zetacored/zetacored_tx_fungible_update-system-contract.md @@ -0,0 +1,52 @@ +# tx fungible update-system-contract + +Broadcast message UpdateSystemContract + +``` +zetacored tx fungible update-system-contract [contract-address] [flags] +``` + +### Options + +``` + -a, --account-number uint The account number of the signing account (offline mode only) + --aux Generate aux signer data instead of sending a tx + -b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) + --dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible) + --fee-granter string Fee granter grants fees for the transaction + --fee-payer string Fee payer pays fees for the transaction instead of deducting from the signer + --fees string Fees to pay along with transaction; eg: 10uatom + --from string Name or address of private key with which to sign + --gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically. Note: "auto" option doesn't always report accurate results. Set a valid coin value to adjust the result. Can be used instead of "fees". (default 200000) + --gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1) + --gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom) + --generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name) + -h, --help help for update-system-contract + --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) + --keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used + --ledger Use a connected Ledger device + --node string [host]:[port] to tendermint rpc interface for this chain + --note string Note to add a description to the transaction (previously --memo) + --offline Offline mode (does not allow any online functionality) + -o, --output string Output format (text|json) + -s, --sequence uint The sequence number of the signing account (offline mode only) + --sign-mode string Choose sign mode (direct|amino-json|direct-aux), this is an advanced feature + --timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height + --tip string Tip is the amount that is going to be transferred to the fee payer on the target chain. This flag is only valid when used with --aux, and is ignored if the target chain didn't enable the TipDecorator + -y, --yes Skip tx broadcasting prompt confirmation +``` + +### Options inherited from parent commands + +``` + --chain-id string The network chain ID + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored tx fungible](zetacored_tx_fungible.md) - fungible transactions subcommands + diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index 0256fdc9e7..2ae06c6b6d 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -26462,21 +26462,6 @@ paths: type: boolean tags: - Query - /zeta-chain/crosschain/TSS: - get: - summary: Queries a tSS by index. - operationId: Query_TSS - responses: - "200": - description: A successful response. - schema: - $ref: '#/definitions/crosschainQueryGetTSSResponse' - default: - description: An unexpected error response. - schema: - $ref: '#/definitions/googlerpcStatus' - tags: - - Query /zeta-chain/crosschain/cctx: get: summary: Queries a list of send items. @@ -26584,13 +26569,13 @@ paths: - Query /zeta-chain/crosschain/cctxPending: get: - summary: Queries a list of send items. - operationId: Query_CctxAllPending + summary: Queries a list of pending cctxs. + operationId: Query_CctxListPending responses: "200": description: A successful response. schema: - $ref: '#/definitions/crosschainQueryAllCctxPendingResponse' + $ref: '#/definitions/crosschainQueryListCctxPendingResponse' default: description: An unexpected error response. schema: @@ -26601,86 +26586,46 @@ paths: required: false type: string format: int64 - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: |- - offset is a numeric offset that can be used when key is unavailable. - It is less efficient than using key. Only one of offset or key should - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: |- - limit is the total number of results to be returned in the result page. - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: |- - count_total is set to true to indicate that the result set should include - a count of the total number of items available for pagination in UIs. - count_total is only respected when offset is used. It is ignored when key - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: |- - reverse is set to true if results are to be returned in the descending order. - - Since: cosmos-sdk 0.43 + - name: limit in: query required: false - type: boolean + type: integer + format: int64 tags: - Query - /zeta-chain/crosschain/cctxbyStatus/{status}: + /zeta-chain/crosschain/convertGasToZeta: get: - operationId: Query_CctxByStatus + operationId: Query_ConvertGasToZeta responses: "200": description: A successful response. schema: - $ref: '#/definitions/crosschainQueryCctxByStatusResponse' + $ref: '#/definitions/crosschainQueryConvertGasToZetaResponse' default: description: An unexpected error response. schema: $ref: '#/definitions/googlerpcStatus' parameters: - - name: status - in: path - required: true + - name: chainId + in: query + required: false + type: string + format: int64 + - name: gasLimit + in: query + required: false type: string - enum: - - PendingInbound - - PendingOutbound - - OutboundMined - - PendingRevert - - Reverted - - Aborted tags: - Query - /zeta-chain/crosschain/chainNonces: + /zeta-chain/crosschain/gasPrice: get: - summary: Queries a list of chainNonces items. - operationId: Query_ChainNoncesAll + summary: Queries a list of gasPrice items. + operationId: Query_GasPriceAll responses: "200": description: A successful response. schema: - $ref: '#/definitions/crosschainQueryAllChainNoncesResponse' + $ref: '#/definitions/crosschainQueryAllGasPriceResponse' default: description: An unexpected error response. schema: @@ -26731,15 +26676,15 @@ paths: type: boolean tags: - Query - /zeta-chain/crosschain/chainNonces/{index}: + /zeta-chain/crosschain/gasPrice/{index}: get: - summary: Queries a chainNonces by index. - operationId: Query_ChainNonces + summary: Queries a gasPrice by index. + operationId: Query_GasPrice responses: "200": description: A successful response. schema: - $ref: '#/definitions/crosschainQueryGetChainNoncesResponse' + $ref: '#/definitions/crosschainQueryGetGasPriceResponse' default: description: An unexpected error response. schema: @@ -26751,39 +26696,35 @@ paths: type: string tags: - Query - /zeta-chain/crosschain/convertGasToZeta: + /zeta-chain/crosschain/in_tx_hash_to_cctx_data/{inTxHash}: get: - operationId: Query_ConvertGasToZeta + summary: Queries a InTxHashToCctx data by index. + operationId: Query_InTxHashToCctxData responses: "200": description: A successful response. schema: - $ref: '#/definitions/crosschainQueryConvertGasToZetaResponse' + $ref: '#/definitions/crosschainQueryInTxHashToCctxDataResponse' default: description: An unexpected error response. schema: $ref: '#/definitions/googlerpcStatus' parameters: - - name: chainId - in: query - required: false - type: string - format: int64 - - name: gasLimit - in: query - required: false + - name: inTxHash + in: path + required: true type: string tags: - Query - /zeta-chain/crosschain/gasPrice: + /zeta-chain/crosschain/inTxHashToCctx: get: - summary: Queries a list of gasPrice items. - operationId: Query_GasPriceAll + summary: Queries a list of InTxHashToCctx items. + operationId: Query_InTxHashToCctxAll responses: "200": description: A successful response. schema: - $ref: '#/definitions/crosschainQueryAllGasPriceResponse' + $ref: '#/definitions/crosschainQueryAllInTxHashToCctxResponse' default: description: An unexpected error response. schema: @@ -26834,80 +26775,44 @@ paths: type: boolean tags: - Query - /zeta-chain/crosschain/gasPrice/{index}: + /zeta-chain/crosschain/inTxHashToCctx/{inTxHash}: get: - summary: Queries a gasPrice by index. - operationId: Query_GasPrice + summary: Queries a InTxHashToCctx by index. + operationId: Query_InTxHashToCctx responses: "200": description: A successful response. schema: - $ref: '#/definitions/crosschainQueryGetGasPriceResponse' + $ref: '#/definitions/crosschainQueryGetInTxHashToCctxResponse' default: description: An unexpected error response. schema: $ref: '#/definitions/googlerpcStatus' parameters: - - name: index + - name: inTxHash in: path required: true type: string tags: - Query - /zeta-chain/crosschain/get_tss_address: - get: - summary: Queries a list of GetTssAddress items. - operationId: Query_GetTssAddress - responses: - "200": - description: A successful response. - schema: - $ref: '#/definitions/crosschainQueryGetTssAddressResponse' - default: - description: An unexpected error response. - schema: - $ref: '#/definitions/googlerpcStatus' - parameters: - - name: tss_pub_key - in: query - required: false - type: string - tags: - - Query - /zeta-chain/crosschain/in_tx_hash_to_cctx_data/{inTxHash}: + /zeta-chain/crosschain/inTxTrackerByChain/{chain_id}: get: - summary: Queries a InTxHashToCctx data by index. - operationId: Query_InTxHashToCctxData + operationId: Query_InTxTrackerAllByChain responses: "200": description: A successful response. schema: - $ref: '#/definitions/crosschainQueryInTxHashToCctxDataResponse' + $ref: '#/definitions/crosschainQueryAllInTxTrackerByChainResponse' default: description: An unexpected error response. schema: $ref: '#/definitions/googlerpcStatus' parameters: - - name: inTxHash + - name: chain_id in: path required: true type: string - tags: - - Query - /zeta-chain/crosschain/inTxHashToCctx: - get: - summary: Queries a list of InTxHashToCctx items. - operationId: Query_InTxHashToCctxAll - responses: - "200": - description: A successful response. - schema: - $ref: '#/definitions/crosschainQueryAllInTxHashToCctxResponse' - default: - description: An unexpected error response. - schema: - $ref: '#/definitions/googlerpcStatus' - parameters: + format: int64 - name: pagination.key description: |- key is a value returned in PageResponse.next_key to begin @@ -26953,44 +26858,19 @@ paths: type: boolean tags: - Query - /zeta-chain/crosschain/inTxHashToCctx/{inTxHash}: - get: - summary: Queries a InTxHashToCctx by index. - operationId: Query_InTxHashToCctx - responses: - "200": - description: A successful response. - schema: - $ref: '#/definitions/crosschainQueryGetInTxHashToCctxResponse' - default: - description: An unexpected error response. - schema: - $ref: '#/definitions/googlerpcStatus' - parameters: - - name: inTxHash - in: path - required: true - type: string - tags: - - Query - /zeta-chain/crosschain/inTxTrackerByChain/{chain_id}: + /zeta-chain/crosschain/inTxTrackers: get: - operationId: Query_InTxTrackerAllByChain + operationId: Query_InTxTrackerAll responses: "200": description: A successful response. schema: - $ref: '#/definitions/crosschainQueryAllInTxTrackerByChainResponse' + $ref: '#/definitions/crosschainQueryAllInTxTrackersResponse' default: description: An unexpected error response. schema: $ref: '#/definitions/googlerpcStatus' parameters: - - name: chain_id - in: path - required: true - type: string - format: int64 - name: pagination.key description: |- key is a value returned in PageResponse.next_key to begin @@ -27036,20 +26916,6 @@ paths: type: boolean tags: - Query - /zeta-chain/crosschain/inTxTrackers: - get: - operationId: Query_InTxTrackerAll - responses: - "200": - description: A successful response. - schema: - $ref: '#/definitions/crosschainQueryAllInTxTrackersResponse' - default: - description: An unexpected error response. - schema: - $ref: '#/definitions/googlerpcStatus' - tags: - - Query /zeta-chain/crosschain/lastBlockHeight: get: summary: Queries a list of lastBlockHeight items. @@ -27307,40 +27173,6 @@ paths: $ref: '#/definitions/googlerpcStatus' tags: - Query - /zeta-chain/crosschain/pendingNonces: - get: - operationId: Query_PendingNoncesAll - responses: - "200": - description: A successful response. - schema: - $ref: '#/definitions/crosschainQueryAllPendingNoncesResponse' - default: - description: An unexpected error response. - schema: - $ref: '#/definitions/googlerpcStatus' - tags: - - Query - /zeta-chain/crosschain/pendingNonces/{chain_id}: - get: - operationId: Query_PendingNoncesByChain - responses: - "200": - description: A successful response. - schema: - $ref: '#/definitions/crosschainQueryPendingNoncesByChainResponse' - default: - description: An unexpected error response. - schema: - $ref: '#/definitions/googlerpcStatus' - parameters: - - name: chain_id - in: path - required: true - type: string - format: int64 - tags: - - Query /zeta-chain/crosschain/protocolFee: get: operationId: Query_ProtocolFee @@ -27355,14 +27187,14 @@ paths: $ref: '#/definitions/googlerpcStatus' tags: - Query - /zeta-chain/crosschain/tssHistory: + /zeta-chain/crosschain/zetaAccounting: get: - operationId: Query_TssHistory + operationId: Query_ZetaAccounting responses: "200": description: A successful response. schema: - $ref: '#/definitions/crosschainQueryTssHistoryResponse' + $ref: '#/definitions/crosschainQueryZetaAccountingResponse' default: description: An unexpected error response. schema: @@ -27434,6 +27266,26 @@ paths: type: string tags: - Query + /zeta-chain/fungible/code_hash/{address}: + get: + summary: Code hash query the code hash of a contract. + operationId: Query_CodeHash + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/fungibleQueryCodeHashResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: address + in: path + required: true + type: string + tags: + - Query /zeta-chain/fungible/foreign_coins: get: summary: Queries a list of ForeignCoins items. @@ -27579,6 +27431,21 @@ paths: $ref: '#/definitions/googlerpcStatus' tags: - Query + /zeta-chain/observer/TSS: + get: + summary: Queries a tSS by index. + operationId: Query_TSS + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/observerQueryGetTSSResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + tags: + - Query /zeta-chain/observer/all_observer_mappers: get: operationId: Query_AllObserverMappers @@ -27659,6 +27526,85 @@ paths: type: string tags: - Query + /zeta-chain/observer/chainNonces: + get: + summary: Queries a list of chainNonces items. + operationId: Query_ChainNoncesAll + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/observerQueryAllChainNoncesResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: |- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key should + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: |- + limit is the total number of results to be returned in the result page. + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: |- + count_total is set to true to indicate that the result set should include + a count of the total number of items available for pagination in UIs. + count_total is only respected when offset is used. It is ignored when key + is set. + in: query + required: false + type: boolean + - name: pagination.reverse + description: |- + reverse is set to true if results are to be returned in the descending order. + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + tags: + - Query + /zeta-chain/observer/chainNonces/{index}: + get: + summary: Queries a chainNonces by index. + operationId: Query_ChainNonces + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/observerQueryGetChainNoncesResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: index + in: path + required: true + type: string + tags: + - Query /zeta-chain/observer/crosschain_flags: get: operationId: Query_CrosschainFlags @@ -27686,6 +27632,50 @@ paths: description: An unexpected error response. schema: $ref: '#/definitions/googlerpcStatus' + parameters: + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: |- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key should + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: |- + limit is the total number of results to be returned in the result page. + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: |- + count_total is set to true to indicate that the result set should include + a count of the total number of items available for pagination in UIs. + count_total is only respected when offset is used. It is ignored when key + is set. + in: query + required: false + type: boolean + - name: pagination.reverse + description: |- + reverse is set to true if results are to be returned in the descending order. + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean tags: - Query /zeta-chain/observer/get_all_block_headers: @@ -27822,6 +27812,76 @@ paths: $ref: '#/definitions/googlerpcStatus' tags: - Query + /zeta-chain/observer/get_tss_address: + get: + summary: Queries a list of GetTssAddress items. + operationId: Query_GetTssAddress + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/observerQueryGetTssAddressResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: bitcoin_chain_id + in: query + required: false + type: string + format: int64 + tags: + - Query + /zeta-chain/observer/get_tss_address_historical/{finalized_zeta_height}/{bitcoin_chain_id}: + get: + operationId: Query_GetTssAddressByFinalizedHeight + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/observerQueryGetTssAddressByFinalizedHeightResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: finalized_zeta_height + in: path + required: true + type: string + format: int64 + - name: bitcoin_chain_id + in: path + required: true + type: string + format: int64 + tags: + - Query + /zeta-chain/observer/has_voted/{ballot_identifier}/{voter_address}: + get: + summary: Query if a voter has voted for a ballot + operationId: Query_HasVoted + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/observerQueryHasVotedResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: ballot_identifier + in: path + required: true + type: string + - name: voter_address + in: path + required: true + type: string + tags: + - Query /zeta-chain/observer/keygen: get: summary: Queries a keygen by index. @@ -27951,6 +28011,84 @@ paths: $ref: '#/definitions/googlerpcStatus' tags: - Query + /zeta-chain/observer/pendingNonces: + get: + operationId: Query_PendingNoncesAll + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/observerQueryAllPendingNoncesResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: |- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key should + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: |- + limit is the total number of results to be returned in the result page. + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: |- + count_total is set to true to indicate that the result set should include + a count of the total number of items available for pagination in UIs. + count_total is only respected when offset is used. It is ignored when key + is set. + in: query + required: false + type: boolean + - name: pagination.reverse + description: |- + reverse is set to true if results are to be returned in the descending order. + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + tags: + - Query + /zeta-chain/observer/pendingNonces/{chain_id}: + get: + operationId: Query_PendingNoncesByChain + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/observerQueryPendingNoncesByChainResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: chain_id + in: path + required: true + type: string + format: int64 + tags: + - Query /zeta-chain/observer/prove: get: summary: merkle proof verification @@ -28008,26 +28146,84 @@ paths: - name: block_hash in: query required: false - type: string - - name: tx_index + type: string + - name: tx_index + in: query + required: false + type: string + format: int64 + tags: + - Query + /zeta-chain/observer/supportedChains: + get: + operationId: Query_SupportedChains + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/observerQuerySupportedChainsResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + tags: + - Query + /zeta-chain/observer/tssHistory: + get: + operationId: Query_TssHistory + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/observerQueryTssHistoryResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: |- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key should + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: |- + limit is the total number of results to be returned in the result page. + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: |- + count_total is set to true to indicate that the result set should include + a count of the total number of items available for pagination in UIs. + count_total is only respected when offset is used. It is ignored when key + is set. + in: query + required: false + type: boolean + - name: pagination.reverse + description: |- + reverse is set to true if results are to be returned in the descending order. + + Since: cosmos-sdk 0.43 in: query required: false - type: string - format: int64 - tags: - - Query - /zeta-chain/observer/supportedChains: - get: - operationId: Query_SupportedChains - responses: - "200": - description: A successful response. - schema: - $ref: '#/definitions/observerQuerySupportedChainsResponse' - default: - description: An unexpected error response. - schema: - $ref: '#/definitions/googlerpcStatus' + type: boolean tags: - Query /zeta-chain/zetacore/fungible/gas_stability_pool_balance: @@ -50448,6 +50644,7 @@ definitions: - bsc_testnet - zeta_testnet - btc_testnet + - sepolia_testnet - goerli_localnet - btc_regtest default: empty @@ -50520,26 +50717,6 @@ definitions: - PendingRevert: outbound cannot succeed; should revert inbound - Reverted: inbound reverted. - Aborted: inbound tx error or invalid paramters and cannot revert; just abort - crosschainChainNonces: - type: object - properties: - creator: - type: string - index: - type: string - chain_id: - type: string - format: int64 - nonce: - type: string - format: uint64 - signers: - type: array - items: - type: string - finalizedHeight: - type: string - format: uint64 crosschainCrossChainTx: type: object properties: @@ -50665,8 +50842,6 @@ definitions: type: object crosschainMsgMigrateTssFundsResponse: type: object - crosschainMsgNonceVoterResponse: - type: object crosschainMsgRemoveFromOutTxTrackerResponse: type: object crosschainMsgUpdateTssAddressResponse: @@ -50739,31 +50914,6 @@ definitions: format: uint64 tss_pubkey: type: string - crosschainPendingNonces: - type: object - properties: - nonce_low: - type: string - format: int64 - nonce_high: - type: string - format: int64 - chain_id: - type: string - format: int64 - tss: - type: string - title: store key is tss+chainid - crosschainQueryAllCctxPendingResponse: - type: object - properties: - CrossChainTx: - type: array - items: - type: object - $ref: '#/definitions/crosschainCrossChainTx' - pagination: - $ref: '#/definitions/v1beta1PageResponse' crosschainQueryAllCctxResponse: type: object properties: @@ -50774,16 +50924,6 @@ definitions: $ref: '#/definitions/crosschainCrossChainTx' pagination: $ref: '#/definitions/v1beta1PageResponse' - crosschainQueryAllChainNoncesResponse: - type: object - properties: - ChainNonces: - type: array - items: - type: object - $ref: '#/definitions/crosschainChainNonces' - pagination: - $ref: '#/definitions/v1beta1PageResponse' crosschainQueryAllGasPriceResponse: type: object properties: @@ -50822,6 +50962,8 @@ definitions: items: type: object $ref: '#/definitions/crosschainInTxTracker' + pagination: + $ref: '#/definitions/v1beta1PageResponse' crosschainQueryAllLastBlockHeightResponse: type: object properties: @@ -50852,22 +50994,6 @@ definitions: $ref: '#/definitions/crosschainOutTxTracker' pagination: $ref: '#/definitions/v1beta1PageResponse' - crosschainQueryAllPendingNoncesResponse: - type: object - properties: - pending_nonces: - type: array - items: - type: object - $ref: '#/definitions/crosschainPendingNonces' - crosschainQueryCctxByStatusResponse: - type: object - properties: - CrossChainTx: - type: array - items: - type: object - $ref: '#/definitions/crosschainCrossChainTx' crosschainQueryConvertGasToZetaResponse: type: object properties: @@ -50883,11 +51009,6 @@ definitions: properties: CrossChainTx: $ref: '#/definitions/crosschainCrossChainTx' - crosschainQueryGetChainNoncesResponse: - type: object - properties: - ChainNonces: - $ref: '#/definitions/crosschainChainNonces' crosschainQueryGetGasPriceResponse: type: object properties: @@ -50908,18 +51029,6 @@ definitions: properties: outTxTracker: $ref: '#/definitions/crosschainOutTxTracker' - crosschainQueryGetTSSResponse: - type: object - properties: - TSS: - $ref: '#/definitions/crosschainTSS' - crosschainQueryGetTssAddressResponse: - type: object - properties: - eth: - type: string - btc: - type: string crosschainQueryInTxHashToCctxDataResponse: type: object properties: @@ -50934,43 +51043,27 @@ definitions: Height: type: string format: int64 - crosschainQueryMessagePassingProtocolFeeResponse: - type: object - properties: - feeInZeta: - type: string - crosschainQueryPendingNoncesByChainResponse: - type: object - properties: - pending_nonces: - $ref: '#/definitions/crosschainPendingNonces' - crosschainQueryTssHistoryResponse: + crosschainQueryListCctxPendingResponse: type: object properties: - tss_list: + CrossChainTx: type: array items: type: object - $ref: '#/definitions/crosschainTSS' - crosschainTSS: + $ref: '#/definitions/crosschainCrossChainTx' + totalPending: + type: string + format: uint64 + crosschainQueryMessagePassingProtocolFeeResponse: type: object properties: - tss_pubkey: - type: string - tss_participant_list: - type: array - items: - type: string - operator_address_list: - type: array - items: - type: string - finalizedZetaHeight: + feeInZeta: type: string - format: int64 - keyGenZetaHeight: + crosschainQueryZetaAccountingResponse: + type: object + properties: + aborted_zeta_amount: type: string - format: int64 crosschainTxHashList: type: object properties: @@ -51049,14 +51142,23 @@ definitions: properties: address: type: string + fungibleMsgDeploySystemContractsResponse: + type: object + properties: + uniswapV2Factory: + type: string + wzeta: + type: string + uniswapV2Router: + type: string + connectorZEVM: + type: string + systemContract: + type: string fungibleMsgRemoveForeignCoinResponse: type: object fungibleMsgUpdateContractBytecodeResponse: type: object - properties: - new_bytecode_hash: - type: string - format: byte fungibleMsgUpdateSystemContractResponse: type: object fungibleMsgUpdateZRC20LiquidityCapResponse: @@ -51083,6 +51185,11 @@ definitions: items: type: object $ref: '#/definitions/QueryAllGasStabilityPoolBalanceResponseBalance' + fungibleQueryCodeHashResponse: + type: object + properties: + code_hash: + type: string fungibleQueryGetForeignCoinsResponse: type: object properties: @@ -51179,6 +51286,26 @@ definitions: type: boolean isBtcTypeChainEnabled: type: boolean + observerChainNonces: + type: object + properties: + creator: + type: string + index: + type: string + chain_id: + type: string + format: int64 + nonce: + type: string + format: uint64 + signers: + type: array + items: + type: string + finalizedHeight: + type: string + format: uint64 observerCoreParams: type: object properties: @@ -51248,6 +51375,10 @@ definitions: title: |- Maximum gas price increase in percent of the median gas price Default is used if 0 + maxPendingCctxs: + type: integer + format: int64 + title: Maximum number of pending crosschain transactions to check for gas price increase observerKeygen: type: object properties: @@ -51362,6 +51493,21 @@ definitions: - Tombstoned - AdminUpdate default: Undefined + observerPendingNonces: + type: object + properties: + nonce_low: + type: string + format: int64 + nonce_high: + type: string + format: int64 + chain_id: + type: string + format: int64 + tss: + type: string + title: store key is tss+chainid observerPolicy_Type: type: string enum: @@ -51376,6 +51522,8 @@ definitions: items: type: object $ref: '#/definitions/observerBlame' + pagination: + $ref: '#/definitions/v1beta1PageResponse' observerQueryAllBlockHeaderResponse: type: object properties: @@ -51386,6 +51534,16 @@ definitions: $ref: '#/definitions/commonBlockHeader' pagination: $ref: '#/definitions/v1beta1PageResponse' + observerQueryAllChainNoncesResponse: + type: object + properties: + ChainNonces: + type: array + items: + type: object + $ref: '#/definitions/observerChainNonces' + pagination: + $ref: '#/definitions/v1beta1PageResponse' observerQueryAllNodeAccountResponse: type: object properties: @@ -51404,6 +51562,16 @@ definitions: items: type: object $ref: '#/definitions/observerObserverMapper' + observerQueryAllPendingNoncesResponse: + type: object + properties: + pending_nonces: + type: array + items: + type: object + $ref: '#/definitions/observerPendingNonces' + pagination: + $ref: '#/definitions/v1beta1PageResponse' observerQueryBallotByIdentifierResponse: type: object properties: @@ -51441,6 +51609,11 @@ definitions: properties: block_header_state: $ref: '#/definitions/observerBlockHeaderState' + observerQueryGetChainNoncesResponse: + type: object + properties: + ChainNonces: + $ref: '#/definitions/observerChainNonces' observerQueryGetCoreParamsForChainResponse: type: object properties: @@ -51466,6 +51639,30 @@ definitions: properties: node_account: $ref: '#/definitions/observerNodeAccount' + observerQueryGetTSSResponse: + type: object + properties: + TSS: + $ref: '#/definitions/observerTSS' + observerQueryGetTssAddressByFinalizedHeightResponse: + type: object + properties: + eth: + type: string + btc: + type: string + observerQueryGetTssAddressResponse: + type: object + properties: + eth: + type: string + btc: + type: string + observerQueryHasVotedResponse: + type: object + properties: + has_voted: + type: boolean observerQueryObserversByChainResponse: type: object properties: @@ -51473,6 +51670,11 @@ definitions: type: array items: type: string + observerQueryPendingNoncesByChainResponse: + type: object + properties: + pending_nonces: + $ref: '#/definitions/observerPendingNonces' observerQueryProveResponse: type: object properties: @@ -51491,6 +51693,35 @@ definitions: items: type: object $ref: '#/definitions/commonChain' + observerQueryTssHistoryResponse: + type: object + properties: + tss_list: + type: array + items: + type: object + $ref: '#/definitions/observerTSS' + pagination: + $ref: '#/definitions/v1beta1PageResponse' + observerTSS: + type: object + properties: + tss_pubkey: + type: string + tss_participant_list: + type: array + items: + type: string + operator_address_list: + type: array + items: + type: string + finalizedZetaHeight: + type: string + format: int64 + keyGenZetaHeight: + type: string + format: int64 observerVoteType: type: string enum: diff --git a/docs/spec/crosschain/messages.md b/docs/spec/crosschain/messages.md index 6c65cf8098..9cc9938109 100644 --- a/docs/spec/crosschain/messages.md +++ b/docs/spec/crosschain/messages.md @@ -20,6 +20,7 @@ message MsgAddToOutTxTracker { ## MsgAddToInTxTracker +AddToInTxTracker adds a new record to the inbound transaction tracker. TODO https://github.com/zeta-chain/node/issues/1269 ```proto @@ -47,31 +48,9 @@ message MsgRemoveFromOutTxTracker { } ``` -## MsgCreateTSSVoter - -CreateTSSVoter votes on creating a TSS key and recording the information about it (public -key, participant and operator addresses, finalized and keygen heights). - -If the vote passes, the information about the TSS key is recorded on chain -and the status of the keygen is set to "success". - -Fails if the keygen does not exist, the keygen has been already -completed, or the keygen has failed. - -Only node accounts are authorized to broadcast this message. - -```proto -message MsgCreateTSSVoter { - string creator = 1; - string tss_pubkey = 2; - int64 keyGenZetaHeight = 3; - common.ReceiveStatus status = 4; -} -``` - ## MsgGasPriceVoter -Submit information about the connected chain's gas price at a specific block +GasPriceVoter submits information about the connected chain's gas price at a specific block height. Gas price submitted by each validator is recorded separately and a median index is updated. @@ -87,18 +66,6 @@ message MsgGasPriceVoter { } ``` -## MsgNonceVoter - -Deprecated. - -```proto -message MsgNonceVoter { - string creator = 1; - int64 chain_id = 2; - uint64 nonce = 3; -} -``` - ## MsgVoteOnObservedOutboundTx VoteOnObservedOutboundTx casts a vote on an outbound transaction observed on a connected chain (after @@ -259,3 +226,25 @@ message MsgMigrateTssFunds { } ``` +## MsgCreateTSSVoter + +CreateTSSVoter votes on creating a TSS key and recording the information about it (public +key, participant and operator addresses, finalized and keygen heights). + +If the vote passes, the information about the TSS key is recorded on chain +and the status of the keygen is set to "success". + +Fails if the keygen does not exist, the keygen has been already +completed, or the keygen has failed. + +Only node accounts are authorized to broadcast this message. + +```proto +message MsgCreateTSSVoter { + string creator = 1; + string tss_pubkey = 2; + int64 keyGenZetaHeight = 3; + common.ReceiveStatus status = 4; +} +``` + diff --git a/docs/spec/fungible/messages.md b/docs/spec/fungible/messages.md index 984455ff41..7e77e642df 100644 --- a/docs/spec/fungible/messages.md +++ b/docs/spec/fungible/messages.md @@ -1,5 +1,15 @@ # Messages +## MsgDeploySystemContracts + +DeploySystemContracts deploy new instances of the system contracts + +```proto +message MsgDeploySystemContracts { + string creator = 1; +} +``` + ## MsgDeployFungibleCoinZRC20 DeployFungibleCoinZRC20 deploys a fungible coin from a connected chains as a ZRC20 on ZetaChain. @@ -67,7 +77,7 @@ the new contract can add new variable but cannot remove any existing variable message MsgUpdateContractBytecode { string creator = 1; string contract_address = 2; - string new_bytecode_address = 3; + string new_code_hash = 3; } ``` diff --git a/go.sum b/go.sum index 77802118ff..1ea1c542db 100644 --- a/go.sum +++ b/go.sum @@ -2625,8 +2625,6 @@ github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5X github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzywPxOvwMdxcg= github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= -github.com/regen-network/keystone/keys v0.0.0-20220129212613-fb67e4f8db9f h1:mZzWwq+8mlPD26RKF0dFZf6zqT3rIlMUiG6XAj9S8DU= -github.com/regen-network/keystone/keys v0.0.0-20220129212613-fb67e4f8db9f/go.mod h1:kElF/8eluneHAO2s1UnFl0Jy5An3f7OiXbzUI+1vnJU= github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M= diff --git a/proto/buf.yaml b/proto/buf.yaml index 63bc9f78c7..87bc116fd4 100644 --- a/proto/buf.yaml +++ b/proto/buf.yaml @@ -2,6 +2,7 @@ version: v1 deps: - buf.build/cosmos/cosmos-sdk - buf.build/googleapis/googleapis + - buf.build/cosmos/gogo-proto breaking: use: - FILE diff --git a/proto/common/common.proto b/proto/common/common.proto index d6b1dcf99b..a3dc8ad69e 100644 --- a/proto/common/common.proto +++ b/proto/common/common.proto @@ -51,6 +51,7 @@ enum ChainName { bsc_testnet = 10; zeta_testnet = 11; btc_testnet = 12; + sepolia_testnet = 13; // LocalNet // zeta_localnet = 13; goerli_localnet = 14; diff --git a/proto/crosschain/cross_chain_tx.proto b/proto/crosschain/cross_chain_tx.proto index fd2851af79..ed38a74597 100644 --- a/proto/crosschain/cross_chain_tx.proto +++ b/proto/crosschain/cross_chain_tx.proto @@ -32,6 +32,14 @@ message InboundTxParams { uint64 inbound_tx_finalized_zeta_height = 10; } +message ZetaAccounting { + // aborted_zeta_amount stores the total aborted amount for cctx of coin-type ZETA + string aborted_zeta_amount = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint", + (gogoproto.nullable) = false + ]; +} + message OutboundTxParams { string receiver = 1; int64 receiver_chainId = 2; diff --git a/proto/crosschain/genesis.proto b/proto/crosschain/genesis.proto index c62d228d0b..46d1b18066 100644 --- a/proto/crosschain/genesis.proto +++ b/proto/crosschain/genesis.proto @@ -1,7 +1,6 @@ syntax = "proto3"; package zetachain.zetacore.crosschain; -import "crosschain/chain_nonces.proto"; import "crosschain/cross_chain_tx.proto"; import "crosschain/gas_price.proto"; import "crosschain/in_tx_hash_to_cctx.proto"; @@ -9,7 +8,6 @@ import "crosschain/in_tx_tracker.proto"; import "crosschain/last_block_height.proto"; import "crosschain/out_tx_tracker.proto"; import "crosschain/params.proto"; -import "crosschain/tss.proto"; import "gogoproto/gogo.proto"; option go_package = "github.com/zeta-chain/zetacore/x/crosschain/types"; @@ -18,13 +16,10 @@ option go_package = "github.com/zeta-chain/zetacore/x/crosschain/types"; message GenesisState { Params params = 1 [(gogoproto.nullable) = false]; repeated OutTxTracker outTxTrackerList = 2 [(gogoproto.nullable) = false]; - TSS tss = 4; repeated GasPrice gasPriceList = 5; - repeated ChainNonces chainNoncesList = 6; repeated CrossChainTx CrossChainTxs = 7; - repeated LastBlockHeight lastBlockHeightList = 8; repeated InTxHashToCctx inTxHashToCctxList = 9 [(gogoproto.nullable) = false]; - repeated TSS tss_history = 10 [(gogoproto.nullable) = false]; repeated InTxTracker in_tx_tracker_list = 11 [(gogoproto.nullable) = false]; + ZetaAccounting zeta_accounting = 12 [(gogoproto.nullable) = false]; } diff --git a/proto/crosschain/nonce_to_cctx.proto b/proto/crosschain/nonce_to_cctx.proto deleted file mode 100644 index a7b0f04aba..0000000000 --- a/proto/crosschain/nonce_to_cctx.proto +++ /dev/null @@ -1,20 +0,0 @@ -syntax = "proto3"; -package zetachain.zetacore.crosschain; - -option go_package = "github.com/zeta-chain/zetacore/x/crosschain/types"; - -// store key is tss+chainid+nonce -message NonceToCctx { - int64 chain_id = 1; - int64 nonce = 2; - string cctxIndex = 3; - string tss = 4; -} - -// store key is tss+chainid -message PendingNonces { - int64 nonce_low = 1; - int64 nonce_high = 2; - int64 chain_id = 3; - string tss = 4; -} diff --git a/proto/crosschain/query.proto b/proto/crosschain/query.proto index 4ba5849353..c9eee26378 100644 --- a/proto/crosschain/query.proto +++ b/proto/crosschain/query.proto @@ -2,16 +2,13 @@ syntax = "proto3"; package zetachain.zetacore.crosschain; import "cosmos/base/query/v1beta1/pagination.proto"; -import "crosschain/chain_nonces.proto"; import "crosschain/cross_chain_tx.proto"; import "crosschain/gas_price.proto"; import "crosschain/in_tx_hash_to_cctx.proto"; import "crosschain/in_tx_tracker.proto"; import "crosschain/last_block_height.proto"; -import "crosschain/nonce_to_cctx.proto"; import "crosschain/out_tx_tracker.proto"; import "crosschain/params.proto"; -import "crosschain/tss.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; @@ -60,16 +57,6 @@ service Query { option (google.api.http).get = "/zeta-chain/crosschain/inTxHashToCctx"; } - // Queries a list of GetTssAddress items. - rpc GetTssAddress(QueryGetTssAddressRequest) returns (QueryGetTssAddressResponse) { - option (google.api.http).get = "/zeta-chain/crosschain/get_tss_address"; - } - - // Queries a tSS by index. - rpc TSS(QueryGetTSSRequest) returns (QueryGetTSSResponse) { - option (google.api.http).get = "/zeta-chain/crosschain/TSS"; - } - // Queries a gasPrice by index. rpc GasPrice(QueryGetGasPriceRequest) returns (QueryGetGasPriceResponse) { option (google.api.http).get = "/zeta-chain/crosschain/gasPrice/{index}"; @@ -88,24 +75,6 @@ service Query { option (google.api.http).get = "/zeta-chain/crosschain/protocolFee"; } - // Queries a chainNonces by index. - rpc ChainNonces(QueryGetChainNoncesRequest) returns (QueryGetChainNoncesResponse) { - option (google.api.http).get = "/zeta-chain/crosschain/chainNonces/{index}"; - } - - // Queries a list of chainNonces items. - rpc ChainNoncesAll(QueryAllChainNoncesRequest) returns (QueryAllChainNoncesResponse) { - option (google.api.http).get = "/zeta-chain/crosschain/chainNonces"; - } - - rpc PendingNoncesAll(QueryAllPendingNoncesRequest) returns (QueryAllPendingNoncesResponse) { - option (google.api.http).get = "/zeta-chain/crosschain/pendingNonces"; - } - - rpc PendingNoncesByChain(QueryPendingNoncesByChainRequest) returns (QueryPendingNoncesByChainResponse) { - option (google.api.http).get = "/zeta-chain/crosschain/pendingNonces/{chain_id}"; - } - // Queries a lastBlockHeight by index. rpc LastBlockHeight(QueryGetLastBlockHeightRequest) returns (QueryGetLastBlockHeightResponse) { option (google.api.http).get = "/zeta-chain/crosschain/lastBlockHeight/{index}"; @@ -130,36 +99,25 @@ service Query { option (google.api.http).get = "/zeta-chain/crosschain/cctx"; } - // Queries a list of send items. - rpc CctxAllPending(QueryAllCctxPendingRequest) returns (QueryAllCctxPendingResponse) { + // Queries a list of pending cctxs. + rpc CctxListPending(QueryListCctxPendingRequest) returns (QueryListCctxPendingResponse) { option (google.api.http).get = "/zeta-chain/crosschain/cctxPending"; } + rpc ZetaAccounting(QueryZetaAccountingRequest) returns (QueryZetaAccountingResponse) { + option (google.api.http).get = "/zeta-chain/crosschain/zetaAccounting"; + } + // Queries a list of lastMetaHeight items. rpc LastZetaHeight(QueryLastZetaHeightRequest) returns (QueryLastZetaHeightResponse) { option (google.api.http).get = "/zeta-chain/crosschain/lastZetaHeight"; } - - rpc TssHistory(QueryTssHistoryRequest) returns (QueryTssHistoryResponse) { - option (google.api.http).get = "/zeta-chain/crosschain/tssHistory"; - } - - rpc CctxByStatus(QueryCctxByStatusRequest) returns (QueryCctxByStatusResponse) { - option (google.api.http).get = "/zeta-chain/crosschain/cctxbyStatus/{status}"; - } } -message QueryCctxByStatusRequest { - CctxStatus status = 1; -} -message QueryCctxByStatusResponse { - repeated CrossChainTx CrossChainTx = 1 [(gogoproto.nullable) = false]; -} +message QueryZetaAccountingRequest {} -message QueryTssHistoryRequest {} - -message QueryTssHistoryResponse { - repeated TSS tss_list = 1 [(gogoproto.nullable) = false]; +message QueryZetaAccountingResponse { + string aborted_zeta_amount = 1; } // QueryParamsRequest is request type for the Query/Params RPC method. @@ -209,10 +167,13 @@ message QueryAllInTxTrackerByChainResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } -message QueryAllInTxTrackersRequest {} +message QueryAllInTxTrackersRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} message QueryAllInTxTrackersResponse { repeated InTxTracker inTxTracker = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } message QueryGetInTxHashToCctxRequest { @@ -240,21 +201,6 @@ message QueryAllInTxHashToCctxResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } -message QueryGetTssAddressRequest { - string tss_pub_key = 1; -} - -message QueryGetTssAddressResponse { - string eth = 1; - string btc = 2; -} - -message QueryGetTSSRequest {} - -message QueryGetTSSResponse { - TSS TSS = 1; -} - message QueryGetGasPriceRequest { string index = 1; } @@ -271,36 +217,6 @@ message QueryAllGasPriceResponse { repeated GasPrice GasPrice = 1; cosmos.base.query.v1beta1.PageResponse pagination = 2; } -message QueryGetChainNoncesRequest { - string index = 1; -} - -message QueryGetChainNoncesResponse { - ChainNonces ChainNonces = 1; -} - -message QueryAllChainNoncesRequest { - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} - -message QueryAllChainNoncesResponse { - repeated ChainNonces ChainNonces = 1; - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -message QueryAllPendingNoncesRequest {} - -message QueryAllPendingNoncesResponse { - repeated PendingNonces pending_nonces = 1; -} - -message QueryPendingNoncesByChainRequest { - int64 chain_id = 1; -} - -message QueryPendingNoncesByChainResponse { - PendingNonces pending_nonces = 1 [(gogoproto.nullable) = false]; -} message QueryGetLastBlockHeightRequest { string index = 1; @@ -341,14 +257,14 @@ message QueryAllCctxResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } -message QueryAllCctxPendingRequest { +message QueryListCctxPendingRequest { int64 chain_id = 1; - cosmos.base.query.v1beta1.PageRequest pagination = 2; + uint32 limit = 2; } -message QueryAllCctxPendingResponse { +message QueryListCctxPendingResponse { repeated CrossChainTx CrossChainTx = 1; - cosmos.base.query.v1beta1.PageResponse pagination = 2; + uint64 totalPending = 2; } message QueryLastZetaHeightRequest {} @@ -373,88 +289,3 @@ message QueryMessagePassingProtocolFeeRequest {} message QueryMessagePassingProtocolFeeResponse { string feeInZeta = 1; } - -message QueryZEVMGetTransactionReceiptRequest { - string hash = 1; -} - -message QueryZEVMGetTransactionReceiptResponse { - string block_hash = 1 [(gogoproto.jsontag) = "blockHash"]; - string block_number = 2 [(gogoproto.jsontag) = "blockNumber"]; - string contract_address = 3 [(gogoproto.jsontag) = "contractAddress"]; - string cumulative_gas_used = 4 [(gogoproto.jsontag) = "cumulativeGasUsed"]; - string from = 5 [(gogoproto.jsontag) = "from"]; - string gas_used = 6 [(gogoproto.jsontag) = "gasUsed"]; - string logs_bloom = 7 [(gogoproto.jsontag) = "logsBloom"]; - string status = 8 [(gogoproto.jsontag) = "status"]; - string to = 9 [(gogoproto.jsontag) = "to"]; - string transaction_hash = 10 [(gogoproto.jsontag) = "transactionHash"]; - string transaction_index = 11 [(gogoproto.jsontag) = "transactionIndex"]; - repeated Log logs = 12; -} - -message Log { - string address = 1; - repeated string topics = 2; - string data = 3; - - // sythetic fields - uint64 block_number = 4 [(gogoproto.jsontag) = "blockNumber"]; - string transaction_hash = 5 [(gogoproto.jsontag) = "transactionHash"]; - uint64 transaction_index = 6 [(gogoproto.jsontag) = "transactionIndex"]; - string block_hash = 7 [(gogoproto.jsontag) = "blockHash"]; - uint64 log_index = 8 [(gogoproto.jsontag) = "logIndex"]; - bool removed = 9 [(gogoproto.jsontag) = "removed"]; -} - -message QueryZEVMGetTransactionRequest { - string hash = 1; -} - -message QueryZEVMGetTransactionResponse { - string block_hash = 1 [(gogoproto.jsontag) = "blockHash"]; - string block_number = 2 [(gogoproto.jsontag) = "blockNumber"]; - string from = 3 [(gogoproto.jsontag) = "from"]; - string gas = 4 [(gogoproto.jsontag) = "gas"]; - string gas_price = 5 [(gogoproto.jsontag) = "gasPrice"]; - string hash = 6 [(gogoproto.jsontag) = "hash"]; - string input = 7 [(gogoproto.jsontag) = "input"]; - string nonce = 8 [(gogoproto.jsontag) = "nonce"]; - string to = 9 [(gogoproto.jsontag) = "to"]; - string transaction_index = 10 [(gogoproto.jsontag) = "transactionIndex"]; - string value = 11 [(gogoproto.jsontag) = "value"]; - string type = 12 [(gogoproto.jsontag) = "type"]; - repeated string access_list = 13 [(gogoproto.jsontag) = "accessList"]; - string chain_id = 14 [(gogoproto.jsontag) = "chainId"]; - string v = 15 [(gogoproto.jsontag) = "v"]; - string r = 16 [(gogoproto.jsontag) = "r"]; - string s = 17 [(gogoproto.jsontag) = "s"]; -} - -message QueryZEVMGetBlockByNumberRequest { - uint64 height = 1; -} - -message QueryZEVMGetBlockByNumberResponse { - string number = 1 [(gogoproto.jsontag) = "number"]; - string hash = 2 [(gogoproto.jsontag) = "hash"]; - string parent_hash = 3 [(gogoproto.jsontag) = "parentHash"]; - string nonce = 4 [(gogoproto.jsontag) = "nonce"]; - string sha3_uncles = 5 [(gogoproto.jsontag) = "sha3Uncles"]; - string logs_bloom = 6 [(gogoproto.jsontag) = "logsBloom"]; - string transactions_root = 7 [(gogoproto.jsontag) = "transactionsRoot"]; - string state_root = 8 [(gogoproto.jsontag) = "stateRoot"]; - string receipts_root = 9 [(gogoproto.jsontag) = "receiptsRoot"]; - string miner = 10 [(gogoproto.jsontag) = "miner"]; - string difficulty = 11 [(gogoproto.jsontag) = "difficulty"]; - string total_difficulty = 12 [(gogoproto.jsontag) = "totalDifficulty"]; - string extra_data = 13 [(gogoproto.jsontag) = "extraData"]; - string size = 14 [(gogoproto.jsontag) = "size"]; - string gas_limit = 15 [(gogoproto.jsontag) = "gasLimit"]; - string gas_used = 16 [(gogoproto.jsontag) = "gasUsed"]; - string timestamp = 17 [(gogoproto.jsontag) = "timestamp"]; - repeated string transactions = 18 [(gogoproto.jsontag) = "transactions"]; - repeated string uncles = 19 [(gogoproto.jsontag) = "uncles"]; - string base_fee_per_gas = 20 [(gogoproto.jsontag) = "baseFeePerGas"]; - string mix_hash = 21 [(gogoproto.jsontag) = "mixHash"]; -} diff --git a/proto/crosschain/tx.proto b/proto/crosschain/tx.proto index 657caa7f55..b660c38968 100644 --- a/proto/crosschain/tx.proto +++ b/proto/crosschain/tx.proto @@ -11,17 +11,25 @@ service Msg { rpc AddToOutTxTracker(MsgAddToOutTxTracker) returns (MsgAddToOutTxTrackerResponse); rpc AddToInTxTracker(MsgAddToInTxTracker) returns (MsgAddToInTxTrackerResponse); rpc RemoveFromOutTxTracker(MsgRemoveFromOutTxTracker) returns (MsgRemoveFromOutTxTrackerResponse); - rpc CreateTSSVoter(MsgCreateTSSVoter) returns (MsgCreateTSSVoterResponse); + rpc GasPriceVoter(MsgGasPriceVoter) returns (MsgGasPriceVoterResponse); - rpc NonceVoter(MsgNonceVoter) returns (MsgNonceVoterResponse); rpc VoteOnObservedOutboundTx(MsgVoteOnObservedOutboundTx) returns (MsgVoteOnObservedOutboundTxResponse); rpc VoteOnObservedInboundTx(MsgVoteOnObservedInboundTx) returns (MsgVoteOnObservedInboundTxResponse); rpc WhitelistERC20(MsgWhitelistERC20) returns (MsgWhitelistERC20Response); rpc UpdateTssAddress(MsgUpdateTssAddress) returns (MsgUpdateTssAddressResponse); rpc MigrateTssFunds(MsgMigrateTssFunds) returns (MsgMigrateTssFundsResponse); - // rpc ProveOutboundTx(MsgProveOutboundTx) returns (MsgProveOutboundTxResponse); + rpc CreateTSSVoter(MsgCreateTSSVoter) returns (MsgCreateTSSVoterResponse); +} + +message MsgCreateTSSVoter { + string creator = 1; + string tss_pubkey = 2; + int64 keyGenZetaHeight = 3; + common.ReceiveStatus status = 4; } +message MsgCreateTSSVoterResponse {} + message MsgMigrateTssFunds { string creator = 1; int64 chain_id = 2; @@ -32,6 +40,13 @@ message MsgMigrateTssFunds { } message MsgMigrateTssFundsResponse {} +message MsgUpdateTssAddress { + string creator = 1; + string tss_pubkey = 2; +} + +message MsgUpdateTssAddressResponse {} + message MsgAddToInTxTracker { string creator = 1; int64 chain_id = 2; @@ -43,13 +58,6 @@ message MsgAddToInTxTracker { } message MsgAddToInTxTrackerResponse {} -message MsgUpdateTssAddress { - string creator = 1; - string tss_pubkey = 2; -} - -message MsgUpdateTssAddressResponse {} - message MsgWhitelistERC20 { string creator = 1; string erc20_address = 2; @@ -87,15 +95,6 @@ message MsgRemoveFromOutTxTracker { message MsgRemoveFromOutTxTrackerResponse {} -message MsgCreateTSSVoter { - string creator = 1; - string tss_pubkey = 2; - int64 keyGenZetaHeight = 3; - common.ReceiveStatus status = 4; -} - -message MsgCreateTSSVoterResponse {} - message MsgGasPriceVoter { string creator = 1; int64 chain_id = 2; @@ -106,14 +105,6 @@ message MsgGasPriceVoter { message MsgGasPriceVoterResponse {} -message MsgNonceVoter { - string creator = 1; - int64 chain_id = 2; - uint64 nonce = 3; -} - -message MsgNonceVoterResponse {} - message MsgVoteOnObservedOutboundTx { string creator = 1; string cctx_hash = 2; @@ -162,11 +153,3 @@ message MsgVoteOnObservedInboundTx { } message MsgVoteOnObservedInboundTxResponse {} - -message MsgSetNodeKeys { - string creator = 1; - common.PubKeySet pubkeySet = 2; - string tss_signer_Address = 3; -} - -message MsgSetNodeKeysResponse {} diff --git a/proto/fungible/events.proto b/proto/fungible/events.proto index 4c66f1a940..06e7af005f 100644 --- a/proto/fungible/events.proto +++ b/proto/fungible/events.proto @@ -44,3 +44,21 @@ message EventZRC20PausedStatusUpdated { UpdatePausedStatusAction action = 3; string signer = 4; } + +message EventSystemContractsDeployed { + string msg_type_url = 1; + string uniswap_v2_factory = 2; + string wzeta = 3; + string uniswap_v2_router = 4; + string connector_zevm = 5; + string system_contract = 6; + string signer = 7; +} + +message EventBytecodeUpdated { + string msg_type_url = 1; + string contract_address = 2; + string new_bytecode_hash = 3; + string old_bytecode_hash = 4; + string signer = 5; +} diff --git a/proto/fungible/query.proto b/proto/fungible/query.proto index 50e573ea32..94e4165cdd 100644 --- a/proto/fungible/query.proto +++ b/proto/fungible/query.proto @@ -16,6 +16,7 @@ service Query { rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/zeta-chain/fungible/params"; } + // Queries a ForeignCoins by index. rpc ForeignCoins(QueryGetForeignCoinsRequest) returns (QueryGetForeignCoinsResponse) { option (google.api.http).get = "/zeta-chain/fungible/foreign_coins/{index}"; @@ -45,6 +46,11 @@ service Query { rpc GasStabilityPoolBalanceAll(QueryAllGasStabilityPoolBalance) returns (QueryAllGasStabilityPoolBalanceResponse) { option (google.api.http).get = "/zeta-chain/zetacore/fungible/gas_stability_pool_balance"; } + + // Code hash query the code hash of a contract. + rpc CodeHash(QueryCodeHashRequest) returns (QueryCodeHashResponse) { + option (google.api.http).get = "/zeta-chain/fungible/code_hash/{address}"; + } } // QueryParamsRequest is request type for the Query/Params RPC method. @@ -103,3 +109,11 @@ message QueryAllGasStabilityPoolBalanceResponse { } repeated Balance balances = 1 [(gogoproto.nullable) = false]; } + +message QueryCodeHashRequest { + string address = 1; +} + +message QueryCodeHashResponse { + string code_hash = 1; +} diff --git a/proto/fungible/tx.proto b/proto/fungible/tx.proto index 34608edb22..e6599a55b9 100644 --- a/proto/fungible/tx.proto +++ b/proto/fungible/tx.proto @@ -8,6 +8,7 @@ option go_package = "github.com/zeta-chain/zetacore/x/fungible/types"; // Msg defines the Msg service. service Msg { + rpc DeploySystemContracts(MsgDeploySystemContracts) returns (MsgDeploySystemContractsResponse); rpc DeployFungibleCoinZRC20(MsgDeployFungibleCoinZRC20) returns (MsgDeployFungibleCoinZRC20Response); rpc RemoveForeignCoin(MsgRemoveForeignCoin) returns (MsgRemoveForeignCoinResponse); rpc UpdateSystemContract(MsgUpdateSystemContract) returns (MsgUpdateSystemContractResponse); @@ -17,6 +18,18 @@ service Msg { rpc UpdateZRC20LiquidityCap(MsgUpdateZRC20LiquidityCap) returns (MsgUpdateZRC20LiquidityCapResponse); } +message MsgDeploySystemContracts { + string creator = 1; +} + +message MsgDeploySystemContractsResponse { + string uniswapV2Factory = 1; + string wzeta = 2; + string uniswapV2Router = 3; + string connectorZEVM = 4; + string systemContract = 5; +} + message MsgUpdateZRC20WithdrawFee { string creator = 1; string zrc20_address = 2; // zrc20 address @@ -64,12 +77,10 @@ message MsgRemoveForeignCoinResponse {} message MsgUpdateContractBytecode { string creator = 1; string contract_address = 2; - string new_bytecode_address = 3; + string new_code_hash = 3; } -message MsgUpdateContractBytecodeResponse { - bytes new_bytecode_hash = 1; -} +message MsgUpdateContractBytecodeResponse {} enum UpdatePausedStatusAction { PAUSE = 0; diff --git a/proto/crosschain/chain_nonces.proto b/proto/observer/chain_nonces.proto similarity index 61% rename from proto/crosschain/chain_nonces.proto rename to proto/observer/chain_nonces.proto index 7372b65807..2ca53ac4cb 100644 --- a/proto/crosschain/chain_nonces.proto +++ b/proto/observer/chain_nonces.proto @@ -1,9 +1,10 @@ syntax = "proto3"; -package zetachain.zetacore.crosschain; +package zetachain.zetacore.observer; +import "common/common.proto"; import "gogoproto/gogo.proto"; -option go_package = "github.com/zeta-chain/zetacore/x/crosschain/types"; +option go_package = "github.com/zeta-chain/zetacore/x/observer/types"; message ChainNonces { string creator = 1; diff --git a/proto/observer/crosschain_flags.proto b/proto/observer/crosschain_flags.proto index 5eebbd865d..e5c3dd9caf 100644 --- a/proto/observer/crosschain_flags.proto +++ b/proto/observer/crosschain_flags.proto @@ -17,6 +17,9 @@ message GasPriceIncreaseFlags { // Maximum gas price increase in percent of the median gas price // Default is used if 0 uint32 gasPriceIncreaseMax = 4; + + // Maximum number of pending crosschain transactions to check for gas price increase + uint32 maxPendingCctxs = 5; } message BlockHeaderVerificationFlags { bool isEthTypeChainEnabled = 1; diff --git a/proto/observer/genesis.proto b/proto/observer/genesis.proto index 4c3b03a4fb..d8a7e306a8 100644 --- a/proto/observer/genesis.proto +++ b/proto/observer/genesis.proto @@ -3,11 +3,17 @@ package zetachain.zetacore.observer; import "gogoproto/gogo.proto"; import "observer/ballot.proto"; +import "observer/blame.proto"; +import "observer/chain_nonces.proto"; import "observer/crosschain_flags.proto"; import "observer/keygen.proto"; import "observer/node_account.proto"; +import "observer/nonce_to_cctx.proto"; import "observer/observer.proto"; import "observer/params.proto"; +import "observer/pending_nonces.proto"; +import "observer/tss.proto"; +import "observer/tss_funds_migrator.proto"; option go_package = "github.com/zeta-chain/zetacore/x/observer/types"; @@ -20,4 +26,11 @@ message GenesisState { Keygen keygen = 6; LastObserverCount last_observer_count = 7; CoreParamsList core_params_list = 8 [(gogoproto.nullable) = false]; + TSS tss = 9; + repeated TSS tss_history = 10 [(gogoproto.nullable) = false]; + repeated TssFundMigratorInfo tss_fund_migrators = 11 [(gogoproto.nullable) = false]; + repeated Blame blame_list = 12 [(gogoproto.nullable) = false]; + repeated PendingNonces pending_nonces = 13 [(gogoproto.nullable) = false]; + repeated ChainNonces chain_nonces = 14 [(gogoproto.nullable) = false]; + repeated NonceToCctx nonce_to_cctx = 15 [(gogoproto.nullable) = false]; } diff --git a/proto/observer/nonce_to_cctx.proto b/proto/observer/nonce_to_cctx.proto new file mode 100644 index 0000000000..0c26d3b34c --- /dev/null +++ b/proto/observer/nonce_to_cctx.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package zetachain.zetacore.observer; + +import "common/common.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/zeta-chain/zetacore/x/observer/types"; + +// store key is tss+chainid+nonce +message NonceToCctx { + int64 chain_id = 1; + int64 nonce = 2; + string cctxIndex = 3; + string tss = 4; +} diff --git a/proto/observer/pending_nonces.proto b/proto/observer/pending_nonces.proto new file mode 100644 index 0000000000..d3aee10cf1 --- /dev/null +++ b/proto/observer/pending_nonces.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package zetachain.zetacore.observer; + +import "common/common.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/zeta-chain/zetacore/x/observer/types"; + +// store key is tss+chainid +message PendingNonces { + int64 nonce_low = 1; + int64 nonce_high = 2; + int64 chain_id = 3; + string tss = 4; +} diff --git a/proto/observer/query.proto b/proto/observer/query.proto index caac5064e6..4060bbdbed 100644 --- a/proto/observer/query.proto +++ b/proto/observer/query.proto @@ -8,11 +8,14 @@ import "google/api/annotations.proto"; import "observer/ballot.proto"; import "observer/blame.proto"; import "observer/block_header.proto"; +import "observer/chain_nonces.proto"; import "observer/crosschain_flags.proto"; import "observer/keygen.proto"; import "observer/node_account.proto"; import "observer/observer.proto"; import "observer/params.proto"; +import "observer/pending_nonces.proto"; +import "observer/tss.proto"; option go_package = "github.com/zeta-chain/zetacore/x/observer/types"; @@ -22,6 +25,10 @@ service Query { rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/zeta-chain/observer/params"; } + // Query if a voter has voted for a ballot + rpc HasVoted(QueryHasVotedRequest) returns (QueryHasVotedResponse) { + option (google.api.http).get = "/zeta-chain/observer/has_voted/{ballot_identifier}/{voter_address}"; + } // Queries a list of VoterByIdentifier items. rpc BallotByIdentifier(QueryBallotByIdentifierRequest) returns (QueryBallotByIdentifierResponse) { option (google.api.http).get = "/zeta-chain/observer/ballot_by_identifier/{ballot_identifier}"; @@ -58,9 +65,11 @@ service Query { rpc NodeAccountAll(QueryAllNodeAccountRequest) returns (QueryAllNodeAccountResponse) { option (google.api.http).get = "/zeta-chain/observer/nodeAccount"; } + rpc CrosschainFlags(QueryGetCrosschainFlagsRequest) returns (QueryGetCrosschainFlagsResponse) { option (google.api.http).get = "/zeta-chain/observer/crosschain_flags"; } + // Queries a keygen by index. rpc Keygen(QueryGetKeygenRequest) returns (QueryGetKeygenResponse) { option (google.api.http).get = "/zeta-chain/observer/keygen"; @@ -102,6 +111,110 @@ service Query { rpc Prove(QueryProveRequest) returns (QueryProveResponse) { option (google.api.http).get = "/zeta-chain/observer/prove"; } + + // Queries a list of GetTssAddress items. + rpc GetTssAddress(QueryGetTssAddressRequest) returns (QueryGetTssAddressResponse) { + option (google.api.http).get = "/zeta-chain/observer/get_tss_address"; + } + + rpc GetTssAddressByFinalizedHeight(QueryGetTssAddressByFinalizedHeightRequest) returns (QueryGetTssAddressByFinalizedHeightResponse) { + option (google.api.http).get = "/zeta-chain/observer/get_tss_address_historical/{finalized_zeta_height}/{bitcoin_chain_id}"; + } + + // Queries a tSS by index. + rpc TSS(QueryGetTSSRequest) returns (QueryGetTSSResponse) { + option (google.api.http).get = "/zeta-chain/observer/TSS"; + } + + rpc TssHistory(QueryTssHistoryRequest) returns (QueryTssHistoryResponse) { + option (google.api.http).get = "/zeta-chain/observer/tssHistory"; + } + + rpc PendingNoncesAll(QueryAllPendingNoncesRequest) returns (QueryAllPendingNoncesResponse) { + option (google.api.http).get = "/zeta-chain/observer/pendingNonces"; + } + + rpc PendingNoncesByChain(QueryPendingNoncesByChainRequest) returns (QueryPendingNoncesByChainResponse) { + option (google.api.http).get = "/zeta-chain/observer/pendingNonces/{chain_id}"; + } + + // Queries a chainNonces by index. + rpc ChainNonces(QueryGetChainNoncesRequest) returns (QueryGetChainNoncesResponse) { + option (google.api.http).get = "/zeta-chain/observer/chainNonces/{index}"; + } + + // Queries a list of chainNonces items. + rpc ChainNoncesAll(QueryAllChainNoncesRequest) returns (QueryAllChainNoncesResponse) { + option (google.api.http).get = "/zeta-chain/observer/chainNonces"; + } +} + +message QueryGetChainNoncesRequest { + string index = 1; +} + +message QueryGetChainNoncesResponse { + ChainNonces ChainNonces = 1 [(gogoproto.nullable) = false]; +} + +message QueryAllChainNoncesRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllChainNoncesResponse { + repeated ChainNonces ChainNonces = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +message QueryAllPendingNoncesRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllPendingNoncesResponse { + repeated PendingNonces pending_nonces = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +message QueryPendingNoncesByChainRequest { + int64 chain_id = 1; +} + +message QueryPendingNoncesByChainResponse { + PendingNonces pending_nonces = 1 [(gogoproto.nullable) = false]; +} + +message QueryGetTSSRequest {} + +message QueryGetTSSResponse { + TSS TSS = 1 [(gogoproto.nullable) = false]; +} + +message QueryGetTssAddressRequest { + int64 bitcoin_chain_id = 2; +} + +message QueryGetTssAddressResponse { + string eth = 1; + string btc = 2; +} + +message QueryGetTssAddressByFinalizedHeightRequest { + int64 finalized_zeta_height = 1; + int64 bitcoin_chain_id = 2; +} + +message QueryGetTssAddressByFinalizedHeightResponse { + string eth = 1; + string btc = 2; +} + +message QueryTssHistoryRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryTssHistoryResponse { + repeated TSS tss_list = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } message QueryProveRequest { @@ -124,6 +237,15 @@ message QueryParamsResponse { Params params = 1 [(gogoproto.nullable) = false]; } +message QueryHasVotedRequest { + string ballot_identifier = 1; + string voter_address = 2; +} + +message QueryHasVotedResponse { + bool has_voted = 1; +} + message QueryBallotByIdentifierRequest { string ballot_identifier = 1; } @@ -215,10 +337,13 @@ message QueryBlameByIdentifierResponse { Blame blame_info = 1; } -message QueryAllBlameRecordsRequest {} +message QueryAllBlameRecordsRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} message QueryAllBlameRecordsResponse { - repeated Blame blame_info = 1; + repeated Blame blame_info = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } message QueryBlameByChainAndNonceRequest { diff --git a/proto/crosschain/tss.proto b/proto/observer/tss.proto similarity index 68% rename from proto/crosschain/tss.proto rename to proto/observer/tss.proto index 9b923c7e36..62d2cdcbad 100644 --- a/proto/crosschain/tss.proto +++ b/proto/observer/tss.proto @@ -1,9 +1,9 @@ syntax = "proto3"; -package zetachain.zetacore.crosschain; +package zetachain.zetacore.observer; import "gogoproto/gogo.proto"; -option go_package = "github.com/zeta-chain/zetacore/x/crosschain/types"; +option go_package = "github.com/zeta-chain/zetacore/x/observer/types"; message TSS { string tss_pubkey = 3; diff --git a/proto/observer/tss_funds_migrator.proto b/proto/observer/tss_funds_migrator.proto new file mode 100644 index 0000000000..f757057eff --- /dev/null +++ b/proto/observer/tss_funds_migrator.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; +package zetachain.zetacore.observer; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/zeta-chain/zetacore/x/observer/types"; + +message TssFundMigratorInfo { + int64 chain_id = 1; + string migration_cctx_index = 2; +} diff --git a/proto/observer/tx.proto b/proto/observer/tx.proto index 8c8d227a9c..8198d12924 100644 --- a/proto/observer/tx.proto +++ b/proto/observer/tx.proto @@ -7,6 +7,8 @@ import "observer/blame.proto"; import "observer/crosschain_flags.proto"; import "observer/observer.proto"; import "observer/params.proto"; +import "observer/pending_nonces.proto"; +import "observer/tss.proto"; option go_package = "github.com/zeta-chain/zetacore/x/observer/types"; @@ -58,7 +60,7 @@ message MsgAddObserverResponse {} message MsgAddBlameVote { string creator = 1; int64 chain_id = 2; - Blame blame_info = 3; + Blame blame_info = 3 [(gogoproto.nullable) = false]; } message MsgAddBlameVoteResponse {} diff --git a/readme.md b/readme.md index b9db6be3c2..9647685d66 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,18 @@ +# ⚠️ Important Notice: Code Freeze for Security Audit ⚠️ + +Dear Contributors and Users, +We are committed to ensuring the highest standards of security and reliability in our project. To uphold this commitment, we are currently undergoing a thorough security audit conducted by Code4rena. More info: https://code4rena.com/contests/2023-11-zetachain. + +During this period, we have instituted a code freeze on our public repository. This means there will be no new commits, merges, or major changes to the codebase until the audit is complete. This process is crucial to maintain the integrity and consistency of the code being audited. + +The audit is scheduled from 20 Nov 9:00 PM GMT+1 to 18 Dec 9:00 PM GMT+1. We appreciate your patience and understanding during this vital phase of our project's development. + +During this time, we encourage our community to review the current codebase and documentation. While we won't be merging new changes, we welcome your feedback, which we will address post-audit. + +For any questions or concerns, feel free to reach out to us on our [Discord](https://discord.com/invite/zetachain). + +Thank you for your cooperation and support! + # ZetaChain ZetaChain is an EVM-compatible L1 blockchain that enables omnichain, generic diff --git a/rpc/namespaces/ethereum/debug/api.go b/rpc/namespaces/ethereum/debug/api.go index 94f771ab39..2861e2b12a 100644 --- a/rpc/namespaces/ethereum/debug/api.go +++ b/rpc/namespaces/ethereum/debug/api.go @@ -200,7 +200,7 @@ func (a *API) StartCPUProfile(file string) error { a.logger.Debug("failed to get filepath for the CPU profile file", "error", err.Error()) return err } - /* #nosec */ + // #nosec G304 variable value is controlled f, err := os.Create(fp) if err != nil { a.logger.Debug("failed to create CPU profile file", "error", err.Error()) diff --git a/rpc/namespaces/ethereum/debug/trace.go b/rpc/namespaces/ethereum/debug/trace.go index 3f45795227..28ba1c8043 100644 --- a/rpc/namespaces/ethereum/debug/trace.go +++ b/rpc/namespaces/ethereum/debug/trace.go @@ -42,7 +42,7 @@ func (a *API) StartGoTrace(file string) error { a.logger.Debug("failed to get filepath for the CPU profile file", "error", err.Error()) return err } - /* #nosec */ + // #nosec G304 variable value is controlled f, err := os.Create(fp) if err != nil { a.logger.Debug("failed to create go trace file", "error", err.Error()) diff --git a/rpc/namespaces/ethereum/debug/utils.go b/rpc/namespaces/ethereum/debug/utils.go index 57a2e0f113..a65134977d 100644 --- a/rpc/namespaces/ethereum/debug/utils.go +++ b/rpc/namespaces/ethereum/debug/utils.go @@ -59,7 +59,7 @@ func writeProfile(name, file string, log log.Logger) error { if err != nil { return err } - /* #nosec */ + // #nosec G304 variable value is controlled f, err := os.Create(fp) if err != nil { return err diff --git a/rpc/websockets.go b/rpc/websockets.go index 84d334e952..b81e49748e 100644 --- a/rpc/websockets.go +++ b/rpc/websockets.go @@ -354,7 +354,6 @@ func (s *websocketsServer) tcpGetAndSendResponse(wsConn *wsConn, mb []byte) erro return errors.Wrap(err, "Could not perform request") } - /* #nosec */ defer resp.Body.Close() body, err := io.ReadAll(resp.Body) diff --git a/server/start.go b/server/start.go index e490886733..3863144995 100644 --- a/server/start.go +++ b/server/start.go @@ -305,7 +305,7 @@ func startInProcess(ctx *server.Context, clientCtx client.Context, opts StartOpt ctx.Logger.Debug("failed to get filepath for the CPU profile file", "error", err.Error()) return err } - /* #nosec */ + // #nosec G304 - users can't control the filepath f, err := os.Create(fp) if err != nil { return err diff --git a/testutil/keeper/mocks/crosschain/account.go b/testutil/keeper/mocks/crosschain/account.go index fa43ac3d58..c54fb001d8 100644 --- a/testutil/keeper/mocks/crosschain/account.go +++ b/testutil/keeper/mocks/crosschain/account.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.0. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks @@ -18,6 +18,10 @@ type CrosschainAccountKeeper struct { func (_m *CrosschainAccountKeeper) GetAccount(ctx types.Context, addr types.AccAddress) authtypes.AccountI { ret := _m.Called(ctx, addr) + if len(ret) == 0 { + panic("no return value specified for GetAccount") + } + var r0 authtypes.AccountI if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress) authtypes.AccountI); ok { r0 = rf(ctx, addr) @@ -34,6 +38,10 @@ func (_m *CrosschainAccountKeeper) GetAccount(ctx types.Context, addr types.AccA func (_m *CrosschainAccountKeeper) GetModuleAccount(ctx types.Context, name string) authtypes.ModuleAccountI { ret := _m.Called(ctx, name) + if len(ret) == 0 { + panic("no return value specified for GetModuleAccount") + } + var r0 authtypes.ModuleAccountI if rf, ok := ret.Get(0).(func(types.Context, string) authtypes.ModuleAccountI); ok { r0 = rf(ctx, name) @@ -50,6 +58,10 @@ func (_m *CrosschainAccountKeeper) GetModuleAccount(ctx types.Context, name stri func (_m *CrosschainAccountKeeper) GetModuleAddress(name string) types.AccAddress { ret := _m.Called(name) + if len(ret) == 0 { + panic("no return value specified for GetModuleAddress") + } + var r0 types.AccAddress if rf, ok := ret.Get(0).(func(string) types.AccAddress); ok { r0 = rf(name) diff --git a/testutil/keeper/mocks/crosschain/bank.go b/testutil/keeper/mocks/crosschain/bank.go index eb339a5880..76bacb53a8 100644 --- a/testutil/keeper/mocks/crosschain/bank.go +++ b/testutil/keeper/mocks/crosschain/bank.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.0. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks @@ -17,6 +17,10 @@ type CrosschainBankKeeper struct { func (_m *CrosschainBankKeeper) BurnCoins(ctx types.Context, name string, amt types.Coins) error { ret := _m.Called(ctx, name, amt) + if len(ret) == 0 { + panic("no return value specified for BurnCoins") + } + var r0 error if rf, ok := ret.Get(0).(func(types.Context, string, types.Coins) error); ok { r0 = rf(ctx, name, amt) @@ -31,6 +35,10 @@ func (_m *CrosschainBankKeeper) BurnCoins(ctx types.Context, name string, amt ty func (_m *CrosschainBankKeeper) GetAllBalances(ctx types.Context, addr types.AccAddress) types.Coins { ret := _m.Called(ctx, addr) + if len(ret) == 0 { + panic("no return value specified for GetAllBalances") + } + var r0 types.Coins if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress) types.Coins); ok { r0 = rf(ctx, addr) @@ -47,6 +55,10 @@ func (_m *CrosschainBankKeeper) GetAllBalances(ctx types.Context, addr types.Acc func (_m *CrosschainBankKeeper) GetBalance(ctx types.Context, addr types.AccAddress, denom string) types.Coin { ret := _m.Called(ctx, addr, denom) + if len(ret) == 0 { + panic("no return value specified for GetBalance") + } + var r0 types.Coin if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, string) types.Coin); ok { r0 = rf(ctx, addr, denom) @@ -61,6 +73,10 @@ func (_m *CrosschainBankKeeper) GetBalance(ctx types.Context, addr types.AccAddr func (_m *CrosschainBankKeeper) LockedCoins(ctx types.Context, addr types.AccAddress) types.Coins { ret := _m.Called(ctx, addr) + if len(ret) == 0 { + panic("no return value specified for LockedCoins") + } + var r0 types.Coins if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress) types.Coins); ok { r0 = rf(ctx, addr) @@ -77,6 +93,10 @@ func (_m *CrosschainBankKeeper) LockedCoins(ctx types.Context, addr types.AccAdd func (_m *CrosschainBankKeeper) MintCoins(ctx types.Context, moduleName string, amt types.Coins) error { ret := _m.Called(ctx, moduleName, amt) + if len(ret) == 0 { + panic("no return value specified for MintCoins") + } + var r0 error if rf, ok := ret.Get(0).(func(types.Context, string, types.Coins) error); ok { r0 = rf(ctx, moduleName, amt) @@ -91,6 +111,10 @@ func (_m *CrosschainBankKeeper) MintCoins(ctx types.Context, moduleName string, func (_m *CrosschainBankKeeper) SendCoinsFromAccountToModule(ctx types.Context, senderAddr types.AccAddress, recipientModule string, amt types.Coins) error { ret := _m.Called(ctx, senderAddr, recipientModule, amt) + if len(ret) == 0 { + panic("no return value specified for SendCoinsFromAccountToModule") + } + var r0 error if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, string, types.Coins) error); ok { r0 = rf(ctx, senderAddr, recipientModule, amt) @@ -105,6 +129,10 @@ func (_m *CrosschainBankKeeper) SendCoinsFromAccountToModule(ctx types.Context, func (_m *CrosschainBankKeeper) SendCoinsFromModuleToAccount(ctx types.Context, senderModule string, recipientAddr types.AccAddress, amt types.Coins) error { ret := _m.Called(ctx, senderModule, recipientAddr, amt) + if len(ret) == 0 { + panic("no return value specified for SendCoinsFromModuleToAccount") + } + var r0 error if rf, ok := ret.Get(0).(func(types.Context, string, types.AccAddress, types.Coins) error); ok { r0 = rf(ctx, senderModule, recipientAddr, amt) @@ -119,6 +147,10 @@ func (_m *CrosschainBankKeeper) SendCoinsFromModuleToAccount(ctx types.Context, func (_m *CrosschainBankKeeper) SpendableCoins(ctx types.Context, addr types.AccAddress) types.Coins { ret := _m.Called(ctx, addr) + if len(ret) == 0 { + panic("no return value specified for SpendableCoins") + } + var r0 types.Coins if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress) types.Coins); ok { r0 = rf(ctx, addr) diff --git a/testutil/keeper/mocks/crosschain/fungible.go b/testutil/keeper/mocks/crosschain/fungible.go index ab960b49a9..69f51cc939 100644 --- a/testutil/keeper/mocks/crosschain/fungible.go +++ b/testutil/keeper/mocks/crosschain/fungible.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.0. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks @@ -26,6 +26,10 @@ type CrosschainFungibleKeeper struct { func (_m *CrosschainFungibleKeeper) CallUniswapV2RouterSwapExactETHForToken(ctx types.Context, sender common.Address, to common.Address, amountIn *big.Int, outZRC4 common.Address, noEthereumTxEvent bool) ([]*big.Int, error) { ret := _m.Called(ctx, sender, to, amountIn, outZRC4, noEthereumTxEvent) + if len(ret) == 0 { + panic("no return value specified for CallUniswapV2RouterSwapExactETHForToken") + } + var r0 []*big.Int var r1 error if rf, ok := ret.Get(0).(func(types.Context, common.Address, common.Address, *big.Int, common.Address, bool) ([]*big.Int, error)); ok { @@ -52,6 +56,10 @@ func (_m *CrosschainFungibleKeeper) CallUniswapV2RouterSwapExactETHForToken(ctx func (_m *CrosschainFungibleKeeper) CallUniswapV2RouterSwapExactTokensForTokens(ctx types.Context, sender common.Address, to common.Address, amountIn *big.Int, inZRC4 common.Address, outZRC4 common.Address, noEthereumTxEvent bool) ([]*big.Int, error) { ret := _m.Called(ctx, sender, to, amountIn, inZRC4, outZRC4, noEthereumTxEvent) + if len(ret) == 0 { + panic("no return value specified for CallUniswapV2RouterSwapExactTokensForTokens") + } + var r0 []*big.Int var r1 error if rf, ok := ret.Get(0).(func(types.Context, common.Address, common.Address, *big.Int, common.Address, common.Address, bool) ([]*big.Int, error)); ok { @@ -78,6 +86,10 @@ func (_m *CrosschainFungibleKeeper) CallUniswapV2RouterSwapExactTokensForTokens( func (_m *CrosschainFungibleKeeper) CallZRC20Approve(ctx types.Context, owner common.Address, zrc20address common.Address, spender common.Address, amount *big.Int, noEthereumTxEvent bool) error { ret := _m.Called(ctx, owner, zrc20address, spender, amount, noEthereumTxEvent) + if len(ret) == 0 { + panic("no return value specified for CallZRC20Approve") + } + var r0 error if rf, ok := ret.Get(0).(func(types.Context, common.Address, common.Address, common.Address, *big.Int, bool) error); ok { r0 = rf(ctx, owner, zrc20address, spender, amount, noEthereumTxEvent) @@ -92,6 +104,10 @@ func (_m *CrosschainFungibleKeeper) CallZRC20Approve(ctx types.Context, owner co func (_m *CrosschainFungibleKeeper) CallZRC20Burn(ctx types.Context, sender common.Address, zrc20address common.Address, amount *big.Int, noEthereumTxEvent bool) error { ret := _m.Called(ctx, sender, zrc20address, amount, noEthereumTxEvent) + if len(ret) == 0 { + panic("no return value specified for CallZRC20Burn") + } + var r0 error if rf, ok := ret.Get(0).(func(types.Context, common.Address, common.Address, *big.Int, bool) error); ok { r0 = rf(ctx, sender, zrc20address, amount, noEthereumTxEvent) @@ -106,6 +122,10 @@ func (_m *CrosschainFungibleKeeper) CallZRC20Burn(ctx types.Context, sender comm func (_m *CrosschainFungibleKeeper) DeployZRC20Contract(ctx types.Context, name string, symbol string, decimals uint8, chainID int64, coinType zetacorecommon.CoinType, erc20Contract string, gasLimit *big.Int) (common.Address, error) { ret := _m.Called(ctx, name, symbol, decimals, chainID, coinType, erc20Contract, gasLimit) + if len(ret) == 0 { + panic("no return value specified for DeployZRC20Contract") + } + var r0 common.Address var r1 error if rf, ok := ret.Get(0).(func(types.Context, string, string, uint8, int64, zetacorecommon.CoinType, string, *big.Int) (common.Address, error)); ok { @@ -132,6 +152,10 @@ func (_m *CrosschainFungibleKeeper) DeployZRC20Contract(ctx types.Context, name func (_m *CrosschainFungibleKeeper) DepositCoinZeta(ctx types.Context, to common.Address, amount *big.Int) error { ret := _m.Called(ctx, to, amount) + if len(ret) == 0 { + panic("no return value specified for DepositCoinZeta") + } + var r0 error if rf, ok := ret.Get(0).(func(types.Context, common.Address, *big.Int) error); ok { r0 = rf(ctx, to, amount) @@ -146,6 +170,10 @@ func (_m *CrosschainFungibleKeeper) DepositCoinZeta(ctx types.Context, to common func (_m *CrosschainFungibleKeeper) DepositZRC20(ctx types.Context, contract common.Address, to common.Address, amount *big.Int) (*evmtypes.MsgEthereumTxResponse, error) { ret := _m.Called(ctx, contract, to, amount) + if len(ret) == 0 { + panic("no return value specified for DepositZRC20") + } + var r0 *evmtypes.MsgEthereumTxResponse var r1 error if rf, ok := ret.Get(0).(func(types.Context, common.Address, common.Address, *big.Int) (*evmtypes.MsgEthereumTxResponse, error)); ok { @@ -172,6 +200,10 @@ func (_m *CrosschainFungibleKeeper) DepositZRC20(ctx types.Context, contract com func (_m *CrosschainFungibleKeeper) FundGasStabilityPool(ctx types.Context, chainID int64, amount *big.Int) error { ret := _m.Called(ctx, chainID, amount) + if len(ret) == 0 { + panic("no return value specified for FundGasStabilityPool") + } + var r0 error if rf, ok := ret.Get(0).(func(types.Context, int64, *big.Int) error); ok { r0 = rf(ctx, chainID, amount) @@ -186,6 +218,10 @@ func (_m *CrosschainFungibleKeeper) FundGasStabilityPool(ctx types.Context, chai func (_m *CrosschainFungibleKeeper) GetAllForeignCoins(ctx types.Context) []fungibletypes.ForeignCoins { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetAllForeignCoins") + } + var r0 []fungibletypes.ForeignCoins if rf, ok := ret.Get(0).(func(types.Context) []fungibletypes.ForeignCoins); ok { r0 = rf(ctx) @@ -202,6 +238,10 @@ func (_m *CrosschainFungibleKeeper) GetAllForeignCoins(ctx types.Context) []fung func (_m *CrosschainFungibleKeeper) GetAllForeignCoinsForChain(ctx types.Context, foreignChainID int64) []fungibletypes.ForeignCoins { ret := _m.Called(ctx, foreignChainID) + if len(ret) == 0 { + panic("no return value specified for GetAllForeignCoinsForChain") + } + var r0 []fungibletypes.ForeignCoins if rf, ok := ret.Get(0).(func(types.Context, int64) []fungibletypes.ForeignCoins); ok { r0 = rf(ctx, foreignChainID) @@ -218,6 +258,10 @@ func (_m *CrosschainFungibleKeeper) GetAllForeignCoinsForChain(ctx types.Context func (_m *CrosschainFungibleKeeper) GetForeignCoinFromAsset(ctx types.Context, asset string, chainID int64) (fungibletypes.ForeignCoins, bool) { ret := _m.Called(ctx, asset, chainID) + if len(ret) == 0 { + panic("no return value specified for GetForeignCoinFromAsset") + } + var r0 fungibletypes.ForeignCoins var r1 bool if rf, ok := ret.Get(0).(func(types.Context, string, int64) (fungibletypes.ForeignCoins, bool)); ok { @@ -242,6 +286,10 @@ func (_m *CrosschainFungibleKeeper) GetForeignCoinFromAsset(ctx types.Context, a func (_m *CrosschainFungibleKeeper) GetForeignCoins(ctx types.Context, zrc20Addr string) (fungibletypes.ForeignCoins, bool) { ret := _m.Called(ctx, zrc20Addr) + if len(ret) == 0 { + panic("no return value specified for GetForeignCoins") + } + var r0 fungibletypes.ForeignCoins var r1 bool if rf, ok := ret.Get(0).(func(types.Context, string) (fungibletypes.ForeignCoins, bool)); ok { @@ -266,6 +314,10 @@ func (_m *CrosschainFungibleKeeper) GetForeignCoins(ctx types.Context, zrc20Addr func (_m *CrosschainFungibleKeeper) GetGasCoinForForeignCoin(ctx types.Context, chainID int64) (fungibletypes.ForeignCoins, bool) { ret := _m.Called(ctx, chainID) + if len(ret) == 0 { + panic("no return value specified for GetGasCoinForForeignCoin") + } + var r0 fungibletypes.ForeignCoins var r1 bool if rf, ok := ret.Get(0).(func(types.Context, int64) (fungibletypes.ForeignCoins, bool)); ok { @@ -290,6 +342,10 @@ func (_m *CrosschainFungibleKeeper) GetGasCoinForForeignCoin(ctx types.Context, func (_m *CrosschainFungibleKeeper) GetSystemContract(ctx types.Context) (fungibletypes.SystemContract, bool) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetSystemContract") + } + var r0 fungibletypes.SystemContract var r1 bool if rf, ok := ret.Get(0).(func(types.Context) (fungibletypes.SystemContract, bool)); ok { @@ -314,6 +370,10 @@ func (_m *CrosschainFungibleKeeper) GetSystemContract(ctx types.Context) (fungib func (_m *CrosschainFungibleKeeper) GetUniswapV2Router02Address(ctx types.Context) (common.Address, error) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetUniswapV2Router02Address") + } + var r0 common.Address var r1 error if rf, ok := ret.Get(0).(func(types.Context) (common.Address, error)); ok { @@ -340,6 +400,10 @@ func (_m *CrosschainFungibleKeeper) GetUniswapV2Router02Address(ctx types.Contex func (_m *CrosschainFungibleKeeper) QueryGasLimit(ctx types.Context, contract common.Address) (*big.Int, error) { ret := _m.Called(ctx, contract) + if len(ret) == 0 { + panic("no return value specified for QueryGasLimit") + } + var r0 *big.Int var r1 error if rf, ok := ret.Get(0).(func(types.Context, common.Address) (*big.Int, error)); ok { @@ -366,6 +430,10 @@ func (_m *CrosschainFungibleKeeper) QueryGasLimit(ctx types.Context, contract co func (_m *CrosschainFungibleKeeper) QueryProtocolFlatFee(ctx types.Context, contract common.Address) (*big.Int, error) { ret := _m.Called(ctx, contract) + if len(ret) == 0 { + panic("no return value specified for QueryProtocolFlatFee") + } + var r0 *big.Int var r1 error if rf, ok := ret.Get(0).(func(types.Context, common.Address) (*big.Int, error)); ok { @@ -392,6 +460,10 @@ func (_m *CrosschainFungibleKeeper) QueryProtocolFlatFee(ctx types.Context, cont func (_m *CrosschainFungibleKeeper) QuerySystemContractGasCoinZRC20(ctx types.Context, chainID *big.Int) (common.Address, error) { ret := _m.Called(ctx, chainID) + if len(ret) == 0 { + panic("no return value specified for QuerySystemContractGasCoinZRC20") + } + var r0 common.Address var r1 error if rf, ok := ret.Get(0).(func(types.Context, *big.Int) (common.Address, error)); ok { @@ -418,6 +490,10 @@ func (_m *CrosschainFungibleKeeper) QuerySystemContractGasCoinZRC20(ctx types.Co func (_m *CrosschainFungibleKeeper) QueryUniswapV2RouterGetZRC4AmountsIn(ctx types.Context, amountOut *big.Int, inZRC4 common.Address) (*big.Int, error) { ret := _m.Called(ctx, amountOut, inZRC4) + if len(ret) == 0 { + panic("no return value specified for QueryUniswapV2RouterGetZRC4AmountsIn") + } + var r0 *big.Int var r1 error if rf, ok := ret.Get(0).(func(types.Context, *big.Int, common.Address) (*big.Int, error)); ok { @@ -444,6 +520,10 @@ func (_m *CrosschainFungibleKeeper) QueryUniswapV2RouterGetZRC4AmountsIn(ctx typ func (_m *CrosschainFungibleKeeper) QueryUniswapV2RouterGetZRC4ToZRC4AmountsIn(ctx types.Context, amountOut *big.Int, inZRC4 common.Address, outZRC4 common.Address) (*big.Int, error) { ret := _m.Called(ctx, amountOut, inZRC4, outZRC4) + if len(ret) == 0 { + panic("no return value specified for QueryUniswapV2RouterGetZRC4ToZRC4AmountsIn") + } + var r0 *big.Int var r1 error if rf, ok := ret.Get(0).(func(types.Context, *big.Int, common.Address, common.Address) (*big.Int, error)); ok { @@ -470,6 +550,10 @@ func (_m *CrosschainFungibleKeeper) QueryUniswapV2RouterGetZRC4ToZRC4AmountsIn(c func (_m *CrosschainFungibleKeeper) QueryUniswapV2RouterGetZetaAmountsIn(ctx types.Context, amountOut *big.Int, outZRC4 common.Address) (*big.Int, error) { ret := _m.Called(ctx, amountOut, outZRC4) + if len(ret) == 0 { + panic("no return value specified for QueryUniswapV2RouterGetZetaAmountsIn") + } + var r0 *big.Int var r1 error if rf, ok := ret.Get(0).(func(types.Context, *big.Int, common.Address) (*big.Int, error)); ok { @@ -501,6 +585,10 @@ func (_m *CrosschainFungibleKeeper) SetForeignCoins(ctx types.Context, foreignCo func (_m *CrosschainFungibleKeeper) SetGasPrice(ctx types.Context, chainID *big.Int, gasPrice *big.Int) (uint64, error) { ret := _m.Called(ctx, chainID, gasPrice) + if len(ret) == 0 { + panic("no return value specified for SetGasPrice") + } + var r0 uint64 var r1 error if rf, ok := ret.Get(0).(func(types.Context, *big.Int, *big.Int) (uint64, error)); ok { @@ -525,6 +613,10 @@ func (_m *CrosschainFungibleKeeper) SetGasPrice(ctx types.Context, chainID *big. func (_m *CrosschainFungibleKeeper) WithdrawFromGasStabilityPool(ctx types.Context, chainID int64, amount *big.Int) error { ret := _m.Called(ctx, chainID, amount) + if len(ret) == 0 { + panic("no return value specified for WithdrawFromGasStabilityPool") + } + var r0 error if rf, ok := ret.Get(0).(func(types.Context, int64, *big.Int) error); ok { r0 = rf(ctx, chainID, amount) @@ -539,6 +631,10 @@ func (_m *CrosschainFungibleKeeper) WithdrawFromGasStabilityPool(ctx types.Conte func (_m *CrosschainFungibleKeeper) ZRC20DepositAndCallContract(ctx types.Context, from []byte, to common.Address, amount *big.Int, senderChain *zetacorecommon.Chain, data []byte, coinType zetacorecommon.CoinType, asset string) (*evmtypes.MsgEthereumTxResponse, bool, error) { ret := _m.Called(ctx, from, to, amount, senderChain, data, coinType, asset) + if len(ret) == 0 { + panic("no return value specified for ZRC20DepositAndCallContract") + } + var r0 *evmtypes.MsgEthereumTxResponse var r1 bool var r2 error diff --git a/testutil/keeper/mocks/crosschain/observer.go b/testutil/keeper/mocks/crosschain/observer.go index 17adf0ae87..2f3bfb7669 100644 --- a/testutil/keeper/mocks/crosschain/observer.go +++ b/testutil/keeper/mocks/crosschain/observer.go @@ -1,11 +1,14 @@ -// Code generated by mockery v2.36.0. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks import ( - mock "github.com/stretchr/testify/mock" + context "context" + common "github.com/zeta-chain/zetacore/common" + mock "github.com/stretchr/testify/mock" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" types "github.com/cosmos/cosmos-sdk/types" @@ -25,6 +28,10 @@ func (_m *CrosschainObserverKeeper) AddBallotToList(ctx types.Context, ballot ob func (_m *CrosschainObserverKeeper) AddVoteToBallot(ctx types.Context, ballot observertypes.Ballot, address string, observationType observertypes.VoteType) (observertypes.Ballot, error) { ret := _m.Called(ctx, ballot, address, observationType) + if len(ret) == 0 { + panic("no return value specified for AddVoteToBallot") + } + var r0 observertypes.Ballot var r1 error if rf, ok := ret.Get(0).(func(types.Context, observertypes.Ballot, string, observertypes.VoteType) (observertypes.Ballot, error)); ok { @@ -49,6 +56,10 @@ func (_m *CrosschainObserverKeeper) AddVoteToBallot(ctx types.Context, ballot ob func (_m *CrosschainObserverKeeper) CheckIfFinalizingVote(ctx types.Context, ballot observertypes.Ballot) (observertypes.Ballot, bool) { ret := _m.Called(ctx, ballot) + if len(ret) == 0 { + panic("no return value specified for CheckIfFinalizingVote") + } + var r0 observertypes.Ballot var r1 bool if rf, ok := ret.Get(0).(func(types.Context, observertypes.Ballot) (observertypes.Ballot, bool)); ok { @@ -69,10 +80,42 @@ func (_m *CrosschainObserverKeeper) CheckIfFinalizingVote(ctx types.Context, bal return r0, r1 } +// CheckIfTssPubkeyHasBeenGenerated provides a mock function with given fields: ctx, tssPubkey +func (_m *CrosschainObserverKeeper) CheckIfTssPubkeyHasBeenGenerated(ctx types.Context, tssPubkey string) (observertypes.TSS, bool) { + ret := _m.Called(ctx, tssPubkey) + + if len(ret) == 0 { + panic("no return value specified for CheckIfTssPubkeyHasBeenGenerated") + } + + var r0 observertypes.TSS + var r1 bool + if rf, ok := ret.Get(0).(func(types.Context, string) (observertypes.TSS, bool)); ok { + return rf(ctx, tssPubkey) + } + if rf, ok := ret.Get(0).(func(types.Context, string) observertypes.TSS); ok { + r0 = rf(ctx, tssPubkey) + } else { + r0 = ret.Get(0).(observertypes.TSS) + } + + if rf, ok := ret.Get(1).(func(types.Context, string) bool); ok { + r1 = rf(ctx, tssPubkey) + } else { + r1 = ret.Get(1).(bool) + } + + return r0, r1 +} + // FindBallot provides a mock function with given fields: ctx, index, chain, observationType func (_m *CrosschainObserverKeeper) FindBallot(ctx types.Context, index string, chain *common.Chain, observationType observertypes.ObservationType) (observertypes.Ballot, bool, error) { ret := _m.Called(ctx, index, chain, observationType) + if len(ret) == 0 { + panic("no return value specified for FindBallot") + } + var r0 observertypes.Ballot var r1 bool var r2 error @@ -104,6 +147,10 @@ func (_m *CrosschainObserverKeeper) FindBallot(ctx types.Context, index string, func (_m *CrosschainObserverKeeper) GetAllBallots(ctx types.Context) []*observertypes.Ballot { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetAllBallots") + } + var r0 []*observertypes.Ballot if rf, ok := ret.Get(0).(func(types.Context) []*observertypes.Ballot); ok { r0 = rf(ctx) @@ -116,10 +163,34 @@ func (_m *CrosschainObserverKeeper) GetAllBallots(ctx types.Context) []*observer return r0 } +// GetAllChainNonces provides a mock function with given fields: ctx +func (_m *CrosschainObserverKeeper) GetAllChainNonces(ctx types.Context) []observertypes.ChainNonces { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetAllChainNonces") + } + + var r0 []observertypes.ChainNonces + if rf, ok := ret.Get(0).(func(types.Context) []observertypes.ChainNonces); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]observertypes.ChainNonces) + } + } + + return r0 +} + // GetAllNodeAccount provides a mock function with given fields: ctx func (_m *CrosschainObserverKeeper) GetAllNodeAccount(ctx types.Context) []observertypes.NodeAccount { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetAllNodeAccount") + } + var r0 []observertypes.NodeAccount if rf, ok := ret.Get(0).(func(types.Context) []observertypes.NodeAccount); ok { r0 = rf(ctx) @@ -132,10 +203,34 @@ func (_m *CrosschainObserverKeeper) GetAllNodeAccount(ctx types.Context) []obser return r0 } +// GetAllNonceToCctx provides a mock function with given fields: ctx +func (_m *CrosschainObserverKeeper) GetAllNonceToCctx(ctx types.Context) []observertypes.NonceToCctx { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetAllNonceToCctx") + } + + var r0 []observertypes.NonceToCctx + if rf, ok := ret.Get(0).(func(types.Context) []observertypes.NonceToCctx); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]observertypes.NonceToCctx) + } + } + + return r0 +} + // GetAllObserverMappers provides a mock function with given fields: ctx func (_m *CrosschainObserverKeeper) GetAllObserverMappers(ctx types.Context) []*observertypes.ObserverMapper { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetAllObserverMappers") + } + var r0 []*observertypes.ObserverMapper if rf, ok := ret.Get(0).(func(types.Context) []*observertypes.ObserverMapper); ok { r0 = rf(ctx) @@ -148,10 +243,84 @@ func (_m *CrosschainObserverKeeper) GetAllObserverMappers(ctx types.Context) []* return r0 } +// GetAllPendingNonces provides a mock function with given fields: ctx +func (_m *CrosschainObserverKeeper) GetAllPendingNonces(ctx types.Context) ([]observertypes.PendingNonces, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetAllPendingNonces") + } + + var r0 []observertypes.PendingNonces + var r1 error + if rf, ok := ret.Get(0).(func(types.Context) ([]observertypes.PendingNonces, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(types.Context) []observertypes.PendingNonces); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]observertypes.PendingNonces) + } + } + + if rf, ok := ret.Get(1).(func(types.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetAllTSS provides a mock function with given fields: ctx +func (_m *CrosschainObserverKeeper) GetAllTSS(ctx types.Context) []observertypes.TSS { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetAllTSS") + } + + var r0 []observertypes.TSS + if rf, ok := ret.Get(0).(func(types.Context) []observertypes.TSS); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]observertypes.TSS) + } + } + + return r0 +} + +// GetAllTssFundMigrators provides a mock function with given fields: ctx +func (_m *CrosschainObserverKeeper) GetAllTssFundMigrators(ctx types.Context) []observertypes.TssFundMigratorInfo { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetAllTssFundMigrators") + } + + var r0 []observertypes.TssFundMigratorInfo + if rf, ok := ret.Get(0).(func(types.Context) []observertypes.TssFundMigratorInfo); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]observertypes.TssFundMigratorInfo) + } + } + + return r0 +} + // GetBallot provides a mock function with given fields: ctx, index func (_m *CrosschainObserverKeeper) GetBallot(ctx types.Context, index string) (observertypes.Ballot, bool) { ret := _m.Called(ctx, index) + if len(ret) == 0 { + panic("no return value specified for GetBallot") + } + var r0 observertypes.Ballot var r1 bool if rf, ok := ret.Get(0).(func(types.Context, string) (observertypes.Ballot, bool)); ok { @@ -176,6 +345,10 @@ func (_m *CrosschainObserverKeeper) GetBallot(ctx types.Context, index string) ( func (_m *CrosschainObserverKeeper) GetBlockHeader(ctx types.Context, hash []byte) (common.BlockHeader, bool) { ret := _m.Called(ctx, hash) + if len(ret) == 0 { + panic("no return value specified for GetBlockHeader") + } + var r0 common.BlockHeader var r1 bool if rf, ok := ret.Get(0).(func(types.Context, []byte) (common.BlockHeader, bool)); ok { @@ -196,10 +369,42 @@ func (_m *CrosschainObserverKeeper) GetBlockHeader(ctx types.Context, hash []byt return r0, r1 } +// GetChainNonces provides a mock function with given fields: ctx, index +func (_m *CrosschainObserverKeeper) GetChainNonces(ctx types.Context, index string) (observertypes.ChainNonces, bool) { + ret := _m.Called(ctx, index) + + if len(ret) == 0 { + panic("no return value specified for GetChainNonces") + } + + var r0 observertypes.ChainNonces + var r1 bool + if rf, ok := ret.Get(0).(func(types.Context, string) (observertypes.ChainNonces, bool)); ok { + return rf(ctx, index) + } + if rf, ok := ret.Get(0).(func(types.Context, string) observertypes.ChainNonces); ok { + r0 = rf(ctx, index) + } else { + r0 = ret.Get(0).(observertypes.ChainNonces) + } + + if rf, ok := ret.Get(1).(func(types.Context, string) bool); ok { + r1 = rf(ctx, index) + } else { + r1 = ret.Get(1).(bool) + } + + return r0, r1 +} + // GetCoreParamsByChainID provides a mock function with given fields: ctx, chainID func (_m *CrosschainObserverKeeper) GetCoreParamsByChainID(ctx types.Context, chainID int64) (*observertypes.CoreParams, bool) { ret := _m.Called(ctx, chainID) + if len(ret) == 0 { + panic("no return value specified for GetCoreParamsByChainID") + } + var r0 *observertypes.CoreParams var r1 bool if rf, ok := ret.Get(0).(func(types.Context, int64) (*observertypes.CoreParams, bool)); ok { @@ -226,6 +431,10 @@ func (_m *CrosschainObserverKeeper) GetCoreParamsByChainID(ctx types.Context, ch func (_m *CrosschainObserverKeeper) GetCrosschainFlags(ctx types.Context) (observertypes.CrosschainFlags, bool) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetCrosschainFlags") + } + var r0 observertypes.CrosschainFlags var r1 bool if rf, ok := ret.Get(0).(func(types.Context) (observertypes.CrosschainFlags, bool)); ok { @@ -246,10 +455,42 @@ func (_m *CrosschainObserverKeeper) GetCrosschainFlags(ctx types.Context) (obser return r0, r1 } +// GetFundMigrator provides a mock function with given fields: ctx, chainID +func (_m *CrosschainObserverKeeper) GetFundMigrator(ctx types.Context, chainID int64) (observertypes.TssFundMigratorInfo, bool) { + ret := _m.Called(ctx, chainID) + + if len(ret) == 0 { + panic("no return value specified for GetFundMigrator") + } + + var r0 observertypes.TssFundMigratorInfo + var r1 bool + if rf, ok := ret.Get(0).(func(types.Context, int64) (observertypes.TssFundMigratorInfo, bool)); ok { + return rf(ctx, chainID) + } + if rf, ok := ret.Get(0).(func(types.Context, int64) observertypes.TssFundMigratorInfo); ok { + r0 = rf(ctx, chainID) + } else { + r0 = ret.Get(0).(observertypes.TssFundMigratorInfo) + } + + if rf, ok := ret.Get(1).(func(types.Context, int64) bool); ok { + r1 = rf(ctx, chainID) + } else { + r1 = ret.Get(1).(bool) + } + + return r0, r1 +} + // GetKeygen provides a mock function with given fields: ctx func (_m *CrosschainObserverKeeper) GetKeygen(ctx types.Context) (observertypes.Keygen, bool) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetKeygen") + } + var r0 observertypes.Keygen var r1 bool if rf, ok := ret.Get(0).(func(types.Context) (observertypes.Keygen, bool)); ok { @@ -274,6 +515,10 @@ func (_m *CrosschainObserverKeeper) GetKeygen(ctx types.Context) (observertypes. func (_m *CrosschainObserverKeeper) GetNodeAccount(ctx types.Context, address string) (observertypes.NodeAccount, bool) { ret := _m.Called(ctx, address) + if len(ret) == 0 { + panic("no return value specified for GetNodeAccount") + } + var r0 observertypes.NodeAccount var r1 bool if rf, ok := ret.Get(0).(func(types.Context, string) (observertypes.NodeAccount, bool)); ok { @@ -294,10 +539,42 @@ func (_m *CrosschainObserverKeeper) GetNodeAccount(ctx types.Context, address st return r0, r1 } +// GetNonceToCctx provides a mock function with given fields: ctx, tss, chainID, nonce +func (_m *CrosschainObserverKeeper) GetNonceToCctx(ctx types.Context, tss string, chainID int64, nonce int64) (observertypes.NonceToCctx, bool) { + ret := _m.Called(ctx, tss, chainID, nonce) + + if len(ret) == 0 { + panic("no return value specified for GetNonceToCctx") + } + + var r0 observertypes.NonceToCctx + var r1 bool + if rf, ok := ret.Get(0).(func(types.Context, string, int64, int64) (observertypes.NonceToCctx, bool)); ok { + return rf(ctx, tss, chainID, nonce) + } + if rf, ok := ret.Get(0).(func(types.Context, string, int64, int64) observertypes.NonceToCctx); ok { + r0 = rf(ctx, tss, chainID, nonce) + } else { + r0 = ret.Get(0).(observertypes.NonceToCctx) + } + + if rf, ok := ret.Get(1).(func(types.Context, string, int64, int64) bool); ok { + r1 = rf(ctx, tss, chainID, nonce) + } else { + r1 = ret.Get(1).(bool) + } + + return r0, r1 +} + // GetObserverMapper provides a mock function with given fields: ctx, chain func (_m *CrosschainObserverKeeper) GetObserverMapper(ctx types.Context, chain *common.Chain) (observertypes.ObserverMapper, bool) { ret := _m.Called(ctx, chain) + if len(ret) == 0 { + panic("no return value specified for GetObserverMapper") + } + var r0 observertypes.ObserverMapper var r1 bool if rf, ok := ret.Get(0).(func(types.Context, *common.Chain) (observertypes.ObserverMapper, bool)); ok { @@ -322,6 +599,10 @@ func (_m *CrosschainObserverKeeper) GetObserverMapper(ctx types.Context, chain * func (_m *CrosschainObserverKeeper) GetParams(ctx types.Context) observertypes.Params { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetParams") + } + var r0 observertypes.Params if rf, ok := ret.Get(0).(func(types.Context) observertypes.Params); ok { r0 = rf(ctx) @@ -332,10 +613,128 @@ func (_m *CrosschainObserverKeeper) GetParams(ctx types.Context) observertypes.P return r0 } +// GetPendingNonces provides a mock function with given fields: ctx, tss, chainID +func (_m *CrosschainObserverKeeper) GetPendingNonces(ctx types.Context, tss string, chainID int64) (observertypes.PendingNonces, bool) { + ret := _m.Called(ctx, tss, chainID) + + if len(ret) == 0 { + panic("no return value specified for GetPendingNonces") + } + + var r0 observertypes.PendingNonces + var r1 bool + if rf, ok := ret.Get(0).(func(types.Context, string, int64) (observertypes.PendingNonces, bool)); ok { + return rf(ctx, tss, chainID) + } + if rf, ok := ret.Get(0).(func(types.Context, string, int64) observertypes.PendingNonces); ok { + r0 = rf(ctx, tss, chainID) + } else { + r0 = ret.Get(0).(observertypes.PendingNonces) + } + + if rf, ok := ret.Get(1).(func(types.Context, string, int64) bool); ok { + r1 = rf(ctx, tss, chainID) + } else { + r1 = ret.Get(1).(bool) + } + + return r0, r1 +} + +// GetPreviousTSS provides a mock function with given fields: ctx +func (_m *CrosschainObserverKeeper) GetPreviousTSS(ctx types.Context) (observertypes.TSS, bool) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetPreviousTSS") + } + + var r0 observertypes.TSS + var r1 bool + if rf, ok := ret.Get(0).(func(types.Context) (observertypes.TSS, bool)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(types.Context) observertypes.TSS); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(observertypes.TSS) + } + + if rf, ok := ret.Get(1).(func(types.Context) bool); ok { + r1 = rf(ctx) + } else { + r1 = ret.Get(1).(bool) + } + + return r0, r1 +} + +// GetTSS provides a mock function with given fields: ctx +func (_m *CrosschainObserverKeeper) GetTSS(ctx types.Context) (observertypes.TSS, bool) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetTSS") + } + + var r0 observertypes.TSS + var r1 bool + if rf, ok := ret.Get(0).(func(types.Context) (observertypes.TSS, bool)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(types.Context) observertypes.TSS); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(observertypes.TSS) + } + + if rf, ok := ret.Get(1).(func(types.Context) bool); ok { + r1 = rf(ctx) + } else { + r1 = ret.Get(1).(bool) + } + + return r0, r1 +} + +// GetTssAddress provides a mock function with given fields: goCtx, req +func (_m *CrosschainObserverKeeper) GetTssAddress(goCtx context.Context, req *observertypes.QueryGetTssAddressRequest) (*observertypes.QueryGetTssAddressResponse, error) { + ret := _m.Called(goCtx, req) + + if len(ret) == 0 { + panic("no return value specified for GetTssAddress") + } + + var r0 *observertypes.QueryGetTssAddressResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *observertypes.QueryGetTssAddressRequest) (*observertypes.QueryGetTssAddressResponse, error)); ok { + return rf(goCtx, req) + } + if rf, ok := ret.Get(0).(func(context.Context, *observertypes.QueryGetTssAddressRequest) *observertypes.QueryGetTssAddressResponse); ok { + r0 = rf(goCtx, req) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*observertypes.QueryGetTssAddressResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *observertypes.QueryGetTssAddressRequest) error); ok { + r1 = rf(goCtx, req) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // IsAuthorized provides a mock function with given fields: ctx, address, chain func (_m *CrosschainObserverKeeper) IsAuthorized(ctx types.Context, address string, chain *common.Chain) bool { ret := _m.Called(ctx, address, chain) + if len(ret) == 0 { + panic("no return value specified for IsAuthorized") + } + var r0 bool if rf, ok := ret.Get(0).(func(types.Context, string, *common.Chain) bool); ok { r0 = rf(ctx, address, chain) @@ -350,6 +749,10 @@ func (_m *CrosschainObserverKeeper) IsAuthorized(ctx types.Context, address stri func (_m *CrosschainObserverKeeper) IsInboundEnabled(ctx types.Context) bool { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for IsInboundEnabled") + } + var r0 bool if rf, ok := ret.Get(0).(func(types.Context) bool); ok { r0 = rf(ctx) @@ -360,16 +763,46 @@ func (_m *CrosschainObserverKeeper) IsInboundEnabled(ctx types.Context) bool { return r0 } +// RemoveAllExistingMigrators provides a mock function with given fields: ctx +func (_m *CrosschainObserverKeeper) RemoveAllExistingMigrators(ctx types.Context) { + _m.Called(ctx) +} + +// RemoveChainNonces provides a mock function with given fields: ctx, index +func (_m *CrosschainObserverKeeper) RemoveChainNonces(ctx types.Context, index string) { + _m.Called(ctx, index) +} + +// RemoveFromPendingNonces provides a mock function with given fields: ctx, tss, chainID, nonce +func (_m *CrosschainObserverKeeper) RemoveFromPendingNonces(ctx types.Context, tss string, chainID int64, nonce int64) { + _m.Called(ctx, tss, chainID, nonce) +} + +// RemoveNonceToCctx provides a mock function with given fields: ctx, cctx +func (_m *CrosschainObserverKeeper) RemoveNonceToCctx(ctx types.Context, cctx observertypes.NonceToCctx) { + _m.Called(ctx, cctx) +} + // SetBallot provides a mock function with given fields: ctx, ballot func (_m *CrosschainObserverKeeper) SetBallot(ctx types.Context, ballot *observertypes.Ballot) { _m.Called(ctx, ballot) } +// SetChainNonces provides a mock function with given fields: ctx, chainNonces +func (_m *CrosschainObserverKeeper) SetChainNonces(ctx types.Context, chainNonces observertypes.ChainNonces) { + _m.Called(ctx, chainNonces) +} + // SetCrosschainFlags provides a mock function with given fields: ctx, crosschainFlags func (_m *CrosschainObserverKeeper) SetCrosschainFlags(ctx types.Context, crosschainFlags observertypes.CrosschainFlags) { _m.Called(ctx, crosschainFlags) } +// SetFundMigrator provides a mock function with given fields: ctx, fm +func (_m *CrosschainObserverKeeper) SetFundMigrator(ctx types.Context, fm observertypes.TssFundMigratorInfo) { + _m.Called(ctx, fm) +} + // SetKeygen provides a mock function with given fields: ctx, keygen func (_m *CrosschainObserverKeeper) SetKeygen(ctx types.Context, keygen observertypes.Keygen) { _m.Called(ctx, keygen) @@ -385,11 +818,36 @@ func (_m *CrosschainObserverKeeper) SetNodeAccount(ctx types.Context, nodeAccoun _m.Called(ctx, nodeAccount) } +// SetNonceToCctx provides a mock function with given fields: ctx, nonceToCctx +func (_m *CrosschainObserverKeeper) SetNonceToCctx(ctx types.Context, nonceToCctx observertypes.NonceToCctx) { + _m.Called(ctx, nonceToCctx) +} + // SetObserverMapper provides a mock function with given fields: ctx, om func (_m *CrosschainObserverKeeper) SetObserverMapper(ctx types.Context, om *observertypes.ObserverMapper) { _m.Called(ctx, om) } +// SetPendingNonces provides a mock function with given fields: ctx, pendingNonces +func (_m *CrosschainObserverKeeper) SetPendingNonces(ctx types.Context, pendingNonces observertypes.PendingNonces) { + _m.Called(ctx, pendingNonces) +} + +// SetTSS provides a mock function with given fields: ctx, tss +func (_m *CrosschainObserverKeeper) SetTSS(ctx types.Context, tss observertypes.TSS) { + _m.Called(ctx, tss) +} + +// SetTSSHistory provides a mock function with given fields: ctx, tss +func (_m *CrosschainObserverKeeper) SetTSSHistory(ctx types.Context, tss observertypes.TSS) { + _m.Called(ctx, tss) +} + +// SetTssAndUpdateNonce provides a mock function with given fields: ctx, tss +func (_m *CrosschainObserverKeeper) SetTssAndUpdateNonce(ctx types.Context, tss observertypes.TSS) { + _m.Called(ctx, tss) +} + // NewCrosschainObserverKeeper creates a new instance of CrosschainObserverKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewCrosschainObserverKeeper(t interface { diff --git a/testutil/keeper/mocks/crosschain/staking.go b/testutil/keeper/mocks/crosschain/staking.go index 921aecb21b..a72a747e5a 100644 --- a/testutil/keeper/mocks/crosschain/staking.go +++ b/testutil/keeper/mocks/crosschain/staking.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.0. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks @@ -19,6 +19,10 @@ type CrosschainStakingKeeper struct { func (_m *CrosschainStakingKeeper) GetAllValidators(ctx types.Context) []stakingtypes.Validator { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetAllValidators") + } + var r0 []stakingtypes.Validator if rf, ok := ret.Get(0).(func(types.Context) []stakingtypes.Validator); ok { r0 = rf(ctx) @@ -35,6 +39,10 @@ func (_m *CrosschainStakingKeeper) GetAllValidators(ctx types.Context) []staking func (_m *CrosschainStakingKeeper) GetValidator(ctx types.Context, addr types.ValAddress) (stakingtypes.Validator, bool) { ret := _m.Called(ctx, addr) + if len(ret) == 0 { + panic("no return value specified for GetValidator") + } + var r0 stakingtypes.Validator var r1 bool if rf, ok := ret.Get(0).(func(types.Context, types.ValAddress) (stakingtypes.Validator, bool)); ok { diff --git a/testutil/keeper/mocks/fungible/account.go b/testutil/keeper/mocks/fungible/account.go index fb67fadaab..0522e833b4 100644 --- a/testutil/keeper/mocks/fungible/account.go +++ b/testutil/keeper/mocks/fungible/account.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.0. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks @@ -18,6 +18,10 @@ type FungibleAccountKeeper struct { func (_m *FungibleAccountKeeper) GetAccount(ctx types.Context, addr types.AccAddress) authtypes.AccountI { ret := _m.Called(ctx, addr) + if len(ret) == 0 { + panic("no return value specified for GetAccount") + } + var r0 authtypes.AccountI if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress) authtypes.AccountI); ok { r0 = rf(ctx, addr) @@ -34,6 +38,10 @@ func (_m *FungibleAccountKeeper) GetAccount(ctx types.Context, addr types.AccAdd func (_m *FungibleAccountKeeper) GetModuleAccount(ctx types.Context, name string) authtypes.ModuleAccountI { ret := _m.Called(ctx, name) + if len(ret) == 0 { + panic("no return value specified for GetModuleAccount") + } + var r0 authtypes.ModuleAccountI if rf, ok := ret.Get(0).(func(types.Context, string) authtypes.ModuleAccountI); ok { r0 = rf(ctx, name) @@ -50,6 +58,10 @@ func (_m *FungibleAccountKeeper) GetModuleAccount(ctx types.Context, name string func (_m *FungibleAccountKeeper) GetSequence(ctx types.Context, addr types.AccAddress) (uint64, error) { ret := _m.Called(ctx, addr) + if len(ret) == 0 { + panic("no return value specified for GetSequence") + } + var r0 uint64 var r1 error if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress) (uint64, error)); ok { @@ -74,6 +86,10 @@ func (_m *FungibleAccountKeeper) GetSequence(ctx types.Context, addr types.AccAd func (_m *FungibleAccountKeeper) HasAccount(ctx types.Context, addr types.AccAddress) bool { ret := _m.Called(ctx, addr) + if len(ret) == 0 { + panic("no return value specified for HasAccount") + } + var r0 bool if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress) bool); ok { r0 = rf(ctx, addr) @@ -88,6 +104,10 @@ func (_m *FungibleAccountKeeper) HasAccount(ctx types.Context, addr types.AccAdd func (_m *FungibleAccountKeeper) NewAccountWithAddress(ctx types.Context, addr types.AccAddress) authtypes.AccountI { ret := _m.Called(ctx, addr) + if len(ret) == 0 { + panic("no return value specified for NewAccountWithAddress") + } + var r0 authtypes.AccountI if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress) authtypes.AccountI); ok { r0 = rf(ctx, addr) diff --git a/testutil/keeper/mocks/fungible/bank.go b/testutil/keeper/mocks/fungible/bank.go index 32213347fb..5b9fb0dd04 100644 --- a/testutil/keeper/mocks/fungible/bank.go +++ b/testutil/keeper/mocks/fungible/bank.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.0. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks @@ -18,6 +18,10 @@ type FungibleBankKeeper struct { func (_m *FungibleBankKeeper) BlockedAddr(addr types.AccAddress) bool { ret := _m.Called(addr) + if len(ret) == 0 { + panic("no return value specified for BlockedAddr") + } + var r0 bool if rf, ok := ret.Get(0).(func(types.AccAddress) bool); ok { r0 = rf(addr) @@ -32,6 +36,10 @@ func (_m *FungibleBankKeeper) BlockedAddr(addr types.AccAddress) bool { func (_m *FungibleBankKeeper) BurnCoins(ctx types.Context, moduleName string, amt types.Coins) error { ret := _m.Called(ctx, moduleName, amt) + if len(ret) == 0 { + panic("no return value specified for BurnCoins") + } + var r0 error if rf, ok := ret.Get(0).(func(types.Context, string, types.Coins) error); ok { r0 = rf(ctx, moduleName, amt) @@ -46,6 +54,10 @@ func (_m *FungibleBankKeeper) BurnCoins(ctx types.Context, moduleName string, am func (_m *FungibleBankKeeper) GetBalance(ctx types.Context, addr types.AccAddress, denom string) types.Coin { ret := _m.Called(ctx, addr, denom) + if len(ret) == 0 { + panic("no return value specified for GetBalance") + } + var r0 types.Coin if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, string) types.Coin); ok { r0 = rf(ctx, addr, denom) @@ -60,6 +72,10 @@ func (_m *FungibleBankKeeper) GetBalance(ctx types.Context, addr types.AccAddres func (_m *FungibleBankKeeper) GetDenomMetaData(ctx types.Context, denom string) (banktypes.Metadata, bool) { ret := _m.Called(ctx, denom) + if len(ret) == 0 { + panic("no return value specified for GetDenomMetaData") + } + var r0 banktypes.Metadata var r1 bool if rf, ok := ret.Get(0).(func(types.Context, string) (banktypes.Metadata, bool)); ok { @@ -84,6 +100,10 @@ func (_m *FungibleBankKeeper) GetDenomMetaData(ctx types.Context, denom string) func (_m *FungibleBankKeeper) HasSupply(ctx types.Context, denom string) bool { ret := _m.Called(ctx, denom) + if len(ret) == 0 { + panic("no return value specified for HasSupply") + } + var r0 bool if rf, ok := ret.Get(0).(func(types.Context, string) bool); ok { r0 = rf(ctx, denom) @@ -98,6 +118,10 @@ func (_m *FungibleBankKeeper) HasSupply(ctx types.Context, denom string) bool { func (_m *FungibleBankKeeper) IsSendEnabledCoin(ctx types.Context, coin types.Coin) bool { ret := _m.Called(ctx, coin) + if len(ret) == 0 { + panic("no return value specified for IsSendEnabledCoin") + } + var r0 bool if rf, ok := ret.Get(0).(func(types.Context, types.Coin) bool); ok { r0 = rf(ctx, coin) @@ -112,6 +136,10 @@ func (_m *FungibleBankKeeper) IsSendEnabledCoin(ctx types.Context, coin types.Co func (_m *FungibleBankKeeper) MintCoins(ctx types.Context, moduleName string, amt types.Coins) error { ret := _m.Called(ctx, moduleName, amt) + if len(ret) == 0 { + panic("no return value specified for MintCoins") + } + var r0 error if rf, ok := ret.Get(0).(func(types.Context, string, types.Coins) error); ok { r0 = rf(ctx, moduleName, amt) @@ -126,6 +154,10 @@ func (_m *FungibleBankKeeper) MintCoins(ctx types.Context, moduleName string, am func (_m *FungibleBankKeeper) SendCoinsFromAccountToModule(ctx types.Context, senderAddr types.AccAddress, recipientModule string, amt types.Coins) error { ret := _m.Called(ctx, senderAddr, recipientModule, amt) + if len(ret) == 0 { + panic("no return value specified for SendCoinsFromAccountToModule") + } + var r0 error if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, string, types.Coins) error); ok { r0 = rf(ctx, senderAddr, recipientModule, amt) @@ -140,6 +172,10 @@ func (_m *FungibleBankKeeper) SendCoinsFromAccountToModule(ctx types.Context, se func (_m *FungibleBankKeeper) SendCoinsFromModuleToAccount(ctx types.Context, senderModule string, recipientAddr types.AccAddress, amt types.Coins) error { ret := _m.Called(ctx, senderModule, recipientAddr, amt) + if len(ret) == 0 { + panic("no return value specified for SendCoinsFromModuleToAccount") + } + var r0 error if rf, ok := ret.Get(0).(func(types.Context, string, types.AccAddress, types.Coins) error); ok { r0 = rf(ctx, senderModule, recipientAddr, amt) diff --git a/testutil/keeper/mocks/fungible/evm.go b/testutil/keeper/mocks/fungible/evm.go index 0dbfc1fe14..f42cc011a3 100644 --- a/testutil/keeper/mocks/fungible/evm.go +++ b/testutil/keeper/mocks/fungible/evm.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.0. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks @@ -30,6 +30,10 @@ type FungibleEVMKeeper struct { func (_m *FungibleEVMKeeper) ApplyMessage(ctx types.Context, msg core.Message, tracer vm.EVMLogger, commit bool) (*evmtypes.MsgEthereumTxResponse, error) { ret := _m.Called(ctx, msg, tracer, commit) + if len(ret) == 0 { + panic("no return value specified for ApplyMessage") + } + var r0 *evmtypes.MsgEthereumTxResponse var r1 error if rf, ok := ret.Get(0).(func(types.Context, core.Message, vm.EVMLogger, bool) (*evmtypes.MsgEthereumTxResponse, error)); ok { @@ -56,6 +60,10 @@ func (_m *FungibleEVMKeeper) ApplyMessage(ctx types.Context, msg core.Message, t func (_m *FungibleEVMKeeper) ChainID() *big.Int { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ChainID") + } + var r0 *big.Int if rf, ok := ret.Get(0).(func() *big.Int); ok { r0 = rf() @@ -72,6 +80,10 @@ func (_m *FungibleEVMKeeper) ChainID() *big.Int { func (_m *FungibleEVMKeeper) EstimateGas(c context.Context, req *evmtypes.EthCallRequest) (*evmtypes.EstimateGasResponse, error) { ret := _m.Called(c, req) + if len(ret) == 0 { + panic("no return value specified for EstimateGas") + } + var r0 *evmtypes.EstimateGasResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *evmtypes.EthCallRequest) (*evmtypes.EstimateGasResponse, error)); ok { @@ -98,6 +110,10 @@ func (_m *FungibleEVMKeeper) EstimateGas(c context.Context, req *evmtypes.EthCal func (_m *FungibleEVMKeeper) GetAccount(ctx types.Context, addr common.Address) *statedb.Account { ret := _m.Called(ctx, addr) + if len(ret) == 0 { + panic("no return value specified for GetAccount") + } + var r0 *statedb.Account if rf, ok := ret.Get(0).(func(types.Context, common.Address) *statedb.Account); ok { r0 = rf(ctx, addr) @@ -114,6 +130,10 @@ func (_m *FungibleEVMKeeper) GetAccount(ctx types.Context, addr common.Address) func (_m *FungibleEVMKeeper) GetBlockBloomTransient(ctx types.Context) *big.Int { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetBlockBloomTransient") + } + var r0 *big.Int if rf, ok := ret.Get(0).(func(types.Context) *big.Int); ok { r0 = rf(ctx) @@ -130,6 +150,10 @@ func (_m *FungibleEVMKeeper) GetBlockBloomTransient(ctx types.Context) *big.Int func (_m *FungibleEVMKeeper) GetLogSizeTransient(ctx types.Context) uint64 { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetLogSizeTransient") + } + var r0 uint64 if rf, ok := ret.Get(0).(func(types.Context) uint64); ok { r0 = rf(ctx) @@ -144,6 +168,10 @@ func (_m *FungibleEVMKeeper) GetLogSizeTransient(ctx types.Context) uint64 { func (_m *FungibleEVMKeeper) SetAccount(ctx types.Context, addr common.Address, account statedb.Account) error { ret := _m.Called(ctx, addr, account) + if len(ret) == 0 { + panic("no return value specified for SetAccount") + } + var r0 error if rf, ok := ret.Get(0).(func(types.Context, common.Address, statedb.Account) error); ok { r0 = rf(ctx, addr, account) diff --git a/testutil/keeper/mocks/fungible/observer.go b/testutil/keeper/mocks/fungible/observer.go index 03e67b1a7b..28fcbba60a 100644 --- a/testutil/keeper/mocks/fungible/observer.go +++ b/testutil/keeper/mocks/fungible/observer.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.0. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks @@ -20,6 +20,10 @@ type FungibleObserverKeeper struct { func (_m *FungibleObserverKeeper) GetAllBallots(ctx types.Context) []*observertypes.Ballot { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetAllBallots") + } + var r0 []*observertypes.Ballot if rf, ok := ret.Get(0).(func(types.Context) []*observertypes.Ballot); ok { r0 = rf(ctx) @@ -36,6 +40,10 @@ func (_m *FungibleObserverKeeper) GetAllBallots(ctx types.Context) []*observerty func (_m *FungibleObserverKeeper) GetAllObserverMappers(ctx types.Context) []*observertypes.ObserverMapper { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetAllObserverMappers") + } + var r0 []*observertypes.ObserverMapper if rf, ok := ret.Get(0).(func(types.Context) []*observertypes.ObserverMapper); ok { r0 = rf(ctx) @@ -52,6 +60,10 @@ func (_m *FungibleObserverKeeper) GetAllObserverMappers(ctx types.Context) []*ob func (_m *FungibleObserverKeeper) GetBallot(ctx types.Context, index string) (observertypes.Ballot, bool) { ret := _m.Called(ctx, index) + if len(ret) == 0 { + panic("no return value specified for GetBallot") + } + var r0 observertypes.Ballot var r1 bool if rf, ok := ret.Get(0).(func(types.Context, string) (observertypes.Ballot, bool)); ok { @@ -76,6 +88,10 @@ func (_m *FungibleObserverKeeper) GetBallot(ctx types.Context, index string) (ob func (_m *FungibleObserverKeeper) GetCoreParamsByChainID(ctx types.Context, chainID int64) (*observertypes.CoreParams, bool) { ret := _m.Called(ctx, chainID) + if len(ret) == 0 { + panic("no return value specified for GetCoreParamsByChainID") + } + var r0 *observertypes.CoreParams var r1 bool if rf, ok := ret.Get(0).(func(types.Context, int64) (*observertypes.CoreParams, bool)); ok { @@ -102,6 +118,10 @@ func (_m *FungibleObserverKeeper) GetCoreParamsByChainID(ctx types.Context, chai func (_m *FungibleObserverKeeper) GetObserverMapper(ctx types.Context, chain *common.Chain) (observertypes.ObserverMapper, bool) { ret := _m.Called(ctx, chain) + if len(ret) == 0 { + panic("no return value specified for GetObserverMapper") + } + var r0 observertypes.ObserverMapper var r1 bool if rf, ok := ret.Get(0).(func(types.Context, *common.Chain) (observertypes.ObserverMapper, bool)); ok { @@ -126,6 +146,10 @@ func (_m *FungibleObserverKeeper) GetObserverMapper(ctx types.Context, chain *co func (_m *FungibleObserverKeeper) GetParams(ctx types.Context) observertypes.Params { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetParams") + } + var r0 observertypes.Params if rf, ok := ret.Get(0).(func(types.Context) observertypes.Params); ok { r0 = rf(ctx) diff --git a/testutil/network/genesis_state.go b/testutil/network/genesis_state.go index ff1596e88d..623115330d 100644 --- a/testutil/network/genesis_state.go +++ b/testutil/network/genesis_state.go @@ -15,7 +15,7 @@ import ( "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/testutil/nullify" "github.com/zeta-chain/zetacore/x/crosschain/types" - observerTypes "github.com/zeta-chain/zetacore/x/observer/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) func SetupZetaGenesisState(t *testing.T, genesisState map[string]json.RawMessage, codec codec.Codec, observerList []string, setupChainNonces bool) { @@ -23,24 +23,13 @@ func SetupZetaGenesisState(t *testing.T, genesisState map[string]json.RawMessage // Cross-chain genesis state var crossChainGenesis types.GenesisState assert.NoError(t, codec.UnmarshalJSON(genesisState[types.ModuleName], &crossChainGenesis)) - nodeAccountList := make([]*observerTypes.NodeAccount, len(observerList)) + nodeAccountList := make([]*observertypes.NodeAccount, len(observerList)) for i, operator := range observerList { - nodeAccountList[i] = &observerTypes.NodeAccount{ + nodeAccountList[i] = &observertypes.NodeAccount{ Operator: operator, - NodeStatus: observerTypes.NodeStatus_Active, + NodeStatus: observertypes.NodeStatus_Active, } } - if setupChainNonces { - chainNonceList := make([]*types.ChainNonces, len(common.DefaultChainsList())) - for i, chain := range common.DefaultChainsList() { - chainNonceList[i] = &types.ChainNonces{ - Index: chain.ChainName.String(), - ChainId: chain.ChainId, - Nonce: 0, - } - } - crossChainGenesis.ChainNoncesList = chainNonceList - } crossChainGenesis.Params.Enabled = true assert.NoError(t, crossChainGenesis.Validate()) @@ -63,62 +52,99 @@ func SetupZetaGenesisState(t *testing.T, genesisState map[string]json.RawMessage assert.NoError(t, err) // Observer genesis state - var observerGenesis observerTypes.GenesisState - assert.NoError(t, codec.UnmarshalJSON(genesisState[observerTypes.ModuleName], &observerGenesis)) - observerMapper := make([]*observerTypes.ObserverMapper, len(common.DefaultChainsList())) + var observerGenesis observertypes.GenesisState + assert.NoError(t, codec.UnmarshalJSON(genesisState[observertypes.ModuleName], &observerGenesis)) + observerMapper := make([]*observertypes.ObserverMapper, len(common.PrivnetChainList())) - for i, chain := range common.DefaultChainsList() { - observerMapper[i] = &observerTypes.ObserverMapper{ + for i, chain := range common.PrivnetChainList() { + observerMapper[i] = &observertypes.ObserverMapper{ ObserverChain: chain, ObserverList: observerList, } } + if setupChainNonces { + chainNonceList := make([]observertypes.ChainNonces, len(common.PrivnetChainList())) + for i, chain := range common.PrivnetChainList() { + chainNonceList[i] = observertypes.ChainNonces{ + Index: chain.ChainName.String(), + ChainId: chain.ChainId, + Nonce: 0, + } + } + observerGenesis.ChainNonces = chainNonceList + } + observerGenesis.Observers = observerMapper observerGenesis.NodeAccountList = nodeAccountList - observerGenesis.Keygen = &observerTypes.Keygen{ - Status: observerTypes.KeygenStatus_PendingKeygen, + observerGenesis.Keygen = &observertypes.Keygen{ + Status: observertypes.KeygenStatus_PendingKeygen, GranteePubkeys: observerList, BlockNumber: 5, } - assert.NoError(t, observerGenesis.Validate()) - observerGenesis.CrosschainFlags = &observerTypes.CrosschainFlags{ + // set admin policy with first validator as admin + observerGenesis.Params.AdminPolicy = []*observertypes.Admin_Policy{ + { + PolicyType: observertypes.Policy_Type_group1, + Address: "zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax", + }, + { + PolicyType: observertypes.Policy_Type_group2, + Address: "zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax", + }, + } + observerGenesis.CrosschainFlags = &observertypes.CrosschainFlags{ IsInboundEnabled: true, IsOutboundEnabled: true, } + assert.NoError(t, observerGenesis.Validate()) observerGenesisBz, err := codec.MarshalJSON(&observerGenesis) assert.NoError(t, err) genesisState[types.ModuleName] = crossChainGenesisBz genesisState[stakingtypes.ModuleName] = stakingGenesisStateBz - genesisState[observerTypes.ModuleName] = observerGenesisBz + genesisState[observertypes.ModuleName] = observerGenesisBz genesisState[evmtypes.ModuleName] = evmGenesisBz } -func AddObserverData(t *testing.T, genesisState map[string]json.RawMessage, codec codec.Codec, ballots []*observerTypes.Ballot) *observerTypes.GenesisState { - state := observerTypes.GenesisState{} - assert.NoError(t, codec.UnmarshalJSON(genesisState[observerTypes.ModuleName], &state)) +func AddObserverData(t *testing.T, n int, genesisState map[string]json.RawMessage, codec codec.Codec, ballots []*observertypes.Ballot) *observertypes.GenesisState { + state := observertypes.GenesisState{} + assert.NoError(t, codec.UnmarshalJSON(genesisState[observertypes.ModuleName], &state)) if len(ballots) > 0 { state.Ballots = ballots } //params := observerTypes.DefaultParams() //params.BallotMaturityBlocks = 3 state.Params.BallotMaturityBlocks = 3 - state.Keygen = &observerTypes.Keygen{BlockNumber: 10, GranteePubkeys: []string{}} - crosschainFlags := &observerTypes.CrosschainFlags{ + state.Keygen = &observertypes.Keygen{BlockNumber: 10, GranteePubkeys: []string{}} + crosschainFlags := &observertypes.CrosschainFlags{ IsInboundEnabled: true, IsOutboundEnabled: true, - GasPriceIncreaseFlags: &observerTypes.DefaultGasPriceIncreaseFlags, - BlockHeaderVerificationFlags: &observerTypes.DefaultBlockHeaderVerificationFlags, + GasPriceIncreaseFlags: &observertypes.DefaultGasPriceIncreaseFlags, + BlockHeaderVerificationFlags: &observertypes.DefaultBlockHeaderVerificationFlags, + } + tss := observertypes.TSS{ + TssPubkey: "tssPubkey", + TssParticipantList: []string{"tssParticipantList"}, + OperatorAddressList: []string{"operatorAddressList"}, + FinalizedZetaHeight: 1, + KeyGenZetaHeight: 1, } + state.Tss = &tss + + state.TssHistory = []observertypes.TSS{tss} nullify.Fill(&crosschainFlags) state.CrosschainFlags = crosschainFlags + for i := 0; i < n; i++ { + state.ChainNonces = append(state.ChainNonces, observertypes.ChainNonces{Creator: "ANY", Index: strconv.Itoa(i), Signers: []string{}}) + } + assert.NoError(t, state.Validate()) buf, err := codec.MarshalJSON(&state) assert.NoError(t, err) - genesisState[observerTypes.ModuleName] = buf + genesisState[observertypes.ModuleName] = buf return &state } func AddCrosschainData(t *testing.T, n int, genesisState map[string]json.RawMessage, codec codec.Codec) *types.GenesisState { @@ -139,34 +165,13 @@ func AddCrosschainData(t *testing.T, n int, genesisState map[string]json.RawMess ZetaFees: math.OneUint()}, ) } - for i := 0; i < n; i++ { - state.ChainNoncesList = append(state.ChainNoncesList, &types.ChainNonces{Creator: "ANY", Index: strconv.Itoa(i), Signers: []string{}}) - } + for i := 0; i < n; i++ { state.GasPriceList = append(state.GasPriceList, &types.GasPrice{Creator: "ANY", ChainId: int64(i), Index: strconv.Itoa(i), Prices: []uint64{}, BlockNums: []uint64{}, Signers: []string{}}) } for i := 0; i < n; i++ { state.LastBlockHeightList = append(state.LastBlockHeightList, &types.LastBlockHeight{Creator: "ANY", Index: strconv.Itoa(i)}) } - tss := types.TSS{ - TssPubkey: "tssPubkey", - TssParticipantList: []string{"tssParticipantList"}, - OperatorAddressList: []string{"operatorAddressList"}, - FinalizedZetaHeight: 1, - KeyGenZetaHeight: 1, - } - state.Tss = &tss - - state.TssHistory = []types.TSS{tss} - for i := 0; i < n; i++ { - outTxTracker := types.OutTxTracker{ - Index: fmt.Sprintf("%d-%d", i, i), - ChainId: int64(i), - Nonce: uint64(i), - } - nullify.Fill(&outTxTracker) - state.OutTxTrackerList = append(state.OutTxTrackerList, outTxTracker) - } for i := 0; i < n; i++ { inTxTracker := types.InTxTracker{ @@ -185,6 +190,15 @@ func AddCrosschainData(t *testing.T, n int, genesisState map[string]json.RawMess nullify.Fill(&inTxHashToCctx) state.InTxHashToCctxList = append(state.InTxHashToCctxList, inTxHashToCctx) } + for i := 0; i < n; i++ { + outTxTracker := types.OutTxTracker{ + Index: fmt.Sprintf("%d-%d", i, i), + ChainId: int64(i), + Nonce: uint64(i), + } + nullify.Fill(&outTxTracker) + state.OutTxTrackerList = append(state.OutTxTrackerList, outTxTracker) + } assert.NoError(t, state.Validate()) diff --git a/testutil/network/util.go b/testutil/network/util.go index 4354e98155..e6ee8fae25 100644 --- a/testutil/network/util.go +++ b/testutil/network/util.go @@ -202,7 +202,7 @@ func writeFile(name string, dir string, contents []byte) error { return err } - err = os.WriteFile(file, contents, 0644) // #nosec + err = os.WriteFile(file, contents, 0600) if err != nil { return err } diff --git a/testutil/sample/crosschain.go b/testutil/sample/crosschain.go index 90027101a2..a2e1e18846 100644 --- a/testutil/sample/crosschain.go +++ b/testutil/sample/crosschain.go @@ -5,7 +5,6 @@ import ( "testing" "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/crosschain/types" ) @@ -20,14 +19,6 @@ func OutTxTracker(t *testing.T, index string) types.OutTxTracker { } } -func Tss() *types.TSS { - return &types.TSS{ - TssPubkey: ed25519.GenPrivKey().PubKey().String(), - FinalizedZetaHeight: 1000, - KeyGenZetaHeight: 1000, - } -} - func GasPrice(t *testing.T, index string) *types.GasPrice { r := newRandFromStringSeed(t, index) @@ -42,19 +33,6 @@ func GasPrice(t *testing.T, index string) *types.GasPrice { } } -func ChainNonces(t *testing.T, index string) *types.ChainNonces { - r := newRandFromStringSeed(t, index) - - return &types.ChainNonces{ - Creator: AccAddress(), - Index: index, - ChainId: r.Int63(), - Nonce: r.Uint64(), - Signers: []string{AccAddress(), AccAddress()}, - FinalizedHeight: r.Uint64(), - } -} - func InboundTxParams(r *rand.Rand) *types.InboundTxParams { return &types.InboundTxParams{ Sender: EthAddress().String(), @@ -131,3 +109,10 @@ func InTxHashToCctx(t *testing.T, inTxHash string) types.InTxHashToCctx { CctxIndex: []string{StringRandom(r, 32), StringRandom(r, 32)}, } } + +func ZetaAccounting(t *testing.T, index string) types.ZetaAccounting { + r := newRandFromStringSeed(t, index) + return types.ZetaAccounting{ + AbortedZetaAmount: math.NewUint(uint64(r.Int63())), + } +} diff --git a/testutil/sample/observer.go b/testutil/sample/observer.go index 3e1d4c7208..ac1395411e 100644 --- a/testutil/sample/observer.go +++ b/testutil/sample/observer.go @@ -1,11 +1,14 @@ package sample import ( + "fmt" "testing" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/common/cosmos" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -91,10 +94,109 @@ func CoreParams(chainID int64) *types.CoreParams { } func CoreParamsList() (cpl types.CoreParamsList) { - chainList := common.DefaultChainsList() + chainList := common.PrivnetChainList() for _, chain := range chainList { cpl.CoreParams = append(cpl.CoreParams, CoreParams(chain.ChainId)) } return } + +func Tss() types.TSS { + _, pubKey, _ := testdata.KeyTestPubAddr() + spk, err := cosmos.Bech32ifyPubKey(cosmos.Bech32PubKeyTypeAccPub, pubKey) + if err != nil { + panic(err) + } + pk, err := common.NewPubKey(spk) + if err != nil { + panic(err) + } + pubkeyString := pk.String() + return types.TSS{ + TssPubkey: pubkeyString, + FinalizedZetaHeight: 1000, + KeyGenZetaHeight: 1000, + } +} + +func TssList(n int) (tssList []types.TSS) { + for i := 0; i < n; i++ { + tss := Tss() + tss.FinalizedZetaHeight = tss.FinalizedZetaHeight + int64(i) + tss.KeyGenZetaHeight = tss.KeyGenZetaHeight + int64(i) + tssList = append(tssList, tss) + } + return +} + +func TssFundsMigrator(chainID int64) types.TssFundMigratorInfo { + return types.TssFundMigratorInfo{ + ChainId: chainID, + MigrationCctxIndex: "sampleIndex", + } +} + +func BlameRecord(t *testing.T, index string) types.Blame { + r := newRandFromStringSeed(t, index) + return types.Blame{ + Index: fmt.Sprintf("%d-%s", r.Int63(), index), + FailureReason: "sample failure reason", + Nodes: nil, + } +} +func BlameRecordsList(t *testing.T, n int) []types.Blame { + blameList := make([]types.Blame, n) + for i := 0; i < n; i++ { + blameList[i] = BlameRecord(t, fmt.Sprintf("%d", i)) + } + return blameList +} + +func ChainNonces(t *testing.T, index string) types.ChainNonces { + r := newRandFromStringSeed(t, index) + return types.ChainNonces{ + Creator: AccAddress(), + Index: index, + ChainId: r.Int63(), + Nonce: r.Uint64(), + Signers: []string{AccAddress(), AccAddress()}, + FinalizedHeight: r.Uint64(), + } +} + +func ChainNoncesList(t *testing.T, n int) []types.ChainNonces { + chainNoncesList := make([]types.ChainNonces, n) + for i := 0; i < n; i++ { + chainNoncesList[i] = ChainNonces(t, fmt.Sprintf("%d", i)) + } + return chainNoncesList +} + +func PendingNoncesList(t *testing.T, index string, count int) []types.PendingNonces { + r := newRandFromStringSeed(t, index) + nonceLow := r.Int63() + list := make([]types.PendingNonces, count) + for i := 0; i < count; i++ { + list[i] = types.PendingNonces{ + ChainId: int64(i), + NonceLow: nonceLow, + NonceHigh: nonceLow + r.Int63(), + Tss: StringRandom(r, 32), + } + } + return list +} + +func NonceToCctxList(t *testing.T, index string, count int) []types.NonceToCctx { + r := newRandFromStringSeed(t, index) + list := make([]types.NonceToCctx, count) + for i := 0; i < count; i++ { + list[i] = types.NonceToCctx{ + ChainId: int64(i), + Nonce: r.Int63(), + CctxIndex: StringRandom(r, 32), + } + } + return list +} diff --git a/testutil/sample/sample.go b/testutil/sample/sample.go index e28f191476..9085e7350c 100644 --- a/testutil/sample/sample.go +++ b/testutil/sample/sample.go @@ -100,6 +100,11 @@ func EthAddress() ethcommon.Address { return ethcommon.BytesToAddress(sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()).Bytes()) } +// Hash returns a sample hash +func Hash() ethcommon.Hash { + return EthAddress().Hash() +} + // Bytes returns a sample byte array func Bytes() []byte { return []byte("sample") diff --git a/typescript/common/common_pb.d.ts b/typescript/common/common_pb.d.ts index fdf8d0e3f4..dbba2518c0 100644 --- a/typescript/common/common_pb.d.ts +++ b/typescript/common/common_pb.d.ts @@ -132,6 +132,11 @@ export declare enum ChainName { */ btc_testnet = 12, + /** + * @generated from enum value: sepolia_testnet = 13; + */ + sepolia_testnet = 13, + /** * LocalNet * zeta_localnet = 13; diff --git a/typescript/crosschain/cross_chain_tx_pb.d.ts b/typescript/crosschain/cross_chain_tx_pb.d.ts index 3d4934dc05..4a00361f6f 100644 --- a/typescript/crosschain/cross_chain_tx_pb.d.ts +++ b/typescript/crosschain/cross_chain_tx_pb.d.ts @@ -129,6 +129,32 @@ export declare class InboundTxParams extends Message { static equals(a: InboundTxParams | PlainMessage | undefined, b: InboundTxParams | PlainMessage | undefined): boolean; } +/** + * @generated from message zetachain.zetacore.crosschain.ZetaAccounting + */ +export declare class ZetaAccounting extends Message { + /** + * aborted_zeta_amount stores the total aborted amount for cctx of coin-type ZETA + * + * @generated from field: string aborted_zeta_amount = 1; + */ + abortedZetaAmount: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.crosschain.ZetaAccounting"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): ZetaAccounting; + + static fromJson(jsonValue: JsonValue, options?: Partial): ZetaAccounting; + + static fromJsonString(jsonString: string, options?: Partial): ZetaAccounting; + + static equals(a: ZetaAccounting | PlainMessage | undefined, b: ZetaAccounting | PlainMessage | undefined): boolean; +} + /** * @generated from message zetachain.zetacore.crosschain.OutboundTxParams */ diff --git a/typescript/crosschain/genesis_pb.d.ts b/typescript/crosschain/genesis_pb.d.ts index b08be54a4a..7d4741170a 100644 --- a/typescript/crosschain/genesis_pb.d.ts +++ b/typescript/crosschain/genesis_pb.d.ts @@ -7,10 +7,8 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialM import { Message, proto3 } from "@bufbuild/protobuf"; import type { Params } from "./params_pb.js"; import type { OutTxTracker } from "./out_tx_tracker_pb.js"; -import type { TSS } from "./tss_pb.js"; import type { GasPrice } from "./gas_price_pb.js"; -import type { ChainNonces } from "./chain_nonces_pb.js"; -import type { CrossChainTx } from "./cross_chain_tx_pb.js"; +import type { CrossChainTx, ZetaAccounting } from "./cross_chain_tx_pb.js"; import type { LastBlockHeight } from "./last_block_height_pb.js"; import type { InTxHashToCctx } from "./in_tx_hash_to_cctx_pb.js"; import type { InTxTracker } from "./in_tx_tracker_pb.js"; @@ -31,21 +29,11 @@ export declare class GenesisState extends Message { */ outTxTrackerList: OutTxTracker[]; - /** - * @generated from field: zetachain.zetacore.crosschain.TSS tss = 4; - */ - tss?: TSS; - /** * @generated from field: repeated zetachain.zetacore.crosschain.GasPrice gasPriceList = 5; */ gasPriceList: GasPrice[]; - /** - * @generated from field: repeated zetachain.zetacore.crosschain.ChainNonces chainNoncesList = 6; - */ - chainNoncesList: ChainNonces[]; - /** * @generated from field: repeated zetachain.zetacore.crosschain.CrossChainTx CrossChainTxs = 7; */ @@ -62,14 +50,14 @@ export declare class GenesisState extends Message { inTxHashToCctxList: InTxHashToCctx[]; /** - * @generated from field: repeated zetachain.zetacore.crosschain.TSS tss_history = 10; + * @generated from field: repeated zetachain.zetacore.crosschain.InTxTracker in_tx_tracker_list = 11; */ - tssHistory: TSS[]; + inTxTrackerList: InTxTracker[]; /** - * @generated from field: repeated zetachain.zetacore.crosschain.InTxTracker in_tx_tracker_list = 11; + * @generated from field: zetachain.zetacore.crosschain.ZetaAccounting zeta_accounting = 12; */ - inTxTrackerList: InTxTracker[]; + zetaAccounting?: ZetaAccounting; constructor(data?: PartialMessage); diff --git a/typescript/crosschain/index.d.ts b/typescript/crosschain/index.d.ts index f788e6e87e..4c073541bc 100644 --- a/typescript/crosschain/index.d.ts +++ b/typescript/crosschain/index.d.ts @@ -1,4 +1,3 @@ -export * from "./chain_nonces_pb"; export * from "./cross_chain_tx_pb"; export * from "./events_pb"; export * from "./gas_price_pb"; @@ -6,9 +5,7 @@ export * from "./genesis_pb"; export * from "./in_tx_hash_to_cctx_pb"; export * from "./in_tx_tracker_pb"; export * from "./last_block_height_pb"; -export * from "./nonce_to_cctx_pb"; export * from "./out_tx_tracker_pb"; export * from "./params_pb"; export * from "./query_pb"; -export * from "./tss_pb"; export * from "./tx_pb"; diff --git a/typescript/crosschain/nonce_to_cctx_pb.d.ts b/typescript/crosschain/nonce_to_cctx_pb.d.ts deleted file mode 100644 index e2a75c5aa8..0000000000 --- a/typescript/crosschain/nonce_to_cctx_pb.d.ts +++ /dev/null @@ -1,90 +0,0 @@ -// @generated by protoc-gen-es v1.3.0 with parameter "target=dts" -// @generated from file crosschain/nonce_to_cctx.proto (package zetachain.zetacore.crosschain, syntax proto3) -/* eslint-disable */ -// @ts-nocheck - -import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; -import { Message, proto3 } from "@bufbuild/protobuf"; - -/** - * store key is tss+chainid+nonce - * - * @generated from message zetachain.zetacore.crosschain.NonceToCctx - */ -export declare class NonceToCctx extends Message { - /** - * @generated from field: int64 chain_id = 1; - */ - chainId: bigint; - - /** - * @generated from field: int64 nonce = 2; - */ - nonce: bigint; - - /** - * @generated from field: string cctxIndex = 3; - */ - cctxIndex: string; - - /** - * @generated from field: string tss = 4; - */ - tss: string; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.NonceToCctx"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): NonceToCctx; - - static fromJson(jsonValue: JsonValue, options?: Partial): NonceToCctx; - - static fromJsonString(jsonString: string, options?: Partial): NonceToCctx; - - static equals(a: NonceToCctx | PlainMessage | undefined, b: NonceToCctx | PlainMessage | undefined): boolean; -} - -/** - * store key is tss+chainid - * - * @generated from message zetachain.zetacore.crosschain.PendingNonces - */ -export declare class PendingNonces extends Message { - /** - * @generated from field: int64 nonce_low = 1; - */ - nonceLow: bigint; - - /** - * @generated from field: int64 nonce_high = 2; - */ - nonceHigh: bigint; - - /** - * @generated from field: int64 chain_id = 3; - */ - chainId: bigint; - - /** - * @generated from field: string tss = 4; - */ - tss: string; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.PendingNonces"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): PendingNonces; - - static fromJson(jsonValue: JsonValue, options?: Partial): PendingNonces; - - static fromJsonString(jsonString: string, options?: Partial): PendingNonces; - - static equals(a: PendingNonces | PlainMessage | undefined, b: PendingNonces | PlainMessage | undefined): boolean; -} - diff --git a/typescript/crosschain/query_pb.d.ts b/typescript/crosschain/query_pb.d.ts index 2176ad0a5f..17bb54ef27 100644 --- a/typescript/crosschain/query_pb.d.ts +++ b/typescript/crosschain/query_pb.d.ts @@ -5,107 +5,56 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; import { Message, proto3 } from "@bufbuild/protobuf"; -import type { CctxStatus, CrossChainTx } from "./cross_chain_tx_pb.js"; -import type { TSS } from "./tss_pb.js"; import type { Params } from "./params_pb.js"; import type { OutTxTracker } from "./out_tx_tracker_pb.js"; import type { PageRequest, PageResponse } from "../cosmos/base/query/v1beta1/pagination_pb.js"; import type { InTxTracker } from "./in_tx_tracker_pb.js"; import type { InTxHashToCctx } from "./in_tx_hash_to_cctx_pb.js"; +import type { CrossChainTx } from "./cross_chain_tx_pb.js"; import type { GasPrice } from "./gas_price_pb.js"; -import type { ChainNonces } from "./chain_nonces_pb.js"; -import type { PendingNonces } from "./nonce_to_cctx_pb.js"; import type { LastBlockHeight } from "./last_block_height_pb.js"; /** - * @generated from message zetachain.zetacore.crosschain.QueryCctxByStatusRequest + * @generated from message zetachain.zetacore.crosschain.QueryZetaAccountingRequest */ -export declare class QueryCctxByStatusRequest extends Message { - /** - * @generated from field: zetachain.zetacore.crosschain.CctxStatus status = 1; - */ - status: CctxStatus; - - constructor(data?: PartialMessage); +export declare class QueryZetaAccountingRequest extends Message { + constructor(data?: PartialMessage); static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryCctxByStatusRequest"; + static readonly typeName = "zetachain.zetacore.crosschain.QueryZetaAccountingRequest"; static readonly fields: FieldList; - static fromBinary(bytes: Uint8Array, options?: Partial): QueryCctxByStatusRequest; + static fromBinary(bytes: Uint8Array, options?: Partial): QueryZetaAccountingRequest; - static fromJson(jsonValue: JsonValue, options?: Partial): QueryCctxByStatusRequest; + static fromJson(jsonValue: JsonValue, options?: Partial): QueryZetaAccountingRequest; - static fromJsonString(jsonString: string, options?: Partial): QueryCctxByStatusRequest; + static fromJsonString(jsonString: string, options?: Partial): QueryZetaAccountingRequest; - static equals(a: QueryCctxByStatusRequest | PlainMessage | undefined, b: QueryCctxByStatusRequest | PlainMessage | undefined): boolean; + static equals(a: QueryZetaAccountingRequest | PlainMessage | undefined, b: QueryZetaAccountingRequest | PlainMessage | undefined): boolean; } /** - * @generated from message zetachain.zetacore.crosschain.QueryCctxByStatusResponse + * @generated from message zetachain.zetacore.crosschain.QueryZetaAccountingResponse */ -export declare class QueryCctxByStatusResponse extends Message { +export declare class QueryZetaAccountingResponse extends Message { /** - * @generated from field: repeated zetachain.zetacore.crosschain.CrossChainTx CrossChainTx = 1; + * @generated from field: string aborted_zeta_amount = 1; */ - CrossChainTx: CrossChainTx[]; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryCctxByStatusResponse"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): QueryCctxByStatusResponse; - - static fromJson(jsonValue: JsonValue, options?: Partial): QueryCctxByStatusResponse; - - static fromJsonString(jsonString: string, options?: Partial): QueryCctxByStatusResponse; + abortedZetaAmount: string; - static equals(a: QueryCctxByStatusResponse | PlainMessage | undefined, b: QueryCctxByStatusResponse | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.crosschain.QueryTssHistoryRequest - */ -export declare class QueryTssHistoryRequest extends Message { - constructor(data?: PartialMessage); + constructor(data?: PartialMessage); static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryTssHistoryRequest"; + static readonly typeName = "zetachain.zetacore.crosschain.QueryZetaAccountingResponse"; static readonly fields: FieldList; - static fromBinary(bytes: Uint8Array, options?: Partial): QueryTssHistoryRequest; + static fromBinary(bytes: Uint8Array, options?: Partial): QueryZetaAccountingResponse; - static fromJson(jsonValue: JsonValue, options?: Partial): QueryTssHistoryRequest; + static fromJson(jsonValue: JsonValue, options?: Partial): QueryZetaAccountingResponse; - static fromJsonString(jsonString: string, options?: Partial): QueryTssHistoryRequest; + static fromJsonString(jsonString: string, options?: Partial): QueryZetaAccountingResponse; - static equals(a: QueryTssHistoryRequest | PlainMessage | undefined, b: QueryTssHistoryRequest | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.crosschain.QueryTssHistoryResponse - */ -export declare class QueryTssHistoryResponse extends Message { - /** - * @generated from field: repeated zetachain.zetacore.crosschain.TSS tss_list = 1; - */ - tssList: TSS[]; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryTssHistoryResponse"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): QueryTssHistoryResponse; - - static fromJson(jsonValue: JsonValue, options?: Partial): QueryTssHistoryResponse; - - static fromJsonString(jsonString: string, options?: Partial): QueryTssHistoryResponse; - - static equals(a: QueryTssHistoryResponse | PlainMessage | undefined, b: QueryTssHistoryResponse | PlainMessage | undefined): boolean; + static equals(a: QueryZetaAccountingResponse | PlainMessage | undefined, b: QueryZetaAccountingResponse | PlainMessage | undefined): boolean; } /** @@ -383,6 +332,11 @@ export declare class QueryAllInTxTrackerByChainResponse extends Message { + /** + * @generated from field: cosmos.base.query.v1beta1.PageRequest pagination = 1; + */ + pagination?: PageRequest; + constructor(data?: PartialMessage); static readonly runtime: typeof proto3; @@ -407,6 +361,11 @@ export declare class QueryAllInTxTrackersResponse extends Message); static readonly runtime: typeof proto3; @@ -571,102 +530,6 @@ export declare class QueryAllInTxHashToCctxResponse extends Message | undefined, b: QueryAllInTxHashToCctxResponse | PlainMessage | undefined): boolean; } -/** - * @generated from message zetachain.zetacore.crosschain.QueryGetTssAddressRequest - */ -export declare class QueryGetTssAddressRequest extends Message { - /** - * @generated from field: string tss_pub_key = 1; - */ - tssPubKey: string; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryGetTssAddressRequest"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): QueryGetTssAddressRequest; - - static fromJson(jsonValue: JsonValue, options?: Partial): QueryGetTssAddressRequest; - - static fromJsonString(jsonString: string, options?: Partial): QueryGetTssAddressRequest; - - static equals(a: QueryGetTssAddressRequest | PlainMessage | undefined, b: QueryGetTssAddressRequest | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.crosschain.QueryGetTssAddressResponse - */ -export declare class QueryGetTssAddressResponse extends Message { - /** - * @generated from field: string eth = 1; - */ - eth: string; - - /** - * @generated from field: string btc = 2; - */ - btc: string; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryGetTssAddressResponse"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): QueryGetTssAddressResponse; - - static fromJson(jsonValue: JsonValue, options?: Partial): QueryGetTssAddressResponse; - - static fromJsonString(jsonString: string, options?: Partial): QueryGetTssAddressResponse; - - static equals(a: QueryGetTssAddressResponse | PlainMessage | undefined, b: QueryGetTssAddressResponse | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.crosschain.QueryGetTSSRequest - */ -export declare class QueryGetTSSRequest extends Message { - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryGetTSSRequest"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): QueryGetTSSRequest; - - static fromJson(jsonValue: JsonValue, options?: Partial): QueryGetTSSRequest; - - static fromJsonString(jsonString: string, options?: Partial): QueryGetTSSRequest; - - static equals(a: QueryGetTSSRequest | PlainMessage | undefined, b: QueryGetTSSRequest | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.crosschain.QueryGetTSSResponse - */ -export declare class QueryGetTSSResponse extends Message { - /** - * @generated from field: zetachain.zetacore.crosschain.TSS TSS = 1; - */ - TSS?: TSS; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryGetTSSResponse"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): QueryGetTSSResponse; - - static fromJson(jsonValue: JsonValue, options?: Partial): QueryGetTSSResponse; - - static fromJsonString(jsonString: string, options?: Partial): QueryGetTSSResponse; - - static equals(a: QueryGetTSSResponse | PlainMessage | undefined, b: QueryGetTSSResponse | PlainMessage | undefined): boolean; -} - /** * @generated from message zetachain.zetacore.crosschain.QueryGetGasPriceRequest */ @@ -768,198 +631,6 @@ export declare class QueryAllGasPriceResponse extends Message | undefined, b: QueryAllGasPriceResponse | PlainMessage | undefined): boolean; } -/** - * @generated from message zetachain.zetacore.crosschain.QueryGetChainNoncesRequest - */ -export declare class QueryGetChainNoncesRequest extends Message { - /** - * @generated from field: string index = 1; - */ - index: string; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryGetChainNoncesRequest"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): QueryGetChainNoncesRequest; - - static fromJson(jsonValue: JsonValue, options?: Partial): QueryGetChainNoncesRequest; - - static fromJsonString(jsonString: string, options?: Partial): QueryGetChainNoncesRequest; - - static equals(a: QueryGetChainNoncesRequest | PlainMessage | undefined, b: QueryGetChainNoncesRequest | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.crosschain.QueryGetChainNoncesResponse - */ -export declare class QueryGetChainNoncesResponse extends Message { - /** - * @generated from field: zetachain.zetacore.crosschain.ChainNonces ChainNonces = 1; - */ - ChainNonces?: ChainNonces; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryGetChainNoncesResponse"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): QueryGetChainNoncesResponse; - - static fromJson(jsonValue: JsonValue, options?: Partial): QueryGetChainNoncesResponse; - - static fromJsonString(jsonString: string, options?: Partial): QueryGetChainNoncesResponse; - - static equals(a: QueryGetChainNoncesResponse | PlainMessage | undefined, b: QueryGetChainNoncesResponse | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.crosschain.QueryAllChainNoncesRequest - */ -export declare class QueryAllChainNoncesRequest extends Message { - /** - * @generated from field: cosmos.base.query.v1beta1.PageRequest pagination = 1; - */ - pagination?: PageRequest; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryAllChainNoncesRequest"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): QueryAllChainNoncesRequest; - - static fromJson(jsonValue: JsonValue, options?: Partial): QueryAllChainNoncesRequest; - - static fromJsonString(jsonString: string, options?: Partial): QueryAllChainNoncesRequest; - - static equals(a: QueryAllChainNoncesRequest | PlainMessage | undefined, b: QueryAllChainNoncesRequest | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.crosschain.QueryAllChainNoncesResponse - */ -export declare class QueryAllChainNoncesResponse extends Message { - /** - * @generated from field: repeated zetachain.zetacore.crosschain.ChainNonces ChainNonces = 1; - */ - ChainNonces: ChainNonces[]; - - /** - * @generated from field: cosmos.base.query.v1beta1.PageResponse pagination = 2; - */ - pagination?: PageResponse; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryAllChainNoncesResponse"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): QueryAllChainNoncesResponse; - - static fromJson(jsonValue: JsonValue, options?: Partial): QueryAllChainNoncesResponse; - - static fromJsonString(jsonString: string, options?: Partial): QueryAllChainNoncesResponse; - - static equals(a: QueryAllChainNoncesResponse | PlainMessage | undefined, b: QueryAllChainNoncesResponse | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.crosschain.QueryAllPendingNoncesRequest - */ -export declare class QueryAllPendingNoncesRequest extends Message { - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryAllPendingNoncesRequest"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): QueryAllPendingNoncesRequest; - - static fromJson(jsonValue: JsonValue, options?: Partial): QueryAllPendingNoncesRequest; - - static fromJsonString(jsonString: string, options?: Partial): QueryAllPendingNoncesRequest; - - static equals(a: QueryAllPendingNoncesRequest | PlainMessage | undefined, b: QueryAllPendingNoncesRequest | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.crosschain.QueryAllPendingNoncesResponse - */ -export declare class QueryAllPendingNoncesResponse extends Message { - /** - * @generated from field: repeated zetachain.zetacore.crosschain.PendingNonces pending_nonces = 1; - */ - pendingNonces: PendingNonces[]; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryAllPendingNoncesResponse"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): QueryAllPendingNoncesResponse; - - static fromJson(jsonValue: JsonValue, options?: Partial): QueryAllPendingNoncesResponse; - - static fromJsonString(jsonString: string, options?: Partial): QueryAllPendingNoncesResponse; - - static equals(a: QueryAllPendingNoncesResponse | PlainMessage | undefined, b: QueryAllPendingNoncesResponse | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.crosschain.QueryPendingNoncesByChainRequest - */ -export declare class QueryPendingNoncesByChainRequest extends Message { - /** - * @generated from field: int64 chain_id = 1; - */ - chainId: bigint; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryPendingNoncesByChainRequest"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): QueryPendingNoncesByChainRequest; - - static fromJson(jsonValue: JsonValue, options?: Partial): QueryPendingNoncesByChainRequest; - - static fromJsonString(jsonString: string, options?: Partial): QueryPendingNoncesByChainRequest; - - static equals(a: QueryPendingNoncesByChainRequest | PlainMessage | undefined, b: QueryPendingNoncesByChainRequest | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.crosschain.QueryPendingNoncesByChainResponse - */ -export declare class QueryPendingNoncesByChainResponse extends Message { - /** - * @generated from field: zetachain.zetacore.crosschain.PendingNonces pending_nonces = 1; - */ - pendingNonces?: PendingNonces; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryPendingNoncesByChainResponse"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): QueryPendingNoncesByChainResponse; - - static fromJson(jsonValue: JsonValue, options?: Partial): QueryPendingNoncesByChainResponse; - - static fromJsonString(jsonString: string, options?: Partial): QueryPendingNoncesByChainResponse; - - static equals(a: QueryPendingNoncesByChainResponse | PlainMessage | undefined, b: QueryPendingNoncesByChainResponse | PlainMessage | undefined): boolean; -} - /** * @generated from message zetachain.zetacore.crosschain.QueryGetLastBlockHeightRequest */ @@ -1192,61 +863,61 @@ export declare class QueryAllCctxResponse extends Message } /** - * @generated from message zetachain.zetacore.crosschain.QueryAllCctxPendingRequest + * @generated from message zetachain.zetacore.crosschain.QueryListCctxPendingRequest */ -export declare class QueryAllCctxPendingRequest extends Message { +export declare class QueryListCctxPendingRequest extends Message { /** * @generated from field: int64 chain_id = 1; */ chainId: bigint; /** - * @generated from field: cosmos.base.query.v1beta1.PageRequest pagination = 2; + * @generated from field: uint32 limit = 2; */ - pagination?: PageRequest; + limit: number; - constructor(data?: PartialMessage); + constructor(data?: PartialMessage); static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryAllCctxPendingRequest"; + static readonly typeName = "zetachain.zetacore.crosschain.QueryListCctxPendingRequest"; static readonly fields: FieldList; - static fromBinary(bytes: Uint8Array, options?: Partial): QueryAllCctxPendingRequest; + static fromBinary(bytes: Uint8Array, options?: Partial): QueryListCctxPendingRequest; - static fromJson(jsonValue: JsonValue, options?: Partial): QueryAllCctxPendingRequest; + static fromJson(jsonValue: JsonValue, options?: Partial): QueryListCctxPendingRequest; - static fromJsonString(jsonString: string, options?: Partial): QueryAllCctxPendingRequest; + static fromJsonString(jsonString: string, options?: Partial): QueryListCctxPendingRequest; - static equals(a: QueryAllCctxPendingRequest | PlainMessage | undefined, b: QueryAllCctxPendingRequest | PlainMessage | undefined): boolean; + static equals(a: QueryListCctxPendingRequest | PlainMessage | undefined, b: QueryListCctxPendingRequest | PlainMessage | undefined): boolean; } /** - * @generated from message zetachain.zetacore.crosschain.QueryAllCctxPendingResponse + * @generated from message zetachain.zetacore.crosschain.QueryListCctxPendingResponse */ -export declare class QueryAllCctxPendingResponse extends Message { +export declare class QueryListCctxPendingResponse extends Message { /** * @generated from field: repeated zetachain.zetacore.crosschain.CrossChainTx CrossChainTx = 1; */ CrossChainTx: CrossChainTx[]; /** - * @generated from field: cosmos.base.query.v1beta1.PageResponse pagination = 2; + * @generated from field: uint64 totalPending = 2; */ - pagination?: PageResponse; + totalPending: bigint; - constructor(data?: PartialMessage); + constructor(data?: PartialMessage); static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryAllCctxPendingResponse"; + static readonly typeName = "zetachain.zetacore.crosschain.QueryListCctxPendingResponse"; static readonly fields: FieldList; - static fromBinary(bytes: Uint8Array, options?: Partial): QueryAllCctxPendingResponse; + static fromBinary(bytes: Uint8Array, options?: Partial): QueryListCctxPendingResponse; - static fromJson(jsonValue: JsonValue, options?: Partial): QueryAllCctxPendingResponse; + static fromJson(jsonValue: JsonValue, options?: Partial): QueryListCctxPendingResponse; - static fromJsonString(jsonString: string, options?: Partial): QueryAllCctxPendingResponse; + static fromJsonString(jsonString: string, options?: Partial): QueryListCctxPendingResponse; - static equals(a: QueryAllCctxPendingResponse | PlainMessage | undefined, b: QueryAllCctxPendingResponse | PlainMessage | undefined): boolean; + static equals(a: QueryListCctxPendingResponse | PlainMessage | undefined, b: QueryListCctxPendingResponse | PlainMessage | undefined): boolean; } /** @@ -1398,448 +1069,3 @@ export declare class QueryMessagePassingProtocolFeeResponse extends Message | undefined, b: QueryMessagePassingProtocolFeeResponse | PlainMessage | undefined): boolean; } -/** - * @generated from message zetachain.zetacore.crosschain.QueryZEVMGetTransactionReceiptRequest - */ -export declare class QueryZEVMGetTransactionReceiptRequest extends Message { - /** - * @generated from field: string hash = 1; - */ - hash: string; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryZEVMGetTransactionReceiptRequest"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): QueryZEVMGetTransactionReceiptRequest; - - static fromJson(jsonValue: JsonValue, options?: Partial): QueryZEVMGetTransactionReceiptRequest; - - static fromJsonString(jsonString: string, options?: Partial): QueryZEVMGetTransactionReceiptRequest; - - static equals(a: QueryZEVMGetTransactionReceiptRequest | PlainMessage | undefined, b: QueryZEVMGetTransactionReceiptRequest | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.crosschain.QueryZEVMGetTransactionReceiptResponse - */ -export declare class QueryZEVMGetTransactionReceiptResponse extends Message { - /** - * @generated from field: string block_hash = 1; - */ - blockHash: string; - - /** - * @generated from field: string block_number = 2; - */ - blockNumber: string; - - /** - * @generated from field: string contract_address = 3; - */ - contractAddress: string; - - /** - * @generated from field: string cumulative_gas_used = 4; - */ - cumulativeGasUsed: string; - - /** - * @generated from field: string from = 5; - */ - from: string; - - /** - * @generated from field: string gas_used = 6; - */ - gasUsed: string; - - /** - * @generated from field: string logs_bloom = 7; - */ - logsBloom: string; - - /** - * @generated from field: string status = 8; - */ - status: string; - - /** - * @generated from field: string to = 9; - */ - to: string; - - /** - * @generated from field: string transaction_hash = 10; - */ - transactionHash: string; - - /** - * @generated from field: string transaction_index = 11; - */ - transactionIndex: string; - - /** - * @generated from field: repeated zetachain.zetacore.crosschain.Log logs = 12; - */ - logs: Log[]; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryZEVMGetTransactionReceiptResponse"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): QueryZEVMGetTransactionReceiptResponse; - - static fromJson(jsonValue: JsonValue, options?: Partial): QueryZEVMGetTransactionReceiptResponse; - - static fromJsonString(jsonString: string, options?: Partial): QueryZEVMGetTransactionReceiptResponse; - - static equals(a: QueryZEVMGetTransactionReceiptResponse | PlainMessage | undefined, b: QueryZEVMGetTransactionReceiptResponse | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.crosschain.Log - */ -export declare class Log extends Message { - /** - * @generated from field: string address = 1; - */ - address: string; - - /** - * @generated from field: repeated string topics = 2; - */ - topics: string[]; - - /** - * @generated from field: string data = 3; - */ - data: string; - - /** - * sythetic fields - * - * @generated from field: uint64 block_number = 4; - */ - blockNumber: bigint; - - /** - * @generated from field: string transaction_hash = 5; - */ - transactionHash: string; - - /** - * @generated from field: uint64 transaction_index = 6; - */ - transactionIndex: bigint; - - /** - * @generated from field: string block_hash = 7; - */ - blockHash: string; - - /** - * @generated from field: uint64 log_index = 8; - */ - logIndex: bigint; - - /** - * @generated from field: bool removed = 9; - */ - removed: boolean; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.Log"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): Log; - - static fromJson(jsonValue: JsonValue, options?: Partial): Log; - - static fromJsonString(jsonString: string, options?: Partial): Log; - - static equals(a: Log | PlainMessage | undefined, b: Log | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.crosschain.QueryZEVMGetTransactionRequest - */ -export declare class QueryZEVMGetTransactionRequest extends Message { - /** - * @generated from field: string hash = 1; - */ - hash: string; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryZEVMGetTransactionRequest"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): QueryZEVMGetTransactionRequest; - - static fromJson(jsonValue: JsonValue, options?: Partial): QueryZEVMGetTransactionRequest; - - static fromJsonString(jsonString: string, options?: Partial): QueryZEVMGetTransactionRequest; - - static equals(a: QueryZEVMGetTransactionRequest | PlainMessage | undefined, b: QueryZEVMGetTransactionRequest | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.crosschain.QueryZEVMGetTransactionResponse - */ -export declare class QueryZEVMGetTransactionResponse extends Message { - /** - * @generated from field: string block_hash = 1; - */ - blockHash: string; - - /** - * @generated from field: string block_number = 2; - */ - blockNumber: string; - - /** - * @generated from field: string from = 3; - */ - from: string; - - /** - * @generated from field: string gas = 4; - */ - gas: string; - - /** - * @generated from field: string gas_price = 5; - */ - gasPrice: string; - - /** - * @generated from field: string hash = 6; - */ - hash: string; - - /** - * @generated from field: string input = 7; - */ - input: string; - - /** - * @generated from field: string nonce = 8; - */ - nonce: string; - - /** - * @generated from field: string to = 9; - */ - to: string; - - /** - * @generated from field: string transaction_index = 10; - */ - transactionIndex: string; - - /** - * @generated from field: string value = 11; - */ - value: string; - - /** - * @generated from field: string type = 12; - */ - type: string; - - /** - * @generated from field: repeated string access_list = 13; - */ - accessList: string[]; - - /** - * @generated from field: string chain_id = 14; - */ - chainId: string; - - /** - * @generated from field: string v = 15; - */ - v: string; - - /** - * @generated from field: string r = 16; - */ - r: string; - - /** - * @generated from field: string s = 17; - */ - s: string; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryZEVMGetTransactionResponse"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): QueryZEVMGetTransactionResponse; - - static fromJson(jsonValue: JsonValue, options?: Partial): QueryZEVMGetTransactionResponse; - - static fromJsonString(jsonString: string, options?: Partial): QueryZEVMGetTransactionResponse; - - static equals(a: QueryZEVMGetTransactionResponse | PlainMessage | undefined, b: QueryZEVMGetTransactionResponse | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.crosschain.QueryZEVMGetBlockByNumberRequest - */ -export declare class QueryZEVMGetBlockByNumberRequest extends Message { - /** - * @generated from field: uint64 height = 1; - */ - height: bigint; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryZEVMGetBlockByNumberRequest"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): QueryZEVMGetBlockByNumberRequest; - - static fromJson(jsonValue: JsonValue, options?: Partial): QueryZEVMGetBlockByNumberRequest; - - static fromJsonString(jsonString: string, options?: Partial): QueryZEVMGetBlockByNumberRequest; - - static equals(a: QueryZEVMGetBlockByNumberRequest | PlainMessage | undefined, b: QueryZEVMGetBlockByNumberRequest | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.crosschain.QueryZEVMGetBlockByNumberResponse - */ -export declare class QueryZEVMGetBlockByNumberResponse extends Message { - /** - * @generated from field: string number = 1; - */ - number: string; - - /** - * @generated from field: string hash = 2; - */ - hash: string; - - /** - * @generated from field: string parent_hash = 3; - */ - parentHash: string; - - /** - * @generated from field: string nonce = 4; - */ - nonce: string; - - /** - * @generated from field: string sha3_uncles = 5; - */ - sha3Uncles: string; - - /** - * @generated from field: string logs_bloom = 6; - */ - logsBloom: string; - - /** - * @generated from field: string transactions_root = 7; - */ - transactionsRoot: string; - - /** - * @generated from field: string state_root = 8; - */ - stateRoot: string; - - /** - * @generated from field: string receipts_root = 9; - */ - receiptsRoot: string; - - /** - * @generated from field: string miner = 10; - */ - miner: string; - - /** - * @generated from field: string difficulty = 11; - */ - difficulty: string; - - /** - * @generated from field: string total_difficulty = 12; - */ - totalDifficulty: string; - - /** - * @generated from field: string extra_data = 13; - */ - extraData: string; - - /** - * @generated from field: string size = 14; - */ - size: string; - - /** - * @generated from field: string gas_limit = 15; - */ - gasLimit: string; - - /** - * @generated from field: string gas_used = 16; - */ - gasUsed: string; - - /** - * @generated from field: string timestamp = 17; - */ - timestamp: string; - - /** - * @generated from field: repeated string transactions = 18; - */ - transactions: string[]; - - /** - * @generated from field: repeated string uncles = 19; - */ - uncles: string[]; - - /** - * @generated from field: string base_fee_per_gas = 20; - */ - baseFeePerGas: string; - - /** - * @generated from field: string mix_hash = 21; - */ - mixHash: string; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.QueryZEVMGetBlockByNumberResponse"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): QueryZEVMGetBlockByNumberResponse; - - static fromJson(jsonValue: JsonValue, options?: Partial): QueryZEVMGetBlockByNumberResponse; - - static fromJsonString(jsonString: string, options?: Partial): QueryZEVMGetBlockByNumberResponse; - - static equals(a: QueryZEVMGetBlockByNumberResponse | PlainMessage | undefined, b: QueryZEVMGetBlockByNumberResponse | PlainMessage | undefined): boolean; -} - diff --git a/typescript/crosschain/tx_pb.d.ts b/typescript/crosschain/tx_pb.d.ts index 23ed750398..6c425e3990 100644 --- a/typescript/crosschain/tx_pb.d.ts +++ b/typescript/crosschain/tx_pb.d.ts @@ -5,7 +5,65 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; import { Message, proto3 } from "@bufbuild/protobuf"; -import type { CoinType, Proof, PubKeySet, ReceiveStatus } from "../common/common_pb.js"; +import type { CoinType, Proof, ReceiveStatus } from "../common/common_pb.js"; + +/** + * @generated from message zetachain.zetacore.crosschain.MsgCreateTSSVoter + */ +export declare class MsgCreateTSSVoter extends Message { + /** + * @generated from field: string creator = 1; + */ + creator: string; + + /** + * @generated from field: string tss_pubkey = 2; + */ + tssPubkey: string; + + /** + * @generated from field: int64 keyGenZetaHeight = 3; + */ + keyGenZetaHeight: bigint; + + /** + * @generated from field: common.ReceiveStatus status = 4; + */ + status: ReceiveStatus; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.crosschain.MsgCreateTSSVoter"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): MsgCreateTSSVoter; + + static fromJson(jsonValue: JsonValue, options?: Partial): MsgCreateTSSVoter; + + static fromJsonString(jsonString: string, options?: Partial): MsgCreateTSSVoter; + + static equals(a: MsgCreateTSSVoter | PlainMessage | undefined, b: MsgCreateTSSVoter | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.crosschain.MsgCreateTSSVoterResponse + */ +export declare class MsgCreateTSSVoterResponse extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.crosschain.MsgCreateTSSVoterResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): MsgCreateTSSVoterResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): MsgCreateTSSVoterResponse; + + static fromJsonString(jsonString: string, options?: Partial): MsgCreateTSSVoterResponse; + + static equals(a: MsgCreateTSSVoterResponse | PlainMessage | undefined, b: MsgCreateTSSVoterResponse | PlainMessage | undefined): boolean; +} /** * @generated from message zetachain.zetacore.crosschain.MsgMigrateTssFunds @@ -60,6 +118,54 @@ export declare class MsgMigrateTssFundsResponse extends Message | undefined, b: MsgMigrateTssFundsResponse | PlainMessage | undefined): boolean; } +/** + * @generated from message zetachain.zetacore.crosschain.MsgUpdateTssAddress + */ +export declare class MsgUpdateTssAddress extends Message { + /** + * @generated from field: string creator = 1; + */ + creator: string; + + /** + * @generated from field: string tss_pubkey = 2; + */ + tssPubkey: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.crosschain.MsgUpdateTssAddress"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): MsgUpdateTssAddress; + + static fromJson(jsonValue: JsonValue, options?: Partial): MsgUpdateTssAddress; + + static fromJsonString(jsonString: string, options?: Partial): MsgUpdateTssAddress; + + static equals(a: MsgUpdateTssAddress | PlainMessage | undefined, b: MsgUpdateTssAddress | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.crosschain.MsgUpdateTssAddressResponse + */ +export declare class MsgUpdateTssAddressResponse extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.crosschain.MsgUpdateTssAddressResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): MsgUpdateTssAddressResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): MsgUpdateTssAddressResponse; + + static fromJsonString(jsonString: string, options?: Partial): MsgUpdateTssAddressResponse; + + static equals(a: MsgUpdateTssAddressResponse | PlainMessage | undefined, b: MsgUpdateTssAddressResponse | PlainMessage | undefined): boolean; +} + /** * @generated from message zetachain.zetacore.crosschain.MsgAddToInTxTracker */ @@ -133,54 +239,6 @@ export declare class MsgAddToInTxTrackerResponse extends Message | undefined, b: MsgAddToInTxTrackerResponse | PlainMessage | undefined): boolean; } -/** - * @generated from message zetachain.zetacore.crosschain.MsgUpdateTssAddress - */ -export declare class MsgUpdateTssAddress extends Message { - /** - * @generated from field: string creator = 1; - */ - creator: string; - - /** - * @generated from field: string tss_pubkey = 2; - */ - tssPubkey: string; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.MsgUpdateTssAddress"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): MsgUpdateTssAddress; - - static fromJson(jsonValue: JsonValue, options?: Partial): MsgUpdateTssAddress; - - static fromJsonString(jsonString: string, options?: Partial): MsgUpdateTssAddress; - - static equals(a: MsgUpdateTssAddress | PlainMessage | undefined, b: MsgUpdateTssAddress | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.crosschain.MsgUpdateTssAddressResponse - */ -export declare class MsgUpdateTssAddressResponse extends Message { - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.MsgUpdateTssAddressResponse"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): MsgUpdateTssAddressResponse; - - static fromJson(jsonValue: JsonValue, options?: Partial): MsgUpdateTssAddressResponse; - - static fromJsonString(jsonString: string, options?: Partial): MsgUpdateTssAddressResponse; - - static equals(a: MsgUpdateTssAddressResponse | PlainMessage | undefined, b: MsgUpdateTssAddressResponse | PlainMessage | undefined): boolean; -} - /** * @generated from message zetachain.zetacore.crosschain.MsgWhitelistERC20 */ @@ -397,64 +455,6 @@ export declare class MsgRemoveFromOutTxTrackerResponse extends Message | undefined, b: MsgRemoveFromOutTxTrackerResponse | PlainMessage | undefined): boolean; } -/** - * @generated from message zetachain.zetacore.crosschain.MsgCreateTSSVoter - */ -export declare class MsgCreateTSSVoter extends Message { - /** - * @generated from field: string creator = 1; - */ - creator: string; - - /** - * @generated from field: string tss_pubkey = 2; - */ - tssPubkey: string; - - /** - * @generated from field: int64 keyGenZetaHeight = 3; - */ - keyGenZetaHeight: bigint; - - /** - * @generated from field: common.ReceiveStatus status = 4; - */ - status: ReceiveStatus; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.MsgCreateTSSVoter"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): MsgCreateTSSVoter; - - static fromJson(jsonValue: JsonValue, options?: Partial): MsgCreateTSSVoter; - - static fromJsonString(jsonString: string, options?: Partial): MsgCreateTSSVoter; - - static equals(a: MsgCreateTSSVoter | PlainMessage | undefined, b: MsgCreateTSSVoter | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.crosschain.MsgCreateTSSVoterResponse - */ -export declare class MsgCreateTSSVoterResponse extends Message { - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.MsgCreateTSSVoterResponse"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): MsgCreateTSSVoterResponse; - - static fromJson(jsonValue: JsonValue, options?: Partial): MsgCreateTSSVoterResponse; - - static fromJsonString(jsonString: string, options?: Partial): MsgCreateTSSVoterResponse; - - static equals(a: MsgCreateTSSVoterResponse | PlainMessage | undefined, b: MsgCreateTSSVoterResponse | PlainMessage | undefined): boolean; -} - /** * @generated from message zetachain.zetacore.crosschain.MsgGasPriceVoter */ @@ -518,59 +518,6 @@ export declare class MsgGasPriceVoterResponse extends Message | undefined, b: MsgGasPriceVoterResponse | PlainMessage | undefined): boolean; } -/** - * @generated from message zetachain.zetacore.crosschain.MsgNonceVoter - */ -export declare class MsgNonceVoter extends Message { - /** - * @generated from field: string creator = 1; - */ - creator: string; - - /** - * @generated from field: int64 chain_id = 2; - */ - chainId: bigint; - - /** - * @generated from field: uint64 nonce = 3; - */ - nonce: bigint; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.MsgNonceVoter"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): MsgNonceVoter; - - static fromJson(jsonValue: JsonValue, options?: Partial): MsgNonceVoter; - - static fromJsonString(jsonString: string, options?: Partial): MsgNonceVoter; - - static equals(a: MsgNonceVoter | PlainMessage | undefined, b: MsgNonceVoter | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.crosschain.MsgNonceVoterResponse - */ -export declare class MsgNonceVoterResponse extends Message { - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.MsgNonceVoterResponse"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): MsgNonceVoterResponse; - - static fromJson(jsonValue: JsonValue, options?: Partial): MsgNonceVoterResponse; - - static fromJsonString(jsonString: string, options?: Partial): MsgNonceVoterResponse; - - static equals(a: MsgNonceVoterResponse | PlainMessage | undefined, b: MsgNonceVoterResponse | PlainMessage | undefined): boolean; -} - /** * @generated from message zetachain.zetacore.crosschain.MsgVoteOnObservedOutboundTx */ @@ -783,56 +730,3 @@ export declare class MsgVoteOnObservedInboundTxResponse extends Message | undefined, b: MsgVoteOnObservedInboundTxResponse | PlainMessage | undefined): boolean; } -/** - * @generated from message zetachain.zetacore.crosschain.MsgSetNodeKeys - */ -export declare class MsgSetNodeKeys extends Message { - /** - * @generated from field: string creator = 1; - */ - creator: string; - - /** - * @generated from field: common.PubKeySet pubkeySet = 2; - */ - pubkeySet?: PubKeySet; - - /** - * @generated from field: string tss_signer_Address = 3; - */ - tssSignerAddress: string; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.MsgSetNodeKeys"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): MsgSetNodeKeys; - - static fromJson(jsonValue: JsonValue, options?: Partial): MsgSetNodeKeys; - - static fromJsonString(jsonString: string, options?: Partial): MsgSetNodeKeys; - - static equals(a: MsgSetNodeKeys | PlainMessage | undefined, b: MsgSetNodeKeys | PlainMessage | undefined): boolean; -} - -/** - * @generated from message zetachain.zetacore.crosschain.MsgSetNodeKeysResponse - */ -export declare class MsgSetNodeKeysResponse extends Message { - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.MsgSetNodeKeysResponse"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): MsgSetNodeKeysResponse; - - static fromJson(jsonValue: JsonValue, options?: Partial): MsgSetNodeKeysResponse; - - static fromJsonString(jsonString: string, options?: Partial): MsgSetNodeKeysResponse; - - static equals(a: MsgSetNodeKeysResponse | PlainMessage | undefined, b: MsgSetNodeKeysResponse | PlainMessage | undefined): boolean; -} - diff --git a/typescript/fungible/events_pb.d.ts b/typescript/fungible/events_pb.d.ts index c36e4eebd8..b34248d4aa 100644 --- a/typescript/fungible/events_pb.d.ts +++ b/typescript/fungible/events_pb.d.ts @@ -214,3 +214,101 @@ export declare class EventZRC20PausedStatusUpdated extends Message | undefined, b: EventZRC20PausedStatusUpdated | PlainMessage | undefined): boolean; } +/** + * @generated from message zetachain.zetacore.fungible.EventSystemContractsDeployed + */ +export declare class EventSystemContractsDeployed extends Message { + /** + * @generated from field: string msg_type_url = 1; + */ + msgTypeUrl: string; + + /** + * @generated from field: string uniswap_v2_factory = 2; + */ + uniswapV2Factory: string; + + /** + * @generated from field: string wzeta = 3; + */ + wzeta: string; + + /** + * @generated from field: string uniswap_v2_router = 4; + */ + uniswapV2Router: string; + + /** + * @generated from field: string connector_zevm = 5; + */ + connectorZevm: string; + + /** + * @generated from field: string system_contract = 6; + */ + systemContract: string; + + /** + * @generated from field: string signer = 7; + */ + signer: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.fungible.EventSystemContractsDeployed"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): EventSystemContractsDeployed; + + static fromJson(jsonValue: JsonValue, options?: Partial): EventSystemContractsDeployed; + + static fromJsonString(jsonString: string, options?: Partial): EventSystemContractsDeployed; + + static equals(a: EventSystemContractsDeployed | PlainMessage | undefined, b: EventSystemContractsDeployed | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.fungible.EventBytecodeUpdated + */ +export declare class EventBytecodeUpdated extends Message { + /** + * @generated from field: string msg_type_url = 1; + */ + msgTypeUrl: string; + + /** + * @generated from field: string contract_address = 2; + */ + contractAddress: string; + + /** + * @generated from field: string new_bytecode_hash = 3; + */ + newBytecodeHash: string; + + /** + * @generated from field: string old_bytecode_hash = 4; + */ + oldBytecodeHash: string; + + /** + * @generated from field: string signer = 5; + */ + signer: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.fungible.EventBytecodeUpdated"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): EventBytecodeUpdated; + + static fromJson(jsonValue: JsonValue, options?: Partial): EventBytecodeUpdated; + + static fromJsonString(jsonString: string, options?: Partial): EventBytecodeUpdated; + + static equals(a: EventBytecodeUpdated | PlainMessage | undefined, b: EventBytecodeUpdated | PlainMessage | undefined): boolean; +} + diff --git a/typescript/fungible/query_pb.d.ts b/typescript/fungible/query_pb.d.ts index 4a604e405e..57b15066b9 100644 --- a/typescript/fungible/query_pb.d.ts +++ b/typescript/fungible/query_pb.d.ts @@ -371,3 +371,51 @@ export declare class QueryAllGasStabilityPoolBalanceResponse_Balance extends Mes static equals(a: QueryAllGasStabilityPoolBalanceResponse_Balance | PlainMessage | undefined, b: QueryAllGasStabilityPoolBalanceResponse_Balance | PlainMessage | undefined): boolean; } +/** + * @generated from message zetachain.zetacore.fungible.QueryCodeHashRequest + */ +export declare class QueryCodeHashRequest extends Message { + /** + * @generated from field: string address = 1; + */ + address: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.fungible.QueryCodeHashRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryCodeHashRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryCodeHashRequest; + + static fromJsonString(jsonString: string, options?: Partial): QueryCodeHashRequest; + + static equals(a: QueryCodeHashRequest | PlainMessage | undefined, b: QueryCodeHashRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.fungible.QueryCodeHashResponse + */ +export declare class QueryCodeHashResponse extends Message { + /** + * @generated from field: string code_hash = 1; + */ + codeHash: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.fungible.QueryCodeHashResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryCodeHashResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryCodeHashResponse; + + static fromJsonString(jsonString: string, options?: Partial): QueryCodeHashResponse; + + static equals(a: QueryCodeHashResponse | PlainMessage | undefined, b: QueryCodeHashResponse | PlainMessage | undefined): boolean; +} + diff --git a/typescript/fungible/tx_pb.d.ts b/typescript/fungible/tx_pb.d.ts index fcb7f77343..e20d4bde71 100644 --- a/typescript/fungible/tx_pb.d.ts +++ b/typescript/fungible/tx_pb.d.ts @@ -22,6 +22,74 @@ export declare enum UpdatePausedStatusAction { UNPAUSE = 1, } +/** + * @generated from message zetachain.zetacore.fungible.MsgDeploySystemContracts + */ +export declare class MsgDeploySystemContracts extends Message { + /** + * @generated from field: string creator = 1; + */ + creator: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.fungible.MsgDeploySystemContracts"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): MsgDeploySystemContracts; + + static fromJson(jsonValue: JsonValue, options?: Partial): MsgDeploySystemContracts; + + static fromJsonString(jsonString: string, options?: Partial): MsgDeploySystemContracts; + + static equals(a: MsgDeploySystemContracts | PlainMessage | undefined, b: MsgDeploySystemContracts | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.fungible.MsgDeploySystemContractsResponse + */ +export declare class MsgDeploySystemContractsResponse extends Message { + /** + * @generated from field: string uniswapV2Factory = 1; + */ + uniswapV2Factory: string; + + /** + * @generated from field: string wzeta = 2; + */ + wzeta: string; + + /** + * @generated from field: string uniswapV2Router = 3; + */ + uniswapV2Router: string; + + /** + * @generated from field: string connectorZEVM = 4; + */ + connectorZEVM: string; + + /** + * @generated from field: string systemContract = 5; + */ + systemContract: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.fungible.MsgDeploySystemContractsResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): MsgDeploySystemContractsResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): MsgDeploySystemContractsResponse; + + static fromJsonString(jsonString: string, options?: Partial): MsgDeploySystemContractsResponse; + + static equals(a: MsgDeploySystemContractsResponse | PlainMessage | undefined, b: MsgDeploySystemContractsResponse | PlainMessage | undefined): boolean; +} + /** * @generated from message zetachain.zetacore.fungible.MsgUpdateZRC20WithdrawFee */ @@ -276,9 +344,9 @@ export declare class MsgUpdateContractBytecode extends Message); @@ -299,11 +367,6 @@ export declare class MsgUpdateContractBytecode extends Message { - /** - * @generated from field: bytes new_bytecode_hash = 1; - */ - newBytecodeHash: Uint8Array; - constructor(data?: PartialMessage); static readonly runtime: typeof proto3; diff --git a/typescript/crosschain/chain_nonces_pb.d.ts b/typescript/observer/chain_nonces_pb.d.ts similarity index 84% rename from typescript/crosschain/chain_nonces_pb.d.ts rename to typescript/observer/chain_nonces_pb.d.ts index 2f629ad9d9..1ae0c34cfe 100644 --- a/typescript/crosschain/chain_nonces_pb.d.ts +++ b/typescript/observer/chain_nonces_pb.d.ts @@ -1,5 +1,5 @@ // @generated by protoc-gen-es v1.3.0 with parameter "target=dts" -// @generated from file crosschain/chain_nonces.proto (package zetachain.zetacore.crosschain, syntax proto3) +// @generated from file observer/chain_nonces.proto (package zetachain.zetacore.observer, syntax proto3) /* eslint-disable */ // @ts-nocheck @@ -7,7 +7,7 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialM import { Message, proto3 } from "@bufbuild/protobuf"; /** - * @generated from message zetachain.zetacore.crosschain.ChainNonces + * @generated from message zetachain.zetacore.observer.ChainNonces */ export declare class ChainNonces extends Message { /** @@ -43,7 +43,7 @@ export declare class ChainNonces extends Message { constructor(data?: PartialMessage); static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.ChainNonces"; + static readonly typeName = "zetachain.zetacore.observer.ChainNonces"; static readonly fields: FieldList; static fromBinary(bytes: Uint8Array, options?: Partial): ChainNonces; diff --git a/typescript/observer/crosschain_flags_pb.d.ts b/typescript/observer/crosschain_flags_pb.d.ts index 00cbc58b2e..d293425314 100644 --- a/typescript/observer/crosschain_flags_pb.d.ts +++ b/typescript/observer/crosschain_flags_pb.d.ts @@ -33,6 +33,13 @@ export declare class GasPriceIncreaseFlags extends Message); static readonly runtime: typeof proto3; diff --git a/typescript/observer/genesis_pb.d.ts b/typescript/observer/genesis_pb.d.ts index 7040539619..6c6c1dc2b5 100644 --- a/typescript/observer/genesis_pb.d.ts +++ b/typescript/observer/genesis_pb.d.ts @@ -11,6 +11,12 @@ import type { NodeAccount } from "./node_account_pb.js"; import type { CrosschainFlags } from "./crosschain_flags_pb.js"; import type { CoreParamsList, Params } from "./params_pb.js"; import type { Keygen } from "./keygen_pb.js"; +import type { TSS } from "./tss_pb.js"; +import type { TssFundMigratorInfo } from "./tss_funds_migrator_pb.js"; +import type { Blame } from "./blame_pb.js"; +import type { PendingNonces } from "./pending_nonces_pb.js"; +import type { ChainNonces } from "./chain_nonces_pb.js"; +import type { NonceToCctx } from "./nonce_to_cctx_pb.js"; /** * @generated from message zetachain.zetacore.observer.GenesisState @@ -56,6 +62,41 @@ export declare class GenesisState extends Message { */ coreParamsList?: CoreParamsList; + /** + * @generated from field: zetachain.zetacore.observer.TSS tss = 9; + */ + tss?: TSS; + + /** + * @generated from field: repeated zetachain.zetacore.observer.TSS tss_history = 10; + */ + tssHistory: TSS[]; + + /** + * @generated from field: repeated zetachain.zetacore.observer.TssFundMigratorInfo tss_fund_migrators = 11; + */ + tssFundMigrators: TssFundMigratorInfo[]; + + /** + * @generated from field: repeated zetachain.zetacore.observer.Blame blame_list = 12; + */ + blameList: Blame[]; + + /** + * @generated from field: repeated zetachain.zetacore.observer.PendingNonces pending_nonces = 13; + */ + pendingNonces: PendingNonces[]; + + /** + * @generated from field: repeated zetachain.zetacore.observer.ChainNonces chain_nonces = 14; + */ + chainNonces: ChainNonces[]; + + /** + * @generated from field: repeated zetachain.zetacore.observer.NonceToCctx nonce_to_cctx = 15; + */ + nonceToCctx: NonceToCctx[]; + constructor(data?: PartialMessage); static readonly runtime: typeof proto3; diff --git a/typescript/observer/index.d.ts b/typescript/observer/index.d.ts index 26a1068953..d6e795bd79 100644 --- a/typescript/observer/index.d.ts +++ b/typescript/observer/index.d.ts @@ -1,12 +1,17 @@ export * from "./ballot_pb"; export * from "./blame_pb"; export * from "./block_header_pb"; +export * from "./chain_nonces_pb"; export * from "./crosschain_flags_pb"; export * from "./events_pb"; export * from "./genesis_pb"; export * from "./keygen_pb"; export * from "./node_account_pb"; +export * from "./nonce_to_cctx_pb"; export * from "./observer_pb"; export * from "./params_pb"; +export * from "./pending_nonces_pb"; export * from "./query_pb"; +export * from "./tss_funds_migrator_pb"; +export * from "./tss_pb"; export * from "./tx_pb"; diff --git a/typescript/observer/nonce_to_cctx_pb.d.ts b/typescript/observer/nonce_to_cctx_pb.d.ts new file mode 100644 index 0000000000..1ddd89882c --- /dev/null +++ b/typescript/observer/nonce_to_cctx_pb.d.ts @@ -0,0 +1,49 @@ +// @generated by protoc-gen-es v1.3.0 with parameter "target=dts" +// @generated from file observer/nonce_to_cctx.proto (package zetachain.zetacore.observer, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * store key is tss+chainid+nonce + * + * @generated from message zetachain.zetacore.observer.NonceToCctx + */ +export declare class NonceToCctx extends Message { + /** + * @generated from field: int64 chain_id = 1; + */ + chainId: bigint; + + /** + * @generated from field: int64 nonce = 2; + */ + nonce: bigint; + + /** + * @generated from field: string cctxIndex = 3; + */ + cctxIndex: string; + + /** + * @generated from field: string tss = 4; + */ + tss: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.NonceToCctx"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): NonceToCctx; + + static fromJson(jsonValue: JsonValue, options?: Partial): NonceToCctx; + + static fromJsonString(jsonString: string, options?: Partial): NonceToCctx; + + static equals(a: NonceToCctx | PlainMessage | undefined, b: NonceToCctx | PlainMessage | undefined): boolean; +} + diff --git a/typescript/observer/pending_nonces_pb.d.ts b/typescript/observer/pending_nonces_pb.d.ts new file mode 100644 index 0000000000..41b7d27d93 --- /dev/null +++ b/typescript/observer/pending_nonces_pb.d.ts @@ -0,0 +1,49 @@ +// @generated by protoc-gen-es v1.3.0 with parameter "target=dts" +// @generated from file observer/pending_nonces.proto (package zetachain.zetacore.observer, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * store key is tss+chainid + * + * @generated from message zetachain.zetacore.observer.PendingNonces + */ +export declare class PendingNonces extends Message { + /** + * @generated from field: int64 nonce_low = 1; + */ + nonceLow: bigint; + + /** + * @generated from field: int64 nonce_high = 2; + */ + nonceHigh: bigint; + + /** + * @generated from field: int64 chain_id = 3; + */ + chainId: bigint; + + /** + * @generated from field: string tss = 4; + */ + tss: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.PendingNonces"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): PendingNonces; + + static fromJson(jsonValue: JsonValue, options?: Partial): PendingNonces; + + static fromJsonString(jsonString: string, options?: Partial): PendingNonces; + + static equals(a: PendingNonces | PlainMessage | undefined, b: PendingNonces | PlainMessage | undefined): boolean; +} + diff --git a/typescript/observer/query_pb.d.ts b/typescript/observer/query_pb.d.ts index e5c5cd6634..6b3f4ad055 100644 --- a/typescript/observer/query_pb.d.ts +++ b/typescript/observer/query_pb.d.ts @@ -5,17 +5,429 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; import { Message, proto3 } from "@bufbuild/protobuf"; +import type { ChainNonces } from "./chain_nonces_pb.js"; +import type { PageRequest, PageResponse } from "../cosmos/base/query/v1beta1/pagination_pb.js"; +import type { PendingNonces } from "./pending_nonces_pb.js"; +import type { TSS } from "./tss_pb.js"; import type { BlockHeader, Chain, Proof } from "../common/common_pb.js"; import type { CoreParams, CoreParamsList, Params } from "./params_pb.js"; import type { BallotStatus, VoteType } from "./ballot_pb.js"; import type { LastObserverCount, ObservationType, ObserverMapper } from "./observer_pb.js"; import type { NodeAccount } from "./node_account_pb.js"; -import type { PageRequest, PageResponse } from "../cosmos/base/query/v1beta1/pagination_pb.js"; import type { CrosschainFlags } from "./crosschain_flags_pb.js"; import type { Keygen } from "./keygen_pb.js"; import type { Blame } from "./blame_pb.js"; import type { BlockHeaderState } from "./block_header_pb.js"; +/** + * @generated from message zetachain.zetacore.observer.QueryGetChainNoncesRequest + */ +export declare class QueryGetChainNoncesRequest extends Message { + /** + * @generated from field: string index = 1; + */ + index: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.QueryGetChainNoncesRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryGetChainNoncesRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryGetChainNoncesRequest; + + static fromJsonString(jsonString: string, options?: Partial): QueryGetChainNoncesRequest; + + static equals(a: QueryGetChainNoncesRequest | PlainMessage | undefined, b: QueryGetChainNoncesRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.QueryGetChainNoncesResponse + */ +export declare class QueryGetChainNoncesResponse extends Message { + /** + * @generated from field: zetachain.zetacore.observer.ChainNonces ChainNonces = 1; + */ + ChainNonces?: ChainNonces; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.QueryGetChainNoncesResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryGetChainNoncesResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryGetChainNoncesResponse; + + static fromJsonString(jsonString: string, options?: Partial): QueryGetChainNoncesResponse; + + static equals(a: QueryGetChainNoncesResponse | PlainMessage | undefined, b: QueryGetChainNoncesResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.QueryAllChainNoncesRequest + */ +export declare class QueryAllChainNoncesRequest extends Message { + /** + * @generated from field: cosmos.base.query.v1beta1.PageRequest pagination = 1; + */ + pagination?: PageRequest; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.QueryAllChainNoncesRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryAllChainNoncesRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryAllChainNoncesRequest; + + static fromJsonString(jsonString: string, options?: Partial): QueryAllChainNoncesRequest; + + static equals(a: QueryAllChainNoncesRequest | PlainMessage | undefined, b: QueryAllChainNoncesRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.QueryAllChainNoncesResponse + */ +export declare class QueryAllChainNoncesResponse extends Message { + /** + * @generated from field: repeated zetachain.zetacore.observer.ChainNonces ChainNonces = 1; + */ + ChainNonces: ChainNonces[]; + + /** + * @generated from field: cosmos.base.query.v1beta1.PageResponse pagination = 2; + */ + pagination?: PageResponse; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.QueryAllChainNoncesResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryAllChainNoncesResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryAllChainNoncesResponse; + + static fromJsonString(jsonString: string, options?: Partial): QueryAllChainNoncesResponse; + + static equals(a: QueryAllChainNoncesResponse | PlainMessage | undefined, b: QueryAllChainNoncesResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.QueryAllPendingNoncesRequest + */ +export declare class QueryAllPendingNoncesRequest extends Message { + /** + * @generated from field: cosmos.base.query.v1beta1.PageRequest pagination = 1; + */ + pagination?: PageRequest; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.QueryAllPendingNoncesRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryAllPendingNoncesRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryAllPendingNoncesRequest; + + static fromJsonString(jsonString: string, options?: Partial): QueryAllPendingNoncesRequest; + + static equals(a: QueryAllPendingNoncesRequest | PlainMessage | undefined, b: QueryAllPendingNoncesRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.QueryAllPendingNoncesResponse + */ +export declare class QueryAllPendingNoncesResponse extends Message { + /** + * @generated from field: repeated zetachain.zetacore.observer.PendingNonces pending_nonces = 1; + */ + pendingNonces: PendingNonces[]; + + /** + * @generated from field: cosmos.base.query.v1beta1.PageResponse pagination = 2; + */ + pagination?: PageResponse; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.QueryAllPendingNoncesResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryAllPendingNoncesResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryAllPendingNoncesResponse; + + static fromJsonString(jsonString: string, options?: Partial): QueryAllPendingNoncesResponse; + + static equals(a: QueryAllPendingNoncesResponse | PlainMessage | undefined, b: QueryAllPendingNoncesResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.QueryPendingNoncesByChainRequest + */ +export declare class QueryPendingNoncesByChainRequest extends Message { + /** + * @generated from field: int64 chain_id = 1; + */ + chainId: bigint; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.QueryPendingNoncesByChainRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryPendingNoncesByChainRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryPendingNoncesByChainRequest; + + static fromJsonString(jsonString: string, options?: Partial): QueryPendingNoncesByChainRequest; + + static equals(a: QueryPendingNoncesByChainRequest | PlainMessage | undefined, b: QueryPendingNoncesByChainRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.QueryPendingNoncesByChainResponse + */ +export declare class QueryPendingNoncesByChainResponse extends Message { + /** + * @generated from field: zetachain.zetacore.observer.PendingNonces pending_nonces = 1; + */ + pendingNonces?: PendingNonces; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.QueryPendingNoncesByChainResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryPendingNoncesByChainResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryPendingNoncesByChainResponse; + + static fromJsonString(jsonString: string, options?: Partial): QueryPendingNoncesByChainResponse; + + static equals(a: QueryPendingNoncesByChainResponse | PlainMessage | undefined, b: QueryPendingNoncesByChainResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.QueryGetTSSRequest + */ +export declare class QueryGetTSSRequest extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.QueryGetTSSRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryGetTSSRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryGetTSSRequest; + + static fromJsonString(jsonString: string, options?: Partial): QueryGetTSSRequest; + + static equals(a: QueryGetTSSRequest | PlainMessage | undefined, b: QueryGetTSSRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.QueryGetTSSResponse + */ +export declare class QueryGetTSSResponse extends Message { + /** + * @generated from field: zetachain.zetacore.observer.TSS TSS = 1; + */ + TSS?: TSS; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.QueryGetTSSResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryGetTSSResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryGetTSSResponse; + + static fromJsonString(jsonString: string, options?: Partial): QueryGetTSSResponse; + + static equals(a: QueryGetTSSResponse | PlainMessage | undefined, b: QueryGetTSSResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.QueryGetTssAddressRequest + */ +export declare class QueryGetTssAddressRequest extends Message { + /** + * @generated from field: int64 bitcoin_chain_id = 2; + */ + bitcoinChainId: bigint; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.QueryGetTssAddressRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryGetTssAddressRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryGetTssAddressRequest; + + static fromJsonString(jsonString: string, options?: Partial): QueryGetTssAddressRequest; + + static equals(a: QueryGetTssAddressRequest | PlainMessage | undefined, b: QueryGetTssAddressRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.QueryGetTssAddressResponse + */ +export declare class QueryGetTssAddressResponse extends Message { + /** + * @generated from field: string eth = 1; + */ + eth: string; + + /** + * @generated from field: string btc = 2; + */ + btc: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.QueryGetTssAddressResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryGetTssAddressResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryGetTssAddressResponse; + + static fromJsonString(jsonString: string, options?: Partial): QueryGetTssAddressResponse; + + static equals(a: QueryGetTssAddressResponse | PlainMessage | undefined, b: QueryGetTssAddressResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.QueryGetTssAddressByFinalizedHeightRequest + */ +export declare class QueryGetTssAddressByFinalizedHeightRequest extends Message { + /** + * @generated from field: int64 finalized_zeta_height = 1; + */ + finalizedZetaHeight: bigint; + + /** + * @generated from field: int64 bitcoin_chain_id = 2; + */ + bitcoinChainId: bigint; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.QueryGetTssAddressByFinalizedHeightRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryGetTssAddressByFinalizedHeightRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryGetTssAddressByFinalizedHeightRequest; + + static fromJsonString(jsonString: string, options?: Partial): QueryGetTssAddressByFinalizedHeightRequest; + + static equals(a: QueryGetTssAddressByFinalizedHeightRequest | PlainMessage | undefined, b: QueryGetTssAddressByFinalizedHeightRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.QueryGetTssAddressByFinalizedHeightResponse + */ +export declare class QueryGetTssAddressByFinalizedHeightResponse extends Message { + /** + * @generated from field: string eth = 1; + */ + eth: string; + + /** + * @generated from field: string btc = 2; + */ + btc: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.QueryGetTssAddressByFinalizedHeightResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryGetTssAddressByFinalizedHeightResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryGetTssAddressByFinalizedHeightResponse; + + static fromJsonString(jsonString: string, options?: Partial): QueryGetTssAddressByFinalizedHeightResponse; + + static equals(a: QueryGetTssAddressByFinalizedHeightResponse | PlainMessage | undefined, b: QueryGetTssAddressByFinalizedHeightResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.QueryTssHistoryRequest + */ +export declare class QueryTssHistoryRequest extends Message { + /** + * @generated from field: cosmos.base.query.v1beta1.PageRequest pagination = 1; + */ + pagination?: PageRequest; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.QueryTssHistoryRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryTssHistoryRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryTssHistoryRequest; + + static fromJsonString(jsonString: string, options?: Partial): QueryTssHistoryRequest; + + static equals(a: QueryTssHistoryRequest | PlainMessage | undefined, b: QueryTssHistoryRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.QueryTssHistoryResponse + */ +export declare class QueryTssHistoryResponse extends Message { + /** + * @generated from field: repeated zetachain.zetacore.observer.TSS tss_list = 1; + */ + tssList: TSS[]; + + /** + * @generated from field: cosmos.base.query.v1beta1.PageResponse pagination = 2; + */ + pagination?: PageResponse; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.QueryTssHistoryResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryTssHistoryResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryTssHistoryResponse; + + static fromJsonString(jsonString: string, options?: Partial): QueryTssHistoryResponse; + + static equals(a: QueryTssHistoryResponse | PlainMessage | undefined, b: QueryTssHistoryResponse | PlainMessage | undefined): boolean; +} + /** * @generated from message zetachain.zetacore.observer.QueryProveRequest */ @@ -131,6 +543,59 @@ export declare class QueryParamsResponse extends Message { static equals(a: QueryParamsResponse | PlainMessage | undefined, b: QueryParamsResponse | PlainMessage | undefined): boolean; } +/** + * @generated from message zetachain.zetacore.observer.QueryHasVotedRequest + */ +export declare class QueryHasVotedRequest extends Message { + /** + * @generated from field: string ballot_identifier = 1; + */ + ballotIdentifier: string; + + /** + * @generated from field: string voter_address = 2; + */ + voterAddress: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.QueryHasVotedRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryHasVotedRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryHasVotedRequest; + + static fromJsonString(jsonString: string, options?: Partial): QueryHasVotedRequest; + + static equals(a: QueryHasVotedRequest | PlainMessage | undefined, b: QueryHasVotedRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.QueryHasVotedResponse + */ +export declare class QueryHasVotedResponse extends Message { + /** + * @generated from field: bool has_voted = 1; + */ + hasVoted: boolean; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.QueryHasVotedResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryHasVotedResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryHasVotedResponse; + + static fromJsonString(jsonString: string, options?: Partial): QueryHasVotedResponse; + + static equals(a: QueryHasVotedResponse | PlainMessage | undefined, b: QueryHasVotedResponse | PlainMessage | undefined): boolean; +} + /** * @generated from message zetachain.zetacore.observer.QueryBallotByIdentifierRequest */ @@ -730,6 +1195,11 @@ export declare class QueryBlameByIdentifierResponse extends Message { + /** + * @generated from field: cosmos.base.query.v1beta1.PageRequest pagination = 1; + */ + pagination?: PageRequest; + constructor(data?: PartialMessage); static readonly runtime: typeof proto3; @@ -754,6 +1224,11 @@ export declare class QueryAllBlameRecordsResponse extends Message); static readonly runtime: typeof proto3; diff --git a/typescript/observer/tss_funds_migrator_pb.d.ts b/typescript/observer/tss_funds_migrator_pb.d.ts new file mode 100644 index 0000000000..ef6a85aac9 --- /dev/null +++ b/typescript/observer/tss_funds_migrator_pb.d.ts @@ -0,0 +1,37 @@ +// @generated by protoc-gen-es v1.3.0 with parameter "target=dts" +// @generated from file observer/tss_funds_migrator.proto (package zetachain.zetacore.observer, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from message zetachain.zetacore.observer.TssFundMigratorInfo + */ +export declare class TssFundMigratorInfo extends Message { + /** + * @generated from field: int64 chain_id = 1; + */ + chainId: bigint; + + /** + * @generated from field: string migration_cctx_index = 2; + */ + migrationCctxIndex: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.TssFundMigratorInfo"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): TssFundMigratorInfo; + + static fromJson(jsonValue: JsonValue, options?: Partial): TssFundMigratorInfo; + + static fromJsonString(jsonString: string, options?: Partial): TssFundMigratorInfo; + + static equals(a: TssFundMigratorInfo | PlainMessage | undefined, b: TssFundMigratorInfo | PlainMessage | undefined): boolean; +} + diff --git a/typescript/crosschain/tss_pb.d.ts b/typescript/observer/tss_pb.d.ts similarity index 85% rename from typescript/crosschain/tss_pb.d.ts rename to typescript/observer/tss_pb.d.ts index 13ef1fb435..19abe69068 100644 --- a/typescript/crosschain/tss_pb.d.ts +++ b/typescript/observer/tss_pb.d.ts @@ -1,5 +1,5 @@ // @generated by protoc-gen-es v1.3.0 with parameter "target=dts" -// @generated from file crosschain/tss.proto (package zetachain.zetacore.crosschain, syntax proto3) +// @generated from file observer/tss.proto (package zetachain.zetacore.observer, syntax proto3) /* eslint-disable */ // @ts-nocheck @@ -7,7 +7,7 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialM import { Message, proto3 } from "@bufbuild/protobuf"; /** - * @generated from message zetachain.zetacore.crosschain.TSS + * @generated from message zetachain.zetacore.observer.TSS */ export declare class TSS extends Message { /** @@ -38,7 +38,7 @@ export declare class TSS extends Message { constructor(data?: PartialMessage); static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.crosschain.TSS"; + static readonly typeName = "zetachain.zetacore.observer.TSS"; static readonly fields: FieldList; static fromBinary(bytes: Uint8Array, options?: Partial): TSS; diff --git a/x/crosschain/client/cli/cli_cctx.go b/x/crosschain/client/cli/cli_cctx.go index b97bc649f2..8191ebb152 100644 --- a/x/crosschain/client/cli/cli_cctx.go +++ b/x/crosschain/client/cli/cli_cctx.go @@ -51,9 +51,9 @@ func CmdListSend() *cobra.Command { func CmdPendingCctx() *cobra.Command { cmd := &cobra.Command{ - Use: "list-pending-cctx [chain-id]", + Use: "list-pending-cctx [chain-id] [limit]", Short: "shows pending CCTX", - Args: cobra.ExactArgs(1), + Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { clientCtx := client.GetClientContextFromCmd(cmd) @@ -62,11 +62,19 @@ func CmdPendingCctx() *cobra.Command { if err != nil { return err } - params := &types.QueryAllCctxPendingRequest{ + + limit, err := strconv.ParseUint(args[1], 10, 32) + if err != nil { + return err + } + + params := &types.QueryListCctxPendingRequest{ ChainId: chainID, + // #nosec G701 bit size verified + Limit: uint32(limit), } - res, err := queryClient.CctxAllPending(context.Background(), params) + res, err := queryClient.CctxListPending(context.Background(), params) if err != nil { return err } diff --git a/x/crosschain/client/cli/cli_chain_nonce.go b/x/crosschain/client/cli/cli_chain_nonce.go deleted file mode 100644 index b5d1dec101..0000000000 --- a/x/crosschain/client/cli/cli_chain_nonce.go +++ /dev/null @@ -1,133 +0,0 @@ -package cli - -import ( - "context" - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cobra" - "github.com/zeta-chain/zetacore/x/crosschain/types" -) - -func CmdListChainNonces() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-chain-nonces", - Short: "list all chainNonces", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - pageReq, err := client.ReadPageRequest(cmd.Flags()) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryAllChainNoncesRequest{ - Pagination: pageReq, - } - - res, err := queryClient.ChainNoncesAll(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, cmd.Use) - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdShowChainNonces() *cobra.Command { - cmd := &cobra.Command{ - Use: "show-chain-nonces [index]", - Short: "shows a chainNonces", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryGetChainNoncesRequest{ - Index: args[0], - } - - res, err := queryClient.ChainNonces(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdListPendingNonces() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-pending-nonces", - Short: "shows a chainNonces", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryAllPendingNoncesRequest{} - - res, err := queryClient.PendingNoncesAll(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -// Transaction CLI ///////////////////////// - -func CmdNonceVoter() *cobra.Command { - cmd := &cobra.Command{ - Use: "nonce-voter [chain] [nonce]", - Short: "Broadcast message nonceVoter", - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - argsChain, err := strconv.ParseInt(args[0], 10, 64) - if err != nil { - return err - } - argsNonce, err := strconv.ParseUint(args[1], 10, 64) - if err != nil { - return err - } - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgNonceVoter(clientCtx.GetFromAddress().String(), argsChain, argsNonce) - if err := msg.ValidateBasic(); err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/crosschain/client/cli/cli_tss.go b/x/crosschain/client/cli/cli_tss.go index 0dd93a244c..18aefa5e75 100644 --- a/x/crosschain/client/cli/cli_tss.go +++ b/x/crosschain/client/cli/cli_tss.go @@ -1,75 +1,19 @@ package cli import ( - "context" "fmt" "strconv" "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cast" - "github.com/zeta-chain/zetacore/common" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cast" "github.com/spf13/cobra" + "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/crosschain/types" ) -func CmdShowTSS() *cobra.Command { - cmd := &cobra.Command{ - Use: "show-tss", - Short: "shows a TSS", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryGetTSSRequest{} - - res, err := queryClient.TSS(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -func CmdListTssHistory() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-tss-history", - Short: "show historical list of TSS", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryTssHistoryRequest{} - - res, err := queryClient.TssHistory(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -// Transaction CLI ///////////////////////// - func CmdCreateTSSVoter() *cobra.Command { cmd := &cobra.Command{ Use: "create-tss-voter [pubkey] [keygenBlock] [status]", diff --git a/x/crosschain/client/cli/query.go b/x/crosschain/client/cli/query.go index 21b112a621..633e76e143 100644 --- a/x/crosschain/client/cli/query.go +++ b/x/crosschain/client/cli/query.go @@ -5,9 +5,9 @@ import ( // "strings" + "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" - "github.com/cosmos/cosmos-sdk/client" // "github.com/cosmos/cosmos-sdk/client/flags" // sdk "github.com/cosmos/cosmos-sdk/types" @@ -28,11 +28,9 @@ func GetQueryCmd(_ string) *cobra.Command { cmd.AddCommand( CmdListOutTxTracker(), CmdShowOutTxTracker(), - CmdShowTSS(), CmdListGasPrice(), CmdShowGasPrice(), - CmdListChainNonces(), - CmdShowChainNonces(), + CmdListSend(), CmdShowSend(), CmdLastZetaHeight(), @@ -40,12 +38,11 @@ func GetQueryCmd(_ string) *cobra.Command { CmdListInTxHashToCctx(), CmdShowInTxHashToCctx(), CmdQueryParams(), - CmdGetTssAddress(), - CmdListTssHistory(), - CmdListPendingNonces(), + CmdPendingCctx(), CmdListInTxTrackerByChain(), CmdListInTxTrackers(), + CmdGetZetaAccounting(), ) return cmd diff --git a/x/crosschain/client/cli/query_get_tss_address.go b/x/crosschain/client/cli/query_zeta_accounting.go similarity index 59% rename from x/crosschain/client/cli/query_get_tss_address.go rename to x/crosschain/client/cli/query_zeta_accounting.go index 785dd05a03..aece6e6f37 100644 --- a/x/crosschain/client/cli/query_get_tss_address.go +++ b/x/crosschain/client/cli/query_zeta_accounting.go @@ -7,38 +7,25 @@ import ( "github.com/zeta-chain/zetacore/x/crosschain/types" ) -func CmdGetTssAddress() *cobra.Command { +func CmdGetZetaAccounting() *cobra.Command { cmd := &cobra.Command{ - Use: "get-tss-address [tss-pubkey]", - Short: "Query current tss address", - Args: cobra.MaximumNArgs(1), + Use: "get-zeta-accounting", + Short: "Query zeta accounting", + Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err } - tssPubKey := "" - if len(args) == 1 { - tssPubKey = args[0] - } - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QueryGetTssAddressRequest{ - TssPubKey: tssPubKey, - } - - res, err := queryClient.GetTssAddress(cmd.Context(), params) + params := &types.QueryZetaAccountingRequest{} + res, err := queryClient.ZetaAccounting(cmd.Context(), params) if err != nil { return err } - return clientCtx.PrintProto(res) }, } - flags.AddQueryFlagsToCmd(cmd) - return cmd } diff --git a/x/crosschain/client/cli/tx.go b/x/crosschain/client/cli/tx.go index 868ff07549..0fc5e3c302 100644 --- a/x/crosschain/client/cli/tx.go +++ b/x/crosschain/client/cli/tx.go @@ -3,9 +3,9 @@ package cli import ( "fmt" + "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" - "github.com/cosmos/cosmos-sdk/client" // "github.com/cosmos/cosmos-sdk/client/flags" "github.com/zeta-chain/zetacore/x/crosschain/types" ) @@ -24,7 +24,6 @@ func GetTxCmd() *cobra.Command { CmdAddToWatchList(), CmdCreateTSSVoter(), CmdGasPriceVoter(), - CmdNonceVoter(), CmdCCTXOutboundVoter(), CmdCCTXInboundVoter(), CmdRemoveFromWatchList(), diff --git a/x/crosschain/client/integrationtests/cli_helpers.go b/x/crosschain/client/integrationtests/cli_helpers.go index eee042daf5..71c8a43a59 100644 --- a/x/crosschain/client/integrationtests/cli_helpers.go +++ b/x/crosschain/client/integrationtests/cli_helpers.go @@ -1,6 +1,3 @@ -//go:build TESTNET -// +build TESTNET - package integrationtests import ( @@ -9,22 +6,24 @@ import ( "strconv" "testing" + fungiblecli "github.com/zeta-chain/zetacore/x/fungible/client/cli" + "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/cosmos/cosmos-sdk/testutil" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" sdk "github.com/cosmos/cosmos-sdk/types" authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/stretchr/testify/require" tmcli "github.com/tendermint/tendermint/libs/cli" + "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/testutil/network" - "github.com/zeta-chain/zetacore/x/crosschain/types" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/testutil" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/zeta-chain/zetacore/x/crosschain/client/cli" + "github.com/zeta-chain/zetacore/x/crosschain/types" ) func TxSignExec(clientCtx client.Context, from fmt.Stringer, filename string, extraArgs ...string) (testutil.BufferWriter, error) { @@ -71,14 +70,95 @@ func GetTempDir(t testing.TB) string { // this change's rationale. tempdir, err := os.MkdirTemp("", "") require.NoError(t, err) - t.Cleanup(func() { _ = os.RemoveAll(tempdir) }) + t.Cleanup(func() { + err := os.RemoveAll(tempdir) + require.NoError(t, err) + }) return tempdir } +func BuildSignedDeploySystemContract(t testing.TB, val *network.Validator, denom string, account authtypes.AccountI) *os.File { + cmd := fungiblecli.CmdDeploySystemContracts() + txArgs := []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=true", flags.FlagGenerateOnly), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(denom, sdk.NewInt(100))).String()), + // gas limit + fmt.Sprintf("--%s=%d", flags.FlagGas, 4000000), + } + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, txArgs) + require.NoError(t, err) + unsignerdTx := WriteToNewTempFile(t, out.String()) + res, err := TxSignExec(val.ClientCtx, val.Address, unsignerdTx.Name(), + "--offline", "--account-number", strconv.FormatUint(account.GetAccountNumber(), 10), "--sequence", strconv.FormatUint(account.GetSequence(), 10)) + require.NoError(t, err) + return WriteToNewTempFile(t, res.String()) +} + +func BuildSignedUpdateSystemContract( + t testing.TB, + val *network.Validator, + denom string, + account authtypes.AccountI, + systemContractAddress string, +) *os.File { + cmd := fungiblecli.CmdUpdateSystemContract() + txArgs := []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=true", flags.FlagGenerateOnly), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(denom, sdk.NewInt(100))).String()), + // gas limit + fmt.Sprintf("--%s=%d", flags.FlagGas, 4000000), + } + args := append([]string{systemContractAddress}, txArgs...) + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, args) + require.NoError(t, err) + unsignerdTx := WriteToNewTempFile(t, out.String()) + res, err := TxSignExec(val.ClientCtx, val.Address, unsignerdTx.Name(), + "--offline", "--account-number", strconv.FormatUint(account.GetAccountNumber(), 10), "--sequence", strconv.FormatUint(account.GetSequence(), 10)) + require.NoError(t, err) + return WriteToNewTempFile(t, res.String()) +} + +func BuildSignedDeployETHZRC20( + t testing.TB, + val *network.Validator, + denom string, + account authtypes.AccountI, +) *os.File { + cmd := fungiblecli.CmdDeployFungibleCoinZRC4() + txArgs := []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=true", flags.FlagGenerateOnly), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(denom, sdk.NewInt(100))).String()), + // gas limit + fmt.Sprintf("--%s=%d", flags.FlagGas, 10000000), + } + args := append([]string{ + "", + strconv.FormatInt(common.GoerliLocalnetChain().ChainId, 10), + "18", + "ETH", + "gETH", + strconv.FormatInt(int64(common.CoinType_Gas), 10), + "1000000", + }, txArgs...) + out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, args) + require.NoError(t, err) + unsignerdTx := WriteToNewTempFile(t, out.String()) + res, err := TxSignExec(val.ClientCtx, val.Address, unsignerdTx.Name(), + "--offline", "--account-number", strconv.FormatUint(account.GetAccountNumber(), 10), "--sequence", strconv.FormatUint(account.GetSequence(), 10)) + require.NoError(t, err) + return WriteToNewTempFile(t, res.String()) +} + func BuildSignedGasPriceVote(t testing.TB, val *network.Validator, denom string, account authtypes.AccountI) *os.File { cmd := cli.CmdGasPriceVoter() inboundVoterArgs := []string{ - strconv.FormatInt(common.GoerliChain().ChainId, 10), + strconv.FormatInt(common.GoerliLocalnetChain().ChainId, 10), "10000000000", "100", "100", @@ -103,7 +183,7 @@ func BuildSignedTssVote(t testing.TB, val *network.Validator, denom string, acco cmd := cli.CmdCreateTSSVoter() inboundVoterArgs := []string{ "tsspubkey", - strconv.FormatInt(common.GoerliChain().ChainId, 10), + strconv.FormatInt(common.GoerliLocalnetChain().ChainId, 10), "0", } txArgs := []string{ @@ -122,8 +202,17 @@ func BuildSignedTssVote(t testing.TB, val *network.Validator, denom string, acco return WriteToNewTempFile(t, res.String()) } -func BuildSignedOutboundVote(t testing.TB, val *network.Validator, denom string, account authtypes.AccountI, nonce uint64, - cctxIndex, outTxHash, valueReceived, status string) *os.File { +func BuildSignedOutboundVote( + t testing.TB, + val *network.Validator, + denom string, + account authtypes.AccountI, + nonce uint64, + cctxIndex, + outTxHash, + valueReceived, + status string, +) *os.File { cmd := cli.CmdCCTXOutboundVoter() outboundVoterArgs := []string{ cctxIndex, @@ -134,7 +223,7 @@ func BuildSignedOutboundVote(t testing.TB, val *network.Validator, denom string, "0", valueReceived, status, - strconv.FormatInt(common.GoerliChain().ChainId, 10), + strconv.FormatInt(common.GoerliLocalnetChain().ChainId, 10), strconv.FormatUint(nonce, 10), "Zeta", } @@ -159,10 +248,10 @@ func BuildSignedInboundVote(t testing.TB, val *network.Validator, denom string, cmd := cli.CmdCCTXInboundVoter() inboundVoterArgs := []string{ "0x96B05C238b99768F349135de0653b687f9c13fEE", - strconv.FormatInt(common.GoerliChain().ChainId, 10), + strconv.FormatInt(common.GoerliLocalnetChain().ChainId, 10), "0x3b9Fe88DE29efD13240829A0c18E9EC7A44C3CA7", "0x96B05C238b99768F349135de0653b687f9c13fEE", - strconv.FormatInt(common.GoerliChain().ChainId, 10), + strconv.FormatInt(common.GoerliLocalnetChain().ChainId, 10), "10000000000000000000", message, "0x19398991572a825894b34b904ac1e3692720895351466b5c9e6bb7ae1e21d680", @@ -191,10 +280,10 @@ func GetBallotIdentifier(message string) string { msg := types.NewMsgVoteOnObservedInboundTx( "", "0x96B05C238b99768F349135de0653b687f9c13fEE", - common.GoerliChain().ChainId, + common.GoerliLocalnetChain().ChainId, "0x3b9Fe88DE29efD13240829A0c18E9EC7A44C3CA7", "0x96B05C238b99768F349135de0653b687f9c13fEE", - common.GoerliChain().ChainId, + common.GoerliLocalnetChain().ChainId, sdk.NewUint(10000000000000000000), message, "0x19398991572a825894b34b904ac1e3692720895351466b5c9e6bb7ae1e21d680", @@ -218,7 +307,7 @@ func GetBallotIdentifierOutBound(nonce uint64, cctxindex, outtxHash, valueReceiv 0, math.NewUintFromString(valueReceived), 0, - common.GoerliChain().ChainId, + common.GoerliLocalnetChain().ChainId, nonce, common.CoinType_Zeta, ) diff --git a/x/crosschain/client/integrationtests/cli_test.go b/x/crosschain/client/integrationtests/cli_test.go index cd5af20871..de594398ce 100644 --- a/x/crosschain/client/integrationtests/cli_test.go +++ b/x/crosschain/client/integrationtests/cli_test.go @@ -1,6 +1,3 @@ -//go:build TESTNET -// +build TESTNET - package integrationtests import ( diff --git a/x/crosschain/client/integrationtests/inbound_voter_test.go b/x/crosschain/client/integrationtests/inbound_voter_test.go index 6305295b2a..cd01d95381 100644 --- a/x/crosschain/client/integrationtests/inbound_voter_test.go +++ b/x/crosschain/client/integrationtests/inbound_voter_test.go @@ -1,19 +1,117 @@ -//go:build TESTNET -// +build TESTNET - package integrationtests import ( + "encoding/json" + "fmt" + "strings" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - crosschainCli "github.com/zeta-chain/zetacore/x/crosschain/client/cli" + crosschaincli "github.com/zeta-chain/zetacore/x/crosschain/client/cli" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" - observerCli "github.com/zeta-chain/zetacore/x/observer/client/cli" + observercli "github.com/zeta-chain/zetacore/x/observer/client/cli" observerTypes "github.com/zeta-chain/zetacore/x/observer/types" ) +type messageLog struct { + Events []event `json:"events"` +} + +type event struct { + Type string `json:"type"` + Attributes []attribute `json:"attributes"` +} + +type attribute struct { + Key string `json:"key"` + Value string `json:"value"` +} + +// fetchAttribute fetches the attribute from the tx response +func fetchAttribute(rawLog string, key string) (string, error) { + var logs []messageLog + err := json.Unmarshal([]byte(rawLog), &logs) + if err != nil { + return "", err + } + + var attributes []string + for _, log := range logs { + for _, event := range log.Events { + for _, attr := range event.Attributes { + attributes = append(attributes, attr.Key) + if strings.EqualFold(attr.Key, key) { + address := attr.Value + + // trim the quotes + address = address[1 : len(address)-1] + + return address, nil + } + + } + } + } + + return "", fmt.Errorf("attribute %s not found, attributes: %+v", key, attributes) +} + +type txRes struct { + RawLog string `json:"raw_log"` +} + +func ExtractRawLog(str string) (string, error) { + var data txRes + + err := json.Unmarshal([]byte(str), &data) + if err != nil { + return "", err + } + + return data.RawLog, nil +} + func (s *IntegrationTestSuite) TestCCTXInboundVoter() { + broadcaster := s.network.Validators[0] + + var systemContractAddr string + // Initialize system contract + { + out, err := clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetAccountCmd(), []string{broadcaster.Address.String(), "--output", "json"}) + s.Require().NoError(err) + var account authtypes.AccountI + s.NoError(broadcaster.ClientCtx.Codec.UnmarshalInterfaceJSON(out.Bytes(), &account)) + signedTx := BuildSignedDeploySystemContract(s.T(), broadcaster, s.cfg.BondDenom, account) + res, err := clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetBroadcastCommand(), []string{signedTx.Name(), "--broadcast-mode", "block"}) + s.Require().NoError(err) + + rawLog, err := ExtractRawLog(res.String()) + s.Require().NoError(err) + + systemContractAddr, err = fetchAttribute(rawLog, "system_contract") + s.Require().NoError(err) + + // update system contract + out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetAccountCmd(), []string{broadcaster.Address.String(), "--output", "json"}) + s.Require().NoError(err) + s.NoError(broadcaster.ClientCtx.Codec.UnmarshalInterfaceJSON(out.Bytes(), &account)) + signedTx = BuildSignedUpdateSystemContract(s.T(), broadcaster, s.cfg.BondDenom, account, systemContractAddr) + res, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetBroadcastCommand(), []string{signedTx.Name(), "--broadcast-mode", "block"}) + s.Require().NoError(err) + } + + // Deploy ETH ZRC20 + { + out, err := clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetAccountCmd(), []string{broadcaster.Address.String(), "--output", "json"}) + s.Require().NoError(err) + var account authtypes.AccountI + s.NoError(broadcaster.ClientCtx.Codec.UnmarshalInterfaceJSON(out.Bytes(), &account)) + signedTx := BuildSignedDeployETHZRC20(s.T(), broadcaster, s.cfg.BondDenom, account) + _, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetBroadcastCommand(), []string{signedTx.Name(), "--broadcast-mode", "block"}) + s.Require().NoError(err) + } + tt := []struct { name string votes map[string]observerTypes.VoteType @@ -128,8 +226,6 @@ func (s *IntegrationTestSuite) TestCCTXInboundVoter() { for _, test := range tt { test := test s.Run(test.name, func() { - broadcaster := s.network.Validators[0] - // Vote the gas price for _, val := range s.network.Validators { out, err := clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetAccountCmd(), []string{val.Address.String(), "--output", "json"}) @@ -178,7 +274,7 @@ func (s *IntegrationTestSuite) TestCCTXInboundVoter() { // Get the ballot ballotIdentifier := GetBallotIdentifier(test.name) - out, err := clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, observerCli.CmdBallotByIdentifier(), []string{ballotIdentifier, "--output", "json"}) + out, err := clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, observercli.CmdBallotByIdentifier(), []string{ballotIdentifier, "--output", "json"}) s.Require().NoError(err) ballot := observerTypes.QueryBallotByIdentifierResponse{} s.NoError(broadcaster.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &ballot)) @@ -187,25 +283,25 @@ func (s *IntegrationTestSuite) TestCCTXInboundVoter() { s.Assert().Equal(len(test.votes), len(ballot.Voters)) for _, vote := range ballot.Voters { if test.votes[vote.VoterAddress] == observerTypes.VoteType_FailureObservation { - s.Assert().Equal(observerTypes.VoteType_NotYetVoted, vote.VoteType) + s.Assert().Equal(observerTypes.VoteType_NotYetVoted.String(), vote.VoteType.String()) continue } - s.Assert().Equal(test.votes[vote.VoterAddress], vote.VoteType) + s.Assert().Equal(test.votes[vote.VoterAddress].String(), vote.VoteType.String()) } - s.Assert().Equal(test.ballotResult, ballot.BallotStatus) + s.Assert().Equal(test.ballotResult.String(), ballot.BallotStatus.String()) // Get the cctx and check its status cctxIdentifier := ballotIdentifier if test.falseBallotIdentifier != "" { cctxIdentifier = test.falseBallotIdentifier } - out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, crosschainCli.CmdShowSend(), []string{cctxIdentifier, "--output", "json"}) + out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, crosschaincli.CmdShowSend(), []string{cctxIdentifier, "--output", "json"}) cctx := crosschaintypes.QueryGetCctxResponse{} if test.cctxStatus == crosschaintypes.CctxStatus_PendingRevert { s.Require().Contains(out.String(), "not found") } else { s.NoError(broadcaster.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &cctx)) - s.Assert().Equal(test.cctxStatus, cctx.CrossChainTx.CctxStatus.Status) + s.Assert().Equal(test.cctxStatus.String(), cctx.CrossChainTx.CctxStatus.Status.String(), cctx.CrossChainTx.CctxStatus.StatusMessage) } }) } diff --git a/x/crosschain/client/integrationtests/outbound_voter_test.go b/x/crosschain/client/integrationtests/outbound_voter_test.go index 92237b62b9..cb36954838 100644 --- a/x/crosschain/client/integrationtests/outbound_voter_test.go +++ b/x/crosschain/client/integrationtests/outbound_voter_test.go @@ -1,15 +1,12 @@ -//go:build TESTNET -// +build TESTNET - package integrationtests import ( clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" authcli "github.com/cosmos/cosmos-sdk/x/auth/client/cli" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - crosschainCli "github.com/zeta-chain/zetacore/x/crosschain/client/cli" + crosschaincli "github.com/zeta-chain/zetacore/x/crosschain/client/cli" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" - observerCli "github.com/zeta-chain/zetacore/x/observer/client/cli" + observercli "github.com/zeta-chain/zetacore/x/observer/client/cli" observerTypes "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -79,7 +76,7 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() { }, correctBallotResult: observerTypes.BallotStatus_BallotInProgress, cctxStatus: crosschaintypes.CctxStatus_PendingOutbound, - valueReceived: "7993442360774956232", + valueReceived: "7990439496224753106", }, { name: "Fake ballot has more votes outbound gets finalized", @@ -159,10 +156,10 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() { // Get the ballot cctxIdentifier := GetBallotIdentifier(test.name) - out, err := clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, crosschainCli.CmdShowSend(), []string{cctxIdentifier, "--output", "json"}) + out, err := clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, crosschaincli.CmdShowSend(), []string{cctxIdentifier, "--output", "json"}) cctx := crosschaintypes.QueryGetCctxResponse{} s.NoError(broadcaster.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &cctx)) - s.Assert().Equal(crosschaintypes.CctxStatus_PendingOutbound, cctx.CrossChainTx.CctxStatus.Status) + s.Assert().Equal(crosschaintypes.CctxStatus_PendingOutbound.String(), cctx.CrossChainTx.CctxStatus.Status.String(), cctx.CrossChainTx.CctxStatus.StatusMessage) nonce := cctx.CrossChainTx.GetCurrentOutTxParam().OutboundTxTssNonce // Check the vote in the ballot and vote the outbound tx fakeVotes := []string{} @@ -201,27 +198,27 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() { s.Require().NoError(s.network.WaitForNBlocks(2)) // Get the cctx - out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, crosschainCli.CmdShowSend(), []string{cctxIdentifier, "--output", "json"}) + out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, crosschaincli.CmdShowSend(), []string{cctxIdentifier, "--output", "json"}) cctx = crosschaintypes.QueryGetCctxResponse{} s.NoError(broadcaster.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &cctx)) - s.Assert().Equal(test.cctxStatus, cctx.CrossChainTx.CctxStatus.Status) + s.Assert().Equal(test.cctxStatus.String(), cctx.CrossChainTx.CctxStatus.Status.String(), cctx.CrossChainTx.CctxStatus.StatusMessage) outboundBallotIdentifier := GetBallotIdentifierOutBound(nonce, cctxIdentifier, test.name, test.valueReceived) - out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, observerCli.CmdBallotByIdentifier(), []string{outboundBallotIdentifier, "--output", "json"}) + out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, observercli.CmdBallotByIdentifier(), []string{outboundBallotIdentifier, "--output", "json"}) s.Require().NoError(err) ballot := observerTypes.QueryBallotByIdentifierResponse{} s.NoError(broadcaster.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &ballot)) // Check the votes - s.Require().Equal(test.correctBallotResult, ballot.BallotStatus) + s.Require().Equal(test.correctBallotResult.String(), ballot.BallotStatus.String()) for _, vote := range test.votes { for _, ballotvote := range ballot.Voters { if vote.voterAddress == ballotvote.VoterAddress { if !vote.isFakeVote { - s.Assert().Equal(vote.voteType, ballotvote.VoteType) + s.Assert().Equal(vote.voteType.String(), ballotvote.VoteType.String()) } else { - s.Assert().Equal(observerTypes.VoteType_NotYetVoted, ballotvote.VoteType) + s.Assert().Equal(observerTypes.VoteType_NotYetVoted.String(), ballotvote.VoteType.String()) } break } @@ -229,7 +226,7 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() { } if len(fakeVotes) > 0 { outboundFakeBallotIdentifier := GetBallotIdentifierOutBound(nonce, cctxIdentifier, test.name+"falseVote", test.valueReceived) - out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, observerCli.CmdBallotByIdentifier(), []string{outboundFakeBallotIdentifier, "--output", "json"}) + out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, observercli.CmdBallotByIdentifier(), []string{outboundFakeBallotIdentifier, "--output", "json"}) s.Require().NoError(err) fakeBallot := observerTypes.QueryBallotByIdentifierResponse{} s.NoError(broadcaster.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &fakeBallot)) @@ -237,7 +234,7 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() { if vote.isFakeVote { for _, ballotVote := range fakeBallot.Voters { if vote.voterAddress == ballotVote.VoterAddress { - s.Assert().Equal(vote.voteType, ballotVote.VoteType) + s.Assert().Equal(vote.voteType.String(), ballotVote.VoteType.String()) break } } diff --git a/x/crosschain/client/integrationtests/suite.go b/x/crosschain/client/integrationtests/suite.go index 8b8db1b25f..65a45bc4b3 100644 --- a/x/crosschain/client/integrationtests/suite.go +++ b/x/crosschain/client/integrationtests/suite.go @@ -1,6 +1,3 @@ -//go:build TESTNET -// +build TESTNET - package integrationtests import ( @@ -53,13 +50,13 @@ func (s *IntegrationTestSuite) SetupSuite() { } network.SetupZetaGenesisState(s.T(), s.cfg.GenesisState, s.cfg.Codec, observerList, true) network.AddCrosschainData(s.T(), 0, s.cfg.GenesisState, s.cfg.Codec) + network.AddObserverData(s.T(), 0, s.cfg.GenesisState, s.cfg.Codec, nil) net, err := network.New(s.T(), app.NodeDir, s.cfg) s.Assert().NoError(err) s.network = net time.Sleep(3 * time.Second) _, err = s.network.WaitForHeight(1) s.Require().NoError(err) - } func (s *IntegrationTestSuite) TearDownSuite() { diff --git a/x/crosschain/client/querytests/suite.go b/x/crosschain/client/querytests/suite.go index 4d3fc20a40..156d2772cf 100644 --- a/x/crosschain/client/querytests/suite.go +++ b/x/crosschain/client/querytests/suite.go @@ -44,7 +44,7 @@ func (s *CliTestSuite) SetupSuite() { } network.SetupZetaGenesisState(s.T(), s.cfg.GenesisState, s.cfg.Codec, observerList, false) s.crosschainState = network.AddCrosschainData(s.T(), 2, s.cfg.GenesisState, s.cfg.Codec) - s.observerState = network.AddObserverData(s.T(), s.cfg.GenesisState, s.cfg.Codec, nil) + s.observerState = network.AddObserverData(s.T(), 2, s.cfg.GenesisState, s.cfg.Codec, nil) net, err := network.New(s.T(), app.NodeDir, s.cfg) s.Assert().NoError(err) s.network = net diff --git a/x/crosschain/genesis.go b/x/crosschain/genesis.go index 9c0f52bb29..06ec239962 100644 --- a/x/crosschain/genesis.go +++ b/x/crosschain/genesis.go @@ -2,7 +2,6 @@ package crosschain import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/crosschain/keeper" "github.com/zeta-chain/zetacore/x/crosschain/types" ) @@ -13,6 +12,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) // Params k.SetParams(ctx, genState.Params) + k.SetZetaAccounting(ctx, genState.ZetaAccounting) // Set all the outTxTracker for _, elem := range genState.OutTxTrackerList { k.SetOutTxTracker(ctx, elem) @@ -36,11 +36,6 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) } // Set all the chain nonces - for _, elem := range genState.ChainNoncesList { - if elem != nil { - k.SetChainNonces(ctx, *elem) - } - } // Set all the last block heights for _, elem := range genState.LastBlockHeightList { @@ -56,20 +51,6 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) } } - if genState.Tss != nil { - k.SetTSS(ctx, *genState.Tss) - for _, chain := range common.DefaultChainsList() { - k.SetPendingNonces(ctx, types.PendingNonces{ - NonceLow: 0, - NonceHigh: 0, - ChainId: chain.ChainId, - Tss: genState.Tss.TssPubkey, - }) - } - for _, elem := range genState.TssHistory { - k.SetTSSHistory(ctx, elem) - } - } } // ExportGenesis returns the crosschain module's exported genesis. @@ -81,12 +62,6 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis.InTxHashToCctxList = k.GetAllInTxHashToCctx(ctx) genesis.InTxTrackerList = k.GetAllInTxTracker(ctx) - // Get tss - tss, found := k.GetTSS(ctx) - if found { - genesis.Tss = &tss - } - // Get all gas prices gasPriceList := k.GetAllGasPrice(ctx) for _, elem := range gasPriceList { @@ -94,13 +69,6 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis.GasPriceList = append(genesis.GasPriceList, &elem) } - // Get all chain nonces - chainNoncesList := k.GetAllChainNonces(ctx) - for _, elem := range chainNoncesList { - elem := elem - genesis.ChainNoncesList = append(genesis.ChainNoncesList, &elem) - } - // Get all last block heights lastBlockHeightList := k.GetAllLastBlockHeight(ctx) for _, elem := range lastBlockHeightList { @@ -115,7 +83,10 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis.CrossChainTxs = append(genesis.CrossChainTxs, &elem) } - genesis.TssHistory = k.GetAllTSS(ctx) + amount, found := k.GetZetaAccounting(ctx) + if found { + genesis.ZetaAccounting = amount + } return &genesis } diff --git a/x/crosschain/genesis_test.go b/x/crosschain/genesis_test.go index 994c83f67a..3ce6a94875 100644 --- a/x/crosschain/genesis_test.go +++ b/x/crosschain/genesis_test.go @@ -13,23 +13,18 @@ import ( func TestGenesis(t *testing.T) { genesisState := types.GenesisState{ - Params: types.DefaultParams(), + Params: types.DefaultParams(), + ZetaAccounting: sample.ZetaAccounting(t, "sample"), OutTxTrackerList: []types.OutTxTracker{ sample.OutTxTracker(t, "0"), sample.OutTxTracker(t, "1"), sample.OutTxTracker(t, "2"), }, - Tss: sample.Tss(), GasPriceList: []*types.GasPrice{ sample.GasPrice(t, "0"), sample.GasPrice(t, "1"), sample.GasPrice(t, "2"), }, - ChainNoncesList: []*types.ChainNonces{ - sample.ChainNonces(t, "0"), - sample.ChainNonces(t, "1"), - sample.ChainNonces(t, "2"), - }, CrossChainTxs: []*types.CrossChainTx{ sample.CrossChainTx(t, "0"), sample.CrossChainTx(t, "1"), diff --git a/x/crosschain/keeper/abci.go b/x/crosschain/keeper/abci.go index 6621c45d36..78959be37c 100644 --- a/x/crosschain/keeper/abci.go +++ b/x/crosschain/keeper/abci.go @@ -34,8 +34,9 @@ func (k Keeper) IterateAndUpdateCctxGasPrice(ctx sdk.Context) error { // iterate all chains' pending cctx chains := common.DefaultChainsList() for _, chain := range chains { - res, err := k.CctxAllPending(sdk.UnwrapSDKContext(ctx), &types.QueryAllCctxPendingRequest{ + res, err := k.CctxListPending(sdk.UnwrapSDKContext(ctx), &types.QueryListCctxPendingRequest{ ChainId: chain.ChainId, + Limit: gasPriceIncreaseFlags.MaxPendingCctxs, }) if err != nil { return err diff --git a/x/crosschain/keeper/cctx.go b/x/crosschain/keeper/cctx.go new file mode 100644 index 0000000000..e3a2a06f71 --- /dev/null +++ b/x/crosschain/keeper/cctx.go @@ -0,0 +1,147 @@ +package keeper + +import ( + "fmt" + + "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/x/crosschain/types" + observerTypes "github.com/zeta-chain/zetacore/x/observer/types" +) + +// SetCctxAndNonceToCctxAndInTxHashToCctx does the following things in one function: +// 1. set the cctx in the store +// 2. set the mapping inTxHash -> cctxIndex , one inTxHash can be connected to multiple cctxindex +// 3. set the mapping nonce => cctx +// 4. update the zeta accounting +func (k Keeper) SetCctxAndNonceToCctxAndInTxHashToCctx(ctx sdk.Context, cctx types.CrossChainTx) { + k.SetCrossChainTx(ctx, cctx) + + // set mapping inTxHash -> cctxIndex + in, _ := k.GetInTxHashToCctx(ctx, cctx.InboundTxParams.InboundTxObservedHash) + in.InTxHash = cctx.InboundTxParams.InboundTxObservedHash + found := false + for _, cctxIndex := range in.CctxIndex { + if cctxIndex == cctx.Index { + found = true + break + } + } + if !found { + in.CctxIndex = append(in.CctxIndex, cctx.Index) + } + k.SetInTxHashToCctx(ctx, in) + + tss, found := k.zetaObserverKeeper.GetTSS(ctx) + if !found { + return + } + // set mapping nonce => cctxIndex + if cctx.CctxStatus.Status == types.CctxStatus_PendingOutbound || cctx.CctxStatus.Status == types.CctxStatus_PendingRevert { + k.GetObserverKeeper().SetNonceToCctx(ctx, observerTypes.NonceToCctx{ + ChainId: cctx.GetCurrentOutTxParam().ReceiverChainId, + // #nosec G701 always in range + Nonce: int64(cctx.GetCurrentOutTxParam().OutboundTxTssNonce), + CctxIndex: cctx.Index, + Tss: tss.TssPubkey, + }) + } + if cctx.CctxStatus.Status == types.CctxStatus_Aborted && cctx.GetCurrentOutTxParam().CoinType == common.CoinType_Zeta { + k.AddZetaAbortedAmount(ctx, cctx.GetCurrentOutTxParam().Amount) + } +} + +// SetCrossChainTx set a specific send in the store from its index +func (k Keeper) SetCrossChainTx(ctx sdk.Context, cctx types.CrossChainTx) { + p := types.KeyPrefix(fmt.Sprintf("%s", types.SendKey)) + store := prefix.NewStore(ctx.KVStore(k.storeKey), p) + b := k.cdc.MustMarshal(&cctx) + store.Set(types.KeyPrefix(cctx.Index), b) +} + +// GetCrossChainTx returns a send from its index +func (k Keeper) GetCrossChainTx(ctx sdk.Context, index string) (val types.CrossChainTx, found bool) { + p := types.KeyPrefix(fmt.Sprintf("%s", types.SendKey)) + store := prefix.NewStore(ctx.KVStore(k.storeKey), p) + + b := store.Get(types.KeyPrefix(index)) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +func (k Keeper) GetAllCrossChainTx(ctx sdk.Context) (list []types.CrossChainTx) { + p := types.KeyPrefix(fmt.Sprintf("%s", types.SendKey)) + store := prefix.NewStore(ctx.KVStore(k.storeKey), p) + + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.CrossChainTx + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return list +} + +// RemoveCrossChainTx removes a send from the store +func (k Keeper) RemoveCrossChainTx(ctx sdk.Context, index string) { + p := types.KeyPrefix(fmt.Sprintf("%s", types.SendKey)) + store := prefix.NewStore(ctx.KVStore(k.storeKey), p) + store.Delete(types.KeyPrefix(index)) +} + +func (k Keeper) CreateNewCCTX(ctx sdk.Context, msg *types.MsgVoteOnObservedInboundTx, index string, tssPubkey string, s types.CctxStatus, senderChain, receiverChain *common.Chain) types.CrossChainTx { + if msg.TxOrigin == "" { + msg.TxOrigin = msg.Sender + } + inboundParams := &types.InboundTxParams{ + Sender: msg.Sender, + SenderChainId: senderChain.ChainId, + TxOrigin: msg.TxOrigin, + Asset: msg.Asset, + Amount: msg.Amount, + CoinType: msg.CoinType, + InboundTxObservedHash: msg.InTxHash, + InboundTxObservedExternalHeight: msg.InBlockHeight, + InboundTxFinalizedZetaHeight: 0, + InboundTxBallotIndex: index, + } + + outBoundParams := &types.OutboundTxParams{ + Receiver: msg.Receiver, + ReceiverChainId: receiverChain.ChainId, + OutboundTxHash: "", + OutboundTxTssNonce: 0, + OutboundTxGasLimit: msg.GasLimit, + OutboundTxGasPrice: "", + OutboundTxBallotIndex: "", + OutboundTxObservedExternalHeight: 0, + CoinType: msg.CoinType, // FIXME: is this correct? + Amount: sdk.NewUint(0), + TssPubkey: tssPubkey, + } + status := &types.Status{ + Status: s, + StatusMessage: "", + LastUpdateTimestamp: ctx.BlockHeader().Time.Unix(), + } + newCctx := types.CrossChainTx{ + Creator: msg.Creator, + Index: index, + ZetaFees: math.ZeroUint(), + RelayedMessage: msg.Message, + CctxStatus: status, + InboundTxParams: inboundParams, + OutboundTxParams: []*types.OutboundTxParams{outBoundParams}, + } + return newCctx +} diff --git a/x/crosschain/keeper/keeper_cross_chain_tx_test.go b/x/crosschain/keeper/cctx_test.go similarity index 88% rename from x/crosschain/keeper/keeper_cross_chain_tx_test.go rename to x/crosschain/keeper/cctx_test.go index 6de7b4b5cb..13218eca13 100644 --- a/x/crosschain/keeper/keeper_cross_chain_tx_test.go +++ b/x/crosschain/keeper/cctx_test.go @@ -1,4 +1,4 @@ -package keeper +package keeper_test import ( "fmt" @@ -6,9 +6,11 @@ import ( "testing" "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/types/query" "github.com/stretchr/testify/require" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/crosschain/keeper" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -19,7 +21,7 @@ import ( "github.com/zeta-chain/zetacore/x/crosschain/types" ) -func createNCctxWithStatus(keeper *Keeper, ctx sdk.Context, n int, status types.CctxStatus) []types.CrossChainTx { +func createNCctxWithStatus(keeper *keeper.Keeper, ctx sdk.Context, n int, status types.CctxStatus) []types.CrossChainTx { items := make([]types.CrossChainTx, n) for i := range items { items[i].Creator = "any" @@ -31,6 +33,7 @@ func createNCctxWithStatus(keeper *Keeper, ctx sdk.Context, n int, status types. } items[i].ZetaFees = math.OneUint() items[i].InboundTxParams = &types.InboundTxParams{InboundTxObservedHash: fmt.Sprintf("%d", i), Amount: math.OneUint()} + items[i].OutboundTxParams = []*types.OutboundTxParams{{Amount: math.ZeroUint()}} keeper.SetCctxAndNonceToCctxAndInTxHashToCctx(ctx, items[i]) } @@ -38,7 +41,7 @@ func createNCctxWithStatus(keeper *Keeper, ctx sdk.Context, n int, status types. } // Keeper Tests -func createNCctx(keeper *Keeper, ctx sdk.Context, n int) []types.CrossChainTx { +func createNCctx(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.CrossChainTx { items := make([]types.CrossChainTx, n) for i := range items { items[i].Creator = "any" @@ -112,8 +115,10 @@ func TestSends(t *testing.T) { for _, tt := range sendsTest { tt := tt t.Run(tt.TestName, func(t *testing.T) { - keeper, ctx := setupKeeper(t) + keeper, ctx, _, zk := keepertest.CrosschainKeeper(t) + keeper.SetZetaAccounting(ctx, types.ZetaAccounting{AbortedZetaAmount: math.ZeroUint()}) var sends []types.CrossChainTx + zk.ObserverKeeper.SetTSS(ctx, sample.Tss()) sends = append(sends, createNCctxWithStatus(keeper, ctx, tt.PendingInbound, types.CctxStatus_PendingInbound)...) sends = append(sends, createNCctxWithStatus(keeper, ctx, tt.PendingOutbound, types.CctxStatus_PendingOutbound)...) sends = append(sends, createNCctxWithStatus(keeper, ctx, tt.PendingRevert, types.CctxStatus_PendingRevert)...) @@ -135,7 +140,8 @@ func TestSends(t *testing.T) { } func TestSendGetAll(t *testing.T) { - keeper, ctx := setupKeeper(t) + keeper, ctx, _, zk := keepertest.CrosschainKeeper(t) + zk.ObserverKeeper.SetTSS(ctx, sample.Tss()) items := createNCctx(keeper, ctx, 10) cctx := keeper.GetAllCrossChainTx(ctx) c := make([]types.CrossChainTx, len(cctx)) @@ -148,7 +154,8 @@ func TestSendGetAll(t *testing.T) { // Querier Tests func TestSendQuerySingle(t *testing.T) { - keeper, ctx := setupKeeper(t) + keeper, ctx, _, zk := keepertest.CrosschainKeeper(t) + zk.ObserverKeeper.SetTSS(ctx, sample.Tss()) wctx := sdk.WrapSDKContext(ctx) msgs := createNCctx(keeper, ctx, 2) for _, tc := range []struct { @@ -190,7 +197,8 @@ func TestSendQuerySingle(t *testing.T) { } func TestSendQueryPaginated(t *testing.T) { - keeper, ctx := setupKeeper(t) + keeper, ctx, _, zk := keepertest.CrosschainKeeper(t) + zk.ObserverKeeper.SetTSS(ctx, sample.Tss()) wctx := sdk.WrapSDKContext(ctx) msgs := createNCctx(keeper, ctx, 5) diff --git a/x/crosschain/keeper/cctx_utils.go b/x/crosschain/keeper/cctx_utils.go index 3bd7cf241b..d257b7f18a 100644 --- a/x/crosschain/keeper/cctx_utils.go +++ b/x/crosschain/keeper/cctx_utils.go @@ -23,19 +23,19 @@ func (k Keeper) UpdateNonce(ctx sdk.Context, receiveChainID int64, cctx *types.C return zetaObserverTypes.ErrSupportedChains } - nonce, found := k.GetChainNonces(ctx, chain.ChainName.String()) + nonce, found := k.GetObserverKeeper().GetChainNonces(ctx, chain.ChainName.String()) if !found { return cosmoserrors.Wrap(types.ErrCannotFindReceiverNonce, fmt.Sprintf("Chain(%s) | Identifiers : %s ", chain.ChainName.String(), cctx.LogIdentifierForCCTX())) } // SET nonce cctx.GetCurrentOutTxParam().OutboundTxTssNonce = nonce.Nonce - tss, found := k.GetTSS(ctx) + tss, found := k.zetaObserverKeeper.GetTSS(ctx) if !found { return cosmoserrors.Wrap(types.ErrCannotFindTSSKeys, fmt.Sprintf("Chain(%s) | Identifiers : %s ", chain.ChainName.String(), cctx.LogIdentifierForCCTX())) } - p, found := k.GetPendingNonces(ctx, tss.TssPubkey, receiveChainID) + p, found := k.GetObserverKeeper().GetPendingNonces(ctx, tss.TssPubkey, receiveChainID) if !found { return cosmoserrors.Wrap(types.ErrCannotFindPendingNonces, fmt.Sprintf("chain_id %d, nonce %d", receiveChainID, nonce.Nonce)) } @@ -47,8 +47,8 @@ func (k Keeper) UpdateNonce(ctx sdk.Context, receiveChainID int64, cctx *types.C nonce.Nonce++ p.NonceHigh++ - k.SetChainNonces(ctx, nonce) - k.SetPendingNonces(ctx, p) + k.GetObserverKeeper().SetChainNonces(ctx, nonce) + k.GetObserverKeeper().SetPendingNonces(ctx, p) return nil } diff --git a/x/crosschain/keeper/evm_deposit.go b/x/crosschain/keeper/evm_deposit.go index 9391f7c485..c33adc8420 100644 --- a/x/crosschain/keeper/evm_deposit.go +++ b/x/crosschain/keeper/evm_deposit.go @@ -66,9 +66,7 @@ func (k Keeper) HandleEVMDeposit( msg.CoinType, msg.Asset, ) - if fungibletypes.IsContractReverted(evmTxResponse, err) || - errors.Is(err, fungibletypes.ErrForeignCoinCapReached) || - errors.Is(err, fungibletypes.ErrCallNonContract) { + if fungibletypes.IsContractReverted(evmTxResponse, err) || errShouldRevertCctx(err) { return true, err } else if err != nil { return false, err @@ -105,6 +103,14 @@ func (k Keeper) HandleEVMDeposit( return false, nil } +// errShouldRevertCctx returns true if the cctx should revert from the error of the deposit +// we revert the cctx if a non-contract is tried to be called, if the liquidity cap is reached, or if the zrc20 is paused +func errShouldRevertCctx(err error) bool { + return errors.Is(err, fungibletypes.ErrForeignCoinCapReached) || + errors.Is(err, fungibletypes.ErrCallNonContract) || + errors.Is(err, fungibletypes.ErrPausedZRC20) +} + // parseAddressAndData parses the message string into an address and data // message is hex encoded byte array // [ contractAddress calldata ] diff --git a/x/crosschain/keeper/evm_deposit_test.go b/x/crosschain/keeper/evm_deposit_test.go index 0a0626af5d..65483d89c1 100644 --- a/x/crosschain/keeper/evm_deposit_test.go +++ b/x/crosschain/keeper/evm_deposit_test.go @@ -253,6 +253,50 @@ func TestMsgServer_HandleEVMDeposit(t *testing.T) { fungibleMock.AssertExpectations(t) }) + t.Run("should return error with reverted if deposit ERC20 fails with zrc20 paused", func(t *testing.T) { + k, ctx, _, _ := keepertest.CrosschainKeeperWithMocks(t, keepertest.CrosschainMockOptions{ + UseFungibleMock: true, + }) + + senderChain := getValidEthChain(t) + + fungibleMock := keepertest.GetCrosschainFungibleMock(t, k) + receiver := sample.EthAddress() + amount := big.NewInt(42) + + // expect DepositCoinZeta to be called + // ZRC20DepositAndCallContract(ctx, from, to, msg.Amount.BigInt(), senderChain, msg.Message, contract, data, msg.CoinType, msg.Asset) + fungibleMock.On( + "ZRC20DepositAndCallContract", + ctx, + mock.Anything, + receiver, + amount, + senderChain, + mock.Anything, + common.CoinType_ERC20, + mock.Anything, + ).Return(&evmtypes.MsgEthereumTxResponse{}, false, fungibletypes.ErrPausedZRC20) + + // call HandleEVMDeposit + reverted, err := k.HandleEVMDeposit( + ctx, + sample.CrossChainTx(t, "foo"), + types.MsgVoteOnObservedInboundTx{ + Sender: sample.EthAddress().String(), + Receiver: receiver.String(), + Amount: math.NewUintFromBigInt(amount), + CoinType: common.CoinType_ERC20, + Message: "", + Asset: "", + }, + senderChain, + ) + require.ErrorIs(t, err, fungibletypes.ErrPausedZRC20) + require.True(t, reverted) + fungibleMock.AssertExpectations(t) + }) + t.Run("should return error with reverted if deposit ERC20 fails with calling a non-contract address", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeperWithMocks(t, keepertest.CrosschainMockOptions{ UseFungibleMock: true, diff --git a/x/crosschain/keeper/evm_hooks.go b/x/crosschain/keeper/evm_hooks.go index a3f4dc5eee..92fa5ffad5 100644 --- a/x/crosschain/keeper/evm_hooks.go +++ b/x/crosschain/keeper/evm_hooks.go @@ -114,7 +114,7 @@ func (k Keeper) ProcessZRC20WithdrawalEvent(ctx sdk.Context, event *zrc20.ZRC20W return types.ErrNotEnoughPermissions } ctx.Logger().Info("ZRC20 withdrawal to %s amount %d\n", hex.EncodeToString(event.To), event.Value) - tss, found := k.GetTSS(ctx) + tss, found := k.zetaObserverKeeper.GetTSS(ctx) if !found { return errorsmod.Wrap(types.ErrCannotFindTSSKeys, "ProcessZRC20WithdrawalEvent: cannot be processed without TSS keys") } @@ -124,7 +124,10 @@ func (k Keeper) ProcessZRC20WithdrawalEvent(ctx sdk.Context, event *zrc20.ZRC20W } receiverChain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(foreignCoin.ForeignChainId) - senderChain := common.ZetaChain() + senderChain, err := common.ZetaChainFromChainID(ctx.ChainID()) + if err != nil { + return fmt.Errorf("ProcessZRC20WithdrawalEvent: failed to convert chainID: %s", err.Error()) + } toAddr, err := receiverChain.EncodeAddress(event.To) if err != nil { return fmt.Errorf("cannot encode address %s: %s", event.To, err.Error()) @@ -180,7 +183,7 @@ func (k Keeper) ProcessZetaSentEvent(ctx sdk.Context, event *connectorzevm.ZetaC event.DestinationChainId, )) - tss, found := k.GetTSS(ctx) + tss, found := k.zetaObserverKeeper.GetTSS(ctx) if !found { return errorsmod.Wrap(types.ErrCannotFindTSSKeys, "ProcessZetaSentEvent: cannot be processed without TSS keys") } @@ -207,7 +210,10 @@ func (k Keeper) ProcessZetaSentEvent(ctx sdk.Context, event *connectorzevm.ZetaC return types.ErrUnableToSendCoinType } toAddr := "0x" + hex.EncodeToString(event.DestinationAddress) - senderChain := common.ZetaChain() + senderChain, err := common.ZetaChainFromChainID(ctx.ChainID()) + if err != nil { + return fmt.Errorf("ProcessZetaSentEvent: failed to convert chainID: %s", err.Error()) + } amount := math.NewUintFromBigInt(event.ZetaValueAndGas) // Bump gasLimit by event index (which is very unlikely to be larger than 1000) to always have different ZetaSent events msgs. diff --git a/x/crosschain/keeper/gas_payment.go b/x/crosschain/keeper/gas_payment.go index a370c7a672..2fc2a13f12 100644 --- a/x/crosschain/keeper/gas_payment.go +++ b/x/crosschain/keeper/gas_payment.go @@ -19,6 +19,7 @@ import ( // PayGasAndUpdateCctx updates the outbound tx with the new amount after paying the gas fee // **Caller should feed temporary ctx into this function** +// chainID is the outbound chain chain id , this can be receiver chain for regular transactions and sender-chain to reverted transactions func (k Keeper) PayGasAndUpdateCctx( ctx sdk.Context, chainID int64, @@ -271,7 +272,7 @@ func (k Keeper) PayGasInZetaAndUpdateCctx( gasZRC20, err := k.fungibleKeeper.QuerySystemContractGasCoinZRC20(ctx, big.NewInt(chainID)) if err != nil { - return cosmoserrors.Wrap(err, "PayGasInZetaAndUpdateCctx: unable to get system contract gas coin") + return cosmoserrors.Wrapf(err, "PayGasInZetaAndUpdateCctx: unable to get system contract gas coin, chaind ID %d", chainID) } // get the gas price diff --git a/x/crosschain/keeper/gas_payment_test.go b/x/crosschain/keeper/gas_payment_test.go index a1ad790d4a..73fdebdde3 100644 --- a/x/crosschain/keeper/gas_payment_test.go +++ b/x/crosschain/keeper/gas_payment_test.go @@ -28,13 +28,9 @@ func getValidEthChainID(t *testing.T) int64 { } // get a valid eth chain independently of the build flag -func getValidEthChain(t *testing.T) *zetacommon.Chain { - list := zetacommon.DefaultChainsList() - require.True(t, len(list) > 1) - require.NotNil(t, list[1]) - require.False(t, zetacommon.IsBitcoinChain(list[1].ChainId)) - - return list[1] +func getValidEthChain(_ *testing.T) *zetacommon.Chain { + goerli := zetacommon.GoerliLocalnetChain() + return &goerli } // assert that a contract has been deployed by checking stored code is non-empty. @@ -250,7 +246,7 @@ func TestKeeper_PayGasNativeAndUpdateCctx(t *testing.T) { }, OutboundTxParams: []*types.OutboundTxParams{ { - ReceiverChainId: zetacommon.ZetaChain().ChainId, + ReceiverChainId: zetacommon.ZetaPrivnetChain().ChainId, }, { ReceiverChainId: chainID, @@ -308,7 +304,7 @@ func TestKeeper_PayGasNativeAndUpdateCctx(t *testing.T) { }, OutboundTxParams: []*types.OutboundTxParams{ { - ReceiverChainId: zetacommon.ZetaChain().ChainId, + ReceiverChainId: zetacommon.ZetaPrivnetChain().ChainId, }, { ReceiverChainId: chainID, @@ -348,7 +344,7 @@ func TestKeeper_PayGasNativeAndUpdateCctx(t *testing.T) { }, OutboundTxParams: []*types.OutboundTxParams{ { - ReceiverChainId: zetacommon.ZetaChain().ChainId, + ReceiverChainId: zetacommon.ZetaPrivnetChain().ChainId, }, { ReceiverChainId: chainID, @@ -413,7 +409,7 @@ func TestKeeper_PayGasInERC20AndUpdateCctx(t *testing.T) { }, OutboundTxParams: []*types.OutboundTxParams{ { - ReceiverChainId: zetacommon.ZetaChain().ChainId, + ReceiverChainId: zetacommon.ZetaPrivnetChain().ChainId, }, { ReceiverChainId: chainID, @@ -476,7 +472,7 @@ func TestKeeper_PayGasInERC20AndUpdateCctx(t *testing.T) { }, OutboundTxParams: []*types.OutboundTxParams{ { - ReceiverChainId: zetacommon.ZetaChain().ChainId, + ReceiverChainId: zetacommon.ZetaPrivnetChain().ChainId, }, { ReceiverChainId: chainID, @@ -521,7 +517,7 @@ func TestKeeper_PayGasInERC20AndUpdateCctx(t *testing.T) { }, OutboundTxParams: []*types.OutboundTxParams{ { - ReceiverChainId: zetacommon.ZetaChain().ChainId, + ReceiverChainId: zetacommon.ZetaPrivnetChain().ChainId, }, { ReceiverChainId: chainID, @@ -576,7 +572,7 @@ func TestKeeper_PayGasInERC20AndUpdateCctx(t *testing.T) { }, OutboundTxParams: []*types.OutboundTxParams{ { - ReceiverChainId: zetacommon.ZetaChain().ChainId, + ReceiverChainId: zetacommon.ZetaPrivnetChain().ChainId, }, { ReceiverChainId: chainID, @@ -637,7 +633,7 @@ func TestKeeper_PayGasInERC20AndUpdateCctx(t *testing.T) { }, OutboundTxParams: []*types.OutboundTxParams{ { - ReceiverChainId: zetacommon.ZetaChain().ChainId, + ReceiverChainId: zetacommon.ZetaPrivnetChain().ChainId, }, { ReceiverChainId: chainID, diff --git a/x/crosschain/keeper/gas_price.go b/x/crosschain/keeper/gas_price.go new file mode 100644 index 0000000000..1d4159e4b9 --- /dev/null +++ b/x/crosschain/keeper/gas_price.go @@ -0,0 +1,60 @@ +package keeper + +import ( + "strconv" + + "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +// SetGasPrice set a specific gasPrice in the store from its index +func (k Keeper) SetGasPrice(ctx sdk.Context, gasPrice types.GasPrice) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GasPriceKey)) + b := k.cdc.MustMarshal(&gasPrice) + gasPrice.Index = strconv.FormatInt(gasPrice.ChainId, 10) + store.Set(types.KeyPrefix(gasPrice.Index), b) +} + +// GetGasPrice returns a gasPrice from its index +func (k Keeper) GetGasPrice(ctx sdk.Context, chainID int64) (val types.GasPrice, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GasPriceKey)) + b := store.Get(types.KeyPrefix(strconv.FormatInt(chainID, 10))) + if b == nil { + return val, false + } + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +func (k Keeper) GetMedianGasPriceInUint(ctx sdk.Context, chainID int64) (sdk.Uint, bool) { + gasPrice, isFound := k.GetGasPrice(ctx, chainID) + if !isFound { + return math.ZeroUint(), isFound + } + mi := gasPrice.MedianIndex + return sdk.NewUint(gasPrice.Prices[mi]), true +} + +// RemoveGasPrice removes a gasPrice from the store +func (k Keeper) RemoveGasPrice(ctx sdk.Context, index string) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GasPriceKey)) + store.Delete(types.KeyPrefix(index)) +} + +// GetAllGasPrice returns all gasPrice +func (k Keeper) GetAllGasPrice(ctx sdk.Context) (list []types.GasPrice) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GasPriceKey)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.GasPrice + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/crosschain/keeper/gas_price_test.go b/x/crosschain/keeper/gas_price_test.go new file mode 100644 index 0000000000..9a269832c2 --- /dev/null +++ b/x/crosschain/keeper/gas_price_test.go @@ -0,0 +1,47 @@ +package keeper + +import ( + "strconv" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/assert" + "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +// Keeper Tests +func createNGasPrice(keeper *Keeper, ctx sdk.Context, n int) []types.GasPrice { + items := make([]types.GasPrice, n) + for i := range items { + items[i].Creator = "any" + items[i].ChainId = int64(i) + items[i].Index = strconv.FormatInt(int64(i), 10) + keeper.SetGasPrice(ctx, items[i]) + } + return items +} + +func TestGasPriceGet(t *testing.T) { + keeper, ctx := setupKeeper(t) + items := createNGasPrice(keeper, ctx, 10) + for _, item := range items { + rst, found := keeper.GetGasPrice(ctx, item.ChainId) + assert.True(t, found) + assert.Equal(t, item, rst) + } +} +func TestGasPriceRemove(t *testing.T) { + keeper, ctx := setupKeeper(t) + items := createNGasPrice(keeper, ctx, 10) + for _, item := range items { + keeper.RemoveGasPrice(ctx, item.Index) + _, found := keeper.GetGasPrice(ctx, item.ChainId) + assert.False(t, found) + } +} + +func TestGasPriceGetAll(t *testing.T) { + keeper, ctx := setupKeeper(t) + items := createNGasPrice(keeper, ctx, 10) + assert.Equal(t, items, keeper.GetAllGasPrice(ctx)) +} diff --git a/x/crosschain/keeper/grpc_query_cctx.go b/x/crosschain/keeper/grpc_query_cctx.go new file mode 100644 index 0000000000..74bdc49293 --- /dev/null +++ b/x/crosschain/keeper/grpc_query_cctx.go @@ -0,0 +1,179 @@ +package keeper + +import ( + "context" + "fmt" + + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/zeta-chain/zetacore/x/crosschain/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +const ( + // MaxPendingCctxs is the maximum number of pending cctxs that can be queried + MaxPendingCctxs = 500 +) + +func (k Keeper) ZetaAccounting(c context.Context, _ *types.QueryZetaAccountingRequest) (*types.QueryZetaAccountingResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + amount, found := k.GetZetaAccounting(ctx) + if !found { + return nil, status.Error(codes.Internal, "aborted zeta amount not found") + } + return &types.QueryZetaAccountingResponse{ + AbortedZetaAmount: amount.AbortedZetaAmount.String(), + }, nil +} + +func (k Keeper) CctxAll(c context.Context, req *types.QueryAllCctxRequest) (*types.QueryAllCctxResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + var sends []*types.CrossChainTx + ctx := sdk.UnwrapSDKContext(c) + + store := ctx.KVStore(k.storeKey) + sendStore := prefix.NewStore(store, types.KeyPrefix(types.SendKey)) + + pageRes, err := query.Paginate(sendStore, req.Pagination, func(key []byte, value []byte) error { + var send types.CrossChainTx + if err := k.cdc.Unmarshal(value, &send); err != nil { + return err + } + sends = append(sends, &send) + return nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllCctxResponse{CrossChainTx: sends, Pagination: pageRes}, nil +} + +func (k Keeper) Cctx(c context.Context, req *types.QueryGetCctxRequest) (*types.QueryGetCctxResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + val, found := k.GetCrossChainTx(ctx, req.Index) + if !found { + return nil, status.Error(codes.InvalidArgument, "not found") + } + + return &types.QueryGetCctxResponse{CrossChainTx: &val}, nil +} + +func (k Keeper) CctxByNonce(c context.Context, req *types.QueryGetCctxByNonceRequest) (*types.QueryGetCctxResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + tss, found := k.zetaObserverKeeper.GetTSS(ctx) + if !found { + return nil, status.Error(codes.Internal, "tss not found") + } + // #nosec G701 always in range + res, found := k.GetObserverKeeper().GetNonceToCctx(ctx, tss.TssPubkey, req.ChainID, int64(req.Nonce)) + if !found { + return nil, status.Error(codes.Internal, fmt.Sprintf("nonceToCctx not found: nonce %d, chainid %d", req.Nonce, req.ChainID)) + } + val, found := k.GetCrossChainTx(ctx, res.CctxIndex) + if !found { + return nil, status.Error(codes.Internal, fmt.Sprintf("cctx not found: index %s", res.CctxIndex)) + } + + return &types.QueryGetCctxResponse{CrossChainTx: &val}, nil +} + +// CctxListPending returns a list of pending cctxs and the total number of pending cctxs +// a limit for the number of cctxs to return can be specified +// if no limit is specified, the default is MaxPendingCctxs +func (k Keeper) CctxListPending(c context.Context, req *types.QueryListCctxPendingRequest) (*types.QueryListCctxPendingResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + // check limit + // if no limit specified, default to MaxPendingCctxs + if req.Limit > MaxPendingCctxs { + return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("limit exceeds max limit of %d", MaxPendingCctxs)) + } + limit := req.Limit + if limit == 0 { + limit = MaxPendingCctxs + } + + ctx := sdk.UnwrapSDKContext(c) + + // query the nonces that are pending + tss, found := k.zetaObserverKeeper.GetTSS(ctx) + if !found { + return nil, status.Error(codes.Internal, "tss not found") + } + pendingNonces, found := k.GetObserverKeeper().GetPendingNonces(ctx, tss.TssPubkey, req.ChainId) + if !found { + return nil, status.Error(codes.Internal, "pending nonces not found") + } + + cctxs := make([]*types.CrossChainTx, 0) + maxCCTXsReached := func() bool { + // #nosec G701 len always positive + return uint32(len(cctxs)) >= limit + } + + totalPending := uint64(0) + + // now query the previous nonces up to 1000 prior to find any pending cctx that we might have missed + // need this logic because a confirmation of higher nonce will automatically update the p.NonceLow + // therefore might mask some lower nonce cctx that is still pending. + startNonce := pendingNonces.NonceLow - 1000 + if startNonce < 0 { + startNonce = 0 + } + for i := startNonce; i < pendingNonces.NonceLow; i++ { + nonceToCctx, found := k.GetObserverKeeper().GetNonceToCctx(ctx, tss.TssPubkey, req.ChainId, i) + if !found { + return nil, status.Error(codes.Internal, fmt.Sprintf("nonceToCctx not found: nonce %d, chainid %d", i, req.ChainId)) + } + cctx, found := k.GetCrossChainTx(ctx, nonceToCctx.CctxIndex) + if !found { + return nil, status.Error(codes.Internal, fmt.Sprintf("cctx not found: index %s", nonceToCctx.CctxIndex)) + } + if cctx.CctxStatus.Status == types.CctxStatus_PendingOutbound || cctx.CctxStatus.Status == types.CctxStatus_PendingRevert { + totalPending++ + + // we check here if max cctxs is reached because we want to return the total pending cctxs + // even if we have reached the limit + if !maxCCTXsReached() { + cctxs = append(cctxs, &cctx) + } + } + } + + // add the pending nonces to the total pending + // #nosec G701 always in range + totalPending += uint64(pendingNonces.NonceHigh - pendingNonces.NonceLow) + + // now query the pending nonces that we know are pending + for i := pendingNonces.NonceLow; i < pendingNonces.NonceHigh && !maxCCTXsReached(); i++ { + nonceToCctx, found := k.GetObserverKeeper().GetNonceToCctx(ctx, tss.TssPubkey, req.ChainId, i) + if !found { + return nil, status.Error(codes.Internal, "nonceToCctx not found") + } + cctx, found := k.GetCrossChainTx(ctx, nonceToCctx.CctxIndex) + if !found { + return nil, status.Error(codes.Internal, "cctxIndex not found") + } + cctxs = append(cctxs, &cctx) + } + + return &types.QueryListCctxPendingResponse{ + CrossChainTx: cctxs, + TotalPending: totalPending, + }, nil +} diff --git a/x/crosschain/keeper/grpc_query_cctx_test.go b/x/crosschain/keeper/grpc_query_cctx_test.go new file mode 100644 index 0000000000..cd5d1e3c14 --- /dev/null +++ b/x/crosschain/keeper/grpc_query_cctx_test.go @@ -0,0 +1,158 @@ +package keeper_test + +import ( + "fmt" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/crosschain/keeper" + "github.com/zeta-chain/zetacore/x/crosschain/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" +) + +// createCctxWithNonceRange create in the store: +// mined cctx from nonce 0 to low +// pending cctx from low to high +// set pending nonces from low to higg +// return pending cctxs +func createCctxWithNonceRange( + t *testing.T, + ctx sdk.Context, + k keeper.Keeper, + low int, + high int, + chainID int64, + tss observertypes.TSS, + zk keepertest.ZetaKeepers, +) (cctxs []*types.CrossChainTx) { + for i := 0; i < low; i++ { + cctx := sample.CrossChainTx(t, fmt.Sprintf("%d", i)) + cctx.CctxStatus.Status = types.CctxStatus_OutboundMined + cctx.InboundTxParams.SenderChainId = chainID + k.SetCrossChainTx(ctx, *cctx) + zk.ObserverKeeper.SetNonceToCctx(ctx, observertypes.NonceToCctx{ + ChainId: chainID, + Nonce: int64(i), + CctxIndex: cctx.Index, + Tss: tss.TssPubkey, + }) + } + for i := low; i < high; i++ { + cctx := sample.CrossChainTx(t, fmt.Sprintf("%d", i)) + cctx.CctxStatus.Status = types.CctxStatus_PendingOutbound + cctx.InboundTxParams.SenderChainId = chainID + k.SetCrossChainTx(ctx, *cctx) + zk.ObserverKeeper.SetNonceToCctx(ctx, observertypes.NonceToCctx{ + ChainId: chainID, + Nonce: int64(i), + CctxIndex: cctx.Index, + Tss: tss.TssPubkey, + }) + cctxs = append(cctxs, cctx) + } + zk.ObserverKeeper.SetPendingNonces(ctx, observertypes.PendingNonces{ + ChainId: chainID, + NonceLow: int64(low), + NonceHigh: int64(high), + Tss: tss.TssPubkey, + }) + + return +} + +func TestKeeper_CctxListPending(t *testing.T) { + + t.Run("should fail for empty req", func(t *testing.T) { + k, ctx, _, _ := keepertest.CrosschainKeeper(t) + _, err := k.CctxListPending(ctx, nil) + require.ErrorContains(t, err, "invalid request") + }) + + t.Run("should fail if limit is too high", func(t *testing.T) { + k, ctx, _, _ := keepertest.CrosschainKeeper(t) + _, err := k.CctxListPending(ctx, &types.QueryListCctxPendingRequest{Limit: keeper.MaxPendingCctxs + 1}) + require.ErrorContains(t, err, "limit exceeds max limit of") + }) + + t.Run("should fail if no TSS", func(t *testing.T) { + k, ctx, _, _ := keepertest.CrosschainKeeper(t) + _, err := k.CctxListPending(ctx, &types.QueryListCctxPendingRequest{Limit: 1}) + require.ErrorContains(t, err, "tss not found") + }) + + t.Run("should return empty list if no nonces", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + + // set TSS + zk.ObserverKeeper.SetTSS(ctx, sample.Tss()) + + _, err := k.CctxListPending(ctx, &types.QueryListCctxPendingRequest{Limit: 1}) + require.ErrorContains(t, err, "pending nonces not found") + }) + + t.Run("can retrieve pending cctx in range", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + chainID := getValidEthChainID(t) + tss := sample.Tss() + zk.ObserverKeeper.SetTSS(ctx, tss) + cctxs := createCctxWithNonceRange(t, ctx, *k, 1000, 2000, chainID, tss, zk) + + res, err := k.CctxListPending(ctx, &types.QueryListCctxPendingRequest{ChainId: chainID, Limit: 100}) + require.NoError(t, err) + require.Equal(t, 100, len(res.CrossChainTx)) + require.EqualValues(t, cctxs[0:100], res.CrossChainTx) + require.EqualValues(t, uint64(1000), res.TotalPending) + + res, err = k.CctxListPending(ctx, &types.QueryListCctxPendingRequest{ChainId: chainID}) + require.NoError(t, err) + require.Equal(t, keeper.MaxPendingCctxs, len(res.CrossChainTx)) + require.EqualValues(t, cctxs[0:keeper.MaxPendingCctxs], res.CrossChainTx) + require.EqualValues(t, uint64(1000), res.TotalPending) + }) + + t.Run("can retrieve pending cctx with range smaller than max", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + chainID := getValidEthChainID(t) + tss := sample.Tss() + zk.ObserverKeeper.SetTSS(ctx, tss) + cctxs := createCctxWithNonceRange(t, ctx, *k, 1000, 1100, chainID, tss, zk) + + res, err := k.CctxListPending(ctx, &types.QueryListCctxPendingRequest{ChainId: chainID}) + require.NoError(t, err) + require.Equal(t, 100, len(res.CrossChainTx)) + require.EqualValues(t, cctxs, res.CrossChainTx) + require.EqualValues(t, uint64(100), res.TotalPending) + }) + + t.Run("can retrieve pending cctx with pending cctx below nonce low", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + chainID := getValidEthChainID(t) + tss := sample.Tss() + zk.ObserverKeeper.SetTSS(ctx, tss) + cctxs := createCctxWithNonceRange(t, ctx, *k, 1000, 2000, chainID, tss, zk) + + // set some cctxs as pending below nonce + cctx1, found := k.GetCrossChainTx(ctx, "940") + require.True(t, found) + cctx1.CctxStatus.Status = types.CctxStatus_PendingOutbound + k.SetCrossChainTx(ctx, cctx1) + + cctx2, found := k.GetCrossChainTx(ctx, "955") + require.True(t, found) + cctx2.CctxStatus.Status = types.CctxStatus_PendingOutbound + k.SetCrossChainTx(ctx, cctx2) + + res, err := k.CctxListPending(ctx, &types.QueryListCctxPendingRequest{ChainId: chainID, Limit: 100}) + require.NoError(t, err) + require.Equal(t, 100, len(res.CrossChainTx)) + + expectedCctxs := append([]*types.CrossChainTx{&cctx1, &cctx2}, cctxs[0:98]...) + require.EqualValues(t, expectedCctxs, res.CrossChainTx) + + // pending nonce + 2 + require.EqualValues(t, uint64(1002), res.TotalPending) + }) +} diff --git a/x/crosschain/keeper/grpc_query_gas_price.go b/x/crosschain/keeper/grpc_query_gas_price.go new file mode 100644 index 0000000000..b703ff44a2 --- /dev/null +++ b/x/crosschain/keeper/grpc_query_gas_price.go @@ -0,0 +1,58 @@ +package keeper + +import ( + "context" + "strconv" + + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/zeta-chain/zetacore/x/crosschain/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) GasPriceAll(c context.Context, req *types.QueryAllGasPriceRequest) (*types.QueryAllGasPriceResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + var gasPrices []*types.GasPrice + ctx := sdk.UnwrapSDKContext(c) + + store := ctx.KVStore(k.storeKey) + gasPriceStore := prefix.NewStore(store, types.KeyPrefix(types.GasPriceKey)) + + pageRes, err := query.Paginate(gasPriceStore, req.Pagination, func(key []byte, value []byte) error { + var gasPrice types.GasPrice + if err := k.cdc.Unmarshal(value, &gasPrice); err != nil { + return err + } + + gasPrices = append(gasPrices, &gasPrice) + return nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllGasPriceResponse{GasPrice: gasPrices, Pagination: pageRes}, nil +} + +func (k Keeper) GasPrice(c context.Context, req *types.QueryGetGasPriceRequest) (*types.QueryGetGasPriceResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + chainID, err := strconv.Atoi(req.Index) + if err != nil { + return nil, err + } + val, found := k.GetGasPrice(ctx, int64(chainID)) + if !found { + return nil, status.Error(codes.InvalidArgument, "not found") + } + + return &types.QueryGetGasPriceResponse{GasPrice: &val}, nil +} diff --git a/x/crosschain/keeper/keeper_gas_price_test.go b/x/crosschain/keeper/grpc_query_gas_price_test.go similarity index 73% rename from x/crosschain/keeper/keeper_gas_price_test.go rename to x/crosschain/keeper/grpc_query_gas_price_test.go index b7848e6ef6..5c2d12cadd 100644 --- a/x/crosschain/keeper/keeper_gas_price_test.go +++ b/x/crosschain/keeper/grpc_query_gas_price_test.go @@ -1,59 +1,17 @@ package keeper import ( - "strconv" "testing" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/x/crosschain/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" - - "github.com/zeta-chain/zetacore/x/crosschain/types" ) -// Keeper Tests -func createNGasPrice(keeper *Keeper, ctx sdk.Context, n int) []types.GasPrice { - items := make([]types.GasPrice, n) - for i := range items { - items[i].Creator = "any" - items[i].ChainId = int64(i) - items[i].Index = strconv.FormatInt(int64(i), 10) - keeper.SetGasPrice(ctx, items[i]) - } - return items -} - -func TestGasPriceGet(t *testing.T) { - keeper, ctx := setupKeeper(t) - items := createNGasPrice(keeper, ctx, 10) - for _, item := range items { - rst, found := keeper.GetGasPrice(ctx, item.ChainId) - assert.True(t, found) - assert.Equal(t, item, rst) - } -} -func TestGasPriceRemove(t *testing.T) { - keeper, ctx := setupKeeper(t) - items := createNGasPrice(keeper, ctx, 10) - for _, item := range items { - keeper.RemoveGasPrice(ctx, item.Index) - _, found := keeper.GetGasPrice(ctx, item.ChainId) - assert.False(t, found) - } -} - -func TestGasPriceGetAll(t *testing.T) { - keeper, ctx := setupKeeper(t) - items := createNGasPrice(keeper, ctx, 10) - assert.Equal(t, items, keeper.GetAllGasPrice(ctx)) -} - -// Querier Tests - func TestGasPriceQuerySingle(t *testing.T) { keeper, ctx := setupKeeper(t) wctx := sdk.WrapSDKContext(ctx) diff --git a/x/crosschain/keeper/grpc_query_get_tss_address.go b/x/crosschain/keeper/grpc_query_get_tss_address.go deleted file mode 100644 index 6d21719388..0000000000 --- a/x/crosschain/keeper/grpc_query_get_tss_address.go +++ /dev/null @@ -1,92 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/btcsuite/btcutil" - ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - zcommon "github.com/zeta-chain/zetacore/common/cosmos" - "github.com/zeta-chain/zetacore/zetaclient/config" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/x/crosschain/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -func (k Keeper) GetTssAddress(goCtx context.Context, req *types.QueryGetTssAddressRequest) (*types.QueryGetTssAddressResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(goCtx) - var tssPubKey string - if req.TssPubKey == "" { - tss, found := k.GetTSS(ctx) - if !found { - return nil, status.Error(codes.NotFound, "current tss not set") - } - tssPubKey = tss.TssPubkey - } else { - tssList := k.GetAllTSS(ctx) - for _, t := range tssList { - if t.TssPubkey == req.TssPubKey { - tssPubKey = t.TssPubkey - break - } - } - } - ethAddress, err := getTssAddrEVM(tssPubKey) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - btcAddress, err := getTssAddrBTC(tssPubKey) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryGetTssAddressResponse{ - Eth: ethAddress.String(), - Btc: btcAddress, - }, nil -} - -func getTssAddrEVM(tssPubkey string) (ethcommon.Address, error) { - var keyAddr ethcommon.Address - pubk, err := zcommon.GetPubKeyFromBech32(zcommon.Bech32PubKeyTypeAccPub, tssPubkey) - if err != nil { - return keyAddr, err - } - //keyAddrBytes := pubk.EVMAddress().Bytes() - pubk.Bytes() - decompresspubkey, err := crypto.DecompressPubkey(pubk.Bytes()) - if err != nil { - return keyAddr, err - } - - keyAddr = crypto.PubkeyToAddress(*decompresspubkey) - - return keyAddr, nil -} - -func getTssAddrBTC(tssPubkey string) (string, error) { - addrWPKH, err := getKeyAddrBTCWitnessPubkeyHash(tssPubkey) - if err != nil { - return "", err - } - - return addrWPKH.EncodeAddress(), nil -} - -func getKeyAddrBTCWitnessPubkeyHash(tssPubkey string) (*btcutil.AddressWitnessPubKeyHash, error) { - pubk, err := zcommon.GetPubKeyFromBech32(zcommon.Bech32PubKeyTypeAccPub, tssPubkey) - if err != nil { - return nil, err - } - addr, err := btcutil.NewAddressWitnessPubKeyHash(btcutil.Hash160(pubk.Bytes()), config.BitconNetParams) - if err != nil { - return nil, err - } - return addr, nil -} diff --git a/x/crosschain/keeper/grpc_query_in_tx_tracker.go b/x/crosschain/keeper/grpc_query_in_tx_tracker.go index ccdaa92e3d..59fdd21155 100644 --- a/x/crosschain/keeper/grpc_query_in_tx_tracker.go +++ b/x/crosschain/keeper/grpc_query_in_tx_tracker.go @@ -20,9 +20,12 @@ func (k Keeper) InTxTrackerAllByChain(goCtx context.Context, request *types.Quer return &types.QueryAllInTxTrackerByChainResponse{InTxTracker: inTxTrackers, Pagination: pageRes}, nil } -func (k Keeper) InTxTrackerAll(goCtx context.Context, _ *types.QueryAllInTxTrackersRequest) (*types.QueryAllInTxTrackersResponse, error) { +func (k Keeper) InTxTrackerAll(goCtx context.Context, req *types.QueryAllInTxTrackersRequest) (*types.QueryAllInTxTrackersResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) var inTxTrackers []types.InTxTracker - inTxTrackers = k.GetAllInTxTracker(ctx) - return &types.QueryAllInTxTrackersResponse{InTxTracker: inTxTrackers}, nil + inTxTrackers, pageRes, err := k.GetAllInTxTrackerPaginated(ctx, req.Pagination) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + return &types.QueryAllInTxTrackersResponse{InTxTracker: inTxTrackers, Pagination: pageRes}, nil } diff --git a/x/crosschain/keeper/keeper_last_block_height.go b/x/crosschain/keeper/grpc_query_last_block_height.go similarity index 52% rename from x/crosschain/keeper/keeper_last_block_height.go rename to x/crosschain/keeper/grpc_query_last_block_height.go index a0a0b3de24..e30a113fb8 100644 --- a/x/crosschain/keeper/keeper_last_block_height.go +++ b/x/crosschain/keeper/grpc_query_last_block_height.go @@ -2,60 +2,16 @@ package keeper import ( "context" - math2 "math" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" + math2 "github.com/ethereum/go-ethereum/common/math" "github.com/zeta-chain/zetacore/x/crosschain/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) -// SetLastBlockHeight set a specific lastBlockHeight in the store from its index -func (k Keeper) SetLastBlockHeight(ctx sdk.Context, lastBlockHeight types.LastBlockHeight) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LastBlockHeightKey)) - b := k.cdc.MustMarshal(&lastBlockHeight) - store.Set(types.KeyPrefix(lastBlockHeight.Index), b) -} - -// GetLastBlockHeight returns a lastBlockHeight from its index -func (k Keeper) GetLastBlockHeight(ctx sdk.Context, index string) (val types.LastBlockHeight, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LastBlockHeightKey)) - - b := store.Get(types.KeyPrefix(index)) - if b == nil { - return val, false - } - - k.cdc.MustUnmarshal(b, &val) - return val, true -} - -// RemoveLastBlockHeight removes a lastBlockHeight from the store -func (k Keeper) RemoveLastBlockHeight(ctx sdk.Context, index string) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LastBlockHeightKey)) - store.Delete(types.KeyPrefix(index)) -} - -// GetAllLastBlockHeight returns all lastBlockHeight -func (k Keeper) GetAllLastBlockHeight(ctx sdk.Context) (list []types.LastBlockHeight) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LastBlockHeightKey)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var val types.LastBlockHeight - k.cdc.MustUnmarshal(iterator.Value(), &val) - list = append(list, val) - } - - return -} - -// Queries - func (k Keeper) LastBlockHeightAll(c context.Context, req *types.QueryAllLastBlockHeightRequest) (*types.QueryAllLastBlockHeightResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") @@ -94,10 +50,10 @@ func (k Keeper) LastBlockHeight(c context.Context, req *types.QueryGetLastBlockH if !found { return nil, status.Error(codes.InvalidArgument, "not found") } - if val.LastSendHeight < 0 || val.LastSendHeight >= math2.MaxInt64 { + if val.LastSendHeight >= math2.MaxInt64 { return nil, status.Error(codes.OutOfRange, "invalid last send height") } - if val.LastReceiveHeight < 0 || val.LastReceiveHeight >= math2.MaxInt64 { + if val.LastReceiveHeight >= math2.MaxInt64 { return nil, status.Error(codes.OutOfRange, "invalid last recv height") } diff --git a/x/crosschain/keeper/keeper_last_block_height_test.go b/x/crosschain/keeper/grpc_query_last_block_height_test.go similarity index 74% rename from x/crosschain/keeper/keeper_last_block_height_test.go rename to x/crosschain/keeper/grpc_query_last_block_height_test.go index 4ced4f17a8..b2fd0463cf 100644 --- a/x/crosschain/keeper/keeper_last_block_height_test.go +++ b/x/crosschain/keeper/grpc_query_last_block_height_test.go @@ -1,57 +1,17 @@ package keeper import ( - "fmt" "testing" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/x/crosschain/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" - - "github.com/zeta-chain/zetacore/x/crosschain/types" ) -func createNLastBlockHeight(keeper *Keeper, ctx sdk.Context, n int) []types.LastBlockHeight { - items := make([]types.LastBlockHeight, n) - for i := range items { - items[i].Creator = "any" - items[i].Index = fmt.Sprintf("%d", i) - keeper.SetLastBlockHeight(ctx, items[i]) - } - return items -} - -func TestLastBlockHeightGet(t *testing.T) { - keeper, ctx := setupKeeper(t) - items := createNLastBlockHeight(keeper, ctx, 10) - for _, item := range items { - rst, found := keeper.GetLastBlockHeight(ctx, item.Index) - assert.True(t, found) - assert.Equal(t, item, rst) - } -} -func TestLastBlockHeightRemove(t *testing.T) { - keeper, ctx := setupKeeper(t) - items := createNLastBlockHeight(keeper, ctx, 10) - for _, item := range items { - keeper.RemoveLastBlockHeight(ctx, item.Index) - _, found := keeper.GetLastBlockHeight(ctx, item.Index) - assert.False(t, found) - } -} - -func TestLastBlockHeightGetAll(t *testing.T) { - keeper, ctx := setupKeeper(t) - items := createNLastBlockHeight(keeper, ctx, 10) - assert.Equal(t, items, keeper.GetAllLastBlockHeight(ctx)) -} - -//Querier Test - func TestLastBlockHeightQuerySingle(t *testing.T) { keeper, ctx := setupKeeper(t) wctx := sdk.WrapSDKContext(ctx) diff --git a/x/crosschain/keeper/keeper_last_zeta_height.go b/x/crosschain/keeper/grpc_query_last_zeta_height.go similarity index 100% rename from x/crosschain/keeper/keeper_last_zeta_height.go rename to x/crosschain/keeper/grpc_query_last_zeta_height.go diff --git a/x/crosschain/keeper/keeper_out_tx_tracker.go b/x/crosschain/keeper/grpc_query_out_tx_tracker.go similarity index 50% rename from x/crosschain/keeper/keeper_out_tx_tracker.go rename to x/crosschain/keeper/grpc_query_out_tx_tracker.go index 1be2b0e8a4..0eac4d35b1 100644 --- a/x/crosschain/keeper/keeper_out_tx_tracker.go +++ b/x/crosschain/keeper/grpc_query_out_tx_tracker.go @@ -8,78 +8,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" "github.com/zeta-chain/zetacore/x/crosschain/types" - observertypes "github.com/zeta-chain/zetacore/x/observer/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) -func getOutTrackerIndex(chainID int64, nonce uint64) string { - return fmt.Sprintf("%d-%d", chainID, nonce) -} - -// SetOutTxTracker set a specific outTxTracker in the store from its index -func (k Keeper) SetOutTxTracker(ctx sdk.Context, outTxTracker types.OutTxTracker) { - outTxTracker.Index = getOutTrackerIndex(outTxTracker.ChainId, outTxTracker.Nonce) - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.OutTxTrackerKeyPrefix)) - b := k.cdc.MustMarshal(&outTxTracker) - store.Set(types.OutTxTrackerKey( - outTxTracker.Index, - ), b) -} - -// GetOutTxTracker returns a outTxTracker from its index -func (k Keeper) GetOutTxTracker( - ctx sdk.Context, - chainID int64, - nonce uint64, - -) (val types.OutTxTracker, found bool) { - index := getOutTrackerIndex(chainID, nonce) - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.OutTxTrackerKeyPrefix)) - - b := store.Get(types.OutTxTrackerKey( - index, - )) - if b == nil { - return val, false - } - - k.cdc.MustUnmarshal(b, &val) - return val, true -} - -// RemoveOutTxTracker removes a outTxTracker from the store -func (k Keeper) RemoveOutTxTracker( - ctx sdk.Context, - chainID int64, - nonce uint64, - -) { - index := getOutTrackerIndex(chainID, nonce) - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.OutTxTrackerKeyPrefix)) - store.Delete(types.OutTxTrackerKey( - index, - )) -} - -// GetAllOutTxTracker returns all outTxTracker -func (k Keeper) GetAllOutTxTracker(ctx sdk.Context) (list []types.OutTxTracker) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.OutTxTrackerKeyPrefix)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var val types.OutTxTracker - k.cdc.MustUnmarshal(iterator.Value(), &val) - list = append(list, val) - } - - return -} - -// Queries - func (k Keeper) OutTxTrackerAll(c context.Context, req *types.QueryAllOutTxTrackerRequest) (*types.QueryAllOutTxTrackerResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") @@ -149,17 +81,3 @@ func (k Keeper) OutTxTracker(c context.Context, req *types.QueryGetOutTxTrackerR return &types.QueryGetOutTxTrackerResponse{OutTxTracker: val}, nil } - -// Messages - -// RemoveFromOutTxTracker removes a record from the outbound transaction tracker by chain ID and nonce. -// only the admin policy account is authorized to broadcast this message. -func (k msgServer) RemoveFromOutTxTracker(goCtx context.Context, msg *types.MsgRemoveFromOutTxTracker) (*types.MsgRemoveFromOutTxTrackerResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - if msg.Creator != k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(observertypes.Policy_Type_group1) { - return &types.MsgRemoveFromOutTxTrackerResponse{}, observertypes.ErrNotAuthorizedPolicy - } - - k.RemoveOutTxTracker(ctx, msg.ChainId, msg.Nonce) - return &types.MsgRemoveFromOutTxTrackerResponse{}, nil -} diff --git a/x/crosschain/keeper/keeper_out_tx_tracker_test.go b/x/crosschain/keeper/grpc_query_out_tx_tracker_test.go similarity index 65% rename from x/crosschain/keeper/keeper_out_tx_tracker_test.go rename to x/crosschain/keeper/grpc_query_out_tx_tracker_test.go index d6835b1623..39f5ad3673 100644 --- a/x/crosschain/keeper/keeper_out_tx_tracker_test.go +++ b/x/crosschain/keeper/grpc_query_out_tx_tracker_test.go @@ -1,77 +1,5 @@ package keeper_test -import ( - "fmt" - "strconv" - "testing" - - "github.com/zeta-chain/zetacore/x/crosschain/keeper" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - keepertest "github.com/zeta-chain/zetacore/testutil/keeper" - "github.com/zeta-chain/zetacore/testutil/nullify" - "github.com/zeta-chain/zetacore/x/crosschain/types" -) - -// Prevent strconv unused error -var _ = strconv.IntSize - -// Keeper Tests -func createNOutTxTracker(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.OutTxTracker { - items := make([]types.OutTxTracker, n) - for i := range items { - items[i].ChainId = int64(i) - items[i].Nonce = uint64(i) - items[i].Index = fmt.Sprintf("%d-%d", items[i].ChainId, items[i].Nonce) - - keeper.SetOutTxTracker(ctx, items[i]) - } - return items -} - -func TestOutTxTrackerGet(t *testing.T) { - keeper, ctx, _, _ := keepertest.CrosschainKeeper(t) - items := createNOutTxTracker(keeper, ctx, 10) - for _, item := range items { - rst, found := keeper.GetOutTxTracker(ctx, - item.ChainId, - item.Nonce, - ) - require.True(t, found) - require.Equal(t, - nullify.Fill(&item), - nullify.Fill(&rst), - ) - } -} -func TestOutTxTrackerRemove(t *testing.T) { - k, ctx, _, _ := keepertest.CrosschainKeeper(t) - items := createNOutTxTracker(k, ctx, 10) - for _, item := range items { - k.RemoveOutTxTracker(ctx, - item.ChainId, - item.Nonce, - ) - _, found := k.GetOutTxTracker(ctx, - item.ChainId, - item.Nonce, - ) - require.False(t, found) - } -} - -func TestOutTxTrackerGetAll(t *testing.T) { - keeper, ctx, _, _ := keepertest.CrosschainKeeper(t) - items := createNOutTxTracker(keeper, ctx, 10) - require.ElementsMatch(t, - nullify.Fill(items), - nullify.Fill(keeper.GetAllOutTxTracker(ctx)), - ) -} - -// Querier Tests - //func TestOutTxTrackerQuerySingle(t *testing.T) { // keeper, ctx := keepertest.ZetacoreKeeper(t) // wctx := sdk.WrapSDKContext(ctx) diff --git a/x/crosschain/keeper/zeta_conversion_rate.go b/x/crosschain/keeper/grpc_query_zeta_conversion_rate.go similarity index 100% rename from x/crosschain/keeper/zeta_conversion_rate.go rename to x/crosschain/keeper/grpc_query_zeta_conversion_rate.go diff --git a/x/crosschain/keeper/grpc_zevm.go b/x/crosschain/keeper/grpc_zevm.go deleted file mode 100644 index 820ac57dcd..0000000000 --- a/x/crosschain/keeper/grpc_zevm.go +++ /dev/null @@ -1,335 +0,0 @@ -package keeper - -import ( - "bytes" - "context" - "encoding/base64" - "encoding/hex" - "encoding/json" - "errors" - "fmt" - "math" - "strings" - - sdk "github.com/cosmos/cosmos-sdk/types" - ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - ethtypes "github.com/ethereum/go-ethereum/core/types" - ethermint "github.com/evmos/ethermint/types" - evmtypes "github.com/evmos/ethermint/x/evm/types" - abci "github.com/tendermint/tendermint/abci/types" - tmrpctypes "github.com/tendermint/tendermint/rpc/core/types" - "github.com/zeta-chain/zetacore/x/crosschain/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -const ( - NonEthTransactionType = "0x88" -) - -func (k Keeper) ZEVMGetBlock(c context.Context, req *types.QueryZEVMGetBlockByNumberRequest) (*types.QueryZEVMGetBlockByNumberResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - rpcclient := types.ClientCtx.Client - if rpcclient == nil { - return nil, status.Error(codes.Internal, "rpc client is not initialized") - } - - height := req.Height - if height >= math.MaxInt64 { - return nil, status.Error(codes.OutOfRange, "invalid height , the height is too large") - } - // #nosec G701 range checked - blockResults, err := GetTendermintBlockResultsByNumber(ctx, int64(req.Height)) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - // #nosec G701 range checked - block, err := GetTendermintBlockByNumber(ctx, int64(req.Height)) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - txDecoder := types.ClientCtx.TxConfig.TxDecoder() - transactionHashes := make([]string, 0) - for idx, txResult := range blockResults.TxsResults { - logs, err := GetEthLogsFromEvents(txResult.Events) - if err != nil || len(logs) == 0 { - continue - } - txBytes := block.Block.Txs[idx] - tx, err := txDecoder(txBytes) - if err != nil { - continue - } - if len(tx.GetMsgs()) == 0 { // should not happen; but just in case - continue - } - _, ok := tx.GetMsgs()[0].(*evmtypes.MsgEthereumTx) - if ok { // skip MsgEthereumTx; these txs are handled by ethermint JSON-RPC server - continue - } - - transactionHashes = append(transactionHashes, fmt.Sprintf("0x%x", block.Block.Txs[idx].Hash())) - } - bloom, err := BlockBloom(blockResults) - if err != nil { - k.Logger(ctx).Debug("failed to query BlockBloom", "height", block.Block.Height, "error", err.Error()) - } - - return &types.QueryZEVMGetBlockByNumberResponse{ - Number: fmt.Sprintf("0x%x", req.Height), - Transactions: transactionHashes, - LogsBloom: fmt.Sprintf("0x%x", bloom), - Hash: ethcommon.BytesToHash(block.Block.Hash()).Hex(), - ParentHash: ethcommon.BytesToHash(block.Block.LastBlockID.Hash).Hex(), - Uncles: []string{}, - Sha3Uncles: ethtypes.EmptyUncleHash.Hex(), - Nonce: fmt.Sprintf("0x%x", ethtypes.BlockNonce{}), - StateRoot: ethcommon.BytesToHash(block.Block.AppHash.Bytes()).Hex(), - ExtraData: "0x", - Timestamp: hexutil.Uint64(block.Block.Time.Unix()).String(), - Miner: ethcommon.BytesToAddress(block.Block.ProposerAddress.Bytes()).Hex(), - MixHash: ethcommon.Hash{}.Hex(), - TransactionsRoot: ethcommon.BytesToHash(block.Block.DataHash).Hex(), - ReceiptsRoot: ethtypes.EmptyRootHash.Hex(), - }, nil -} - -func (k Keeper) ZEVMGetTransactionReceipt(c context.Context, req *types.QueryZEVMGetTransactionReceiptRequest) (*types.QueryZEVMGetTransactionReceiptResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - rpcclient := types.ClientCtx.Client - if rpcclient == nil { - return nil, status.Error(codes.Internal, "rpc client is not initialized") - } - - hash := NormalizeHash(req.Hash) - - query := fmt.Sprintf("ethereum_tx.txHash='%s'", hash) - res, err := rpcclient.TxSearch(c, query, false, nil, nil, "asc") - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - if len(res.Txs) == 0 { - return nil, status.Error(codes.NotFound, "transaction not found") - } - - txRaw := res.Txs[0] - block, err := GetTendermintBlockByNumber(ctx, txRaw.Height) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - blockHash := ethcommon.BytesToHash(block.BlockID.Hash.Bytes()) - blockNumber := fmt.Sprintf("0x%x", txRaw.Height) - - tx, err := types.ClientCtx.TxConfig.TxDecoder()(txRaw.Tx) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - msg0 := tx.GetMsgs()[0] - fromAddress := ethcommon.BytesToAddress(msg0.GetSigners()[0].Bytes()) - - status0 := "0x0" - if txRaw.TxResult.Code == 0 { // code 0 means success for cosmos tx; ref https://docs.cosmos.network/main/core/baseapp#delivertx - status0 = "0x1" // 1 = success in ethereum; - } - hash = ethcommon.BytesToHash(txRaw.Hash.Bytes()).Hex() - - logs, err := GetEthLogsFromEvents(txRaw.TxResult.Events) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - for _, log := range logs { - log.TransactionHash = hash - } - - return &types.QueryZEVMGetTransactionReceiptResponse{ - BlockHash: blockHash.Hex(), - BlockNumber: blockNumber, - ContractAddress: "", // this is the contract created by the transaction, if any - CumulativeGasUsed: "0x0", - From: fromAddress.Hex(), - GasUsed: fmt.Sprintf("0x%x", txRaw.TxResult.GasUsed), - LogsBloom: "", //FIXME: add proper bloom filter - Status: status0, - To: "", - TransactionHash: hash, - TransactionIndex: fmt.Sprintf("0x%x", txRaw.Index), // FIXME: does this make sense? - Logs: logs, - }, nil -} - -func (k Keeper) ZEVMGetTransaction(c context.Context, req *types.QueryZEVMGetTransactionRequest) (*types.QueryZEVMGetTransactionResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - rpcclient := types.ClientCtx.Client - - if rpcclient == nil { - return nil, status.Error(codes.Internal, "rpc client is not initialized") - } - hash := NormalizeHash(req.Hash) - - query := fmt.Sprintf("ethereum_tx.txHash='%s'", hash) - res, err := rpcclient.TxSearch(c, query, false, nil, nil, "asc") - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - if len(res.Txs) == 0 { - return nil, status.Error(codes.NotFound, "transaction not found") - } - - txRaw := res.Txs[0] - - block, err := GetTendermintBlockByNumber(ctx, txRaw.Height) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - tx, err := types.ClientCtx.TxConfig.TxDecoder()(txRaw.Tx) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - if len(tx.GetMsgs()) == 0 { // should not happen, just in case - return nil, status.Error(codes.Internal, "transaction has no messages") - } - msg0 := tx.GetMsgs()[0] - fromAddress := ethcommon.BytesToAddress(msg0.GetSigners()[0].Bytes()) - chainID, err := ethermint.ParseChainID(ctx.ChainID()) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - var blockNumber string - hash = ethcommon.BytesToHash(txRaw.Hash.Bytes()).Hex() - blockNumber = fmt.Sprintf("0x%x", txRaw.Height) - blockHash := ethcommon.BytesToHash(block.BlockID.Hash.Bytes()) - - return &types.QueryZEVMGetTransactionResponse{ - BlockHash: blockHash.Hex(), - BlockNumber: blockNumber, - From: fromAddress.Hex(), // FIXME: this should be the EOA on external chain? - Gas: fmt.Sprintf("0x%x", txRaw.TxResult.GasWanted), - GasPrice: "", - Hash: hash, // Note: This is the cosmos tx hash, in ethereum format (0x prefixed) - Input: "", - Nonce: "0", - To: "", - TransactionIndex: "0", - Value: "0", - Type: NonEthTransactionType, - AccessList: nil, - ChainId: chainID.String(), - V: "", - R: "", - S: "", - }, nil -} - -func GetTendermintBlockByNumber(ctx sdk.Context, blockNum int64) (*tmrpctypes.ResultBlock, error) { - rpcclient := types.ClientCtx.Client - if rpcclient == nil { - return nil, fmt.Errorf("rpc client is not initialized") - } - height := blockNum - if height <= 0 { - height = ctx.BlockHeight() - } - resBlock, err := rpcclient.Block(sdk.WrapSDKContext(ctx), &height) - if err != nil { - return nil, fmt.Errorf("failed to get block by height %d: %w", height, err) - } - - if resBlock.Block == nil { - return nil, nil - } - - return resBlock, nil -} - -func GetTendermintBlockResultsByNumber(ctx sdk.Context, blockNum int64) (*tmrpctypes.ResultBlockResults, error) { - rpcclient := types.ClientCtx.Client - if rpcclient == nil { - return nil, fmt.Errorf("rpc client is not initialized") - } - height := blockNum - if height <= 0 { - height = ctx.BlockHeight() - } - resBlock, err := rpcclient.BlockResults(sdk.WrapSDKContext(ctx), &height) - if err != nil { - return nil, fmt.Errorf("failed to get block by height %d: %w", height, err) - } - - if resBlock == nil { - return nil, nil - } - - return resBlock, nil -} - -func GetEthLogsFromEvents(events []abci.Event) ([]*types.Log, error) { - logs := make([]*types.Log, 0) - for _, event := range events { - if event.Type == evmtypes.EventTypeTxLog { - for _, attr := range event.Attributes { - if !bytes.Equal(attr.Key, []byte(evmtypes.AttributeKeyTxLog)) { - continue - } - - var log types.Log - err := json.Unmarshal(attr.Value, &log) - if err != nil { - return nil, err - } - data, err := base64.StdEncoding.DecodeString(log.Data) - if err == nil { - log.Data = "0x" + hex.EncodeToString(data) - } - logs = append(logs, &log) - - } - } - } - return logs, nil -} - -var bAttributeKeyEthereumBloom = []byte(evmtypes.AttributeKeyEthereumBloom) - -// BlockBloom query block bloom filter from block results -// FIXME: does this work? -func BlockBloom(blockRes *tmrpctypes.ResultBlockResults) (ethtypes.Bloom, error) { - for _, event := range blockRes.EndBlockEvents { - if event.Type != evmtypes.EventTypeBlockBloom { - continue - } - - for _, attr := range event.Attributes { - if bytes.Equal(attr.Key, bAttributeKeyEthereumBloom) { - return ethtypes.BytesToBloom(attr.Value), nil - } - } - } - return ethtypes.Bloom{}, errors.New("block bloom event is not found") -} - -// convert an eth hash (0x prefixed hex) or a cosmos hash (no 0x prefix, uppercase hex) -// into a cosmos hash -func NormalizeHash(hashEthOrCosmos string) string { - if len(hashEthOrCosmos) == 66 && hashEthOrCosmos[:2] == "0x" { // eth format - return strings.ToUpper(hashEthOrCosmos[2:]) - } - return hashEthOrCosmos -} diff --git a/x/crosschain/keeper/in_tx_tracker.go b/x/crosschain/keeper/in_tx_tracker.go index 0957cb2162..d53c56c57f 100644 --- a/x/crosschain/keeper/in_tx_tracker.go +++ b/x/crosschain/keeper/in_tx_tracker.go @@ -40,16 +40,31 @@ func (k Keeper) RemoveInTxTrackerIfExists(ctx sdk.Context, chainID int64, txHash store.Delete(types.KeyPrefix(key)) } } -func (k Keeper) GetAllInTxTracker(ctx sdk.Context) (list []types.InTxTracker) { +func (k Keeper) GetAllInTxTrackerPaginated(ctx sdk.Context, pagination *query.PageRequest) (inTxTrackers []types.InTxTracker, pageRes *query.PageResponse, err error) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.InTxTrackerKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + defer iterator.Close() + pageRes, err = query.Paginate(store, pagination, func(key []byte, value []byte) error { + var inTxTracker types.InTxTracker + if err := k.cdc.Unmarshal(value, &inTxTracker); err != nil { + return err + } + inTxTrackers = append(inTxTrackers, inTxTracker) + return nil + }) + return +} + +func (k Keeper) GetAllInTxTracker(ctx sdk.Context) (inTxTrackers []types.InTxTracker) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.InTxTrackerKeyPrefix)) iterator := sdk.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var val types.InTxTracker k.cdc.MustUnmarshal(iterator.Value(), &val) - list = append(list, val) + inTxTrackers = append(inTxTrackers, val) } - return list + return } func (k Keeper) GetAllInTxTrackerForChain(ctx sdk.Context, chainID int64) (list []types.InTxTracker) { diff --git a/x/crosschain/keeper/in_tx_tracker_test.go b/x/crosschain/keeper/in_tx_tracker_test.go index c16deeb819..a4bda41192 100644 --- a/x/crosschain/keeper/in_tx_tracker_test.go +++ b/x/crosschain/keeper/in_tx_tracker_test.go @@ -1,4 +1,4 @@ -package keeper +package keeper_test import ( "fmt" @@ -9,11 +9,13 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/common" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/nullify" + "github.com/zeta-chain/zetacore/x/crosschain/keeper" "github.com/zeta-chain/zetacore/x/crosschain/types" ) -func createNInTxTracker(keeper *Keeper, ctx sdk.Context, n int, chainID int64) []types.InTxTracker { +func createNInTxTracker(keeper *keeper.Keeper, ctx sdk.Context, n int, chainID int64) []types.InTxTracker { items := make([]types.InTxTracker, n) for i := range items { items[i].TxHash = fmt.Sprintf("TxHash-%d", i) @@ -24,9 +26,9 @@ func createNInTxTracker(keeper *Keeper, ctx sdk.Context, n int, chainID int64) [ return items } func TestKeeper_GetAllInTxTrackerForChain(t *testing.T) { - keeper, ctx := setupKeeper(t) - intxTrackers := createNInTxTracker(keeper, ctx, 10, 5) t.Run("Get InTx trackers one by one", func(t *testing.T) { + keeper, ctx, _, _ := keepertest.CrosschainKeeper(t) + intxTrackers := createNInTxTracker(keeper, ctx, 10, 5) for _, item := range intxTrackers { rst, found := keeper.GetInTxTracker(ctx, item.ChainId, item.TxHash) require.True(t, found) @@ -34,10 +36,13 @@ func TestKeeper_GetAllInTxTrackerForChain(t *testing.T) { } }) t.Run("Get all InTx trackers", func(t *testing.T) { + keeper, ctx, _, _ := keepertest.CrosschainKeeper(t) + intxTrackers := createNInTxTracker(keeper, ctx, 10, 5) rst := keeper.GetAllInTxTracker(ctx) require.Equal(t, intxTrackers, rst) }) t.Run("Get all InTx trackers for chain", func(t *testing.T) { + keeper, ctx, _, _ := keepertest.CrosschainKeeper(t) intxTrackersNew := createNInTxTracker(keeper, ctx, 100, 6) rst := keeper.GetAllInTxTrackerForChain(ctx, 6) sort.SliceStable(rst, func(i, j int) bool { @@ -49,20 +54,40 @@ func TestKeeper_GetAllInTxTrackerForChain(t *testing.T) { require.Equal(t, intxTrackersNew, rst) }) t.Run("Get all InTx trackers for chain paginated by limit", func(t *testing.T) { - intxTrackers = createNInTxTracker(keeper, ctx, 100, 6) + keeper, ctx, _, _ := keepertest.CrosschainKeeper(t) + intxTrackers := createNInTxTracker(keeper, ctx, 100, 6) rst, pageRes, err := keeper.GetAllInTxTrackerForChainPaginated(ctx, 6, &query.PageRequest{Limit: 10, CountTotal: true}) require.NoError(t, err) require.Subset(t, nullify.Fill(intxTrackers), nullify.Fill(rst)) require.Equal(t, len(intxTrackers), int(pageRes.Total)) }) t.Run("Get all InTx trackers for chain paginated by offset", func(t *testing.T) { - intxTrackers = createNInTxTracker(keeper, ctx, 100, 6) + keeper, ctx, _, _ := keepertest.CrosschainKeeper(t) + intxTrackers := createNInTxTracker(keeper, ctx, 100, 6) rst, pageRes, err := keeper.GetAllInTxTrackerForChainPaginated(ctx, 6, &query.PageRequest{Offset: 10, CountTotal: true}) require.NoError(t, err) require.Subset(t, nullify.Fill(intxTrackers), nullify.Fill(rst)) require.Equal(t, len(intxTrackers), int(pageRes.Total)) }) + t.Run("Get all InTx trackers paginated by limit", func(t *testing.T) { + keeper, ctx, _, _ := keepertest.CrosschainKeeper(t) + intxTrackers := append(createNInTxTracker(keeper, ctx, 10, 6), createNInTxTracker(keeper, ctx, 10, 7)...) + rst, pageRes, err := keeper.GetAllInTxTrackerPaginated(ctx, &query.PageRequest{Limit: 20, CountTotal: true}) + require.NoError(t, err) + require.Subset(t, nullify.Fill(intxTrackers), nullify.Fill(rst)) + require.Equal(t, len(intxTrackers), int(pageRes.Total)) + }) + t.Run("Get all InTx trackers paginated by offset", func(t *testing.T) { + keeper, ctx, _, _ := keepertest.CrosschainKeeper(t) + intxTrackers := append(createNInTxTracker(keeper, ctx, 100, 6), createNInTxTracker(keeper, ctx, 100, 7)...) + rst, pageRes, err := keeper.GetAllInTxTrackerPaginated(ctx, &query.PageRequest{Offset: 10, CountTotal: true}) + require.NoError(t, err) + require.Subset(t, nullify.Fill(intxTrackers), nullify.Fill(rst)) + require.Equal(t, len(intxTrackers), int(pageRes.Total)) + }) t.Run("Delete InTxTracker", func(t *testing.T) { + keeper, ctx, _, _ := keepertest.CrosschainKeeper(t) + intxTrackers := createNInTxTracker(keeper, ctx, 10, 5) trackers := keeper.GetAllInTxTracker(ctx) for _, item := range trackers { keeper.RemoveInTxTrackerIfExists(ctx, item.ChainId, item.TxHash) diff --git a/x/crosschain/keeper/keeper.go b/x/crosschain/keeper/keeper.go index 0a44254be7..877bd56016 100644 --- a/x/crosschain/keeper/keeper.go +++ b/x/crosschain/keeper/keeper.go @@ -81,3 +81,15 @@ func (k Keeper) GetFungibleKeeper() types.FungibleKeeper { func (k Keeper) GetObserverKeeper() types.ZetaObserverKeeper { return k.zetaObserverKeeper } + +func (k Keeper) GetStoreKey() storetypes.StoreKey { + return k.storeKey +} + +func (k Keeper) GetMemKey() storetypes.StoreKey { + return k.memKey +} + +func (k Keeper) GetCodec() codec.Codec { + return k.cdc +} diff --git a/x/crosschain/keeper/keeper_chain_nonces.go b/x/crosschain/keeper/keeper_chain_nonces.go deleted file mode 100644 index 7ecd816075..0000000000 --- a/x/crosschain/keeper/keeper_chain_nonces.go +++ /dev/null @@ -1,147 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/zeta-chain/zetacore/x/crosschain/types" - observertypes "github.com/zeta-chain/zetacore/x/observer/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -// SetChainNonces set a specific chainNonces in the store from its index -func (k Keeper) SetChainNonces(ctx sdk.Context, chainNonces types.ChainNonces) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ChainNoncesKey)) - b := k.cdc.MustMarshal(&chainNonces) - store.Set(types.KeyPrefix(chainNonces.Index), b) -} - -// GetChainNonces returns a chainNonces from its index -func (k Keeper) GetChainNonces(ctx sdk.Context, index string) (val types.ChainNonces, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ChainNoncesKey)) - - b := store.Get(types.KeyPrefix(index)) - if b == nil { - return val, false - } - - k.cdc.MustUnmarshal(b, &val) - return val, true -} - -// RemoveChainNonces removes a chainNonces from the store -func (k Keeper) RemoveChainNonces(ctx sdk.Context, index string) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ChainNoncesKey)) - store.Delete(types.KeyPrefix(index)) -} - -// GetAllChainNonces returns all chainNonces -func (k Keeper) GetAllChainNonces(ctx sdk.Context) (list []types.ChainNonces) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ChainNoncesKey)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var val types.ChainNonces - k.cdc.MustUnmarshal(iterator.Value(), &val) - list = append(list, val) - } - - return -} - -// Queries - -func (k Keeper) ChainNoncesAll(c context.Context, req *types.QueryAllChainNoncesRequest) (*types.QueryAllChainNoncesResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - var chainNoncess []*types.ChainNonces - ctx := sdk.UnwrapSDKContext(c) - - store := ctx.KVStore(k.storeKey) - chainNoncesStore := prefix.NewStore(store, types.KeyPrefix(types.ChainNoncesKey)) - - pageRes, err := query.Paginate(chainNoncesStore, req.Pagination, func(key []byte, value []byte) error { - var chainNonces types.ChainNonces - if err := k.cdc.Unmarshal(value, &chainNonces); err != nil { - return err - } - - chainNoncess = append(chainNoncess, &chainNonces) - return nil - }) - - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryAllChainNoncesResponse{ChainNonces: chainNoncess, Pagination: pageRes}, nil -} - -func (k Keeper) ChainNonces(c context.Context, req *types.QueryGetChainNoncesRequest) (*types.QueryGetChainNoncesResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - - val, found := k.GetChainNonces(ctx, req.Index) - if !found { - return nil, status.Error(codes.InvalidArgument, "not found") - } - - return &types.QueryGetChainNoncesResponse{ChainNonces: &val}, nil -} - -// MESSAGES - -// Deprecated. -func (k msgServer) NonceVoter(goCtx context.Context, msg *types.MsgNonceVoter) (*types.MsgNonceVoterResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(msg.ChainId) - if chain == nil { - return nil, observertypes.ErrSupportedChains - } - - if ok := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, chain); !ok { - return nil, observertypes.ErrNotAuthorizedPolicy - } - chainNonce, isFound := k.GetChainNonces(ctx, chain.ChainName.String()) - - if isFound { - isExisting := false - for _, signer := range chainNonce.Signers { - if signer == msg.Creator { - isExisting = true - } - } - if !isExisting { - chainNonce.Signers = append(chainNonce.Signers, msg.Creator) - } - chainNonce.Nonce = msg.Nonce - } else if !isFound { - chainNonce = types.ChainNonces{ - Creator: msg.Creator, - Index: chain.ChainName.String(), - ChainId: chain.ChainId, - Nonce: msg.Nonce, - Signers: []string{msg.Creator}, - } - } else { - return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("chainNonce vote msg does not match state: %v vs %v", msg, chainNonce)) - } - - //if hasSuperMajorityValidators(len(chainNonce.Signers), validators) { - // chainNonce.FinalizedHeight = uint64(ctx.BlockHeader().Height) - //} - - k.SetChainNonces(ctx, chainNonce) - return &types.MsgNonceVoterResponse{}, nil -} diff --git a/x/crosschain/keeper/keeper_chain_nonces_test.go b/x/crosschain/keeper/keeper_chain_nonces_test.go deleted file mode 100644 index 693bd49a21..0000000000 --- a/x/crosschain/keeper/keeper_chain_nonces_test.go +++ /dev/null @@ -1,144 +0,0 @@ -package keeper - -import ( - "fmt" - "testing" - - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" - - "github.com/zeta-chain/zetacore/x/crosschain/types" -) - -// Keeper Tests -func createNChainNonces(keeper *Keeper, ctx sdk.Context, n int) []types.ChainNonces { - items := make([]types.ChainNonces, n) - for i := range items { - items[i].Creator = "any" - items[i].Index = fmt.Sprintf("%d", i) - keeper.SetChainNonces(ctx, items[i]) - } - return items -} - -func TestChainNoncesGet(t *testing.T) { - keeper, ctx := setupKeeper(t) - items := createNChainNonces(keeper, ctx, 10) - for _, item := range items { - rst, found := keeper.GetChainNonces(ctx, item.Index) - assert.True(t, found) - assert.Equal(t, item, rst) - } -} -func TestChainNoncesRemove(t *testing.T) { - keeper, ctx := setupKeeper(t) - items := createNChainNonces(keeper, ctx, 10) - for _, item := range items { - keeper.RemoveChainNonces(ctx, item.Index) - _, found := keeper.GetChainNonces(ctx, item.Index) - assert.False(t, found) - } -} - -func TestChainNoncesGetAll(t *testing.T) { - keeper, ctx := setupKeeper(t) - items := createNChainNonces(keeper, ctx, 10) - assert.Equal(t, items, keeper.GetAllChainNonces(ctx)) -} - -//Querier Tests - -func TestChainNoncesQuerySingle(t *testing.T) { - keeper, ctx := setupKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - msgs := createNChainNonces(keeper, ctx, 2) - for _, tc := range []struct { - desc string - request *types.QueryGetChainNoncesRequest - response *types.QueryGetChainNoncesResponse - err error - }{ - { - desc: "First", - request: &types.QueryGetChainNoncesRequest{Index: msgs[0].Index}, - response: &types.QueryGetChainNoncesResponse{ChainNonces: &msgs[0]}, - }, - { - desc: "Second", - request: &types.QueryGetChainNoncesRequest{Index: msgs[1].Index}, - response: &types.QueryGetChainNoncesResponse{ChainNonces: &msgs[1]}, - }, - { - desc: "KeyNotFound", - request: &types.QueryGetChainNoncesRequest{Index: "missing"}, - err: status.Error(codes.InvalidArgument, "not found"), - }, - { - desc: "InvalidRequest", - err: status.Error(codes.InvalidArgument, "invalid request"), - }, - } { - tc := tc - t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.ChainNonces(wctx, tc.request) - if tc.err != nil { - require.ErrorIs(t, err, tc.err) - } else { - require.Equal(t, tc.response, response) - } - }) - } -} - -func TestChainNoncesQueryPaginated(t *testing.T) { - keeper, ctx := setupKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - msgs := createNChainNonces(keeper, ctx, 5) - - request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllChainNoncesRequest { - return &types.QueryAllChainNoncesRequest{ - Pagination: &query.PageRequest{ - Key: next, - Offset: offset, - Limit: limit, - CountTotal: total, - }, - } - } - t.Run("ByOffset", func(t *testing.T) { - step := 2 - for i := 0; i < len(msgs); i += step { - resp, err := keeper.ChainNoncesAll(wctx, request(nil, uint64(i), uint64(step), false)) - require.NoError(t, err) - for j := i; j < len(msgs) && j < i+step; j++ { - assert.Equal(t, &msgs[j], resp.ChainNonces[j-i]) - } - } - }) - t.Run("ByKey", func(t *testing.T) { - step := 2 - var next []byte - for i := 0; i < len(msgs); i += step { - resp, err := keeper.ChainNoncesAll(wctx, request(next, 0, uint64(step), false)) - require.NoError(t, err) - for j := i; j < len(msgs) && j < i+step; j++ { - assert.Equal(t, &msgs[j], resp.ChainNonces[j-i]) - } - next = resp.Pagination.NextKey - } - }) - t.Run("Total", func(t *testing.T) { - resp, err := keeper.ChainNoncesAll(wctx, request(nil, 0, 0, true)) - require.NoError(t, err) - require.Equal(t, len(msgs), int(resp.Pagination.Total)) - }) - t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.ChainNoncesAll(wctx, nil) - require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) - }) -} diff --git a/x/crosschain/keeper/keeper_cross_chain_tx.go b/x/crosschain/keeper/keeper_cross_chain_tx.go deleted file mode 100644 index 55da65fb9d..0000000000 --- a/x/crosschain/keeper/keeper_cross_chain_tx.go +++ /dev/null @@ -1,286 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/x/crosschain/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -// SetCctxAndNonceToCctxAndInTxHashToCctx set a specific send in the store from its index -func (k Keeper) SetCctxAndNonceToCctxAndInTxHashToCctx(ctx sdk.Context, send types.CrossChainTx) { - - p := types.KeyPrefix(fmt.Sprintf("%s", types.SendKey)) - store := prefix.NewStore(ctx.KVStore(k.storeKey), p) - b := k.cdc.MustMarshal(&send) - store.Set(types.KeyPrefix(send.Index), b) - - // set mapping inTxHash -> cctxIndex - in, _ := k.GetInTxHashToCctx(ctx, send.InboundTxParams.InboundTxObservedHash) - in.InTxHash = send.InboundTxParams.InboundTxObservedHash - found := false - for _, cctxIndex := range in.CctxIndex { - if cctxIndex == send.Index { - found = true - break - } - } - if !found { - in.CctxIndex = append(in.CctxIndex, send.Index) - } - k.SetInTxHashToCctx(ctx, in) - - tss, found := k.GetTSS(ctx) - if !found { - return - } - // set mapping nonce => cctxIndex - if send.CctxStatus.Status == types.CctxStatus_PendingOutbound || send.CctxStatus.Status == types.CctxStatus_PendingRevert { - k.SetNonceToCctx(ctx, types.NonceToCctx{ - ChainId: send.GetCurrentOutTxParam().ReceiverChainId, - // #nosec G701 always in range - Nonce: int64(send.GetCurrentOutTxParam().OutboundTxTssNonce), - CctxIndex: send.Index, - Tss: tss.TssPubkey, - }) - } -} - -// SetCrossChainTx set a specific send in the store from its index -func (k Keeper) SetCrossChainTx(ctx sdk.Context, send types.CrossChainTx) { - p := types.KeyPrefix(fmt.Sprintf("%s", types.SendKey)) - store := prefix.NewStore(ctx.KVStore(k.storeKey), p) - b := k.cdc.MustMarshal(&send) - store.Set(types.KeyPrefix(send.Index), b) -} - -// GetCrossChainTx returns a send from its index -func (k Keeper) GetCrossChainTx(ctx sdk.Context, index string) (val types.CrossChainTx, found bool) { - p := types.KeyPrefix(fmt.Sprintf("%s", types.SendKey)) - store := prefix.NewStore(ctx.KVStore(k.storeKey), p) - - b := store.Get(types.KeyPrefix(index)) - if b == nil { - return val, false - } - - k.cdc.MustUnmarshal(b, &val) - return val, true -} - -func (k Keeper) GetAllCrossChainTx(ctx sdk.Context) (list []types.CrossChainTx) { - p := types.KeyPrefix(fmt.Sprintf("%s", types.SendKey)) - store := prefix.NewStore(ctx.KVStore(k.storeKey), p) - - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var val types.CrossChainTx - k.cdc.MustUnmarshal(iterator.Value(), &val) - list = append(list, val) - } - - return list -} - -// RemoveCrossChainTx removes a send from the store -func (k Keeper) RemoveCrossChainTx(ctx sdk.Context, index string) { - p := types.KeyPrefix(fmt.Sprintf("%s", types.SendKey)) - store := prefix.NewStore(ctx.KVStore(k.storeKey), p) - store.Delete(types.KeyPrefix(index)) -} - -// Queries - -func (k Keeper) CctxAll(c context.Context, req *types.QueryAllCctxRequest) (*types.QueryAllCctxResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - var sends []*types.CrossChainTx - ctx := sdk.UnwrapSDKContext(c) - - store := ctx.KVStore(k.storeKey) - sendStore := prefix.NewStore(store, types.KeyPrefix(types.SendKey)) - - pageRes, err := query.Paginate(sendStore, req.Pagination, func(key []byte, value []byte) error { - var send types.CrossChainTx - if err := k.cdc.Unmarshal(value, &send); err != nil { - return err - } - sends = append(sends, &send) - return nil - }) - - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryAllCctxResponse{CrossChainTx: sends, Pagination: pageRes}, nil -} - -func (k Keeper) CctxByStatus(c context.Context, req *types.QueryCctxByStatusRequest) (*types.QueryCctxByStatusResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - p := types.KeyPrefix(fmt.Sprintf("%s", types.SendKey)) - store := prefix.NewStore(ctx.KVStore(k.storeKey), p) - - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - - defer iterator.Close() - cctxList := make([]types.CrossChainTx, 0) - for ; iterator.Valid(); iterator.Next() { - var val types.CrossChainTx - k.cdc.MustUnmarshal(iterator.Value(), &val) - if val.CctxStatus.Status == req.Status { - cctxList = append(cctxList, val) - } - } - - return &types.QueryCctxByStatusResponse{CrossChainTx: cctxList}, nil -} - -func (k Keeper) Cctx(c context.Context, req *types.QueryGetCctxRequest) (*types.QueryGetCctxResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - - val, found := k.GetCrossChainTx(ctx, req.Index) - if !found { - return nil, status.Error(codes.InvalidArgument, "not found") - } - - return &types.QueryGetCctxResponse{CrossChainTx: &val}, nil -} - -func (k Keeper) CctxByNonce(c context.Context, req *types.QueryGetCctxByNonceRequest) (*types.QueryGetCctxResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - tss, found := k.GetTSS(ctx) - if !found { - return nil, status.Error(codes.Internal, "tss not found") - } - // #nosec G701 always in range - res, found := k.GetNonceToCctx(ctx, tss.TssPubkey, req.ChainID, int64(req.Nonce)) - if !found { - return nil, status.Error(codes.Internal, fmt.Sprintf("nonceToCctx not found: nonce %d, chainid %d", req.Nonce, req.ChainID)) - } - val, found := k.GetCrossChainTx(ctx, res.CctxIndex) - if !found { - return nil, status.Error(codes.Internal, fmt.Sprintf("cctx not found: index %s", res.CctxIndex)) - } - - return &types.QueryGetCctxResponse{CrossChainTx: &val}, nil -} - -func (k Keeper) CctxAllPending(c context.Context, req *types.QueryAllCctxPendingRequest) (*types.QueryAllCctxPendingResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - tss, found := k.GetTSS(ctx) - if !found { - return nil, status.Error(codes.Internal, "tss not found") - } - p, found := k.GetPendingNonces(ctx, tss.TssPubkey, req.ChainId) - if !found { - return nil, status.Error(codes.Internal, "pending nonces not found") - } - sends := make([]*types.CrossChainTx, 0) - - // now query the previous nonces up to 100 prior to find any pending cctx that we might have missed - // need this logic because a confirmation of higher nonce will automatically update the p.NonceLow - // therefore might mask some lower nonce cctx that is still pending. - startNonce := p.NonceLow - 1000 - if startNonce < 0 { - startNonce = 0 - } - for i := startNonce; i < p.NonceLow; i++ { - res, found := k.GetNonceToCctx(ctx, tss.TssPubkey, req.ChainId, i) - if !found { - return nil, status.Error(codes.Internal, fmt.Sprintf("nonceToCctx not found: nonce %d, chainid %d", i, req.ChainId)) - } - send, found := k.GetCrossChainTx(ctx, res.CctxIndex) - if !found { - return nil, status.Error(codes.Internal, fmt.Sprintf("cctx not found: index %s", res.CctxIndex)) - } - if send.CctxStatus.Status == types.CctxStatus_PendingOutbound || send.CctxStatus.Status == types.CctxStatus_PendingRevert { - sends = append(sends, &send) - } - } - - // now query the pending nonces that we know are pending - for i := p.NonceLow; i < p.NonceHigh; i++ { - ntc, found := k.GetNonceToCctx(ctx, tss.TssPubkey, req.ChainId, i) - if !found { - return nil, status.Error(codes.Internal, "nonceToCctx not found") - } - cctx, found := k.GetCrossChainTx(ctx, ntc.CctxIndex) - if !found { - return nil, status.Error(codes.Internal, "cctxIndex not found") - } - sends = append(sends, &cctx) - } - - return &types.QueryAllCctxPendingResponse{CrossChainTx: sends}, nil -} - -func (k Keeper) CreateNewCCTX(ctx sdk.Context, msg *types.MsgVoteOnObservedInboundTx, index string, tssPubkey string, s types.CctxStatus, senderChain, receiverChain *common.Chain) types.CrossChainTx { - if msg.TxOrigin == "" { - msg.TxOrigin = msg.Sender - } - inboundParams := &types.InboundTxParams{ - Sender: msg.Sender, - SenderChainId: senderChain.ChainId, - TxOrigin: msg.TxOrigin, - Asset: msg.Asset, - Amount: msg.Amount, - CoinType: msg.CoinType, - InboundTxObservedHash: msg.InTxHash, - InboundTxObservedExternalHeight: msg.InBlockHeight, - InboundTxFinalizedZetaHeight: 0, - InboundTxBallotIndex: index, - } - - outBoundParams := &types.OutboundTxParams{ - Receiver: msg.Receiver, - ReceiverChainId: receiverChain.ChainId, - OutboundTxHash: "", - OutboundTxTssNonce: 0, - OutboundTxGasLimit: msg.GasLimit, - OutboundTxGasPrice: "", - OutboundTxBallotIndex: "", - OutboundTxObservedExternalHeight: 0, - CoinType: msg.CoinType, // FIXME: is this correct? - Amount: sdk.NewUint(0), - TssPubkey: tssPubkey, - } - status := &types.Status{ - Status: s, - StatusMessage: "", - LastUpdateTimestamp: ctx.BlockHeader().Time.Unix(), - } - newCctx := types.CrossChainTx{ - Creator: msg.Creator, - Index: index, - ZetaFees: math.ZeroUint(), - RelayedMessage: msg.Message, - CctxStatus: status, - InboundTxParams: inboundParams, - OutboundTxParams: []*types.OutboundTxParams{outBoundParams}, - } - return newCctx -} diff --git a/x/crosschain/keeper/keeper_gas_price.go b/x/crosschain/keeper/keeper_gas_price.go deleted file mode 100644 index 50a103bec9..0000000000 --- a/x/crosschain/keeper/keeper_gas_price.go +++ /dev/null @@ -1,212 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - "math/big" - "sort" - "strconv" - - "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/zeta-chain/zetacore/x/crosschain/types" - observertypes "github.com/zeta-chain/zetacore/x/observer/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -// SetGasPrice set a specific gasPrice in the store from its index -func (k Keeper) SetGasPrice(ctx sdk.Context, gasPrice types.GasPrice) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GasPriceKey)) - b := k.cdc.MustMarshal(&gasPrice) - gasPrice.Index = strconv.FormatInt(gasPrice.ChainId, 10) - store.Set(types.KeyPrefix(gasPrice.Index), b) -} - -// GetGasPrice returns a gasPrice from its index -func (k Keeper) GetGasPrice(ctx sdk.Context, chainID int64) (val types.GasPrice, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GasPriceKey)) - b := store.Get(types.KeyPrefix(strconv.FormatInt(chainID, 10))) - if b == nil { - return val, false - } - k.cdc.MustUnmarshal(b, &val) - return val, true -} - -func (k Keeper) GetMedianGasPriceInUint(ctx sdk.Context, chainID int64) (sdk.Uint, bool) { - gasPrice, isFound := k.GetGasPrice(ctx, chainID) - if !isFound { - return math.ZeroUint(), isFound - } - mi := gasPrice.MedianIndex - return sdk.NewUint(gasPrice.Prices[mi]), true -} - -// RemoveGasPrice removes a gasPrice from the store -func (k Keeper) RemoveGasPrice(ctx sdk.Context, index string) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GasPriceKey)) - store.Delete(types.KeyPrefix(index)) -} - -// GetAllGasPrice returns all gasPrice -func (k Keeper) GetAllGasPrice(ctx sdk.Context) (list []types.GasPrice) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GasPriceKey)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var val types.GasPrice - k.cdc.MustUnmarshal(iterator.Value(), &val) - list = append(list, val) - } - - return -} - -// Queries - -func (k Keeper) GasPriceAll(c context.Context, req *types.QueryAllGasPriceRequest) (*types.QueryAllGasPriceResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - var gasPrices []*types.GasPrice - ctx := sdk.UnwrapSDKContext(c) - - store := ctx.KVStore(k.storeKey) - gasPriceStore := prefix.NewStore(store, types.KeyPrefix(types.GasPriceKey)) - - pageRes, err := query.Paginate(gasPriceStore, req.Pagination, func(key []byte, value []byte) error { - var gasPrice types.GasPrice - if err := k.cdc.Unmarshal(value, &gasPrice); err != nil { - return err - } - - gasPrices = append(gasPrices, &gasPrice) - return nil - }) - - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - - return &types.QueryAllGasPriceResponse{GasPrice: gasPrices, Pagination: pageRes}, nil -} - -func (k Keeper) GasPrice(c context.Context, req *types.QueryGetGasPriceRequest) (*types.QueryGetGasPriceResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - chainID, err := strconv.Atoi(req.Index) - if err != nil { - return nil, err - } - val, found := k.GetGasPrice(ctx, int64(chainID)) - if !found { - return nil, status.Error(codes.InvalidArgument, "not found") - } - - return &types.QueryGetGasPriceResponse{GasPrice: &val}, nil -} - -// MESSAGES - -// Submit information about the connected chain's gas price at a specific block -// height. Gas price submitted by each validator is recorded separately and a -// median index is updated. -// -// Only observer validators are authorized to broadcast this message. -func (k msgServer) GasPriceVoter(goCtx context.Context, msg *types.MsgGasPriceVoter) (*types.MsgGasPriceVoterResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(msg.ChainId) - if chain == nil { - return nil, observertypes.ErrSupportedChains - } - if ok := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, chain); !ok { - return nil, observertypes.ErrNotAuthorizedPolicy - } - if chain == nil { - return nil, sdkerrors.Wrap(types.ErrUnsupportedChain, fmt.Sprintf("ChainID : %d ", msg.ChainId)) - } - - gasPrice, isFound := k.GetGasPrice(ctx, chain.ChainId) - if !isFound { - gasPrice = types.GasPrice{ - Creator: msg.Creator, - Index: strconv.FormatInt(chain.ChainId, 10), // TODO : Not needed index set at keeper - ChainId: chain.ChainId, - Prices: []uint64{msg.Price}, - BlockNums: []uint64{msg.BlockNumber}, - Signers: []string{msg.Creator}, - MedianIndex: 0, - } - } else { - signers := gasPrice.Signers - exist := false - for i, s := range signers { - if s == msg.Creator { // update existing entry - gasPrice.BlockNums[i] = msg.BlockNumber - gasPrice.Prices[i] = msg.Price - exist = true - break - } - } - if !exist { - gasPrice.Signers = append(gasPrice.Signers, msg.Creator) - gasPrice.BlockNums = append(gasPrice.BlockNums, msg.BlockNumber) - gasPrice.Prices = append(gasPrice.Prices, msg.Price) - } - // recompute the median gas price - mi := medianOfArray(gasPrice.Prices) - // #nosec G701 always positive - gasPrice.MedianIndex = uint64(mi) - } - k.SetGasPrice(ctx, gasPrice) - chainIDBigINT := big.NewInt(chain.ChainId) - - gasUsed, err := k.fungibleKeeper.SetGasPrice( - ctx, - chainIDBigINT, - math.NewUint(gasPrice.Prices[gasPrice.MedianIndex]).BigInt(), - ) - if err != nil { - return nil, err - } - - // reset the gas count - k.ResetGasMeterAndConsumeGas(ctx, gasUsed) - - return &types.MsgGasPriceVoterResponse{}, nil -} - -type indexValue struct { - Index int - Value uint64 -} - -func medianOfArray(values []uint64) int { - array := make([]indexValue, len(values)) - for i, v := range values { - array[i] = indexValue{Index: i, Value: v} - } - sort.SliceStable(array, func(i, j int) bool { - return array[i].Value < array[j].Value - }) - l := len(array) - return array[l/2].Index -} - -// ResetGasMeterAndConsumeGas reset first the gas meter consumed value to zero and set it back to the new value -// 'gasUsed' -func (k *Keeper) ResetGasMeterAndConsumeGas(ctx sdk.Context, gasUsed uint64) { - // reset the gas count - ctx.GasMeter().RefundGas(ctx.GasMeter().GasConsumed(), "reset the gas count") - ctx.GasMeter().ConsumeGas(gasUsed, "apply evm transaction") -} diff --git a/x/crosschain/keeper/keeper_pending_nonces.go b/x/crosschain/keeper/keeper_pending_nonces.go deleted file mode 100644 index 5d08fd069a..0000000000 --- a/x/crosschain/keeper/keeper_pending_nonces.go +++ /dev/null @@ -1,115 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/x/crosschain/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -// CRUD -func (k Keeper) SetNonceToCctx(ctx sdk.Context, nonceToCctx types.NonceToCctx) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NonceToCctxKeyPrefix)) - b := k.cdc.MustMarshal(&nonceToCctx) - store.Set(types.KeyPrefix(fmt.Sprintf("%s-%d-%d", nonceToCctx.Tss, nonceToCctx.ChainId, nonceToCctx.Nonce)), b) -} - -func (k Keeper) GetNonceToCctx(ctx sdk.Context, tss string, chainID int64, nonce int64) (val types.NonceToCctx, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NonceToCctxKeyPrefix)) - - b := store.Get(types.KeyPrefix(fmt.Sprintf("%s-%d-%d", tss, chainID, nonce))) - if b == nil { - return val, false - } - - k.cdc.MustUnmarshal(b, &val) - return val, true -} - -func (k Keeper) RemoveNonceToCctx(ctx sdk.Context, nonceToCctx types.NonceToCctx) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NonceToCctxKeyPrefix)) - store.Delete(types.KeyPrefix(fmt.Sprintf("%s-%d-%d", nonceToCctx.Tss, nonceToCctx.ChainId, nonceToCctx.Nonce))) -} - -func (k Keeper) SetPendingNonces(ctx sdk.Context, pendingNonces types.PendingNonces) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PendingNoncesKeyPrefix)) - b := k.cdc.MustMarshal(&pendingNonces) - store.Set(types.KeyPrefix(fmt.Sprintf("%s-%d", pendingNonces.Tss, pendingNonces.ChainId)), b) -} - -func (k Keeper) GetPendingNonces(ctx sdk.Context, tss string, chainID int64) (val types.PendingNonces, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PendingNoncesKeyPrefix)) - - b := store.Get(types.KeyPrefix(fmt.Sprintf("%s-%d", tss, chainID))) - if b == nil { - return val, false - } - - k.cdc.MustUnmarshal(b, &val) - return val, true -} - -func (k Keeper) GetAllPendingNonces(ctx sdk.Context) (list []*types.PendingNonces) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PendingNoncesKeyPrefix)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - var val types.PendingNonces - k.cdc.MustUnmarshal(iterator.Value(), &val) - list = append(list, &val) - } - - return -} - -func (k Keeper) RemovePendingNonces(ctx sdk.Context, pendingNonces types.PendingNonces) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PendingNoncesKeyPrefix)) - store.Delete(types.KeyPrefix(fmt.Sprintf("%s-%d", pendingNonces.Tss, pendingNonces.ChainId))) -} - -// utility -func (k Keeper) RemoveFromPendingNonces(ctx sdk.Context, tssPubkey string, chainID int64, nonce int64) { - p, found := k.GetPendingNonces(ctx, tssPubkey, chainID) - if found && nonce >= p.NonceLow && nonce <= p.NonceHigh { - p.NonceLow = nonce + 1 - k.SetPendingNonces(ctx, p) - } -} - -func (k Keeper) PendingNoncesAll(c context.Context, req *types.QueryAllPendingNoncesRequest) (*types.QueryAllPendingNoncesResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - list := k.GetAllPendingNonces(ctx) - - return &types.QueryAllPendingNoncesResponse{ - PendingNonces: list, - }, nil -} - -func (k Keeper) PendingNoncesByChain(c context.Context, req *types.QueryPendingNoncesByChainRequest) (*types.QueryPendingNoncesByChainResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(c) - tss, found := k.GetTSS(ctx) - if !found { - return nil, status.Error(codes.NotFound, "tss not found") - } - list, found := k.GetPendingNonces(ctx, tss.TssPubkey, req.ChainId) - if !found { - return nil, status.Error(codes.NotFound, fmt.Sprintf("pending nonces not found for chain id : %d", req.ChainId)) - } - - return &types.QueryPendingNoncesByChainResponse{ - PendingNonces: list, - }, nil -} diff --git a/x/crosschain/keeper/keeper_tss_test.go b/x/crosschain/keeper/keeper_tss_test.go deleted file mode 100644 index d48e625671..0000000000 --- a/x/crosschain/keeper/keeper_tss_test.go +++ /dev/null @@ -1,120 +0,0 @@ -package keeper - -import ( - "testing" - - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" - - "github.com/zeta-chain/zetacore/x/crosschain/types" -) - -func createTSS(keeper *Keeper, ctx sdk.Context, n int) []types.TSS { - tssList := make([]types.TSS, n) - for i := 0; i < n; i++ { - tss := types.TSS{ - TssPubkey: "tssPubkey", - TssParticipantList: []string{"tssParticipantList"}, - OperatorAddressList: []string{"operatorAddressList"}, - KeyGenZetaHeight: int64(100 + i), - FinalizedZetaHeight: int64(110 + i), - } - keeper.SetTSS(ctx, tss) - keeper.SetTSSHistory(ctx, tss) - tssList[i] = tss - } - return tssList -} - -func TestTSSGet(t *testing.T) { - keeper, ctx := setupKeeper(t) - tssSaved := createTSS(keeper, ctx, 1) - tss, found := keeper.GetTSS(ctx) - assert.True(t, found) - assert.Equal(t, tssSaved[len(tssSaved)-1], tss) - -} -func TestTSSRemove(t *testing.T) { - keeper, ctx := setupKeeper(t) - _ = createTSS(keeper, ctx, 1) - keeper.RemoveTSS(ctx) - _, found := keeper.GetTSS(ctx) - assert.False(t, found) -} - -func TestTSSQuerySingle(t *testing.T) { - keeper, ctx := setupKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - msgs := createTSS(keeper, ctx, 1) - for _, tc := range []struct { - desc string - request *types.QueryGetTSSRequest - response *types.QueryGetTSSResponse - err error - }{ - { - desc: "First", - request: &types.QueryGetTSSRequest{}, - response: &types.QueryGetTSSResponse{TSS: &msgs[len(msgs)-1]}, - }, - { - desc: "InvalidRequest", - err: status.Error(codes.InvalidArgument, "invalid request"), - }, - } { - tc := tc - t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.TSS(wctx, tc.request) - if tc.err != nil { - require.ErrorIs(t, err, tc.err) - } else { - require.Equal(t, tc.response, response) - } - }) - } -} - -func TestTSSQueryHistory(t *testing.T) { - keeper, ctx := setupKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - for _, tc := range []struct { - desc string - tssCount int - foundPrevious bool - err error - }{ - { - desc: "1 Tss addresses", - tssCount: 1, - foundPrevious: false, - err: nil, - }, - { - desc: "10 Tss addresses", - tssCount: 10, - foundPrevious: true, - err: nil, - }, - } { - tc := tc - t.Run(tc.desc, func(t *testing.T) { - tssList := createTSS(keeper, ctx, tc.tssCount) - request := &types.QueryTssHistoryRequest{} - response, err := keeper.TssHistory(wctx, request) - if tc.err != nil { - require.ErrorIs(t, err, tc.err) - } else { - require.Equal(t, len(tssList), len(response.TssList)) - prevTss, found := keeper.GetPreviousTSS(ctx) - assert.Equal(t, tc.foundPrevious, found) - if found { - assert.Equal(t, tssList[len(tssList)-2], prevTss) - } - } - }) - } -} diff --git a/x/crosschain/keeper/last_block_height.go b/x/crosschain/keeper/last_block_height.go new file mode 100644 index 0000000000..bc4d5bb636 --- /dev/null +++ b/x/crosschain/keeper/last_block_height.go @@ -0,0 +1,49 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +// SetLastBlockHeight set a specific lastBlockHeight in the store from its index +func (k Keeper) SetLastBlockHeight(ctx sdk.Context, lastBlockHeight types.LastBlockHeight) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LastBlockHeightKey)) + b := k.cdc.MustMarshal(&lastBlockHeight) + store.Set(types.KeyPrefix(lastBlockHeight.Index), b) +} + +// GetLastBlockHeight returns a lastBlockHeight from its index +func (k Keeper) GetLastBlockHeight(ctx sdk.Context, index string) (val types.LastBlockHeight, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LastBlockHeightKey)) + + b := store.Get(types.KeyPrefix(index)) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// RemoveLastBlockHeight removes a lastBlockHeight from the store +func (k Keeper) RemoveLastBlockHeight(ctx sdk.Context, index string) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LastBlockHeightKey)) + store.Delete(types.KeyPrefix(index)) +} + +// GetAllLastBlockHeight returns all lastBlockHeight +func (k Keeper) GetAllLastBlockHeight(ctx sdk.Context) (list []types.LastBlockHeight) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LastBlockHeightKey)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.LastBlockHeight + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/crosschain/keeper/last_block_height_test.go b/x/crosschain/keeper/last_block_height_test.go new file mode 100644 index 0000000000..94eb087e01 --- /dev/null +++ b/x/crosschain/keeper/last_block_height_test.go @@ -0,0 +1,45 @@ +package keeper + +import ( + "fmt" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/assert" + "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +func createNLastBlockHeight(keeper *Keeper, ctx sdk.Context, n int) []types.LastBlockHeight { + items := make([]types.LastBlockHeight, n) + for i := range items { + items[i].Creator = "any" + items[i].Index = fmt.Sprintf("%d", i) + keeper.SetLastBlockHeight(ctx, items[i]) + } + return items +} + +func TestLastBlockHeightGet(t *testing.T) { + keeper, ctx := setupKeeper(t) + items := createNLastBlockHeight(keeper, ctx, 10) + for _, item := range items { + rst, found := keeper.GetLastBlockHeight(ctx, item.Index) + assert.True(t, found) + assert.Equal(t, item, rst) + } +} +func TestLastBlockHeightRemove(t *testing.T) { + keeper, ctx := setupKeeper(t) + items := createNLastBlockHeight(keeper, ctx, 10) + for _, item := range items { + keeper.RemoveLastBlockHeight(ctx, item.Index) + _, found := keeper.GetLastBlockHeight(ctx, item.Index) + assert.False(t, found) + } +} + +func TestLastBlockHeightGetAll(t *testing.T) { + keeper, ctx := setupKeeper(t) + items := createNLastBlockHeight(keeper, ctx, 10) + assert.Equal(t, items, keeper.GetAllLastBlockHeight(ctx)) +} diff --git a/x/crosschain/keeper/migrator.go b/x/crosschain/keeper/migrator.go index c62d423249..30c1274b8a 100644 --- a/x/crosschain/keeper/migrator.go +++ b/x/crosschain/keeper/migrator.go @@ -4,6 +4,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" v2 "github.com/zeta-chain/zetacore/x/crosschain/migrations/v2" v3 "github.com/zeta-chain/zetacore/x/crosschain/migrations/v3" + v4 "github.com/zeta-chain/zetacore/x/crosschain/migrations/v4" ) // Migrator is a struct for handling in-place store migrations. @@ -18,11 +19,17 @@ func NewMigrator(keeper Keeper) Migrator { } } -// Migrate2to3 migrates the store from consensus version 2 to 3 +// Migrate1to2 migrates the store from consensus version 1 to 2 func (m Migrator) Migrate1to2(ctx sdk.Context) error { return v2.MigrateStore(ctx, m.crossChainKeeper.zetaObserverKeeper, m.crossChainKeeper.storeKey, m.crossChainKeeper.cdc) } +// Migrate2to3 migrates the store from consensus version 2 to 3 func (m Migrator) Migrate2to3(ctx sdk.Context) error { return v3.MigrateStore(ctx, m.crossChainKeeper.storeKey, m.crossChainKeeper.cdc) } + +// Migrate3to4 migrates the store from consensus version 3 to 4 +func (m Migrator) Migrate3to4(ctx sdk.Context) error { + return v4.MigrateStore(ctx, m.crossChainKeeper.zetaObserverKeeper, m.crossChainKeeper.storeKey, m.crossChainKeeper.cdc) +} diff --git a/x/crosschain/keeper/msg_migrate_tss_funds.go b/x/crosschain/keeper/msg_migrate_tss_funds.go deleted file mode 100644 index 85107860dc..0000000000 --- a/x/crosschain/keeper/msg_migrate_tss_funds.go +++ /dev/null @@ -1,140 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - "sort" - - errorsmod "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/ethereum/go-ethereum/crypto" - tmbytes "github.com/tendermint/tendermint/libs/bytes" - tmtypes "github.com/tendermint/tendermint/types" - "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/x/crosschain/types" - observerTypes "github.com/zeta-chain/zetacore/x/observer/types" -) - -func (k msgServer) MigrateTssFunds(goCtx context.Context, msg *types.MsgMigrateTssFunds) (*types.MsgMigrateTssFundsResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - if msg.Creator != k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(observerTypes.Policy_Type_group2) { - return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "Update can only be executed by the correct policy account") - } - if k.zetaObserverKeeper.IsInboundEnabled(ctx) { - return nil, errorsmod.Wrap(types.ErrUnableToUpdateTss, "cannot migrate funds while inbound is enabled") - } - tss, found := k.GetTSS(ctx) - if !found { - return nil, errorsmod.Wrap(types.ErrUnableToUpdateTss, "cannot find current TSS") - } - pendingNonces, found := k.GetPendingNonces(ctx, tss.TssPubkey, msg.ChainId) - if !found { - return nil, errorsmod.Wrap(types.ErrUnableToUpdateTss, "cannot find pending nonces for chain") - } - if pendingNonces.NonceLow != pendingNonces.NonceHigh { - return nil, errorsmod.Wrap(types.ErrUnableToUpdateTss, "cannot migrate funds when there are pending nonces") - } - err := k.MigrateTSSFundsForChain(ctx, msg.ChainId, msg.Amount, tss) - if err != nil { - return nil, errorsmod.Wrap(types.ErrUnableToUpdateTss, err.Error()) - } - return &types.MsgMigrateTssFundsResponse{}, nil -} - -func (k Keeper) MigrateTSSFundsForChain(ctx sdk.Context, chainID int64, amount sdkmath.Uint, currentTss types.TSS) error { - tssList := k.GetAllTSS(ctx) - if len(tssList) < 2 { - return errorsmod.Wrap(types.ErrCannotMigrateTss, "only one TSS found") - } - // Sort tssList by FinalizedZetaHeight - sort.SliceStable(tssList, func(i, j int) bool { - return tssList[i].FinalizedZetaHeight < tssList[j].FinalizedZetaHeight - }) - // Always migrate to the latest TSS if multiple TSS addresses have been generated - newTss := tssList[len(tssList)-1] - ethAddressOld, err := getTssAddrEVM(currentTss.TssPubkey) - if err != nil { - return err - } - btcAddressOld, err := getTssAddrBTC(currentTss.TssPubkey) - if err != nil { - return err - } - ethAddressNew, err := getTssAddrEVM(newTss.TssPubkey) - if err != nil { - return err - } - btcAddressNew, err := getTssAddrBTC(newTss.TssPubkey) - if err != nil { - return err - } - - medianGasPrice, isFound := k.GetMedianGasPriceInUint(ctx, chainID) - if !isFound { - return types.ErrUnableToGetGasPrice - } - indexString := fmt.Sprintf("%s-%s-%d-%s-%d", currentTss.TssPubkey, newTss.TssPubkey, chainID, amount.String(), ctx.BlockHeight()) - - hash := crypto.Keccak256Hash([]byte(indexString)) - index := hash.Hex() - - cctx := types.CrossChainTx{ - Creator: "", - Index: index, - ZetaFees: sdkmath.Uint{}, - RelayedMessage: fmt.Sprintf("%s:%s", common.CmdMigrateTssFunds, "Funds Migrator Admin Cmd"), - CctxStatus: &types.Status{ - Status: types.CctxStatus_PendingOutbound, - StatusMessage: "", - LastUpdateTimestamp: 0, - }, - InboundTxParams: &types.InboundTxParams{ - Sender: "", - SenderChainId: chainID, - TxOrigin: "", - CoinType: common.CoinType_Cmd, - Asset: "", - Amount: amount, - InboundTxObservedHash: tmbytes.HexBytes(tmtypes.Tx(ctx.TxBytes()).Hash()).String(), - InboundTxObservedExternalHeight: 0, - InboundTxBallotIndex: "", - InboundTxFinalizedZetaHeight: 0, - }, - OutboundTxParams: []*types.OutboundTxParams{{ - Receiver: "", - ReceiverChainId: chainID, - CoinType: common.CoinType_Cmd, - Amount: amount, - OutboundTxTssNonce: 0, - OutboundTxGasLimit: 1_000_000, - OutboundTxGasPrice: medianGasPrice.MulUint64(2).String(), - OutboundTxHash: "", - OutboundTxBallotIndex: "", - OutboundTxObservedExternalHeight: 0, - OutboundTxGasUsed: 0, - OutboundTxEffectiveGasPrice: sdkmath.Int{}, - OutboundTxEffectiveGasLimit: 0, - TssPubkey: currentTss.TssPubkey, - }}} - - if common.IsEVMChain(chainID) { - cctx.InboundTxParams.Sender = ethAddressOld.String() - cctx.GetCurrentOutTxParam().Receiver = ethAddressNew.String() - } - if common.IsBitcoinChain(chainID) { - cctx.InboundTxParams.Sender = btcAddressOld - cctx.GetCurrentOutTxParam().Receiver = btcAddressNew - } - if cctx.GetCurrentOutTxParam().Receiver == "" { - return errorsmod.Wrap(types.ErrCannotMigrateTss, fmt.Sprintf("chain %d is not supported", chainID)) - } - err = k.UpdateNonce(ctx, chainID, &cctx) - if err != nil { - return err - } - k.SetCctxAndNonceToCctxAndInTxHashToCctx(ctx, cctx) - EmitEventInboundFinalized(ctx, &cctx) - return nil -} diff --git a/x/crosschain/keeper/msg_server_add_to_intx_tracker.go b/x/crosschain/keeper/msg_server_add_to_intx_tracker.go index 3aa8644423..e079a02387 100644 --- a/x/crosschain/keeper/msg_server_add_to_intx_tracker.go +++ b/x/crosschain/keeper/msg_server_add_to_intx_tracker.go @@ -11,6 +11,7 @@ import ( observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) +// AddToInTxTracker adds a new record to the inbound transaction tracker. // TODO https://github.com/zeta-chain/node/issues/1269 func (k msgServer) AddToInTxTracker(goCtx context.Context, msg *types.MsgAddToInTxTracker) (*types.MsgAddToInTxTrackerResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) diff --git a/x/crosschain/keeper/msg_server_add_to_intx_tracker_test.go b/x/crosschain/keeper/msg_server_add_to_intx_tracker_test.go index 715635e9fe..d4102e0b17 100644 --- a/x/crosschain/keeper/msg_server_add_to_intx_tracker_test.go +++ b/x/crosschain/keeper/msg_server_add_to_intx_tracker_test.go @@ -1,6 +1,3 @@ -//go:build TESTNET -// +build TESTNET - package keeper_test import ( @@ -14,7 +11,7 @@ import ( "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/keeper" "github.com/zeta-chain/zetacore/x/crosschain/types" - observerTypes "github.com/zeta-chain/zetacore/x/observer/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) func TestMsgServer_AddToInTxTracker(t *testing.T) { @@ -41,7 +38,7 @@ func TestMsgServer_AddToInTxTracker(t *testing.T) { t.Run("fail to add proof based tracker with wrong tx hash", func(t *testing.T) { k, ctx, _, zk := keepertest.CrosschainKeeper(t) - chainID := int64(5) + chainID := getValidEthChainID(t) txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() require.NoError(t, err) setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) @@ -55,14 +52,14 @@ func TestMsgServer_AddToInTxTracker(t *testing.T) { BlockHash: block.Hash().Hex(), TxIndex: txIndex, }) - require.ErrorIs(t, types.ErrTxBodyVerificationFail, err) + require.ErrorIs(t, err, types.ErrTxBodyVerificationFail) _, found := k.GetInTxTracker(ctx, chainID, tx.Hash().Hex()) require.False(t, found) }) t.Run("fail to add proof based tracker with wrong chain id", func(t *testing.T) { k, ctx, _, zk := keepertest.CrosschainKeeper(t) - chainID := int64(5) + chainID := getValidEthChainID(t) txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() require.NoError(t, err) setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) @@ -76,14 +73,14 @@ func TestMsgServer_AddToInTxTracker(t *testing.T) { BlockHash: block.Hash().Hex(), TxIndex: txIndex, }) - require.ErrorIs(t, types.ErrTxBodyVerificationFail, err) + require.ErrorIs(t, err, observertypes.ErrSupportedChains) _, found := k.GetInTxTracker(ctx, chainID, tx.Hash().Hex()) require.False(t, found) }) t.Run("fail normal user submit without proof", func(t *testing.T) { k, ctx, _, _ := keepertest.CrosschainKeeper(t) tx_hash := "string" - chainID := int64(5) + chainID := getValidEthChainID(t) msgServer := keeper.NewMsgServerImpl(*k) _, err := msgServer.AddToInTxTracker(ctx, &types.MsgAddToInTxTracker{ Creator: sample.AccAddress(), @@ -94,7 +91,7 @@ func TestMsgServer_AddToInTxTracker(t *testing.T) { BlockHash: "", TxIndex: 0, }) - require.ErrorIs(t, observerTypes.ErrNotAuthorized, err) + require.ErrorIs(t, err, observertypes.ErrNotAuthorized) _, found := k.GetInTxTracker(ctx, chainID, tx_hash) require.False(t, found) }) @@ -103,7 +100,7 @@ func TestMsgServer_AddToInTxTracker(t *testing.T) { admin := sample.AccAddress() setAdminPolicies(ctx, zk, admin) tx_hash := "string" - chainID := int64(5) + chainID := getValidEthChainID(t) msgServer := keeper.NewMsgServerImpl(*k) _, err := msgServer.AddToInTxTracker(ctx, &types.MsgAddToInTxTracker{ Creator: admin, @@ -123,7 +120,7 @@ func TestMsgServer_AddToInTxTracker(t *testing.T) { admin := sample.AccAddress() setAdminPolicies(ctx, zk, admin) tx_hash := "string" - chainID := int64(5) + chainID := getValidEthChainID(t) msgServer := keeper.NewMsgServerImpl(*k) _, err := msgServer.AddToInTxTracker(ctx, &types.MsgAddToInTxTracker{ Creator: admin, @@ -144,7 +141,7 @@ func TestMsgServer_AddToInTxTracker(t *testing.T) { func setupVerificationParams(zk keepertest.ZetaKeepers, ctx sdk.Context, tx_index int64, chainID int64, header ethtypes.Header, headerRLP []byte, block *ethtypes.Block) { params := zk.ObserverKeeper.GetParams(ctx) - params.ObserverParams = append(params.ObserverParams, &observerTypes.ObserverParams{ + params.ObserverParams = append(params.ObserverParams, &observertypes.ObserverParams{ Chain: &common.Chain{ ChainId: chainID, ChainName: common.ChainName_goerli_testnet, @@ -161,14 +158,14 @@ func setupVerificationParams(zk keepertest.ZetaKeepers, ctx sdk.Context, tx_inde ChainId: chainID, Header: common.NewEthereumHeader(headerRLP), }) - zk.ObserverKeeper.SetCoreParams(ctx, observerTypes.CoreParamsList{CoreParams: []*observerTypes.CoreParams{ + zk.ObserverKeeper.SetCoreParams(ctx, observertypes.CoreParamsList{CoreParams: []*observertypes.CoreParams{ { ChainId: chainID, ConnectorContractAddress: block.Transactions()[tx_index].To().Hex(), }, }}) - zk.ObserverKeeper.SetCrosschainFlags(ctx, observerTypes.CrosschainFlags{ - BlockHeaderVerificationFlags: &observerTypes.BlockHeaderVerificationFlags{ + zk.ObserverKeeper.SetCrosschainFlags(ctx, observertypes.CrosschainFlags{ + BlockHeaderVerificationFlags: &observertypes.BlockHeaderVerificationFlags{ IsEthTypeChainEnabled: true, IsBtcTypeChainEnabled: false, }, diff --git a/x/crosschain/keeper/msg_server_add_to_outtx_tracker.go b/x/crosschain/keeper/msg_server_add_to_outtx_tracker.go index 3c77f829b6..fb2c5c5159 100644 --- a/x/crosschain/keeper/msg_server_add_to_outtx_tracker.go +++ b/x/crosschain/keeper/msg_server_add_to_outtx_tracker.go @@ -15,7 +15,6 @@ import ( "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" - "github.com/zeta-chain/zetacore/zetaclient/config" ) // AddToOutTxTracker adds a new record to the outbound transaction tracker. @@ -76,6 +75,7 @@ func (k msgServer) AddToOutTxTracker(goCtx context.Context, msg *types.MsgAddToO Nonce: msg.Nonce, HashList: []*types.TxHashList{&hash}, }) + ctx.Logger().Info(fmt.Sprintf("Add tracker %s: , Block Height : %d ", getOutTrackerIndex(chain.ChainId, msg.Nonce), ctx.BlockHeight())) return &types.MsgAddToOutTxTrackerResponse{}, nil } @@ -107,7 +107,13 @@ func (k msgServer) AddToOutTxTracker(goCtx context.Context, msg *types.MsgAddToO func (k Keeper) VerifyOutTxBody(ctx sdk.Context, msg *types.MsgAddToOutTxTracker, txBytes []byte) error { // get tss address - tss, err := k.GetTssAddress(ctx, &types.QueryGetTssAddressRequest{}) + var bitcoinChainID int64 + if common.IsBitcoinChain(msg.ChainId) { + bitcoinChainID = msg.ChainId + } + tss, err := k.zetaObserverKeeper.GetTssAddress(ctx, &observertypes.QueryGetTssAddressRequest{ + BitcoinChainId: bitcoinChainID, + }) if err != nil { return err } @@ -158,6 +164,9 @@ func VerifyEVMOutTxBody(msg *types.MsgAddToOutTxTracker, txBytes []byte, tssEth // VerifyBTCOutTxBody validates the SegWit sender address, nonce and chain id and tx hash // Note: 'msg' may contain fabricated information func VerifyBTCOutTxBody(msg *types.MsgAddToOutTxTracker, txBytes []byte, tssBtc string) error { + if !common.IsBitcoinChain(msg.ChainId) { + return fmt.Errorf("not a Bitcoin chain ID %d", msg.ChainId) + } tx, err := btcutil.NewTxFromBytes(txBytes) if err != nil { return err @@ -170,7 +179,14 @@ func VerifyBTCOutTxBody(msg *types.MsgAddToOutTxTracker, txBytes []byte, tssBtc if err != nil { return fmt.Errorf("failed to parse public key") } - addrP2WPKH, err := btcutil.NewAddressWitnessPubKeyHash(btcutil.Hash160(pubKey.SerializeCompressed()), config.BitconNetParams) + bitcoinNetParams, err := common.BitcoinNetParamsFromChainID(msg.ChainId) + if err != nil { + return fmt.Errorf("failed to get Bitcoin net params, error %s", err.Error()) + } + addrP2WPKH, err := btcutil.NewAddressWitnessPubKeyHash( + btcutil.Hash160(pubKey.SerializeCompressed()), + bitcoinNetParams, + ) if err != nil { return fmt.Errorf("failed to create P2WPKH address") } @@ -178,9 +194,6 @@ func VerifyBTCOutTxBody(msg *types.MsgAddToOutTxTracker, txBytes []byte, tssBtc return fmt.Errorf("sender %s is not tss address", addrP2WPKH.EncodeAddress()) } } - if common.BtcChainID() != msg.ChainId { - return fmt.Errorf("want btc chain id %d, got %d", common.BtcChainID(), msg.ChainId) - } if len(tx.MsgTx().TxOut) < 1 { return fmt.Errorf("outTx should have at least one output") } diff --git a/x/crosschain/keeper/msg_server_add_to_outtx_tracker_test.go b/x/crosschain/keeper/msg_server_add_to_outtx_tracker_test.go index 2751a62c1d..72820fcffc 100644 --- a/x/crosschain/keeper/msg_server_add_to_outtx_tracker_test.go +++ b/x/crosschain/keeper/msg_server_add_to_outtx_tracker_test.go @@ -7,6 +7,7 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/common/ethereum" @@ -14,14 +15,20 @@ import ( "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/keeper" "github.com/zeta-chain/zetacore/x/crosschain/types" + observerTypes "github.com/zeta-chain/zetacore/x/observer/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) +func getEthereumChainID() int64 { + return 5 // Goerli + +} func TestMsgServer_AddToOutTxTracker(t *testing.T) { t.Run("add tracker admin", func(t *testing.T) { k, ctx, _, zk := keepertest.CrosschainKeeper(t) admin := sample.AccAddress() setAdminPolicies(ctx, zk, admin) - chainID := int64(5) + chainID := getEthereumChainID() txIndex, block, header, headerRLP, _, tx, err := sample.Proof() require.NoError(t, err) setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) @@ -40,10 +47,50 @@ func TestMsgServer_AddToOutTxTracker(t *testing.T) { _, found := k.GetOutTxTracker(ctx, chainID, 0) require.True(t, found) }) + t.Run("unable to add tracker admin exceeding maximum allowed length of hashlist without proof", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + admin := sample.AccAddress() + setAdminPolicies(ctx, zk, admin) + chainID := getEthereumChainID() + txIndex, block, header, headerRLP, _, tx, err := sample.Proof() + require.NoError(t, err) + setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) + setupTssAndNonceToCctx(k, ctx, chainID, 0) + k.SetOutTxTracker(ctx, types.OutTxTracker{ + ChainId: chainID, + Nonce: 0, + HashList: []*types.TxHashList{ + { + TxHash: "hash1", + TxSigner: sample.AccAddress(), + Proved: false, + }, + { + TxHash: "hash2", + TxSigner: sample.AccAddress(), + Proved: false, + }, + }, + }) + msgServer := keeper.NewMsgServerImpl(*k) + _, err = msgServer.AddToOutTxTracker(ctx, &types.MsgAddToOutTxTracker{ + Creator: admin, + ChainId: chainID, + TxHash: tx.Hash().Hex(), + Proof: nil, + BlockHash: "", + TxIndex: 0, + Nonce: 0, + }) + require.NoError(t, err) + tracker, found := k.GetOutTxTracker(ctx, chainID, 0) + require.True(t, found) + require.Equal(t, 2, len(tracker.HashList)) + }) t.Run("fail add proof based tracker with wrong chainID", func(t *testing.T) { k, ctx, _, zk := keepertest.CrosschainKeeper(t) - chainID := int64(5) + chainID := getEthereumChainID() txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() require.NoError(t, err) setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) @@ -58,14 +105,14 @@ func TestMsgServer_AddToOutTxTracker(t *testing.T) { TxIndex: txIndex, Nonce: tx.Nonce(), }) - require.ErrorIs(t, types.ErrTxBodyVerificationFail, err) + require.ErrorIs(t, err, observertypes.ErrSupportedChains) _, found := k.GetOutTxTracker(ctx, chainID, tx.Nonce()) require.False(t, found) }) t.Run("fail add proof based tracker with wrong nonce", func(t *testing.T) { k, ctx, _, zk := keepertest.CrosschainKeeper(t) - chainID := int64(5) + chainID := getEthereumChainID() txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() require.NoError(t, err) setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) @@ -80,14 +127,14 @@ func TestMsgServer_AddToOutTxTracker(t *testing.T) { TxIndex: txIndex, Nonce: 1, }) - require.ErrorIs(t, types.ErrTxBodyVerificationFail, err) + require.ErrorIs(t, err, types.ErrTxBodyVerificationFail) _, found := k.GetOutTxTracker(ctx, chainID, 1) require.False(t, found) }) t.Run("fail add proof based tracker with wrong tx_hash", func(t *testing.T) { k, ctx, _, zk := keepertest.CrosschainKeeper(t) - chainID := int64(5) + chainID := getEthereumChainID() txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() require.NoError(t, err) setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) @@ -102,14 +149,14 @@ func TestMsgServer_AddToOutTxTracker(t *testing.T) { TxIndex: txIndex, Nonce: tx.Nonce(), }) - require.ErrorIs(t, types.ErrTxBodyVerificationFail, err) + require.ErrorIs(t, err, types.ErrTxBodyVerificationFail) _, found := k.GetOutTxTracker(ctx, chainID, tx.Nonce()) require.False(t, found) }) t.Run("fail proof based tracker with incorrect proof", func(t *testing.T) { k, ctx, _, zk := keepertest.CrosschainKeeper(t) - chainID := int64(5) + chainID := getEthereumChainID() txIndex, block, header, headerRLP, _, tx, err := sample.Proof() require.NoError(t, err) setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) @@ -124,13 +171,13 @@ func TestMsgServer_AddToOutTxTracker(t *testing.T) { TxIndex: txIndex, Nonce: tx.Nonce(), }) - require.ErrorIs(t, types.ErrProofVerificationFail, err) + require.ErrorIs(t, err, types.ErrProofVerificationFail) _, found := k.GetOutTxTracker(ctx, chainID, tx.Nonce()) require.False(t, found) }) t.Run("add proof based tracker with correct proof", func(t *testing.T) { k, ctx, _, zk := keepertest.CrosschainKeeper(t) - chainID := int64(5) + chainID := getEthereumChainID() txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() require.NoError(t, err) setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) @@ -149,11 +196,98 @@ func TestMsgServer_AddToOutTxTracker(t *testing.T) { _, found := k.GetOutTxTracker(ctx, chainID, tx.Nonce()) require.True(t, found) }) + t.Run("add proven txHash even if length of hashList is already 2", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + chainID := getEthereumChainID() + txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() + require.NoError(t, err) + setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) + setupTssAndNonceToCctx(k, ctx, chainID, int64(tx.Nonce())) + k.SetOutTxTracker(ctx, types.OutTxTracker{ + ChainId: chainID, + Nonce: tx.Nonce(), + HashList: []*types.TxHashList{ + { + TxHash: "hash1", + TxSigner: sample.AccAddress(), + Proved: false, + }, + { + TxHash: "hash2", + TxSigner: sample.AccAddress(), + Proved: false, + }, + }, + }) + msgServer := keeper.NewMsgServerImpl(*k) + _, err = msgServer.AddToOutTxTracker(ctx, &types.MsgAddToOutTxTracker{ + Creator: sample.AccAddress(), + ChainId: chainID, + TxHash: tx.Hash().Hex(), + Proof: proof, + BlockHash: block.Hash().Hex(), + TxIndex: txIndex, + Nonce: tx.Nonce(), + }) + require.NoError(t, err) + tracker, found := k.GetOutTxTracker(ctx, chainID, tx.Nonce()) + require.True(t, found) + require.Equal(t, 3, len(tracker.HashList)) + // Proven tracker is prepended to the list + require.True(t, tracker.HashList[0].Proved) + require.False(t, tracker.HashList[1].Proved) + require.False(t, tracker.HashList[2].Proved) + }) + t.Run("add proof for existing txHash", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + chainID := getEthereumChainID() + txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() + require.NoError(t, err) + setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) + setupTssAndNonceToCctx(k, ctx, chainID, int64(tx.Nonce())) + k.SetOutTxTracker(ctx, types.OutTxTracker{ + ChainId: chainID, + Nonce: tx.Nonce(), + HashList: []*types.TxHashList{ + { + TxHash: tx.Hash().Hex(), + TxSigner: sample.AccAddress(), + Proved: false, + }, + }, + }) + tracker, found := k.GetOutTxTracker(ctx, chainID, tx.Nonce()) + assert.True(t, found) + require.False(t, tracker.HashList[0].Proved) + msgServer := keeper.NewMsgServerImpl(*k) + _, err = msgServer.AddToOutTxTracker(ctx, &types.MsgAddToOutTxTracker{ + Creator: sample.AccAddress(), + ChainId: chainID, + TxHash: tx.Hash().Hex(), + Proof: proof, + BlockHash: block.Hash().Hex(), + TxIndex: txIndex, + Nonce: tx.Nonce(), + }) + require.NoError(t, err) + tracker, found = k.GetOutTxTracker(ctx, chainID, tx.Nonce()) + require.True(t, found) + require.Equal(t, 1, len(tracker.HashList)) + require.True(t, tracker.HashList[0].Proved) + }) } func setupTssAndNonceToCctx(k *keeper.Keeper, ctx sdk.Context, chainId, nonce int64) { - k.SetTSS(ctx, types.TSS{ - TssPubkey: "zetapub1addwnpepq28c57cvcs0a2htsem5zxr6qnlvq9mzhmm76z3jncsnzz32rclangr2g35p", + + tssPubKey := "zetapub1addwnpepq28c57cvcs0a2htsem5zxr6qnlvq9mzhmm76z3jncsnzz32rclangr2g35p" + k.GetObserverKeeper().SetTSS(ctx, observerTypes.TSS{ + TssPubkey: tssPubKey, + }) + k.SetPendingNonces(ctx, types.PendingNonces{ + Tss: tssPubKey, + NonceLow: 0, + NonceHigh: 1, + ChainId: chainId, }) cctx := types.CrossChainTx{ Creator: "any", diff --git a/x/crosschain/keeper/msg_server_gas_price_voter.go b/x/crosschain/keeper/msg_server_gas_price_voter.go new file mode 100644 index 0000000000..63f0d27795 --- /dev/null +++ b/x/crosschain/keeper/msg_server_gas_price_voter.go @@ -0,0 +1,110 @@ +package keeper + +import ( + "context" + "fmt" + "math/big" + "sort" + "strconv" + + "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/zeta-chain/zetacore/x/crosschain/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" +) + +// GasPriceVoter submits information about the connected chain's gas price at a specific block +// height. Gas price submitted by each validator is recorded separately and a +// median index is updated. +// +// Only observer validators are authorized to broadcast this message. +func (k msgServer) GasPriceVoter(goCtx context.Context, msg *types.MsgGasPriceVoter) (*types.MsgGasPriceVoterResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(msg.ChainId) + if chain == nil { + return nil, observertypes.ErrSupportedChains + } + if ok := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, chain); !ok { + return nil, observertypes.ErrNotAuthorizedPolicy + } + if chain == nil { + return nil, sdkerrors.Wrap(types.ErrUnsupportedChain, fmt.Sprintf("ChainID : %d ", msg.ChainId)) + } + + gasPrice, isFound := k.GetGasPrice(ctx, chain.ChainId) + if !isFound { + gasPrice = types.GasPrice{ + Creator: msg.Creator, + Index: strconv.FormatInt(chain.ChainId, 10), // TODO : Not needed index set at keeper + ChainId: chain.ChainId, + Prices: []uint64{msg.Price}, + BlockNums: []uint64{msg.BlockNumber}, + Signers: []string{msg.Creator}, + MedianIndex: 0, + } + } else { + signers := gasPrice.Signers + exist := false + for i, s := range signers { + if s == msg.Creator { // update existing entry + gasPrice.BlockNums[i] = msg.BlockNumber + gasPrice.Prices[i] = msg.Price + exist = true + break + } + } + if !exist { + gasPrice.Signers = append(gasPrice.Signers, msg.Creator) + gasPrice.BlockNums = append(gasPrice.BlockNums, msg.BlockNumber) + gasPrice.Prices = append(gasPrice.Prices, msg.Price) + } + // recompute the median gas price + mi := medianOfArray(gasPrice.Prices) + // #nosec G701 always positive + gasPrice.MedianIndex = uint64(mi) + } + k.SetGasPrice(ctx, gasPrice) + chainIDBigINT := big.NewInt(chain.ChainId) + + gasUsed, err := k.fungibleKeeper.SetGasPrice( + ctx, + chainIDBigINT, + math.NewUint(gasPrice.Prices[gasPrice.MedianIndex]).BigInt(), + ) + if err != nil { + return nil, err + } + + // reset the gas count + k.ResetGasMeterAndConsumeGas(ctx, gasUsed) + + return &types.MsgGasPriceVoterResponse{}, nil +} + +type indexValue struct { + Index int + Value uint64 +} + +func medianOfArray(values []uint64) int { + array := make([]indexValue, len(values)) + for i, v := range values { + array[i] = indexValue{Index: i, Value: v} + } + sort.SliceStable(array, func(i, j int) bool { + return array[i].Value < array[j].Value + }) + l := len(array) + return array[l/2].Index +} + +// ResetGasMeterAndConsumeGas reset first the gas meter consumed value to zero and set it back to the new value +// 'gasUsed' +func (k *Keeper) ResetGasMeterAndConsumeGas(ctx sdk.Context, gasUsed uint64) { + // reset the gas count + ctx.GasMeter().RefundGas(ctx.GasMeter().GasConsumed(), "reset the gas count") + ctx.GasMeter().ConsumeGas(gasUsed, "apply evm transaction") +} diff --git a/x/crosschain/keeper/msg_server_migrate_tss_funds.go b/x/crosschain/keeper/msg_server_migrate_tss_funds.go new file mode 100644 index 0000000000..c922d6f5f1 --- /dev/null +++ b/x/crosschain/keeper/msg_server_migrate_tss_funds.go @@ -0,0 +1,170 @@ +package keeper + +import ( + "context" + "fmt" + "sort" + + errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/ethereum/go-ethereum/crypto" + tmbytes "github.com/tendermint/tendermint/libs/bytes" + tmtypes "github.com/tendermint/tendermint/types" + "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/x/crosschain/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" +) + +func (k msgServer) MigrateTssFunds(goCtx context.Context, msg *types.MsgMigrateTssFunds) (*types.MsgMigrateTssFundsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + if msg.Creator != k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(observertypes.Policy_Type_group2) { + return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "Update can only be executed by the correct policy account") + } + if k.zetaObserverKeeper.IsInboundEnabled(ctx) { + return nil, errorsmod.Wrap(types.ErrCannotMigrateTssFunds, "cannot migrate funds while inbound is enabled") + } + tss, found := k.zetaObserverKeeper.GetTSS(ctx) + if !found { + return nil, errorsmod.Wrap(types.ErrCannotMigrateTssFunds, "cannot find current TSS") + } + tssHistory := k.zetaObserverKeeper.GetAllTSS(ctx) + sort.SliceStable(tssHistory, func(i, j int) bool { + return tssHistory[i].FinalizedZetaHeight < tssHistory[j].FinalizedZetaHeight + }) + if tss.TssPubkey == tssHistory[len(tssHistory)-1].TssPubkey { + return nil, errorsmod.Wrap(types.ErrCannotMigrateTssFunds, "no new tss address has been generated") + } + // This check is to deal with an edge case where the current TSS is not part of the TSS history list at all + if tss.FinalizedZetaHeight >= tssHistory[len(tssHistory)-1].FinalizedZetaHeight { + return nil, errorsmod.Wrap(types.ErrCannotMigrateTssFunds, "current tss is the latest") + } + pendingNonces, found := k.GetObserverKeeper().GetPendingNonces(ctx, tss.TssPubkey, msg.ChainId) + if !found { + return nil, errorsmod.Wrap(types.ErrCannotMigrateTssFunds, "cannot find pending nonces for chain") + } + if pendingNonces.NonceLow != pendingNonces.NonceHigh { + return nil, errorsmod.Wrap(types.ErrCannotMigrateTssFunds, "cannot migrate funds when there are pending nonces") + } + err := k.MigrateTSSFundsForChain(ctx, msg.ChainId, msg.Amount, tss, tssHistory) + if err != nil { + return nil, errorsmod.Wrap(types.ErrCannotMigrateTssFunds, err.Error()) + } + return &types.MsgMigrateTssFundsResponse{}, nil +} + +func (k Keeper) MigrateTSSFundsForChain(ctx sdk.Context, chainID int64, amount sdkmath.Uint, currentTss observertypes.TSS, tssList []observertypes.TSS) error { + // Always migrate to the latest TSS if multiple TSS addresses have been generated + newTss := tssList[len(tssList)-1] + medianGasPrice, isFound := k.GetMedianGasPriceInUint(ctx, chainID) + if !isFound { + return types.ErrUnableToGetGasPrice + } + indexString := GetIndexStringForTssMigration(currentTss.TssPubkey, newTss.TssPubkey, chainID, amount, ctx.BlockHeight()) + + hash := crypto.Keccak256Hash([]byte(indexString)) + index := hash.Hex() + cctx := types.CrossChainTx{ + Creator: "", + Index: index, + ZetaFees: sdkmath.Uint{}, + RelayedMessage: fmt.Sprintf("%s:%s", common.CmdMigrateTssFunds, "Funds Migrator Admin Cmd"), + CctxStatus: &types.Status{ + Status: types.CctxStatus_PendingOutbound, + StatusMessage: "", + LastUpdateTimestamp: 0, + }, + InboundTxParams: &types.InboundTxParams{ + Sender: "", + SenderChainId: chainID, + TxOrigin: "", + CoinType: common.CoinType_Cmd, + Asset: "", + Amount: amount, + InboundTxObservedHash: tmbytes.HexBytes(tmtypes.Tx(ctx.TxBytes()).Hash()).String(), + InboundTxObservedExternalHeight: 0, + InboundTxBallotIndex: "", + InboundTxFinalizedZetaHeight: 0, + }, + OutboundTxParams: []*types.OutboundTxParams{{ + Receiver: "", + ReceiverChainId: chainID, + CoinType: common.CoinType_Cmd, + Amount: amount, + OutboundTxTssNonce: 0, + OutboundTxGasLimit: 1_000_000, + OutboundTxGasPrice: medianGasPrice.MulUint64(2).String(), + OutboundTxHash: "", + OutboundTxBallotIndex: "", + OutboundTxObservedExternalHeight: 0, + OutboundTxGasUsed: 0, + OutboundTxEffectiveGasPrice: sdkmath.Int{}, + OutboundTxEffectiveGasLimit: 0, + TssPubkey: currentTss.TssPubkey, + }}} + // Set the sender and receiver addresses for EVM chain + if common.IsEVMChain(chainID) { + ethAddressOld, err := common.GetTssAddrEVM(currentTss.TssPubkey) + if err != nil { + return err + } + ethAddressNew, err := common.GetTssAddrEVM(newTss.TssPubkey) + if err != nil { + return err + } + cctx.InboundTxParams.Sender = ethAddressOld.String() + cctx.GetCurrentOutTxParam().Receiver = ethAddressNew.String() + } + // Set the sender and receiver addresses for Bitcoin chain + if common.IsBitcoinChain(chainID) { + bitcoinNetParams, err := common.BitcoinNetParamsFromChainID(chainID) + if err != nil { + return err + } + btcAddressOld, err := common.GetTssAddrBTC(currentTss.TssPubkey, bitcoinNetParams) + if err != nil { + return err + } + btcAddressNew, err := common.GetTssAddrBTC(newTss.TssPubkey, bitcoinNetParams) + if err != nil { + return err + } + cctx.InboundTxParams.Sender = btcAddressOld + cctx.GetCurrentOutTxParam().Receiver = btcAddressNew + } + + if cctx.GetCurrentOutTxParam().Receiver == "" { + return errorsmod.Wrap(types.ErrReceiverIsEmpty, fmt.Sprintf("chain %d is not supported", chainID)) + } + + err := k.UpdateNonce(ctx, chainID, &cctx) + if err != nil { + return err + } + // The migrate funds can be run again to update the migration cctx index if the migration fails + // This should be used after carefully calculating the amount again + existingMigrationInfo, found := k.zetaObserverKeeper.GetFundMigrator(ctx, chainID) + if found { + olderMigrationCctx, found := k.GetCrossChainTx(ctx, existingMigrationInfo.MigrationCctxIndex) + if !found { + return errorsmod.Wrapf(types.ErrCannotFindCctx, "cannot find existing migration cctx but migration info is present for chainID %d , migrator info : %s", chainID, existingMigrationInfo.String()) + } + if olderMigrationCctx.CctxStatus.Status == types.CctxStatus_PendingOutbound { + return errorsmod.Wrapf(types.ErrUnsupportedStatus, "cannot migrate funds while there are pending migrations , migrator info : %s", existingMigrationInfo.String()) + } + } + + k.SetCctxAndNonceToCctxAndInTxHashToCctx(ctx, cctx) + k.zetaObserverKeeper.SetFundMigrator(ctx, observertypes.TssFundMigratorInfo{ + ChainId: chainID, + MigrationCctxIndex: index, + }) + EmitEventInboundFinalized(ctx, &cctx) + + return nil +} + +func GetIndexStringForTssMigration(currentTssPubkey, newTssPubkey string, chainID int64, amount sdkmath.Uint, height int64) string { + return fmt.Sprintf("%s-%s-%d-%s-%d", currentTssPubkey, newTssPubkey, chainID, amount.String(), height) +} diff --git a/x/crosschain/keeper/msg_server_migrate_tss_funds_test.go b/x/crosschain/keeper/msg_server_migrate_tss_funds_test.go new file mode 100644 index 0000000000..ea272efba6 --- /dev/null +++ b/x/crosschain/keeper/msg_server_migrate_tss_funds_test.go @@ -0,0 +1,201 @@ +package keeper_test + +import ( + "testing" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/stretchr/testify/assert" + "github.com/zeta-chain/zetacore/common" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/crosschain/keeper" + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" +) + +func TestMsgServer_MigrateTssFunds(t *testing.T) { + t.Run("successfully create tss migration cctx", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + admin := sample.AccAddress() + setAdminPolicies(ctx, zk, admin) + msgServer := keeper.NewMsgServerImpl(*k) + chain := getValidEthChain(t) + amount := sdkmath.NewUint(100) + indexString, _ := setupTssMigrationParams(zk, k, ctx, *chain, amount, true, true) + _, err := msgServer.MigrateTssFunds(ctx, &crosschaintypes.MsgMigrateTssFunds{ + Creator: admin, + ChainId: chain.ChainId, + Amount: amount, + }) + assert.NoError(t, err) + hash := crypto.Keccak256Hash([]byte(indexString)) + index := hash.Hex() + _, found := k.GetCrossChainTx(ctx, index) + assert.True(t, found) + }) + t.Run("unable to migrate funds if new TSS is not created ", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + admin := sample.AccAddress() + setAdminPolicies(ctx, zk, admin) + msgServer := keeper.NewMsgServerImpl(*k) + chain := getValidEthChain(t) + amount := sdkmath.NewUint(100) + indexString, _ := setupTssMigrationParams(zk, k, ctx, *chain, amount, false, true) + _, err := msgServer.MigrateTssFunds(ctx, &crosschaintypes.MsgMigrateTssFunds{ + Creator: admin, + ChainId: chain.ChainId, + Amount: amount, + }) + assert.ErrorIs(t, err, crosschaintypes.ErrCannotMigrateTssFunds) + assert.ErrorContains(t, err, "no new tss address has been generated") + hash := crypto.Keccak256Hash([]byte(indexString)) + index := hash.Hex() + _, found := k.GetCrossChainTx(ctx, index) + assert.False(t, found) + }) + t.Run("unable to migrate funds when nonce low does not match nonce high", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + admin := sample.AccAddress() + setAdminPolicies(ctx, zk, admin) + msgServer := keeper.NewMsgServerImpl(*k) + chain := getValidEthChain(t) + amount := sdkmath.NewUint(100) + indexString, tssPubkey := setupTssMigrationParams(zk, k, ctx, *chain, amount, true, true) + k.GetObserverKeeper().SetPendingNonces(ctx, observertypes.PendingNonces{ + NonceLow: 1, + NonceHigh: 10, + ChainId: chain.ChainId, + Tss: tssPubkey, + }) + _, err := msgServer.MigrateTssFunds(ctx, &crosschaintypes.MsgMigrateTssFunds{ + Creator: admin, + ChainId: chain.ChainId, + Amount: amount, + }) + assert.ErrorIs(t, err, crosschaintypes.ErrCannotMigrateTssFunds) + assert.ErrorContains(t, err, "cannot migrate funds when there are pending nonces") + hash := crypto.Keccak256Hash([]byte(indexString)) + index := hash.Hex() + _, found := k.GetCrossChainTx(ctx, index) + assert.False(t, found) + }) + t.Run("unable to migrate funds when a pending cctx is presnt in migration info", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + admin := sample.AccAddress() + setAdminPolicies(ctx, zk, admin) + msgServer := keeper.NewMsgServerImpl(*k) + chain := getValidEthChain(t) + amount := sdkmath.NewUint(100) + indexString, tssPubkey := setupTssMigrationParams(zk, k, ctx, *chain, amount, true, true) + k.GetObserverKeeper().SetPendingNonces(ctx, observertypes.PendingNonces{ + NonceLow: 1, + NonceHigh: 1, + ChainId: chain.ChainId, + Tss: tssPubkey, + }) + existingCctx := sample.CrossChainTx(t, "sample_index") + existingCctx.CctxStatus.Status = crosschaintypes.CctxStatus_PendingOutbound + k.SetCrossChainTx(ctx, *existingCctx) + k.GetObserverKeeper().SetFundMigrator(ctx, observertypes.TssFundMigratorInfo{ + ChainId: chain.ChainId, + MigrationCctxIndex: existingCctx.Index, + }) + _, err := msgServer.MigrateTssFunds(ctx, &crosschaintypes.MsgMigrateTssFunds{ + Creator: admin, + ChainId: chain.ChainId, + Amount: amount, + }) + assert.ErrorIs(t, err, crosschaintypes.ErrCannotMigrateTssFunds) + assert.ErrorContains(t, err, "cannot migrate funds while there are pending migrations") + hash := crypto.Keccak256Hash([]byte(indexString)) + index := hash.Hex() + _, found := k.GetCrossChainTx(ctx, index) + assert.False(t, found) + _, found = k.GetCrossChainTx(ctx, existingCctx.Index) + assert.True(t, found) + }) + + t.Run("unable to migrate funds if current TSS is not present in TSSHistory and no new TSS has been generated", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + admin := sample.AccAddress() + setAdminPolicies(ctx, zk, admin) + msgServer := keeper.NewMsgServerImpl(*k) + chain := getValidEthChain(t) + amount := sdkmath.NewUint(100) + indexString, _ := setupTssMigrationParams(zk, k, ctx, *chain, amount, false, false) + currentTss, found := k.GetObserverKeeper().GetTSS(ctx) + assert.True(t, found) + newTss := sample.Tss() + newTss.FinalizedZetaHeight = currentTss.FinalizedZetaHeight - 10 + newTss.KeyGenZetaHeight = currentTss.KeyGenZetaHeight - 10 + k.GetObserverKeeper().SetTSSHistory(ctx, newTss) + _, err := msgServer.MigrateTssFunds(ctx, &crosschaintypes.MsgMigrateTssFunds{ + Creator: admin, + ChainId: chain.ChainId, + Amount: amount, + }) + assert.ErrorIs(t, err, crosschaintypes.ErrCannotMigrateTssFunds) + assert.ErrorContains(t, err, "current tss is the latest") + hash := crypto.Keccak256Hash([]byte(indexString)) + index := hash.Hex() + _, found = k.GetCrossChainTx(ctx, index) + assert.False(t, found) + }) +} +func setupTssMigrationParams( + zk keepertest.ZetaKeepers, + k *keeper.Keeper, + ctx sdk.Context, + chain common.Chain, + amount sdkmath.Uint, + setNewTss bool, + setCurrentTSS bool, +) (string, string) { + zk.ObserverKeeper.SetCrosschainFlags(ctx, observertypes.CrosschainFlags{ + IsInboundEnabled: false, + IsOutboundEnabled: true, + }) + params := zk.ObserverKeeper.GetParamsIfExists(ctx) + params.ObserverParams = append(params.ObserverParams, &observertypes.ObserverParams{ + Chain: &chain, + BallotThreshold: sdk.NewDec(0), + MinObserverDelegation: sdk.OneDec(), + IsSupported: true, + }) + zk.ObserverKeeper.SetParams(ctx, params) + currentTss := sample.Tss() + newTss := sample.Tss() + newTss.FinalizedZetaHeight = currentTss.FinalizedZetaHeight + 1 + newTss.KeyGenZetaHeight = currentTss.KeyGenZetaHeight + 1 + k.GetObserverKeeper().SetTSS(ctx, currentTss) + if setCurrentTSS { + k.GetObserverKeeper().SetTSSHistory(ctx, currentTss) + } + if setNewTss { + k.GetObserverKeeper().SetTSSHistory(ctx, newTss) + } + k.GetObserverKeeper().SetPendingNonces(ctx, observertypes.PendingNonces{ + NonceLow: 1, + NonceHigh: 1, + ChainId: chain.ChainId, + Tss: currentTss.TssPubkey, + }) + k.SetGasPrice(ctx, crosschaintypes.GasPrice{ + Creator: "", + Index: "", + ChainId: chain.ChainId, + Signers: nil, + BlockNums: nil, + Prices: []uint64{1, 1, 1}, + MedianIndex: 1, + }) + k.GetObserverKeeper().SetChainNonces(ctx, observertypes.ChainNonces{ + Index: chain.ChainName.String(), + ChainId: chain.ChainId, + Nonce: 1, + }) + indexString := keeper.GetIndexStringForTssMigration(currentTss.TssPubkey, newTss.TssPubkey, chain.ChainId, amount, ctx.BlockHeight()) + return indexString, currentTss.TssPubkey +} diff --git a/x/crosschain/keeper/msg_server_remove_out_tx_tracker.go b/x/crosschain/keeper/msg_server_remove_out_tx_tracker.go new file mode 100644 index 0000000000..8afd6197e8 --- /dev/null +++ b/x/crosschain/keeper/msg_server_remove_out_tx_tracker.go @@ -0,0 +1,21 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/x/crosschain/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" +) + +// RemoveFromOutTxTracker removes a record from the outbound transaction tracker by chain ID and nonce. +// only the admin policy account is authorized to broadcast this message. +func (k msgServer) RemoveFromOutTxTracker(goCtx context.Context, msg *types.MsgRemoveFromOutTxTracker) (*types.MsgRemoveFromOutTxTrackerResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + if msg.Creator != k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(observertypes.Policy_Type_group1) { + return &types.MsgRemoveFromOutTxTrackerResponse{}, observertypes.ErrNotAuthorizedPolicy + } + + k.RemoveOutTxTracker(ctx, msg.ChainId, msg.Nonce) + return &types.MsgRemoveFromOutTxTrackerResponse{}, nil +} diff --git a/x/crosschain/keeper/msg_tss_voter.go b/x/crosschain/keeper/msg_server_tss_voter.go similarity index 67% rename from x/crosschain/keeper/msg_tss_voter.go rename to x/crosschain/keeper/msg_server_tss_voter.go index f81f43cd7b..b15dfcabc9 100644 --- a/x/crosschain/keeper/msg_tss_voter.go +++ b/x/crosschain/keeper/msg_server_tss_voter.go @@ -10,8 +10,8 @@ import ( math2 "github.com/ethereum/go-ethereum/common/math" "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/crosschain/types" - observerKeeper "github.com/zeta-chain/zetacore/x/observer/keeper" - observerTypes "github.com/zeta-chain/zetacore/x/observer/types" + "github.com/zeta-chain/zetacore/x/observer/keeper" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) // MESSAGES @@ -35,11 +35,11 @@ func (k msgServer) CreateTSSVoter(goCtx context.Context, msg *types.MsgCreateTSS // No need to create a ballot if keygen does not exist keygen, found := k.zetaObserverKeeper.GetKeygen(ctx) if !found { - return &types.MsgCreateTSSVoterResponse{}, observerTypes.ErrKeygenNotFound + return &types.MsgCreateTSSVoterResponse{}, observertypes.ErrKeygenNotFound } // USE a separate transaction to update KEYGEN status to pending when trying to change the TSS address - if keygen.Status == observerTypes.KeygenStatus_KeyGenSuccess { - return &types.MsgCreateTSSVoterResponse{}, observerTypes.ErrKeygenCompleted + if keygen.Status == observertypes.KeygenStatus_KeyGenSuccess { + return &types.MsgCreateTSSVoterResponse{}, observertypes.ErrKeygenCompleted } index := msg.Digest() // Add votes and Set Ballot @@ -52,32 +52,32 @@ func (k msgServer) CreateTSSVoter(goCtx context.Context, msg *types.MsgCreateTSS for _, nodeAccount := range k.zetaObserverKeeper.GetAllNodeAccount(ctx) { voterList = append(voterList, nodeAccount.Operator) } - ballot = observerTypes.Ballot{ + ballot = observertypes.Ballot{ Index: "", BallotIdentifier: index, VoterList: voterList, - Votes: observerTypes.CreateVotes(len(voterList)), - ObservationType: observerTypes.ObservationType_TSSKeyGen, + Votes: observertypes.CreateVotes(len(voterList)), + ObservationType: observertypes.ObservationType_TSSKeyGen, BallotThreshold: sdk.MustNewDecFromStr("1.00"), - BallotStatus: observerTypes.BallotStatus_BallotInProgress, + BallotStatus: observertypes.BallotStatus_BallotInProgress, BallotCreationHeight: ctx.BlockHeight(), } k.zetaObserverKeeper.AddBallotToList(ctx, ballot) } var err error if msg.Status == common.ReceiveStatus_Success { - ballot, err = k.zetaObserverKeeper.AddVoteToBallot(ctx, ballot, msg.Creator, observerTypes.VoteType_SuccessObservation) + ballot, err = k.zetaObserverKeeper.AddVoteToBallot(ctx, ballot, msg.Creator, observertypes.VoteType_SuccessObservation) if err != nil { return &types.MsgCreateTSSVoterResponse{}, err } } else if msg.Status == common.ReceiveStatus_Failed { - ballot, err = k.zetaObserverKeeper.AddVoteToBallot(ctx, ballot, msg.Creator, observerTypes.VoteType_FailureObservation) + ballot, err = k.zetaObserverKeeper.AddVoteToBallot(ctx, ballot, msg.Creator, observertypes.VoteType_FailureObservation) if err != nil { return &types.MsgCreateTSSVoterResponse{}, err } } if !found { - observerKeeper.EmitEventBallotCreated(ctx, ballot, msg.TssPubkey, "Common-TSS-For-All-Chain") + keeper.EmitEventBallotCreated(ctx, ballot, msg.TssPubkey, "Common-TSS-For-All-Chain") } ballot, isFinalized := k.zetaObserverKeeper.CheckIfFinalizingVote(ctx, ballot) @@ -87,8 +87,8 @@ func (k msgServer) CreateTSSVoter(goCtx context.Context, msg *types.MsgCreateTSS } // Set TSS only on success, set Keygen either way. // Keygen block can be updated using a policy transaction if keygen fails - if ballot.BallotStatus != observerTypes.BallotStatus_BallotFinalized_FailureObservation { - tss := types.TSS{ + if ballot.BallotStatus != observertypes.BallotStatus_BallotFinalized_FailureObservation { + tss := observertypes.TSS{ TssPubkey: msg.TssPubkey, TssParticipantList: keygen.GetGranteePubkeys(), OperatorAddressList: ballot.VoterList, @@ -98,37 +98,22 @@ func (k msgServer) CreateTSSVoter(goCtx context.Context, msg *types.MsgCreateTSS // Set TSS history only, current TSS is updated via admin transaction // In Case this is the first TSS address update both current and history - tssList := k.GetAllTSS(ctx) + tssList := k.zetaObserverKeeper.GetAllTSS(ctx) if len(tssList) == 0 { - k.SetTssAndUpdateNonce(ctx, tss) + k.GetObserverKeeper().SetTssAndUpdateNonce(ctx, tss) } - k.SetTSSHistory(ctx, tss) - keygen.Status = observerTypes.KeygenStatus_KeyGenSuccess + k.zetaObserverKeeper.SetTSSHistory(ctx, tss) + keygen.Status = observertypes.KeygenStatus_KeyGenSuccess keygen.BlockNumber = ctx.BlockHeight() - } else if ballot.BallotStatus == observerTypes.BallotStatus_BallotFinalized_FailureObservation { - keygen.Status = observerTypes.KeygenStatus_KeyGenFailed + } else if ballot.BallotStatus == observertypes.BallotStatus_BallotFinalized_FailureObservation { + keygen.Status = observertypes.KeygenStatus_KeyGenFailed keygen.BlockNumber = math2.MaxInt64 } k.zetaObserverKeeper.SetKeygen(ctx, keygen) return &types.MsgCreateTSSVoterResponse{}, nil } -func (k msgServer) UpdateTssAddress(goCtx context.Context, msg *types.MsgUpdateTssAddress) (*types.MsgUpdateTssAddressResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - // TODO : Add a new policy type for updating the TSS address - if msg.Creator != k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(observerTypes.Policy_Type_group2) { - return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "Update can only be executed by the correct policy account") - } - tss, ok := k.CheckIfTssPubkeyHasBeenGenerated(ctx, msg.TssPubkey) - if !ok { - return nil, errorsmod.Wrap(types.ErrUnableToUpdateTss, "tss pubkey has not been generated") - } - k.SetTssAndUpdateNonce(ctx, tss) - - return &types.MsgUpdateTssAddressResponse{}, nil -} - // IsAuthorizedNodeAccount checks whether a signer is authorized to sign , by checking their address against the observer mapper which contains the observer list for the chain and type func (k Keeper) IsAuthorizedNodeAccount(ctx sdk.Context, address string) bool { _, found := k.zetaObserverKeeper.GetNodeAccount(ctx, address) diff --git a/x/crosschain/keeper/msg_server_update_tss.go b/x/crosschain/keeper/msg_server_update_tss.go new file mode 100644 index 0000000000..31131be47c --- /dev/null +++ b/x/crosschain/keeper/msg_server_update_tss.go @@ -0,0 +1,57 @@ +package keeper + +import ( + "context" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/zeta-chain/zetacore/x/crosschain/types" + observerTypes "github.com/zeta-chain/zetacore/x/observer/types" +) + +func (k msgServer) UpdateTssAddress(goCtx context.Context, msg *types.MsgUpdateTssAddress) (*types.MsgUpdateTssAddressResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + // TODO : Add a new policy type for updating the TSS address + if msg.Creator != k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(observerTypes.Policy_Type_group2) { + return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "Update can only be executed by the correct policy account") + } + currentTss, found := k.zetaObserverKeeper.GetTSS(ctx) + if !found { + return nil, errorsmod.Wrap(types.ErrUnableToUpdateTss, "cannot find current TSS") + } + if currentTss.TssPubkey == msg.TssPubkey { + return nil, errorsmod.Wrap(types.ErrUnableToUpdateTss, "no new tss address has been generated") + } + tss, ok := k.zetaObserverKeeper.CheckIfTssPubkeyHasBeenGenerated(ctx, msg.TssPubkey) + if !ok { + return nil, errorsmod.Wrap(types.ErrUnableToUpdateTss, "tss pubkey has not been generated") + } + + tssMigrators := k.zetaObserverKeeper.GetAllTssFundMigrators(ctx) + // Each connected chain should have its own tss migrator + if len(k.zetaObserverKeeper.GetParams(ctx).GetSupportedChains()) != len(tssMigrators) { + return nil, errorsmod.Wrap(types.ErrUnableToUpdateTss, "cannot update tss address not enough migrations have been created and completed") + } + // GetAllTssFundMigrators would return the migrators created for the current migration + // if any of the migrations is still pending we should not allow the tss address to be updated + // we can wait for all migrations to complete before updating; this includes btc and eth chains. + for _, tssMigrator := range tssMigrators { + migratorTx, found := k.GetCrossChainTx(ctx, tssMigrator.MigrationCctxIndex) + if !found { + return nil, errorsmod.Wrap(types.ErrUnableToUpdateTss, "migration cross chain tx not found") + } + if migratorTx.CctxStatus.Status != types.CctxStatus_OutboundMined { + return nil, errorsmod.Wrapf(types.ErrUnableToUpdateTss, + "cannot update tss address while there are pending migrations , current status of migration cctx : %s ", migratorTx.CctxStatus.Status.String()) + } + + } + + k.GetObserverKeeper().SetTssAndUpdateNonce(ctx, tss) + // Remove all migrators once the tss address has been updated successfully, + // A new set of migrators will be created when the next migration is triggered + k.zetaObserverKeeper.RemoveAllExistingMigrators(ctx) + + return &types.MsgUpdateTssAddressResponse{}, nil +} diff --git a/x/crosschain/keeper/msg_server_update_tss_test.go b/x/crosschain/keeper/msg_server_update_tss_test.go new file mode 100644 index 0000000000..1d735c7c4e --- /dev/null +++ b/x/crosschain/keeper/msg_server_update_tss_test.go @@ -0,0 +1,205 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/assert" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/crosschain/keeper" + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func TestMsgServer_UpdateTssAddress(t *testing.T) { + t.Run("successfully update tss address", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + admin := sample.AccAddress() + setAdminPolicies(ctx, zk, admin) + msgServer := keeper.NewMsgServerImpl(*k) + tssOld := sample.Tss() + tssNew := sample.Tss() + k.GetObserverKeeper().SetTSSHistory(ctx, tssOld) + k.GetObserverKeeper().SetTSSHistory(ctx, tssNew) + k.GetObserverKeeper().SetTSS(ctx, tssOld) + for _, chain := range k.GetObserverKeeper().GetParams(ctx).GetSupportedChains() { + index := chain.ChainName.String() + "_migration_tx_index" + k.GetObserverKeeper().SetFundMigrator(ctx, types.TssFundMigratorInfo{ + ChainId: chain.ChainId, + MigrationCctxIndex: index, + }) + cctx := sample.CrossChainTx(t, index) + cctx.CctxStatus.Status = crosschaintypes.CctxStatus_OutboundMined + k.SetCrossChainTx(ctx, *cctx) + } + assert.Equal(t, len(k.GetObserverKeeper().GetAllTssFundMigrators(ctx)), len(k.GetObserverKeeper().GetParams(ctx).GetSupportedChains())) + _, err := msgServer.UpdateTssAddress(ctx, &crosschaintypes.MsgUpdateTssAddress{ + Creator: admin, + TssPubkey: tssNew.TssPubkey, + }) + assert.NoError(t, err) + tss, found := k.GetObserverKeeper().GetTSS(ctx) + assert.True(t, found) + assert.Equal(t, tssNew, tss) + migrators := k.GetObserverKeeper().GetAllTssFundMigrators(ctx) + assert.Equal(t, 0, len(migrators)) + }) + t.Run("new tss has not been added to tss history", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + admin := sample.AccAddress() + setAdminPolicies(ctx, zk, admin) + msgServer := keeper.NewMsgServerImpl(*k) + tssOld := sample.Tss() + tssNew := sample.Tss() + k.GetObserverKeeper().SetTSSHistory(ctx, tssOld) + k.GetObserverKeeper().SetTSS(ctx, tssOld) + for _, chain := range k.GetObserverKeeper().GetParams(ctx).GetSupportedChains() { + index := chain.ChainName.String() + "_migration_tx_index" + k.GetObserverKeeper().SetFundMigrator(ctx, types.TssFundMigratorInfo{ + ChainId: chain.ChainId, + MigrationCctxIndex: index, + }) + cctx := sample.CrossChainTx(t, index) + cctx.CctxStatus.Status = crosschaintypes.CctxStatus_OutboundMined + k.SetCrossChainTx(ctx, *cctx) + } + assert.Equal(t, len(k.GetObserverKeeper().GetAllTssFundMigrators(ctx)), len(k.GetObserverKeeper().GetParams(ctx).GetSupportedChains())) + _, err := msgServer.UpdateTssAddress(ctx, &crosschaintypes.MsgUpdateTssAddress{ + Creator: admin, + TssPubkey: tssNew.TssPubkey, + }) + assert.ErrorContains(t, err, "tss pubkey has not been generated") + assert.ErrorIs(t, err, crosschaintypes.ErrUnableToUpdateTss) + tss, found := k.GetObserverKeeper().GetTSS(ctx) + assert.True(t, found) + assert.Equal(t, tssOld, tss) + assert.Equal(t, len(k.GetObserverKeeper().GetAllTssFundMigrators(ctx)), len(k.GetObserverKeeper().GetParams(ctx).GetSupportedChains())) + }) + t.Run("old tss pubkey provided", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + admin := sample.AccAddress() + setAdminPolicies(ctx, zk, admin) + msgServer := keeper.NewMsgServerImpl(*k) + tssOld := sample.Tss() + k.GetObserverKeeper().SetTSSHistory(ctx, tssOld) + k.GetObserverKeeper().SetTSS(ctx, tssOld) + for _, chain := range k.GetObserverKeeper().GetParams(ctx).GetSupportedChains() { + index := chain.ChainName.String() + "_migration_tx_index" + k.GetObserverKeeper().SetFundMigrator(ctx, types.TssFundMigratorInfo{ + ChainId: chain.ChainId, + MigrationCctxIndex: index, + }) + cctx := sample.CrossChainTx(t, index) + cctx.CctxStatus.Status = crosschaintypes.CctxStatus_OutboundMined + k.SetCrossChainTx(ctx, *cctx) + } + assert.Equal(t, len(k.GetObserverKeeper().GetAllTssFundMigrators(ctx)), len(k.GetObserverKeeper().GetParams(ctx).GetSupportedChains())) + _, err := msgServer.UpdateTssAddress(ctx, &crosschaintypes.MsgUpdateTssAddress{ + Creator: admin, + TssPubkey: tssOld.TssPubkey, + }) + assert.ErrorContains(t, err, "no new tss address has been generated") + assert.ErrorIs(t, err, crosschaintypes.ErrUnableToUpdateTss) + tss, found := k.GetObserverKeeper().GetTSS(ctx) + assert.True(t, found) + assert.Equal(t, tssOld, tss) + assert.Equal(t, len(k.GetObserverKeeper().GetAllTssFundMigrators(ctx)), len(k.GetObserverKeeper().GetParams(ctx).GetSupportedChains())) + }) + t.Run("unable to update tss when not enough migrators are present", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + admin := sample.AccAddress() + setAdminPolicies(ctx, zk, admin) + msgServer := keeper.NewMsgServerImpl(*k) + tssOld := sample.Tss() + tssNew := sample.Tss() + k.GetObserverKeeper().SetTSSHistory(ctx, tssOld) + k.GetObserverKeeper().SetTSSHistory(ctx, tssNew) + k.GetObserverKeeper().SetTSS(ctx, tssOld) + for _, chain := range k.GetObserverKeeper().GetParams(ctx).GetSupportedChains() { + index := chain.ChainName.String() + "_migration_tx_index" + k.GetObserverKeeper().SetFundMigrator(ctx, types.TssFundMigratorInfo{ + ChainId: chain.ChainId, + MigrationCctxIndex: index, + }) + cctx := sample.CrossChainTx(t, index) + cctx.CctxStatus.Status = crosschaintypes.CctxStatus_OutboundMined + k.SetCrossChainTx(ctx, *cctx) + break + } + assert.Equal(t, len(k.GetObserverKeeper().GetAllTssFundMigrators(ctx)), 1) + _, err := msgServer.UpdateTssAddress(ctx, &crosschaintypes.MsgUpdateTssAddress{ + Creator: admin, + TssPubkey: tssNew.TssPubkey, + }) + assert.ErrorContains(t, err, "cannot update tss address not enough migrations have been created and completed") + assert.ErrorIs(t, err, crosschaintypes.ErrUnableToUpdateTss) + tss, found := k.GetObserverKeeper().GetTSS(ctx) + assert.True(t, found) + assert.Equal(t, tssOld, tss) + migrators := k.GetObserverKeeper().GetAllTssFundMigrators(ctx) + assert.Equal(t, 1, len(migrators)) + }) + t.Run("unable to update tss when pending cctx is present", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + admin := sample.AccAddress() + setAdminPolicies(ctx, zk, admin) + msgServer := keeper.NewMsgServerImpl(*k) + tssOld := sample.Tss() + tssNew := sample.Tss() + k.GetObserverKeeper().SetTSSHistory(ctx, tssOld) + k.GetObserverKeeper().SetTSSHistory(ctx, tssNew) + k.GetObserverKeeper().SetTSS(ctx, tssOld) + for _, chain := range k.GetObserverKeeper().GetParams(ctx).GetSupportedChains() { + index := chain.ChainName.String() + "_migration_tx_index" + k.GetObserverKeeper().SetFundMigrator(ctx, types.TssFundMigratorInfo{ + ChainId: chain.ChainId, + MigrationCctxIndex: index, + }) + cctx := sample.CrossChainTx(t, index) + cctx.CctxStatus.Status = crosschaintypes.CctxStatus_PendingOutbound + k.SetCrossChainTx(ctx, *cctx) + } + assert.Equal(t, len(k.GetObserverKeeper().GetAllTssFundMigrators(ctx)), len(k.GetObserverKeeper().GetParams(ctx).GetSupportedChains())) + _, err := msgServer.UpdateTssAddress(ctx, &crosschaintypes.MsgUpdateTssAddress{ + Creator: admin, + TssPubkey: tssNew.TssPubkey, + }) + assert.ErrorContains(t, err, "cannot update tss address while there are pending migrations") + assert.ErrorIs(t, err, crosschaintypes.ErrUnableToUpdateTss) + tss, found := k.GetObserverKeeper().GetTSS(ctx) + assert.True(t, found) + assert.Equal(t, tssOld, tss) + migrators := k.GetObserverKeeper().GetAllTssFundMigrators(ctx) + assert.Equal(t, len(k.GetObserverKeeper().GetParams(ctx).GetSupportedChains()), len(migrators)) + }) + t.Run("unable to update tss cctx is not present", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + admin := sample.AccAddress() + setAdminPolicies(ctx, zk, admin) + msgServer := keeper.NewMsgServerImpl(*k) + tssOld := sample.Tss() + tssNew := sample.Tss() + k.GetObserverKeeper().SetTSSHistory(ctx, tssOld) + k.GetObserverKeeper().SetTSSHistory(ctx, tssNew) + k.GetObserverKeeper().SetTSS(ctx, tssOld) + for _, chain := range k.GetObserverKeeper().GetParams(ctx).GetSupportedChains() { + index := chain.ChainName.String() + "_migration_tx_index" + k.GetObserverKeeper().SetFundMigrator(ctx, types.TssFundMigratorInfo{ + ChainId: chain.ChainId, + MigrationCctxIndex: index, + }) + } + assert.Equal(t, len(k.GetObserverKeeper().GetAllTssFundMigrators(ctx)), len(k.GetObserverKeeper().GetParams(ctx).GetSupportedChains())) + _, err := msgServer.UpdateTssAddress(ctx, &crosschaintypes.MsgUpdateTssAddress{ + Creator: admin, + TssPubkey: tssNew.TssPubkey, + }) + assert.ErrorContains(t, err, "migration cross chain tx not found") + assert.ErrorIs(t, err, crosschaintypes.ErrUnableToUpdateTss) + tss, found := k.GetObserverKeeper().GetTSS(ctx) + assert.True(t, found) + assert.Equal(t, tssOld, tss) + migrators := k.GetObserverKeeper().GetAllTssFundMigrators(ctx) + assert.Equal(t, len(k.GetObserverKeeper().GetParams(ctx).GetSupportedChains()), len(migrators)) + }) +} diff --git a/x/crosschain/keeper/keeper_cross_chain_tx_vote_inbound_tx.go b/x/crosschain/keeper/msg_server_vote_inbound_tx.go similarity index 88% rename from x/crosschain/keeper/keeper_cross_chain_tx_vote_inbound_tx.go rename to x/crosschain/keeper/msg_server_vote_inbound_tx.go index d4454ba42f..dd5af15b4b 100644 --- a/x/crosschain/keeper/keeper_cross_chain_tx_vote_inbound_tx.go +++ b/x/crosschain/keeper/msg_server_vote_inbound_tx.go @@ -72,7 +72,7 @@ func (k msgServer) VoteOnObservedInboundTx(goCtx context.Context, msg *types.Msg return nil, sdkerrors.Wrap(types.ErrUnsupportedChain, fmt.Sprintf("ChainID %d, Observation %s", msg.ReceiverChain, observationType.String())) } tssPub := "" - tss, tssFound := k.GetTSS(ctx) + tss, tssFound := k.zetaObserverKeeper.GetTSS(ctx) if tssFound { tssPub = tss.TssPubkey } @@ -177,11 +177,7 @@ func (k msgServer) VoteOnObservedInboundTx(goCtx context.Context, msg *types.Msg if err != nil { return err } - err = k.UpdateNonce(tmpCtx, chain.ChainId, &cctx) - if err != nil { - return err - } - return nil + return k.UpdateNonce(tmpCtx, chain.ChainId, &cctx) }() if err != nil { // do not commit anything here as the CCTX should be aborted @@ -200,45 +196,41 @@ func (k msgServer) VoteOnObservedInboundTx(goCtx context.Context, msg *types.Msg } } - cctx.CctxStatus.ChangeStatus(types.CctxStatus_Aborted, err.Error()) + cctx.CctxStatus.ChangeStatus(types.CctxStatus_Aborted, err.Error()+" deposit revert message: "+revertMessage) return &types.MsgVoteOnObservedInboundTxResponse{}, nil } commit() cctx.CctxStatus.ChangeStatus(types.CctxStatus_PendingRevert, revertMessage) return &types.MsgVoteOnObservedInboundTxResponse{}, nil - } else { // successful HandleEVMDeposit; - commit() - cctx.CctxStatus.ChangeStatus(types.CctxStatus_OutboundMined, "Remote omnichain contract call completed") - return &types.MsgVoteOnObservedInboundTxResponse{}, nil } - } else { // Cross Chain SWAP - tmpCtx, commit := ctx.CacheContext() - err = func() error { - err := k.PayGasAndUpdateCctx( - tmpCtx, - receiverChain.ChainId, - &cctx, - cctx.InboundTxParams.Amount, - false, - ) - if err != nil { - return err - } - err = k.UpdateNonce(tmpCtx, receiverChain.ChainId, &cctx) - if err != nil { - return err - } - return nil - }() + // successful HandleEVMDeposit; + commit() + cctx.CctxStatus.ChangeStatus(types.CctxStatus_OutboundMined, "Remote omnichain contract call completed") + return &types.MsgVoteOnObservedInboundTxResponse{}, nil + } + + // Receiver is not ZetaChain: Cross Chain SWAP + tmpCtx, commit := ctx.CacheContext() + err = func() error { + err := k.PayGasAndUpdateCctx( + tmpCtx, + receiverChain.ChainId, + &cctx, + cctx.InboundTxParams.Amount, + false, + ) if err != nil { - // do not commit anything here as the CCTX should be aborted - cctx.CctxStatus.ChangeStatus(types.CctxStatus_Aborted, err.Error()) - return &types.MsgVoteOnObservedInboundTxResponse{}, nil + return err } - commit() - cctx.CctxStatus.ChangeStatus(types.CctxStatus_PendingOutbound, "") - k.RemoveInTxTrackerIfExists(ctx, cctx.InboundTxParams.SenderChainId, cctx.InboundTxParams.InboundTxObservedHash) + return k.UpdateNonce(tmpCtx, receiverChain.ChainId, &cctx) + }() + if err != nil { + // do not commit anything here as the CCTX should be aborted + cctx.CctxStatus.ChangeStatus(types.CctxStatus_Aborted, err.Error()) return &types.MsgVoteOnObservedInboundTxResponse{}, nil } + commit() + cctx.CctxStatus.ChangeStatus(types.CctxStatus_PendingOutbound, "") + return &types.MsgVoteOnObservedInboundTxResponse{}, nil } diff --git a/x/crosschain/keeper/keeper_cross_chain_tx_vote_inbound_tx_test.go b/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go similarity index 100% rename from x/crosschain/keeper/keeper_cross_chain_tx_vote_inbound_tx_test.go rename to x/crosschain/keeper/msg_server_vote_inbound_tx_test.go diff --git a/x/crosschain/keeper/keeper_cross_chain_tx_vote_outbound_tx.go b/x/crosschain/keeper/msg_server_vote_outbound_tx.go similarity index 93% rename from x/crosschain/keeper/keeper_cross_chain_tx_vote_outbound_tx.go rename to x/crosschain/keeper/msg_server_vote_outbound_tx.go index 31cf4bfcb1..e954c25967 100644 --- a/x/crosschain/keeper/keeper_cross_chain_tx_vote_outbound_tx.go +++ b/x/crosschain/keeper/msg_server_vote_outbound_tx.go @@ -107,8 +107,8 @@ func (k msgServer) VoteOnObservedOutboundTx(goCtx context.Context, msg *types.Ms return nil, err } - ballot, isFinalized := k.zetaObserverKeeper.CheckIfFinalizingVote(ctx, ballot) - if !isFinalized { + ballot, isFinalizedInThisBlock := k.zetaObserverKeeper.CheckIfFinalizingVote(ctx, ballot) + if !isFinalizedInThisBlock { // Return nil here to add vote to ballot and commit state return &types.MsgVoteOnObservedOutboundTxResponse{}, nil } @@ -135,7 +135,10 @@ func (k msgServer) VoteOnObservedOutboundTx(goCtx context.Context, msg *types.Ms ) } - tss, _ := k.GetTSS(ctx) + tss, found := k.zetaObserverKeeper.GetTSS(ctx) + if !found { + return nil, types.ErrCannotFindTSSKeys + } // FinalizeOutbound sets final status for a successful vote // FinalizeOutbound updates CCTX Prices and Nonce for a revert @@ -155,7 +158,7 @@ func (k msgServer) VoteOnObservedOutboundTx(goCtx context.Context, msg *types.Ms newStatus := cctx.CctxStatus.Status.String() EmitOutboundSuccess(tmpCtx, msg, oldStatus.String(), newStatus, cctx) case observerTypes.BallotStatus_BallotFinalized_FailureObservation: - if msg.CoinType == common.CoinType_Cmd || cctx.InboundTxParams.SenderChainId == common.ZetaChain().ChainId { + if msg.CoinType == common.CoinType_Cmd || common.IsZetaChain(cctx.InboundTxParams.SenderChainId) { // if the cctx is of coin type cmd or the sender chain is zeta chain, then we do not revert, the cctx is aborted cctx.CctxStatus.ChangeStatus(types.CctxStatus_Aborted, "") } else { @@ -210,7 +213,7 @@ func (k msgServer) VoteOnObservedOutboundTx(goCtx context.Context, msg *types.Ms cctx.CctxStatus.ChangeStatus(types.CctxStatus_Aborted, err.Error()) ctx.Logger().Error(err.Error()) // #nosec G701 always in range - k.RemoveFromPendingNonces(ctx, tss.TssPubkey, msg.OutTxChain, int64(msg.OutTxTssNonce)) + k.GetObserverKeeper().RemoveFromPendingNonces(ctx, tss.TssPubkey, msg.OutTxChain, int64(msg.OutTxTssNonce)) k.RemoveOutTxTracker(ctx, msg.OutTxChain, msg.OutTxTssNonce) k.SetCctxAndNonceToCctxAndInTxHashToCctx(ctx, cctx) return &types.MsgVoteOnObservedOutboundTxResponse{}, nil @@ -219,8 +222,9 @@ func (k msgServer) VoteOnObservedOutboundTx(goCtx context.Context, msg *types.Ms // Set the ballot index to the finalized ballot cctx.GetCurrentOutTxParam().OutboundTxBallotIndex = ballotIndex // #nosec G701 always in range - k.RemoveFromPendingNonces(ctx, tss.TssPubkey, msg.OutTxChain, int64(msg.OutTxTssNonce)) + k.GetObserverKeeper().RemoveFromPendingNonces(ctx, tss.TssPubkey, msg.OutTxChain, int64(msg.OutTxTssNonce)) k.RemoveOutTxTracker(ctx, msg.OutTxChain, msg.OutTxTssNonce) + ctx.Logger().Info(fmt.Sprintf("Remove tracker %s: , Block Height : %d ", getOutTrackerIndex(msg.OutTxChain, msg.OutTxTssNonce), ctx.BlockHeight())) k.SetCctxAndNonceToCctxAndInTxHashToCctx(ctx, cctx) return &types.MsgVoteOnObservedOutboundTxResponse{}, nil } diff --git a/x/crosschain/keeper/keeper_cross_chain_tx_vote_outbound_tx_test.go b/x/crosschain/keeper/msg_server_vote_outbound_tx_test.go similarity index 100% rename from x/crosschain/keeper/keeper_cross_chain_tx_vote_outbound_tx_test.go rename to x/crosschain/keeper/msg_server_vote_outbound_tx_test.go diff --git a/x/crosschain/keeper/msg_server_whitelist_erc20.go b/x/crosschain/keeper/msg_server_whitelist_erc20.go index 7097f8c46b..7bf72d45c7 100644 --- a/x/crosschain/keeper/msg_server_whitelist_erc20.go +++ b/x/crosschain/keeper/msg_server_whitelist_erc20.go @@ -45,7 +45,7 @@ func (k msgServer) WhitelistERC20(goCtx context.Context, msg *types.MsgWhitelist } } - tss, found := k.GetTSS(ctx) + tss, found := k.zetaObserverKeeper.GetTSS(ctx) if !found { return nil, errorsmod.Wrapf(types.ErrCannotFindTSSKeys, "Cannot create new admin cmd of type whitelistERC20") } diff --git a/x/crosschain/keeper/msg_server_whitelist_erc20_test.go b/x/crosschain/keeper/msg_server_whitelist_erc20_test.go index 7461ffc81b..93b1e3d1b6 100644 --- a/x/crosschain/keeper/msg_server_whitelist_erc20_test.go +++ b/x/crosschain/keeper/msg_server_whitelist_erc20_test.go @@ -27,7 +27,7 @@ func TestKeeper_WhitelistERC20(t *testing.T) { deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper) setupGasCoin(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper, chainID, "foobar", "FOOBAR") - k.SetTssAndUpdateNonce(ctx, *sample.Tss()) + k.GetObserverKeeper().SetTssAndUpdateNonce(ctx, sample.Tss()) k.SetGasPrice(ctx, types.GasPrice{ ChainId: chainID, MedianIndex: 0, @@ -172,7 +172,7 @@ func TestKeeper_WhitelistERC20(t *testing.T) { admin := sample.AccAddress() setAdminPolicies(ctx, zk, admin) - k.SetTssAndUpdateNonce(ctx, *sample.Tss()) + k.GetObserverKeeper().SetTssAndUpdateNonce(ctx, sample.Tss()) erc20Address := sample.EthAddress().Hex() _, err := msgServer.WhitelistERC20(ctx, &types.MsgWhitelistERC20{ diff --git a/x/crosschain/keeper/out_tx_tracker.go b/x/crosschain/keeper/out_tx_tracker.go new file mode 100644 index 0000000000..f28ef5a35b --- /dev/null +++ b/x/crosschain/keeper/out_tx_tracker.go @@ -0,0 +1,74 @@ +package keeper + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +func getOutTrackerIndex(chainID int64, nonce uint64) string { + return fmt.Sprintf("%d-%d", chainID, nonce) +} + +// SetOutTxTracker set a specific outTxTracker in the store from its index +func (k Keeper) SetOutTxTracker(ctx sdk.Context, outTxTracker types.OutTxTracker) { + outTxTracker.Index = getOutTrackerIndex(outTxTracker.ChainId, outTxTracker.Nonce) + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.OutTxTrackerKeyPrefix)) + b := k.cdc.MustMarshal(&outTxTracker) + store.Set(types.OutTxTrackerKey( + outTxTracker.Index, + ), b) +} + +// GetOutTxTracker returns a outTxTracker from its index +func (k Keeper) GetOutTxTracker( + ctx sdk.Context, + chainID int64, + nonce uint64, + +) (val types.OutTxTracker, found bool) { + index := getOutTrackerIndex(chainID, nonce) + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.OutTxTrackerKeyPrefix)) + + b := store.Get(types.OutTxTrackerKey( + index, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// RemoveOutTxTracker removes a outTxTracker from the store +func (k Keeper) RemoveOutTxTracker( + ctx sdk.Context, + chainID int64, + nonce uint64, + +) { + index := getOutTrackerIndex(chainID, nonce) + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.OutTxTrackerKeyPrefix)) + store.Delete(types.OutTxTrackerKey( + index, + )) +} + +// GetAllOutTxTracker returns all outTxTracker +func (k Keeper) GetAllOutTxTracker(ctx sdk.Context) (list []types.OutTxTracker) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.OutTxTrackerKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.OutTxTracker + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/crosschain/keeper/out_tx_tracker_test.go b/x/crosschain/keeper/out_tx_tracker_test.go new file mode 100644 index 0000000000..4b849b4c3d --- /dev/null +++ b/x/crosschain/keeper/out_tx_tracker_test.go @@ -0,0 +1,66 @@ +package keeper_test + +import ( + "fmt" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/nullify" + "github.com/zeta-chain/zetacore/x/crosschain/keeper" + "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +// Keeper Tests +func createNOutTxTracker(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.OutTxTracker { + items := make([]types.OutTxTracker, n) + for i := range items { + items[i].ChainId = int64(i) + items[i].Nonce = uint64(i) + items[i].Index = fmt.Sprintf("%d-%d", items[i].ChainId, items[i].Nonce) + + keeper.SetOutTxTracker(ctx, items[i]) + } + return items +} + +func TestOutTxTrackerGet(t *testing.T) { + keeper, ctx, _, _ := keepertest.CrosschainKeeper(t) + items := createNOutTxTracker(keeper, ctx, 10) + for _, item := range items { + rst, found := keeper.GetOutTxTracker(ctx, + item.ChainId, + item.Nonce, + ) + require.True(t, found) + require.Equal(t, + nullify.Fill(&item), + nullify.Fill(&rst), + ) + } +} +func TestOutTxTrackerRemove(t *testing.T) { + k, ctx, _, _ := keepertest.CrosschainKeeper(t) + items := createNOutTxTracker(k, ctx, 10) + for _, item := range items { + k.RemoveOutTxTracker(ctx, + item.ChainId, + item.Nonce, + ) + _, found := k.GetOutTxTracker(ctx, + item.ChainId, + item.Nonce, + ) + require.False(t, found) + } +} + +func TestOutTxTrackerGetAll(t *testing.T) { + keeper, ctx, _, _ := keepertest.CrosschainKeeper(t) + items := createNOutTxTracker(keeper, ctx, 10) + require.ElementsMatch(t, + nullify.Fill(items), + nullify.Fill(keeper.GetAllOutTxTracker(ctx)), + ) +} diff --git a/x/crosschain/keeper/keeper_params.go b/x/crosschain/keeper/params.go similarity index 100% rename from x/crosschain/keeper/keeper_params.go rename to x/crosschain/keeper/params.go diff --git a/x/crosschain/keeper/test_privnet.go b/x/crosschain/keeper/test_privnet.go deleted file mode 100644 index a9a96a2586..0000000000 --- a/x/crosschain/keeper/test_privnet.go +++ /dev/null @@ -1,24 +0,0 @@ -//go:build PRIVNET -// +build PRIVNET - -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/x/crosschain/types" - zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types" -) - -func (k Keeper) TestWhitelistERC20(ctx sdk.Context) error { - goCtx := sdk.UnwrapSDKContext(ctx) - creator := k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_group1) - msg := types.NewMsgWhitelistERC20(creator, types.ModuleAddressEVM.Hex(), common.GoerliChain().ChainId, "test", "testerc20", 17, 90_000) - - msgServer := NewMsgServerImpl(k) - _, err := msgServer.WhitelistERC20(goCtx, msg) - if err != nil { - panic(err) - } - return nil -} diff --git a/x/crosschain/keeper/test_testnet.go b/x/crosschain/keeper/test_testnet.go deleted file mode 100644 index 7a3a7375b8..0000000000 --- a/x/crosschain/keeper/test_testnet.go +++ /dev/null @@ -1,12 +0,0 @@ -//go:build !PRIVNET -// +build !PRIVNET - -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func (k Keeper) TestWhitelistERC20(_ sdk.Context) error { - return nil -} diff --git a/x/crosschain/keeper/verify_proof.go b/x/crosschain/keeper/verify_proof.go index c80a600078..34e03ae3ff 100644 --- a/x/crosschain/keeper/verify_proof.go +++ b/x/crosschain/keeper/verify_proof.go @@ -9,6 +9,7 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/crosschain/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) func (k Keeper) VerifyProof(ctx sdk.Context, proof *common.Proof, chainID int64, blockHash string, txIndex int64) ([]byte, error) { @@ -86,7 +87,9 @@ func (k Keeper) VerifyEVMInTxBody(ctx sdk.Context, msg *types.MsgAddToInTxTracke } return nil case common.CoinType_Gas: - tss, err := k.GetTssAddress(ctx, &types.QueryGetTssAddressRequest{}) + tss, err := k.zetaObserverKeeper.GetTssAddress(ctx, &observertypes.QueryGetTssAddressRequest{ + BitcoinChainId: msg.ChainId, + }) if err != nil { return err } diff --git a/x/crosschain/keeper/zeta_accounting.go b/x/crosschain/keeper/zeta_accounting.go new file mode 100644 index 0000000000..ee3184b5e3 --- /dev/null +++ b/x/crosschain/keeper/zeta_accounting.go @@ -0,0 +1,35 @@ +package keeper + +import ( + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +func (k Keeper) SetZetaAccounting(ctx sdk.Context, abortedZetaAmount types.ZetaAccounting) { + store := ctx.KVStore(k.storeKey) + b := k.cdc.MustMarshal(&abortedZetaAmount) + store.Set([]byte(types.ZetaAccountingKey), b) +} + +func (k Keeper) GetZetaAccounting(ctx sdk.Context) (val types.ZetaAccounting, found bool) { + store := ctx.KVStore(k.storeKey) + b := store.Get([]byte(types.ZetaAccountingKey)) + if b == nil { + return val, false + } + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +func (k Keeper) AddZetaAbortedAmount(ctx sdk.Context, amount sdkmath.Uint) { + zetaAccounting, found := k.GetZetaAccounting(ctx) + if !found { + zetaAccounting = types.ZetaAccounting{ + AbortedZetaAmount: amount, + } + } else { + zetaAccounting.AbortedZetaAmount = zetaAccounting.AbortedZetaAmount.Add(amount) + } + k.SetZetaAccounting(ctx, zetaAccounting) +} diff --git a/x/crosschain/keeper/zeta_accounting_test.go b/x/crosschain/keeper/zeta_accounting_test.go new file mode 100644 index 0000000000..1d5e1f7921 --- /dev/null +++ b/x/crosschain/keeper/zeta_accounting_test.go @@ -0,0 +1,49 @@ +package keeper_test + +import ( + "math/rand" + "testing" + + sdkmath "cosmossdk.io/math" + "github.com/stretchr/testify/require" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +func TestKeeper_AddZetaAccounting(t *testing.T) { + + t.Run("should add aborted zeta amount", func(t *testing.T) { + k, ctx, _, _ := keepertest.CrosschainKeeper(t) + originalAmount := sdkmath.NewUint(rand.Uint64()) + k.SetZetaAccounting(ctx, types.ZetaAccounting{ + AbortedZetaAmount: originalAmount, + }) + val, found := k.GetZetaAccounting(ctx) + require.True(t, found) + require.Equal(t, originalAmount, val.AbortedZetaAmount) + addAmount := sdkmath.NewUint(rand.Uint64()) + k.AddZetaAbortedAmount(ctx, addAmount) + val, found = k.GetZetaAccounting(ctx) + require.True(t, found) + require.Equal(t, originalAmount.Add(addAmount), val.AbortedZetaAmount) + }) + + t.Run("cant find aborted amount", func(t *testing.T) { + k, ctx, _, _ := keepertest.CrosschainKeeper(t) + val, found := k.GetZetaAccounting(ctx) + require.False(t, found) + require.Equal(t, types.ZetaAccounting{}, val) + }) + + t.Run("add very high zeta amount", func(t *testing.T) { + k, ctx, _, _ := keepertest.CrosschainKeeper(t) + highAmount := sdkmath.NewUintFromString("100000000000000000000000000000000000000000000000") + k.SetZetaAccounting(ctx, types.ZetaAccounting{ + AbortedZetaAmount: highAmount, + }) + val, found := k.GetZetaAccounting(ctx) + require.True(t, found) + require.Equal(t, highAmount, val.AbortedZetaAmount) + }) + +} diff --git a/x/crosschain/migrations/v3/migrate.go b/x/crosschain/migrations/v3/migrate.go index 34f19a3c8b..37b04ed324 100644 --- a/x/crosschain/migrations/v3/migrate.go +++ b/x/crosschain/migrations/v3/migrate.go @@ -9,11 +9,10 @@ import ( storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/zeta-chain/zetacore/x/crosschain/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) -// MigrateStore migrates the x/crosschain module state from the consensus version 1 to 2 -// This migration moves some data from the cross chain store to the observer store. -// The data moved is the node accounts, permission flags and keygen. +// MigrateStore adds a new TSSHistory store to crosschain module func MigrateStore( ctx sdk.Context, crossChainStoreKey storetypes.StoreKey, @@ -21,8 +20,8 @@ func MigrateStore( ) error { // Fetch existing TSS - existingTss := types.TSS{} - store := prefix.NewStore(ctx.KVStore(crossChainStoreKey), types.KeyPrefix(types.TSSKey)) + existingTss := observertypes.TSS{} + store := prefix.NewStore(ctx.KVStore(crossChainStoreKey), types.KeyPrefix(observertypes.TSSKey)) b := store.Get([]byte{0}) if b == nil { return errors.New("TSS not found") @@ -30,7 +29,7 @@ func MigrateStore( // Add existing TSS to TSSHistory store cdc.MustUnmarshal(b, &existingTss) - store = prefix.NewStore(ctx.KVStore(crossChainStoreKey), types.KeyPrefix(types.TSSHistoryKey)) + store = prefix.NewStore(ctx.KVStore(crossChainStoreKey), types.KeyPrefix(observertypes.TSSHistoryKey)) b = cdc.MustMarshal(&existingTss) store.Set(types.KeyPrefix(fmt.Sprintf("%d", existingTss.FinalizedZetaHeight)), b) diff --git a/x/crosschain/migrations/v4/migrate.go b/x/crosschain/migrations/v4/migrate.go new file mode 100644 index 0000000000..90ba70ddb0 --- /dev/null +++ b/x/crosschain/migrations/v4/migrate.go @@ -0,0 +1,161 @@ +package v4 + +import ( + "fmt" + + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/store/prefix" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/x/crosschain/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" +) + +// MigrateStore migrates the x/crosschain module state from the consensus version 3 to 4 +// It initializes the aborted zeta amount to 0 +func MigrateStore( + ctx sdk.Context, + observerKeeper types.ZetaObserverKeeper, + crossChainStoreKey storetypes.StoreKey, + cdc codec.BinaryCodec, +) error { + SetZetaAccounting(ctx, crossChainStoreKey, cdc) + MoveTssToObserverModule(ctx, observerKeeper, crossChainStoreKey, cdc) + MoveNonceToObserverModule(ctx, observerKeeper, crossChainStoreKey, cdc) + return nil +} + +func SetZetaAccounting( + ctx sdk.Context, + crossChainStoreKey storetypes.StoreKey, + cdc codec.BinaryCodec) { + p := types.KeyPrefix(fmt.Sprintf("%s", types.SendKey)) + prefixedStore := prefix.NewStore(ctx.KVStore(crossChainStoreKey), p) + abortedAmountZeta := sdkmath.ZeroUint() + iterator := sdk.KVStorePrefixIterator(prefixedStore, []byte{}) + defer func(iterator sdk.Iterator) { + err := iterator.Close() + if err != nil { + panic(err) + } + }(iterator) + for ; iterator.Valid(); iterator.Next() { + var val types.CrossChainTx + cdc.MustUnmarshal(iterator.Value(), &val) + if val.CctxStatus.Status == types.CctxStatus_Aborted && val.GetCurrentOutTxParam().CoinType == common.CoinType_Zeta { + abortedAmountZeta = abortedAmountZeta.Add(val.GetCurrentOutTxParam().Amount) + } + } + b := cdc.MustMarshal(&types.ZetaAccounting{ + AbortedZetaAmount: abortedAmountZeta, + }) + store := ctx.KVStore(crossChainStoreKey) + store.Set([]byte(types.ZetaAccountingKey), b) +} + +func MoveNonceToObserverModule( + ctx sdk.Context, + observerKeeper types.ZetaObserverKeeper, + crossChainStoreKey storetypes.StoreKey, + cdc codec.BinaryCodec, +) { + var chainNonces []observertypes.ChainNonces + var pendingNonces []observertypes.PendingNonces + var nonceToCcTx []observertypes.NonceToCctx + store := prefix.NewStore(ctx.KVStore(crossChainStoreKey), types.KeyPrefix(observertypes.ChainNoncesKey)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + defer func(iterator sdk.Iterator) { + err := iterator.Close() + if err != nil { + return + } + }(iterator) + for ; iterator.Valid(); iterator.Next() { + var val observertypes.ChainNonces + err := cdc.Unmarshal(iterator.Value(), &val) + if err == nil { + chainNonces = append(chainNonces, val) + } + } + store = prefix.NewStore(ctx.KVStore(crossChainStoreKey), types.KeyPrefix(observertypes.PendingNoncesKeyPrefix)) + iterator = sdk.KVStorePrefixIterator(store, []byte{}) + defer func(iterator sdk.Iterator) { + err := iterator.Close() + if err != nil { + return + } + }(iterator) + for ; iterator.Valid(); iterator.Next() { + var val observertypes.PendingNonces + err := cdc.Unmarshal(iterator.Value(), &val) + if err == nil { + pendingNonces = append(pendingNonces, val) + } + } + store = prefix.NewStore(ctx.KVStore(crossChainStoreKey), types.KeyPrefix(observertypes.NonceToCctxKeyPrefix)) + iterator = sdk.KVStorePrefixIterator(store, []byte{}) + defer func(iterator sdk.Iterator) { + err := iterator.Close() + if err != nil { + return + } + }(iterator) + for ; iterator.Valid(); iterator.Next() { + var val observertypes.NonceToCctx + err := cdc.Unmarshal(iterator.Value(), &val) + if err == nil { + nonceToCcTx = append(nonceToCcTx, val) + } + } + for _, c := range chainNonces { + observerKeeper.SetChainNonces(ctx, c) + } + for _, p := range pendingNonces { + observerKeeper.SetPendingNonces(ctx, p) + } + for _, n := range nonceToCcTx { + observerKeeper.SetNonceToCctx(ctx, n) + } + +} + +func MoveTssToObserverModule(ctx sdk.Context, + observerKeeper types.ZetaObserverKeeper, + crossChainStoreKey storetypes.StoreKey, + cdc codec.BinaryCodec) { + // Using New Types from observer module as the structure is the same + var tss observertypes.TSS + var tssHistory []observertypes.TSS + + writeTss := false + + // Fetch data from cross chain store using the legacy keys directly + store := prefix.NewStore(ctx.KVStore(crossChainStoreKey), types.KeyPrefix(observertypes.TSSKey)) + b := store.Get([]byte{0}) + if b != nil { + err := cdc.Unmarshal(b, &tss) + if err == nil { + writeTss = true + } + } + + store = prefix.NewStore(ctx.KVStore(crossChainStoreKey), types.KeyPrefix(observertypes.TSSHistoryKey)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + var val observertypes.TSS + err := cdc.Unmarshal(iterator.Value(), &val) + if err == nil { + tssHistory = append(tssHistory, val) + } + } + + for _, t := range tssHistory { + observerKeeper.SetTSSHistory(ctx, t) + } + if writeTss { + observerKeeper.SetTSS(ctx, tss) + } +} diff --git a/x/crosschain/migrations/v4/migrate_test.go b/x/crosschain/migrations/v4/migrate_test.go new file mode 100644 index 0000000000..eb119873e1 --- /dev/null +++ b/x/crosschain/migrations/v4/migrate_test.go @@ -0,0 +1,110 @@ +package v4_test + +import ( + "fmt" + "math/rand" + "sort" + "testing" + + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/assert" + "github.com/zeta-chain/zetacore/common" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/crosschain/keeper" + v4 "github.com/zeta-chain/zetacore/x/crosschain/migrations/v4" + "github.com/zeta-chain/zetacore/x/crosschain/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" +) + +func TestMigrateStore(t *testing.T) { + t.Run("test migrate store add zeta accounting", func(t *testing.T) { + k, ctx, _, _ := keepertest.CrosschainKeeper(t) + amountZeta := SetRandomCctx(ctx, *k) + err := v4.MigrateStore(ctx, k.GetObserverKeeper(), k.GetStoreKey(), k.GetCodec()) + assert.NoError(t, err) + zetaAccounting, found := k.GetZetaAccounting(ctx) + assert.True(t, found) + assert.Equal(t, amountZeta, zetaAccounting.AbortedZetaAmount) + }) + t.Run("test migrate store move tss from cross chain to observer", func(t *testing.T) { + k, ctx, _, zk := keepertest.CrosschainKeeper(t) + tss1 := sample.Tss() + tss2 := sample.Tss() + tss2.FinalizedZetaHeight = tss2.FinalizedZetaHeight + 10 + tss1Bytes := k.GetCodec().MustMarshal(&tss1) + tss2Bytes := k.GetCodec().MustMarshal(&tss2) + + store := prefix.NewStore(ctx.KVStore(k.GetStoreKey()), observertypes.KeyPrefix(observertypes.TSSKey)) + store.Set([]byte{0}, tss1Bytes) + + store = prefix.NewStore(ctx.KVStore(k.GetStoreKey()), observertypes.KeyPrefix(observertypes.TSSHistoryKey)) + store.Set(observertypes.KeyPrefix(fmt.Sprintf("%d", tss1.FinalizedZetaHeight)), tss1Bytes) + store.Set(observertypes.KeyPrefix(fmt.Sprintf("%d", tss2.FinalizedZetaHeight)), tss2Bytes) + + err := v4.MigrateStore(ctx, k.GetObserverKeeper(), k.GetStoreKey(), k.GetCodec()) + assert.NoError(t, err) + + tss, found := zk.ObserverKeeper.GetTSS(ctx) + assert.True(t, found) + assert.Equal(t, tss1, tss) + tssHistory := k.GetObserverKeeper().GetAllTSS(ctx) + assert.Equal(t, 2, len(tssHistory)) + assert.Equal(t, tss1, tssHistory[0]) + assert.Equal(t, tss2, tssHistory[1]) + }) + t.Run("test migrate store move nonce from cross chain to observer", func(t *testing.T) { + k, ctx, _, _ := keepertest.CrosschainKeeper(t) + chainNonces := sample.ChainNoncesList(t, 10) + pendingNonces := sample.PendingNoncesList(t, "sample", 10) + nonceToCctxList := sample.NonceToCctxList(t, "sample", 10) + store := prefix.NewStore(ctx.KVStore(k.GetStoreKey()), types.KeyPrefix(observertypes.ChainNoncesKey)) + for _, nonce := range chainNonces { + store.Set([]byte(nonce.Index), k.GetCodec().MustMarshal(&nonce)) + } + store = prefix.NewStore(ctx.KVStore(k.GetStoreKey()), types.KeyPrefix(observertypes.PendingNoncesKeyPrefix)) + for _, nonce := range pendingNonces { + store.Set(types.KeyPrefix(fmt.Sprintf("%s-%d", nonce.Tss, nonce.ChainId)), k.GetCodec().MustMarshal(&nonce)) + } + store = prefix.NewStore(ctx.KVStore(k.GetStoreKey()), types.KeyPrefix(observertypes.NonceToCctxKeyPrefix)) + for _, nonce := range nonceToCctxList { + store.Set(types.KeyPrefix(fmt.Sprintf("%s-%d-%d", nonce.Tss, nonce.ChainId, nonce.Nonce)), k.GetCodec().MustMarshal(&nonce)) + } + err := v4.MigrateStore(ctx, k.GetObserverKeeper(), k.GetStoreKey(), k.GetCodec()) + assert.NoError(t, err) + pn, err := k.GetObserverKeeper().GetAllPendingNonces(ctx) + assert.NoError(t, err) + sort.Slice(pn, func(i, j int) bool { + return pn[i].ChainId < pn[j].ChainId + }) + sort.Slice(pendingNonces, func(i, j int) bool { + return pendingNonces[i].ChainId < pendingNonces[j].ChainId + }) + assert.Equal(t, pendingNonces, pn) + assert.Equal(t, chainNonces, k.GetObserverKeeper().GetAllChainNonces(ctx)) + assert.Equal(t, nonceToCctxList, k.GetObserverKeeper().GetAllNonceToCctx(ctx)) + + }) +} + +func SetRandomCctx(ctx sdk.Context, k keeper.Keeper) sdkmath.Uint { + totalZeta := sdkmath.ZeroUint() + + i := 0 + r := rand.New(rand.NewSource(9)) + for ; i < 10; i++ { + amount := sdkmath.NewUint(uint64(r.Uint32())) + k.SetCrossChainTx(ctx, types.CrossChainTx{ + Index: fmt.Sprintf("%d", i), + CctxStatus: &types.Status{Status: types.CctxStatus_Aborted}, + OutboundTxParams: []*types.OutboundTxParams{{ + Amount: amount, + CoinType: common.CoinType_Zeta, + }}, + }) + totalZeta = totalZeta.Add(amount) + } + return totalZeta +} diff --git a/x/crosschain/module.go b/x/crosschain/module.go index 4be40efde9..a0177cd11e 100644 --- a/x/crosschain/module.go +++ b/x/crosschain/module.go @@ -154,6 +154,9 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { if err := cfg.RegisterMigration(types.ModuleName, 2, m.Migrate2to3); err != nil { panic(err) } + if err := cfg.RegisterMigration(types.ModuleName, 3, m.Migrate3to4); err != nil { + panic(err) + } } // RegisterInvariants registers the crosschain module's invariants. @@ -181,17 +184,10 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 3 } +func (AppModule) ConsensusVersion() uint64 { return 4 } // BeginBlock executes all ABCI BeginBlock logic respective to the crosschain module. func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { - if ctx.BlockHeight() == 200 { - err := am.keeper.TestWhitelistERC20(ctx) - if err != nil { - panic(err) - } - } - err := am.keeper.IterateAndUpdateCctxGasPrice(ctx) if err != nil { ctx.Logger().Error("Error iterating and updating pending cctx gas price", "err", err.Error()) diff --git a/x/crosschain/types/cctx_utils.go b/x/crosschain/types/cctx_utils.go index d15fe58970..bf3357c709 100644 --- a/x/crosschain/types/cctx_utils.go +++ b/x/crosschain/types/cctx_utils.go @@ -36,14 +36,11 @@ func (m CrossChainTx) OriginalDestinationChainID() int64 { // GetAllAuthzZetaclientTxTypes returns all the authz types for zetaclient func GetAllAuthzZetaclientTxTypes() []string { return []string{ - sdk.MsgTypeURL(&MsgNonceVoter{}), sdk.MsgTypeURL(&MsgGasPriceVoter{}), sdk.MsgTypeURL(&MsgVoteOnObservedInboundTx{}), sdk.MsgTypeURL(&MsgVoteOnObservedOutboundTx{}), - sdk.MsgTypeURL(&MsgSetNodeKeys{}), sdk.MsgTypeURL(&MsgCreateTSSVoter{}), sdk.MsgTypeURL(&MsgAddToOutTxTracker{}), - sdk.MsgTypeURL(&MsgSetNodeKeys{}), sdk.MsgTypeURL(&observertypes.MsgAddBlameVote{}), sdk.MsgTypeURL(&observertypes.MsgAddBlockHeader{}), } diff --git a/x/crosschain/types/codec.go b/x/crosschain/types/codec.go index 02c0e849ea..c85eb7f8ea 100644 --- a/x/crosschain/types/codec.go +++ b/x/crosschain/types/codec.go @@ -13,13 +13,11 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgRemoveFromOutTxTracker{}, "crosschain/RemoveFromOutTxTracker", nil) cdc.RegisterConcrete(&MsgCreateTSSVoter{}, "crosschain/CreateTSSVoter", nil) cdc.RegisterConcrete(&MsgGasPriceVoter{}, "crosschain/GasPriceVoter", nil) - cdc.RegisterConcrete(&MsgNonceVoter{}, "crosschain/NonceVoter", nil) cdc.RegisterConcrete(&MsgVoteOnObservedOutboundTx{}, "crosschain/VoteOnObservedOutboundTx", nil) cdc.RegisterConcrete(&MsgVoteOnObservedInboundTx{}, "crosschain/VoteOnObservedInboundTx", nil) cdc.RegisterConcrete(&MsgWhitelistERC20{}, "crosschain/WhitelistERC20", nil) cdc.RegisterConcrete(&MsgMigrateTssFunds{}, "crosschain/MigrateTssFunds", nil) cdc.RegisterConcrete(&MsgUpdateTssAddress{}, "crosschain/UpdateTssAddress", nil) - cdc.RegisterConcrete(&MsgSetNodeKeys{}, "crosschain/SetNodeKeys", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { @@ -29,13 +27,11 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgRemoveFromOutTxTracker{}, &MsgCreateTSSVoter{}, &MsgGasPriceVoter{}, - &MsgNonceVoter{}, &MsgVoteOnObservedOutboundTx{}, &MsgVoteOnObservedInboundTx{}, &MsgWhitelistERC20{}, &MsgMigrateTssFunds{}, &MsgUpdateTssAddress{}, - &MsgSetNodeKeys{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/crosschain/types/cross_chain_tx.pb.go b/x/crosschain/types/cross_chain_tx.pb.go index 1b09cbe090..fbcfff0e36 100644 --- a/x/crosschain/types/cross_chain_tx.pb.go +++ b/x/crosschain/types/cross_chain_tx.pb.go @@ -172,6 +172,44 @@ func (m *InboundTxParams) GetInboundTxFinalizedZetaHeight() uint64 { return 0 } +type ZetaAccounting struct { + // aborted_zeta_amount stores the total aborted amount for cctx of coin-type ZETA + AbortedZetaAmount github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,1,opt,name=aborted_zeta_amount,json=abortedZetaAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"aborted_zeta_amount"` +} + +func (m *ZetaAccounting) Reset() { *m = ZetaAccounting{} } +func (m *ZetaAccounting) String() string { return proto.CompactTextString(m) } +func (*ZetaAccounting) ProtoMessage() {} +func (*ZetaAccounting) Descriptor() ([]byte, []int) { + return fileDescriptor_af3a0ad055343c21, []int{1} +} +func (m *ZetaAccounting) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ZetaAccounting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ZetaAccounting.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 *ZetaAccounting) XXX_Merge(src proto.Message) { + xxx_messageInfo_ZetaAccounting.Merge(m, src) +} +func (m *ZetaAccounting) XXX_Size() int { + return m.Size() +} +func (m *ZetaAccounting) XXX_DiscardUnknown() { + xxx_messageInfo_ZetaAccounting.DiscardUnknown(m) +} + +var xxx_messageInfo_ZetaAccounting proto.InternalMessageInfo + type OutboundTxParams struct { Receiver string `protobuf:"bytes,1,opt,name=receiver,proto3" json:"receiver,omitempty"` ReceiverChainId int64 `protobuf:"varint,2,opt,name=receiver_chainId,json=receiverChainId,proto3" json:"receiver_chainId,omitempty"` @@ -195,7 +233,7 @@ func (m *OutboundTxParams) Reset() { *m = OutboundTxParams{} } func (m *OutboundTxParams) String() string { return proto.CompactTextString(m) } func (*OutboundTxParams) ProtoMessage() {} func (*OutboundTxParams) Descriptor() ([]byte, []int) { - return fileDescriptor_af3a0ad055343c21, []int{1} + return fileDescriptor_af3a0ad055343c21, []int{2} } func (m *OutboundTxParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -318,7 +356,7 @@ func (m *Status) Reset() { *m = Status{} } func (m *Status) String() string { return proto.CompactTextString(m) } func (*Status) ProtoMessage() {} func (*Status) Descriptor() ([]byte, []int) { - return fileDescriptor_af3a0ad055343c21, []int{2} + return fileDescriptor_af3a0ad055343c21, []int{3} } func (m *Status) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -382,7 +420,7 @@ func (m *CrossChainTx) Reset() { *m = CrossChainTx{} } func (m *CrossChainTx) String() string { return proto.CompactTextString(m) } func (*CrossChainTx) ProtoMessage() {} func (*CrossChainTx) Descriptor() ([]byte, []int) { - return fileDescriptor_af3a0ad055343c21, []int{3} + return fileDescriptor_af3a0ad055343c21, []int{4} } func (m *CrossChainTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -456,6 +494,7 @@ func (m *CrossChainTx) GetOutboundTxParams() []*OutboundTxParams { func init() { proto.RegisterEnum("zetachain.zetacore.crosschain.CctxStatus", CctxStatus_name, CctxStatus_value) proto.RegisterType((*InboundTxParams)(nil), "zetachain.zetacore.crosschain.InboundTxParams") + proto.RegisterType((*ZetaAccounting)(nil), "zetachain.zetacore.crosschain.ZetaAccounting") proto.RegisterType((*OutboundTxParams)(nil), "zetachain.zetacore.crosschain.OutboundTxParams") proto.RegisterType((*Status)(nil), "zetachain.zetacore.crosschain.Status") proto.RegisterType((*CrossChainTx)(nil), "zetachain.zetacore.crosschain.CrossChainTx") @@ -464,70 +503,72 @@ func init() { func init() { proto.RegisterFile("crosschain/cross_chain_tx.proto", fileDescriptor_af3a0ad055343c21) } var fileDescriptor_af3a0ad055343c21 = []byte{ - // 1003 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xdd, 0x4e, 0x1b, 0xc7, - 0x17, 0x67, 0xff, 0x36, 0xc6, 0x3e, 0x0e, 0x78, 0x19, 0x4c, 0xfe, 0x2b, 0xd2, 0xd8, 0x96, 0xdb, - 0x24, 0x4e, 0x25, 0x6c, 0x41, 0x55, 0x45, 0xea, 0x5d, 0xa0, 0x21, 0x41, 0x4d, 0x02, 0xda, 0xc2, - 0x0d, 0x52, 0xb5, 0x1d, 0xef, 0x1e, 0xec, 0x51, 0xec, 0x1d, 0x6b, 0x67, 0x8c, 0x96, 0xa8, 0x57, - 0x7d, 0x82, 0x3e, 0x44, 0x2b, 0xb5, 0x6f, 0x92, 0x8b, 0x5e, 0xe4, 0xb2, 0xea, 0x05, 0xaa, 0xe0, - 0x0d, 0xfa, 0x04, 0xd5, 0xcc, 0xec, 0xda, 0x6b, 0x17, 0x42, 0xab, 0x5e, 0xf9, 0x7c, 0xcc, 0xef, - 0xcc, 0xf9, 0xf8, 0x9d, 0xf1, 0x42, 0xdd, 0x8f, 0xb8, 0x10, 0x7e, 0x9f, 0xb2, 0xb0, 0xa3, 0x45, - 0x4f, 0xcb, 0x9e, 0x8c, 0xdb, 0xa3, 0x88, 0x4b, 0x4e, 0xee, 0xbf, 0x45, 0x49, 0xb5, 0xad, 0xad, - 0x25, 0x1e, 0x61, 0x7b, 0x8a, 0xd9, 0x58, 0xf3, 0xf9, 0x70, 0xc8, 0xc3, 0x8e, 0xf9, 0x31, 0x98, - 0x8d, 0x6a, 0x8f, 0xf7, 0xb8, 0x16, 0x3b, 0x4a, 0x32, 0xd6, 0xe6, 0xf7, 0x79, 0xa8, 0xec, 0x87, - 0x5d, 0x3e, 0x0e, 0x83, 0xa3, 0xf8, 0x90, 0x46, 0x74, 0x28, 0xc8, 0x5d, 0x28, 0x08, 0x0c, 0x03, - 0x8c, 0x1c, 0xab, 0x61, 0xb5, 0x4a, 0x6e, 0xa2, 0x91, 0x87, 0x50, 0x31, 0x52, 0x92, 0x0e, 0x0b, - 0x9c, 0xff, 0x35, 0xac, 0x56, 0xce, 0x5d, 0x36, 0xe6, 0x5d, 0x65, 0xdd, 0x0f, 0xc8, 0x3d, 0x28, - 0xc9, 0xd8, 0xe3, 0x11, 0xeb, 0xb1, 0xd0, 0xc9, 0xe9, 0x10, 0x45, 0x19, 0x1f, 0x68, 0x9d, 0x6c, - 0x42, 0xc9, 0xe7, 0xaa, 0x96, 0xf3, 0x11, 0x3a, 0xf9, 0x86, 0xd5, 0x5a, 0xd9, 0xb6, 0xdb, 0x49, - 0xa2, 0xbb, 0x9c, 0x85, 0x47, 0xe7, 0x23, 0x74, 0x8b, 0x7e, 0x22, 0x91, 0x2a, 0x2c, 0x52, 0x21, - 0x50, 0x3a, 0x8b, 0x3a, 0x8e, 0x51, 0xc8, 0x73, 0x28, 0xd0, 0x21, 0x1f, 0x87, 0xd2, 0x29, 0x28, - 0xf3, 0x4e, 0xe7, 0xdd, 0x45, 0x7d, 0xe1, 0xf7, 0x8b, 0xfa, 0xa3, 0x1e, 0x93, 0xfd, 0x71, 0x57, - 0xc5, 0xeb, 0xf8, 0x5c, 0x0c, 0xb9, 0x48, 0x7e, 0x36, 0x45, 0xf0, 0xa6, 0xa3, 0xae, 0x14, 0xed, - 0x63, 0x16, 0x4a, 0x37, 0x81, 0x93, 0x27, 0xe0, 0x30, 0x53, 0xbd, 0xa7, 0x52, 0xee, 0x0a, 0x8c, - 0xce, 0x30, 0xf0, 0xfa, 0x54, 0xf4, 0x9d, 0x25, 0x7d, 0xe3, 0x3a, 0x4b, 0xbb, 0x73, 0x90, 0x78, - 0x5f, 0x50, 0xd1, 0x27, 0x2f, 0xe1, 0xe3, 0xeb, 0x80, 0x18, 0x4b, 0x8c, 0x42, 0x3a, 0xf0, 0xfa, - 0xc8, 0x7a, 0x7d, 0xe9, 0x14, 0x1b, 0x56, 0x2b, 0xef, 0xd6, 0xff, 0x16, 0xe3, 0x59, 0x72, 0xee, - 0x85, 0x3e, 0x46, 0x3e, 0x87, 0xff, 0x67, 0xa2, 0x75, 0xe9, 0x60, 0xc0, 0xa5, 0xc7, 0xc2, 0x00, - 0x63, 0xa7, 0xa4, 0xb3, 0xa8, 0x4e, 0x22, 0xec, 0x68, 0xe7, 0xbe, 0xf2, 0x91, 0x3d, 0x68, 0x64, - 0x60, 0xa7, 0x2c, 0xa4, 0x03, 0xf6, 0x16, 0x03, 0x4f, 0x71, 0x22, 0xcd, 0x00, 0x74, 0x06, 0x1f, - 0x4d, 0xf0, 0x7b, 0xe9, 0xa9, 0x13, 0x94, 0xd4, 0x5c, 0xdf, 0xfc, 0xa5, 0x00, 0xf6, 0xc1, 0x58, - 0xce, 0xb2, 0x60, 0x03, 0x8a, 0x11, 0xfa, 0xc8, 0xce, 0x26, 0x3c, 0x98, 0xe8, 0xe4, 0x31, 0xd8, - 0xa9, 0x6c, 0xb8, 0xb0, 0x9f, 0x52, 0xa1, 0x92, 0xda, 0x53, 0x32, 0xcc, 0xcc, 0x3b, 0x77, 0xeb, - 0xbc, 0xa7, 0x93, 0xcd, 0xff, 0xb7, 0xc9, 0x6e, 0xc1, 0x3a, 0x4f, 0x4a, 0x52, 0xcd, 0x91, 0x42, - 0x78, 0x21, 0x0f, 0x7d, 0xd4, 0x44, 0xca, 0xbb, 0x84, 0x4f, 0xea, 0x3d, 0x12, 0xe2, 0xb5, 0xf2, - 0xcc, 0x43, 0x7a, 0x54, 0x78, 0x03, 0x36, 0x64, 0x86, 0x64, 0x33, 0x90, 0xe7, 0x54, 0xbc, 0x54, - 0x9e, 0xeb, 0x20, 0xa3, 0x88, 0xf9, 0x98, 0x90, 0x67, 0x16, 0x72, 0xa8, 0x3c, 0xa4, 0x05, 0x76, - 0x16, 0xa2, 0xa9, 0x56, 0xd4, 0xa7, 0x57, 0xa6, 0xa7, 0x35, 0xc7, 0x9e, 0x80, 0x93, 0x3d, 0x79, - 0x0d, 0x2d, 0xd6, 0xa7, 0x88, 0x2c, 0x2f, 0x5e, 0xc3, 0x27, 0x59, 0xe0, 0x8d, 0xec, 0x34, 0xdc, - 0x68, 0x4c, 0x83, 0xdc, 0x40, 0xcf, 0x0e, 0x54, 0xe7, 0xab, 0x1c, 0x0b, 0x0c, 0x9c, 0xaa, 0xc6, - 0xaf, 0xce, 0x14, 0x79, 0x2c, 0x30, 0x20, 0x12, 0xea, 0x59, 0x00, 0x9e, 0x9e, 0xa2, 0x2f, 0xd9, - 0x19, 0x66, 0x1a, 0xb4, 0xae, 0xc7, 0xdb, 0x4e, 0xc6, 0xfb, 0xf0, 0x1f, 0x8c, 0x77, 0x3f, 0x94, - 0xee, 0xbd, 0xe9, 0x5d, 0xcf, 0xd2, 0xa0, 0x93, 0xce, 0x7e, 0xf9, 0xa1, 0x5b, 0xcd, 0x24, 0xef, - 0xea, 0x8c, 0x6f, 0x88, 0x62, 0x46, 0x7a, 0x1f, 0x40, 0x91, 0x65, 0x34, 0xee, 0xbe, 0xc1, 0x73, - 0xa7, 0xac, 0xfb, 0x5c, 0x92, 0x42, 0x1c, 0x6a, 0x43, 0xf3, 0x27, 0x0b, 0x0a, 0x5f, 0x4b, 0x2a, - 0xc7, 0x82, 0x3c, 0x85, 0x82, 0xd0, 0x92, 0xde, 0x8f, 0x95, 0xed, 0xc7, 0xed, 0x0f, 0x3e, 0xcb, - 0xed, 0x5d, 0x5f, 0xc6, 0x06, 0xea, 0x26, 0x40, 0xf2, 0x00, 0x56, 0x8c, 0xe4, 0x0d, 0x51, 0x08, - 0xda, 0x43, 0xbd, 0x46, 0x25, 0x77, 0xd9, 0x58, 0x5f, 0x19, 0x23, 0xd9, 0x82, 0xea, 0x80, 0x0a, - 0x79, 0x3c, 0x0a, 0xa8, 0x44, 0x4f, 0xb2, 0x21, 0x0a, 0x49, 0x87, 0x23, 0xbd, 0x4f, 0x39, 0x77, - 0x6d, 0xea, 0x3b, 0x4a, 0x5d, 0xcd, 0x5f, 0x73, 0x70, 0x67, 0x57, 0xdd, 0xad, 0x17, 0xf1, 0x28, - 0x26, 0x0e, 0x2c, 0xf9, 0x11, 0x52, 0xc9, 0xd3, 0x75, 0x4e, 0x55, 0xf5, 0xc6, 0x1a, 0x52, 0x99, - 0xbb, 0x8d, 0x42, 0xbe, 0x85, 0x92, 0x7e, 0x47, 0x4e, 0x11, 0x85, 0x79, 0x7d, 0x77, 0x76, 0xff, - 0xe5, 0x32, 0xfe, 0x79, 0x51, 0xb7, 0xcf, 0xe9, 0x70, 0xf0, 0x45, 0x73, 0x12, 0xa9, 0xe9, 0x16, - 0x95, 0xbc, 0x87, 0x28, 0xc8, 0x23, 0xa8, 0x44, 0x38, 0xa0, 0xe7, 0x18, 0x4c, 0xaa, 0x2f, 0x98, - 0x45, 0x48, 0xcc, 0x69, 0xf9, 0x7b, 0x50, 0xf6, 0x7d, 0x19, 0x7b, 0x49, 0xb7, 0xd5, 0xb6, 0x94, - 0xb7, 0x1f, 0xdc, 0xd2, 0xed, 0xa4, 0xd3, 0xe0, 0x4f, 0xba, 0x4e, 0x4e, 0x60, 0x35, 0xf3, 0x5e, - 0x8e, 0xf4, 0x3b, 0xa7, 0x37, 0xa9, 0xbc, 0xdd, 0xbe, 0x25, 0xda, 0xdc, 0x7f, 0xa4, 0x5b, 0x61, - 0x73, 0x7f, 0x9a, 0xdf, 0x00, 0xc9, 0x92, 0x2f, 0x09, 0x0e, 0x8d, 0x5c, 0xab, 0xbc, 0xdd, 0xb9, - 0x25, 0xf8, 0xfc, 0xdb, 0xeb, 0xda, 0x7c, 0xce, 0xf2, 0xe9, 0x77, 0x00, 0x53, 0xfa, 0x10, 0x02, - 0x2b, 0x87, 0x18, 0x06, 0x2c, 0xec, 0x25, 0x79, 0xd9, 0x0b, 0x64, 0x0d, 0x2a, 0x89, 0x2d, 0x0d, - 0x67, 0x5b, 0x64, 0x15, 0x96, 0x53, 0xed, 0x15, 0x0b, 0x31, 0xb0, 0x73, 0xca, 0x94, 0x9c, 0x73, - 0xf1, 0x0c, 0x23, 0x69, 0xe7, 0xc9, 0x1d, 0x28, 0x1a, 0x19, 0x03, 0x7b, 0x91, 0x94, 0x61, 0xe9, - 0x69, 0x97, 0x6b, 0xa5, 0xb0, 0x91, 0xff, 0xf9, 0xc7, 0x9a, 0xb5, 0xf3, 0xd5, 0xbb, 0xcb, 0x9a, - 0xf5, 0xfe, 0xb2, 0x66, 0xfd, 0x71, 0x59, 0xb3, 0x7e, 0xb8, 0xaa, 0x2d, 0xbc, 0xbf, 0xaa, 0x2d, - 0xfc, 0x76, 0x55, 0x5b, 0x38, 0xd9, 0xca, 0x50, 0x41, 0x95, 0xb6, 0x69, 0xbe, 0x5a, 0xd2, 0x2a, - 0x3b, 0x71, 0x27, 0xf3, 0x2d, 0xa3, 0x99, 0xd1, 0x2d, 0xe8, 0x2f, 0x8f, 0xcf, 0xfe, 0x0a, 0x00, - 0x00, 0xff, 0xff, 0x46, 0x27, 0x16, 0x29, 0xe6, 0x08, 0x00, 0x00, + // 1037 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcf, 0x6e, 0x1b, 0xb7, + 0x13, 0xf6, 0xfe, 0x24, 0xcb, 0xd2, 0x28, 0x96, 0xd6, 0xb4, 0x9c, 0xdf, 0xc2, 0x69, 0x24, 0x41, + 0x6d, 0x12, 0xa5, 0x80, 0x25, 0xd8, 0x45, 0x11, 0xa0, 0x37, 0xdb, 0x8d, 0x13, 0xa3, 0x49, 0x6c, + 0x6c, 0xed, 0x8b, 0x81, 0x62, 0x4b, 0xed, 0x8e, 0x25, 0x22, 0xd2, 0x52, 0x5d, 0x52, 0x86, 0x1c, + 0xf4, 0xd4, 0x27, 0xe8, 0x43, 0xb4, 0x40, 0xfb, 0x26, 0x39, 0xf4, 0x90, 0x63, 0xd1, 0x83, 0x51, + 0xd8, 0x6f, 0xd0, 0x27, 0x28, 0x48, 0xee, 0x4a, 0x2b, 0xd5, 0x8e, 0xfb, 0xe7, 0xb4, 0xc3, 0x21, + 0xbf, 0x8f, 0x33, 0xc3, 0x6f, 0xc8, 0x85, 0x9a, 0x1f, 0x71, 0x21, 0xfc, 0x1e, 0x65, 0x61, 0x5b, + 0x9b, 0x9e, 0xb6, 0x3d, 0x39, 0x6e, 0x0d, 0x23, 0x2e, 0x39, 0xb9, 0xff, 0x06, 0x25, 0xd5, 0xbe, + 0x96, 0xb6, 0x78, 0x84, 0xad, 0x29, 0x66, 0x7d, 0xd5, 0xe7, 0x83, 0x01, 0x0f, 0xdb, 0xe6, 0x63, + 0x30, 0xeb, 0x95, 0x2e, 0xef, 0x72, 0x6d, 0xb6, 0x95, 0x65, 0xbc, 0x8d, 0xef, 0xb2, 0x50, 0xde, + 0x0f, 0x3b, 0x7c, 0x14, 0x06, 0x47, 0xe3, 0x43, 0x1a, 0xd1, 0x81, 0x20, 0x77, 0x21, 0x27, 0x30, + 0x0c, 0x30, 0x72, 0xac, 0xba, 0xd5, 0x2c, 0xb8, 0xf1, 0x88, 0x3c, 0x84, 0xb2, 0xb1, 0xe2, 0x70, + 0x58, 0xe0, 0xfc, 0xaf, 0x6e, 0x35, 0x33, 0xee, 0xb2, 0x71, 0xef, 0x2a, 0xef, 0x7e, 0x40, 0xee, + 0x41, 0x41, 0x8e, 0x3d, 0x1e, 0xb1, 0x2e, 0x0b, 0x9d, 0x8c, 0xa6, 0xc8, 0xcb, 0xf1, 0x81, 0x1e, + 0x93, 0x0d, 0x28, 0xf8, 0x5c, 0xe5, 0x72, 0x3e, 0x44, 0x27, 0x5b, 0xb7, 0x9a, 0xa5, 0x2d, 0xbb, + 0x15, 0x07, 0xba, 0xcb, 0x59, 0x78, 0x74, 0x3e, 0x44, 0x37, 0xef, 0xc7, 0x16, 0xa9, 0xc0, 0x22, + 0x15, 0x02, 0xa5, 0xb3, 0xa8, 0x79, 0xcc, 0x80, 0x3c, 0x83, 0x1c, 0x1d, 0xf0, 0x51, 0x28, 0x9d, + 0x9c, 0x72, 0xef, 0xb4, 0xdf, 0x5e, 0xd4, 0x16, 0x7e, 0xbb, 0xa8, 0x3d, 0xea, 0x32, 0xd9, 0x1b, + 0x75, 0x14, 0x5f, 0xdb, 0xe7, 0x62, 0xc0, 0x45, 0xfc, 0xd9, 0x10, 0xc1, 0xeb, 0xb6, 0xda, 0x52, + 0xb4, 0x8e, 0x59, 0x28, 0xdd, 0x18, 0x4e, 0x9e, 0x80, 0xc3, 0x4c, 0xf6, 0x9e, 0x0a, 0xb9, 0x23, + 0x30, 0x3a, 0xc3, 0xc0, 0xeb, 0x51, 0xd1, 0x73, 0x96, 0xf4, 0x8e, 0x6b, 0x2c, 0xa9, 0xce, 0x41, + 0x3c, 0xfb, 0x9c, 0x8a, 0x1e, 0x79, 0x01, 0x1f, 0x5e, 0x07, 0xc4, 0xb1, 0xc4, 0x28, 0xa4, 0x7d, + 0xaf, 0x87, 0xac, 0xdb, 0x93, 0x4e, 0xbe, 0x6e, 0x35, 0xb3, 0x6e, 0xed, 0x2f, 0x1c, 0x4f, 0xe3, + 0x75, 0xcf, 0xf5, 0x32, 0xf2, 0x29, 0xfc, 0x3f, 0xc5, 0xd6, 0xa1, 0xfd, 0x3e, 0x97, 0x1e, 0x0b, + 0x03, 0x1c, 0x3b, 0x05, 0x1d, 0x45, 0x65, 0xc2, 0xb0, 0xa3, 0x27, 0xf7, 0xd5, 0x1c, 0xd9, 0x83, + 0x7a, 0x0a, 0x76, 0xca, 0x42, 0xda, 0x67, 0x6f, 0x30, 0xf0, 0x94, 0x26, 0x92, 0x08, 0x40, 0x47, + 0xf0, 0xc1, 0x04, 0xbf, 0x97, 0xac, 0x3a, 0x41, 0x49, 0xcd, 0xf6, 0x8d, 0x6f, 0xa0, 0xa4, 0x46, + 0xdb, 0xbe, 0xaf, 0x8a, 0xc2, 0xc2, 0x2e, 0xf1, 0x60, 0x95, 0x76, 0x78, 0x24, 0x13, 0xb2, 0xb8, + 0xda, 0xd6, 0xbf, 0xab, 0xf6, 0x4a, 0xcc, 0xa5, 0x37, 0xd1, 0x4c, 0x8d, 0x9f, 0x73, 0x60, 0x1f, + 0x8c, 0xe4, 0xac, 0xf0, 0xd6, 0x21, 0x1f, 0xa1, 0x8f, 0xec, 0x6c, 0x22, 0xbd, 0xc9, 0x98, 0x3c, + 0x06, 0x3b, 0xb1, 0x8d, 0xfc, 0xf6, 0x13, 0xf5, 0x95, 0x13, 0x7f, 0xa2, 0xbf, 0x19, 0x89, 0x65, + 0x6e, 0x95, 0xd8, 0x54, 0x4c, 0xd9, 0xff, 0x26, 0xa6, 0x4d, 0x58, 0xe3, 0x71, 0x4a, 0xea, 0x3c, + 0xa4, 0x10, 0x5e, 0xc8, 0x43, 0x1f, 0xb5, 0x76, 0xb3, 0x2e, 0xe1, 0x93, 0x7c, 0x8f, 0x84, 0x78, + 0xa5, 0x66, 0xe6, 0x21, 0x5d, 0x2a, 0xbc, 0x3e, 0x1b, 0x30, 0xa3, 0xeb, 0x19, 0xc8, 0x33, 0x2a, + 0x5e, 0xa8, 0x99, 0xeb, 0x20, 0xc3, 0x88, 0xf9, 0x18, 0xeb, 0x75, 0x16, 0x72, 0xa8, 0x66, 0x48, + 0x13, 0xec, 0x34, 0x44, 0xab, 0x3b, 0xaf, 0x57, 0x97, 0xa6, 0xab, 0xb5, 0xac, 0x9f, 0x80, 0x93, + 0x5e, 0x79, 0x8d, 0x12, 0xd7, 0xa6, 0x88, 0xb4, 0x14, 0x5f, 0xc1, 0x47, 0x69, 0xe0, 0x8d, 0x0d, + 0x61, 0xe4, 0x58, 0x9f, 0x92, 0xdc, 0xd0, 0x11, 0x6d, 0xa8, 0xcc, 0x67, 0x39, 0x12, 0x18, 0x38, + 0x15, 0x8d, 0x5f, 0x99, 0x49, 0xf2, 0x58, 0x60, 0x40, 0x24, 0xd4, 0xd2, 0x00, 0x3c, 0x3d, 0x45, + 0x5f, 0xb2, 0x33, 0x4c, 0x15, 0x68, 0x4d, 0x1f, 0x6f, 0x2b, 0x3e, 0xde, 0x87, 0x7f, 0xe3, 0x78, + 0xf7, 0x43, 0xe9, 0xde, 0x9b, 0xee, 0xf5, 0x34, 0x21, 0x9d, 0x54, 0xf6, 0xf3, 0xf7, 0xed, 0x6a, + 0x4e, 0xf2, 0xae, 0x8e, 0xf8, 0x06, 0x16, 0x73, 0xa4, 0xf7, 0x01, 0x94, 0x58, 0x86, 0xa3, 0xce, + 0x6b, 0x3c, 0x77, 0x8a, 0xba, 0xce, 0x05, 0x29, 0xc4, 0xa1, 0x76, 0x34, 0x7e, 0xb4, 0x20, 0xf7, + 0xa5, 0xa4, 0x72, 0x24, 0xc8, 0x36, 0xe4, 0x84, 0xb6, 0x74, 0x7f, 0x94, 0xb6, 0x1e, 0xb7, 0xde, + 0xfb, 0x12, 0xb4, 0x76, 0x7d, 0x39, 0x36, 0x50, 0x37, 0x06, 0x92, 0x07, 0x50, 0x32, 0x96, 0x37, + 0x40, 0x21, 0x68, 0x17, 0x75, 0x1b, 0x15, 0xdc, 0x65, 0xe3, 0x7d, 0x69, 0x9c, 0x64, 0x13, 0x2a, + 0x7d, 0x2a, 0xe4, 0xf1, 0x30, 0xa0, 0x12, 0x3d, 0xc9, 0x06, 0x28, 0x24, 0x1d, 0x0c, 0x75, 0x3f, + 0x65, 0xdc, 0xd5, 0xe9, 0xdc, 0x51, 0x32, 0xd5, 0xf8, 0x25, 0x03, 0x77, 0x76, 0xd5, 0xde, 0xba, + 0x11, 0x8f, 0xc6, 0xc4, 0x81, 0x25, 0x3f, 0x42, 0x2a, 0x79, 0xd2, 0xce, 0xc9, 0x50, 0x5d, 0xeb, + 0x46, 0x54, 0x66, 0x6f, 0x33, 0x20, 0x5f, 0x43, 0x41, 0xdf, 0x36, 0xa7, 0x88, 0xc2, 0x5c, 0xf8, + 0x3b, 0xbb, 0xff, 0xb0, 0x19, 0xff, 0xb8, 0xa8, 0xd9, 0xe7, 0x74, 0xd0, 0xff, 0xac, 0x31, 0x61, + 0x6a, 0xb8, 0x79, 0x65, 0xef, 0x21, 0x0a, 0xf2, 0x08, 0xca, 0x11, 0xf6, 0xe9, 0x39, 0x06, 0x93, + 0xec, 0x73, 0xa6, 0x11, 0x62, 0x77, 0x92, 0xfe, 0x1e, 0x14, 0x7d, 0x5f, 0x8e, 0xbd, 0xb8, 0xda, + 0xaa, 0x5b, 0x8a, 0x5b, 0x0f, 0x6e, 0xa9, 0x76, 0x5c, 0x69, 0xf0, 0x27, 0x55, 0x27, 0x27, 0xb0, + 0x92, 0xba, 0xa2, 0x87, 0xfa, 0x9e, 0xd3, 0x9d, 0x54, 0xdc, 0x6a, 0xdd, 0xc2, 0x36, 0xf7, 0x2c, + 0xbb, 0x65, 0x36, 0xf7, 0x4e, 0x7f, 0x05, 0x24, 0x2d, 0xbe, 0x98, 0x1c, 0xea, 0x99, 0x66, 0x71, + 0xab, 0x7d, 0x0b, 0xf9, 0xfc, 0xdd, 0xeb, 0xda, 0x7c, 0xce, 0xf3, 0xf1, 0xb7, 0x00, 0x53, 0xf9, + 0x10, 0x02, 0xa5, 0x43, 0x0c, 0x03, 0x16, 0x76, 0xe3, 0xb8, 0xec, 0x05, 0xb2, 0x0a, 0xe5, 0xd8, + 0x97, 0xd0, 0xd9, 0x16, 0x59, 0x81, 0xe5, 0x64, 0xf4, 0x92, 0x85, 0x18, 0xd8, 0x19, 0xe5, 0x8a, + 0xd7, 0xb9, 0x78, 0x86, 0x91, 0xb4, 0xb3, 0xe4, 0x0e, 0xe4, 0x8d, 0x8d, 0x81, 0xbd, 0x48, 0x8a, + 0xb0, 0xb4, 0x6d, 0x9e, 0x08, 0x3b, 0xb7, 0x9e, 0xfd, 0xe9, 0x87, 0xaa, 0xb5, 0xf3, 0xc5, 0xdb, + 0xcb, 0xaa, 0xf5, 0xee, 0xb2, 0x6a, 0xfd, 0x7e, 0x59, 0xb5, 0xbe, 0xbf, 0xaa, 0x2e, 0xbc, 0xbb, + 0xaa, 0x2e, 0xfc, 0x7a, 0x55, 0x5d, 0x38, 0xd9, 0x4c, 0x49, 0x41, 0xa5, 0xb6, 0x61, 0x7e, 0x94, + 0x92, 0x2c, 0xdb, 0xe3, 0x76, 0xea, 0xf7, 0x49, 0x2b, 0xa3, 0x93, 0xd3, 0x3f, 0x3b, 0x9f, 0xfc, + 0x19, 0x00, 0x00, 0xff, 0xff, 0xd6, 0x5f, 0xb2, 0x04, 0x59, 0x09, 0x00, 0x00, } func (m *InboundTxParams) Marshal() (dAtA []byte, err error) { @@ -618,6 +659,39 @@ func (m *InboundTxParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ZetaAccounting) 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 *ZetaAccounting) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ZetaAccounting) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.AbortedZetaAmount.Size() + i -= size + if _, err := m.AbortedZetaAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintCrossChainTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *OutboundTxParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -923,6 +997,17 @@ func (m *InboundTxParams) Size() (n int) { return n } +func (m *ZetaAccounting) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.AbortedZetaAmount.Size() + n += 1 + l + sovCrossChainTx(uint64(l)) + return n +} + func (m *OutboundTxParams) Size() (n int) { if m == nil { return 0 @@ -1359,6 +1444,90 @@ func (m *InboundTxParams) Unmarshal(dAtA []byte) error { } return nil } +func (m *ZetaAccounting) 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 ErrIntOverflowCrossChainTx + } + 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: ZetaAccounting: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ZetaAccounting: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AbortedZetaAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCrossChainTx + } + 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 ErrInvalidLengthCrossChainTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCrossChainTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.AbortedZetaAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCrossChainTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCrossChainTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *OutboundTxParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/crosschain/types/errors.go b/x/crosschain/types/errors.go index c1797d54b9..5de2c55af1 100644 --- a/x/crosschain/types/errors.go +++ b/x/crosschain/types/errors.go @@ -38,6 +38,8 @@ var ( ErrInvalidGasAmount = errorsmod.Register(ModuleName, 1137, "invalid gas amount") ErrNoLiquidityPool = errorsmod.Register(ModuleName, 1138, "no liquidity pool") ErrInvalidCoinType = errorsmod.Register(ModuleName, 1139, "invalid coin type") - ErrCannotMigrateTss = errorsmod.Register(ModuleName, 1140, "Cannot migrate TSS funds") + ErrCannotMigrateTssFunds = errorsmod.Register(ModuleName, 1140, "cannot migrate TSS funds") ErrTxBodyVerificationFail = errorsmod.Register(ModuleName, 1141, "transaction body verification fail") + ErrReceiverIsEmpty = errorsmod.Register(ModuleName, 1142, "receiver is empty") + ErrUnsupportedStatus = errorsmod.Register(ModuleName, 1143, "unsupported status") ) diff --git a/x/crosschain/types/expected_keepers.go b/x/crosschain/types/expected_keepers.go index 8330c4c66d..d4747e68c2 100644 --- a/x/crosschain/types/expected_keepers.go +++ b/x/crosschain/types/expected_keepers.go @@ -1,6 +1,7 @@ package types import ( + "context" "math/big" sdk "github.com/cosmos/cosmos-sdk/types" @@ -11,7 +12,7 @@ import ( "github.com/zeta-chain/zetacore/common" fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" - zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) type StakingKeeper interface { @@ -44,29 +45,54 @@ type BankKeeper interface { } type ZetaObserverKeeper interface { - SetObserverMapper(ctx sdk.Context, om *zetaObserverTypes.ObserverMapper) - GetObserverMapper(ctx sdk.Context, chain *common.Chain) (val zetaObserverTypes.ObserverMapper, found bool) - GetAllObserverMappers(ctx sdk.Context) (mappers []*zetaObserverTypes.ObserverMapper) - SetBallot(ctx sdk.Context, ballot *zetaObserverTypes.Ballot) - GetBallot(ctx sdk.Context, index string) (val zetaObserverTypes.Ballot, found bool) - GetAllBallots(ctx sdk.Context) (voters []*zetaObserverTypes.Ballot) - GetParams(ctx sdk.Context) (params zetaObserverTypes.Params) - GetCoreParamsByChainID(ctx sdk.Context, chainID int64) (params *zetaObserverTypes.CoreParams, found bool) - GetNodeAccount(ctx sdk.Context, address string) (nodeAccount zetaObserverTypes.NodeAccount, found bool) - GetAllNodeAccount(ctx sdk.Context) (nodeAccounts []zetaObserverTypes.NodeAccount) - SetNodeAccount(ctx sdk.Context, nodeAccount zetaObserverTypes.NodeAccount) + SetObserverMapper(ctx sdk.Context, om *observertypes.ObserverMapper) + GetObserverMapper(ctx sdk.Context, chain *common.Chain) (val observertypes.ObserverMapper, found bool) + GetAllObserverMappers(ctx sdk.Context) (mappers []*observertypes.ObserverMapper) + SetBallot(ctx sdk.Context, ballot *observertypes.Ballot) + GetBallot(ctx sdk.Context, index string) (val observertypes.Ballot, found bool) + GetAllBallots(ctx sdk.Context) (voters []*observertypes.Ballot) + GetParams(ctx sdk.Context) (params observertypes.Params) + GetCoreParamsByChainID(ctx sdk.Context, chainID int64) (params *observertypes.CoreParams, found bool) + GetNodeAccount(ctx sdk.Context, address string) (nodeAccount observertypes.NodeAccount, found bool) + GetAllNodeAccount(ctx sdk.Context) (nodeAccounts []observertypes.NodeAccount) + SetNodeAccount(ctx sdk.Context, nodeAccount observertypes.NodeAccount) IsInboundEnabled(ctx sdk.Context) (found bool) - GetCrosschainFlags(ctx sdk.Context) (val zetaObserverTypes.CrosschainFlags, found bool) - GetKeygen(ctx sdk.Context) (val zetaObserverTypes.Keygen, found bool) - SetKeygen(ctx sdk.Context, keygen zetaObserverTypes.Keygen) - SetCrosschainFlags(ctx sdk.Context, crosschainFlags zetaObserverTypes.CrosschainFlags) - SetLastObserverCount(ctx sdk.Context, lbc *zetaObserverTypes.LastObserverCount) - AddVoteToBallot(ctx sdk.Context, ballot zetaObserverTypes.Ballot, address string, observationType zetaObserverTypes.VoteType) (zetaObserverTypes.Ballot, error) - CheckIfFinalizingVote(ctx sdk.Context, ballot zetaObserverTypes.Ballot) (zetaObserverTypes.Ballot, bool) + GetCrosschainFlags(ctx sdk.Context) (val observertypes.CrosschainFlags, found bool) + GetKeygen(ctx sdk.Context) (val observertypes.Keygen, found bool) + SetKeygen(ctx sdk.Context, keygen observertypes.Keygen) + SetCrosschainFlags(ctx sdk.Context, crosschainFlags observertypes.CrosschainFlags) + SetLastObserverCount(ctx sdk.Context, lbc *observertypes.LastObserverCount) + AddVoteToBallot(ctx sdk.Context, ballot observertypes.Ballot, address string, observationType observertypes.VoteType) (observertypes.Ballot, error) + CheckIfFinalizingVote(ctx sdk.Context, ballot observertypes.Ballot) (observertypes.Ballot, bool) IsAuthorized(ctx sdk.Context, address string, chain *common.Chain) bool - FindBallot(ctx sdk.Context, index string, chain *common.Chain, observationType zetaObserverTypes.ObservationType) (ballot zetaObserverTypes.Ballot, isNew bool, err error) - AddBallotToList(ctx sdk.Context, ballot zetaObserverTypes.Ballot) + FindBallot(ctx sdk.Context, index string, chain *common.Chain, observationType observertypes.ObservationType) (ballot observertypes.Ballot, isNew bool, err error) + AddBallotToList(ctx sdk.Context, ballot observertypes.Ballot) GetBlockHeader(ctx sdk.Context, hash []byte) (val common.BlockHeader, found bool) + CheckIfTssPubkeyHasBeenGenerated(ctx sdk.Context, tssPubkey string) (observertypes.TSS, bool) + GetPreviousTSS(ctx sdk.Context) (val observertypes.TSS, found bool) + GetAllTSS(ctx sdk.Context) (list []observertypes.TSS) + GetTSS(ctx sdk.Context) (val observertypes.TSS, found bool) + SetTSS(ctx sdk.Context, tss observertypes.TSS) + SetTSSHistory(ctx sdk.Context, tss observertypes.TSS) + GetTssAddress(goCtx context.Context, req *observertypes.QueryGetTssAddressRequest) (*observertypes.QueryGetTssAddressResponse, error) + + SetFundMigrator(ctx sdk.Context, fm observertypes.TssFundMigratorInfo) + GetFundMigrator(ctx sdk.Context, chainID int64) (val observertypes.TssFundMigratorInfo, found bool) + GetAllTssFundMigrators(ctx sdk.Context) (fms []observertypes.TssFundMigratorInfo) + RemoveAllExistingMigrators(ctx sdk.Context) + SetChainNonces(ctx sdk.Context, chainNonces observertypes.ChainNonces) + GetChainNonces(ctx sdk.Context, index string) (val observertypes.ChainNonces, found bool) + RemoveChainNonces(ctx sdk.Context, index string) + GetAllChainNonces(ctx sdk.Context) (list []observertypes.ChainNonces) + SetNonceToCctx(ctx sdk.Context, nonceToCctx observertypes.NonceToCctx) + GetNonceToCctx(ctx sdk.Context, tss string, chainID int64, nonce int64) (val observertypes.NonceToCctx, found bool) + RemoveNonceToCctx(ctx sdk.Context, cctx observertypes.NonceToCctx) + GetAllPendingNonces(ctx sdk.Context) (list []observertypes.PendingNonces, err error) + GetPendingNonces(ctx sdk.Context, tss string, chainID int64) (val observertypes.PendingNonces, found bool) + SetPendingNonces(ctx sdk.Context, pendingNonces observertypes.PendingNonces) + SetTssAndUpdateNonce(ctx sdk.Context, tss observertypes.TSS) + RemoveFromPendingNonces(ctx sdk.Context, tss string, chainID int64, nonce int64) + GetAllNonceToCctx(ctx sdk.Context) (list []observertypes.NonceToCctx) } type FungibleKeeper interface { diff --git a/x/crosschain/types/genesis.go b/x/crosschain/types/genesis.go index 935ba7e651..23343133c8 100644 --- a/x/crosschain/types/genesis.go +++ b/x/crosschain/types/genesis.go @@ -16,7 +16,6 @@ func DefaultGenesis() *GenesisState { OutTxTrackerList: []OutTxTracker{}, InTxHashToCctxList: []InTxHashToCctx{}, GasPriceList: []*GasPrice{}, - ChainNoncesList: []*ChainNonces{}, //CCTX: []*Send{}, } @@ -56,15 +55,6 @@ func (gs GenesisState) Validate() error { } gasPriceIndexMap[elem.Index] = true } - // Check for duplicated index in chainNonces - chainNoncesIndexMap := make(map[string]bool) - - for _, elem := range gs.ChainNoncesList { - if _, ok := chainNoncesIndexMap[elem.Index]; ok { - return fmt.Errorf("duplicated index for chainNonces") - } - chainNoncesIndexMap[elem.Index] = true - } // Check for duplicated index in send //sendIndexMap := make(map[string]bool) diff --git a/x/crosschain/types/genesis.pb.go b/x/crosschain/types/genesis.pb.go index c1b357ebad..250dc7128d 100644 --- a/x/crosschain/types/genesis.pb.go +++ b/x/crosschain/types/genesis.pb.go @@ -28,14 +28,12 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type GenesisState struct { Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` OutTxTrackerList []OutTxTracker `protobuf:"bytes,2,rep,name=outTxTrackerList,proto3" json:"outTxTrackerList"` - Tss *TSS `protobuf:"bytes,4,opt,name=tss,proto3" json:"tss,omitempty"` GasPriceList []*GasPrice `protobuf:"bytes,5,rep,name=gasPriceList,proto3" json:"gasPriceList,omitempty"` - ChainNoncesList []*ChainNonces `protobuf:"bytes,6,rep,name=chainNoncesList,proto3" json:"chainNoncesList,omitempty"` CrossChainTxs []*CrossChainTx `protobuf:"bytes,7,rep,name=CrossChainTxs,proto3" json:"CrossChainTxs,omitempty"` LastBlockHeightList []*LastBlockHeight `protobuf:"bytes,8,rep,name=lastBlockHeightList,proto3" json:"lastBlockHeightList,omitempty"` InTxHashToCctxList []InTxHashToCctx `protobuf:"bytes,9,rep,name=inTxHashToCctxList,proto3" json:"inTxHashToCctxList"` - TssHistory []TSS `protobuf:"bytes,10,rep,name=tss_history,json=tssHistory,proto3" json:"tss_history"` InTxTrackerList []InTxTracker `protobuf:"bytes,11,rep,name=in_tx_tracker_list,json=inTxTrackerList,proto3" json:"in_tx_tracker_list"` + ZetaAccounting ZetaAccounting `protobuf:"bytes,12,opt,name=zeta_accounting,json=zetaAccounting,proto3" json:"zeta_accounting"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -85,13 +83,6 @@ func (m *GenesisState) GetOutTxTrackerList() []OutTxTracker { return nil } -func (m *GenesisState) GetTss() *TSS { - if m != nil { - return m.Tss - } - return nil -} - func (m *GenesisState) GetGasPriceList() []*GasPrice { if m != nil { return m.GasPriceList @@ -99,13 +90,6 @@ func (m *GenesisState) GetGasPriceList() []*GasPrice { return nil } -func (m *GenesisState) GetChainNoncesList() []*ChainNonces { - if m != nil { - return m.ChainNoncesList - } - return nil -} - func (m *GenesisState) GetCrossChainTxs() []*CrossChainTx { if m != nil { return m.CrossChainTxs @@ -127,18 +111,18 @@ func (m *GenesisState) GetInTxHashToCctxList() []InTxHashToCctx { return nil } -func (m *GenesisState) GetTssHistory() []TSS { +func (m *GenesisState) GetInTxTrackerList() []InTxTracker { if m != nil { - return m.TssHistory + return m.InTxTrackerList } return nil } -func (m *GenesisState) GetInTxTrackerList() []InTxTracker { +func (m *GenesisState) GetZetaAccounting() ZetaAccounting { if m != nil { - return m.InTxTrackerList + return m.ZetaAccounting } - return nil + return ZetaAccounting{} } func init() { @@ -148,39 +132,37 @@ func init() { func init() { proto.RegisterFile("crosschain/genesis.proto", fileDescriptor_dd51403692d571f4) } var fileDescriptor_dd51403692d571f4 = []byte{ - // 512 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xd1, 0x6e, 0xd3, 0x30, - 0x14, 0x86, 0x1b, 0x36, 0x0a, 0xb8, 0x43, 0x43, 0x06, 0x89, 0xa8, 0xd2, 0xb2, 0xa9, 0x08, 0x31, - 0x81, 0x96, 0x88, 0xc1, 0x13, 0xb4, 0x17, 0xeb, 0xb4, 0x09, 0x46, 0x9a, 0x2b, 0xa4, 0xc9, 0xb8, - 0x96, 0x95, 0x44, 0xeb, 0xe2, 0x2a, 0xc7, 0x95, 0x32, 0x9e, 0x82, 0xc7, 0xda, 0x1d, 0xbb, 0xe4, - 0x0a, 0xa1, 0xf6, 0x45, 0x90, 0x4f, 0xb2, 0xcd, 0xa1, 0x15, 0xe9, 0x4d, 0x65, 0xe5, 0xfc, 0xff, - 0x77, 0xfe, 0xda, 0xe7, 0x10, 0x57, 0xe4, 0x0a, 0x40, 0x24, 0x3c, 0xcd, 0x82, 0x58, 0x66, 0x12, - 0x52, 0xf0, 0xa7, 0xb9, 0xd2, 0x8a, 0xee, 0x7c, 0x97, 0x9a, 0x63, 0xc1, 0xc7, 0x93, 0xca, 0xa5, - 0x7f, 0x2f, 0xee, 0xee, 0x58, 0x46, 0xfc, 0x65, 0x99, 0xca, 0x84, 0xac, 0xdc, 0xdd, 0x5d, 0xbb, - 0x6c, 0x8e, 0xac, 0x14, 0xe9, 0xa2, 0x12, 0x74, 0xed, 0xc6, 0x1c, 0xd8, 0x34, 0x4f, 0x85, 0xac, - 0x6a, 0xaf, 0xac, 0x1a, 0x7a, 0x58, 0xc2, 0x21, 0x61, 0x5a, 0x31, 0x21, 0xee, 0x00, 0xde, 0x92, - 0x48, 0xe7, 0x5c, 0x5c, 0xc8, 0xbc, 0xaa, 0xf7, 0xac, 0xfa, 0x84, 0x83, 0x66, 0xe3, 0x89, 0x12, - 0x17, 0x2c, 0x91, 0x69, 0x9c, 0xe8, 0x15, 0x29, 0xd5, 0x4c, 0x2f, 0x43, 0x5e, 0x5a, 0x82, 0x29, - 0xcf, 0xf9, 0xe5, 0xed, 0xff, 0x7b, 0x61, 0x15, 0x34, 0xdc, 0x7d, 0x8d, 0x55, 0xac, 0xf0, 0x18, - 0x98, 0x53, 0xf9, 0xb5, 0xf7, 0xb3, 0x4d, 0xb6, 0x8e, 0xca, 0xbb, 0x1d, 0x69, 0xae, 0x25, 0x1d, - 0x90, 0x76, 0x09, 0x73, 0x9d, 0x3d, 0x67, 0xbf, 0x73, 0xf8, 0xda, 0xff, 0xef, 0x5d, 0xfb, 0x67, - 0x28, 0xee, 0x6f, 0x5e, 0xff, 0xde, 0x6d, 0x85, 0x95, 0x95, 0x9e, 0x93, 0x67, 0x6a, 0xa6, 0xa3, - 0x22, 0x2a, 0x03, 0x9f, 0xa6, 0xa0, 0xdd, 0x07, 0x7b, 0x1b, 0xfb, 0x9d, 0xc3, 0x77, 0x0d, 0xb8, - 0xcf, 0x96, 0xad, 0x82, 0x2e, 0xa1, 0xe8, 0x47, 0xb2, 0xa1, 0x01, 0xdc, 0x4d, 0x0c, 0xd8, 0x6b, - 0x20, 0x46, 0xa3, 0x51, 0x68, 0xe4, 0xf4, 0x84, 0x6c, 0xc5, 0x1c, 0xce, 0xcc, 0x5b, 0x62, 0xa0, - 0x87, 0x18, 0xe8, 0x4d, 0x83, 0xfd, 0xa8, 0xb2, 0x84, 0x35, 0x33, 0x8d, 0xc8, 0x36, 0xd6, 0x3f, - 0xe1, 0x60, 0x21, 0xaf, 0x8d, 0xbc, 0xb7, 0x0d, 0xbc, 0xc1, 0xbd, 0x2b, 0xfc, 0x17, 0x41, 0xbf, - 0x90, 0xa7, 0x03, 0x23, 0x45, 0x51, 0x54, 0x80, 0xfb, 0x68, 0xad, 0x4b, 0xb3, 0x3d, 0x61, 0x9d, - 0x40, 0xbf, 0x91, 0xe7, 0x66, 0xc2, 0xfa, 0x66, 0xc0, 0x86, 0x38, 0x5f, 0x18, 0xf6, 0x31, 0x82, - 0xfd, 0x06, 0xf0, 0x69, 0xdd, 0x19, 0xae, 0x42, 0x51, 0x41, 0xa8, 0x69, 0x35, 0xe4, 0x90, 0x44, - 0x6a, 0x20, 0x74, 0x81, 0x0d, 0x9e, 0x60, 0x83, 0x83, 0x86, 0x06, 0xc7, 0x35, 0x63, 0xf5, 0xe0, - 0x2b, 0x70, 0xf4, 0x98, 0x74, 0x34, 0x00, 0x4b, 0x52, 0xd0, 0x2a, 0xbf, 0x72, 0x09, 0xd2, 0xd7, - 0x78, 0xfa, 0x0a, 0x49, 0x34, 0xc0, 0xb0, 0xf4, 0xd2, 0x73, 0x93, 0xd7, 0x5a, 0x27, 0x36, 0x31, - 0x79, 0x3b, 0x6b, 0xbd, 0x9e, 0xc9, 0x5b, 0x9f, 0xce, 0xed, 0x34, 0xab, 0x0d, 0x67, 0xff, 0xe4, - 0x7a, 0xee, 0x39, 0x37, 0x73, 0xcf, 0xf9, 0x33, 0xf7, 0x9c, 0x1f, 0x0b, 0xaf, 0x75, 0xb3, 0xf0, - 0x5a, 0xbf, 0x16, 0x5e, 0xeb, 0xeb, 0xfb, 0x38, 0xd5, 0xc9, 0x6c, 0xec, 0x0b, 0x75, 0x19, 0x18, - 0xf8, 0x41, 0xb9, 0xa2, 0xb7, 0x7d, 0x82, 0x22, 0xb0, 0x17, 0xf7, 0x6a, 0x2a, 0x61, 0xdc, 0xc6, - 0x2d, 0xfd, 0xf0, 0x37, 0x00, 0x00, 0xff, 0xff, 0xeb, 0x12, 0x5d, 0x65, 0x0b, 0x05, 0x00, 0x00, + // 468 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x51, 0x6b, 0x14, 0x31, + 0x10, 0xc7, 0x6f, 0xd5, 0x56, 0xcd, 0x9d, 0x56, 0xa2, 0xe0, 0x72, 0xe0, 0xb6, 0x54, 0xc4, 0xa2, + 0x74, 0x17, 0xeb, 0x27, 0xb0, 0xf7, 0xd0, 0x4a, 0x0b, 0xd6, 0xf3, 0x9e, 0x8a, 0x25, 0xe6, 0x42, + 0xd8, 0x0d, 0xbd, 0x6e, 0x96, 0xcd, 0x2c, 0xac, 0xfd, 0x14, 0x7e, 0xac, 0x3e, 0xf6, 0x49, 0x7c, + 0x12, 0xb9, 0xfb, 0x22, 0x92, 0xd9, 0x58, 0xb3, 0x5c, 0xe9, 0xf6, 0x6d, 0xc8, 0xcc, 0xff, 0xf7, + 0x9f, 0xcc, 0x24, 0x24, 0x14, 0xa5, 0x36, 0x46, 0x64, 0x5c, 0xe5, 0x49, 0x2a, 0x73, 0x69, 0x94, + 0x89, 0x8b, 0x52, 0x83, 0xa6, 0x2f, 0xce, 0x25, 0x70, 0x4c, 0xc4, 0x18, 0xe9, 0x52, 0xc6, 0xff, + 0x8b, 0x87, 0xeb, 0x9e, 0x10, 0x43, 0x86, 0x31, 0x83, 0xba, 0xd1, 0x0f, 0x87, 0x3e, 0x99, 0x1b, + 0x56, 0x94, 0x4a, 0x48, 0x97, 0x7b, 0xe9, 0xe5, 0x50, 0xc3, 0x32, 0x6e, 0x32, 0x06, 0x9a, 0x09, + 0x71, 0x05, 0x88, 0x96, 0x8a, 0xa0, 0xe4, 0xe2, 0x54, 0x96, 0x2e, 0xbf, 0xe9, 0xe5, 0x67, 0xdc, + 0x00, 0x9b, 0xce, 0xb4, 0x38, 0x65, 0x99, 0x54, 0x69, 0x06, 0xae, 0xc6, 0xef, 0x52, 0x57, 0xb0, + 0x0c, 0x79, 0xee, 0x15, 0x14, 0xbc, 0xe4, 0x67, 0xee, 0xfa, 0xc3, 0x67, 0xa9, 0x4e, 0x35, 0x86, + 0x89, 0x8d, 0x9a, 0xd3, 0xcd, 0x9f, 0x2b, 0x64, 0xb0, 0xd7, 0x8c, 0xe9, 0x0b, 0x70, 0x90, 0x74, + 0x44, 0x56, 0x1b, 0x59, 0x18, 0x6c, 0x04, 0x5b, 0xfd, 0x9d, 0x57, 0xf1, 0x8d, 0x63, 0x8b, 0x8f, + 0xb0, 0x78, 0xf7, 0xde, 0xc5, 0xef, 0xf5, 0xde, 0xd8, 0x49, 0xe9, 0x09, 0x79, 0xa2, 0x2b, 0x98, + 0xd4, 0x93, 0xa6, 0xb5, 0x43, 0x65, 0x20, 0xbc, 0xb3, 0x71, 0x77, 0xab, 0xbf, 0xf3, 0xb6, 0x03, + 0xf7, 0xc9, 0x93, 0x39, 0xe8, 0x12, 0x8a, 0x1e, 0x90, 0x41, 0xca, 0xcd, 0x91, 0x9d, 0x3f, 0xa2, + 0x57, 0x10, 0xfd, 0xba, 0x03, 0xbd, 0xe7, 0x24, 0xe3, 0x96, 0x98, 0x7e, 0x26, 0x8f, 0x46, 0xb6, + 0x68, 0x64, 0x8b, 0x26, 0xb5, 0x09, 0xef, 0xdf, 0xaa, 0x51, 0x5f, 0x33, 0x6e, 0x13, 0xe8, 0x37, + 0xf2, 0xd4, 0xee, 0x6f, 0xd7, 0xae, 0x6f, 0x1f, 0xb7, 0x87, 0x6d, 0x3e, 0x40, 0x70, 0xdc, 0x01, + 0x3e, 0x6c, 0x2b, 0xc7, 0xd7, 0xa1, 0xa8, 0x20, 0xd4, 0x5a, 0xed, 0x73, 0x93, 0x4d, 0xf4, 0x48, + 0x40, 0x8d, 0x06, 0x0f, 0xd1, 0x60, 0xbb, 0xc3, 0xe0, 0x63, 0x4b, 0xe8, 0x86, 0x7c, 0x0d, 0x8e, + 0x9e, 0x58, 0x13, 0xef, 0x85, 0xb1, 0x99, 0x35, 0xe9, 0xa3, 0xc9, 0x9b, 0x5b, 0x98, 0xb4, 0xd7, + 0xb8, 0xa6, 0xf2, 0xf6, 0x16, 0xbf, 0x92, 0x35, 0xab, 0x64, 0x5c, 0x08, 0x5d, 0xe5, 0xa0, 0xf2, + 0x34, 0x1c, 0xe0, 0x93, 0xeb, 0xba, 0xc0, 0xb1, 0x04, 0xfe, 0xe1, 0x4a, 0xe4, 0xf0, 0x8f, 0xcf, + 0xdb, 0xa7, 0x07, 0x17, 0xf3, 0x28, 0xb8, 0x9c, 0x47, 0xc1, 0x9f, 0x79, 0x14, 0xfc, 0x58, 0x44, + 0xbd, 0xcb, 0x45, 0xd4, 0xfb, 0xb5, 0x88, 0x7a, 0xc7, 0xef, 0x52, 0x05, 0x59, 0x35, 0x8d, 0x85, + 0x3e, 0x4b, 0xac, 0x68, 0xbb, 0xf9, 0x2c, 0xff, 0x9c, 0x92, 0x3a, 0xf1, 0xbe, 0x10, 0x7c, 0x2f, + 0xa4, 0x99, 0xae, 0xe2, 0x67, 0x79, 0xff, 0x37, 0x00, 0x00, 0xff, 0xff, 0x06, 0xe1, 0xb6, 0x7c, + 0x5d, 0x04, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -203,6 +185,16 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.ZetaAccounting.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x62 if len(m.InTxTrackerList) > 0 { for iNdEx := len(m.InTxTrackerList) - 1; iNdEx >= 0; iNdEx-- { { @@ -217,20 +209,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x5a } } - if len(m.TssHistory) > 0 { - for iNdEx := len(m.TssHistory) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.TssHistory[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x52 - } - } if len(m.InTxHashToCctxList) > 0 { for iNdEx := len(m.InTxHashToCctxList) - 1; iNdEx >= 0; iNdEx-- { { @@ -273,20 +251,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x3a } } - if len(m.ChainNoncesList) > 0 { - for iNdEx := len(m.ChainNoncesList) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ChainNoncesList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } if len(m.GasPriceList) > 0 { for iNdEx := len(m.GasPriceList) - 1; iNdEx >= 0; iNdEx-- { { @@ -301,18 +265,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x2a } } - if m.Tss != nil { - { - size, err := m.Tss.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } if len(m.OutTxTrackerList) > 0 { for iNdEx := len(m.OutTxTrackerList) - 1; iNdEx >= 0; iNdEx-- { { @@ -365,22 +317,12 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if m.Tss != nil { - l = m.Tss.Size() - n += 1 + l + sovGenesis(uint64(l)) - } if len(m.GasPriceList) > 0 { for _, e := range m.GasPriceList { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.ChainNoncesList) > 0 { - for _, e := range m.ChainNoncesList { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } if len(m.CrossChainTxs) > 0 { for _, e := range m.CrossChainTxs { l = e.Size() @@ -399,18 +341,14 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.TssHistory) > 0 { - for _, e := range m.TssHistory { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } if len(m.InTxTrackerList) > 0 { for _, e := range m.InTxTrackerList { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } } + l = m.ZetaAccounting.Size() + n += 1 + l + sovGenesis(uint64(l)) return n } @@ -516,42 +454,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tss", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Tss == nil { - m.Tss = &TSS{} - } - if err := m.Tss.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field GasPriceList", wireType) @@ -586,40 +488,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainNoncesList", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChainNoncesList = append(m.ChainNoncesList, &ChainNonces{}) - if err := m.ChainNoncesList[len(m.ChainNoncesList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CrossChainTxs", wireType) @@ -722,9 +590,9 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 10: + case 11: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TssHistory", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InTxTrackerList", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -751,14 +619,14 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TssHistory = append(m.TssHistory, TSS{}) - if err := m.TssHistory[len(m.TssHistory)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.InTxTrackerList = append(m.InTxTrackerList, InTxTracker{}) + if err := m.InTxTrackerList[len(m.InTxTrackerList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 11: + case 12: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InTxTrackerList", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ZetaAccounting", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -785,8 +653,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.InTxTrackerList = append(m.InTxTrackerList, InTxTracker{}) - if err := m.InTxTrackerList[len(m.InTxTrackerList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ZetaAccounting.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/crosschain/types/keys.go b/x/crosschain/types/keys.go index 5af95e2e3c..7e710562a4 100644 --- a/x/crosschain/types/keys.go +++ b/x/crosschain/types/keys.go @@ -36,28 +36,19 @@ func KeyPrefix(p string) []byte { } const ( - TxinKey = "Txin-value-" - TxinVoterKey = "TxinVoter-value-" - - TxoutKey = "Txout-value-" - TxoutCountKey = "Txout-count-" - TxoutConfirmationKey = "TxoutConfirmation-value-" - SendKey = "Send-value-" - VoteCounterKey = "VoteCounter-value-" - ReceiveKey = "Receive-value-" - LastBlockHeightKey = "LastBlockHeight-value-" - ChainNoncesKey = "ChainNonces-value-" - GasPriceKey = "GasPrice-value-" + SendKey = "Send-value-" + LastBlockHeightKey = "LastBlockHeight-value-" + + GasPriceKey = "GasPrice-value-" GasBalanceKey = "GasBalance-value-" - TSSKey = "TSS-value-" - TSSHistoryKey = "TSS-History-value-" OutTxTrackerKeyPrefix = "OutTxTracker-value-" InTxTrackerKeyPrefix = "InTxTracker-value-" - NonceToCctxKeyPrefix = "NonceToCctx-value-" - PendingNoncesKeyPrefix = "PendingNonces-value-" + // #nosec G101: Potential hardcoded credentials (gosec) + // ZetaAccountingKey value is used as prefix for storing ZetaAccountingKey + ZetaAccountingKey = "ZetaAccounting-value-" ) // OutTxTrackerKey returns the store key to retrieve a OutTxTracker from the index fields diff --git a/x/crosschain/types/message_add_to_in_tx_tracker_test.go b/x/crosschain/types/message_add_to_in_tx_tracker_test.go index 0bd45fbb7a..c05272224f 100644 --- a/x/crosschain/types/message_add_to_in_tx_tracker_test.go +++ b/x/crosschain/types/message_add_to_in_tx_tracker_test.go @@ -1,6 +1,3 @@ -//go:build TESTNET -// +build TESTNET - package types_test import ( diff --git a/x/crosschain/types/message_migrate_tss_funds_test.go b/x/crosschain/types/message_migrate_tss_funds_test.go index 6823553e29..a03a4e9ef4 100644 --- a/x/crosschain/types/message_migrate_tss_funds_test.go +++ b/x/crosschain/types/message_migrate_tss_funds_test.go @@ -6,8 +6,8 @@ import ( sdkmath "cosmossdk.io/math" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/x/crosschain/types" - observerTypes "github.com/zeta-chain/zetacore/x/observer/types" ) func TestNewMsgMigrateTssFunds(t *testing.T) { @@ -46,7 +46,7 @@ func TestNewMsgMigrateTssFunds(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - observerTypes.SetConfig(false) + keeper.SetConfig(false) err := tt.msg.ValidateBasic() if tt.error { require.Error(t, err) diff --git a/x/crosschain/types/message_nonce_voter.go b/x/crosschain/types/message_nonce_voter.go deleted file mode 100644 index ae0b6de15f..0000000000 --- a/x/crosschain/types/message_nonce_voter.go +++ /dev/null @@ -1,50 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/zeta-chain/zetacore/common" -) - -var _ sdk.Msg = &MsgNonceVoter{} - -func NewMsgNonceVoter(creator string, chain int64, nonce uint64) *MsgNonceVoter { - return &MsgNonceVoter{ - Creator: creator, - ChainId: chain, - Nonce: nonce, - } -} - -func (msg *MsgNonceVoter) Route() string { - return RouterKey -} - -func (msg *MsgNonceVoter) Type() string { - return common.NonceVoter.String() -} - -func (msg *MsgNonceVoter) GetSigners() []sdk.AccAddress { - creator, err := sdk.AccAddressFromBech32(msg.Creator) - if err != nil { - panic(err) - } - return []sdk.AccAddress{creator} -} - -func (msg *MsgNonceVoter) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgNonceVoter) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Creator) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) - } - if msg.ChainId < 0 { - return sdkerrors.Wrapf(ErrInvalidChainID, "chain id (%d)", msg.ChainId) - } - - return nil -} diff --git a/x/crosschain/types/message_set_node_keys.go b/x/crosschain/types/message_set_node_keys.go deleted file mode 100644 index 3b2c1abd48..0000000000 --- a/x/crosschain/types/message_set_node_keys.go +++ /dev/null @@ -1,62 +0,0 @@ -package types - -import ( - "bytes" - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/common/cosmos" -) - -var _ sdk.Msg = &MsgSetNodeKeys{} - -func NewMsgSetNodeKeys(creator string, pubkeySet common.PubKeySet, tssSignerAddress string) *MsgSetNodeKeys { - return &MsgSetNodeKeys{ - Creator: creator, - PubkeySet: &pubkeySet, - TssSigner_Address: tssSignerAddress, - } -} - -func (msg *MsgSetNodeKeys) Route() string { - return RouterKey -} - -func (msg *MsgSetNodeKeys) Type() string { - return "SetNodeKeys" -} - -func (msg *MsgSetNodeKeys) GetSigners() []sdk.AccAddress { - creator, err := sdk.AccAddressFromBech32(msg.Creator) - if err != nil { - panic(err) - } - return []sdk.AccAddress{creator} -} - -func (msg *MsgSetNodeKeys) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) -} - -func (msg *MsgSetNodeKeys) ValidateBasic() error { - accAddressCreator, err := sdk.AccAddressFromBech32(msg.TssSigner_Address) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid tss signer address (%s)", err) - } - pubkey, err := cosmos.GetPubKeyFromBech32(cosmos.Bech32PubKeyTypeAccPub, msg.PubkeySet.Secp256k1.String()) - if err != nil { - return sdkerrors.Wrapf(ErrInvalidPubKeySet, err.Error()) - } - if bytes.Compare(accAddressCreator.Bytes(), pubkey.Address().Bytes()) != 0 { - return sdkerrors.Wrapf(ErrInvalidPubKeySet, fmt.Sprintf("Creator : %s , PubkeySet %s", accAddressCreator.String(), pubkey.Address().String())) - } - _, err = sdk.AccAddressFromBech32(msg.Creator) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) - } - - return nil -} diff --git a/x/crosschain/types/message_set_node_keys_test.go b/x/crosschain/types/message_set_node_keys_test.go deleted file mode 100644 index b98194cd0c..0000000000 --- a/x/crosschain/types/message_set_node_keys_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - "github.com/cosmos/cosmos-sdk/crypto/hd" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/testutil/testdata" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/crypto" - "github.com/zeta-chain/zetacore/x/crosschain/types" - mc "github.com/zeta-chain/zetacore/zetaclient" -) - -func TestMsgSetNodeKeys_ValidateBasic(t *testing.T) { - registry := codectypes.NewInterfaceRegistry() - cryptocodec.RegisterInterfaces(registry) - cdc := codec.NewProtoCodec(registry) - kb := keyring.NewInMemory(cdc) - path := sdk.GetConfig().GetFullBIP44Path() - //_, err := kb.NewAccount("signerName", testdata.TestMnemonic, "", path, hd.Secp256k1) - //require.NoError(t, err) - _, err := kb.NewAccount(mc.GetGranteeKeyName("signerName"), testdata.TestMnemonic, "", path, hd.Secp256k1) - require.NoError(t, err) - granterAddress := sdk.AccAddress(crypto.AddressHash([]byte("granterAddress"))) - k := mc.NewKeysWithKeybase(kb, granterAddress, "signerName") - pubKeySet, err := k.GetPubKeySet() - assert.NoError(t, err) - addr, err := k.GetSignerInfo().GetAddress() - assert.NoError(t, err) - msg := types.MsgSetNodeKeys{ - Creator: addr.String(), - TssSigner_Address: addr.String(), - PubkeySet: &pubKeySet, - } - err = msg.ValidateBasic() - assert.NoError(t, err) -} diff --git a/x/crosschain/types/message_update_tss_address_test.go b/x/crosschain/types/message_update_tss_address_test.go index 52eb758d45..ae2bcb25a4 100644 --- a/x/crosschain/types/message_update_tss_address_test.go +++ b/x/crosschain/types/message_update_tss_address_test.go @@ -4,19 +4,19 @@ import ( "testing" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/x/crosschain/types" - observerTypes "github.com/zeta-chain/zetacore/x/observer/types" + "github.com/zeta-chain/zetacore/testutil/keeper" + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" ) func TestMessageUpdateTssAddress_ValidateBasic(t *testing.T) { tests := []struct { name string - msg types.MsgUpdateTssAddress + msg crosschaintypes.MsgUpdateTssAddress error bool }{ { name: "invalid creator", - msg: types.MsgUpdateTssAddress{ + msg: crosschaintypes.MsgUpdateTssAddress{ Creator: "invalid_address", TssPubkey: "zetapub1addwnpepq28c57cvcs0a2htsem5zxr6qnlvq9mzhmm76z3jncsnzz32rclangr2g35p", }, @@ -24,7 +24,7 @@ func TestMessageUpdateTssAddress_ValidateBasic(t *testing.T) { }, { name: "invalid pubkey", - msg: types.MsgUpdateTssAddress{ + msg: crosschaintypes.MsgUpdateTssAddress{ Creator: "zeta15ruj2tc76pnj9xtw64utktee7cc7w6vzaes73z", TssPubkey: "zetapub1addwnpepq28c57cvcs0a2htsem5zxr6qnlvq9mzhmm", }, @@ -32,7 +32,7 @@ func TestMessageUpdateTssAddress_ValidateBasic(t *testing.T) { }, { name: "valid msg", - msg: types.MsgUpdateTssAddress{ + msg: crosschaintypes.MsgUpdateTssAddress{ Creator: "zeta15ruj2tc76pnj9xtw64utktee7cc7w6vzaes73z", TssPubkey: "zetapub1addwnpepq28c57cvcs0a2htsem5zxr6qnlvq9mzhmm76z3jncsnzz32rclangr2g35p", }, @@ -42,7 +42,7 @@ func TestMessageUpdateTssAddress_ValidateBasic(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - observerTypes.SetConfig(false) + keeper.SetConfig(false) err := tt.msg.ValidateBasic() if tt.error { require.Error(t, err) diff --git a/x/crosschain/types/query.pb.go b/x/crosschain/types/query.pb.go index bac8d3450a..7273180766 100644 --- a/x/crosschain/types/query.pb.go +++ b/x/crosschain/types/query.pb.go @@ -31,22 +31,21 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type QueryCctxByStatusRequest struct { - Status CctxStatus `protobuf:"varint,1,opt,name=status,proto3,enum=zetachain.zetacore.crosschain.CctxStatus" json:"status,omitempty"` +type QueryZetaAccountingRequest struct { } -func (m *QueryCctxByStatusRequest) Reset() { *m = QueryCctxByStatusRequest{} } -func (m *QueryCctxByStatusRequest) String() string { return proto.CompactTextString(m) } -func (*QueryCctxByStatusRequest) ProtoMessage() {} -func (*QueryCctxByStatusRequest) Descriptor() ([]byte, []int) { +func (m *QueryZetaAccountingRequest) Reset() { *m = QueryZetaAccountingRequest{} } +func (m *QueryZetaAccountingRequest) String() string { return proto.CompactTextString(m) } +func (*QueryZetaAccountingRequest) ProtoMessage() {} +func (*QueryZetaAccountingRequest) Descriptor() ([]byte, []int) { return fileDescriptor_65a992045e92a606, []int{0} } -func (m *QueryCctxByStatusRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryZetaAccountingRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryCctxByStatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryZetaAccountingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryCctxByStatusRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryZetaAccountingRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -56,84 +55,34 @@ func (m *QueryCctxByStatusRequest) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } -func (m *QueryCctxByStatusRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryCctxByStatusRequest.Merge(m, src) +func (m *QueryZetaAccountingRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryZetaAccountingRequest.Merge(m, src) } -func (m *QueryCctxByStatusRequest) XXX_Size() int { +func (m *QueryZetaAccountingRequest) XXX_Size() int { return m.Size() } -func (m *QueryCctxByStatusRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryCctxByStatusRequest.DiscardUnknown(m) +func (m *QueryZetaAccountingRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryZetaAccountingRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryCctxByStatusRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryZetaAccountingRequest proto.InternalMessageInfo -func (m *QueryCctxByStatusRequest) GetStatus() CctxStatus { - if m != nil { - return m.Status - } - return CctxStatus_PendingInbound -} - -type QueryCctxByStatusResponse struct { - CrossChainTx []CrossChainTx `protobuf:"bytes,1,rep,name=CrossChainTx,proto3" json:"CrossChainTx"` +type QueryZetaAccountingResponse struct { + AbortedZetaAmount string `protobuf:"bytes,1,opt,name=aborted_zeta_amount,json=abortedZetaAmount,proto3" json:"aborted_zeta_amount,omitempty"` } -func (m *QueryCctxByStatusResponse) Reset() { *m = QueryCctxByStatusResponse{} } -func (m *QueryCctxByStatusResponse) String() string { return proto.CompactTextString(m) } -func (*QueryCctxByStatusResponse) ProtoMessage() {} -func (*QueryCctxByStatusResponse) Descriptor() ([]byte, []int) { +func (m *QueryZetaAccountingResponse) Reset() { *m = QueryZetaAccountingResponse{} } +func (m *QueryZetaAccountingResponse) String() string { return proto.CompactTextString(m) } +func (*QueryZetaAccountingResponse) ProtoMessage() {} +func (*QueryZetaAccountingResponse) Descriptor() ([]byte, []int) { return fileDescriptor_65a992045e92a606, []int{1} } -func (m *QueryCctxByStatusResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryCctxByStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryCctxByStatusResponse.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 *QueryCctxByStatusResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryCctxByStatusResponse.Merge(m, src) -} -func (m *QueryCctxByStatusResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryCctxByStatusResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryCctxByStatusResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryCctxByStatusResponse proto.InternalMessageInfo - -func (m *QueryCctxByStatusResponse) GetCrossChainTx() []CrossChainTx { - if m != nil { - return m.CrossChainTx - } - return nil -} - -type QueryTssHistoryRequest struct { -} - -func (m *QueryTssHistoryRequest) Reset() { *m = QueryTssHistoryRequest{} } -func (m *QueryTssHistoryRequest) String() string { return proto.CompactTextString(m) } -func (*QueryTssHistoryRequest) ProtoMessage() {} -func (*QueryTssHistoryRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{2} -} -func (m *QueryTssHistoryRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryZetaAccountingResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryTssHistoryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryZetaAccountingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryTssHistoryRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryZetaAccountingResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -143,60 +92,23 @@ func (m *QueryTssHistoryRequest) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *QueryTssHistoryRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryTssHistoryRequest.Merge(m, src) +func (m *QueryZetaAccountingResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryZetaAccountingResponse.Merge(m, src) } -func (m *QueryTssHistoryRequest) XXX_Size() int { +func (m *QueryZetaAccountingResponse) XXX_Size() int { return m.Size() } -func (m *QueryTssHistoryRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryTssHistoryRequest.DiscardUnknown(m) +func (m *QueryZetaAccountingResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryZetaAccountingResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryTssHistoryRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryZetaAccountingResponse proto.InternalMessageInfo -type QueryTssHistoryResponse struct { - TssList []TSS `protobuf:"bytes,1,rep,name=tss_list,json=tssList,proto3" json:"tss_list"` -} - -func (m *QueryTssHistoryResponse) Reset() { *m = QueryTssHistoryResponse{} } -func (m *QueryTssHistoryResponse) String() string { return proto.CompactTextString(m) } -func (*QueryTssHistoryResponse) ProtoMessage() {} -func (*QueryTssHistoryResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{3} -} -func (m *QueryTssHistoryResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryTssHistoryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryTssHistoryResponse.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 *QueryTssHistoryResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryTssHistoryResponse.Merge(m, src) -} -func (m *QueryTssHistoryResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryTssHistoryResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryTssHistoryResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryTssHistoryResponse proto.InternalMessageInfo - -func (m *QueryTssHistoryResponse) GetTssList() []TSS { +func (m *QueryZetaAccountingResponse) GetAbortedZetaAmount() string { if m != nil { - return m.TssList + return m.AbortedZetaAmount } - return nil + return "" } // QueryParamsRequest is request type for the Query/Params RPC method. @@ -207,7 +119,7 @@ func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{4} + return fileDescriptor_65a992045e92a606, []int{2} } func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -246,7 +158,7 @@ func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{5} + return fileDescriptor_65a992045e92a606, []int{3} } func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -291,7 +203,7 @@ func (m *QueryGetOutTxTrackerRequest) Reset() { *m = QueryGetOutTxTracke func (m *QueryGetOutTxTrackerRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetOutTxTrackerRequest) ProtoMessage() {} func (*QueryGetOutTxTrackerRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{6} + return fileDescriptor_65a992045e92a606, []int{4} } func (m *QueryGetOutTxTrackerRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -342,7 +254,7 @@ func (m *QueryGetOutTxTrackerResponse) Reset() { *m = QueryGetOutTxTrack func (m *QueryGetOutTxTrackerResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetOutTxTrackerResponse) ProtoMessage() {} func (*QueryGetOutTxTrackerResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{7} + return fileDescriptor_65a992045e92a606, []int{5} } func (m *QueryGetOutTxTrackerResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -386,7 +298,7 @@ func (m *QueryAllOutTxTrackerRequest) Reset() { *m = QueryAllOutTxTracke func (m *QueryAllOutTxTrackerRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllOutTxTrackerRequest) ProtoMessage() {} func (*QueryAllOutTxTrackerRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{8} + return fileDescriptor_65a992045e92a606, []int{6} } func (m *QueryAllOutTxTrackerRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -431,7 +343,7 @@ func (m *QueryAllOutTxTrackerResponse) Reset() { *m = QueryAllOutTxTrack func (m *QueryAllOutTxTrackerResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllOutTxTrackerResponse) ProtoMessage() {} func (*QueryAllOutTxTrackerResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{9} + return fileDescriptor_65a992045e92a606, []int{7} } func (m *QueryAllOutTxTrackerResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -483,7 +395,7 @@ func (m *QueryAllOutTxTrackerByChainRequest) Reset() { *m = QueryAllOutT func (m *QueryAllOutTxTrackerByChainRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllOutTxTrackerByChainRequest) ProtoMessage() {} func (*QueryAllOutTxTrackerByChainRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{10} + return fileDescriptor_65a992045e92a606, []int{8} } func (m *QueryAllOutTxTrackerByChainRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -535,7 +447,7 @@ func (m *QueryAllOutTxTrackerByChainResponse) Reset() { *m = QueryAllOut func (m *QueryAllOutTxTrackerByChainResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllOutTxTrackerByChainResponse) ProtoMessage() {} func (*QueryAllOutTxTrackerByChainResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{11} + return fileDescriptor_65a992045e92a606, []int{9} } func (m *QueryAllOutTxTrackerByChainResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -587,7 +499,7 @@ func (m *QueryAllInTxTrackerByChainRequest) Reset() { *m = QueryAllInTxT func (m *QueryAllInTxTrackerByChainRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllInTxTrackerByChainRequest) ProtoMessage() {} func (*QueryAllInTxTrackerByChainRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{12} + return fileDescriptor_65a992045e92a606, []int{10} } func (m *QueryAllInTxTrackerByChainRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -639,7 +551,7 @@ func (m *QueryAllInTxTrackerByChainResponse) Reset() { *m = QueryAllInTx func (m *QueryAllInTxTrackerByChainResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllInTxTrackerByChainResponse) ProtoMessage() {} func (*QueryAllInTxTrackerByChainResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{13} + return fileDescriptor_65a992045e92a606, []int{11} } func (m *QueryAllInTxTrackerByChainResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -683,13 +595,14 @@ func (m *QueryAllInTxTrackerByChainResponse) GetPagination() *query.PageResponse } type QueryAllInTxTrackersRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryAllInTxTrackersRequest) Reset() { *m = QueryAllInTxTrackersRequest{} } func (m *QueryAllInTxTrackersRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllInTxTrackersRequest) ProtoMessage() {} func (*QueryAllInTxTrackersRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{14} + return fileDescriptor_65a992045e92a606, []int{12} } func (m *QueryAllInTxTrackersRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -718,15 +631,23 @@ func (m *QueryAllInTxTrackersRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryAllInTxTrackersRequest proto.InternalMessageInfo +func (m *QueryAllInTxTrackersRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + type QueryAllInTxTrackersResponse struct { - InTxTracker []InTxTracker `protobuf:"bytes,1,rep,name=inTxTracker,proto3" json:"inTxTracker"` + InTxTracker []InTxTracker `protobuf:"bytes,1,rep,name=inTxTracker,proto3" json:"inTxTracker"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryAllInTxTrackersResponse) Reset() { *m = QueryAllInTxTrackersResponse{} } func (m *QueryAllInTxTrackersResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllInTxTrackersResponse) ProtoMessage() {} func (*QueryAllInTxTrackersResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{15} + return fileDescriptor_65a992045e92a606, []int{13} } func (m *QueryAllInTxTrackersResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -762,6 +683,13 @@ func (m *QueryAllInTxTrackersResponse) GetInTxTracker() []InTxTracker { return nil } +func (m *QueryAllInTxTrackersResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + type QueryGetInTxHashToCctxRequest struct { InTxHash string `protobuf:"bytes,1,opt,name=inTxHash,proto3" json:"inTxHash,omitempty"` } @@ -770,7 +698,7 @@ func (m *QueryGetInTxHashToCctxRequest) Reset() { *m = QueryGetInTxHashT func (m *QueryGetInTxHashToCctxRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetInTxHashToCctxRequest) ProtoMessage() {} func (*QueryGetInTxHashToCctxRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{16} + return fileDescriptor_65a992045e92a606, []int{14} } func (m *QueryGetInTxHashToCctxRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -814,7 +742,7 @@ func (m *QueryGetInTxHashToCctxResponse) Reset() { *m = QueryGetInTxHash func (m *QueryGetInTxHashToCctxResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetInTxHashToCctxResponse) ProtoMessage() {} func (*QueryGetInTxHashToCctxResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{17} + return fileDescriptor_65a992045e92a606, []int{15} } func (m *QueryGetInTxHashToCctxResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -858,7 +786,7 @@ func (m *QueryInTxHashToCctxDataRequest) Reset() { *m = QueryInTxHashToC func (m *QueryInTxHashToCctxDataRequest) String() string { return proto.CompactTextString(m) } func (*QueryInTxHashToCctxDataRequest) ProtoMessage() {} func (*QueryInTxHashToCctxDataRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{18} + return fileDescriptor_65a992045e92a606, []int{16} } func (m *QueryInTxHashToCctxDataRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -902,7 +830,7 @@ func (m *QueryInTxHashToCctxDataResponse) Reset() { *m = QueryInTxHashTo func (m *QueryInTxHashToCctxDataResponse) String() string { return proto.CompactTextString(m) } func (*QueryInTxHashToCctxDataResponse) ProtoMessage() {} func (*QueryInTxHashToCctxDataResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{19} + return fileDescriptor_65a992045e92a606, []int{17} } func (m *QueryInTxHashToCctxDataResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -946,7 +874,7 @@ func (m *QueryAllInTxHashToCctxRequest) Reset() { *m = QueryAllInTxHashT func (m *QueryAllInTxHashToCctxRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllInTxHashToCctxRequest) ProtoMessage() {} func (*QueryAllInTxHashToCctxRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{20} + return fileDescriptor_65a992045e92a606, []int{18} } func (m *QueryAllInTxHashToCctxRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -991,7 +919,7 @@ func (m *QueryAllInTxHashToCctxResponse) Reset() { *m = QueryAllInTxHash func (m *QueryAllInTxHashToCctxResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllInTxHashToCctxResponse) ProtoMessage() {} func (*QueryAllInTxHashToCctxResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{21} + return fileDescriptor_65a992045e92a606, []int{19} } func (m *QueryAllInTxHashToCctxResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1034,182 +962,6 @@ func (m *QueryAllInTxHashToCctxResponse) GetPagination() *query.PageResponse { return nil } -type QueryGetTssAddressRequest struct { - TssPubKey string `protobuf:"bytes,1,opt,name=tss_pub_key,json=tssPubKey,proto3" json:"tss_pub_key,omitempty"` -} - -func (m *QueryGetTssAddressRequest) Reset() { *m = QueryGetTssAddressRequest{} } -func (m *QueryGetTssAddressRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetTssAddressRequest) ProtoMessage() {} -func (*QueryGetTssAddressRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{22} -} -func (m *QueryGetTssAddressRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGetTssAddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGetTssAddressRequest.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 *QueryGetTssAddressRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetTssAddressRequest.Merge(m, src) -} -func (m *QueryGetTssAddressRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryGetTssAddressRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetTssAddressRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGetTssAddressRequest proto.InternalMessageInfo - -func (m *QueryGetTssAddressRequest) GetTssPubKey() string { - if m != nil { - return m.TssPubKey - } - return "" -} - -type QueryGetTssAddressResponse struct { - Eth string `protobuf:"bytes,1,opt,name=eth,proto3" json:"eth,omitempty"` - Btc string `protobuf:"bytes,2,opt,name=btc,proto3" json:"btc,omitempty"` -} - -func (m *QueryGetTssAddressResponse) Reset() { *m = QueryGetTssAddressResponse{} } -func (m *QueryGetTssAddressResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetTssAddressResponse) ProtoMessage() {} -func (*QueryGetTssAddressResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{23} -} -func (m *QueryGetTssAddressResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGetTssAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGetTssAddressResponse.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 *QueryGetTssAddressResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetTssAddressResponse.Merge(m, src) -} -func (m *QueryGetTssAddressResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryGetTssAddressResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetTssAddressResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGetTssAddressResponse proto.InternalMessageInfo - -func (m *QueryGetTssAddressResponse) GetEth() string { - if m != nil { - return m.Eth - } - return "" -} - -func (m *QueryGetTssAddressResponse) GetBtc() string { - if m != nil { - return m.Btc - } - return "" -} - -type QueryGetTSSRequest struct { -} - -func (m *QueryGetTSSRequest) Reset() { *m = QueryGetTSSRequest{} } -func (m *QueryGetTSSRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetTSSRequest) ProtoMessage() {} -func (*QueryGetTSSRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{24} -} -func (m *QueryGetTSSRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGetTSSRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGetTSSRequest.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 *QueryGetTSSRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetTSSRequest.Merge(m, src) -} -func (m *QueryGetTSSRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryGetTSSRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetTSSRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGetTSSRequest proto.InternalMessageInfo - -type QueryGetTSSResponse struct { - TSS *TSS `protobuf:"bytes,1,opt,name=TSS,proto3" json:"TSS,omitempty"` -} - -func (m *QueryGetTSSResponse) Reset() { *m = QueryGetTSSResponse{} } -func (m *QueryGetTSSResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetTSSResponse) ProtoMessage() {} -func (*QueryGetTSSResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{25} -} -func (m *QueryGetTSSResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryGetTSSResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryGetTSSResponse.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 *QueryGetTSSResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetTSSResponse.Merge(m, src) -} -func (m *QueryGetTSSResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryGetTSSResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetTSSResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryGetTSSResponse proto.InternalMessageInfo - -func (m *QueryGetTSSResponse) GetTSS() *TSS { - if m != nil { - return m.TSS - } - return nil -} - type QueryGetGasPriceRequest struct { Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` } @@ -1218,7 +970,7 @@ func (m *QueryGetGasPriceRequest) Reset() { *m = QueryGetGasPriceRequest func (m *QueryGetGasPriceRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetGasPriceRequest) ProtoMessage() {} func (*QueryGetGasPriceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{26} + return fileDescriptor_65a992045e92a606, []int{20} } func (m *QueryGetGasPriceRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1262,7 +1014,7 @@ func (m *QueryGetGasPriceResponse) Reset() { *m = QueryGetGasPriceRespon func (m *QueryGetGasPriceResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetGasPriceResponse) ProtoMessage() {} func (*QueryGetGasPriceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{27} + return fileDescriptor_65a992045e92a606, []int{21} } func (m *QueryGetGasPriceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1306,7 +1058,7 @@ func (m *QueryAllGasPriceRequest) Reset() { *m = QueryAllGasPriceRequest func (m *QueryAllGasPriceRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllGasPriceRequest) ProtoMessage() {} func (*QueryAllGasPriceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{28} + return fileDescriptor_65a992045e92a606, []int{22} } func (m *QueryAllGasPriceRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1351,7 +1103,7 @@ func (m *QueryAllGasPriceResponse) Reset() { *m = QueryAllGasPriceRespon func (m *QueryAllGasPriceResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllGasPriceResponse) ProtoMessage() {} func (*QueryAllGasPriceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{29} + return fileDescriptor_65a992045e92a606, []int{23} } func (m *QueryAllGasPriceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1394,22 +1146,22 @@ func (m *QueryAllGasPriceResponse) GetPagination() *query.PageResponse { return nil } -type QueryGetChainNoncesRequest struct { +type QueryGetLastBlockHeightRequest struct { Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` } -func (m *QueryGetChainNoncesRequest) Reset() { *m = QueryGetChainNoncesRequest{} } -func (m *QueryGetChainNoncesRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetChainNoncesRequest) ProtoMessage() {} -func (*QueryGetChainNoncesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{30} +func (m *QueryGetLastBlockHeightRequest) Reset() { *m = QueryGetLastBlockHeightRequest{} } +func (m *QueryGetLastBlockHeightRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetLastBlockHeightRequest) ProtoMessage() {} +func (*QueryGetLastBlockHeightRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_65a992045e92a606, []int{24} } -func (m *QueryGetChainNoncesRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryGetLastBlockHeightRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetChainNoncesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetLastBlockHeightRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetChainNoncesRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetLastBlockHeightRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1419,41 +1171,41 @@ func (m *QueryGetChainNoncesRequest) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *QueryGetChainNoncesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetChainNoncesRequest.Merge(m, src) +func (m *QueryGetLastBlockHeightRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetLastBlockHeightRequest.Merge(m, src) } -func (m *QueryGetChainNoncesRequest) XXX_Size() int { +func (m *QueryGetLastBlockHeightRequest) XXX_Size() int { return m.Size() } -func (m *QueryGetChainNoncesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetChainNoncesRequest.DiscardUnknown(m) +func (m *QueryGetLastBlockHeightRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetLastBlockHeightRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetChainNoncesRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryGetLastBlockHeightRequest proto.InternalMessageInfo -func (m *QueryGetChainNoncesRequest) GetIndex() string { +func (m *QueryGetLastBlockHeightRequest) GetIndex() string { if m != nil { return m.Index } return "" } -type QueryGetChainNoncesResponse struct { - ChainNonces *ChainNonces `protobuf:"bytes,1,opt,name=ChainNonces,proto3" json:"ChainNonces,omitempty"` +type QueryGetLastBlockHeightResponse struct { + LastBlockHeight *LastBlockHeight `protobuf:"bytes,1,opt,name=LastBlockHeight,proto3" json:"LastBlockHeight,omitempty"` } -func (m *QueryGetChainNoncesResponse) Reset() { *m = QueryGetChainNoncesResponse{} } -func (m *QueryGetChainNoncesResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetChainNoncesResponse) ProtoMessage() {} -func (*QueryGetChainNoncesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{31} +func (m *QueryGetLastBlockHeightResponse) Reset() { *m = QueryGetLastBlockHeightResponse{} } +func (m *QueryGetLastBlockHeightResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetLastBlockHeightResponse) ProtoMessage() {} +func (*QueryGetLastBlockHeightResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_65a992045e92a606, []int{25} } -func (m *QueryGetChainNoncesResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryGetLastBlockHeightResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetChainNoncesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetLastBlockHeightResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetChainNoncesResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetLastBlockHeightResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1463,41 +1215,41 @@ func (m *QueryGetChainNoncesResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryGetChainNoncesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetChainNoncesResponse.Merge(m, src) +func (m *QueryGetLastBlockHeightResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetLastBlockHeightResponse.Merge(m, src) } -func (m *QueryGetChainNoncesResponse) XXX_Size() int { +func (m *QueryGetLastBlockHeightResponse) XXX_Size() int { return m.Size() } -func (m *QueryGetChainNoncesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetChainNoncesResponse.DiscardUnknown(m) +func (m *QueryGetLastBlockHeightResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetLastBlockHeightResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetChainNoncesResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryGetLastBlockHeightResponse proto.InternalMessageInfo -func (m *QueryGetChainNoncesResponse) GetChainNonces() *ChainNonces { +func (m *QueryGetLastBlockHeightResponse) GetLastBlockHeight() *LastBlockHeight { if m != nil { - return m.ChainNonces + return m.LastBlockHeight } return nil } -type QueryAllChainNoncesRequest struct { +type QueryAllLastBlockHeightRequest struct { Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryAllChainNoncesRequest) Reset() { *m = QueryAllChainNoncesRequest{} } -func (m *QueryAllChainNoncesRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllChainNoncesRequest) ProtoMessage() {} -func (*QueryAllChainNoncesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{32} +func (m *QueryAllLastBlockHeightRequest) Reset() { *m = QueryAllLastBlockHeightRequest{} } +func (m *QueryAllLastBlockHeightRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllLastBlockHeightRequest) ProtoMessage() {} +func (*QueryAllLastBlockHeightRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_65a992045e92a606, []int{26} } -func (m *QueryAllChainNoncesRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryAllLastBlockHeightRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllChainNoncesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllLastBlockHeightRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllChainNoncesRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllLastBlockHeightRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1507,42 +1259,42 @@ func (m *QueryAllChainNoncesRequest) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *QueryAllChainNoncesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllChainNoncesRequest.Merge(m, src) +func (m *QueryAllLastBlockHeightRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllLastBlockHeightRequest.Merge(m, src) } -func (m *QueryAllChainNoncesRequest) XXX_Size() int { +func (m *QueryAllLastBlockHeightRequest) XXX_Size() int { return m.Size() } -func (m *QueryAllChainNoncesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllChainNoncesRequest.DiscardUnknown(m) +func (m *QueryAllLastBlockHeightRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllLastBlockHeightRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllChainNoncesRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryAllLastBlockHeightRequest proto.InternalMessageInfo -func (m *QueryAllChainNoncesRequest) GetPagination() *query.PageRequest { +func (m *QueryAllLastBlockHeightRequest) GetPagination() *query.PageRequest { if m != nil { return m.Pagination } return nil } -type QueryAllChainNoncesResponse struct { - ChainNonces []*ChainNonces `protobuf:"bytes,1,rep,name=ChainNonces,proto3" json:"ChainNonces,omitempty"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +type QueryAllLastBlockHeightResponse struct { + LastBlockHeight []*LastBlockHeight `protobuf:"bytes,1,rep,name=LastBlockHeight,proto3" json:"LastBlockHeight,omitempty"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryAllChainNoncesResponse) Reset() { *m = QueryAllChainNoncesResponse{} } -func (m *QueryAllChainNoncesResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllChainNoncesResponse) ProtoMessage() {} -func (*QueryAllChainNoncesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{33} +func (m *QueryAllLastBlockHeightResponse) Reset() { *m = QueryAllLastBlockHeightResponse{} } +func (m *QueryAllLastBlockHeightResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllLastBlockHeightResponse) ProtoMessage() {} +func (*QueryAllLastBlockHeightResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_65a992045e92a606, []int{27} } -func (m *QueryAllChainNoncesResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryAllLastBlockHeightResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllChainNoncesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllLastBlockHeightResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllChainNoncesResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllLastBlockHeightResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1552,47 +1304,48 @@ func (m *QueryAllChainNoncesResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryAllChainNoncesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllChainNoncesResponse.Merge(m, src) +func (m *QueryAllLastBlockHeightResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllLastBlockHeightResponse.Merge(m, src) } -func (m *QueryAllChainNoncesResponse) XXX_Size() int { +func (m *QueryAllLastBlockHeightResponse) XXX_Size() int { return m.Size() } -func (m *QueryAllChainNoncesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllChainNoncesResponse.DiscardUnknown(m) +func (m *QueryAllLastBlockHeightResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllLastBlockHeightResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllChainNoncesResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryAllLastBlockHeightResponse proto.InternalMessageInfo -func (m *QueryAllChainNoncesResponse) GetChainNonces() []*ChainNonces { +func (m *QueryAllLastBlockHeightResponse) GetLastBlockHeight() []*LastBlockHeight { if m != nil { - return m.ChainNonces + return m.LastBlockHeight } return nil } -func (m *QueryAllChainNoncesResponse) GetPagination() *query.PageResponse { +func (m *QueryAllLastBlockHeightResponse) GetPagination() *query.PageResponse { if m != nil { return m.Pagination } return nil } -type QueryAllPendingNoncesRequest struct { +type QueryGetCctxRequest struct { + Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` } -func (m *QueryAllPendingNoncesRequest) Reset() { *m = QueryAllPendingNoncesRequest{} } -func (m *QueryAllPendingNoncesRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllPendingNoncesRequest) ProtoMessage() {} -func (*QueryAllPendingNoncesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{34} +func (m *QueryGetCctxRequest) Reset() { *m = QueryGetCctxRequest{} } +func (m *QueryGetCctxRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetCctxRequest) ProtoMessage() {} +func (*QueryGetCctxRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_65a992045e92a606, []int{28} } -func (m *QueryAllPendingNoncesRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryGetCctxRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllPendingNoncesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetCctxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllPendingNoncesRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetCctxRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1602,34 +1355,42 @@ func (m *QueryAllPendingNoncesRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryAllPendingNoncesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllPendingNoncesRequest.Merge(m, src) +func (m *QueryGetCctxRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetCctxRequest.Merge(m, src) } -func (m *QueryAllPendingNoncesRequest) XXX_Size() int { +func (m *QueryGetCctxRequest) XXX_Size() int { return m.Size() } -func (m *QueryAllPendingNoncesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllPendingNoncesRequest.DiscardUnknown(m) +func (m *QueryGetCctxRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetCctxRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllPendingNoncesRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryGetCctxRequest proto.InternalMessageInfo + +func (m *QueryGetCctxRequest) GetIndex() string { + if m != nil { + return m.Index + } + return "" +} -type QueryAllPendingNoncesResponse struct { - PendingNonces []*PendingNonces `protobuf:"bytes,1,rep,name=pending_nonces,json=pendingNonces,proto3" json:"pending_nonces,omitempty"` +type QueryGetCctxByNonceRequest struct { + ChainID int64 `protobuf:"varint,1,opt,name=chainID,proto3" json:"chainID,omitempty"` + Nonce uint64 `protobuf:"varint,2,opt,name=nonce,proto3" json:"nonce,omitempty"` } -func (m *QueryAllPendingNoncesResponse) Reset() { *m = QueryAllPendingNoncesResponse{} } -func (m *QueryAllPendingNoncesResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllPendingNoncesResponse) ProtoMessage() {} -func (*QueryAllPendingNoncesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{35} +func (m *QueryGetCctxByNonceRequest) Reset() { *m = QueryGetCctxByNonceRequest{} } +func (m *QueryGetCctxByNonceRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetCctxByNonceRequest) ProtoMessage() {} +func (*QueryGetCctxByNonceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_65a992045e92a606, []int{29} } -func (m *QueryAllPendingNoncesResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryGetCctxByNonceRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllPendingNoncesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetCctxByNonceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllPendingNoncesResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetCctxByNonceRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1639,41 +1400,48 @@ func (m *QueryAllPendingNoncesResponse) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } -func (m *QueryAllPendingNoncesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllPendingNoncesResponse.Merge(m, src) +func (m *QueryGetCctxByNonceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetCctxByNonceRequest.Merge(m, src) } -func (m *QueryAllPendingNoncesResponse) XXX_Size() int { +func (m *QueryGetCctxByNonceRequest) XXX_Size() int { return m.Size() } -func (m *QueryAllPendingNoncesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllPendingNoncesResponse.DiscardUnknown(m) +func (m *QueryGetCctxByNonceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetCctxByNonceRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllPendingNoncesResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryGetCctxByNonceRequest proto.InternalMessageInfo -func (m *QueryAllPendingNoncesResponse) GetPendingNonces() []*PendingNonces { +func (m *QueryGetCctxByNonceRequest) GetChainID() int64 { if m != nil { - return m.PendingNonces + return m.ChainID } - return nil + return 0 } -type QueryPendingNoncesByChainRequest struct { - ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` +func (m *QueryGetCctxByNonceRequest) GetNonce() uint64 { + if m != nil { + return m.Nonce + } + return 0 } -func (m *QueryPendingNoncesByChainRequest) Reset() { *m = QueryPendingNoncesByChainRequest{} } -func (m *QueryPendingNoncesByChainRequest) String() string { return proto.CompactTextString(m) } -func (*QueryPendingNoncesByChainRequest) ProtoMessage() {} -func (*QueryPendingNoncesByChainRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{36} +type QueryGetCctxResponse struct { + CrossChainTx *CrossChainTx `protobuf:"bytes,1,opt,name=CrossChainTx,proto3" json:"CrossChainTx,omitempty"` } -func (m *QueryPendingNoncesByChainRequest) XXX_Unmarshal(b []byte) error { + +func (m *QueryGetCctxResponse) Reset() { *m = QueryGetCctxResponse{} } +func (m *QueryGetCctxResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetCctxResponse) ProtoMessage() {} +func (*QueryGetCctxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_65a992045e92a606, []int{30} +} +func (m *QueryGetCctxResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryPendingNoncesByChainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetCctxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryPendingNoncesByChainRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetCctxResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1683,41 +1451,41 @@ func (m *QueryPendingNoncesByChainRequest) XXX_Marshal(b []byte, deterministic b return b[:n], nil } } -func (m *QueryPendingNoncesByChainRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPendingNoncesByChainRequest.Merge(m, src) +func (m *QueryGetCctxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetCctxResponse.Merge(m, src) } -func (m *QueryPendingNoncesByChainRequest) XXX_Size() int { +func (m *QueryGetCctxResponse) XXX_Size() int { return m.Size() } -func (m *QueryPendingNoncesByChainRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPendingNoncesByChainRequest.DiscardUnknown(m) +func (m *QueryGetCctxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetCctxResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryPendingNoncesByChainRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryGetCctxResponse proto.InternalMessageInfo -func (m *QueryPendingNoncesByChainRequest) GetChainId() int64 { +func (m *QueryGetCctxResponse) GetCrossChainTx() *CrossChainTx { if m != nil { - return m.ChainId + return m.CrossChainTx } - return 0 + return nil } -type QueryPendingNoncesByChainResponse struct { - PendingNonces PendingNonces `protobuf:"bytes,1,opt,name=pending_nonces,json=pendingNonces,proto3" json:"pending_nonces"` +type QueryAllCctxRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryPendingNoncesByChainResponse) Reset() { *m = QueryPendingNoncesByChainResponse{} } -func (m *QueryPendingNoncesByChainResponse) String() string { return proto.CompactTextString(m) } -func (*QueryPendingNoncesByChainResponse) ProtoMessage() {} -func (*QueryPendingNoncesByChainResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{37} +func (m *QueryAllCctxRequest) Reset() { *m = QueryAllCctxRequest{} } +func (m *QueryAllCctxRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllCctxRequest) ProtoMessage() {} +func (*QueryAllCctxRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_65a992045e92a606, []int{31} } -func (m *QueryPendingNoncesByChainResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryAllCctxRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryPendingNoncesByChainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllCctxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryPendingNoncesByChainResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllCctxRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1727,41 +1495,42 @@ func (m *QueryPendingNoncesByChainResponse) XXX_Marshal(b []byte, deterministic return b[:n], nil } } -func (m *QueryPendingNoncesByChainResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPendingNoncesByChainResponse.Merge(m, src) +func (m *QueryAllCctxRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllCctxRequest.Merge(m, src) } -func (m *QueryPendingNoncesByChainResponse) XXX_Size() int { +func (m *QueryAllCctxRequest) XXX_Size() int { return m.Size() } -func (m *QueryPendingNoncesByChainResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPendingNoncesByChainResponse.DiscardUnknown(m) +func (m *QueryAllCctxRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllCctxRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryPendingNoncesByChainResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryAllCctxRequest proto.InternalMessageInfo -func (m *QueryPendingNoncesByChainResponse) GetPendingNonces() PendingNonces { +func (m *QueryAllCctxRequest) GetPagination() *query.PageRequest { if m != nil { - return m.PendingNonces + return m.Pagination } - return PendingNonces{} + return nil } -type QueryGetLastBlockHeightRequest struct { - Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` +type QueryAllCctxResponse struct { + CrossChainTx []*CrossChainTx `protobuf:"bytes,1,rep,name=CrossChainTx,proto3" json:"CrossChainTx,omitempty"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryGetLastBlockHeightRequest) Reset() { *m = QueryGetLastBlockHeightRequest{} } -func (m *QueryGetLastBlockHeightRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetLastBlockHeightRequest) ProtoMessage() {} -func (*QueryGetLastBlockHeightRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{38} +func (m *QueryAllCctxResponse) Reset() { *m = QueryAllCctxResponse{} } +func (m *QueryAllCctxResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllCctxResponse) ProtoMessage() {} +func (*QueryAllCctxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_65a992045e92a606, []int{32} } -func (m *QueryGetLastBlockHeightRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryAllCctxResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetLastBlockHeightRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllCctxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetLastBlockHeightRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllCctxResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1771,41 +1540,49 @@ func (m *QueryGetLastBlockHeightRequest) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } -func (m *QueryGetLastBlockHeightRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetLastBlockHeightRequest.Merge(m, src) +func (m *QueryAllCctxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllCctxResponse.Merge(m, src) } -func (m *QueryGetLastBlockHeightRequest) XXX_Size() int { +func (m *QueryAllCctxResponse) XXX_Size() int { return m.Size() } -func (m *QueryGetLastBlockHeightRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetLastBlockHeightRequest.DiscardUnknown(m) +func (m *QueryAllCctxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllCctxResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetLastBlockHeightRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryAllCctxResponse proto.InternalMessageInfo -func (m *QueryGetLastBlockHeightRequest) GetIndex() string { +func (m *QueryAllCctxResponse) GetCrossChainTx() []*CrossChainTx { if m != nil { - return m.Index + return m.CrossChainTx } - return "" + return nil } -type QueryGetLastBlockHeightResponse struct { - LastBlockHeight *LastBlockHeight `protobuf:"bytes,1,opt,name=LastBlockHeight,proto3" json:"LastBlockHeight,omitempty"` +func (m *QueryAllCctxResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil } -func (m *QueryGetLastBlockHeightResponse) Reset() { *m = QueryGetLastBlockHeightResponse{} } -func (m *QueryGetLastBlockHeightResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetLastBlockHeightResponse) ProtoMessage() {} -func (*QueryGetLastBlockHeightResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{39} +type QueryListCctxPendingRequest struct { + ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + Limit uint32 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` } -func (m *QueryGetLastBlockHeightResponse) XXX_Unmarshal(b []byte) error { + +func (m *QueryListCctxPendingRequest) Reset() { *m = QueryListCctxPendingRequest{} } +func (m *QueryListCctxPendingRequest) String() string { return proto.CompactTextString(m) } +func (*QueryListCctxPendingRequest) ProtoMessage() {} +func (*QueryListCctxPendingRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_65a992045e92a606, []int{33} +} +func (m *QueryListCctxPendingRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetLastBlockHeightResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryListCctxPendingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetLastBlockHeightResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryListCctxPendingRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1815,41 +1592,49 @@ func (m *QueryGetLastBlockHeightResponse) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } -func (m *QueryGetLastBlockHeightResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetLastBlockHeightResponse.Merge(m, src) +func (m *QueryListCctxPendingRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryListCctxPendingRequest.Merge(m, src) } -func (m *QueryGetLastBlockHeightResponse) XXX_Size() int { +func (m *QueryListCctxPendingRequest) XXX_Size() int { return m.Size() } -func (m *QueryGetLastBlockHeightResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetLastBlockHeightResponse.DiscardUnknown(m) +func (m *QueryListCctxPendingRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryListCctxPendingRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetLastBlockHeightResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryListCctxPendingRequest proto.InternalMessageInfo -func (m *QueryGetLastBlockHeightResponse) GetLastBlockHeight() *LastBlockHeight { +func (m *QueryListCctxPendingRequest) GetChainId() int64 { if m != nil { - return m.LastBlockHeight + return m.ChainId } - return nil + return 0 } -type QueryAllLastBlockHeightRequest struct { - Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +func (m *QueryListCctxPendingRequest) GetLimit() uint32 { + if m != nil { + return m.Limit + } + return 0 } -func (m *QueryAllLastBlockHeightRequest) Reset() { *m = QueryAllLastBlockHeightRequest{} } -func (m *QueryAllLastBlockHeightRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllLastBlockHeightRequest) ProtoMessage() {} -func (*QueryAllLastBlockHeightRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{40} +type QueryListCctxPendingResponse struct { + CrossChainTx []*CrossChainTx `protobuf:"bytes,1,rep,name=CrossChainTx,proto3" json:"CrossChainTx,omitempty"` + TotalPending uint64 `protobuf:"varint,2,opt,name=totalPending,proto3" json:"totalPending,omitempty"` } -func (m *QueryAllLastBlockHeightRequest) XXX_Unmarshal(b []byte) error { + +func (m *QueryListCctxPendingResponse) Reset() { *m = QueryListCctxPendingResponse{} } +func (m *QueryListCctxPendingResponse) String() string { return proto.CompactTextString(m) } +func (*QueryListCctxPendingResponse) ProtoMessage() {} +func (*QueryListCctxPendingResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_65a992045e92a606, []int{34} +} +func (m *QueryListCctxPendingResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllLastBlockHeightRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryListCctxPendingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllLastBlockHeightRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryListCctxPendingResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1859,42 +1644,47 @@ func (m *QueryAllLastBlockHeightRequest) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } -func (m *QueryAllLastBlockHeightRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllLastBlockHeightRequest.Merge(m, src) +func (m *QueryListCctxPendingResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryListCctxPendingResponse.Merge(m, src) } -func (m *QueryAllLastBlockHeightRequest) XXX_Size() int { +func (m *QueryListCctxPendingResponse) XXX_Size() int { return m.Size() } -func (m *QueryAllLastBlockHeightRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllLastBlockHeightRequest.DiscardUnknown(m) +func (m *QueryListCctxPendingResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryListCctxPendingResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllLastBlockHeightRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryListCctxPendingResponse proto.InternalMessageInfo -func (m *QueryAllLastBlockHeightRequest) GetPagination() *query.PageRequest { +func (m *QueryListCctxPendingResponse) GetCrossChainTx() []*CrossChainTx { if m != nil { - return m.Pagination + return m.CrossChainTx } return nil } -type QueryAllLastBlockHeightResponse struct { - LastBlockHeight []*LastBlockHeight `protobuf:"bytes,1,rep,name=LastBlockHeight,proto3" json:"LastBlockHeight,omitempty"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +func (m *QueryListCctxPendingResponse) GetTotalPending() uint64 { + if m != nil { + return m.TotalPending + } + return 0 } -func (m *QueryAllLastBlockHeightResponse) Reset() { *m = QueryAllLastBlockHeightResponse{} } -func (m *QueryAllLastBlockHeightResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllLastBlockHeightResponse) ProtoMessage() {} -func (*QueryAllLastBlockHeightResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{41} +type QueryLastZetaHeightRequest struct { } -func (m *QueryAllLastBlockHeightResponse) XXX_Unmarshal(b []byte) error { + +func (m *QueryLastZetaHeightRequest) Reset() { *m = QueryLastZetaHeightRequest{} } +func (m *QueryLastZetaHeightRequest) String() string { return proto.CompactTextString(m) } +func (*QueryLastZetaHeightRequest) ProtoMessage() {} +func (*QueryLastZetaHeightRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_65a992045e92a606, []int{35} +} +func (m *QueryLastZetaHeightRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllLastBlockHeightResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryLastZetaHeightRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllLastBlockHeightResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryLastZetaHeightRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1904,48 +1694,34 @@ func (m *QueryAllLastBlockHeightResponse) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } -func (m *QueryAllLastBlockHeightResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllLastBlockHeightResponse.Merge(m, src) +func (m *QueryLastZetaHeightRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLastZetaHeightRequest.Merge(m, src) } -func (m *QueryAllLastBlockHeightResponse) XXX_Size() int { +func (m *QueryLastZetaHeightRequest) XXX_Size() int { return m.Size() } -func (m *QueryAllLastBlockHeightResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllLastBlockHeightResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllLastBlockHeightResponse proto.InternalMessageInfo - -func (m *QueryAllLastBlockHeightResponse) GetLastBlockHeight() []*LastBlockHeight { - if m != nil { - return m.LastBlockHeight - } - return nil +func (m *QueryLastZetaHeightRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLastZetaHeightRequest.DiscardUnknown(m) } -func (m *QueryAllLastBlockHeightResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} +var xxx_messageInfo_QueryLastZetaHeightRequest proto.InternalMessageInfo -type QueryGetCctxRequest struct { - Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` +type QueryLastZetaHeightResponse struct { + Height int64 `protobuf:"varint,1,opt,name=Height,proto3" json:"Height,omitempty"` } -func (m *QueryGetCctxRequest) Reset() { *m = QueryGetCctxRequest{} } -func (m *QueryGetCctxRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetCctxRequest) ProtoMessage() {} -func (*QueryGetCctxRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{42} +func (m *QueryLastZetaHeightResponse) Reset() { *m = QueryLastZetaHeightResponse{} } +func (m *QueryLastZetaHeightResponse) String() string { return proto.CompactTextString(m) } +func (*QueryLastZetaHeightResponse) ProtoMessage() {} +func (*QueryLastZetaHeightResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_65a992045e92a606, []int{36} } -func (m *QueryGetCctxRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryLastZetaHeightResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetCctxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryLastZetaHeightResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetCctxRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryLastZetaHeightResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1955,42 +1731,42 @@ func (m *QueryGetCctxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *QueryGetCctxRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetCctxRequest.Merge(m, src) +func (m *QueryLastZetaHeightResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLastZetaHeightResponse.Merge(m, src) } -func (m *QueryGetCctxRequest) XXX_Size() int { +func (m *QueryLastZetaHeightResponse) XXX_Size() int { return m.Size() } -func (m *QueryGetCctxRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetCctxRequest.DiscardUnknown(m) +func (m *QueryLastZetaHeightResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLastZetaHeightResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetCctxRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryLastZetaHeightResponse proto.InternalMessageInfo -func (m *QueryGetCctxRequest) GetIndex() string { +func (m *QueryLastZetaHeightResponse) GetHeight() int64 { if m != nil { - return m.Index + return m.Height } - return "" + return 0 } -type QueryGetCctxByNonceRequest struct { - ChainID int64 `protobuf:"varint,1,opt,name=chainID,proto3" json:"chainID,omitempty"` - Nonce uint64 `protobuf:"varint,2,opt,name=nonce,proto3" json:"nonce,omitempty"` +type QueryConvertGasToZetaRequest struct { + ChainId int64 `protobuf:"varint,1,opt,name=chainId,proto3" json:"chainId,omitempty"` + GasLimit string `protobuf:"bytes,2,opt,name=gasLimit,proto3" json:"gasLimit,omitempty"` } -func (m *QueryGetCctxByNonceRequest) Reset() { *m = QueryGetCctxByNonceRequest{} } -func (m *QueryGetCctxByNonceRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetCctxByNonceRequest) ProtoMessage() {} -func (*QueryGetCctxByNonceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{43} +func (m *QueryConvertGasToZetaRequest) Reset() { *m = QueryConvertGasToZetaRequest{} } +func (m *QueryConvertGasToZetaRequest) String() string { return proto.CompactTextString(m) } +func (*QueryConvertGasToZetaRequest) ProtoMessage() {} +func (*QueryConvertGasToZetaRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_65a992045e92a606, []int{37} } -func (m *QueryGetCctxByNonceRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryConvertGasToZetaRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetCctxByNonceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryConvertGasToZetaRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetCctxByNonceRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryConvertGasToZetaRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -2000,48 +1776,50 @@ func (m *QueryGetCctxByNonceRequest) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *QueryGetCctxByNonceRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetCctxByNonceRequest.Merge(m, src) +func (m *QueryConvertGasToZetaRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryConvertGasToZetaRequest.Merge(m, src) } -func (m *QueryGetCctxByNonceRequest) XXX_Size() int { +func (m *QueryConvertGasToZetaRequest) XXX_Size() int { return m.Size() } -func (m *QueryGetCctxByNonceRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetCctxByNonceRequest.DiscardUnknown(m) +func (m *QueryConvertGasToZetaRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryConvertGasToZetaRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetCctxByNonceRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryConvertGasToZetaRequest proto.InternalMessageInfo -func (m *QueryGetCctxByNonceRequest) GetChainID() int64 { +func (m *QueryConvertGasToZetaRequest) GetChainId() int64 { if m != nil { - return m.ChainID + return m.ChainId } return 0 } -func (m *QueryGetCctxByNonceRequest) GetNonce() uint64 { +func (m *QueryConvertGasToZetaRequest) GetGasLimit() string { if m != nil { - return m.Nonce + return m.GasLimit } - return 0 + return "" } -type QueryGetCctxResponse struct { - CrossChainTx *CrossChainTx `protobuf:"bytes,1,opt,name=CrossChainTx,proto3" json:"CrossChainTx,omitempty"` +type QueryConvertGasToZetaResponse struct { + OutboundGasInZeta string `protobuf:"bytes,1,opt,name=outboundGasInZeta,proto3" json:"outboundGasInZeta,omitempty"` + ProtocolFeeInZeta string `protobuf:"bytes,2,opt,name=protocolFeeInZeta,proto3" json:"protocolFeeInZeta,omitempty"` + ZetaBlockHeight uint64 `protobuf:"varint,3,opt,name=ZetaBlockHeight,proto3" json:"ZetaBlockHeight,omitempty"` } -func (m *QueryGetCctxResponse) Reset() { *m = QueryGetCctxResponse{} } -func (m *QueryGetCctxResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetCctxResponse) ProtoMessage() {} -func (*QueryGetCctxResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{44} +func (m *QueryConvertGasToZetaResponse) Reset() { *m = QueryConvertGasToZetaResponse{} } +func (m *QueryConvertGasToZetaResponse) String() string { return proto.CompactTextString(m) } +func (*QueryConvertGasToZetaResponse) ProtoMessage() {} +func (*QueryConvertGasToZetaResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_65a992045e92a606, []int{38} } -func (m *QueryGetCctxResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryConvertGasToZetaResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetCctxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryConvertGasToZetaResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetCctxResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryConvertGasToZetaResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -2051,86 +1829,54 @@ func (m *QueryGetCctxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *QueryGetCctxResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetCctxResponse.Merge(m, src) +func (m *QueryConvertGasToZetaResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryConvertGasToZetaResponse.Merge(m, src) } -func (m *QueryGetCctxResponse) XXX_Size() int { +func (m *QueryConvertGasToZetaResponse) XXX_Size() int { return m.Size() } -func (m *QueryGetCctxResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetCctxResponse.DiscardUnknown(m) +func (m *QueryConvertGasToZetaResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryConvertGasToZetaResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetCctxResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryConvertGasToZetaResponse proto.InternalMessageInfo -func (m *QueryGetCctxResponse) GetCrossChainTx() *CrossChainTx { +func (m *QueryConvertGasToZetaResponse) GetOutboundGasInZeta() string { if m != nil { - return m.CrossChainTx + return m.OutboundGasInZeta } - return nil -} - -type QueryAllCctxRequest struct { - Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` + return "" } -func (m *QueryAllCctxRequest) Reset() { *m = QueryAllCctxRequest{} } -func (m *QueryAllCctxRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllCctxRequest) ProtoMessage() {} -func (*QueryAllCctxRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{45} -} -func (m *QueryAllCctxRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllCctxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllCctxRequest.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 *QueryConvertGasToZetaResponse) GetProtocolFeeInZeta() string { + if m != nil { + return m.ProtocolFeeInZeta } + return "" } -func (m *QueryAllCctxRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllCctxRequest.Merge(m, src) -} -func (m *QueryAllCctxRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAllCctxRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllCctxRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllCctxRequest proto.InternalMessageInfo -func (m *QueryAllCctxRequest) GetPagination() *query.PageRequest { +func (m *QueryConvertGasToZetaResponse) GetZetaBlockHeight() uint64 { if m != nil { - return m.Pagination + return m.ZetaBlockHeight } - return nil + return 0 } -type QueryAllCctxResponse struct { - CrossChainTx []*CrossChainTx `protobuf:"bytes,1,rep,name=CrossChainTx,proto3" json:"CrossChainTx,omitempty"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +type QueryMessagePassingProtocolFeeRequest struct { } -func (m *QueryAllCctxResponse) Reset() { *m = QueryAllCctxResponse{} } -func (m *QueryAllCctxResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllCctxResponse) ProtoMessage() {} -func (*QueryAllCctxResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{46} +func (m *QueryMessagePassingProtocolFeeRequest) Reset() { *m = QueryMessagePassingProtocolFeeRequest{} } +func (m *QueryMessagePassingProtocolFeeRequest) String() string { return proto.CompactTextString(m) } +func (*QueryMessagePassingProtocolFeeRequest) ProtoMessage() {} +func (*QueryMessagePassingProtocolFeeRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_65a992045e92a606, []int{39} } -func (m *QueryAllCctxResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryMessagePassingProtocolFeeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllCctxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryMessagePassingProtocolFeeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllCctxResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryMessagePassingProtocolFeeRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -2140,49 +1886,36 @@ func (m *QueryAllCctxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *QueryAllCctxResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllCctxResponse.Merge(m, src) +func (m *QueryMessagePassingProtocolFeeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMessagePassingProtocolFeeRequest.Merge(m, src) } -func (m *QueryAllCctxResponse) XXX_Size() int { +func (m *QueryMessagePassingProtocolFeeRequest) XXX_Size() int { return m.Size() } -func (m *QueryAllCctxResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllCctxResponse.DiscardUnknown(m) +func (m *QueryMessagePassingProtocolFeeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMessagePassingProtocolFeeRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllCctxResponse proto.InternalMessageInfo - -func (m *QueryAllCctxResponse) GetCrossChainTx() []*CrossChainTx { - if m != nil { - return m.CrossChainTx - } - return nil -} +var xxx_messageInfo_QueryMessagePassingProtocolFeeRequest proto.InternalMessageInfo -func (m *QueryAllCctxResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil +type QueryMessagePassingProtocolFeeResponse struct { + FeeInZeta string `protobuf:"bytes,1,opt,name=feeInZeta,proto3" json:"feeInZeta,omitempty"` } -type QueryAllCctxPendingRequest struct { - ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +func (m *QueryMessagePassingProtocolFeeResponse) Reset() { + *m = QueryMessagePassingProtocolFeeResponse{} } - -func (m *QueryAllCctxPendingRequest) Reset() { *m = QueryAllCctxPendingRequest{} } -func (m *QueryAllCctxPendingRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllCctxPendingRequest) ProtoMessage() {} -func (*QueryAllCctxPendingRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{47} +func (m *QueryMessagePassingProtocolFeeResponse) String() string { return proto.CompactTextString(m) } +func (*QueryMessagePassingProtocolFeeResponse) ProtoMessage() {} +func (*QueryMessagePassingProtocolFeeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_65a992045e92a606, []int{40} } -func (m *QueryAllCctxPendingRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryMessagePassingProtocolFeeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllCctxPendingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryMessagePassingProtocolFeeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllCctxPendingRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryMessagePassingProtocolFeeResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -2192,2474 +1925,1902 @@ func (m *QueryAllCctxPendingRequest) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *QueryAllCctxPendingRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllCctxPendingRequest.Merge(m, src) +func (m *QueryMessagePassingProtocolFeeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMessagePassingProtocolFeeResponse.Merge(m, src) } -func (m *QueryAllCctxPendingRequest) XXX_Size() int { +func (m *QueryMessagePassingProtocolFeeResponse) XXX_Size() int { return m.Size() } -func (m *QueryAllCctxPendingRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllCctxPendingRequest.DiscardUnknown(m) +func (m *QueryMessagePassingProtocolFeeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMessagePassingProtocolFeeResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllCctxPendingRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryMessagePassingProtocolFeeResponse proto.InternalMessageInfo -func (m *QueryAllCctxPendingRequest) GetChainId() int64 { +func (m *QueryMessagePassingProtocolFeeResponse) GetFeeInZeta() string { if m != nil { - return m.ChainId + return m.FeeInZeta } - return 0 + return "" } -func (m *QueryAllCctxPendingRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil +func init() { + proto.RegisterType((*QueryZetaAccountingRequest)(nil), "zetachain.zetacore.crosschain.QueryZetaAccountingRequest") + proto.RegisterType((*QueryZetaAccountingResponse)(nil), "zetachain.zetacore.crosschain.QueryZetaAccountingResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "zetachain.zetacore.crosschain.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "zetachain.zetacore.crosschain.QueryParamsResponse") + proto.RegisterType((*QueryGetOutTxTrackerRequest)(nil), "zetachain.zetacore.crosschain.QueryGetOutTxTrackerRequest") + proto.RegisterType((*QueryGetOutTxTrackerResponse)(nil), "zetachain.zetacore.crosschain.QueryGetOutTxTrackerResponse") + proto.RegisterType((*QueryAllOutTxTrackerRequest)(nil), "zetachain.zetacore.crosschain.QueryAllOutTxTrackerRequest") + proto.RegisterType((*QueryAllOutTxTrackerResponse)(nil), "zetachain.zetacore.crosschain.QueryAllOutTxTrackerResponse") + proto.RegisterType((*QueryAllOutTxTrackerByChainRequest)(nil), "zetachain.zetacore.crosschain.QueryAllOutTxTrackerByChainRequest") + proto.RegisterType((*QueryAllOutTxTrackerByChainResponse)(nil), "zetachain.zetacore.crosschain.QueryAllOutTxTrackerByChainResponse") + proto.RegisterType((*QueryAllInTxTrackerByChainRequest)(nil), "zetachain.zetacore.crosschain.QueryAllInTxTrackerByChainRequest") + proto.RegisterType((*QueryAllInTxTrackerByChainResponse)(nil), "zetachain.zetacore.crosschain.QueryAllInTxTrackerByChainResponse") + proto.RegisterType((*QueryAllInTxTrackersRequest)(nil), "zetachain.zetacore.crosschain.QueryAllInTxTrackersRequest") + proto.RegisterType((*QueryAllInTxTrackersResponse)(nil), "zetachain.zetacore.crosschain.QueryAllInTxTrackersResponse") + proto.RegisterType((*QueryGetInTxHashToCctxRequest)(nil), "zetachain.zetacore.crosschain.QueryGetInTxHashToCctxRequest") + proto.RegisterType((*QueryGetInTxHashToCctxResponse)(nil), "zetachain.zetacore.crosschain.QueryGetInTxHashToCctxResponse") + proto.RegisterType((*QueryInTxHashToCctxDataRequest)(nil), "zetachain.zetacore.crosschain.QueryInTxHashToCctxDataRequest") + proto.RegisterType((*QueryInTxHashToCctxDataResponse)(nil), "zetachain.zetacore.crosschain.QueryInTxHashToCctxDataResponse") + proto.RegisterType((*QueryAllInTxHashToCctxRequest)(nil), "zetachain.zetacore.crosschain.QueryAllInTxHashToCctxRequest") + proto.RegisterType((*QueryAllInTxHashToCctxResponse)(nil), "zetachain.zetacore.crosschain.QueryAllInTxHashToCctxResponse") + proto.RegisterType((*QueryGetGasPriceRequest)(nil), "zetachain.zetacore.crosschain.QueryGetGasPriceRequest") + proto.RegisterType((*QueryGetGasPriceResponse)(nil), "zetachain.zetacore.crosschain.QueryGetGasPriceResponse") + proto.RegisterType((*QueryAllGasPriceRequest)(nil), "zetachain.zetacore.crosschain.QueryAllGasPriceRequest") + proto.RegisterType((*QueryAllGasPriceResponse)(nil), "zetachain.zetacore.crosschain.QueryAllGasPriceResponse") + proto.RegisterType((*QueryGetLastBlockHeightRequest)(nil), "zetachain.zetacore.crosschain.QueryGetLastBlockHeightRequest") + proto.RegisterType((*QueryGetLastBlockHeightResponse)(nil), "zetachain.zetacore.crosschain.QueryGetLastBlockHeightResponse") + proto.RegisterType((*QueryAllLastBlockHeightRequest)(nil), "zetachain.zetacore.crosschain.QueryAllLastBlockHeightRequest") + proto.RegisterType((*QueryAllLastBlockHeightResponse)(nil), "zetachain.zetacore.crosschain.QueryAllLastBlockHeightResponse") + proto.RegisterType((*QueryGetCctxRequest)(nil), "zetachain.zetacore.crosschain.QueryGetCctxRequest") + proto.RegisterType((*QueryGetCctxByNonceRequest)(nil), "zetachain.zetacore.crosschain.QueryGetCctxByNonceRequest") + proto.RegisterType((*QueryGetCctxResponse)(nil), "zetachain.zetacore.crosschain.QueryGetCctxResponse") + proto.RegisterType((*QueryAllCctxRequest)(nil), "zetachain.zetacore.crosschain.QueryAllCctxRequest") + proto.RegisterType((*QueryAllCctxResponse)(nil), "zetachain.zetacore.crosschain.QueryAllCctxResponse") + proto.RegisterType((*QueryListCctxPendingRequest)(nil), "zetachain.zetacore.crosschain.QueryListCctxPendingRequest") + proto.RegisterType((*QueryListCctxPendingResponse)(nil), "zetachain.zetacore.crosschain.QueryListCctxPendingResponse") + proto.RegisterType((*QueryLastZetaHeightRequest)(nil), "zetachain.zetacore.crosschain.QueryLastZetaHeightRequest") + proto.RegisterType((*QueryLastZetaHeightResponse)(nil), "zetachain.zetacore.crosschain.QueryLastZetaHeightResponse") + proto.RegisterType((*QueryConvertGasToZetaRequest)(nil), "zetachain.zetacore.crosschain.QueryConvertGasToZetaRequest") + proto.RegisterType((*QueryConvertGasToZetaResponse)(nil), "zetachain.zetacore.crosschain.QueryConvertGasToZetaResponse") + proto.RegisterType((*QueryMessagePassingProtocolFeeRequest)(nil), "zetachain.zetacore.crosschain.QueryMessagePassingProtocolFeeRequest") + proto.RegisterType((*QueryMessagePassingProtocolFeeResponse)(nil), "zetachain.zetacore.crosschain.QueryMessagePassingProtocolFeeResponse") } -type QueryAllCctxPendingResponse struct { - CrossChainTx []*CrossChainTx `protobuf:"bytes,1,rep,name=CrossChainTx,proto3" json:"CrossChainTx,omitempty"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} +func init() { proto.RegisterFile("crosschain/query.proto", fileDescriptor_65a992045e92a606) } -func (m *QueryAllCctxPendingResponse) Reset() { *m = QueryAllCctxPendingResponse{} } -func (m *QueryAllCctxPendingResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllCctxPendingResponse) ProtoMessage() {} -func (*QueryAllCctxPendingResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{48} -} -func (m *QueryAllCctxPendingResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllCctxPendingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllCctxPendingResponse.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 *QueryAllCctxPendingResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllCctxPendingResponse.Merge(m, src) +var fileDescriptor_65a992045e92a606 = []byte{ + // 1782 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x59, 0xdf, 0x6f, 0x14, 0x55, + 0x14, 0xee, 0xed, 0xd2, 0x52, 0x6e, 0x0b, 0x95, 0x4b, 0x85, 0x3a, 0xb4, 0x5b, 0x98, 0x5a, 0x5a, + 0xc1, 0xee, 0xd0, 0x02, 0x45, 0xa0, 0x18, 0xb7, 0x45, 0x0a, 0xb1, 0x40, 0xdd, 0xd4, 0x68, 0x30, + 0x66, 0x73, 0x3b, 0x3b, 0xce, 0x4e, 0x98, 0xce, 0x94, 0x9d, 0x59, 0xd2, 0xd2, 0xf4, 0x85, 0x07, + 0x5f, 0x7c, 0x31, 0x21, 0xd1, 0x17, 0x5f, 0x8d, 0x3e, 0xf8, 0xe0, 0x83, 0xd1, 0x07, 0x13, 0x8c, + 0x51, 0x91, 0x47, 0x12, 0x13, 0x63, 0x34, 0x31, 0x06, 0xfc, 0x43, 0xcc, 0xdc, 0x39, 0xb3, 0x7b, + 0xe7, 0xd7, 0xee, 0xed, 0x76, 0x79, 0xe0, 0xa9, 0x3b, 0x73, 0xef, 0x39, 0xe7, 0xfb, 0xbe, 0xfb, + 0x63, 0xce, 0x39, 0xc5, 0x07, 0xd5, 0x8a, 0xed, 0x38, 0x6a, 0x99, 0x1a, 0x96, 0x72, 0xbb, 0xaa, + 0x55, 0x36, 0x72, 0x6b, 0x15, 0xdb, 0xb5, 0xc9, 0xf0, 0x5d, 0xcd, 0xa5, 0xec, 0x75, 0x8e, 0xfd, + 0xb2, 0x2b, 0x5a, 0xae, 0x3e, 0x55, 0x3a, 0xae, 0xda, 0xce, 0xaa, 0xed, 0x28, 0x2b, 0xd4, 0xd1, + 0x7c, 0x3b, 0xe5, 0xce, 0xd4, 0x8a, 0xe6, 0xd2, 0x29, 0x65, 0x8d, 0xea, 0x86, 0x45, 0x5d, 0xc3, + 0xb6, 0x7c, 0x57, 0xd2, 0x08, 0x17, 0x82, 0xfd, 0x2c, 0xb2, 0xdf, 0x45, 0x77, 0x1d, 0x26, 0x48, + 0xdc, 0x04, 0x9d, 0x3a, 0xc5, 0xb5, 0x8a, 0xa1, 0x6a, 0x30, 0x36, 0xca, 0x8d, 0x31, 0x9b, 0x62, + 0x99, 0x3a, 0xe5, 0xa2, 0x6b, 0x17, 0x55, 0xb5, 0xe6, 0x20, 0x1b, 0x9b, 0xe4, 0x56, 0xa8, 0x7a, + 0x4b, 0xab, 0xc0, 0xb8, 0xcc, 0x8d, 0x9b, 0xd4, 0x71, 0x8b, 0x2b, 0xa6, 0xad, 0xde, 0x2a, 0x96, + 0x35, 0x43, 0x2f, 0xbb, 0x09, 0x28, 0xed, 0xaa, 0x1b, 0x77, 0x72, 0x88, 0x9b, 0xb0, 0x46, 0x2b, + 0x74, 0xd5, 0x81, 0x81, 0x01, 0xdd, 0xd6, 0x6d, 0xf6, 0x53, 0xf1, 0x7e, 0xc1, 0xdb, 0x21, 0xdd, + 0xb6, 0x75, 0x53, 0x53, 0xe8, 0x9a, 0xa1, 0x50, 0xcb, 0xb2, 0x5d, 0x26, 0x09, 0xd8, 0xc8, 0x43, + 0x58, 0x7a, 0xdb, 0x53, 0xed, 0xa6, 0xe6, 0xd2, 0xbc, 0xaa, 0xda, 0x55, 0xcb, 0x35, 0x2c, 0xbd, + 0xa0, 0xdd, 0xae, 0x6a, 0x8e, 0x2b, 0x5f, 0xc3, 0x87, 0x13, 0x47, 0x9d, 0x35, 0xdb, 0x72, 0x34, + 0x92, 0xc3, 0x07, 0xe8, 0x8a, 0x5d, 0x71, 0xb5, 0x52, 0xd1, 0x5b, 0x9b, 0x22, 0x5d, 0xf5, 0x66, + 0x0c, 0xa2, 0x23, 0x68, 0x62, 0x4f, 0x61, 0x3f, 0x0c, 0x31, 0x5b, 0x36, 0x20, 0x0f, 0x60, 0xc2, + 0xdc, 0x2d, 0x31, 0xd4, 0x41, 0x90, 0x9b, 0xf8, 0x40, 0xe8, 0x2d, 0x38, 0x9f, 0xc7, 0xdd, 0x3e, + 0x3b, 0xe6, 0xaf, 0x77, 0x7a, 0x2c, 0xd7, 0x70, 0x27, 0xe4, 0x7c, 0xf3, 0xb9, 0x5d, 0x8f, 0xfe, + 0x19, 0xe9, 0x28, 0x80, 0x69, 0x8d, 0xc0, 0x82, 0xe6, 0xde, 0xa8, 0xba, 0xcb, 0xeb, 0xcb, 0xbe, + 0x92, 0x10, 0x9a, 0x0c, 0xe2, 0xdd, 0xcc, 0xf8, 0xea, 0x25, 0x16, 0x24, 0x53, 0x08, 0x1e, 0xc9, + 0x00, 0xee, 0xb2, 0x6c, 0x4b, 0xd5, 0x06, 0x3b, 0x8f, 0xa0, 0x89, 0x5d, 0x05, 0xff, 0x41, 0xae, + 0xe2, 0xa1, 0x64, 0x77, 0x80, 0xf9, 0x1d, 0xdc, 0x67, 0x73, 0xef, 0x01, 0xf9, 0x89, 0x26, 0xc8, + 0x79, 0x57, 0x80, 0x3f, 0xe4, 0x46, 0xd6, 0x80, 0x45, 0xde, 0x34, 0x93, 0x58, 0x5c, 0xc6, 0xb8, + 0xbe, 0xd7, 0x21, 0xe6, 0xb1, 0x9c, 0x7f, 0x30, 0x72, 0xde, 0xc1, 0xc8, 0xf9, 0x07, 0x0a, 0x0e, + 0x46, 0x6e, 0x89, 0xea, 0x1a, 0xd8, 0x16, 0x38, 0x4b, 0xf9, 0x01, 0x02, 0x7a, 0xb1, 0x38, 0xa9, + 0xf4, 0x32, 0x6d, 0xa0, 0x47, 0x16, 0x42, 0xf8, 0x3b, 0x19, 0xfe, 0xf1, 0xa6, 0xf8, 0x7d, 0x4c, + 0x21, 0x02, 0xf7, 0x10, 0x96, 0x93, 0x08, 0xcc, 0x6d, 0xcc, 0x7b, 0x48, 0x02, 0xbd, 0x06, 0x70, + 0x17, 0x43, 0x06, 0x6b, 0xee, 0x3f, 0x44, 0x54, 0xec, 0x6c, 0x59, 0xc5, 0x5f, 0x11, 0x1e, 0x6d, + 0x08, 0xe2, 0x39, 0x11, 0xf3, 0x23, 0x84, 0x8f, 0x06, 0x3c, 0xae, 0x5a, 0x69, 0x5a, 0xbe, 0x84, + 0x7b, 0xfc, 0x4b, 0xd4, 0x28, 0x85, 0x8f, 0x50, 0xa9, 0x6d, 0x82, 0xfe, 0xc4, 0xad, 0x6a, 0x12, + 0x10, 0xd0, 0xb3, 0x80, 0x7b, 0x0d, 0x2b, 0x2a, 0xe7, 0xf1, 0x26, 0x72, 0xf2, 0xfe, 0x7c, 0x35, + 0x79, 0x27, 0xed, 0x13, 0x93, 0x3b, 0xc1, 0x5c, 0x48, 0xa7, 0xdd, 0x27, 0xf8, 0x07, 0xee, 0x04, + 0x87, 0xe3, 0x3c, 0x0f, 0x22, 0x5d, 0xc0, 0xc3, 0xc1, 0xed, 0xea, 0x85, 0xbc, 0x42, 0x9d, 0xf2, + 0xb2, 0x3d, 0xaf, 0xba, 0xeb, 0x81, 0x4c, 0x12, 0xee, 0x31, 0x60, 0x00, 0x3e, 0x32, 0xb5, 0x67, + 0x79, 0x0b, 0x67, 0xd3, 0x8c, 0x81, 0xfb, 0xfb, 0x78, 0x9f, 0x11, 0x1a, 0x01, 0xa1, 0x27, 0x05, + 0xe8, 0xd7, 0x8d, 0x40, 0x81, 0x88, 0x2b, 0x79, 0x16, 0xc2, 0x87, 0x27, 0x5f, 0xa2, 0x2e, 0x15, + 0x01, 0x7f, 0x17, 0x8f, 0xa4, 0x5a, 0x03, 0xfa, 0x77, 0xf1, 0xde, 0x79, 0x0f, 0x13, 0xdb, 0xf4, + 0xcb, 0xeb, 0x8e, 0xe0, 0x7d, 0xc1, 0xdb, 0x00, 0xf4, 0xb0, 0x1f, 0x59, 0x07, 0xd5, 0x61, 0xcb, + 0xc4, 0x55, 0x6f, 0xd7, 0xe6, 0x7c, 0x88, 0x40, 0xa3, 0x84, 0x48, 0x0d, 0x96, 0x28, 0xd3, 0xa6, + 0x25, 0x6a, 0xdf, 0x3e, 0x55, 0xf0, 0xa1, 0x60, 0xab, 0x2d, 0x50, 0x67, 0xc9, 0x4b, 0x12, 0xb9, + 0x4f, 0x8b, 0x61, 0x95, 0xb4, 0x75, 0x58, 0x61, 0xff, 0x41, 0x2e, 0xe2, 0xc1, 0xb8, 0x41, 0x2d, + 0xcd, 0xe9, 0x09, 0xde, 0x81, 0xb6, 0xe3, 0x4d, 0xc8, 0xd6, 0x5c, 0xd4, 0x0c, 0x65, 0x0a, 0x88, + 0xf2, 0xa6, 0x19, 0x45, 0xd4, 0xae, 0xd5, 0xfb, 0x0a, 0x01, 0x89, 0x50, 0x8c, 0x44, 0x12, 0x99, + 0x96, 0x48, 0xb4, 0x6f, 0x7d, 0x66, 0xea, 0x57, 0xc1, 0x22, 0x75, 0xdc, 0x39, 0x2f, 0xc7, 0xbe, + 0xc2, 0x52, 0xec, 0xc6, 0xcb, 0xb4, 0x09, 0xa7, 0x30, 0xc9, 0x0e, 0x88, 0xbe, 0x87, 0xfb, 0x23, + 0x43, 0x20, 0x69, 0xae, 0x09, 0xdf, 0xa8, 0xc3, 0xa8, 0x1b, 0xb9, 0x5c, 0x3f, 0x1c, 0x29, 0xa0, + 0xdb, 0xb5, 0x92, 0xbf, 0x20, 0xe0, 0x99, 0x14, 0xaa, 0x11, 0xcf, 0x4c, 0x1b, 0x78, 0xb6, 0x6f, + 0x95, 0x4f, 0x40, 0xd9, 0xb0, 0xa0, 0xb9, 0xfc, 0x6d, 0x95, 0xbc, 0xb4, 0x8b, 0x50, 0xe6, 0xc0, + 0xe4, 0xb9, 0x8d, 0xeb, 0x5e, 0x3e, 0xdf, 0x6a, 0x19, 0xa0, 0xe3, 0x81, 0x70, 0x68, 0x50, 0xed, + 0x06, 0xee, 0xe3, 0xef, 0x56, 0xc1, 0xf4, 0x9f, 0x37, 0x29, 0x84, 0x1c, 0xc8, 0x1f, 0x00, 0xc7, + 0xbc, 0x69, 0x3e, 0x8b, 0x1b, 0xf9, 0x1b, 0x04, 0x44, 0x6a, 0xfe, 0x53, 0x89, 0x64, 0x76, 0x44, + 0xa4, 0x7d, 0xab, 0x7e, 0x1d, 0x12, 0xa9, 0x45, 0xc3, 0x61, 0xda, 0x2f, 0x69, 0x56, 0xa9, 0x5e, + 0xb0, 0x36, 0x4a, 0x47, 0x07, 0x70, 0x97, 0x69, 0xac, 0x1a, 0x2e, 0x8b, 0xbe, 0xb7, 0xe0, 0x3f, + 0xc8, 0xf7, 0x83, 0x8c, 0x29, 0xe6, 0xf0, 0x59, 0x49, 0x21, 0xe3, 0x3e, 0xd7, 0x76, 0xa9, 0x09, + 0x81, 0x60, 0x67, 0x85, 0xde, 0xd5, 0xaa, 0x72, 0xef, 0xf0, 0x78, 0xf5, 0x73, 0xe8, 0x22, 0x90, + 0xcf, 0x04, 0x1a, 0x44, 0x46, 0x01, 0xf1, 0x41, 0xdc, 0xcd, 0x5d, 0x4d, 0x99, 0x02, 0x3c, 0xc9, + 0xcb, 0xc0, 0x74, 0xde, 0xb6, 0xee, 0x68, 0x15, 0xef, 0x4b, 0xb4, 0x6c, 0x7b, 0xe6, 0xb1, 0x53, + 0x10, 0x93, 0x4e, 0xc2, 0x3d, 0x3a, 0x75, 0x16, 0x6b, 0xea, 0xed, 0x29, 0xd4, 0x9e, 0xe5, 0x2f, + 0x10, 0xe4, 0x0f, 0x71, 0xb7, 0x80, 0xe7, 0x55, 0xbc, 0xdf, 0xae, 0xba, 0x2b, 0x76, 0xd5, 0x2a, + 0x2d, 0x50, 0xe7, 0xaa, 0xe5, 0x0d, 0x06, 0x3d, 0x82, 0xd8, 0x80, 0x37, 0x9b, 0x75, 0x26, 0x54, + 0xdb, 0xbc, 0xac, 0x69, 0x30, 0xdb, 0x0f, 0x1a, 0x1f, 0x20, 0x13, 0xb8, 0xdf, 0xfb, 0xcb, 0xdf, + 0x53, 0x19, 0xa6, 0x67, 0xf4, 0xb5, 0x3c, 0x8e, 0xc7, 0x18, 0xcc, 0x6b, 0x9a, 0xe3, 0x50, 0x5d, + 0x5b, 0xa2, 0x8e, 0x63, 0x58, 0xfa, 0x52, 0xdd, 0x63, 0xa0, 0xee, 0x65, 0x7c, 0xac, 0xd9, 0x44, + 0x20, 0x36, 0x84, 0xf7, 0x7c, 0x58, 0x83, 0xe8, 0x13, 0xaa, 0xbf, 0x98, 0xfe, 0x78, 0x04, 0x77, + 0x31, 0x47, 0xe4, 0x53, 0x84, 0xbb, 0xfd, 0xee, 0x04, 0x99, 0x6a, 0xb2, 0x6f, 0xe2, 0xed, 0x11, + 0x69, 0x7a, 0x3b, 0x26, 0x3e, 0x32, 0x79, 0xec, 0xde, 0xef, 0xff, 0xdd, 0xef, 0x1c, 0x21, 0xc3, + 0x8a, 0x67, 0x31, 0xc9, 0xb5, 0xbc, 0xf8, 0xb6, 0x11, 0x79, 0x88, 0x70, 0x1f, 0x5f, 0x50, 0x92, + 0xf3, 0x22, 0xb1, 0x92, 0x7b, 0x29, 0xd2, 0x85, 0x96, 0x6c, 0x01, 0xf0, 0x45, 0x06, 0xf8, 0x2c, + 0x39, 0x93, 0x02, 0x98, 0x2f, 0x71, 0x95, 0x4d, 0xb8, 0x9d, 0xb7, 0x94, 0x4d, 0x76, 0x1f, 0x6f, + 0x91, 0xef, 0x11, 0xee, 0xe7, 0xfd, 0xe6, 0x4d, 0x53, 0x8c, 0x4b, 0x72, 0x47, 0x45, 0x8c, 0x4b, + 0x4a, 0x97, 0x44, 0x3e, 0xc1, 0xb8, 0x8c, 0x91, 0x51, 0x01, 0x2e, 0xe4, 0x6f, 0x84, 0x0f, 0x46, + 0x90, 0x43, 0x61, 0x4b, 0xf2, 0x2d, 0x80, 0x08, 0x57, 0xe7, 0xd2, 0xdc, 0x4e, 0x5c, 0x00, 0x9d, + 0xf3, 0x8c, 0xce, 0x69, 0x32, 0x2d, 0x40, 0x07, 0x6c, 0x61, 0x85, 0xb6, 0xc8, 0x5f, 0x08, 0xbf, + 0xc8, 0x55, 0x8f, 0x1c, 0xb9, 0x37, 0x04, 0x91, 0xa5, 0x76, 0x1e, 0xa4, 0xfc, 0x0e, 0x3c, 0x00, + 0xb5, 0x59, 0x46, 0x6d, 0x86, 0x9c, 0x4e, 0xa1, 0x66, 0x58, 0x29, 0xcc, 0x8a, 0x46, 0x69, 0x8b, + 0x7c, 0x87, 0xf0, 0xbe, 0x30, 0x39, 0xe1, 0x3d, 0x97, 0xd0, 0x03, 0x10, 0xde, 0x73, 0x49, 0x75, + 0x7d, 0xd3, 0x3d, 0xc7, 0x31, 0x71, 0xc8, 0x6f, 0x00, 0x9c, 0xab, 0x8d, 0x66, 0x05, 0x0f, 0x6f, + 0x62, 0x85, 0x28, 0x5d, 0x6c, 0xd1, 0x1a, 0xc0, 0xbf, 0xc6, 0xc0, 0x4f, 0x93, 0x93, 0x0d, 0xc0, + 0xd7, 0xcd, 0x94, 0xcd, 0xe0, 0x79, 0x8b, 0xfc, 0x81, 0x30, 0x89, 0xd7, 0xcc, 0x44, 0x08, 0x4f, + 0x6a, 0xa5, 0x2e, 0xbd, 0xde, 0xaa, 0x39, 0xf0, 0xc9, 0x33, 0x3e, 0x17, 0xc8, 0xb9, 0x54, 0x3e, + 0xd1, 0x7f, 0x1f, 0x14, 0x4b, 0xd4, 0xa5, 0x3c, 0xb1, 0x1f, 0x11, 0xde, 0x1f, 0x8e, 0xe0, 0x6d, + 0xaf, 0xd9, 0x6d, 0x6c, 0x91, 0x16, 0x57, 0x29, 0xb5, 0x36, 0x97, 0x27, 0x19, 0xab, 0x71, 0x32, + 0x26, 0xb4, 0x4a, 0xe4, 0x6b, 0x54, 0xaf, 0x09, 0xc9, 0x8c, 0xe0, 0x06, 0x89, 0x14, 0xaf, 0xd2, + 0xd9, 0x6d, 0xdb, 0x01, 0x58, 0x85, 0x81, 0x7d, 0x85, 0x8c, 0xa7, 0x80, 0xd5, 0xc1, 0xc0, 0xd3, + 0xbc, 0xa4, 0xad, 0x6f, 0x91, 0x2f, 0x11, 0xee, 0x0d, 0xbc, 0x78, 0x52, 0xcf, 0x08, 0x8a, 0xd5, + 0x12, 0xe2, 0x84, 0x12, 0x5a, 0x1e, 0x67, 0x88, 0x8f, 0x92, 0x91, 0x26, 0x88, 0xc9, 0x03, 0x84, + 0x5f, 0x88, 0xe6, 0x5a, 0x44, 0xe8, 0xf2, 0x48, 0x49, 0xfc, 0xa4, 0xd9, 0xd6, 0x8c, 0x05, 0xa5, + 0x56, 0xa3, 0x58, 0x1f, 0x22, 0xdc, 0xcb, 0xa5, 0x53, 0xe4, 0x92, 0x48, 0xf8, 0x66, 0x69, 0x9b, + 0xf4, 0xe6, 0x0e, 0xbd, 0x00, 0x9b, 0xe3, 0x8c, 0xcd, 0xcb, 0x44, 0x4e, 0xcb, 0x9c, 0x38, 0xe0, + 0x8f, 0x50, 0xac, 0x4a, 0x26, 0xa2, 0x57, 0x61, 0x72, 0x8d, 0x2f, 0x76, 0xf5, 0xa4, 0xf7, 0x27, + 0xe4, 0x19, 0x06, 0xff, 0x24, 0xc9, 0xa5, 0xc0, 0x37, 0xc3, 0x76, 0xb5, 0xed, 0xff, 0x33, 0xc2, + 0x24, 0xe2, 0xd3, 0x3b, 0x05, 0xa2, 0x57, 0xc6, 0x4e, 0xd8, 0xa4, 0x77, 0x21, 0xe4, 0x1c, 0x63, + 0x33, 0x41, 0x8e, 0x89, 0xb1, 0x21, 0x9f, 0x23, 0xbc, 0x8b, 0x5d, 0x3e, 0xd3, 0x82, 0x32, 0xf2, + 0xd7, 0xe3, 0xa9, 0x6d, 0xd9, 0x08, 0x7e, 0x77, 0x55, 0xf8, 0x60, 0x31, 0x91, 0xbf, 0x45, 0xb8, + 0x97, 0xeb, 0x3e, 0x90, 0x73, 0xdb, 0x88, 0x18, 0xee, 0x58, 0xb4, 0x06, 0xf6, 0x0c, 0x03, 0xab, + 0x90, 0xc9, 0x86, 0x60, 0x63, 0xc9, 0xf5, 0x67, 0x08, 0xef, 0x0e, 0xbe, 0x40, 0xd3, 0x82, 0x2b, + 0xba, 0x6d, 0x61, 0x23, 0x1d, 0x08, 0x79, 0x94, 0x61, 0x1d, 0x26, 0x87, 0x1b, 0x60, 0xf5, 0x32, + 0xb0, 0x7e, 0xcf, 0xca, 0xab, 0xdd, 0xa1, 0x74, 0x16, 0x4b, 0xc1, 0x92, 0xbb, 0x07, 0x62, 0x29, + 0x58, 0x4a, 0xa3, 0xa0, 0xe9, 0xcd, 0xa1, 0xd6, 0x6d, 0x58, 0xea, 0x18, 0xfe, 0x9f, 0xba, 0xd8, + 0x66, 0x48, 0xfc, 0x2f, 0xbd, 0x74, 0xbe, 0x15, 0x53, 0xc1, 0xaf, 0xfa, 0xdd, 0x30, 0x4a, 0x0f, + 0x78, 0xb8, 0xed, 0x20, 0x06, 0x3c, 0xb1, 0x91, 0x21, 0x06, 0x3c, 0xb9, 0xcb, 0xd1, 0x14, 0xb8, + 0x19, 0x32, 0x9b, 0x7b, 0xeb, 0xd1, 0x93, 0x2c, 0x7a, 0xfc, 0x24, 0x8b, 0xfe, 0x7d, 0x92, 0x45, + 0x9f, 0x3c, 0xcd, 0x76, 0x3c, 0x7e, 0x9a, 0xed, 0xf8, 0xf3, 0x69, 0xb6, 0xe3, 0xe6, 0x94, 0x6e, + 0xb8, 0xe5, 0xea, 0x4a, 0x4e, 0xb5, 0x57, 0x79, 0x57, 0x01, 0x1e, 0x65, 0x9d, 0xf7, 0xea, 0x6e, + 0xac, 0x69, 0xce, 0x4a, 0x37, 0xfb, 0x0a, 0x9c, 0xfa, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xf5, 0x77, + 0x46, 0x98, 0xb4, 0x22, 0x00, 0x00, } -func (m *QueryAllCctxPendingResponse) XXX_Size() int { - return m.Size() + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// 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 { + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Queries a OutTxTracker by index. + OutTxTracker(ctx context.Context, in *QueryGetOutTxTrackerRequest, opts ...grpc.CallOption) (*QueryGetOutTxTrackerResponse, error) + // Queries a list of OutTxTracker items. + OutTxTrackerAll(ctx context.Context, in *QueryAllOutTxTrackerRequest, opts ...grpc.CallOption) (*QueryAllOutTxTrackerResponse, error) + OutTxTrackerAllByChain(ctx context.Context, in *QueryAllOutTxTrackerByChainRequest, opts ...grpc.CallOption) (*QueryAllOutTxTrackerByChainResponse, error) + InTxTrackerAllByChain(ctx context.Context, in *QueryAllInTxTrackerByChainRequest, opts ...grpc.CallOption) (*QueryAllInTxTrackerByChainResponse, error) + InTxTrackerAll(ctx context.Context, in *QueryAllInTxTrackersRequest, opts ...grpc.CallOption) (*QueryAllInTxTrackersResponse, error) + // Queries a InTxHashToCctx by index. + InTxHashToCctx(ctx context.Context, in *QueryGetInTxHashToCctxRequest, opts ...grpc.CallOption) (*QueryGetInTxHashToCctxResponse, error) + // Queries a InTxHashToCctx data by index. + InTxHashToCctxData(ctx context.Context, in *QueryInTxHashToCctxDataRequest, opts ...grpc.CallOption) (*QueryInTxHashToCctxDataResponse, error) + // Queries a list of InTxHashToCctx items. + InTxHashToCctxAll(ctx context.Context, in *QueryAllInTxHashToCctxRequest, opts ...grpc.CallOption) (*QueryAllInTxHashToCctxResponse, error) + // Queries a gasPrice by index. + GasPrice(ctx context.Context, in *QueryGetGasPriceRequest, opts ...grpc.CallOption) (*QueryGetGasPriceResponse, error) + // Queries a list of gasPrice items. + GasPriceAll(ctx context.Context, in *QueryAllGasPriceRequest, opts ...grpc.CallOption) (*QueryAllGasPriceResponse, error) + ConvertGasToZeta(ctx context.Context, in *QueryConvertGasToZetaRequest, opts ...grpc.CallOption) (*QueryConvertGasToZetaResponse, error) + ProtocolFee(ctx context.Context, in *QueryMessagePassingProtocolFeeRequest, opts ...grpc.CallOption) (*QueryMessagePassingProtocolFeeResponse, error) + // Queries a lastBlockHeight by index. + LastBlockHeight(ctx context.Context, in *QueryGetLastBlockHeightRequest, opts ...grpc.CallOption) (*QueryGetLastBlockHeightResponse, error) + // Queries a list of lastBlockHeight items. + LastBlockHeightAll(ctx context.Context, in *QueryAllLastBlockHeightRequest, opts ...grpc.CallOption) (*QueryAllLastBlockHeightResponse, error) + // Queries a send by index. + Cctx(ctx context.Context, in *QueryGetCctxRequest, opts ...grpc.CallOption) (*QueryGetCctxResponse, error) + // Queries a send by nonce. + CctxByNonce(ctx context.Context, in *QueryGetCctxByNonceRequest, opts ...grpc.CallOption) (*QueryGetCctxResponse, error) + // Queries a list of send items. + CctxAll(ctx context.Context, in *QueryAllCctxRequest, opts ...grpc.CallOption) (*QueryAllCctxResponse, error) + // Queries a list of pending cctxs. + CctxListPending(ctx context.Context, in *QueryListCctxPendingRequest, opts ...grpc.CallOption) (*QueryListCctxPendingResponse, error) + ZetaAccounting(ctx context.Context, in *QueryZetaAccountingRequest, opts ...grpc.CallOption) (*QueryZetaAccountingResponse, error) + // Queries a list of lastMetaHeight items. + LastZetaHeight(ctx context.Context, in *QueryLastZetaHeightRequest, opts ...grpc.CallOption) (*QueryLastZetaHeightResponse, error) } -func (m *QueryAllCctxPendingResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllCctxPendingResponse.DiscardUnknown(m) + +type queryClient struct { + cc grpc1.ClientConn } -var xxx_messageInfo_QueryAllCctxPendingResponse proto.InternalMessageInfo +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} -func (m *QueryAllCctxPendingResponse) GetCrossChainTx() []*CrossChainTx { - if m != nil { - return m.CrossChainTx +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/Params", in, out, opts...) + if err != nil { + return nil, err } - return nil + return out, nil } -func (m *QueryAllCctxPendingResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination +func (c *queryClient) OutTxTracker(ctx context.Context, in *QueryGetOutTxTrackerRequest, opts ...grpc.CallOption) (*QueryGetOutTxTrackerResponse, error) { + out := new(QueryGetOutTxTrackerResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/OutTxTracker", in, out, opts...) + if err != nil { + return nil, err } - return nil + return out, nil } -type QueryLastZetaHeightRequest struct { +func (c *queryClient) OutTxTrackerAll(ctx context.Context, in *QueryAllOutTxTrackerRequest, opts ...grpc.CallOption) (*QueryAllOutTxTrackerResponse, error) { + out := new(QueryAllOutTxTrackerResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/OutTxTrackerAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryLastZetaHeightRequest) Reset() { *m = QueryLastZetaHeightRequest{} } -func (m *QueryLastZetaHeightRequest) String() string { return proto.CompactTextString(m) } -func (*QueryLastZetaHeightRequest) ProtoMessage() {} -func (*QueryLastZetaHeightRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{49} -} -func (m *QueryLastZetaHeightRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryLastZetaHeightRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryLastZetaHeightRequest.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 (c *queryClient) OutTxTrackerAllByChain(ctx context.Context, in *QueryAllOutTxTrackerByChainRequest, opts ...grpc.CallOption) (*QueryAllOutTxTrackerByChainResponse, error) { + out := new(QueryAllOutTxTrackerByChainResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/OutTxTrackerAllByChain", in, out, opts...) + if err != nil { + return nil, err } + return out, nil } -func (m *QueryLastZetaHeightRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryLastZetaHeightRequest.Merge(m, src) -} -func (m *QueryLastZetaHeightRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryLastZetaHeightRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryLastZetaHeightRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryLastZetaHeightRequest proto.InternalMessageInfo -type QueryLastZetaHeightResponse struct { - Height int64 `protobuf:"varint,1,opt,name=Height,proto3" json:"Height,omitempty"` +func (c *queryClient) InTxTrackerAllByChain(ctx context.Context, in *QueryAllInTxTrackerByChainRequest, opts ...grpc.CallOption) (*QueryAllInTxTrackerByChainResponse, error) { + out := new(QueryAllInTxTrackerByChainResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/InTxTrackerAllByChain", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryLastZetaHeightResponse) Reset() { *m = QueryLastZetaHeightResponse{} } -func (m *QueryLastZetaHeightResponse) String() string { return proto.CompactTextString(m) } -func (*QueryLastZetaHeightResponse) ProtoMessage() {} -func (*QueryLastZetaHeightResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{50} -} -func (m *QueryLastZetaHeightResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryLastZetaHeightResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryLastZetaHeightResponse.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 (c *queryClient) InTxTrackerAll(ctx context.Context, in *QueryAllInTxTrackersRequest, opts ...grpc.CallOption) (*QueryAllInTxTrackersResponse, error) { + out := new(QueryAllInTxTrackersResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/InTxTrackerAll", in, out, opts...) + if err != nil { + return nil, err } -} -func (m *QueryLastZetaHeightResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryLastZetaHeightResponse.Merge(m, src) -} -func (m *QueryLastZetaHeightResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryLastZetaHeightResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryLastZetaHeightResponse.DiscardUnknown(m) + return out, nil } -var xxx_messageInfo_QueryLastZetaHeightResponse proto.InternalMessageInfo +func (c *queryClient) InTxHashToCctx(ctx context.Context, in *QueryGetInTxHashToCctxRequest, opts ...grpc.CallOption) (*QueryGetInTxHashToCctxResponse, error) { + out := new(QueryGetInTxHashToCctxResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/InTxHashToCctx", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} -func (m *QueryLastZetaHeightResponse) GetHeight() int64 { - if m != nil { - return m.Height +func (c *queryClient) InTxHashToCctxData(ctx context.Context, in *QueryInTxHashToCctxDataRequest, opts ...grpc.CallOption) (*QueryInTxHashToCctxDataResponse, error) { + out := new(QueryInTxHashToCctxDataResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/InTxHashToCctxData", in, out, opts...) + if err != nil { + return nil, err } - return 0 + return out, nil } -type QueryConvertGasToZetaRequest struct { - ChainId int64 `protobuf:"varint,1,opt,name=chainId,proto3" json:"chainId,omitempty"` - GasLimit string `protobuf:"bytes,2,opt,name=gasLimit,proto3" json:"gasLimit,omitempty"` +func (c *queryClient) InTxHashToCctxAll(ctx context.Context, in *QueryAllInTxHashToCctxRequest, opts ...grpc.CallOption) (*QueryAllInTxHashToCctxResponse, error) { + out := new(QueryAllInTxHashToCctxResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/InTxHashToCctxAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryConvertGasToZetaRequest) Reset() { *m = QueryConvertGasToZetaRequest{} } -func (m *QueryConvertGasToZetaRequest) String() string { return proto.CompactTextString(m) } -func (*QueryConvertGasToZetaRequest) ProtoMessage() {} -func (*QueryConvertGasToZetaRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{51} +func (c *queryClient) GasPrice(ctx context.Context, in *QueryGetGasPriceRequest, opts ...grpc.CallOption) (*QueryGetGasPriceResponse, error) { + out := new(QueryGetGasPriceResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/GasPrice", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryConvertGasToZetaRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryConvertGasToZetaRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryConvertGasToZetaRequest.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 (c *queryClient) GasPriceAll(ctx context.Context, in *QueryAllGasPriceRequest, opts ...grpc.CallOption) (*QueryAllGasPriceResponse, error) { + out := new(QueryAllGasPriceResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/GasPriceAll", in, out, opts...) + if err != nil { + return nil, err } + return out, nil } -func (m *QueryConvertGasToZetaRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryConvertGasToZetaRequest.Merge(m, src) -} -func (m *QueryConvertGasToZetaRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryConvertGasToZetaRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryConvertGasToZetaRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryConvertGasToZetaRequest proto.InternalMessageInfo -func (m *QueryConvertGasToZetaRequest) GetChainId() int64 { - if m != nil { - return m.ChainId +func (c *queryClient) ConvertGasToZeta(ctx context.Context, in *QueryConvertGasToZetaRequest, opts ...grpc.CallOption) (*QueryConvertGasToZetaResponse, error) { + out := new(QueryConvertGasToZetaResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/ConvertGasToZeta", in, out, opts...) + if err != nil { + return nil, err } - return 0 + return out, nil } -func (m *QueryConvertGasToZetaRequest) GetGasLimit() string { - if m != nil { - return m.GasLimit +func (c *queryClient) ProtocolFee(ctx context.Context, in *QueryMessagePassingProtocolFeeRequest, opts ...grpc.CallOption) (*QueryMessagePassingProtocolFeeResponse, error) { + out := new(QueryMessagePassingProtocolFeeResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/ProtocolFee", in, out, opts...) + if err != nil { + return nil, err } - return "" + return out, nil } -type QueryConvertGasToZetaResponse struct { - OutboundGasInZeta string `protobuf:"bytes,1,opt,name=outboundGasInZeta,proto3" json:"outboundGasInZeta,omitempty"` - ProtocolFeeInZeta string `protobuf:"bytes,2,opt,name=protocolFeeInZeta,proto3" json:"protocolFeeInZeta,omitempty"` - ZetaBlockHeight uint64 `protobuf:"varint,3,opt,name=ZetaBlockHeight,proto3" json:"ZetaBlockHeight,omitempty"` +func (c *queryClient) LastBlockHeight(ctx context.Context, in *QueryGetLastBlockHeightRequest, opts ...grpc.CallOption) (*QueryGetLastBlockHeightResponse, error) { + out := new(QueryGetLastBlockHeightResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/LastBlockHeight", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryConvertGasToZetaResponse) Reset() { *m = QueryConvertGasToZetaResponse{} } -func (m *QueryConvertGasToZetaResponse) String() string { return proto.CompactTextString(m) } -func (*QueryConvertGasToZetaResponse) ProtoMessage() {} -func (*QueryConvertGasToZetaResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{52} -} -func (m *QueryConvertGasToZetaResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryConvertGasToZetaResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryConvertGasToZetaResponse.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 (c *queryClient) LastBlockHeightAll(ctx context.Context, in *QueryAllLastBlockHeightRequest, opts ...grpc.CallOption) (*QueryAllLastBlockHeightResponse, error) { + out := new(QueryAllLastBlockHeightResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/LastBlockHeightAll", in, out, opts...) + if err != nil { + return nil, err } + return out, nil } -func (m *QueryConvertGasToZetaResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryConvertGasToZetaResponse.Merge(m, src) -} -func (m *QueryConvertGasToZetaResponse) XXX_Size() int { - return m.Size() + +func (c *queryClient) Cctx(ctx context.Context, in *QueryGetCctxRequest, opts ...grpc.CallOption) (*QueryGetCctxResponse, error) { + out := new(QueryGetCctxResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/Cctx", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryConvertGasToZetaResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryConvertGasToZetaResponse.DiscardUnknown(m) + +func (c *queryClient) CctxByNonce(ctx context.Context, in *QueryGetCctxByNonceRequest, opts ...grpc.CallOption) (*QueryGetCctxResponse, error) { + out := new(QueryGetCctxResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/CctxByNonce", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -var xxx_messageInfo_QueryConvertGasToZetaResponse proto.InternalMessageInfo +func (c *queryClient) CctxAll(ctx context.Context, in *QueryAllCctxRequest, opts ...grpc.CallOption) (*QueryAllCctxResponse, error) { + out := new(QueryAllCctxResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/CctxAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} -func (m *QueryConvertGasToZetaResponse) GetOutboundGasInZeta() string { - if m != nil { - return m.OutboundGasInZeta +func (c *queryClient) CctxListPending(ctx context.Context, in *QueryListCctxPendingRequest, opts ...grpc.CallOption) (*QueryListCctxPendingResponse, error) { + out := new(QueryListCctxPendingResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/CctxListPending", in, out, opts...) + if err != nil { + return nil, err } - return "" + return out, nil } -func (m *QueryConvertGasToZetaResponse) GetProtocolFeeInZeta() string { - if m != nil { - return m.ProtocolFeeInZeta +func (c *queryClient) ZetaAccounting(ctx context.Context, in *QueryZetaAccountingRequest, opts ...grpc.CallOption) (*QueryZetaAccountingResponse, error) { + out := new(QueryZetaAccountingResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/ZetaAccounting", in, out, opts...) + if err != nil { + return nil, err } - return "" + return out, nil } -func (m *QueryConvertGasToZetaResponse) GetZetaBlockHeight() uint64 { - if m != nil { - return m.ZetaBlockHeight +func (c *queryClient) LastZetaHeight(ctx context.Context, in *QueryLastZetaHeightRequest, opts ...grpc.CallOption) (*QueryLastZetaHeightResponse, error) { + out := new(QueryLastZetaHeightResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/LastZetaHeight", in, out, opts...) + if err != nil { + return nil, err } - return 0 + return out, nil } -type QueryMessagePassingProtocolFeeRequest struct { +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Queries a OutTxTracker by index. + OutTxTracker(context.Context, *QueryGetOutTxTrackerRequest) (*QueryGetOutTxTrackerResponse, error) + // Queries a list of OutTxTracker items. + OutTxTrackerAll(context.Context, *QueryAllOutTxTrackerRequest) (*QueryAllOutTxTrackerResponse, error) + OutTxTrackerAllByChain(context.Context, *QueryAllOutTxTrackerByChainRequest) (*QueryAllOutTxTrackerByChainResponse, error) + InTxTrackerAllByChain(context.Context, *QueryAllInTxTrackerByChainRequest) (*QueryAllInTxTrackerByChainResponse, error) + InTxTrackerAll(context.Context, *QueryAllInTxTrackersRequest) (*QueryAllInTxTrackersResponse, error) + // Queries a InTxHashToCctx by index. + InTxHashToCctx(context.Context, *QueryGetInTxHashToCctxRequest) (*QueryGetInTxHashToCctxResponse, error) + // Queries a InTxHashToCctx data by index. + InTxHashToCctxData(context.Context, *QueryInTxHashToCctxDataRequest) (*QueryInTxHashToCctxDataResponse, error) + // Queries a list of InTxHashToCctx items. + InTxHashToCctxAll(context.Context, *QueryAllInTxHashToCctxRequest) (*QueryAllInTxHashToCctxResponse, error) + // Queries a gasPrice by index. + GasPrice(context.Context, *QueryGetGasPriceRequest) (*QueryGetGasPriceResponse, error) + // Queries a list of gasPrice items. + GasPriceAll(context.Context, *QueryAllGasPriceRequest) (*QueryAllGasPriceResponse, error) + ConvertGasToZeta(context.Context, *QueryConvertGasToZetaRequest) (*QueryConvertGasToZetaResponse, error) + ProtocolFee(context.Context, *QueryMessagePassingProtocolFeeRequest) (*QueryMessagePassingProtocolFeeResponse, error) + // Queries a lastBlockHeight by index. + LastBlockHeight(context.Context, *QueryGetLastBlockHeightRequest) (*QueryGetLastBlockHeightResponse, error) + // Queries a list of lastBlockHeight items. + LastBlockHeightAll(context.Context, *QueryAllLastBlockHeightRequest) (*QueryAllLastBlockHeightResponse, error) + // Queries a send by index. + Cctx(context.Context, *QueryGetCctxRequest) (*QueryGetCctxResponse, error) + // Queries a send by nonce. + CctxByNonce(context.Context, *QueryGetCctxByNonceRequest) (*QueryGetCctxResponse, error) + // Queries a list of send items. + CctxAll(context.Context, *QueryAllCctxRequest) (*QueryAllCctxResponse, error) + // Queries a list of pending cctxs. + CctxListPending(context.Context, *QueryListCctxPendingRequest) (*QueryListCctxPendingResponse, error) + ZetaAccounting(context.Context, *QueryZetaAccountingRequest) (*QueryZetaAccountingResponse, error) + // Queries a list of lastMetaHeight items. + LastZetaHeight(context.Context, *QueryLastZetaHeightRequest) (*QueryLastZetaHeightResponse, error) } -func (m *QueryMessagePassingProtocolFeeRequest) Reset() { *m = QueryMessagePassingProtocolFeeRequest{} } -func (m *QueryMessagePassingProtocolFeeRequest) String() string { return proto.CompactTextString(m) } -func (*QueryMessagePassingProtocolFeeRequest) ProtoMessage() {} -func (*QueryMessagePassingProtocolFeeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{53} +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { } -func (m *QueryMessagePassingProtocolFeeRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } -func (m *QueryMessagePassingProtocolFeeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryMessagePassingProtocolFeeRequest.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 (*UnimplementedQueryServer) OutTxTracker(ctx context.Context, req *QueryGetOutTxTrackerRequest) (*QueryGetOutTxTrackerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method OutTxTracker not implemented") } -func (m *QueryMessagePassingProtocolFeeRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryMessagePassingProtocolFeeRequest.Merge(m, src) +func (*UnimplementedQueryServer) OutTxTrackerAll(ctx context.Context, req *QueryAllOutTxTrackerRequest) (*QueryAllOutTxTrackerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method OutTxTrackerAll not implemented") } -func (m *QueryMessagePassingProtocolFeeRequest) XXX_Size() int { - return m.Size() +func (*UnimplementedQueryServer) OutTxTrackerAllByChain(ctx context.Context, req *QueryAllOutTxTrackerByChainRequest) (*QueryAllOutTxTrackerByChainResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method OutTxTrackerAllByChain not implemented") } -func (m *QueryMessagePassingProtocolFeeRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryMessagePassingProtocolFeeRequest.DiscardUnknown(m) +func (*UnimplementedQueryServer) InTxTrackerAllByChain(ctx context.Context, req *QueryAllInTxTrackerByChainRequest) (*QueryAllInTxTrackerByChainResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InTxTrackerAllByChain not implemented") } - -var xxx_messageInfo_QueryMessagePassingProtocolFeeRequest proto.InternalMessageInfo - -type QueryMessagePassingProtocolFeeResponse struct { - FeeInZeta string `protobuf:"bytes,1,opt,name=feeInZeta,proto3" json:"feeInZeta,omitempty"` +func (*UnimplementedQueryServer) InTxTrackerAll(ctx context.Context, req *QueryAllInTxTrackersRequest) (*QueryAllInTxTrackersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InTxTrackerAll not implemented") } - -func (m *QueryMessagePassingProtocolFeeResponse) Reset() { - *m = QueryMessagePassingProtocolFeeResponse{} +func (*UnimplementedQueryServer) InTxHashToCctx(ctx context.Context, req *QueryGetInTxHashToCctxRequest) (*QueryGetInTxHashToCctxResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InTxHashToCctx not implemented") } -func (m *QueryMessagePassingProtocolFeeResponse) String() string { return proto.CompactTextString(m) } -func (*QueryMessagePassingProtocolFeeResponse) ProtoMessage() {} -func (*QueryMessagePassingProtocolFeeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{54} +func (*UnimplementedQueryServer) InTxHashToCctxData(ctx context.Context, req *QueryInTxHashToCctxDataRequest) (*QueryInTxHashToCctxDataResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InTxHashToCctxData not implemented") } -func (m *QueryMessagePassingProtocolFeeResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) +func (*UnimplementedQueryServer) InTxHashToCctxAll(ctx context.Context, req *QueryAllInTxHashToCctxRequest) (*QueryAllInTxHashToCctxResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InTxHashToCctxAll not implemented") } -func (m *QueryMessagePassingProtocolFeeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryMessagePassingProtocolFeeResponse.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 (*UnimplementedQueryServer) GasPrice(ctx context.Context, req *QueryGetGasPriceRequest) (*QueryGetGasPriceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GasPrice not implemented") } -func (m *QueryMessagePassingProtocolFeeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryMessagePassingProtocolFeeResponse.Merge(m, src) +func (*UnimplementedQueryServer) GasPriceAll(ctx context.Context, req *QueryAllGasPriceRequest) (*QueryAllGasPriceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GasPriceAll not implemented") } -func (m *QueryMessagePassingProtocolFeeResponse) XXX_Size() int { - return m.Size() +func (*UnimplementedQueryServer) ConvertGasToZeta(ctx context.Context, req *QueryConvertGasToZetaRequest) (*QueryConvertGasToZetaResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConvertGasToZeta not implemented") } -func (m *QueryMessagePassingProtocolFeeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryMessagePassingProtocolFeeResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryMessagePassingProtocolFeeResponse proto.InternalMessageInfo - -func (m *QueryMessagePassingProtocolFeeResponse) GetFeeInZeta() string { - if m != nil { - return m.FeeInZeta - } - return "" +func (*UnimplementedQueryServer) ProtocolFee(ctx context.Context, req *QueryMessagePassingProtocolFeeRequest) (*QueryMessagePassingProtocolFeeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ProtocolFee not implemented") } - -type QueryZEVMGetTransactionReceiptRequest struct { - Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` +func (*UnimplementedQueryServer) LastBlockHeight(ctx context.Context, req *QueryGetLastBlockHeightRequest) (*QueryGetLastBlockHeightResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LastBlockHeight not implemented") } - -func (m *QueryZEVMGetTransactionReceiptRequest) Reset() { *m = QueryZEVMGetTransactionReceiptRequest{} } -func (m *QueryZEVMGetTransactionReceiptRequest) String() string { return proto.CompactTextString(m) } -func (*QueryZEVMGetTransactionReceiptRequest) ProtoMessage() {} -func (*QueryZEVMGetTransactionReceiptRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{55} +func (*UnimplementedQueryServer) LastBlockHeightAll(ctx context.Context, req *QueryAllLastBlockHeightRequest) (*QueryAllLastBlockHeightResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LastBlockHeightAll not implemented") } -func (m *QueryZEVMGetTransactionReceiptRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) +func (*UnimplementedQueryServer) Cctx(ctx context.Context, req *QueryGetCctxRequest) (*QueryGetCctxResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Cctx not implemented") } -func (m *QueryZEVMGetTransactionReceiptRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryZEVMGetTransactionReceiptRequest.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 (*UnimplementedQueryServer) CctxByNonce(ctx context.Context, req *QueryGetCctxByNonceRequest) (*QueryGetCctxResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CctxByNonce not implemented") } -func (m *QueryZEVMGetTransactionReceiptRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryZEVMGetTransactionReceiptRequest.Merge(m, src) +func (*UnimplementedQueryServer) CctxAll(ctx context.Context, req *QueryAllCctxRequest) (*QueryAllCctxResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CctxAll not implemented") } -func (m *QueryZEVMGetTransactionReceiptRequest) XXX_Size() int { - return m.Size() +func (*UnimplementedQueryServer) CctxListPending(ctx context.Context, req *QueryListCctxPendingRequest) (*QueryListCctxPendingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CctxListPending not implemented") } -func (m *QueryZEVMGetTransactionReceiptRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryZEVMGetTransactionReceiptRequest.DiscardUnknown(m) +func (*UnimplementedQueryServer) ZetaAccounting(ctx context.Context, req *QueryZetaAccountingRequest) (*QueryZetaAccountingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ZetaAccounting not implemented") } - -var xxx_messageInfo_QueryZEVMGetTransactionReceiptRequest proto.InternalMessageInfo - -func (m *QueryZEVMGetTransactionReceiptRequest) GetHash() string { - if m != nil { - return m.Hash - } - return "" +func (*UnimplementedQueryServer) LastZetaHeight(ctx context.Context, req *QueryLastZetaHeightRequest) (*QueryLastZetaHeightResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LastZetaHeight not implemented") } -type QueryZEVMGetTransactionReceiptResponse struct { - BlockHash string `protobuf:"bytes,1,opt,name=block_hash,json=blockHash,proto3" json:"blockHash"` - BlockNumber string `protobuf:"bytes,2,opt,name=block_number,json=blockNumber,proto3" json:"blockNumber"` - ContractAddress string `protobuf:"bytes,3,opt,name=contract_address,json=contractAddress,proto3" json:"contractAddress"` - CumulativeGasUsed string `protobuf:"bytes,4,opt,name=cumulative_gas_used,json=cumulativeGasUsed,proto3" json:"cumulativeGasUsed"` - From string `protobuf:"bytes,5,opt,name=from,proto3" json:"from"` - GasUsed string `protobuf:"bytes,6,opt,name=gas_used,json=gasUsed,proto3" json:"gasUsed"` - LogsBloom string `protobuf:"bytes,7,opt,name=logs_bloom,json=logsBloom,proto3" json:"logsBloom"` - Status string `protobuf:"bytes,8,opt,name=status,proto3" json:"status"` - To string `protobuf:"bytes,9,opt,name=to,proto3" json:"to"` - TransactionHash string `protobuf:"bytes,10,opt,name=transaction_hash,json=transactionHash,proto3" json:"transactionHash"` - TransactionIndex string `protobuf:"bytes,11,opt,name=transaction_index,json=transactionIndex,proto3" json:"transactionIndex"` - Logs []*Log `protobuf:"bytes,12,rep,name=logs,proto3" json:"logs,omitempty"` +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) } -func (m *QueryZEVMGetTransactionReceiptResponse) Reset() { - *m = QueryZEVMGetTransactionReceiptResponse{} -} -func (m *QueryZEVMGetTransactionReceiptResponse) String() string { return proto.CompactTextString(m) } -func (*QueryZEVMGetTransactionReceiptResponse) ProtoMessage() {} -func (*QueryZEVMGetTransactionReceiptResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{56} -} -func (m *QueryZEVMGetTransactionReceiptResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryZEVMGetTransactionReceiptResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryZEVMGetTransactionReceiptResponse.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 _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err } -} -func (m *QueryZEVMGetTransactionReceiptResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryZEVMGetTransactionReceiptResponse.Merge(m, src) -} -func (m *QueryZEVMGetTransactionReceiptResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryZEVMGetTransactionReceiptResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryZEVMGetTransactionReceiptResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryZEVMGetTransactionReceiptResponse proto.InternalMessageInfo - -func (m *QueryZEVMGetTransactionReceiptResponse) GetBlockHash() string { - if m != nil { - return m.BlockHash + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) } - return "" -} - -func (m *QueryZEVMGetTransactionReceiptResponse) GetBlockNumber() string { - if m != nil { - return m.BlockNumber + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.crosschain.Query/Params", } - return "" -} - -func (m *QueryZEVMGetTransactionReceiptResponse) GetContractAddress() string { - if m != nil { - return m.ContractAddress + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) } - return "" + return interceptor(ctx, in, info, handler) } -func (m *QueryZEVMGetTransactionReceiptResponse) GetCumulativeGasUsed() string { - if m != nil { - return m.CumulativeGasUsed +func _Query_OutTxTracker_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetOutTxTrackerRequest) + if err := dec(in); err != nil { + return nil, err } - return "" -} - -func (m *QueryZEVMGetTransactionReceiptResponse) GetFrom() string { - if m != nil { - return m.From + if interceptor == nil { + return srv.(QueryServer).OutTxTracker(ctx, in) } - return "" -} - -func (m *QueryZEVMGetTransactionReceiptResponse) GetGasUsed() string { - if m != nil { - return m.GasUsed + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.crosschain.Query/OutTxTracker", } - return "" -} - -func (m *QueryZEVMGetTransactionReceiptResponse) GetLogsBloom() string { - if m != nil { - return m.LogsBloom + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).OutTxTracker(ctx, req.(*QueryGetOutTxTrackerRequest)) } - return "" + return interceptor(ctx, in, info, handler) } -func (m *QueryZEVMGetTransactionReceiptResponse) GetStatus() string { - if m != nil { - return m.Status +func _Query_OutTxTrackerAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllOutTxTrackerRequest) + if err := dec(in); err != nil { + return nil, err } - return "" -} - -func (m *QueryZEVMGetTransactionReceiptResponse) GetTo() string { - if m != nil { - return m.To + if interceptor == nil { + return srv.(QueryServer).OutTxTrackerAll(ctx, in) } - return "" -} - -func (m *QueryZEVMGetTransactionReceiptResponse) GetTransactionHash() string { - if m != nil { - return m.TransactionHash + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.crosschain.Query/OutTxTrackerAll", } - return "" -} - -func (m *QueryZEVMGetTransactionReceiptResponse) GetTransactionIndex() string { - if m != nil { - return m.TransactionIndex + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).OutTxTrackerAll(ctx, req.(*QueryAllOutTxTrackerRequest)) } - return "" + return interceptor(ctx, in, info, handler) } -func (m *QueryZEVMGetTransactionReceiptResponse) GetLogs() []*Log { - if m != nil { - return m.Logs +func _Query_OutTxTrackerAllByChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllOutTxTrackerByChainRequest) + if err := dec(in); err != nil { + return nil, err } - return nil -} - -type Log struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - Topics []string `protobuf:"bytes,2,rep,name=topics,proto3" json:"topics,omitempty"` - Data string `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` - // sythetic fields - BlockNumber uint64 `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"blockNumber"` - TransactionHash string `protobuf:"bytes,5,opt,name=transaction_hash,json=transactionHash,proto3" json:"transactionHash"` - TransactionIndex uint64 `protobuf:"varint,6,opt,name=transaction_index,json=transactionIndex,proto3" json:"transactionIndex"` - BlockHash string `protobuf:"bytes,7,opt,name=block_hash,json=blockHash,proto3" json:"blockHash"` - LogIndex uint64 `protobuf:"varint,8,opt,name=log_index,json=logIndex,proto3" json:"logIndex"` - Removed bool `protobuf:"varint,9,opt,name=removed,proto3" json:"removed"` -} - -func (m *Log) Reset() { *m = Log{} } -func (m *Log) String() string { return proto.CompactTextString(m) } -func (*Log) ProtoMessage() {} -func (*Log) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{57} -} -func (m *Log) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Log) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Log.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil + if interceptor == nil { + return srv.(QueryServer).OutTxTrackerAllByChain(ctx, in) } -} -func (m *Log) XXX_Merge(src proto.Message) { - xxx_messageInfo_Log.Merge(m, src) -} -func (m *Log) XXX_Size() int { - return m.Size() -} -func (m *Log) XXX_DiscardUnknown() { - xxx_messageInfo_Log.DiscardUnknown(m) -} - -var xxx_messageInfo_Log proto.InternalMessageInfo - -func (m *Log) GetAddress() string { - if m != nil { - return m.Address + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.crosschain.Query/OutTxTrackerAllByChain", } - return "" -} - -func (m *Log) GetTopics() []string { - if m != nil { - return m.Topics + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).OutTxTrackerAllByChain(ctx, req.(*QueryAllOutTxTrackerByChainRequest)) } - return nil + return interceptor(ctx, in, info, handler) } -func (m *Log) GetData() string { - if m != nil { - return m.Data +func _Query_InTxTrackerAllByChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllInTxTrackerByChainRequest) + if err := dec(in); err != nil { + return nil, err } - return "" -} - -func (m *Log) GetBlockNumber() uint64 { - if m != nil { - return m.BlockNumber + if interceptor == nil { + return srv.(QueryServer).InTxTrackerAllByChain(ctx, in) } - return 0 -} - -func (m *Log) GetTransactionHash() string { - if m != nil { - return m.TransactionHash + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.crosschain.Query/InTxTrackerAllByChain", } - return "" -} - -func (m *Log) GetTransactionIndex() uint64 { - if m != nil { - return m.TransactionIndex + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).InTxTrackerAllByChain(ctx, req.(*QueryAllInTxTrackerByChainRequest)) } - return 0 + return interceptor(ctx, in, info, handler) } -func (m *Log) GetBlockHash() string { - if m != nil { - return m.BlockHash +func _Query_InTxTrackerAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllInTxTrackersRequest) + if err := dec(in); err != nil { + return nil, err } - return "" -} - -func (m *Log) GetLogIndex() uint64 { - if m != nil { - return m.LogIndex + if interceptor == nil { + return srv.(QueryServer).InTxTrackerAll(ctx, in) } - return 0 + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.crosschain.Query/InTxTrackerAll", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).InTxTrackerAll(ctx, req.(*QueryAllInTxTrackersRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *Log) GetRemoved() bool { - if m != nil { - return m.Removed +func _Query_InTxHashToCctx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetInTxHashToCctxRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).InTxHashToCctx(ctx, in) } - return false + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.crosschain.Query/InTxHashToCctx", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).InTxHashToCctx(ctx, req.(*QueryGetInTxHashToCctxRequest)) + } + return interceptor(ctx, in, info, handler) } -type QueryZEVMGetTransactionRequest struct { - Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` +func _Query_InTxHashToCctxData_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryInTxHashToCctxDataRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).InTxHashToCctxData(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.crosschain.Query/InTxHashToCctxData", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).InTxHashToCctxData(ctx, req.(*QueryInTxHashToCctxDataRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryZEVMGetTransactionRequest) Reset() { *m = QueryZEVMGetTransactionRequest{} } -func (m *QueryZEVMGetTransactionRequest) String() string { return proto.CompactTextString(m) } -func (*QueryZEVMGetTransactionRequest) ProtoMessage() {} -func (*QueryZEVMGetTransactionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{58} -} -func (m *QueryZEVMGetTransactionRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryZEVMGetTransactionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryZEVMGetTransactionRequest.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 _Query_InTxHashToCctxAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllInTxHashToCctxRequest) + if err := dec(in); err != nil { + return nil, err } -} -func (m *QueryZEVMGetTransactionRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryZEVMGetTransactionRequest.Merge(m, src) -} -func (m *QueryZEVMGetTransactionRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryZEVMGetTransactionRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryZEVMGetTransactionRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryZEVMGetTransactionRequest proto.InternalMessageInfo - -func (m *QueryZEVMGetTransactionRequest) GetHash() string { - if m != nil { - return m.Hash + if interceptor == nil { + return srv.(QueryServer).InTxHashToCctxAll(ctx, in) } - return "" -} - -type QueryZEVMGetTransactionResponse struct { - BlockHash string `protobuf:"bytes,1,opt,name=block_hash,json=blockHash,proto3" json:"blockHash"` - BlockNumber string `protobuf:"bytes,2,opt,name=block_number,json=blockNumber,proto3" json:"blockNumber"` - From string `protobuf:"bytes,3,opt,name=from,proto3" json:"from"` - Gas string `protobuf:"bytes,4,opt,name=gas,proto3" json:"gas"` - GasPrice string `protobuf:"bytes,5,opt,name=gas_price,json=gasPrice,proto3" json:"gasPrice"` - Hash string `protobuf:"bytes,6,opt,name=hash,proto3" json:"hash"` - Input string `protobuf:"bytes,7,opt,name=input,proto3" json:"input"` - Nonce string `protobuf:"bytes,8,opt,name=nonce,proto3" json:"nonce"` - To string `protobuf:"bytes,9,opt,name=to,proto3" json:"to"` - TransactionIndex string `protobuf:"bytes,10,opt,name=transaction_index,json=transactionIndex,proto3" json:"transactionIndex"` - Value string `protobuf:"bytes,11,opt,name=value,proto3" json:"value"` - Type string `protobuf:"bytes,12,opt,name=type,proto3" json:"type"` - AccessList []string `protobuf:"bytes,13,rep,name=access_list,json=accessList,proto3" json:"accessList"` - ChainId string `protobuf:"bytes,14,opt,name=chain_id,json=chainId,proto3" json:"chainId"` - V string `protobuf:"bytes,15,opt,name=v,proto3" json:"v"` - R string `protobuf:"bytes,16,opt,name=r,proto3" json:"r"` - S string `protobuf:"bytes,17,opt,name=s,proto3" json:"s"` -} - -func (m *QueryZEVMGetTransactionResponse) Reset() { *m = QueryZEVMGetTransactionResponse{} } -func (m *QueryZEVMGetTransactionResponse) String() string { return proto.CompactTextString(m) } -func (*QueryZEVMGetTransactionResponse) ProtoMessage() {} -func (*QueryZEVMGetTransactionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{59} -} -func (m *QueryZEVMGetTransactionResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryZEVMGetTransactionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryZEVMGetTransactionResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.crosschain.Query/InTxHashToCctxAll", } -} -func (m *QueryZEVMGetTransactionResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryZEVMGetTransactionResponse.Merge(m, src) -} -func (m *QueryZEVMGetTransactionResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryZEVMGetTransactionResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryZEVMGetTransactionResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryZEVMGetTransactionResponse proto.InternalMessageInfo - -func (m *QueryZEVMGetTransactionResponse) GetBlockHash() string { - if m != nil { - return m.BlockHash + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).InTxHashToCctxAll(ctx, req.(*QueryAllInTxHashToCctxRequest)) } - return "" + return interceptor(ctx, in, info, handler) } -func (m *QueryZEVMGetTransactionResponse) GetBlockNumber() string { - if m != nil { - return m.BlockNumber +func _Query_GasPrice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetGasPriceRequest) + if err := dec(in); err != nil { + return nil, err } - return "" -} - -func (m *QueryZEVMGetTransactionResponse) GetFrom() string { - if m != nil { - return m.From + if interceptor == nil { + return srv.(QueryServer).GasPrice(ctx, in) } - return "" -} - -func (m *QueryZEVMGetTransactionResponse) GetGas() string { - if m != nil { - return m.Gas + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.crosschain.Query/GasPrice", } - return "" -} - -func (m *QueryZEVMGetTransactionResponse) GetGasPrice() string { - if m != nil { - return m.GasPrice + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GasPrice(ctx, req.(*QueryGetGasPriceRequest)) } - return "" + return interceptor(ctx, in, info, handler) } -func (m *QueryZEVMGetTransactionResponse) GetHash() string { - if m != nil { - return m.Hash +func _Query_GasPriceAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllGasPriceRequest) + if err := dec(in); err != nil { + return nil, err } - return "" -} - -func (m *QueryZEVMGetTransactionResponse) GetInput() string { - if m != nil { - return m.Input + if interceptor == nil { + return srv.(QueryServer).GasPriceAll(ctx, in) } - return "" -} - -func (m *QueryZEVMGetTransactionResponse) GetNonce() string { - if m != nil { - return m.Nonce + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.crosschain.Query/GasPriceAll", } - return "" -} - -func (m *QueryZEVMGetTransactionResponse) GetTo() string { - if m != nil { - return m.To + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GasPriceAll(ctx, req.(*QueryAllGasPriceRequest)) } - return "" + return interceptor(ctx, in, info, handler) } -func (m *QueryZEVMGetTransactionResponse) GetTransactionIndex() string { - if m != nil { - return m.TransactionIndex +func _Query_ConvertGasToZeta_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryConvertGasToZetaRequest) + if err := dec(in); err != nil { + return nil, err } - return "" -} - -func (m *QueryZEVMGetTransactionResponse) GetValue() string { - if m != nil { - return m.Value + if interceptor == nil { + return srv.(QueryServer).ConvertGasToZeta(ctx, in) } - return "" -} - -func (m *QueryZEVMGetTransactionResponse) GetType() string { - if m != nil { - return m.Type + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.crosschain.Query/ConvertGasToZeta", } - return "" -} - -func (m *QueryZEVMGetTransactionResponse) GetAccessList() []string { - if m != nil { - return m.AccessList + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ConvertGasToZeta(ctx, req.(*QueryConvertGasToZetaRequest)) } - return nil + return interceptor(ctx, in, info, handler) } -func (m *QueryZEVMGetTransactionResponse) GetChainId() string { - if m != nil { - return m.ChainId +func _Query_ProtocolFee_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryMessagePassingProtocolFeeRequest) + if err := dec(in); err != nil { + return nil, err } - return "" -} - -func (m *QueryZEVMGetTransactionResponse) GetV() string { - if m != nil { - return m.V + if interceptor == nil { + return srv.(QueryServer).ProtocolFee(ctx, in) } - return "" -} - -func (m *QueryZEVMGetTransactionResponse) GetR() string { - if m != nil { - return m.R + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.crosschain.Query/ProtocolFee", } - return "" -} - -func (m *QueryZEVMGetTransactionResponse) GetS() string { - if m != nil { - return m.S + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ProtocolFee(ctx, req.(*QueryMessagePassingProtocolFeeRequest)) } - return "" -} - -type QueryZEVMGetBlockByNumberRequest struct { - Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + return interceptor(ctx, in, info, handler) } -func (m *QueryZEVMGetBlockByNumberRequest) Reset() { *m = QueryZEVMGetBlockByNumberRequest{} } -func (m *QueryZEVMGetBlockByNumberRequest) String() string { return proto.CompactTextString(m) } -func (*QueryZEVMGetBlockByNumberRequest) ProtoMessage() {} -func (*QueryZEVMGetBlockByNumberRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{60} -} -func (m *QueryZEVMGetBlockByNumberRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryZEVMGetBlockByNumberRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryZEVMGetBlockByNumberRequest.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 _Query_LastBlockHeight_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetLastBlockHeightRequest) + if err := dec(in); err != nil { + return nil, err } -} -func (m *QueryZEVMGetBlockByNumberRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryZEVMGetBlockByNumberRequest.Merge(m, src) -} -func (m *QueryZEVMGetBlockByNumberRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryZEVMGetBlockByNumberRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryZEVMGetBlockByNumberRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryZEVMGetBlockByNumberRequest proto.InternalMessageInfo - -func (m *QueryZEVMGetBlockByNumberRequest) GetHeight() uint64 { - if m != nil { - return m.Height + if interceptor == nil { + return srv.(QueryServer).LastBlockHeight(ctx, in) } - return 0 -} - -type QueryZEVMGetBlockByNumberResponse struct { - Number string `protobuf:"bytes,1,opt,name=number,proto3" json:"number"` - Hash string `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash"` - ParentHash string `protobuf:"bytes,3,opt,name=parent_hash,json=parentHash,proto3" json:"parentHash"` - Nonce string `protobuf:"bytes,4,opt,name=nonce,proto3" json:"nonce"` - Sha3Uncles string `protobuf:"bytes,5,opt,name=sha3_uncles,json=sha3Uncles,proto3" json:"sha3Uncles"` - LogsBloom string `protobuf:"bytes,6,opt,name=logs_bloom,json=logsBloom,proto3" json:"logsBloom"` - TransactionsRoot string `protobuf:"bytes,7,opt,name=transactions_root,json=transactionsRoot,proto3" json:"transactionsRoot"` - StateRoot string `protobuf:"bytes,8,opt,name=state_root,json=stateRoot,proto3" json:"stateRoot"` - ReceiptsRoot string `protobuf:"bytes,9,opt,name=receipts_root,json=receiptsRoot,proto3" json:"receiptsRoot"` - Miner string `protobuf:"bytes,10,opt,name=miner,proto3" json:"miner"` - Difficulty string `protobuf:"bytes,11,opt,name=difficulty,proto3" json:"difficulty"` - TotalDifficulty string `protobuf:"bytes,12,opt,name=total_difficulty,json=totalDifficulty,proto3" json:"totalDifficulty"` - ExtraData string `protobuf:"bytes,13,opt,name=extra_data,json=extraData,proto3" json:"extraData"` - Size_ string `protobuf:"bytes,14,opt,name=size,proto3" json:"size"` - GasLimit string `protobuf:"bytes,15,opt,name=gas_limit,json=gasLimit,proto3" json:"gasLimit"` - GasUsed string `protobuf:"bytes,16,opt,name=gas_used,json=gasUsed,proto3" json:"gasUsed"` - Timestamp string `protobuf:"bytes,17,opt,name=timestamp,proto3" json:"timestamp"` - Transactions []string `protobuf:"bytes,18,rep,name=transactions,proto3" json:"transactions"` - Uncles []string `protobuf:"bytes,19,rep,name=uncles,proto3" json:"uncles"` - BaseFeePerGas string `protobuf:"bytes,20,opt,name=base_fee_per_gas,json=baseFeePerGas,proto3" json:"baseFeePerGas"` - MixHash string `protobuf:"bytes,21,opt,name=mix_hash,json=mixHash,proto3" json:"mixHash"` -} - -func (m *QueryZEVMGetBlockByNumberResponse) Reset() { *m = QueryZEVMGetBlockByNumberResponse{} } -func (m *QueryZEVMGetBlockByNumberResponse) String() string { return proto.CompactTextString(m) } -func (*QueryZEVMGetBlockByNumberResponse) ProtoMessage() {} -func (*QueryZEVMGetBlockByNumberResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a992045e92a606, []int{61} -} -func (m *QueryZEVMGetBlockByNumberResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryZEVMGetBlockByNumberResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryZEVMGetBlockByNumberResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.crosschain.Query/LastBlockHeight", } -} -func (m *QueryZEVMGetBlockByNumberResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryZEVMGetBlockByNumberResponse.Merge(m, src) -} -func (m *QueryZEVMGetBlockByNumberResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryZEVMGetBlockByNumberResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryZEVMGetBlockByNumberResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryZEVMGetBlockByNumberResponse proto.InternalMessageInfo - -func (m *QueryZEVMGetBlockByNumberResponse) GetNumber() string { - if m != nil { - return m.Number + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).LastBlockHeight(ctx, req.(*QueryGetLastBlockHeightRequest)) } - return "" + return interceptor(ctx, in, info, handler) } -func (m *QueryZEVMGetBlockByNumberResponse) GetHash() string { - if m != nil { - return m.Hash +func _Query_LastBlockHeightAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllLastBlockHeightRequest) + if err := dec(in); err != nil { + return nil, err } - return "" -} - -func (m *QueryZEVMGetBlockByNumberResponse) GetParentHash() string { - if m != nil { - return m.ParentHash + if interceptor == nil { + return srv.(QueryServer).LastBlockHeightAll(ctx, in) } - return "" -} - -func (m *QueryZEVMGetBlockByNumberResponse) GetNonce() string { - if m != nil { - return m.Nonce + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.crosschain.Query/LastBlockHeightAll", } - return "" -} - -func (m *QueryZEVMGetBlockByNumberResponse) GetSha3Uncles() string { - if m != nil { - return m.Sha3Uncles + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).LastBlockHeightAll(ctx, req.(*QueryAllLastBlockHeightRequest)) } - return "" + return interceptor(ctx, in, info, handler) } -func (m *QueryZEVMGetBlockByNumberResponse) GetLogsBloom() string { - if m != nil { - return m.LogsBloom +func _Query_Cctx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetCctxRequest) + if err := dec(in); err != nil { + return nil, err } - return "" -} - -func (m *QueryZEVMGetBlockByNumberResponse) GetTransactionsRoot() string { - if m != nil { - return m.TransactionsRoot + if interceptor == nil { + return srv.(QueryServer).Cctx(ctx, in) } - return "" -} - -func (m *QueryZEVMGetBlockByNumberResponse) GetStateRoot() string { - if m != nil { - return m.StateRoot + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.crosschain.Query/Cctx", } - return "" + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Cctx(ctx, req.(*QueryGetCctxRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryZEVMGetBlockByNumberResponse) GetReceiptsRoot() string { - if m != nil { - return m.ReceiptsRoot +func _Query_CctxByNonce_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetCctxByNonceRequest) + if err := dec(in); err != nil { + return nil, err } - return "" + if interceptor == nil { + return srv.(QueryServer).CctxByNonce(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.crosschain.Query/CctxByNonce", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).CctxByNonce(ctx, req.(*QueryGetCctxByNonceRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryZEVMGetBlockByNumberResponse) GetMiner() string { - if m != nil { - return m.Miner +func _Query_CctxAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllCctxRequest) + if err := dec(in); err != nil { + return nil, err } - return "" + if interceptor == nil { + return srv.(QueryServer).CctxAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.crosschain.Query/CctxAll", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).CctxAll(ctx, req.(*QueryAllCctxRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryZEVMGetBlockByNumberResponse) GetDifficulty() string { - if m != nil { - return m.Difficulty +func _Query_CctxListPending_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryListCctxPendingRequest) + if err := dec(in); err != nil { + return nil, err } - return "" + if interceptor == nil { + return srv.(QueryServer).CctxListPending(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.crosschain.Query/CctxListPending", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).CctxListPending(ctx, req.(*QueryListCctxPendingRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryZEVMGetBlockByNumberResponse) GetTotalDifficulty() string { - if m != nil { - return m.TotalDifficulty +func _Query_ZetaAccounting_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryZetaAccountingRequest) + if err := dec(in); err != nil { + return nil, err } - return "" + if interceptor == nil { + return srv.(QueryServer).ZetaAccounting(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.crosschain.Query/ZetaAccounting", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ZetaAccounting(ctx, req.(*QueryZetaAccountingRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryZEVMGetBlockByNumberResponse) GetExtraData() string { - if m != nil { - return m.ExtraData +func _Query_LastZetaHeight_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryLastZetaHeightRequest) + if err := dec(in); err != nil { + return nil, err } - return "" + if interceptor == nil { + return srv.(QueryServer).LastZetaHeight(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.crosschain.Query/LastZetaHeight", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).LastZetaHeight(ctx, req.(*QueryLastZetaHeightRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryZEVMGetBlockByNumberResponse) GetSize_() string { - if m != nil { - return m.Size_ - } - return "" +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "zetachain.zetacore.crosschain.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "OutTxTracker", + Handler: _Query_OutTxTracker_Handler, + }, + { + MethodName: "OutTxTrackerAll", + Handler: _Query_OutTxTrackerAll_Handler, + }, + { + MethodName: "OutTxTrackerAllByChain", + Handler: _Query_OutTxTrackerAllByChain_Handler, + }, + { + MethodName: "InTxTrackerAllByChain", + Handler: _Query_InTxTrackerAllByChain_Handler, + }, + { + MethodName: "InTxTrackerAll", + Handler: _Query_InTxTrackerAll_Handler, + }, + { + MethodName: "InTxHashToCctx", + Handler: _Query_InTxHashToCctx_Handler, + }, + { + MethodName: "InTxHashToCctxData", + Handler: _Query_InTxHashToCctxData_Handler, + }, + { + MethodName: "InTxHashToCctxAll", + Handler: _Query_InTxHashToCctxAll_Handler, + }, + { + MethodName: "GasPrice", + Handler: _Query_GasPrice_Handler, + }, + { + MethodName: "GasPriceAll", + Handler: _Query_GasPriceAll_Handler, + }, + { + MethodName: "ConvertGasToZeta", + Handler: _Query_ConvertGasToZeta_Handler, + }, + { + MethodName: "ProtocolFee", + Handler: _Query_ProtocolFee_Handler, + }, + { + MethodName: "LastBlockHeight", + Handler: _Query_LastBlockHeight_Handler, + }, + { + MethodName: "LastBlockHeightAll", + Handler: _Query_LastBlockHeightAll_Handler, + }, + { + MethodName: "Cctx", + Handler: _Query_Cctx_Handler, + }, + { + MethodName: "CctxByNonce", + Handler: _Query_CctxByNonce_Handler, + }, + { + MethodName: "CctxAll", + Handler: _Query_CctxAll_Handler, + }, + { + MethodName: "CctxListPending", + Handler: _Query_CctxListPending_Handler, + }, + { + MethodName: "ZetaAccounting", + Handler: _Query_ZetaAccounting_Handler, + }, + { + MethodName: "LastZetaHeight", + Handler: _Query_LastZetaHeight_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "crosschain/query.proto", } -func (m *QueryZEVMGetBlockByNumberResponse) GetGasLimit() string { - if m != nil { - return m.GasLimit +func (m *QueryZetaAccountingRequest) 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 "" + return dAtA[:n], nil } -func (m *QueryZEVMGetBlockByNumberResponse) GetGasUsed() string { - if m != nil { - return m.GasUsed - } - return "" +func (m *QueryZetaAccountingRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryZEVMGetBlockByNumberResponse) GetTimestamp() string { - if m != nil { - return m.Timestamp - } - return "" +func (m *QueryZetaAccountingRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil } -func (m *QueryZEVMGetBlockByNumberResponse) GetTransactions() []string { - if m != nil { - return m.Transactions +func (m *QueryZetaAccountingResponse) 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 nil + return dAtA[:n], nil } -func (m *QueryZEVMGetBlockByNumberResponse) GetUncles() []string { - if m != nil { - return m.Uncles +func (m *QueryZetaAccountingResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryZetaAccountingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AbortedZetaAmount) > 0 { + i -= len(m.AbortedZetaAmount) + copy(dAtA[i:], m.AbortedZetaAmount) + i = encodeVarintQuery(dAtA, i, uint64(len(m.AbortedZetaAmount))) + i-- + dAtA[i] = 0xa } - return nil + return len(dAtA) - i, nil } -func (m *QueryZEVMGetBlockByNumberResponse) GetBaseFeePerGas() string { - if m != nil { - return m.BaseFeePerGas +func (m *QueryParamsRequest) 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 "" + return dAtA[:n], nil } -func (m *QueryZEVMGetBlockByNumberResponse) GetMixHash() string { - if m != nil { - return m.MixHash +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) 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 "" + return dAtA[:n], nil } -func init() { - proto.RegisterType((*QueryCctxByStatusRequest)(nil), "zetachain.zetacore.crosschain.QueryCctxByStatusRequest") - proto.RegisterType((*QueryCctxByStatusResponse)(nil), "zetachain.zetacore.crosschain.QueryCctxByStatusResponse") - proto.RegisterType((*QueryTssHistoryRequest)(nil), "zetachain.zetacore.crosschain.QueryTssHistoryRequest") - proto.RegisterType((*QueryTssHistoryResponse)(nil), "zetachain.zetacore.crosschain.QueryTssHistoryResponse") - proto.RegisterType((*QueryParamsRequest)(nil), "zetachain.zetacore.crosschain.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "zetachain.zetacore.crosschain.QueryParamsResponse") - proto.RegisterType((*QueryGetOutTxTrackerRequest)(nil), "zetachain.zetacore.crosschain.QueryGetOutTxTrackerRequest") - proto.RegisterType((*QueryGetOutTxTrackerResponse)(nil), "zetachain.zetacore.crosschain.QueryGetOutTxTrackerResponse") - proto.RegisterType((*QueryAllOutTxTrackerRequest)(nil), "zetachain.zetacore.crosschain.QueryAllOutTxTrackerRequest") - proto.RegisterType((*QueryAllOutTxTrackerResponse)(nil), "zetachain.zetacore.crosschain.QueryAllOutTxTrackerResponse") - proto.RegisterType((*QueryAllOutTxTrackerByChainRequest)(nil), "zetachain.zetacore.crosschain.QueryAllOutTxTrackerByChainRequest") - proto.RegisterType((*QueryAllOutTxTrackerByChainResponse)(nil), "zetachain.zetacore.crosschain.QueryAllOutTxTrackerByChainResponse") - proto.RegisterType((*QueryAllInTxTrackerByChainRequest)(nil), "zetachain.zetacore.crosschain.QueryAllInTxTrackerByChainRequest") - proto.RegisterType((*QueryAllInTxTrackerByChainResponse)(nil), "zetachain.zetacore.crosschain.QueryAllInTxTrackerByChainResponse") - proto.RegisterType((*QueryAllInTxTrackersRequest)(nil), "zetachain.zetacore.crosschain.QueryAllInTxTrackersRequest") - proto.RegisterType((*QueryAllInTxTrackersResponse)(nil), "zetachain.zetacore.crosschain.QueryAllInTxTrackersResponse") - proto.RegisterType((*QueryGetInTxHashToCctxRequest)(nil), "zetachain.zetacore.crosschain.QueryGetInTxHashToCctxRequest") - proto.RegisterType((*QueryGetInTxHashToCctxResponse)(nil), "zetachain.zetacore.crosschain.QueryGetInTxHashToCctxResponse") - proto.RegisterType((*QueryInTxHashToCctxDataRequest)(nil), "zetachain.zetacore.crosschain.QueryInTxHashToCctxDataRequest") - proto.RegisterType((*QueryInTxHashToCctxDataResponse)(nil), "zetachain.zetacore.crosschain.QueryInTxHashToCctxDataResponse") - proto.RegisterType((*QueryAllInTxHashToCctxRequest)(nil), "zetachain.zetacore.crosschain.QueryAllInTxHashToCctxRequest") - proto.RegisterType((*QueryAllInTxHashToCctxResponse)(nil), "zetachain.zetacore.crosschain.QueryAllInTxHashToCctxResponse") - proto.RegisterType((*QueryGetTssAddressRequest)(nil), "zetachain.zetacore.crosschain.QueryGetTssAddressRequest") - proto.RegisterType((*QueryGetTssAddressResponse)(nil), "zetachain.zetacore.crosschain.QueryGetTssAddressResponse") - proto.RegisterType((*QueryGetTSSRequest)(nil), "zetachain.zetacore.crosschain.QueryGetTSSRequest") - proto.RegisterType((*QueryGetTSSResponse)(nil), "zetachain.zetacore.crosschain.QueryGetTSSResponse") - proto.RegisterType((*QueryGetGasPriceRequest)(nil), "zetachain.zetacore.crosschain.QueryGetGasPriceRequest") - proto.RegisterType((*QueryGetGasPriceResponse)(nil), "zetachain.zetacore.crosschain.QueryGetGasPriceResponse") - proto.RegisterType((*QueryAllGasPriceRequest)(nil), "zetachain.zetacore.crosschain.QueryAllGasPriceRequest") - proto.RegisterType((*QueryAllGasPriceResponse)(nil), "zetachain.zetacore.crosschain.QueryAllGasPriceResponse") - proto.RegisterType((*QueryGetChainNoncesRequest)(nil), "zetachain.zetacore.crosschain.QueryGetChainNoncesRequest") - proto.RegisterType((*QueryGetChainNoncesResponse)(nil), "zetachain.zetacore.crosschain.QueryGetChainNoncesResponse") - proto.RegisterType((*QueryAllChainNoncesRequest)(nil), "zetachain.zetacore.crosschain.QueryAllChainNoncesRequest") - proto.RegisterType((*QueryAllChainNoncesResponse)(nil), "zetachain.zetacore.crosschain.QueryAllChainNoncesResponse") - proto.RegisterType((*QueryAllPendingNoncesRequest)(nil), "zetachain.zetacore.crosschain.QueryAllPendingNoncesRequest") - proto.RegisterType((*QueryAllPendingNoncesResponse)(nil), "zetachain.zetacore.crosschain.QueryAllPendingNoncesResponse") - proto.RegisterType((*QueryPendingNoncesByChainRequest)(nil), "zetachain.zetacore.crosschain.QueryPendingNoncesByChainRequest") - proto.RegisterType((*QueryPendingNoncesByChainResponse)(nil), "zetachain.zetacore.crosschain.QueryPendingNoncesByChainResponse") - proto.RegisterType((*QueryGetLastBlockHeightRequest)(nil), "zetachain.zetacore.crosschain.QueryGetLastBlockHeightRequest") - proto.RegisterType((*QueryGetLastBlockHeightResponse)(nil), "zetachain.zetacore.crosschain.QueryGetLastBlockHeightResponse") - proto.RegisterType((*QueryAllLastBlockHeightRequest)(nil), "zetachain.zetacore.crosschain.QueryAllLastBlockHeightRequest") - proto.RegisterType((*QueryAllLastBlockHeightResponse)(nil), "zetachain.zetacore.crosschain.QueryAllLastBlockHeightResponse") - proto.RegisterType((*QueryGetCctxRequest)(nil), "zetachain.zetacore.crosschain.QueryGetCctxRequest") - proto.RegisterType((*QueryGetCctxByNonceRequest)(nil), "zetachain.zetacore.crosschain.QueryGetCctxByNonceRequest") - proto.RegisterType((*QueryGetCctxResponse)(nil), "zetachain.zetacore.crosschain.QueryGetCctxResponse") - proto.RegisterType((*QueryAllCctxRequest)(nil), "zetachain.zetacore.crosschain.QueryAllCctxRequest") - proto.RegisterType((*QueryAllCctxResponse)(nil), "zetachain.zetacore.crosschain.QueryAllCctxResponse") - proto.RegisterType((*QueryAllCctxPendingRequest)(nil), "zetachain.zetacore.crosschain.QueryAllCctxPendingRequest") - proto.RegisterType((*QueryAllCctxPendingResponse)(nil), "zetachain.zetacore.crosschain.QueryAllCctxPendingResponse") - proto.RegisterType((*QueryLastZetaHeightRequest)(nil), "zetachain.zetacore.crosschain.QueryLastZetaHeightRequest") - proto.RegisterType((*QueryLastZetaHeightResponse)(nil), "zetachain.zetacore.crosschain.QueryLastZetaHeightResponse") - proto.RegisterType((*QueryConvertGasToZetaRequest)(nil), "zetachain.zetacore.crosschain.QueryConvertGasToZetaRequest") - proto.RegisterType((*QueryConvertGasToZetaResponse)(nil), "zetachain.zetacore.crosschain.QueryConvertGasToZetaResponse") - proto.RegisterType((*QueryMessagePassingProtocolFeeRequest)(nil), "zetachain.zetacore.crosschain.QueryMessagePassingProtocolFeeRequest") - proto.RegisterType((*QueryMessagePassingProtocolFeeResponse)(nil), "zetachain.zetacore.crosschain.QueryMessagePassingProtocolFeeResponse") - proto.RegisterType((*QueryZEVMGetTransactionReceiptRequest)(nil), "zetachain.zetacore.crosschain.QueryZEVMGetTransactionReceiptRequest") - proto.RegisterType((*QueryZEVMGetTransactionReceiptResponse)(nil), "zetachain.zetacore.crosschain.QueryZEVMGetTransactionReceiptResponse") - proto.RegisterType((*Log)(nil), "zetachain.zetacore.crosschain.Log") - proto.RegisterType((*QueryZEVMGetTransactionRequest)(nil), "zetachain.zetacore.crosschain.QueryZEVMGetTransactionRequest") - proto.RegisterType((*QueryZEVMGetTransactionResponse)(nil), "zetachain.zetacore.crosschain.QueryZEVMGetTransactionResponse") - proto.RegisterType((*QueryZEVMGetBlockByNumberRequest)(nil), "zetachain.zetacore.crosschain.QueryZEVMGetBlockByNumberRequest") - proto.RegisterType((*QueryZEVMGetBlockByNumberResponse)(nil), "zetachain.zetacore.crosschain.QueryZEVMGetBlockByNumberResponse") -} - -func init() { proto.RegisterFile("crosschain/query.proto", fileDescriptor_65a992045e92a606) } - -var fileDescriptor_65a992045e92a606 = []byte{ - // 3234 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x5b, 0xdb, 0x6f, 0x1b, 0xc7, - 0xd5, 0xf7, 0x8a, 0xba, 0x0e, 0x75, 0xf3, 0x58, 0x71, 0x18, 0xc6, 0x16, 0x9d, 0x75, 0x7c, 0xb7, - 0xc9, 0x58, 0xb1, 0x95, 0xc4, 0x76, 0xf2, 0x45, 0xb2, 0x63, 0xc5, 0x88, 0x92, 0xe8, 0x5b, 0x29, - 0xdf, 0xd7, 0xba, 0x48, 0x89, 0x15, 0x39, 0xa6, 0x16, 0x26, 0xb9, 0xcc, 0xce, 0x50, 0x90, 0x62, - 0xa8, 0x2d, 0xf2, 0xd0, 0xe7, 0x00, 0x05, 0xda, 0x97, 0xbe, 0xf6, 0xf2, 0xd0, 0x87, 0x02, 0x0d, - 0x9a, 0x02, 0x05, 0x52, 0x14, 0x6d, 0xd3, 0x3c, 0x06, 0x2d, 0x50, 0xf4, 0x02, 0x10, 0x45, 0xd2, - 0x27, 0xfe, 0x07, 0x05, 0xfa, 0x50, 0xcc, 0xd9, 0xb3, 0xdc, 0x59, 0xee, 0xae, 0xb8, 0xa2, 0x98, - 0xa0, 0x7d, 0x11, 0x67, 0xce, 0xec, 0x39, 0xf3, 0x3b, 0x97, 0x39, 0x73, 0x66, 0x67, 0x45, 0x8e, - 0x97, 0x1c, 0x9b, 0xf3, 0xd2, 0x96, 0x69, 0xd5, 0x0b, 0xef, 0x34, 0x99, 0xb3, 0x9b, 0x6f, 0x38, - 0xb6, 0xb0, 0xe9, 0xc9, 0x77, 0x99, 0x30, 0x81, 0x9c, 0x87, 0x96, 0xed, 0xb0, 0xbc, 0xff, 0x68, - 0xf6, 0x62, 0xc9, 0xe6, 0x35, 0x9b, 0x17, 0x36, 0x4d, 0xce, 0x5c, 0xbe, 0xc2, 0xf6, 0xd5, 0x4d, - 0x26, 0xcc, 0xab, 0x85, 0x86, 0x59, 0xb1, 0xea, 0xa6, 0xb0, 0xec, 0xba, 0x2b, 0x2a, 0x7b, 0x52, - 0x99, 0x02, 0xfe, 0x16, 0xeb, 0x76, 0xbd, 0xc4, 0x38, 0x0e, 0xe7, 0xd4, 0x61, 0xd9, 0x2c, 0xba, - 0x0f, 0x89, 0x1d, 0x7c, 0x20, 0xab, 0x3c, 0x50, 0x31, 0x79, 0xb1, 0xe1, 0x58, 0x25, 0x86, 0x63, - 0xa7, 0x95, 0x31, 0xe0, 0x29, 0x6e, 0x99, 0x7c, 0xab, 0x28, 0xec, 0x62, 0xa9, 0xd4, 0x11, 0x30, - 0x1f, 0x7a, 0x48, 0x38, 0x66, 0xe9, 0x21, 0x73, 0x70, 0x5c, 0x57, 0xc6, 0xab, 0x26, 0x17, 0xc5, - 0xcd, 0xaa, 0x5d, 0x7a, 0x58, 0xdc, 0x62, 0x56, 0x65, 0x4b, 0x44, 0xc8, 0x00, 0xf8, 0x5d, 0x73, - 0xa8, 0x5a, 0xd8, 0x4d, 0x11, 0x9e, 0xe4, 0x71, 0xe5, 0x81, 0x86, 0xe9, 0x98, 0x35, 0x4f, 0xff, - 0x39, 0x65, 0x40, 0xf0, 0x0e, 0xb5, 0x62, 0x57, 0x6c, 0x68, 0x16, 0x64, 0x0b, 0xa9, 0x27, 0x2a, - 0xb6, 0x5d, 0xa9, 0xb2, 0x82, 0xd9, 0xb0, 0x0a, 0x66, 0xbd, 0x6e, 0x0b, 0xb0, 0x33, 0xf2, 0xe8, - 0x6f, 0x93, 0xcc, 0xff, 0x4a, 0x57, 0xdc, 0x2e, 0x89, 0x9d, 0xe5, 0xdd, 0x75, 0x61, 0x8a, 0x26, - 0x37, 0xd8, 0x3b, 0x4d, 0xc6, 0x05, 0x5d, 0x22, 0xa3, 0x1c, 0x08, 0x19, 0xed, 0x94, 0x76, 0x7e, - 0x7a, 0xe1, 0x42, 0x7e, 0x5f, 0x07, 0xe7, 0xa5, 0x0c, 0x94, 0x80, 0x8c, 0xba, 0x43, 0x9e, 0x88, - 0x10, 0xcf, 0x1b, 0x76, 0x9d, 0x33, 0xfa, 0x16, 0x99, 0xbc, 0x2d, 0xb9, 0x6f, 0x4b, 0xee, 0x8d, - 0x9d, 0x8c, 0x76, 0x2a, 0x75, 0x3e, 0xbd, 0x70, 0xa9, 0xd7, 0x2c, 0x0a, 0xcb, 0xf2, 0xf0, 0x27, - 0xad, 0xdc, 0x11, 0x23, 0x20, 0x46, 0xcf, 0x90, 0xe3, 0x30, 0xe7, 0x06, 0xe7, 0xaf, 0x5a, 0x5c, - 0xd8, 0xce, 0x2e, 0x2a, 0xa4, 0x7f, 0x9d, 0x3c, 0x1e, 0x1a, 0x41, 0x2c, 0xb7, 0xc9, 0xb8, 0xe0, - 0xbc, 0x58, 0xb5, 0xb8, 0x40, 0x1c, 0x7a, 0x0f, 0x1c, 0x1b, 0xeb, 0xeb, 0x38, 0xfd, 0x98, 0xe0, - 0x7c, 0xd5, 0xe2, 0x42, 0x9f, 0x23, 0x14, 0xe4, 0xaf, 0x81, 0xaf, 0xbc, 0x59, 0xef, 0x93, 0x63, - 0x01, 0x6a, 0x67, 0xc6, 0x51, 0xd7, 0xa7, 0x60, 0xdd, 0xf4, 0xc2, 0x99, 0x1e, 0xf3, 0xb9, 0xec, - 0x38, 0x25, 0xb2, 0xea, 0xaf, 0x93, 0x27, 0x41, 0xf6, 0x0a, 0x13, 0x6f, 0x36, 0xc5, 0xc6, 0xce, - 0x86, 0x1b, 0x3f, 0x9e, 0x07, 0x33, 0x64, 0x0c, 0x98, 0xef, 0xdd, 0x81, 0x49, 0x52, 0x86, 0xd7, - 0xa5, 0x73, 0x64, 0x04, 0x42, 0x32, 0x33, 0x74, 0x4a, 0x3b, 0x3f, 0x6c, 0xb8, 0x1d, 0xbd, 0x49, - 0x4e, 0x44, 0x8b, 0xf3, 0x3d, 0x66, 0x2b, 0x74, 0x44, 0xde, 0xcb, 0x63, 0xaa, 0x28, 0xcf, 0x63, - 0xaa, 0x18, 0x9d, 0xa1, 0x16, 0x4b, 0xd5, 0x6a, 0x94, 0x16, 0x77, 0x09, 0xf1, 0x13, 0x04, 0xce, - 0x79, 0x36, 0xef, 0x66, 0x93, 0xbc, 0xcc, 0x26, 0x79, 0x37, 0x0b, 0x61, 0x36, 0xc9, 0xaf, 0x99, - 0x15, 0x86, 0xbc, 0x86, 0xc2, 0xa9, 0x7f, 0xa4, 0xa1, 0x7a, 0xa1, 0x79, 0x62, 0xd5, 0x4b, 0x0d, - 0x40, 0x3d, 0xba, 0x12, 0xc0, 0x3f, 0x04, 0xf8, 0xcf, 0xf5, 0xc4, 0xef, 0x62, 0x0a, 0x28, 0xf0, - 0x9e, 0x46, 0xf4, 0x28, 0x05, 0x96, 0x77, 0x21, 0xf6, 0x3d, 0x7b, 0xcd, 0x91, 0x11, 0x40, 0x86, - 0x3e, 0x77, 0x3b, 0x5d, 0x56, 0x1c, 0xea, 0xdb, 0x8a, 0xbf, 0xd3, 0xc8, 0xe9, 0x7d, 0x41, 0xfc, - 0x97, 0x18, 0xf3, 0xdb, 0x1a, 0x79, 0xca, 0xd3, 0xe3, 0x5e, 0x3d, 0xce, 0x96, 0x4f, 0x90, 0x71, - 0x77, 0x6b, 0xb1, 0xca, 0xc1, 0x25, 0x54, 0x1e, 0x98, 0x41, 0x7f, 0xad, 0x78, 0x35, 0x0a, 0x08, - 0xda, 0xd3, 0x20, 0x69, 0xab, 0xde, 0x6d, 0xce, 0x8b, 0x3d, 0xcc, 0xa9, 0xca, 0x73, 0xad, 0xa9, - 0x0a, 0x19, 0x9c, 0x31, 0x4f, 0xfa, 0x2b, 0x58, 0x99, 0xb2, 0x93, 0x02, 0x1d, 0x7f, 0xe1, 0x05, - 0x87, 0xbf, 0x38, 0xdd, 0xf4, 0x9b, 0xe4, 0xa4, 0x97, 0xcb, 0xe4, 0x93, 0xaf, 0x9a, 0x7c, 0x6b, - 0xc3, 0x96, 0xfb, 0x90, 0xe7, 0xda, 0x2c, 0x19, 0xb7, 0x70, 0x00, 0x5c, 0x3b, 0x61, 0x74, 0xfa, - 0xfa, 0x1e, 0x99, 0x8f, 0x63, 0x46, 0xc8, 0x5f, 0x23, 0xd3, 0x56, 0x60, 0x04, 0x13, 0xd3, 0x95, - 0x04, 0xa8, 0x7d, 0x26, 0x04, 0xde, 0x25, 0x4a, 0xbf, 0x85, 0xd3, 0x07, 0x1f, 0xbe, 0x63, 0x0a, - 0x33, 0x09, 0xf8, 0x77, 0x49, 0x2e, 0x96, 0x1b, 0xd1, 0xff, 0x3f, 0x99, 0x52, 0xf7, 0x4c, 0xde, - 0xff, 0xde, 0x1b, 0x94, 0xa3, 0x57, 0xd0, 0xea, 0xe8, 0xe9, 0xb0, 0xd5, 0x07, 0x95, 0xcc, 0x3f, - 0xd6, 0xd0, 0x46, 0x11, 0x33, 0xed, 0xe3, 0xa2, 0xd4, 0x80, 0x5c, 0x34, 0xb8, 0xa5, 0x73, 0x13, - 0x4b, 0xa4, 0x15, 0x26, 0x36, 0x38, 0x5f, 0x2a, 0x97, 0x1d, 0xc6, 0x3b, 0x25, 0xd8, 0x3c, 0x49, - 0xcb, 0xb2, 0xa4, 0xd1, 0xdc, 0x2c, 0x3e, 0x64, 0xbb, 0xe8, 0xe9, 0x09, 0xc1, 0xf9, 0x5a, 0x73, - 0xf3, 0x35, 0xb6, 0xab, 0xbf, 0x4c, 0xb2, 0x51, 0xcc, 0x68, 0x80, 0x59, 0x92, 0x62, 0xc2, 0x8b, - 0x0f, 0xd9, 0x94, 0x94, 0x4d, 0x51, 0x02, 0xb8, 0x13, 0x86, 0x6c, 0x76, 0x6a, 0x16, 0x29, 0x61, - 0x7d, 0xdd, 0x5b, 0xb0, 0xaf, 0x61, 0xcd, 0xe2, 0x51, 0x51, 0xe0, 0x35, 0x92, 0xda, 0x58, 0x5f, - 0x47, 0xaf, 0x25, 0x28, 0x90, 0x0c, 0xf9, 0xb8, 0x5e, 0xc0, 0xb2, 0x6b, 0x85, 0x89, 0x15, 0x93, - 0xaf, 0xc9, 0x52, 0x5c, 0xd9, 0xaa, 0xac, 0x7a, 0x99, 0xed, 0x20, 0x46, 0xb7, 0xa3, 0x17, 0xb1, - 0x28, 0x0d, 0x30, 0xf8, 0x85, 0x9a, 0x47, 0x43, 0x1c, 0xe7, 0x7a, 0xe0, 0xe8, 0x88, 0xe8, 0x30, - 0xea, 0x26, 0x22, 0x5a, 0xaa, 0x56, 0xbb, 0x11, 0x0d, 0x2a, 0x3e, 0x7f, 0xac, 0xa1, 0x12, 0x81, - 0x39, 0x22, 0x95, 0x48, 0xf5, 0xa5, 0xc4, 0xe0, 0x22, 0x70, 0xc1, 0x0f, 0x22, 0x58, 0xc7, 0x6f, - 0xc0, 0x51, 0x6b, 0x7f, 0x17, 0x3d, 0xf4, 0x0b, 0xcf, 0x00, 0x0f, 0x2a, 0xb8, 0x4a, 0xd2, 0x0a, - 0x19, 0xcd, 0xd8, 0x2b, 0xa1, 0xab, 0x82, 0x54, 0x76, 0xbd, 0x8c, 0x00, 0x97, 0xaa, 0xd5, 0x08, - 0x80, 0x83, 0xf2, 0xd8, 0x07, 0x9a, 0xbf, 0x89, 0x25, 0xd2, 0x29, 0x75, 0x08, 0x9d, 0x06, 0xe7, - 0xbd, 0x79, 0x7f, 0x6f, 0x5d, 0x63, 0xf5, 0xb2, 0x55, 0xaf, 0x04, 0xcc, 0xa3, 0x0b, 0x3f, 0x23, - 0x77, 0x8d, 0xa3, 0x5e, 0xeb, 0x64, 0xba, 0xe1, 0x0e, 0xe0, 0x21, 0x1b, 0x55, 0xbb, 0xdc, 0xeb, - 0x40, 0x12, 0x90, 0x36, 0xd5, 0x50, 0xbb, 0xfa, 0x8b, 0xe4, 0x94, 0x7b, 0xe8, 0x51, 0xa9, 0x89, - 0x6b, 0x2b, 0xfd, 0x1b, 0x58, 0x9b, 0x45, 0xb3, 0x23, 0xf0, 0xaf, 0x46, 0x00, 0xd7, 0x0e, 0x0a, - 0xdc, 0xdb, 0xc6, 0x82, 0xf0, 0x17, 0xfd, 0xfd, 0x7f, 0xd5, 0xe4, 0x62, 0x59, 0x1e, 0xee, 0x5f, - 0x85, 0xb3, 0xfd, 0xfe, 0xcb, 0xe2, 0x11, 0x6e, 0xbd, 0x51, 0x7c, 0x88, 0xfa, 0x2b, 0x64, 0xa6, - 0x6b, 0x08, 0x61, 0xe7, 0x7b, 0xc0, 0xee, 0x16, 0xd8, 0x2d, 0x46, 0xdf, 0xf2, 0x77, 0xc4, 0x18, - 0xd0, 0x83, 0x5a, 0x2a, 0xbf, 0xd5, 0x50, 0xcf, 0xa8, 0xa9, 0xf6, 0xd3, 0x33, 0x35, 0x00, 0x3d, - 0x07, 0xb7, 0x74, 0x2e, 0xf9, 0xbb, 0x9c, 0x5a, 0xa2, 0x44, 0xbb, 0x76, 0x55, 0xc9, 0x92, 0xf0, - 0x36, 0x03, 0x42, 0xa5, 0xdf, 0x93, 0x76, 0x85, 0xcc, 0x05, 0xa7, 0x46, 0xab, 0xbd, 0x19, 0x7a, - 0x27, 0xa2, 0x1d, 0xb0, 0x2e, 0xeb, 0x7a, 0x1b, 0xf2, 0x36, 0xea, 0x28, 0x93, 0xda, 0x17, 0x50, - 0x86, 0xfd, 0x54, 0x43, 0x45, 0x3a, 0xf2, 0x63, 0x15, 0x49, 0x1d, 0x4a, 0x91, 0xc1, 0x79, 0xfd, - 0x9b, 0xca, 0x6e, 0x52, 0x12, 0x3b, 0x98, 0x0d, 0xbe, 0xc4, 0x03, 0xdf, 0x87, 0xea, 0x46, 0xa3, - 0x22, 0xf8, 0x8f, 0x37, 0xdd, 0x09, 0x34, 0x9d, 0x5c, 0x91, 0xf7, 0x99, 0x30, 0x03, 0xd9, 0x45, - 0xbf, 0x8e, 0x6a, 0x75, 0x8f, 0xa2, 0x5a, 0xc7, 0xc9, 0xa8, 0x92, 0xef, 0x52, 0x06, 0xf6, 0xf4, - 0x0d, 0xdc, 0xc0, 0x6e, 0xdb, 0xf5, 0x6d, 0xe6, 0xc8, 0x8a, 0x6f, 0xc3, 0x96, 0xec, 0xa1, 0xa5, - 0x15, 0x72, 0x48, 0x96, 0x8c, 0x57, 0x4c, 0xbe, 0x6a, 0xd5, 0x2c, 0x81, 0x25, 0x6d, 0xa7, 0xaf, - 0xff, 0x40, 0xc3, 0x7d, 0x2f, 0x2c, 0x16, 0xf1, 0x5c, 0x26, 0x47, 0xed, 0xa6, 0xd8, 0xb4, 0x9b, - 0xf5, 0xf2, 0x8a, 0xc9, 0xef, 0xd5, 0xe5, 0x20, 0x2e, 0xf9, 0xf0, 0x80, 0x7c, 0x1a, 0xde, 0x98, - 0x96, 0xec, 0xea, 0x5d, 0xc6, 0xf0, 0x69, 0x77, 0xd2, 0xf0, 0x00, 0x3d, 0x4f, 0x66, 0xe4, 0xaf, - 0x9a, 0xfc, 0x52, 0xb0, 0xfc, 0xbb, 0xc9, 0xfa, 0x39, 0x72, 0x06, 0x60, 0xbe, 0xce, 0x38, 0x37, - 0x2b, 0x6c, 0xcd, 0xe4, 0xdc, 0xaa, 0x57, 0xd6, 0x7c, 0x89, 0x9e, 0x75, 0xef, 0x92, 0xb3, 0xbd, - 0x1e, 0x44, 0xc5, 0x4e, 0x90, 0x89, 0x07, 0x1d, 0x88, 0x78, 0x64, 0xe8, 0x10, 0xf4, 0x9b, 0x38, - 0xe1, 0xfd, 0x57, 0xfe, 0xef, 0x75, 0x59, 0xde, 0x3b, 0x66, 0x9d, 0x9b, 0x25, 0xe9, 0x5e, 0x83, - 0x95, 0x98, 0xd5, 0xe8, 0x6c, 0x16, 0x94, 0x0c, 0x6f, 0xf9, 0xc7, 0x4b, 0x68, 0xeb, 0xff, 0x1a, - 0x46, 0x14, 0xfb, 0x70, 0x77, 0xcc, 0x4b, 0xf0, 0x9d, 0x78, 0x47, 0xc8, 0xf2, 0x54, 0xbb, 0x95, - 0x9b, 0x00, 0xaa, 0x3c, 0x49, 0x19, 0x7e, 0x93, 0x2e, 0x90, 0x49, 0xf7, 0xe9, 0x7a, 0xb3, 0xb6, - 0xc9, 0x1c, 0xd7, 0xb2, 0xcb, 0x33, 0xed, 0x56, 0x2e, 0x0d, 0xf4, 0x37, 0x80, 0x6c, 0xa8, 0x1d, - 0xfa, 0x12, 0x99, 0x2d, 0xd9, 0x75, 0xe1, 0x98, 0x25, 0x51, 0x34, 0xdd, 0xa3, 0x0f, 0x58, 0x79, - 0x62, 0xf9, 0x58, 0xbb, 0x95, 0x9b, 0xf1, 0xc6, 0xbc, 0x53, 0x51, 0x37, 0x81, 0xbe, 0x42, 0x8e, - 0x95, 0x9a, 0xb5, 0x66, 0xd5, 0x14, 0xd6, 0x36, 0x2b, 0x56, 0x4c, 0x5e, 0x6c, 0x72, 0x56, 0xce, - 0x0c, 0x83, 0x88, 0xc7, 0xda, 0xad, 0xdc, 0x51, 0x7f, 0x78, 0xc5, 0xe4, 0x6f, 0x71, 0x56, 0x36, - 0xc2, 0x24, 0x7a, 0x82, 0x0c, 0x3f, 0x70, 0xec, 0x5a, 0x66, 0x04, 0xf8, 0xc6, 0xdb, 0xad, 0x1c, - 0xf4, 0x0d, 0xf8, 0x4b, 0xcf, 0x42, 0x8c, 0xba, 0x92, 0x47, 0xe1, 0x89, 0x74, 0xbb, 0x95, 0x1b, - 0xab, 0xa0, 0x3c, 0xaf, 0x21, 0xcd, 0x55, 0xb5, 0x2b, 0xbc, 0xb8, 0x59, 0xb5, 0xed, 0x5a, 0x66, - 0xcc, 0x37, 0x97, 0xa4, 0x2e, 0x4b, 0xa2, 0xe1, 0x37, 0xa9, 0xde, 0x79, 0x35, 0x3f, 0x0e, 0x4f, - 0x92, 0x76, 0x2b, 0x87, 0x14, 0xef, 0xdd, 0x3b, 0x3d, 0x4e, 0x86, 0x84, 0x9d, 0x99, 0x80, 0xf1, - 0xd1, 0x76, 0x2b, 0x37, 0x24, 0x6c, 0x63, 0x48, 0xd8, 0xd2, 0x6c, 0xc2, 0x77, 0x9b, 0xeb, 0x1e, - 0xe2, 0x9b, 0x4d, 0x19, 0x03, 0x27, 0x75, 0x13, 0xe8, 0x12, 0x39, 0xaa, 0xf2, 0xbb, 0x5b, 0x65, - 0x1a, 0x04, 0xcc, 0xb5, 0x5b, 0x39, 0x55, 0xf8, 0x3d, 0x39, 0x66, 0x84, 0x28, 0x74, 0x91, 0x0c, - 0x4b, 0x5d, 0x32, 0x93, 0x89, 0xde, 0xb4, 0xaf, 0xda, 0x15, 0x03, 0x9e, 0xd7, 0xdf, 0x4b, 0x91, - 0xd4, 0xaa, 0x5d, 0x91, 0x29, 0xc1, 0x73, 0xb8, 0x1b, 0x9d, 0x5e, 0x57, 0x26, 0x19, 0x61, 0x37, - 0xac, 0x12, 0xcf, 0x0c, 0x9d, 0x4a, 0x9d, 0x9f, 0x30, 0xb0, 0x27, 0x83, 0xb9, 0x6c, 0x0a, 0xd3, - 0x8d, 0x0f, 0x03, 0xda, 0xa1, 0x98, 0x93, 0x8e, 0x1f, 0xee, 0x1d, 0x73, 0x21, 0xe3, 0x8d, 0x1c, - 0xd6, 0x78, 0xa3, 0x30, 0x71, 0x52, 0xe3, 0x05, 0x17, 0xd6, 0x58, 0x8f, 0x85, 0x75, 0x81, 0xc8, - 0xb0, 0xc1, 0x89, 0xc6, 0x61, 0xa2, 0xc9, 0x76, 0x2b, 0x37, 0x5e, 0xb5, 0x2b, 0xee, 0x04, 0x9d, - 0x16, 0x3d, 0x43, 0xc6, 0x1c, 0x56, 0xb3, 0xb7, 0x59, 0x19, 0xa2, 0x66, 0xdc, 0x8d, 0x54, 0x24, - 0x19, 0x5e, 0x43, 0xbf, 0x86, 0x65, 0x66, 0x54, 0x0a, 0x88, 0xcf, 0x1c, 0xff, 0x1c, 0xc6, 0x92, - 0x31, 0x8a, 0xed, 0x4b, 0x4b, 0x19, 0xde, 0x5a, 0x4d, 0x45, 0xae, 0xd5, 0x27, 0x48, 0xaa, 0x62, - 0x72, 0x4c, 0x00, 0x63, 0xed, 0x56, 0x4e, 0x76, 0x0d, 0xf9, 0x47, 0x9a, 0xb1, 0x73, 0x8f, 0x88, - 0x0e, 0x07, 0x33, 0x56, 0x3a, 0xe7, 0x72, 0xaf, 0x25, 0xe7, 0x00, 0xfc, 0xa3, 0xfe, 0x1c, 0xb2, - 0xef, 0xda, 0x81, 0xe6, 0x64, 0x71, 0xd9, 0x68, 0x0a, 0x74, 0xdc, 0x44, 0xbb, 0x95, 0x73, 0x09, - 0x86, 0xfb, 0x23, 0x1f, 0x70, 0xeb, 0xc5, 0x71, 0xff, 0x01, 0x20, 0x60, 0xe9, 0x18, 0xbb, 0xae, - 0x23, 0x43, 0x8b, 0x1c, 0x68, 0x5d, 0xe6, 0xc8, 0xc8, 0xb6, 0x59, 0x6d, 0x32, 0x5c, 0xce, 0x30, - 0x37, 0x10, 0x0c, 0xf7, 0x47, 0xea, 0x26, 0x76, 0x1b, 0x2c, 0x33, 0xe9, 0xeb, 0x26, 0xfb, 0x06, - 0xfc, 0xa5, 0x05, 0x92, 0x36, 0x4b, 0x25, 0xe6, 0xdd, 0xa3, 0x4d, 0xc9, 0x15, 0xb8, 0x3c, 0xdd, - 0x6e, 0xe5, 0x88, 0x4b, 0x5e, 0xb5, 0x64, 0x25, 0xe4, 0xb7, 0x65, 0x72, 0xec, 0x14, 0x5b, 0xd3, - 0x7e, 0x72, 0xc4, 0xfd, 0xdd, 0xdf, 0xe8, 0x8f, 0x11, 0x6d, 0x3b, 0x33, 0x03, 0x0f, 0x8c, 0xb4, - 0x5b, 0x39, 0x6d, 0xdb, 0xd0, 0xb6, 0x25, 0xd1, 0xc9, 0xcc, 0xfa, 0x44, 0xc7, 0xd0, 0x1c, 0x49, - 0xe4, 0x99, 0xa3, 0x3e, 0x91, 0x1b, 0x1a, 0xd7, 0x6f, 0xe0, 0x61, 0x14, 0x43, 0x0f, 0xb6, 0xdf, - 0xe5, 0x5d, 0x8c, 0x0f, 0x8c, 0xd9, 0xe3, 0x64, 0x74, 0xcb, 0xaf, 0x4e, 0x86, 0x0d, 0xec, 0xe9, - 0x7f, 0x19, 0xc3, 0xa3, 0x68, 0x34, 0x33, 0x46, 0xae, 0x4e, 0x46, 0x31, 0x0a, 0x35, 0x3f, 0x1f, - 0xbb, 0x14, 0x03, 0x7f, 0x3b, 0x71, 0x31, 0x14, 0x19, 0x17, 0x05, 0x92, 0x6e, 0x98, 0x0e, 0xab, - 0x0b, 0x37, 0xf8, 0xdd, 0x00, 0x05, 0xdb, 0xb9, 0x64, 0x88, 0x7e, 0xa5, 0xed, 0xc7, 0xc9, 0x70, - 0x4c, 0x9c, 0x14, 0x48, 0x9a, 0x6f, 0x99, 0xcf, 0x16, 0x9b, 0xf5, 0x52, 0x95, 0x71, 0x0c, 0x5a, - 0x90, 0x28, 0xc9, 0x6f, 0x01, 0xd5, 0x50, 0xda, 0x5d, 0x5b, 0xd0, 0x68, 0x8f, 0x2d, 0x28, 0x18, - 0x6e, 0xbc, 0xe8, 0xd8, 0xb6, 0x17, 0xd4, 0xdd, 0xe1, 0xc6, 0x0d, 0xdb, 0x16, 0x46, 0x88, 0x22, - 0x27, 0x94, 0x7b, 0x15, 0x73, 0x79, 0xc7, 0xfd, 0x09, 0x81, 0x0a, 0x4c, 0x7e, 0x93, 0x5e, 0x27, - 0x53, 0x8e, 0x5b, 0x63, 0xe0, 0x64, 0xee, 0x12, 0x98, 0x6d, 0xb7, 0x72, 0x93, 0xde, 0x00, 0xf0, - 0x04, 0x7a, 0xd2, 0x4e, 0x35, 0xab, 0xce, 0x1c, 0x5c, 0x0a, 0x60, 0x27, 0x20, 0x18, 0xee, 0x0f, - 0xcd, 0x13, 0x52, 0xb6, 0x1e, 0x3c, 0xb0, 0x4a, 0xcd, 0xaa, 0xd8, 0xc5, 0xc8, 0x07, 0x33, 0xf9, - 0x54, 0x43, 0x69, 0xc3, 0x16, 0x60, 0x0b, 0xb3, 0x5a, 0x54, 0xb8, 0x26, 0x95, 0x2d, 0x40, 0x8e, - 0xdd, 0xf1, 0x59, 0xbb, 0x09, 0x52, 0x6b, 0xb6, 0x23, 0x1c, 0xb3, 0x08, 0x1b, 0xd2, 0x94, 0xaf, - 0x35, 0x50, 0xe1, 0x35, 0xbd, 0xdf, 0x94, 0x51, 0xc3, 0xad, 0x77, 0x19, 0x2e, 0x0f, 0x88, 0x1a, - 0xd9, 0x37, 0xe0, 0xaf, 0x97, 0x96, 0xaa, 0x50, 0x02, 0xcf, 0x04, 0xd2, 0x12, 0x94, 0xc1, 0x7e, - 0x41, 0x1c, 0x28, 0x44, 0x66, 0xf7, 0x29, 0x44, 0x2e, 0x91, 0x09, 0x61, 0xd5, 0x18, 0x17, 0x66, - 0xad, 0x81, 0x2b, 0x09, 0xd0, 0x75, 0x88, 0x86, 0xdf, 0xa4, 0xd7, 0xc8, 0xa4, 0xea, 0xd5, 0x0c, - 0x85, 0x25, 0x0f, 0x2e, 0x09, 0x78, 0x3b, 0xd0, 0x93, 0xab, 0x05, 0x83, 0xf2, 0x18, 0x3c, 0x0f, - 0xab, 0xc5, 0xa5, 0x18, 0xf8, 0x4b, 0x6f, 0x90, 0x59, 0x79, 0x32, 0x29, 0x3e, 0x60, 0xac, 0xd8, - 0x60, 0x8e, 0x2c, 0xcf, 0x32, 0x73, 0x80, 0xe6, 0x68, 0xbb, 0x95, 0x9b, 0x92, 0x63, 0x77, 0x19, - 0x5b, 0x63, 0xce, 0x8a, 0xc9, 0x8d, 0x60, 0x57, 0xaa, 0x5a, 0xb3, 0xdc, 0xcf, 0x3a, 0x32, 0x8f, - 0xf9, 0xaa, 0xd6, 0x2c, 0x78, 0x81, 0x6f, 0x78, 0x8d, 0x85, 0x6f, 0x5d, 0x20, 0x23, 0xb0, 0xb6, - 0xe9, 0x77, 0x35, 0x32, 0xea, 0x5e, 0xb0, 0xd3, 0xab, 0x3d, 0xaa, 0x91, 0xf0, 0x0d, 0x7f, 0x76, - 0xe1, 0x20, 0x2c, 0x6e, 0xc6, 0xd0, 0xcf, 0xbc, 0xf7, 0xc7, 0x7f, 0x7c, 0x67, 0x28, 0x47, 0x4f, - 0x16, 0x24, 0xc7, 0x15, 0xe5, 0x5b, 0x16, 0xf5, 0x7b, 0x0f, 0xfa, 0xb1, 0x46, 0x26, 0xd5, 0x3b, - 0x51, 0x7a, 0x23, 0xc9, 0x5c, 0xd1, 0x9f, 0x03, 0x64, 0x6f, 0xf6, 0xc5, 0x8b, 0x80, 0x5f, 0x04, - 0xc0, 0xcf, 0xd1, 0xeb, 0x31, 0x80, 0xd5, 0x5b, 0xda, 0xc2, 0x23, 0x7c, 0xfb, 0xb1, 0x57, 0x78, - 0x04, 0xc9, 0x68, 0x8f, 0x7e, 0xa8, 0x91, 0x19, 0x55, 0xee, 0x52, 0xb5, 0x9a, 0x4c, 0x97, 0xe8, - 0x8f, 0x02, 0x92, 0xe9, 0x12, 0x73, 0xd1, 0xaf, 0x5f, 0x02, 0x5d, 0xce, 0xd0, 0xd3, 0x09, 0x74, - 0xa1, 0x7f, 0xd3, 0xc8, 0xf1, 0x2e, 0xe4, 0xf8, 0x26, 0x92, 0x2e, 0xf5, 0x01, 0x22, 0xf8, 0x12, - 0x34, 0xbb, 0x7c, 0x18, 0x11, 0xa8, 0xce, 0x0d, 0x50, 0xe7, 0x1a, 0x5d, 0x48, 0xa0, 0x0e, 0xf2, - 0xa2, 0x87, 0xf6, 0xe8, 0x5f, 0x35, 0xf2, 0x98, 0x72, 0x93, 0xaa, 0x28, 0xf7, 0x72, 0x42, 0x64, - 0xb1, 0x97, 0xe7, 0xd9, 0xa5, 0x43, 0x48, 0x40, 0xd5, 0x6e, 0x81, 0x6a, 0x8b, 0xf4, 0x5a, 0x8c, - 0x6a, 0x56, 0x3d, 0x46, 0xb3, 0xa2, 0x55, 0xde, 0xa3, 0x3f, 0xd7, 0xc8, 0x74, 0x50, 0xb9, 0xc4, - 0x31, 0x17, 0x71, 0x8d, 0x9d, 0x38, 0xe6, 0xa2, 0xee, 0xb8, 0x7b, 0xc6, 0x9c, 0xa2, 0x09, 0xa7, - 0xbf, 0x47, 0xe0, 0xca, 0x85, 0xe3, 0xad, 0x84, 0x8b, 0x37, 0xf2, 0xda, 0x35, 0xfb, 0x62, 0x9f, - 0xdc, 0x08, 0xfe, 0x79, 0x00, 0xbf, 0x40, 0x9f, 0xd9, 0x07, 0xbc, 0xcf, 0x56, 0x78, 0xe4, 0xf5, - 0xf7, 0xe8, 0x9f, 0x34, 0x42, 0xc3, 0x17, 0xd1, 0x34, 0x11, 0x9e, 0xd8, 0xeb, 0xef, 0xec, 0x4b, - 0xfd, 0xb2, 0xa3, 0x3e, 0x4b, 0xa0, 0xcf, 0x4d, 0xfa, 0x42, 0xac, 0x3e, 0xdd, 0xdf, 0x05, 0xc2, - 0x6e, 0xad, 0x2a, 0xf6, 0x2b, 0x8d, 0x1c, 0x0d, 0xce, 0x20, 0xc3, 0xeb, 0xd6, 0x01, 0x42, 0xa4, - 0x4f, 0x2f, 0xc5, 0x5e, 0x78, 0xeb, 0x57, 0x40, 0xab, 0x73, 0xf4, 0x4c, 0x22, 0x2f, 0xd1, 0x0f, - 0x34, 0x32, 0x15, 0xb8, 0x38, 0xa6, 0xcf, 0x27, 0x8c, 0x92, 0xd0, 0x45, 0x75, 0xf6, 0x85, 0x3e, - 0x38, 0x11, 0x75, 0x1e, 0x50, 0x9f, 0xa7, 0x67, 0x63, 0x50, 0x57, 0x98, 0x28, 0x0a, 0xce, 0xbd, - 0x57, 0x3c, 0xf4, 0x7d, 0x0d, 0x6e, 0xa1, 0x93, 0x6d, 0xd4, 0x81, 0x6b, 0xed, 0x64, 0x1b, 0x75, - 0xf0, 0xce, 0x5b, 0xd7, 0x01, 0xde, 0x09, 0x9a, 0x8d, 0x81, 0x27, 0xa1, 0xfc, 0x44, 0xf3, 0x2f, - 0x74, 0xe9, 0x62, 0xc2, 0x49, 0xba, 0x6e, 0x9e, 0xb3, 0xcf, 0x1d, 0x98, 0x0f, 0x11, 0x16, 0x00, - 0xe1, 0x05, 0x7a, 0x2e, 0xce, 0x80, 0xc8, 0x20, 0xa3, 0xb7, 0xcc, 0x76, 0xf6, 0xe8, 0x8f, 0x34, - 0x92, 0xf6, 0xa4, 0xc8, 0xa0, 0x5d, 0x4c, 0x18, 0x76, 0x7d, 0x21, 0x8e, 0xb8, 0xff, 0xd6, 0xcf, - 0x01, 0xe2, 0xa7, 0x68, 0xae, 0x07, 0x62, 0xfa, 0x91, 0x46, 0x66, 0xbb, 0x5f, 0xe0, 0xd2, 0x44, - 0x69, 0x38, 0xe6, 0x6d, 0x72, 0xf6, 0x56, 0x7f, 0xcc, 0x09, 0x4d, 0x5d, 0xea, 0xc6, 0xfa, 0xb1, - 0x46, 0xd2, 0xca, 0x3b, 0x5a, 0x7a, 0x27, 0xc9, 0xf4, 0xbd, 0xde, 0x05, 0x67, 0x5f, 0x39, 0xa4, - 0x14, 0xd4, 0xe6, 0x22, 0x68, 0xf3, 0x34, 0xd5, 0xe3, 0x6a, 0x50, 0x05, 0xf8, 0x2f, 0xb4, 0xc0, - 0xf5, 0x37, 0x4d, 0xba, 0xe0, 0xc3, 0x17, 0xf6, 0xd9, 0x1b, 0xfd, 0xb0, 0x22, 0xe4, 0x05, 0x80, - 0x7c, 0x99, 0x5e, 0x8c, 0x73, 0x80, 0xcf, 0xd3, 0x09, 0xf7, 0x9f, 0x69, 0x64, 0x5a, 0x91, 0x25, - 0x23, 0xfe, 0x85, 0x84, 0x91, 0xdb, 0x2f, 0xfa, 0xe8, 0x4f, 0x08, 0x7a, 0x1a, 0x5c, 0x41, 0x4f, - 0x7f, 0xa9, 0x91, 0xd9, 0xc0, 0x4d, 0xb5, 0xc4, 0x9d, 0xb4, 0x02, 0x89, 0xfa, 0x12, 0x20, 0x7b, - 0xab, 0x3f, 0x66, 0xc4, 0x7e, 0x19, 0xb0, 0x9f, 0xa5, 0x4f, 0xc7, 0x05, 0x8b, 0xca, 0x45, 0xff, - 0xa0, 0x91, 0xb9, 0xa8, 0xcb, 0x7b, 0xfa, 0x3f, 0x89, 0xce, 0x4a, 0xf1, 0x5f, 0x0d, 0x64, 0x5f, - 0xee, 0x5f, 0x00, 0x6a, 0xf2, 0x1c, 0x68, 0x72, 0x95, 0x16, 0x92, 0x68, 0xa2, 0x96, 0x93, 0x9f, - 0x68, 0xa1, 0x3b, 0x6d, 0x9a, 0xb4, 0xb0, 0x8a, 0xbe, 0x91, 0x4f, 0x56, 0xc8, 0xc4, 0x7f, 0x4d, - 0xa0, 0x2f, 0x82, 0x2e, 0xcf, 0xd0, 0x7c, 0x8c, 0x2e, 0xd5, 0x20, 0x5f, 0x67, 0x4d, 0xfc, 0x46, - 0x23, 0xb4, 0x4b, 0xa6, 0x8c, 0xaf, 0xa4, 0x05, 0xc8, 0x61, 0xb4, 0x89, 0xff, 0x66, 0xa0, 0x67, - 0x29, 0xd0, 0xa5, 0x0d, 0xfd, 0xbe, 0x46, 0x86, 0xa1, 0x94, 0x49, 0xba, 0xb1, 0xab, 0xc5, 0xd6, - 0xb3, 0x07, 0xe2, 0x49, 0x58, 0xc5, 0x97, 0xb0, 0xfc, 0x05, 0x23, 0x7f, 0x20, 0x73, 0xa6, 0xff, - 0xad, 0x40, 0xf2, 0x9c, 0x19, 0xfa, 0xbe, 0xa0, 0x3f, 0xb0, 0xd7, 0x01, 0x6c, 0x81, 0x5e, 0xd9, - 0x17, 0x6c, 0xe8, 0xa8, 0xfe, 0x3d, 0x8d, 0x8c, 0x79, 0xf5, 0xec, 0x42, 0xd2, 0x6c, 0x77, 0x50, - 0xc3, 0x76, 0x7d, 0x2f, 0xa0, 0x9f, 0x06, 0xac, 0x27, 0xe9, 0x93, 0xfb, 0x60, 0x75, 0x33, 0xb9, - 0x8b, 0x0c, 0x57, 0x78, 0xf2, 0x4c, 0x1e, 0xba, 0xea, 0x4f, 0x9e, 0xc9, 0xc3, 0x77, 0xf4, 0xbd, - 0x33, 0xb9, 0xcf, 0x03, 0xa7, 0xd0, 0xe0, 0x9d, 0x78, 0x32, 0xd4, 0x91, 0xb7, 0xec, 0xc9, 0x50, - 0x47, 0x5f, 0xc1, 0xf7, 0x3c, 0x20, 0x54, 0x83, 0x28, 0x7f, 0xa8, 0x11, 0xe2, 0xff, 0xaf, 0x0c, - 0xbd, 0x9e, 0x64, 0xe6, 0xd0, 0x7f, 0xdd, 0x64, 0x17, 0x0f, 0xca, 0x86, 0x60, 0x2f, 0x00, 0xd8, - 0xd3, 0xf4, 0xa9, 0x18, 0xb0, 0xc2, 0x47, 0xf6, 0xa1, 0x46, 0x26, 0xd5, 0x7f, 0x31, 0xa2, 0x89, - 0x2a, 0xd3, 0x88, 0xff, 0x79, 0xca, 0x3e, 0x7f, 0x70, 0x46, 0x84, 0x7b, 0x0d, 0xe0, 0xe6, 0xe9, - 0xe5, 0x7d, 0x22, 0x62, 0x13, 0x99, 0x0a, 0x8f, 0xdc, 0x3b, 0xda, 0xbd, 0xe5, 0xd7, 0x3e, 0xf9, - 0x6c, 0x5e, 0xfb, 0xf4, 0xb3, 0x79, 0xed, 0xef, 0x9f, 0xcd, 0x6b, 0xef, 0x7f, 0x3e, 0x7f, 0xe4, - 0xd3, 0xcf, 0xe7, 0x8f, 0xfc, 0xf9, 0xf3, 0xf9, 0x23, 0xf7, 0xaf, 0x56, 0x2c, 0xb1, 0xd5, 0xdc, - 0xcc, 0x97, 0xec, 0x9a, 0x2a, 0xd1, 0x03, 0x55, 0xd8, 0x09, 0xd8, 0x62, 0xb7, 0xc1, 0xf8, 0xe6, - 0x28, 0x14, 0x6c, 0xcf, 0xfe, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x62, 0xb0, 0x08, 0xf4, 0xa1, 0x37, - 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryClient is the client API for Query service. -// -// 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 { - // Parameters queries the parameters of the module. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // Queries a OutTxTracker by index. - OutTxTracker(ctx context.Context, in *QueryGetOutTxTrackerRequest, opts ...grpc.CallOption) (*QueryGetOutTxTrackerResponse, error) - // Queries a list of OutTxTracker items. - OutTxTrackerAll(ctx context.Context, in *QueryAllOutTxTrackerRequest, opts ...grpc.CallOption) (*QueryAllOutTxTrackerResponse, error) - OutTxTrackerAllByChain(ctx context.Context, in *QueryAllOutTxTrackerByChainRequest, opts ...grpc.CallOption) (*QueryAllOutTxTrackerByChainResponse, error) - InTxTrackerAllByChain(ctx context.Context, in *QueryAllInTxTrackerByChainRequest, opts ...grpc.CallOption) (*QueryAllInTxTrackerByChainResponse, error) - InTxTrackerAll(ctx context.Context, in *QueryAllInTxTrackersRequest, opts ...grpc.CallOption) (*QueryAllInTxTrackersResponse, error) - // Queries a InTxHashToCctx by index. - InTxHashToCctx(ctx context.Context, in *QueryGetInTxHashToCctxRequest, opts ...grpc.CallOption) (*QueryGetInTxHashToCctxResponse, error) - // Queries a InTxHashToCctx data by index. - InTxHashToCctxData(ctx context.Context, in *QueryInTxHashToCctxDataRequest, opts ...grpc.CallOption) (*QueryInTxHashToCctxDataResponse, error) - // Queries a list of InTxHashToCctx items. - InTxHashToCctxAll(ctx context.Context, in *QueryAllInTxHashToCctxRequest, opts ...grpc.CallOption) (*QueryAllInTxHashToCctxResponse, error) - // Queries a list of GetTssAddress items. - GetTssAddress(ctx context.Context, in *QueryGetTssAddressRequest, opts ...grpc.CallOption) (*QueryGetTssAddressResponse, error) - // Queries a tSS by index. - TSS(ctx context.Context, in *QueryGetTSSRequest, opts ...grpc.CallOption) (*QueryGetTSSResponse, error) - // Queries a gasPrice by index. - GasPrice(ctx context.Context, in *QueryGetGasPriceRequest, opts ...grpc.CallOption) (*QueryGetGasPriceResponse, error) - // Queries a list of gasPrice items. - GasPriceAll(ctx context.Context, in *QueryAllGasPriceRequest, opts ...grpc.CallOption) (*QueryAllGasPriceResponse, error) - ConvertGasToZeta(ctx context.Context, in *QueryConvertGasToZetaRequest, opts ...grpc.CallOption) (*QueryConvertGasToZetaResponse, error) - ProtocolFee(ctx context.Context, in *QueryMessagePassingProtocolFeeRequest, opts ...grpc.CallOption) (*QueryMessagePassingProtocolFeeResponse, error) - // Queries a chainNonces by index. - ChainNonces(ctx context.Context, in *QueryGetChainNoncesRequest, opts ...grpc.CallOption) (*QueryGetChainNoncesResponse, error) - // Queries a list of chainNonces items. - ChainNoncesAll(ctx context.Context, in *QueryAllChainNoncesRequest, opts ...grpc.CallOption) (*QueryAllChainNoncesResponse, error) - PendingNoncesAll(ctx context.Context, in *QueryAllPendingNoncesRequest, opts ...grpc.CallOption) (*QueryAllPendingNoncesResponse, error) - PendingNoncesByChain(ctx context.Context, in *QueryPendingNoncesByChainRequest, opts ...grpc.CallOption) (*QueryPendingNoncesByChainResponse, error) - // Queries a lastBlockHeight by index. - LastBlockHeight(ctx context.Context, in *QueryGetLastBlockHeightRequest, opts ...grpc.CallOption) (*QueryGetLastBlockHeightResponse, error) - // Queries a list of lastBlockHeight items. - LastBlockHeightAll(ctx context.Context, in *QueryAllLastBlockHeightRequest, opts ...grpc.CallOption) (*QueryAllLastBlockHeightResponse, error) - // Queries a send by index. - Cctx(ctx context.Context, in *QueryGetCctxRequest, opts ...grpc.CallOption) (*QueryGetCctxResponse, error) - // Queries a send by nonce. - CctxByNonce(ctx context.Context, in *QueryGetCctxByNonceRequest, opts ...grpc.CallOption) (*QueryGetCctxResponse, error) - // Queries a list of send items. - CctxAll(ctx context.Context, in *QueryAllCctxRequest, opts ...grpc.CallOption) (*QueryAllCctxResponse, error) - // Queries a list of send items. - CctxAllPending(ctx context.Context, in *QueryAllCctxPendingRequest, opts ...grpc.CallOption) (*QueryAllCctxPendingResponse, error) - // Queries a list of lastMetaHeight items. - LastZetaHeight(ctx context.Context, in *QueryLastZetaHeightRequest, opts ...grpc.CallOption) (*QueryLastZetaHeightResponse, error) - TssHistory(ctx context.Context, in *QueryTssHistoryRequest, opts ...grpc.CallOption) (*QueryTssHistoryResponse, error) - CctxByStatus(ctx context.Context, in *QueryCctxByStatusRequest, opts ...grpc.CallOption) (*QueryCctxByStatusResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/Params", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - return out, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (c *queryClient) OutTxTracker(ctx context.Context, in *QueryGetOutTxTrackerRequest, opts ...grpc.CallOption) (*QueryGetOutTxTrackerResponse, error) { - out := new(QueryGetOutTxTrackerResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/OutTxTracker", in, out, opts...) +func (m *QueryGetOutTxTrackerRequest) 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 out, nil + return dAtA[:n], nil } -func (c *queryClient) OutTxTrackerAll(ctx context.Context, in *QueryAllOutTxTrackerRequest, opts ...grpc.CallOption) (*QueryAllOutTxTrackerResponse, error) { - out := new(QueryAllOutTxTrackerResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/OutTxTrackerAll", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryGetOutTxTrackerRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (c *queryClient) OutTxTrackerAllByChain(ctx context.Context, in *QueryAllOutTxTrackerByChainRequest, opts ...grpc.CallOption) (*QueryAllOutTxTrackerByChainResponse, error) { - out := new(QueryAllOutTxTrackerByChainResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/OutTxTrackerAllByChain", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryGetOutTxTrackerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Nonce != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Nonce)) + i-- + dAtA[i] = 0x10 } - return out, nil + if m.ChainID != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ChainID)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } -func (c *queryClient) InTxTrackerAllByChain(ctx context.Context, in *QueryAllInTxTrackerByChainRequest, opts ...grpc.CallOption) (*QueryAllInTxTrackerByChainResponse, error) { - out := new(QueryAllInTxTrackerByChainResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/InTxTrackerAllByChain", in, out, opts...) +func (m *QueryGetOutTxTrackerResponse) 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 out, nil + return dAtA[:n], nil } -func (c *queryClient) InTxTrackerAll(ctx context.Context, in *QueryAllInTxTrackersRequest, opts ...grpc.CallOption) (*QueryAllInTxTrackersResponse, error) { - out := new(QueryAllInTxTrackersResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/InTxTrackerAll", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryGetOutTxTrackerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (c *queryClient) InTxHashToCctx(ctx context.Context, in *QueryGetInTxHashToCctxRequest, opts ...grpc.CallOption) (*QueryGetInTxHashToCctxResponse, error) { - out := new(QueryGetInTxHashToCctxResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/InTxHashToCctx", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryGetOutTxTrackerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.OutTxTracker.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - return out, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (c *queryClient) InTxHashToCctxData(ctx context.Context, in *QueryInTxHashToCctxDataRequest, opts ...grpc.CallOption) (*QueryInTxHashToCctxDataResponse, error) { - out := new(QueryInTxHashToCctxDataResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/InTxHashToCctxData", in, out, opts...) +func (m *QueryAllOutTxTrackerRequest) 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 out, nil + return dAtA[:n], nil } -func (c *queryClient) InTxHashToCctxAll(ctx context.Context, in *QueryAllInTxHashToCctxRequest, opts ...grpc.CallOption) (*QueryAllInTxHashToCctxResponse, error) { - out := new(QueryAllInTxHashToCctxResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/InTxHashToCctxAll", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryAllOutTxTrackerRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (c *queryClient) GetTssAddress(ctx context.Context, in *QueryGetTssAddressRequest, opts ...grpc.CallOption) (*QueryGetTssAddressResponse, error) { - out := new(QueryGetTssAddressResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/GetTssAddress", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryAllOutTxTrackerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return out, nil + return len(dAtA) - i, nil } -func (c *queryClient) TSS(ctx context.Context, in *QueryGetTSSRequest, opts ...grpc.CallOption) (*QueryGetTSSResponse, error) { - out := new(QueryGetTSSResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/TSS", in, out, opts...) +func (m *QueryAllOutTxTrackerResponse) 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 out, nil + return dAtA[:n], nil } -func (c *queryClient) GasPrice(ctx context.Context, in *QueryGetGasPriceRequest, opts ...grpc.CallOption) (*QueryGetGasPriceResponse, error) { - out := new(QueryGetGasPriceResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/GasPrice", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryAllOutTxTrackerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (c *queryClient) GasPriceAll(ctx context.Context, in *QueryAllGasPriceRequest, opts ...grpc.CallOption) (*QueryAllGasPriceResponse, error) { - out := new(QueryAllGasPriceResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/GasPriceAll", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryAllOutTxTrackerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - return out, nil -} - -func (c *queryClient) ConvertGasToZeta(ctx context.Context, in *QueryConvertGasToZetaRequest, opts ...grpc.CallOption) (*QueryConvertGasToZetaResponse, error) { - out := new(QueryConvertGasToZetaResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/ConvertGasToZeta", in, out, opts...) - if err != nil { - return nil, err + if len(m.OutTxTracker) > 0 { + for iNdEx := len(m.OutTxTracker) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.OutTxTracker[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return out, nil + return len(dAtA) - i, nil } -func (c *queryClient) ProtocolFee(ctx context.Context, in *QueryMessagePassingProtocolFeeRequest, opts ...grpc.CallOption) (*QueryMessagePassingProtocolFeeResponse, error) { - out := new(QueryMessagePassingProtocolFeeResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/ProtocolFee", in, out, opts...) +func (m *QueryAllOutTxTrackerByChainRequest) 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 out, nil + return dAtA[:n], nil } -func (c *queryClient) ChainNonces(ctx context.Context, in *QueryGetChainNoncesRequest, opts ...grpc.CallOption) (*QueryGetChainNoncesResponse, error) { - out := new(QueryGetChainNoncesResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/ChainNonces", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryAllOutTxTrackerByChainRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (c *queryClient) ChainNoncesAll(ctx context.Context, in *QueryAllChainNoncesRequest, opts ...grpc.CallOption) (*QueryAllChainNoncesResponse, error) { - out := new(QueryAllChainNoncesResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/ChainNoncesAll", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryAllOutTxTrackerByChainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - return out, nil + if m.Chain != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Chain)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } -func (c *queryClient) PendingNoncesAll(ctx context.Context, in *QueryAllPendingNoncesRequest, opts ...grpc.CallOption) (*QueryAllPendingNoncesResponse, error) { - out := new(QueryAllPendingNoncesResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/PendingNoncesAll", in, out, opts...) +func (m *QueryAllOutTxTrackerByChainResponse) 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 out, nil + return dAtA[:n], nil } -func (c *queryClient) PendingNoncesByChain(ctx context.Context, in *QueryPendingNoncesByChainRequest, opts ...grpc.CallOption) (*QueryPendingNoncesByChainResponse, error) { - out := new(QueryPendingNoncesByChainResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/PendingNoncesByChain", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryAllOutTxTrackerByChainResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (c *queryClient) LastBlockHeight(ctx context.Context, in *QueryGetLastBlockHeightRequest, opts ...grpc.CallOption) (*QueryGetLastBlockHeightResponse, error) { - out := new(QueryGetLastBlockHeightResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/LastBlockHeight", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryAllOutTxTrackerByChainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - return out, nil + if len(m.OutTxTracker) > 0 { + for iNdEx := len(m.OutTxTracker) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.OutTxTracker[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil } -func (c *queryClient) LastBlockHeightAll(ctx context.Context, in *QueryAllLastBlockHeightRequest, opts ...grpc.CallOption) (*QueryAllLastBlockHeightResponse, error) { - out := new(QueryAllLastBlockHeightResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/LastBlockHeightAll", in, out, opts...) +func (m *QueryAllInTxTrackerByChainRequest) 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 out, nil + return dAtA[:n], nil } -func (c *queryClient) Cctx(ctx context.Context, in *QueryGetCctxRequest, opts ...grpc.CallOption) (*QueryGetCctxResponse, error) { - out := new(QueryGetCctxResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/Cctx", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryAllInTxTrackerByChainRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (c *queryClient) CctxByNonce(ctx context.Context, in *QueryGetCctxByNonceRequest, opts ...grpc.CallOption) (*QueryGetCctxResponse, error) { - out := new(QueryGetCctxResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/CctxByNonce", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryAllInTxTrackerByChainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - return out, nil + if m.ChainId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ChainId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } -func (c *queryClient) CctxAll(ctx context.Context, in *QueryAllCctxRequest, opts ...grpc.CallOption) (*QueryAllCctxResponse, error) { - out := new(QueryAllCctxResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/CctxAll", in, out, opts...) +func (m *QueryAllInTxTrackerByChainResponse) 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 out, nil + return dAtA[:n], nil } -func (c *queryClient) CctxAllPending(ctx context.Context, in *QueryAllCctxPendingRequest, opts ...grpc.CallOption) (*QueryAllCctxPendingResponse, error) { - out := new(QueryAllCctxPendingResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/CctxAllPending", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryAllInTxTrackerByChainResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (c *queryClient) LastZetaHeight(ctx context.Context, in *QueryLastZetaHeightRequest, opts ...grpc.CallOption) (*QueryLastZetaHeightResponse, error) { - out := new(QueryLastZetaHeightResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/LastZetaHeight", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryAllInTxTrackerByChainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - return out, nil + if len(m.InTxTracker) > 0 { + for iNdEx := len(m.InTxTracker) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.InTxTracker[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil } -func (c *queryClient) TssHistory(ctx context.Context, in *QueryTssHistoryRequest, opts ...grpc.CallOption) (*QueryTssHistoryResponse, error) { - out := new(QueryTssHistoryResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/TssHistory", in, out, opts...) +func (m *QueryAllInTxTrackersRequest) 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 out, nil + return dAtA[:n], nil } -func (c *queryClient) CctxByStatus(ctx context.Context, in *QueryCctxByStatusRequest, opts ...grpc.CallOption) (*QueryCctxByStatusResponse, error) { - out := new(QueryCctxByStatusResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/CctxByStatus", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryAllInTxTrackersRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -// QueryServer is the server API for Query service. -type QueryServer interface { - // Parameters queries the parameters of the module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // Queries a OutTxTracker by index. - OutTxTracker(context.Context, *QueryGetOutTxTrackerRequest) (*QueryGetOutTxTrackerResponse, error) - // Queries a list of OutTxTracker items. - OutTxTrackerAll(context.Context, *QueryAllOutTxTrackerRequest) (*QueryAllOutTxTrackerResponse, error) - OutTxTrackerAllByChain(context.Context, *QueryAllOutTxTrackerByChainRequest) (*QueryAllOutTxTrackerByChainResponse, error) - InTxTrackerAllByChain(context.Context, *QueryAllInTxTrackerByChainRequest) (*QueryAllInTxTrackerByChainResponse, error) - InTxTrackerAll(context.Context, *QueryAllInTxTrackersRequest) (*QueryAllInTxTrackersResponse, error) - // Queries a InTxHashToCctx by index. - InTxHashToCctx(context.Context, *QueryGetInTxHashToCctxRequest) (*QueryGetInTxHashToCctxResponse, error) - // Queries a InTxHashToCctx data by index. - InTxHashToCctxData(context.Context, *QueryInTxHashToCctxDataRequest) (*QueryInTxHashToCctxDataResponse, error) - // Queries a list of InTxHashToCctx items. - InTxHashToCctxAll(context.Context, *QueryAllInTxHashToCctxRequest) (*QueryAllInTxHashToCctxResponse, error) - // Queries a list of GetTssAddress items. - GetTssAddress(context.Context, *QueryGetTssAddressRequest) (*QueryGetTssAddressResponse, error) - // Queries a tSS by index. - TSS(context.Context, *QueryGetTSSRequest) (*QueryGetTSSResponse, error) - // Queries a gasPrice by index. - GasPrice(context.Context, *QueryGetGasPriceRequest) (*QueryGetGasPriceResponse, error) - // Queries a list of gasPrice items. - GasPriceAll(context.Context, *QueryAllGasPriceRequest) (*QueryAllGasPriceResponse, error) - ConvertGasToZeta(context.Context, *QueryConvertGasToZetaRequest) (*QueryConvertGasToZetaResponse, error) - ProtocolFee(context.Context, *QueryMessagePassingProtocolFeeRequest) (*QueryMessagePassingProtocolFeeResponse, error) - // Queries a chainNonces by index. - ChainNonces(context.Context, *QueryGetChainNoncesRequest) (*QueryGetChainNoncesResponse, error) - // Queries a list of chainNonces items. - ChainNoncesAll(context.Context, *QueryAllChainNoncesRequest) (*QueryAllChainNoncesResponse, error) - PendingNoncesAll(context.Context, *QueryAllPendingNoncesRequest) (*QueryAllPendingNoncesResponse, error) - PendingNoncesByChain(context.Context, *QueryPendingNoncesByChainRequest) (*QueryPendingNoncesByChainResponse, error) - // Queries a lastBlockHeight by index. - LastBlockHeight(context.Context, *QueryGetLastBlockHeightRequest) (*QueryGetLastBlockHeightResponse, error) - // Queries a list of lastBlockHeight items. - LastBlockHeightAll(context.Context, *QueryAllLastBlockHeightRequest) (*QueryAllLastBlockHeightResponse, error) - // Queries a send by index. - Cctx(context.Context, *QueryGetCctxRequest) (*QueryGetCctxResponse, error) - // Queries a send by nonce. - CctxByNonce(context.Context, *QueryGetCctxByNonceRequest) (*QueryGetCctxResponse, error) - // Queries a list of send items. - CctxAll(context.Context, *QueryAllCctxRequest) (*QueryAllCctxResponse, error) - // Queries a list of send items. - CctxAllPending(context.Context, *QueryAllCctxPendingRequest) (*QueryAllCctxPendingResponse, error) - // Queries a list of lastMetaHeight items. - LastZetaHeight(context.Context, *QueryLastZetaHeightRequest) (*QueryLastZetaHeightResponse, error) - TssHistory(context.Context, *QueryTssHistoryRequest) (*QueryTssHistoryResponse, error) - CctxByStatus(context.Context, *QueryCctxByStatusRequest) (*QueryCctxByStatusResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { +func (m *QueryAllInTxTrackersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} -func (*UnimplementedQueryServer) OutTxTracker(ctx context.Context, req *QueryGetOutTxTrackerRequest) (*QueryGetOutTxTrackerResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method OutTxTracker not implemented") -} -func (*UnimplementedQueryServer) OutTxTrackerAll(ctx context.Context, req *QueryAllOutTxTrackerRequest) (*QueryAllOutTxTrackerResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method OutTxTrackerAll not implemented") -} -func (*UnimplementedQueryServer) OutTxTrackerAllByChain(ctx context.Context, req *QueryAllOutTxTrackerByChainRequest) (*QueryAllOutTxTrackerByChainResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method OutTxTrackerAllByChain not implemented") -} -func (*UnimplementedQueryServer) InTxTrackerAllByChain(ctx context.Context, req *QueryAllInTxTrackerByChainRequest) (*QueryAllInTxTrackerByChainResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method InTxTrackerAllByChain not implemented") -} -func (*UnimplementedQueryServer) InTxTrackerAll(ctx context.Context, req *QueryAllInTxTrackersRequest) (*QueryAllInTxTrackersResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method InTxTrackerAll not implemented") -} -func (*UnimplementedQueryServer) InTxHashToCctx(ctx context.Context, req *QueryGetInTxHashToCctxRequest) (*QueryGetInTxHashToCctxResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method InTxHashToCctx not implemented") -} -func (*UnimplementedQueryServer) InTxHashToCctxData(ctx context.Context, req *QueryInTxHashToCctxDataRequest) (*QueryInTxHashToCctxDataResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method InTxHashToCctxData not implemented") -} -func (*UnimplementedQueryServer) InTxHashToCctxAll(ctx context.Context, req *QueryAllInTxHashToCctxRequest) (*QueryAllInTxHashToCctxResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method InTxHashToCctxAll not implemented") -} -func (*UnimplementedQueryServer) GetTssAddress(ctx context.Context, req *QueryGetTssAddressRequest) (*QueryGetTssAddressResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetTssAddress not implemented") -} -func (*UnimplementedQueryServer) TSS(ctx context.Context, req *QueryGetTSSRequest) (*QueryGetTSSResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method TSS not implemented") -} -func (*UnimplementedQueryServer) GasPrice(ctx context.Context, req *QueryGetGasPriceRequest) (*QueryGetGasPriceResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GasPrice not implemented") -} -func (*UnimplementedQueryServer) GasPriceAll(ctx context.Context, req *QueryAllGasPriceRequest) (*QueryAllGasPriceResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GasPriceAll not implemented") -} -func (*UnimplementedQueryServer) ConvertGasToZeta(ctx context.Context, req *QueryConvertGasToZetaRequest) (*QueryConvertGasToZetaResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ConvertGasToZeta not implemented") -} -func (*UnimplementedQueryServer) ProtocolFee(ctx context.Context, req *QueryMessagePassingProtocolFeeRequest) (*QueryMessagePassingProtocolFeeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ProtocolFee not implemented") -} -func (*UnimplementedQueryServer) ChainNonces(ctx context.Context, req *QueryGetChainNoncesRequest) (*QueryGetChainNoncesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ChainNonces not implemented") -} -func (*UnimplementedQueryServer) ChainNoncesAll(ctx context.Context, req *QueryAllChainNoncesRequest) (*QueryAllChainNoncesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ChainNoncesAll not implemented") -} -func (*UnimplementedQueryServer) PendingNoncesAll(ctx context.Context, req *QueryAllPendingNoncesRequest) (*QueryAllPendingNoncesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method PendingNoncesAll not implemented") -} -func (*UnimplementedQueryServer) PendingNoncesByChain(ctx context.Context, req *QueryPendingNoncesByChainRequest) (*QueryPendingNoncesByChainResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method PendingNoncesByChain not implemented") -} -func (*UnimplementedQueryServer) LastBlockHeight(ctx context.Context, req *QueryGetLastBlockHeightRequest) (*QueryGetLastBlockHeightResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method LastBlockHeight not implemented") -} -func (*UnimplementedQueryServer) LastBlockHeightAll(ctx context.Context, req *QueryAllLastBlockHeightRequest) (*QueryAllLastBlockHeightResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method LastBlockHeightAll not implemented") -} -func (*UnimplementedQueryServer) Cctx(ctx context.Context, req *QueryGetCctxRequest) (*QueryGetCctxResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Cctx not implemented") -} -func (*UnimplementedQueryServer) CctxByNonce(ctx context.Context, req *QueryGetCctxByNonceRequest) (*QueryGetCctxResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CctxByNonce not implemented") -} -func (*UnimplementedQueryServer) CctxAll(ctx context.Context, req *QueryAllCctxRequest) (*QueryAllCctxResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CctxAll not implemented") -} -func (*UnimplementedQueryServer) CctxAllPending(ctx context.Context, req *QueryAllCctxPendingRequest) (*QueryAllCctxPendingResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CctxAllPending not implemented") -} -func (*UnimplementedQueryServer) LastZetaHeight(ctx context.Context, req *QueryLastZetaHeightRequest) (*QueryLastZetaHeightResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method LastZetaHeight not implemented") -} -func (*UnimplementedQueryServer) TssHistory(ctx context.Context, req *QueryTssHistoryRequest) (*QueryTssHistoryResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method TssHistory not implemented") -} -func (*UnimplementedQueryServer) CctxByStatus(ctx context.Context, req *QueryCctxByStatusRequest) (*QueryCctxByStatusResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CctxByStatus not implemented") +func (m *QueryAllInTxTrackersResponse) 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 RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) +func (m *QueryAllInTxTrackersResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/Params", +func (m *QueryAllInTxTrackersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + if len(m.InTxTracker) > 0 { + for iNdEx := len(m.InTxTracker) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.InTxTracker[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return interceptor(ctx, in, info, handler) + return len(dAtA) - i, nil } -func _Query_OutTxTracker_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetOutTxTrackerRequest) - if err := dec(in); err != nil { +func (m *QueryGetInTxHashToCctxRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(QueryServer).OutTxTracker(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/OutTxTracker", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).OutTxTracker(ctx, req.(*QueryGetOutTxTrackerRequest)) - } - return interceptor(ctx, in, info, handler) + return dAtA[:n], nil } -func _Query_OutTxTrackerAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllOutTxTrackerRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).OutTxTrackerAll(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/OutTxTrackerAll", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).OutTxTrackerAll(ctx, req.(*QueryAllOutTxTrackerRequest)) - } - return interceptor(ctx, in, info, handler) +func (m *QueryGetInTxHashToCctxRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func _Query_OutTxTrackerAllByChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllOutTxTrackerByChainRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).OutTxTrackerAllByChain(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/OutTxTrackerAllByChain", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).OutTxTrackerAllByChain(ctx, req.(*QueryAllOutTxTrackerByChainRequest)) +func (m *QueryGetInTxHashToCctxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.InTxHash) > 0 { + i -= len(m.InTxHash) + copy(dAtA[i:], m.InTxHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.InTxHash))) + i-- + dAtA[i] = 0xa } - return interceptor(ctx, in, info, handler) + return len(dAtA) - i, nil } -func _Query_InTxTrackerAllByChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllInTxTrackerByChainRequest) - if err := dec(in); err != nil { +func (m *QueryGetInTxHashToCctxResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(QueryServer).InTxTrackerAllByChain(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/InTxTrackerAllByChain", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).InTxTrackerAllByChain(ctx, req.(*QueryAllInTxTrackerByChainRequest)) - } - return interceptor(ctx, in, info, handler) + return dAtA[:n], nil } -func _Query_InTxTrackerAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllInTxTrackersRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).InTxTrackerAll(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/InTxTrackerAll", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).InTxTrackerAll(ctx, req.(*QueryAllInTxTrackersRequest)) - } - return interceptor(ctx, in, info, handler) +func (m *QueryGetInTxHashToCctxResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func _Query_InTxHashToCctx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetInTxHashToCctxRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).InTxHashToCctx(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/InTxHashToCctx", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).InTxHashToCctx(ctx, req.(*QueryGetInTxHashToCctxRequest)) +func (m *QueryGetInTxHashToCctxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.InTxHashToCctx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - return interceptor(ctx, in, info, handler) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func _Query_InTxHashToCctxData_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryInTxHashToCctxDataRequest) - if err := dec(in); err != nil { +func (m *QueryInTxHashToCctxDataRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(QueryServer).InTxHashToCctxData(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/InTxHashToCctxData", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).InTxHashToCctxData(ctx, req.(*QueryInTxHashToCctxDataRequest)) - } - return interceptor(ctx, in, info, handler) + return dAtA[:n], nil } -func _Query_InTxHashToCctxAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllInTxHashToCctxRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).InTxHashToCctxAll(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/InTxHashToCctxAll", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).InTxHashToCctxAll(ctx, req.(*QueryAllInTxHashToCctxRequest)) - } - return interceptor(ctx, in, info, handler) +func (m *QueryInTxHashToCctxDataRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func _Query_GetTssAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetTssAddressRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GetTssAddress(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/GetTssAddress", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetTssAddress(ctx, req.(*QueryGetTssAddressRequest)) +func (m *QueryInTxHashToCctxDataRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.InTxHash) > 0 { + i -= len(m.InTxHash) + copy(dAtA[i:], m.InTxHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.InTxHash))) + i-- + dAtA[i] = 0xa } - return interceptor(ctx, in, info, handler) + return len(dAtA) - i, nil } -func _Query_TSS_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetTSSRequest) - if err := dec(in); err != nil { +func (m *QueryInTxHashToCctxDataResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(QueryServer).TSS(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/TSS", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).TSS(ctx, req.(*QueryGetTSSRequest)) - } - return interceptor(ctx, in, info, handler) + return dAtA[:n], nil } -func _Query_GasPrice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetGasPriceRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GasPrice(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/GasPrice", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GasPrice(ctx, req.(*QueryGetGasPriceRequest)) - } - return interceptor(ctx, in, info, handler) +func (m *QueryInTxHashToCctxDataResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func _Query_GasPriceAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllGasPriceRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GasPriceAll(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/GasPriceAll", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GasPriceAll(ctx, req.(*QueryAllGasPriceRequest)) +func (m *QueryInTxHashToCctxDataResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.CrossChainTxs) > 0 { + for iNdEx := len(m.CrossChainTxs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CrossChainTxs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return interceptor(ctx, in, info, handler) + return len(dAtA) - i, nil } -func _Query_ConvertGasToZeta_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryConvertGasToZetaRequest) - if err := dec(in); err != nil { +func (m *QueryAllInTxHashToCctxRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(QueryServer).ConvertGasToZeta(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/ConvertGasToZeta", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ConvertGasToZeta(ctx, req.(*QueryConvertGasToZetaRequest)) - } - return interceptor(ctx, in, info, handler) + return dAtA[:n], nil } -func _Query_ProtocolFee_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryMessagePassingProtocolFeeRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ProtocolFee(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/ProtocolFee", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ProtocolFee(ctx, req.(*QueryMessagePassingProtocolFeeRequest)) - } - return interceptor(ctx, in, info, handler) +func (m *QueryAllInTxHashToCctxRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func _Query_ChainNonces_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetChainNoncesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ChainNonces(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/ChainNonces", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ChainNonces(ctx, req.(*QueryGetChainNoncesRequest)) +func (m *QueryAllInTxHashToCctxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return interceptor(ctx, in, info, handler) + return len(dAtA) - i, nil } -func _Query_ChainNoncesAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllChainNoncesRequest) - if err := dec(in); err != nil { +func (m *QueryAllInTxHashToCctxResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(QueryServer).ChainNoncesAll(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/ChainNoncesAll", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ChainNoncesAll(ctx, req.(*QueryAllChainNoncesRequest)) - } - return interceptor(ctx, in, info, handler) + return dAtA[:n], nil } -func _Query_PendingNoncesAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllPendingNoncesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).PendingNoncesAll(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/PendingNoncesAll", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).PendingNoncesAll(ctx, req.(*QueryAllPendingNoncesRequest)) - } - return interceptor(ctx, in, info, handler) +func (m *QueryAllInTxHashToCctxResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func _Query_PendingNoncesByChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryPendingNoncesByChainRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).PendingNoncesByChain(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/PendingNoncesByChain", +func (m *QueryAllInTxHashToCctxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).PendingNoncesByChain(ctx, req.(*QueryPendingNoncesByChainRequest)) + if len(m.InTxHashToCctx) > 0 { + for iNdEx := len(m.InTxHashToCctx) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.InTxHashToCctx[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return interceptor(ctx, in, info, handler) + return len(dAtA) - i, nil } -func _Query_LastBlockHeight_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetLastBlockHeightRequest) - if err := dec(in); err != nil { +func (m *QueryGetGasPriceRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(QueryServer).LastBlockHeight(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/LastBlockHeight", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).LastBlockHeight(ctx, req.(*QueryGetLastBlockHeightRequest)) - } - return interceptor(ctx, in, info, handler) + return dAtA[:n], nil } -func _Query_LastBlockHeightAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllLastBlockHeightRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).LastBlockHeightAll(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/LastBlockHeightAll", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).LastBlockHeightAll(ctx, req.(*QueryAllLastBlockHeightRequest)) - } - return interceptor(ctx, in, info, handler) +func (m *QueryGetGasPriceRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func _Query_Cctx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetCctxRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Cctx(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/Cctx", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Cctx(ctx, req.(*QueryGetCctxRequest)) +func (m *QueryGetGasPriceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Index) > 0 { + i -= len(m.Index) + copy(dAtA[i:], m.Index) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Index))) + i-- + dAtA[i] = 0xa } - return interceptor(ctx, in, info, handler) + return len(dAtA) - i, nil } -func _Query_CctxByNonce_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetCctxByNonceRequest) - if err := dec(in); err != nil { +func (m *QueryGetGasPriceResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(QueryServer).CctxByNonce(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/CctxByNonce", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).CctxByNonce(ctx, req.(*QueryGetCctxByNonceRequest)) - } - return interceptor(ctx, in, info, handler) + return dAtA[:n], nil } -func _Query_CctxAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllCctxRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).CctxAll(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/CctxAll", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).CctxAll(ctx, req.(*QueryAllCctxRequest)) - } - return interceptor(ctx, in, info, handler) +func (m *QueryGetGasPriceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func _Query_CctxAllPending_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllCctxPendingRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).CctxAllPending(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/CctxAllPending", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).CctxAllPending(ctx, req.(*QueryAllCctxPendingRequest)) +func (m *QueryGetGasPriceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.GasPrice != nil { + { + size, err := m.GasPrice.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return interceptor(ctx, in, info, handler) + return len(dAtA) - i, nil } -func _Query_LastZetaHeight_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryLastZetaHeightRequest) - if err := dec(in); err != nil { +func (m *QueryAllGasPriceRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(QueryServer).LastZetaHeight(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/LastZetaHeight", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).LastZetaHeight(ctx, req.(*QueryLastZetaHeightRequest)) - } - return interceptor(ctx, in, info, handler) + return dAtA[:n], nil } -func _Query_TssHistory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryTssHistoryRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).TssHistory(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/TssHistory", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).TssHistory(ctx, req.(*QueryTssHistoryRequest)) +func (m *QueryAllGasPriceRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllGasPriceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return interceptor(ctx, in, info, handler) + return len(dAtA) - i, nil } -func _Query_CctxByStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryCctxByStatusRequest) - if err := dec(in); err != nil { +func (m *QueryAllGasPriceResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { return nil, err } - if interceptor == nil { - return srv.(QueryServer).CctxByStatus(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Query/CctxByStatus", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).CctxByStatus(ctx, req.(*QueryCctxByStatusRequest)) - } - return interceptor(ctx, in, info, handler) + return dAtA[:n], nil } -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "zetachain.zetacore.crosschain.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - { - MethodName: "OutTxTracker", - Handler: _Query_OutTxTracker_Handler, - }, - { - MethodName: "OutTxTrackerAll", - Handler: _Query_OutTxTrackerAll_Handler, - }, - { - MethodName: "OutTxTrackerAllByChain", - Handler: _Query_OutTxTrackerAllByChain_Handler, - }, - { - MethodName: "InTxTrackerAllByChain", - Handler: _Query_InTxTrackerAllByChain_Handler, - }, - { - MethodName: "InTxTrackerAll", - Handler: _Query_InTxTrackerAll_Handler, - }, - { - MethodName: "InTxHashToCctx", - Handler: _Query_InTxHashToCctx_Handler, - }, - { - MethodName: "InTxHashToCctxData", - Handler: _Query_InTxHashToCctxData_Handler, - }, - { - MethodName: "InTxHashToCctxAll", - Handler: _Query_InTxHashToCctxAll_Handler, - }, - { - MethodName: "GetTssAddress", - Handler: _Query_GetTssAddress_Handler, - }, - { - MethodName: "TSS", - Handler: _Query_TSS_Handler, - }, - { - MethodName: "GasPrice", - Handler: _Query_GasPrice_Handler, - }, - { - MethodName: "GasPriceAll", - Handler: _Query_GasPriceAll_Handler, - }, - { - MethodName: "ConvertGasToZeta", - Handler: _Query_ConvertGasToZeta_Handler, - }, - { - MethodName: "ProtocolFee", - Handler: _Query_ProtocolFee_Handler, - }, - { - MethodName: "ChainNonces", - Handler: _Query_ChainNonces_Handler, - }, - { - MethodName: "ChainNoncesAll", - Handler: _Query_ChainNoncesAll_Handler, - }, - { - MethodName: "PendingNoncesAll", - Handler: _Query_PendingNoncesAll_Handler, - }, - { - MethodName: "PendingNoncesByChain", - Handler: _Query_PendingNoncesByChain_Handler, - }, - { - MethodName: "LastBlockHeight", - Handler: _Query_LastBlockHeight_Handler, - }, - { - MethodName: "LastBlockHeightAll", - Handler: _Query_LastBlockHeightAll_Handler, - }, - { - MethodName: "Cctx", - Handler: _Query_Cctx_Handler, - }, - { - MethodName: "CctxByNonce", - Handler: _Query_CctxByNonce_Handler, - }, - { - MethodName: "CctxAll", - Handler: _Query_CctxAll_Handler, - }, - { - MethodName: "CctxAllPending", - Handler: _Query_CctxAllPending_Handler, - }, - { - MethodName: "LastZetaHeight", - Handler: _Query_LastZetaHeight_Handler, - }, - { - MethodName: "TssHistory", - Handler: _Query_TssHistory_Handler, - }, +func (m *QueryAllGasPriceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllGasPriceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { { - MethodName: "CctxByStatus", - Handler: _Query_CctxByStatus_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "crosschain/query.proto", + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.GasPrice) > 0 { + for iNdEx := len(m.GasPrice) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.GasPrice[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil } -func (m *QueryCctxByStatusRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryGetLastBlockHeightRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -4669,25 +3830,27 @@ func (m *QueryCctxByStatusRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryCctxByStatusRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryGetLastBlockHeightRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryCctxByStatusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryGetLastBlockHeightRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Status != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Status)) + if len(m.Index) > 0 { + i -= len(m.Index) + copy(dAtA[i:], m.Index) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Index))) i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryCctxByStatusResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryGetLastBlockHeightResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -4697,34 +3860,32 @@ func (m *QueryCctxByStatusResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryCctxByStatusResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryGetLastBlockHeightResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryCctxByStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryGetLastBlockHeightResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.CrossChainTx) > 0 { - for iNdEx := len(m.CrossChainTx) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.CrossChainTx[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + if m.LastBlockHeight != nil { + { + size, err := m.LastBlockHeight.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryTssHistoryRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryAllLastBlockHeightRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -4734,20 +3895,32 @@ func (m *QueryTssHistoryRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryTssHistoryRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllLastBlockHeightRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryTssHistoryRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllLastBlockHeightRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } -func (m *QueryTssHistoryResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryAllLastBlockHeightResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -4757,20 +3930,32 @@ func (m *QueryTssHistoryResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryTssHistoryResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllLastBlockHeightResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryTssHistoryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllLastBlockHeightResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.TssList) > 0 { - for iNdEx := len(m.TssList) - 1; iNdEx >= 0; iNdEx-- { + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.LastBlockHeight) > 0 { + for iNdEx := len(m.LastBlockHeight) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.TssList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.LastBlockHeight[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -4784,30 +3969,7 @@ func (m *QueryTssHistoryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryParamsRequest) 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 *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryGetCctxRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -4817,30 +3979,27 @@ func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryGetCctxRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryGetCctxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + if len(m.Index) > 0 { + i -= len(m.Index) + copy(dAtA[i:], m.Index) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Index))) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *QueryGetOutTxTrackerRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryGetCctxByNonceRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -4850,12 +4009,12 @@ func (m *QueryGetOutTxTrackerRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryGetOutTxTrackerRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryGetCctxByNonceRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetOutTxTrackerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryGetCctxByNonceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -4873,7 +4032,7 @@ func (m *QueryGetOutTxTrackerRequest) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } -func (m *QueryGetOutTxTrackerResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryGetCctxResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -4883,30 +4042,32 @@ func (m *QueryGetOutTxTrackerResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryGetOutTxTrackerResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryGetCctxResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetOutTxTrackerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryGetCctxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - { - size, err := m.OutTxTracker.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.CrossChainTx != nil { + { + size, err := m.CrossChainTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *QueryAllOutTxTrackerRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryAllCctxRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -4916,12 +4077,12 @@ func (m *QueryAllOutTxTrackerRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAllOutTxTrackerRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllCctxRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllOutTxTrackerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllCctxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -4941,7 +4102,7 @@ func (m *QueryAllOutTxTrackerRequest) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } -func (m *QueryAllOutTxTrackerResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryAllCctxResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -4951,12 +4112,12 @@ func (m *QueryAllOutTxTrackerResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAllOutTxTrackerResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllCctxResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllOutTxTrackerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllCctxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -4973,10 +4134,10 @@ func (m *QueryAllOutTxTrackerResponse) MarshalToSizedBuffer(dAtA []byte) (int, e i-- dAtA[i] = 0x12 } - if len(m.OutTxTracker) > 0 { - for iNdEx := len(m.OutTxTracker) - 1; iNdEx >= 0; iNdEx-- { + if len(m.CrossChainTx) > 0 { + for iNdEx := len(m.CrossChainTx) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.OutTxTracker[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.CrossChainTx[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -4990,7 +4151,7 @@ func (m *QueryAllOutTxTrackerResponse) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } -func (m *QueryAllOutTxTrackerByChainRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryListCctxPendingRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -5000,37 +4161,30 @@ func (m *QueryAllOutTxTrackerByChainRequest) Marshal() (dAtA []byte, err error) return dAtA[:n], nil } -func (m *QueryAllOutTxTrackerByChainRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryListCctxPendingRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllOutTxTrackerByChainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryListCctxPendingRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } + if m.Limit != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Limit)) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x10 } - if m.Chain != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Chain)) + if m.ChainId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ChainId)) i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *QueryAllOutTxTrackerByChainResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryListCctxPendingResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -5040,32 +4194,25 @@ func (m *QueryAllOutTxTrackerByChainResponse) Marshal() (dAtA []byte, err error) return dAtA[:n], nil } -func (m *QueryAllOutTxTrackerByChainResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryListCctxPendingResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllOutTxTrackerByChainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryListCctxPendingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } + if m.TotalPending != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.TotalPending)) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x10 } - if len(m.OutTxTracker) > 0 { - for iNdEx := len(m.OutTxTracker) - 1; iNdEx >= 0; iNdEx-- { + if len(m.CrossChainTx) > 0 { + for iNdEx := len(m.CrossChainTx) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.OutTxTracker[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.CrossChainTx[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -5079,7 +4226,7 @@ func (m *QueryAllOutTxTrackerByChainResponse) MarshalToSizedBuffer(dAtA []byte) return len(dAtA) - i, nil } -func (m *QueryAllInTxTrackerByChainRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryLastZetaHeightRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -5089,37 +4236,20 @@ func (m *QueryAllInTxTrackerByChainRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAllInTxTrackerByChainRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryLastZetaHeightRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllInTxTrackerByChainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryLastZetaHeightRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.ChainId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ChainId)) - i-- - dAtA[i] = 0x8 - } return len(dAtA) - i, nil } -func (m *QueryAllInTxTrackerByChainResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryLastZetaHeightResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -5129,46 +4259,25 @@ func (m *QueryAllInTxTrackerByChainResponse) Marshal() (dAtA []byte, err error) return dAtA[:n], nil } -func (m *QueryAllInTxTrackerByChainResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryLastZetaHeightResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllInTxTrackerByChainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryLastZetaHeightResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) i-- - dAtA[i] = 0x12 - } - if len(m.InTxTracker) > 0 { - for iNdEx := len(m.InTxTracker) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.InTxTracker[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *QueryAllInTxTrackersRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryConvertGasToZetaRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -5178,57 +4287,32 @@ func (m *QueryAllInTxTrackersRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAllInTxTrackersRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryConvertGasToZetaRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllInTxTrackersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryConvertGasToZetaRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - return len(dAtA) - i, nil -} - -func (m *QueryAllInTxTrackersResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if len(m.GasLimit) > 0 { + i -= len(m.GasLimit) + copy(dAtA[i:], m.GasLimit) + i = encodeVarintQuery(dAtA, i, uint64(len(m.GasLimit))) + i-- + dAtA[i] = 0x12 } - return dAtA[:n], nil -} - -func (m *QueryAllInTxTrackersResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllInTxTrackersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.InTxTracker) > 0 { - for iNdEx := len(m.InTxTracker) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.InTxTracker[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + if m.ChainId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ChainId)) + i-- + dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *QueryGetInTxHashToCctxRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryConvertGasToZetaResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -5238,27 +4322,39 @@ func (m *QueryGetInTxHashToCctxRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryGetInTxHashToCctxRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryConvertGasToZetaResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetInTxHashToCctxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryConvertGasToZetaResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.InTxHash) > 0 { - i -= len(m.InTxHash) - copy(dAtA[i:], m.InTxHash) - i = encodeVarintQuery(dAtA, i, uint64(len(m.InTxHash))) + if m.ZetaBlockHeight != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ZetaBlockHeight)) + i-- + dAtA[i] = 0x18 + } + if len(m.ProtocolFeeInZeta) > 0 { + i -= len(m.ProtocolFeeInZeta) + copy(dAtA[i:], m.ProtocolFeeInZeta) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ProtocolFeeInZeta))) + i-- + dAtA[i] = 0x12 + } + if len(m.OutboundGasInZeta) > 0 { + i -= len(m.OutboundGasInZeta) + copy(dAtA[i:], m.OutboundGasInZeta) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OutboundGasInZeta))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryGetInTxHashToCctxResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryMessagePassingProtocolFeeRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -5268,30 +4364,20 @@ func (m *QueryGetInTxHashToCctxResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryGetInTxHashToCctxResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryMessagePassingProtocolFeeRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetInTxHashToCctxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryMessagePassingProtocolFeeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - { - size, err := m.InTxHashToCctx.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *QueryInTxHashToCctxDataRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryMessagePassingProtocolFeeResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -5301,7134 +4387,631 @@ func (m *QueryInTxHashToCctxDataRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryInTxHashToCctxDataRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryMessagePassingProtocolFeeResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryInTxHashToCctxDataRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryMessagePassingProtocolFeeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.InTxHash) > 0 { - i -= len(m.InTxHash) - copy(dAtA[i:], m.InTxHash) - i = encodeVarintQuery(dAtA, i, uint64(len(m.InTxHash))) + if len(m.FeeInZeta) > 0 { + i -= len(m.FeeInZeta) + copy(dAtA[i:], m.FeeInZeta) + i = encodeVarintQuery(dAtA, i, uint64(len(m.FeeInZeta))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryInTxHashToCctxDataResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ } - return dAtA[:n], nil -} - -func (m *QueryInTxHashToCctxDataResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + dAtA[offset] = uint8(v) + return base } - -func (m *QueryInTxHashToCctxDataResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *QueryZetaAccountingRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - if len(m.CrossChainTxs) > 0 { - for iNdEx := len(m.CrossChainTxs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.CrossChainTxs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil + return n } -func (m *QueryAllInTxHashToCctxRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryZetaAccountingResponse) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *QueryAllInTxHashToCctxRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllInTxHashToCctxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa + l = len(m.AbortedZetaAmount) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) } - return len(dAtA) - i, nil + return n } -func (m *QueryAllInTxHashToCctxResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil + var l int + _ = l + return n } -func (m *QueryAllInTxHashToCctxResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n } -func (m *QueryAllInTxHashToCctxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *QueryGetOutTxTrackerRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 + if m.ChainID != 0 { + n += 1 + sovQuery(uint64(m.ChainID)) } - if len(m.InTxHashToCctx) > 0 { - for iNdEx := len(m.InTxHashToCctx) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.InTxHashToCctx[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + if m.Nonce != 0 { + n += 1 + sovQuery(uint64(m.Nonce)) } - return len(dAtA) - i, nil + return n } -func (m *QueryGetTssAddressRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryGetOutTxTrackerResponse) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *QueryGetTssAddressRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + var l int + _ = l + l = m.OutTxTracker.Size() + n += 1 + l + sovQuery(uint64(l)) + return n } -func (m *QueryGetTssAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *QueryAllOutTxTrackerRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - if len(m.TssPubKey) > 0 { - i -= len(m.TssPubKey) - copy(dAtA[i:], m.TssPubKey) - i = encodeVarintQuery(dAtA, i, uint64(len(m.TssPubKey))) - i-- - dAtA[i] = 0xa + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) } - return len(dAtA) - i, nil + return n } -func (m *QueryGetTssAddressResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryAllOutTxTrackerResponse) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *QueryGetTssAddressResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGetTssAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i var l int _ = l - if len(m.Btc) > 0 { - i -= len(m.Btc) - copy(dAtA[i:], m.Btc) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Btc))) - i-- - dAtA[i] = 0x12 + if len(m.OutTxTracker) > 0 { + for _, e := range m.OutTxTracker { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } } - if len(m.Eth) > 0 { - i -= len(m.Eth) - copy(dAtA[i:], m.Eth) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Eth))) - i-- - dAtA[i] = 0xa + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) } - return len(dAtA) - i, nil + return n } -func (m *QueryGetTSSRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryAllOutTxTrackerByChainRequest) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *QueryGetTSSRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGetTSSRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i var l int _ = l - return len(dAtA) - i, nil -} - -func (m *QueryGetTSSResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if m.Chain != 0 { + n += 1 + sovQuery(uint64(m.Chain)) } - return dAtA[:n], nil -} - -func (m *QueryGetTSSResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n } -func (m *QueryGetTSSResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *QueryAllOutTxTrackerByChainResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - if m.TSS != nil { - { - size, err := m.TSS.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + if len(m.OutTxTracker) > 0 { + for _, e := range m.OutTxTracker { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) } - i-- - dAtA[i] = 0xa } - return len(dAtA) - i, nil -} - -func (m *QueryGetGasPriceRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) } - return dAtA[:n], nil -} - -func (m *QueryGetGasPriceRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return n } -func (m *QueryGetGasPriceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *QueryAllInTxTrackerByChainRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - if len(m.Index) > 0 { - i -= len(m.Index) - copy(dAtA[i:], m.Index) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Index))) - i-- - dAtA[i] = 0xa + if m.ChainId != 0 { + n += 1 + sovQuery(uint64(m.ChainId)) } - return len(dAtA) - i, nil -} - -func (m *QueryGetGasPriceResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) } - return dAtA[:n], nil -} - -func (m *QueryGetGasPriceResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return n } -func (m *QueryGetGasPriceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *QueryAllInTxTrackerByChainResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - if m.GasPrice != nil { - { - size, err := m.GasPrice.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + if len(m.InTxTracker) > 0 { + for _, e := range m.InTxTracker { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) } - i-- - dAtA[i] = 0xa } - return len(dAtA) - i, nil -} - -func (m *QueryAllGasPriceRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) } - return dAtA[:n], nil -} - -func (m *QueryAllGasPriceRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return n } -func (m *QueryAllGasPriceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *QueryAllInTxTrackersRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) } - return len(dAtA) - i, nil + return n } -func (m *QueryAllGasPriceResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryAllInTxTrackersResponse) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *QueryAllGasPriceResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllGasPriceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + if len(m.InTxTracker) > 0 { + for _, e := range m.InTxTracker { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) } - i-- - dAtA[i] = 0x12 } - if len(m.GasPrice) > 0 { - for iNdEx := len(m.GasPrice) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.GasPrice[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) } - return len(dAtA) - i, nil + return n } -func (m *QueryGetChainNoncesRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryGetInTxHashToCctxRequest) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *QueryGetChainNoncesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGetChainNoncesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i var l int _ = l - if len(m.Index) > 0 { - i -= len(m.Index) - copy(dAtA[i:], m.Index) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Index))) - i-- - dAtA[i] = 0xa + l = len(m.InTxHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) } - return len(dAtA) - i, nil + return n } -func (m *QueryGetChainNoncesResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryGetInTxHashToCctxResponse) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil + var l int + _ = l + l = m.InTxHashToCctx.Size() + n += 1 + l + sovQuery(uint64(l)) + return n } -func (m *QueryGetChainNoncesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *QueryInTxHashToCctxDataRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.InTxHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n } -func (m *QueryGetChainNoncesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *QueryInTxHashToCctxDataResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - if m.ChainNonces != nil { - { - size, err := m.ChainNonces.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + if len(m.CrossChainTxs) > 0 { + for _, e := range m.CrossChainTxs { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) } - i-- - dAtA[i] = 0xa } - return len(dAtA) - i, nil + return n } -func (m *QueryAllChainNoncesRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryAllInTxHashToCctxRequest) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *QueryAllChainNoncesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllChainNoncesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i var l int _ = l if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) } - return len(dAtA) - i, nil + return n } -func (m *QueryAllChainNoncesResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryAllInTxHashToCctxResponse) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *QueryAllChainNoncesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllChainNoncesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + if len(m.InTxHashToCctx) > 0 { + for _, e := range m.InTxHashToCctx { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) } - i-- - dAtA[i] = 0x12 } - if len(m.ChainNonces) > 0 { - for iNdEx := len(m.ChainNonces) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ChainNonces[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) } - return len(dAtA) - i, nil + return n } -func (m *QueryAllPendingNoncesRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryGetGasPriceRequest) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *QueryAllPendingNoncesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllPendingNoncesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i var l int _ = l - return len(dAtA) - i, nil -} - -func (m *QueryAllPendingNoncesResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + l = len(m.Index) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) } - return dAtA[:n], nil -} - -func (m *QueryAllPendingNoncesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return n } -func (m *QueryAllPendingNoncesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *QueryGetGasPriceResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - if len(m.PendingNonces) > 0 { - for iNdEx := len(m.PendingNonces) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.PendingNonces[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + if m.GasPrice != nil { + l = m.GasPrice.Size() + n += 1 + l + sovQuery(uint64(l)) } - return len(dAtA) - i, nil + return n } -func (m *QueryPendingNoncesByChainRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryAllGasPriceRequest) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *QueryPendingNoncesByChainRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryPendingNoncesByChainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i var l int _ = l - if m.ChainId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ChainId)) - i-- - dAtA[i] = 0x8 + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) } - return len(dAtA) - i, nil + return n } -func (m *QueryPendingNoncesByChainResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryAllGasPriceResponse) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *QueryPendingNoncesByChainResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryPendingNoncesByChainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i var l int _ = l - { - size, err := m.PendingNonces.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.GasPrice) > 0 { + for _, e := range m.GasPrice { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *QueryGetLastBlockHeightRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) } - return dAtA[:n], nil -} - -func (m *QueryGetLastBlockHeightRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return n } -func (m *QueryGetLastBlockHeightRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *QueryGetLastBlockHeightRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - if len(m.Index) > 0 { - i -= len(m.Index) - copy(dAtA[i:], m.Index) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Index))) - i-- - dAtA[i] = 0xa + l = len(m.Index) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) } - return len(dAtA) - i, nil + return n } -func (m *QueryGetLastBlockHeightResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryGetLastBlockHeightResponse) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *QueryGetLastBlockHeightResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGetLastBlockHeightResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i var l int _ = l if m.LastBlockHeight != nil { - { - size, err := m.LastBlockHeight.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa + l = m.LastBlockHeight.Size() + n += 1 + l + sovQuery(uint64(l)) } - return len(dAtA) - i, nil + return n } -func (m *QueryAllLastBlockHeightRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryAllLastBlockHeightRequest) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *QueryAllLastBlockHeightRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllLastBlockHeightRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i var l int _ = l if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) } - return len(dAtA) - i, nil + return n } -func (m *QueryAllLastBlockHeightResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryAllLastBlockHeightResponse) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *QueryAllLastBlockHeightResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllLastBlockHeightResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } if len(m.LastBlockHeight) > 0 { - for iNdEx := len(m.LastBlockHeight) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.LastBlockHeight[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa + for _, e := range m.LastBlockHeight { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) } } - return len(dAtA) - i, nil -} - -func (m *QueryGetCctxRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) } - return dAtA[:n], nil -} - -func (m *QueryGetCctxRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return n } -func (m *QueryGetCctxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *QueryGetCctxRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - if len(m.Index) > 0 { - i -= len(m.Index) - copy(dAtA[i:], m.Index) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Index))) - i-- - dAtA[i] = 0xa + l = len(m.Index) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) } - return len(dAtA) - i, nil + return n } -func (m *QueryGetCctxByNonceRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryGetCctxByNonceRequest) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *QueryGetCctxByNonceRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryGetCctxByNonceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i var l int _ = l - if m.Nonce != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Nonce)) - i-- - dAtA[i] = 0x10 - } if m.ChainID != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ChainID)) - i-- - dAtA[i] = 0x8 + n += 1 + sovQuery(uint64(m.ChainID)) } - return len(dAtA) - i, nil + if m.Nonce != 0 { + n += 1 + sovQuery(uint64(m.Nonce)) + } + return n } -func (m *QueryGetCctxResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryGetCctxResponse) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil + var l int + _ = l + if m.CrossChainTx != nil { + l = m.CrossChainTx.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n } -func (m *QueryGetCctxResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *QueryAllCctxRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n } -func (m *QueryGetCctxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *QueryAllCctxResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - if m.CrossChainTx != nil { - { - size, err := m.CrossChainTx.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + if len(m.CrossChainTx) > 0 { + for _, e := range m.CrossChainTx { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) } - i-- - dAtA[i] = 0xa } - return len(dAtA) - i, nil -} - -func (m *QueryAllCctxRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) } - return dAtA[:n], nil + return n } -func (m *QueryAllCctxRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *QueryListCctxPendingRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ChainId != 0 { + n += 1 + sovQuery(uint64(m.ChainId)) + } + if m.Limit != 0 { + n += 1 + sovQuery(uint64(m.Limit)) + } + return n } -func (m *QueryAllCctxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *QueryListCctxPendingResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + if len(m.CrossChainTx) > 0 { + for _, e := range m.CrossChainTx { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) } - i-- - dAtA[i] = 0xa } - return len(dAtA) - i, nil + if m.TotalPending != 0 { + n += 1 + sovQuery(uint64(m.TotalPending)) + } + return n } -func (m *QueryAllCctxResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryLastZetaHeightRequest) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil + var l int + _ = l + return n } -func (m *QueryAllCctxResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *QueryLastZetaHeightResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + return n } -func (m *QueryAllCctxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *QueryConvertGasToZetaRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.CrossChainTx) > 0 { - for iNdEx := len(m.CrossChainTx) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.CrossChainTx[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *QueryAllCctxPendingRequest) 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 *QueryAllCctxPendingRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllCctxPendingRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.ChainId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ChainId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryAllCctxPendingResponse) 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 *QueryAllCctxPendingResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllCctxPendingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.CrossChainTx) > 0 { - for iNdEx := len(m.CrossChainTx) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.CrossChainTx[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *QueryLastZetaHeightRequest) 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 *QueryLastZetaHeightRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryLastZetaHeightRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryLastZetaHeightResponse) 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 *QueryLastZetaHeightResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryLastZetaHeightResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Height != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Height)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryConvertGasToZetaRequest) 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 *QueryConvertGasToZetaRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryConvertGasToZetaRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.GasLimit) > 0 { - i -= len(m.GasLimit) - copy(dAtA[i:], m.GasLimit) - i = encodeVarintQuery(dAtA, i, uint64(len(m.GasLimit))) - i-- - dAtA[i] = 0x12 - } if m.ChainId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ChainId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryConvertGasToZetaResponse) 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 *QueryConvertGasToZetaResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryConvertGasToZetaResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ZetaBlockHeight != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ZetaBlockHeight)) - i-- - dAtA[i] = 0x18 - } - if len(m.ProtocolFeeInZeta) > 0 { - i -= len(m.ProtocolFeeInZeta) - copy(dAtA[i:], m.ProtocolFeeInZeta) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ProtocolFeeInZeta))) - i-- - dAtA[i] = 0x12 + n += 1 + sovQuery(uint64(m.ChainId)) } - if len(m.OutboundGasInZeta) > 0 { - i -= len(m.OutboundGasInZeta) - copy(dAtA[i:], m.OutboundGasInZeta) - i = encodeVarintQuery(dAtA, i, uint64(len(m.OutboundGasInZeta))) - i-- - dAtA[i] = 0xa + l = len(m.GasLimit) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) } - return len(dAtA) - i, nil + return n } -func (m *QueryMessagePassingProtocolFeeRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryConvertGasToZetaResponse) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *QueryMessagePassingProtocolFeeRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryMessagePassingProtocolFeeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i var l int _ = l - return len(dAtA) - i, nil -} - -func (m *QueryMessagePassingProtocolFeeResponse) 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 *QueryMessagePassingProtocolFeeResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryMessagePassingProtocolFeeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.FeeInZeta) > 0 { - i -= len(m.FeeInZeta) - copy(dAtA[i:], m.FeeInZeta) - i = encodeVarintQuery(dAtA, i, uint64(len(m.FeeInZeta))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryZEVMGetTransactionReceiptRequest) 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 *QueryZEVMGetTransactionReceiptRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryZEVMGetTransactionReceiptRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Hash) > 0 { - i -= len(m.Hash) - copy(dAtA[i:], m.Hash) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Hash))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryZEVMGetTransactionReceiptResponse) 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 *QueryZEVMGetTransactionReceiptResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryZEVMGetTransactionReceiptResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Logs) > 0 { - for iNdEx := len(m.Logs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Logs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x62 - } - } - if len(m.TransactionIndex) > 0 { - i -= len(m.TransactionIndex) - copy(dAtA[i:], m.TransactionIndex) - i = encodeVarintQuery(dAtA, i, uint64(len(m.TransactionIndex))) - i-- - dAtA[i] = 0x5a - } - if len(m.TransactionHash) > 0 { - i -= len(m.TransactionHash) - copy(dAtA[i:], m.TransactionHash) - i = encodeVarintQuery(dAtA, i, uint64(len(m.TransactionHash))) - i-- - dAtA[i] = 0x52 - } - if len(m.To) > 0 { - i -= len(m.To) - copy(dAtA[i:], m.To) - i = encodeVarintQuery(dAtA, i, uint64(len(m.To))) - i-- - dAtA[i] = 0x4a - } - if len(m.Status) > 0 { - i -= len(m.Status) - copy(dAtA[i:], m.Status) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Status))) - i-- - dAtA[i] = 0x42 - } - if len(m.LogsBloom) > 0 { - i -= len(m.LogsBloom) - copy(dAtA[i:], m.LogsBloom) - i = encodeVarintQuery(dAtA, i, uint64(len(m.LogsBloom))) - i-- - dAtA[i] = 0x3a - } - if len(m.GasUsed) > 0 { - i -= len(m.GasUsed) - copy(dAtA[i:], m.GasUsed) - i = encodeVarintQuery(dAtA, i, uint64(len(m.GasUsed))) - i-- - dAtA[i] = 0x32 - } - if len(m.From) > 0 { - i -= len(m.From) - copy(dAtA[i:], m.From) - i = encodeVarintQuery(dAtA, i, uint64(len(m.From))) - i-- - dAtA[i] = 0x2a - } - if len(m.CumulativeGasUsed) > 0 { - i -= len(m.CumulativeGasUsed) - copy(dAtA[i:], m.CumulativeGasUsed) - i = encodeVarintQuery(dAtA, i, uint64(len(m.CumulativeGasUsed))) - i-- - dAtA[i] = 0x22 - } - if len(m.ContractAddress) > 0 { - i -= len(m.ContractAddress) - copy(dAtA[i:], m.ContractAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) - i-- - dAtA[i] = 0x1a - } - if len(m.BlockNumber) > 0 { - i -= len(m.BlockNumber) - copy(dAtA[i:], m.BlockNumber) - i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockNumber))) - i-- - dAtA[i] = 0x12 - } - if len(m.BlockHash) > 0 { - i -= len(m.BlockHash) - copy(dAtA[i:], m.BlockHash) - i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockHash))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Log) 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 *Log) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Log) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Removed { - i-- - if m.Removed { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x48 - } - if m.LogIndex != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.LogIndex)) - i-- - dAtA[i] = 0x40 - } - if len(m.BlockHash) > 0 { - i -= len(m.BlockHash) - copy(dAtA[i:], m.BlockHash) - i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockHash))) - i-- - dAtA[i] = 0x3a - } - if m.TransactionIndex != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.TransactionIndex)) - i-- - dAtA[i] = 0x30 - } - if len(m.TransactionHash) > 0 { - i -= len(m.TransactionHash) - copy(dAtA[i:], m.TransactionHash) - i = encodeVarintQuery(dAtA, i, uint64(len(m.TransactionHash))) - i-- - dAtA[i] = 0x2a - } - if m.BlockNumber != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.BlockNumber)) - i-- - dAtA[i] = 0x20 - } - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0x1a - } - if len(m.Topics) > 0 { - for iNdEx := len(m.Topics) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Topics[iNdEx]) - copy(dAtA[i:], m.Topics[iNdEx]) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Topics[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryZEVMGetTransactionRequest) 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 *QueryZEVMGetTransactionRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryZEVMGetTransactionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Hash) > 0 { - i -= len(m.Hash) - copy(dAtA[i:], m.Hash) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Hash))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryZEVMGetTransactionResponse) 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 *QueryZEVMGetTransactionResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryZEVMGetTransactionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.S) > 0 { - i -= len(m.S) - copy(dAtA[i:], m.S) - i = encodeVarintQuery(dAtA, i, uint64(len(m.S))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x8a - } - if len(m.R) > 0 { - i -= len(m.R) - copy(dAtA[i:], m.R) - i = encodeVarintQuery(dAtA, i, uint64(len(m.R))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x82 - } - if len(m.V) > 0 { - i -= len(m.V) - copy(dAtA[i:], m.V) - i = encodeVarintQuery(dAtA, i, uint64(len(m.V))) - i-- - dAtA[i] = 0x7a - } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0x72 - } - if len(m.AccessList) > 0 { - for iNdEx := len(m.AccessList) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.AccessList[iNdEx]) - copy(dAtA[i:], m.AccessList[iNdEx]) - i = encodeVarintQuery(dAtA, i, uint64(len(m.AccessList[iNdEx]))) - i-- - dAtA[i] = 0x6a - } - } - if len(m.Type) > 0 { - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0x62 - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x5a - } - if len(m.TransactionIndex) > 0 { - i -= len(m.TransactionIndex) - copy(dAtA[i:], m.TransactionIndex) - i = encodeVarintQuery(dAtA, i, uint64(len(m.TransactionIndex))) - i-- - dAtA[i] = 0x52 - } - if len(m.To) > 0 { - i -= len(m.To) - copy(dAtA[i:], m.To) - i = encodeVarintQuery(dAtA, i, uint64(len(m.To))) - i-- - dAtA[i] = 0x4a - } - if len(m.Nonce) > 0 { - i -= len(m.Nonce) - copy(dAtA[i:], m.Nonce) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Nonce))) - i-- - dAtA[i] = 0x42 - } - if len(m.Input) > 0 { - i -= len(m.Input) - copy(dAtA[i:], m.Input) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Input))) - i-- - dAtA[i] = 0x3a - } - if len(m.Hash) > 0 { - i -= len(m.Hash) - copy(dAtA[i:], m.Hash) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Hash))) - i-- - dAtA[i] = 0x32 - } - if len(m.GasPrice) > 0 { - i -= len(m.GasPrice) - copy(dAtA[i:], m.GasPrice) - i = encodeVarintQuery(dAtA, i, uint64(len(m.GasPrice))) - i-- - dAtA[i] = 0x2a - } - if len(m.Gas) > 0 { - i -= len(m.Gas) - copy(dAtA[i:], m.Gas) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Gas))) - i-- - dAtA[i] = 0x22 - } - if len(m.From) > 0 { - i -= len(m.From) - copy(dAtA[i:], m.From) - i = encodeVarintQuery(dAtA, i, uint64(len(m.From))) - i-- - dAtA[i] = 0x1a - } - if len(m.BlockNumber) > 0 { - i -= len(m.BlockNumber) - copy(dAtA[i:], m.BlockNumber) - i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockNumber))) - i-- - dAtA[i] = 0x12 - } - if len(m.BlockHash) > 0 { - i -= len(m.BlockHash) - copy(dAtA[i:], m.BlockHash) - i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockHash))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryZEVMGetBlockByNumberRequest) 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 *QueryZEVMGetBlockByNumberRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryZEVMGetBlockByNumberRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Height != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Height)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryZEVMGetBlockByNumberResponse) 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 *QueryZEVMGetBlockByNumberResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryZEVMGetBlockByNumberResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.MixHash) > 0 { - i -= len(m.MixHash) - copy(dAtA[i:], m.MixHash) - i = encodeVarintQuery(dAtA, i, uint64(len(m.MixHash))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xaa - } - if len(m.BaseFeePerGas) > 0 { - i -= len(m.BaseFeePerGas) - copy(dAtA[i:], m.BaseFeePerGas) - i = encodeVarintQuery(dAtA, i, uint64(len(m.BaseFeePerGas))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xa2 - } - if len(m.Uncles) > 0 { - for iNdEx := len(m.Uncles) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Uncles[iNdEx]) - copy(dAtA[i:], m.Uncles[iNdEx]) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Uncles[iNdEx]))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x9a - } - } - if len(m.Transactions) > 0 { - for iNdEx := len(m.Transactions) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Transactions[iNdEx]) - copy(dAtA[i:], m.Transactions[iNdEx]) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Transactions[iNdEx]))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x92 - } - } - if len(m.Timestamp) > 0 { - i -= len(m.Timestamp) - copy(dAtA[i:], m.Timestamp) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Timestamp))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x8a - } - if len(m.GasUsed) > 0 { - i -= len(m.GasUsed) - copy(dAtA[i:], m.GasUsed) - i = encodeVarintQuery(dAtA, i, uint64(len(m.GasUsed))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x82 - } - if len(m.GasLimit) > 0 { - i -= len(m.GasLimit) - copy(dAtA[i:], m.GasLimit) - i = encodeVarintQuery(dAtA, i, uint64(len(m.GasLimit))) - i-- - dAtA[i] = 0x7a - } - if len(m.Size_) > 0 { - i -= len(m.Size_) - copy(dAtA[i:], m.Size_) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Size_))) - i-- - dAtA[i] = 0x72 - } - if len(m.ExtraData) > 0 { - i -= len(m.ExtraData) - copy(dAtA[i:], m.ExtraData) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ExtraData))) - i-- - dAtA[i] = 0x6a - } - if len(m.TotalDifficulty) > 0 { - i -= len(m.TotalDifficulty) - copy(dAtA[i:], m.TotalDifficulty) - i = encodeVarintQuery(dAtA, i, uint64(len(m.TotalDifficulty))) - i-- - dAtA[i] = 0x62 - } - if len(m.Difficulty) > 0 { - i -= len(m.Difficulty) - copy(dAtA[i:], m.Difficulty) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Difficulty))) - i-- - dAtA[i] = 0x5a - } - if len(m.Miner) > 0 { - i -= len(m.Miner) - copy(dAtA[i:], m.Miner) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Miner))) - i-- - dAtA[i] = 0x52 - } - if len(m.ReceiptsRoot) > 0 { - i -= len(m.ReceiptsRoot) - copy(dAtA[i:], m.ReceiptsRoot) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ReceiptsRoot))) - i-- - dAtA[i] = 0x4a - } - if len(m.StateRoot) > 0 { - i -= len(m.StateRoot) - copy(dAtA[i:], m.StateRoot) - i = encodeVarintQuery(dAtA, i, uint64(len(m.StateRoot))) - i-- - dAtA[i] = 0x42 - } - if len(m.TransactionsRoot) > 0 { - i -= len(m.TransactionsRoot) - copy(dAtA[i:], m.TransactionsRoot) - i = encodeVarintQuery(dAtA, i, uint64(len(m.TransactionsRoot))) - i-- - dAtA[i] = 0x3a - } - if len(m.LogsBloom) > 0 { - i -= len(m.LogsBloom) - copy(dAtA[i:], m.LogsBloom) - i = encodeVarintQuery(dAtA, i, uint64(len(m.LogsBloom))) - i-- - dAtA[i] = 0x32 - } - if len(m.Sha3Uncles) > 0 { - i -= len(m.Sha3Uncles) - copy(dAtA[i:], m.Sha3Uncles) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Sha3Uncles))) - i-- - dAtA[i] = 0x2a - } - if len(m.Nonce) > 0 { - i -= len(m.Nonce) - copy(dAtA[i:], m.Nonce) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Nonce))) - i-- - dAtA[i] = 0x22 - } - if len(m.ParentHash) > 0 { - i -= len(m.ParentHash) - copy(dAtA[i:], m.ParentHash) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ParentHash))) - i-- - dAtA[i] = 0x1a - } - if len(m.Hash) > 0 { - i -= len(m.Hash) - copy(dAtA[i:], m.Hash) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Hash))) - i-- - dAtA[i] = 0x12 - } - if len(m.Number) > 0 { - i -= len(m.Number) - copy(dAtA[i:], m.Number) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Number))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryCctxByStatusRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Status != 0 { - n += 1 + sovQuery(uint64(m.Status)) - } - return n -} - -func (m *QueryCctxByStatusResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.CrossChainTx) > 0 { - for _, e := range m.CrossChainTx { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryTssHistoryRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryTssHistoryResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.TssList) > 0 { - for _, e := range m.TssList { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryGetOutTxTrackerRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ChainID != 0 { - n += 1 + sovQuery(uint64(m.ChainID)) - } - if m.Nonce != 0 { - n += 1 + sovQuery(uint64(m.Nonce)) - } - return n -} - -func (m *QueryGetOutTxTrackerResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.OutTxTracker.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryAllOutTxTrackerRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllOutTxTrackerResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.OutTxTracker) > 0 { - for _, e := range m.OutTxTracker { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllOutTxTrackerByChainRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Chain != 0 { - n += 1 + sovQuery(uint64(m.Chain)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllOutTxTrackerByChainResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.OutTxTracker) > 0 { - for _, e := range m.OutTxTracker { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllInTxTrackerByChainRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ChainId != 0 { - n += 1 + sovQuery(uint64(m.ChainId)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllInTxTrackerByChainResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.InTxTracker) > 0 { - for _, e := range m.InTxTracker { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllInTxTrackersRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryAllInTxTrackersResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.InTxTracker) > 0 { - for _, e := range m.InTxTracker { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryGetInTxHashToCctxRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.InTxHash) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGetInTxHashToCctxResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.InTxHashToCctx.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryInTxHashToCctxDataRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.InTxHash) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryInTxHashToCctxDataResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.CrossChainTxs) > 0 { - for _, e := range m.CrossChainTxs { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryAllInTxHashToCctxRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllInTxHashToCctxResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.InTxHashToCctx) > 0 { - for _, e := range m.InTxHashToCctx { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGetTssAddressRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.TssPubKey) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGetTssAddressResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Eth) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Btc) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGetTSSRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryGetTSSResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.TSS != nil { - l = m.TSS.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGetGasPriceRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Index) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGetGasPriceResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.GasPrice != nil { - l = m.GasPrice.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllGasPriceRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllGasPriceResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.GasPrice) > 0 { - for _, e := range m.GasPrice { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGetChainNoncesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Index) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGetChainNoncesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ChainNonces != nil { - l = m.ChainNonces.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllChainNoncesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllChainNoncesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.ChainNonces) > 0 { - for _, e := range m.ChainNonces { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllPendingNoncesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryAllPendingNoncesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.PendingNonces) > 0 { - for _, e := range m.PendingNonces { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryPendingNoncesByChainRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ChainId != 0 { - n += 1 + sovQuery(uint64(m.ChainId)) - } - return n -} - -func (m *QueryPendingNoncesByChainResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.PendingNonces.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryGetLastBlockHeightRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Index) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGetLastBlockHeightResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.LastBlockHeight != nil { - l = m.LastBlockHeight.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllLastBlockHeightRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllLastBlockHeightResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.LastBlockHeight) > 0 { - for _, e := range m.LastBlockHeight { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGetCctxRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Index) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryGetCctxByNonceRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ChainID != 0 { - n += 1 + sovQuery(uint64(m.ChainID)) - } - if m.Nonce != 0 { - n += 1 + sovQuery(uint64(m.Nonce)) - } - return n -} - -func (m *QueryGetCctxResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.CrossChainTx != nil { - l = m.CrossChainTx.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllCctxRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllCctxResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.CrossChainTx) > 0 { - for _, e := range m.CrossChainTx { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllCctxPendingRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ChainId != 0 { - n += 1 + sovQuery(uint64(m.ChainId)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllCctxPendingResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.CrossChainTx) > 0 { - for _, e := range m.CrossChainTx { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryLastZetaHeightRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryLastZetaHeightResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Height != 0 { - n += 1 + sovQuery(uint64(m.Height)) - } - return n -} - -func (m *QueryConvertGasToZetaRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ChainId != 0 { - n += 1 + sovQuery(uint64(m.ChainId)) - } - l = len(m.GasLimit) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryConvertGasToZetaResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.OutboundGasInZeta) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.ProtocolFeeInZeta) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.ZetaBlockHeight != 0 { - n += 1 + sovQuery(uint64(m.ZetaBlockHeight)) - } - return n -} - -func (m *QueryMessagePassingProtocolFeeRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryMessagePassingProtocolFeeResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FeeInZeta) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryZEVMGetTransactionReceiptRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Hash) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryZEVMGetTransactionReceiptResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.BlockHash) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.BlockNumber) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.ContractAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.CumulativeGasUsed) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.From) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.GasUsed) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.LogsBloom) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Status) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.To) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.TransactionHash) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.TransactionIndex) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if len(m.Logs) > 0 { - for _, e := range m.Logs { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *Log) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if len(m.Topics) > 0 { - for _, s := range m.Topics { - l = len(s) - n += 1 + l + sovQuery(uint64(l)) - } - } - l = len(m.Data) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.BlockNumber != 0 { - n += 1 + sovQuery(uint64(m.BlockNumber)) - } - l = len(m.TransactionHash) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.TransactionIndex != 0 { - n += 1 + sovQuery(uint64(m.TransactionIndex)) - } - l = len(m.BlockHash) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.LogIndex != 0 { - n += 1 + sovQuery(uint64(m.LogIndex)) - } - if m.Removed { - n += 2 - } - return n -} - -func (m *QueryZEVMGetTransactionRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Hash) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryZEVMGetTransactionResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.BlockHash) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.BlockNumber) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.From) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Gas) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.GasPrice) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Hash) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Input) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Nonce) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.To) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.TransactionIndex) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Type) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if len(m.AccessList) > 0 { - for _, s := range m.AccessList { - l = len(s) - n += 1 + l + sovQuery(uint64(l)) - } - } - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.V) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.R) - if l > 0 { - n += 2 + l + sovQuery(uint64(l)) - } - l = len(m.S) - if l > 0 { - n += 2 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryZEVMGetBlockByNumberRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Height != 0 { - n += 1 + sovQuery(uint64(m.Height)) - } - return n -} - -func (m *QueryZEVMGetBlockByNumberResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Number) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Hash) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.ParentHash) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Nonce) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Sha3Uncles) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.LogsBloom) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.TransactionsRoot) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.StateRoot) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.ReceiptsRoot) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Miner) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Difficulty) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.TotalDifficulty) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.ExtraData) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Size_) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.GasLimit) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.GasUsed) - if l > 0 { - n += 2 + l + sovQuery(uint64(l)) - } - l = len(m.Timestamp) - if l > 0 { - n += 2 + l + sovQuery(uint64(l)) - } - if len(m.Transactions) > 0 { - for _, s := range m.Transactions { - l = len(s) - n += 2 + l + sovQuery(uint64(l)) - } - } - if len(m.Uncles) > 0 { - for _, s := range m.Uncles { - l = len(s) - n += 2 + l + sovQuery(uint64(l)) - } - } - l = len(m.BaseFeePerGas) - if l > 0 { - n += 2 + l + sovQuery(uint64(l)) - } - l = len(m.MixHash) - if l > 0 { - n += 2 + l + sovQuery(uint64(l)) - } - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *QueryCctxByStatusRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryCctxByStatusRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCctxByStatusRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - m.Status = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Status |= CctxStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryCctxByStatusResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryCctxByStatusResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCctxByStatusResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CrossChainTx", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CrossChainTx = append(m.CrossChainTx, CrossChainTx{}) - if err := m.CrossChainTx[len(m.CrossChainTx)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryTssHistoryRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryTssHistoryRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryTssHistoryRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryTssHistoryResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryTssHistoryResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryTssHistoryResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TssList", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TssList = append(m.TssList, TSS{}) - if err := m.TssList[len(m.TssList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetOutTxTrackerRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetOutTxTrackerRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetOutTxTrackerRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainID", wireType) - } - m.ChainID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ChainID |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) - } - m.Nonce = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Nonce |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetOutTxTrackerResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetOutTxTrackerResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetOutTxTrackerResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OutTxTracker", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.OutTxTracker.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllOutTxTrackerRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllOutTxTrackerRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllOutTxTrackerRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllOutTxTrackerResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllOutTxTrackerResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllOutTxTrackerResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OutTxTracker", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OutTxTracker = append(m.OutTxTracker, OutTxTracker{}) - if err := m.OutTxTracker[len(m.OutTxTracker)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllOutTxTrackerByChainRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllOutTxTrackerByChainRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllOutTxTrackerByChainRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Chain", wireType) - } - m.Chain = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Chain |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllOutTxTrackerByChainResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllOutTxTrackerByChainResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllOutTxTrackerByChainResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OutTxTracker", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OutTxTracker = append(m.OutTxTracker, OutTxTracker{}) - if err := m.OutTxTracker[len(m.OutTxTracker)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllInTxTrackerByChainRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllInTxTrackerByChainRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllInTxTrackerByChainRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - m.ChainId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ChainId |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllInTxTrackerByChainResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllInTxTrackerByChainResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllInTxTrackerByChainResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InTxTracker", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InTxTracker = append(m.InTxTracker, InTxTracker{}) - if err := m.InTxTracker[len(m.InTxTracker)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllInTxTrackersRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllInTxTrackersRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllInTxTrackersRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllInTxTrackersResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllInTxTrackersResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllInTxTrackersResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InTxTracker", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InTxTracker = append(m.InTxTracker, InTxTracker{}) - if err := m.InTxTracker[len(m.InTxTracker)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetInTxHashToCctxRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetInTxHashToCctxRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetInTxHashToCctxRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InTxHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InTxHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetInTxHashToCctxResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetInTxHashToCctxResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetInTxHashToCctxResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InTxHashToCctx", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.InTxHashToCctx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryInTxHashToCctxDataRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryInTxHashToCctxDataRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryInTxHashToCctxDataRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InTxHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InTxHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryInTxHashToCctxDataResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryInTxHashToCctxDataResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryInTxHashToCctxDataResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CrossChainTxs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CrossChainTxs = append(m.CrossChainTxs, CrossChainTx{}) - if err := m.CrossChainTxs[len(m.CrossChainTxs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllInTxHashToCctxRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllInTxHashToCctxRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllInTxHashToCctxRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllInTxHashToCctxResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllInTxHashToCctxResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllInTxHashToCctxResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InTxHashToCctx", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InTxHashToCctx = append(m.InTxHashToCctx, InTxHashToCctx{}) - if err := m.InTxHashToCctx[len(m.InTxHashToCctx)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetTssAddressRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetTssAddressRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetTssAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TssPubKey", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TssPubKey = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetTssAddressResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetTssAddressResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetTssAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Eth", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Eth = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Btc", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Btc = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetTSSRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetTSSRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetTSSRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetTSSResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetTSSResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetTSSResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TSS", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.TSS == nil { - m.TSS = &TSS{} - } - if err := m.TSS.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetGasPriceRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetGasPriceRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetGasPriceRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Index = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetGasPriceResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetGasPriceResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetGasPriceResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasPrice", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.GasPrice == nil { - m.GasPrice = &GasPrice{} - } - if err := m.GasPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllGasPriceRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllGasPriceRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllGasPriceRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllGasPriceResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllGasPriceResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllGasPriceResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasPrice", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.GasPrice = append(m.GasPrice, &GasPrice{}) - if err := m.GasPrice[len(m.GasPrice)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetChainNoncesRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetChainNoncesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetChainNoncesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Index = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetChainNoncesResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetChainNoncesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetChainNoncesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainNonces", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ChainNonces == nil { - m.ChainNonces = &ChainNonces{} - } - if err := m.ChainNonces.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllChainNoncesRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllChainNoncesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllChainNoncesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllChainNoncesResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllChainNoncesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllChainNoncesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainNonces", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChainNonces = append(m.ChainNonces, &ChainNonces{}) - if err := m.ChainNonces[len(m.ChainNonces)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllPendingNoncesRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllPendingNoncesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllPendingNoncesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllPendingNoncesResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllPendingNoncesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllPendingNoncesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PendingNonces", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PendingNonces = append(m.PendingNonces, &PendingNonces{}) - if err := m.PendingNonces[len(m.PendingNonces)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryPendingNoncesByChainRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryPendingNoncesByChainRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPendingNoncesByChainRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - m.ChainId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ChainId |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryPendingNoncesByChainResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryPendingNoncesByChainResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPendingNoncesByChainResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PendingNonces", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.PendingNonces.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetLastBlockHeightRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetLastBlockHeightRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetLastBlockHeightRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Index = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetLastBlockHeightResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetLastBlockHeightResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetLastBlockHeightResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastBlockHeight", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.LastBlockHeight == nil { - m.LastBlockHeight = &LastBlockHeight{} - } - if err := m.LastBlockHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllLastBlockHeightRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllLastBlockHeightRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllLastBlockHeightRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllLastBlockHeightResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllLastBlockHeightResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllLastBlockHeightResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastBlockHeight", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LastBlockHeight = append(m.LastBlockHeight, &LastBlockHeight{}) - if err := m.LastBlockHeight[len(m.LastBlockHeight)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetCctxRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetCctxRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetCctxRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Index = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetCctxByNonceRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetCctxByNonceRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetCctxByNonceRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainID", wireType) - } - m.ChainID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ChainID |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) - } - m.Nonce = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Nonce |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryGetCctxResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryGetCctxResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetCctxResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CrossChainTx", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.CrossChainTx == nil { - m.CrossChainTx = &CrossChainTx{} - } - if err := m.CrossChainTx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryAllCctxRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllCctxRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllCctxRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } + l = len(m.OutboundGasInZeta) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) } - - if iNdEx > l { - return io.ErrUnexpectedEOF + l = len(m.ProtocolFeeInZeta) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) } - return nil + if m.ZetaBlockHeight != 0 { + n += 1 + sovQuery(uint64(m.ZetaBlockHeight)) + } + return n } -func (m *QueryAllCctxResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllCctxResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllCctxResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CrossChainTx", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CrossChainTx = append(m.CrossChainTx, &CrossChainTx{}) - if err := m.CrossChainTx[len(m.CrossChainTx)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } + +func (m *QueryMessagePassingProtocolFeeRequest) Size() (n int) { + if m == nil { + return 0 } + var l int + _ = l + return n +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *QueryMessagePassingProtocolFeeResponse) Size() (n int) { + if m == nil { + return 0 } - return nil + var l int + _ = l + l = len(m.FeeInZeta) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *QueryAllCctxPendingRequest) Unmarshal(dAtA []byte) error { +func (m *QueryZetaAccountingRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -12451,67 +5034,12 @@ func (m *QueryAllCctxPendingRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllCctxPendingRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryZetaAccountingRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllCctxPendingRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryZetaAccountingRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - m.ChainId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ChainId |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -12533,74 +5061,40 @@ func (m *QueryAllCctxPendingRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllCctxPendingResponse) Unmarshal(dAtA []byte) error { +func (m *QueryZetaAccountingResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryAllCctxPendingResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllCctxPendingResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CrossChainTx", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery } - if postIndex > l { + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.CrossChainTx = append(m.CrossChainTx, &CrossChainTx{}) - if err := m.CrossChainTx[len(m.CrossChainTx)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - iNdEx = postIndex - case 2: + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryZetaAccountingResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryZetaAccountingResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AbortedZetaAmount", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -12610,27 +5104,23 @@ func (m *QueryAllCctxPendingResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.AbortedZetaAmount = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -12653,7 +5143,7 @@ func (m *QueryAllCctxPendingResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryLastZetaHeightRequest) Unmarshal(dAtA []byte) error { +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -12676,10 +5166,10 @@ func (m *QueryLastZetaHeightRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryLastZetaHeightRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLastZetaHeightRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -12703,7 +5193,7 @@ func (m *QueryLastZetaHeightRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryLastZetaHeightResponse) Unmarshal(dAtA []byte) error { +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -12726,17 +5216,17 @@ func (m *QueryLastZetaHeightResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryLastZetaHeightResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLastZetaHeightResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } - m.Height = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -12746,11 +5236,25 @@ func (m *QueryLastZetaHeightResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= int64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -12772,7 +5276,7 @@ func (m *QueryLastZetaHeightResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryConvertGasToZetaRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetOutTxTrackerRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -12795,17 +5299,17 @@ func (m *QueryConvertGasToZetaRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConvertGasToZetaRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetOutTxTrackerRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConvertGasToZetaRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetOutTxTrackerRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChainID", wireType) } - m.ChainId = 0 + m.ChainID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -12815,16 +5319,16 @@ func (m *QueryConvertGasToZetaRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ChainId |= int64(b&0x7F) << shift + m.ChainID |= int64(b&0x7F) << shift if b < 0x80 { break } } case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) } - var stringLen uint64 + m.Nonce = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -12834,24 +5338,11 @@ func (m *QueryConvertGasToZetaRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.Nonce |= uint64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.GasLimit = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -12873,7 +5364,7 @@ func (m *QueryConvertGasToZetaRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryConvertGasToZetaResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetOutTxTrackerResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -12896,17 +5387,17 @@ func (m *QueryConvertGasToZetaResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConvertGasToZetaResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetOutTxTrackerResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConvertGasToZetaResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetOutTxTrackerResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OutboundGasInZeta", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OutTxTracker", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -12916,75 +5407,25 @@ func (m *QueryConvertGasToZetaResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.OutboundGasInZeta = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProtocolFeeInZeta", 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.OutTxTracker.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.ProtocolFeeInZeta = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ZetaBlockHeight", wireType) - } - m.ZetaBlockHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ZetaBlockHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -13006,7 +5447,7 @@ func (m *QueryConvertGasToZetaResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryMessagePassingProtocolFeeRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllOutTxTrackerRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -13029,12 +5470,48 @@ func (m *QueryMessagePassingProtocolFeeRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryMessagePassingProtocolFeeRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllOutTxTrackerRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryMessagePassingProtocolFeeRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllOutTxTrackerRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -13056,7 +5533,7 @@ func (m *QueryMessagePassingProtocolFeeRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryMessagePassingProtocolFeeResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllOutTxTrackerResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -13079,17 +5556,51 @@ func (m *QueryMessagePassingProtocolFeeResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryMessagePassingProtocolFeeResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllOutTxTrackerResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryMessagePassingProtocolFeeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllOutTxTrackerResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeeInZeta", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OutTxTracker", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OutTxTracker = append(m.OutTxTracker, OutTxTracker{}) + if err := m.OutTxTracker[len(m.OutTxTracker)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -13099,23 +5610,27 @@ func (m *QueryMessagePassingProtocolFeeResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.FeeInZeta = string(dAtA[iNdEx:postIndex]) + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -13138,7 +5653,7 @@ func (m *QueryMessagePassingProtocolFeeResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryZEVMGetTransactionReceiptRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllOutTxTrackerByChainRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -13161,17 +5676,36 @@ func (m *QueryZEVMGetTransactionReceiptRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryZEVMGetTransactionReceiptRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllOutTxTrackerByChainRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryZEVMGetTransactionReceiptRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllOutTxTrackerByChainRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Chain", wireType) + } + m.Chain = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Chain |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -13181,23 +5715,27 @@ func (m *QueryZEVMGetTransactionReceiptRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Hash = string(dAtA[iNdEx:postIndex]) + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -13220,7 +5758,7 @@ func (m *QueryZEVMGetTransactionReceiptRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryZEVMGetTransactionReceiptResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllOutTxTrackerByChainResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -13243,17 +5781,17 @@ func (m *QueryZEVMGetTransactionReceiptResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryZEVMGetTransactionReceiptResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllOutTxTrackerByChainResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryZEVMGetTransactionReceiptResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllOutTxTrackerByChainResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OutTxTracker", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -13263,29 +5801,31 @@ func (m *QueryZEVMGetTransactionReceiptResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.BlockHash = string(dAtA[iNdEx:postIndex]) + m.OutTxTracker = append(m.OutTxTracker, OutTxTracker{}) + if err := m.OutTxTracker[len(m.OutTxTracker)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -13295,61 +5835,83 @@ func (m *QueryZEVMGetTransactionReceiptResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.BlockNumber = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} } - 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 - } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + intStringLen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - m.ContractAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CumulativeGasUsed", wireType) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllInTxTrackerByChainRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery } - var stringLen uint64 + 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: QueryAllInTxTrackerByChainRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllInTxTrackerByChainRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + m.ChainId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -13359,29 +5921,16 @@ func (m *QueryZEVMGetTransactionReceiptResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ChainId |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CumulativeGasUsed = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -13391,29 +5940,83 @@ func (m *QueryZEVMGetTransactionReceiptResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.From = string(dAtA[iNdEx:postIndex]) + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 6: + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllInTxTrackerByChainResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllInTxTrackerByChainResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllInTxTrackerByChainResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasUsed", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InTxTracker", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -13423,29 +6026,31 @@ func (m *QueryZEVMGetTransactionReceiptResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.GasUsed = string(dAtA[iNdEx:postIndex]) + m.InTxTracker = append(m.InTxTracker, InTxTracker{}) + if err := m.InTxTracker[len(m.InTxTracker)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 7: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LogsBloom", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -13455,29 +6060,83 @@ func (m *QueryZEVMGetTransactionReceiptResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.LogsBloom = string(dAtA[iNdEx:postIndex]) + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 8: + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllInTxTrackersRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllInTxTrackersRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllInTxTrackersRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -13487,29 +6146,83 @@ func (m *QueryZEVMGetTransactionReceiptResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Status = string(dAtA[iNdEx:postIndex]) + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 9: + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllInTxTrackersResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllInTxTrackersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllInTxTrackersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field To", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InTxTracker", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -13519,29 +6232,31 @@ func (m *QueryZEVMGetTransactionReceiptResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.To = string(dAtA[iNdEx:postIndex]) + m.InTxTracker = append(m.InTxTracker, InTxTracker{}) + if err := m.InTxTracker[len(m.InTxTracker)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 10: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransactionHash", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -13551,27 +6266,81 @@ func (m *QueryZEVMGetTransactionReceiptResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.TransactionHash = string(dAtA[iNdEx:postIndex]) + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 11: + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetInTxHashToCctxRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetInTxHashToCctxRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetInTxHashToCctxRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransactionIndex", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InTxHash", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -13596,14 +6365,64 @@ func (m *QueryZEVMGetTransactionReceiptResponse) Unmarshal(dAtA []byte) error { if postIndex < 0 { return ErrInvalidLengthQuery } - if postIndex > l { + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InTxHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetInTxHashToCctxResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.TransactionIndex = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 12: + 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: QueryGetInTxHashToCctxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetInTxHashToCctxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Logs", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InTxHashToCctx", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -13630,8 +6449,7 @@ func (m *QueryZEVMGetTransactionReceiptResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Logs = append(m.Logs, &Log{}) - if err := m.Logs[len(m.Logs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.InTxHashToCctx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -13656,7 +6474,7 @@ func (m *QueryZEVMGetTransactionReceiptResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *Log) Unmarshal(dAtA []byte) error { +func (m *QueryInTxHashToCctxDataRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -13679,15 +6497,15 @@ func (m *Log) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Log: wiretype end group for non-group") + return fmt.Errorf("proto: QueryInTxHashToCctxDataRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Log: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryInTxHashToCctxDataRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InTxHash", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -13715,45 +6533,63 @@ func (m *Log) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Address = string(dAtA[iNdEx:postIndex]) + m.InTxHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Topics", 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 - } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - intStringLen := int(stringLen) - if intStringLen < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF } - if postIndex > l { + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryInTxHashToCctxDataResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.Topics = append(m.Topics, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 3: + 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: QueryInTxHashToCctxDataResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryInTxHashToCctxDataResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CrossChainTxs", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -13763,48 +6599,81 @@ func (m *Log) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Data = string(dAtA[iNdEx:postIndex]) + m.CrossChainTxs = append(m.CrossChainTxs, CrossChainTx{}) + if err := m.CrossChainTxs[len(m.CrossChainTxs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - m.BlockNumber = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BlockNumber |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery } - case 5: + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllInTxHashToCctxRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllInTxHashToCctxRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllInTxHashToCctxRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransactionHash", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -13814,48 +6683,83 @@ func (m *Log) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.TransactionHash = string(dAtA[iNdEx:postIndex]) + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TransactionIndex", wireType) + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - m.TransactionIndex = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TransactionIndex |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllInTxHashToCctxResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - case 7: + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllInTxHashToCctxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllInTxHashToCctxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field InTxHashToCctx", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -13865,29 +6769,31 @@ func (m *Log) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.BlockHash = string(dAtA[iNdEx:postIndex]) + m.InTxHashToCctx = append(m.InTxHashToCctx, InTxHashToCctx{}) + if err := m.InTxHashToCctx[len(m.InTxHashToCctx)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LogIndex", wireType) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - m.LogIndex = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -13897,31 +6803,28 @@ func (m *Log) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.LogIndex |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Removed", wireType) + if msglen < 0 { + return ErrInvalidLengthQuery } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.Removed = bool(v != 0) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -13943,7 +6846,7 @@ func (m *Log) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryZEVMGetTransactionRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetGasPriceRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -13966,15 +6869,15 @@ func (m *QueryZEVMGetTransactionRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryZEVMGetTransactionRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetGasPriceRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryZEVMGetTransactionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetGasPriceRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -14002,7 +6905,7 @@ func (m *QueryZEVMGetTransactionRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Hash = string(dAtA[iNdEx:postIndex]) + m.Index = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -14025,7 +6928,7 @@ func (m *QueryZEVMGetTransactionRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryZEVMGetTransactionResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetGasPriceResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -14048,49 +6951,17 @@ func (m *QueryZEVMGetTransactionResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryZEVMGetTransactionResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetGasPriceResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryZEVMGetTransactionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetGasPriceResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BlockHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GasPrice", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -14100,157 +6971,83 @@ func (m *QueryZEVMGetTransactionResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.BlockNumber = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field From", 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 m.GasPrice == nil { + m.GasPrice = &GasPrice{} } - if postIndex > l { - return io.ErrUnexpectedEOF + if err := m.GasPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.From = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Gas", 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 + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + intStringLen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - m.Gas = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasPrice", 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 + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllGasPriceRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery } - if postIndex > l { + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.GasPrice = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", 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 + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - m.Hash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllGasPriceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllGasPriceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Input", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -14260,61 +7057,83 @@ func (m *QueryZEVMGetTransactionResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Input = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} } - 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 - } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + intStringLen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - m.Nonce = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 9: + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllGasPriceResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllGasPriceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllGasPriceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field To", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GasPrice", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -14324,29 +7143,31 @@ func (m *QueryZEVMGetTransactionResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.To = string(dAtA[iNdEx:postIndex]) + m.GasPrice = append(m.GasPrice, &GasPrice{}) + if err := m.GasPrice[len(m.GasPrice)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 10: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransactionIndex", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -14356,59 +7177,81 @@ func (m *QueryZEVMGetTransactionResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.TransactionIndex = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} } - 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 - } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + intStringLen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 12: + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetLastBlockHeightRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetLastBlockHeightRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetLastBlockHeightRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -14436,45 +7279,63 @@ func (m *QueryZEVMGetTransactionResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Type = string(dAtA[iNdEx:postIndex]) + m.Index = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 13: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AccessList", 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 - } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - intStringLen := int(stringLen) - if intStringLen < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF } - if postIndex > l { + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetLastBlockHeightResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.AccessList = append(m.AccessList, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 14: + 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: QueryGetLastBlockHeightResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetLastBlockHeightResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LastBlockHeight", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -14484,29 +7345,83 @@ func (m *QueryZEVMGetTransactionResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainId = string(dAtA[iNdEx:postIndex]) + if m.LastBlockHeight == nil { + m.LastBlockHeight = &LastBlockHeight{} + } + if err := m.LastBlockHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 15: + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllLastBlockHeightRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllLastBlockHeightRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllLastBlockHeightRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field V", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -14516,29 +7431,83 @@ func (m *QueryZEVMGetTransactionResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.V = string(dAtA[iNdEx:postIndex]) + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 16: + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllLastBlockHeightResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllLastBlockHeightResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllLastBlockHeightResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field R", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LastBlockHeight", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -14548,29 +7517,31 @@ func (m *QueryZEVMGetTransactionResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.R = string(dAtA[iNdEx:postIndex]) + m.LastBlockHeight = append(m.LastBlockHeight, &LastBlockHeight{}) + if err := m.LastBlockHeight[len(m.LastBlockHeight)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 17: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field S", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -14580,23 +7551,27 @@ func (m *QueryZEVMGetTransactionResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.S = string(dAtA[iNdEx:postIndex]) + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -14619,7 +7594,7 @@ func (m *QueryZEVMGetTransactionResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryZEVMGetBlockByNumberRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetCctxRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -14642,17 +7617,17 @@ func (m *QueryZEVMGetBlockByNumberRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryZEVMGetBlockByNumberRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetCctxRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryZEVMGetBlockByNumberRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetCctxRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) } - m.Height = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -14662,11 +7637,24 @@ func (m *QueryZEVMGetBlockByNumberRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Index = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -14688,7 +7676,7 @@ func (m *QueryZEVMGetBlockByNumberRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryZEVMGetBlockByNumberResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetCctxByNonceRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -14711,81 +7699,17 @@ func (m *QueryZEVMGetBlockByNumberResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryZEVMGetBlockByNumberResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetCctxByNonceRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryZEVMGetBlockByNumberResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetCctxByNonceRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Number", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Number = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Hash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ParentHash", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainID", wireType) } - var stringLen uint64 + m.ChainID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -14795,29 +7719,16 @@ func (m *QueryZEVMGetBlockByNumberResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ChainID |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ParentHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { + case 2: + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) } - var stringLen uint64 + m.Nonce = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -14827,29 +7738,66 @@ func (m *QueryZEVMGetBlockByNumberResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.Nonce |= uint64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + intStringLen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - m.Nonce = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetCctxResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetCctxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetCctxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sha3Uncles", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CrossChainTx", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -14859,61 +7807,83 @@ func (m *QueryZEVMGetBlockByNumberResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Sha3Uncles = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LogsBloom", wireType) + if m.CrossChainTx == nil { + m.CrossChainTx = &CrossChainTx{} } - 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 - } + if err := m.CrossChainTx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + intStringLen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - m.LogsBloom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllCctxRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllCctxRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllCctxRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransactionsRoot", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -14923,61 +7893,83 @@ func (m *QueryZEVMGetBlockByNumberResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.TransactionsRoot = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StateRoot", wireType) + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} } - 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 - } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + intStringLen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - m.StateRoot = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 9: + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllCctxResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllCctxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllCctxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ReceiptsRoot", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CrossChainTx", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -14987,29 +7979,31 @@ func (m *QueryZEVMGetBlockByNumberResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.ReceiptsRoot = string(dAtA[iNdEx:postIndex]) + m.CrossChainTx = append(m.CrossChainTx, &CrossChainTx{}) + if err := m.CrossChainTx[len(m.CrossChainTx)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 10: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Miner", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -15019,29 +8013,83 @@ func (m *QueryZEVMGetBlockByNumberResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Miner = string(dAtA[iNdEx:postIndex]) + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Difficulty", wireType) + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - var stringLen uint64 + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryListCctxPendingRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryListCctxPendingRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryListCctxPendingRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + m.ChainId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -15051,29 +8099,16 @@ func (m *QueryZEVMGetBlockByNumberResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ChainId |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Difficulty = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalDifficulty", wireType) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) } - var stringLen uint64 + m.Limit = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -15083,29 +8118,66 @@ func (m *QueryZEVMGetBlockByNumberResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.Limit |= uint32(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + intStringLen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - m.TotalDifficulty = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 13: + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryListCctxPendingResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryListCctxPendingResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryListCctxPendingResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExtraData", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CrossChainTx", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -15115,29 +8187,31 @@ func (m *QueryZEVMGetBlockByNumberResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.ExtraData = string(dAtA[iNdEx:postIndex]) + m.CrossChainTx = append(m.CrossChainTx, &CrossChainTx{}) + if err := m.CrossChainTx[len(m.CrossChainTx)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 14: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Size_", wireType) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalPending", wireType) } - var stringLen uint64 + m.TotalPending = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -15147,29 +8221,116 @@ func (m *QueryZEVMGetBlockByNumberResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.TotalPending |= uint64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen - if postIndex < 0 { + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryLastZetaHeightRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryLastZetaHeightRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLastZetaHeightRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - m.Size_ = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 15: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryLastZetaHeightResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryLastZetaHeightResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLastZetaHeightResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) } - var stringLen uint64 + m.Height = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -15179,29 +8340,66 @@ func (m *QueryZEVMGetBlockByNumberResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + intStringLen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - m.GasLimit = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 16: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasUsed", wireType) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryConvertGasToZetaRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery } - var stringLen uint64 + 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: QueryConvertGasToZetaRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConvertGasToZetaRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + m.ChainId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -15211,27 +8409,14 @@ func (m *QueryZEVMGetBlockByNumberResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ChainId |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.GasUsed = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 17: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -15259,11 +8444,61 @@ func (m *QueryZEVMGetBlockByNumberResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Timestamp = string(dAtA[iNdEx:postIndex]) + m.GasLimit = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 18: + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryConvertGasToZetaResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryConvertGasToZetaResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConvertGasToZetaResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Transactions", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OutboundGasInZeta", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -15291,11 +8526,11 @@ func (m *QueryZEVMGetBlockByNumberResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Transactions = append(m.Transactions, string(dAtA[iNdEx:postIndex])) + m.OutboundGasInZeta = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 19: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Uncles", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ProtocolFeeInZeta", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -15323,13 +8558,13 @@ func (m *QueryZEVMGetBlockByNumberResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Uncles = append(m.Uncles, string(dAtA[iNdEx:postIndex])) + m.ProtocolFeeInZeta = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 20: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseFeePerGas", wireType) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ZetaBlockHeight", wireType) } - var stringLen uint64 + m.ZetaBlockHeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -15339,27 +8574,114 @@ func (m *QueryZEVMGetBlockByNumberResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ZetaBlockHeight |= uint64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen - if postIndex < 0 { + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryMessagePassingProtocolFeeRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryMessagePassingProtocolFeeRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryMessagePassingProtocolFeeRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - m.BaseFeePerGas = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 21: + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryMessagePassingProtocolFeeResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryMessagePassingProtocolFeeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryMessagePassingProtocolFeeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MixHash", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FeeInZeta", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -15387,7 +8709,7 @@ func (m *QueryZEVMGetBlockByNumberResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.MixHash = string(dAtA[iNdEx:postIndex]) + m.FeeInZeta = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/crosschain/types/query.pb.gw.go b/x/crosschain/types/query.pb.gw.go index b4a9373a3a..3e7f8b97c6 100644 --- a/x/crosschain/types/query.pb.gw.go +++ b/x/crosschain/types/query.pb.gw.go @@ -307,10 +307,21 @@ func local_request_Query_InTxTrackerAllByChain_0(ctx context.Context, marshaler } +var ( + filter_Query_InTxTrackerAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + func request_Query_InTxTrackerAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryAllInTxTrackersRequest var metadata runtime.ServerMetadata + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_InTxTrackerAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.InTxTrackerAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -320,6 +331,13 @@ func local_request_Query_InTxTrackerAll_0(ctx context.Context, marshaler runtime var protoReq QueryAllInTxTrackersRequest var metadata runtime.ServerMetadata + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_InTxTrackerAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.InTxTrackerAll(ctx, &protoReq) return msg, metadata, err @@ -469,60 +487,6 @@ func local_request_Query_InTxHashToCctxAll_0(ctx context.Context, marshaler runt } -var ( - filter_Query_GetTssAddress_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_GetTssAddress_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetTssAddressRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetTssAddress_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.GetTssAddress(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_GetTssAddress_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetTssAddressRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetTssAddress_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.GetTssAddress(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_TSS_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetTSSRequest - var metadata runtime.ServerMetadata - - msg, err := client.TSS(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_TSS_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetTSSRequest - var metadata runtime.ServerMetadata - - msg, err := server.TSS(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_GasPrice_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryGetGasPriceRequest var metadata runtime.ServerMetadata @@ -667,168 +631,6 @@ func local_request_Query_ProtocolFee_0(ctx context.Context, marshaler runtime.Ma } -func request_Query_ChainNonces_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetChainNoncesRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["index"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index") - } - - protoReq.Index, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err) - } - - msg, err := client.ChainNonces(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ChainNonces_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryGetChainNoncesRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["index"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index") - } - - protoReq.Index, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err) - } - - msg, err := server.ChainNonces(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_ChainNoncesAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_ChainNoncesAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllChainNoncesRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ChainNoncesAll_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.ChainNoncesAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ChainNoncesAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllChainNoncesRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ChainNoncesAll_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.ChainNoncesAll(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_PendingNoncesAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllPendingNoncesRequest - var metadata runtime.ServerMetadata - - msg, err := client.PendingNoncesAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_PendingNoncesAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllPendingNoncesRequest - var metadata runtime.ServerMetadata - - msg, err := server.PendingNoncesAll(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_PendingNoncesByChain_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryPendingNoncesByChainRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["chain_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") - } - - protoReq.ChainId, err = runtime.Int64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) - } - - msg, err := client.PendingNoncesByChain(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_PendingNoncesByChain_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryPendingNoncesByChainRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["chain_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") - } - - protoReq.ChainId, err = runtime.Int64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) - } - - msg, err := server.PendingNoncesByChain(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_LastBlockHeight_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryGetLastBlockHeightRequest var metadata runtime.ServerMetadata @@ -1086,282 +888,84 @@ func local_request_Query_CctxAll_0(ctx context.Context, marshaler runtime.Marsha } var ( - filter_Query_CctxAllPending_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Query_CctxListPending_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Query_CctxAllPending_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllCctxPendingRequest +func request_Query_CctxListPending_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryListCctxPendingRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_CctxAllPending_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_CctxListPending_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.CctxAllPending(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.CctxListPending(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_CctxAllPending_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAllCctxPendingRequest +func local_request_Query_CctxListPending_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryListCctxPendingRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_CctxAllPending_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_CctxListPending_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.CctxAllPending(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_LastZetaHeight_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryLastZetaHeightRequest - var metadata runtime.ServerMetadata - - msg, err := client.LastZetaHeight(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := server.CctxListPending(ctx, &protoReq) return msg, metadata, err } -func local_request_Query_LastZetaHeight_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryLastZetaHeightRequest +func request_Query_ZetaAccounting_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryZetaAccountingRequest var metadata runtime.ServerMetadata - msg, err := server.LastZetaHeight(ctx, &protoReq) + msg, err := client.ZetaAccounting(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func request_Query_TssHistory_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryTssHistoryRequest +func local_request_Query_ZetaAccounting_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryZetaAccountingRequest var metadata runtime.ServerMetadata - msg, err := client.TssHistory(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_TssHistory_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryTssHistoryRequest - var metadata runtime.ServerMetadata - - msg, err := server.TssHistory(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_CctxByStatus_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryCctxByStatusRequest - var metadata runtime.ServerMetadata - - var ( - val string - e int32 - ok bool - err error - _ = err - ) - - val, ok = pathParams["status"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status") - } - - e, err = runtime.Enum(val, CctxStatus_value) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status", err) - } - - protoReq.Status = CctxStatus(e) - - msg, err := client.CctxByStatus(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_CctxByStatus_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryCctxByStatusRequest - var metadata runtime.ServerMetadata - - var ( - val string - e int32 - ok bool - err error - _ = err - ) - - val, ok = pathParams["status"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status") - } - - e, err = runtime.Enum(val, CctxStatus_value) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status", err) - } - - protoReq.Status = CctxStatus(e) - - msg, err := server.CctxByStatus(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". -// UnaryRPC :call QueryServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. -func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_OutTxTracker_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_OutTxTracker_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_OutTxTracker_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_OutTxTrackerAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_OutTxTrackerAll_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_OutTxTrackerAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_OutTxTrackerAllByChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_OutTxTrackerAllByChain_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_OutTxTrackerAllByChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_InTxTrackerAllByChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_InTxTrackerAllByChain_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_InTxTrackerAllByChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_InTxTrackerAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_InTxTrackerAll_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } + msg, err := server.ZetaAccounting(ctx, &protoReq) + return msg, metadata, err - forward_Query_InTxTrackerAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) +} - }) +func request_Query_LastZetaHeight_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryLastZetaHeightRequest + var metadata runtime.ServerMetadata - mux.Handle("GET", pattern_Query_InTxHashToCctx_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + msg, err := client.LastZetaHeight(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_LastZetaHeight_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryLastZetaHeightRequest + var metadata runtime.ServerMetadata + + msg, err := server.LastZetaHeight(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1372,7 +976,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_InTxHashToCctx_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_Params_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 { @@ -1380,11 +984,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_InTxHashToCctx_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_InTxHashToCctxData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_OutTxTracker_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1395,7 +999,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_InTxHashToCctxData_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_OutTxTracker_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 { @@ -1403,11 +1007,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_InTxHashToCctxData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_OutTxTracker_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_InTxHashToCctxAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_OutTxTrackerAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1418,7 +1022,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_InTxHashToCctxAll_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_OutTxTrackerAll_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 { @@ -1426,11 +1030,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_InTxHashToCctxAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_OutTxTrackerAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_GetTssAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_OutTxTrackerAllByChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1441,7 +1045,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_GetTssAddress_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_OutTxTrackerAllByChain_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 { @@ -1449,11 +1053,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_GetTssAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_OutTxTrackerAllByChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_TSS_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_InTxTrackerAllByChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1464,7 +1068,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_TSS_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_InTxTrackerAllByChain_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 { @@ -1472,11 +1076,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_TSS_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_InTxTrackerAllByChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_GasPrice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_InTxTrackerAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1487,7 +1091,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_GasPrice_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_InTxTrackerAll_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 { @@ -1495,11 +1099,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_GasPrice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_InTxTrackerAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_GasPriceAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_InTxHashToCctx_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1510,7 +1114,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_GasPriceAll_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_InTxHashToCctx_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 { @@ -1518,11 +1122,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_GasPriceAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_InTxHashToCctx_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ConvertGasToZeta_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_InTxHashToCctxData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1533,7 +1137,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_ConvertGasToZeta_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_InTxHashToCctxData_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 { @@ -1541,11 +1145,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_ConvertGasToZeta_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_InTxHashToCctxData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ProtocolFee_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_InTxHashToCctxAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1556,7 +1160,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_ProtocolFee_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_InTxHashToCctxAll_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 { @@ -1564,11 +1168,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_ProtocolFee_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_InTxHashToCctxAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ChainNonces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GasPrice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1579,7 +1183,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_ChainNonces_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_GasPrice_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 { @@ -1587,11 +1191,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_ChainNonces_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GasPrice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ChainNoncesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GasPriceAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1602,7 +1206,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_ChainNoncesAll_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_GasPriceAll_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 { @@ -1610,11 +1214,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_ChainNoncesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GasPriceAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_PendingNoncesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ConvertGasToZeta_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1625,7 +1229,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_PendingNoncesAll_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_ConvertGasToZeta_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 { @@ -1633,11 +1237,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_PendingNoncesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ConvertGasToZeta_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_PendingNoncesByChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ProtocolFee_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1648,7 +1252,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_PendingNoncesByChain_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_ProtocolFee_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 { @@ -1656,7 +1260,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_PendingNoncesByChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ProtocolFee_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1775,30 +1379,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_CctxAllPending_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_CctxAllPending_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_CctxAllPending_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_LastZetaHeight_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_CctxListPending_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1809,7 +1390,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_LastZetaHeight_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_CctxListPending_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 { @@ -1817,11 +1398,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_LastZetaHeight_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_CctxListPending_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_TssHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ZetaAccounting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1832,7 +1413,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_TssHistory_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_ZetaAccounting_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 { @@ -1840,11 +1421,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_TssHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ZetaAccounting_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_CctxByStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_LastZetaHeight_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1855,7 +1436,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_CctxByStatus_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_LastZetaHeight_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 { @@ -1863,7 +1444,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_CctxByStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_LastZetaHeight_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -2088,46 +1669,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_GetTssAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_GetTssAddress_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_GetTssAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_TSS_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_TSS_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_TSS_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_GasPrice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -2208,86 +1749,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_ChainNonces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_ChainNonces_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_ChainNonces_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ChainNoncesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_ChainNoncesAll_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_ChainNoncesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_PendingNoncesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_PendingNoncesAll_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_PendingNoncesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_PendingNoncesByChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_PendingNoncesByChain_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_PendingNoncesByChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_LastBlockHeight_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -2388,27 +1849,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_CctxAllPending_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_CctxAllPending_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_CctxAllPending_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_LastZetaHeight_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_CctxListPending_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) @@ -2417,18 +1858,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_LastZetaHeight_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_CctxListPending_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_LastZetaHeight_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_CctxListPending_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_TssHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ZetaAccounting_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) @@ -2437,18 +1878,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_TssHistory_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_ZetaAccounting_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_TssHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ZetaAccounting_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_CctxByStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_LastZetaHeight_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) @@ -2457,14 +1898,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_CctxByStatus_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_LastZetaHeight_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_CctxByStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_LastZetaHeight_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -2490,10 +1931,6 @@ var ( pattern_Query_InTxHashToCctxAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "inTxHashToCctx"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_GetTssAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "get_tss_address"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_TSS_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "TSS"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_GasPrice_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "crosschain", "gasPrice", "index"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_GasPriceAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "gasPrice"}, "", runtime.AssumeColonVerbOpt(false))) @@ -2502,14 +1939,6 @@ var ( pattern_Query_ProtocolFee_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "protocolFee"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_ChainNonces_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "crosschain", "chainNonces", "index"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_ChainNoncesAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "chainNonces"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_PendingNoncesAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "pendingNonces"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_PendingNoncesByChain_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "crosschain", "pendingNonces", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_LastBlockHeight_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "crosschain", "lastBlockHeight", "index"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_LastBlockHeightAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "lastBlockHeight"}, "", runtime.AssumeColonVerbOpt(false))) @@ -2520,13 +1949,11 @@ var ( pattern_Query_CctxAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "cctx"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_CctxAllPending_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "cctxPending"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_CctxListPending_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "cctxPending"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_LastZetaHeight_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "lastZetaHeight"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_TssHistory_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "tssHistory"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_ZetaAccounting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "zetaAccounting"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_CctxByStatus_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "crosschain", "cctxbyStatus", "status"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_LastZetaHeight_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "lastZetaHeight"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -2548,10 +1975,6 @@ var ( forward_Query_InTxHashToCctxAll_0 = runtime.ForwardResponseMessage - forward_Query_GetTssAddress_0 = runtime.ForwardResponseMessage - - forward_Query_TSS_0 = runtime.ForwardResponseMessage - forward_Query_GasPrice_0 = runtime.ForwardResponseMessage forward_Query_GasPriceAll_0 = runtime.ForwardResponseMessage @@ -2560,14 +1983,6 @@ var ( forward_Query_ProtocolFee_0 = runtime.ForwardResponseMessage - forward_Query_ChainNonces_0 = runtime.ForwardResponseMessage - - forward_Query_ChainNoncesAll_0 = runtime.ForwardResponseMessage - - forward_Query_PendingNoncesAll_0 = runtime.ForwardResponseMessage - - forward_Query_PendingNoncesByChain_0 = runtime.ForwardResponseMessage - forward_Query_LastBlockHeight_0 = runtime.ForwardResponseMessage forward_Query_LastBlockHeightAll_0 = runtime.ForwardResponseMessage @@ -2578,11 +1993,9 @@ var ( forward_Query_CctxAll_0 = runtime.ForwardResponseMessage - forward_Query_CctxAllPending_0 = runtime.ForwardResponseMessage - - forward_Query_LastZetaHeight_0 = runtime.ForwardResponseMessage + forward_Query_CctxListPending_0 = runtime.ForwardResponseMessage - forward_Query_TssHistory_0 = runtime.ForwardResponseMessage + forward_Query_ZetaAccounting_0 = runtime.ForwardResponseMessage - forward_Query_CctxByStatus_0 = runtime.ForwardResponseMessage + forward_Query_LastZetaHeight_0 = runtime.ForwardResponseMessage ) diff --git a/x/crosschain/types/tx.pb.go b/x/crosschain/types/tx.pb.go index 0e789fcb04..6745107685 100644 --- a/x/crosschain/types/tx.pb.go +++ b/x/crosschain/types/tx.pb.go @@ -31,6 +31,110 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type MsgCreateTSSVoter struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + TssPubkey string `protobuf:"bytes,2,opt,name=tss_pubkey,json=tssPubkey,proto3" json:"tss_pubkey,omitempty"` + KeyGenZetaHeight int64 `protobuf:"varint,3,opt,name=keyGenZetaHeight,proto3" json:"keyGenZetaHeight,omitempty"` + Status common.ReceiveStatus `protobuf:"varint,4,opt,name=status,proto3,enum=common.ReceiveStatus" json:"status,omitempty"` +} + +func (m *MsgCreateTSSVoter) Reset() { *m = MsgCreateTSSVoter{} } +func (m *MsgCreateTSSVoter) String() string { return proto.CompactTextString(m) } +func (*MsgCreateTSSVoter) ProtoMessage() {} +func (*MsgCreateTSSVoter) Descriptor() ([]byte, []int) { + return fileDescriptor_81d6d611190b7635, []int{0} +} +func (m *MsgCreateTSSVoter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateTSSVoter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateTSSVoter.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 *MsgCreateTSSVoter) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateTSSVoter.Merge(m, src) +} +func (m *MsgCreateTSSVoter) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateTSSVoter) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateTSSVoter.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateTSSVoter proto.InternalMessageInfo + +func (m *MsgCreateTSSVoter) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgCreateTSSVoter) GetTssPubkey() string { + if m != nil { + return m.TssPubkey + } + return "" +} + +func (m *MsgCreateTSSVoter) GetKeyGenZetaHeight() int64 { + if m != nil { + return m.KeyGenZetaHeight + } + return 0 +} + +func (m *MsgCreateTSSVoter) GetStatus() common.ReceiveStatus { + if m != nil { + return m.Status + } + return common.ReceiveStatus_Created +} + +type MsgCreateTSSVoterResponse struct { +} + +func (m *MsgCreateTSSVoterResponse) Reset() { *m = MsgCreateTSSVoterResponse{} } +func (m *MsgCreateTSSVoterResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateTSSVoterResponse) ProtoMessage() {} +func (*MsgCreateTSSVoterResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_81d6d611190b7635, []int{1} +} +func (m *MsgCreateTSSVoterResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateTSSVoterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateTSSVoterResponse.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 *MsgCreateTSSVoterResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateTSSVoterResponse.Merge(m, src) +} +func (m *MsgCreateTSSVoterResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateTSSVoterResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateTSSVoterResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateTSSVoterResponse proto.InternalMessageInfo + type MsgMigrateTssFunds struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` @@ -41,7 +145,7 @@ func (m *MsgMigrateTssFunds) Reset() { *m = MsgMigrateTssFunds{} } func (m *MsgMigrateTssFunds) String() string { return proto.CompactTextString(m) } func (*MsgMigrateTssFunds) ProtoMessage() {} func (*MsgMigrateTssFunds) Descriptor() ([]byte, []int) { - return fileDescriptor_81d6d611190b7635, []int{0} + return fileDescriptor_81d6d611190b7635, []int{2} } func (m *MsgMigrateTssFunds) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -91,7 +195,7 @@ func (m *MsgMigrateTssFundsResponse) Reset() { *m = MsgMigrateTssFundsRe func (m *MsgMigrateTssFundsResponse) String() string { return proto.CompactTextString(m) } func (*MsgMigrateTssFundsResponse) ProtoMessage() {} func (*MsgMigrateTssFundsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_81d6d611190b7635, []int{1} + return fileDescriptor_81d6d611190b7635, []int{3} } func (m *MsgMigrateTssFundsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -120,6 +224,94 @@ func (m *MsgMigrateTssFundsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgMigrateTssFundsResponse proto.InternalMessageInfo +type MsgUpdateTssAddress struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + TssPubkey string `protobuf:"bytes,2,opt,name=tss_pubkey,json=tssPubkey,proto3" json:"tss_pubkey,omitempty"` +} + +func (m *MsgUpdateTssAddress) Reset() { *m = MsgUpdateTssAddress{} } +func (m *MsgUpdateTssAddress) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateTssAddress) ProtoMessage() {} +func (*MsgUpdateTssAddress) Descriptor() ([]byte, []int) { + return fileDescriptor_81d6d611190b7635, []int{4} +} +func (m *MsgUpdateTssAddress) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateTssAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateTssAddress.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 *MsgUpdateTssAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateTssAddress.Merge(m, src) +} +func (m *MsgUpdateTssAddress) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateTssAddress) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateTssAddress.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateTssAddress proto.InternalMessageInfo + +func (m *MsgUpdateTssAddress) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgUpdateTssAddress) GetTssPubkey() string { + if m != nil { + return m.TssPubkey + } + return "" +} + +type MsgUpdateTssAddressResponse struct { +} + +func (m *MsgUpdateTssAddressResponse) Reset() { *m = MsgUpdateTssAddressResponse{} } +func (m *MsgUpdateTssAddressResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateTssAddressResponse) ProtoMessage() {} +func (*MsgUpdateTssAddressResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_81d6d611190b7635, []int{5} +} +func (m *MsgUpdateTssAddressResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateTssAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateTssAddressResponse.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 *MsgUpdateTssAddressResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateTssAddressResponse.Merge(m, src) +} +func (m *MsgUpdateTssAddressResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateTssAddressResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateTssAddressResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateTssAddressResponse proto.InternalMessageInfo + type MsgAddToInTxTracker struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` @@ -134,7 +326,7 @@ func (m *MsgAddToInTxTracker) Reset() { *m = MsgAddToInTxTracker{} } func (m *MsgAddToInTxTracker) String() string { return proto.CompactTextString(m) } func (*MsgAddToInTxTracker) ProtoMessage() {} func (*MsgAddToInTxTracker) Descriptor() ([]byte, []int) { - return fileDescriptor_81d6d611190b7635, []int{2} + return fileDescriptor_81d6d611190b7635, []int{6} } func (m *MsgAddToInTxTracker) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -219,7 +411,7 @@ func (m *MsgAddToInTxTrackerResponse) Reset() { *m = MsgAddToInTxTracker func (m *MsgAddToInTxTrackerResponse) String() string { return proto.CompactTextString(m) } func (*MsgAddToInTxTrackerResponse) ProtoMessage() {} func (*MsgAddToInTxTrackerResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_81d6d611190b7635, []int{3} + return fileDescriptor_81d6d611190b7635, []int{7} } func (m *MsgAddToInTxTrackerResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -248,94 +440,6 @@ func (m *MsgAddToInTxTrackerResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgAddToInTxTrackerResponse proto.InternalMessageInfo -type MsgUpdateTssAddress struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - TssPubkey string `protobuf:"bytes,2,opt,name=tss_pubkey,json=tssPubkey,proto3" json:"tss_pubkey,omitempty"` -} - -func (m *MsgUpdateTssAddress) Reset() { *m = MsgUpdateTssAddress{} } -func (m *MsgUpdateTssAddress) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateTssAddress) ProtoMessage() {} -func (*MsgUpdateTssAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_81d6d611190b7635, []int{4} -} -func (m *MsgUpdateTssAddress) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateTssAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateTssAddress.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 *MsgUpdateTssAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateTssAddress.Merge(m, src) -} -func (m *MsgUpdateTssAddress) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateTssAddress) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateTssAddress.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateTssAddress proto.InternalMessageInfo - -func (m *MsgUpdateTssAddress) GetCreator() string { - if m != nil { - return m.Creator - } - return "" -} - -func (m *MsgUpdateTssAddress) GetTssPubkey() string { - if m != nil { - return m.TssPubkey - } - return "" -} - -type MsgUpdateTssAddressResponse struct { -} - -func (m *MsgUpdateTssAddressResponse) Reset() { *m = MsgUpdateTssAddressResponse{} } -func (m *MsgUpdateTssAddressResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateTssAddressResponse) ProtoMessage() {} -func (*MsgUpdateTssAddressResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_81d6d611190b7635, []int{5} -} -func (m *MsgUpdateTssAddressResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateTssAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateTssAddressResponse.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 *MsgUpdateTssAddressResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateTssAddressResponse.Merge(m, src) -} -func (m *MsgUpdateTssAddressResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateTssAddressResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateTssAddressResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateTssAddressResponse proto.InternalMessageInfo - type MsgWhitelistERC20 struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` Erc20Address string `protobuf:"bytes,2,opt,name=erc20_address,json=erc20Address,proto3" json:"erc20_address,omitempty"` @@ -350,7 +454,7 @@ func (m *MsgWhitelistERC20) Reset() { *m = MsgWhitelistERC20{} } func (m *MsgWhitelistERC20) String() string { return proto.CompactTextString(m) } func (*MsgWhitelistERC20) ProtoMessage() {} func (*MsgWhitelistERC20) Descriptor() ([]byte, []int) { - return fileDescriptor_81d6d611190b7635, []int{6} + return fileDescriptor_81d6d611190b7635, []int{8} } func (m *MsgWhitelistERC20) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -437,7 +541,7 @@ func (m *MsgWhitelistERC20Response) Reset() { *m = MsgWhitelistERC20Resp func (m *MsgWhitelistERC20Response) String() string { return proto.CompactTextString(m) } func (*MsgWhitelistERC20Response) ProtoMessage() {} func (*MsgWhitelistERC20Response) Descriptor() ([]byte, []int) { - return fileDescriptor_81d6d611190b7635, []int{7} + return fileDescriptor_81d6d611190b7635, []int{9} } func (m *MsgWhitelistERC20Response) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -494,7 +598,7 @@ func (m *MsgAddToOutTxTracker) Reset() { *m = MsgAddToOutTxTracker{} } func (m *MsgAddToOutTxTracker) String() string { return proto.CompactTextString(m) } func (*MsgAddToOutTxTracker) ProtoMessage() {} func (*MsgAddToOutTxTracker) Descriptor() ([]byte, []int) { - return fileDescriptor_81d6d611190b7635, []int{8} + return fileDescriptor_81d6d611190b7635, []int{10} } func (m *MsgAddToOutTxTracker) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -580,7 +684,7 @@ func (m *MsgAddToOutTxTrackerResponse) Reset() { *m = MsgAddToOutTxTrack func (m *MsgAddToOutTxTrackerResponse) String() string { return proto.CompactTextString(m) } func (*MsgAddToOutTxTrackerResponse) ProtoMessage() {} func (*MsgAddToOutTxTrackerResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_81d6d611190b7635, []int{9} + return fileDescriptor_81d6d611190b7635, []int{11} } func (m *MsgAddToOutTxTrackerResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -597,140 +701,43 @@ func (m *MsgAddToOutTxTrackerResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *MsgAddToOutTxTrackerResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAddToOutTxTrackerResponse.Merge(m, src) -} -func (m *MsgAddToOutTxTrackerResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgAddToOutTxTrackerResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAddToOutTxTrackerResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgAddToOutTxTrackerResponse proto.InternalMessageInfo - -func (m *MsgAddToOutTxTrackerResponse) GetIsRemoved() bool { - if m != nil { - return m.IsRemoved - } - return false -} - -type MsgRemoveFromOutTxTracker struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - Nonce uint64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"` -} - -func (m *MsgRemoveFromOutTxTracker) Reset() { *m = MsgRemoveFromOutTxTracker{} } -func (m *MsgRemoveFromOutTxTracker) String() string { return proto.CompactTextString(m) } -func (*MsgRemoveFromOutTxTracker) ProtoMessage() {} -func (*MsgRemoveFromOutTxTracker) Descriptor() ([]byte, []int) { - return fileDescriptor_81d6d611190b7635, []int{10} -} -func (m *MsgRemoveFromOutTxTracker) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRemoveFromOutTxTracker) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRemoveFromOutTxTracker.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 *MsgRemoveFromOutTxTracker) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRemoveFromOutTxTracker.Merge(m, src) -} -func (m *MsgRemoveFromOutTxTracker) XXX_Size() int { - return m.Size() -} -func (m *MsgRemoveFromOutTxTracker) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRemoveFromOutTxTracker.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRemoveFromOutTxTracker proto.InternalMessageInfo - -func (m *MsgRemoveFromOutTxTracker) GetCreator() string { - if m != nil { - return m.Creator - } - return "" -} - -func (m *MsgRemoveFromOutTxTracker) GetChainId() int64 { - if m != nil { - return m.ChainId - } - return 0 -} - -func (m *MsgRemoveFromOutTxTracker) GetNonce() uint64 { - if m != nil { - return m.Nonce - } - return 0 -} - -type MsgRemoveFromOutTxTrackerResponse struct { -} - -func (m *MsgRemoveFromOutTxTrackerResponse) Reset() { *m = MsgRemoveFromOutTxTrackerResponse{} } -func (m *MsgRemoveFromOutTxTrackerResponse) String() string { return proto.CompactTextString(m) } -func (*MsgRemoveFromOutTxTrackerResponse) ProtoMessage() {} -func (*MsgRemoveFromOutTxTrackerResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_81d6d611190b7635, []int{11} -} -func (m *MsgRemoveFromOutTxTrackerResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRemoveFromOutTxTrackerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRemoveFromOutTxTrackerResponse.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 *MsgRemoveFromOutTxTrackerResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRemoveFromOutTxTrackerResponse.Merge(m, src) +func (m *MsgAddToOutTxTrackerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddToOutTxTrackerResponse.Merge(m, src) } -func (m *MsgRemoveFromOutTxTrackerResponse) XXX_Size() int { +func (m *MsgAddToOutTxTrackerResponse) XXX_Size() int { return m.Size() } -func (m *MsgRemoveFromOutTxTrackerResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRemoveFromOutTxTrackerResponse.DiscardUnknown(m) +func (m *MsgAddToOutTxTrackerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddToOutTxTrackerResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgRemoveFromOutTxTrackerResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgAddToOutTxTrackerResponse proto.InternalMessageInfo -type MsgCreateTSSVoter struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - TssPubkey string `protobuf:"bytes,2,opt,name=tss_pubkey,json=tssPubkey,proto3" json:"tss_pubkey,omitempty"` - KeyGenZetaHeight int64 `protobuf:"varint,3,opt,name=keyGenZetaHeight,proto3" json:"keyGenZetaHeight,omitempty"` - Status common.ReceiveStatus `protobuf:"varint,4,opt,name=status,proto3,enum=common.ReceiveStatus" json:"status,omitempty"` +func (m *MsgAddToOutTxTrackerResponse) GetIsRemoved() bool { + if m != nil { + return m.IsRemoved + } + return false } -func (m *MsgCreateTSSVoter) Reset() { *m = MsgCreateTSSVoter{} } -func (m *MsgCreateTSSVoter) String() string { return proto.CompactTextString(m) } -func (*MsgCreateTSSVoter) ProtoMessage() {} -func (*MsgCreateTSSVoter) Descriptor() ([]byte, []int) { +type MsgRemoveFromOutTxTracker struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + Nonce uint64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"` +} + +func (m *MsgRemoveFromOutTxTracker) Reset() { *m = MsgRemoveFromOutTxTracker{} } +func (m *MsgRemoveFromOutTxTracker) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveFromOutTxTracker) ProtoMessage() {} +func (*MsgRemoveFromOutTxTracker) Descriptor() ([]byte, []int) { return fileDescriptor_81d6d611190b7635, []int{12} } -func (m *MsgCreateTSSVoter) XXX_Unmarshal(b []byte) error { +func (m *MsgRemoveFromOutTxTracker) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgCreateTSSVoter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgRemoveFromOutTxTracker) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgCreateTSSVoter.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgRemoveFromOutTxTracker.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -740,61 +747,54 @@ func (m *MsgCreateTSSVoter) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } -func (m *MsgCreateTSSVoter) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateTSSVoter.Merge(m, src) +func (m *MsgRemoveFromOutTxTracker) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveFromOutTxTracker.Merge(m, src) } -func (m *MsgCreateTSSVoter) XXX_Size() int { +func (m *MsgRemoveFromOutTxTracker) XXX_Size() int { return m.Size() } -func (m *MsgCreateTSSVoter) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateTSSVoter.DiscardUnknown(m) +func (m *MsgRemoveFromOutTxTracker) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveFromOutTxTracker.DiscardUnknown(m) } -var xxx_messageInfo_MsgCreateTSSVoter proto.InternalMessageInfo +var xxx_messageInfo_MsgRemoveFromOutTxTracker proto.InternalMessageInfo -func (m *MsgCreateTSSVoter) GetCreator() string { +func (m *MsgRemoveFromOutTxTracker) GetCreator() string { if m != nil { return m.Creator } return "" } -func (m *MsgCreateTSSVoter) GetTssPubkey() string { - if m != nil { - return m.TssPubkey - } - return "" -} - -func (m *MsgCreateTSSVoter) GetKeyGenZetaHeight() int64 { +func (m *MsgRemoveFromOutTxTracker) GetChainId() int64 { if m != nil { - return m.KeyGenZetaHeight + return m.ChainId } return 0 } -func (m *MsgCreateTSSVoter) GetStatus() common.ReceiveStatus { +func (m *MsgRemoveFromOutTxTracker) GetNonce() uint64 { if m != nil { - return m.Status + return m.Nonce } - return common.ReceiveStatus_Created + return 0 } -type MsgCreateTSSVoterResponse struct { +type MsgRemoveFromOutTxTrackerResponse struct { } -func (m *MsgCreateTSSVoterResponse) Reset() { *m = MsgCreateTSSVoterResponse{} } -func (m *MsgCreateTSSVoterResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCreateTSSVoterResponse) ProtoMessage() {} -func (*MsgCreateTSSVoterResponse) Descriptor() ([]byte, []int) { +func (m *MsgRemoveFromOutTxTrackerResponse) Reset() { *m = MsgRemoveFromOutTxTrackerResponse{} } +func (m *MsgRemoveFromOutTxTrackerResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveFromOutTxTrackerResponse) ProtoMessage() {} +func (*MsgRemoveFromOutTxTrackerResponse) Descriptor() ([]byte, []int) { return fileDescriptor_81d6d611190b7635, []int{13} } -func (m *MsgCreateTSSVoterResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgRemoveFromOutTxTrackerResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgCreateTSSVoterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgRemoveFromOutTxTrackerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgCreateTSSVoterResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgRemoveFromOutTxTrackerResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -804,17 +804,17 @@ func (m *MsgCreateTSSVoterResponse) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } -func (m *MsgCreateTSSVoterResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateTSSVoterResponse.Merge(m, src) +func (m *MsgRemoveFromOutTxTrackerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveFromOutTxTrackerResponse.Merge(m, src) } -func (m *MsgCreateTSSVoterResponse) XXX_Size() int { +func (m *MsgRemoveFromOutTxTrackerResponse) XXX_Size() int { return m.Size() } -func (m *MsgCreateTSSVoterResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateTSSVoterResponse.DiscardUnknown(m) +func (m *MsgRemoveFromOutTxTrackerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveFromOutTxTrackerResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgCreateTSSVoterResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgRemoveFromOutTxTrackerResponse proto.InternalMessageInfo type MsgGasPriceVoter struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` @@ -928,102 +928,6 @@ func (m *MsgGasPriceVoterResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgGasPriceVoterResponse proto.InternalMessageInfo -type MsgNonceVoter struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - Nonce uint64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"` -} - -func (m *MsgNonceVoter) Reset() { *m = MsgNonceVoter{} } -func (m *MsgNonceVoter) String() string { return proto.CompactTextString(m) } -func (*MsgNonceVoter) ProtoMessage() {} -func (*MsgNonceVoter) Descriptor() ([]byte, []int) { - return fileDescriptor_81d6d611190b7635, []int{16} -} -func (m *MsgNonceVoter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgNonceVoter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgNonceVoter.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 *MsgNonceVoter) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgNonceVoter.Merge(m, src) -} -func (m *MsgNonceVoter) XXX_Size() int { - return m.Size() -} -func (m *MsgNonceVoter) XXX_DiscardUnknown() { - xxx_messageInfo_MsgNonceVoter.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgNonceVoter proto.InternalMessageInfo - -func (m *MsgNonceVoter) GetCreator() string { - if m != nil { - return m.Creator - } - return "" -} - -func (m *MsgNonceVoter) GetChainId() int64 { - if m != nil { - return m.ChainId - } - return 0 -} - -func (m *MsgNonceVoter) GetNonce() uint64 { - if m != nil { - return m.Nonce - } - return 0 -} - -type MsgNonceVoterResponse struct { -} - -func (m *MsgNonceVoterResponse) Reset() { *m = MsgNonceVoterResponse{} } -func (m *MsgNonceVoterResponse) String() string { return proto.CompactTextString(m) } -func (*MsgNonceVoterResponse) ProtoMessage() {} -func (*MsgNonceVoterResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_81d6d611190b7635, []int{17} -} -func (m *MsgNonceVoterResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgNonceVoterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgNonceVoterResponse.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 *MsgNonceVoterResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgNonceVoterResponse.Merge(m, src) -} -func (m *MsgNonceVoterResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgNonceVoterResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgNonceVoterResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgNonceVoterResponse proto.InternalMessageInfo - type MsgVoteOnObservedOutboundTx struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` CctxHash string `protobuf:"bytes,2,opt,name=cctx_hash,json=cctxHash,proto3" json:"cctx_hash,omitempty"` @@ -1043,7 +947,7 @@ func (m *MsgVoteOnObservedOutboundTx) Reset() { *m = MsgVoteOnObservedOu func (m *MsgVoteOnObservedOutboundTx) String() string { return proto.CompactTextString(m) } func (*MsgVoteOnObservedOutboundTx) ProtoMessage() {} func (*MsgVoteOnObservedOutboundTx) Descriptor() ([]byte, []int) { - return fileDescriptor_81d6d611190b7635, []int{18} + return fileDescriptor_81d6d611190b7635, []int{16} } func (m *MsgVoteOnObservedOutboundTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1149,7 +1053,7 @@ func (m *MsgVoteOnObservedOutboundTxResponse) Reset() { *m = MsgVoteOnOb func (m *MsgVoteOnObservedOutboundTxResponse) String() string { return proto.CompactTextString(m) } func (*MsgVoteOnObservedOutboundTxResponse) ProtoMessage() {} func (*MsgVoteOnObservedOutboundTxResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_81d6d611190b7635, []int{19} + return fileDescriptor_81d6d611190b7635, []int{17} } func (m *MsgVoteOnObservedOutboundTxResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1202,7 +1106,7 @@ func (m *MsgVoteOnObservedInboundTx) Reset() { *m = MsgVoteOnObservedInb func (m *MsgVoteOnObservedInboundTx) String() string { return proto.CompactTextString(m) } func (*MsgVoteOnObservedInboundTx) ProtoMessage() {} func (*MsgVoteOnObservedInboundTx) Descriptor() ([]byte, []int) { - return fileDescriptor_81d6d611190b7635, []int{20} + return fileDescriptor_81d6d611190b7635, []int{18} } func (m *MsgVoteOnObservedInboundTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1288,151 +1192,55 @@ func (m *MsgVoteOnObservedInboundTx) GetInBlockHeight() uint64 { } func (m *MsgVoteOnObservedInboundTx) GetGasLimit() uint64 { - if m != nil { - return m.GasLimit - } - return 0 -} - -func (m *MsgVoteOnObservedInboundTx) GetCoinType() common.CoinType { - if m != nil { - return m.CoinType - } - return common.CoinType_Zeta -} - -func (m *MsgVoteOnObservedInboundTx) GetTxOrigin() string { - if m != nil { - return m.TxOrigin - } - return "" -} - -func (m *MsgVoteOnObservedInboundTx) GetAsset() string { - if m != nil { - return m.Asset - } - return "" -} - -func (m *MsgVoteOnObservedInboundTx) GetEventIndex() uint64 { - if m != nil { - return m.EventIndex - } - return 0 -} - -type MsgVoteOnObservedInboundTxResponse struct { -} - -func (m *MsgVoteOnObservedInboundTxResponse) Reset() { *m = MsgVoteOnObservedInboundTxResponse{} } -func (m *MsgVoteOnObservedInboundTxResponse) String() string { return proto.CompactTextString(m) } -func (*MsgVoteOnObservedInboundTxResponse) ProtoMessage() {} -func (*MsgVoteOnObservedInboundTxResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_81d6d611190b7635, []int{21} -} -func (m *MsgVoteOnObservedInboundTxResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgVoteOnObservedInboundTxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgVoteOnObservedInboundTxResponse.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 *MsgVoteOnObservedInboundTxResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgVoteOnObservedInboundTxResponse.Merge(m, src) -} -func (m *MsgVoteOnObservedInboundTxResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgVoteOnObservedInboundTxResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgVoteOnObservedInboundTxResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgVoteOnObservedInboundTxResponse proto.InternalMessageInfo - -type MsgSetNodeKeys struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - PubkeySet *common.PubKeySet `protobuf:"bytes,2,opt,name=pubkeySet,proto3" json:"pubkeySet,omitempty"` - TssSigner_Address string `protobuf:"bytes,3,opt,name=tss_signer_Address,json=tssSignerAddress,proto3" json:"tss_signer_Address,omitempty"` -} - -func (m *MsgSetNodeKeys) Reset() { *m = MsgSetNodeKeys{} } -func (m *MsgSetNodeKeys) String() string { return proto.CompactTextString(m) } -func (*MsgSetNodeKeys) ProtoMessage() {} -func (*MsgSetNodeKeys) Descriptor() ([]byte, []int) { - return fileDescriptor_81d6d611190b7635, []int{22} -} -func (m *MsgSetNodeKeys) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSetNodeKeys) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSetNodeKeys.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 *MsgSetNodeKeys) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSetNodeKeys.Merge(m, src) -} -func (m *MsgSetNodeKeys) XXX_Size() int { - return m.Size() -} -func (m *MsgSetNodeKeys) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSetNodeKeys.DiscardUnknown(m) + if m != nil { + return m.GasLimit + } + return 0 } -var xxx_messageInfo_MsgSetNodeKeys proto.InternalMessageInfo +func (m *MsgVoteOnObservedInboundTx) GetCoinType() common.CoinType { + if m != nil { + return m.CoinType + } + return common.CoinType_Zeta +} -func (m *MsgSetNodeKeys) GetCreator() string { +func (m *MsgVoteOnObservedInboundTx) GetTxOrigin() string { if m != nil { - return m.Creator + return m.TxOrigin } return "" } -func (m *MsgSetNodeKeys) GetPubkeySet() *common.PubKeySet { +func (m *MsgVoteOnObservedInboundTx) GetAsset() string { if m != nil { - return m.PubkeySet + return m.Asset } - return nil + return "" } -func (m *MsgSetNodeKeys) GetTssSigner_Address() string { +func (m *MsgVoteOnObservedInboundTx) GetEventIndex() uint64 { if m != nil { - return m.TssSigner_Address + return m.EventIndex } - return "" + return 0 } -type MsgSetNodeKeysResponse struct { +type MsgVoteOnObservedInboundTxResponse struct { } -func (m *MsgSetNodeKeysResponse) Reset() { *m = MsgSetNodeKeysResponse{} } -func (m *MsgSetNodeKeysResponse) String() string { return proto.CompactTextString(m) } -func (*MsgSetNodeKeysResponse) ProtoMessage() {} -func (*MsgSetNodeKeysResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_81d6d611190b7635, []int{23} +func (m *MsgVoteOnObservedInboundTxResponse) Reset() { *m = MsgVoteOnObservedInboundTxResponse{} } +func (m *MsgVoteOnObservedInboundTxResponse) String() string { return proto.CompactTextString(m) } +func (*MsgVoteOnObservedInboundTxResponse) ProtoMessage() {} +func (*MsgVoteOnObservedInboundTxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_81d6d611190b7635, []int{19} } -func (m *MsgSetNodeKeysResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgVoteOnObservedInboundTxResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgSetNodeKeysResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgVoteOnObservedInboundTxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgSetNodeKeysResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgVoteOnObservedInboundTxResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1442,144 +1250,133 @@ func (m *MsgSetNodeKeysResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *MsgSetNodeKeysResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSetNodeKeysResponse.Merge(m, src) +func (m *MsgVoteOnObservedInboundTxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgVoteOnObservedInboundTxResponse.Merge(m, src) } -func (m *MsgSetNodeKeysResponse) XXX_Size() int { +func (m *MsgVoteOnObservedInboundTxResponse) XXX_Size() int { return m.Size() } -func (m *MsgSetNodeKeysResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSetNodeKeysResponse.DiscardUnknown(m) +func (m *MsgVoteOnObservedInboundTxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgVoteOnObservedInboundTxResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgSetNodeKeysResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgVoteOnObservedInboundTxResponse proto.InternalMessageInfo func init() { + proto.RegisterType((*MsgCreateTSSVoter)(nil), "zetachain.zetacore.crosschain.MsgCreateTSSVoter") + proto.RegisterType((*MsgCreateTSSVoterResponse)(nil), "zetachain.zetacore.crosschain.MsgCreateTSSVoterResponse") proto.RegisterType((*MsgMigrateTssFunds)(nil), "zetachain.zetacore.crosschain.MsgMigrateTssFunds") proto.RegisterType((*MsgMigrateTssFundsResponse)(nil), "zetachain.zetacore.crosschain.MsgMigrateTssFundsResponse") - proto.RegisterType((*MsgAddToInTxTracker)(nil), "zetachain.zetacore.crosschain.MsgAddToInTxTracker") - proto.RegisterType((*MsgAddToInTxTrackerResponse)(nil), "zetachain.zetacore.crosschain.MsgAddToInTxTrackerResponse") proto.RegisterType((*MsgUpdateTssAddress)(nil), "zetachain.zetacore.crosschain.MsgUpdateTssAddress") proto.RegisterType((*MsgUpdateTssAddressResponse)(nil), "zetachain.zetacore.crosschain.MsgUpdateTssAddressResponse") + proto.RegisterType((*MsgAddToInTxTracker)(nil), "zetachain.zetacore.crosschain.MsgAddToInTxTracker") + proto.RegisterType((*MsgAddToInTxTrackerResponse)(nil), "zetachain.zetacore.crosschain.MsgAddToInTxTrackerResponse") proto.RegisterType((*MsgWhitelistERC20)(nil), "zetachain.zetacore.crosschain.MsgWhitelistERC20") proto.RegisterType((*MsgWhitelistERC20Response)(nil), "zetachain.zetacore.crosschain.MsgWhitelistERC20Response") proto.RegisterType((*MsgAddToOutTxTracker)(nil), "zetachain.zetacore.crosschain.MsgAddToOutTxTracker") proto.RegisterType((*MsgAddToOutTxTrackerResponse)(nil), "zetachain.zetacore.crosschain.MsgAddToOutTxTrackerResponse") proto.RegisterType((*MsgRemoveFromOutTxTracker)(nil), "zetachain.zetacore.crosschain.MsgRemoveFromOutTxTracker") proto.RegisterType((*MsgRemoveFromOutTxTrackerResponse)(nil), "zetachain.zetacore.crosschain.MsgRemoveFromOutTxTrackerResponse") - proto.RegisterType((*MsgCreateTSSVoter)(nil), "zetachain.zetacore.crosschain.MsgCreateTSSVoter") - proto.RegisterType((*MsgCreateTSSVoterResponse)(nil), "zetachain.zetacore.crosschain.MsgCreateTSSVoterResponse") proto.RegisterType((*MsgGasPriceVoter)(nil), "zetachain.zetacore.crosschain.MsgGasPriceVoter") proto.RegisterType((*MsgGasPriceVoterResponse)(nil), "zetachain.zetacore.crosschain.MsgGasPriceVoterResponse") - proto.RegisterType((*MsgNonceVoter)(nil), "zetachain.zetacore.crosschain.MsgNonceVoter") - proto.RegisterType((*MsgNonceVoterResponse)(nil), "zetachain.zetacore.crosschain.MsgNonceVoterResponse") proto.RegisterType((*MsgVoteOnObservedOutboundTx)(nil), "zetachain.zetacore.crosschain.MsgVoteOnObservedOutboundTx") proto.RegisterType((*MsgVoteOnObservedOutboundTxResponse)(nil), "zetachain.zetacore.crosschain.MsgVoteOnObservedOutboundTxResponse") proto.RegisterType((*MsgVoteOnObservedInboundTx)(nil), "zetachain.zetacore.crosschain.MsgVoteOnObservedInboundTx") proto.RegisterType((*MsgVoteOnObservedInboundTxResponse)(nil), "zetachain.zetacore.crosschain.MsgVoteOnObservedInboundTxResponse") - proto.RegisterType((*MsgSetNodeKeys)(nil), "zetachain.zetacore.crosschain.MsgSetNodeKeys") - proto.RegisterType((*MsgSetNodeKeysResponse)(nil), "zetachain.zetacore.crosschain.MsgSetNodeKeysResponse") } func init() { proto.RegisterFile("crosschain/tx.proto", fileDescriptor_81d6d611190b7635) } var fileDescriptor_81d6d611190b7635 = []byte{ - // 1516 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x5f, 0x6f, 0xdb, 0x54, - 0x14, 0xaf, 0x69, 0x9b, 0xc6, 0xa7, 0x4d, 0xff, 0xb8, 0xdd, 0xea, 0xb9, 0xeb, 0x9f, 0xb9, 0x6c, - 0x54, 0x68, 0x4d, 0xb6, 0x0e, 0xc4, 0x36, 0x40, 0x62, 0xad, 0xb6, 0xae, 0x8c, 0xb4, 0x93, 0x9b, - 0x81, 0xb4, 0x17, 0xcb, 0xb1, 0x6f, 0x1d, 0xab, 0xb1, 0x6f, 0xe4, 0x7b, 0x53, 0x25, 0x15, 0x12, - 0xd2, 0x24, 0x1e, 0x78, 0x43, 0x08, 0x09, 0xc4, 0x17, 0xe0, 0xab, 0xec, 0x8d, 0x89, 0x27, 0xc6, - 0xc3, 0x84, 0xb6, 0x4f, 0x00, 0x9f, 0x00, 0xf9, 0xde, 0x6b, 0x37, 0x4e, 0x9b, 0x7f, 0x9d, 0xf6, - 0x14, 0x9f, 0xe3, 0xfb, 0x3b, 0xff, 0xcf, 0x3d, 0xc7, 0x81, 0x59, 0x3b, 0xc4, 0x84, 0xd8, 0x15, - 0xcb, 0x0b, 0x0a, 0xb4, 0x91, 0xaf, 0x85, 0x98, 0x62, 0x65, 0xf1, 0x18, 0x51, 0x8b, 0xf1, 0xf2, - 0xec, 0x09, 0x87, 0x28, 0x7f, 0x72, 0x4e, 0x9b, 0xb5, 0xb1, 0xef, 0xe3, 0xa0, 0xc0, 0x7f, 0x38, - 0x46, 0x9b, 0x73, 0xb1, 0x8b, 0xd9, 0x63, 0x21, 0x7a, 0xe2, 0x5c, 0xfd, 0x27, 0x09, 0x94, 0x22, - 0x71, 0x8b, 0x9e, 0x1b, 0x5a, 0x14, 0x95, 0x08, 0x79, 0x50, 0x0f, 0x1c, 0xa2, 0xa8, 0x30, 0x66, - 0x87, 0xc8, 0xa2, 0x38, 0x54, 0xa5, 0x15, 0x69, 0x4d, 0x36, 0x62, 0x52, 0xb9, 0x04, 0x59, 0xa6, - 0xc4, 0xf4, 0x1c, 0xf5, 0xbd, 0x15, 0x69, 0x6d, 0xd8, 0x18, 0x63, 0xf4, 0x8e, 0xa3, 0x6c, 0x43, - 0xc6, 0xf2, 0x71, 0x3d, 0xa0, 0xea, 0x70, 0x84, 0xd9, 0x2c, 0x3c, 0x7f, 0xb5, 0x3c, 0xf4, 0xf7, - 0xab, 0xe5, 0x0f, 0x5c, 0x8f, 0x56, 0xea, 0xe5, 0xbc, 0x8d, 0xfd, 0x82, 0x8d, 0x89, 0x8f, 0x89, - 0xf8, 0x59, 0x27, 0xce, 0x61, 0x81, 0x36, 0x6b, 0x88, 0xe4, 0x9f, 0x78, 0x01, 0x35, 0x04, 0x5c, - 0xbf, 0x0c, 0xda, 0x69, 0x9b, 0x0c, 0x44, 0x6a, 0x38, 0x20, 0x48, 0xff, 0x57, 0x82, 0xd9, 0x22, - 0x71, 0xef, 0x39, 0x4e, 0x09, 0xef, 0x04, 0xa5, 0x46, 0x29, 0xb4, 0xec, 0x43, 0x14, 0x9e, 0xcf, - 0xe6, 0x79, 0x18, 0xa3, 0x0d, 0xb3, 0x62, 0x91, 0x0a, 0x37, 0xda, 0xc8, 0xd0, 0xc6, 0x43, 0x8b, - 0x54, 0x94, 0x75, 0x90, 0x6d, 0xec, 0x05, 0x66, 0x64, 0x9e, 0x3a, 0xb2, 0x22, 0xad, 0x4d, 0x6e, - 0x4c, 0xe7, 0x45, 0x40, 0xb7, 0xb0, 0x17, 0x94, 0x9a, 0x35, 0x64, 0x64, 0x6d, 0xf1, 0xa4, 0xac, - 0xc2, 0x68, 0x2d, 0xc4, 0xf8, 0x40, 0x1d, 0x5d, 0x91, 0xd6, 0xc6, 0x37, 0x72, 0xf1, 0xd1, 0xc7, - 0x11, 0xd3, 0xe0, 0xef, 0x94, 0x45, 0x80, 0x72, 0x15, 0xdb, 0x87, 0x5c, 0x5f, 0x86, 0xe9, 0x93, - 0x19, 0x87, 0xa9, 0xbc, 0x04, 0x59, 0xda, 0x30, 0xbd, 0xc0, 0x41, 0x0d, 0x75, 0x8c, 0x9b, 0x49, - 0x1b, 0x3b, 0x11, 0xa9, 0x2f, 0xc2, 0xc2, 0x19, 0x2e, 0x27, 0x21, 0xd9, 0x65, 0x11, 0x79, 0x52, - 0x73, 0x78, 0xbc, 0xee, 0x39, 0x4e, 0x88, 0x48, 0xb7, 0x2c, 0x2e, 0x02, 0x50, 0x42, 0xcc, 0x5a, - 0xbd, 0x7c, 0x88, 0x9a, 0x2c, 0x26, 0xb2, 0x21, 0x53, 0x42, 0x1e, 0x33, 0x86, 0x50, 0xd7, 0x2e, - 0x2f, 0x51, 0xf7, 0xa7, 0x04, 0x33, 0x45, 0xe2, 0x7e, 0x53, 0xf1, 0x28, 0xaa, 0x7a, 0x84, 0xde, - 0x37, 0xb6, 0x36, 0x6e, 0x74, 0xd1, 0xb6, 0x0a, 0x39, 0x14, 0xda, 0x1b, 0x37, 0x4c, 0x8b, 0x0b, - 0x12, 0x0a, 0x27, 0x18, 0x33, 0x36, 0xb6, 0x35, 0x49, 0xc3, 0xe9, 0x24, 0x29, 0x30, 0x12, 0x58, - 0x3e, 0x4f, 0x83, 0x6c, 0xb0, 0x67, 0xe5, 0x22, 0x64, 0x48, 0xd3, 0x2f, 0xe3, 0x2a, 0x8b, 0xb8, - 0x6c, 0x08, 0x4a, 0xd1, 0x20, 0xeb, 0x20, 0xdb, 0xf3, 0xad, 0x2a, 0x61, 0x11, 0xce, 0x19, 0x09, - 0xad, 0x2c, 0x80, 0xec, 0x5a, 0xc4, 0xac, 0x7a, 0xbe, 0x47, 0x45, 0x84, 0xb3, 0xae, 0x45, 0xbe, - 0x8a, 0x68, 0xdd, 0x84, 0x4b, 0xa7, 0x7c, 0x8a, 0x3d, 0x8e, 0x3c, 0x38, 0x4e, 0x79, 0xc0, 0x3d, - 0x9c, 0x38, 0x6e, 0xf5, 0x60, 0x11, 0xc0, 0xb6, 0x93, 0x0c, 0x8a, 0xa0, 0x46, 0x1c, 0x9e, 0xc3, - 0x97, 0x12, 0xcc, 0xc5, 0x49, 0xdc, 0xab, 0xd3, 0xb7, 0x2c, 0xdc, 0x39, 0x18, 0x0d, 0x70, 0x60, - 0x23, 0x16, 0xab, 0x11, 0x83, 0x13, 0xad, 0xe5, 0x3c, 0x92, 0x2a, 0xe7, 0x77, 0x5c, 0x9f, 0x9f, - 0xc3, 0xe5, 0xb3, 0x5c, 0x4b, 0xe2, 0xb7, 0x08, 0xe0, 0x11, 0x33, 0x44, 0x3e, 0x3e, 0x42, 0x0e, - 0xf3, 0x32, 0x6b, 0xc8, 0x1e, 0x31, 0x38, 0x43, 0x3f, 0x60, 0xb1, 0xe7, 0xd4, 0x83, 0x10, 0xfb, - 0xef, 0x28, 0x3c, 0xfa, 0x2a, 0x5c, 0xe9, 0xa8, 0x27, 0xa9, 0xee, 0xdf, 0x79, 0x75, 0x6f, 0x45, - 0x4a, 0x50, 0x69, 0x7f, 0xff, 0x6b, 0x4c, 0xbb, 0x5a, 0xd1, 0xbd, 0x97, 0x94, 0x0f, 0x61, 0xfa, - 0x10, 0x35, 0xb7, 0x51, 0xf0, 0x14, 0x51, 0xeb, 0x21, 0xf2, 0xdc, 0x0a, 0x15, 0xf5, 0x7d, 0x8a, - 0xaf, 0xac, 0x43, 0x86, 0x50, 0x8b, 0xd6, 0x89, 0xb8, 0x71, 0x2e, 0xc4, 0x69, 0x32, 0x90, 0x8d, - 0xbc, 0x23, 0xb4, 0xcf, 0x5e, 0x1a, 0xe2, 0x90, 0xbe, 0xc0, 0xc2, 0x96, 0x36, 0x34, 0x71, 0xe3, - 0x57, 0x09, 0xa6, 0x8b, 0xc4, 0xdd, 0xb6, 0xc8, 0xe3, 0xd0, 0xb3, 0x51, 0x2f, 0x2f, 0xba, 0xc7, - 0xb2, 0x16, 0x89, 0x88, 0x63, 0xc9, 0x08, 0xe5, 0x0a, 0x4c, 0xf0, 0x62, 0x09, 0xea, 0x7e, 0x19, - 0x85, 0xcc, 0xe2, 0x11, 0x63, 0x9c, 0xf1, 0x76, 0x19, 0x8b, 0xf5, 0x68, 0xbd, 0x56, 0xab, 0x36, - 0x93, 0x1e, 0x65, 0x94, 0xae, 0x81, 0xda, 0x6e, 0x59, 0x62, 0xf6, 0x53, 0xc8, 0x15, 0x89, 0xbb, - 0x1b, 0xa5, 0xeb, 0xed, 0x4c, 0x3e, 0x23, 0xfd, 0xf3, 0x70, 0x21, 0x25, 0x3b, 0x51, 0xfa, 0x72, - 0x94, 0x5d, 0x78, 0x11, 0x73, 0x2f, 0xd8, 0x2b, 0x13, 0x14, 0x1e, 0x21, 0x67, 0xaf, 0x4e, 0xcb, - 0xb8, 0x1e, 0x38, 0xa5, 0x46, 0x17, 0x1b, 0x16, 0x80, 0x75, 0x38, 0xef, 0x18, 0x9e, 0xfb, 0x6c, - 0xc4, 0x60, 0x0d, 0x93, 0x87, 0x59, 0x2c, 0x84, 0x99, 0x38, 0x2a, 0xb5, 0xd6, 0x41, 0x33, 0x83, - 0x4f, 0xf4, 0x94, 0xf8, 0xf9, 0xcf, 0x40, 0x6b, 0x3b, 0xcf, 0x9b, 0x8f, 0x17, 0x0d, 0x0f, 0xb0, - 0x9a, 0x82, 0x6d, 0x9e, 0xbc, 0x57, 0x3e, 0x86, 0xf9, 0x36, 0x74, 0x74, 0xd9, 0xd5, 0x09, 0x72, - 0x54, 0x60, 0xd0, 0xb9, 0x14, 0x74, 0xdb, 0x22, 0x4f, 0x08, 0x72, 0x94, 0x63, 0xd0, 0xdb, 0x60, - 0xe8, 0xe0, 0x00, 0xd9, 0xd4, 0x3b, 0x42, 0x4c, 0x00, 0x4f, 0xfd, 0x38, 0x9b, 0xe8, 0x79, 0x31, - 0xd1, 0xaf, 0xf5, 0x31, 0xd1, 0x77, 0x02, 0x6a, 0x2c, 0xa5, 0x34, 0xde, 0x8f, 0xe5, 0xc6, 0x99, - 0x57, 0xbe, 0xec, 0xa1, 0x9b, 0xdf, 0xd4, 0x13, 0xcc, 0xfa, 0xce, 0xb2, 0xd8, 0xfd, 0xad, 0x60, - 0x98, 0x3c, 0xb2, 0xaa, 0x75, 0x64, 0x86, 0xbc, 0x57, 0x1c, 0x5e, 0x74, 0x9b, 0x0f, 0x07, 0xdc, - 0x42, 0xfe, 0x7b, 0xb5, 0x7c, 0xa1, 0x69, 0xf9, 0xd5, 0xbb, 0x7a, 0x5a, 0x9c, 0x6e, 0xe4, 0x18, - 0x43, 0xb4, 0xa2, 0xd3, 0xd2, 0xac, 0x99, 0x3e, 0x9a, 0x55, 0x59, 0x86, 0x71, 0xee, 0x22, 0xab, - 0x51, 0x71, 0x81, 0x02, 0x63, 0x6d, 0x45, 0x1c, 0xe5, 0x1a, 0x4c, 0xf1, 0x03, 0xd1, 0x6d, 0xc2, - 0xab, 0x37, 0xcb, 0x3c, 0xcf, 0x31, 0x76, 0x89, 0x10, 0x56, 0xb9, 0xe9, 0xcd, 0x44, 0xee, 0xb5, - 0x99, 0xe8, 0x57, 0x61, 0xb5, 0x4b, 0x69, 0x27, 0x2d, 0xf0, 0x6c, 0x84, 0x2d, 0x5d, 0xe9, 0x73, - 0x3b, 0x41, 0xef, 0x0e, 0x88, 0x9a, 0x1c, 0x05, 0x0e, 0x0a, 0x45, 0xf9, 0x0b, 0x2a, 0x72, 0x87, - 0x3f, 0x99, 0x6d, 0x63, 0x3d, 0xc7, 0xd9, 0x5b, 0xa2, 0x55, 0x35, 0xc8, 0x8a, 0x10, 0x87, 0x62, - 0x66, 0x25, 0xb4, 0x72, 0x15, 0x26, 0xe3, 0x67, 0x11, 0xb6, 0x51, 0x2e, 0x22, 0xe6, 0xf2, 0xc8, - 0x9d, 0x2c, 0x9e, 0x99, 0xb7, 0x5a, 0x3c, 0x23, 0x2f, 0x7d, 0x44, 0x88, 0xe5, 0xf2, 0xd0, 0xcb, - 0x46, 0x4c, 0x2a, 0x97, 0x01, 0xa2, 0x90, 0x8b, 0x0e, 0x96, 0xb9, 0x9d, 0x5e, 0x20, 0x1a, 0xf7, - 0x1a, 0x4c, 0x79, 0x81, 0x29, 0x66, 0x27, 0xef, 0x56, 0xde, 0x72, 0x39, 0x2f, 0x68, 0x6d, 0xd1, - 0xd4, 0x02, 0x32, 0xce, 0x4e, 0x24, 0x0b, 0x48, 0x3a, 0xaf, 0x13, 0x3d, 0x37, 0xce, 0x05, 0x90, - 0x69, 0xc3, 0xc4, 0xa1, 0xe7, 0x7a, 0x81, 0x9a, 0xe3, 0x06, 0xd1, 0xc6, 0x1e, 0xa3, 0xa3, 0xfb, - 0xcf, 0x22, 0x04, 0x51, 0x75, 0x92, 0xbd, 0xe0, 0x44, 0x54, 0x82, 0xe8, 0x08, 0x05, 0x54, 0xcc, - 0xf0, 0x29, 0x66, 0x00, 0x30, 0x16, 0x1f, 0xe3, 0xef, 0x83, 0xde, 0xb9, 0x06, 0x92, 0x52, 0xf9, - 0x41, 0x82, 0xc9, 0x22, 0x71, 0xf7, 0x11, 0xdd, 0xc5, 0x0e, 0x7a, 0x84, 0x9a, 0xdd, 0x36, 0xcd, - 0x02, 0xc8, 0x7c, 0x32, 0xee, 0x23, 0xca, 0x2a, 0x64, 0x7c, 0x63, 0x26, 0x59, 0x3e, 0xea, 0xe5, - 0x47, 0xec, 0x85, 0x71, 0x72, 0x46, 0xb9, 0x0e, 0x4a, 0xd4, 0x00, 0xc4, 0x73, 0x03, 0x14, 0x9a, - 0x62, 0xb7, 0x12, 0x77, 0xe6, 0x34, 0x25, 0x64, 0x9f, 0xbd, 0x10, 0x7c, 0x5d, 0x85, 0x8b, 0x69, - 0x53, 0x62, 0x2b, 0x37, 0xfe, 0x18, 0x87, 0xe1, 0x22, 0x71, 0x95, 0xef, 0x25, 0x98, 0x39, 0xbd, - 0x73, 0xdd, 0xca, 0x77, 0xfd, 0x84, 0xca, 0x9f, 0xb5, 0xcd, 0x68, 0x9f, 0x9e, 0x03, 0x94, 0xac, - 0x40, 0xcf, 0x24, 0x98, 0x3e, 0xf5, 0xcd, 0xb2, 0xd1, 0xa7, 0xc4, 0x16, 0x8c, 0x76, 0x77, 0x70, - 0x4c, 0x62, 0xc4, 0xcf, 0x12, 0x5c, 0xec, 0xb0, 0x66, 0xdd, 0xee, 0x2d, 0xf6, 0x6c, 0xa4, 0xf6, - 0xc5, 0x79, 0x91, 0x89, 0x59, 0xdf, 0xc2, 0x64, 0xdb, 0xba, 0x75, 0xa3, 0xb7, 0xcc, 0x34, 0x42, - 0xbb, 0x3d, 0x28, 0x22, 0xd1, 0xde, 0x84, 0x5c, 0x7a, 0x4b, 0x2a, 0xf4, 0x16, 0x95, 0x02, 0x68, - 0x9f, 0x0c, 0x08, 0x48, 0x54, 0xd7, 0x00, 0x5a, 0x56, 0x9d, 0xeb, 0xbd, 0xc5, 0x9c, 0x9c, 0xd6, - 0x3e, 0x1a, 0xe4, 0x74, 0xa2, 0xf1, 0x37, 0x09, 0xd4, 0x8e, 0x7b, 0x4e, 0x1f, 0xa5, 0xd5, 0x09, - 0xab, 0x6d, 0x9e, 0x1f, 0x9b, 0x18, 0xf7, 0x8b, 0x04, 0xf3, 0x9d, 0x26, 0xd0, 0x9d, 0x41, 0xe5, - 0x27, 0x50, 0xed, 0xde, 0xb9, 0xa1, 0xad, 0x15, 0xda, 0xf6, 0xb9, 0xdb, 0x47, 0x85, 0xa6, 0x11, - 0xfd, 0x54, 0x68, 0x87, 0xcf, 0xcf, 0xe8, 0xee, 0x38, 0xf5, 0x75, 0xdf, 0xc7, 0xdd, 0xd1, 0x8e, - 0xe9, 0xe7, 0xee, 0xe8, 0xf4, 0xd5, 0xaf, 0x7c, 0x07, 0x53, 0xed, 0x7f, 0x13, 0xdd, 0xec, 0x2d, - 0xae, 0x0d, 0xa2, 0xdd, 0x19, 0x18, 0x12, 0x1b, 0xb0, 0xf9, 0xe8, 0xf9, 0xeb, 0x25, 0xe9, 0xc5, - 0xeb, 0x25, 0xe9, 0x9f, 0xd7, 0x4b, 0xd2, 0x8f, 0x6f, 0x96, 0x86, 0x5e, 0xbc, 0x59, 0x1a, 0xfa, - 0xeb, 0xcd, 0xd2, 0xd0, 0xd3, 0x9b, 0x2d, 0x83, 0x3e, 0x12, 0xba, 0xce, 0xff, 0x2f, 0x8b, 0xe5, - 0x17, 0x1a, 0x85, 0xd6, 0x7f, 0xd1, 0xa2, 0xb9, 0x5f, 0xce, 0xb0, 0xff, 0xbf, 0x6e, 0xfd, 0x1f, - 0x00, 0x00, 0xff, 0xff, 0x3f, 0x94, 0xa8, 0x99, 0x60, 0x13, 0x00, 0x00, + // 1407 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x6d, 0x4f, 0x1b, 0xc7, + 0x13, 0xe7, 0xfe, 0x80, 0xb1, 0x07, 0x0c, 0xe4, 0x20, 0x89, 0x73, 0x04, 0x43, 0x8e, 0x7f, 0x52, + 0x54, 0x09, 0x3b, 0x21, 0xaa, 0x9a, 0xa4, 0xad, 0xd4, 0x80, 0x12, 0x42, 0x5b, 0x42, 0x74, 0x71, + 0x5a, 0x29, 0x6f, 0x4e, 0xe7, 0xbb, 0xe5, 0x7c, 0xc2, 0xb7, 0x6b, 0xdd, 0xae, 0x91, 0x8d, 0x2a, + 0x55, 0x8a, 0xd4, 0xf7, 0x55, 0x55, 0xa9, 0x55, 0xbf, 0x40, 0xbf, 0x4a, 0x5e, 0x46, 0x7d, 0xd5, + 0x54, 0x6a, 0x54, 0x85, 0x4f, 0xd0, 0x7e, 0x82, 0x6a, 0x1f, 0xee, 0xf0, 0x19, 0xfc, 0x00, 0x51, + 0x5e, 0xdd, 0xce, 0xec, 0xce, 0xec, 0xcc, 0x6f, 0x66, 0x76, 0xf6, 0x16, 0xe6, 0xdc, 0x88, 0x50, + 0xea, 0xd6, 0x9c, 0x00, 0x97, 0x59, 0xab, 0xd4, 0x88, 0x08, 0x23, 0xfa, 0xe2, 0x21, 0x62, 0x8e, + 0xe0, 0x95, 0xc4, 0x88, 0x44, 0xa8, 0x74, 0xbc, 0xce, 0x98, 0x73, 0x49, 0x18, 0x12, 0x5c, 0x96, + 0x1f, 0x29, 0x63, 0xcc, 0xfb, 0xc4, 0x27, 0x62, 0x58, 0xe6, 0x23, 0xc9, 0x35, 0x7f, 0xd3, 0xe0, + 0xc2, 0x0e, 0xf5, 0x37, 0x23, 0xe4, 0x30, 0x54, 0x79, 0xfa, 0xf4, 0x6b, 0xc2, 0x50, 0xa4, 0x17, + 0x60, 0xc2, 0xe5, 0x1c, 0x12, 0x15, 0xb4, 0x65, 0x6d, 0x35, 0x67, 0xc5, 0xa4, 0xbe, 0x08, 0xc0, + 0x28, 0xb5, 0x1b, 0xcd, 0xea, 0x3e, 0x6a, 0x17, 0xfe, 0x27, 0x26, 0x73, 0x8c, 0xd2, 0x27, 0x82, + 0xa1, 0x7f, 0x08, 0xb3, 0xfb, 0xa8, 0xbd, 0x85, 0xf0, 0x73, 0xc4, 0x9c, 0x47, 0x28, 0xf0, 0x6b, + 0xac, 0x30, 0xba, 0xac, 0xad, 0x8e, 0x5a, 0x27, 0xf8, 0xfa, 0x1a, 0x64, 0x28, 0x73, 0x58, 0x93, + 0x16, 0xc6, 0x96, 0xb5, 0xd5, 0xe9, 0xf5, 0x8b, 0x25, 0x65, 0xaf, 0x85, 0x5c, 0x14, 0x1c, 0xa0, + 0xa7, 0x62, 0xd2, 0x52, 0x8b, 0xcc, 0x05, 0xb8, 0x72, 0xc2, 0x50, 0x0b, 0xd1, 0x06, 0xc1, 0x14, + 0x99, 0x3f, 0x6a, 0xa0, 0xef, 0x50, 0x7f, 0x27, 0xf0, 0x23, 0x3e, 0x4d, 0xe9, 0xc3, 0x26, 0xf6, + 0x68, 0x1f, 0x3f, 0xae, 0x40, 0x56, 0x60, 0x65, 0x07, 0x9e, 0xf0, 0x62, 0xd4, 0x9a, 0x10, 0xf4, + 0xb6, 0xa7, 0x6f, 0x41, 0xc6, 0x09, 0x49, 0x13, 0x4b, 0xcb, 0x73, 0x1b, 0xe5, 0x97, 0x6f, 0x96, + 0x46, 0xfe, 0x7c, 0xb3, 0xf4, 0x81, 0x1f, 0xb0, 0x5a, 0xb3, 0xca, 0xad, 0x2c, 0xbb, 0x84, 0x86, + 0x84, 0xaa, 0xcf, 0x1a, 0xf5, 0xf6, 0xcb, 0xac, 0xdd, 0x40, 0xb4, 0xf4, 0x2c, 0xc0, 0xcc, 0x52, + 0xe2, 0xe6, 0x55, 0x30, 0x4e, 0xda, 0x94, 0x98, 0xfc, 0x18, 0xe6, 0x76, 0xa8, 0xff, 0xac, 0xe1, + 0xc9, 0xc9, 0xfb, 0x9e, 0x17, 0x21, 0x4a, 0xcf, 0x0d, 0xbd, 0xb9, 0x08, 0x0b, 0xa7, 0xe8, 0x4b, + 0xb6, 0xfb, 0x47, 0x13, 0xfb, 0xdd, 0xf7, 0xbc, 0x0a, 0xd9, 0xc6, 0x95, 0x56, 0x25, 0x72, 0xdc, + 0xfd, 0xbe, 0xa1, 0xee, 0x03, 0xd1, 0x65, 0x98, 0x60, 0x2d, 0xbb, 0xe6, 0xd0, 0x9a, 0xc4, 0xc8, + 0xca, 0xb0, 0xd6, 0x23, 0x87, 0xd6, 0xf4, 0x35, 0xc8, 0xb9, 0x24, 0xc0, 0x36, 0x47, 0x43, 0x85, + 0x75, 0x36, 0x0e, 0xeb, 0x26, 0x09, 0x70, 0xa5, 0xdd, 0x40, 0x56, 0xd6, 0x55, 0x23, 0x7d, 0x05, + 0xc6, 0x1b, 0x11, 0x21, 0x7b, 0x85, 0xf1, 0x65, 0x6d, 0x75, 0x72, 0x3d, 0x1f, 0x2f, 0x7d, 0xc2, + 0x99, 0x96, 0x9c, 0xe3, 0x7e, 0x57, 0xeb, 0xc4, 0xdd, 0x97, 0xfb, 0x65, 0xa4, 0xdf, 0x82, 0x23, + 0xb6, 0xbc, 0x02, 0x59, 0xd6, 0xb2, 0x03, 0xec, 0xa1, 0x56, 0x61, 0x42, 0x9a, 0xc9, 0x5a, 0xdb, + 0x9c, 0x54, 0x90, 0x74, 0xbb, 0x9c, 0x40, 0xf2, 0xbb, 0xcc, 0xfd, 0x6f, 0x6a, 0x01, 0x43, 0xf5, + 0x80, 0xb2, 0x07, 0xd6, 0xe6, 0xfa, 0xcd, 0x3e, 0x80, 0xac, 0x40, 0x1e, 0x45, 0xee, 0xfa, 0x4d, + 0xdb, 0x91, 0xd8, 0xaa, 0x18, 0x4c, 0x09, 0x66, 0x1c, 0xbf, 0x4e, 0xd4, 0x46, 0xd3, 0xa8, 0xe9, + 0x30, 0x86, 0x9d, 0x50, 0xe2, 0x92, 0xb3, 0xc4, 0x58, 0xbf, 0x04, 0x19, 0xda, 0x0e, 0xab, 0xa4, + 0x2e, 0x20, 0xc8, 0x59, 0x8a, 0xd2, 0x0d, 0xc8, 0x7a, 0xc8, 0x0d, 0x42, 0xa7, 0x4e, 0x85, 0xcb, + 0x79, 0x2b, 0xa1, 0xf5, 0x05, 0xc8, 0xf9, 0x0e, 0xb5, 0xeb, 0x41, 0x18, 0x30, 0xe5, 0x72, 0xd6, + 0x77, 0xe8, 0x57, 0x9c, 0x36, 0x6d, 0x51, 0x26, 0x69, 0x9f, 0x62, 0x8f, 0xb9, 0x07, 0x87, 0x29, + 0x0f, 0xa4, 0x87, 0x53, 0x87, 0x9d, 0x1e, 0x2c, 0x02, 0xb8, 0x6e, 0x02, 0xa9, 0xca, 0x33, 0xce, + 0x91, 0xa0, 0xbe, 0xd6, 0x60, 0x3e, 0x46, 0x75, 0xb7, 0xc9, 0xde, 0x31, 0x93, 0xe6, 0x61, 0x1c, + 0x13, 0xec, 0x22, 0x81, 0xd5, 0x98, 0x25, 0x89, 0xce, 0xfc, 0x1a, 0x4b, 0xe5, 0xd7, 0x7b, 0x4e, + 0x98, 0xcf, 0xe0, 0xea, 0x69, 0xae, 0x25, 0xf8, 0x2d, 0x02, 0x04, 0xd4, 0x8e, 0x50, 0x48, 0x0e, + 0x90, 0x27, 0xbc, 0xcc, 0x5a, 0xb9, 0x80, 0x5a, 0x92, 0x61, 0xee, 0x09, 0xec, 0x25, 0xf5, 0x30, + 0x22, 0xe1, 0x7b, 0x82, 0xc7, 0x5c, 0x81, 0x6b, 0x3d, 0xf7, 0x49, 0xb2, 0xfb, 0x17, 0x0d, 0x66, + 0x77, 0xa8, 0xbf, 0xe5, 0xd0, 0x27, 0x51, 0xe0, 0xa2, 0x41, 0x07, 0x7b, 0x7f, 0x23, 0x1a, 0x5c, + 0x45, 0x6c, 0x84, 0x20, 0xf4, 0x6b, 0x30, 0x25, 0x51, 0xc6, 0xcd, 0xb0, 0x8a, 0x22, 0x11, 0xa8, + 0x31, 0x6b, 0x52, 0xf0, 0x1e, 0x0b, 0x96, 0x48, 0xee, 0x66, 0xa3, 0x51, 0x6f, 0x27, 0xc9, 0x2d, + 0x28, 0xd3, 0x80, 0x42, 0xb7, 0x65, 0x89, 0xd9, 0xaf, 0xc7, 0x45, 0xd1, 0x72, 0xe6, 0x2e, 0xde, + 0xad, 0x52, 0x14, 0x1d, 0x20, 0x6f, 0xb7, 0xc9, 0xaa, 0xa4, 0x89, 0xbd, 0x4a, 0xab, 0x8f, 0x07, + 0x0b, 0x20, 0xb2, 0x54, 0x46, 0x5d, 0xa6, 0x6d, 0x96, 0x33, 0x44, 0xd0, 0x4b, 0x30, 0x47, 0x94, + 0x32, 0x9b, 0x70, 0xb8, 0x3a, 0x4f, 0xaf, 0x0b, 0xe4, 0x78, 0x9f, 0x8a, 0x5c, 0xff, 0x29, 0x18, + 0x5d, 0xeb, 0x65, 0x02, 0xc9, 0x96, 0x26, 0x7d, 0x2d, 0xa4, 0xc4, 0x36, 0x8e, 0xe7, 0xf5, 0x8f, + 0xe0, 0x72, 0x97, 0x34, 0x2f, 0xd8, 0x26, 0x45, 0x5e, 0x01, 0x84, 0xe8, 0x7c, 0x4a, 0x74, 0xcb, + 0xa1, 0xcf, 0x28, 0xf2, 0xf4, 0x43, 0x30, 0xbb, 0xc4, 0xd0, 0xde, 0x1e, 0x72, 0x59, 0x70, 0x80, + 0x84, 0x02, 0x19, 0x85, 0x49, 0xd1, 0x95, 0x4a, 0xaa, 0x2b, 0xdd, 0x18, 0xa2, 0x2b, 0x6d, 0x63, + 0x66, 0x15, 0x53, 0x3b, 0x3e, 0x88, 0xf5, 0xc6, 0x41, 0xd0, 0xbf, 0x18, 0xb0, 0xb7, 0x3c, 0x6d, + 0xa6, 0x84, 0xf5, 0xbd, 0x75, 0x89, 0x33, 0x48, 0x27, 0x30, 0x7d, 0xe0, 0xd4, 0x9b, 0xc8, 0x8e, + 0x64, 0x27, 0xf7, 0x64, 0xfc, 0x37, 0x1e, 0x9d, 0xb1, 0x93, 0xfe, 0xfb, 0x66, 0xe9, 0x62, 0xdb, + 0x09, 0xeb, 0xf7, 0xcc, 0xb4, 0x3a, 0xd3, 0xca, 0x0b, 0x86, 0xba, 0x28, 0x78, 0x1d, 0x57, 0x89, + 0xcc, 0x10, 0x57, 0x09, 0x7d, 0x09, 0x26, 0xa5, 0x8b, 0x22, 0xc3, 0xd5, 0x21, 0x00, 0x82, 0xb5, + 0xc9, 0x39, 0xfa, 0x0d, 0x98, 0x91, 0x0b, 0x78, 0xc3, 0x95, 0x05, 0x98, 0x15, 0x9e, 0xe7, 0x05, + 0xbb, 0x42, 0xe9, 0x63, 0x71, 0x4e, 0xa5, 0xda, 0x5d, 0x6e, 0x50, 0xbb, 0x33, 0xaf, 0xc3, 0x4a, + 0x9f, 0xd4, 0x4e, 0x4a, 0xe0, 0xc5, 0x98, 0xb8, 0x38, 0xa4, 0xd7, 0x6d, 0xe3, 0xc1, 0x15, 0xc0, + 0xeb, 0x0d, 0x61, 0x0f, 0x45, 0x2a, 0xfd, 0x15, 0xc5, 0xdd, 0x91, 0x23, 0xbb, 0xab, 0x35, 0xe5, + 0x25, 0x7b, 0x53, 0x15, 0xba, 0x01, 0x59, 0x05, 0x71, 0xa4, 0xce, 0xdd, 0x84, 0xd6, 0xaf, 0xc3, + 0x74, 0x3c, 0x56, 0xb0, 0x8d, 0x4b, 0x15, 0x31, 0x57, 0x22, 0x77, 0x7c, 0x79, 0xca, 0xbc, 0xd3, + 0xe5, 0x89, 0x7b, 0x19, 0x22, 0x4a, 0x1d, 0x5f, 0x42, 0x9f, 0xb3, 0x62, 0x52, 0xbf, 0x0a, 0xc0, + 0x21, 0x57, 0x15, 0x9c, 0x93, 0x76, 0x06, 0x58, 0x15, 0xee, 0x0d, 0x98, 0x09, 0xb0, 0xad, 0xce, + 0x7f, 0x59, 0xad, 0xb2, 0xe4, 0xf2, 0x01, 0xee, 0x2c, 0xd1, 0x54, 0x13, 0x9d, 0x14, 0x2b, 0x92, + 0x26, 0x9a, 0x8e, 0xeb, 0xd4, 0xc0, 0x6b, 0xcc, 0x02, 0xe4, 0x58, 0xcb, 0x26, 0x51, 0xe0, 0x07, + 0xb8, 0x90, 0x97, 0x06, 0xb1, 0xd6, 0xae, 0xa0, 0xf9, 0xe9, 0xe9, 0x50, 0x8a, 0x58, 0x61, 0x5a, + 0x4c, 0x48, 0x82, 0xa7, 0x20, 0x3a, 0x40, 0x98, 0xa9, 0x3e, 0x34, 0x23, 0x0c, 0x00, 0xc1, 0x92, + 0xad, 0xe8, 0xff, 0x60, 0xf6, 0xce, 0x81, 0x38, 0x55, 0xd6, 0xff, 0x02, 0x18, 0xdd, 0xa1, 0xbe, + 0xfe, 0xbd, 0x06, 0x17, 0x4e, 0x76, 0xe4, 0xdb, 0xa5, 0xbe, 0xff, 0x09, 0xa5, 0xd3, 0x7a, 0x9d, + 0xf1, 0xc9, 0x39, 0x84, 0x92, 0x06, 0xf9, 0x42, 0x83, 0xd9, 0x13, 0x57, 0xcc, 0xf5, 0x21, 0x35, + 0x76, 0xc8, 0x18, 0xf7, 0xce, 0x2e, 0x93, 0x18, 0xf1, 0x93, 0x06, 0x97, 0x7a, 0x34, 0xe1, 0x3b, + 0x83, 0xd5, 0x9e, 0x2e, 0x69, 0x7c, 0x7e, 0x5e, 0xc9, 0xc4, 0xac, 0x36, 0xe4, 0xd3, 0xcd, 0xb8, + 0x3c, 0x58, 0x65, 0x4a, 0xc0, 0xf8, 0xf8, 0x8c, 0x02, 0xc9, 0xd6, 0xbf, 0x6a, 0x50, 0xe8, 0xd9, + 0x51, 0x87, 0x80, 0xba, 0x97, 0xac, 0xb1, 0x71, 0x7e, 0xd9, 0xc4, 0xb8, 0x9f, 0x35, 0xb8, 0xdc, + 0xeb, 0xac, 0xbb, 0x7b, 0x56, 0xfd, 0x89, 0xa8, 0x71, 0xff, 0xdc, 0xa2, 0x89, 0x65, 0xdf, 0xc2, + 0x74, 0xd7, 0xcf, 0xc1, 0xcd, 0xc1, 0x4a, 0xd3, 0x12, 0xc6, 0x9d, 0xb3, 0x4a, 0xa4, 0x6a, 0xe9, + 0xc4, 0xef, 0xe1, 0x10, 0xb5, 0xd4, 0x2d, 0x33, 0x4c, 0x2d, 0xf5, 0xfa, 0x6d, 0xd4, 0xbf, 0x83, + 0x99, 0xee, 0x9f, 0xea, 0x5b, 0x83, 0xd5, 0x75, 0x89, 0x18, 0x77, 0xcf, 0x2c, 0xd2, 0x19, 0x83, + 0xae, 0xc7, 0x89, 0x21, 0x62, 0x90, 0x96, 0x18, 0x26, 0x06, 0xa7, 0xbf, 0x2b, 0x6c, 0x7c, 0xf9, + 0xf2, 0x6d, 0x51, 0x7b, 0xf5, 0xb6, 0xa8, 0xfd, 0xfd, 0xb6, 0xa8, 0xfd, 0x70, 0x54, 0x1c, 0x79, + 0x75, 0x54, 0x1c, 0xf9, 0xe3, 0xa8, 0x38, 0xf2, 0xfc, 0x56, 0x47, 0x43, 0xe3, 0x3a, 0xd7, 0xe4, + 0x13, 0x4d, 0xac, 0xbe, 0xdc, 0x2a, 0x77, 0x3e, 0xdc, 0xf0, 0xfe, 0x56, 0xcd, 0x88, 0x27, 0x97, + 0xdb, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x47, 0x0c, 0x03, 0xae, 0xd3, 0x11, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1597,14 +1394,13 @@ type MsgClient interface { AddToOutTxTracker(ctx context.Context, in *MsgAddToOutTxTracker, opts ...grpc.CallOption) (*MsgAddToOutTxTrackerResponse, error) AddToInTxTracker(ctx context.Context, in *MsgAddToInTxTracker, opts ...grpc.CallOption) (*MsgAddToInTxTrackerResponse, error) RemoveFromOutTxTracker(ctx context.Context, in *MsgRemoveFromOutTxTracker, opts ...grpc.CallOption) (*MsgRemoveFromOutTxTrackerResponse, error) - CreateTSSVoter(ctx context.Context, in *MsgCreateTSSVoter, opts ...grpc.CallOption) (*MsgCreateTSSVoterResponse, error) GasPriceVoter(ctx context.Context, in *MsgGasPriceVoter, opts ...grpc.CallOption) (*MsgGasPriceVoterResponse, error) - NonceVoter(ctx context.Context, in *MsgNonceVoter, opts ...grpc.CallOption) (*MsgNonceVoterResponse, error) VoteOnObservedOutboundTx(ctx context.Context, in *MsgVoteOnObservedOutboundTx, opts ...grpc.CallOption) (*MsgVoteOnObservedOutboundTxResponse, error) VoteOnObservedInboundTx(ctx context.Context, in *MsgVoteOnObservedInboundTx, opts ...grpc.CallOption) (*MsgVoteOnObservedInboundTxResponse, error) WhitelistERC20(ctx context.Context, in *MsgWhitelistERC20, opts ...grpc.CallOption) (*MsgWhitelistERC20Response, error) UpdateTssAddress(ctx context.Context, in *MsgUpdateTssAddress, opts ...grpc.CallOption) (*MsgUpdateTssAddressResponse, error) MigrateTssFunds(ctx context.Context, in *MsgMigrateTssFunds, opts ...grpc.CallOption) (*MsgMigrateTssFundsResponse, error) + CreateTSSVoter(ctx context.Context, in *MsgCreateTSSVoter, opts ...grpc.CallOption) (*MsgCreateTSSVoterResponse, error) } type msgClient struct { @@ -1642,15 +1438,6 @@ func (c *msgClient) RemoveFromOutTxTracker(ctx context.Context, in *MsgRemoveFro return out, nil } -func (c *msgClient) CreateTSSVoter(ctx context.Context, in *MsgCreateTSSVoter, opts ...grpc.CallOption) (*MsgCreateTSSVoterResponse, error) { - out := new(MsgCreateTSSVoterResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Msg/CreateTSSVoter", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *msgClient) GasPriceVoter(ctx context.Context, in *MsgGasPriceVoter, opts ...grpc.CallOption) (*MsgGasPriceVoterResponse, error) { out := new(MsgGasPriceVoterResponse) err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Msg/GasPriceVoter", in, out, opts...) @@ -1660,15 +1447,6 @@ func (c *msgClient) GasPriceVoter(ctx context.Context, in *MsgGasPriceVoter, opt return out, nil } -func (c *msgClient) NonceVoter(ctx context.Context, in *MsgNonceVoter, opts ...grpc.CallOption) (*MsgNonceVoterResponse, error) { - out := new(MsgNonceVoterResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Msg/NonceVoter", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *msgClient) VoteOnObservedOutboundTx(ctx context.Context, in *MsgVoteOnObservedOutboundTx, opts ...grpc.CallOption) (*MsgVoteOnObservedOutboundTxResponse, error) { out := new(MsgVoteOnObservedOutboundTxResponse) err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Msg/VoteOnObservedOutboundTx", in, out, opts...) @@ -1714,19 +1492,27 @@ func (c *msgClient) MigrateTssFunds(ctx context.Context, in *MsgMigrateTssFunds, return out, nil } +func (c *msgClient) CreateTSSVoter(ctx context.Context, in *MsgCreateTSSVoter, opts ...grpc.CallOption) (*MsgCreateTSSVoterResponse, error) { + out := new(MsgCreateTSSVoterResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Msg/CreateTSSVoter", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { AddToOutTxTracker(context.Context, *MsgAddToOutTxTracker) (*MsgAddToOutTxTrackerResponse, error) AddToInTxTracker(context.Context, *MsgAddToInTxTracker) (*MsgAddToInTxTrackerResponse, error) RemoveFromOutTxTracker(context.Context, *MsgRemoveFromOutTxTracker) (*MsgRemoveFromOutTxTrackerResponse, error) - CreateTSSVoter(context.Context, *MsgCreateTSSVoter) (*MsgCreateTSSVoterResponse, error) GasPriceVoter(context.Context, *MsgGasPriceVoter) (*MsgGasPriceVoterResponse, error) - NonceVoter(context.Context, *MsgNonceVoter) (*MsgNonceVoterResponse, error) VoteOnObservedOutboundTx(context.Context, *MsgVoteOnObservedOutboundTx) (*MsgVoteOnObservedOutboundTxResponse, error) VoteOnObservedInboundTx(context.Context, *MsgVoteOnObservedInboundTx) (*MsgVoteOnObservedInboundTxResponse, error) WhitelistERC20(context.Context, *MsgWhitelistERC20) (*MsgWhitelistERC20Response, error) UpdateTssAddress(context.Context, *MsgUpdateTssAddress) (*MsgUpdateTssAddressResponse, error) MigrateTssFunds(context.Context, *MsgMigrateTssFunds) (*MsgMigrateTssFundsResponse, error) + CreateTSSVoter(context.Context, *MsgCreateTSSVoter) (*MsgCreateTSSVoterResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -1742,15 +1528,9 @@ func (*UnimplementedMsgServer) AddToInTxTracker(ctx context.Context, req *MsgAdd func (*UnimplementedMsgServer) RemoveFromOutTxTracker(ctx context.Context, req *MsgRemoveFromOutTxTracker) (*MsgRemoveFromOutTxTrackerResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RemoveFromOutTxTracker not implemented") } -func (*UnimplementedMsgServer) CreateTSSVoter(ctx context.Context, req *MsgCreateTSSVoter) (*MsgCreateTSSVoterResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateTSSVoter not implemented") -} func (*UnimplementedMsgServer) GasPriceVoter(ctx context.Context, req *MsgGasPriceVoter) (*MsgGasPriceVoterResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GasPriceVoter not implemented") } -func (*UnimplementedMsgServer) NonceVoter(ctx context.Context, req *MsgNonceVoter) (*MsgNonceVoterResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method NonceVoter not implemented") -} func (*UnimplementedMsgServer) VoteOnObservedOutboundTx(ctx context.Context, req *MsgVoteOnObservedOutboundTx) (*MsgVoteOnObservedOutboundTxResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method VoteOnObservedOutboundTx not implemented") } @@ -1766,6 +1546,9 @@ func (*UnimplementedMsgServer) UpdateTssAddress(ctx context.Context, req *MsgUpd func (*UnimplementedMsgServer) MigrateTssFunds(ctx context.Context, req *MsgMigrateTssFunds) (*MsgMigrateTssFundsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method MigrateTssFunds not implemented") } +func (*UnimplementedMsgServer) CreateTSSVoter(ctx context.Context, req *MsgCreateTSSVoter) (*MsgCreateTSSVoterResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateTSSVoter not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -1825,24 +1608,6 @@ func _Msg_RemoveFromOutTxTracker_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } -func _Msg_CreateTSSVoter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCreateTSSVoter) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).CreateTSSVoter(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Msg/CreateTSSVoter", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CreateTSSVoter(ctx, req.(*MsgCreateTSSVoter)) - } - return interceptor(ctx, in, info, handler) -} - func _Msg_GasPriceVoter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgGasPriceVoter) if err := dec(in); err != nil { @@ -1861,24 +1626,6 @@ func _Msg_GasPriceVoter_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } -func _Msg_NonceVoter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgNonceVoter) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).NonceVoter(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.crosschain.Msg/NonceVoter", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).NonceVoter(ctx, req.(*MsgNonceVoter)) - } - return interceptor(ctx, in, info, handler) -} - func _Msg_VoteOnObservedOutboundTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgVoteOnObservedOutboundTx) if err := dec(in); err != nil { @@ -1969,6 +1716,24 @@ func _Msg_MigrateTssFunds_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _Msg_CreateTSSVoter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateTSSVoter) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateTSSVoter(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.crosschain.Msg/CreateTSSVoter", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateTSSVoter(ctx, req.(*MsgCreateTSSVoter)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "zetachain.zetacore.crosschain.Msg", HandlerType: (*MsgServer)(nil), @@ -1985,18 +1750,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "RemoveFromOutTxTracker", Handler: _Msg_RemoveFromOutTxTracker_Handler, }, - { - MethodName: "CreateTSSVoter", - Handler: _Msg_CreateTSSVoter_Handler, - }, { MethodName: "GasPriceVoter", Handler: _Msg_GasPriceVoter_Handler, }, - { - MethodName: "NonceVoter", - Handler: _Msg_NonceVoter_Handler, - }, { MethodName: "VoteOnObservedOutboundTx", Handler: _Msg_VoteOnObservedOutboundTx_Handler, @@ -2017,12 +1774,154 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "MigrateTssFunds", Handler: _Msg_MigrateTssFunds_Handler, }, + { + MethodName: "CreateTSSVoter", + Handler: _Msg_CreateTSSVoter_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "crosschain/tx.proto", } -func (m *MsgMigrateTssFunds) Marshal() (dAtA []byte, err error) { +func (m *MsgCreateTSSVoter) 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 *MsgCreateTSSVoter) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateTSSVoter) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Status != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x20 + } + if m.KeyGenZetaHeight != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.KeyGenZetaHeight)) + i-- + dAtA[i] = 0x18 + } + if len(m.TssPubkey) > 0 { + i -= len(m.TssPubkey) + copy(dAtA[i:], m.TssPubkey) + i = encodeVarintTx(dAtA, i, uint64(len(m.TssPubkey))) + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateTSSVoterResponse) 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 *MsgCreateTSSVoterResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateTSSVoterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgMigrateTssFunds) 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 *MsgMigrateTssFunds) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMigrateTssFunds) 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] = 0x1a + if m.ChainId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ChainId)) + i-- + dAtA[i] = 0x10 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgMigrateTssFundsResponse) 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 *MsgMigrateTssFundsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMigrateTssFundsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateTssAddress) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2032,30 +1931,22 @@ func (m *MsgMigrateTssFunds) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgMigrateTssFunds) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateTssAddress) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgMigrateTssFunds) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateTssAddress) 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] = 0x1a - if m.ChainId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.ChainId)) + if len(m.TssPubkey) > 0 { + i -= len(m.TssPubkey) + copy(dAtA[i:], m.TssPubkey) + i = encodeVarintTx(dAtA, i, uint64(len(m.TssPubkey))) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x12 } if len(m.Creator) > 0 { i -= len(m.Creator) @@ -2067,7 +1958,7 @@ func (m *MsgMigrateTssFunds) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgMigrateTssFundsResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateTssAddressResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2077,12 +1968,12 @@ func (m *MsgMigrateTssFundsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgMigrateTssFundsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateTssAddressResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgMigrateTssFundsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateTssAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2184,66 +2075,6 @@ func (m *MsgAddToInTxTrackerResponse) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } -func (m *MsgUpdateTssAddress) 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 *MsgUpdateTssAddress) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateTssAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.TssPubkey) > 0 { - i -= len(m.TssPubkey) - copy(dAtA[i:], m.TssPubkey) - i = encodeVarintTx(dAtA, i, uint64(len(m.TssPubkey))) - i-- - dAtA[i] = 0x12 - } - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgUpdateTssAddressResponse) 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 *MsgUpdateTssAddressResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateTssAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - func (m *MsgWhitelistERC20) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2506,152 +2337,7 @@ func (m *MsgRemoveFromOutTxTrackerResponse) MarshalTo(dAtA []byte) (int, error) return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgRemoveFromOutTxTrackerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgCreateTSSVoter) 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 *MsgCreateTSSVoter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateTSSVoter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Status != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Status)) - i-- - dAtA[i] = 0x20 - } - if m.KeyGenZetaHeight != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.KeyGenZetaHeight)) - i-- - dAtA[i] = 0x18 - } - if len(m.TssPubkey) > 0 { - i -= len(m.TssPubkey) - copy(dAtA[i:], m.TssPubkey) - i = encodeVarintTx(dAtA, i, uint64(len(m.TssPubkey))) - i-- - dAtA[i] = 0x12 - } - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgCreateTSSVoterResponse) 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 *MsgCreateTSSVoterResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateTSSVoterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgGasPriceVoter) 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 *MsgGasPriceVoter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgGasPriceVoter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Supply) > 0 { - i -= len(m.Supply) - copy(dAtA[i:], m.Supply) - i = encodeVarintTx(dAtA, i, uint64(len(m.Supply))) - i-- - dAtA[i] = 0x2a - } - if m.BlockNumber != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.BlockNumber)) - i-- - dAtA[i] = 0x20 - } - if m.Price != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Price)) - i-- - dAtA[i] = 0x18 - } - if m.ChainId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.ChainId)) - i-- - dAtA[i] = 0x10 - } - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgGasPriceVoterResponse) 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 *MsgGasPriceVoterResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgGasPriceVoterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgRemoveFromOutTxTrackerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2659,7 +2345,7 @@ func (m *MsgGasPriceVoterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *MsgNonceVoter) Marshal() (dAtA []byte, err error) { +func (m *MsgGasPriceVoter) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2669,18 +2355,30 @@ func (m *MsgNonceVoter) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgNonceVoter) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgGasPriceVoter) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgNonceVoter) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgGasPriceVoter) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Nonce != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Nonce)) + if len(m.Supply) > 0 { + i -= len(m.Supply) + copy(dAtA[i:], m.Supply) + i = encodeVarintTx(dAtA, i, uint64(len(m.Supply))) + i-- + dAtA[i] = 0x2a + } + if m.BlockNumber != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.BlockNumber)) + i-- + dAtA[i] = 0x20 + } + if m.Price != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Price)) i-- dAtA[i] = 0x18 } @@ -2699,7 +2397,7 @@ func (m *MsgNonceVoter) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgNonceVoterResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgGasPriceVoterResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2709,12 +2407,12 @@ func (m *MsgNonceVoterResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgNonceVoterResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgGasPriceVoterResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgNonceVoterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgGasPriceVoterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2979,89 +2677,49 @@ func (m *MsgVoteOnObservedInboundTxResponse) MarshalToSizedBuffer(dAtA []byte) ( return len(dAtA) - i, nil } -func (m *MsgSetNodeKeys) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ } - return dAtA[:n], nil -} - -func (m *MsgSetNodeKeys) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + dAtA[offset] = uint8(v) + return base } - -func (m *MsgSetNodeKeys) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *MsgCreateTSSVoter) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - if len(m.TssSigner_Address) > 0 { - i -= len(m.TssSigner_Address) - copy(dAtA[i:], m.TssSigner_Address) - i = encodeVarintTx(dAtA, i, uint64(len(m.TssSigner_Address))) - i-- - dAtA[i] = 0x1a + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) } - if m.PubkeySet != nil { - { - size, err := m.PubkeySet.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 + l = len(m.TssPubkey) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) } - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) - i-- - dAtA[i] = 0xa + if m.KeyGenZetaHeight != 0 { + n += 1 + sovTx(uint64(m.KeyGenZetaHeight)) } - return len(dAtA) - i, nil -} - -func (m *MsgSetNodeKeysResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if m.Status != 0 { + n += 1 + sovTx(uint64(m.Status)) } - return dAtA[:n], nil -} - -func (m *MsgSetNodeKeysResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return n } -func (m *MsgSetNodeKeysResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *MsgCreateTSSVoterResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - return len(dAtA) - i, nil + return n } -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} func (m *MsgMigrateTssFunds) Size() (n int) { if m == nil { return 0 @@ -3089,7 +2747,7 @@ func (m *MsgMigrateTssFundsResponse) Size() (n int) { return n } -func (m *MsgAddToInTxTracker) Size() (n int) { +func (m *MsgUpdateTssAddress) Size() (n int) { if m == nil { return 0 } @@ -3099,31 +2757,14 @@ func (m *MsgAddToInTxTracker) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.ChainId != 0 { - n += 1 + sovTx(uint64(m.ChainId)) - } - l = len(m.TxHash) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.CoinType != 0 { - n += 1 + sovTx(uint64(m.CoinType)) - } - if m.Proof != nil { - l = m.Proof.Size() - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.BlockHash) + l = len(m.TssPubkey) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.TxIndex != 0 { - n += 1 + sovTx(uint64(m.TxIndex)) - } return n } -func (m *MsgAddToInTxTrackerResponse) Size() (n int) { +func (m *MsgUpdateTssAddressResponse) Size() (n int) { if m == nil { return 0 } @@ -3132,7 +2773,7 @@ func (m *MsgAddToInTxTrackerResponse) Size() (n int) { return n } -func (m *MsgUpdateTssAddress) Size() (n int) { +func (m *MsgAddToInTxTracker) Size() (n int) { if m == nil { return 0 } @@ -3142,14 +2783,31 @@ func (m *MsgUpdateTssAddress) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.TssPubkey) + if m.ChainId != 0 { + n += 1 + sovTx(uint64(m.ChainId)) + } + l = len(m.TxHash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.CoinType != 0 { + n += 1 + sovTx(uint64(m.CoinType)) + } + if m.Proof != nil { + l = m.Proof.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.BlockHash) if l > 0 { n += 1 + l + sovTx(uint64(l)) } + if m.TxIndex != 0 { + n += 1 + sovTx(uint64(m.TxIndex)) + } return n } -func (m *MsgUpdateTssAddressResponse) Size() (n int) { +func (m *MsgAddToInTxTrackerResponse) Size() (n int) { if m == nil { return 0 } @@ -3283,38 +2941,6 @@ func (m *MsgRemoveFromOutTxTrackerResponse) Size() (n int) { return n } -func (m *MsgCreateTSSVoter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.TssPubkey) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.KeyGenZetaHeight != 0 { - n += 1 + sovTx(uint64(m.KeyGenZetaHeight)) - } - if m.Status != 0 { - n += 1 + sovTx(uint64(m.Status)) - } - return n -} - -func (m *MsgCreateTSSVoterResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - func (m *MsgGasPriceVoter) Size() (n int) { if m == nil { return 0 @@ -3350,34 +2976,6 @@ func (m *MsgGasPriceVoterResponse) Size() (n int) { return n } -func (m *MsgNonceVoter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.ChainId != 0 { - n += 1 + sovTx(uint64(m.ChainId)) - } - if m.Nonce != 0 { - n += 1 + sovTx(uint64(m.Nonce)) - } - return n -} - -func (m *MsgNonceVoterResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - func (m *MsgVoteOnObservedOutboundTx) Size() (n int) { if m == nil { return 0 @@ -3458,69 +3056,39 @@ func (m *MsgVoteOnObservedInboundTx) Size() (n int) { n += 1 + sovTx(uint64(m.ReceiverChain)) } l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.Message) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.InTxHash) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.InBlockHeight != 0 { - n += 1 + sovTx(uint64(m.InBlockHeight)) - } - if m.GasLimit != 0 { - n += 1 + sovTx(uint64(m.GasLimit)) - } - if m.CoinType != 0 { - n += 1 + sovTx(uint64(m.CoinType)) - } - l = len(m.TxOrigin) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Asset) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.EventIndex != 0 { - n += 1 + sovTx(uint64(m.EventIndex)) - } - return n -} - -func (m *MsgVoteOnObservedInboundTxResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgSetNodeKeys) Size() (n int) { - if m == nil { - return 0 + n += 1 + l + sovTx(uint64(l)) + l = len(m.Message) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) } - var l int - _ = l - l = len(m.Creator) + l = len(m.InTxHash) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.PubkeySet != nil { - l = m.PubkeySet.Size() + if m.InBlockHeight != 0 { + n += 1 + sovTx(uint64(m.InBlockHeight)) + } + if m.GasLimit != 0 { + n += 1 + sovTx(uint64(m.GasLimit)) + } + if m.CoinType != 0 { + n += 1 + sovTx(uint64(m.CoinType)) + } + l = len(m.TxOrigin) + if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.TssSigner_Address) + l = len(m.Asset) if l > 0 { n += 1 + l + sovTx(uint64(l)) } + if m.EventIndex != 0 { + n += 1 + sovTx(uint64(m.EventIndex)) + } return n } -func (m *MsgSetNodeKeysResponse) Size() (n int) { +func (m *MsgVoteOnObservedInboundTxResponse) Size() (n int) { if m == nil { return 0 } @@ -3535,7 +3103,7 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgMigrateTssFunds) Unmarshal(dAtA []byte) error { +func (m *MsgCreateTSSVoter) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3558,10 +3126,10 @@ func (m *MsgMigrateTssFunds) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgMigrateTssFunds: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCreateTSSVoter: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMigrateTssFunds: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCreateTSSVoter: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3597,10 +3165,10 @@ func (m *MsgMigrateTssFunds) Unmarshal(dAtA []byte) error { m.Creator = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TssPubkey", wireType) } - m.ChainId = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3610,16 +3178,29 @@ func (m *MsgMigrateTssFunds) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ChainId |= int64(b&0x7F) << shift + 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.TssPubkey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field KeyGenZetaHeight", wireType) } - var stringLen uint64 + m.KeyGenZetaHeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3629,26 +3210,30 @@ func (m *MsgMigrateTssFunds) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.KeyGenZetaHeight |= int64(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 + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= common.ReceiveStatus(b&0x7F) << shift + if b < 0x80 { + break + } } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3670,7 +3255,7 @@ func (m *MsgMigrateTssFunds) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgMigrateTssFundsResponse) Unmarshal(dAtA []byte) error { +func (m *MsgCreateTSSVoterResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3693,10 +3278,10 @@ func (m *MsgMigrateTssFundsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgMigrateTssFundsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCreateTSSVoterResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMigrateTssFundsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCreateTSSVoterResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3720,7 +3305,7 @@ func (m *MsgMigrateTssFundsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgAddToInTxTracker) Unmarshal(dAtA []byte) error { +func (m *MsgMigrateTssFunds) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3743,10 +3328,10 @@ func (m *MsgAddToInTxTracker) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgAddToInTxTracker: wiretype end group for non-group") + return fmt.Errorf("proto: MsgMigrateTssFunds: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddToInTxTracker: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgMigrateTssFunds: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3802,7 +3387,7 @@ func (m *MsgAddToInTxTracker) Unmarshal(dAtA []byte) error { } case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3830,114 +3415,10 @@ func (m *MsgAddToInTxTracker) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TxHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CoinType", wireType) - } - m.CoinType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CoinType |= common.CoinType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Proof == nil { - m.Proof = &common.Proof{} - } - if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", 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.BlockHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TxIndex", wireType) - } - m.TxIndex = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TxIndex |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -3959,7 +3440,7 @@ func (m *MsgAddToInTxTracker) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgAddToInTxTrackerResponse) Unmarshal(dAtA []byte) error { +func (m *MsgMigrateTssFundsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3982,10 +3463,10 @@ func (m *MsgAddToInTxTrackerResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgAddToInTxTrackerResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgMigrateTssFundsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddToInTxTrackerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgMigrateTssFundsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -4173,7 +3654,7 @@ func (m *MsgUpdateTssAddressResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgWhitelistERC20) Unmarshal(dAtA []byte) error { +func (m *MsgAddToInTxTracker) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4196,10 +3677,10 @@ func (m *MsgWhitelistERC20) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgWhitelistERC20: wiretype end group for non-group") + return fmt.Errorf("proto: MsgAddToInTxTracker: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWhitelistERC20: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgAddToInTxTracker: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4235,8 +3716,27 @@ func (m *MsgWhitelistERC20) Unmarshal(dAtA []byte) error { m.Creator = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + m.ChainId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ChainId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Erc20Address", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4264,13 +3764,13 @@ func (m *MsgWhitelistERC20) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Erc20Address = string(dAtA[iNdEx:postIndex]) + m.TxHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CoinType", wireType) } - m.ChainId = 0 + m.CoinType = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -4280,16 +3780,16 @@ func (m *MsgWhitelistERC20) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ChainId |= int64(b&0x7F) << shift + m.CoinType |= common.CoinType(b&0x7F) << shift if b < 0x80 { break } } - case 4: + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -4299,27 +3799,31 @@ func (m *MsgWhitelistERC20) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Name = string(dAtA[iNdEx:postIndex]) + if m.Proof == nil { + m.Proof = &common.Proof{} + } + if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 5: + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4347,32 +3851,13 @@ func (m *MsgWhitelistERC20) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Symbol = string(dAtA[iNdEx:postIndex]) + m.BlockHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Decimals", wireType) - } - m.Decimals = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Decimals |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } case 7: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TxIndex", wireType) } - m.GasLimit = 0 + m.TxIndex = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -4382,7 +3867,7 @@ func (m *MsgWhitelistERC20) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.GasLimit |= int64(b&0x7F) << shift + m.TxIndex |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -4408,7 +3893,7 @@ func (m *MsgWhitelistERC20) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgWhitelistERC20Response) Unmarshal(dAtA []byte) error { +func (m *MsgAddToInTxTrackerResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4431,76 +3916,12 @@ func (m *MsgWhitelistERC20Response) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgWhitelistERC20Response: wiretype end group for non-group") + return fmt.Errorf("proto: MsgAddToInTxTrackerResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWhitelistERC20Response: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgAddToInTxTrackerResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Zrc20Address", 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.Zrc20Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CctxIndex", 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.CctxIndex = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -4522,7 +3943,7 @@ func (m *MsgWhitelistERC20Response) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgAddToOutTxTracker) Unmarshal(dAtA []byte) error { +func (m *MsgWhitelistERC20) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4545,10 +3966,10 @@ func (m *MsgAddToOutTxTracker) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgAddToOutTxTracker: wiretype end group for non-group") + return fmt.Errorf("proto: MsgWhitelistERC20: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddToOutTxTracker: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgWhitelistERC20: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4584,10 +4005,10 @@ func (m *MsgAddToOutTxTracker) Unmarshal(dAtA []byte) error { m.Creator = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Erc20Address", wireType) } - m.ChainId = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -4597,16 +4018,29 @@ func (m *MsgAddToOutTxTracker) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ChainId |= int64(b&0x7F) << shift + 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.Erc20Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) } - m.Nonce = 0 + m.ChainId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -4616,14 +4050,14 @@ func (m *MsgAddToOutTxTracker) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Nonce |= uint64(b&0x7F) << shift + m.ChainId |= int64(b&0x7F) << shift if b < 0x80 { break } } case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4651,13 +4085,13 @@ func (m *MsgAddToOutTxTracker) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TxHash = string(dAtA[iNdEx:postIndex]) + m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -4667,33 +4101,29 @@ func (m *MsgAddToOutTxTracker) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Proof == nil { - m.Proof = &common.Proof{} - } - if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Symbol = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Decimals", wireType) } - var stringLen uint64 + m.Decimals = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -4703,29 +4133,16 @@ func (m *MsgAddToOutTxTracker) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.Decimals |= uint32(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.BlockHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 7: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TxIndex", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType) } - m.TxIndex = 0 + m.GasLimit = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -4735,7 +4152,7 @@ func (m *MsgAddToOutTxTracker) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TxIndex |= int64(b&0x7F) << shift + m.GasLimit |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -4761,7 +4178,7 @@ func (m *MsgAddToOutTxTracker) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgAddToOutTxTrackerResponse) Unmarshal(dAtA []byte) error { +func (m *MsgWhitelistERC20Response) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4784,17 +4201,17 @@ func (m *MsgAddToOutTxTrackerResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgAddToOutTxTrackerResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgWhitelistERC20Response: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddToOutTxTrackerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgWhitelistERC20Response: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsRemoved", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Zrc20Address", wireType) } - var v int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -4804,12 +4221,56 @@ func (m *MsgAddToOutTxTrackerResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + 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.Zrc20Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CctxIndex", 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 } } - m.IsRemoved = bool(v != 0) + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CctxIndex = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -4831,7 +4292,7 @@ func (m *MsgAddToOutTxTrackerResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgRemoveFromOutTxTracker) Unmarshal(dAtA []byte) error { +func (m *MsgAddToOutTxTracker) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4854,10 +4315,10 @@ func (m *MsgRemoveFromOutTxTracker) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgRemoveFromOutTxTracker: wiretype end group for non-group") + return fmt.Errorf("proto: MsgAddToOutTxTracker: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRemoveFromOutTxTracker: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgAddToOutTxTracker: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4930,109 +4391,9 @@ func (m *MsgRemoveFromOutTxTracker) Unmarshal(dAtA []byte) error { break } } - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgRemoveFromOutTxTrackerResponse) 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: MsgRemoveFromOutTxTrackerResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRemoveFromOutTxTrackerResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgCreateTSSVoter) 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: MsgCreateTSSVoter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateTSSVoter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5060,13 +4421,13 @@ func (m *MsgCreateTSSVoter) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Creator = string(dAtA[iNdEx:postIndex]) + m.TxHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TssPubkey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -5076,29 +4437,33 @@ func (m *MsgCreateTSSVoter) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.TssPubkey = string(dAtA[iNdEx:postIndex]) + if m.Proof == nil { + m.Proof = &common.Proof{} + } + if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field KeyGenZetaHeight", wireType) + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) } - m.KeyGenZetaHeight = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -5108,16 +4473,29 @@ func (m *MsgCreateTSSVoter) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.KeyGenZetaHeight |= int64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - case 4: + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlockHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TxIndex", wireType) } - m.Status = 0 + m.TxIndex = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -5127,7 +4505,7 @@ func (m *MsgCreateTSSVoter) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Status |= common.ReceiveStatus(b&0x7F) << shift + m.TxIndex |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -5153,7 +4531,7 @@ func (m *MsgCreateTSSVoter) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCreateTSSVoterResponse) Unmarshal(dAtA []byte) error { +func (m *MsgAddToOutTxTrackerResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5176,12 +4554,32 @@ func (m *MsgCreateTSSVoterResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreateTSSVoterResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgAddToOutTxTrackerResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateTSSVoterResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgAddToOutTxTrackerResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsRemoved", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsRemoved = bool(v != 0) default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -5203,7 +4601,7 @@ func (m *MsgCreateTSSVoterResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgGasPriceVoter) Unmarshal(dAtA []byte) error { +func (m *MsgRemoveFromOutTxTracker) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5226,10 +4624,10 @@ func (m *MsgGasPriceVoter) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgGasPriceVoter: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRemoveFromOutTxTracker: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgGasPriceVoter: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRemoveFromOutTxTracker: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -5285,47 +4683,9 @@ func (m *MsgGasPriceVoter) Unmarshal(dAtA []byte) error { } case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) - } - m.Price = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Price |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) - } - m.BlockNumber = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BlockNumber |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Supply", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) } - var stringLen uint64 + m.Nonce = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -5335,24 +4695,11 @@ func (m *MsgGasPriceVoter) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.Nonce |= 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.Supply = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -5374,7 +4721,7 @@ func (m *MsgGasPriceVoter) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgGasPriceVoterResponse) Unmarshal(dAtA []byte) error { +func (m *MsgRemoveFromOutTxTrackerResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5397,10 +4744,10 @@ func (m *MsgGasPriceVoterResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgGasPriceVoterResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRemoveFromOutTxTrackerResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgGasPriceVoterResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRemoveFromOutTxTrackerResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -5424,7 +4771,7 @@ func (m *MsgGasPriceVoterResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgNonceVoter) Unmarshal(dAtA []byte) error { +func (m *MsgGasPriceVoter) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5447,10 +4794,10 @@ func (m *MsgNonceVoter) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgNonceVoter: wiretype end group for non-group") + return fmt.Errorf("proto: MsgGasPriceVoter: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgNonceVoter: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgGasPriceVoter: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -5506,9 +4853,9 @@ func (m *MsgNonceVoter) Unmarshal(dAtA []byte) error { } case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) } - m.Nonce = 0 + m.Price = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -5518,11 +4865,62 @@ func (m *MsgNonceVoter) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Nonce |= uint64(b&0x7F) << shift + m.Price |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) + } + m.BlockNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Supply", 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.Supply = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -5544,7 +4942,7 @@ func (m *MsgNonceVoter) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgNonceVoterResponse) Unmarshal(dAtA []byte) error { +func (m *MsgGasPriceVoterResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5567,10 +4965,10 @@ func (m *MsgNonceVoterResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgNonceVoterResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgGasPriceVoterResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgNonceVoterResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgGasPriceVoterResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -6463,206 +5861,6 @@ func (m *MsgVoteOnObservedInboundTxResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSetNodeKeys) 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: MsgSetNodeKeys: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSetNodeKeys: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", 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.Creator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubkeySet", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PubkeySet == nil { - m.PubkeySet = &common.PubKeySet{} - } - if err := m.PubkeySet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TssSigner_Address", 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.TssSigner_Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgSetNodeKeysResponse) 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: MsgSetNodeKeysResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSetNodeKeysResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/emissions/client/tests/suite.go b/x/emissions/client/tests/suite.go index b59adf9483..2baea8a338 100644 --- a/x/emissions/client/tests/suite.go +++ b/x/emissions/client/tests/suite.go @@ -53,7 +53,7 @@ func (s *CliTestSuite) SetupSuite() { } network.SetupZetaGenesisState(s.T(), s.cfg.GenesisState, s.cfg.Codec, observerList, false) s.ballots = RandomBallotGenerator(20, observerList) - network.AddObserverData(s.T(), s.cfg.GenesisState, s.cfg.Codec, s.ballots) + network.AddObserverData(s.T(), 2, s.cfg.GenesisState, s.cfg.Codec, s.ballots) net, err := network.New(s.T(), app.NodeDir, s.cfg) s.Assert().NoError(err) diff --git a/x/fungible/client/cli/query.go b/x/fungible/client/cli/query.go index f0498d44b8..2fcda320d5 100644 --- a/x/fungible/client/cli/query.go +++ b/x/fungible/client/cli/query.go @@ -27,6 +27,7 @@ func GetQueryCmd(_ string) *cobra.Command { CmdGasStabilityPoolBalance(), CmdGasStabilityPoolBalances(), CmdSystemContract(), + CmdQueryCodeHash(), ) return cmd diff --git a/x/fungible/client/cli/query_code_hash.go b/x/fungible/client/cli/query_code_hash.go new file mode 100644 index 0000000000..460fd7a414 --- /dev/null +++ b/x/fungible/client/cli/query_code_hash.go @@ -0,0 +1,36 @@ +package cli + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + "github.com/zeta-chain/zetacore/x/fungible/types" +) + +func CmdQueryCodeHash() *cobra.Command { + cmd := &cobra.Command{ + Use: "code-hash [address]", + Short: "shows the code hash of an account", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.CodeHash(context.Background(), &types.QueryCodeHashRequest{ + Address: args[0], + }) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/fungible/client/cli/tx.go b/x/fungible/client/cli/tx.go index 9b347fad35..64e0edda8f 100644 --- a/x/fungible/client/cli/tx.go +++ b/x/fungible/client/cli/tx.go @@ -19,9 +19,12 @@ func GetTxCmd() *cobra.Command { } cmd.AddCommand( + CmdDeploySystemContracts(), CmdDeployFungibleCoinZRC4(), CmdRemoveForeignCoin(), CmdUpdateZRC20LiquidityCap(), + CmdUpdateSystemContract(), + CmdUpdateContractBytecode(), ) return cmd diff --git a/x/fungible/client/cli/tx_deploy_fungible_coin_zrc_4.go b/x/fungible/client/cli/tx_deploy_fungible_coin_zrc_4.go index 3a82f7c75f..2697f7f293 100644 --- a/x/fungible/client/cli/tx_deploy_fungible_coin_zrc_4.go +++ b/x/fungible/client/cli/tx_deploy_fungible_coin_zrc_4.go @@ -17,7 +17,7 @@ func CmdDeployFungibleCoinZRC4() *cobra.Command { cmd := &cobra.Command{ Use: "deploy-fungible-coin-zrc-4 [erc-20] [foreign-chain] [decimals] [name] [symbol] [coin-type] [gas-limit]", Short: "Broadcast message DeployFungibleCoinZRC20", - Args: cobra.ExactArgs(6), + Args: cobra.ExactArgs(7), RunE: func(cmd *cobra.Command, args []string) (err error) { argERC20 := args[0] argForeignChain, err := strconv.ParseInt(args[1], 10, 32) diff --git a/x/fungible/client/cli/tx_deploy_system_contracts.go b/x/fungible/client/cli/tx_deploy_system_contracts.go new file mode 100644 index 0000000000..b8ed9dd9d2 --- /dev/null +++ b/x/fungible/client/cli/tx_deploy_system_contracts.go @@ -0,0 +1,34 @@ +package cli + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cobra" + "github.com/zeta-chain/zetacore/x/fungible/types" +) + +func CmdDeploySystemContracts() *cobra.Command { + cmd := &cobra.Command{ + Use: "deploy-system-contracts", + Short: "Broadcast message SystemContracts", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + msg := types.NewMsgDeploySystemContracts( + clientCtx.GetFromAddress().String(), + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/fungible/client/cli/tx_update_contract_bytecode.go b/x/fungible/client/cli/tx_update_contract_bytecode.go new file mode 100644 index 0000000000..8a67cf505a --- /dev/null +++ b/x/fungible/client/cli/tx_update_contract_bytecode.go @@ -0,0 +1,38 @@ +package cli + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cobra" + "github.com/zeta-chain/zetacore/x/fungible/types" +) + +func CmdUpdateContractBytecode() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-contract-bytecode [contract-address] [new-code-hash]", + Short: "Broadcast message UpdateContractBytecode", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) (err error) { + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgUpdateContractBytecode( + clientCtx.GetFromAddress().String(), + args[0], + args[1], + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/fungible/client/cli/tx_update_update_system_contract.go b/x/fungible/client/cli/tx_update_update_system_contract.go new file mode 100644 index 0000000000..2f30a528e9 --- /dev/null +++ b/x/fungible/client/cli/tx_update_update_system_contract.go @@ -0,0 +1,35 @@ +package cli + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cobra" + "github.com/zeta-chain/zetacore/x/fungible/types" +) + +func CmdUpdateSystemContract() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-system-contract [contract-address] ", + Short: "Broadcast message UpdateSystemContract", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + fmt.Printf("CLI address: %s\n", clientCtx.GetFromAddress().String()) + msg := types.NewMsgUpdateSystemContract(clientCtx.GetFromAddress().String(), args[0]) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/fungible/keeper/begin_blocker_deploy_system_contracts.go b/x/fungible/keeper/begin_blocker_deploy_system_contracts.go deleted file mode 100644 index 8425f4e9a0..0000000000 --- a/x/fungible/keeper/begin_blocker_deploy_system_contracts.go +++ /dev/null @@ -1,18 +0,0 @@ -//go:build !PRIVNET && !TESTNET && !MOCK_MAINNET -// +build !PRIVNET,!TESTNET,!MOCK_MAINNET - -package keeper - -import ( - "context" -) - -func (k Keeper) BlockOneDeploySystemContracts(_ context.Context) error { - return nil -} -func (k Keeper) TestUpdateSystemContractAddress(_ context.Context) error { - return nil -} -func (k Keeper) TestUpdateZRC20WithdrawFee(_ context.Context) error { - return nil -} diff --git a/x/fungible/keeper/begin_blocker_deploy_system_contracts_mock_mainnet.go b/x/fungible/keeper/begin_blocker_deploy_system_contracts_mock_mainnet.go deleted file mode 100644 index d5e3021e25..0000000000 --- a/x/fungible/keeper/begin_blocker_deploy_system_contracts_mock_mainnet.go +++ /dev/null @@ -1,100 +0,0 @@ -//go:build MOCK_MAINNET -// +build MOCK_MAINNET - -package keeper - -import ( - "context" - "fmt" - - errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/zeta-chain/zetacore/common" -) - -func (k Keeper) BlockOneDeploySystemContracts(goCtx context.Context) error { - ctx := sdk.UnwrapSDKContext(goCtx) - - // setup uniswap v2 factory - uniswapV2Factory, err := k.DeployUniswapV2Factory(ctx) - if err != nil { - return sdkerrors.Wrapf(err, "failed to DeployUniswapV2Factory") - } - ctx.EventManager().EmitEvent( - sdk.NewEvent(sdk.EventTypeMessage, - sdk.NewAttribute("UniswapV2Factory", uniswapV2Factory.String()), - ), - ) - - // setup WZETA contract - wzeta, err := k.DeployWZETA(ctx) - if err != nil { - return sdkerrors.Wrapf(err, "failed to DeployWZetaContract") - } - ctx.EventManager().EmitEvent( - sdk.NewEvent(sdk.EventTypeMessage, - sdk.NewAttribute("DeployWZetaContract", wzeta.String()), - ), - ) - - router, err := k.DeployUniswapV2Router02(ctx, uniswapV2Factory, wzeta) - if err != nil { - return sdkerrors.Wrapf(err, "failed to DeployUniswapV2Router02") - } - ctx.EventManager().EmitEvent( - sdk.NewEvent(sdk.EventTypeMessage, - sdk.NewAttribute("DeployUniswapV2Router02", router.String()), - ), - ) - - connector, err := k.DeployConnectorZEVM(ctx, wzeta) - if err != nil { - return sdkerrors.Wrapf(err, "failed to DeployConnectorZEVM") - } - ctx.EventManager().EmitEvent( - sdk.NewEvent(sdk.EventTypeMessage, - sdk.NewAttribute("DeployConnectorZEVM", connector.String()), - ), - ) - ctx.Logger().Info("Deployed Connector ZEVM at " + connector.String()) - - SystemContractAddress, err := k.DeploySystemContract(ctx, wzeta, uniswapV2Factory, router) - if err != nil { - return sdkerrors.Wrapf(err, "failed to SystemContractAddress") - } - ctx.EventManager().EmitEvent( - sdk.NewEvent(sdk.EventTypeMessage, - sdk.NewAttribute("SystemContractAddress", SystemContractAddress.String()), - ), - ) - - // set the system contract - system, _ := k.GetSystemContract(ctx) - system.SystemContract = SystemContractAddress.String() - k.SetSystemContract(ctx, system) - //err = k.SetGasPrice(ctx, big.NewInt(1337), big.NewInt(1)) - if err != nil { - return err - } - _, err = k.SetupChainGasCoinAndPool(ctx, common.EthChain().ChainId, "ETH", "ETH", 18, nil) - if err != nil { - return errorsmod.Wrapf(err, fmt.Sprintf("failed to setupChainGasCoinAndPool for %s", common.EthChain().ChainName)) - } - - _, err = k.SetupChainGasCoinAndPool(ctx, common.BscMainnetChain().ChainId, "BNB", "BNB", 18, nil) - if err != nil { - return errorsmod.Wrapf(err, fmt.Sprintf("failed to setupChainGasCoinAndPool for %s", common.BscMainnetChain().ChainName)) - } - _, err = k.SetupChainGasCoinAndPool(ctx, common.BtcMainnetChain().ChainId, "BTC", "BTC", 8, nil) - if err != nil { - return errorsmod.Wrapf(err, fmt.Sprintf("failed to setupChainGasCoinAndPool for %s", common.BtcMainnetChain().ChainName)) - } - return nil -} -func (k Keeper) TestUpdateSystemContractAddress(_ context.Context) error { - return nil -} -func (k Keeper) TestUpdateZRC20WithdrawFee(_ context.Context) error { - return nil -} diff --git a/x/fungible/keeper/begin_blocker_deploy_system_contracts_privnet.go b/x/fungible/keeper/begin_blocker_deploy_system_contracts_privnet.go deleted file mode 100644 index cbcedd747b..0000000000 --- a/x/fungible/keeper/begin_blocker_deploy_system_contracts_privnet.go +++ /dev/null @@ -1,166 +0,0 @@ -//go:build PRIVNET - -package keeper - -import ( - "context" - "fmt" - "math/big" - - "cosmossdk.io/math" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/x/fungible/types" - observertypes "github.com/zeta-chain/zetacore/x/observer/types" -) - -// This is for privnet/testnet only -func (k Keeper) BlockOneDeploySystemContracts(goCtx context.Context) error { - ctx := sdk.UnwrapSDKContext(goCtx) - - // setup uniswap v2 factory - uniswapV2Factory, err := k.DeployUniswapV2Factory(ctx) - if err != nil { - return sdkerrors.Wrapf(err, "failed to DeployUniswapV2Factory") - } - ctx.EventManager().EmitEvent( - sdk.NewEvent(sdk.EventTypeMessage, - sdk.NewAttribute("UniswapV2Factory", uniswapV2Factory.String()), - ), - ) - - // setup WZETA contract - wzeta, err := k.DeployWZETA(ctx) - if err != nil { - return sdkerrors.Wrapf(err, "failed to DeployWZetaContract") - } - ctx.EventManager().EmitEvent( - sdk.NewEvent(sdk.EventTypeMessage, - sdk.NewAttribute("DeployWZetaContract", wzeta.String()), - ), - ) - - router, err := k.DeployUniswapV2Router02(ctx, uniswapV2Factory, wzeta) - if err != nil { - return sdkerrors.Wrapf(err, "failed to DeployUniswapV2Router02") - } - ctx.EventManager().EmitEvent( - sdk.NewEvent(sdk.EventTypeMessage, - sdk.NewAttribute("DeployUniswapV2Router02", router.String()), - ), - ) - - connector, err := k.DeployConnectorZEVM(ctx, wzeta) - if err != nil { - return sdkerrors.Wrapf(err, "failed to DeployConnectorZEVM") - } - ctx.EventManager().EmitEvent( - sdk.NewEvent(sdk.EventTypeMessage, - sdk.NewAttribute("DeployConnectorZEVM", connector.String()), - ), - ) - ctx.Logger().Info("Deployed Connector ZEVM at " + connector.String()) - - SystemContractAddress, err := k.DeploySystemContract(ctx, wzeta, uniswapV2Factory, router) - if err != nil { - return sdkerrors.Wrapf(err, "failed to SystemContractAddress") - } - ctx.EventManager().EmitEvent( - sdk.NewEvent(sdk.EventTypeMessage, - sdk.NewAttribute("SystemContractAddress", SystemContractAddress.String()), - ), - ) - - // set the system contract - system, _ := k.GetSystemContract(ctx) - system.SystemContract = SystemContractAddress.String() - // FIXME: remove unnecessary SetGasPrice and setupChainGasCoinAndPool - k.SetSystemContract(ctx, system) - //err = k.SetGasPrice(ctx, big.NewInt(1337), big.NewInt(1)) - if err != nil { - return err - } - - ETHZRC20Addr, err := k.SetupChainGasCoinAndPool(ctx, common.GoerliChain().ChainId, "ETH", "gETH", 18, nil) - if err != nil { - return sdkerrors.Wrapf(err, "failed to setupChainGasCoinAndPool") - } - ctx.Logger().Info("Deployed ETH ZRC20 at " + ETHZRC20Addr.String()) - - BTCZRC20Addr, err := k.SetupChainGasCoinAndPool(ctx, common.BtcRegtestChain().ChainId, "BTC", "tBTC", 8, nil) - if err != nil { - return sdkerrors.Wrapf(err, "failed to setupChainGasCoinAndPool") - } - ctx.Logger().Info("Deployed BTC ZRC20 at " + BTCZRC20Addr.String()) - - //FIXME: clean up and config the above based on localnet/testnet/mainnet - - // for localnet only: USDT ZRC20 - USDTAddr := "0xff3135df4F2775f4091b81f4c7B6359CfA07862a" - USDTZRC20Addr, err := k.DeployZRC20Contract(ctx, "USDT", "USDT", uint8(6), common.GoerliChain().ChainId, common.CoinType_ERC20, USDTAddr, big.NewInt(90_000)) - if err != nil { - return sdkerrors.Wrapf(err, "failed to DeployZRC20Contract USDT") - } - ctx.Logger().Info("Deployed USDT ZRC20 at " + USDTZRC20Addr.String()) - // for localnet only: ZEVM Swap App - //ZEVMSwapAddress, err := k.DeployZEVMSwapApp(ctx, router, SystemContractAddress) - //if err != nil { - // return sdkerrors.Wrapf(err, "failed to deploy ZEVMSwapApp") - //} - //ctx.Logger().Info("Deployed ZEVM Swap App at " + ZEVMSwapAddress.String()) - fmt.Println("Successfully deployed contracts") - return nil -} - -func (k Keeper) TestUpdateSystemContractAddress(goCtx context.Context) error { - ctx := sdk.UnwrapSDKContext(goCtx) - msgServer := NewMsgServerImpl(k) - - wzeta, err := k.GetWZetaContractAddress(ctx) - if err != nil { - return sdkerrors.Wrap(err, "failed to GetWZetaContractAddress") - } - uniswapV2Factory, err := k.GetUniswapV2FactoryAddress(ctx) - if err != nil { - return sdkerrors.Wrap(err, "failed to GetUniswapv2FacotryAddress") - } - router, err := k.GetUniswapV2Router02Address(ctx) - if err != nil { - return sdkerrors.Wrap(err, "failed to GetUniswapV2Router02Address") - } - - SystemContractAddress, err := k.DeploySystemContract(ctx, wzeta, uniswapV2Factory, router) - if err != nil { - return sdkerrors.Wrapf(err, "failed to DeploySystemContract") - } - creator := k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(observertypes.Policy_Type_group1) - msg := types.NewMsgUpdateSystemContract(creator, SystemContractAddress.Hex()) - _, err = msgServer.UpdateSystemContract(ctx, msg) - k.Logger(ctx).Info("System contract updated", "new address", SystemContractAddress.String()) - return err -} - -func (k Keeper) TestUpdateZRC20WithdrawFee(goCtx context.Context) error { - ctx := sdk.UnwrapSDKContext(goCtx) - msgServer := NewMsgServerImpl(k) - - foreignCoins := k.GetAllForeignCoins(ctx) - creator := k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(observertypes.Policy_Type_group1) - - for _, foreignCoin := range foreignCoins { - msg := types.NewMsgUpdateZRC20WithdrawFee( - creator, - foreignCoin.Zrc20ContractAddress, - sdk.NewUint(uint64(foreignCoin.ForeignChainId)), - math.Uint{}, - ) - _, err := msgServer.UpdateZRC20WithdrawFee(ctx, msg) - if err != nil { - return err - } - } - - return nil -} diff --git a/x/fungible/keeper/begin_blocker_deploy_system_contracts_testnet.go b/x/fungible/keeper/begin_blocker_deploy_system_contracts_testnet.go deleted file mode 100644 index 5c19164ba0..0000000000 --- a/x/fungible/keeper/begin_blocker_deploy_system_contracts_testnet.go +++ /dev/null @@ -1,106 +0,0 @@ -//go:build TESTNET - -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/zeta-chain/zetacore/common" -) - -// This is for privnet/testnet only -func (k Keeper) BlockOneDeploySystemContracts(goCtx context.Context) error { - ctx := sdk.UnwrapSDKContext(goCtx) - - // setup uniswap v2 factory - uniswapV2Factory, err := k.DeployUniswapV2Factory(ctx) - if err != nil { - return sdkerrors.Wrapf(err, "failed to DeployUniswapV2Factory") - } - ctx.EventManager().EmitEvent( - sdk.NewEvent(sdk.EventTypeMessage, - sdk.NewAttribute("UniswapV2Factory", uniswapV2Factory.String()), - ), - ) - - // setup WZETA contract - wzeta, err := k.DeployWZETA(ctx) - if err != nil { - return sdkerrors.Wrapf(err, "failed to DeployWZetaContract") - } - ctx.EventManager().EmitEvent( - sdk.NewEvent(sdk.EventTypeMessage, - sdk.NewAttribute("DeployWZetaContract", wzeta.String()), - ), - ) - - router, err := k.DeployUniswapV2Router02(ctx, uniswapV2Factory, wzeta) - if err != nil { - return sdkerrors.Wrapf(err, "failed to DeployUniswapV2Router02") - } - ctx.EventManager().EmitEvent( - sdk.NewEvent(sdk.EventTypeMessage, - sdk.NewAttribute("DeployUniswapV2Router02", router.String()), - ), - ) - - connector, err := k.DeployConnectorZEVM(ctx, wzeta) - if err != nil { - return sdkerrors.Wrapf(err, "failed to DeployConnectorZEVM") - } - ctx.EventManager().EmitEvent( - sdk.NewEvent(sdk.EventTypeMessage, - sdk.NewAttribute("DeployConnectorZEVM", connector.String()), - ), - ) - ctx.Logger().Info("Deployed Connector ZEVM at " + connector.String()) - - SystemContractAddress, err := k.DeploySystemContract(ctx, wzeta, uniswapV2Factory, router) - if err != nil { - return sdkerrors.Wrapf(err, "failed to SystemContractAddress") - } - ctx.EventManager().EmitEvent( - sdk.NewEvent(sdk.EventTypeMessage, - sdk.NewAttribute("SystemContractAddress", SystemContractAddress.String()), - ), - ) - - // set the system contract - system, _ := k.GetSystemContract(ctx) - system.SystemContract = SystemContractAddress.String() - // FIXME: remove unnecessary SetGasPrice and setupChainGasCoinAndPool - k.SetSystemContract(ctx, system) - //err = k.SetGasPrice(ctx, big.NewInt(1337), big.NewInt(1)) - if err != nil { - return err - } - _, err = k.SetupChainGasCoinAndPool(ctx, common.GoerliChain().ChainId, "ETH", "gETH", 18, nil) - if err != nil { - return sdkerrors.Wrapf(err, "failed to setupChainGasCoinAndPool") - } - - _, err = k.SetupChainGasCoinAndPool(ctx, common.BscTestnetChain().ChainId, "BNB", "tBNB", 18, nil) - if err != nil { - return sdkerrors.Wrapf(err, "failed to setupChainGasCoinAndPool") - } - _, err = k.SetupChainGasCoinAndPool(ctx, common.MumbaiChain().ChainId, "MATIC", "tMATIC", 18, nil) - if err != nil { - return sdkerrors.Wrapf(err, "failed to setupChainGasCoinAndPool") - } - _, err = k.SetupChainGasCoinAndPool(ctx, common.BtcTestNetChain().ChainId, "BTC", "tBTC", 8, nil) - if err != nil { - return sdkerrors.Wrapf(err, "failed to setupChainGasCoinAndPool") - } - - return nil -} - -func (k Keeper) TestUpdateSystemContractAddress(goCtx context.Context) error { - return nil -} - -func (k Keeper) TestUpdateZRC20WithdrawFee(goCtx context.Context) error { - return nil -} diff --git a/x/fungible/keeper/deposits.go b/x/fungible/keeper/deposits.go index fa197a953b..832613aa2c 100644 --- a/x/fungible/keeper/deposits.go +++ b/x/fungible/keeper/deposits.go @@ -49,6 +49,11 @@ func (k Keeper) ZRC20DepositAndCallContract( } ZRC20Contract = eth.HexToAddress(coin.Zrc20ContractAddress) + // check if foreign coin is paused + if coin.Paused { + return nil, false, types.ErrPausedZRC20 + } + // check foreign coins cap if it has a cap if !coin.LiquidityCap.IsNil() && !coin.LiquidityCap.IsZero() { liquidityCap := coin.LiquidityCap.BigInt() diff --git a/x/fungible/keeper/deposits_test.go b/x/fungible/keeper/deposits_test.go index 2e357cd42c..4131a1e00d 100644 --- a/x/fungible/keeper/deposits_test.go +++ b/x/fungible/keeper/deposits_test.go @@ -153,6 +153,38 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { require.Equal(t, big.NewInt(500), balance) }) + t.Run("should fail if coin paused", func(t *testing.T) { + // setup gas coin + k, ctx, sdkk, _ := testkeeper.FungibleKeeper(t) + _ = k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) + + chainList := common.DefaultChainsList() + chain := chainList[0] + + // deploy the system contracts + deploySystemContracts(t, ctx, k, sdkk.EvmKeeper) + zrc20 := setupGasCoin(t, ctx, k, sdkk.EvmKeeper, chain.ChainId, "foobar", "foobar") + + // pause the coin + coin, found := k.GetForeignCoins(ctx, zrc20.String()) + require.True(t, found) + coin.Paused = true + k.SetForeignCoins(ctx, coin) + + to := sample.EthAddress() + _, _, err := k.ZRC20DepositAndCallContract( + ctx, + sample.EthAddress().Bytes(), + to, + big.NewInt(42), + chain, + []byte{}, + common.CoinType_Gas, + sample.EthAddress().String(), + ) + require.ErrorIs(t, err, types.ErrPausedZRC20) + }) + t.Run("should fail if liquidity cap reached", func(t *testing.T) { // setup gas coin k, ctx, sdkk, _ := testkeeper.FungibleKeeper(t) diff --git a/x/fungible/keeper/evm.go b/x/fungible/keeper/evm.go index f0683deb60..0555c0cb95 100644 --- a/x/fungible/keeper/evm.go +++ b/x/fungible/keeper/evm.go @@ -101,6 +101,12 @@ func (k Keeper) DeployZRC20Contract( if chain == nil { return common.Address{}, cosmoserrors.Wrapf(zetaObserverTypes.ErrSupportedChains, "chain %s not found", chainStr) } + // Check if Contract has already been deployed for Asset + _, found := k.GetForeignCoinFromAsset(ctx, erc20Contract, chainID) + if found { + return common.Address{}, types.ErrForeignCoinAlreadyExist + } + system, found := k.GetSystemContract(ctx) if !found { return common.Address{}, cosmoserrors.Wrapf(types.ErrSystemContractNotFound, "system contract not found") @@ -118,7 +124,6 @@ func (k Keeper) DeployZRC20Contract( if err != nil { return common.Address{}, cosmoserrors.Wrapf(types.ErrABIPack, "failed to deploy ZRC20 contract: %s, %s", name, err.Error()) } - coin, _ := k.GetForeignCoins(ctx, contractAddr.Hex()) coin.CoinType = coinType coin.Name = name @@ -571,7 +576,7 @@ func (k Keeper) CallEVM( k.Logger(ctx).Debug("calling EVM", "from", from, "contract", contract, "value", value, "method", method) resp, err := k.CallEVMWithData(ctx, from, &contract, data, commit, noEthereumTxEvent, value, gasLimit) if err != nil { - errMes := fmt.Sprintf("contract call failed: method '%s', contract '%s'", method, contract.Hex()) + errMes := fmt.Sprintf("contract call failed: method '%s', contract '%s', args: %v", method, contract.Hex(), args) // if it is a revert error then add the revert reason to the error message revertErr, ok := err.(*evmtypes.RevertError) diff --git a/x/fungible/keeper/gas_coin_and_pool.go b/x/fungible/keeper/gas_coin_and_pool.go index d33c3ddec6..7540b90f69 100644 --- a/x/fungible/keeper/gas_coin_and_pool.go +++ b/x/fungible/keeper/gas_coin_and_pool.go @@ -34,6 +34,12 @@ func (k Keeper) SetupChainGasCoinAndPool( transferGasLimit := gasLimit + // Check if gas coin already exists + _, found := k.GetGasCoinForForeignCoin(ctx, chainID) + if found { + return ethcommon.Address{}, types.ErrForeignCoinAlreadyExist + } + // default values if transferGasLimit == nil { transferGasLimit = big.NewInt(21_000) diff --git a/x/fungible/keeper/grpc_query_code_hash.go b/x/fungible/keeper/grpc_query_code_hash.go new file mode 100644 index 0000000000..78fa60e3be --- /dev/null +++ b/x/fungible/keeper/grpc_query_code_hash.go @@ -0,0 +1,40 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + ethcommon "github.com/ethereum/go-ethereum/common" + + "github.com/zeta-chain/zetacore/x/fungible/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// CodeHash returns the code hash of an account if it exists +func (k Keeper) CodeHash(c context.Context, req *types.QueryCodeHashRequest) (*types.QueryCodeHashResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + // convert address to hex + if !ethcommon.IsHexAddress(req.Address) { + return nil, status.Error(codes.InvalidArgument, "invalid address") + } + address := ethcommon.HexToAddress(req.Address) + + // fetch account + ctx := sdk.UnwrapSDKContext(c) + acc := k.evmKeeper.GetAccount(ctx, address) + if acc == nil { + return nil, status.Error(codes.NotFound, "account not found") + } + if !acc.IsContract() { + return nil, status.Error(codes.NotFound, "account is not a contract") + } + + // convert code hash to hex + codeHash := ethcommon.BytesToHash(acc.CodeHash) + + return &types.QueryCodeHashResponse{CodeHash: codeHash.Hex()}, nil +} diff --git a/x/fungible/keeper/grpc_query_code_hash_test.go b/x/fungible/keeper/grpc_query_code_hash_test.go new file mode 100644 index 0000000000..e2359dc530 --- /dev/null +++ b/x/fungible/keeper/grpc_query_code_hash_test.go @@ -0,0 +1,60 @@ +package keeper_test + +import ( + "testing" + + ethcommon "github.com/ethereum/go-ethereum/common" + "github.com/stretchr/testify/require" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/fungible/types" +) + +func TestKeeper_CodeHash(t *testing.T) { + t.Run("should return code hash", func(t *testing.T) { + k, ctx, sdkk, _ := keepertest.FungibleKeeper(t) + k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) + + wzeta, _, _, _, _ := deploySystemContracts(t, ctx, k, sdkk.EvmKeeper) + acc := sdkk.EvmKeeper.GetAccount(ctx, wzeta) + require.NotNil(t, acc) + require.NotNil(t, acc.CodeHash) + + res, err := k.CodeHash(ctx, &types.QueryCodeHashRequest{ + Address: wzeta.Hex(), + }) + require.NoError(t, err) + require.Equal(t, ethcommon.BytesToHash(acc.CodeHash).Hex(), res.CodeHash) + }) + + t.Run("should return error if address is invalid", func(t *testing.T) { + k, ctx, _, _ := keepertest.FungibleKeeper(t) + + _, err := k.CodeHash(ctx, &types.QueryCodeHashRequest{ + Address: "invalid", + }) + require.Error(t, err) + require.ErrorContains(t, err, "invalid address") + }) + + t.Run("should return error if account not found", func(t *testing.T) { + k, ctx, _, _ := keepertest.FungibleKeeper(t) + + _, err := k.CodeHash(ctx, &types.QueryCodeHashRequest{ + Address: sample.EthAddress().Hex(), + }) + require.Error(t, err) + require.ErrorContains(t, err, "account not found") + }) + + t.Run("should return error if account is not a contract", func(t *testing.T) { + k, ctx, _, _ := keepertest.FungibleKeeper(t) + k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) + + _, err := k.CodeHash(ctx, &types.QueryCodeHashRequest{ + Address: types.ModuleAddressEVM.Hex(), + }) + require.Error(t, err) + require.ErrorContains(t, err, "account is not a contract") + }) +} diff --git a/x/fungible/keeper/grpc_query_foreign_coins.go b/x/fungible/keeper/grpc_query_foreign_coins.go index 2afceaff9c..2688dc6d6b 100644 --- a/x/fungible/keeper/grpc_query_foreign_coins.go +++ b/x/fungible/keeper/grpc_query_foreign_coins.go @@ -39,7 +39,6 @@ func (k Keeper) ForeignCoinsAll(c context.Context, req *types.QueryAllForeignCoi return &types.QueryAllForeignCoinsResponse{ForeignCoins: foreignCoinss, Pagination: pageRes}, nil } -// Change this query to take Chain as well func (k Keeper) ForeignCoins(c context.Context, req *types.QueryGetForeignCoinsRequest) (*types.QueryGetForeignCoinsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") diff --git a/x/fungible/keeper/grpc_gas_stability_pool.go b/x/fungible/keeper/grpc_query_gas_stability_pool.go similarity index 100% rename from x/fungible/keeper/grpc_gas_stability_pool.go rename to x/fungible/keeper/grpc_query_gas_stability_pool.go diff --git a/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20_test.go b/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20_test.go index 95426c9437..1e64419f1a 100644 --- a/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20_test.go +++ b/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20_test.go @@ -154,4 +154,40 @@ func TestMsgServer_DeployFungibleCoinZRC20(t *testing.T) { require.Error(t, err) require.ErrorIs(t, err, observertypes.ErrSupportedChains) }) + + t.Run("should not deploy an existing gas or erc20 contract", func(t *testing.T) { + k, ctx, sdkk, zk := keepertest.FungibleKeeper(t) + k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) + admin := sample.AccAddress() + setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2) + chainID := getValidChainID(t) + + deploySystemContracts(t, ctx, k, sdkk.EvmKeeper) + + deployMsg := types.NewMsgDeployFungibleCoinZRC20( + admin, + sample.EthAddress().Hex(), + chainID, + 8, + "foo", + "foo", + common.CoinType_Gas, + 1000000, + ) + + // Attempt to deploy the same gas token twice should result in error + _, err := keeper.NewMsgServerImpl(*k).DeployFungibleCoinZRC20(ctx, deployMsg) + require.NoError(t, err) + _, err = keeper.NewMsgServerImpl(*k).DeployFungibleCoinZRC20(ctx, deployMsg) + require.Error(t, err) + require.ErrorIs(t, err, types.ErrForeignCoinAlreadyExist) + + // Similar to above, redeploying existing erc20 should also fail + deployMsg.CoinType = common.CoinType_ERC20 + _, err = keeper.NewMsgServerImpl(*k).DeployFungibleCoinZRC20(ctx, deployMsg) + require.NoError(t, err) + _, err = keeper.NewMsgServerImpl(*k).DeployFungibleCoinZRC20(ctx, deployMsg) + require.Error(t, err) + require.ErrorIs(t, err, types.ErrForeignCoinAlreadyExist) + }) } diff --git a/x/fungible/keeper/msg_server_deploy_system_contract.go b/x/fungible/keeper/msg_server_deploy_system_contract.go new file mode 100644 index 0000000000..284e6b5759 --- /dev/null +++ b/x/fungible/keeper/msg_server_deploy_system_contract.go @@ -0,0 +1,77 @@ +package keeper + +import ( + "context" + + cosmoserror "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/zeta-chain/zetacore/x/fungible/types" + zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types" +) + +// DeploySystemContracts deploy new instances of the system contracts +func (k msgServer) DeploySystemContracts(goCtx context.Context, msg *types.MsgDeploySystemContracts) (*types.MsgDeploySystemContractsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if msg.Creator != k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_group2) { + return nil, cosmoserror.Wrap(sdkerrors.ErrUnauthorized, "System contract deployment can only be executed by the correct policy account") + } + + // uniswap v2 factory + factory, err := k.DeployUniswapV2Factory(ctx) + if err != nil { + return nil, cosmoserror.Wrapf(err, "failed to deploy UniswapV2Factory") + } + + // wzeta contract + wzeta, err := k.DeployWZETA(ctx) + if err != nil { + return nil, cosmoserror.Wrapf(err, "failed to DeployWZetaContract") + } + + // uniswap v2 router + router, err := k.DeployUniswapV2Router02(ctx, factory, wzeta) + if err != nil { + return nil, cosmoserror.Wrapf(err, "failed to deploy UniswapV2Router02") + } + + // connector zevm + connector, err := k.DeployConnectorZEVM(ctx, wzeta) + if err != nil { + return nil, cosmoserror.Wrapf(err, "failed to deploy ConnectorZEVM") + } + + // system contract + systemContract, err := k.DeploySystemContract(ctx, wzeta, factory, router) + if err != nil { + return nil, cosmoserror.Wrapf(err, "failed to deploy SystemContract") + } + + err = ctx.EventManager().EmitTypedEvent( + &types.EventSystemContractsDeployed{ + MsgTypeUrl: sdk.MsgTypeURL(&types.MsgDeploySystemContracts{}), + UniswapV2Factory: factory.Hex(), + Wzeta: wzeta.Hex(), + UniswapV2Router: router.Hex(), + ConnectorZevm: connector.Hex(), + SystemContract: systemContract.Hex(), + Signer: msg.Creator, + }, + ) + if err != nil { + k.Logger(ctx).Error("failed to emit event", + "event", "EventSystemContractsDeployed", + "error", err.Error(), + ) + return nil, cosmoserror.Wrapf(types.ErrEmitEvent, "failed to emit event (%s)", err.Error()) + } + + return &types.MsgDeploySystemContractsResponse{ + UniswapV2Factory: factory.Hex(), + Wzeta: wzeta.Hex(), + UniswapV2Router: router.Hex(), + ConnectorZEVM: connector.Hex(), + SystemContract: systemContract.Hex(), + }, nil +} diff --git a/x/fungible/keeper/msg_server_deploy_system_contract_test.go b/x/fungible/keeper/msg_server_deploy_system_contract_test.go new file mode 100644 index 0000000000..86b9745021 --- /dev/null +++ b/x/fungible/keeper/msg_server_deploy_system_contract_test.go @@ -0,0 +1,68 @@ +package keeper_test + +import ( + "errors" + "testing" + + "github.com/stretchr/testify/mock" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + ethcommon "github.com/ethereum/go-ethereum/common" + "github.com/stretchr/testify/require" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/fungible/keeper" + "github.com/zeta-chain/zetacore/x/fungible/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" +) + +func TestMsgServer_DeploySystemContracts(t *testing.T) { + t.Run("admin can deploy system contracts", func(t *testing.T) { + k, ctx, sdkk, zk := keepertest.FungibleKeeper(t) + msgServer := keeper.NewMsgServerImpl(*k) + _ = k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) + admin := sample.AccAddress() + setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2) + + res, err := msgServer.DeploySystemContracts(ctx, types.NewMsgDeploySystemContracts(admin)) + require.NoError(t, err) + require.NotNil(t, res) + assertContractDeployment(t, sdkk.EvmKeeper, ctx, ethcommon.HexToAddress(res.UniswapV2Factory)) + assertContractDeployment(t, sdkk.EvmKeeper, ctx, ethcommon.HexToAddress(res.Wzeta)) + assertContractDeployment(t, sdkk.EvmKeeper, ctx, ethcommon.HexToAddress(res.UniswapV2Router)) + assertContractDeployment(t, sdkk.EvmKeeper, ctx, ethcommon.HexToAddress(res.ConnectorZEVM)) + assertContractDeployment(t, sdkk.EvmKeeper, ctx, ethcommon.HexToAddress(res.SystemContract)) + }) + + t.Run("non-admin cannot deploy system contracts", func(t *testing.T) { + k, ctx, _, zk := keepertest.FungibleKeeper(t) + msgServer := keeper.NewMsgServerImpl(*k) + _ = k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) + nonadmin := sample.AccAddress() + setAdminPolicies(ctx, zk, nonadmin, observertypes.Policy_Type_group1) + + _, err := msgServer.DeploySystemContracts(ctx, types.NewMsgDeploySystemContracts(nonadmin)) + require.ErrorIs(t, err, sdkerrors.ErrUnauthorized) + }) + + t.Run("should fail if contract deployment fails", func(t *testing.T) { + k, ctx, _, zk := keepertest.FungibleKeeperWithMocks(t, keepertest.FungibleMockOptions{ + UseEVMMock: true, + }) + msgServer := keeper.NewMsgServerImpl(*k) + _ = k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) + admin := sample.AccAddress() + setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2) + + mockEVMKeeper := keepertest.GetFungibleEVMMock(t, k) + mockEVMKeeper.On( + "EstimateGas", + mock.Anything, + mock.Anything, + ).Return(nil, errors.New("failed to estimate gas")) + + _, err := msgServer.DeploySystemContracts(ctx, types.NewMsgDeploySystemContracts(admin)) + require.Error(t, err) + require.Contains(t, err.Error(), "failed to deploy") + }) +} diff --git a/x/fungible/keeper/msg_server_update_contract_bytecode.go b/x/fungible/keeper/msg_server_update_contract_bytecode.go index 5d5e7c7950..5c2d328bbd 100644 --- a/x/fungible/keeper/msg_server_update_contract_bytecode.go +++ b/x/fungible/keeper/msg_server_update_contract_bytecode.go @@ -4,7 +4,6 @@ import ( "context" cosmoserror "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ethcommon "github.com/ethereum/go-ethereum/common" @@ -48,19 +47,9 @@ func (k msgServer) UpdateContractBytecode(goCtx context.Context, msg *types.MsgU } } - // fetch the account of the new bytecode - if !ethcommon.IsHexAddress(msg.NewBytecodeAddress) { - return nil, cosmoserror.Wrapf(sdkerrors.ErrInvalidAddress, "invalid contract address (%s)", msg.NewBytecodeAddress) - } - newBytecodeAddress := ethcommon.HexToAddress(msg.NewBytecodeAddress) - newBytecodeAcct := k.evmKeeper.GetAccount(ctx, newBytecodeAddress) - if newBytecodeAcct == nil { - return nil, cosmoserror.Wrapf(types.ErrContractNotFound, "contract (%s) not found", newBytecodeAddress.Hex()) - } - // set the new CodeHash to the account - previousCodeHash := acct.CodeHash - acct.CodeHash = newBytecodeAcct.CodeHash + oldCodeHash := acct.CodeHash + acct.CodeHash = ethcommon.HexToHash(msg.NewCodeHash).Bytes() err := k.evmKeeper.SetAccount(ctx, contractAddress, *acct) if err != nil { return nil, cosmoserror.Wrapf( @@ -70,14 +59,20 @@ func (k msgServer) UpdateContractBytecode(goCtx context.Context, msg *types.MsgU err.Error(), ) } - k.Logger(ctx).Info( - "updated contract bytecode", - "contract", contractAddress.Hex(), - "oldCodeHash", string(previousCodeHash), - "newCodeHash", string(acct.CodeHash), + + err = ctx.EventManager().EmitTypedEvent( + &types.EventBytecodeUpdated{ + MsgTypeUrl: sdk.MsgTypeURL(&types.MsgUpdateContractBytecode{}), + ContractAddress: msg.ContractAddress, + OldBytecodeHash: ethcommon.BytesToHash(oldCodeHash).Hex(), + NewBytecodeHash: msg.NewCodeHash, + Signer: msg.Creator, + }, ) + if err != nil { + k.Logger(ctx).Error("failed to emit event", "error", err.Error()) + return nil, cosmoserror.Wrapf(types.ErrEmitEvent, "failed to emit event (%s)", err.Error()) + } - return &types.MsgUpdateContractBytecodeResponse{ - NewBytecodeHash: acct.CodeHash, - }, nil + return &types.MsgUpdateContractBytecodeResponse{}, nil } diff --git a/x/fungible/keeper/msg_server_update_contract_bytecode_test.go b/x/fungible/keeper/msg_server_update_contract_bytecode_test.go index 57f1c8b931..cb8e894eb0 100644 --- a/x/fungible/keeper/msg_server_update_contract_bytecode_test.go +++ b/x/fungible/keeper/msg_server_update_contract_bytecode_test.go @@ -5,6 +5,8 @@ import ( "math/big" "testing" + ethcommon "github.com/ethereum/go-ethereum/common" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/evmos/ethermint/x/evm/statedb" @@ -29,6 +31,14 @@ func setAdminPolicies(ctx sdk.Context, zk keepertest.ZetaKeepers, admin string, }) } +func codeHashFromAddress(t *testing.T, ctx sdk.Context, k *keeper.Keeper, contractAddr string) string { + res, err := k.CodeHash(ctx, &types.QueryCodeHashRequest{ + Address: contractAddr, + }) + require.NoError(t, err) + return res.CodeHash +} + func TestKeeper_UpdateContractBytecode(t *testing.T) { t.Run("can update the bytecode from another contract", func(t *testing.T) { k, ctx, sdkk, zk := keepertest.FungibleKeeper(t) @@ -92,18 +102,19 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { big.NewInt(90_000), ) require.NoError(t, err) + codeHash := codeHashFromAddress(t, ctx, k, newCodeAddress.Hex()) // update the bytecode - res, err := msgServer.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode( + _, err = msgServer.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode( admin, - zrc20, - newCodeAddress, + zrc20.Hex(), + codeHash, )) require.NoError(t, err) // check the returned new bytecode hash matches the one in the account acct := sdkk.EvmKeeper.GetAccount(ctx, zrc20) - require.Equal(t, acct.CodeHash, res.NewBytecodeHash) + require.Equal(t, acct.CodeHash, ethcommon.HexToHash(codeHash).Bytes()) // check the state // balances and total supply should remain @@ -134,11 +145,12 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { "gamma", big.NewInt(90_000), ) + codeHash = codeHashFromAddress(t, ctx, k, newCodeAddress.Hex()) require.NoError(t, err) _, err = msgServer.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode( admin, - zrc20, - newCodeAddress, + zrc20.Hex(), + codeHash, )) require.NoError(t, err) balance, err = k.BalanceOfZRC4(ctx, zrc20, addr1) @@ -161,6 +173,7 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { // deploy a connector setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2) wzeta, _, _, oldConnector, _ := deploySystemContracts(t, ctx, k, sdkk.EvmKeeper) + codeHash := codeHashFromAddress(t, ctx, k, oldConnector.Hex()) // deploy a new connector that will become official connector newConnector, err := k.DeployConnectorZEVM(ctx, wzeta) @@ -171,8 +184,8 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { // can update the bytecode of the new connector with the old connector contract _, err = msgServer.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode( admin, - newConnector, - oldConnector, + newConnector.Hex(), + codeHash, )) require.NoError(t, err) }) @@ -183,8 +196,8 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { _, err := msgServer.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode( sample.AccAddress(), - sample.EthAddress(), - sample.EthAddress(), + sample.EthAddress().Hex(), + sample.Hash().Hex(), )) require.ErrorIs(t, err, sdkerrors.ErrUnauthorized) }) @@ -197,9 +210,9 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2) _, err := msgServer.UpdateContractBytecode(ctx, &types.MsgUpdateContractBytecode{ - Creator: admin, - ContractAddress: "invalid", - NewBytecodeAddress: sample.EthAddress().Hex(), + Creator: admin, + ContractAddress: "invalid", + NewCodeHash: sample.Hash().Hex(), }) require.ErrorIs(t, err, sdkerrors.ErrInvalidAddress) }) @@ -222,8 +235,8 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { _, err := msgServer.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode( admin, - contractAddr, - sample.EthAddress(), + contractAddr.Hex(), + sample.Hash().Hex(), )) require.ErrorIs(t, err, types.ErrContractNotFound) @@ -242,8 +255,8 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { // can't update the bytecode of the wzeta contract _, err := msgServer.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode( admin, - wzeta, - sample.EthAddress(), + wzeta.Hex(), + sample.Hash().Hex(), )) require.ErrorIs(t, err, types.ErrInvalidContract) }) @@ -263,82 +276,12 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { // can't update the bytecode of the wzeta contract _, err := msgServer.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode( admin, - connector, - sample.EthAddress(), + connector.Hex(), + sample.Hash().Hex(), )) require.ErrorIs(t, err, types.ErrSystemContractNotFound) }) - t.Run("should fail if invalid bytecode address", func(t *testing.T) { - k, ctx, _, zk := keepertest.FungibleKeeperWithMocks(t, keepertest.FungibleMockOptions{ - UseEVMMock: true, - }) - msgServer := keeper.NewMsgServerImpl(*k) - mockEVMKeeper := keepertest.GetFungibleEVMMock(t, k) - admin := sample.AccAddress() - setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2) - - // set the contract as the connector - contract := sample.EthAddress() - k.SetSystemContract(ctx, types.SystemContract{ - ConnectorZevm: contract.Hex(), - }) - - mockEVMKeeper.On( - "GetAccount", - mock.Anything, - mock.Anything, - ).Return(&statedb.Account{}) - - _, err := msgServer.UpdateContractBytecode(ctx, &types.MsgUpdateContractBytecode{ - Creator: admin, - ContractAddress: contract.Hex(), - NewBytecodeAddress: "invalid", - }) - - require.ErrorIs(t, err, sdkerrors.ErrInvalidAddress) - - mockEVMKeeper.AssertExpectations(t) - }) - - t.Run("should fail if can't get new bytecode account", func(t *testing.T) { - k, ctx, _, zk := keepertest.FungibleKeeperWithMocks(t, keepertest.FungibleMockOptions{ - UseEVMMock: true, - }) - msgServer := keeper.NewMsgServerImpl(*k) - mockEVMKeeper := keepertest.GetFungibleEVMMock(t, k) - admin := sample.AccAddress() - setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2) - contractAddr := sample.EthAddress() - newBytecodeAddr := sample.EthAddress() - - // set the contract as the connector - k.SetSystemContract(ctx, types.SystemContract{ - ConnectorZevm: contractAddr.String(), - }) - - mockEVMKeeper.On( - "GetAccount", - mock.Anything, - contractAddr, - ).Return(&statedb.Account{}) - - mockEVMKeeper.On( - "GetAccount", - mock.Anything, - newBytecodeAddr, - ).Return(nil) - - _, err := msgServer.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode( - admin, - contractAddr, - newBytecodeAddr, - )) - require.ErrorIs(t, err, types.ErrContractNotFound) - - mockEVMKeeper.AssertExpectations(t) - }) - t.Run("should fail if can't set account with new bytecode", func(t *testing.T) { k, ctx, _, zk := keepertest.FungibleKeeperWithMocks(t, keepertest.FungibleMockOptions{ UseEVMMock: true, @@ -348,7 +291,7 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { admin := sample.AccAddress() setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2) contractAddr := sample.EthAddress() - newBytecodeAddr := sample.EthAddress() + newCodeHash := sample.Hash().Hex() // set the contract as the connector k.SetSystemContract(ctx, types.SystemContract{ @@ -361,12 +304,6 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { contractAddr, ).Return(&statedb.Account{}) - mockEVMKeeper.On( - "GetAccount", - mock.Anything, - newBytecodeAddr, - ).Return(&statedb.Account{}) - mockEVMKeeper.On( "SetAccount", mock.Anything, @@ -376,8 +313,8 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { _, err := msgServer.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode( admin, - contractAddr, - newBytecodeAddr, + contractAddr.Hex(), + newCodeHash, )) require.ErrorIs(t, err, types.ErrSetBytecode) diff --git a/x/fungible/module.go b/x/fungible/module.go index 7ea3ff45d0..e66b28f1e8 100644 --- a/x/fungible/module.go +++ b/x/fungible/module.go @@ -176,33 +176,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return 2 } // BeginBlock executes all ABCI BeginBlock logic respective to the fungible module. -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { - //TODO : moved to init-genesis - // https://github.com/zeta-chain/node/issues/866 - if ctx.BlockHeight() == 1 { - err := am.keeper.BlockOneDeploySystemContracts(sdk.WrapSDKContext(ctx)) - if err != nil { - ctx.Logger().Error("Unable To deploy contracts", "err", err.Error()) - } - } - - if ctx.BlockHeight() == 20 { - err := am.keeper.TestUpdateSystemContractAddress(sdk.WrapSDKContext(ctx)) - if err != nil { - ctx.Logger().Error("Unable To update system contracts", "err", err.Error()) - } else { - ctx.Logger().Info("System contract updated") - } - } - if ctx.BlockHeight() == 25 { - err := am.keeper.TestUpdateZRC20WithdrawFee(sdk.WrapSDKContext(ctx)) - if err != nil { - ctx.Logger().Error("Unable To update zrc20 withdraw fee", "err", err.Error()) - } else { - ctx.Logger().Info("zrc20 withdraw fee updated") - } - } -} +func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} // EndBlock executes all ABCI EndBlock logic respective to the fungible module. It // returns no validator updates. diff --git a/x/fungible/types/codec.go b/x/fungible/types/codec.go index 47bbfee990..ac7fc91429 100644 --- a/x/fungible/types/codec.go +++ b/x/fungible/types/codec.go @@ -9,6 +9,7 @@ import ( func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgDeployFungibleCoinZRC20{}, "fungible/DeployFungibleCoinZRC20", nil) + cdc.RegisterConcrete(&MsgDeploySystemContracts{}, "fungible/MsgDeploySystemContracts", nil) cdc.RegisterConcrete(&MsgRemoveForeignCoin{}, "fungible/RemoveForeignCoin", nil) cdc.RegisterConcrete(&MsgUpdateSystemContract{}, "fungible/UpdateSystemContract", nil) cdc.RegisterConcrete(&MsgUpdateZRC20WithdrawFee{}, "fungible/UpdateZRC20WithdrawFee", nil) @@ -20,6 +21,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) { func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgDeployFungibleCoinZRC20{}, + &MsgDeploySystemContracts{}, &MsgRemoveForeignCoin{}, &MsgUpdateSystemContract{}, &MsgUpdateZRC20WithdrawFee{}, diff --git a/x/fungible/types/errors.go b/x/fungible/types/errors.go index 8ab68525a3..2652442b4a 100644 --- a/x/fungible/types/errors.go +++ b/x/fungible/types/errors.go @@ -8,24 +8,16 @@ import ( // x/fungible module sentinel errors var ( - ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") ErrABIPack = sdkerrors.Register(ModuleName, 1101, "abi pack error") ErrABIGet = sdkerrors.Register(ModuleName, 1102, "abi get error") - ErrUnexpectedEvent = sdkerrors.Register(ModuleName, 1103, "unexpected event") ErrABIUnpack = sdkerrors.Register(ModuleName, 1104, "abi unpack error") - ErrBlanceQuery = sdkerrors.Register(ModuleName, 1105, "balance query error") - ErrBalanceInvariance = sdkerrors.Register(ModuleName, 1106, "balance invariance error") ErrContractNotFound = sdkerrors.Register(ModuleName, 1107, "contract not found") - ErrChainNotFound = sdkerrors.Register(ModuleName, 1108, "chain not found") ErrContractCall = sdkerrors.Register(ModuleName, 1109, "contract call error") ErrSystemContractNotFound = sdkerrors.Register(ModuleName, 1110, "system contract not found") ErrInvalidAddress = sdkerrors.Register(ModuleName, 1111, "invalid address") ErrStateVariableNotFound = sdkerrors.Register(ModuleName, 1112, "state variable not found") - ErrDeployContract = sdkerrors.Register(ModuleName, 1113, "deploy contract error") ErrEmitEvent = sdkerrors.Register(ModuleName, 1114, "emit event error") ErrInvalidDecimals = sdkerrors.Register(ModuleName, 1115, "invalid decimals") - ErrGasPriceNotFound = sdkerrors.Register(ModuleName, 1116, "gas price not found") - ErrUpdateNonce = sdkerrors.Register(ModuleName, 1117, "update nonce error") ErrInvalidGasLimit = sdkerrors.Register(ModuleName, 1118, "invalid gas limit") ErrSetBytecode = sdkerrors.Register(ModuleName, 1119, "set bytecode error") ErrInvalidContract = sdkerrors.Register(ModuleName, 1120, "invalid contract") @@ -34,4 +26,5 @@ var ( ErrForeignCoinCapReached = sdkerrors.Register(ModuleName, 1123, "foreign coin cap reached") ErrCallNonContract = sdkerrors.Register(ModuleName, 1124, "can't call a non-contract address") ErrForeignCoinAlreadyExist = sdkerrors.Register(ModuleName, 1125, "foreign coin already exist") + ErrInvalidHash = sdkerrors.Register(ModuleName, 1126, "invalid hash") ) diff --git a/x/fungible/types/events.pb.go b/x/fungible/types/events.pb.go index 9f3f881138..3216373f9a 100644 --- a/x/fungible/types/events.pb.go +++ b/x/fungible/types/events.pb.go @@ -377,55 +377,235 @@ func (m *EventZRC20PausedStatusUpdated) GetSigner() string { return "" } +type EventSystemContractsDeployed struct { + MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"` + UniswapV2Factory string `protobuf:"bytes,2,opt,name=uniswap_v2_factory,json=uniswapV2Factory,proto3" json:"uniswap_v2_factory,omitempty"` + Wzeta string `protobuf:"bytes,3,opt,name=wzeta,proto3" json:"wzeta,omitempty"` + UniswapV2Router string `protobuf:"bytes,4,opt,name=uniswap_v2_router,json=uniswapV2Router,proto3" json:"uniswap_v2_router,omitempty"` + ConnectorZevm string `protobuf:"bytes,5,opt,name=connector_zevm,json=connectorZevm,proto3" json:"connector_zevm,omitempty"` + SystemContract string `protobuf:"bytes,6,opt,name=system_contract,json=systemContract,proto3" json:"system_contract,omitempty"` + Signer string `protobuf:"bytes,7,opt,name=signer,proto3" json:"signer,omitempty"` +} + +func (m *EventSystemContractsDeployed) Reset() { *m = EventSystemContractsDeployed{} } +func (m *EventSystemContractsDeployed) String() string { return proto.CompactTextString(m) } +func (*EventSystemContractsDeployed) ProtoMessage() {} +func (*EventSystemContractsDeployed) Descriptor() ([]byte, []int) { + return fileDescriptor_858e6494730deffd, []int{4} +} +func (m *EventSystemContractsDeployed) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventSystemContractsDeployed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventSystemContractsDeployed.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 *EventSystemContractsDeployed) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventSystemContractsDeployed.Merge(m, src) +} +func (m *EventSystemContractsDeployed) XXX_Size() int { + return m.Size() +} +func (m *EventSystemContractsDeployed) XXX_DiscardUnknown() { + xxx_messageInfo_EventSystemContractsDeployed.DiscardUnknown(m) +} + +var xxx_messageInfo_EventSystemContractsDeployed proto.InternalMessageInfo + +func (m *EventSystemContractsDeployed) GetMsgTypeUrl() string { + if m != nil { + return m.MsgTypeUrl + } + return "" +} + +func (m *EventSystemContractsDeployed) GetUniswapV2Factory() string { + if m != nil { + return m.UniswapV2Factory + } + return "" +} + +func (m *EventSystemContractsDeployed) GetWzeta() string { + if m != nil { + return m.Wzeta + } + return "" +} + +func (m *EventSystemContractsDeployed) GetUniswapV2Router() string { + if m != nil { + return m.UniswapV2Router + } + return "" +} + +func (m *EventSystemContractsDeployed) GetConnectorZevm() string { + if m != nil { + return m.ConnectorZevm + } + return "" +} + +func (m *EventSystemContractsDeployed) GetSystemContract() string { + if m != nil { + return m.SystemContract + } + return "" +} + +func (m *EventSystemContractsDeployed) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +type EventBytecodeUpdated struct { + MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"` + ContractAddress string `protobuf:"bytes,2,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` + NewBytecodeHash string `protobuf:"bytes,3,opt,name=new_bytecode_hash,json=newBytecodeHash,proto3" json:"new_bytecode_hash,omitempty"` + OldBytecodeHash string `protobuf:"bytes,4,opt,name=old_bytecode_hash,json=oldBytecodeHash,proto3" json:"old_bytecode_hash,omitempty"` + Signer string `protobuf:"bytes,5,opt,name=signer,proto3" json:"signer,omitempty"` +} + +func (m *EventBytecodeUpdated) Reset() { *m = EventBytecodeUpdated{} } +func (m *EventBytecodeUpdated) String() string { return proto.CompactTextString(m) } +func (*EventBytecodeUpdated) ProtoMessage() {} +func (*EventBytecodeUpdated) Descriptor() ([]byte, []int) { + return fileDescriptor_858e6494730deffd, []int{5} +} +func (m *EventBytecodeUpdated) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventBytecodeUpdated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventBytecodeUpdated.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 *EventBytecodeUpdated) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventBytecodeUpdated.Merge(m, src) +} +func (m *EventBytecodeUpdated) XXX_Size() int { + return m.Size() +} +func (m *EventBytecodeUpdated) XXX_DiscardUnknown() { + xxx_messageInfo_EventBytecodeUpdated.DiscardUnknown(m) +} + +var xxx_messageInfo_EventBytecodeUpdated proto.InternalMessageInfo + +func (m *EventBytecodeUpdated) GetMsgTypeUrl() string { + if m != nil { + return m.MsgTypeUrl + } + return "" +} + +func (m *EventBytecodeUpdated) GetContractAddress() string { + if m != nil { + return m.ContractAddress + } + return "" +} + +func (m *EventBytecodeUpdated) GetNewBytecodeHash() string { + if m != nil { + return m.NewBytecodeHash + } + return "" +} + +func (m *EventBytecodeUpdated) GetOldBytecodeHash() string { + if m != nil { + return m.OldBytecodeHash + } + return "" +} + +func (m *EventBytecodeUpdated) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + func init() { proto.RegisterType((*EventSystemContractUpdated)(nil), "zetachain.zetacore.fungible.EventSystemContractUpdated") proto.RegisterType((*EventZRC20Deployed)(nil), "zetachain.zetacore.fungible.EventZRC20Deployed") proto.RegisterType((*EventZRC20WithdrawFeeUpdated)(nil), "zetachain.zetacore.fungible.EventZRC20WithdrawFeeUpdated") proto.RegisterType((*EventZRC20PausedStatusUpdated)(nil), "zetachain.zetacore.fungible.EventZRC20PausedStatusUpdated") + proto.RegisterType((*EventSystemContractsDeployed)(nil), "zetachain.zetacore.fungible.EventSystemContractsDeployed") + proto.RegisterType((*EventBytecodeUpdated)(nil), "zetachain.zetacore.fungible.EventBytecodeUpdated") } func init() { proto.RegisterFile("fungible/events.proto", fileDescriptor_858e6494730deffd) } var fileDescriptor_858e6494730deffd = []byte{ - // 593 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcb, 0x6e, 0xd3, 0x4c, - 0x14, 0xae, 0x9b, 0x36, 0x6d, 0xa6, 0x97, 0xbf, 0xff, 0x50, 0x90, 0x49, 0xc1, 0xaa, 0xc2, 0x82, - 0x6e, 0x6a, 0x57, 0x45, 0x3c, 0x40, 0x29, 0x17, 0x55, 0x02, 0x09, 0xa5, 0x54, 0x48, 0xdd, 0x58, - 0x13, 0xcf, 0xa9, 0x3b, 0x92, 0x3d, 0x63, 0x79, 0x26, 0xb8, 0xee, 0x53, 0xb0, 0xe3, 0x5d, 0x78, - 0x02, 0x96, 0x65, 0xc7, 0x12, 0x35, 0x2f, 0x82, 0xe6, 0xe2, 0x5c, 0x40, 0x94, 0xac, 0x72, 0xce, - 0xe4, 0x3b, 0xe7, 0xfb, 0xfc, 0x9d, 0x33, 0x83, 0xee, 0x5f, 0x0c, 0x79, 0xca, 0x06, 0x19, 0x44, - 0xf0, 0x09, 0xb8, 0x92, 0x61, 0x51, 0x0a, 0x25, 0xf0, 0xce, 0x35, 0x28, 0x92, 0x5c, 0x12, 0xc6, - 0x43, 0x13, 0x89, 0x12, 0xc2, 0x06, 0xd9, 0xbd, 0x97, 0x88, 0x3c, 0x17, 0x3c, 0xb2, 0x3f, 0xb6, - 0xa2, 0xfb, 0xff, 0xb8, 0x91, 0xba, 0x72, 0x47, 0xdb, 0xa9, 0x48, 0x85, 0x09, 0x23, 0x1d, 0xd9, - 0xd3, 0xde, 0x57, 0x0f, 0x75, 0x5f, 0x69, 0xae, 0xd3, 0x5a, 0x2a, 0xc8, 0x8f, 0x05, 0x57, 0x25, - 0x49, 0xd4, 0x59, 0x41, 0x89, 0x02, 0x8a, 0x77, 0xd1, 0x7a, 0x2e, 0xd3, 0x58, 0xd5, 0x05, 0xc4, - 0xc3, 0x32, 0xf3, 0xbd, 0x5d, 0x6f, 0xaf, 0xd3, 0x47, 0xb9, 0x4c, 0x3f, 0xd4, 0x05, 0x9c, 0x95, - 0x19, 0x3e, 0x40, 0xdb, 0x1c, 0xaa, 0x38, 0x71, 0x85, 0x31, 0xa1, 0xb4, 0x04, 0x29, 0xfd, 0x45, - 0x83, 0xc4, 0x1c, 0xaa, 0xa6, 0xe7, 0x91, 0xfd, 0x47, 0x57, 0x88, 0x8c, 0xfe, 0x59, 0xd1, 0xb2, - 0x15, 0x22, 0xa3, 0xbf, 0x57, 0x3c, 0x40, 0x6d, 0xc9, 0x52, 0x0e, 0xa5, 0xbf, 0x64, 0x30, 0x2e, - 0xeb, 0x7d, 0x59, 0x44, 0xd8, 0x88, 0x3f, 0xef, 0x1f, 0x1f, 0x1e, 0xbc, 0x84, 0x22, 0x13, 0xf5, - 0x5c, 0xa2, 0x1f, 0xa2, 0x55, 0x63, 0x67, 0xcc, 0xa8, 0x11, 0xda, 0xea, 0xaf, 0x98, 0xfc, 0x84, - 0xe2, 0x2e, 0x5a, 0x6d, 0x94, 0x39, 0x45, 0xe3, 0x1c, 0x63, 0xb4, 0xc4, 0x49, 0x0e, 0x4e, 0x85, - 0x89, 0x8d, 0xb6, 0x3a, 0x1f, 0x88, 0xcc, 0x5f, 0x76, 0xda, 0x4c, 0xa6, 0xfb, 0x50, 0x48, 0x58, - 0x4e, 0x32, 0xe9, 0xb7, 0x0d, 0xc5, 0x38, 0xc7, 0xfb, 0xa8, 0x93, 0x08, 0xc6, 0x8d, 0x42, 0x7f, - 0x65, 0xd7, 0xdb, 0xdb, 0x3c, 0xdc, 0x0a, 0xdd, 0xfc, 0x8e, 0x05, 0xe3, 0x5a, 0xa6, 0xa6, 0xb5, - 0x11, 0xde, 0x46, 0xcb, 0x50, 0x26, 0x87, 0x07, 0xfe, 0xaa, 0x61, 0xb0, 0x09, 0xde, 0x41, 0x9d, - 0x94, 0xc8, 0x38, 0x63, 0x39, 0x53, 0x7e, 0xc7, 0x32, 0xa4, 0x44, 0xbe, 0xd5, 0x79, 0x6f, 0xb4, - 0x88, 0x1e, 0x4d, 0x9c, 0xf9, 0xc8, 0xd4, 0x25, 0x2d, 0x49, 0xf5, 0x1a, 0x60, 0xfe, 0xc1, 0xde, - 0xe1, 0xd1, 0x8c, 0xfe, 0xd6, 0x3f, 0xf5, 0x3f, 0x41, 0x1b, 0xd7, 0x5a, 0xf2, 0x78, 0xd2, 0xd6, - 0xbf, 0x75, 0x73, 0xd8, 0xcc, 0x78, 0x0f, 0x6d, 0xe9, 0xad, 0xa8, 0x9c, 0xd4, 0xf8, 0x02, 0xc0, - 0x39, 0xba, 0x29, 0x32, 0x3a, 0xf5, 0x05, 0x1a, 0xa9, 0x37, 0x6e, 0x06, 0xd9, 0xb6, 0x48, 0x0e, - 0xd5, 0x34, 0x72, 0xb2, 0x37, 0x2b, 0xd3, 0x7b, 0x83, 0x7b, 0x68, 0x43, 0x73, 0x4d, 0xec, 0xb3, - 0xc6, 0xae, 0x89, 0x8c, 0xbe, 0x71, 0x0e, 0x6a, 0x8c, 0x66, 0x99, 0xb5, 0xb8, 0xd3, 0x5f, 0xe3, - 0x50, 0x35, 0x98, 0xde, 0x77, 0x0f, 0x3d, 0x9e, 0xb8, 0xfc, 0x9e, 0x0c, 0x25, 0xd0, 0x53, 0x45, - 0xd4, 0x50, 0xce, 0x6f, 0xf3, 0x53, 0xf4, 0xdf, 0x8c, 0x39, 0xa0, 0xaf, 0x4e, 0x4b, 0x7f, 0xcc, - 0xb4, 0x3d, 0x20, 0xf1, 0x3b, 0xd4, 0x26, 0x89, 0x62, 0x82, 0x3b, 0xc7, 0x9f, 0x87, 0x77, 0xbc, - 0x0a, 0xa1, 0x15, 0x30, 0x2d, 0xe9, 0xc8, 0x14, 0xf7, 0x5d, 0x93, 0xbf, 0xdd, 0xa9, 0x17, 0x27, - 0xdf, 0x6e, 0x03, 0xef, 0xe6, 0x36, 0xf0, 0x7e, 0xde, 0x06, 0xde, 0xe7, 0x51, 0xb0, 0x70, 0x33, - 0x0a, 0x16, 0x7e, 0x8c, 0x82, 0x85, 0xf3, 0x28, 0x65, 0xea, 0x72, 0x38, 0xd0, 0x83, 0x8e, 0x34, - 0xe1, 0xbe, 0xe1, 0x8e, 0x1a, 0xee, 0xe8, 0x2a, 0x9a, 0x3c, 0x3a, 0x75, 0x01, 0x72, 0xd0, 0x36, - 0x4f, 0xcc, 0xb3, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xaf, 0x60, 0xaf, 0x2f, 0xd6, 0x04, 0x00, - 0x00, + // 756 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xdf, 0x6e, 0xd3, 0x3e, + 0x14, 0x5e, 0xd6, 0xad, 0x5b, 0xbd, 0x3f, 0xed, 0xfc, 0xeb, 0x0f, 0x85, 0x0e, 0xaa, 0xa9, 0x08, + 0x31, 0x26, 0xd6, 0x4c, 0x45, 0x3c, 0xc0, 0x36, 0x18, 0x4c, 0x02, 0x09, 0x75, 0x0c, 0xa4, 0xdd, + 0x44, 0x6e, 0x72, 0x96, 0x46, 0x4a, 0xec, 0x2a, 0x76, 0x9b, 0x65, 0x4f, 0xc1, 0x1d, 0x3c, 0x0b, + 0x4f, 0xc0, 0xe5, 0x10, 0x37, 0x5c, 0xa2, 0xf5, 0x45, 0x90, 0x1d, 0x27, 0x6d, 0x86, 0x36, 0xb6, + 0xab, 0xfa, 0xb8, 0xdf, 0x39, 0xe7, 0xf3, 0xe7, 0xcf, 0x27, 0xe8, 0xff, 0xd3, 0x21, 0xf5, 0xfc, + 0x5e, 0x00, 0x16, 0x8c, 0x80, 0x0a, 0xde, 0x1e, 0x44, 0x4c, 0x30, 0xbc, 0x7e, 0x0e, 0x82, 0x38, + 0x7d, 0xe2, 0xd3, 0xb6, 0x5a, 0xb1, 0x08, 0xda, 0x19, 0xb2, 0xf1, 0x9f, 0xc3, 0xc2, 0x90, 0x51, + 0x2b, 0xfd, 0x49, 0x33, 0x1a, 0x6b, 0x79, 0x21, 0x71, 0xa6, 0xb7, 0xea, 0x1e, 0xf3, 0x98, 0x5a, + 0x5a, 0x72, 0x95, 0xee, 0xb6, 0xbe, 0x19, 0xa8, 0xf1, 0x4a, 0xf6, 0x3a, 0x4a, 0xb8, 0x80, 0x70, + 0x9f, 0x51, 0x11, 0x11, 0x47, 0x1c, 0x0f, 0x5c, 0x22, 0xc0, 0xc5, 0x1b, 0x68, 0x39, 0xe4, 0x9e, + 0x2d, 0x92, 0x01, 0xd8, 0xc3, 0x28, 0x30, 0x8d, 0x0d, 0x63, 0xb3, 0xd2, 0x45, 0x21, 0xf7, 0x3e, + 0x24, 0x03, 0x38, 0x8e, 0x02, 0xbc, 0x83, 0xea, 0x14, 0x62, 0xdb, 0xd1, 0x89, 0x36, 0x71, 0xdd, + 0x08, 0x38, 0x37, 0x67, 0x15, 0x12, 0x53, 0x88, 0xb3, 0x9a, 0xbb, 0xe9, 0x3f, 0x32, 0x83, 0x05, + 0xee, 0xdf, 0x19, 0xa5, 0x34, 0x83, 0x05, 0xee, 0xd5, 0x8c, 0x7b, 0xa8, 0xcc, 0x7d, 0x8f, 0x42, + 0x64, 0xce, 0x29, 0x8c, 0x8e, 0x5a, 0x5f, 0x66, 0x11, 0x56, 0xe4, 0x4f, 0xba, 0xfb, 0x9d, 0x9d, + 0x97, 0x30, 0x08, 0x58, 0x72, 0x2b, 0xd2, 0xf7, 0xd1, 0xa2, 0x92, 0xd3, 0xf6, 0x5d, 0x45, 0xb4, + 0xd4, 0x5d, 0x50, 0xf1, 0xa1, 0x8b, 0x1b, 0x68, 0x31, 0x63, 0xa6, 0x19, 0xe5, 0x31, 0xc6, 0x68, + 0x8e, 0x92, 0x10, 0x34, 0x0b, 0xb5, 0x56, 0xdc, 0x92, 0xb0, 0xc7, 0x02, 0x73, 0x5e, 0x73, 0x53, + 0x91, 0xac, 0xe3, 0x82, 0xe3, 0x87, 0x24, 0xe0, 0x66, 0x59, 0xb5, 0xc8, 0x63, 0xbc, 0x8d, 0x2a, + 0x0e, 0xf3, 0xa9, 0x62, 0x68, 0x2e, 0x6c, 0x18, 0x9b, 0xab, 0x9d, 0x5a, 0x5b, 0xdf, 0xdf, 0x3e, + 0xf3, 0xa9, 0xa4, 0x29, 0xdb, 0xa6, 0x2b, 0x5c, 0x47, 0xf3, 0x10, 0x39, 0x9d, 0x1d, 0x73, 0x51, + 0x75, 0x48, 0x03, 0xbc, 0x8e, 0x2a, 0x1e, 0xe1, 0x76, 0xe0, 0x87, 0xbe, 0x30, 0x2b, 0x69, 0x07, + 0x8f, 0xf0, 0xb7, 0x32, 0x6e, 0x8d, 0x67, 0xd1, 0x83, 0x89, 0x32, 0x9f, 0x7c, 0xd1, 0x77, 0x23, + 0x12, 0x1f, 0x00, 0xdc, 0xfe, 0x62, 0x6f, 0xd0, 0xa8, 0xc0, 0xbf, 0xf4, 0x4f, 0xfe, 0x8f, 0xd0, + 0xca, 0xb9, 0xa4, 0x9c, 0xdf, 0x74, 0xaa, 0xdf, 0xb2, 0xda, 0xcc, 0xee, 0x78, 0x13, 0xd5, 0xa4, + 0x2b, 0x62, 0x4d, 0xd5, 0x3e, 0x05, 0xd0, 0x8a, 0xae, 0xb2, 0xc0, 0x9d, 0x3a, 0x81, 0x44, 0x4a, + 0xc7, 0x15, 0x90, 0xe5, 0x14, 0x49, 0x21, 0x9e, 0x46, 0x4e, 0x7c, 0xb3, 0x30, 0xed, 0x1b, 0xdc, + 0x42, 0x2b, 0xb2, 0xd7, 0x44, 0xbe, 0x54, 0xd8, 0x25, 0x16, 0xb8, 0xaf, 0xb5, 0x82, 0x12, 0x23, + 0xbb, 0x14, 0x25, 0xae, 0x74, 0x97, 0x28, 0xc4, 0x19, 0xa6, 0xf5, 0xc3, 0x40, 0x0f, 0x27, 0x2a, + 0xbf, 0x27, 0x43, 0x0e, 0xee, 0x91, 0x20, 0x62, 0xc8, 0x6f, 0x2f, 0xf3, 0x13, 0x54, 0x2d, 0x88, + 0x03, 0xf2, 0xe9, 0x94, 0xe4, 0x61, 0xa6, 0xe5, 0x01, 0x8e, 0xdf, 0xa1, 0x32, 0x71, 0x84, 0xcf, + 0xa8, 0x56, 0xfc, 0x45, 0xfb, 0x86, 0xa9, 0xd0, 0x4e, 0x09, 0x4c, 0x53, 0xda, 0x55, 0xc9, 0x5d, + 0x5d, 0xe4, 0xda, 0x37, 0xf5, 0x35, 0x73, 0x4e, 0x71, 0x20, 0xf0, 0x3b, 0xbc, 0xae, 0x67, 0x08, + 0x0f, 0xa9, 0xcf, 0x63, 0x32, 0xb0, 0x47, 0x1d, 0xfb, 0x94, 0x38, 0x82, 0x45, 0x89, 0x1e, 0x08, + 0x35, 0xfd, 0xcf, 0xc7, 0xce, 0x41, 0xba, 0x2f, 0xdd, 0x1d, 0x4b, 0xfe, 0xfa, 0xb5, 0xa5, 0x01, + 0xde, 0x42, 0x6b, 0x53, 0x35, 0x22, 0x36, 0x14, 0x39, 0xd3, 0x6a, 0x5e, 0xa2, 0xab, 0xb6, 0xf1, + 0x63, 0xb4, 0xea, 0x30, 0x4a, 0x41, 0xd6, 0xb3, 0xcf, 0x61, 0x14, 0x6a, 0xe3, 0xac, 0xe4, 0xbb, + 0x27, 0x30, 0x0a, 0xa5, 0xd2, 0x5c, 0x9d, 0x29, 0x1f, 0x3d, 0x99, 0x6d, 0x78, 0xe1, 0xa8, 0xd7, + 0xd9, 0xa6, 0xf5, 0xd3, 0x40, 0x75, 0x25, 0xcd, 0x5e, 0x22, 0xc0, 0x61, 0xee, 0x1d, 0x1e, 0xd3, + 0x53, 0x54, 0xbb, 0x66, 0x42, 0x56, 0x9d, 0x2b, 0xc3, 0x6e, 0x0b, 0xad, 0x49, 0xe3, 0xf5, 0x74, + 0x0f, 0xbb, 0x4f, 0x78, 0x5f, 0x6b, 0x53, 0xa5, 0x10, 0x67, 0xbd, 0xdf, 0x10, 0xde, 0x97, 0x58, + 0x69, 0xe4, 0x22, 0x56, 0xab, 0xc4, 0x02, 0xb7, 0x80, 0x9d, 0x9c, 0x6a, 0x7e, 0xfa, 0x54, 0x7b, + 0x87, 0xdf, 0x2f, 0x9b, 0xc6, 0xc5, 0x65, 0xd3, 0xf8, 0x7d, 0xd9, 0x34, 0x3e, 0x8f, 0x9b, 0x33, + 0x17, 0xe3, 0xe6, 0xcc, 0xaf, 0x71, 0x73, 0xe6, 0xc4, 0xf2, 0x7c, 0xd1, 0x1f, 0xf6, 0xe4, 0xcb, + 0xb6, 0xe4, 0xa5, 0x6c, 0x2b, 0xb3, 0x59, 0x99, 0xd9, 0xac, 0x33, 0x6b, 0xf2, 0x95, 0x49, 0x06, + 0xc0, 0x7b, 0x65, 0xf5, 0x4d, 0x79, 0xfe, 0x27, 0x00, 0x00, 0xff, 0xff, 0x50, 0x31, 0x7b, 0x39, + 0xc7, 0x06, 0x00, 0x00, } func (m *EventSystemContractUpdated) Marshal() (dAtA []byte, err error) { @@ -690,6 +870,136 @@ func (m *EventZRC20PausedStatusUpdated) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } +func (m *EventSystemContractsDeployed) 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 *EventSystemContractsDeployed) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventSystemContractsDeployed) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x3a + } + if len(m.SystemContract) > 0 { + i -= len(m.SystemContract) + copy(dAtA[i:], m.SystemContract) + i = encodeVarintEvents(dAtA, i, uint64(len(m.SystemContract))) + i-- + dAtA[i] = 0x32 + } + if len(m.ConnectorZevm) > 0 { + i -= len(m.ConnectorZevm) + copy(dAtA[i:], m.ConnectorZevm) + i = encodeVarintEvents(dAtA, i, uint64(len(m.ConnectorZevm))) + i-- + dAtA[i] = 0x2a + } + if len(m.UniswapV2Router) > 0 { + i -= len(m.UniswapV2Router) + copy(dAtA[i:], m.UniswapV2Router) + i = encodeVarintEvents(dAtA, i, uint64(len(m.UniswapV2Router))) + i-- + dAtA[i] = 0x22 + } + if len(m.Wzeta) > 0 { + i -= len(m.Wzeta) + copy(dAtA[i:], m.Wzeta) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Wzeta))) + i-- + dAtA[i] = 0x1a + } + if len(m.UniswapV2Factory) > 0 { + i -= len(m.UniswapV2Factory) + copy(dAtA[i:], m.UniswapV2Factory) + i = encodeVarintEvents(dAtA, i, uint64(len(m.UniswapV2Factory))) + i-- + dAtA[i] = 0x12 + } + if len(m.MsgTypeUrl) > 0 { + i -= len(m.MsgTypeUrl) + copy(dAtA[i:], m.MsgTypeUrl) + i = encodeVarintEvents(dAtA, i, uint64(len(m.MsgTypeUrl))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventBytecodeUpdated) 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 *EventBytecodeUpdated) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventBytecodeUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x2a + } + if len(m.OldBytecodeHash) > 0 { + i -= len(m.OldBytecodeHash) + copy(dAtA[i:], m.OldBytecodeHash) + i = encodeVarintEvents(dAtA, i, uint64(len(m.OldBytecodeHash))) + i-- + dAtA[i] = 0x22 + } + if len(m.NewBytecodeHash) > 0 { + i -= len(m.NewBytecodeHash) + copy(dAtA[i:], m.NewBytecodeHash) + i = encodeVarintEvents(dAtA, i, uint64(len(m.NewBytecodeHash))) + i-- + dAtA[i] = 0x1a + } + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintEvents(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.MsgTypeUrl) > 0 { + i -= len(m.MsgTypeUrl) + copy(dAtA[i:], m.MsgTypeUrl) + i = encodeVarintEvents(dAtA, i, uint64(len(m.MsgTypeUrl))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { offset -= sovEvents(v) base := offset @@ -836,6 +1146,72 @@ func (m *EventZRC20PausedStatusUpdated) Size() (n int) { return n } +func (m *EventSystemContractsDeployed) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.MsgTypeUrl) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.UniswapV2Factory) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Wzeta) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.UniswapV2Router) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.ConnectorZevm) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.SystemContract) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + +func (m *EventBytecodeUpdated) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.MsgTypeUrl) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.NewBytecodeHash) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.OldBytecodeHash) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + func sovEvents(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1783,6 +2159,490 @@ func (m *EventZRC20PausedStatusUpdated) Unmarshal(dAtA []byte) error { } return nil } +func (m *EventSystemContractsDeployed) 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 ErrIntOverflowEvents + } + 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: EventSystemContractsDeployed: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventSystemContractsDeployed: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MsgTypeUrl = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UniswapV2Factory", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UniswapV2Factory = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Wzeta", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Wzeta = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UniswapV2Router", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UniswapV2Router = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConnectorZevm", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConnectorZevm = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SystemContract", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SystemContract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventBytecodeUpdated) 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 ErrIntOverflowEvents + } + 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: EventBytecodeUpdated: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventBytecodeUpdated: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MsgTypeUrl", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MsgTypeUrl = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewBytecodeHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewBytecodeHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OldBytecodeHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OldBytecodeHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipEvents(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/fungible/types/message_deploy_system_contracts.go b/x/fungible/types/message_deploy_system_contracts.go new file mode 100644 index 0000000000..579df47a25 --- /dev/null +++ b/x/fungible/types/message_deploy_system_contracts.go @@ -0,0 +1,45 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const TypeMsgDeploySystemContracts = "deploy_system_contract" + +var _ sdk.Msg = &MsgDeploySystemContracts{} + +func NewMsgDeploySystemContracts(creator string) *MsgDeploySystemContracts { + return &MsgDeploySystemContracts{ + Creator: creator, + } +} + +func (msg *MsgDeploySystemContracts) Route() string { + return RouterKey +} + +func (msg *MsgDeploySystemContracts) Type() string { + return TypeMsgDeployFungibleCoinZRC20 +} + +func (msg *MsgDeploySystemContracts) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgDeploySystemContracts) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgDeploySystemContracts) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + return nil +} diff --git a/x/fungible/types/message_deploy_system_contracts_test.go b/x/fungible/types/message_deploy_system_contracts_test.go new file mode 100644 index 0000000000..b14aa419ed --- /dev/null +++ b/x/fungible/types/message_deploy_system_contracts_test.go @@ -0,0 +1,42 @@ +package types_test + +import ( + "testing" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/fungible/types" +) + +func TestMsgDeploySystemContract_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg types.MsgDeploySystemContracts + err error + }{ + { + name: "invalid address", + msg: types.MsgDeploySystemContracts{ + Creator: "invalid_address", + }, + err: sdkerrors.ErrInvalidAddress, + }, + { + name: "valid message", + msg: types.MsgDeploySystemContracts{ + Creator: sample.AccAddress(), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/fungible/types/message_update_contract_bytecode.go b/x/fungible/types/message_update_contract_bytecode.go index a8a10cb5bd..212526b558 100644 --- a/x/fungible/types/message_update_contract_bytecode.go +++ b/x/fungible/types/message_update_contract_bytecode.go @@ -13,12 +13,14 @@ const TypeMsgUpdateContractBytecode = "update_contract_bytecode" var _ sdk.Msg = &MsgUpdateContractBytecode{} func NewMsgUpdateContractBytecode( - creator string, contractAddress ethcommon.Address, newBytecodeAddress ethcommon.Address, + creator string, + contractAddress string, + newCodeHash string, ) *MsgUpdateContractBytecode { return &MsgUpdateContractBytecode{ - Creator: creator, - ContractAddress: contractAddress.Hex(), - NewBytecodeAddress: newBytecodeAddress.Hex(), + Creator: creator, + ContractAddress: contractAddress, + NewCodeHash: newCodeHash, } } @@ -53,9 +55,10 @@ func (msg *MsgUpdateContractBytecode) ValidateBasic() error { return cosmoserror.Wrapf(sdkerrors.ErrInvalidAddress, "invalid contract address (%s)", msg.ContractAddress) } - // check if the bytecode contract address is valid - if !ethcommon.IsHexAddress(msg.NewBytecodeAddress) { - return cosmoserror.Wrapf(sdkerrors.ErrInvalidAddress, "invalid contract address (%s)", msg.ContractAddress) + // check if the new code hash is valid, it should be 32 bytes + // 32 bytes = 64 hex characters + 0x prefix + if len(msg.NewCodeHash) != 66 { + return cosmoserror.Wrapf(sdkerrors.ErrInvalidRequest, "invalid new code hash length (%d)", len(msg.NewCodeHash)) } return nil diff --git a/x/fungible/types/message_update_contract_bytecode_test.go b/x/fungible/types/message_update_contract_bytecode_test.go index 23a1ee2d97..02e8b3cfdd 100644 --- a/x/fungible/types/message_update_contract_bytecode_test.go +++ b/x/fungible/types/message_update_contract_bytecode_test.go @@ -17,36 +17,36 @@ func TestMsgUpdateContractBytecode_ValidateBasic(t *testing.T) { { name: "valid", msg: types.MsgUpdateContractBytecode{ - Creator: sample.AccAddress(), - ContractAddress: sample.EthAddress().Hex(), - NewBytecodeAddress: sample.EthAddress().Hex(), + Creator: sample.AccAddress(), + ContractAddress: sample.EthAddress().Hex(), + NewCodeHash: sample.Hash().Hex(), }, wantError: false, }, { name: "invalid creator", msg: types.MsgUpdateContractBytecode{ - Creator: "invalid", - ContractAddress: sample.EthAddress().Hex(), - NewBytecodeAddress: sample.EthAddress().Hex(), + Creator: "invalid", + ContractAddress: sample.EthAddress().Hex(), + NewCodeHash: sample.Hash().Hex(), }, wantError: true, }, { name: "invalid contract address", msg: types.MsgUpdateContractBytecode{ - Creator: sample.AccAddress(), - ContractAddress: "invalid", - NewBytecodeAddress: sample.EthAddress().Hex(), + Creator: sample.AccAddress(), + ContractAddress: "invalid", + NewCodeHash: sample.Hash().Hex(), }, wantError: true, }, { - name: "invalid bytecode address", + name: "invalid new code hash", msg: types.MsgUpdateContractBytecode{ - Creator: sample.AccAddress(), - ContractAddress: sample.EthAddress().Hex(), - NewBytecodeAddress: "invalid", + Creator: sample.AccAddress(), + ContractAddress: sample.EthAddress().Hex(), + NewCodeHash: "invalid", }, wantError: true, }, diff --git a/x/fungible/types/query.pb.go b/x/fungible/types/query.pb.go index c8db6b9a46..89ad3937b2 100644 --- a/x/fungible/types/query.pb.go +++ b/x/fungible/types/query.pb.go @@ -696,6 +696,94 @@ func (m *QueryAllGasStabilityPoolBalanceResponse_Balance) GetBalance() string { return "" } +type QueryCodeHashRequest struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *QueryCodeHashRequest) Reset() { *m = QueryCodeHashRequest{} } +func (m *QueryCodeHashRequest) String() string { return proto.CompactTextString(m) } +func (*QueryCodeHashRequest) ProtoMessage() {} +func (*QueryCodeHashRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d671b6e9298b37cd, []int{14} +} +func (m *QueryCodeHashRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCodeHashRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCodeHashRequest.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 *QueryCodeHashRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCodeHashRequest.Merge(m, src) +} +func (m *QueryCodeHashRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryCodeHashRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCodeHashRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCodeHashRequest proto.InternalMessageInfo + +func (m *QueryCodeHashRequest) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +type QueryCodeHashResponse struct { + CodeHash string `protobuf:"bytes,1,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"` +} + +func (m *QueryCodeHashResponse) Reset() { *m = QueryCodeHashResponse{} } +func (m *QueryCodeHashResponse) String() string { return proto.CompactTextString(m) } +func (*QueryCodeHashResponse) ProtoMessage() {} +func (*QueryCodeHashResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d671b6e9298b37cd, []int{15} +} +func (m *QueryCodeHashResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCodeHashResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCodeHashResponse.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 *QueryCodeHashResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCodeHashResponse.Merge(m, src) +} +func (m *QueryCodeHashResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryCodeHashResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCodeHashResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCodeHashResponse proto.InternalMessageInfo + +func (m *QueryCodeHashResponse) GetCodeHash() string { + if m != nil { + return m.CodeHash + } + return "" +} + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "zetachain.zetacore.fungible.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "zetachain.zetacore.fungible.QueryParamsResponse") @@ -712,65 +800,72 @@ func init() { proto.RegisterType((*QueryAllGasStabilityPoolBalance)(nil), "zetachain.zetacore.fungible.QueryAllGasStabilityPoolBalance") proto.RegisterType((*QueryAllGasStabilityPoolBalanceResponse)(nil), "zetachain.zetacore.fungible.QueryAllGasStabilityPoolBalanceResponse") proto.RegisterType((*QueryAllGasStabilityPoolBalanceResponse_Balance)(nil), "zetachain.zetacore.fungible.QueryAllGasStabilityPoolBalanceResponse.Balance") + proto.RegisterType((*QueryCodeHashRequest)(nil), "zetachain.zetacore.fungible.QueryCodeHashRequest") + proto.RegisterType((*QueryCodeHashResponse)(nil), "zetachain.zetacore.fungible.QueryCodeHashResponse") } func init() { proto.RegisterFile("fungible/query.proto", fileDescriptor_d671b6e9298b37cd) } var fileDescriptor_d671b6e9298b37cd = []byte{ - // 846 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x96, 0x4d, 0x4f, 0xdb, 0x48, - 0x18, 0xc7, 0x63, 0x58, 0x5e, 0x76, 0x60, 0x59, 0x69, 0x36, 0xab, 0x65, 0x0d, 0x38, 0xbb, 0x03, - 0x0b, 0x5b, 0x4a, 0xed, 0x02, 0x87, 0x52, 0x1a, 0x55, 0x4d, 0xa8, 0x40, 0x48, 0x3d, 0xd0, 0x70, - 0x69, 0x7b, 0x89, 0x26, 0xc9, 0x60, 0x2c, 0x39, 0x9e, 0x90, 0x71, 0x10, 0x29, 0xe2, 0xd2, 0x4f, - 0x80, 0xd4, 0x6f, 0xd2, 0x4b, 0x2f, 0xfd, 0x00, 0x1c, 0x91, 0x2a, 0x55, 0xed, 0xa5, 0x6a, 0x43, - 0xfb, 0x3d, 0xaa, 0x8c, 0x1f, 0x9b, 0x38, 0xb5, 0x13, 0x2b, 0xdc, 0xec, 0x99, 0xe7, 0xe5, 0xf7, - 0x9f, 0x79, 0xfc, 0x4f, 0x50, 0xfa, 0xa0, 0xe1, 0x98, 0x56, 0xc9, 0x66, 0xc6, 0x51, 0x83, 0xd5, - 0x9b, 0x7a, 0xad, 0xce, 0x5d, 0x8e, 0x67, 0x5e, 0x32, 0x97, 0x96, 0x0f, 0xa9, 0xe5, 0xe8, 0xf2, - 0x89, 0xd7, 0x99, 0xee, 0x07, 0xaa, 0xcb, 0x65, 0x2e, 0xaa, 0x5c, 0x18, 0x25, 0x2a, 0x20, 0xcb, - 0x38, 0x5e, 0x2d, 0x31, 0x97, 0xae, 0x1a, 0x35, 0x6a, 0x5a, 0x0e, 0x75, 0x2d, 0xee, 0x78, 0x85, - 0xd4, 0xd9, 0xa0, 0xfc, 0x01, 0xaf, 0x33, 0xcb, 0x74, 0x8a, 0x65, 0x6e, 0x39, 0x02, 0x76, 0xff, - 0x0c, 0x76, 0x6b, 0xb4, 0x4e, 0xab, 0xfe, 0xb2, 0x16, 0x2c, 0x8b, 0xa6, 0x70, 0x59, 0xb5, 0x58, - 0xe6, 0x8e, 0x5b, 0xa7, 0x65, 0x17, 0xf6, 0xd3, 0x26, 0x37, 0xb9, 0x7c, 0x34, 0xda, 0x4f, 0x7e, - 0x2b, 0x93, 0x73, 0xd3, 0x66, 0x06, 0xad, 0x59, 0x06, 0x75, 0x1c, 0xee, 0x4a, 0x0e, 0xa8, 0x49, - 0xd2, 0x08, 0x3f, 0x6d, 0xa3, 0xee, 0xc9, 0x46, 0x05, 0x76, 0xd4, 0x60, 0xc2, 0x25, 0xcf, 0xd0, - 0x1f, 0xa1, 0x55, 0x51, 0xe3, 0x8e, 0x60, 0x38, 0x87, 0x46, 0x3d, 0xa0, 0x69, 0xe5, 0x1f, 0xe5, - 0xff, 0x89, 0xb5, 0x79, 0xbd, 0xc7, 0x79, 0xe8, 0x5e, 0x72, 0xfe, 0x97, 0x8b, 0xcf, 0x99, 0x54, - 0x01, 0x12, 0xc9, 0x3a, 0x9a, 0x91, 0x95, 0x77, 0x98, 0xbb, 0xed, 0x29, 0xdf, 0x6a, 0x0b, 0x87, - 0xc6, 0x38, 0x8d, 0x46, 0x2c, 0xa7, 0xc2, 0x4e, 0x64, 0x83, 0x5f, 0x0b, 0xde, 0x0b, 0x11, 0x68, - 0x36, 0x3a, 0x09, 0xb8, 0xf6, 0xd1, 0xe4, 0x41, 0xc7, 0x3a, 0xd0, 0xdd, 0xea, 0x49, 0xd7, 0x59, - 0x08, 0x18, 0x43, 0x45, 0x08, 0x03, 0xd2, 0x9c, 0x6d, 0x47, 0x91, 0x6e, 0x23, 0x74, 0x7d, 0xab, - 0xd0, 0x71, 0x51, 0xf7, 0x46, 0x40, 0x6f, 0x8f, 0x80, 0xee, 0x0d, 0x0e, 0x8c, 0x80, 0xbe, 0x47, - 0x4d, 0x06, 0xb9, 0x85, 0x8e, 0x4c, 0xf2, 0x4e, 0x01, 0x71, 0x3f, 0xf5, 0x89, 0x15, 0x37, 0x7c, - 0x63, 0x71, 0x78, 0x27, 0x44, 0x3f, 0x24, 0xe9, 0x97, 0xfa, 0xd2, 0x7b, 0x44, 0x21, 0xfc, 0x0c, - 0x9a, 0xf3, 0xaf, 0x66, 0x5f, 0x0e, 0xe5, 0x16, 0xcc, 0xa4, 0x3f, 0x4a, 0xa7, 0x48, 0x8b, 0x0b, - 0x00, 0x81, 0xcf, 0xd1, 0x54, 0x78, 0x07, 0x4e, 0xf3, 0x76, 0x4f, 0x89, 0xe1, 0x14, 0x10, 0xd9, - 0x55, 0x88, 0xfc, 0x8b, 0x32, 0x7e, 0xf3, 0x1d, 0x2a, 0xf6, 0x5d, 0x5a, 0xb2, 0x6c, 0xcb, 0x6d, - 0xee, 0x71, 0x6e, 0xe7, 0x2a, 0x95, 0x3a, 0x13, 0x82, 0x1c, 0xa1, 0xa5, 0x3e, 0x21, 0x01, 0xe8, - 0x7f, 0x68, 0xca, 0x3b, 0xa1, 0x22, 0xf5, 0x76, 0x60, 0x4a, 0x7f, 0xf3, 0x56, 0x21, 0x1c, 0x67, - 0xd0, 0x04, 0x3b, 0xae, 0x06, 0x31, 0x43, 0x32, 0x06, 0xb1, 0xe3, 0xaa, 0xdf, 0x32, 0x1b, 0x4f, - 0x95, 0xa7, 0x36, 0x75, 0xca, 0x0c, 0xff, 0x8d, 0xc6, 0xa5, 0xf0, 0xa2, 0x55, 0x91, 0x4d, 0x86, - 0x0b, 0x63, 0xf2, 0x7d, 0xb7, 0x42, 0xb6, 0xe2, 0x81, 0x21, 0x3b, 0x00, 0x9e, 0x46, 0x63, 0x25, - 0x6f, 0x09, 0x28, 0xfc, 0xd7, 0xe0, 0x60, 0x72, 0xb6, 0x1d, 0x53, 0x84, 0x7c, 0x52, 0xa0, 0x51, - 0x7c, 0x4c, 0xd0, 0xc8, 0x41, 0xe3, 0x50, 0xd9, 0x9f, 0xcf, 0x27, 0x3d, 0x2f, 0x2f, 0x61, 0x5d, - 0x1d, 0xde, 0xe1, 0x76, 0x83, 0x1e, 0xea, 0x43, 0x34, 0xd6, 0xff, 0xa4, 0xe2, 0xe5, 0xaf, 0x7d, - 0x47, 0x68, 0x44, 0x32, 0xe0, 0x73, 0x05, 0x8d, 0x7a, 0x46, 0x85, 0x8d, 0xfe, 0xc8, 0x21, 0x97, - 0x54, 0xef, 0x26, 0x4f, 0xf0, 0xf4, 0x90, 0xf9, 0x57, 0xef, 0xbf, 0xbd, 0x1e, 0x9a, 0xc3, 0x33, - 0x46, 0x3b, 0xfe, 0x8e, 0x4c, 0x35, 0xba, 0xcc, 0x1e, 0xbf, 0x55, 0xd0, 0x64, 0xe7, 0x07, 0x8c, - 0x37, 0xfa, 0xf7, 0x89, 0xb6, 0x53, 0xf5, 0xfe, 0x00, 0x99, 0x80, 0xba, 0x26, 0x51, 0x57, 0xf0, - 0x72, 0x24, 0x6a, 0xe8, 0x57, 0xcb, 0x38, 0x95, 0x36, 0x7d, 0x86, 0xdf, 0x28, 0xe8, 0xf7, 0xce, - 0x62, 0x39, 0xdb, 0x4e, 0x02, 0x1f, 0xed, 0xb0, 0x49, 0xe0, 0x63, 0x3c, 0x93, 0x2c, 0x4b, 0xf8, - 0x05, 0x4c, 0xfa, 0xc3, 0xb7, 0x8f, 0xbb, 0xcb, 0x36, 0xf0, 0x66, 0xa2, 0x63, 0x8b, 0xf4, 0x3b, - 0xf5, 0xc1, 0x40, 0xb9, 0xc0, 0xbd, 0x22, 0xb9, 0x17, 0xf1, 0x42, 0x24, 0x77, 0xd7, 0xaf, 0x3e, - 0xfe, 0xa0, 0xa0, 0xbf, 0x62, 0x3c, 0x0b, 0x67, 0x13, 0x61, 0xc4, 0x64, 0xab, 0x8f, 0x6f, 0x92, - 0x1d, 0xa8, 0xb9, 0x27, 0xd5, 0xac, 0x62, 0x23, 0x52, 0x8d, 0x49, 0x45, 0x51, 0xf8, 0xe9, 0xc5, - 0x1a, 0xe7, 0xb6, 0x6f, 0x99, 0xf8, 0x6b, 0x84, 0x30, 0xff, 0x7b, 0x1f, 0x4c, 0x18, 0x64, 0x0f, - 0x28, 0xac, 0xcb, 0x96, 0x48, 0x5e, 0x0a, 0xcb, 0xe2, 0xcd, 0xa4, 0xc2, 0xc0, 0x77, 0x8c, 0x53, - 0xdf, 0xaa, 0xce, 0x70, 0x4b, 0x41, 0x6a, 0x4c, 0x9f, 0xf6, 0x67, 0x93, 0xbd, 0x89, 0x7f, 0x26, - 0x91, 0xd9, 0xdf, 0x7d, 0xc9, 0x23, 0x29, 0x73, 0x13, 0x6f, 0x74, 0xca, 0xf4, 0xcb, 0x25, 0xd1, - 0x9b, 0xdf, 0xbd, 0x68, 0x69, 0xca, 0x65, 0x4b, 0x53, 0xbe, 0xb4, 0x34, 0xe5, 0xfc, 0x4a, 0x4b, - 0x5d, 0x5e, 0x69, 0xa9, 0x8f, 0x57, 0x5a, 0xea, 0x85, 0x61, 0x5a, 0xee, 0x61, 0xa3, 0xa4, 0x97, - 0x79, 0x35, 0xb2, 0xfa, 0xc9, 0x75, 0x7d, 0xb7, 0x59, 0x63, 0xa2, 0x34, 0x2a, 0xff, 0xaf, 0xae, - 0xff, 0x08, 0x00, 0x00, 0xff, 0xff, 0x88, 0x06, 0xca, 0xa7, 0x99, 0x0b, 0x00, 0x00, + // 927 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x41, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0xa6, 0x34, 0x49, 0x5f, 0x43, 0x91, 0x06, 0x57, 0x84, 0x4d, 0xbb, 0x81, 0x69, 0x69, + 0x4b, 0x28, 0xbb, 0x49, 0x8a, 0x44, 0x09, 0x11, 0xc2, 0x31, 0x6a, 0xa8, 0xc4, 0x21, 0x38, 0x17, + 0xe0, 0x62, 0x8d, 0xd7, 0x93, 0xf5, 0x4a, 0xeb, 0x1d, 0xc7, 0xb3, 0x8e, 0x6a, 0xac, 0x5c, 0xb8, + 0x72, 0xa9, 0xc4, 0x4f, 0xe0, 0x1f, 0x70, 0xe1, 0xc2, 0x0f, 0xe8, 0xb1, 0x12, 0x12, 0x82, 0x0b, + 0x02, 0x87, 0x1f, 0x82, 0x3c, 0xfb, 0x66, 0xe3, 0x35, 0xbb, 0xde, 0xc5, 0xb9, 0xed, 0xcc, 0xbc, + 0xef, 0xbd, 0xef, 0x7b, 0xf3, 0xfc, 0x8d, 0xa1, 0x72, 0xdc, 0x0f, 0x3d, 0xbf, 0x19, 0x70, 0xe7, + 0xa4, 0xcf, 0x7b, 0x03, 0xbb, 0xdb, 0x13, 0x91, 0x20, 0xeb, 0xdf, 0xf2, 0x88, 0xb9, 0x6d, 0xe6, + 0x87, 0xb6, 0xfa, 0x12, 0x3d, 0x6e, 0xeb, 0x40, 0x73, 0xd3, 0x15, 0xb2, 0x23, 0xa4, 0xd3, 0x64, + 0x12, 0x51, 0xce, 0xe9, 0x76, 0x93, 0x47, 0x6c, 0xdb, 0xe9, 0x32, 0xcf, 0x0f, 0x59, 0xe4, 0x8b, + 0x30, 0x4e, 0x64, 0xde, 0x4a, 0xd2, 0x1f, 0x8b, 0x1e, 0xf7, 0xbd, 0xb0, 0xe1, 0x0a, 0x3f, 0x94, + 0x78, 0x7a, 0x33, 0x39, 0xed, 0xb2, 0x1e, 0xeb, 0xe8, 0x6d, 0x2b, 0xd9, 0x96, 0x03, 0x19, 0xf1, + 0x4e, 0xc3, 0x15, 0x61, 0xd4, 0x63, 0x6e, 0x84, 0xe7, 0x15, 0x4f, 0x78, 0x42, 0x7d, 0x3a, 0xe3, + 0x2f, 0x5d, 0xca, 0x13, 0xc2, 0x0b, 0xb8, 0xc3, 0xba, 0xbe, 0xc3, 0xc2, 0x50, 0x44, 0x8a, 0x07, + 0xe6, 0xa4, 0x15, 0x20, 0x5f, 0x8e, 0xa9, 0x1e, 0xaa, 0x42, 0x75, 0x7e, 0xd2, 0xe7, 0x32, 0xa2, + 0x5f, 0xc1, 0xeb, 0xa9, 0x5d, 0xd9, 0x15, 0xa1, 0xe4, 0xa4, 0x0a, 0x4b, 0x31, 0xa1, 0x35, 0xe3, + 0x2d, 0xe3, 0xc1, 0xf5, 0x9d, 0x3b, 0xf6, 0x8c, 0x7e, 0xd8, 0x31, 0x78, 0xff, 0x95, 0x17, 0x7f, + 0x6e, 0x2c, 0xd4, 0x11, 0x48, 0x1f, 0xc1, 0xba, 0xca, 0x7c, 0xc0, 0xa3, 0x27, 0xb1, 0xf2, 0xda, + 0x58, 0x38, 0x16, 0x26, 0x15, 0xb8, 0xea, 0x87, 0x2d, 0xfe, 0x4c, 0x15, 0xb8, 0x56, 0x8f, 0x17, + 0x54, 0xc2, 0xad, 0x6c, 0x10, 0xf2, 0x3a, 0x82, 0xd5, 0xe3, 0x89, 0x7d, 0x64, 0xf7, 0xee, 0x4c, + 0x76, 0x93, 0x89, 0x90, 0x63, 0x2a, 0x09, 0xe5, 0xc8, 0xb4, 0x1a, 0x04, 0x59, 0x4c, 0x9f, 0x00, + 0x5c, 0xdc, 0x2a, 0x56, 0xbc, 0x67, 0xc7, 0x23, 0x60, 0x8f, 0x47, 0xc0, 0x8e, 0x07, 0x07, 0x47, + 0xc0, 0x3e, 0x64, 0x1e, 0x47, 0x6c, 0x7d, 0x02, 0x49, 0x7f, 0x31, 0x50, 0xdc, 0x7f, 0xea, 0xe4, + 0x8a, 0xbb, 0x72, 0x69, 0x71, 0xe4, 0x20, 0xc5, 0x7e, 0x51, 0xb1, 0xbf, 0x5f, 0xc8, 0x3e, 0x66, + 0x94, 0xa2, 0xbf, 0x01, 0xb7, 0xf5, 0xd5, 0x1c, 0xa9, 0xa1, 0xac, 0xe1, 0x4c, 0xea, 0x51, 0x1a, + 0x82, 0x95, 0x17, 0x80, 0x02, 0xbf, 0x86, 0x1b, 0xe9, 0x13, 0xec, 0xe6, 0x7b, 0x33, 0x25, 0xa6, + 0x21, 0x28, 0x72, 0x2a, 0x11, 0x7d, 0x1b, 0x36, 0x74, 0xf1, 0x03, 0x26, 0x8f, 0x22, 0xd6, 0xf4, + 0x03, 0x3f, 0x1a, 0x1c, 0x0a, 0x11, 0x54, 0x5b, 0xad, 0x1e, 0x97, 0x92, 0x9e, 0xc0, 0xfd, 0x82, + 0x90, 0x84, 0xe8, 0x3b, 0x70, 0x23, 0xee, 0x50, 0x83, 0xc5, 0x27, 0x38, 0xa5, 0xaf, 0xc6, 0xbb, + 0x18, 0x4e, 0x36, 0xe0, 0x3a, 0x3f, 0xed, 0x24, 0x31, 0x8b, 0x2a, 0x06, 0xf8, 0x69, 0x47, 0x97, + 0xdc, 0xcb, 0x67, 0xb5, 0xcf, 0x02, 0x16, 0xba, 0x9c, 0xbc, 0x09, 0x2b, 0x4a, 0x78, 0xc3, 0x6f, + 0xa9, 0x22, 0x57, 0xea, 0xcb, 0x6a, 0xfd, 0xb4, 0x45, 0x6b, 0xf9, 0x84, 0x11, 0x9d, 0x10, 0x5e, + 0x83, 0xe5, 0x66, 0xbc, 0x85, 0x2c, 0xf4, 0x32, 0x69, 0x4c, 0x35, 0x08, 0x72, 0x92, 0xd0, 0x3f, + 0x0c, 0x2c, 0x94, 0x1f, 0x93, 0x14, 0x0a, 0x61, 0x05, 0x33, 0xeb, 0xf9, 0xfc, 0x62, 0xe6, 0xe5, + 0x95, 0xcc, 0x6b, 0xe3, 0x1a, 0x6f, 0x37, 0xa9, 0x61, 0x7e, 0x02, 0xcb, 0xc5, 0x9d, 0x9a, 0x21, + 0x7f, 0x0b, 0x2a, 0x8a, 0x42, 0x4d, 0xb4, 0xf8, 0xe7, 0x4c, 0xb6, 0xf5, 0x8f, 0x7a, 0x0d, 0x96, + 0xd3, 0x57, 0xab, 0x97, 0xf4, 0x03, 0xb8, 0x39, 0x85, 0x40, 0xe9, 0xeb, 0x70, 0xcd, 0x15, 0x2d, + 0xde, 0x68, 0x33, 0xd9, 0x46, 0xd0, 0x8a, 0x8b, 0x41, 0x3b, 0xdf, 0xaf, 0xc2, 0x55, 0x05, 0x23, + 0xcf, 0x0d, 0x58, 0x8a, 0x0d, 0x91, 0x38, 0xc5, 0xad, 0x49, 0xb9, 0xb1, 0xb9, 0x55, 0x1e, 0x10, + 0x93, 0xa2, 0x77, 0xbe, 0xfb, 0xf5, 0x9f, 0x1f, 0x16, 0x6f, 0x93, 0x75, 0x67, 0x1c, 0xff, 0xbe, + 0x82, 0x3a, 0x53, 0x8f, 0x0a, 0xf9, 0xd9, 0x80, 0xd5, 0x49, 0xa3, 0x20, 0x8f, 0x8b, 0xeb, 0x64, + 0xdb, 0xb6, 0xf9, 0xd1, 0x1c, 0x48, 0xa4, 0xba, 0xa3, 0xa8, 0x3e, 0x24, 0x9b, 0x99, 0x54, 0x53, + 0xaf, 0xa3, 0x33, 0x54, 0xcf, 0xc1, 0x19, 0xf9, 0xc9, 0x80, 0xd7, 0x26, 0x93, 0x55, 0x83, 0xa0, + 0x0c, 0xf9, 0x6c, 0x27, 0x2f, 0x43, 0x3e, 0xc7, 0x9b, 0xe9, 0xa6, 0x22, 0x7f, 0x97, 0xd0, 0x62, + 0xf2, 0xe3, 0x76, 0x4f, 0xd9, 0x13, 0xd9, 0x2d, 0xd5, 0xb6, 0x4c, 0x5f, 0x35, 0x3f, 0x9e, 0x0b, + 0x8b, 0xbc, 0x1f, 0x2a, 0xde, 0xf7, 0xc8, 0xdd, 0x4c, 0xde, 0x53, 0xff, 0x2e, 0xc8, 0x6f, 0x06, + 0xbc, 0x91, 0xe3, 0x8d, 0x64, 0xaf, 0x14, 0x8d, 0x1c, 0xb4, 0xf9, 0xd9, 0x65, 0xd0, 0x89, 0x9a, + 0x0f, 0x95, 0x9a, 0x6d, 0xe2, 0x64, 0xaa, 0xf1, 0x98, 0x6c, 0x48, 0x0d, 0x6f, 0x74, 0x85, 0x08, + 0xb4, 0x35, 0x93, 0xbf, 0x33, 0x84, 0x69, 0x5f, 0x99, 0x4f, 0x18, 0xa2, 0xe7, 0x14, 0x36, 0x65, + 0x7f, 0x74, 0x5f, 0x09, 0xdb, 0x23, 0xbb, 0x65, 0x85, 0xa1, 0xbf, 0x39, 0x43, 0x6d, 0x89, 0x67, + 0x64, 0x64, 0x80, 0x99, 0x53, 0x67, 0xfc, 0xb3, 0xd9, 0xbb, 0x8c, 0x4f, 0x97, 0x91, 0x59, 0xec, + 0xf2, 0xf4, 0x53, 0x25, 0x73, 0x97, 0x3c, 0x9e, 0x94, 0xa9, 0xd3, 0x95, 0xd1, 0x4b, 0x7e, 0x34, + 0x60, 0x45, 0x3b, 0x33, 0xd9, 0x2e, 0x26, 0x35, 0xe5, 0xfb, 0xe6, 0xce, 0xff, 0x81, 0x20, 0xeb, + 0x2d, 0xc5, 0x7a, 0x93, 0x3c, 0xc8, 0xbc, 0x9c, 0xe4, 0x4d, 0x70, 0x86, 0x38, 0x6d, 0x67, 0xfb, + 0x4f, 0x5f, 0x8c, 0x2c, 0xe3, 0xe5, 0xc8, 0x32, 0xfe, 0x1a, 0x59, 0xc6, 0xf3, 0x73, 0x6b, 0xe1, + 0xe5, 0xb9, 0xb5, 0xf0, 0xfb, 0xb9, 0xb5, 0xf0, 0x8d, 0xe3, 0xf9, 0x51, 0xbb, 0xdf, 0xb4, 0x5d, + 0xd1, 0xc9, 0xec, 0xc1, 0xb3, 0x8b, 0xc4, 0xd1, 0xa0, 0xcb, 0x65, 0x73, 0x49, 0xfd, 0x7b, 0x7f, + 0xf4, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x10, 0x51, 0x58, 0xac, 0xa7, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -799,6 +894,8 @@ type QueryClient interface { GasStabilityPoolBalance(ctx context.Context, in *QueryGetGasStabilityPoolBalance, opts ...grpc.CallOption) (*QueryGetGasStabilityPoolBalanceResponse, error) // Queries all gas stability pool balances. GasStabilityPoolBalanceAll(ctx context.Context, in *QueryAllGasStabilityPoolBalance, opts ...grpc.CallOption) (*QueryAllGasStabilityPoolBalanceResponse, error) + // Code hash query the code hash of a contract. + CodeHash(ctx context.Context, in *QueryCodeHashRequest, opts ...grpc.CallOption) (*QueryCodeHashResponse, error) } type queryClient struct { @@ -872,6 +969,15 @@ func (c *queryClient) GasStabilityPoolBalanceAll(ctx context.Context, in *QueryA return out, nil } +func (c *queryClient) CodeHash(ctx context.Context, in *QueryCodeHashRequest, opts ...grpc.CallOption) (*QueryCodeHashResponse, error) { + out := new(QueryCodeHashResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.fungible.Query/CodeHash", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Parameters queries the parameters of the module. @@ -888,6 +994,8 @@ type QueryServer interface { GasStabilityPoolBalance(context.Context, *QueryGetGasStabilityPoolBalance) (*QueryGetGasStabilityPoolBalanceResponse, error) // Queries all gas stability pool balances. GasStabilityPoolBalanceAll(context.Context, *QueryAllGasStabilityPoolBalance) (*QueryAllGasStabilityPoolBalanceResponse, error) + // Code hash query the code hash of a contract. + CodeHash(context.Context, *QueryCodeHashRequest) (*QueryCodeHashResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -915,6 +1023,9 @@ func (*UnimplementedQueryServer) GasStabilityPoolBalance(ctx context.Context, re func (*UnimplementedQueryServer) GasStabilityPoolBalanceAll(ctx context.Context, req *QueryAllGasStabilityPoolBalance) (*QueryAllGasStabilityPoolBalanceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GasStabilityPoolBalanceAll not implemented") } +func (*UnimplementedQueryServer) CodeHash(ctx context.Context, req *QueryCodeHashRequest) (*QueryCodeHashResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CodeHash not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1046,6 +1157,24 @@ func _Query_GasStabilityPoolBalanceAll_Handler(srv interface{}, ctx context.Cont return interceptor(ctx, in, info, handler) } +func _Query_CodeHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryCodeHashRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).CodeHash(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.fungible.Query/CodeHash", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).CodeHash(ctx, req.(*QueryCodeHashRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "zetachain.zetacore.fungible.Query", HandlerType: (*QueryServer)(nil), @@ -1078,6 +1207,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "GasStabilityPoolBalanceAll", Handler: _Query_GasStabilityPoolBalanceAll_Handler, }, + { + MethodName: "CodeHash", + Handler: _Query_CodeHash_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "fungible/query.proto", @@ -1555,6 +1688,66 @@ func (m *QueryAllGasStabilityPoolBalanceResponse_Balance) MarshalToSizedBuffer(d return len(dAtA) - i, nil } +func (m *QueryCodeHashRequest) 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 *QueryCodeHashRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCodeHashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryCodeHashResponse) 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 *QueryCodeHashResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCodeHashResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.CodeHash) > 0 { + i -= len(m.CodeHash) + copy(dAtA[i:], m.CodeHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.CodeHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -1753,6 +1946,32 @@ func (m *QueryAllGasStabilityPoolBalanceResponse_Balance) Size() (n int) { return n } +func (m *QueryCodeHashRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryCodeHashResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.CodeHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2946,6 +3165,170 @@ func (m *QueryAllGasStabilityPoolBalanceResponse_Balance) Unmarshal(dAtA []byte) } return nil } +func (m *QueryCodeHashRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryCodeHashRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCodeHashRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryCodeHashResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryCodeHashResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCodeHashResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CodeHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/fungible/types/query.pb.gw.go b/x/fungible/types/query.pb.gw.go index 5338914d3f..c971723b1b 100644 --- a/x/fungible/types/query.pb.gw.go +++ b/x/fungible/types/query.pb.gw.go @@ -249,6 +249,60 @@ func local_request_Query_GasStabilityPoolBalanceAll_0(ctx context.Context, marsh } +func request_Query_CodeHash_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCodeHashRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + msg, err := client.CodeHash(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_CodeHash_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCodeHashRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + msg, err := server.CodeHash(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -416,6 +470,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_CodeHash_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_CodeHash_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_CodeHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -597,6 +674,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_CodeHash_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_CodeHash_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_CodeHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -614,6 +711,8 @@ var ( pattern_Query_GasStabilityPoolBalance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "fungible", "gas_stability_pool_balance", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_GasStabilityPoolBalanceAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"zeta-chain", "zetacore", "fungible", "gas_stability_pool_balance"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_CodeHash_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "fungible", "code_hash", "address"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -630,4 +729,6 @@ var ( forward_Query_GasStabilityPoolBalance_0 = runtime.ForwardResponseMessage forward_Query_GasStabilityPoolBalanceAll_0 = runtime.ForwardResponseMessage + + forward_Query_CodeHash_0 = runtime.ForwardResponseMessage ) diff --git a/x/fungible/types/tx.pb.go b/x/fungible/types/tx.pb.go index 476981cc21..35820af781 100644 --- a/x/fungible/types/tx.pb.go +++ b/x/fungible/types/tx.pb.go @@ -56,6 +56,126 @@ func (UpdatePausedStatusAction) EnumDescriptor() ([]byte, []int) { return fileDescriptor_197fdedece277fa0, []int{0} } +type MsgDeploySystemContracts struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` +} + +func (m *MsgDeploySystemContracts) Reset() { *m = MsgDeploySystemContracts{} } +func (m *MsgDeploySystemContracts) String() string { return proto.CompactTextString(m) } +func (*MsgDeploySystemContracts) ProtoMessage() {} +func (*MsgDeploySystemContracts) Descriptor() ([]byte, []int) { + return fileDescriptor_197fdedece277fa0, []int{0} +} +func (m *MsgDeploySystemContracts) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDeploySystemContracts) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDeploySystemContracts.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 *MsgDeploySystemContracts) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeploySystemContracts.Merge(m, src) +} +func (m *MsgDeploySystemContracts) XXX_Size() int { + return m.Size() +} +func (m *MsgDeploySystemContracts) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeploySystemContracts.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDeploySystemContracts proto.InternalMessageInfo + +func (m *MsgDeploySystemContracts) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +type MsgDeploySystemContractsResponse struct { + UniswapV2Factory string `protobuf:"bytes,1,opt,name=uniswapV2Factory,proto3" json:"uniswapV2Factory,omitempty"` + Wzeta string `protobuf:"bytes,2,opt,name=wzeta,proto3" json:"wzeta,omitempty"` + UniswapV2Router string `protobuf:"bytes,3,opt,name=uniswapV2Router,proto3" json:"uniswapV2Router,omitempty"` + ConnectorZEVM string `protobuf:"bytes,4,opt,name=connectorZEVM,proto3" json:"connectorZEVM,omitempty"` + SystemContract string `protobuf:"bytes,5,opt,name=systemContract,proto3" json:"systemContract,omitempty"` +} + +func (m *MsgDeploySystemContractsResponse) Reset() { *m = MsgDeploySystemContractsResponse{} } +func (m *MsgDeploySystemContractsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDeploySystemContractsResponse) ProtoMessage() {} +func (*MsgDeploySystemContractsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_197fdedece277fa0, []int{1} +} +func (m *MsgDeploySystemContractsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDeploySystemContractsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDeploySystemContractsResponse.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 *MsgDeploySystemContractsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeploySystemContractsResponse.Merge(m, src) +} +func (m *MsgDeploySystemContractsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDeploySystemContractsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeploySystemContractsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDeploySystemContractsResponse proto.InternalMessageInfo + +func (m *MsgDeploySystemContractsResponse) GetUniswapV2Factory() string { + if m != nil { + return m.UniswapV2Factory + } + return "" +} + +func (m *MsgDeploySystemContractsResponse) GetWzeta() string { + if m != nil { + return m.Wzeta + } + return "" +} + +func (m *MsgDeploySystemContractsResponse) GetUniswapV2Router() string { + if m != nil { + return m.UniswapV2Router + } + return "" +} + +func (m *MsgDeploySystemContractsResponse) GetConnectorZEVM() string { + if m != nil { + return m.ConnectorZEVM + } + return "" +} + +func (m *MsgDeploySystemContractsResponse) GetSystemContract() string { + if m != nil { + return m.SystemContract + } + return "" +} + type MsgUpdateZRC20WithdrawFee struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` Zrc20Address string `protobuf:"bytes,2,opt,name=zrc20_address,json=zrc20Address,proto3" json:"zrc20_address,omitempty"` @@ -67,7 +187,7 @@ func (m *MsgUpdateZRC20WithdrawFee) Reset() { *m = MsgUpdateZRC20Withdra func (m *MsgUpdateZRC20WithdrawFee) String() string { return proto.CompactTextString(m) } func (*MsgUpdateZRC20WithdrawFee) ProtoMessage() {} func (*MsgUpdateZRC20WithdrawFee) Descriptor() ([]byte, []int) { - return fileDescriptor_197fdedece277fa0, []int{0} + return fileDescriptor_197fdedece277fa0, []int{2} } func (m *MsgUpdateZRC20WithdrawFee) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -117,7 +237,7 @@ func (m *MsgUpdateZRC20WithdrawFeeResponse) Reset() { *m = MsgUpdateZRC2 func (m *MsgUpdateZRC20WithdrawFeeResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateZRC20WithdrawFeeResponse) ProtoMessage() {} func (*MsgUpdateZRC20WithdrawFeeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_197fdedece277fa0, []int{1} + return fileDescriptor_197fdedece277fa0, []int{3} } func (m *MsgUpdateZRC20WithdrawFeeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -155,7 +275,7 @@ func (m *MsgUpdateSystemContract) Reset() { *m = MsgUpdateSystemContract func (m *MsgUpdateSystemContract) String() string { return proto.CompactTextString(m) } func (*MsgUpdateSystemContract) ProtoMessage() {} func (*MsgUpdateSystemContract) Descriptor() ([]byte, []int) { - return fileDescriptor_197fdedece277fa0, []int{2} + return fileDescriptor_197fdedece277fa0, []int{4} } func (m *MsgUpdateSystemContract) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -205,7 +325,7 @@ func (m *MsgUpdateSystemContractResponse) Reset() { *m = MsgUpdateSystem func (m *MsgUpdateSystemContractResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateSystemContractResponse) ProtoMessage() {} func (*MsgUpdateSystemContractResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_197fdedece277fa0, []int{3} + return fileDescriptor_197fdedece277fa0, []int{5} } func (m *MsgUpdateSystemContractResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -249,7 +369,7 @@ func (m *MsgDeployFungibleCoinZRC20) Reset() { *m = MsgDeployFungibleCoi func (m *MsgDeployFungibleCoinZRC20) String() string { return proto.CompactTextString(m) } func (*MsgDeployFungibleCoinZRC20) ProtoMessage() {} func (*MsgDeployFungibleCoinZRC20) Descriptor() ([]byte, []int) { - return fileDescriptor_197fdedece277fa0, []int{4} + return fileDescriptor_197fdedece277fa0, []int{6} } func (m *MsgDeployFungibleCoinZRC20) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -342,7 +462,7 @@ func (m *MsgDeployFungibleCoinZRC20Response) Reset() { *m = MsgDeployFun func (m *MsgDeployFungibleCoinZRC20Response) String() string { return proto.CompactTextString(m) } func (*MsgDeployFungibleCoinZRC20Response) ProtoMessage() {} func (*MsgDeployFungibleCoinZRC20Response) Descriptor() ([]byte, []int) { - return fileDescriptor_197fdedece277fa0, []int{5} + return fileDescriptor_197fdedece277fa0, []int{7} } func (m *MsgDeployFungibleCoinZRC20Response) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -387,7 +507,7 @@ func (m *MsgRemoveForeignCoin) Reset() { *m = MsgRemoveForeignCoin{} } func (m *MsgRemoveForeignCoin) String() string { return proto.CompactTextString(m) } func (*MsgRemoveForeignCoin) ProtoMessage() {} func (*MsgRemoveForeignCoin) Descriptor() ([]byte, []int) { - return fileDescriptor_197fdedece277fa0, []int{6} + return fileDescriptor_197fdedece277fa0, []int{8} } func (m *MsgRemoveForeignCoin) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -437,7 +557,7 @@ func (m *MsgRemoveForeignCoinResponse) Reset() { *m = MsgRemoveForeignCo func (m *MsgRemoveForeignCoinResponse) String() string { return proto.CompactTextString(m) } func (*MsgRemoveForeignCoinResponse) ProtoMessage() {} func (*MsgRemoveForeignCoinResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_197fdedece277fa0, []int{7} + return fileDescriptor_197fdedece277fa0, []int{9} } func (m *MsgRemoveForeignCoinResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -467,16 +587,16 @@ func (m *MsgRemoveForeignCoinResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRemoveForeignCoinResponse proto.InternalMessageInfo type MsgUpdateContractBytecode struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - ContractAddress string `protobuf:"bytes,2,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` - NewBytecodeAddress string `protobuf:"bytes,3,opt,name=new_bytecode_address,json=newBytecodeAddress,proto3" json:"new_bytecode_address,omitempty"` + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + ContractAddress string `protobuf:"bytes,2,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` + NewCodeHash string `protobuf:"bytes,3,opt,name=new_code_hash,json=newCodeHash,proto3" json:"new_code_hash,omitempty"` } func (m *MsgUpdateContractBytecode) Reset() { *m = MsgUpdateContractBytecode{} } func (m *MsgUpdateContractBytecode) String() string { return proto.CompactTextString(m) } func (*MsgUpdateContractBytecode) ProtoMessage() {} func (*MsgUpdateContractBytecode) Descriptor() ([]byte, []int) { - return fileDescriptor_197fdedece277fa0, []int{8} + return fileDescriptor_197fdedece277fa0, []int{10} } func (m *MsgUpdateContractBytecode) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -519,22 +639,21 @@ func (m *MsgUpdateContractBytecode) GetContractAddress() string { return "" } -func (m *MsgUpdateContractBytecode) GetNewBytecodeAddress() string { +func (m *MsgUpdateContractBytecode) GetNewCodeHash() string { if m != nil { - return m.NewBytecodeAddress + return m.NewCodeHash } return "" } type MsgUpdateContractBytecodeResponse struct { - NewBytecodeHash []byte `protobuf:"bytes,1,opt,name=new_bytecode_hash,json=newBytecodeHash,proto3" json:"new_bytecode_hash,omitempty"` } func (m *MsgUpdateContractBytecodeResponse) Reset() { *m = MsgUpdateContractBytecodeResponse{} } func (m *MsgUpdateContractBytecodeResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateContractBytecodeResponse) ProtoMessage() {} func (*MsgUpdateContractBytecodeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_197fdedece277fa0, []int{9} + return fileDescriptor_197fdedece277fa0, []int{11} } func (m *MsgUpdateContractBytecodeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -563,13 +682,6 @@ func (m *MsgUpdateContractBytecodeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateContractBytecodeResponse proto.InternalMessageInfo -func (m *MsgUpdateContractBytecodeResponse) GetNewBytecodeHash() []byte { - if m != nil { - return m.NewBytecodeHash - } - return nil -} - type MsgUpdateZRC20PausedStatus struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` Zrc20Addresses []string `protobuf:"bytes,2,rep,name=zrc20_addresses,json=zrc20Addresses,proto3" json:"zrc20_addresses,omitempty"` @@ -580,7 +692,7 @@ func (m *MsgUpdateZRC20PausedStatus) Reset() { *m = MsgUpdateZRC20Paused func (m *MsgUpdateZRC20PausedStatus) String() string { return proto.CompactTextString(m) } func (*MsgUpdateZRC20PausedStatus) ProtoMessage() {} func (*MsgUpdateZRC20PausedStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_197fdedece277fa0, []int{10} + return fileDescriptor_197fdedece277fa0, []int{12} } func (m *MsgUpdateZRC20PausedStatus) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -637,7 +749,7 @@ func (m *MsgUpdateZRC20PausedStatusResponse) Reset() { *m = MsgUpdateZRC func (m *MsgUpdateZRC20PausedStatusResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateZRC20PausedStatusResponse) ProtoMessage() {} func (*MsgUpdateZRC20PausedStatusResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_197fdedece277fa0, []int{11} + return fileDescriptor_197fdedece277fa0, []int{13} } func (m *MsgUpdateZRC20PausedStatusResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -676,7 +788,7 @@ func (m *MsgUpdateZRC20LiquidityCap) Reset() { *m = MsgUpdateZRC20Liquid func (m *MsgUpdateZRC20LiquidityCap) String() string { return proto.CompactTextString(m) } func (*MsgUpdateZRC20LiquidityCap) ProtoMessage() {} func (*MsgUpdateZRC20LiquidityCap) Descriptor() ([]byte, []int) { - return fileDescriptor_197fdedece277fa0, []int{12} + return fileDescriptor_197fdedece277fa0, []int{14} } func (m *MsgUpdateZRC20LiquidityCap) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -726,7 +838,7 @@ func (m *MsgUpdateZRC20LiquidityCapResponse) Reset() { *m = MsgUpdateZRC func (m *MsgUpdateZRC20LiquidityCapResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateZRC20LiquidityCapResponse) ProtoMessage() {} func (*MsgUpdateZRC20LiquidityCapResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_197fdedece277fa0, []int{13} + return fileDescriptor_197fdedece277fa0, []int{15} } func (m *MsgUpdateZRC20LiquidityCapResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -757,6 +869,8 @@ var xxx_messageInfo_MsgUpdateZRC20LiquidityCapResponse proto.InternalMessageInfo func init() { proto.RegisterEnum("zetachain.zetacore.fungible.UpdatePausedStatusAction", UpdatePausedStatusAction_name, UpdatePausedStatusAction_value) + proto.RegisterType((*MsgDeploySystemContracts)(nil), "zetachain.zetacore.fungible.MsgDeploySystemContracts") + proto.RegisterType((*MsgDeploySystemContractsResponse)(nil), "zetachain.zetacore.fungible.MsgDeploySystemContractsResponse") proto.RegisterType((*MsgUpdateZRC20WithdrawFee)(nil), "zetachain.zetacore.fungible.MsgUpdateZRC20WithdrawFee") proto.RegisterType((*MsgUpdateZRC20WithdrawFeeResponse)(nil), "zetachain.zetacore.fungible.MsgUpdateZRC20WithdrawFeeResponse") proto.RegisterType((*MsgUpdateSystemContract)(nil), "zetachain.zetacore.fungible.MsgUpdateSystemContract") @@ -776,65 +890,70 @@ func init() { func init() { proto.RegisterFile("fungible/tx.proto", fileDescriptor_197fdedece277fa0) } var fileDescriptor_197fdedece277fa0 = []byte{ - // 913 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcb, 0x6e, 0xdb, 0x46, - 0x14, 0x15, 0xad, 0xf8, 0xa1, 0x1b, 0x5b, 0x96, 0x59, 0x21, 0x61, 0xe5, 0x42, 0x76, 0x98, 0x02, - 0x51, 0x03, 0x58, 0x74, 0xd5, 0x47, 0x50, 0xa0, 0x4d, 0x61, 0x2b, 0x71, 0x1b, 0x20, 0x6a, 0x03, - 0x3a, 0x46, 0xd1, 0x6c, 0x88, 0x11, 0x39, 0xa6, 0x06, 0x15, 0x67, 0x54, 0xce, 0xa8, 0x8a, 0xb2, - 0xeb, 0xd6, 0xab, 0xa0, 0xfd, 0x8f, 0x02, 0xfd, 0x8b, 0x2c, 0xb3, 0x2c, 0xba, 0x08, 0x0a, 0xfb, - 0x3f, 0x8a, 0x82, 0xc3, 0x87, 0xa9, 0x07, 0x65, 0x4b, 0x5d, 0x69, 0x66, 0x74, 0xef, 0xe1, 0xb9, - 0xf7, 0x9e, 0x39, 0x24, 0x6c, 0x9d, 0xf6, 0xa9, 0x4b, 0xda, 0x5d, 0x6c, 0x88, 0x97, 0xf5, 0x9e, - 0xcf, 0x04, 0x53, 0xb7, 0x5f, 0x61, 0x81, 0xec, 0x0e, 0x22, 0xb4, 0x2e, 0x57, 0xcc, 0xc7, 0xf5, - 0x38, 0xaa, 0xf2, 0x9e, 0xcd, 0x3c, 0x8f, 0x51, 0x23, 0xfc, 0x09, 0x33, 0x2a, 0x65, 0x97, 0xb9, - 0x4c, 0x2e, 0x8d, 0x60, 0x15, 0x9e, 0xea, 0x67, 0x4b, 0xf0, 0x7e, 0x8b, 0xbb, 0x27, 0x3d, 0x07, - 0x09, 0xfc, 0xc2, 0x6c, 0x36, 0xf6, 0x7f, 0x20, 0xa2, 0xe3, 0xf8, 0x68, 0x70, 0x84, 0xb1, 0xaa, - 0xc1, 0xaa, 0xed, 0x63, 0x24, 0x98, 0xaf, 0x29, 0xbb, 0x4a, 0xad, 0x60, 0xc6, 0x5b, 0xf5, 0x2e, - 0x6c, 0xbc, 0xf2, 0xed, 0xc6, 0xbe, 0x85, 0x1c, 0xc7, 0xc7, 0x9c, 0x6b, 0x4b, 0xf2, 0xff, 0x75, - 0x79, 0x78, 0x10, 0x9e, 0xa9, 0x3f, 0x42, 0x89, 0xe2, 0x81, 0x35, 0x88, 0x10, 0xad, 0x53, 0x8c, - 0xb5, 0x95, 0x20, 0xee, 0xd0, 0x78, 0xf3, 0x6e, 0x27, 0xf7, 0xf7, 0xbb, 0x9d, 0x7b, 0x2e, 0x11, - 0x9d, 0x7e, 0xbb, 0x6e, 0x33, 0xcf, 0xb0, 0x19, 0xf7, 0x18, 0x8f, 0x7e, 0xf6, 0xb8, 0xf3, 0x93, - 0x21, 0x86, 0x3d, 0xcc, 0xeb, 0x27, 0x84, 0x0a, 0xb3, 0x48, 0xf1, 0x20, 0xcd, 0xec, 0x18, 0x36, - 0x02, 0x68, 0x17, 0x71, 0xab, 0x4b, 0x3c, 0x22, 0xb4, 0xd5, 0xc5, 0x70, 0x6f, 0x52, 0x3c, 0xf8, - 0x06, 0xf1, 0xa7, 0x01, 0x86, 0x7e, 0x17, 0xee, 0x64, 0xf6, 0xc2, 0xc4, 0xbc, 0xc7, 0x28, 0xc7, - 0xba, 0x0f, 0xb7, 0x93, 0xa0, 0xe3, 0x21, 0x17, 0xd8, 0x6b, 0x32, 0x2a, 0x7c, 0x64, 0x8b, 0x19, - 0xed, 0xfa, 0x0a, 0xb6, 0x03, 0xba, 0x5c, 0xc6, 0x5b, 0x76, 0x94, 0x30, 0xd6, 0x3c, 0x8d, 0xe2, - 0xc1, 0x28, 0x62, 0xd4, 0x48, 0xfd, 0x0e, 0xec, 0x64, 0x3c, 0x33, 0xa1, 0x75, 0xb6, 0x04, 0x95, - 0x16, 0x77, 0x1f, 0xe1, 0x5e, 0x97, 0x0d, 0x8f, 0x22, 0x25, 0x34, 0x19, 0xa1, 0xb2, 0x90, 0x19, - 0xd4, 0xca, 0xb0, 0xfc, 0x38, 0x08, 0x89, 0x48, 0x84, 0x1b, 0xb5, 0x06, 0xa5, 0x53, 0xe6, 0x63, - 0xe2, 0x52, 0x4b, 0xaa, 0xcc, 0x22, 0x8e, 0x96, 0xdf, 0x55, 0x6a, 0x79, 0xb3, 0x18, 0x9d, 0x37, - 0x83, 0xe3, 0x27, 0x8e, 0x5a, 0x81, 0x35, 0x07, 0xdb, 0xc4, 0x43, 0x5d, 0xae, 0xdd, 0xd8, 0x55, - 0x6a, 0x1b, 0x66, 0xb2, 0x57, 0x55, 0xb8, 0x41, 0x91, 0x87, 0xb5, 0x65, 0x09, 0x2d, 0xd7, 0xea, - 0x2d, 0x58, 0xe1, 0x43, 0xaf, 0xcd, 0xba, 0xa1, 0x14, 0xcc, 0x68, 0xa7, 0xee, 0x41, 0xc1, 0x66, - 0x84, 0x5a, 0xc1, 0x70, 0xe4, 0x34, 0x8b, 0x8d, 0x52, 0x3d, 0x52, 0x70, 0x50, 0xc7, 0xf3, 0x61, - 0x0f, 0x9b, 0x6b, 0x76, 0xb4, 0x52, 0xb7, 0xa1, 0x70, 0x39, 0xfc, 0x35, 0xc9, 0x6c, 0xcd, 0x8d, - 0x07, 0xf9, 0x10, 0xf4, 0xec, 0x5e, 0xc4, 0x2d, 0x0b, 0x7a, 0x12, 0x0f, 0x20, 0xea, 0x49, 0xb4, - 0xd5, 0x1f, 0x41, 0xb9, 0xc5, 0x5d, 0x13, 0x7b, 0xec, 0x17, 0x7c, 0x14, 0x95, 0xcb, 0x08, 0x9d, - 0xd1, 0xc5, 0xb8, 0xd2, 0xa5, 0xcb, 0x4a, 0xf5, 0x2a, 0x7c, 0x30, 0x0d, 0x25, 0x19, 0xd9, 0x6f, - 0x4a, 0xea, 0xee, 0xc5, 0x03, 0x3d, 0x1c, 0x0a, 0x6c, 0x33, 0x67, 0xd6, 0xdd, 0xfb, 0x08, 0x4a, - 0x19, 0x0a, 0xda, 0xb4, 0x47, 0x85, 0xa3, 0xee, 0x43, 0x39, 0xd0, 0x5d, 0x3b, 0x02, 0x4d, 0xc2, - 0xf3, 0x32, 0x5c, 0xa5, 0x78, 0x10, 0x3f, 0x2f, 0x96, 0xda, 0xf7, 0xa9, 0x3b, 0x30, 0xce, 0x29, - 0xe9, 0xdc, 0x7d, 0xd8, 0x1a, 0x81, 0xed, 0x20, 0xde, 0x91, 0x2c, 0xd7, 0xcd, 0xcd, 0x14, 0xe6, - 0xb7, 0x88, 0x77, 0xf4, 0x3f, 0x14, 0x29, 0xcc, 0xd4, 0xad, 0x7a, 0x86, 0xfa, 0x1c, 0x3b, 0xc7, - 0x02, 0x89, 0x3e, 0x9f, 0x51, 0xe6, 0x3d, 0xd8, 0x1c, 0xb1, 0x18, 0x1c, 0x54, 0x99, 0xaf, 0x15, - 0xcc, 0x62, 0xda, 0x64, 0x30, 0x57, 0x5b, 0xb0, 0x82, 0x6c, 0x41, 0x18, 0x95, 0x65, 0x15, 0x1b, - 0x9f, 0xd5, 0x67, 0x98, 0x63, 0x3d, 0x24, 0x92, 0xe6, 0x70, 0x20, 0x93, 0xcd, 0x08, 0x44, 0xff, - 0x50, 0x8a, 0x27, 0x83, 0x6f, 0x32, 0xbc, 0x3f, 0x27, 0xca, 0x7a, 0x4a, 0x7e, 0xee, 0x13, 0x87, - 0x88, 0x61, 0x13, 0xf5, 0xfe, 0xaf, 0x73, 0x3e, 0x87, 0x8d, 0x6e, 0x0c, 0x67, 0xd9, 0xa8, 0x17, - 0x0e, 0x6c, 0x7e, 0x7b, 0x5b, 0xef, 0xa6, 0x48, 0x4d, 0x56, 0x96, 0xa6, 0x1c, 0x57, 0x76, 0xbf, - 0x01, 0x5a, 0x56, 0x8f, 0xd4, 0x02, 0x2c, 0x3f, 0x3b, 0x38, 0x39, 0x7e, 0x5c, 0xca, 0xa9, 0x37, - 0x61, 0xf5, 0xe4, 0xbb, 0x70, 0xa3, 0x34, 0xfe, 0x5d, 0x85, 0x7c, 0x8b, 0xbb, 0xea, 0xef, 0x0a, - 0xdc, 0xce, 0xb2, 0xa0, 0x07, 0x33, 0xc7, 0x92, 0x7d, 0x5f, 0x2b, 0x5f, 0x2f, 0x98, 0x98, 0xc8, - 0xf5, 0x57, 0x05, 0xb6, 0x26, 0x2f, 0xf3, 0xc7, 0x57, 0xc1, 0x4e, 0xa4, 0x54, 0xbe, 0x98, 0x3b, - 0x25, 0xe1, 0x70, 0xa6, 0x40, 0x79, 0xea, 0x4b, 0xe3, 0xd3, 0xab, 0x30, 0xa7, 0x65, 0x55, 0xbe, - 0x5c, 0x24, 0x2b, 0x21, 0xf3, 0x5a, 0x81, 0x5b, 0x19, 0xb6, 0xf3, 0xf9, 0xf5, 0x80, 0xc7, 0xf3, - 0x2a, 0x0f, 0x17, 0xcb, 0x9b, 0x42, 0x69, 0xe2, 0x2b, 0xe4, 0x9a, 0x94, 0xc6, 0xf3, 0xae, 0x4b, - 0x29, 0xeb, 0x4d, 0x2f, 0xc5, 0x9c, 0x65, 0x5b, 0x0f, 0xe6, 0xc0, 0x4e, 0x27, 0x5e, 0x2d, 0xe6, - 0x2b, 0x8c, 0x67, 0x9c, 0xd5, 0x88, 0xeb, 0xcc, 0xc3, 0x2a, 0x9d, 0x38, 0x17, 0xab, 0x69, 0xa6, - 0x71, 0xf8, 0xe4, 0xcd, 0x79, 0x55, 0x79, 0x7b, 0x5e, 0x55, 0xfe, 0x39, 0xaf, 0x2a, 0xaf, 0x2f, - 0xaa, 0xb9, 0xb7, 0x17, 0xd5, 0xdc, 0x5f, 0x17, 0xd5, 0xdc, 0x0b, 0x23, 0xe5, 0x55, 0x01, 0xf4, - 0x9e, 0x7c, 0x8a, 0x11, 0x3f, 0xc5, 0x78, 0x69, 0x5c, 0x7e, 0xdd, 0x06, 0xc6, 0xd5, 0x5e, 0x91, - 0x5f, 0xa6, 0x9f, 0xfc, 0x17, 0x00, 0x00, 0xff, 0xff, 0x42, 0x83, 0xe6, 0x96, 0xf6, 0x0a, 0x00, - 0x00, + // 998 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0x5d, 0x6f, 0xdb, 0x54, + 0x18, 0xae, 0xdb, 0xf5, 0x23, 0xef, 0x96, 0x34, 0x3b, 0x84, 0xcd, 0xa4, 0x28, 0xdd, 0xbc, 0x89, + 0x95, 0x49, 0x8d, 0x47, 0x18, 0x4c, 0x48, 0x6c, 0xa8, 0xcd, 0x5a, 0x98, 0xb4, 0xa0, 0xc9, 0x5d, + 0x87, 0xe8, 0x8d, 0x75, 0x6a, 0x9f, 0x3a, 0x16, 0xf1, 0x39, 0xc6, 0xe7, 0x84, 0x2c, 0xbb, 0x43, + 0xe2, 0xaa, 0x12, 0x68, 0x12, 0xff, 0x03, 0x89, 0x7f, 0xb1, 0xcb, 0x5d, 0x22, 0x84, 0x26, 0xd4, + 0xfe, 0x11, 0xe4, 0xe3, 0x8f, 0x3a, 0x1f, 0x4e, 0x9b, 0x70, 0x95, 0x73, 0xde, 0xbc, 0xef, 0xe3, + 0xe7, 0xfd, 0x7a, 0x9c, 0xc0, 0xd5, 0xa3, 0x2e, 0x75, 0xdc, 0xc3, 0x0e, 0xd1, 0xc5, 0xcb, 0xba, + 0x1f, 0x30, 0xc1, 0xd0, 0xda, 0x2b, 0x22, 0xb0, 0xd5, 0xc6, 0x2e, 0xad, 0xcb, 0x13, 0x0b, 0x48, + 0x3d, 0xf1, 0xaa, 0xbe, 0x67, 0x31, 0xcf, 0x63, 0x54, 0x8f, 0x3e, 0xa2, 0x88, 0x6a, 0xc5, 0x61, + 0x0e, 0x93, 0x47, 0x3d, 0x3c, 0x45, 0x56, 0xed, 0x3e, 0xa8, 0x2d, 0xee, 0x3c, 0x26, 0x7e, 0x87, + 0xf5, 0xf7, 0xfa, 0x5c, 0x10, 0xaf, 0xc9, 0xa8, 0x08, 0xb0, 0x25, 0x38, 0x52, 0x61, 0xd9, 0x0a, + 0x08, 0x16, 0x2c, 0x50, 0x95, 0x1b, 0xca, 0x46, 0xc1, 0x48, 0xae, 0xda, 0x3f, 0x0a, 0xdc, 0xc8, + 0x0b, 0x33, 0x08, 0xf7, 0x19, 0xe5, 0x04, 0xdd, 0x85, 0x72, 0x97, 0xba, 0xbc, 0x87, 0xfd, 0x17, + 0x8d, 0x5d, 0x6c, 0x09, 0x16, 0xf4, 0x63, 0x9c, 0x11, 0x3b, 0xaa, 0xc0, 0x62, 0x2f, 0xcc, 0x43, + 0x9d, 0x97, 0x0e, 0xd1, 0x05, 0x6d, 0xc0, 0x6a, 0xea, 0x69, 0xb0, 0xae, 0x20, 0x81, 0xba, 0x20, + 0xbf, 0x1f, 0x36, 0xa3, 0xdb, 0x50, 0xb4, 0x18, 0xa5, 0x24, 0x44, 0x3b, 0xd8, 0x79, 0xd1, 0x52, + 0x2f, 0x49, 0xbf, 0x41, 0x23, 0xfa, 0x08, 0x4a, 0x7c, 0x80, 0xac, 0xba, 0x28, 0xdd, 0x86, 0xac, + 0xda, 0xf1, 0x3c, 0x7c, 0xd0, 0xe2, 0xce, 0xbe, 0x6f, 0x63, 0x41, 0x0e, 0x8c, 0x66, 0xe3, 0xde, + 0x77, 0xae, 0x68, 0xdb, 0x01, 0xee, 0xed, 0x12, 0x92, 0x5f, 0x16, 0x74, 0x0b, 0x8a, 0xaf, 0x02, + 0xab, 0x71, 0xcf, 0xc4, 0xb6, 0x1d, 0x10, 0xce, 0xe3, 0x6c, 0xae, 0x48, 0xe3, 0x56, 0x64, 0x43, + 0xdf, 0x43, 0x99, 0x92, 0x9e, 0xd9, 0x8b, 0x11, 0xcd, 0x23, 0x42, 0xd4, 0xa5, 0xd0, 0x6f, 0x5b, + 0x7f, 0xf3, 0x6e, 0x7d, 0xee, 0xef, 0x77, 0xeb, 0x77, 0x1c, 0x57, 0xb4, 0xbb, 0x87, 0x75, 0x8b, + 0x79, 0xba, 0xc5, 0xb8, 0xc7, 0x78, 0xfc, 0xb1, 0xc9, 0xed, 0x1f, 0x74, 0xd1, 0xf7, 0x09, 0xaf, + 0xef, 0xbb, 0x54, 0x18, 0x25, 0x4a, 0x7a, 0x59, 0x66, 0x7b, 0x50, 0x0c, 0xa1, 0x1d, 0xcc, 0xcd, + 0x8e, 0xeb, 0xb9, 0x42, 0x5d, 0x9e, 0x0d, 0xf7, 0x32, 0x25, 0xbd, 0xaf, 0x31, 0x7f, 0x1a, 0x62, + 0x68, 0xb7, 0xe0, 0x66, 0x6e, 0x2d, 0x92, 0x5e, 0x6b, 0x01, 0x5c, 0x4f, 0x9d, 0x06, 0xe7, 0x61, + 0x42, 0xb9, 0x1e, 0xc2, 0x5a, 0x48, 0x37, 0x2a, 0xbe, 0x69, 0xc5, 0x01, 0x43, 0xc5, 0x53, 0x29, + 0xe9, 0x0d, 0x22, 0xc6, 0x85, 0xd4, 0x6e, 0xc2, 0x7a, 0xce, 0x33, 0x53, 0x5a, 0xc7, 0xf3, 0x50, + 0x4d, 0xe7, 0x74, 0x37, 0x5e, 0x8f, 0x26, 0x73, 0xa9, 0x4c, 0x64, 0x02, 0xb5, 0x0a, 0x2c, 0xee, + 0x84, 0x2e, 0xc9, 0x3c, 0xca, 0x0b, 0xda, 0x80, 0xf2, 0x11, 0x0b, 0x88, 0xeb, 0x50, 0x53, 0xae, + 0x9e, 0xe9, 0xda, 0x72, 0x20, 0x17, 0x8c, 0x52, 0x6c, 0x6f, 0x86, 0xe6, 0x27, 0x36, 0xaa, 0xc2, + 0x8a, 0x4d, 0x2c, 0xd7, 0xc3, 0x1d, 0x2e, 0x47, 0xb1, 0x68, 0xa4, 0x77, 0x84, 0xe0, 0x12, 0xc5, + 0x1e, 0x89, 0x67, 0x4f, 0x9e, 0xd1, 0x35, 0x58, 0xe2, 0x7d, 0xef, 0x90, 0x75, 0xa2, 0x51, 0x30, + 0xe2, 0x1b, 0xda, 0x84, 0x82, 0xc5, 0x5c, 0x6a, 0x86, 0xcd, 0x91, 0xdd, 0x2c, 0x35, 0xca, 0xf5, + 0x78, 0xad, 0xc3, 0x3c, 0x9e, 0xf7, 0x7d, 0x62, 0xac, 0x58, 0xf1, 0x09, 0xad, 0x41, 0xe1, 0xac, + 0xf9, 0x2b, 0x92, 0xd9, 0x8a, 0x93, 0x34, 0xf2, 0x11, 0x68, 0xf9, 0xb5, 0x48, 0xb7, 0x56, 0x85, + 0xe5, 0xa4, 0x01, 0x71, 0x4d, 0xe2, 0xab, 0xf6, 0x18, 0x2a, 0x2d, 0xee, 0x18, 0xc4, 0x63, 0x3f, + 0x91, 0xdd, 0x38, 0x5d, 0xe6, 0xd2, 0x09, 0x55, 0x4c, 0x32, 0x9d, 0x3f, 0xcb, 0x54, 0xab, 0xc1, + 0x87, 0xe3, 0x50, 0xd2, 0x96, 0xfd, 0xa2, 0x64, 0x76, 0x2f, 0x69, 0xe8, 0x76, 0x5f, 0x10, 0x8b, + 0xd9, 0x93, 0x76, 0xef, 0x63, 0x28, 0xe7, 0x4c, 0xd0, 0xaa, 0x35, 0x38, 0x38, 0x48, 0x8b, 0xd6, + 0x24, 0x04, 0x34, 0xdb, 0x98, 0xb7, 0x63, 0x51, 0x09, 0xa7, 0xbe, 0xc9, 0x6c, 0xf2, 0x0d, 0xe6, + 0xed, 0x81, 0xa9, 0x1f, 0x66, 0x91, 0x72, 0xfd, 0x43, 0x91, 0xe3, 0x95, 0xd9, 0x8d, 0x67, 0xb8, + 0xcb, 0x89, 0xbd, 0x27, 0xb0, 0xe8, 0x4e, 0xd0, 0x4f, 0x74, 0x07, 0x56, 0x07, 0x84, 0x82, 0x84, + 0x5c, 0x17, 0x42, 0x25, 0xca, 0x4a, 0x05, 0xe1, 0xa8, 0x05, 0x4b, 0xd8, 0x12, 0x2e, 0xa3, 0x92, + 0x63, 0xa9, 0xf1, 0x59, 0x7d, 0x82, 0xee, 0xd7, 0x23, 0x22, 0x59, 0x0e, 0x5b, 0x32, 0xd8, 0x88, + 0x41, 0xb4, 0xdb, 0x72, 0x04, 0x72, 0xf8, 0xa6, 0x69, 0xfd, 0x39, 0x92, 0xd6, 0x53, 0xf7, 0xc7, + 0xae, 0x6b, 0xbb, 0xa2, 0xdf, 0xc4, 0xfe, 0xff, 0xd5, 0xbf, 0xe7, 0x50, 0xec, 0x24, 0x70, 0xa6, + 0x85, 0xfd, 0xa8, 0xfa, 0xd3, 0x8b, 0xd4, 0x95, 0x4e, 0x86, 0xd4, 0x68, 0x66, 0x59, 0xca, 0x49, + 0x66, 0x77, 0x1b, 0xa0, 0xe6, 0xd5, 0x08, 0x15, 0x60, 0xf1, 0xd9, 0xd6, 0xfe, 0xde, 0x4e, 0x79, + 0x0e, 0x5d, 0x86, 0xe5, 0xfd, 0x6f, 0xa3, 0x8b, 0xd2, 0xf8, 0xad, 0x00, 0x0b, 0x2d, 0xee, 0xa0, + 0x5f, 0x15, 0x78, 0x7f, 0xfc, 0x7b, 0x72, 0x72, 0x53, 0xf2, 0xde, 0x93, 0xd5, 0x87, 0x33, 0x85, + 0xa5, 0x8b, 0xfa, 0xbb, 0x02, 0xd7, 0xf3, 0x84, 0xed, 0xc1, 0xc5, 0xa0, 0x47, 0x02, 0xab, 0x5f, + 0xcd, 0x18, 0x98, 0xb2, 0xfa, 0x59, 0x81, 0xab, 0xa3, 0x12, 0xf1, 0xc9, 0x79, 0xb0, 0x23, 0x21, + 0xd5, 0x2f, 0xa6, 0x0e, 0x49, 0x39, 0x1c, 0x2b, 0x50, 0x19, 0xfb, 0x2a, 0xba, 0x7f, 0x1e, 0xe6, + 0xb8, 0xa8, 0xea, 0x97, 0xb3, 0x44, 0xa5, 0x64, 0x5e, 0x2b, 0x70, 0x2d, 0x47, 0xcc, 0x3e, 0xbf, + 0x18, 0xf0, 0x70, 0x5c, 0xf5, 0xd1, 0x6c, 0x71, 0x63, 0x28, 0x8d, 0xfc, 0xb6, 0xb9, 0x20, 0xa5, + 0xe1, 0xb8, 0x8b, 0x52, 0xca, 0xfb, 0xfd, 0x20, 0x87, 0x39, 0x4f, 0x46, 0x1f, 0x4c, 0x81, 0x9d, + 0x0d, 0x3c, 0x7f, 0x98, 0xcf, 0x11, 0xc2, 0x61, 0x56, 0x03, 0x2a, 0x38, 0x0d, 0xab, 0x6c, 0xe0, + 0x54, 0xac, 0xc6, 0x89, 0xd8, 0xf6, 0x93, 0x37, 0x27, 0x35, 0xe5, 0xed, 0x49, 0x4d, 0xf9, 0xf7, + 0xa4, 0xa6, 0xbc, 0x3e, 0xad, 0xcd, 0xbd, 0x3d, 0xad, 0xcd, 0xfd, 0x75, 0x5a, 0x9b, 0x3b, 0xd0, + 0x33, 0xda, 0x19, 0x42, 0x6f, 0xca, 0xa7, 0xe8, 0xc9, 0x53, 0xf4, 0x97, 0xfa, 0xd9, 0x1f, 0x89, + 0x50, 0x48, 0x0f, 0x97, 0xe4, 0x9f, 0x80, 0x4f, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x5b, 0x18, + 0xdc, 0x6a, 0x61, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -849,6 +968,7 @@ 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 { + DeploySystemContracts(ctx context.Context, in *MsgDeploySystemContracts, opts ...grpc.CallOption) (*MsgDeploySystemContractsResponse, error) DeployFungibleCoinZRC20(ctx context.Context, in *MsgDeployFungibleCoinZRC20, opts ...grpc.CallOption) (*MsgDeployFungibleCoinZRC20Response, error) RemoveForeignCoin(ctx context.Context, in *MsgRemoveForeignCoin, opts ...grpc.CallOption) (*MsgRemoveForeignCoinResponse, error) UpdateSystemContract(ctx context.Context, in *MsgUpdateSystemContract, opts ...grpc.CallOption) (*MsgUpdateSystemContractResponse, error) @@ -866,6 +986,15 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } +func (c *msgClient) DeploySystemContracts(ctx context.Context, in *MsgDeploySystemContracts, opts ...grpc.CallOption) (*MsgDeploySystemContractsResponse, error) { + out := new(MsgDeploySystemContractsResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.fungible.Msg/DeploySystemContracts", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) DeployFungibleCoinZRC20(ctx context.Context, in *MsgDeployFungibleCoinZRC20, opts ...grpc.CallOption) (*MsgDeployFungibleCoinZRC20Response, error) { out := new(MsgDeployFungibleCoinZRC20Response) err := c.cc.Invoke(ctx, "/zetachain.zetacore.fungible.Msg/DeployFungibleCoinZRC20", in, out, opts...) @@ -931,6 +1060,7 @@ func (c *msgClient) UpdateZRC20LiquidityCap(ctx context.Context, in *MsgUpdateZR // MsgServer is the server API for Msg service. type MsgServer interface { + DeploySystemContracts(context.Context, *MsgDeploySystemContracts) (*MsgDeploySystemContractsResponse, error) DeployFungibleCoinZRC20(context.Context, *MsgDeployFungibleCoinZRC20) (*MsgDeployFungibleCoinZRC20Response, error) RemoveForeignCoin(context.Context, *MsgRemoveForeignCoin) (*MsgRemoveForeignCoinResponse, error) UpdateSystemContract(context.Context, *MsgUpdateSystemContract) (*MsgUpdateSystemContractResponse, error) @@ -944,6 +1074,9 @@ type MsgServer interface { type UnimplementedMsgServer struct { } +func (*UnimplementedMsgServer) DeploySystemContracts(ctx context.Context, req *MsgDeploySystemContracts) (*MsgDeploySystemContractsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeploySystemContracts not implemented") +} func (*UnimplementedMsgServer) DeployFungibleCoinZRC20(ctx context.Context, req *MsgDeployFungibleCoinZRC20) (*MsgDeployFungibleCoinZRC20Response, error) { return nil, status.Errorf(codes.Unimplemented, "method DeployFungibleCoinZRC20 not implemented") } @@ -970,6 +1103,24 @@ func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } +func _Msg_DeploySystemContracts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDeploySystemContracts) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DeploySystemContracts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.fungible.Msg/DeploySystemContracts", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DeploySystemContracts(ctx, req.(*MsgDeploySystemContracts)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_DeployFungibleCoinZRC20_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgDeployFungibleCoinZRC20) if err := dec(in); err != nil { @@ -1100,6 +1251,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "zetachain.zetacore.fungible.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "DeploySystemContracts", + Handler: _Msg_DeploySystemContracts_Handler, + }, { MethodName: "DeployFungibleCoinZRC20", Handler: _Msg_DeployFungibleCoinZRC20_Handler, @@ -1133,6 +1288,94 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Metadata: "fungible/tx.proto", } +func (m *MsgDeploySystemContracts) 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 *MsgDeploySystemContracts) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDeploySystemContracts) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDeploySystemContractsResponse) 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 *MsgDeploySystemContractsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDeploySystemContractsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SystemContract) > 0 { + i -= len(m.SystemContract) + copy(dAtA[i:], m.SystemContract) + i = encodeVarintTx(dAtA, i, uint64(len(m.SystemContract))) + i-- + dAtA[i] = 0x2a + } + if len(m.ConnectorZEVM) > 0 { + i -= len(m.ConnectorZEVM) + copy(dAtA[i:], m.ConnectorZEVM) + i = encodeVarintTx(dAtA, i, uint64(len(m.ConnectorZEVM))) + i-- + dAtA[i] = 0x22 + } + if len(m.UniswapV2Router) > 0 { + i -= len(m.UniswapV2Router) + copy(dAtA[i:], m.UniswapV2Router) + i = encodeVarintTx(dAtA, i, uint64(len(m.UniswapV2Router))) + i-- + dAtA[i] = 0x1a + } + if len(m.Wzeta) > 0 { + i -= len(m.Wzeta) + copy(dAtA[i:], m.Wzeta) + i = encodeVarintTx(dAtA, i, uint64(len(m.Wzeta))) + i-- + dAtA[i] = 0x12 + } + if len(m.UniswapV2Factory) > 0 { + i -= len(m.UniswapV2Factory) + copy(dAtA[i:], m.UniswapV2Factory) + i = encodeVarintTx(dAtA, i, uint64(len(m.UniswapV2Factory))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *MsgUpdateZRC20WithdrawFee) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1454,10 +1697,10 @@ func (m *MsgUpdateContractBytecode) MarshalToSizedBuffer(dAtA []byte) (int, erro _ = i var l int _ = l - if len(m.NewBytecodeAddress) > 0 { - i -= len(m.NewBytecodeAddress) - copy(dAtA[i:], m.NewBytecodeAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.NewBytecodeAddress))) + if len(m.NewCodeHash) > 0 { + i -= len(m.NewCodeHash) + copy(dAtA[i:], m.NewCodeHash) + i = encodeVarintTx(dAtA, i, uint64(len(m.NewCodeHash))) i-- dAtA[i] = 0x1a } @@ -1498,13 +1741,6 @@ func (m *MsgUpdateContractBytecodeResponse) MarshalToSizedBuffer(dAtA []byte) (i _ = i var l int _ = l - if len(m.NewBytecodeHash) > 0 { - i -= len(m.NewBytecodeHash) - copy(dAtA[i:], m.NewBytecodeHash) - i = encodeVarintTx(dAtA, i, uint64(len(m.NewBytecodeHash))) - i-- - dAtA[i] = 0xa - } return len(dAtA) - i, nil } @@ -1656,6 +1892,48 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *MsgDeploySystemContracts) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgDeploySystemContractsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.UniswapV2Factory) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Wzeta) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.UniswapV2Router) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ConnectorZEVM) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.SystemContract) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + func (m *MsgUpdateZRC20WithdrawFee) Size() (n int) { if m == nil { return 0 @@ -1802,7 +2080,7 @@ func (m *MsgUpdateContractBytecode) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.NewBytecodeAddress) + l = len(m.NewCodeHash) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -1815,10 +2093,6 @@ func (m *MsgUpdateContractBytecodeResponse) Size() (n int) { } var l int _ = l - l = len(m.NewBytecodeHash) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } return n } @@ -1887,7 +2161,7 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgUpdateZRC20WithdrawFee) Unmarshal(dAtA []byte) error { +func (m *MsgDeploySystemContracts) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1910,10 +2184,10 @@ func (m *MsgUpdateZRC20WithdrawFee) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateZRC20WithdrawFee: wiretype end group for non-group") + return fmt.Errorf("proto: MsgDeploySystemContracts: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateZRC20WithdrawFee: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgDeploySystemContracts: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1948,24 +2222,316 @@ func (m *MsgUpdateZRC20WithdrawFee) Unmarshal(dAtA []byte) error { } m.Creator = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Zrc20Address", wireType) + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err } - 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 (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 *MsgDeploySystemContractsResponse) 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: MsgDeploySystemContractsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeploySystemContractsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UniswapV2Factory", 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.UniswapV2Factory = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Wzeta", 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.Wzeta = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UniswapV2Router", 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.UniswapV2Router = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConnectorZEVM", 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.ConnectorZEVM = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SystemContract", 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.SystemContract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateZRC20WithdrawFee) 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: MsgUpdateZRC20WithdrawFee: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateZRC20WithdrawFee: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", 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.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Zrc20Address", 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 { @@ -2878,7 +3444,7 @@ func (m *MsgUpdateContractBytecode) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NewBytecodeAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NewCodeHash", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2906,7 +3472,7 @@ func (m *MsgUpdateContractBytecode) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NewBytecodeAddress = string(dAtA[iNdEx:postIndex]) + m.NewCodeHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2958,40 +3524,6 @@ func (m *MsgUpdateContractBytecodeResponse) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: MsgUpdateContractBytecodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NewBytecodeHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NewBytecodeHash = append(m.NewBytecodeHash[:0], dAtA[iNdEx:postIndex]...) - if m.NewBytecodeHash == nil { - m.NewBytecodeHash = []byte{} - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/observer/client/cli/cli_supported_chains.go b/x/observer/client/cli/cli_supported_chains.go deleted file mode 100644 index aeb870ec27..0000000000 --- a/x/observer/client/cli/cli_supported_chains.go +++ /dev/null @@ -1,75 +0,0 @@ -package cli - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - "github.com/zeta-chain/zetacore/x/observer/types" -) - -func CmdGetSupportedChains() *cobra.Command { - cmd := &cobra.Command{ - Use: "list-chains", - Short: "list all SupportedChains", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := &types.QuerySupportedChains{} - - res, err := queryClient.SupportedChains(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddPaginationFlagsToCmd(cmd, cmd.Use) - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - -// Transaction CLI ///////////////////////// - -//func CmdSetSupportedChains() *cobra.Command { -// cmd := &cobra.Command{ -// Use: "add-supported-chains chainID chainName ", -// Short: "Broadcast message set-supported-chains", -// Args: cobra.ExactArgs(2), -// RunE: func(cmd *cobra.Command, args []string) error { -// -// chainName := common.ParseStringToObserverChain(args[1]) -// if chainName == 0 { -// return errors.New("ChainName type not supported\"") -// } -// chainID, err := strconv.Atoi(args[0]) -// if err != nil { -// return err -// } -// clientCtx, err := client.GetClientTxContext(cmd) -// if err != nil { -// return err -// } -// -// msg := &types.MsgSetSupportedChains{ -// Creator: clientCtx.GetFromAddress().String(), -// ChainId: int64(chainID), -// ChainName: chainName, -// } -// if err := msg.ValidateBasic(); err != nil { -// return err -// } -// return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) -// }, -// } -// -// flags.AddTxFlagsToCmd(cmd) -// -// return cmd -//} diff --git a/x/observer/client/cli/query.go b/x/observer/client/cli/query.go index 47fd373eba..768d37828e 100644 --- a/x/observer/client/cli/query.go +++ b/x/observer/client/cli/query.go @@ -40,6 +40,13 @@ func GetQueryCmd(_ string) *cobra.Command { CmdBlameByIdentifier(), CmdGetAllBlameRecords(), CmdGetBlameByChainAndNonce(), + CmdGetTssAddress(), + CmdListTssHistory(), + CmdShowTSS(), + CmdGetTssAddressByFinalizedZetaHeight(), + CmdListChainNonces(), + CmdShowChainNonces(), + CmdListPendingNonces(), ) return cmd diff --git a/x/observer/client/cli/query_chain_nonce.go b/x/observer/client/cli/query_chain_nonce.go new file mode 100644 index 0000000000..8a0a443fca --- /dev/null +++ b/x/observer/client/cli/query_chain_nonce.go @@ -0,0 +1,71 @@ +package cli + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func CmdListChainNonces() *cobra.Command { + cmd := &cobra.Command{ + Use: "list-chain-nonces", + Short: "list all chainNonces", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryAllChainNoncesRequest{ + Pagination: pageReq, + } + + res, err := queryClient.ChainNoncesAll(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, cmd.Use) + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdShowChainNonces() *cobra.Command { + cmd := &cobra.Command{ + Use: "show-chain-nonces [index]", + Short: "shows a chainNonces", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryGetChainNoncesRequest{ + Index: args[0], + } + + res, err := queryClient.ChainNonces(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/observer/client/cli/query_get_tss_address.go b/x/observer/client/cli/query_get_tss_address.go new file mode 100644 index 0000000000..8bfac0e10f --- /dev/null +++ b/x/observer/client/cli/query_get_tss_address.go @@ -0,0 +1,71 @@ +package cli + +import ( + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func CmdGetTssAddress() *cobra.Command { + cmd := &cobra.Command{ + Use: "get-tss-address", + Short: "Query current tss address", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) (err error) { + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryGetTssAddressRequest{} + + res, err := queryClient.GetTssAddress(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdGetTssAddressByFinalizedZetaHeight() *cobra.Command { + cmd := &cobra.Command{ + Use: "get-historical-tss-address [finalizedZetaHeight]", + Short: "Query tss address by finalized zeta height (for historical tss addresses)", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + finalizedZetaHeight, err := strconv.ParseInt(args[0], 10, 64) + if err != nil { + return err + } + params := &types.QueryGetTssAddressByFinalizedHeightRequest{ + FinalizedZetaHeight: finalizedZetaHeight, + } + + res, err := queryClient.GetTssAddressByFinalizedHeight(cmd.Context(), params) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/observer/client/cli/cli_keygen.go b/x/observer/client/cli/query_keygen.go similarity index 100% rename from x/observer/client/cli/cli_keygen.go rename to x/observer/client/cli/query_keygen.go diff --git a/x/observer/client/cli/cli_node_account.go b/x/observer/client/cli/query_node_account.go similarity index 100% rename from x/observer/client/cli/cli_node_account.go rename to x/observer/client/cli/query_node_account.go diff --git a/x/observer/client/cli/query_pending_nonces.go b/x/observer/client/cli/query_pending_nonces.go new file mode 100644 index 0000000000..0afff149fd --- /dev/null +++ b/x/observer/client/cli/query_pending_nonces.go @@ -0,0 +1,36 @@ +package cli + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func CmdListPendingNonces() *cobra.Command { + cmd := &cobra.Command{ + Use: "list-pending-nonces", + Short: "shows a chainNonces", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryAllPendingNoncesRequest{} + + res, err := queryClient.PendingNoncesAll(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/observer/client/cli/query_supported_chains.go b/x/observer/client/cli/query_supported_chains.go new file mode 100644 index 0000000000..b4c0181d8c --- /dev/null +++ b/x/observer/client/cli/query_supported_chains.go @@ -0,0 +1,36 @@ +package cli + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func CmdGetSupportedChains() *cobra.Command { + cmd := &cobra.Command{ + Use: "list-chains", + Short: "list all SupportedChains", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QuerySupportedChains{} + + res, err := queryClient.SupportedChains(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, cmd.Use) + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/observer/client/cli/query_tss.go b/x/observer/client/cli/query_tss.go new file mode 100644 index 0000000000..865303d423 --- /dev/null +++ b/x/observer/client/cli/query_tss.go @@ -0,0 +1,62 @@ +package cli + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func CmdShowTSS() *cobra.Command { + cmd := &cobra.Command{ + Use: "show-tss", + Short: "shows a TSS", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryGetTSSRequest{} + + res, err := queryClient.TSS(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdListTssHistory() *cobra.Command { + cmd := &cobra.Command{ + Use: "list-tss-history", + Short: "show historical list of TSS", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryTssHistoryRequest{} + + res, err := queryClient.TssHistory(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/observer/client/cli/tx_add_blame_vote.go b/x/observer/client/cli/tx_add_blame_vote.go index 802fda3edd..38b56e68a8 100644 --- a/x/observer/client/cli/tx_add_blame_vote.go +++ b/x/observer/client/cli/tx_add_blame_vote.go @@ -48,7 +48,7 @@ func CmdAddBlameVote() *cobra.Command { return err } blameNodes := types.ConvertNodes(nodes) - blameInfo := &types.Blame{ + blameInfo := types.Blame{ Index: index, FailureReason: failureReason, Nodes: blameNodes, diff --git a/x/crosschain/client/querytests/chain_nonces.go b/x/observer/client/querytests/chain_nonces.go similarity index 93% rename from x/crosschain/client/querytests/chain_nonces.go rename to x/observer/client/querytests/chain_nonces.go index 0e42078974..03175365a3 100644 --- a/x/crosschain/client/querytests/chain_nonces.go +++ b/x/observer/client/querytests/chain_nonces.go @@ -6,15 +6,15 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" tmcli "github.com/tendermint/tendermint/libs/cli" - "github.com/zeta-chain/zetacore/x/crosschain/client/cli" - "github.com/zeta-chain/zetacore/x/crosschain/types" + "github.com/zeta-chain/zetacore/x/observer/client/cli" + "github.com/zeta-chain/zetacore/x/observer/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) func (s *CliTestSuite) TestShowChainNonces() { ctx := s.network.Validators[0].ClientCtx - objs := s.crosschainState.ChainNoncesList + objs := s.observerState.ChainNonces common := []string{ fmt.Sprintf("--%s=json", tmcli.OutputFlag), } @@ -23,7 +23,7 @@ func (s *CliTestSuite) TestShowChainNonces() { id string args []string err error - obj *types.ChainNonces + obj types.ChainNonces }{ { desc: "found", @@ -60,7 +60,7 @@ func (s *CliTestSuite) TestShowChainNonces() { func (s *CliTestSuite) TestListChainNonces() { ctx := s.network.Validators[0].ClientCtx - objs := s.crosschainState.ChainNoncesList + objs := s.observerState.ChainNonces request := func(next []byte, offset, limit uint64, total bool) []string { args := []string{ fmt.Sprintf("--%s=json", tmcli.OutputFlag), diff --git a/x/observer/client/querytests/suite.go b/x/observer/client/querytests/suite.go index cbaa7a2a9e..344819c890 100644 --- a/x/observer/client/querytests/suite.go +++ b/x/observer/client/querytests/suite.go @@ -44,7 +44,7 @@ func (s *CliTestSuite) SetupSuite() { } network.SetupZetaGenesisState(s.T(), s.cfg.GenesisState, s.cfg.Codec, observerList, false) s.crosschainState = network.AddCrosschainData(s.T(), 2, s.cfg.GenesisState, s.cfg.Codec) - s.observerState = network.AddObserverData(s.T(), s.cfg.GenesisState, s.cfg.Codec, nil) + s.observerState = network.AddObserverData(s.T(), 2, s.cfg.GenesisState, s.cfg.Codec, nil) net, err := network.New(s.T(), app.NodeDir, s.cfg) s.Assert().NoError(err) s.network = net diff --git a/x/crosschain/client/querytests/tss.go b/x/observer/client/querytests/tss.go similarity index 84% rename from x/crosschain/client/querytests/tss.go rename to x/observer/client/querytests/tss.go index c25358a75e..d764052100 100644 --- a/x/crosschain/client/querytests/tss.go +++ b/x/observer/client/querytests/tss.go @@ -5,14 +5,14 @@ import ( clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" tmcli "github.com/tendermint/tendermint/libs/cli" - "github.com/zeta-chain/zetacore/x/crosschain/client/cli" - "github.com/zeta-chain/zetacore/x/crosschain/types" + "github.com/zeta-chain/zetacore/x/observer/client/cli" + "github.com/zeta-chain/zetacore/x/observer/types" "google.golang.org/grpc/status" ) func (s *CliTestSuite) TestShowTSS() { ctx := s.network.Validators[0].ClientCtx - obj := s.crosschainState.Tss + obj := s.observerState.Tss common := []string{ fmt.Sprintf("--%s=json", tmcli.OutputFlag), } @@ -43,7 +43,7 @@ func (s *CliTestSuite) TestShowTSS() { var resp types.QueryGetTSSResponse s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) s.Require().NotNil(resp.TSS) - s.Require().Equal(tc.obj, resp.TSS) + s.Require().Equal(*tc.obj, resp.TSS) } }) } diff --git a/x/observer/genesis.go b/x/observer/genesis.go index 8e9303df78..ce13a5e902 100644 --- a/x/observer/genesis.go +++ b/x/observer/genesis.go @@ -2,6 +2,7 @@ package observer import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/observer/keeper" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -82,6 +83,45 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) } else { k.SetLastObserverCount(ctx, &types.LastObserverCount{LastChangeHeight: 0, Count: observerCount}) } + + if genState.Tss != nil { + tss := *genState.Tss + k.SetTSS(ctx, tss) + for _, chain := range common.DefaultChainsList() { + k.SetPendingNonces(ctx, types.PendingNonces{ + NonceLow: 0, + NonceHigh: 0, + ChainId: chain.ChainId, + Tss: tss.TssPubkey, + }) + } + } + + // Get all chain nonces + + for _, elem := range genState.TssHistory { + k.SetTSSHistory(ctx, elem) + } + + for _, elem := range genState.TssFundMigrators { + k.SetFundMigrator(ctx, elem) + } + + for _, elem := range genState.BlameList { + k.SetBlame(ctx, elem) + } + + // Set all the pending nonces + for _, pendingNonce := range genState.PendingNonces { + k.SetPendingNonces(ctx, pendingNonce) + } + for _, chainNonce := range genState.ChainNonces { + k.SetChainNonces(ctx, chainNonce) + } + for _, elem := range genState.NonceToCctx { + k.SetNonceToCctx(ctx, elem) + } + } // ExportGenesis returns the observer module's exported genesis. @@ -120,6 +160,18 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { oc = &observerCount } + // Get tss + tss := &types.TSS{} + t, found := k.GetTSS(ctx) + if found { + tss = &t + } + + var pendingNonces []types.PendingNonces + p, err := k.GetAllPendingNonces(ctx) + if err == nil { + pendingNonces = p + } return &types.GenesisState{ Ballots: k.GetAllBallots(ctx), Observers: k.GetAllObserverMappers(ctx), @@ -129,5 +181,12 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { CrosschainFlags: cf, Keygen: kn, LastObserverCount: oc, + Tss: tss, + PendingNonces: pendingNonces, + TssHistory: k.GetAllTSS(ctx), + TssFundMigrators: k.GetAllTssFundMigrators(ctx), + BlameList: k.GetAllBlame(ctx), + ChainNonces: k.GetAllChainNonces(ctx), + NonceToCctx: k.GetAllNonceToCctx(ctx), } } diff --git a/x/observer/genesis_test.go b/x/observer/genesis_test.go index 30b9260821..10b2cdbd1b 100644 --- a/x/observer/genesis_test.go +++ b/x/observer/genesis_test.go @@ -13,9 +13,11 @@ import ( func TestGenesis(t *testing.T) { params := types.DefaultParams() - + tss := sample.Tss() genesisState := types.GenesisState{ - Params: ¶ms, + Params: ¶ms, + Tss: &tss, + BlameList: sample.BlameRecordsList(t, 10), Ballots: []*types.Ballot{ sample.Ballot(t, "0"), sample.Ballot(t, "1"), @@ -35,6 +37,14 @@ func TestGenesis(t *testing.T) { Keygen: sample.Keygen(t), LastObserverCount: sample.LastObserverCount(1000), CoreParamsList: sample.CoreParamsList(), + TssFundMigrators: []types.TssFundMigratorInfo{sample.TssFundsMigrator(1), sample.TssFundsMigrator(2)}, + ChainNonces: []types.ChainNonces{ + sample.ChainNonces(t, "0"), + sample.ChainNonces(t, "1"), + sample.ChainNonces(t, "2"), + }, + PendingNonces: sample.PendingNoncesList(t, "sample", 20), + NonceToCctx: sample.NonceToCctxList(t, "sample", 20), } // Init and export diff --git a/x/observer/keeper/ballot.go b/x/observer/keeper/ballot.go index 4dbeb277c5..787afd7831 100644 --- a/x/observer/keeper/ballot.go +++ b/x/observer/keeper/ballot.go @@ -1,13 +1,9 @@ package keeper import ( - "context" - "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/zeta-chain/zetacore/x/observer/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) func (k Keeper) SetBallot(ctx sdk.Context, ballot *types.Ballot) { @@ -74,32 +70,3 @@ func (k Keeper) GetMaturedBallotList(ctx sdk.Context) []string { } return list.BallotsIndexList } - -// Queries - -func (k Keeper) BallotByIdentifier(goCtx context.Context, req *types.QueryBallotByIdentifierRequest) (*types.QueryBallotByIdentifierResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - ballot, found := k.GetBallot(ctx, req.BallotIdentifier) - if !found { - return nil, status.Error(codes.NotFound, "not found ballot") - } - - votersList := make([]*types.VoterList, len(ballot.VoterList)) - for i, voterAddress := range ballot.VoterList { - voter := types.VoterList{ - VoterAddress: voterAddress, - VoteType: ballot.Votes[ballot.GetVoterIndex(voterAddress)], - } - votersList[i] = &voter - } - - return &types.QueryBallotByIdentifierResponse{ - BallotIdentifier: ballot.BallotIdentifier, - Voters: votersList, - ObservationType: ballot.ObservationType, - BallotStatus: ballot.BallotStatus, - }, nil -} diff --git a/x/observer/keeper/blame.go b/x/observer/keeper/blame.go index a72ae4335f..adbbfb0436 100644 --- a/x/observer/keeper/blame.go +++ b/x/observer/keeper/blame.go @@ -1,18 +1,15 @@ package keeper import ( - "context" - "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" "github.com/zeta-chain/zetacore/x/observer/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) -func (k Keeper) SetBlame(ctx sdk.Context, blame *types.Blame) { +func (k Keeper) SetBlame(ctx sdk.Context, blame types.Blame) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlameKey)) - b := k.cdc.MustMarshal(blame) + b := k.cdc.MustMarshal(&blame) store.Set([]byte(blame.Index), b) } @@ -26,20 +23,31 @@ func (k Keeper) GetBlame(ctx sdk.Context, index string) (val types.Blame, found return val, true } -func (k Keeper) GetAllBlame(ctx sdk.Context) (BlameRecords []*types.Blame, found bool) { +func (k Keeper) GetAllBlame(ctx sdk.Context) (BlameRecords []types.Blame) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlameKey)) iterator := sdk.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() - found = false for ; iterator.Valid(); iterator.Next() { var val types.Blame k.cdc.MustUnmarshal(iterator.Value(), &val) - BlameRecords = append(BlameRecords, &val) - found = true + BlameRecords = append(BlameRecords, val) } return } +func (k Keeper) GetAllBlamePaginated(ctx sdk.Context, pagination *query.PageRequest) (blameRecords []types.Blame, pageRes *query.PageResponse, err error) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlameKey)) + pageRes, err = query.Paginate(store, pagination, func(key []byte, value []byte) error { + var blame types.Blame + if err := k.cdc.Unmarshal(value, &blame); err != nil { + return err + } + blameRecords = append(blameRecords, blame) + return nil + }) + return +} + func (k Keeper) GetBlamesByChainAndNonce(ctx sdk.Context, chainID int64, nonce int64) (BlameRecords []*types.Blame, found bool) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlameKey)) blamePrefix := types.GetBlamePrefix(chainID, nonce) @@ -54,49 +62,3 @@ func (k Keeper) GetBlamesByChainAndNonce(ctx sdk.Context, chainID int64, nonce i } return } - -// Query - -func (k Keeper) BlameByIdentifier(goCtx context.Context, request *types.QueryBlameByIdentifierRequest) (*types.QueryBlameByIdentifierResponse, error) { - if request == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - blame, found := k.GetBlame(ctx, request.BlameIdentifier) - if !found { - return nil, status.Error(codes.NotFound, "blame info not found") - } - - return &types.QueryBlameByIdentifierResponse{ - BlameInfo: &blame, - }, nil -} - -func (k Keeper) GetAllBlameRecords(goCtx context.Context, request *types.QueryAllBlameRecordsRequest) (*types.QueryAllBlameRecordsResponse, error) { - if request == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - blameRecords, found := k.GetAllBlame(ctx) - if !found { - return nil, status.Error(codes.NotFound, "blame info not found") - } - - return &types.QueryAllBlameRecordsResponse{ - BlameInfo: blameRecords, - }, nil -} - -func (k Keeper) BlamesByChainAndNonce(goCtx context.Context, request *types.QueryBlameByChainAndNonceRequest) (*types.QueryBlameByChainAndNonceResponse, error) { - if request == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - blameRecords, found := k.GetBlamesByChainAndNonce(ctx, request.ChainId, request.Nonce) - if !found { - return nil, status.Error(codes.NotFound, "blame info not found") - } - return &types.QueryBlameByChainAndNonceResponse{ - BlameInfo: blameRecords, - }, nil -} diff --git a/x/observer/keeper/blame_test.go b/x/observer/keeper/blame_test.go deleted file mode 100644 index d12d69b84a..0000000000 --- a/x/observer/keeper/blame_test.go +++ /dev/null @@ -1,47 +0,0 @@ -package keeper - -import ( - "testing" - - "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/x/observer/types" -) - -func TestKeeper_BlameByIdentifier(t *testing.T) { - keeper, ctx := SetupKeeper(t) - var chainId int64 = 97 - var nonce uint64 = 101 - digest := "85f5e10431f69bc2a14046a13aabaefc660103b6de7a84f75c4b96181d03f0b5" - - index := types.GetBlameIndex(chainId, nonce, digest, 123) - - keeper.SetBlame(ctx, &types.Blame{ - Index: index, - FailureReason: "failed to join party", - Nodes: nil, - }) - - blameRecords, found := keeper.GetBlame(ctx, index) - require.True(t, found) - require.Equal(t, index, blameRecords.Index) -} - -func TestKeeper_BlameByChainAndNonce(t *testing.T) { - keeper, ctx := SetupKeeper(t) - var chainId int64 = 97 - var nonce uint64 = 101 - digest := "85f5e10431f69bc2a14046a13aabaefc660103b6de7a84f75c4b96181d03f0b5" - - index := types.GetBlameIndex(chainId, nonce, digest, 123) - - keeper.SetBlame(ctx, &types.Blame{ - Index: index, - FailureReason: "failed to join party", - Nodes: nil, - }) - - blameRecords, found := keeper.GetBlamesByChainAndNonce(ctx, chainId, int64(nonce)) - require.True(t, found) - require.Equal(t, 1, len(blameRecords)) - require.Equal(t, index, blameRecords[0].Index) -} diff --git a/x/observer/keeper/block_header.go b/x/observer/keeper/block_header.go index 20c97b1468..e5f6aa74f4 100644 --- a/x/observer/keeper/block_header.go +++ b/x/observer/keeper/block_header.go @@ -1,16 +1,12 @@ package keeper import ( - "context" - "fmt" + "strconv" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/observer/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) // SetBlockHeader set a specific block header in the store from its index @@ -39,54 +35,21 @@ func (k Keeper) RemoveBlockHeader(ctx sdk.Context, hash []byte) { store.Delete(hash) } -// GetAllBlockHeaders queries all for block header -func (k Keeper) GetAllBlockHeaders(c context.Context, req *types.QueryAllBlockHeaderRequest) (*types.QueryAllBlockHeaderResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - store := ctx.KVStore(k.storeKey) - blockHeaderStore := prefix.NewStore(store, types.KeyPrefix(types.BlockHeaderKey)) - - var blockHeaders []*common.BlockHeader - pageRes, err := query.Paginate(blockHeaderStore, req.Pagination, func(key []byte, value []byte) error { - var blockHeader common.BlockHeader - if err := k.cdc.Unmarshal(value, &blockHeader); err != nil { - return err - } - - blockHeaders = append(blockHeaders, &blockHeader) - return nil - }) - if err != nil { - return nil, status.Error(codes.Internal, err.Error()) - } - return &types.QueryAllBlockHeaderResponse{BlockHeaders: blockHeaders, Pagination: pageRes}, nil +func (k Keeper) SetBlockHeaderState(ctx sdk.Context, blockHeaderState types.BlockHeaderState) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeaderStateKey)) + b := k.cdc.MustMarshal(&blockHeaderState) + key := strconv.FormatInt(blockHeaderState.ChainId, 10) + store.Set(types.KeyPrefix(key), b) } -// GetBlockHeaderByHash queries block header by hash -func (k Keeper) GetBlockHeaderByHash(c context.Context, req *types.QueryGetBlockHeaderByHashRequest) (*types.QueryGetBlockHeaderByHashResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - header, found := k.GetBlockHeader(sdk.UnwrapSDKContext(c), req.BlockHash) - if !found { - return nil, status.Error(codes.NotFound, "not found") - } +func (k Keeper) GetBlockHeaderState(ctx sdk.Context, chainID int64) (val types.BlockHeaderState, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeaderStateKey)) - return &types.QueryGetBlockHeaderByHashResponse{BlockHeader: &header}, nil -} - -func (k Keeper) GetBlockHeaderStateByChain(c context.Context, req *types.QueryGetBlockHeaderStateRequest) (*types.QueryGetBlockHeaderStateResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - state, found := k.GetBlockHeaderState(sdk.UnwrapSDKContext(c), req.ChainId) - if !found { - return nil, status.Error(codes.NotFound, fmt.Sprintf("not found: chain id %d", req.ChainId)) + b := store.Get(types.KeyPrefix(strconv.FormatInt(chainID, 10))) + if b == nil { + return val, false } - return &types.QueryGetBlockHeaderStateResponse{BlockHeaderState: &state}, nil + k.cdc.MustUnmarshal(b, &val) + return val, true } diff --git a/x/observer/keeper/chain_nonces.go b/x/observer/keeper/chain_nonces.go new file mode 100644 index 0000000000..cf386545d0 --- /dev/null +++ b/x/observer/keeper/chain_nonces.go @@ -0,0 +1,52 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +// ChainNonces methods +// The object stores the current nonce for the chain + +// SetChainNonces set a specific chainNonces in the store from its index +func (k Keeper) SetChainNonces(ctx sdk.Context, chainNonces types.ChainNonces) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ChainNoncesKey)) + b := k.cdc.MustMarshal(&chainNonces) + store.Set(types.KeyPrefix(chainNonces.Index), b) +} + +// GetChainNonces returns a chainNonces from its index +func (k Keeper) GetChainNonces(ctx sdk.Context, index string) (val types.ChainNonces, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ChainNoncesKey)) + + b := store.Get(types.KeyPrefix(index)) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// RemoveChainNonces removes a chainNonces from the store +func (k Keeper) RemoveChainNonces(ctx sdk.Context, index string) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ChainNoncesKey)) + store.Delete(types.KeyPrefix(index)) +} + +// GetAllChainNonces returns all chainNonces +func (k Keeper) GetAllChainNonces(ctx sdk.Context) (list []types.ChainNonces) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ChainNoncesKey)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.ChainNonces + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/observer/keeper/chain_nonces_test.go b/x/observer/keeper/chain_nonces_test.go new file mode 100644 index 0000000000..0c511d3f79 --- /dev/null +++ b/x/observer/keeper/chain_nonces_test.go @@ -0,0 +1,42 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" +) + +func TestKeeper_GetChainNonces(t *testing.T) { + t.Run("Get chain nonces", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + chainNoncesList := sample.ChainNoncesList(t, 10) + for _, n := range chainNoncesList { + k.SetChainNonces(ctx, n) + } + for _, n := range chainNoncesList { + rst, found := k.GetChainNonces(ctx, n.Index) + require.True(t, found) + require.Equal(t, n, rst) + } + }) + t.Run("Get chain nonces not found", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + chainNoncesList := sample.ChainNoncesList(t, 10) + for _, n := range chainNoncesList { + k.SetChainNonces(ctx, n) + } + _, found := k.GetChainNonces(ctx, "not_found") + require.False(t, found) + }) + t.Run("Get all chain nonces", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + chainNoncesList := sample.ChainNoncesList(t, 10) + for _, n := range chainNoncesList { + k.SetChainNonces(ctx, n) + } + rst := k.GetAllChainNonces(ctx) + require.Equal(t, chainNoncesList, rst) + }) +} diff --git a/x/observer/keeper/grpc_query_ballot.go b/x/observer/keeper/grpc_query_ballot.go new file mode 100644 index 0000000000..4bd0e6c6ff --- /dev/null +++ b/x/observer/keeper/grpc_query_ballot.go @@ -0,0 +1,55 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/x/observer/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) HasVoted(goCtx context.Context, req *types.QueryHasVotedRequest) (*types.QueryHasVotedResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + ballot, found := k.GetBallot(ctx, req.BallotIdentifier) + if !found { + return &types.QueryHasVotedResponse{ + HasVoted: false, + }, nil + } + hasVoted := ballot.HasVoted(req.VoterAddress) + + return &types.QueryHasVotedResponse{ + HasVoted: hasVoted, + }, nil +} + +func (k Keeper) BallotByIdentifier(goCtx context.Context, req *types.QueryBallotByIdentifierRequest) (*types.QueryBallotByIdentifierResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + ballot, found := k.GetBallot(ctx, req.BallotIdentifier) + if !found { + return nil, status.Error(codes.NotFound, "not found ballot") + } + + votersList := make([]*types.VoterList, len(ballot.VoterList)) + for i, voterAddress := range ballot.VoterList { + voter := types.VoterList{ + VoterAddress: voterAddress, + VoteType: ballot.Votes[ballot.GetVoterIndex(voterAddress)], + } + votersList[i] = &voter + } + + return &types.QueryBallotByIdentifierResponse{ + BallotIdentifier: ballot.BallotIdentifier, + Voters: votersList, + ObservationType: ballot.ObservationType, + BallotStatus: ballot.BallotStatus, + }, nil +} diff --git a/x/observer/keeper/grpc_query_blame.go b/x/observer/keeper/grpc_query_blame.go new file mode 100644 index 0000000000..e0cb709772 --- /dev/null +++ b/x/observer/keeper/grpc_query_blame.go @@ -0,0 +1,55 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/x/observer/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) BlameByIdentifier(goCtx context.Context, request *types.QueryBlameByIdentifierRequest) (*types.QueryBlameByIdentifierResponse, error) { + if request == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + blame, found := k.GetBlame(ctx, request.BlameIdentifier) + if !found { + return nil, status.Error(codes.NotFound, "blame info not found") + } + + return &types.QueryBlameByIdentifierResponse{ + BlameInfo: &blame, + }, nil +} + +func (k Keeper) GetAllBlameRecords(goCtx context.Context, request *types.QueryAllBlameRecordsRequest) (*types.QueryAllBlameRecordsResponse, error) { + if request == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + blameRecords, pageRes, err := k.GetAllBlamePaginated(ctx, request.Pagination) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllBlameRecordsResponse{ + BlameInfo: blameRecords, + Pagination: pageRes, + }, nil +} + +func (k Keeper) BlamesByChainAndNonce(goCtx context.Context, request *types.QueryBlameByChainAndNonceRequest) (*types.QueryBlameByChainAndNonceResponse, error) { + if request == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + blameRecords, found := k.GetBlamesByChainAndNonce(ctx, request.ChainId, request.Nonce) + if !found { + return nil, status.Error(codes.NotFound, "blame info not found") + } + return &types.QueryBlameByChainAndNonceResponse{ + BlameInfo: blameRecords, + }, nil +} diff --git a/x/observer/keeper/grpc_query_blame_test.go b/x/observer/keeper/grpc_query_blame_test.go new file mode 100644 index 0000000000..8e66e3a2da --- /dev/null +++ b/x/observer/keeper/grpc_query_blame_test.go @@ -0,0 +1,110 @@ +package keeper_test + +import ( + "sort" + "testing" + + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/stretchr/testify/require" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func TestKeeper_BlameByIdentifier(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + var chainId int64 = 97 + var nonce uint64 = 101 + digest := "85f5e10431f69bc2a14046a13aabaefc660103b6de7a84f75c4b96181d03f0b5" + + index := types.GetBlameIndex(chainId, nonce, digest, 123) + + k.SetBlame(ctx, types.Blame{ + Index: index, + FailureReason: "failed to join party", + Nodes: nil, + }) + + blameRecords, found := k.GetBlame(ctx, index) + require.True(t, found) + require.Equal(t, index, blameRecords.Index) +} + +func TestKeeper_BlameByChainAndNonce(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + var chainId int64 = 97 + var nonce uint64 = 101 + digest := "85f5e10431f69bc2a14046a13aabaefc660103b6de7a84f75c4b96181d03f0b5" + + index := types.GetBlameIndex(chainId, nonce, digest, 123) + + k.SetBlame(ctx, types.Blame{ + Index: index, + FailureReason: "failed to join party", + Nodes: nil, + }) + + blameRecords, found := k.GetBlamesByChainAndNonce(ctx, chainId, int64(nonce)) + require.True(t, found) + require.Equal(t, 1, len(blameRecords)) + require.Equal(t, index, blameRecords[0].Index) +} + +func TestKeeper_BlameAll(t *testing.T) { + t.Run("GetBlameRecord by limit ", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + blameList := sample.BlameRecordsList(t, 10) + for _, record := range blameList { + k.SetBlame(ctx, record) + } + sort.Slice(blameList, func(i, j int) bool { + return blameList[i].Index < blameList[j].Index + }) + rst, pageRes, err := k.GetAllBlamePaginated(ctx, &query.PageRequest{Limit: 10, CountTotal: true}) + require.NoError(t, err) + sort.Slice(rst, func(i, j int) bool { + return rst[i].Index < rst[j].Index + }) + require.Equal(t, blameList, rst) + require.Equal(t, len(blameList), int(pageRes.Total)) + }) + t.Run("GetBlameRecord by offset ", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + blameList := sample.BlameRecordsList(t, 20) + offset := 10 + for _, record := range blameList { + k.SetBlame(ctx, record) + } + sort.Slice(blameList, func(i, j int) bool { + return blameList[i].Index < blameList[j].Index + }) + rst, pageRes, err := k.GetAllBlamePaginated(ctx, &query.PageRequest{Offset: uint64(offset), CountTotal: true}) + require.NoError(t, err) + sort.Slice(rst, func(i, j int) bool { + return rst[i].Index < rst[j].Index + }) + require.Subset(t, blameList, rst) + require.Equal(t, len(blameList)-offset, len(rst)) + require.Equal(t, len(blameList), int(pageRes.Total)) + }) + t.Run("GetAllBlameRecord", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + blameList := sample.BlameRecordsList(t, 100) + for _, record := range blameList { + k.SetBlame(ctx, record) + } + rst := k.GetAllBlame(ctx) + sort.Slice(rst, func(i, j int) bool { + return rst[i].Index < rst[j].Index + }) + sort.Slice(blameList, func(i, j int) bool { + return blameList[i].Index < blameList[j].Index + }) + require.Equal(t, blameList, rst) + }) + t.Run("Get no records if nothing is set", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + rst := k.GetAllBlame(ctx) + require.Len(t, rst, 0) + }) +} diff --git a/x/observer/keeper/grpc_query_block_header.go b/x/observer/keeper/grpc_query_block_header.go new file mode 100644 index 0000000000..1fd95c24d5 --- /dev/null +++ b/x/observer/keeper/grpc_query_block_header.go @@ -0,0 +1,66 @@ +package keeper + +import ( + "context" + "fmt" + + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/x/observer/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// GetAllBlockHeaders queries all for block header +func (k Keeper) GetAllBlockHeaders(c context.Context, req *types.QueryAllBlockHeaderRequest) (*types.QueryAllBlockHeaderResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + store := ctx.KVStore(k.storeKey) + blockHeaderStore := prefix.NewStore(store, types.KeyPrefix(types.BlockHeaderKey)) + + var blockHeaders []*common.BlockHeader + pageRes, err := query.Paginate(blockHeaderStore, req.Pagination, func(key []byte, value []byte) error { + var blockHeader common.BlockHeader + if err := k.cdc.Unmarshal(value, &blockHeader); err != nil { + return err + } + + blockHeaders = append(blockHeaders, &blockHeader) + return nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + return &types.QueryAllBlockHeaderResponse{BlockHeaders: blockHeaders, Pagination: pageRes}, nil +} + +// GetBlockHeaderByHash queries block header by hash +func (k Keeper) GetBlockHeaderByHash(c context.Context, req *types.QueryGetBlockHeaderByHashRequest) (*types.QueryGetBlockHeaderByHashResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + header, found := k.GetBlockHeader(sdk.UnwrapSDKContext(c), req.BlockHash) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + return &types.QueryGetBlockHeaderByHashResponse{BlockHeader: &header}, nil +} + +func (k Keeper) GetBlockHeaderStateByChain(c context.Context, req *types.QueryGetBlockHeaderStateRequest) (*types.QueryGetBlockHeaderStateResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + state, found := k.GetBlockHeaderState(sdk.UnwrapSDKContext(c), req.ChainId) + if !found { + return nil, status.Error(codes.NotFound, fmt.Sprintf("not found: chain id %d", req.ChainId)) + } + + return &types.QueryGetBlockHeaderStateResponse{BlockHeaderState: &state}, nil +} diff --git a/x/observer/keeper/grpc_query_core_params.go b/x/observer/keeper/grpc_query_core_params.go new file mode 100644 index 0000000000..d55daa98a9 --- /dev/null +++ b/x/observer/keeper/grpc_query_core_params.go @@ -0,0 +1,40 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/x/observer/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) GetCoreParamsForChain(goCtx context.Context, req *types.QueryGetCoreParamsForChainRequest) (*types.QueryGetCoreParamsForChainResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + coreParams, found := k.GetCoreParamsByChainID(ctx, req.ChainId) + if !found { + return nil, status.Error(codes.NotFound, "core params not found") + } + return &types.QueryGetCoreParamsForChainResponse{ + CoreParams: coreParams, + }, nil +} + +func (k Keeper) GetCoreParams(goCtx context.Context, req *types.QueryGetCoreParamsRequest) (*types.QueryGetCoreParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + coreParams, found := k.GetAllCoreParams(ctx) + if !found { + return nil, status.Error(codes.NotFound, "core params not found") + } + return &types.QueryGetCoreParamsResponse{ + CoreParams: &coreParams, + }, nil +} diff --git a/x/observer/keeper/grpc_query_keygen.go b/x/observer/keeper/grpc_query_keygen.go new file mode 100644 index 0000000000..f479991759 --- /dev/null +++ b/x/observer/keeper/grpc_query_keygen.go @@ -0,0 +1,19 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/x/observer/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) Keygen(c context.Context, _ *types.QueryGetKeygenRequest) (*types.QueryGetKeygenResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + val, found := k.GetKeygen(ctx) + if !found { + return nil, status.Error(codes.InvalidArgument, "not found") + } + return &types.QueryGetKeygenResponse{Keygen: &val}, nil +} diff --git a/x/observer/keeper/keeper_keygen_test.go b/x/observer/keeper/grpc_query_keygen_test.go similarity index 57% rename from x/observer/keeper/keeper_keygen_test.go rename to x/observer/keeper/grpc_query_keygen_test.go index 03e2190bf3..f4c61aeabd 100644 --- a/x/observer/keeper/keeper_keygen_test.go +++ b/x/observer/keeper/grpc_query_keygen_test.go @@ -6,37 +6,9 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" - "github.com/zeta-chain/zetacore/x/observer/types" ) -// Keeper Tests -func createTestKeygen(keeper *Keeper, ctx sdk.Context) types.Keygen { - item := types.Keygen{ - BlockNumber: 10, - } - keeper.SetKeygen(ctx, item) - return item -} - -func TestKeygenGet(t *testing.T) { - keeper, ctx := SetupKeeper(t) - item := createTestKeygen(keeper, ctx) - rst, found := keeper.GetKeygen(ctx) - assert.True(t, found) - assert.Equal(t, item, rst) -} -func TestKeygenRemove(t *testing.T) { - keeper, ctx := SetupKeeper(t) - createTestKeygen(keeper, ctx) - keeper.RemoveKeygen(ctx) - _, found := keeper.GetKeygen(ctx) - assert.False(t, found) -} - -// Querier Tests - func TestKeygenQuery(t *testing.T) { keeper, ctx := SetupKeeper(t) wctx := sdk.WrapSDKContext(ctx) diff --git a/x/observer/keeper/keeper_node_account.go b/x/observer/keeper/grpc_query_node_account.go similarity index 53% rename from x/observer/keeper/keeper_node_account.go rename to x/observer/keeper/grpc_query_node_account.go index 19436b55dc..2528754448 100644 --- a/x/observer/keeper/keeper_node_account.go +++ b/x/observer/keeper/grpc_query_node_account.go @@ -11,50 +11,6 @@ import ( "google.golang.org/grpc/status" ) -// SetNodeAccount set a specific nodeAccount in the store from its index -func (k Keeper) SetNodeAccount(ctx sdk.Context, nodeAccount types.NodeAccount) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NodeAccountKey)) - b := k.cdc.MustMarshal(&nodeAccount) - store.Set(types.KeyPrefix(nodeAccount.Operator), b) -} - -// GetNodeAccount returns a nodeAccount from its index -func (k Keeper) GetNodeAccount(ctx sdk.Context, index string) (val types.NodeAccount, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NodeAccountKey)) - - b := store.Get(types.KeyPrefix(index)) - if b == nil { - return val, false - } - - k.cdc.MustUnmarshal(b, &val) - return val, true -} - -// RemoveNodeAccount removes a nodeAccount from the store -func (k Keeper) RemoveNodeAccount(ctx sdk.Context, index string) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NodeAccountKey)) - store.Delete(types.KeyPrefix(index)) -} - -// GetAllNodeAccount returns all nodeAccount -func (k Keeper) GetAllNodeAccount(ctx sdk.Context) (list []types.NodeAccount) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NodeAccountKey)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var val types.NodeAccount - k.cdc.MustUnmarshal(iterator.Value(), &val) - list = append(list, val) - } - - return -} - -// Queries - func (k Keeper) NodeAccountAll(c context.Context, req *types.QueryAllNodeAccountRequest) (*types.QueryAllNodeAccountResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") diff --git a/x/observer/keeper/keeper_node_account_test.go b/x/observer/keeper/grpc_query_node_account_test.go similarity index 74% rename from x/observer/keeper/keeper_node_account_test.go rename to x/observer/keeper/grpc_query_node_account_test.go index e8d6b90eba..37585214cf 100644 --- a/x/observer/keeper/keeper_node_account_test.go +++ b/x/observer/keeper/grpc_query_node_account_test.go @@ -1,58 +1,17 @@ package keeper import ( - "fmt" "testing" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/x/observer/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" - - "github.com/zeta-chain/zetacore/x/observer/types" ) -// Keeper Tests - -func createNNodeAccount(keeper *Keeper, ctx sdk.Context, n int) []types.NodeAccount { - items := make([]types.NodeAccount, n) - for i := range items { - items[i].Operator = fmt.Sprintf("%d", i) - keeper.SetNodeAccount(ctx, items[i]) - } - return items -} - -func TestNodeAccountGet(t *testing.T) { - keeper, ctx := SetupKeeper(t) - items := createNNodeAccount(keeper, ctx, 10) - for _, item := range items { - rst, found := keeper.GetNodeAccount(ctx, item.Operator) - assert.True(t, found) - assert.Equal(t, item, rst) - } -} -func TestNodeAccountRemove(t *testing.T) { - keeper, ctx := SetupKeeper(t) - items := createNNodeAccount(keeper, ctx, 10) - for _, item := range items { - keeper.RemoveNodeAccount(ctx, item.Operator) - _, found := keeper.GetNodeAccount(ctx, item.Operator) - assert.False(t, found) - } -} - -func TestNodeAccountGetAll(t *testing.T) { - keeper, ctx := SetupKeeper(t) - items := createNNodeAccount(keeper, ctx, 10) - assert.Equal(t, items, keeper.GetAllNodeAccount(ctx)) -} - -// Querier Tests - func TestNodeAccountQuerySingle(t *testing.T) { keeper, ctx := SetupKeeper(t) wctx := sdk.WrapSDKContext(ctx) diff --git a/x/observer/keeper/grpc_query_nonces.go b/x/observer/keeper/grpc_query_nonces.go new file mode 100644 index 0000000000..7c0b6d481a --- /dev/null +++ b/x/observer/keeper/grpc_query_nonces.go @@ -0,0 +1,95 @@ +package keeper + +import ( + "context" + "fmt" + + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/zeta-chain/zetacore/x/observer/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// Chain nonces queries + +func (k Keeper) ChainNoncesAll(c context.Context, req *types.QueryAllChainNoncesRequest) (*types.QueryAllChainNoncesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + var chainNoncess []types.ChainNonces + ctx := sdk.UnwrapSDKContext(c) + + store := ctx.KVStore(k.storeKey) + chainNoncesStore := prefix.NewStore(store, types.KeyPrefix(types.ChainNoncesKey)) + + pageRes, err := query.Paginate(chainNoncesStore, req.Pagination, func(key []byte, value []byte) error { + var chainNonces types.ChainNonces + if err := k.cdc.Unmarshal(value, &chainNonces); err != nil { + return err + } + + chainNoncess = append(chainNoncess, chainNonces) + return nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllChainNoncesResponse{ChainNonces: chainNoncess, Pagination: pageRes}, nil +} + +func (k Keeper) ChainNonces(c context.Context, req *types.QueryGetChainNoncesRequest) (*types.QueryGetChainNoncesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + val, found := k.GetChainNonces(ctx, req.Index) + if !found { + return nil, status.Error(codes.InvalidArgument, "not found") + } + + return &types.QueryGetChainNoncesResponse{ChainNonces: val}, nil +} + +// Pending nonces queries + +func (k Keeper) PendingNoncesAll(c context.Context, req *types.QueryAllPendingNoncesRequest) (*types.QueryAllPendingNoncesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(c) + list, pageRes, err := k.GetAllPendingNoncesPaginated(ctx, req.Pagination) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + return &types.QueryAllPendingNoncesResponse{ + PendingNonces: list, + Pagination: pageRes, + }, nil +} + +func (k Keeper) PendingNoncesByChain(c context.Context, req *types.QueryPendingNoncesByChainRequest) (*types.QueryPendingNoncesByChainResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(c) + tss, found := k.GetTSS(ctx) + if !found { + return nil, status.Error(codes.NotFound, "tss not found") + } + list, found := k.GetPendingNonces(ctx, tss.TssPubkey, req.ChainId) + if !found { + return nil, status.Error(codes.NotFound, fmt.Sprintf("pending nonces not found for chain id : %d", req.ChainId)) + } + + return &types.QueryPendingNoncesByChainResponse{ + PendingNonces: list, + }, nil +} diff --git a/x/observer/keeper/grpc_query_nonces_test.go b/x/observer/keeper/grpc_query_nonces_test.go new file mode 100644 index 0000000000..584f237e7b --- /dev/null +++ b/x/observer/keeper/grpc_query_nonces_test.go @@ -0,0 +1,111 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/observer/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func TestChainNoncesQuerySingle(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + chainNonces := sample.ChainNoncesList(t, 2) + for _, nonce := range chainNonces { + k.SetChainNonces(ctx, nonce) + } + for _, tc := range []struct { + desc string + request *types.QueryGetChainNoncesRequest + response *types.QueryGetChainNoncesResponse + err error + }{ + { + desc: "First", + request: &types.QueryGetChainNoncesRequest{Index: chainNonces[0].Index}, + response: &types.QueryGetChainNoncesResponse{ChainNonces: chainNonces[0]}, + }, + { + desc: "Second", + request: &types.QueryGetChainNoncesRequest{Index: chainNonces[1].Index}, + response: &types.QueryGetChainNoncesResponse{ChainNonces: chainNonces[1]}, + }, + { + desc: "KeyNotFound", + request: &types.QueryGetChainNoncesRequest{Index: "missing"}, + err: status.Error(codes.InvalidArgument, "not found"), + }, + { + desc: "InvalidRequest", + err: status.Error(codes.InvalidArgument, "invalid request"), + }, + } { + tc := tc + t.Run(tc.desc, func(t *testing.T) { + response, err := k.ChainNonces(wctx, tc.request) + if tc.err != nil { + require.ErrorIs(t, err, tc.err) + } else { + require.Equal(t, tc.response, response) + } + }) + } +} + +func TestChainNoncesQueryPaginated(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + chainNonces := sample.ChainNoncesList(t, 5) + for _, nonce := range chainNonces { + k.SetChainNonces(ctx, nonce) + } + + request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllChainNoncesRequest { + return &types.QueryAllChainNoncesRequest{ + Pagination: &query.PageRequest{ + Key: next, + Offset: offset, + Limit: limit, + CountTotal: total, + }, + } + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(chainNonces); i += step { + resp, err := k.ChainNoncesAll(wctx, request(nil, uint64(i), uint64(step), false)) + require.NoError(t, err) + for j := i; j < len(chainNonces) && j < i+step; j++ { + assert.Equal(t, chainNonces[j], resp.ChainNonces[j-i]) + } + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(chainNonces); i += step { + resp, err := k.ChainNoncesAll(wctx, request(next, 0, uint64(step), false)) + require.NoError(t, err) + for j := i; j < len(chainNonces) && j < i+step; j++ { + assert.Equal(t, chainNonces[j], resp.ChainNonces[j-i]) + } + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + resp, err := k.ChainNoncesAll(wctx, request(nil, 0, 0, true)) + require.NoError(t, err) + require.Equal(t, len(chainNonces), int(resp.Pagination.Total)) + }) + t.Run("InvalidRequest", func(t *testing.T) { + _, err := k.ChainNoncesAll(wctx, nil) + require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) + }) +} diff --git a/x/observer/keeper/grpc_query_observer.go b/x/observer/keeper/grpc_query_observer.go new file mode 100644 index 0000000000..e9c8aacb77 --- /dev/null +++ b/x/observer/keeper/grpc_query_observer.go @@ -0,0 +1,60 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/x/observer/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) ObserversByChain(goCtx context.Context, req *types.QueryObserversByChainRequest) (*types.QueryObserversByChainResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + // TODO move parsing to client + // https://github.com/zeta-chain/node/issues/867 + + chainName := common.ParseChainName(req.ObservationChain) + chain := k.GetParams(ctx).GetChainFromChainName(chainName) + if chain == nil { + return &types.QueryObserversByChainResponse{}, types.ErrSupportedChains + } + mapper, found := k.GetObserverMapper(ctx, chain) + if !found { + return &types.QueryObserversByChainResponse{}, types.ErrObserverNotPresent + } + return &types.QueryObserversByChainResponse{Observers: mapper.ObserverList}, nil +} + +func (k Keeper) AllObserverMappers(goCtx context.Context, req *types.QueryAllObserverMappersRequest) (*types.QueryAllObserverMappersResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + mappers := k.GetAllObserverMappers(ctx) + return &types.QueryAllObserverMappersResponse{ObserverMappers: mappers}, nil +} + +func (k Keeper) ShowObserverCount(goCtx context.Context, req *types.QueryShowObserverCountRequest) (*types.QueryShowObserverCountResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + lb, found := k.GetLastObserverCount(ctx) + if !found { + return nil, status.Error(codes.NotFound, "last observer count not found") + } + + return &types.QueryShowObserverCountResponse{ + LastObserverCount: &lb, + }, nil +} diff --git a/x/observer/keeper/grpc_query_params.go b/x/observer/keeper/grpc_query_params.go index 516d967cb9..f02060de25 100644 --- a/x/observer/keeper/grpc_query_params.go +++ b/x/observer/keeper/grpc_query_params.go @@ -17,33 +17,3 @@ func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types return &types.QueryParamsResponse{ Params: k.GetParams(ctx)}, nil } - -func (k Keeper) GetCoreParamsForChain(goCtx context.Context, req *types.QueryGetCoreParamsForChainRequest) (*types.QueryGetCoreParamsForChainResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(goCtx) - coreParams, found := k.GetCoreParamsByChainID(ctx, req.ChainId) - if !found { - return nil, status.Error(codes.NotFound, "core params not found") - } - return &types.QueryGetCoreParamsForChainResponse{ - CoreParams: coreParams, - }, nil -} - -func (k Keeper) GetCoreParams(goCtx context.Context, req *types.QueryGetCoreParamsRequest) (*types.QueryGetCoreParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(goCtx) - - coreParams, found := k.GetAllCoreParams(ctx) - if !found { - return nil, status.Error(codes.NotFound, "core params not found") - } - return &types.QueryGetCoreParamsResponse{ - CoreParams: &coreParams, - }, nil -} diff --git a/x/observer/keeper/grpc_query_show_observer_count.go b/x/observer/keeper/grpc_query_show_observer_count.go deleted file mode 100644 index 47b140f96e..0000000000 --- a/x/observer/keeper/grpc_query_show_observer_count.go +++ /dev/null @@ -1,27 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/x/observer/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -func (k Keeper) ShowObserverCount(goCtx context.Context, req *types.QueryShowObserverCountRequest) (*types.QueryShowObserverCountResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(goCtx) - - lb, found := k.GetLastObserverCount(ctx) - if !found { - return nil, status.Error(codes.NotFound, "last observer count not found") - } - - return &types.QueryShowObserverCountResponse{ - LastObserverCount: &lb, - }, nil -} diff --git a/x/observer/keeper/keeper_supported_chain.go b/x/observer/keeper/grpc_query_supported_chain.go similarity index 100% rename from x/observer/keeper/keeper_supported_chain.go rename to x/observer/keeper/grpc_query_supported_chain.go diff --git a/x/observer/keeper/grpc_query_tss.go b/x/observer/keeper/grpc_query_tss.go new file mode 100644 index 0000000000..081d801277 --- /dev/null +++ b/x/observer/keeper/grpc_query_tss.go @@ -0,0 +1,98 @@ +package keeper + +import ( + "context" + "sort" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/x/observer/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// Tss returns the tss address for the current tss only +func (k Keeper) TSS(c context.Context, req *types.QueryGetTSSRequest) (*types.QueryGetTSSResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + val, found := k.GetTSS(ctx) + if !found { + return nil, status.Error(codes.InvalidArgument, "not found") + } + + return &types.QueryGetTSSResponse{TSS: val}, nil +} + +// TssHistory Query historical list of TSS information +func (k Keeper) TssHistory(c context.Context, _ *types.QueryTssHistoryRequest) (*types.QueryTssHistoryResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + tssList := k.GetAllTSS(ctx) + sort.SliceStable(tssList, func(i, j int) bool { + return tssList[i].FinalizedZetaHeight < tssList[j].FinalizedZetaHeight + }) + return &types.QueryTssHistoryResponse{TssList: tssList}, nil +} + +func (k Keeper) GetTssAddress(goCtx context.Context, req *types.QueryGetTssAddressRequest) (*types.QueryGetTssAddressResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + tss, found := k.GetTSS(ctx) + if !found { + return nil, status.Error(codes.NotFound, "current tss not set") + } + ethAddress, err := common.GetTssAddrEVM(tss.TssPubkey) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + bitcoinParams := common.BitcoinRegnetParams + if req.BitcoinChainId != 0 { + bitcoinParams, err = common.BitcoinNetParamsFromChainID(req.BitcoinChainId) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + } + btcAddress, err := common.GetTssAddrBTC(tss.TssPubkey, bitcoinParams) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryGetTssAddressResponse{ + Eth: ethAddress.String(), + Btc: btcAddress, + }, nil +} + +func (k Keeper) GetTssAddressByFinalizedHeight(goCtx context.Context, req *types.QueryGetTssAddressByFinalizedHeightRequest) (*types.QueryGetTssAddressByFinalizedHeightResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + tss, found := k.GetHistoricalTssByFinalizedHeight(ctx, req.FinalizedZetaHeight) + if !found { + return nil, status.Error(codes.NotFound, "tss not found") + } + ethAddress, err := common.GetTssAddrEVM(tss.TssPubkey) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + bitcoinParams := common.BitcoinRegnetParams + if req.BitcoinChainId != 0 { + bitcoinParams, err = common.BitcoinNetParamsFromChainID(req.BitcoinChainId) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + } + btcAddress, err := common.GetTssAddrBTC(tss.TssPubkey, bitcoinParams) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + return &types.QueryGetTssAddressByFinalizedHeightResponse{ + Eth: ethAddress.String(), + Btc: btcAddress, + }, nil +} diff --git a/x/observer/keeper/keeper_block_header.go b/x/observer/keeper/keeper_block_header.go deleted file mode 100644 index d82ac962f5..0000000000 --- a/x/observer/keeper/keeper_block_header.go +++ /dev/null @@ -1,29 +0,0 @@ -package keeper - -import ( - "strconv" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/x/observer/types" -) - -// SetKeygen set keygen in the store -func (k Keeper) SetBlockHeaderState(ctx sdk.Context, blockHeaderState types.BlockHeaderState) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeaderStateKey)) - b := k.cdc.MustMarshal(&blockHeaderState) - key := strconv.FormatInt(blockHeaderState.ChainId, 10) - store.Set(types.KeyPrefix(key), b) -} - -func (k Keeper) GetBlockHeaderState(ctx sdk.Context, chainID int64) (val types.BlockHeaderState, found bool) { - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeaderStateKey)) - - b := store.Get(types.KeyPrefix(strconv.FormatInt(chainID, 10))) - if b == nil { - return val, false - } - - k.cdc.MustUnmarshal(b, &val) - return val, true -} diff --git a/x/observer/keeper/keeper_keygen.go b/x/observer/keeper/keygen.go similarity index 69% rename from x/observer/keeper/keeper_keygen.go rename to x/observer/keeper/keygen.go index daa79935dd..a8860c9c9f 100644 --- a/x/observer/keeper/keeper_keygen.go +++ b/x/observer/keeper/keygen.go @@ -1,13 +1,9 @@ package keeper import ( - "context" - "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/zeta-chain/zetacore/x/observer/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) // SetKeygen set keygen in the store @@ -35,14 +31,3 @@ func (k Keeper) RemoveKeygen(ctx sdk.Context) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.KeygenKey)) store.Delete([]byte{0}) } - -// Query - -func (k Keeper) Keygen(c context.Context, _ *types.QueryGetKeygenRequest) (*types.QueryGetKeygenResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - val, found := k.GetKeygen(ctx) - if !found { - return nil, status.Error(codes.InvalidArgument, "not found") - } - return &types.QueryGetKeygenResponse{Keygen: &val}, nil -} diff --git a/x/observer/keeper/keygen_test.go b/x/observer/keeper/keygen_test.go new file mode 100644 index 0000000000..a48c769c37 --- /dev/null +++ b/x/observer/keeper/keygen_test.go @@ -0,0 +1,34 @@ +package keeper + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/assert" + + "github.com/zeta-chain/zetacore/x/observer/types" +) + +// Keeper Tests +func createTestKeygen(keeper *Keeper, ctx sdk.Context) types.Keygen { + item := types.Keygen{ + BlockNumber: 10, + } + keeper.SetKeygen(ctx, item) + return item +} + +func TestKeygenGet(t *testing.T) { + keeper, ctx := SetupKeeper(t) + item := createTestKeygen(keeper, ctx) + rst, found := keeper.GetKeygen(ctx) + assert.True(t, found) + assert.Equal(t, item, rst) +} +func TestKeygenRemove(t *testing.T) { + keeper, ctx := SetupKeeper(t) + createTestKeygen(keeper, ctx) + keeper.RemoveKeygen(ctx) + _, found := keeper.GetKeygen(ctx) + assert.False(t, found) +} diff --git a/x/observer/keeper/msg_server_add_block_header_test.go b/x/observer/keeper/msg_server_add_block_header_test.go index ff3c916b11..eb2c93970f 100644 --- a/x/observer/keeper/msg_server_add_block_header_test.go +++ b/x/observer/keeper/msg_server_add_block_header_test.go @@ -1,6 +1,3 @@ -//go:build TESTNET -// +build TESTNET - package keeper_test import ( @@ -29,7 +26,7 @@ func TestMsgServer_AddBlockHeader(t *testing.T) { header3RLP, err := rlp.EncodeToBytes(header3) assert.NoError(t, err) - observerChain := common.GoerliChain() + observerChain := common.GoerliLocalnetChain() r := rand.New(rand.NewSource(9)) validator := sample.Validator(t, r) observerAddress, err := types.GetAccAddressFromOperatorAddress(validator.OperatorAddress) @@ -47,7 +44,7 @@ func TestMsgServer_AddBlockHeader(t *testing.T) { name: "success submit eth header", msg: &types.MsgAddBlockHeader{ Creator: observerAddress.String(), - ChainId: common.GoerliChain().ChainId, + ChainId: common.GoerliLocalnetChain().ChainId, BlockHash: header.Hash().Bytes(), Height: 1, Header: common.NewEthereumHeader(header1RLP), @@ -61,7 +58,7 @@ func TestMsgServer_AddBlockHeader(t *testing.T) { name: "failure submit eth header eth disabled", msg: &types.MsgAddBlockHeader{ Creator: observerAddress.String(), - ChainId: common.GoerliChain().ChainId, + ChainId: common.GoerliLocalnetChain().ChainId, BlockHash: header.Hash().Bytes(), Height: 1, Header: common.NewEthereumHeader(header1RLP), @@ -77,7 +74,7 @@ func TestMsgServer_AddBlockHeader(t *testing.T) { name: "failure submit eth header eth disabled", msg: &types.MsgAddBlockHeader{ Creator: sample.AccAddress(), - ChainId: common.GoerliChain().ChainId, + ChainId: common.GoerliLocalnetChain().ChainId, BlockHash: header.Hash().Bytes(), Height: 1, Header: common.NewEthereumHeader(header1RLP), @@ -93,7 +90,7 @@ func TestMsgServer_AddBlockHeader(t *testing.T) { name: "should fail if block header parent does not exist", msg: &types.MsgAddBlockHeader{ Creator: observerAddress.String(), - ChainId: common.GoerliChain().ChainId, + ChainId: common.GoerliLocalnetChain().ChainId, BlockHash: header3.Hash().Bytes(), Height: 3, Header: common.NewEthereumHeader(header3RLP), @@ -109,7 +106,7 @@ func TestMsgServer_AddBlockHeader(t *testing.T) { name: "should succeed if block header parent does exist", msg: &types.MsgAddBlockHeader{ Creator: observerAddress.String(), - ChainId: common.GoerliChain().ChainId, + ChainId: common.GoerliLocalnetChain().ChainId, BlockHash: header2.Hash().Bytes(), Height: 2, Header: common.NewEthereumHeader(header2RLP), @@ -123,7 +120,7 @@ func TestMsgServer_AddBlockHeader(t *testing.T) { name: "should succeed to post 3rd header if 2nd header is posted", msg: &types.MsgAddBlockHeader{ Creator: observerAddress.String(), - ChainId: common.GoerliChain().ChainId, + ChainId: common.GoerliLocalnetChain().ChainId, BlockHash: header3.Hash().Bytes(), Height: 3, Header: common.NewEthereumHeader(header3RLP), diff --git a/x/observer/keeper/node_account.go b/x/observer/keeper/node_account.go new file mode 100644 index 0000000000..3f6a14be66 --- /dev/null +++ b/x/observer/keeper/node_account.go @@ -0,0 +1,49 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +// SetNodeAccount set a specific nodeAccount in the store from its index +func (k Keeper) SetNodeAccount(ctx sdk.Context, nodeAccount types.NodeAccount) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NodeAccountKey)) + b := k.cdc.MustMarshal(&nodeAccount) + store.Set(types.KeyPrefix(nodeAccount.Operator), b) +} + +// GetNodeAccount returns a nodeAccount from its index +func (k Keeper) GetNodeAccount(ctx sdk.Context, index string) (val types.NodeAccount, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NodeAccountKey)) + + b := store.Get(types.KeyPrefix(index)) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// RemoveNodeAccount removes a nodeAccount from the store +func (k Keeper) RemoveNodeAccount(ctx sdk.Context, index string) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NodeAccountKey)) + store.Delete(types.KeyPrefix(index)) +} + +// GetAllNodeAccount returns all nodeAccount +func (k Keeper) GetAllNodeAccount(ctx sdk.Context) (list []types.NodeAccount) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NodeAccountKey)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.NodeAccount + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/observer/keeper/node_account_test.go b/x/observer/keeper/node_account_test.go new file mode 100644 index 0000000000..034b48ba67 --- /dev/null +++ b/x/observer/keeper/node_account_test.go @@ -0,0 +1,46 @@ +package keeper + +import ( + "fmt" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/assert" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +// Keeper Tests + +func createNNodeAccount(keeper *Keeper, ctx sdk.Context, n int) []types.NodeAccount { + items := make([]types.NodeAccount, n) + for i := range items { + items[i].Operator = fmt.Sprintf("%d", i) + keeper.SetNodeAccount(ctx, items[i]) + } + return items +} + +func TestNodeAccountGet(t *testing.T) { + keeper, ctx := SetupKeeper(t) + items := createNNodeAccount(keeper, ctx, 10) + for _, item := range items { + rst, found := keeper.GetNodeAccount(ctx, item.Operator) + assert.True(t, found) + assert.Equal(t, item, rst) + } +} +func TestNodeAccountRemove(t *testing.T) { + keeper, ctx := SetupKeeper(t) + items := createNNodeAccount(keeper, ctx, 10) + for _, item := range items { + keeper.RemoveNodeAccount(ctx, item.Operator) + _, found := keeper.GetNodeAccount(ctx, item.Operator) + assert.False(t, found) + } +} + +func TestNodeAccountGetAll(t *testing.T) { + keeper, ctx := SetupKeeper(t) + items := createNNodeAccount(keeper, ctx, 10) + assert.Equal(t, items, keeper.GetAllNodeAccount(ctx)) +} diff --git a/x/observer/keeper/nonce_to_cctx.go b/x/observer/keeper/nonce_to_cctx.go new file mode 100644 index 0000000000..6ecedd22ea --- /dev/null +++ b/x/observer/keeper/nonce_to_cctx.go @@ -0,0 +1,53 @@ +package keeper + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +// NonceToCctx methods +// The object stores the mapping from nonce to cross chain tx + +func (k Keeper) RemoveNonceToCctx(ctx sdk.Context, nonceToCctx types.NonceToCctx) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NonceToCctxKeyPrefix)) + store.Delete(types.KeyPrefix(fmt.Sprintf("%s-%d-%d", nonceToCctx.Tss, nonceToCctx.ChainId, nonceToCctx.Nonce))) +} + +func (k Keeper) SetNonceToCctx(ctx sdk.Context, nonceToCctx types.NonceToCctx) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NonceToCctxKeyPrefix)) + b := k.cdc.MustMarshal(&nonceToCctx) + store.Set(types.KeyPrefix(fmt.Sprintf("%s-%d-%d", nonceToCctx.Tss, nonceToCctx.ChainId, nonceToCctx.Nonce)), b) +} + +func (k Keeper) GetNonceToCctx(ctx sdk.Context, tss string, chainID int64, nonce int64) (val types.NonceToCctx, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NonceToCctxKeyPrefix)) + + b := store.Get(types.KeyPrefix(fmt.Sprintf("%s-%d-%d", tss, chainID, nonce))) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +func (k Keeper) GetAllNonceToCctx(ctx sdk.Context) (list []types.NonceToCctx) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.NonceToCctxKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + var val types.NonceToCctx + err := k.cdc.Unmarshal(iterator.Value(), &val) + if err == nil { + list = append(list, val) + } + + } + + return + +} diff --git a/x/observer/keeper/nonce_to_cctx_test.go b/x/observer/keeper/nonce_to_cctx_test.go new file mode 100644 index 0000000000..1cbd023fbd --- /dev/null +++ b/x/observer/keeper/nonce_to_cctx_test.go @@ -0,0 +1,42 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" +) + +func TestKeeper_GetNonceToCctx(t *testing.T) { + t.Run("Get nonce to cctx", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + nonceToCctxList := sample.NonceToCctxList(t, "sample", 1) + for _, n := range nonceToCctxList { + k.SetNonceToCctx(ctx, n) + } + for _, n := range nonceToCctxList { + rst, found := k.GetNonceToCctx(ctx, n.Tss, n.ChainId, n.Nonce) + require.True(t, found) + require.Equal(t, n, rst) + } + }) + t.Run("Get nonce to cctx not found", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + nonceToCctxList := sample.NonceToCctxList(t, "sample", 1) + for _, n := range nonceToCctxList { + k.SetNonceToCctx(ctx, n) + } + _, found := k.GetNonceToCctx(ctx, "not_found", 1, 1) + require.False(t, found) + }) + t.Run("Get all nonce to cctx", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + nonceToCctxList := sample.NonceToCctxList(t, "sample", 10) + for _, n := range nonceToCctxList { + k.SetNonceToCctx(ctx, n) + } + rst := k.GetAllNonceToCctx(ctx) + require.Equal(t, nonceToCctxList, rst) + }) +} diff --git a/x/observer/keeper/nonces_test.go b/x/observer/keeper/nonces_test.go new file mode 100644 index 0000000000..2e201ae67e --- /dev/null +++ b/x/observer/keeper/nonces_test.go @@ -0,0 +1,43 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/assert" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" +) + +func TestChainNoncesGet(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + items := sample.ChainNoncesList(t, 10) + for _, item := range items { + k.SetChainNonces(ctx, item) + } + for _, item := range items { + rst, found := k.GetChainNonces(ctx, item.Index) + assert.True(t, found) + assert.Equal(t, item, rst) + } +} +func TestChainNoncesRemove(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + items := sample.ChainNoncesList(t, 10) + for _, item := range items { + k.SetChainNonces(ctx, item) + } + for _, item := range items { + k.RemoveChainNonces(ctx, item.Index) + _, found := k.GetChainNonces(ctx, item.Index) + assert.False(t, found) + } +} + +func TestChainNoncesGetAll(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + items := sample.ChainNoncesList(t, 10) + for _, item := range items { + k.SetChainNonces(ctx, item) + } + assert.Equal(t, items, k.GetAllChainNonces(ctx)) +} diff --git a/x/observer/keeper/observer_mapper.go b/x/observer/keeper/observer_mapper.go index ca42fb3618..121c7ec000 100644 --- a/x/observer/keeper/observer_mapper.go +++ b/x/observer/keeper/observer_mapper.go @@ -1,15 +1,12 @@ package keeper import ( - "context" "fmt" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/observer/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) func GetObserverMapperIndex(chain *common.Chain) string { @@ -83,46 +80,6 @@ func (k Keeper) GetAllObserverMappersForAddress(ctx sdk.Context, address string) return } -// Tx - -// AddObserver adds in a new observer to the store.It can be executed using an admin policy account -// Once added, the function also resets keygen and pauses inbound so that a new TSS can be generated. - -//Queries - -func (k Keeper) ObserversByChain(goCtx context.Context, req *types.QueryObserversByChainRequest) (*types.QueryObserversByChainResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(goCtx) - - // TODO move parsing to client - // https://github.com/zeta-chain/node/issues/867 - - chainName := common.ParseChainName(req.ObservationChain) - chain := k.GetParams(ctx).GetChainFromChainName(chainName) - if chain == nil { - return &types.QueryObserversByChainResponse{}, types.ErrSupportedChains - } - mapper, found := k.GetObserverMapper(ctx, chain) - if !found { - return &types.QueryObserversByChainResponse{}, types.ErrObserverNotPresent - } - return &types.QueryObserversByChainResponse{Observers: mapper.ObserverList}, nil -} - -func (k Keeper) AllObserverMappers(goCtx context.Context, req *types.QueryAllObserverMappersRequest) (*types.QueryAllObserverMappersResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - ctx := sdk.UnwrapSDKContext(goCtx) - - mappers := k.GetAllObserverMappers(ctx) - return &types.QueryAllObserverMappersResponse{ObserverMappers: mappers}, nil -} - // Utils func (k Keeper) GetAllObserverAddresses(ctx sdk.Context) []string { diff --git a/x/observer/keeper/observer_mapper_test.go b/x/observer/keeper/observer_mapper_test.go index eb861934ad..12e572e81a 100644 --- a/x/observer/keeper/observer_mapper_test.go +++ b/x/observer/keeper/observer_mapper_test.go @@ -1,7 +1,4 @@ -//go:build PRIVNET -// +build PRIVNET - -package keeper +package keeper_test import ( "testing" @@ -9,6 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/assert" "github.com/zeta-chain/zetacore/common" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -102,11 +100,11 @@ func TestKeeper_GetObserver(t *testing.T) { for _, test := range tt { test := test t.Run(test.name, func(t *testing.T) { - keeper, ctx := SetupKeeper(t) + k, ctx := keepertest.ObserverKeeper(t) for _, mapper := range test.mapper { - keeper.SetObserverMapper(ctx, mapper) + k.SetObserverMapper(ctx, mapper) } - mapper, found := keeper.GetObserverMapper(ctx, test.assertChain) + mapper, found := k.GetObserverMapper(ctx, test.assertChain) assert.Equal(t, test.isFound, found) if test.isFound { assert.Equal(t, test.assertObsListLen, len(mapper.ObserverList)) @@ -139,14 +137,14 @@ func TestKeeper_ObserversByChainAndType(t *testing.T) { { name: "Filter out from multiple mappers", mapper: append(append(types.CreateObserverMapperList(1, common.GoerliChain()), - types.CreateObserverMapperList(1, common.ZetaChain())...)), + types.CreateObserverMapperList(1, common.ZetaPrivnetChain())...)), assertChain: common.ChainName_goerli_localnet, isFound: true, }, { name: "No Observers of expected Observation Chain", mapper: append(append(types.CreateObserverMapperList(1, common.GoerliChain()), - types.CreateObserverMapperList(1, common.ZetaChain())...)), + types.CreateObserverMapperList(1, common.ZetaPrivnetChain())...)), assertChain: common.ChainName_btc_regtest, isFound: false, }, @@ -155,16 +153,17 @@ func TestKeeper_ObserversByChainAndType(t *testing.T) { for _, test := range tt { test := test t.Run(test.name, func(t *testing.T) { - keeper, ctx := SetupKeeper(t) + k, ctx := keepertest.ObserverKeeper(t) + for _, mapper := range test.mapper { - keeper.SetObserverMapper(ctx, mapper) + k.SetObserverMapper(ctx, mapper) } goCtx := sdk.WrapSDKContext(ctx) msg := &types.QueryObserversByChainRequest{ ObservationChain: test.assertChain.String(), } - mapper, _ := keeper.ObserversByChain(goCtx, msg) + mapper, _ := k.ObserversByChain(goCtx, msg) if test.isFound { assert.NotEqual(t, "", mapper) } @@ -186,10 +185,10 @@ func TestKeeper_GetAllObserverAddresses(t *testing.T) { ChainName: common.ChainName_bsc_mainnet, ChainId: 5, })...) - keeper, ctx := SetupKeeper(t) + k, ctx := keepertest.ObserverKeeper(t) for _, mapper := range mappers { - keeper.SetObserverMapper(ctx, mapper) + k.SetObserverMapper(ctx, mapper) } - addresses := keeper.GetAllObserverAddresses(ctx) + addresses := k.GetAllObserverAddresses(ctx) assert.Equal(t, 4, len(addresses)) } diff --git a/x/observer/keeper/params.go b/x/observer/keeper/params.go index 5357139479..c3516e0633 100644 --- a/x/observer/keeper/params.go +++ b/x/observer/keeper/params.go @@ -13,7 +13,7 @@ func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { return } -func (k Keeper) GetParamsIsExists(ctx sdk.Context) (params types.Params) { +func (k Keeper) GetParamsIfExists(ctx sdk.Context) (params types.Params) { k.paramstore.GetParamSetIfExists(ctx, ¶ms) return } diff --git a/x/observer/keeper/pending_nonces.go b/x/observer/keeper/pending_nonces.go new file mode 100644 index 0000000000..6ab5b61ca4 --- /dev/null +++ b/x/observer/keeper/pending_nonces.go @@ -0,0 +1,103 @@ +package keeper + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +// PendingNonces methods +// The object stores the pending nonces for the chain + +func (k Keeper) SetPendingNonces(ctx sdk.Context, pendingNonces types.PendingNonces) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PendingNoncesKeyPrefix)) + b := k.cdc.MustMarshal(&pendingNonces) + store.Set(types.KeyPrefix(fmt.Sprintf("%s-%d", pendingNonces.Tss, pendingNonces.ChainId)), b) +} + +func (k Keeper) GetPendingNonces(ctx sdk.Context, tss string, chainID int64) (val types.PendingNonces, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PendingNoncesKeyPrefix)) + + b := store.Get(types.KeyPrefix(fmt.Sprintf("%s-%d", tss, chainID))) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +func (k Keeper) GetAllPendingNoncesPaginated(ctx sdk.Context, pagination *query.PageRequest) (list []types.PendingNonces, pageRes *query.PageResponse, err error) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PendingNoncesKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + pageRes, err = query.Paginate(store, pagination, func(key []byte, value []byte) error { + var val types.PendingNonces + if err := k.cdc.Unmarshal(value, &val); err != nil { + return err + } + list = append(list, val) + return nil + }) + + return +} + +func (k Keeper) GetAllPendingNonces(ctx sdk.Context) (list []types.PendingNonces, err error) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PendingNoncesKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + var val types.PendingNonces + err := k.cdc.Unmarshal(iterator.Value(), &val) + if err != nil { + return nil, err + } + list = append(list, val) + } + return +} + +func (k Keeper) RemovePendingNonces(ctx sdk.Context, pendingNonces types.PendingNonces) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PendingNoncesKeyPrefix)) + store.Delete(types.KeyPrefix(fmt.Sprintf("%s-%d", pendingNonces.Tss, pendingNonces.ChainId))) +} + +// Utility functions + +func (k Keeper) RemoveFromPendingNonces(ctx sdk.Context, tssPubkey string, chainID int64, nonce int64) { + p, found := k.GetPendingNonces(ctx, tssPubkey, chainID) + if found && nonce >= p.NonceLow && nonce <= p.NonceHigh { + p.NonceLow = nonce + 1 + k.SetPendingNonces(ctx, p) + } +} + +func (k Keeper) SetTssAndUpdateNonce(ctx sdk.Context, tss types.TSS) { + k.SetTSS(ctx, tss) + // initialize the nonces and pending nonces of all enabled chains + supportedChains := k.GetParams(ctx).GetSupportedChains() + for _, chain := range supportedChains { + chainNonce := types.ChainNonces{ + Index: chain.ChainName.String(), + ChainId: chain.ChainId, + Nonce: 0, + // #nosec G701 always positive + FinalizedHeight: uint64(ctx.BlockHeight()), + } + k.SetChainNonces(ctx, chainNonce) + + p := types.PendingNonces{ + NonceLow: 0, + NonceHigh: 0, + ChainId: chain.ChainId, + Tss: tss.TssPubkey, + } + k.SetPendingNonces(ctx, p) + } +} diff --git a/x/observer/keeper/pending_nonces_test.go b/x/observer/keeper/pending_nonces_test.go new file mode 100644 index 0000000000..0cb61f090d --- /dev/null +++ b/x/observer/keeper/pending_nonces_test.go @@ -0,0 +1,66 @@ +package keeper_test + +import ( + "sort" + "testing" + + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/stretchr/testify/require" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" +) + +func TestKeeper_PendingNoncesAll(t *testing.T) { + t.Run("Get all pending nonces paginated by limit", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + nonces := sample.PendingNoncesList(t, "sample", 10) + sort.SliceStable(nonces, func(i, j int) bool { + return nonces[i].ChainId < nonces[j].ChainId + }) + for _, nonce := range nonces { + k.SetPendingNonces(ctx, nonce) + } + rst, pageRes, err := k.GetAllPendingNoncesPaginated(ctx, &query.PageRequest{Limit: 10, CountTotal: true}) + require.NoError(t, err) + sort.SliceStable(rst, func(i, j int) bool { + return rst[i].ChainId < rst[j].ChainId + }) + require.Equal(t, nonces, rst) + require.Equal(t, len(nonces), int(pageRes.Total)) + }) + t.Run("Get all pending nonces paginated by offset", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + nonces := sample.PendingNoncesList(t, "sample", 42) + sort.SliceStable(nonces, func(i, j int) bool { + return nonces[i].ChainId < nonces[j].ChainId + }) + for _, nonce := range nonces { + k.SetPendingNonces(ctx, nonce) + } + offset := 10 + rst, pageRes, err := k.GetAllPendingNoncesPaginated(ctx, &query.PageRequest{Offset: uint64(offset), CountTotal: true}) + require.NoError(t, err) + sort.SliceStable(rst, func(i, j int) bool { + return rst[i].ChainId < rst[j].ChainId + }) + require.Subset(t, nonces, rst) + require.Len(t, rst, len(nonces)-offset) + require.Equal(t, len(nonces), int(pageRes.Total)) + }) + t.Run("Get all pending nonces ", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + nonces := sample.PendingNoncesList(t, "sample", 10) + sort.SliceStable(nonces, func(i, j int) bool { + return nonces[i].ChainId < nonces[j].ChainId + }) + for _, nonce := range nonces { + k.SetPendingNonces(ctx, nonce) + } + rst, err := k.GetAllPendingNonces(ctx) + require.NoError(t, err) + sort.SliceStable(rst, func(i, j int) bool { + return rst[i].ChainId < rst[j].ChainId + }) + require.Equal(t, nonces, rst) + }) +} diff --git a/x/crosschain/keeper/keeper_tss.go b/x/observer/keeper/tss.go similarity index 61% rename from x/crosschain/keeper/keeper_tss.go rename to x/observer/keeper/tss.go index d1461539f9..0b389d2643 100644 --- a/x/crosschain/keeper/keeper_tss.go +++ b/x/observer/keeper/tss.go @@ -1,15 +1,13 @@ package keeper import ( - "context" "fmt" "sort" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/x/crosschain/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/zeta-chain/zetacore/x/observer/types" ) // AppendTss appends a tss to the TSSHistoryKey store and update the current TSS to the latest one @@ -18,30 +16,6 @@ func (k Keeper) AppendTss(ctx sdk.Context, tss types.TSS) { k.SetTSSHistory(ctx, tss) } -func (k Keeper) SetTssAndUpdateNonce(ctx sdk.Context, tss types.TSS) { - k.SetTSS(ctx, tss) - // initialize the nonces and pending nonces of all enabled chains - supportedChains := k.zetaObserverKeeper.GetParams(ctx).GetSupportedChains() - for _, chain := range supportedChains { - chainNonce := types.ChainNonces{ - Index: chain.ChainName.String(), - ChainId: chain.ChainId, - Nonce: 0, - // #nosec G701 always positive - FinalizedHeight: uint64(ctx.BlockHeight()), - } - k.SetChainNonces(ctx, chainNonce) - - p := types.PendingNonces{ - NonceLow: 0, - NonceHigh: 0, - ChainId: chain.ChainId, - Tss: tss.TssPubkey, - } - k.SetPendingNonces(ctx, p) - } -} - // SetTSS sets tss information to the store func (k Keeper) SetTSS(ctx sdk.Context, tss types.TSS) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.TSSKey)) @@ -56,6 +30,23 @@ func (k Keeper) SetTSSHistory(ctx sdk.Context, tss types.TSS) { store.Set(types.KeyPrefix(fmt.Sprintf("%d", tss.FinalizedZetaHeight)), b) } +// GetHistoricalTssByFinalizedHeight Returns the TSS address the specified finalized zeta height +// Finalized zeta height is the zeta block height at which the voting for the generation of a new TSS is finalized +func (k Keeper) GetHistoricalTssByFinalizedHeight(ctx sdk.Context, finalizedZetaHeight int64) (types.TSS, bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.TSSHistoryKey)) + b := store.Get(types.KeyPrefix(fmt.Sprintf("%d", finalizedZetaHeight))) + if b == nil { + return types.TSS{}, false + } + var tss types.TSS + err := k.cdc.Unmarshal(b, &tss) + if err != nil { + return types.TSS{}, false + } + return tss, true + +} + // GetTSS returns the current tss information func (k Keeper) GetTSS(ctx sdk.Context) (val types.TSS, found bool) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.TSSKey)) @@ -88,6 +79,19 @@ func (k Keeper) GetAllTSS(ctx sdk.Context) (list []types.TSS) { return } +func (k Keeper) GetAllTSSPaginated(ctx sdk.Context, pagination *query.PageRequest) (list []types.TSS, pageRes *query.PageResponse, err error) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.TSSHistoryKey)) + pageRes, err = query.Paginate(store, pagination, func(key []byte, value []byte) error { + var tss types.TSS + if err := k.cdc.Unmarshal(value, &tss); err != nil { + return err + } + list = append(list, tss) + return nil + }) + return +} + // GetPreviousTSS returns the previous tss information func (k Keeper) GetPreviousTSS(ctx sdk.Context) (val types.TSS, found bool) { tssList := k.GetAllTSS(ctx) @@ -110,29 +114,3 @@ func (k Keeper) CheckIfTssPubkeyHasBeenGenerated(ctx sdk.Context, tssPubkey stri } return types.TSS{}, false } - -// Queries - -func (k Keeper) TSS(c context.Context, req *types.QueryGetTSSRequest) (*types.QueryGetTSSResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - - val, found := k.GetTSS(ctx) - if !found { - return nil, status.Error(codes.InvalidArgument, "not found") - } - - return &types.QueryGetTSSResponse{TSS: &val}, nil -} - -// TssHistory Query historical list of TSS information -func (k Keeper) TssHistory(c context.Context, _ *types.QueryTssHistoryRequest) (*types.QueryTssHistoryResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - tssList := k.GetAllTSS(ctx) - sort.SliceStable(tssList, func(i, j int) bool { - return tssList[i].FinalizedZetaHeight < tssList[j].FinalizedZetaHeight - }) - return &types.QueryTssHistoryResponse{TssList: tssList}, nil -} diff --git a/x/observer/keeper/tss_funds_migrator.go b/x/observer/keeper/tss_funds_migrator.go new file mode 100644 index 0000000000..8ff91e4e16 --- /dev/null +++ b/x/observer/keeper/tss_funds_migrator.go @@ -0,0 +1,46 @@ +package keeper + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func (k Keeper) SetFundMigrator(ctx sdk.Context, fm types.TssFundMigratorInfo) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.TssFundMigratorKey)) + b := k.cdc.MustMarshal(&fm) + store.Set([]byte(fmt.Sprintf("%d", fm.ChainId)), b) +} + +func (k Keeper) GetFundMigrator(ctx sdk.Context, chainID int64) (val types.TssFundMigratorInfo, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.TssFundMigratorKey)) + b := store.Get([]byte(fmt.Sprintf("%d", chainID))) + if b == nil { + return val, false + } + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +func (k Keeper) GetAllTssFundMigrators(ctx sdk.Context) (fms []types.TssFundMigratorInfo) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.TssFundMigratorKey)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + var val types.TssFundMigratorInfo + k.cdc.MustUnmarshal(iterator.Value(), &val) + fms = append(fms, val) + } + return +} + +func (k Keeper) RemoveAllExistingMigrators(ctx sdk.Context) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.TssFundMigratorKey)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + store.Delete(iterator.Key()) + } +} diff --git a/x/observer/keeper/tss_funds_migrator_test.go b/x/observer/keeper/tss_funds_migrator_test.go new file mode 100644 index 0000000000..b7cd45bec1 --- /dev/null +++ b/x/observer/keeper/tss_funds_migrator_test.go @@ -0,0 +1,32 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/assert" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" +) + +func TestKeeper_GetTssFundMigrator(t *testing.T) { + t.Run("Successfully set funds migrator for chain", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + chain := sample.TssFundsMigrator(1) + k.SetFundMigrator(ctx, chain) + tfm, found := k.GetFundMigrator(ctx, chain.ChainId) + assert.True(t, found) + assert.Equal(t, chain, tfm) + }) + t.Run("Verify only one migrator can be created for a chain", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + tfm1 := sample.TssFundsMigrator(1) + k.SetFundMigrator(ctx, tfm1) + tfm2 := tfm1 + tfm2.MigrationCctxIndex = "sampleIndex2" + k.SetFundMigrator(ctx, tfm2) + migratorList := k.GetAllTssFundMigrators(ctx) + assert.Equal(t, 1, len(migratorList)) + assert.Equal(t, tfm2, migratorList[0]) + }) + +} diff --git a/x/observer/keeper/tss_test.go b/x/observer/keeper/tss_test.go new file mode 100644 index 0000000000..37099a519b --- /dev/null +++ b/x/observer/keeper/tss_test.go @@ -0,0 +1,180 @@ +package keeper_test + +import ( + "math/rand" + "sort" + "testing" + + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/stretchr/testify/require" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/assert" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func TestTSSGet(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + tss := sample.Tss() + k.SetTSS(ctx, tss) + tssQueried, found := k.GetTSS(ctx) + assert.True(t, found) + assert.Equal(t, tss, tssQueried) + +} +func TestTSSRemove(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + tss := sample.Tss() + k.SetTSS(ctx, tss) + k.RemoveTSS(ctx) + _, found := k.GetTSS(ctx) + assert.False(t, found) +} + +func TestTSSQuerySingle(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + //msgs := createTSS(keeper, ctx, 1) + tss := sample.Tss() + k.SetTSS(ctx, tss) + for _, tc := range []struct { + desc string + request *types.QueryGetTSSRequest + response *types.QueryGetTSSResponse + err error + }{ + { + desc: "First", + request: &types.QueryGetTSSRequest{}, + response: &types.QueryGetTSSResponse{TSS: tss}, + }, + { + desc: "InvalidRequest", + err: status.Error(codes.InvalidArgument, "invalid request"), + }, + } { + tc := tc + t.Run(tc.desc, func(t *testing.T) { + response, err := k.TSS(wctx, tc.request) + if tc.err != nil { + require.ErrorIs(t, err, tc.err) + } else { + require.Equal(t, tc.response, response) + } + }) + } +} + +func TestTSSQueryHistory(t *testing.T) { + keeper, ctx := keepertest.ObserverKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + for _, tc := range []struct { + desc string + tssCount int + foundPrevious bool + err error + }{ + { + desc: "1 Tss addresses", + tssCount: 1, + foundPrevious: false, + err: nil, + }, + { + desc: "10 Tss addresses", + tssCount: 10, + foundPrevious: true, + err: nil, + }, + } { + tc := tc + t.Run(tc.desc, func(t *testing.T) { + tssList := sample.TssList(tc.tssCount) + for _, tss := range tssList { + keeper.SetTSS(ctx, tss) + keeper.SetTSSHistory(ctx, tss) + } + request := &types.QueryTssHistoryRequest{} + response, err := keeper.TssHistory(wctx, request) + if tc.err != nil { + require.ErrorIs(t, err, tc.err) + } else { + require.Equal(t, len(tssList), len(response.TssList)) + prevTss, found := keeper.GetPreviousTSS(ctx) + assert.Equal(t, tc.foundPrevious, found) + if found { + assert.Equal(t, tssList[len(tssList)-2], prevTss) + } + } + }) + } +} + +func TestKeeper_TssHistory(t *testing.T) { + t.Run("Get tss history paginated by limit", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + tssList := sample.TssList(10) + for _, tss := range tssList { + k.SetTSSHistory(ctx, tss) + } + rst, pageRes, err := k.GetAllTSSPaginated(ctx, &query.PageRequest{Limit: 20, CountTotal: true}) + require.NoError(t, err) + sort.Slice(tssList, func(i, j int) bool { + return tssList[i].FinalizedZetaHeight < tssList[j].FinalizedZetaHeight + }) + sort.Slice(rst, func(i, j int) bool { + return rst[i].FinalizedZetaHeight < rst[j].FinalizedZetaHeight + }) + require.Equal(t, tssList, rst) + require.Equal(t, len(tssList), int(pageRes.Total)) + }) + t.Run("Get tss history paginated by offset", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + tssList := sample.TssList(100) + offset := 20 + for _, tss := range tssList { + k.SetTSSHistory(ctx, tss) + } + rst, pageRes, err := k.GetAllTSSPaginated(ctx, &query.PageRequest{Offset: uint64(offset), CountTotal: true}) + require.NoError(t, err) + sort.Slice(tssList, func(i, j int) bool { + return tssList[i].FinalizedZetaHeight < tssList[j].FinalizedZetaHeight + }) + sort.Slice(rst, func(i, j int) bool { + return rst[i].FinalizedZetaHeight < rst[j].FinalizedZetaHeight + }) + require.Subset(t, tssList, rst) + require.Equal(t, len(tssList)-offset, len(rst)) + require.Equal(t, len(tssList), int(pageRes.Total)) + }) + t.Run("Get all TSS without pagination", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + tssList := sample.TssList(100) + for _, tss := range tssList { + k.SetTSSHistory(ctx, tss) + } + rst := k.GetAllTSS(ctx) + sort.Slice(tssList, func(i, j int) bool { + return tssList[i].FinalizedZetaHeight < tssList[j].FinalizedZetaHeight + }) + sort.Slice(rst, func(i, j int) bool { + return rst[i].FinalizedZetaHeight < rst[j].FinalizedZetaHeight + }) + require.Equal(t, tssList, rst) + }) + t.Run("Get historical TSS", func(t *testing.T) { + k, ctx := keepertest.ObserverKeeper(t) + tssList := sample.TssList(100) + for _, tss := range tssList { + k.SetTSSHistory(ctx, tss) + } + r := rand.Intn((len(tssList)-1)-0) + 0 + tss, found := k.GetHistoricalTssByFinalizedHeight(ctx, tssList[r].FinalizedZetaHeight) + require.True(t, found) + require.Equal(t, tssList[r], tss) + }) +} diff --git a/x/observer/keeper/keeper_utils.go b/x/observer/keeper/utils.go similarity index 98% rename from x/observer/keeper/keeper_utils.go rename to x/observer/keeper/utils.go index 63c92c8b89..a5a22bc36d 100644 --- a/x/observer/keeper/keeper_utils.go +++ b/x/observer/keeper/utils.go @@ -23,7 +23,7 @@ func (k Keeper) AddVoteToBallot(ctx sdk.Context, ballot types.Ballot, address st // This function with only return true if the ballot moves for pending to success or failed status with this vote. // If the ballot is already finalized in the previous vote , it will return false func (k Keeper) CheckIfFinalizingVote(ctx sdk.Context, ballot types.Ballot) (types.Ballot, bool) { - ballot, isFinalized := ballot.IsBallotFinalized() + ballot, isFinalized := ballot.IsFinalizingVote() if !isFinalized { return ballot, false } diff --git a/x/observer/keeper/keeper_utils_test.go b/x/observer/keeper/utils_test.go similarity index 100% rename from x/observer/keeper/keeper_utils_test.go rename to x/observer/keeper/utils_test.go diff --git a/x/observer/migrations/v3/migrate.go b/x/observer/migrations/v3/migrate.go index 875ccc80fe..8c8a82b08b 100644 --- a/x/observer/migrations/v3/migrate.go +++ b/x/observer/migrations/v3/migrate.go @@ -6,7 +6,7 @@ import ( ) type ObserverKeeper interface { - GetParamsIsExists(ctx sdk.Context) types.Params + GetParamsIfExists(ctx sdk.Context) types.Params SetParams(ctx sdk.Context, params types.Params) } @@ -14,7 +14,7 @@ type ObserverKeeper interface { // This migration update the policy group func MigrateStore(ctx sdk.Context, k ObserverKeeper) error { // Get first admin policy group - p := k.GetParamsIsExists(ctx) + p := k.GetParamsIfExists(ctx) if len(p.AdminPolicy) == 0 || p.AdminPolicy[0] == nil { return nil } diff --git a/x/observer/module_simulation.go b/x/observer/module_simulation.go index 08b52bcc08..5ebd6a9027 100644 --- a/x/observer/module_simulation.go +++ b/x/observer/module_simulation.go @@ -9,7 +9,6 @@ import ( "github.com/zeta-chain/zetacore/x/observer/types" ) -/* #nosec */ const ( // #nosec G101 not a hardcoded credential opWeightMsgUpdateClientParams = "op_weight_msg_update_client_params" diff --git a/x/observer/types/ballot.go b/x/observer/types/ballot.go index dae3476789..bc6bfd66ee 100644 --- a/x/observer/types/ballot.go +++ b/x/observer/types/ballot.go @@ -34,12 +34,18 @@ func (m Ballot) GetVoterIndex(address string) int { return index } -func (m Ballot) IsBallotFinalized() (Ballot, bool) { +// Is finalzing vote checks sets the ballot to a final status if enough votes have been added +// If it has already been finalized it returns false +// It enough votes have not been added it returns false +func (m Ballot) IsFinalizingVote() (Ballot, bool) { if m.BallotStatus != BallotStatus_BallotInProgress { return m, false } success, failure := sdk.ZeroDec(), sdk.ZeroDec() total := sdk.NewDec(int64(len(m.VoterList))) + if total.IsZero() { + return m, false + } for _, vote := range m.Votes { if vote == VoteType_SuccessObservation { success = success.Add(sdk.OneDec()) @@ -55,6 +61,7 @@ func (m Ballot) IsBallotFinalized() (Ballot, bool) { return m, true } } + if success.IsPositive() { if success.Quo(total).GTE(m.BallotThreshold) { m.BallotStatus = BallotStatus_BallotFinalized_SuccessObservation diff --git a/x/observer/types/ballot_test.go b/x/observer/types/ballot_test.go index 008df06f11..0e087309e3 100644 --- a/x/observer/types/ballot_test.go +++ b/x/observer/types/ballot_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/assert" ) -func TestVoter_IsBallotFinalized(t *testing.T) { +func TestBallot_AddVote(t *testing.T) { type votes struct { address string vote VoteType @@ -66,9 +66,76 @@ func TestVoter_IsBallotFinalized(t *testing.T) { finalStatus: BallotStatus_BallotInProgress, isFinalized: false, }, - { - name: "Two observers ", + name: "Ballot finalized at threshold", + threshold: sdk.MustNewDecFromStr("0.66"), + voterList: []string{"Observer1", "Observer2", "Observer3", "Observer4", "Observer5", "Observer6", "Observer7", "Observer8", "Observer9", "Observer10", "Observer11", "Observer12"}, + votes: []votes{ + {"Observer1", VoteType_SuccessObservation}, + {"Observer2", VoteType_SuccessObservation}, + {"Observer3", VoteType_SuccessObservation}, + {"Observer4", VoteType_SuccessObservation}, + {"Observer5", VoteType_SuccessObservation}, + {"Observer6", VoteType_SuccessObservation}, + {"Observer7", VoteType_SuccessObservation}, + {"Observer8", VoteType_SuccessObservation}, + {"Observer9", VoteType_NotYetVoted}, + {"Observer10", VoteType_NotYetVoted}, + {"Observer11", VoteType_NotYetVoted}, + {"Observer12", VoteType_NotYetVoted}, + }, + finalVotes: []VoteType{VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_NotYetVoted, + VoteType_NotYetVoted, + VoteType_NotYetVoted, + VoteType_NotYetVoted, + }, + finalStatus: BallotStatus_BallotFinalized_SuccessObservation, + isFinalized: true, + }, + { + name: "Ballot finalized at threshold but more votes added after", + threshold: sdk.MustNewDecFromStr("0.66"), + voterList: []string{"Observer1", "Observer2", "Observer3", "Observer4", "Observer5", "Observer6", "Observer7", "Observer8", "Observer9", "Observer10", "Observer11", "Observer12"}, + votes: []votes{ + {"Observer1", VoteType_SuccessObservation}, + {"Observer2", VoteType_SuccessObservation}, + {"Observer3", VoteType_SuccessObservation}, + {"Observer4", VoteType_SuccessObservation}, + {"Observer5", VoteType_SuccessObservation}, + {"Observer6", VoteType_SuccessObservation}, + {"Observer7", VoteType_SuccessObservation}, + {"Observer8", VoteType_SuccessObservation}, + {"Observer9", VoteType_SuccessObservation}, + {"Observer10", VoteType_SuccessObservation}, + {"Observer11", VoteType_SuccessObservation}, + {"Observer12", VoteType_SuccessObservation}, + }, + finalVotes: []VoteType{VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_SuccessObservation, + }, + finalStatus: BallotStatus_BallotFinalized_SuccessObservation, + isFinalized: true, + }, + { + name: "Two observers", threshold: sdk.MustNewDecFromStr("1.00"), voterList: []string{"Observer1", "Observer2"}, votes: []votes{ @@ -79,6 +146,48 @@ func TestVoter_IsBallotFinalized(t *testing.T) { finalStatus: BallotStatus_BallotFinalized_SuccessObservation, isFinalized: true, }, + { + name: "Low threshold 1 always fails as Failure is checked first", + threshold: sdk.MustNewDecFromStr("0.01"), + voterList: []string{"Observer1", "Observer2", "Observer3", "Observer4"}, + votes: []votes{ + {"Observer1", VoteType_SuccessObservation}, + {"Observer2", VoteType_SuccessObservation}, + {"Observer3", VoteType_SuccessObservation}, + {"Observer4", VoteType_FailureObservation}, + }, + finalVotes: []VoteType{VoteType_SuccessObservation, VoteType_SuccessObservation, VoteType_SuccessObservation, VoteType_FailureObservation}, + finalStatus: BallotStatus_BallotFinalized_FailureObservation, + isFinalized: true, + }, + { + name: "Low threshold 2 always fails as Failure is checked first", + threshold: sdk.MustNewDecFromStr("0.01"), + voterList: []string{"Observer1", "Observer2", "Observer3", "Observer4"}, + votes: []votes{ + {"Observer1", VoteType_SuccessObservation}, + {"Observer2", VoteType_FailureObservation}, + {"Observer3", VoteType_SuccessObservation}, + {"Observer4", VoteType_SuccessObservation}, + }, + finalVotes: []VoteType{VoteType_SuccessObservation, VoteType_FailureObservation, VoteType_SuccessObservation, VoteType_SuccessObservation}, + finalStatus: BallotStatus_BallotFinalized_FailureObservation, + isFinalized: true, + }, + { + name: "100 percent threshold cannot finalze with less than 100 percent votes", + threshold: sdk.MustNewDecFromStr("1"), + voterList: []string{"Observer1", "Observer2", "Observer3", "Observer4"}, + votes: []votes{ + {"Observer1", VoteType_SuccessObservation}, + {"Observer2", VoteType_FailureObservation}, + {"Observer3", VoteType_SuccessObservation}, + {"Observer4", VoteType_SuccessObservation}, + }, + finalVotes: []VoteType{VoteType_SuccessObservation, VoteType_FailureObservation, VoteType_SuccessObservation, VoteType_SuccessObservation}, + finalStatus: BallotStatus_BallotInProgress, + isFinalized: false, + }, } for _, test := range tt { test := test @@ -96,7 +205,7 @@ func TestVoter_IsBallotFinalized(t *testing.T) { ballot, _ = ballot.AddVote(vote.address, vote.vote) } - finalBallot, isFinalized := ballot.IsBallotFinalized() + finalBallot, isFinalized := ballot.IsFinalizingVote() assert.Equal(t, test.finalStatus, finalBallot.BallotStatus) assert.Equal(t, test.finalVotes, finalBallot.Votes) assert.Equal(t, test.isFinalized, isFinalized) @@ -104,6 +213,137 @@ func TestVoter_IsBallotFinalized(t *testing.T) { } } +func TestBallot_IsFinalizingVote(t *testing.T) { + tt := []struct { + name string + BallotThreshold sdk.Dec + Votes []VoteType + finalizingVote int + finalStatus BallotStatus + }{ + { + name: "finalized to success", + BallotThreshold: sdk.MustNewDecFromStr("0.66"), + Votes: []VoteType{ + VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_SuccessObservation, + VoteType_NotYetVoted, + VoteType_NotYetVoted, + VoteType_NotYetVoted, + VoteType_NotYetVoted, + }, + finalizingVote: 7, + finalStatus: BallotStatus_BallotFinalized_SuccessObservation, + }, + { + name: "finalized to failure", + BallotThreshold: sdk.MustNewDecFromStr("0.66"), + Votes: []VoteType{ + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_NotYetVoted, + VoteType_NotYetVoted, + VoteType_NotYetVoted, + VoteType_NotYetVoted, + }, + finalizingVote: 7, + finalStatus: BallotStatus_BallotFinalized_FailureObservation, + }, + { + name: "low threshold finalized early to success", + BallotThreshold: sdk.MustNewDecFromStr("0.01"), + Votes: []VoteType{ + VoteType_SuccessObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_NotYetVoted, + VoteType_NotYetVoted, + VoteType_NotYetVoted, + VoteType_NotYetVoted, + }, + finalizingVote: 0, + finalStatus: BallotStatus_BallotFinalized_SuccessObservation, + }, + { + name: "100 percent threshold cannot finalize with less than 100 percent votes", + BallotThreshold: sdk.MustNewDecFromStr("1"), + Votes: []VoteType{ + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_SuccessObservation, + }, + finalizingVote: 0, + finalStatus: BallotStatus_BallotInProgress, + }, + { + name: "100 percent threshold can finalize with 100 percent votes", + BallotThreshold: sdk.MustNewDecFromStr("1"), + Votes: []VoteType{ + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + VoteType_FailureObservation, + }, + finalizingVote: 11, + finalStatus: BallotStatus_BallotFinalized_FailureObservation, + }, + } + for _, test := range tt { + test := test + t.Run(test.name, func(t *testing.T) { + + ballot := Ballot{ + BallotStatus: BallotStatus_BallotInProgress, + BallotThreshold: test.BallotThreshold, + VoterList: make([]string, len(test.Votes)), + } + isFinalizingVote := false + for index, vote := range test.Votes { + ballot.Votes = append(ballot.Votes, vote) + ballot, isFinalizingVote = ballot.IsFinalizingVote() + if isFinalizingVote { + assert.Equal(t, test.finalizingVote, index) + } + } + assert.Equal(t, test.finalStatus, ballot.BallotStatus) + }) + } +} + func Test_BuildRewardsDistribution(t *testing.T) { tt := []struct { name string diff --git a/x/crosschain/types/chain_nonces.pb.go b/x/observer/types/chain_nonces.pb.go similarity index 84% rename from x/crosschain/types/chain_nonces.pb.go rename to x/observer/types/chain_nonces.pb.go index 9fea4ec405..47ea34bda2 100644 --- a/x/crosschain/types/chain_nonces.pb.go +++ b/x/observer/types/chain_nonces.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: crosschain/chain_nonces.proto +// source: observer/chain_nonces.proto package types @@ -11,6 +11,7 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" + _ "github.com/zeta-chain/zetacore/common" ) // Reference imports to suppress errors if they are not otherwise used. @@ -37,7 +38,7 @@ func (m *ChainNonces) Reset() { *m = ChainNonces{} } func (m *ChainNonces) String() string { return proto.CompactTextString(m) } func (*ChainNonces) ProtoMessage() {} func (*ChainNonces) Descriptor() ([]byte, []int) { - return fileDescriptor_c2dddd7805d88f2e, []int{0} + return fileDescriptor_a4a180ef3ffea001, []int{0} } func (m *ChainNonces) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -109,30 +110,31 @@ func (m *ChainNonces) GetFinalizedHeight() uint64 { } func init() { - proto.RegisterType((*ChainNonces)(nil), "zetachain.zetacore.crosschain.ChainNonces") + proto.RegisterType((*ChainNonces)(nil), "zetachain.zetacore.observer.ChainNonces") } -func init() { proto.RegisterFile("crosschain/chain_nonces.proto", fileDescriptor_c2dddd7805d88f2e) } +func init() { proto.RegisterFile("observer/chain_nonces.proto", fileDescriptor_a4a180ef3ffea001) } -var fileDescriptor_c2dddd7805d88f2e = []byte{ - // 266 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4d, 0x2e, 0xca, 0x2f, - 0x2e, 0x4e, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x07, 0x93, 0xf1, 0x79, 0xf9, 0x79, 0xc9, 0xa9, 0xc5, - 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0xb2, 0x55, 0xa9, 0x25, 0x89, 0x60, 0x71, 0x3d, 0x30, - 0x2b, 0xbf, 0x28, 0x55, 0x0f, 0xa1, 0x43, 0x4a, 0x24, 0x3d, 0x3f, 0x3d, 0x1f, 0xac, 0x52, 0x1f, - 0xc4, 0x82, 0x68, 0x52, 0xda, 0xc4, 0xc8, 0xc5, 0xed, 0x0c, 0x92, 0xf7, 0x03, 0x1b, 0x25, 0x24, - 0xc1, 0xc5, 0x9e, 0x5c, 0x94, 0x9a, 0x58, 0x92, 0x5f, 0x24, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19, - 0x04, 0xe3, 0x0a, 0x89, 0x70, 0xb1, 0x66, 0xe6, 0xa5, 0xa4, 0x56, 0x48, 0x30, 0x81, 0xc5, 0x21, - 0x1c, 0x21, 0x49, 0x2e, 0x0e, 0x88, 0x53, 0x32, 0x53, 0x24, 0x98, 0x15, 0x18, 0x35, 0x98, 0x83, - 0xd8, 0xc1, 0x7c, 0xcf, 0x14, 0x90, 0x06, 0xb0, 0xfb, 0x24, 0x58, 0x14, 0x18, 0x35, 0x58, 0x82, - 0x20, 0x1c, 0x90, 0x05, 0xc5, 0x99, 0xe9, 0x79, 0xa9, 0x45, 0xc5, 0x12, 0xac, 0x0a, 0xcc, 0x20, - 0x0b, 0xa0, 0x5c, 0x21, 0x0d, 0x2e, 0xfe, 0xb4, 0xcc, 0xbc, 0xc4, 0x9c, 0xcc, 0xaa, 0xd4, 0x14, - 0x8f, 0xd4, 0xcc, 0xf4, 0x8c, 0x12, 0x09, 0x36, 0xb0, 0x4e, 0x74, 0x61, 0x27, 0xef, 0x13, 0x8f, - 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, - 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x32, 0x4c, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, - 0x4b, 0xce, 0xcf, 0xd5, 0x07, 0x05, 0x82, 0x2e, 0x24, 0xb4, 0x60, 0xe1, 0xa1, 0x5f, 0xa1, 0x8f, - 0x14, 0x86, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0x80, 0x30, 0x06, 0x04, 0x00, 0x00, - 0xff, 0xff, 0x69, 0x96, 0x2f, 0x81, 0x5e, 0x01, 0x00, 0x00, +var fileDescriptor_a4a180ef3ffea001 = []byte{ + // 276 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0xbd, 0x4e, 0xc3, 0x30, + 0x14, 0x85, 0x6b, 0xd2, 0x1f, 0x30, 0x03, 0x52, 0xe8, 0x60, 0x5a, 0xc9, 0x8a, 0x98, 0xb2, 0x10, + 0x0f, 0xbc, 0x01, 0x2c, 0x74, 0x61, 0xc8, 0xc8, 0x82, 0xf2, 0x73, 0x49, 0x2c, 0x11, 0xdf, 0xca, + 0x36, 0xa8, 0xf4, 0x29, 0x78, 0x16, 0x9e, 0x82, 0xb1, 0x23, 0x23, 0x4a, 0x5e, 0x04, 0xd9, 0x26, + 0x0c, 0x4c, 0xbe, 0xdf, 0x91, 0xcf, 0xbd, 0x47, 0x87, 0xae, 0xb1, 0x34, 0xa0, 0x5f, 0x41, 0x8b, + 0xaa, 0x2d, 0xa4, 0x7a, 0x54, 0xa8, 0x2a, 0x30, 0xd9, 0x56, 0xa3, 0xc5, 0x78, 0xbd, 0x07, 0x5b, + 0x78, 0x3d, 0xf3, 0x13, 0x6a, 0xc8, 0xc6, 0xff, 0xab, 0xf3, 0x0a, 0xbb, 0x0e, 0x95, 0x08, 0x4f, + 0x70, 0xac, 0x96, 0x0d, 0x36, 0xe8, 0x47, 0xe1, 0xa6, 0xa0, 0x5e, 0x7e, 0x10, 0x7a, 0x7a, 0xeb, + 0xd6, 0xdc, 0xfb, 0xed, 0x31, 0xa3, 0x8b, 0x4a, 0x43, 0x61, 0x51, 0x33, 0x92, 0x90, 0xf4, 0x24, + 0x1f, 0x31, 0x5e, 0xd2, 0x99, 0x54, 0x35, 0xec, 0xd8, 0x91, 0xd7, 0x03, 0xc4, 0x17, 0xf4, 0x38, + 0xa4, 0x93, 0x35, 0x8b, 0x12, 0x92, 0x46, 0xf9, 0xc2, 0xf3, 0xa6, 0x76, 0x06, 0x1f, 0x99, 0x4d, + 0x13, 0x92, 0x4e, 0xf3, 0x00, 0xee, 0x80, 0x91, 0x8d, 0x02, 0x6d, 0xd8, 0x2c, 0x89, 0xdc, 0x81, + 0x5f, 0x8c, 0x53, 0x7a, 0xf6, 0x24, 0x55, 0xf1, 0x2c, 0xf7, 0x50, 0xdf, 0x81, 0x6c, 0x5a, 0xcb, + 0xe6, 0xde, 0xf9, 0x5f, 0xbe, 0xd9, 0x7c, 0xf6, 0x9c, 0x1c, 0x7a, 0x4e, 0xbe, 0x7b, 0x4e, 0xde, + 0x07, 0x3e, 0x39, 0x0c, 0x7c, 0xf2, 0x35, 0xf0, 0xc9, 0x83, 0x68, 0xa4, 0x6d, 0x5f, 0xca, 0xac, + 0xc2, 0x4e, 0xb8, 0x5e, 0xae, 0x7c, 0x18, 0x31, 0x56, 0x24, 0x76, 0xe2, 0xaf, 0x54, 0xfb, 0xb6, + 0x05, 0x53, 0xce, 0x7d, 0x0d, 0xd7, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3c, 0x24, 0x62, 0xd5, + 0x6d, 0x01, 0x00, 0x00, } func (m *ChainNonces) Marshal() (dAtA []byte, err error) { diff --git a/x/observer/types/core_params.go b/x/observer/types/core_params.go new file mode 100644 index 0000000000..adf29d74ea --- /dev/null +++ b/x/observer/types/core_params.go @@ -0,0 +1,156 @@ +package types + +import ( + "fmt" + + "github.com/zeta-chain/zetacore/common" +) + +// GetCoreParams returns a list of default core params +func GetCoreParams() CoreParamsList { + return CoreParamsList{ + CoreParams: []*CoreParams{ + { + ChainId: common.EthChain().ChainId, + ConfirmationCount: 14, + ZetaTokenContractAddress: "", + ConnectorContractAddress: "", + Erc20CustodyContractAddress: "", + InTxTicker: 12, + OutTxTicker: 15, + WatchUtxoTicker: 0, + GasPriceTicker: 30, + OutboundTxScheduleInterval: 30, + OutboundTxScheduleLookahead: 60, + }, + { + ChainId: common.BscMainnetChain().ChainId, + ConfirmationCount: 14, + ZetaTokenContractAddress: "", + ConnectorContractAddress: "", + Erc20CustodyContractAddress: "", + InTxTicker: 5, + OutTxTicker: 15, + WatchUtxoTicker: 0, + GasPriceTicker: 30, + OutboundTxScheduleInterval: 30, + OutboundTxScheduleLookahead: 60, + }, + { + ChainId: common.BtcMainnetChain().ChainId, + ConfirmationCount: 2, + ZetaTokenContractAddress: "", + ConnectorContractAddress: "", + Erc20CustodyContractAddress: "", + WatchUtxoTicker: 30, + InTxTicker: 120, + OutTxTicker: 60, + GasPriceTicker: 30, + OutboundTxScheduleInterval: 30, + OutboundTxScheduleLookahead: 60, + }, + { + ChainId: common.GoerliChain().ChainId, + ConfirmationCount: 6, + // This is the actual Zeta token Goerli testnet, we need to specify this address for the integration tests to pass + ZetaTokenContractAddress: "0x0000c304d2934c00db1d51995b9f6996affd17c0", + ConnectorContractAddress: "", + Erc20CustodyContractAddress: "", + InTxTicker: 12, + OutTxTicker: 15, + WatchUtxoTicker: 0, + GasPriceTicker: 30, + OutboundTxScheduleInterval: 30, + OutboundTxScheduleLookahead: 60, + }, + { + ChainId: common.BscTestnetChain().ChainId, + ConfirmationCount: 6, + ZetaTokenContractAddress: "", + ConnectorContractAddress: "", + Erc20CustodyContractAddress: "", + InTxTicker: 5, + OutTxTicker: 15, + WatchUtxoTicker: 0, + GasPriceTicker: 30, + OutboundTxScheduleInterval: 30, + OutboundTxScheduleLookahead: 60, + }, + { + ChainId: common.MumbaiChain().ChainId, + ConfirmationCount: 12, + ZetaTokenContractAddress: "", + ConnectorContractAddress: "", + Erc20CustodyContractAddress: "", + InTxTicker: 2, + OutTxTicker: 15, + WatchUtxoTicker: 0, + GasPriceTicker: 30, + OutboundTxScheduleInterval: 30, + OutboundTxScheduleLookahead: 60, + }, + { + ChainId: common.BtcTestNetChain().ChainId, + ConfirmationCount: 2, + ZetaTokenContractAddress: "", + ConnectorContractAddress: "", + Erc20CustodyContractAddress: "", + WatchUtxoTicker: 30, + InTxTicker: 120, + OutTxTicker: 12, + GasPriceTicker: 30, + OutboundTxScheduleInterval: 30, + OutboundTxScheduleLookahead: 100, + }, + { + ChainId: common.BtcRegtestChain().ChainId, + ConfirmationCount: 2, + ZetaTokenContractAddress: "", + ConnectorContractAddress: "", + Erc20CustodyContractAddress: "", + GasPriceTicker: 5, + WatchUtxoTicker: 1, + InTxTicker: 1, + OutTxTicker: 2, + OutboundTxScheduleInterval: 2, + OutboundTxScheduleLookahead: 5, + }, + { + ChainId: common.GoerliLocalnetChain().ChainId, + ConfirmationCount: 2, + ZetaTokenContractAddress: "0xA8D5060feb6B456e886F023709A2795373691E63", + ConnectorContractAddress: "0x733aB8b06DDDEf27Eaa72294B0d7c9cEF7f12db9", + Erc20CustodyContractAddress: "0xD28D6A0b8189305551a0A8bd247a6ECa9CE781Ca", + InTxTicker: 2, + OutTxTicker: 2, + WatchUtxoTicker: 0, + GasPriceTicker: 5, + OutboundTxScheduleInterval: 2, + OutboundTxScheduleLookahead: 5, + }, + }, + } +} + +// Validate checks all core params correspond to a chain and there is no duplicate chain id +func (cpl CoreParamsList) Validate() error { + // check all core params correspond to a chain + externalChainMap := make(map[int64]struct{}) + existingChainMap := make(map[int64]struct{}) + + externalChainList := common.ExternalChainList() + for _, chain := range externalChainList { + externalChainMap[chain.ChainId] = struct{}{} + } + + for _, param := range cpl.CoreParams { + if _, ok := externalChainMap[param.ChainId]; !ok { + return fmt.Errorf("chain id %d not found in chain list", param.ChainId) + } + if _, ok := existingChainMap[param.ChainId]; ok { + return fmt.Errorf("duplicated chain id %d found", param.ChainId) + } + existingChainMap[param.ChainId] = struct{}{} + } + return nil +} diff --git a/x/observer/types/core_params_mainnet.go b/x/observer/types/core_params_mainnet.go deleted file mode 100644 index 38ab439aab..0000000000 --- a/x/observer/types/core_params_mainnet.go +++ /dev/null @@ -1,72 +0,0 @@ -//go:build !PRIVNET && !TESTNET && !MOCK_MAINNET -// +build !PRIVNET,!TESTNET,!MOCK_MAINNET - -package types - -import ( - "fmt" - - "github.com/coinbase/rosetta-sdk-go/types" - "github.com/zeta-chain/zetacore/common" -) - -func GetCoreParams() CoreParamsList { - params := CoreParamsList{ - CoreParams: []*CoreParams{ - { - ChainId: common.EthChain().ChainId, - ConfirmationCount: 14, - ZetaTokenContractAddress: "", - ConnectorContractAddress: "", - Erc20CustodyContractAddress: "", - InTxTicker: 12, - OutTxTicker: 15, - WatchUtxoTicker: 0, - GasPriceTicker: 30, - OutboundTxScheduleInterval: 30, - OutboundTxScheduleLookahead: 60, - }, - { - ChainId: common.BscMainnetChain().ChainId, - ConfirmationCount: 14, - ZetaTokenContractAddress: "", - ConnectorContractAddress: "", - Erc20CustodyContractAddress: "", - InTxTicker: 5, - OutTxTicker: 15, - WatchUtxoTicker: 0, - GasPriceTicker: 30, - OutboundTxScheduleInterval: 30, - OutboundTxScheduleLookahead: 60, - }, - { - ChainId: common.BtcMainnetChain().ChainId, - ConfirmationCount: 2, - ZetaTokenContractAddress: "", - ConnectorContractAddress: "", - Erc20CustodyContractAddress: "", - WatchUtxoTicker: 30, - InTxTicker: 120, - OutTxTicker: 60, - GasPriceTicker: 30, - OutboundTxScheduleInterval: 30, - OutboundTxScheduleLookahead: 60, - }, - }, - } - chainList := common.ExternalChainList() - requiredParams := len(chainList) - availableParams := 0 - for _, chain := range chainList { - for _, param := range params.CoreParams { - if chain.ChainId == param.ChainId { - availableParams++ - } - } - } - if availableParams != requiredParams { - panic(fmt.Sprintf("Core params are not available for all chains , DefaultChains : %s , CoreParams : %s", - types.PrettyPrintStruct(chainList), params.String())) - } - return params -} diff --git a/x/observer/types/core_params_mock_mainnet.go b/x/observer/types/core_params_mock_mainnet.go deleted file mode 100644 index 549edc5bf7..0000000000 --- a/x/observer/types/core_params_mock_mainnet.go +++ /dev/null @@ -1,72 +0,0 @@ -//go:build MOCK_MAINNET -// +build MOCK_MAINNET - -package types - -import ( - "fmt" - - "github.com/coinbase/rosetta-sdk-go/types" - "github.com/zeta-chain/zetacore/common" -) - -func GetCoreParams() CoreParamsList { - params := CoreParamsList{ - CoreParams: []*CoreParams{ - { - ChainId: common.EthChain().ChainId, - ConfirmationCount: 6, - ZetaTokenContractAddress: "", - ConnectorContractAddress: "", - Erc20CustodyContractAddress: "", - InTxTicker: 12, - OutTxTicker: 15, - WatchUtxoTicker: 0, - GasPriceTicker: 30, - OutboundTxScheduleInterval: 30, - OutboundTxScheduleLookahead: 60, - }, - { - ChainId: common.BscMainnetChain().ChainId, - ConfirmationCount: 6, - ZetaTokenContractAddress: "", - ConnectorContractAddress: "", - Erc20CustodyContractAddress: "", - InTxTicker: 5, - OutTxTicker: 15, - WatchUtxoTicker: 0, - GasPriceTicker: 30, - OutboundTxScheduleInterval: 30, - OutboundTxScheduleLookahead: 60, - }, - { - ChainId: common.BtcMainnetChain().ChainId, - ConfirmationCount: 2, - ZetaTokenContractAddress: "", - ConnectorContractAddress: "", - Erc20CustodyContractAddress: "", - WatchUtxoTicker: 30, - InTxTicker: 120, - OutTxTicker: 60, - GasPriceTicker: 30, - OutboundTxScheduleInterval: 30, - OutboundTxScheduleLookahead: 60, - }, - }, - } - chainList := common.ExternalChainList() - requiredParams := len(chainList) - availableParams := 0 - for _, chain := range chainList { - for _, param := range params.CoreParams { - if chain.ChainId == param.ChainId { - availableParams++ - } - } - } - if availableParams != requiredParams { - panic(fmt.Sprintf("Core params are not available for all chains , DefaultChains : %s , CoreParams : %s", - types.PrettyPrintStruct(chainList), params.String())) - } - return params -} diff --git a/x/observer/types/core_params_privnet.go b/x/observer/types/core_params_privnet.go deleted file mode 100644 index 832bf57475..0000000000 --- a/x/observer/types/core_params_privnet.go +++ /dev/null @@ -1,58 +0,0 @@ -//go:build PRIVNET -// +build PRIVNET - -package types - -import ( - "fmt" - - "github.com/coinbase/rosetta-sdk-go/types" - "github.com/zeta-chain/zetacore/common" -) - -func GetCoreParams() CoreParamsList { - params := CoreParamsList{ - CoreParams: []*CoreParams{ - { - ChainId: common.GoerliChain().ChainId, - ConfirmationCount: 2, - ZetaTokenContractAddress: "0xA8D5060feb6B456e886F023709A2795373691E63", - ConnectorContractAddress: "0x733aB8b06DDDEf27Eaa72294B0d7c9cEF7f12db9", - Erc20CustodyContractAddress: "0xD28D6A0b8189305551a0A8bd247a6ECa9CE781Ca", - InTxTicker: 2, - OutTxTicker: 2, - WatchUtxoTicker: 0, - GasPriceTicker: 5, - OutboundTxScheduleInterval: 2, - OutboundTxScheduleLookahead: 5, - }, - { - ChainId: common.BtcRegtestChain().ChainId, - ConfirmationCount: 2, - ZetaTokenContractAddress: "", - ConnectorContractAddress: "", - Erc20CustodyContractAddress: "", - GasPriceTicker: 5, - WatchUtxoTicker: 1, - InTxTicker: 1, - OutTxTicker: 2, - OutboundTxScheduleInterval: 2, - OutboundTxScheduleLookahead: 5, - }}, - } - chainList := common.ExternalChainList() - requiredParams := len(chainList) - availableParams := 0 - for _, chain := range chainList { - for _, param := range params.CoreParams { - if chain.ChainId == param.ChainId { - availableParams++ - } - } - } - if availableParams != requiredParams { - panic(fmt.Sprintf("Core params are not available for all chains , DefaultChains : %s , CoreParams : %s", - types.PrettyPrintStruct(chainList), params.String())) - } - return params -} diff --git a/x/observer/types/core_params_test.go b/x/observer/types/core_params_test.go new file mode 100644 index 0000000000..273e96d00c --- /dev/null +++ b/x/observer/types/core_params_test.go @@ -0,0 +1,32 @@ +package types_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func TestCoreParamsList_Validate(t *testing.T) { + t.Run("should return no error for default list", func(t *testing.T) { + list := types.GetCoreParams() + err := list.Validate() + require.NoError(t, err) + }) + + t.Run("should return error for invalid chain id", func(t *testing.T) { + list := types.GetCoreParams() + list.CoreParams[0].ChainId = 999 + err := list.Validate() + require.Error(t, err) + require.Contains(t, err.Error(), "not found in chain list") + }) + + t.Run("should return error for duplicated chain ID", func(t *testing.T) { + list := types.GetCoreParams() + list.CoreParams = append(list.CoreParams, list.CoreParams[0]) + err := list.Validate() + require.Error(t, err) + require.Contains(t, err.Error(), "duplicated chain id") + }) +} diff --git a/x/observer/types/core_params_testnet.go b/x/observer/types/core_params_testnet.go deleted file mode 100644 index a2be9be7fc..0000000000 --- a/x/observer/types/core_params_testnet.go +++ /dev/null @@ -1,86 +0,0 @@ -//go:build TESTNET -// +build TESTNET - -package types - -import ( - "fmt" - - "github.com/coinbase/rosetta-sdk-go/types" - "github.com/zeta-chain/zetacore/common" -) - -func GetCoreParams() CoreParamsList { - params := CoreParamsList{ - CoreParams: []*CoreParams{ - { - ChainId: common.GoerliChain().ChainId, - ConfirmationCount: 6, - // This is the actual Zeta token Goerli testnet, we need to specify this address for the integration tests to pass - ZetaTokenContractAddress: "0x0000c304d2934c00db1d51995b9f6996affd17c0", - ConnectorContractAddress: "", - Erc20CustodyContractAddress: "", - InTxTicker: 12, - OutTxTicker: 15, - WatchUtxoTicker: 0, - GasPriceTicker: 30, - OutboundTxScheduleInterval: 30, - OutboundTxScheduleLookahead: 60, - }, - { - ChainId: common.BscTestnetChain().ChainId, - ConfirmationCount: 6, - ZetaTokenContractAddress: "", - ConnectorContractAddress: "", - Erc20CustodyContractAddress: "", - InTxTicker: 5, - OutTxTicker: 15, - WatchUtxoTicker: 0, - GasPriceTicker: 30, - OutboundTxScheduleInterval: 30, - OutboundTxScheduleLookahead: 60, - }, - { - ChainId: common.MumbaiChain().ChainId, - ConfirmationCount: 12, - ZetaTokenContractAddress: "", - ConnectorContractAddress: "", - Erc20CustodyContractAddress: "", - InTxTicker: 2, - OutTxTicker: 15, - WatchUtxoTicker: 0, - GasPriceTicker: 30, - OutboundTxScheduleInterval: 30, - OutboundTxScheduleLookahead: 60, - }, - { - ChainId: common.BtcTestNetChain().ChainId, - ConfirmationCount: 2, - ZetaTokenContractAddress: "", - ConnectorContractAddress: "", - Erc20CustodyContractAddress: "", - WatchUtxoTicker: 30, - InTxTicker: 120, - OutTxTicker: 12, - GasPriceTicker: 30, - OutboundTxScheduleInterval: 30, - OutboundTxScheduleLookahead: 100, - }, - }, - } - chainList := common.ExternalChainList() - requiredParams := len(chainList) - availableParams := 0 - for _, chain := range chainList { - for _, param := range params.CoreParams { - if chain.ChainId == param.ChainId { - availableParams++ - } - } - } - if availableParams != requiredParams { - panic(fmt.Sprintf("Core params are not available for all chains , DefaultChains : %s , CoreParams : %s", - types.PrettyPrintStruct(chainList), params.String())) - } - return params -} diff --git a/x/observer/types/crosschain_flags.go b/x/observer/types/crosschain_flags.go index bc3db1e8f8..876baf80e1 100644 --- a/x/observer/types/crosschain_flags.go +++ b/x/observer/types/crosschain_flags.go @@ -16,6 +16,9 @@ var DefaultGasPriceIncreaseFlags = GasPriceIncreaseFlags{ // Maximum gas price increase in percent of the median gas price // 500 means the gas price can be increased by 5 times the median gas price at most GasPriceIncreaseMax: 500, + + // Maximum pending CCTXs to iterate for gas price increase + MaxPendingCctxs: 500, } var DefaultBlockHeaderVerificationFlags = BlockHeaderVerificationFlags{ diff --git a/x/observer/types/crosschain_flags.pb.go b/x/observer/types/crosschain_flags.pb.go index a09b683689..e1c4dd34ae 100644 --- a/x/observer/types/crosschain_flags.pb.go +++ b/x/observer/types/crosschain_flags.pb.go @@ -35,6 +35,8 @@ type GasPriceIncreaseFlags struct { // Maximum gas price increase in percent of the median gas price // Default is used if 0 GasPriceIncreaseMax uint32 `protobuf:"varint,4,opt,name=gasPriceIncreaseMax,proto3" json:"gasPriceIncreaseMax,omitempty"` + // Maximum number of pending crosschain transactions to check for gas price increase + MaxPendingCctxs uint32 `protobuf:"varint,5,opt,name=maxPendingCctxs,proto3" json:"maxPendingCctxs,omitempty"` } func (m *GasPriceIncreaseFlags) Reset() { *m = GasPriceIncreaseFlags{} } @@ -98,6 +100,13 @@ func (m *GasPriceIncreaseFlags) GetGasPriceIncreaseMax() uint32 { return 0 } +func (m *GasPriceIncreaseFlags) GetMaxPendingCctxs() uint32 { + if m != nil { + return m.MaxPendingCctxs + } + return 0 +} + type BlockHeaderVerificationFlags struct { IsEthTypeChainEnabled bool `protobuf:"varint,1,opt,name=isEthTypeChainEnabled,proto3" json:"isEthTypeChainEnabled,omitempty"` IsBtcTypeChainEnabled bool `protobuf:"varint,2,opt,name=isBtcTypeChainEnabled,proto3" json:"isBtcTypeChainEnabled,omitempty"` @@ -288,37 +297,38 @@ func init() { func init() { proto.RegisterFile("observer/crosschain_flags.proto", fileDescriptor_b948b59e4d986f49) } var fileDescriptor_b948b59e4d986f49 = []byte{ - // 468 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x94, 0xc1, 0x6e, 0xd3, 0x30, - 0x18, 0xc7, 0xeb, 0x0e, 0xa1, 0xc9, 0xd5, 0x04, 0x04, 0x2a, 0xca, 0x98, 0xd2, 0xaa, 0xa7, 0x0a, - 0x81, 0x8d, 0x0a, 0x07, 0xb8, 0x76, 0x0c, 0x88, 0x34, 0xc4, 0x14, 0x21, 0x0e, 0x5c, 0x90, 0xe3, - 0x7e, 0x75, 0x2c, 0x82, 0x5d, 0xd9, 0xce, 0xb4, 0x22, 0xf1, 0x02, 0x9c, 0x38, 0xf2, 0x48, 0x3b, - 0xee, 0xc0, 0x01, 0x09, 0x09, 0x50, 0xfb, 0x02, 0x3c, 0x02, 0xaa, 0x43, 0x26, 0xda, 0x86, 0x3c, - 0xc0, 0x6e, 0xce, 0xf7, 0xf7, 0xdf, 0x3f, 0xe7, 0xff, 0x7d, 0x09, 0xee, 0xea, 0xc4, 0x82, 0x39, - 0x06, 0x43, 0xb9, 0xd1, 0xd6, 0xf2, 0x94, 0x49, 0xf5, 0x76, 0x92, 0x31, 0x61, 0xc9, 0xd4, 0x68, - 0xa7, 0x83, 0xdb, 0x1f, 0xc0, 0x31, 0x5f, 0x26, 0x7e, 0xa5, 0x0d, 0x90, 0xd2, 0xb3, 0x7b, 0x43, - 0x68, 0xa1, 0xfd, 0x3e, 0xba, 0x5c, 0x15, 0x96, 0xdd, 0x50, 0x68, 0x2d, 0x32, 0xa0, 0xfe, 0x29, - 0xc9, 0x27, 0x74, 0x9c, 0x1b, 0xe6, 0xa4, 0x56, 0x85, 0xde, 0xff, 0x8d, 0x70, 0xfb, 0x19, 0xb3, - 0x47, 0x46, 0x72, 0x88, 0x14, 0x37, 0xc0, 0x2c, 0x3c, 0x5d, 0x22, 0x83, 0x1e, 0x6e, 0xc1, 0x54, - 0xf3, 0xf4, 0x10, 0x94, 0x70, 0x69, 0x07, 0xf5, 0xd0, 0x60, 0x2b, 0xfe, 0xb7, 0x14, 0x44, 0x78, - 0xc7, 0x80, 0x33, 0xb3, 0x48, 0x39, 0x30, 0xc7, 0x2c, 0xeb, 0x34, 0x7b, 0x68, 0xd0, 0x1a, 0xde, - 0x22, 0x05, 0x93, 0x94, 0x4c, 0xf2, 0xe4, 0x2f, 0x73, 0xb4, 0x7d, 0xfa, 0xa3, 0xdb, 0xf8, 0xf2, - 0xb3, 0x8b, 0xe2, 0x55, 0x67, 0xf0, 0x08, 0xdf, 0x14, 0x6b, 0xb7, 0x38, 0x02, 0xc3, 0x41, 0xb9, - 0xce, 0x56, 0x0f, 0x0d, 0x76, 0xe2, 0xff, 0xc9, 0xc1, 0x7d, 0x7c, 0x7d, 0x5d, 0x7a, 0xc1, 0x4e, - 0x3a, 0x97, 0xbc, 0xab, 0x4a, 0xea, 0x7f, 0x42, 0x78, 0x6f, 0x94, 0x69, 0xfe, 0xee, 0x39, 0xb0, - 0x31, 0x98, 0xd7, 0x60, 0xe4, 0x44, 0x72, 0x7f, 0xc1, 0xe2, 0xcd, 0x1f, 0xe2, 0xb6, 0xb4, 0x07, - 0x2e, 0x7d, 0x35, 0x9b, 0xc2, 0xfe, 0x32, 0xed, 0x03, 0xc5, 0x92, 0x0c, 0xc6, 0x3e, 0x83, 0xed, - 0xb8, 0x5a, 0x2c, 0x5c, 0x23, 0xc7, 0x37, 0x5c, 0xcd, 0xd2, 0x55, 0x21, 0xf6, 0xbf, 0x36, 0xf1, - 0x95, 0xfd, 0xf3, 0x6e, 0x17, 0xfc, 0x3b, 0xf8, 0xaa, 0xb4, 0x91, 0x4a, 0x74, 0xae, 0xc6, 0xab, - 0xe8, 0x8d, 0x7a, 0x70, 0x17, 0x5f, 0x93, 0xf6, 0x65, 0xee, 0x56, 0x36, 0x17, 0xc4, 0x4d, 0x21, - 0x48, 0x71, 0x5b, 0x54, 0x35, 0xdb, 0x87, 0xdc, 0x1a, 0x0e, 0x49, 0xcd, 0x80, 0x91, 0xca, 0x31, - 0x89, 0xab, 0x0f, 0x0c, 0x3e, 0xe2, 0xbd, 0xa4, 0x26, 0x63, 0xdf, 0x9f, 0xd6, 0xf0, 0x71, 0x2d, - 0xb0, 0xae, 0x49, 0x71, 0xed, 0xf1, 0xfd, 0xef, 0x08, 0xb7, 0x0f, 0x41, 0x30, 0x3e, 0xbb, 0x80, - 0xe1, 0x8e, 0xa2, 0xd3, 0x79, 0x88, 0xce, 0xe6, 0x21, 0xfa, 0x35, 0x0f, 0xd1, 0xe7, 0x45, 0xd8, - 0x38, 0x5b, 0x84, 0x8d, 0x6f, 0x8b, 0xb0, 0xf1, 0x86, 0x0a, 0xe9, 0xd2, 0x3c, 0x21, 0x5c, 0xbf, - 0xa7, 0x4b, 0xc8, 0x3d, 0xcf, 0xa3, 0x25, 0x8f, 0x9e, 0xd0, 0xf3, 0x7f, 0x8c, 0x9b, 0x4d, 0xc1, - 0x26, 0x97, 0xfd, 0x47, 0xfa, 0xe0, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdb, 0xb0, 0x8c, 0xc5, - 0x7c, 0x04, 0x00, 0x00, + // 487 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x94, 0x41, 0x8b, 0xd3, 0x40, + 0x14, 0xc7, 0x3b, 0x5d, 0x95, 0x65, 0xca, 0xb2, 0x1a, 0x2d, 0xd6, 0x75, 0x49, 0x4b, 0x4f, 0x45, + 0x34, 0x23, 0xd5, 0x83, 0x5e, 0x5b, 0x57, 0x0d, 0xac, 0x58, 0x82, 0x78, 0xf0, 0x22, 0x93, 0xc9, + 0xeb, 0x64, 0x30, 0x3b, 0x53, 0x66, 0x26, 0x4b, 0x2b, 0xf8, 0x05, 0x3c, 0x79, 0x14, 0x3f, 0xd1, + 0x1e, 0xf7, 0xe0, 0x41, 0x10, 0x54, 0xda, 0x2f, 0x22, 0x9d, 0xd8, 0xc5, 0xb6, 0x31, 0x1f, 0xc0, + 0xdb, 0xe4, 0xfd, 0xdf, 0xff, 0xfd, 0x92, 0xf7, 0x5e, 0x06, 0xb7, 0x55, 0x6c, 0x40, 0x9f, 0x82, + 0x26, 0x4c, 0x2b, 0x63, 0x58, 0x4a, 0x85, 0x7c, 0x3b, 0xce, 0x28, 0x37, 0xc1, 0x44, 0x2b, 0xab, + 0xbc, 0xdb, 0xef, 0xc1, 0x52, 0x17, 0x0e, 0xdc, 0x49, 0x69, 0x08, 0x56, 0x9e, 0x83, 0x1b, 0x5c, + 0x71, 0xe5, 0xf2, 0xc8, 0xf2, 0x54, 0x58, 0x0e, 0x7c, 0xae, 0x14, 0xcf, 0x80, 0xb8, 0xa7, 0x38, + 0x1f, 0x93, 0x24, 0xd7, 0xd4, 0x0a, 0x25, 0x0b, 0xbd, 0xfb, 0xa5, 0x8e, 0x9b, 0xcf, 0xa8, 0x19, + 0x69, 0xc1, 0x20, 0x94, 0x4c, 0x03, 0x35, 0xf0, 0x74, 0x89, 0xf4, 0x3a, 0xb8, 0x01, 0x13, 0xc5, + 0xd2, 0x63, 0x90, 0xdc, 0xa6, 0x2d, 0xd4, 0x41, 0xbd, 0x9d, 0xe8, 0xef, 0x90, 0x17, 0xe2, 0x3d, + 0x0d, 0x56, 0xcf, 0x42, 0x69, 0x41, 0x9f, 0xd2, 0xac, 0x55, 0xef, 0xa0, 0x5e, 0xa3, 0x7f, 0x2b, + 0x28, 0x98, 0xc1, 0x8a, 0x19, 0x3c, 0xf9, 0xc3, 0x1c, 0xec, 0x9e, 0xfd, 0x68, 0xd7, 0x3e, 0xff, + 0x6c, 0xa3, 0x68, 0xdd, 0xe9, 0x3d, 0xc2, 0x37, 0xf9, 0xc6, 0x5b, 0x8c, 0x40, 0x33, 0x90, 0xb6, + 0xb5, 0xd3, 0x41, 0xbd, 0xbd, 0xe8, 0x5f, 0xb2, 0x77, 0x1f, 0x5f, 0xdf, 0x94, 0x5e, 0xd0, 0x69, + 0xeb, 0x92, 0x73, 0x95, 0x49, 0x5e, 0x0f, 0xef, 0x9f, 0xd0, 0xe9, 0x08, 0x64, 0x22, 0x24, 0x1f, + 0x32, 0x3b, 0x35, 0xad, 0xcb, 0x2e, 0x7b, 0x33, 0xdc, 0xfd, 0x88, 0xf0, 0xe1, 0x20, 0x53, 0xec, + 0xdd, 0x73, 0xa0, 0x09, 0xe8, 0xd7, 0xa0, 0xc5, 0x58, 0x30, 0xf7, 0x29, 0x45, 0x8f, 0x1e, 0xe2, + 0xa6, 0x30, 0x47, 0x36, 0x7d, 0x35, 0x9b, 0xc0, 0x70, 0x39, 0x97, 0x23, 0x49, 0xe3, 0x0c, 0x12, + 0xd7, 0xad, 0xdd, 0xa8, 0x5c, 0x2c, 0x5c, 0x03, 0xcb, 0xb6, 0x5c, 0xf5, 0x95, 0xab, 0x44, 0xec, + 0x7e, 0xad, 0xe3, 0xfd, 0xe1, 0xc5, 0x5e, 0x14, 0xfc, 0x3b, 0xf8, 0xaa, 0x30, 0xa1, 0x8c, 0x55, + 0x2e, 0x93, 0x75, 0xf4, 0x56, 0xdc, 0xbb, 0x8b, 0xaf, 0x09, 0xf3, 0x32, 0xb7, 0x6b, 0xc9, 0x05, + 0x71, 0x5b, 0xf0, 0x52, 0xdc, 0xe4, 0x65, 0x6b, 0xe1, 0xc6, 0xd1, 0xe8, 0xf7, 0x83, 0x8a, 0x55, + 0x0c, 0x4a, 0x17, 0x2a, 0x2a, 0x2f, 0xe8, 0x7d, 0xc0, 0x87, 0x71, 0x45, 0x8f, 0xdd, 0x24, 0x1b, + 0xfd, 0xc7, 0x95, 0xc0, 0xaa, 0x21, 0x45, 0x95, 0xe5, 0xbb, 0xdf, 0x11, 0x6e, 0x1e, 0x03, 0xa7, + 0x6c, 0xf6, 0x1f, 0x36, 0x77, 0x10, 0x9e, 0xcd, 0x7d, 0x74, 0x3e, 0xf7, 0xd1, 0xaf, 0xb9, 0x8f, + 0x3e, 0x2d, 0xfc, 0xda, 0xf9, 0xc2, 0xaf, 0x7d, 0x5b, 0xf8, 0xb5, 0x37, 0x84, 0x0b, 0x9b, 0xe6, + 0x71, 0xc0, 0xd4, 0x09, 0x59, 0x42, 0xee, 0x39, 0x1e, 0x59, 0xf1, 0xc8, 0x94, 0x5c, 0xdc, 0x46, + 0x76, 0x36, 0x01, 0x13, 0x5f, 0x71, 0xbf, 0xf3, 0x83, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xde, + 0xd8, 0x41, 0xc9, 0xa6, 0x04, 0x00, 0x00, } func (m *GasPriceIncreaseFlags) Marshal() (dAtA []byte, err error) { @@ -341,6 +351,11 @@ func (m *GasPriceIncreaseFlags) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.MaxPendingCctxs != 0 { + i = encodeVarintCrosschainFlags(dAtA, i, uint64(m.MaxPendingCctxs)) + i-- + dAtA[i] = 0x28 + } if m.GasPriceIncreaseMax != 0 { i = encodeVarintCrosschainFlags(dAtA, i, uint64(m.GasPriceIncreaseMax)) i-- @@ -560,6 +575,9 @@ func (m *GasPriceIncreaseFlags) Size() (n int) { if m.GasPriceIncreaseMax != 0 { n += 1 + sovCrosschainFlags(uint64(m.GasPriceIncreaseMax)) } + if m.MaxPendingCctxs != 0 { + n += 1 + sovCrosschainFlags(uint64(m.MaxPendingCctxs)) + } return n } @@ -745,6 +763,25 @@ func (m *GasPriceIncreaseFlags) Unmarshal(dAtA []byte) error { break } } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxPendingCctxs", wireType) + } + m.MaxPendingCctxs = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCrosschainFlags + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxPendingCctxs |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipCrosschainFlags(dAtA[iNdEx:]) diff --git a/x/observer/types/genesis.go b/x/observer/types/genesis.go index d43b42e89e..918636794c 100644 --- a/x/observer/types/genesis.go +++ b/x/observer/types/genesis.go @@ -18,6 +18,7 @@ func DefaultGenesis() *GenesisState { CrosschainFlags: &CrosschainFlags{IsInboundEnabled: true, IsOutboundEnabled: true}, Keygen: nil, LastObserverCount: nil, + ChainNonces: []ChainNonces{}, } } @@ -39,6 +40,21 @@ func (gs GenesisState) Validate() error { nodeAccountIndexMap[elem.GetOperator()] = true } + // check for invalid core params + if err := gs.CoreParamsList.Validate(); err != nil { + return err + } + + // Check for duplicated index in chainNonces + chainNoncesIndexMap := make(map[string]bool) + + for _, elem := range gs.ChainNonces { + if _, ok := chainNoncesIndexMap[elem.Index]; ok { + return fmt.Errorf("duplicated index for chainNonces") + } + chainNoncesIndexMap[elem.Index] = true + } + return VerifyObserverMapper(gs.Observers) } diff --git a/x/observer/types/genesis.pb.go b/x/observer/types/genesis.pb.go index da23bf6955..1f55b9fdb7 100644 --- a/x/observer/types/genesis.pb.go +++ b/x/observer/types/genesis.pb.go @@ -25,14 +25,21 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type GenesisState struct { - Ballots []*Ballot `protobuf:"bytes,1,rep,name=ballots,proto3" json:"ballots,omitempty"` - Observers []*ObserverMapper `protobuf:"bytes,2,rep,name=observers,proto3" json:"observers,omitempty"` - NodeAccountList []*NodeAccount `protobuf:"bytes,3,rep,name=nodeAccountList,proto3" json:"nodeAccountList,omitempty"` - CrosschainFlags *CrosschainFlags `protobuf:"bytes,4,opt,name=crosschain_flags,json=crosschainFlags,proto3" json:"crosschain_flags,omitempty"` - Params *Params `protobuf:"bytes,5,opt,name=params,proto3" json:"params,omitempty"` - Keygen *Keygen `protobuf:"bytes,6,opt,name=keygen,proto3" json:"keygen,omitempty"` - LastObserverCount *LastObserverCount `protobuf:"bytes,7,opt,name=last_observer_count,json=lastObserverCount,proto3" json:"last_observer_count,omitempty"` - CoreParamsList CoreParamsList `protobuf:"bytes,8,opt,name=core_params_list,json=coreParamsList,proto3" json:"core_params_list"` + Ballots []*Ballot `protobuf:"bytes,1,rep,name=ballots,proto3" json:"ballots,omitempty"` + Observers []*ObserverMapper `protobuf:"bytes,2,rep,name=observers,proto3" json:"observers,omitempty"` + NodeAccountList []*NodeAccount `protobuf:"bytes,3,rep,name=nodeAccountList,proto3" json:"nodeAccountList,omitempty"` + CrosschainFlags *CrosschainFlags `protobuf:"bytes,4,opt,name=crosschain_flags,json=crosschainFlags,proto3" json:"crosschain_flags,omitempty"` + Params *Params `protobuf:"bytes,5,opt,name=params,proto3" json:"params,omitempty"` + Keygen *Keygen `protobuf:"bytes,6,opt,name=keygen,proto3" json:"keygen,omitempty"` + LastObserverCount *LastObserverCount `protobuf:"bytes,7,opt,name=last_observer_count,json=lastObserverCount,proto3" json:"last_observer_count,omitempty"` + CoreParamsList CoreParamsList `protobuf:"bytes,8,opt,name=core_params_list,json=coreParamsList,proto3" json:"core_params_list"` + Tss *TSS `protobuf:"bytes,9,opt,name=tss,proto3" json:"tss,omitempty"` + TssHistory []TSS `protobuf:"bytes,10,rep,name=tss_history,json=tssHistory,proto3" json:"tss_history"` + TssFundMigrators []TssFundMigratorInfo `protobuf:"bytes,11,rep,name=tss_fund_migrators,json=tssFundMigrators,proto3" json:"tss_fund_migrators"` + BlameList []Blame `protobuf:"bytes,12,rep,name=blame_list,json=blameList,proto3" json:"blame_list"` + PendingNonces []PendingNonces `protobuf:"bytes,13,rep,name=pending_nonces,json=pendingNonces,proto3" json:"pending_nonces"` + ChainNonces []ChainNonces `protobuf:"bytes,14,rep,name=chain_nonces,json=chainNonces,proto3" json:"chain_nonces"` + NonceToCctx []NonceToCctx `protobuf:"bytes,15,rep,name=nonce_to_cctx,json=nonceToCctx,proto3" json:"nonce_to_cctx"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -124,6 +131,55 @@ func (m *GenesisState) GetCoreParamsList() CoreParamsList { return CoreParamsList{} } +func (m *GenesisState) GetTss() *TSS { + if m != nil { + return m.Tss + } + return nil +} + +func (m *GenesisState) GetTssHistory() []TSS { + if m != nil { + return m.TssHistory + } + return nil +} + +func (m *GenesisState) GetTssFundMigrators() []TssFundMigratorInfo { + if m != nil { + return m.TssFundMigrators + } + return nil +} + +func (m *GenesisState) GetBlameList() []Blame { + if m != nil { + return m.BlameList + } + return nil +} + +func (m *GenesisState) GetPendingNonces() []PendingNonces { + if m != nil { + return m.PendingNonces + } + return nil +} + +func (m *GenesisState) GetChainNonces() []ChainNonces { + if m != nil { + return m.ChainNonces + } + return nil +} + +func (m *GenesisState) GetNonceToCctx() []NonceToCctx { + if m != nil { + return m.NonceToCctx + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "zetachain.zetacore.observer.GenesisState") } @@ -131,34 +187,48 @@ func init() { func init() { proto.RegisterFile("observer/genesis.proto", fileDescriptor_15ea8c9d44da7399) } var fileDescriptor_15ea8c9d44da7399 = []byte{ - // 431 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x5f, 0xab, 0xd3, 0x30, - 0x18, 0xc6, 0x5b, 0x37, 0x37, 0xcd, 0xc4, 0xcd, 0xf8, 0xaf, 0x6c, 0xd0, 0x0d, 0xbd, 0x19, 0xa8, - 0x2d, 0xcc, 0x4b, 0xf1, 0xc2, 0x0d, 0x94, 0xe1, 0xfc, 0x43, 0xbc, 0x10, 0x14, 0x2c, 0x69, 0x8d, - 0x5d, 0xb1, 0x6b, 0x4a, 0x92, 0x89, 0xf3, 0x53, 0xf8, 0xb1, 0x76, 0xb9, 0xcb, 0x73, 0x75, 0x38, - 0x6c, 0x5f, 0xe3, 0x5c, 0x1c, 0x92, 0x34, 0x1d, 0xdb, 0xa0, 0x9c, 0xbb, 0x97, 0x27, 0xef, 0xf3, - 0x4b, 0xde, 0xe7, 0x0d, 0x78, 0x44, 0x43, 0x4e, 0xd8, 0x1f, 0xc2, 0xfc, 0x98, 0x64, 0x84, 0x27, - 0xdc, 0xcb, 0x19, 0x15, 0x14, 0xf6, 0xfe, 0x11, 0x81, 0xa3, 0x39, 0x4e, 0x32, 0x4f, 0x55, 0x94, - 0x11, 0xcf, 0xb4, 0x76, 0x1f, 0xc4, 0x34, 0xa6, 0xaa, 0xcf, 0x97, 0x95, 0xb6, 0x74, 0x1f, 0x96, - 0xa8, 0x10, 0xa7, 0x29, 0x15, 0x85, 0xdc, 0x2f, 0xe5, 0x88, 0x51, 0xce, 0x15, 0x33, 0xf8, 0x95, - 0xe2, 0x98, 0x9f, 0xf8, 0x7e, 0x93, 0x55, 0x4c, 0xb2, 0x42, 0xee, 0x95, 0x72, 0x46, 0x7f, 0x92, - 0x00, 0x47, 0x11, 0x5d, 0x66, 0x06, 0xfa, 0xb8, 0x3c, 0x34, 0xc5, 0x09, 0x2c, 0xc7, 0x0c, 0x2f, - 0x8a, 0x3b, 0x9e, 0x5c, 0xd6, 0xc1, 0x9d, 0x77, 0x7a, 0xc0, 0x2f, 0x02, 0x0b, 0x02, 0x5f, 0x83, - 0xa6, 0x7e, 0x25, 0x77, 0xec, 0x41, 0x6d, 0xd8, 0x1a, 0x3d, 0xf5, 0x2a, 0x26, 0xf6, 0xc6, 0xaa, - 0x17, 0x19, 0x0f, 0x9c, 0x82, 0xdb, 0xe6, 0x8c, 0x3b, 0x37, 0x14, 0xe0, 0x59, 0x25, 0xe0, 0x53, - 0x51, 0x7c, 0xc0, 0x79, 0x4e, 0x18, 0xda, 0xbb, 0x21, 0x02, 0x6d, 0x39, 0xe0, 0x1b, 0x3d, 0xdf, - 0x2c, 0xe1, 0xc2, 0xa9, 0x29, 0xe0, 0xb0, 0x12, 0xf8, 0x71, 0xef, 0x41, 0xc7, 0x00, 0xf8, 0x15, - 0x74, 0x8e, 0xc3, 0x76, 0xea, 0x03, 0x7b, 0xd8, 0x1a, 0x3d, 0xaf, 0x84, 0x4e, 0x4a, 0xd3, 0x5b, - 0xe9, 0x41, 0xed, 0xe8, 0x50, 0x80, 0xaf, 0x40, 0x43, 0xe7, 0xea, 0xdc, 0x54, 0xb8, 0xea, 0xd4, - 0x3e, 0xab, 0x56, 0x54, 0x58, 0xa4, 0x59, 0x6f, 0xd8, 0x69, 0x5c, 0xc3, 0xfc, 0x5e, 0xb5, 0xa2, - 0xc2, 0x02, 0x7f, 0x80, 0xfb, 0x29, 0xe6, 0x22, 0x30, 0xe7, 0x81, 0x9a, 0xd6, 0x69, 0x2a, 0x92, - 0x57, 0x49, 0x9a, 0x61, 0x2e, 0x4c, 0xfe, 0x13, 0x15, 0xd8, 0xbd, 0xf4, 0x58, 0x82, 0xdf, 0x41, - 0x47, 0xba, 0x02, 0xfd, 0xd6, 0x20, 0x95, 0x7b, 0xb8, 0xa5, 0xe0, 0xd5, 0x8b, 0x9d, 0x50, 0x46, - 0xf4, 0x9c, 0x32, 0xf9, 0x71, 0x7d, 0x7d, 0xde, 0xb7, 0xd0, 0xdd, 0xe8, 0x50, 0x9d, 0xae, 0xb7, - 0xae, 0xbd, 0xd9, 0xba, 0xf6, 0xc5, 0xd6, 0xb5, 0xff, 0xef, 0x5c, 0x6b, 0xb3, 0x73, 0xad, 0xb3, - 0x9d, 0x6b, 0x7d, 0xf3, 0xe3, 0x44, 0xcc, 0x97, 0xa1, 0x17, 0xd1, 0x85, 0x2f, 0xe1, 0x2f, 0xd4, - 0x3d, 0xbe, 0xb9, 0xc7, 0xff, 0x5b, 0x7e, 0x70, 0x5f, 0xac, 0x72, 0xc2, 0xc3, 0x86, 0xfa, 0xd0, - 0x2f, 0xaf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x9a, 0xb6, 0x15, 0x7a, 0xb9, 0x03, 0x00, 0x00, + // 642 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xdd, 0x4e, 0x14, 0x31, + 0x14, 0xc7, 0x77, 0x05, 0xc1, 0xed, 0xf2, 0x65, 0x45, 0x6d, 0x40, 0x07, 0xc4, 0x1b, 0xe2, 0xc7, + 0x8c, 0xc1, 0x4b, 0xe3, 0x85, 0x6c, 0x02, 0x12, 0x01, 0x75, 0x20, 0x31, 0xd1, 0xc4, 0x49, 0xb7, + 0x5b, 0x86, 0x89, 0xb3, 0xed, 0x64, 0xda, 0x35, 0xe0, 0x53, 0xf8, 0x18, 0x3e, 0x0a, 0x97, 0x5c, + 0x7a, 0x65, 0x0c, 0xbc, 0x88, 0xe9, 0xd7, 0xcc, 0xce, 0x6e, 0x32, 0xee, 0x5d, 0xf3, 0x3f, 0xe7, + 0xff, 0x3b, 0xed, 0x69, 0x4f, 0xc1, 0x3d, 0xde, 0x15, 0x34, 0xff, 0x4e, 0xf3, 0x20, 0xa6, 0x8c, + 0x8a, 0x44, 0xf8, 0x59, 0xce, 0x25, 0x87, 0xab, 0x3f, 0xa8, 0xc4, 0xe4, 0x14, 0x27, 0xcc, 0xd7, + 0x2b, 0x9e, 0x53, 0xdf, 0xa5, 0xae, 0x2c, 0xc7, 0x3c, 0xe6, 0x3a, 0x2f, 0x50, 0x2b, 0x63, 0x59, + 0xb9, 0x5b, 0xa0, 0xba, 0x38, 0x4d, 0xb9, 0xb4, 0xf2, 0x72, 0x29, 0xa7, 0xb8, 0x4f, 0xad, 0xba, + 0x5a, 0xa8, 0xba, 0x48, 0xc4, 0x38, 0x23, 0xd4, 0x16, 0x5f, 0x59, 0x2b, 0x83, 0x39, 0x17, 0xc2, + 0x64, 0x9c, 0xa4, 0x38, 0x16, 0x63, 0xa5, 0xbe, 0xd1, 0xf3, 0x98, 0xb2, 0x31, 0x28, 0xe3, 0x3d, + 0x1a, 0x61, 0x42, 0xf8, 0x80, 0xb9, 0x7d, 0x3c, 0x18, 0x0a, 0x32, 0x42, 0x23, 0xc9, 0x23, 0x42, + 0xe4, 0x99, 0x8d, 0xde, 0x2f, 0xa2, 0x6e, 0x31, 0x56, 0x2a, 0xc3, 0x39, 0xee, 0xbb, 0x1d, 0x3c, + 0x2c, 0x65, 0xca, 0x7a, 0x09, 0x8b, 0xab, 0x27, 0x80, 0x45, 0x58, 0x0a, 0xa7, 0x3d, 0x1a, 0xd6, + 0xa2, 0x93, 0x01, 0xeb, 0x89, 0xa8, 0x9f, 0xc4, 0x39, 0x96, 0xdc, 0x16, 0xdb, 0xf8, 0xd5, 0x02, + 0x73, 0xbb, 0xe6, 0x1e, 0x8e, 0x24, 0x96, 0x14, 0xbe, 0x06, 0xb3, 0xa6, 0x99, 0x02, 0x35, 0xd7, + 0xa7, 0x36, 0xdb, 0x5b, 0x8f, 0xfd, 0x9a, 0x8b, 0xf1, 0xb7, 0x75, 0x6e, 0xe8, 0x3c, 0x70, 0x0f, + 0xb4, 0x5c, 0x4c, 0xa0, 0x1b, 0x1a, 0xf0, 0xb4, 0x16, 0xf0, 0xde, 0x2e, 0x0e, 0x70, 0x96, 0xd1, + 0x3c, 0x2c, 0xdd, 0x30, 0x04, 0x8b, 0xaa, 0xa9, 0x6f, 0x4c, 0x4f, 0xf7, 0x13, 0x21, 0xd1, 0x94, + 0x06, 0x6e, 0xd6, 0x02, 0x0f, 0x4b, 0x4f, 0x38, 0x0a, 0x80, 0x9f, 0xc0, 0xd2, 0xe8, 0x05, 0xa3, + 0xe9, 0xf5, 0xe6, 0x66, 0x7b, 0xeb, 0x59, 0x2d, 0xb4, 0x53, 0x98, 0x76, 0x94, 0x27, 0x5c, 0x24, + 0x55, 0x01, 0xbe, 0x02, 0x33, 0xe6, 0xb6, 0xd0, 0x4d, 0x8d, 0xab, 0xef, 0xda, 0x07, 0x9d, 0x1a, + 0x5a, 0x8b, 0x32, 0x9b, 0x57, 0x85, 0x66, 0x26, 0x30, 0xbf, 0xd3, 0xa9, 0xa1, 0xb5, 0xc0, 0xaf, + 0xe0, 0x4e, 0x8a, 0x85, 0x8c, 0x5c, 0x3c, 0xd2, 0xa7, 0x45, 0xb3, 0x9a, 0xe4, 0xd7, 0x92, 0xf6, + 0xb1, 0x90, 0xae, 0xff, 0x1d, 0xdd, 0xb0, 0xdb, 0xe9, 0xa8, 0x04, 0xbf, 0x80, 0x25, 0xe5, 0x8a, + 0xcc, 0x5e, 0xa3, 0x54, 0xdd, 0xc3, 0x2d, 0x0d, 0xaf, 0xbf, 0xd8, 0x0e, 0xcf, 0xa9, 0x39, 0xa7, + 0xea, 0xfc, 0xf6, 0xf4, 0xc5, 0x9f, 0xb5, 0x46, 0xb8, 0x40, 0x2a, 0x2a, 0xdc, 0x02, 0x53, 0x52, + 0x08, 0xd4, 0xd2, 0xbc, 0xf5, 0x5a, 0xde, 0xf1, 0xd1, 0x51, 0xa8, 0x92, 0xe1, 0x2e, 0x68, 0xab, + 0xe7, 0x7c, 0x9a, 0x08, 0xc9, 0xf3, 0x73, 0x04, 0xf4, 0x9b, 0xf8, 0xaf, 0xd7, 0x6e, 0x00, 0x48, + 0x21, 0xde, 0x1a, 0x27, 0xec, 0x01, 0xe8, 0xe6, 0xa2, 0x18, 0x0b, 0x81, 0xda, 0x9a, 0xf7, 0xa2, + 0x9e, 0x27, 0xc4, 0xce, 0x80, 0xf5, 0x0e, 0xac, 0x69, 0x8f, 0x9d, 0x70, 0xcb, 0x5f, 0x92, 0xd5, + 0x90, 0xda, 0x2e, 0xd0, 0xdf, 0x90, 0xe9, 0xdc, 0x9c, 0xa6, 0x6f, 0xd4, 0xcf, 0x94, 0x4a, 0xb7, + 0xbc, 0x96, 0xf6, 0xda, 0xb7, 0xbb, 0x50, 0x9d, 0x7c, 0x34, 0xaf, 0x61, 0x4f, 0xea, 0x9f, 0x9a, + 0xb1, 0x1c, 0x6a, 0x87, 0x85, 0xce, 0x67, 0xc3, 0x22, 0xfc, 0x08, 0xe6, 0x86, 0xbf, 0x44, 0xb4, + 0x30, 0xc1, 0x94, 0x75, 0x94, 0x5e, 0x81, 0xb6, 0x49, 0x29, 0xc1, 0x10, 0xcc, 0x57, 0xfe, 0x3c, + 0xb4, 0x38, 0xd1, 0xe4, 0x32, 0x42, 0x8f, 0x79, 0x87, 0xc8, 0x33, 0xc7, 0x64, 0x43, 0xd2, 0xde, + 0xc5, 0x95, 0xd7, 0xbc, 0xbc, 0xf2, 0x9a, 0x7f, 0xaf, 0xbc, 0xe6, 0xcf, 0x6b, 0xaf, 0x71, 0x79, + 0xed, 0x35, 0x7e, 0x5f, 0x7b, 0x8d, 0xcf, 0x41, 0x9c, 0xc8, 0xd3, 0x41, 0xd7, 0x27, 0xbc, 0x1f, + 0x28, 0xec, 0x73, 0x5d, 0x21, 0x70, 0x15, 0x82, 0xb3, 0xa0, 0xfc, 0x08, 0xcf, 0x33, 0x2a, 0xba, + 0x33, 0xfa, 0xf3, 0x7b, 0xf9, 0x2f, 0x00, 0x00, 0xff, 0xff, 0xee, 0x86, 0x37, 0x94, 0x8c, 0x06, + 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -181,6 +251,102 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.NonceToCctx) > 0 { + for iNdEx := len(m.NonceToCctx) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.NonceToCctx[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x7a + } + } + if len(m.ChainNonces) > 0 { + for iNdEx := len(m.ChainNonces) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ChainNonces[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x72 + } + } + if len(m.PendingNonces) > 0 { + for iNdEx := len(m.PendingNonces) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PendingNonces[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6a + } + } + if len(m.BlameList) > 0 { + for iNdEx := len(m.BlameList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BlameList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x62 + } + } + if len(m.TssFundMigrators) > 0 { + for iNdEx := len(m.TssFundMigrators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TssFundMigrators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + } + } + if len(m.TssHistory) > 0 { + for iNdEx := len(m.TssHistory) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TssHistory[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + } + } + if m.Tss != nil { + { + size, err := m.Tss.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } { size, err := m.CoreParamsList.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -337,6 +503,46 @@ func (m *GenesisState) Size() (n int) { } l = m.CoreParamsList.Size() n += 1 + l + sovGenesis(uint64(l)) + if m.Tss != nil { + l = m.Tss.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + if len(m.TssHistory) > 0 { + for _, e := range m.TssHistory { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.TssFundMigrators) > 0 { + for _, e := range m.TssFundMigrators { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.BlameList) > 0 { + for _, e := range m.BlameList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.PendingNonces) > 0 { + for _, e := range m.PendingNonces { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.ChainNonces) > 0 { + for _, e := range m.ChainNonces { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.NonceToCctx) > 0 { + for _, e := range m.NonceToCctx { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -654,6 +860,246 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tss", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Tss == nil { + m.Tss = &TSS{} + } + if err := m.Tss.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TssHistory", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TssHistory = append(m.TssHistory, TSS{}) + if err := m.TssHistory[len(m.TssHistory)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TssFundMigrators", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TssFundMigrators = append(m.TssFundMigrators, TssFundMigratorInfo{}) + if err := m.TssFundMigrators[len(m.TssFundMigrators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlameList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlameList = append(m.BlameList, Blame{}) + if err := m.BlameList[len(m.BlameList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PendingNonces", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PendingNonces = append(m.PendingNonces, PendingNonces{}) + if err := m.PendingNonces[len(m.PendingNonces)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainNonces", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainNonces = append(m.ChainNonces, ChainNonces{}) + if err := m.ChainNonces[len(m.ChainNonces)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NonceToCctx", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NonceToCctx = append(m.NonceToCctx, NonceToCctx{}) + if err := m.NonceToCctx[len(m.NonceToCctx)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/observer/types/genesis_test.go b/x/observer/types/genesis_test.go index 3bde1d8f5d..91047ccfd1 100644 --- a/x/observer/types/genesis_test.go +++ b/x/observer/types/genesis_test.go @@ -8,6 +8,10 @@ import ( ) func TestGenesisState_Validate(t *testing.T) { + invalidCoreParamsGen := types.DefaultGenesis() + coreParams := types.GetCoreParams().CoreParams + invalidCoreParamsGen.CoreParamsList.CoreParams = append(coreParams, coreParams[0]) + for _, tc := range []struct { desc string genState *types.GenesisState @@ -23,6 +27,11 @@ func TestGenesisState_Validate(t *testing.T) { genState: &types.GenesisState{}, valid: true, }, + { + desc: "invalid core params", + genState: invalidCoreParamsGen, + valid: false, + }, } { t.Run(tc.desc, func(t *testing.T) { err := tc.genState.Validate() @@ -33,4 +42,7 @@ func TestGenesisState_Validate(t *testing.T) { } }) } + + list := types.GetCoreParams() + list.CoreParams = append(list.CoreParams, list.CoreParams[0]) } diff --git a/x/observer/types/keys.go b/x/observer/types/keys.go index 9c7e8fc349..21a8ff4489 100644 --- a/x/observer/types/keys.go +++ b/x/observer/types/keys.go @@ -49,7 +49,14 @@ const ( BlockHeaderKey = "BlockHeader-value-" BlockHeaderStateKey = "BlockHeaderState-value-" - BallotListKey = "BallotList-value-" + BallotListKey = "BallotList-value-" + TSSKey = "TSS-value-" + TSSHistoryKey = "TSS-History-value-" + TssFundMigratorKey = "FundsMigrator-value-" + + PendingNoncesKeyPrefix = "PendingNonces-value-" + ChainNoncesKey = "ChainNonces-value-" + NonceToCctxKeyPrefix = "NonceToCctx-value-" ) func GetBlameIndex(chainID int64, nonce uint64, digest string, height uint64) string { diff --git a/x/observer/types/message_add_blame_vote.go b/x/observer/types/message_add_blame_vote.go index e3e6db8e99..1d9422f757 100644 --- a/x/observer/types/message_add_blame_vote.go +++ b/x/observer/types/message_add_blame_vote.go @@ -11,7 +11,7 @@ const TypeMsgAddBlameVote = "add_blame_vote" var _ sdk.Msg = &MsgAddBlameVote{} -func NewMsgAddBlameVoteMsg(creator string, chainID int64, blameInfo *Blame) *MsgAddBlameVote { +func NewMsgAddBlameVoteMsg(creator string, chainID int64, blameInfo Blame) *MsgAddBlameVote { return &MsgAddBlameVote{ Creator: creator, ChainId: chainID, diff --git a/x/observer/types/messages_add_block_header.go b/x/observer/types/message_add_block_header.go similarity index 100% rename from x/observer/types/messages_add_block_header.go rename to x/observer/types/message_add_block_header.go diff --git a/x/observer/types/messages_crosschain_flags.go b/x/observer/types/message_crosschain_flags.go similarity index 100% rename from x/observer/types/messages_crosschain_flags.go rename to x/observer/types/message_crosschain_flags.go diff --git a/x/observer/types/messages_crosschain_flags_test.go b/x/observer/types/message_crosschain_flags_test.go similarity index 100% rename from x/observer/types/messages_crosschain_flags_test.go rename to x/observer/types/message_crosschain_flags_test.go diff --git a/x/crosschain/types/nonce_to_cctx.pb.go b/x/observer/types/nonce_to_cctx.pb.go similarity index 53% rename from x/crosschain/types/nonce_to_cctx.pb.go rename to x/observer/types/nonce_to_cctx.pb.go index 0d5ef41237..b6c0a77386 100644 --- a/x/crosschain/types/nonce_to_cctx.pb.go +++ b/x/observer/types/nonce_to_cctx.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: crosschain/nonce_to_cctx.proto +// source: observer/nonce_to_cctx.proto package types @@ -9,7 +9,9 @@ import ( math "math" math_bits "math/bits" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" + _ "github.com/zeta-chain/zetacore/common" ) // Reference imports to suppress errors if they are not otherwise used. @@ -35,7 +37,7 @@ func (m *NonceToCctx) Reset() { *m = NonceToCctx{} } func (m *NonceToCctx) String() string { return proto.CompactTextString(m) } func (*NonceToCctx) ProtoMessage() {} func (*NonceToCctx) Descriptor() ([]byte, []int) { - return fileDescriptor_cfa802a2474dc9c1, []int{0} + return fileDescriptor_6f9bbe8a689fa6e4, []int{0} } func (m *NonceToCctx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -92,102 +94,30 @@ func (m *NonceToCctx) GetTss() string { return "" } -// store key is tss+chainid -type PendingNonces struct { - NonceLow int64 `protobuf:"varint,1,opt,name=nonce_low,json=nonceLow,proto3" json:"nonce_low,omitempty"` - NonceHigh int64 `protobuf:"varint,2,opt,name=nonce_high,json=nonceHigh,proto3" json:"nonce_high,omitempty"` - ChainId int64 `protobuf:"varint,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - Tss string `protobuf:"bytes,4,opt,name=tss,proto3" json:"tss,omitempty"` -} - -func (m *PendingNonces) Reset() { *m = PendingNonces{} } -func (m *PendingNonces) String() string { return proto.CompactTextString(m) } -func (*PendingNonces) ProtoMessage() {} -func (*PendingNonces) Descriptor() ([]byte, []int) { - return fileDescriptor_cfa802a2474dc9c1, []int{1} -} -func (m *PendingNonces) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PendingNonces) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PendingNonces.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 *PendingNonces) XXX_Merge(src proto.Message) { - xxx_messageInfo_PendingNonces.Merge(m, src) -} -func (m *PendingNonces) XXX_Size() int { - return m.Size() -} -func (m *PendingNonces) XXX_DiscardUnknown() { - xxx_messageInfo_PendingNonces.DiscardUnknown(m) -} - -var xxx_messageInfo_PendingNonces proto.InternalMessageInfo - -func (m *PendingNonces) GetNonceLow() int64 { - if m != nil { - return m.NonceLow - } - return 0 -} - -func (m *PendingNonces) GetNonceHigh() int64 { - if m != nil { - return m.NonceHigh - } - return 0 -} - -func (m *PendingNonces) GetChainId() int64 { - if m != nil { - return m.ChainId - } - return 0 -} - -func (m *PendingNonces) GetTss() string { - if m != nil { - return m.Tss - } - return "" -} - func init() { - proto.RegisterType((*NonceToCctx)(nil), "zetachain.zetacore.crosschain.NonceToCctx") - proto.RegisterType((*PendingNonces)(nil), "zetachain.zetacore.crosschain.PendingNonces") -} - -func init() { proto.RegisterFile("crosschain/nonce_to_cctx.proto", fileDescriptor_cfa802a2474dc9c1) } - -var fileDescriptor_cfa802a2474dc9c1 = []byte{ - // 273 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0x2e, 0xca, 0x2f, - 0x2e, 0x4e, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0xcf, 0xcb, 0xcf, 0x4b, 0x4e, 0x8d, 0x2f, 0xc9, 0x8f, - 0x4f, 0x4e, 0x2e, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0xad, 0x4a, 0x2d, 0x49, - 0x04, 0x4b, 0xeb, 0x81, 0x59, 0xf9, 0x45, 0xa9, 0x7a, 0x08, 0x2d, 0x4a, 0x79, 0x5c, 0xdc, 0x7e, - 0x20, 0x5d, 0x21, 0xf9, 0xce, 0xc9, 0x25, 0x15, 0x42, 0x92, 0x5c, 0x1c, 0x60, 0xf1, 0xf8, 0xcc, - 0x14, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xe6, 0x20, 0x76, 0x30, 0xdf, 0x33, 0x45, 0x48, 0x84, 0x8b, - 0x15, 0x6c, 0xbe, 0x04, 0x13, 0x58, 0x1c, 0xc2, 0x11, 0x92, 0xe1, 0xe2, 0x04, 0x59, 0xe6, 0x99, - 0x97, 0x92, 0x5a, 0x21, 0xc1, 0xac, 0xc0, 0xa8, 0xc1, 0x19, 0x84, 0x10, 0x10, 0x12, 0xe0, 0x62, - 0x2e, 0x29, 0x2e, 0x96, 0x60, 0x01, 0x8b, 0x83, 0x98, 0x4a, 0x15, 0x5c, 0xbc, 0x01, 0xa9, 0x79, - 0x29, 0x99, 0x79, 0xe9, 0x60, 0x6b, 0x8b, 0x85, 0xa4, 0xb9, 0x38, 0x21, 0xce, 0xce, 0xc9, 0x2f, - 0x87, 0x5a, 0xc9, 0x01, 0x16, 0xf0, 0xc9, 0x2f, 0x17, 0x92, 0xe5, 0xe2, 0x82, 0x48, 0x66, 0x64, - 0xa6, 0x67, 0x40, 0x2d, 0x86, 0x28, 0xf7, 0xc8, 0x4c, 0xcf, 0x40, 0x71, 0x2d, 0x33, 0xaa, 0x6b, - 0x31, 0x6c, 0x76, 0xf2, 0x3e, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, - 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xc3, - 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x50, 0x18, 0xe9, 0x42, 0x42, - 0x13, 0x16, 0x5c, 0xfa, 0x15, 0xfa, 0x48, 0x61, 0x5c, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, - 0x0e, 0x5c, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb8, 0xcb, 0x3e, 0xac, 0x7e, 0x01, 0x00, - 0x00, + proto.RegisterType((*NonceToCctx)(nil), "zetachain.zetacore.observer.NonceToCctx") +} + +func init() { proto.RegisterFile("observer/nonce_to_cctx.proto", fileDescriptor_6f9bbe8a689fa6e4) } + +var fileDescriptor_6f9bbe8a689fa6e4 = []byte{ + // 242 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xc9, 0x4f, 0x2a, 0x4e, + 0x2d, 0x2a, 0x4b, 0x2d, 0xd2, 0xcf, 0xcb, 0xcf, 0x4b, 0x4e, 0x8d, 0x2f, 0xc9, 0x8f, 0x4f, 0x4e, + 0x2e, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0xae, 0x4a, 0x2d, 0x49, 0x4c, 0xce, + 0x48, 0xcc, 0xcc, 0xd3, 0x03, 0xb3, 0xf2, 0x8b, 0x52, 0xf5, 0x60, 0x1a, 0xa4, 0x84, 0x93, 0xf3, + 0x73, 0x73, 0xf3, 0xf3, 0xf4, 0x21, 0x14, 0x44, 0x87, 0x94, 0x48, 0x7a, 0x7e, 0x7a, 0x3e, 0x98, + 0xa9, 0x0f, 0x62, 0x41, 0x44, 0x95, 0xf2, 0xb8, 0xb8, 0xfd, 0x40, 0xc6, 0x87, 0xe4, 0x3b, 0x27, + 0x97, 0x54, 0x08, 0x49, 0x72, 0x71, 0x80, 0x0d, 0x8d, 0xcf, 0x4c, 0x91, 0x60, 0x54, 0x60, 0xd4, + 0x60, 0x0e, 0x62, 0x07, 0xf3, 0x3d, 0x53, 0x84, 0x44, 0xb8, 0x58, 0xc1, 0x0e, 0x91, 0x60, 0x02, + 0x8b, 0x43, 0x38, 0x42, 0x32, 0x5c, 0x9c, 0x20, 0x57, 0x79, 0xe6, 0xa5, 0xa4, 0x56, 0x48, 0x30, + 0x2b, 0x30, 0x6a, 0x70, 0x06, 0x21, 0x04, 0x84, 0x04, 0xb8, 0x98, 0x4b, 0x8a, 0x8b, 0x25, 0x58, + 0xc0, 0xe2, 0x20, 0xa6, 0x93, 0xe7, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, + 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, + 0xe9, 0xa7, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x83, 0xbc, 0xa4, 0x0b, + 0xb6, 0x58, 0x1f, 0xe6, 0x3b, 0xfd, 0x0a, 0x7d, 0x78, 0x80, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x27, + 0xb1, 0x81, 0x7d, 0x60, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x18, 0xf1, 0x0b, 0xf9, 0x29, 0x01, + 0x00, 0x00, } func (m *NonceToCctx) Marshal() (dAtA []byte, err error) { @@ -237,51 +167,6 @@ func (m *NonceToCctx) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *PendingNonces) 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 *PendingNonces) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PendingNonces) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Tss) > 0 { - i -= len(m.Tss) - copy(dAtA[i:], m.Tss) - i = encodeVarintNonceToCctx(dAtA, i, uint64(len(m.Tss))) - i-- - dAtA[i] = 0x22 - } - if m.ChainId != 0 { - i = encodeVarintNonceToCctx(dAtA, i, uint64(m.ChainId)) - i-- - dAtA[i] = 0x18 - } - if m.NonceHigh != 0 { - i = encodeVarintNonceToCctx(dAtA, i, uint64(m.NonceHigh)) - i-- - dAtA[i] = 0x10 - } - if m.NonceLow != 0 { - i = encodeVarintNonceToCctx(dAtA, i, uint64(m.NonceLow)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - func encodeVarintNonceToCctx(dAtA []byte, offset int, v uint64) int { offset -= sovNonceToCctx(v) base := offset @@ -316,28 +201,6 @@ func (m *NonceToCctx) Size() (n int) { return n } -func (m *PendingNonces) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.NonceLow != 0 { - n += 1 + sovNonceToCctx(uint64(m.NonceLow)) - } - if m.NonceHigh != 0 { - n += 1 + sovNonceToCctx(uint64(m.NonceHigh)) - } - if m.ChainId != 0 { - n += 1 + sovNonceToCctx(uint64(m.ChainId)) - } - l = len(m.Tss) - if l > 0 { - n += 1 + l + sovNonceToCctx(uint64(l)) - } - return n -} - func sovNonceToCctx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -496,145 +359,6 @@ func (m *NonceToCctx) Unmarshal(dAtA []byte) error { } return nil } -func (m *PendingNonces) 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 ErrIntOverflowNonceToCctx - } - 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: PendingNonces: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PendingNonces: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NonceLow", wireType) - } - m.NonceLow = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNonceToCctx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NonceLow |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NonceHigh", wireType) - } - m.NonceHigh = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNonceToCctx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NonceHigh |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - m.ChainId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNonceToCctx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ChainId |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tss", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNonceToCctx - } - 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 ErrInvalidLengthNonceToCctx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNonceToCctx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Tss = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNonceToCctx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNonceToCctx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipNonceToCctx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/observer/types/params.go b/x/observer/types/params.go index bff524b297..9b755af3cf 100644 --- a/x/observer/types/params.go +++ b/x/observer/types/params.go @@ -17,11 +17,18 @@ func ParamKeyTable() paramtypes.KeyTable { } func NewParams(observerParams []*ObserverParams, adminParams []*Admin_Policy, ballotMaturityBlocks int64) Params { - return Params{ObserverParams: observerParams, AdminPolicy: adminParams, BallotMaturityBlocks: ballotMaturityBlocks} + return Params{ + ObserverParams: observerParams, + AdminPolicy: adminParams, + BallotMaturityBlocks: ballotMaturityBlocks, + } } +// DefaultParams returns a default set of parameters. +// privnet chains are supported by default for testing purposes +// custom params must be provided in genesis for other networks func DefaultParams() Params { - chains := common.DefaultChainsList() + chains := common.PrivnetChainList() observerParams := make([]*ObserverParams, len(chains)) for i, chain := range chains { observerParams[i] = &ObserverParams{ @@ -135,7 +142,8 @@ func (p Params) GetSupportedChains() (chains []*common.Chain) { } func (p Params) GetChainFromChainID(chainID int64) *common.Chain { - for _, observerParam := range p.GetObserverParams() { + chainList := p.GetObserverParams() + for _, observerParam := range chainList { if observerParam.Chain.ChainId == chainID && observerParam.IsSupported { return observerParam.Chain } diff --git a/x/observer/types/pending_nonces.pb.go b/x/observer/types/pending_nonces.pb.go new file mode 100644 index 0000000000..dee38660f7 --- /dev/null +++ b/x/observer/types/pending_nonces.pb.go @@ -0,0 +1,429 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: observer/pending_nonces.proto + +package types + +import ( + fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "github.com/zeta-chain/zetacore/common" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// store key is tss+chainid +type PendingNonces struct { + NonceLow int64 `protobuf:"varint,1,opt,name=nonce_low,json=nonceLow,proto3" json:"nonce_low,omitempty"` + NonceHigh int64 `protobuf:"varint,2,opt,name=nonce_high,json=nonceHigh,proto3" json:"nonce_high,omitempty"` + ChainId int64 `protobuf:"varint,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + Tss string `protobuf:"bytes,4,opt,name=tss,proto3" json:"tss,omitempty"` +} + +func (m *PendingNonces) Reset() { *m = PendingNonces{} } +func (m *PendingNonces) String() string { return proto.CompactTextString(m) } +func (*PendingNonces) ProtoMessage() {} +func (*PendingNonces) Descriptor() ([]byte, []int) { + return fileDescriptor_dd001e4838750ecf, []int{0} +} +func (m *PendingNonces) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PendingNonces) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PendingNonces.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 *PendingNonces) XXX_Merge(src proto.Message) { + xxx_messageInfo_PendingNonces.Merge(m, src) +} +func (m *PendingNonces) XXX_Size() int { + return m.Size() +} +func (m *PendingNonces) XXX_DiscardUnknown() { + xxx_messageInfo_PendingNonces.DiscardUnknown(m) +} + +var xxx_messageInfo_PendingNonces proto.InternalMessageInfo + +func (m *PendingNonces) GetNonceLow() int64 { + if m != nil { + return m.NonceLow + } + return 0 +} + +func (m *PendingNonces) GetNonceHigh() int64 { + if m != nil { + return m.NonceHigh + } + return 0 +} + +func (m *PendingNonces) GetChainId() int64 { + if m != nil { + return m.ChainId + } + return 0 +} + +func (m *PendingNonces) GetTss() string { + if m != nil { + return m.Tss + } + return "" +} + +func init() { + proto.RegisterType((*PendingNonces)(nil), "zetachain.zetacore.observer.PendingNonces") +} + +func init() { proto.RegisterFile("observer/pending_nonces.proto", fileDescriptor_dd001e4838750ecf) } + +var fileDescriptor_dd001e4838750ecf = []byte{ + // 251 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcd, 0x4f, 0x2a, 0x4e, + 0x2d, 0x2a, 0x4b, 0x2d, 0xd2, 0x2f, 0x48, 0xcd, 0x4b, 0xc9, 0xcc, 0x4b, 0x8f, 0xcf, 0xcb, 0xcf, + 0x4b, 0x4e, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0xae, 0x4a, 0x2d, 0x49, 0x4c, + 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x03, 0xb3, 0xf2, 0x8b, 0x52, 0xf5, 0x60, 0x3a, 0xa4, 0x84, 0x93, + 0xf3, 0x73, 0x73, 0xf3, 0xf3, 0xf4, 0x21, 0x14, 0x44, 0x87, 0x94, 0x48, 0x7a, 0x7e, 0x7a, 0x3e, + 0x98, 0xa9, 0x0f, 0x62, 0x41, 0x44, 0x95, 0x2a, 0xb8, 0x78, 0x03, 0x20, 0xe6, 0xfb, 0x81, 0x8d, + 0x17, 0x92, 0xe6, 0xe2, 0x04, 0x5b, 0x14, 0x9f, 0x93, 0x5f, 0x2e, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, + 0x1c, 0xc4, 0x01, 0x16, 0xf0, 0xc9, 0x2f, 0x17, 0x92, 0xe5, 0xe2, 0x82, 0x48, 0x66, 0x64, 0xa6, + 0x67, 0x48, 0x30, 0x81, 0x65, 0x21, 0xca, 0x3d, 0x32, 0xd3, 0x33, 0x84, 0x24, 0xb9, 0x38, 0xc0, + 0x4e, 0x8a, 0xcf, 0x4c, 0x91, 0x60, 0x06, 0x4b, 0xb2, 0x83, 0xf9, 0x9e, 0x29, 0x42, 0x02, 0x5c, + 0xcc, 0x25, 0xc5, 0xc5, 0x12, 0x2c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x20, 0xa6, 0x93, 0xe7, 0x89, + 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, + 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0xe9, 0xa7, 0x67, 0x96, 0x64, 0x94, 0x26, + 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x83, 0x3c, 0xa7, 0x0b, 0x36, 0x44, 0x1f, 0xe6, 0x4f, 0xfd, 0x0a, + 0x7d, 0x78, 0xd8, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0xfd, 0x62, 0x0c, 0x08, 0x00, + 0x00, 0xff, 0xff, 0xd9, 0xc8, 0x8e, 0xf9, 0x34, 0x01, 0x00, 0x00, +} + +func (m *PendingNonces) 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 *PendingNonces) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PendingNonces) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Tss) > 0 { + i -= len(m.Tss) + copy(dAtA[i:], m.Tss) + i = encodeVarintPendingNonces(dAtA, i, uint64(len(m.Tss))) + i-- + dAtA[i] = 0x22 + } + if m.ChainId != 0 { + i = encodeVarintPendingNonces(dAtA, i, uint64(m.ChainId)) + i-- + dAtA[i] = 0x18 + } + if m.NonceHigh != 0 { + i = encodeVarintPendingNonces(dAtA, i, uint64(m.NonceHigh)) + i-- + dAtA[i] = 0x10 + } + if m.NonceLow != 0 { + i = encodeVarintPendingNonces(dAtA, i, uint64(m.NonceLow)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintPendingNonces(dAtA []byte, offset int, v uint64) int { + offset -= sovPendingNonces(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *PendingNonces) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.NonceLow != 0 { + n += 1 + sovPendingNonces(uint64(m.NonceLow)) + } + if m.NonceHigh != 0 { + n += 1 + sovPendingNonces(uint64(m.NonceHigh)) + } + if m.ChainId != 0 { + n += 1 + sovPendingNonces(uint64(m.ChainId)) + } + l = len(m.Tss) + if l > 0 { + n += 1 + l + sovPendingNonces(uint64(l)) + } + return n +} + +func sovPendingNonces(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozPendingNonces(x uint64) (n int) { + return sovPendingNonces(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *PendingNonces) 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 ErrIntOverflowPendingNonces + } + 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: PendingNonces: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PendingNonces: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NonceLow", wireType) + } + m.NonceLow = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPendingNonces + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NonceLow |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NonceHigh", wireType) + } + m.NonceHigh = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPendingNonces + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NonceHigh |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + m.ChainId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPendingNonces + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ChainId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tss", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPendingNonces + } + 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 ErrInvalidLengthPendingNonces + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPendingNonces + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Tss = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPendingNonces(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPendingNonces + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipPendingNonces(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPendingNonces + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPendingNonces + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowPendingNonces + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthPendingNonces + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupPendingNonces + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthPendingNonces + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthPendingNonces = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowPendingNonces = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupPendingNonces = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/observer/types/query.pb.go b/x/observer/types/query.pb.go index 35fd0d08c7..cf78bf525a 100644 --- a/x/observer/types/query.pb.go +++ b/x/observer/types/query.pb.go @@ -32,26 +32,22 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type QueryProveRequest struct { - ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - TxHash string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` - Proof *common.Proof `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof,omitempty"` - BlockHash string `protobuf:"bytes,4,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` - TxIndex int64 `protobuf:"varint,5,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"` +type QueryGetChainNoncesRequest struct { + Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` } -func (m *QueryProveRequest) Reset() { *m = QueryProveRequest{} } -func (m *QueryProveRequest) String() string { return proto.CompactTextString(m) } -func (*QueryProveRequest) ProtoMessage() {} -func (*QueryProveRequest) Descriptor() ([]byte, []int) { +func (m *QueryGetChainNoncesRequest) Reset() { *m = QueryGetChainNoncesRequest{} } +func (m *QueryGetChainNoncesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetChainNoncesRequest) ProtoMessage() {} +func (*QueryGetChainNoncesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{0} } -func (m *QueryProveRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryGetChainNoncesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryProveRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetChainNoncesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryProveRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetChainNoncesRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -61,69 +57,41 @@ func (m *QueryProveRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } -func (m *QueryProveRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryProveRequest.Merge(m, src) +func (m *QueryGetChainNoncesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetChainNoncesRequest.Merge(m, src) } -func (m *QueryProveRequest) XXX_Size() int { +func (m *QueryGetChainNoncesRequest) XXX_Size() int { return m.Size() } -func (m *QueryProveRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryProveRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryProveRequest proto.InternalMessageInfo - -func (m *QueryProveRequest) GetChainId() int64 { - if m != nil { - return m.ChainId - } - return 0 -} - -func (m *QueryProveRequest) GetTxHash() string { - if m != nil { - return m.TxHash - } - return "" +func (m *QueryGetChainNoncesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetChainNoncesRequest.DiscardUnknown(m) } -func (m *QueryProveRequest) GetProof() *common.Proof { - if m != nil { - return m.Proof - } - return nil -} +var xxx_messageInfo_QueryGetChainNoncesRequest proto.InternalMessageInfo -func (m *QueryProveRequest) GetBlockHash() string { +func (m *QueryGetChainNoncesRequest) GetIndex() string { if m != nil { - return m.BlockHash + return m.Index } return "" } -func (m *QueryProveRequest) GetTxIndex() int64 { - if m != nil { - return m.TxIndex - } - return 0 -} - -type QueryProveResponse struct { - Valid bool `protobuf:"varint,1,opt,name=valid,proto3" json:"valid,omitempty"` +type QueryGetChainNoncesResponse struct { + ChainNonces ChainNonces `protobuf:"bytes,1,opt,name=ChainNonces,proto3" json:"ChainNonces"` } -func (m *QueryProveResponse) Reset() { *m = QueryProveResponse{} } -func (m *QueryProveResponse) String() string { return proto.CompactTextString(m) } -func (*QueryProveResponse) ProtoMessage() {} -func (*QueryProveResponse) Descriptor() ([]byte, []int) { +func (m *QueryGetChainNoncesResponse) Reset() { *m = QueryGetChainNoncesResponse{} } +func (m *QueryGetChainNoncesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetChainNoncesResponse) ProtoMessage() {} +func (*QueryGetChainNoncesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{1} } -func (m *QueryProveResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryGetChainNoncesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryProveResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetChainNoncesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryProveResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetChainNoncesResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -133,40 +101,41 @@ func (m *QueryProveResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *QueryProveResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryProveResponse.Merge(m, src) +func (m *QueryGetChainNoncesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetChainNoncesResponse.Merge(m, src) } -func (m *QueryProveResponse) XXX_Size() int { +func (m *QueryGetChainNoncesResponse) XXX_Size() int { return m.Size() } -func (m *QueryProveResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryProveResponse.DiscardUnknown(m) +func (m *QueryGetChainNoncesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetChainNoncesResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryProveResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryGetChainNoncesResponse proto.InternalMessageInfo -func (m *QueryProveResponse) GetValid() bool { +func (m *QueryGetChainNoncesResponse) GetChainNonces() ChainNonces { if m != nil { - return m.Valid + return m.ChainNonces } - return false + return ChainNonces{} } -type QueryParamsRequest struct { +type QueryAllChainNoncesRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } -func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamsRequest) ProtoMessage() {} -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { +func (m *QueryAllChainNoncesRequest) Reset() { *m = QueryAllChainNoncesRequest{} } +func (m *QueryAllChainNoncesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllChainNoncesRequest) ProtoMessage() {} +func (*QueryAllChainNoncesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{2} } -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryAllChainNoncesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllChainNoncesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllChainNoncesRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -176,36 +145,42 @@ func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) +func (m *QueryAllChainNoncesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllChainNoncesRequest.Merge(m, src) } -func (m *QueryParamsRequest) XXX_Size() int { +func (m *QueryAllChainNoncesRequest) XXX_Size() int { return m.Size() } -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +func (m *QueryAllChainNoncesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllChainNoncesRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryAllChainNoncesRequest proto.InternalMessageInfo -// QueryParamsResponse is response type for the Query/Params RPC method. -type QueryParamsResponse struct { - // params holds all the parameters of this module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +func (m *QueryAllChainNoncesRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil } -func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } -func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryParamsResponse) ProtoMessage() {} -func (*QueryParamsResponse) Descriptor() ([]byte, []int) { +type QueryAllChainNoncesResponse struct { + ChainNonces []ChainNonces `protobuf:"bytes,1,rep,name=ChainNonces,proto3" json:"ChainNonces"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllChainNoncesResponse) Reset() { *m = QueryAllChainNoncesResponse{} } +func (m *QueryAllChainNoncesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllChainNoncesResponse) ProtoMessage() {} +func (*QueryAllChainNoncesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{3} } -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryAllChainNoncesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllChainNoncesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllChainNoncesResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -215,41 +190,48 @@ func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) +func (m *QueryAllChainNoncesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllChainNoncesResponse.Merge(m, src) } -func (m *QueryParamsResponse) XXX_Size() int { +func (m *QueryAllChainNoncesResponse) XXX_Size() int { return m.Size() } -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +func (m *QueryAllChainNoncesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllChainNoncesResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryAllChainNoncesResponse proto.InternalMessageInfo -func (m *QueryParamsResponse) GetParams() Params { +func (m *QueryAllChainNoncesResponse) GetChainNonces() []ChainNonces { if m != nil { - return m.Params + return m.ChainNonces } - return Params{} + return nil } -type QueryBallotByIdentifierRequest struct { - BallotIdentifier string `protobuf:"bytes,1,opt,name=ballot_identifier,json=ballotIdentifier,proto3" json:"ballot_identifier,omitempty"` +func (m *QueryAllChainNoncesResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil } -func (m *QueryBallotByIdentifierRequest) Reset() { *m = QueryBallotByIdentifierRequest{} } -func (m *QueryBallotByIdentifierRequest) String() string { return proto.CompactTextString(m) } -func (*QueryBallotByIdentifierRequest) ProtoMessage() {} -func (*QueryBallotByIdentifierRequest) Descriptor() ([]byte, []int) { +type QueryAllPendingNoncesRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllPendingNoncesRequest) Reset() { *m = QueryAllPendingNoncesRequest{} } +func (m *QueryAllPendingNoncesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllPendingNoncesRequest) ProtoMessage() {} +func (*QueryAllPendingNoncesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{4} } -func (m *QueryBallotByIdentifierRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryAllPendingNoncesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryBallotByIdentifierRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllPendingNoncesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryBallotByIdentifierRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllPendingNoncesRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -259,42 +241,42 @@ func (m *QueryBallotByIdentifierRequest) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } -func (m *QueryBallotByIdentifierRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryBallotByIdentifierRequest.Merge(m, src) +func (m *QueryAllPendingNoncesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllPendingNoncesRequest.Merge(m, src) } -func (m *QueryBallotByIdentifierRequest) XXX_Size() int { +func (m *QueryAllPendingNoncesRequest) XXX_Size() int { return m.Size() } -func (m *QueryBallotByIdentifierRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryBallotByIdentifierRequest.DiscardUnknown(m) +func (m *QueryAllPendingNoncesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllPendingNoncesRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryBallotByIdentifierRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryAllPendingNoncesRequest proto.InternalMessageInfo -func (m *QueryBallotByIdentifierRequest) GetBallotIdentifier() string { +func (m *QueryAllPendingNoncesRequest) GetPagination() *query.PageRequest { if m != nil { - return m.BallotIdentifier + return m.Pagination } - return "" + return nil } -type VoterList struct { - VoterAddress string `protobuf:"bytes,1,opt,name=voter_address,json=voterAddress,proto3" json:"voter_address,omitempty"` - VoteType VoteType `protobuf:"varint,2,opt,name=vote_type,json=voteType,proto3,enum=zetachain.zetacore.observer.VoteType" json:"vote_type,omitempty"` +type QueryAllPendingNoncesResponse struct { + PendingNonces []PendingNonces `protobuf:"bytes,1,rep,name=pending_nonces,json=pendingNonces,proto3" json:"pending_nonces"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *VoterList) Reset() { *m = VoterList{} } -func (m *VoterList) String() string { return proto.CompactTextString(m) } -func (*VoterList) ProtoMessage() {} -func (*VoterList) Descriptor() ([]byte, []int) { +func (m *QueryAllPendingNoncesResponse) Reset() { *m = QueryAllPendingNoncesResponse{} } +func (m *QueryAllPendingNoncesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllPendingNoncesResponse) ProtoMessage() {} +func (*QueryAllPendingNoncesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{5} } -func (m *VoterList) XXX_Unmarshal(b []byte) error { +func (m *QueryAllPendingNoncesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *VoterList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllPendingNoncesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_VoterList.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllPendingNoncesResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -304,51 +286,48 @@ func (m *VoterList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *VoterList) XXX_Merge(src proto.Message) { - xxx_messageInfo_VoterList.Merge(m, src) +func (m *QueryAllPendingNoncesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllPendingNoncesResponse.Merge(m, src) } -func (m *VoterList) XXX_Size() int { +func (m *QueryAllPendingNoncesResponse) XXX_Size() int { return m.Size() } -func (m *VoterList) XXX_DiscardUnknown() { - xxx_messageInfo_VoterList.DiscardUnknown(m) +func (m *QueryAllPendingNoncesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllPendingNoncesResponse.DiscardUnknown(m) } -var xxx_messageInfo_VoterList proto.InternalMessageInfo +var xxx_messageInfo_QueryAllPendingNoncesResponse proto.InternalMessageInfo -func (m *VoterList) GetVoterAddress() string { +func (m *QueryAllPendingNoncesResponse) GetPendingNonces() []PendingNonces { if m != nil { - return m.VoterAddress + return m.PendingNonces } - return "" + return nil } -func (m *VoterList) GetVoteType() VoteType { +func (m *QueryAllPendingNoncesResponse) GetPagination() *query.PageResponse { if m != nil { - return m.VoteType + return m.Pagination } - return VoteType_SuccessObservation + return nil } -type QueryBallotByIdentifierResponse struct { - BallotIdentifier string `protobuf:"bytes,1,opt,name=ballot_identifier,json=ballotIdentifier,proto3" json:"ballot_identifier,omitempty"` - Voters []*VoterList `protobuf:"bytes,2,rep,name=voters,proto3" json:"voters,omitempty"` - ObservationType ObservationType `protobuf:"varint,3,opt,name=observation_type,json=observationType,proto3,enum=zetachain.zetacore.observer.ObservationType" json:"observation_type,omitempty"` - BallotStatus BallotStatus `protobuf:"varint,4,opt,name=ballot_status,json=ballotStatus,proto3,enum=zetachain.zetacore.observer.BallotStatus" json:"ballot_status,omitempty"` +type QueryPendingNoncesByChainRequest struct { + ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` } -func (m *QueryBallotByIdentifierResponse) Reset() { *m = QueryBallotByIdentifierResponse{} } -func (m *QueryBallotByIdentifierResponse) String() string { return proto.CompactTextString(m) } -func (*QueryBallotByIdentifierResponse) ProtoMessage() {} -func (*QueryBallotByIdentifierResponse) Descriptor() ([]byte, []int) { +func (m *QueryPendingNoncesByChainRequest) Reset() { *m = QueryPendingNoncesByChainRequest{} } +func (m *QueryPendingNoncesByChainRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPendingNoncesByChainRequest) ProtoMessage() {} +func (*QueryPendingNoncesByChainRequest) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{6} } -func (m *QueryBallotByIdentifierResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryPendingNoncesByChainRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryBallotByIdentifierResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryPendingNoncesByChainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryBallotByIdentifierResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryPendingNoncesByChainRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -358,62 +337,41 @@ func (m *QueryBallotByIdentifierResponse) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } -func (m *QueryBallotByIdentifierResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryBallotByIdentifierResponse.Merge(m, src) +func (m *QueryPendingNoncesByChainRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPendingNoncesByChainRequest.Merge(m, src) } -func (m *QueryBallotByIdentifierResponse) XXX_Size() int { +func (m *QueryPendingNoncesByChainRequest) XXX_Size() int { return m.Size() } -func (m *QueryBallotByIdentifierResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryBallotByIdentifierResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryBallotByIdentifierResponse proto.InternalMessageInfo - -func (m *QueryBallotByIdentifierResponse) GetBallotIdentifier() string { - if m != nil { - return m.BallotIdentifier - } - return "" -} - -func (m *QueryBallotByIdentifierResponse) GetVoters() []*VoterList { - if m != nil { - return m.Voters - } - return nil +func (m *QueryPendingNoncesByChainRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPendingNoncesByChainRequest.DiscardUnknown(m) } -func (m *QueryBallotByIdentifierResponse) GetObservationType() ObservationType { - if m != nil { - return m.ObservationType - } - return ObservationType_EmptyObserverType -} +var xxx_messageInfo_QueryPendingNoncesByChainRequest proto.InternalMessageInfo -func (m *QueryBallotByIdentifierResponse) GetBallotStatus() BallotStatus { +func (m *QueryPendingNoncesByChainRequest) GetChainId() int64 { if m != nil { - return m.BallotStatus + return m.ChainId } - return BallotStatus_BallotFinalized_SuccessObservation + return 0 } -type QueryObserversByChainRequest struct { - ObservationChain string `protobuf:"bytes,1,opt,name=observation_chain,json=observationChain,proto3" json:"observation_chain,omitempty"` +type QueryPendingNoncesByChainResponse struct { + PendingNonces PendingNonces `protobuf:"bytes,1,opt,name=pending_nonces,json=pendingNonces,proto3" json:"pending_nonces"` } -func (m *QueryObserversByChainRequest) Reset() { *m = QueryObserversByChainRequest{} } -func (m *QueryObserversByChainRequest) String() string { return proto.CompactTextString(m) } -func (*QueryObserversByChainRequest) ProtoMessage() {} -func (*QueryObserversByChainRequest) Descriptor() ([]byte, []int) { +func (m *QueryPendingNoncesByChainResponse) Reset() { *m = QueryPendingNoncesByChainResponse{} } +func (m *QueryPendingNoncesByChainResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPendingNoncesByChainResponse) ProtoMessage() {} +func (*QueryPendingNoncesByChainResponse) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{7} } -func (m *QueryObserversByChainRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryPendingNoncesByChainResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryObserversByChainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryPendingNoncesByChainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryObserversByChainRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryPendingNoncesByChainResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -423,41 +381,40 @@ func (m *QueryObserversByChainRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryObserversByChainRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryObserversByChainRequest.Merge(m, src) +func (m *QueryPendingNoncesByChainResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPendingNoncesByChainResponse.Merge(m, src) } -func (m *QueryObserversByChainRequest) XXX_Size() int { +func (m *QueryPendingNoncesByChainResponse) XXX_Size() int { return m.Size() } -func (m *QueryObserversByChainRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryObserversByChainRequest.DiscardUnknown(m) +func (m *QueryPendingNoncesByChainResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPendingNoncesByChainResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryObserversByChainRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryPendingNoncesByChainResponse proto.InternalMessageInfo -func (m *QueryObserversByChainRequest) GetObservationChain() string { +func (m *QueryPendingNoncesByChainResponse) GetPendingNonces() PendingNonces { if m != nil { - return m.ObservationChain + return m.PendingNonces } - return "" + return PendingNonces{} } -type QueryObserversByChainResponse struct { - Observers []string `protobuf:"bytes,1,rep,name=observers,proto3" json:"observers,omitempty"` +type QueryGetTSSRequest struct { } -func (m *QueryObserversByChainResponse) Reset() { *m = QueryObserversByChainResponse{} } -func (m *QueryObserversByChainResponse) String() string { return proto.CompactTextString(m) } -func (*QueryObserversByChainResponse) ProtoMessage() {} -func (*QueryObserversByChainResponse) Descriptor() ([]byte, []int) { +func (m *QueryGetTSSRequest) Reset() { *m = QueryGetTSSRequest{} } +func (m *QueryGetTSSRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetTSSRequest) ProtoMessage() {} +func (*QueryGetTSSRequest) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{8} } -func (m *QueryObserversByChainResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryGetTSSRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryObserversByChainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetTSSRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryObserversByChainResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetTSSRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -467,40 +424,34 @@ func (m *QueryObserversByChainResponse) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } -func (m *QueryObserversByChainResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryObserversByChainResponse.Merge(m, src) +func (m *QueryGetTSSRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetTSSRequest.Merge(m, src) } -func (m *QueryObserversByChainResponse) XXX_Size() int { +func (m *QueryGetTSSRequest) XXX_Size() int { return m.Size() } -func (m *QueryObserversByChainResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryObserversByChainResponse.DiscardUnknown(m) +func (m *QueryGetTSSRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetTSSRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryObserversByChainResponse proto.InternalMessageInfo - -func (m *QueryObserversByChainResponse) GetObservers() []string { - if m != nil { - return m.Observers - } - return nil -} +var xxx_messageInfo_QueryGetTSSRequest proto.InternalMessageInfo -type QueryAllObserverMappersRequest struct { +type QueryGetTSSResponse struct { + TSS TSS `protobuf:"bytes,1,opt,name=TSS,proto3" json:"TSS"` } -func (m *QueryAllObserverMappersRequest) Reset() { *m = QueryAllObserverMappersRequest{} } -func (m *QueryAllObserverMappersRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllObserverMappersRequest) ProtoMessage() {} -func (*QueryAllObserverMappersRequest) Descriptor() ([]byte, []int) { +func (m *QueryGetTSSResponse) Reset() { *m = QueryGetTSSResponse{} } +func (m *QueryGetTSSResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetTSSResponse) ProtoMessage() {} +func (*QueryGetTSSResponse) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{9} } -func (m *QueryAllObserverMappersRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryGetTSSResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllObserverMappersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetTSSResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllObserverMappersRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetTSSResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -510,34 +461,41 @@ func (m *QueryAllObserverMappersRequest) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } -func (m *QueryAllObserverMappersRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllObserverMappersRequest.Merge(m, src) +func (m *QueryGetTSSResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetTSSResponse.Merge(m, src) } -func (m *QueryAllObserverMappersRequest) XXX_Size() int { +func (m *QueryGetTSSResponse) XXX_Size() int { return m.Size() } -func (m *QueryAllObserverMappersRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllObserverMappersRequest.DiscardUnknown(m) +func (m *QueryGetTSSResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetTSSResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllObserverMappersRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryGetTSSResponse proto.InternalMessageInfo -type QueryAllObserverMappersResponse struct { - ObserverMappers []*ObserverMapper `protobuf:"bytes,1,rep,name=observer_mappers,json=observerMappers,proto3" json:"observer_mappers,omitempty"` +func (m *QueryGetTSSResponse) GetTSS() TSS { + if m != nil { + return m.TSS + } + return TSS{} } -func (m *QueryAllObserverMappersResponse) Reset() { *m = QueryAllObserverMappersResponse{} } -func (m *QueryAllObserverMappersResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllObserverMappersResponse) ProtoMessage() {} -func (*QueryAllObserverMappersResponse) Descriptor() ([]byte, []int) { +type QueryGetTssAddressRequest struct { + BitcoinChainId int64 `protobuf:"varint,2,opt,name=bitcoin_chain_id,json=bitcoinChainId,proto3" json:"bitcoin_chain_id,omitempty"` +} + +func (m *QueryGetTssAddressRequest) Reset() { *m = QueryGetTssAddressRequest{} } +func (m *QueryGetTssAddressRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetTssAddressRequest) ProtoMessage() {} +func (*QueryGetTssAddressRequest) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{10} } -func (m *QueryAllObserverMappersResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryGetTssAddressRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllObserverMappersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetTssAddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllObserverMappersResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetTssAddressRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -547,40 +505,42 @@ func (m *QueryAllObserverMappersResponse) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } -func (m *QueryAllObserverMappersResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllObserverMappersResponse.Merge(m, src) +func (m *QueryGetTssAddressRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetTssAddressRequest.Merge(m, src) } -func (m *QueryAllObserverMappersResponse) XXX_Size() int { +func (m *QueryGetTssAddressRequest) XXX_Size() int { return m.Size() } -func (m *QueryAllObserverMappersResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllObserverMappersResponse.DiscardUnknown(m) +func (m *QueryGetTssAddressRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetTssAddressRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllObserverMappersResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryGetTssAddressRequest proto.InternalMessageInfo -func (m *QueryAllObserverMappersResponse) GetObserverMappers() []*ObserverMapper { +func (m *QueryGetTssAddressRequest) GetBitcoinChainId() int64 { if m != nil { - return m.ObserverMappers + return m.BitcoinChainId } - return nil + return 0 } -type QuerySupportedChains struct { +type QueryGetTssAddressResponse struct { + Eth string `protobuf:"bytes,1,opt,name=eth,proto3" json:"eth,omitempty"` + Btc string `protobuf:"bytes,2,opt,name=btc,proto3" json:"btc,omitempty"` } -func (m *QuerySupportedChains) Reset() { *m = QuerySupportedChains{} } -func (m *QuerySupportedChains) String() string { return proto.CompactTextString(m) } -func (*QuerySupportedChains) ProtoMessage() {} -func (*QuerySupportedChains) Descriptor() ([]byte, []int) { +func (m *QueryGetTssAddressResponse) Reset() { *m = QueryGetTssAddressResponse{} } +func (m *QueryGetTssAddressResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetTssAddressResponse) ProtoMessage() {} +func (*QueryGetTssAddressResponse) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{11} } -func (m *QuerySupportedChains) XXX_Unmarshal(b []byte) error { +func (m *QueryGetTssAddressResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QuerySupportedChains) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetTssAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QuerySupportedChains.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetTssAddressResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -590,34 +550,53 @@ func (m *QuerySupportedChains) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *QuerySupportedChains) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuerySupportedChains.Merge(m, src) +func (m *QueryGetTssAddressResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetTssAddressResponse.Merge(m, src) } -func (m *QuerySupportedChains) XXX_Size() int { +func (m *QueryGetTssAddressResponse) XXX_Size() int { return m.Size() } -func (m *QuerySupportedChains) XXX_DiscardUnknown() { - xxx_messageInfo_QuerySupportedChains.DiscardUnknown(m) +func (m *QueryGetTssAddressResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetTssAddressResponse.DiscardUnknown(m) } -var xxx_messageInfo_QuerySupportedChains proto.InternalMessageInfo +var xxx_messageInfo_QueryGetTssAddressResponse proto.InternalMessageInfo -type QuerySupportedChainsResponse struct { - Chains []*common.Chain `protobuf:"bytes,1,rep,name=chains,proto3" json:"chains,omitempty"` +func (m *QueryGetTssAddressResponse) GetEth() string { + if m != nil { + return m.Eth + } + return "" } -func (m *QuerySupportedChainsResponse) Reset() { *m = QuerySupportedChainsResponse{} } -func (m *QuerySupportedChainsResponse) String() string { return proto.CompactTextString(m) } -func (*QuerySupportedChainsResponse) ProtoMessage() {} -func (*QuerySupportedChainsResponse) Descriptor() ([]byte, []int) { +func (m *QueryGetTssAddressResponse) GetBtc() string { + if m != nil { + return m.Btc + } + return "" +} + +type QueryGetTssAddressByFinalizedHeightRequest struct { + FinalizedZetaHeight int64 `protobuf:"varint,1,opt,name=finalized_zeta_height,json=finalizedZetaHeight,proto3" json:"finalized_zeta_height,omitempty"` + BitcoinChainId int64 `protobuf:"varint,2,opt,name=bitcoin_chain_id,json=bitcoinChainId,proto3" json:"bitcoin_chain_id,omitempty"` +} + +func (m *QueryGetTssAddressByFinalizedHeightRequest) Reset() { + *m = QueryGetTssAddressByFinalizedHeightRequest{} +} +func (m *QueryGetTssAddressByFinalizedHeightRequest) String() string { + return proto.CompactTextString(m) +} +func (*QueryGetTssAddressByFinalizedHeightRequest) ProtoMessage() {} +func (*QueryGetTssAddressByFinalizedHeightRequest) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{12} } -func (m *QuerySupportedChainsResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryGetTssAddressByFinalizedHeightRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QuerySupportedChainsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetTssAddressByFinalizedHeightRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QuerySupportedChainsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetTssAddressByFinalizedHeightRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -627,41 +606,53 @@ func (m *QuerySupportedChainsResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QuerySupportedChainsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuerySupportedChainsResponse.Merge(m, src) +func (m *QueryGetTssAddressByFinalizedHeightRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetTssAddressByFinalizedHeightRequest.Merge(m, src) } -func (m *QuerySupportedChainsResponse) XXX_Size() int { +func (m *QueryGetTssAddressByFinalizedHeightRequest) XXX_Size() int { return m.Size() } -func (m *QuerySupportedChainsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QuerySupportedChainsResponse.DiscardUnknown(m) +func (m *QueryGetTssAddressByFinalizedHeightRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetTssAddressByFinalizedHeightRequest.DiscardUnknown(m) } -var xxx_messageInfo_QuerySupportedChainsResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryGetTssAddressByFinalizedHeightRequest proto.InternalMessageInfo -func (m *QuerySupportedChainsResponse) GetChains() []*common.Chain { +func (m *QueryGetTssAddressByFinalizedHeightRequest) GetFinalizedZetaHeight() int64 { if m != nil { - return m.Chains + return m.FinalizedZetaHeight } - return nil + return 0 } -type QueryGetCoreParamsForChainRequest struct { - ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` +func (m *QueryGetTssAddressByFinalizedHeightRequest) GetBitcoinChainId() int64 { + if m != nil { + return m.BitcoinChainId + } + return 0 } -func (m *QueryGetCoreParamsForChainRequest) Reset() { *m = QueryGetCoreParamsForChainRequest{} } -func (m *QueryGetCoreParamsForChainRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetCoreParamsForChainRequest) ProtoMessage() {} -func (*QueryGetCoreParamsForChainRequest) Descriptor() ([]byte, []int) { +type QueryGetTssAddressByFinalizedHeightResponse struct { + Eth string `protobuf:"bytes,1,opt,name=eth,proto3" json:"eth,omitempty"` + Btc string `protobuf:"bytes,2,opt,name=btc,proto3" json:"btc,omitempty"` +} + +func (m *QueryGetTssAddressByFinalizedHeightResponse) Reset() { + *m = QueryGetTssAddressByFinalizedHeightResponse{} +} +func (m *QueryGetTssAddressByFinalizedHeightResponse) String() string { + return proto.CompactTextString(m) +} +func (*QueryGetTssAddressByFinalizedHeightResponse) ProtoMessage() {} +func (*QueryGetTssAddressByFinalizedHeightResponse) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{13} } -func (m *QueryGetCoreParamsForChainRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryGetTssAddressByFinalizedHeightResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetCoreParamsForChainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetTssAddressByFinalizedHeightResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetCoreParamsForChainRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetTssAddressByFinalizedHeightResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -671,41 +662,48 @@ func (m *QueryGetCoreParamsForChainRequest) XXX_Marshal(b []byte, deterministic return b[:n], nil } } -func (m *QueryGetCoreParamsForChainRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetCoreParamsForChainRequest.Merge(m, src) +func (m *QueryGetTssAddressByFinalizedHeightResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetTssAddressByFinalizedHeightResponse.Merge(m, src) } -func (m *QueryGetCoreParamsForChainRequest) XXX_Size() int { +func (m *QueryGetTssAddressByFinalizedHeightResponse) XXX_Size() int { return m.Size() } -func (m *QueryGetCoreParamsForChainRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetCoreParamsForChainRequest.DiscardUnknown(m) +func (m *QueryGetTssAddressByFinalizedHeightResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetTssAddressByFinalizedHeightResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetCoreParamsForChainRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryGetTssAddressByFinalizedHeightResponse proto.InternalMessageInfo -func (m *QueryGetCoreParamsForChainRequest) GetChainId() int64 { +func (m *QueryGetTssAddressByFinalizedHeightResponse) GetEth() string { if m != nil { - return m.ChainId + return m.Eth } - return 0 + return "" } -type QueryGetCoreParamsForChainResponse struct { - CoreParams *CoreParams `protobuf:"bytes,1,opt,name=core_params,json=coreParams,proto3" json:"core_params,omitempty"` +func (m *QueryGetTssAddressByFinalizedHeightResponse) GetBtc() string { + if m != nil { + return m.Btc + } + return "" } -func (m *QueryGetCoreParamsForChainResponse) Reset() { *m = QueryGetCoreParamsForChainResponse{} } -func (m *QueryGetCoreParamsForChainResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetCoreParamsForChainResponse) ProtoMessage() {} -func (*QueryGetCoreParamsForChainResponse) Descriptor() ([]byte, []int) { +type QueryTssHistoryRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryTssHistoryRequest) Reset() { *m = QueryTssHistoryRequest{} } +func (m *QueryTssHistoryRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTssHistoryRequest) ProtoMessage() {} +func (*QueryTssHistoryRequest) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{14} } -func (m *QueryGetCoreParamsForChainResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryTssHistoryRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetCoreParamsForChainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryTssHistoryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetCoreParamsForChainResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryTssHistoryRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -715,40 +713,42 @@ func (m *QueryGetCoreParamsForChainResponse) XXX_Marshal(b []byte, deterministic return b[:n], nil } } -func (m *QueryGetCoreParamsForChainResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetCoreParamsForChainResponse.Merge(m, src) +func (m *QueryTssHistoryRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTssHistoryRequest.Merge(m, src) } -func (m *QueryGetCoreParamsForChainResponse) XXX_Size() int { +func (m *QueryTssHistoryRequest) XXX_Size() int { return m.Size() } -func (m *QueryGetCoreParamsForChainResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetCoreParamsForChainResponse.DiscardUnknown(m) +func (m *QueryTssHistoryRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTssHistoryRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetCoreParamsForChainResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryTssHistoryRequest proto.InternalMessageInfo -func (m *QueryGetCoreParamsForChainResponse) GetCoreParams() *CoreParams { +func (m *QueryTssHistoryRequest) GetPagination() *query.PageRequest { if m != nil { - return m.CoreParams + return m.Pagination } return nil } -type QueryGetCoreParamsRequest struct { +type QueryTssHistoryResponse struct { + TssList []TSS `protobuf:"bytes,1,rep,name=tss_list,json=tssList,proto3" json:"tss_list"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryGetCoreParamsRequest) Reset() { *m = QueryGetCoreParamsRequest{} } -func (m *QueryGetCoreParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetCoreParamsRequest) ProtoMessage() {} -func (*QueryGetCoreParamsRequest) Descriptor() ([]byte, []int) { +func (m *QueryTssHistoryResponse) Reset() { *m = QueryTssHistoryResponse{} } +func (m *QueryTssHistoryResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTssHistoryResponse) ProtoMessage() {} +func (*QueryTssHistoryResponse) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{15} } -func (m *QueryGetCoreParamsRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryTssHistoryResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetCoreParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryTssHistoryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetCoreParamsRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryTssHistoryResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -758,34 +758,52 @@ func (m *QueryGetCoreParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } -func (m *QueryGetCoreParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetCoreParamsRequest.Merge(m, src) +func (m *QueryTssHistoryResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTssHistoryResponse.Merge(m, src) } -func (m *QueryGetCoreParamsRequest) XXX_Size() int { +func (m *QueryTssHistoryResponse) XXX_Size() int { return m.Size() } -func (m *QueryGetCoreParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetCoreParamsRequest.DiscardUnknown(m) +func (m *QueryTssHistoryResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTssHistoryResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetCoreParamsRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryTssHistoryResponse proto.InternalMessageInfo -type QueryGetCoreParamsResponse struct { - CoreParams *CoreParamsList `protobuf:"bytes,1,opt,name=core_params,json=coreParams,proto3" json:"core_params,omitempty"` +func (m *QueryTssHistoryResponse) GetTssList() []TSS { + if m != nil { + return m.TssList + } + return nil } -func (m *QueryGetCoreParamsResponse) Reset() { *m = QueryGetCoreParamsResponse{} } -func (m *QueryGetCoreParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetCoreParamsResponse) ProtoMessage() {} -func (*QueryGetCoreParamsResponse) Descriptor() ([]byte, []int) { +func (m *QueryTssHistoryResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryProveRequest struct { + ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + TxHash string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` + Proof *common.Proof `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof,omitempty"` + BlockHash string `protobuf:"bytes,4,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + TxIndex int64 `protobuf:"varint,5,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"` +} + +func (m *QueryProveRequest) Reset() { *m = QueryProveRequest{} } +func (m *QueryProveRequest) String() string { return proto.CompactTextString(m) } +func (*QueryProveRequest) ProtoMessage() {} +func (*QueryProveRequest) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{16} } -func (m *QueryGetCoreParamsResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryProveRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetCoreParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryProveRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetCoreParamsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryProveRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -795,41 +813,69 @@ func (m *QueryGetCoreParamsResponse) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *QueryGetCoreParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetCoreParamsResponse.Merge(m, src) +func (m *QueryProveRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryProveRequest.Merge(m, src) } -func (m *QueryGetCoreParamsResponse) XXX_Size() int { +func (m *QueryProveRequest) XXX_Size() int { return m.Size() } -func (m *QueryGetCoreParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetCoreParamsResponse.DiscardUnknown(m) +func (m *QueryProveRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryProveRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetCoreParamsResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryProveRequest proto.InternalMessageInfo -func (m *QueryGetCoreParamsResponse) GetCoreParams() *CoreParamsList { +func (m *QueryProveRequest) GetChainId() int64 { if m != nil { - return m.CoreParams + return m.ChainId + } + return 0 +} + +func (m *QueryProveRequest) GetTxHash() string { + if m != nil { + return m.TxHash + } + return "" +} + +func (m *QueryProveRequest) GetProof() *common.Proof { + if m != nil { + return m.Proof } return nil } -type QueryGetNodeAccountRequest struct { - Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` +func (m *QueryProveRequest) GetBlockHash() string { + if m != nil { + return m.BlockHash + } + return "" } -func (m *QueryGetNodeAccountRequest) Reset() { *m = QueryGetNodeAccountRequest{} } -func (m *QueryGetNodeAccountRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetNodeAccountRequest) ProtoMessage() {} -func (*QueryGetNodeAccountRequest) Descriptor() ([]byte, []int) { +func (m *QueryProveRequest) GetTxIndex() int64 { + if m != nil { + return m.TxIndex + } + return 0 +} + +type QueryProveResponse struct { + Valid bool `protobuf:"varint,1,opt,name=valid,proto3" json:"valid,omitempty"` +} + +func (m *QueryProveResponse) Reset() { *m = QueryProveResponse{} } +func (m *QueryProveResponse) String() string { return proto.CompactTextString(m) } +func (*QueryProveResponse) ProtoMessage() {} +func (*QueryProveResponse) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{17} } -func (m *QueryGetNodeAccountRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryProveResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetNodeAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryProveResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetNodeAccountRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryProveResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -839,41 +885,40 @@ func (m *QueryGetNodeAccountRequest) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *QueryGetNodeAccountRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetNodeAccountRequest.Merge(m, src) +func (m *QueryProveResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryProveResponse.Merge(m, src) } -func (m *QueryGetNodeAccountRequest) XXX_Size() int { +func (m *QueryProveResponse) XXX_Size() int { return m.Size() } -func (m *QueryGetNodeAccountRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetNodeAccountRequest.DiscardUnknown(m) +func (m *QueryProveResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryProveResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetNodeAccountRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryProveResponse proto.InternalMessageInfo -func (m *QueryGetNodeAccountRequest) GetIndex() string { +func (m *QueryProveResponse) GetValid() bool { if m != nil { - return m.Index + return m.Valid } - return "" + return false } -type QueryGetNodeAccountResponse struct { - NodeAccount *NodeAccount `protobuf:"bytes,1,opt,name=node_account,json=nodeAccount,proto3" json:"node_account,omitempty"` +type QueryParamsRequest struct { } -func (m *QueryGetNodeAccountResponse) Reset() { *m = QueryGetNodeAccountResponse{} } -func (m *QueryGetNodeAccountResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetNodeAccountResponse) ProtoMessage() {} -func (*QueryGetNodeAccountResponse) Descriptor() ([]byte, []int) { +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{18} } -func (m *QueryGetNodeAccountResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetNodeAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetNodeAccountResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -883,41 +928,36 @@ func (m *QueryGetNodeAccountResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryGetNodeAccountResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetNodeAccountResponse.Merge(m, src) +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) } -func (m *QueryGetNodeAccountResponse) XXX_Size() int { +func (m *QueryParamsRequest) XXX_Size() int { return m.Size() } -func (m *QueryGetNodeAccountResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetNodeAccountResponse.DiscardUnknown(m) +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetNodeAccountResponse proto.InternalMessageInfo - -func (m *QueryGetNodeAccountResponse) GetNodeAccount() *NodeAccount { - if m != nil { - return m.NodeAccount - } - return nil -} +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo -type QueryAllNodeAccountRequest struct { - Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } -func (m *QueryAllNodeAccountRequest) Reset() { *m = QueryAllNodeAccountRequest{} } -func (m *QueryAllNodeAccountRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllNodeAccountRequest) ProtoMessage() {} -func (*QueryAllNodeAccountRequest) Descriptor() ([]byte, []int) { +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{19} } -func (m *QueryAllNodeAccountRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllNodeAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllNodeAccountRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -927,42 +967,42 @@ func (m *QueryAllNodeAccountRequest) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *QueryAllNodeAccountRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllNodeAccountRequest.Merge(m, src) +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) } -func (m *QueryAllNodeAccountRequest) XXX_Size() int { +func (m *QueryParamsResponse) XXX_Size() int { return m.Size() } -func (m *QueryAllNodeAccountRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllNodeAccountRequest.DiscardUnknown(m) +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllNodeAccountRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo -func (m *QueryAllNodeAccountRequest) GetPagination() *query.PageRequest { +func (m *QueryParamsResponse) GetParams() Params { if m != nil { - return m.Pagination + return m.Params } - return nil + return Params{} } -type QueryAllNodeAccountResponse struct { - NodeAccount []*NodeAccount `protobuf:"bytes,1,rep,name=NodeAccount,proto3" json:"NodeAccount,omitempty"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +type QueryHasVotedRequest struct { + BallotIdentifier string `protobuf:"bytes,1,opt,name=ballot_identifier,json=ballotIdentifier,proto3" json:"ballot_identifier,omitempty"` + VoterAddress string `protobuf:"bytes,2,opt,name=voter_address,json=voterAddress,proto3" json:"voter_address,omitempty"` } -func (m *QueryAllNodeAccountResponse) Reset() { *m = QueryAllNodeAccountResponse{} } -func (m *QueryAllNodeAccountResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllNodeAccountResponse) ProtoMessage() {} -func (*QueryAllNodeAccountResponse) Descriptor() ([]byte, []int) { +func (m *QueryHasVotedRequest) Reset() { *m = QueryHasVotedRequest{} } +func (m *QueryHasVotedRequest) String() string { return proto.CompactTextString(m) } +func (*QueryHasVotedRequest) ProtoMessage() {} +func (*QueryHasVotedRequest) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{20} } -func (m *QueryAllNodeAccountResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryHasVotedRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllNodeAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryHasVotedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllNodeAccountResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryHasVotedRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -972,47 +1012,48 @@ func (m *QueryAllNodeAccountResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryAllNodeAccountResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllNodeAccountResponse.Merge(m, src) +func (m *QueryHasVotedRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryHasVotedRequest.Merge(m, src) } -func (m *QueryAllNodeAccountResponse) XXX_Size() int { +func (m *QueryHasVotedRequest) XXX_Size() int { return m.Size() } -func (m *QueryAllNodeAccountResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllNodeAccountResponse.DiscardUnknown(m) +func (m *QueryHasVotedRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryHasVotedRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllNodeAccountResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryHasVotedRequest proto.InternalMessageInfo -func (m *QueryAllNodeAccountResponse) GetNodeAccount() []*NodeAccount { +func (m *QueryHasVotedRequest) GetBallotIdentifier() string { if m != nil { - return m.NodeAccount + return m.BallotIdentifier } - return nil + return "" } -func (m *QueryAllNodeAccountResponse) GetPagination() *query.PageResponse { +func (m *QueryHasVotedRequest) GetVoterAddress() string { if m != nil { - return m.Pagination + return m.VoterAddress } - return nil + return "" } -type QueryGetCrosschainFlagsRequest struct { +type QueryHasVotedResponse struct { + HasVoted bool `protobuf:"varint,1,opt,name=has_voted,json=hasVoted,proto3" json:"has_voted,omitempty"` } -func (m *QueryGetCrosschainFlagsRequest) Reset() { *m = QueryGetCrosschainFlagsRequest{} } -func (m *QueryGetCrosschainFlagsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetCrosschainFlagsRequest) ProtoMessage() {} -func (*QueryGetCrosschainFlagsRequest) Descriptor() ([]byte, []int) { +func (m *QueryHasVotedResponse) Reset() { *m = QueryHasVotedResponse{} } +func (m *QueryHasVotedResponse) String() string { return proto.CompactTextString(m) } +func (*QueryHasVotedResponse) ProtoMessage() {} +func (*QueryHasVotedResponse) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{21} } -func (m *QueryGetCrosschainFlagsRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryHasVotedResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetCrosschainFlagsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryHasVotedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetCrosschainFlagsRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryHasVotedResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1022,34 +1063,41 @@ func (m *QueryGetCrosschainFlagsRequest) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } -func (m *QueryGetCrosschainFlagsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetCrosschainFlagsRequest.Merge(m, src) +func (m *QueryHasVotedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryHasVotedResponse.Merge(m, src) } -func (m *QueryGetCrosschainFlagsRequest) XXX_Size() int { +func (m *QueryHasVotedResponse) XXX_Size() int { return m.Size() } -func (m *QueryGetCrosschainFlagsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetCrosschainFlagsRequest.DiscardUnknown(m) +func (m *QueryHasVotedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryHasVotedResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetCrosschainFlagsRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryHasVotedResponse proto.InternalMessageInfo -type QueryGetCrosschainFlagsResponse struct { - CrosschainFlags CrosschainFlags `protobuf:"bytes,1,opt,name=crosschain_flags,json=crosschainFlags,proto3" json:"crosschain_flags"` +func (m *QueryHasVotedResponse) GetHasVoted() bool { + if m != nil { + return m.HasVoted + } + return false } -func (m *QueryGetCrosschainFlagsResponse) Reset() { *m = QueryGetCrosschainFlagsResponse{} } -func (m *QueryGetCrosschainFlagsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetCrosschainFlagsResponse) ProtoMessage() {} -func (*QueryGetCrosschainFlagsResponse) Descriptor() ([]byte, []int) { +type QueryBallotByIdentifierRequest struct { + BallotIdentifier string `protobuf:"bytes,1,opt,name=ballot_identifier,json=ballotIdentifier,proto3" json:"ballot_identifier,omitempty"` +} + +func (m *QueryBallotByIdentifierRequest) Reset() { *m = QueryBallotByIdentifierRequest{} } +func (m *QueryBallotByIdentifierRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBallotByIdentifierRequest) ProtoMessage() {} +func (*QueryBallotByIdentifierRequest) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{22} } -func (m *QueryGetCrosschainFlagsResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryBallotByIdentifierRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetCrosschainFlagsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryBallotByIdentifierRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetCrosschainFlagsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryBallotByIdentifierRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1059,40 +1107,42 @@ func (m *QueryGetCrosschainFlagsResponse) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } -func (m *QueryGetCrosschainFlagsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetCrosschainFlagsResponse.Merge(m, src) +func (m *QueryBallotByIdentifierRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBallotByIdentifierRequest.Merge(m, src) } -func (m *QueryGetCrosschainFlagsResponse) XXX_Size() int { +func (m *QueryBallotByIdentifierRequest) XXX_Size() int { return m.Size() } -func (m *QueryGetCrosschainFlagsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetCrosschainFlagsResponse.DiscardUnknown(m) +func (m *QueryBallotByIdentifierRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBallotByIdentifierRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetCrosschainFlagsResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryBallotByIdentifierRequest proto.InternalMessageInfo -func (m *QueryGetCrosschainFlagsResponse) GetCrosschainFlags() CrosschainFlags { +func (m *QueryBallotByIdentifierRequest) GetBallotIdentifier() string { if m != nil { - return m.CrosschainFlags + return m.BallotIdentifier } - return CrosschainFlags{} + return "" } -type QueryGetKeygenRequest struct { +type VoterList struct { + VoterAddress string `protobuf:"bytes,1,opt,name=voter_address,json=voterAddress,proto3" json:"voter_address,omitempty"` + VoteType VoteType `protobuf:"varint,2,opt,name=vote_type,json=voteType,proto3,enum=zetachain.zetacore.observer.VoteType" json:"vote_type,omitempty"` } -func (m *QueryGetKeygenRequest) Reset() { *m = QueryGetKeygenRequest{} } -func (m *QueryGetKeygenRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetKeygenRequest) ProtoMessage() {} -func (*QueryGetKeygenRequest) Descriptor() ([]byte, []int) { +func (m *VoterList) Reset() { *m = VoterList{} } +func (m *VoterList) String() string { return proto.CompactTextString(m) } +func (*VoterList) ProtoMessage() {} +func (*VoterList) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{23} } -func (m *QueryGetKeygenRequest) XXX_Unmarshal(b []byte) error { +func (m *VoterList) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetKeygenRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *VoterList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetKeygenRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_VoterList.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1102,34 +1152,51 @@ func (m *QueryGetKeygenRequest) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *QueryGetKeygenRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetKeygenRequest.Merge(m, src) +func (m *VoterList) XXX_Merge(src proto.Message) { + xxx_messageInfo_VoterList.Merge(m, src) } -func (m *QueryGetKeygenRequest) XXX_Size() int { +func (m *VoterList) XXX_Size() int { return m.Size() } -func (m *QueryGetKeygenRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetKeygenRequest.DiscardUnknown(m) +func (m *VoterList) XXX_DiscardUnknown() { + xxx_messageInfo_VoterList.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetKeygenRequest proto.InternalMessageInfo +var xxx_messageInfo_VoterList proto.InternalMessageInfo -type QueryGetKeygenResponse struct { - Keygen *Keygen `protobuf:"bytes,1,opt,name=keygen,proto3" json:"keygen,omitempty"` +func (m *VoterList) GetVoterAddress() string { + if m != nil { + return m.VoterAddress + } + return "" } -func (m *QueryGetKeygenResponse) Reset() { *m = QueryGetKeygenResponse{} } -func (m *QueryGetKeygenResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetKeygenResponse) ProtoMessage() {} -func (*QueryGetKeygenResponse) Descriptor() ([]byte, []int) { +func (m *VoterList) GetVoteType() VoteType { + if m != nil { + return m.VoteType + } + return VoteType_SuccessObservation +} + +type QueryBallotByIdentifierResponse struct { + BallotIdentifier string `protobuf:"bytes,1,opt,name=ballot_identifier,json=ballotIdentifier,proto3" json:"ballot_identifier,omitempty"` + Voters []*VoterList `protobuf:"bytes,2,rep,name=voters,proto3" json:"voters,omitempty"` + ObservationType ObservationType `protobuf:"varint,3,opt,name=observation_type,json=observationType,proto3,enum=zetachain.zetacore.observer.ObservationType" json:"observation_type,omitempty"` + BallotStatus BallotStatus `protobuf:"varint,4,opt,name=ballot_status,json=ballotStatus,proto3,enum=zetachain.zetacore.observer.BallotStatus" json:"ballot_status,omitempty"` +} + +func (m *QueryBallotByIdentifierResponse) Reset() { *m = QueryBallotByIdentifierResponse{} } +func (m *QueryBallotByIdentifierResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBallotByIdentifierResponse) ProtoMessage() {} +func (*QueryBallotByIdentifierResponse) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{24} } -func (m *QueryGetKeygenResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryBallotByIdentifierResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetKeygenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryBallotByIdentifierResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetKeygenResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryBallotByIdentifierResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1139,40 +1206,62 @@ func (m *QueryGetKeygenResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *QueryGetKeygenResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetKeygenResponse.Merge(m, src) +func (m *QueryBallotByIdentifierResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBallotByIdentifierResponse.Merge(m, src) } -func (m *QueryGetKeygenResponse) XXX_Size() int { +func (m *QueryBallotByIdentifierResponse) XXX_Size() int { return m.Size() } -func (m *QueryGetKeygenResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetKeygenResponse.DiscardUnknown(m) +func (m *QueryBallotByIdentifierResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBallotByIdentifierResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetKeygenResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryBallotByIdentifierResponse proto.InternalMessageInfo -func (m *QueryGetKeygenResponse) GetKeygen() *Keygen { +func (m *QueryBallotByIdentifierResponse) GetBallotIdentifier() string { if m != nil { - return m.Keygen + return m.BallotIdentifier + } + return "" +} + +func (m *QueryBallotByIdentifierResponse) GetVoters() []*VoterList { + if m != nil { + return m.Voters } return nil } -type QueryShowObserverCountRequest struct { +func (m *QueryBallotByIdentifierResponse) GetObservationType() ObservationType { + if m != nil { + return m.ObservationType + } + return ObservationType_EmptyObserverType } -func (m *QueryShowObserverCountRequest) Reset() { *m = QueryShowObserverCountRequest{} } -func (m *QueryShowObserverCountRequest) String() string { return proto.CompactTextString(m) } -func (*QueryShowObserverCountRequest) ProtoMessage() {} -func (*QueryShowObserverCountRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{25} +func (m *QueryBallotByIdentifierResponse) GetBallotStatus() BallotStatus { + if m != nil { + return m.BallotStatus + } + return BallotStatus_BallotFinalized_SuccessObservation } -func (m *QueryShowObserverCountRequest) XXX_Unmarshal(b []byte) error { + +type QueryObserversByChainRequest struct { + ObservationChain string `protobuf:"bytes,1,opt,name=observation_chain,json=observationChain,proto3" json:"observation_chain,omitempty"` +} + +func (m *QueryObserversByChainRequest) Reset() { *m = QueryObserversByChainRequest{} } +func (m *QueryObserversByChainRequest) String() string { return proto.CompactTextString(m) } +func (*QueryObserversByChainRequest) ProtoMessage() {} +func (*QueryObserversByChainRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{25} +} +func (m *QueryObserversByChainRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryShowObserverCountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryObserversByChainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryShowObserverCountRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryObserversByChainRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1182,34 +1271,41 @@ func (m *QueryShowObserverCountRequest) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } -func (m *QueryShowObserverCountRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryShowObserverCountRequest.Merge(m, src) +func (m *QueryObserversByChainRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryObserversByChainRequest.Merge(m, src) } -func (m *QueryShowObserverCountRequest) XXX_Size() int { +func (m *QueryObserversByChainRequest) XXX_Size() int { return m.Size() } -func (m *QueryShowObserverCountRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryShowObserverCountRequest.DiscardUnknown(m) +func (m *QueryObserversByChainRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryObserversByChainRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryShowObserverCountRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryObserversByChainRequest proto.InternalMessageInfo -type QueryShowObserverCountResponse struct { - LastObserverCount *LastObserverCount `protobuf:"bytes,1,opt,name=last_observer_count,json=lastObserverCount,proto3" json:"last_observer_count,omitempty"` +func (m *QueryObserversByChainRequest) GetObservationChain() string { + if m != nil { + return m.ObservationChain + } + return "" } -func (m *QueryShowObserverCountResponse) Reset() { *m = QueryShowObserverCountResponse{} } -func (m *QueryShowObserverCountResponse) String() string { return proto.CompactTextString(m) } -func (*QueryShowObserverCountResponse) ProtoMessage() {} -func (*QueryShowObserverCountResponse) Descriptor() ([]byte, []int) { +type QueryObserversByChainResponse struct { + Observers []string `protobuf:"bytes,1,rep,name=observers,proto3" json:"observers,omitempty"` +} + +func (m *QueryObserversByChainResponse) Reset() { *m = QueryObserversByChainResponse{} } +func (m *QueryObserversByChainResponse) String() string { return proto.CompactTextString(m) } +func (*QueryObserversByChainResponse) ProtoMessage() {} +func (*QueryObserversByChainResponse) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{26} } -func (m *QueryShowObserverCountResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryObserversByChainResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryShowObserverCountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryObserversByChainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryShowObserverCountResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryObserversByChainResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1219,41 +1315,40 @@ func (m *QueryShowObserverCountResponse) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } -func (m *QueryShowObserverCountResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryShowObserverCountResponse.Merge(m, src) +func (m *QueryObserversByChainResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryObserversByChainResponse.Merge(m, src) } -func (m *QueryShowObserverCountResponse) XXX_Size() int { +func (m *QueryObserversByChainResponse) XXX_Size() int { return m.Size() } -func (m *QueryShowObserverCountResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryShowObserverCountResponse.DiscardUnknown(m) +func (m *QueryObserversByChainResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryObserversByChainResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryShowObserverCountResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryObserversByChainResponse proto.InternalMessageInfo -func (m *QueryShowObserverCountResponse) GetLastObserverCount() *LastObserverCount { +func (m *QueryObserversByChainResponse) GetObservers() []string { if m != nil { - return m.LastObserverCount + return m.Observers } return nil } -type QueryBlameByIdentifierRequest struct { - BlameIdentifier string `protobuf:"bytes,1,opt,name=blame_identifier,json=blameIdentifier,proto3" json:"blame_identifier,omitempty"` +type QueryAllObserverMappersRequest struct { } -func (m *QueryBlameByIdentifierRequest) Reset() { *m = QueryBlameByIdentifierRequest{} } -func (m *QueryBlameByIdentifierRequest) String() string { return proto.CompactTextString(m) } -func (*QueryBlameByIdentifierRequest) ProtoMessage() {} -func (*QueryBlameByIdentifierRequest) Descriptor() ([]byte, []int) { +func (m *QueryAllObserverMappersRequest) Reset() { *m = QueryAllObserverMappersRequest{} } +func (m *QueryAllObserverMappersRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllObserverMappersRequest) ProtoMessage() {} +func (*QueryAllObserverMappersRequest) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{27} } -func (m *QueryBlameByIdentifierRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryAllObserverMappersRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryBlameByIdentifierRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllObserverMappersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryBlameByIdentifierRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllObserverMappersRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1263,41 +1358,34 @@ func (m *QueryBlameByIdentifierRequest) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } -func (m *QueryBlameByIdentifierRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryBlameByIdentifierRequest.Merge(m, src) +func (m *QueryAllObserverMappersRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllObserverMappersRequest.Merge(m, src) } -func (m *QueryBlameByIdentifierRequest) XXX_Size() int { +func (m *QueryAllObserverMappersRequest) XXX_Size() int { return m.Size() } -func (m *QueryBlameByIdentifierRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryBlameByIdentifierRequest.DiscardUnknown(m) +func (m *QueryAllObserverMappersRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllObserverMappersRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryBlameByIdentifierRequest proto.InternalMessageInfo - -func (m *QueryBlameByIdentifierRequest) GetBlameIdentifier() string { - if m != nil { - return m.BlameIdentifier - } - return "" -} +var xxx_messageInfo_QueryAllObserverMappersRequest proto.InternalMessageInfo -type QueryBlameByIdentifierResponse struct { - BlameInfo *Blame `protobuf:"bytes,1,opt,name=blame_info,json=blameInfo,proto3" json:"blame_info,omitempty"` +type QueryAllObserverMappersResponse struct { + ObserverMappers []*ObserverMapper `protobuf:"bytes,1,rep,name=observer_mappers,json=observerMappers,proto3" json:"observer_mappers,omitempty"` } -func (m *QueryBlameByIdentifierResponse) Reset() { *m = QueryBlameByIdentifierResponse{} } -func (m *QueryBlameByIdentifierResponse) String() string { return proto.CompactTextString(m) } -func (*QueryBlameByIdentifierResponse) ProtoMessage() {} -func (*QueryBlameByIdentifierResponse) Descriptor() ([]byte, []int) { +func (m *QueryAllObserverMappersResponse) Reset() { *m = QueryAllObserverMappersResponse{} } +func (m *QueryAllObserverMappersResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllObserverMappersResponse) ProtoMessage() {} +func (*QueryAllObserverMappersResponse) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{28} } -func (m *QueryBlameByIdentifierResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryAllObserverMappersResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryBlameByIdentifierResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllObserverMappersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryBlameByIdentifierResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllObserverMappersResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1307,40 +1395,40 @@ func (m *QueryBlameByIdentifierResponse) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } -func (m *QueryBlameByIdentifierResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryBlameByIdentifierResponse.Merge(m, src) +func (m *QueryAllObserverMappersResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllObserverMappersResponse.Merge(m, src) } -func (m *QueryBlameByIdentifierResponse) XXX_Size() int { +func (m *QueryAllObserverMappersResponse) XXX_Size() int { return m.Size() } -func (m *QueryBlameByIdentifierResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryBlameByIdentifierResponse.DiscardUnknown(m) +func (m *QueryAllObserverMappersResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllObserverMappersResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryBlameByIdentifierResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryAllObserverMappersResponse proto.InternalMessageInfo -func (m *QueryBlameByIdentifierResponse) GetBlameInfo() *Blame { +func (m *QueryAllObserverMappersResponse) GetObserverMappers() []*ObserverMapper { if m != nil { - return m.BlameInfo + return m.ObserverMappers } return nil } -type QueryAllBlameRecordsRequest struct { +type QuerySupportedChains struct { } -func (m *QueryAllBlameRecordsRequest) Reset() { *m = QueryAllBlameRecordsRequest{} } -func (m *QueryAllBlameRecordsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllBlameRecordsRequest) ProtoMessage() {} -func (*QueryAllBlameRecordsRequest) Descriptor() ([]byte, []int) { +func (m *QuerySupportedChains) Reset() { *m = QuerySupportedChains{} } +func (m *QuerySupportedChains) String() string { return proto.CompactTextString(m) } +func (*QuerySupportedChains) ProtoMessage() {} +func (*QuerySupportedChains) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{29} } -func (m *QueryAllBlameRecordsRequest) XXX_Unmarshal(b []byte) error { +func (m *QuerySupportedChains) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllBlameRecordsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QuerySupportedChains) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllBlameRecordsRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QuerySupportedChains.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1350,34 +1438,34 @@ func (m *QueryAllBlameRecordsRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryAllBlameRecordsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllBlameRecordsRequest.Merge(m, src) +func (m *QuerySupportedChains) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySupportedChains.Merge(m, src) } -func (m *QueryAllBlameRecordsRequest) XXX_Size() int { +func (m *QuerySupportedChains) XXX_Size() int { return m.Size() } -func (m *QueryAllBlameRecordsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllBlameRecordsRequest.DiscardUnknown(m) +func (m *QuerySupportedChains) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySupportedChains.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllBlameRecordsRequest proto.InternalMessageInfo +var xxx_messageInfo_QuerySupportedChains proto.InternalMessageInfo -type QueryAllBlameRecordsResponse struct { - BlameInfo []*Blame `protobuf:"bytes,1,rep,name=blame_info,json=blameInfo,proto3" json:"blame_info,omitempty"` +type QuerySupportedChainsResponse struct { + Chains []*common.Chain `protobuf:"bytes,1,rep,name=chains,proto3" json:"chains,omitempty"` } -func (m *QueryAllBlameRecordsResponse) Reset() { *m = QueryAllBlameRecordsResponse{} } -func (m *QueryAllBlameRecordsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllBlameRecordsResponse) ProtoMessage() {} -func (*QueryAllBlameRecordsResponse) Descriptor() ([]byte, []int) { +func (m *QuerySupportedChainsResponse) Reset() { *m = QuerySupportedChainsResponse{} } +func (m *QuerySupportedChainsResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySupportedChainsResponse) ProtoMessage() {} +func (*QuerySupportedChainsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{30} } -func (m *QueryAllBlameRecordsResponse) XXX_Unmarshal(b []byte) error { +func (m *QuerySupportedChainsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllBlameRecordsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QuerySupportedChainsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllBlameRecordsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QuerySupportedChainsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1387,42 +1475,41 @@ func (m *QueryAllBlameRecordsResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryAllBlameRecordsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllBlameRecordsResponse.Merge(m, src) +func (m *QuerySupportedChainsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySupportedChainsResponse.Merge(m, src) } -func (m *QueryAllBlameRecordsResponse) XXX_Size() int { +func (m *QuerySupportedChainsResponse) XXX_Size() int { return m.Size() } -func (m *QueryAllBlameRecordsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllBlameRecordsResponse.DiscardUnknown(m) +func (m *QuerySupportedChainsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySupportedChainsResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllBlameRecordsResponse proto.InternalMessageInfo +var xxx_messageInfo_QuerySupportedChainsResponse proto.InternalMessageInfo -func (m *QueryAllBlameRecordsResponse) GetBlameInfo() []*Blame { +func (m *QuerySupportedChainsResponse) GetChains() []*common.Chain { if m != nil { - return m.BlameInfo + return m.Chains } return nil } -type QueryBlameByChainAndNonceRequest struct { +type QueryGetCoreParamsForChainRequest struct { ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - Nonce int64 `protobuf:"varint,2,opt,name=nonce,proto3" json:"nonce,omitempty"` } -func (m *QueryBlameByChainAndNonceRequest) Reset() { *m = QueryBlameByChainAndNonceRequest{} } -func (m *QueryBlameByChainAndNonceRequest) String() string { return proto.CompactTextString(m) } -func (*QueryBlameByChainAndNonceRequest) ProtoMessage() {} -func (*QueryBlameByChainAndNonceRequest) Descriptor() ([]byte, []int) { +func (m *QueryGetCoreParamsForChainRequest) Reset() { *m = QueryGetCoreParamsForChainRequest{} } +func (m *QueryGetCoreParamsForChainRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetCoreParamsForChainRequest) ProtoMessage() {} +func (*QueryGetCoreParamsForChainRequest) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{31} } -func (m *QueryBlameByChainAndNonceRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryGetCoreParamsForChainRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryBlameByChainAndNonceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetCoreParamsForChainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryBlameByChainAndNonceRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetCoreParamsForChainRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1432,48 +1519,41 @@ func (m *QueryBlameByChainAndNonceRequest) XXX_Marshal(b []byte, deterministic b return b[:n], nil } } -func (m *QueryBlameByChainAndNonceRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryBlameByChainAndNonceRequest.Merge(m, src) +func (m *QueryGetCoreParamsForChainRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetCoreParamsForChainRequest.Merge(m, src) } -func (m *QueryBlameByChainAndNonceRequest) XXX_Size() int { +func (m *QueryGetCoreParamsForChainRequest) XXX_Size() int { return m.Size() } -func (m *QueryBlameByChainAndNonceRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryBlameByChainAndNonceRequest.DiscardUnknown(m) +func (m *QueryGetCoreParamsForChainRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetCoreParamsForChainRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryBlameByChainAndNonceRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryGetCoreParamsForChainRequest proto.InternalMessageInfo -func (m *QueryBlameByChainAndNonceRequest) GetChainId() int64 { +func (m *QueryGetCoreParamsForChainRequest) GetChainId() int64 { if m != nil { return m.ChainId } return 0 } -func (m *QueryBlameByChainAndNonceRequest) GetNonce() int64 { - if m != nil { - return m.Nonce - } - return 0 -} - -type QueryBlameByChainAndNonceResponse struct { - BlameInfo []*Blame `protobuf:"bytes,1,rep,name=blame_info,json=blameInfo,proto3" json:"blame_info,omitempty"` +type QueryGetCoreParamsForChainResponse struct { + CoreParams *CoreParams `protobuf:"bytes,1,opt,name=core_params,json=coreParams,proto3" json:"core_params,omitempty"` } -func (m *QueryBlameByChainAndNonceResponse) Reset() { *m = QueryBlameByChainAndNonceResponse{} } -func (m *QueryBlameByChainAndNonceResponse) String() string { return proto.CompactTextString(m) } -func (*QueryBlameByChainAndNonceResponse) ProtoMessage() {} -func (*QueryBlameByChainAndNonceResponse) Descriptor() ([]byte, []int) { +func (m *QueryGetCoreParamsForChainResponse) Reset() { *m = QueryGetCoreParamsForChainResponse{} } +func (m *QueryGetCoreParamsForChainResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetCoreParamsForChainResponse) ProtoMessage() {} +func (*QueryGetCoreParamsForChainResponse) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{32} } -func (m *QueryBlameByChainAndNonceResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryGetCoreParamsForChainResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryBlameByChainAndNonceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetCoreParamsForChainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryBlameByChainAndNonceResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetCoreParamsForChainResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1483,41 +1563,40 @@ func (m *QueryBlameByChainAndNonceResponse) XXX_Marshal(b []byte, deterministic return b[:n], nil } } -func (m *QueryBlameByChainAndNonceResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryBlameByChainAndNonceResponse.Merge(m, src) +func (m *QueryGetCoreParamsForChainResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetCoreParamsForChainResponse.Merge(m, src) } -func (m *QueryBlameByChainAndNonceResponse) XXX_Size() int { +func (m *QueryGetCoreParamsForChainResponse) XXX_Size() int { return m.Size() } -func (m *QueryBlameByChainAndNonceResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryBlameByChainAndNonceResponse.DiscardUnknown(m) +func (m *QueryGetCoreParamsForChainResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetCoreParamsForChainResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryBlameByChainAndNonceResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryGetCoreParamsForChainResponse proto.InternalMessageInfo -func (m *QueryBlameByChainAndNonceResponse) GetBlameInfo() []*Blame { +func (m *QueryGetCoreParamsForChainResponse) GetCoreParams() *CoreParams { if m != nil { - return m.BlameInfo + return m.CoreParams } return nil } -type QueryAllBlockHeaderRequest struct { - Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +type QueryGetCoreParamsRequest struct { } -func (m *QueryAllBlockHeaderRequest) Reset() { *m = QueryAllBlockHeaderRequest{} } -func (m *QueryAllBlockHeaderRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllBlockHeaderRequest) ProtoMessage() {} -func (*QueryAllBlockHeaderRequest) Descriptor() ([]byte, []int) { +func (m *QueryGetCoreParamsRequest) Reset() { *m = QueryGetCoreParamsRequest{} } +func (m *QueryGetCoreParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetCoreParamsRequest) ProtoMessage() {} +func (*QueryGetCoreParamsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{33} } -func (m *QueryAllBlockHeaderRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryGetCoreParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllBlockHeaderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetCoreParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllBlockHeaderRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetCoreParamsRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1527,42 +1606,34 @@ func (m *QueryAllBlockHeaderRequest) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *QueryAllBlockHeaderRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllBlockHeaderRequest.Merge(m, src) +func (m *QueryGetCoreParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetCoreParamsRequest.Merge(m, src) } -func (m *QueryAllBlockHeaderRequest) XXX_Size() int { +func (m *QueryGetCoreParamsRequest) XXX_Size() int { return m.Size() } -func (m *QueryAllBlockHeaderRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllBlockHeaderRequest.DiscardUnknown(m) +func (m *QueryGetCoreParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetCoreParamsRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllBlockHeaderRequest proto.InternalMessageInfo - -func (m *QueryAllBlockHeaderRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} +var xxx_messageInfo_QueryGetCoreParamsRequest proto.InternalMessageInfo -type QueryAllBlockHeaderResponse struct { - BlockHeaders []*common.BlockHeader `protobuf:"bytes,1,rep,name=block_headers,json=blockHeaders,proto3" json:"block_headers,omitempty"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +type QueryGetCoreParamsResponse struct { + CoreParams *CoreParamsList `protobuf:"bytes,1,opt,name=core_params,json=coreParams,proto3" json:"core_params,omitempty"` } -func (m *QueryAllBlockHeaderResponse) Reset() { *m = QueryAllBlockHeaderResponse{} } -func (m *QueryAllBlockHeaderResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllBlockHeaderResponse) ProtoMessage() {} -func (*QueryAllBlockHeaderResponse) Descriptor() ([]byte, []int) { +func (m *QueryGetCoreParamsResponse) Reset() { *m = QueryGetCoreParamsResponse{} } +func (m *QueryGetCoreParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetCoreParamsResponse) ProtoMessage() {} +func (*QueryGetCoreParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{34} } -func (m *QueryAllBlockHeaderResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryGetCoreParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryAllBlockHeaderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetCoreParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryAllBlockHeaderResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetCoreParamsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1572,48 +1643,41 @@ func (m *QueryAllBlockHeaderResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryAllBlockHeaderResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllBlockHeaderResponse.Merge(m, src) +func (m *QueryGetCoreParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetCoreParamsResponse.Merge(m, src) } -func (m *QueryAllBlockHeaderResponse) XXX_Size() int { +func (m *QueryGetCoreParamsResponse) XXX_Size() int { return m.Size() } -func (m *QueryAllBlockHeaderResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllBlockHeaderResponse.DiscardUnknown(m) +func (m *QueryGetCoreParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetCoreParamsResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryAllBlockHeaderResponse proto.InternalMessageInfo - -func (m *QueryAllBlockHeaderResponse) GetBlockHeaders() []*common.BlockHeader { - if m != nil { - return m.BlockHeaders - } - return nil -} +var xxx_messageInfo_QueryGetCoreParamsResponse proto.InternalMessageInfo -func (m *QueryAllBlockHeaderResponse) GetPagination() *query.PageResponse { +func (m *QueryGetCoreParamsResponse) GetCoreParams() *CoreParamsList { if m != nil { - return m.Pagination + return m.CoreParams } return nil } -type QueryGetBlockHeaderByHashRequest struct { - BlockHash []byte `protobuf:"bytes,1,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` +type QueryGetNodeAccountRequest struct { + Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` } -func (m *QueryGetBlockHeaderByHashRequest) Reset() { *m = QueryGetBlockHeaderByHashRequest{} } -func (m *QueryGetBlockHeaderByHashRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetBlockHeaderByHashRequest) ProtoMessage() {} -func (*QueryGetBlockHeaderByHashRequest) Descriptor() ([]byte, []int) { +func (m *QueryGetNodeAccountRequest) Reset() { *m = QueryGetNodeAccountRequest{} } +func (m *QueryGetNodeAccountRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetNodeAccountRequest) ProtoMessage() {} +func (*QueryGetNodeAccountRequest) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{35} } -func (m *QueryGetBlockHeaderByHashRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryGetNodeAccountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetBlockHeaderByHashRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetNodeAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetBlockHeaderByHashRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetNodeAccountRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1623,41 +1687,41 @@ func (m *QueryGetBlockHeaderByHashRequest) XXX_Marshal(b []byte, deterministic b return b[:n], nil } } -func (m *QueryGetBlockHeaderByHashRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetBlockHeaderByHashRequest.Merge(m, src) +func (m *QueryGetNodeAccountRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetNodeAccountRequest.Merge(m, src) } -func (m *QueryGetBlockHeaderByHashRequest) XXX_Size() int { +func (m *QueryGetNodeAccountRequest) XXX_Size() int { return m.Size() } -func (m *QueryGetBlockHeaderByHashRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetBlockHeaderByHashRequest.DiscardUnknown(m) +func (m *QueryGetNodeAccountRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetNodeAccountRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetBlockHeaderByHashRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryGetNodeAccountRequest proto.InternalMessageInfo -func (m *QueryGetBlockHeaderByHashRequest) GetBlockHash() []byte { +func (m *QueryGetNodeAccountRequest) GetIndex() string { if m != nil { - return m.BlockHash + return m.Index } - return nil + return "" } -type QueryGetBlockHeaderByHashResponse struct { - BlockHeader *common.BlockHeader `protobuf:"bytes,1,opt,name=block_header,json=blockHeader,proto3" json:"block_header,omitempty"` +type QueryGetNodeAccountResponse struct { + NodeAccount *NodeAccount `protobuf:"bytes,1,opt,name=node_account,json=nodeAccount,proto3" json:"node_account,omitempty"` } -func (m *QueryGetBlockHeaderByHashResponse) Reset() { *m = QueryGetBlockHeaderByHashResponse{} } -func (m *QueryGetBlockHeaderByHashResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetBlockHeaderByHashResponse) ProtoMessage() {} -func (*QueryGetBlockHeaderByHashResponse) Descriptor() ([]byte, []int) { +func (m *QueryGetNodeAccountResponse) Reset() { *m = QueryGetNodeAccountResponse{} } +func (m *QueryGetNodeAccountResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetNodeAccountResponse) ProtoMessage() {} +func (*QueryGetNodeAccountResponse) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{36} } -func (m *QueryGetBlockHeaderByHashResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryGetNodeAccountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetBlockHeaderByHashResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryGetNodeAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetBlockHeaderByHashResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryGetNodeAccountResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1667,41 +1731,41 @@ func (m *QueryGetBlockHeaderByHashResponse) XXX_Marshal(b []byte, deterministic return b[:n], nil } } -func (m *QueryGetBlockHeaderByHashResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetBlockHeaderByHashResponse.Merge(m, src) +func (m *QueryGetNodeAccountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetNodeAccountResponse.Merge(m, src) } -func (m *QueryGetBlockHeaderByHashResponse) XXX_Size() int { +func (m *QueryGetNodeAccountResponse) XXX_Size() int { return m.Size() } -func (m *QueryGetBlockHeaderByHashResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetBlockHeaderByHashResponse.DiscardUnknown(m) +func (m *QueryGetNodeAccountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetNodeAccountResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetBlockHeaderByHashResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryGetNodeAccountResponse proto.InternalMessageInfo -func (m *QueryGetBlockHeaderByHashResponse) GetBlockHeader() *common.BlockHeader { +func (m *QueryGetNodeAccountResponse) GetNodeAccount() *NodeAccount { if m != nil { - return m.BlockHeader + return m.NodeAccount } return nil } -type QueryGetBlockHeaderStateRequest struct { - ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` +type QueryAllNodeAccountRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryGetBlockHeaderStateRequest) Reset() { *m = QueryGetBlockHeaderStateRequest{} } -func (m *QueryGetBlockHeaderStateRequest) String() string { return proto.CompactTextString(m) } -func (*QueryGetBlockHeaderStateRequest) ProtoMessage() {} -func (*QueryGetBlockHeaderStateRequest) Descriptor() ([]byte, []int) { +func (m *QueryAllNodeAccountRequest) Reset() { *m = QueryAllNodeAccountRequest{} } +func (m *QueryAllNodeAccountRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllNodeAccountRequest) ProtoMessage() {} +func (*QueryAllNodeAccountRequest) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{37} } -func (m *QueryGetBlockHeaderStateRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryAllNodeAccountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetBlockHeaderStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllNodeAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetBlockHeaderStateRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllNodeAccountRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1711,41 +1775,42 @@ func (m *QueryGetBlockHeaderStateRequest) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } -func (m *QueryGetBlockHeaderStateRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetBlockHeaderStateRequest.Merge(m, src) +func (m *QueryAllNodeAccountRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllNodeAccountRequest.Merge(m, src) } -func (m *QueryGetBlockHeaderStateRequest) XXX_Size() int { +func (m *QueryAllNodeAccountRequest) XXX_Size() int { return m.Size() } -func (m *QueryGetBlockHeaderStateRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetBlockHeaderStateRequest.DiscardUnknown(m) +func (m *QueryAllNodeAccountRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllNodeAccountRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetBlockHeaderStateRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryAllNodeAccountRequest proto.InternalMessageInfo -func (m *QueryGetBlockHeaderStateRequest) GetChainId() int64 { +func (m *QueryAllNodeAccountRequest) GetPagination() *query.PageRequest { if m != nil { - return m.ChainId + return m.Pagination } - return 0 + return nil } -type QueryGetBlockHeaderStateResponse struct { - BlockHeaderState *BlockHeaderState `protobuf:"bytes,1,opt,name=block_header_state,json=blockHeaderState,proto3" json:"block_header_state,omitempty"` +type QueryAllNodeAccountResponse struct { + NodeAccount []*NodeAccount `protobuf:"bytes,1,rep,name=NodeAccount,proto3" json:"NodeAccount,omitempty"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryGetBlockHeaderStateResponse) Reset() { *m = QueryGetBlockHeaderStateResponse{} } -func (m *QueryGetBlockHeaderStateResponse) String() string { return proto.CompactTextString(m) } -func (*QueryGetBlockHeaderStateResponse) ProtoMessage() {} -func (*QueryGetBlockHeaderStateResponse) Descriptor() ([]byte, []int) { +func (m *QueryAllNodeAccountResponse) Reset() { *m = QueryAllNodeAccountResponse{} } +func (m *QueryAllNodeAccountResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllNodeAccountResponse) ProtoMessage() {} +func (*QueryAllNodeAccountResponse) Descriptor() ([]byte, []int) { return fileDescriptor_dcb801e455adaee4, []int{38} } -func (m *QueryGetBlockHeaderStateResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryAllNodeAccountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryGetBlockHeaderStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryAllNodeAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryGetBlockHeaderStateResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryAllNodeAccountResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1755,2186 +1820,2172 @@ func (m *QueryGetBlockHeaderStateResponse) XXX_Marshal(b []byte, deterministic b return b[:n], nil } } -func (m *QueryGetBlockHeaderStateResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryGetBlockHeaderStateResponse.Merge(m, src) +func (m *QueryAllNodeAccountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllNodeAccountResponse.Merge(m, src) } -func (m *QueryGetBlockHeaderStateResponse) XXX_Size() int { +func (m *QueryAllNodeAccountResponse) XXX_Size() int { return m.Size() } -func (m *QueryGetBlockHeaderStateResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryGetBlockHeaderStateResponse.DiscardUnknown(m) +func (m *QueryAllNodeAccountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllNodeAccountResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryGetBlockHeaderStateResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryAllNodeAccountResponse proto.InternalMessageInfo -func (m *QueryGetBlockHeaderStateResponse) GetBlockHeaderState() *BlockHeaderState { +func (m *QueryAllNodeAccountResponse) GetNodeAccount() []*NodeAccount { if m != nil { - return m.BlockHeaderState + return m.NodeAccount } return nil } -func init() { - proto.RegisterType((*QueryProveRequest)(nil), "zetachain.zetacore.observer.QueryProveRequest") - proto.RegisterType((*QueryProveResponse)(nil), "zetachain.zetacore.observer.QueryProveResponse") - proto.RegisterType((*QueryParamsRequest)(nil), "zetachain.zetacore.observer.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "zetachain.zetacore.observer.QueryParamsResponse") - proto.RegisterType((*QueryBallotByIdentifierRequest)(nil), "zetachain.zetacore.observer.QueryBallotByIdentifierRequest") - proto.RegisterType((*VoterList)(nil), "zetachain.zetacore.observer.VoterList") - proto.RegisterType((*QueryBallotByIdentifierResponse)(nil), "zetachain.zetacore.observer.QueryBallotByIdentifierResponse") - proto.RegisterType((*QueryObserversByChainRequest)(nil), "zetachain.zetacore.observer.QueryObserversByChainRequest") - proto.RegisterType((*QueryObserversByChainResponse)(nil), "zetachain.zetacore.observer.QueryObserversByChainResponse") - proto.RegisterType((*QueryAllObserverMappersRequest)(nil), "zetachain.zetacore.observer.QueryAllObserverMappersRequest") - proto.RegisterType((*QueryAllObserverMappersResponse)(nil), "zetachain.zetacore.observer.QueryAllObserverMappersResponse") - proto.RegisterType((*QuerySupportedChains)(nil), "zetachain.zetacore.observer.QuerySupportedChains") - proto.RegisterType((*QuerySupportedChainsResponse)(nil), "zetachain.zetacore.observer.QuerySupportedChainsResponse") - proto.RegisterType((*QueryGetCoreParamsForChainRequest)(nil), "zetachain.zetacore.observer.QueryGetCoreParamsForChainRequest") - proto.RegisterType((*QueryGetCoreParamsForChainResponse)(nil), "zetachain.zetacore.observer.QueryGetCoreParamsForChainResponse") - proto.RegisterType((*QueryGetCoreParamsRequest)(nil), "zetachain.zetacore.observer.QueryGetCoreParamsRequest") - proto.RegisterType((*QueryGetCoreParamsResponse)(nil), "zetachain.zetacore.observer.QueryGetCoreParamsResponse") - proto.RegisterType((*QueryGetNodeAccountRequest)(nil), "zetachain.zetacore.observer.QueryGetNodeAccountRequest") - proto.RegisterType((*QueryGetNodeAccountResponse)(nil), "zetachain.zetacore.observer.QueryGetNodeAccountResponse") - proto.RegisterType((*QueryAllNodeAccountRequest)(nil), "zetachain.zetacore.observer.QueryAllNodeAccountRequest") - proto.RegisterType((*QueryAllNodeAccountResponse)(nil), "zetachain.zetacore.observer.QueryAllNodeAccountResponse") - proto.RegisterType((*QueryGetCrosschainFlagsRequest)(nil), "zetachain.zetacore.observer.QueryGetCrosschainFlagsRequest") - proto.RegisterType((*QueryGetCrosschainFlagsResponse)(nil), "zetachain.zetacore.observer.QueryGetCrosschainFlagsResponse") - proto.RegisterType((*QueryGetKeygenRequest)(nil), "zetachain.zetacore.observer.QueryGetKeygenRequest") - proto.RegisterType((*QueryGetKeygenResponse)(nil), "zetachain.zetacore.observer.QueryGetKeygenResponse") - proto.RegisterType((*QueryShowObserverCountRequest)(nil), "zetachain.zetacore.observer.QueryShowObserverCountRequest") - proto.RegisterType((*QueryShowObserverCountResponse)(nil), "zetachain.zetacore.observer.QueryShowObserverCountResponse") - proto.RegisterType((*QueryBlameByIdentifierRequest)(nil), "zetachain.zetacore.observer.QueryBlameByIdentifierRequest") - proto.RegisterType((*QueryBlameByIdentifierResponse)(nil), "zetachain.zetacore.observer.QueryBlameByIdentifierResponse") - proto.RegisterType((*QueryAllBlameRecordsRequest)(nil), "zetachain.zetacore.observer.QueryAllBlameRecordsRequest") - proto.RegisterType((*QueryAllBlameRecordsResponse)(nil), "zetachain.zetacore.observer.QueryAllBlameRecordsResponse") - proto.RegisterType((*QueryBlameByChainAndNonceRequest)(nil), "zetachain.zetacore.observer.QueryBlameByChainAndNonceRequest") - proto.RegisterType((*QueryBlameByChainAndNonceResponse)(nil), "zetachain.zetacore.observer.QueryBlameByChainAndNonceResponse") - proto.RegisterType((*QueryAllBlockHeaderRequest)(nil), "zetachain.zetacore.observer.QueryAllBlockHeaderRequest") - proto.RegisterType((*QueryAllBlockHeaderResponse)(nil), "zetachain.zetacore.observer.QueryAllBlockHeaderResponse") - proto.RegisterType((*QueryGetBlockHeaderByHashRequest)(nil), "zetachain.zetacore.observer.QueryGetBlockHeaderByHashRequest") - proto.RegisterType((*QueryGetBlockHeaderByHashResponse)(nil), "zetachain.zetacore.observer.QueryGetBlockHeaderByHashResponse") - proto.RegisterType((*QueryGetBlockHeaderStateRequest)(nil), "zetachain.zetacore.observer.QueryGetBlockHeaderStateRequest") - proto.RegisterType((*QueryGetBlockHeaderStateResponse)(nil), "zetachain.zetacore.observer.QueryGetBlockHeaderStateResponse") +func (m *QueryAllNodeAccountResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil } -func init() { proto.RegisterFile("observer/query.proto", fileDescriptor_dcb801e455adaee4) } - -var fileDescriptor_dcb801e455adaee4 = []byte{ - // 1955 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x59, 0xcd, 0x6f, 0x1b, 0xc7, - 0x15, 0xf7, 0x4a, 0x91, 0x62, 0x3d, 0x49, 0x96, 0x34, 0xa6, 0x63, 0x79, 0x25, 0xd3, 0xea, 0xb8, - 0x76, 0xe4, 0x2f, 0x6e, 0x44, 0x03, 0x89, 0x1d, 0x5b, 0x4a, 0x49, 0x37, 0xfe, 0x8e, 0xe3, 0xd2, - 0x6d, 0x5a, 0x34, 0x68, 0x89, 0x25, 0x39, 0x22, 0x99, 0xac, 0x76, 0x98, 0xdd, 0x95, 0x22, 0x56, - 0x10, 0x5a, 0xf4, 0xdc, 0x43, 0x80, 0x02, 0x3d, 0xf7, 0xd4, 0x5b, 0x7b, 0xc8, 0xa5, 0x87, 0xa2, - 0x97, 0x5e, 0x9a, 0x53, 0x91, 0xa2, 0x40, 0x91, 0x1e, 0x5a, 0x18, 0x76, 0xfb, 0x7f, 0x14, 0x33, - 0xf3, 0x76, 0x39, 0x5c, 0xee, 0x92, 0x4b, 0xc1, 0x27, 0xee, 0x7c, 0xbc, 0x37, 0xbf, 0xdf, 0x9b, - 0x99, 0x37, 0xef, 0x07, 0x42, 0x8e, 0xd7, 0x7c, 0xe6, 0xed, 0x31, 0xcf, 0xfa, 0x6c, 0x97, 0x79, - 0xdd, 0x42, 0xc7, 0xe3, 0x01, 0x27, 0x2b, 0x3f, 0x63, 0x81, 0x5d, 0x6f, 0xd9, 0x6d, 0xb7, 0x20, - 0xbf, 0xb8, 0xc7, 0x0a, 0xe1, 0x44, 0xf3, 0x64, 0x9d, 0xef, 0xec, 0x70, 0xd7, 0x52, 0x3f, 0xca, - 0xc2, 0xbc, 0x5c, 0xe7, 0xfe, 0x0e, 0xf7, 0xad, 0x9a, 0xed, 0x33, 0xe5, 0xca, 0xda, 0xdb, 0xa8, - 0xb1, 0xc0, 0xde, 0xb0, 0x3a, 0x76, 0xb3, 0xed, 0xda, 0x41, 0x3b, 0x9a, 0x9b, 0x6b, 0xf2, 0x26, - 0x97, 0x9f, 0x96, 0xf8, 0xc2, 0xde, 0xd5, 0x26, 0xe7, 0x4d, 0x87, 0x59, 0x76, 0xa7, 0x6d, 0xd9, - 0xae, 0xcb, 0x03, 0x69, 0xe2, 0xe3, 0xe8, 0xa9, 0x08, 0x67, 0xcd, 0x76, 0x1c, 0x1e, 0x84, 0xae, - 0x7a, 0xdd, 0x8e, 0xbd, 0xc3, 0xb0, 0x77, 0x45, 0xeb, 0xe5, 0xf5, 0x4f, 0xab, 0x2d, 0x66, 0x37, - 0x98, 0x87, 0x83, 0xe7, 0xa2, 0xc1, 0xba, 0xc7, 0x7d, 0x5f, 0xb2, 0xac, 0x6e, 0x3b, 0x76, 0x73, - 0x70, 0xa9, 0x4f, 0x59, 0xb7, 0xc9, 0xdc, 0x01, 0xa7, 0x2e, 0x6f, 0xb0, 0xaa, 0x5d, 0xaf, 0xf3, - 0x5d, 0x37, 0xc4, 0x71, 0x3a, 0x1a, 0x0c, 0x3f, 0x06, 0x9c, 0x75, 0x6c, 0xcf, 0xde, 0xc1, 0x35, - 0xe8, 0xef, 0x0c, 0x58, 0xfa, 0x9e, 0x88, 0xd2, 0x53, 0x8f, 0xef, 0xb1, 0x0a, 0xfb, 0x6c, 0x97, - 0xf9, 0x01, 0x39, 0x03, 0xc7, 0x15, 0x9c, 0x76, 0x63, 0xd9, 0x58, 0x33, 0xd6, 0x27, 0x2b, 0xaf, - 0xcb, 0xf6, 0x83, 0x06, 0x39, 0x0d, 0xaf, 0x07, 0xfb, 0xd5, 0x96, 0xed, 0xb7, 0x96, 0x27, 0xd6, - 0x8c, 0xf5, 0x99, 0xca, 0x74, 0xb0, 0x7f, 0xdf, 0xf6, 0x5b, 0xe4, 0x3c, 0x4c, 0x75, 0x3c, 0xce, - 0xb7, 0x97, 0x27, 0xd7, 0x8c, 0xf5, 0xd9, 0xe2, 0x7c, 0x01, 0xb7, 0xe5, 0xa9, 0xe8, 0xac, 0xa8, - 0x31, 0x72, 0x16, 0x00, 0x23, 0x21, 0x1c, 0xbc, 0x26, 0x1d, 0xcc, 0xc8, 0x1e, 0xe9, 0xe3, 0x0c, - 0x1c, 0x0f, 0xf6, 0xab, 0x6d, 0xb7, 0xc1, 0xf6, 0x97, 0xa7, 0xd4, 0xba, 0xc1, 0xfe, 0x03, 0xd1, - 0xa4, 0x97, 0x81, 0xe8, 0x38, 0xfd, 0x0e, 0x77, 0x7d, 0x46, 0x72, 0x30, 0xb5, 0x67, 0x3b, 0x88, - 0xf2, 0x78, 0x45, 0x35, 0x68, 0x2e, 0x9c, 0x2b, 0x99, 0x22, 0x29, 0xfa, 0x23, 0x38, 0xd9, 0xd7, - 0x8b, 0x2e, 0x4a, 0x30, 0xad, 0x22, 0x22, 0x7d, 0xcc, 0x16, 0xcf, 0x17, 0x86, 0x9c, 0xb9, 0x82, - 0x32, 0x2e, 0xbf, 0xf6, 0xd5, 0x7f, 0xce, 0x1d, 0xab, 0xa0, 0x21, 0xfd, 0x00, 0xf2, 0xd2, 0x73, - 0x59, 0x9e, 0x88, 0x72, 0xf7, 0x41, 0x83, 0xb9, 0x41, 0x7b, 0xbb, 0xcd, 0xbc, 0x30, 0xa0, 0x57, - 0x60, 0x49, 0x1d, 0x97, 0x6a, 0x3b, 0x1a, 0x93, 0xeb, 0xcd, 0x54, 0x16, 0xd5, 0x40, 0xcf, 0x86, - 0x06, 0x30, 0xf3, 0x11, 0x0f, 0x98, 0xf7, 0xb8, 0xed, 0x07, 0xe4, 0x3c, 0xcc, 0xef, 0x89, 0x46, - 0xd5, 0x6e, 0x34, 0x3c, 0xe6, 0xfb, 0x68, 0x35, 0x27, 0x3b, 0x4b, 0xaa, 0x8f, 0x94, 0x61, 0x46, - 0xb4, 0xab, 0x41, 0xb7, 0xc3, 0xe4, 0xb6, 0x9c, 0x28, 0x5e, 0x18, 0x4a, 0x43, 0xf8, 0xff, 0x7e, - 0xb7, 0xc3, 0x2a, 0xc7, 0xf7, 0xf0, 0x8b, 0xfe, 0x71, 0x02, 0xce, 0xa5, 0xb2, 0xc0, 0x58, 0x8d, - 0x43, 0x83, 0x6c, 0xc1, 0xb4, 0x04, 0xe9, 0x2f, 0x4f, 0xac, 0x4d, 0xae, 0xcf, 0x16, 0x2f, 0x8e, - 0x44, 0x24, 0x19, 0x57, 0xd0, 0x8a, 0xfc, 0x10, 0x16, 0xd5, 0xa8, 0xbc, 0x7f, 0x8a, 0xdb, 0xa4, - 0xe4, 0x76, 0x75, 0xa8, 0xa7, 0x0f, 0x7b, 0x46, 0x92, 0xe2, 0x02, 0xef, 0xef, 0x20, 0x4f, 0x60, - 0x1e, 0x59, 0xf8, 0x81, 0x1d, 0xec, 0xfa, 0xf2, 0x1c, 0x9e, 0x28, 0x5e, 0x1a, 0xea, 0x55, 0x45, - 0xe5, 0x99, 0x34, 0xa8, 0xcc, 0xd5, 0xb4, 0x16, 0x7d, 0x04, 0xab, 0x32, 0x70, 0x1f, 0xe2, 0x5c, - 0xbf, 0xdc, 0xbd, 0x23, 0xbc, 0x68, 0x9b, 0xaf, 0x13, 0x91, 0x2b, 0x84, 0x51, 0xd3, 0x06, 0xa4, - 0x0d, 0xdd, 0x84, 0xb3, 0x29, 0xce, 0x70, 0x0f, 0x56, 0x61, 0x26, 0x04, 0x25, 0x0e, 0xc3, 0xa4, - 0xb8, 0x41, 0x51, 0x07, 0x5d, 0xc3, 0xa3, 0x58, 0x72, 0x9c, 0xd0, 0xc3, 0x07, 0x76, 0xa7, 0xc3, - 0xbc, 0xe8, 0x1a, 0x74, 0x71, 0x9b, 0x93, 0x66, 0xe0, 0x12, 0x1f, 0x85, 0x91, 0x67, 0x5e, 0x75, - 0x47, 0x8d, 0xc9, 0x95, 0x66, 0x8b, 0x57, 0x32, 0x44, 0x3e, 0xf4, 0x17, 0x06, 0x3e, 0xf2, 0x4f, - 0xdf, 0x80, 0x9c, 0x5c, 0xfa, 0xd9, 0x6e, 0xa7, 0xc3, 0xbd, 0x80, 0x35, 0x24, 0x33, 0x9f, 0xbe, - 0x8f, 0x01, 0x8c, 0xf5, 0x47, 0x78, 0x2e, 0xc0, 0xb4, 0x5c, 0x32, 0x44, 0x11, 0xe5, 0x16, 0x15, - 0x19, 0x1c, 0xa4, 0x5b, 0xf0, 0x2d, 0xe9, 0xe6, 0x1e, 0x0b, 0xee, 0x70, 0x8f, 0xa9, 0xab, 0x7a, - 0x97, 0x7b, 0x7d, 0x9b, 0x91, 0x9e, 0xda, 0xa8, 0x0b, 0x74, 0x98, 0x3d, 0x82, 0xb9, 0x0f, 0xb3, - 0x82, 0x75, 0xb5, 0x2f, 0x69, 0xbc, 0x39, 0x34, 0x2e, 0x3d, 0x6f, 0x15, 0xa8, 0x47, 0xdf, 0x74, - 0x05, 0xce, 0x0c, 0xae, 0x17, 0x6e, 0xd3, 0x27, 0x60, 0x26, 0x0d, 0x22, 0x88, 0xc7, 0x49, 0x20, - 0xae, 0x64, 0x04, 0x21, 0x6f, 0x99, 0x0e, 0xa4, 0xd8, 0x5b, 0xeb, 0x09, 0x6f, 0xb0, 0x92, 0x7a, - 0x51, 0xc2, 0x88, 0xe5, 0x60, 0x4a, 0x65, 0x64, 0x75, 0x64, 0x55, 0x83, 0x7e, 0x02, 0x2b, 0x89, - 0x36, 0x08, 0xf0, 0x11, 0xcc, 0xe9, 0xaf, 0x13, 0x22, 0x5c, 0x1f, 0x8a, 0x50, 0xf7, 0x33, 0xeb, - 0xf6, 0x1a, 0xb4, 0x81, 0xf8, 0x4a, 0x8e, 0x93, 0x80, 0xef, 0x2e, 0x40, 0xef, 0x65, 0xc7, 0x85, - 0x2e, 0x16, 0x54, 0x19, 0x50, 0x10, 0x65, 0x40, 0x41, 0x55, 0x14, 0x58, 0x06, 0x14, 0x9e, 0xda, - 0xcd, 0xf0, 0xa1, 0xab, 0x68, 0x96, 0xf4, 0x4b, 0x03, 0x29, 0xc5, 0x97, 0x41, 0x4a, 0x0f, 0x61, - 0x56, 0xeb, 0xc6, 0xa3, 0x38, 0x06, 0x23, 0xad, 0x41, 0xee, 0xf5, 0x61, 0x9e, 0xc0, 0x33, 0x34, - 0x0a, 0xb3, 0x02, 0xd2, 0x07, 0x3a, 0xbc, 0xef, 0xe2, 0x98, 0x44, 0x55, 0xc4, 0x5d, 0x51, 0x44, - 0x84, 0x07, 0xe9, 0x17, 0x06, 0x5e, 0xf8, 0xa4, 0x29, 0x48, 0xed, 0x27, 0xb0, 0x18, 0xaf, 0x41, - 0x30, 0x90, 0xc3, 0x53, 0x6d, 0xcc, 0x1f, 0x3e, 0x8b, 0x0b, 0xf5, 0xfe, 0x6e, 0x7a, 0x1a, 0x4e, - 0x85, 0x08, 0x1e, 0xc9, 0x4a, 0x26, 0xc4, 0xf6, 0x03, 0x78, 0x23, 0x3e, 0x80, 0x88, 0x6e, 0xc1, - 0xb4, 0x2a, 0x7a, 0x32, 0xbd, 0xca, 0x68, 0x8c, 0x26, 0xf4, 0x1c, 0xe6, 0xd0, 0x67, 0x2d, 0xfe, - 0x79, 0x98, 0x93, 0xee, 0x68, 0x47, 0x46, 0xc4, 0x24, 0x9f, 0x36, 0x03, 0x01, 0xfc, 0x14, 0x4e, - 0x3a, 0xb6, 0x1f, 0x54, 0xa3, 0x44, 0xa8, 0x9f, 0xe3, 0xc2, 0x50, 0x34, 0x8f, 0x6d, 0x3f, 0xe8, - 0x77, 0xba, 0xe4, 0xc4, 0xbb, 0xe8, 0x43, 0xc4, 0x58, 0x16, 0xe5, 0x62, 0x52, 0xc9, 0x70, 0x09, - 0x16, 0x65, 0x29, 0x39, 0xf8, 0xd4, 0x2e, 0xc8, 0x7e, 0xad, 0x60, 0xa8, 0x87, 0xf5, 0xc7, 0xa0, - 0xaf, 0xa8, 0xc8, 0x01, 0x74, 0xe6, 0x6e, 0x73, 0x24, 0x41, 0x87, 0xbf, 0x77, 0x62, 0xba, 0xa8, - 0xcd, 0xc4, 0x52, 0xee, 0x36, 0xa7, 0x67, 0x7b, 0xb7, 0x43, 0x8d, 0xb1, 0x3a, 0xf7, 0x1a, 0xd1, - 0x31, 0xb3, 0x31, 0x87, 0x0f, 0x0c, 0xa7, 0x20, 0x98, 0x1c, 0x1f, 0xc1, 0x33, 0x58, 0xd3, 0x69, - 0xca, 0xb4, 0x5c, 0x72, 0x1b, 0x4f, 0xb8, 0x5b, 0xcf, 0x52, 0xb9, 0xe6, 0x60, 0xca, 0x15, 0x53, - 0xe5, 0x75, 0x9b, 0xac, 0xa8, 0x06, 0xdd, 0xc6, 0x47, 0x23, 0xd9, 0xe9, 0xab, 0x03, 0xaf, 0xe5, - 0xb0, 0xb2, 0xac, 0x77, 0xa5, 0x14, 0x78, 0xd5, 0x39, 0xec, 0xb7, 0x86, 0xbe, 0x4b, 0xda, 0x32, - 0x48, 0xe4, 0x06, 0xcc, 0xeb, 0x4a, 0x24, 0x7c, 0x50, 0x4f, 0x86, 0x0f, 0xaa, 0x6e, 0x33, 0x57, - 0xeb, 0x35, 0xfc, 0x57, 0x97, 0xb1, 0x4a, 0xb8, 0x8b, 0xf7, 0x58, 0xa0, 0xad, 0x56, 0xee, 0x0a, - 0x01, 0x10, 0x86, 0xa3, 0x5f, 0x26, 0x88, 0x70, 0xcc, 0x69, 0x32, 0x81, 0x7e, 0xdc, 0x7b, 0xe8, - 0x13, 0x5c, 0x20, 0xd5, 0xb7, 0x61, 0x4e, 0xa7, 0x8a, 0x41, 0x4d, 0x64, 0x3a, 0xab, 0x31, 0xa5, - 0xb7, 0x7b, 0xe9, 0x52, 0x9b, 0x23, 0x4a, 0xbd, 0x0c, 0x87, 0x8c, 0xfe, 0x3c, 0x91, 0x1d, 0x5a, - 0x23, 0xb2, 0x8f, 0x81, 0xe8, 0xc8, 0x64, 0x15, 0xca, 0x10, 0xdf, 0xb5, 0x11, 0xa7, 0x2a, 0xe6, - 0x72, 0xb1, 0x16, 0xeb, 0x29, 0x7e, 0xb3, 0x0a, 0x53, 0x12, 0x01, 0xf9, 0xc2, 0x80, 0x69, 0xf5, - 0xc0, 0x13, 0x6b, 0xa8, 0xd7, 0x41, 0xad, 0x64, 0xbe, 0x95, 0xdd, 0x40, 0x91, 0xa2, 0xe7, 0x7f, - 0xf9, 0x8f, 0xff, 0xfe, 0x7a, 0xe2, 0x2c, 0x59, 0xb1, 0xc4, 0xfc, 0x6b, 0xd2, 0xd4, 0x8a, 0x69, - 0x4e, 0xf2, 0x4f, 0x03, 0xc8, 0xa0, 0xbc, 0x20, 0xb7, 0x46, 0xaf, 0x96, 0x2a, 0xad, 0xcc, 0xdb, - 0x47, 0x33, 0x46, 0xd8, 0xef, 0x4b, 0xd8, 0xef, 0x91, 0xcd, 0x44, 0xd8, 0x28, 0x13, 0x6a, 0x5d, - 0x2d, 0x09, 0x5b, 0x07, 0x03, 0x12, 0xe8, 0x90, 0xfc, 0xcd, 0x80, 0xc5, 0x78, 0xc5, 0x4e, 0x6e, - 0x8e, 0x46, 0x96, 0x22, 0x19, 0xcc, 0x77, 0x8f, 0x62, 0x8a, 0x94, 0xee, 0x48, 0x4a, 0x9b, 0xe4, - 0x56, 0x22, 0xa5, 0x48, 0x2a, 0x08, 0x56, 0x6a, 0xec, 0x60, 0x40, 0x9d, 0x1c, 0x92, 0xbf, 0x18, - 0x40, 0x06, 0x15, 0x42, 0x96, 0x9d, 0x4a, 0x55, 0x1e, 0x59, 0x76, 0x2a, 0x5d, 0x94, 0xd0, 0x0d, - 0x49, 0xeb, 0x0a, 0xb9, 0x94, 0x48, 0xcb, 0x76, 0x9c, 0x6a, 0x5c, 0xb3, 0x90, 0xdf, 0x1b, 0xb0, - 0x10, 0xd3, 0x14, 0x64, 0x63, 0x34, 0x88, 0x98, 0x89, 0x79, 0x73, 0x6c, 0x93, 0x08, 0xf4, 0x55, - 0x09, 0xfa, 0x22, 0xf9, 0x76, 0x22, 0x68, 0x3f, 0x86, 0xed, 0xdf, 0x06, 0x9c, 0x4a, 0x14, 0x1f, - 0x64, 0x6b, 0x34, 0x84, 0x61, 0xaa, 0xc7, 0x7c, 0xef, 0xc8, 0xf6, 0x99, 0x0e, 0x55, 0x93, 0x05, - 0xd5, 0xba, 0xd3, 0x66, 0x6e, 0x80, 0x8a, 0xa4, 0xba, 0xcd, 0xbd, 0xf0, 0x74, 0x85, 0xa9, 0xf2, - 0x90, 0xfc, 0xc1, 0x80, 0xf9, 0xbe, 0x65, 0xc8, 0xdb, 0x63, 0xe2, 0x0a, 0xf9, 0xbc, 0x33, 0xb6, - 0x5d, 0xa6, 0x0d, 0x91, 0x3c, 0x7a, 0xba, 0x8a, 0x7c, 0x69, 0xf4, 0xd5, 0xfc, 0x24, 0xdb, 0xb2, - 0x83, 0x1a, 0xc5, 0xbc, 0x31, 0xbe, 0x21, 0x02, 0x7e, 0x4b, 0x02, 0xbe, 0x4c, 0xd6, 0x13, 0x01, - 0x6b, 0x2a, 0xc9, 0x3a, 0x90, 0xc2, 0xec, 0x50, 0x9c, 0xfa, 0x13, 0x9a, 0xa7, 0x92, 0xe3, 0x64, - 0xc1, 0x9d, 0xa8, 0xad, 0xb2, 0xe0, 0x4e, 0x56, 0x4b, 0x74, 0x5d, 0xe2, 0xa6, 0x64, 0x6d, 0x14, - 0x6e, 0xf2, 0x27, 0x03, 0x16, 0x62, 0x42, 0x22, 0x4b, 0x9e, 0x49, 0x55, 0x3c, 0x59, 0xf2, 0x4c, - 0xba, 0x16, 0xa2, 0xd7, 0x24, 0xf0, 0x37, 0xc9, 0x85, 0x44, 0xe0, 0x71, 0x99, 0x44, 0x7e, 0x63, - 0xc0, 0xb4, 0x92, 0x1f, 0xa4, 0x98, 0x69, 0xdd, 0x3e, 0x05, 0x64, 0x5e, 0x1f, 0xcb, 0x26, 0xd3, - 0x5b, 0xab, 0x44, 0x10, 0xf9, 0xab, 0x01, 0x4b, 0x03, 0xf2, 0x86, 0x64, 0x78, 0x58, 0xd2, 0x54, - 0x93, 0x79, 0xeb, 0x48, 0xb6, 0x88, 0xf9, 0xa6, 0xc4, 0x7c, 0x9d, 0x6c, 0xe8, 0x98, 0x43, 0x2f, - 0x5a, 0x4a, 0x6c, 0xf1, 0xcf, 0x63, 0x9a, 0x8b, 0xfc, 0xdd, 0x80, 0xa5, 0x01, 0x69, 0x93, 0x85, - 0x49, 0x9a, 0xb6, 0xca, 0xc2, 0x24, 0x55, 0x4b, 0x8d, 0x48, 0x85, 0x4a, 0x27, 0xc4, 0x2b, 0x86, - 0x98, 0x90, 0x3b, 0x24, 0x7f, 0x36, 0x80, 0xdc, 0x63, 0x41, 0x4c, 0x2d, 0x91, 0x6c, 0xf7, 0x2d, - 0x41, 0x7f, 0x65, 0x79, 0xa4, 0x52, 0xa4, 0x19, 0x2d, 0x4a, 0x42, 0x57, 0xc9, 0xe5, 0xd4, 0x9c, - 0x28, 0x5e, 0x57, 0xc5, 0xc1, 0x43, 0xa0, 0xcf, 0x0d, 0x38, 0x25, 0x9d, 0xf9, 0x31, 0xcd, 0x44, - 0x36, 0x33, 0xc7, 0x36, 0x49, 0xc0, 0x99, 0x5b, 0x47, 0x35, 0x47, 0x32, 0xf7, 0x25, 0x99, 0x32, - 0xf9, 0xce, 0xf0, 0xdd, 0x51, 0x57, 0xd8, 0x76, 0x1b, 0x55, 0x29, 0x03, 0xb5, 0x57, 0xca, 0x3a, - 0x90, 0x3d, 0x87, 0x22, 0x2f, 0x45, 0x5b, 0xa4, 0x09, 0xa1, 0x77, 0x32, 0x06, 0x3a, 0xae, 0xf1, - 0xcc, 0x1b, 0xe3, 0x1b, 0x8e, 0xb9, 0x41, 0x9a, 0xb0, 0x23, 0xff, 0x32, 0x20, 0x97, 0xa4, 0x8f, - 0xb2, 0xec, 0xcf, 0x10, 0x69, 0x66, 0x6e, 0x1d, 0xd5, 0x1c, 0xb9, 0x94, 0x25, 0x97, 0xdb, 0xe4, - 0xdd, 0x54, 0x2e, 0x7d, 0xda, 0xa8, 0xd6, 0x95, 0x1a, 0x50, 0x5c, 0xa1, 0x50, 0x0f, 0x1e, 0x92, - 0xff, 0x19, 0x60, 0x26, 0x08, 0xac, 0xb0, 0xee, 0xbe, 0x3d, 0x2e, 0x44, 0x5d, 0xdc, 0x99, 0x9b, - 0x47, 0xb4, 0x46, 0x7e, 0x0f, 0x25, 0xbf, 0xef, 0x92, 0x72, 0x36, 0x7e, 0x52, 0xfb, 0xf5, 0x0e, - 0x64, 0xbb, 0xa1, 0xd7, 0x4b, 0xbf, 0x32, 0x60, 0x4a, 0xfe, 0xdf, 0x45, 0x0a, 0x19, 0xf4, 0x98, - 0xf6, 0x07, 0x9e, 0x69, 0x65, 0x9e, 0x8f, 0xb0, 0xa9, 0x84, 0xbd, 0x4a, 0xcc, 0x64, 0xf9, 0x26, - 0xe6, 0x96, 0x1f, 0x7c, 0xf5, 0x22, 0x6f, 0x7c, 0xfd, 0x22, 0x6f, 0x3c, 0x7f, 0x91, 0x37, 0xbe, - 0x78, 0x99, 0x3f, 0xf6, 0xf5, 0xcb, 0xfc, 0xb1, 0x6f, 0x5e, 0xe6, 0x8f, 0xfd, 0xd8, 0x6a, 0xb6, - 0x83, 0xd6, 0x6e, 0x4d, 0x68, 0xeb, 0xc4, 0xf4, 0xbe, 0xdf, 0x73, 0x15, 0x74, 0x3b, 0xcc, 0xaf, - 0x4d, 0xcb, 0x7f, 0x1f, 0xaf, 0xff, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x17, 0xcc, 0x9e, 0x05, 0xf6, - 0x1d, 0x00, 0x00, +type QueryGetCrosschainFlagsRequest struct { } -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +func (m *QueryGetCrosschainFlagsRequest) Reset() { *m = QueryGetCrosschainFlagsRequest{} } +func (m *QueryGetCrosschainFlagsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetCrosschainFlagsRequest) ProtoMessage() {} +func (*QueryGetCrosschainFlagsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{39} +} +func (m *QueryGetCrosschainFlagsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetCrosschainFlagsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetCrosschainFlagsRequest.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 *QueryGetCrosschainFlagsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetCrosschainFlagsRequest.Merge(m, src) +} +func (m *QueryGetCrosschainFlagsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetCrosschainFlagsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetCrosschainFlagsRequest.DiscardUnknown(m) +} -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 +var xxx_messageInfo_QueryGetCrosschainFlagsRequest proto.InternalMessageInfo -// QueryClient is the client API for Query service. -// -// 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 { - // Parameters queries the parameters of the module. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // Queries a list of VoterByIdentifier items. - BallotByIdentifier(ctx context.Context, in *QueryBallotByIdentifierRequest, opts ...grpc.CallOption) (*QueryBallotByIdentifierResponse, error) - // Queries a list of ObserversByChainAndType items. - ObserversByChain(ctx context.Context, in *QueryObserversByChainRequest, opts ...grpc.CallOption) (*QueryObserversByChainResponse, error) - AllObserverMappers(ctx context.Context, in *QueryAllObserverMappersRequest, opts ...grpc.CallOption) (*QueryAllObserverMappersResponse, error) - SupportedChains(ctx context.Context, in *QuerySupportedChains, opts ...grpc.CallOption) (*QuerySupportedChainsResponse, error) - // Queries a list of GetClientParamsForChain items. - GetCoreParamsForChain(ctx context.Context, in *QueryGetCoreParamsForChainRequest, opts ...grpc.CallOption) (*QueryGetCoreParamsForChainResponse, error) - // Queries a list of GetCoreParams items. - GetCoreParams(ctx context.Context, in *QueryGetCoreParamsRequest, opts ...grpc.CallOption) (*QueryGetCoreParamsResponse, error) - // Queries a nodeAccount by index. - NodeAccount(ctx context.Context, in *QueryGetNodeAccountRequest, opts ...grpc.CallOption) (*QueryGetNodeAccountResponse, error) - // Queries a list of nodeAccount items. - NodeAccountAll(ctx context.Context, in *QueryAllNodeAccountRequest, opts ...grpc.CallOption) (*QueryAllNodeAccountResponse, error) - CrosschainFlags(ctx context.Context, in *QueryGetCrosschainFlagsRequest, opts ...grpc.CallOption) (*QueryGetCrosschainFlagsResponse, error) - // Queries a keygen by index. - Keygen(ctx context.Context, in *QueryGetKeygenRequest, opts ...grpc.CallOption) (*QueryGetKeygenResponse, error) - // Queries a list of ShowObserverCount items. - ShowObserverCount(ctx context.Context, in *QueryShowObserverCountRequest, opts ...grpc.CallOption) (*QueryShowObserverCountResponse, error) - // Queries a list of VoterByIdentifier items. - BlameByIdentifier(ctx context.Context, in *QueryBlameByIdentifierRequest, opts ...grpc.CallOption) (*QueryBlameByIdentifierResponse, error) - // Queries a list of VoterByIdentifier items. - GetAllBlameRecords(ctx context.Context, in *QueryAllBlameRecordsRequest, opts ...grpc.CallOption) (*QueryAllBlameRecordsResponse, error) - // Queries a list of VoterByIdentifier items. - BlamesByChainAndNonce(ctx context.Context, in *QueryBlameByChainAndNonceRequest, opts ...grpc.CallOption) (*QueryBlameByChainAndNonceResponse, error) - GetAllBlockHeaders(ctx context.Context, in *QueryAllBlockHeaderRequest, opts ...grpc.CallOption) (*QueryAllBlockHeaderResponse, error) - GetBlockHeaderByHash(ctx context.Context, in *QueryGetBlockHeaderByHashRequest, opts ...grpc.CallOption) (*QueryGetBlockHeaderByHashResponse, error) - GetBlockHeaderStateByChain(ctx context.Context, in *QueryGetBlockHeaderStateRequest, opts ...grpc.CallOption) (*QueryGetBlockHeaderStateResponse, error) - // merkle proof verification - Prove(ctx context.Context, in *QueryProveRequest, opts ...grpc.CallOption) (*QueryProveResponse, error) +type QueryGetCrosschainFlagsResponse struct { + CrosschainFlags CrosschainFlags `protobuf:"bytes,1,opt,name=crosschain_flags,json=crosschainFlags,proto3" json:"crosschain_flags"` } -type queryClient struct { - cc grpc1.ClientConn +func (m *QueryGetCrosschainFlagsResponse) Reset() { *m = QueryGetCrosschainFlagsResponse{} } +func (m *QueryGetCrosschainFlagsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetCrosschainFlagsResponse) ProtoMessage() {} +func (*QueryGetCrosschainFlagsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{40} } - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} +func (m *QueryGetCrosschainFlagsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/Params", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryGetCrosschainFlagsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetCrosschainFlagsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return out, nil } - -func (c *queryClient) BallotByIdentifier(ctx context.Context, in *QueryBallotByIdentifierRequest, opts ...grpc.CallOption) (*QueryBallotByIdentifierResponse, error) { - out := new(QueryBallotByIdentifierResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/BallotByIdentifier", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryGetCrosschainFlagsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetCrosschainFlagsResponse.Merge(m, src) } - -func (c *queryClient) ObserversByChain(ctx context.Context, in *QueryObserversByChainRequest, opts ...grpc.CallOption) (*QueryObserversByChainResponse, error) { - out := new(QueryObserversByChainResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/ObserversByChain", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryGetCrosschainFlagsResponse) XXX_Size() int { + return m.Size() } - -func (c *queryClient) AllObserverMappers(ctx context.Context, in *QueryAllObserverMappersRequest, opts ...grpc.CallOption) (*QueryAllObserverMappersResponse, error) { - out := new(QueryAllObserverMappersResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/AllObserverMappers", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryGetCrosschainFlagsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetCrosschainFlagsResponse.DiscardUnknown(m) } -func (c *queryClient) SupportedChains(ctx context.Context, in *QuerySupportedChains, opts ...grpc.CallOption) (*QuerySupportedChainsResponse, error) { - out := new(QuerySupportedChainsResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/SupportedChains", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} +var xxx_messageInfo_QueryGetCrosschainFlagsResponse proto.InternalMessageInfo -func (c *queryClient) GetCoreParamsForChain(ctx context.Context, in *QueryGetCoreParamsForChainRequest, opts ...grpc.CallOption) (*QueryGetCoreParamsForChainResponse, error) { - out := new(QueryGetCoreParamsForChainResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetCoreParamsForChain", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryGetCrosschainFlagsResponse) GetCrosschainFlags() CrosschainFlags { + if m != nil { + return m.CrosschainFlags } - return out, nil + return CrosschainFlags{} } -func (c *queryClient) GetCoreParams(ctx context.Context, in *QueryGetCoreParamsRequest, opts ...grpc.CallOption) (*QueryGetCoreParamsResponse, error) { - out := new(QueryGetCoreParamsResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetCoreParams", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +type QueryGetKeygenRequest struct { } -func (c *queryClient) NodeAccount(ctx context.Context, in *QueryGetNodeAccountRequest, opts ...grpc.CallOption) (*QueryGetNodeAccountResponse, error) { - out := new(QueryGetNodeAccountResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/NodeAccount", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryGetKeygenRequest) Reset() { *m = QueryGetKeygenRequest{} } +func (m *QueryGetKeygenRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetKeygenRequest) ProtoMessage() {} +func (*QueryGetKeygenRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{41} } - -func (c *queryClient) NodeAccountAll(ctx context.Context, in *QueryAllNodeAccountRequest, opts ...grpc.CallOption) (*QueryAllNodeAccountResponse, error) { - out := new(QueryAllNodeAccountResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/NodeAccountAll", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryGetKeygenRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } - -func (c *queryClient) CrosschainFlags(ctx context.Context, in *QueryGetCrosschainFlagsRequest, opts ...grpc.CallOption) (*QueryGetCrosschainFlagsResponse, error) { - out := new(QueryGetCrosschainFlagsResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/CrosschainFlags", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryGetKeygenRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetKeygenRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return out, nil } - -func (c *queryClient) Keygen(ctx context.Context, in *QueryGetKeygenRequest, opts ...grpc.CallOption) (*QueryGetKeygenResponse, error) { - out := new(QueryGetKeygenResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/Keygen", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryGetKeygenRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetKeygenRequest.Merge(m, src) } - -func (c *queryClient) ShowObserverCount(ctx context.Context, in *QueryShowObserverCountRequest, opts ...grpc.CallOption) (*QueryShowObserverCountResponse, error) { - out := new(QueryShowObserverCountResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/ShowObserverCount", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryGetKeygenRequest) XXX_Size() int { + return m.Size() } - -func (c *queryClient) BlameByIdentifier(ctx context.Context, in *QueryBlameByIdentifierRequest, opts ...grpc.CallOption) (*QueryBlameByIdentifierResponse, error) { - out := new(QueryBlameByIdentifierResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/BlameByIdentifier", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryGetKeygenRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetKeygenRequest.DiscardUnknown(m) } -func (c *queryClient) GetAllBlameRecords(ctx context.Context, in *QueryAllBlameRecordsRequest, opts ...grpc.CallOption) (*QueryAllBlameRecordsResponse, error) { - out := new(QueryAllBlameRecordsResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetAllBlameRecords", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} +var xxx_messageInfo_QueryGetKeygenRequest proto.InternalMessageInfo -func (c *queryClient) BlamesByChainAndNonce(ctx context.Context, in *QueryBlameByChainAndNonceRequest, opts ...grpc.CallOption) (*QueryBlameByChainAndNonceResponse, error) { - out := new(QueryBlameByChainAndNonceResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/BlamesByChainAndNonce", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +type QueryGetKeygenResponse struct { + Keygen *Keygen `protobuf:"bytes,1,opt,name=keygen,proto3" json:"keygen,omitempty"` } -func (c *queryClient) GetAllBlockHeaders(ctx context.Context, in *QueryAllBlockHeaderRequest, opts ...grpc.CallOption) (*QueryAllBlockHeaderResponse, error) { - out := new(QueryAllBlockHeaderResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetAllBlockHeaders", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryGetKeygenResponse) Reset() { *m = QueryGetKeygenResponse{} } +func (m *QueryGetKeygenResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetKeygenResponse) ProtoMessage() {} +func (*QueryGetKeygenResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{42} } - -func (c *queryClient) GetBlockHeaderByHash(ctx context.Context, in *QueryGetBlockHeaderByHashRequest, opts ...grpc.CallOption) (*QueryGetBlockHeaderByHashResponse, error) { - out := new(QueryGetBlockHeaderByHashResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetBlockHeaderByHash", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil +func (m *QueryGetKeygenResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } - -func (c *queryClient) GetBlockHeaderStateByChain(ctx context.Context, in *QueryGetBlockHeaderStateRequest, opts ...grpc.CallOption) (*QueryGetBlockHeaderStateResponse, error) { - out := new(QueryGetBlockHeaderStateResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetBlockHeaderStateByChain", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryGetKeygenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetKeygenResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return out, nil +} +func (m *QueryGetKeygenResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetKeygenResponse.Merge(m, src) +} +func (m *QueryGetKeygenResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetKeygenResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetKeygenResponse.DiscardUnknown(m) } -func (c *queryClient) Prove(ctx context.Context, in *QueryProveRequest, opts ...grpc.CallOption) (*QueryProveResponse, error) { - out := new(QueryProveResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/Prove", in, out, opts...) - if err != nil { - return nil, err +var xxx_messageInfo_QueryGetKeygenResponse proto.InternalMessageInfo + +func (m *QueryGetKeygenResponse) GetKeygen() *Keygen { + if m != nil { + return m.Keygen } - return out, nil + return nil } -// QueryServer is the server API for Query service. -type QueryServer interface { - // Parameters queries the parameters of the module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // Queries a list of VoterByIdentifier items. - BallotByIdentifier(context.Context, *QueryBallotByIdentifierRequest) (*QueryBallotByIdentifierResponse, error) - // Queries a list of ObserversByChainAndType items. - ObserversByChain(context.Context, *QueryObserversByChainRequest) (*QueryObserversByChainResponse, error) - AllObserverMappers(context.Context, *QueryAllObserverMappersRequest) (*QueryAllObserverMappersResponse, error) - SupportedChains(context.Context, *QuerySupportedChains) (*QuerySupportedChainsResponse, error) - // Queries a list of GetClientParamsForChain items. - GetCoreParamsForChain(context.Context, *QueryGetCoreParamsForChainRequest) (*QueryGetCoreParamsForChainResponse, error) - // Queries a list of GetCoreParams items. - GetCoreParams(context.Context, *QueryGetCoreParamsRequest) (*QueryGetCoreParamsResponse, error) - // Queries a nodeAccount by index. - NodeAccount(context.Context, *QueryGetNodeAccountRequest) (*QueryGetNodeAccountResponse, error) - // Queries a list of nodeAccount items. - NodeAccountAll(context.Context, *QueryAllNodeAccountRequest) (*QueryAllNodeAccountResponse, error) - CrosschainFlags(context.Context, *QueryGetCrosschainFlagsRequest) (*QueryGetCrosschainFlagsResponse, error) - // Queries a keygen by index. - Keygen(context.Context, *QueryGetKeygenRequest) (*QueryGetKeygenResponse, error) - // Queries a list of ShowObserverCount items. - ShowObserverCount(context.Context, *QueryShowObserverCountRequest) (*QueryShowObserverCountResponse, error) - // Queries a list of VoterByIdentifier items. - BlameByIdentifier(context.Context, *QueryBlameByIdentifierRequest) (*QueryBlameByIdentifierResponse, error) - // Queries a list of VoterByIdentifier items. - GetAllBlameRecords(context.Context, *QueryAllBlameRecordsRequest) (*QueryAllBlameRecordsResponse, error) - // Queries a list of VoterByIdentifier items. - BlamesByChainAndNonce(context.Context, *QueryBlameByChainAndNonceRequest) (*QueryBlameByChainAndNonceResponse, error) - GetAllBlockHeaders(context.Context, *QueryAllBlockHeaderRequest) (*QueryAllBlockHeaderResponse, error) - GetBlockHeaderByHash(context.Context, *QueryGetBlockHeaderByHashRequest) (*QueryGetBlockHeaderByHashResponse, error) - GetBlockHeaderStateByChain(context.Context, *QueryGetBlockHeaderStateRequest) (*QueryGetBlockHeaderStateResponse, error) - // merkle proof verification - Prove(context.Context, *QueryProveRequest) (*QueryProveResponse, error) +type QueryShowObserverCountRequest struct { } -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { +func (m *QueryShowObserverCountRequest) Reset() { *m = QueryShowObserverCountRequest{} } +func (m *QueryShowObserverCountRequest) String() string { return proto.CompactTextString(m) } +func (*QueryShowObserverCountRequest) ProtoMessage() {} +func (*QueryShowObserverCountRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{43} } - -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +func (m *QueryShowObserverCountRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } -func (*UnimplementedQueryServer) BallotByIdentifier(ctx context.Context, req *QueryBallotByIdentifierRequest) (*QueryBallotByIdentifierResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method BallotByIdentifier not implemented") +func (m *QueryShowObserverCountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryShowObserverCountRequest.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 (*UnimplementedQueryServer) ObserversByChain(ctx context.Context, req *QueryObserversByChainRequest) (*QueryObserversByChainResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ObserversByChain not implemented") +func (m *QueryShowObserverCountRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryShowObserverCountRequest.Merge(m, src) } -func (*UnimplementedQueryServer) AllObserverMappers(ctx context.Context, req *QueryAllObserverMappersRequest) (*QueryAllObserverMappersResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AllObserverMappers not implemented") +func (m *QueryShowObserverCountRequest) XXX_Size() int { + return m.Size() } -func (*UnimplementedQueryServer) SupportedChains(ctx context.Context, req *QuerySupportedChains) (*QuerySupportedChainsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SupportedChains not implemented") +func (m *QueryShowObserverCountRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryShowObserverCountRequest.DiscardUnknown(m) } -func (*UnimplementedQueryServer) GetCoreParamsForChain(ctx context.Context, req *QueryGetCoreParamsForChainRequest) (*QueryGetCoreParamsForChainResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetCoreParamsForChain not implemented") + +var xxx_messageInfo_QueryShowObserverCountRequest proto.InternalMessageInfo + +type QueryShowObserverCountResponse struct { + LastObserverCount *LastObserverCount `protobuf:"bytes,1,opt,name=last_observer_count,json=lastObserverCount,proto3" json:"last_observer_count,omitempty"` } -func (*UnimplementedQueryServer) GetCoreParams(ctx context.Context, req *QueryGetCoreParamsRequest) (*QueryGetCoreParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetCoreParams not implemented") + +func (m *QueryShowObserverCountResponse) Reset() { *m = QueryShowObserverCountResponse{} } +func (m *QueryShowObserverCountResponse) String() string { return proto.CompactTextString(m) } +func (*QueryShowObserverCountResponse) ProtoMessage() {} +func (*QueryShowObserverCountResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{44} } -func (*UnimplementedQueryServer) NodeAccount(ctx context.Context, req *QueryGetNodeAccountRequest) (*QueryGetNodeAccountResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method NodeAccount not implemented") +func (m *QueryShowObserverCountResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } -func (*UnimplementedQueryServer) NodeAccountAll(ctx context.Context, req *QueryAllNodeAccountRequest) (*QueryAllNodeAccountResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method NodeAccountAll not implemented") +func (m *QueryShowObserverCountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryShowObserverCountResponse.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 (*UnimplementedQueryServer) CrosschainFlags(ctx context.Context, req *QueryGetCrosschainFlagsRequest) (*QueryGetCrosschainFlagsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CrosschainFlags not implemented") +func (m *QueryShowObserverCountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryShowObserverCountResponse.Merge(m, src) } -func (*UnimplementedQueryServer) Keygen(ctx context.Context, req *QueryGetKeygenRequest) (*QueryGetKeygenResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Keygen not implemented") +func (m *QueryShowObserverCountResponse) XXX_Size() int { + return m.Size() } -func (*UnimplementedQueryServer) ShowObserverCount(ctx context.Context, req *QueryShowObserverCountRequest) (*QueryShowObserverCountResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ShowObserverCount not implemented") +func (m *QueryShowObserverCountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryShowObserverCountResponse.DiscardUnknown(m) } -func (*UnimplementedQueryServer) BlameByIdentifier(ctx context.Context, req *QueryBlameByIdentifierRequest) (*QueryBlameByIdentifierResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method BlameByIdentifier not implemented") + +var xxx_messageInfo_QueryShowObserverCountResponse proto.InternalMessageInfo + +func (m *QueryShowObserverCountResponse) GetLastObserverCount() *LastObserverCount { + if m != nil { + return m.LastObserverCount + } + return nil } -func (*UnimplementedQueryServer) GetAllBlameRecords(ctx context.Context, req *QueryAllBlameRecordsRequest) (*QueryAllBlameRecordsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAllBlameRecords not implemented") + +type QueryBlameByIdentifierRequest struct { + BlameIdentifier string `protobuf:"bytes,1,opt,name=blame_identifier,json=blameIdentifier,proto3" json:"blame_identifier,omitempty"` } -func (*UnimplementedQueryServer) BlamesByChainAndNonce(ctx context.Context, req *QueryBlameByChainAndNonceRequest) (*QueryBlameByChainAndNonceResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method BlamesByChainAndNonce not implemented") + +func (m *QueryBlameByIdentifierRequest) Reset() { *m = QueryBlameByIdentifierRequest{} } +func (m *QueryBlameByIdentifierRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBlameByIdentifierRequest) ProtoMessage() {} +func (*QueryBlameByIdentifierRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{45} } -func (*UnimplementedQueryServer) GetAllBlockHeaders(ctx context.Context, req *QueryAllBlockHeaderRequest) (*QueryAllBlockHeaderResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAllBlockHeaders not implemented") +func (m *QueryBlameByIdentifierRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } -func (*UnimplementedQueryServer) GetBlockHeaderByHash(ctx context.Context, req *QueryGetBlockHeaderByHashRequest) (*QueryGetBlockHeaderByHashResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetBlockHeaderByHash not implemented") +func (m *QueryBlameByIdentifierRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBlameByIdentifierRequest.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 (*UnimplementedQueryServer) GetBlockHeaderStateByChain(ctx context.Context, req *QueryGetBlockHeaderStateRequest) (*QueryGetBlockHeaderStateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetBlockHeaderStateByChain not implemented") +func (m *QueryBlameByIdentifierRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBlameByIdentifierRequest.Merge(m, src) } -func (*UnimplementedQueryServer) Prove(ctx context.Context, req *QueryProveRequest) (*QueryProveResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Prove not implemented") +func (m *QueryBlameByIdentifierRequest) XXX_Size() int { + return m.Size() } - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) +func (m *QueryBlameByIdentifierRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBlameByIdentifierRequest.DiscardUnknown(m) } -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) +var xxx_messageInfo_QueryBlameByIdentifierRequest proto.InternalMessageInfo + +func (m *QueryBlameByIdentifierRequest) GetBlameIdentifier() string { + if m != nil { + return m.BlameIdentifier } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.observer.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) + return "" } -func _Query_BallotByIdentifier_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryBallotByIdentifierRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).BallotByIdentifier(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.observer.Query/BallotByIdentifier", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).BallotByIdentifier(ctx, req.(*QueryBallotByIdentifierRequest)) - } - return interceptor(ctx, in, info, handler) +type QueryBlameByIdentifierResponse struct { + BlameInfo *Blame `protobuf:"bytes,1,opt,name=blame_info,json=blameInfo,proto3" json:"blame_info,omitempty"` } -func _Query_ObserversByChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryObserversByChainRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ObserversByChain(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.observer.Query/ObserversByChain", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ObserversByChain(ctx, req.(*QueryObserversByChainRequest)) +func (m *QueryBlameByIdentifierResponse) Reset() { *m = QueryBlameByIdentifierResponse{} } +func (m *QueryBlameByIdentifierResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBlameByIdentifierResponse) ProtoMessage() {} +func (*QueryBlameByIdentifierResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{46} +} +func (m *QueryBlameByIdentifierResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBlameByIdentifierResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBlameByIdentifierResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return interceptor(ctx, in, info, handler) +} +func (m *QueryBlameByIdentifierResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBlameByIdentifierResponse.Merge(m, src) +} +func (m *QueryBlameByIdentifierResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBlameByIdentifierResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBlameByIdentifierResponse.DiscardUnknown(m) } -func _Query_AllObserverMappers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllObserverMappersRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).AllObserverMappers(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.observer.Query/AllObserverMappers", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AllObserverMappers(ctx, req.(*QueryAllObserverMappersRequest)) +var xxx_messageInfo_QueryBlameByIdentifierResponse proto.InternalMessageInfo + +func (m *QueryBlameByIdentifierResponse) GetBlameInfo() *Blame { + if m != nil { + return m.BlameInfo } - return interceptor(ctx, in, info, handler) + return nil } -func _Query_SupportedChains_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QuerySupportedChains) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).SupportedChains(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.observer.Query/SupportedChains", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).SupportedChains(ctx, req.(*QuerySupportedChains)) - } - return interceptor(ctx, in, info, handler) +type QueryAllBlameRecordsRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func _Query_GetCoreParamsForChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetCoreParamsForChainRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GetCoreParamsForChain(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.observer.Query/GetCoreParamsForChain", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetCoreParamsForChain(ctx, req.(*QueryGetCoreParamsForChainRequest)) +func (m *QueryAllBlameRecordsRequest) Reset() { *m = QueryAllBlameRecordsRequest{} } +func (m *QueryAllBlameRecordsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllBlameRecordsRequest) ProtoMessage() {} +func (*QueryAllBlameRecordsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{47} +} +func (m *QueryAllBlameRecordsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllBlameRecordsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllBlameRecordsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return interceptor(ctx, in, info, handler) +} +func (m *QueryAllBlameRecordsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllBlameRecordsRequest.Merge(m, src) +} +func (m *QueryAllBlameRecordsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllBlameRecordsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllBlameRecordsRequest.DiscardUnknown(m) } -func _Query_GetCoreParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetCoreParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GetCoreParams(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.observer.Query/GetCoreParams", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetCoreParams(ctx, req.(*QueryGetCoreParamsRequest)) +var xxx_messageInfo_QueryAllBlameRecordsRequest proto.InternalMessageInfo + +func (m *QueryAllBlameRecordsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination } - return interceptor(ctx, in, info, handler) + return nil } -func _Query_NodeAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetNodeAccountRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).NodeAccount(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.observer.Query/NodeAccount", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).NodeAccount(ctx, req.(*QueryGetNodeAccountRequest)) - } - return interceptor(ctx, in, info, handler) +type QueryAllBlameRecordsResponse struct { + BlameInfo []Blame `protobuf:"bytes,1,rep,name=blame_info,json=blameInfo,proto3" json:"blame_info"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func _Query_NodeAccountAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllNodeAccountRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).NodeAccountAll(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.observer.Query/NodeAccountAll", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).NodeAccountAll(ctx, req.(*QueryAllNodeAccountRequest)) +func (m *QueryAllBlameRecordsResponse) Reset() { *m = QueryAllBlameRecordsResponse{} } +func (m *QueryAllBlameRecordsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllBlameRecordsResponse) ProtoMessage() {} +func (*QueryAllBlameRecordsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{48} +} +func (m *QueryAllBlameRecordsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllBlameRecordsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllBlameRecordsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return interceptor(ctx, in, info, handler) +} +func (m *QueryAllBlameRecordsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllBlameRecordsResponse.Merge(m, src) +} +func (m *QueryAllBlameRecordsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllBlameRecordsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllBlameRecordsResponse.DiscardUnknown(m) } -func _Query_CrosschainFlags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetCrosschainFlagsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).CrosschainFlags(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.observer.Query/CrosschainFlags", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).CrosschainFlags(ctx, req.(*QueryGetCrosschainFlagsRequest)) +var xxx_messageInfo_QueryAllBlameRecordsResponse proto.InternalMessageInfo + +func (m *QueryAllBlameRecordsResponse) GetBlameInfo() []Blame { + if m != nil { + return m.BlameInfo } - return interceptor(ctx, in, info, handler) + return nil } -func _Query_Keygen_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetKeygenRequest) - if err := dec(in); err != nil { - return nil, err +func (m *QueryAllBlameRecordsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination } - if interceptor == nil { - return srv.(QueryServer).Keygen(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.observer.Query/Keygen", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Keygen(ctx, req.(*QueryGetKeygenRequest)) - } - return interceptor(ctx, in, info, handler) + return nil } -func _Query_ShowObserverCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryShowObserverCountRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ShowObserverCount(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.observer.Query/ShowObserverCount", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ShowObserverCount(ctx, req.(*QueryShowObserverCountRequest)) - } - return interceptor(ctx, in, info, handler) +type QueryBlameByChainAndNonceRequest struct { + ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + Nonce int64 `protobuf:"varint,2,opt,name=nonce,proto3" json:"nonce,omitempty"` } -func _Query_BlameByIdentifier_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryBlameByIdentifierRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).BlameByIdentifier(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.observer.Query/BlameByIdentifier", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).BlameByIdentifier(ctx, req.(*QueryBlameByIdentifierRequest)) +func (m *QueryBlameByChainAndNonceRequest) Reset() { *m = QueryBlameByChainAndNonceRequest{} } +func (m *QueryBlameByChainAndNonceRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBlameByChainAndNonceRequest) ProtoMessage() {} +func (*QueryBlameByChainAndNonceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{49} +} +func (m *QueryBlameByChainAndNonceRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBlameByChainAndNonceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBlameByChainAndNonceRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return interceptor(ctx, in, info, handler) +} +func (m *QueryBlameByChainAndNonceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBlameByChainAndNonceRequest.Merge(m, src) +} +func (m *QueryBlameByChainAndNonceRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBlameByChainAndNonceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBlameByChainAndNonceRequest.DiscardUnknown(m) } -func _Query_GetAllBlameRecords_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllBlameRecordsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GetAllBlameRecords(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.observer.Query/GetAllBlameRecords", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetAllBlameRecords(ctx, req.(*QueryAllBlameRecordsRequest)) +var xxx_messageInfo_QueryBlameByChainAndNonceRequest proto.InternalMessageInfo + +func (m *QueryBlameByChainAndNonceRequest) GetChainId() int64 { + if m != nil { + return m.ChainId } - return interceptor(ctx, in, info, handler) + return 0 } -func _Query_BlamesByChainAndNonce_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryBlameByChainAndNonceRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).BlamesByChainAndNonce(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.observer.Query/BlamesByChainAndNonce", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).BlamesByChainAndNonce(ctx, req.(*QueryBlameByChainAndNonceRequest)) +func (m *QueryBlameByChainAndNonceRequest) GetNonce() int64 { + if m != nil { + return m.Nonce } - return interceptor(ctx, in, info, handler) + return 0 } -func _Query_GetAllBlockHeaders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllBlockHeaderRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GetAllBlockHeaders(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.observer.Query/GetAllBlockHeaders", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetAllBlockHeaders(ctx, req.(*QueryAllBlockHeaderRequest)) - } - return interceptor(ctx, in, info, handler) +type QueryBlameByChainAndNonceResponse struct { + BlameInfo []*Blame `protobuf:"bytes,1,rep,name=blame_info,json=blameInfo,proto3" json:"blame_info,omitempty"` } -func _Query_GetBlockHeaderByHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetBlockHeaderByHashRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GetBlockHeaderByHash(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.observer.Query/GetBlockHeaderByHash", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetBlockHeaderByHash(ctx, req.(*QueryGetBlockHeaderByHashRequest)) +func (m *QueryBlameByChainAndNonceResponse) Reset() { *m = QueryBlameByChainAndNonceResponse{} } +func (m *QueryBlameByChainAndNonceResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBlameByChainAndNonceResponse) ProtoMessage() {} +func (*QueryBlameByChainAndNonceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{50} +} +func (m *QueryBlameByChainAndNonceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBlameByChainAndNonceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBlameByChainAndNonceResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return interceptor(ctx, in, info, handler) +} +func (m *QueryBlameByChainAndNonceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBlameByChainAndNonceResponse.Merge(m, src) +} +func (m *QueryBlameByChainAndNonceResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBlameByChainAndNonceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBlameByChainAndNonceResponse.DiscardUnknown(m) } -func _Query_GetBlockHeaderStateByChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryGetBlockHeaderStateRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GetBlockHeaderStateByChain(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.observer.Query/GetBlockHeaderStateByChain", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetBlockHeaderStateByChain(ctx, req.(*QueryGetBlockHeaderStateRequest)) +var xxx_messageInfo_QueryBlameByChainAndNonceResponse proto.InternalMessageInfo + +func (m *QueryBlameByChainAndNonceResponse) GetBlameInfo() []*Blame { + if m != nil { + return m.BlameInfo } - return interceptor(ctx, in, info, handler) + return nil } -func _Query_Prove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryProveRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Prove(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.observer.Query/Prove", +type QueryAllBlockHeaderRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllBlockHeaderRequest) Reset() { *m = QueryAllBlockHeaderRequest{} } +func (m *QueryAllBlockHeaderRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllBlockHeaderRequest) ProtoMessage() {} +func (*QueryAllBlockHeaderRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{51} +} +func (m *QueryAllBlockHeaderRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllBlockHeaderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllBlockHeaderRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Prove(ctx, req.(*QueryProveRequest)) +} +func (m *QueryAllBlockHeaderRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllBlockHeaderRequest.Merge(m, src) +} +func (m *QueryAllBlockHeaderRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllBlockHeaderRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllBlockHeaderRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllBlockHeaderRequest proto.InternalMessageInfo + +func (m *QueryAllBlockHeaderRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination } - return interceptor(ctx, in, info, handler) + return nil } -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "zetachain.zetacore.observer.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - { - MethodName: "BallotByIdentifier", - Handler: _Query_BallotByIdentifier_Handler, - }, - { - MethodName: "ObserversByChain", - Handler: _Query_ObserversByChain_Handler, - }, - { - MethodName: "AllObserverMappers", - Handler: _Query_AllObserverMappers_Handler, - }, - { - MethodName: "SupportedChains", - Handler: _Query_SupportedChains_Handler, - }, - { - MethodName: "GetCoreParamsForChain", - Handler: _Query_GetCoreParamsForChain_Handler, - }, - { - MethodName: "GetCoreParams", - Handler: _Query_GetCoreParams_Handler, - }, - { - MethodName: "NodeAccount", - Handler: _Query_NodeAccount_Handler, - }, - { - MethodName: "NodeAccountAll", - Handler: _Query_NodeAccountAll_Handler, - }, - { - MethodName: "CrosschainFlags", - Handler: _Query_CrosschainFlags_Handler, - }, - { - MethodName: "Keygen", - Handler: _Query_Keygen_Handler, - }, - { - MethodName: "ShowObserverCount", - Handler: _Query_ShowObserverCount_Handler, - }, - { - MethodName: "BlameByIdentifier", - Handler: _Query_BlameByIdentifier_Handler, - }, - { - MethodName: "GetAllBlameRecords", - Handler: _Query_GetAllBlameRecords_Handler, - }, - { - MethodName: "BlamesByChainAndNonce", - Handler: _Query_BlamesByChainAndNonce_Handler, - }, - { - MethodName: "GetAllBlockHeaders", - Handler: _Query_GetAllBlockHeaders_Handler, - }, - { - MethodName: "GetBlockHeaderByHash", - Handler: _Query_GetBlockHeaderByHash_Handler, - }, - { - MethodName: "GetBlockHeaderStateByChain", - Handler: _Query_GetBlockHeaderStateByChain_Handler, - }, - { - MethodName: "Prove", - Handler: _Query_Prove_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "observer/query.proto", +type QueryAllBlockHeaderResponse struct { + BlockHeaders []*common.BlockHeader `protobuf:"bytes,1,rep,name=block_headers,json=blockHeaders,proto3" json:"block_headers,omitempty"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryProveRequest) 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 *QueryAllBlockHeaderResponse) Reset() { *m = QueryAllBlockHeaderResponse{} } +func (m *QueryAllBlockHeaderResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllBlockHeaderResponse) ProtoMessage() {} +func (*QueryAllBlockHeaderResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{52} } - -func (m *QueryProveRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *QueryAllBlockHeaderResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } - -func (m *QueryProveRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.TxIndex != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.TxIndex)) - i-- - dAtA[i] = 0x28 - } - if len(m.BlockHash) > 0 { - i -= len(m.BlockHash) - copy(dAtA[i:], m.BlockHash) - i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockHash))) - i-- - dAtA[i] = 0x22 - } - if m.Proof != nil { - { - size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) +func (m *QueryAllBlockHeaderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllBlockHeaderResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } - i-- - dAtA[i] = 0x1a - } - if len(m.TxHash) > 0 { - i -= len(m.TxHash) - copy(dAtA[i:], m.TxHash) - i = encodeVarintQuery(dAtA, i, uint64(len(m.TxHash))) - i-- - dAtA[i] = 0x12 + return b[:n], nil } - if m.ChainId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ChainId)) - i-- - dAtA[i] = 0x8 +} +func (m *QueryAllBlockHeaderResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllBlockHeaderResponse.Merge(m, src) +} +func (m *QueryAllBlockHeaderResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllBlockHeaderResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllBlockHeaderResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllBlockHeaderResponse proto.InternalMessageInfo + +func (m *QueryAllBlockHeaderResponse) GetBlockHeaders() []*common.BlockHeader { + if m != nil { + return m.BlockHeaders } - return len(dAtA) - i, nil + return nil } -func (m *QueryProveResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryAllBlockHeaderResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination } - return dAtA[:n], nil + return nil } -func (m *QueryProveResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +type QueryGetBlockHeaderByHashRequest struct { + BlockHash []byte `protobuf:"bytes,1,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` } -func (m *QueryProveResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Valid { - i-- - if m.Valid { - dAtA[i] = 1 - } else { - dAtA[i] = 0 +func (m *QueryGetBlockHeaderByHashRequest) Reset() { *m = QueryGetBlockHeaderByHashRequest{} } +func (m *QueryGetBlockHeaderByHashRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetBlockHeaderByHashRequest) ProtoMessage() {} +func (*QueryGetBlockHeaderByHashRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{53} +} +func (m *QueryGetBlockHeaderByHashRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetBlockHeaderByHashRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetBlockHeaderByHashRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } - i-- - dAtA[i] = 0x8 + return b[:n], nil } - return len(dAtA) - i, nil } - -func (m *QueryParamsRequest) 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 *QueryGetBlockHeaderByHashRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetBlockHeaderByHashRequest.Merge(m, src) } - -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *QueryGetBlockHeaderByHashRequest) XXX_Size() int { + return m.Size() } - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil +func (m *QueryGetBlockHeaderByHashRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetBlockHeaderByHashRequest.DiscardUnknown(m) } -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +var xxx_messageInfo_QueryGetBlockHeaderByHashRequest proto.InternalMessageInfo + +func (m *QueryGetBlockHeaderByHashRequest) GetBlockHash() []byte { + if m != nil { + return m.BlockHash } - return dAtA[:n], nil + return nil } -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +type QueryGetBlockHeaderByHashResponse struct { + BlockHeader *common.BlockHeader `protobuf:"bytes,1,opt,name=block_header,json=blockHeader,proto3" json:"block_header,omitempty"` } -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) +func (m *QueryGetBlockHeaderByHashResponse) Reset() { *m = QueryGetBlockHeaderByHashResponse{} } +func (m *QueryGetBlockHeaderByHashResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetBlockHeaderByHashResponse) ProtoMessage() {} +func (*QueryGetBlockHeaderByHashResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{54} +} +func (m *QueryGetBlockHeaderByHashResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetBlockHeaderByHashResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetBlockHeaderByHashResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) if err != nil { - return 0, err + return nil, err } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *QueryBallotByIdentifierRequest) 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 b[:n], nil } - return dAtA[:n], nil } - -func (m *QueryBallotByIdentifierRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *QueryGetBlockHeaderByHashResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetBlockHeaderByHashResponse.Merge(m, src) } - -func (m *QueryBallotByIdentifierRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.BallotIdentifier) > 0 { - i -= len(m.BallotIdentifier) - copy(dAtA[i:], m.BallotIdentifier) - i = encodeVarintQuery(dAtA, i, uint64(len(m.BallotIdentifier))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil +func (m *QueryGetBlockHeaderByHashResponse) XXX_Size() int { + return m.Size() } - -func (m *VoterList) 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 *QueryGetBlockHeaderByHashResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetBlockHeaderByHashResponse.DiscardUnknown(m) } -func (m *VoterList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} +var xxx_messageInfo_QueryGetBlockHeaderByHashResponse proto.InternalMessageInfo -func (m *VoterList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.VoteType != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.VoteType)) - i-- - dAtA[i] = 0x10 - } - if len(m.VoterAddress) > 0 { - i -= len(m.VoterAddress) - copy(dAtA[i:], m.VoterAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.VoterAddress))) - i-- - dAtA[i] = 0xa +func (m *QueryGetBlockHeaderByHashResponse) GetBlockHeader() *common.BlockHeader { + if m != nil { + return m.BlockHeader } - return len(dAtA) - i, nil + return nil } -func (m *QueryBallotByIdentifierResponse) 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 +type QueryGetBlockHeaderStateRequest struct { + ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` } -func (m *QueryBallotByIdentifierResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *QueryGetBlockHeaderStateRequest) Reset() { *m = QueryGetBlockHeaderStateRequest{} } +func (m *QueryGetBlockHeaderStateRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetBlockHeaderStateRequest) ProtoMessage() {} +func (*QueryGetBlockHeaderStateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{55} } - -func (m *QueryBallotByIdentifierResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.BallotStatus != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.BallotStatus)) - i-- - dAtA[i] = 0x20 - } - if m.ObservationType != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ObservationType)) - i-- - dAtA[i] = 0x18 - } - if len(m.Voters) > 0 { - for iNdEx := len(m.Voters) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Voters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 +func (m *QueryGetBlockHeaderStateRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetBlockHeaderStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetBlockHeaderStateRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if len(m.BallotIdentifier) > 0 { - i -= len(m.BallotIdentifier) - copy(dAtA[i:], m.BallotIdentifier) - i = encodeVarintQuery(dAtA, i, uint64(len(m.BallotIdentifier))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil } - -func (m *QueryObserversByChainRequest) 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 *QueryGetBlockHeaderStateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetBlockHeaderStateRequest.Merge(m, src) } - -func (m *QueryObserversByChainRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *QueryGetBlockHeaderStateRequest) XXX_Size() int { + return m.Size() } - -func (m *QueryObserversByChainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ObservationChain) > 0 { - i -= len(m.ObservationChain) - copy(dAtA[i:], m.ObservationChain) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ObservationChain))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil +func (m *QueryGetBlockHeaderStateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetBlockHeaderStateRequest.DiscardUnknown(m) } -func (m *QueryObserversByChainResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +var xxx_messageInfo_QueryGetBlockHeaderStateRequest proto.InternalMessageInfo + +func (m *QueryGetBlockHeaderStateRequest) GetChainId() int64 { + if m != nil { + return m.ChainId } - return dAtA[:n], nil + return 0 } -func (m *QueryObserversByChainResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +type QueryGetBlockHeaderStateResponse struct { + BlockHeaderState *BlockHeaderState `protobuf:"bytes,1,opt,name=block_header_state,json=blockHeaderState,proto3" json:"block_header_state,omitempty"` } -func (m *QueryObserversByChainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Observers) > 0 { - for iNdEx := len(m.Observers) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Observers[iNdEx]) - copy(dAtA[i:], m.Observers[iNdEx]) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Observers[iNdEx]))) - i-- - dAtA[i] = 0xa +func (m *QueryGetBlockHeaderStateResponse) Reset() { *m = QueryGetBlockHeaderStateResponse{} } +func (m *QueryGetBlockHeaderStateResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetBlockHeaderStateResponse) ProtoMessage() {} +func (*QueryGetBlockHeaderStateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{56} +} +func (m *QueryGetBlockHeaderStateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetBlockHeaderStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetBlockHeaderStateResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - return len(dAtA) - i, nil } - -func (m *QueryAllObserverMappersRequest) 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 *QueryGetBlockHeaderStateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetBlockHeaderStateResponse.Merge(m, src) } - -func (m *QueryAllObserverMappersRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *QueryGetBlockHeaderStateResponse) XXX_Size() int { + return m.Size() } - -func (m *QueryAllObserverMappersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil +func (m *QueryGetBlockHeaderStateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetBlockHeaderStateResponse.DiscardUnknown(m) } -func (m *QueryAllObserverMappersResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +var xxx_messageInfo_QueryGetBlockHeaderStateResponse proto.InternalMessageInfo + +func (m *QueryGetBlockHeaderStateResponse) GetBlockHeaderState() *BlockHeaderState { + if m != nil { + return m.BlockHeaderState } - return dAtA[:n], nil + return nil } -func (m *QueryAllObserverMappersResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func init() { + proto.RegisterType((*QueryGetChainNoncesRequest)(nil), "zetachain.zetacore.observer.QueryGetChainNoncesRequest") + proto.RegisterType((*QueryGetChainNoncesResponse)(nil), "zetachain.zetacore.observer.QueryGetChainNoncesResponse") + proto.RegisterType((*QueryAllChainNoncesRequest)(nil), "zetachain.zetacore.observer.QueryAllChainNoncesRequest") + proto.RegisterType((*QueryAllChainNoncesResponse)(nil), "zetachain.zetacore.observer.QueryAllChainNoncesResponse") + proto.RegisterType((*QueryAllPendingNoncesRequest)(nil), "zetachain.zetacore.observer.QueryAllPendingNoncesRequest") + proto.RegisterType((*QueryAllPendingNoncesResponse)(nil), "zetachain.zetacore.observer.QueryAllPendingNoncesResponse") + proto.RegisterType((*QueryPendingNoncesByChainRequest)(nil), "zetachain.zetacore.observer.QueryPendingNoncesByChainRequest") + proto.RegisterType((*QueryPendingNoncesByChainResponse)(nil), "zetachain.zetacore.observer.QueryPendingNoncesByChainResponse") + proto.RegisterType((*QueryGetTSSRequest)(nil), "zetachain.zetacore.observer.QueryGetTSSRequest") + proto.RegisterType((*QueryGetTSSResponse)(nil), "zetachain.zetacore.observer.QueryGetTSSResponse") + proto.RegisterType((*QueryGetTssAddressRequest)(nil), "zetachain.zetacore.observer.QueryGetTssAddressRequest") + proto.RegisterType((*QueryGetTssAddressResponse)(nil), "zetachain.zetacore.observer.QueryGetTssAddressResponse") + proto.RegisterType((*QueryGetTssAddressByFinalizedHeightRequest)(nil), "zetachain.zetacore.observer.QueryGetTssAddressByFinalizedHeightRequest") + proto.RegisterType((*QueryGetTssAddressByFinalizedHeightResponse)(nil), "zetachain.zetacore.observer.QueryGetTssAddressByFinalizedHeightResponse") + proto.RegisterType((*QueryTssHistoryRequest)(nil), "zetachain.zetacore.observer.QueryTssHistoryRequest") + proto.RegisterType((*QueryTssHistoryResponse)(nil), "zetachain.zetacore.observer.QueryTssHistoryResponse") + proto.RegisterType((*QueryProveRequest)(nil), "zetachain.zetacore.observer.QueryProveRequest") + proto.RegisterType((*QueryProveResponse)(nil), "zetachain.zetacore.observer.QueryProveResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "zetachain.zetacore.observer.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "zetachain.zetacore.observer.QueryParamsResponse") + proto.RegisterType((*QueryHasVotedRequest)(nil), "zetachain.zetacore.observer.QueryHasVotedRequest") + proto.RegisterType((*QueryHasVotedResponse)(nil), "zetachain.zetacore.observer.QueryHasVotedResponse") + proto.RegisterType((*QueryBallotByIdentifierRequest)(nil), "zetachain.zetacore.observer.QueryBallotByIdentifierRequest") + proto.RegisterType((*VoterList)(nil), "zetachain.zetacore.observer.VoterList") + proto.RegisterType((*QueryBallotByIdentifierResponse)(nil), "zetachain.zetacore.observer.QueryBallotByIdentifierResponse") + proto.RegisterType((*QueryObserversByChainRequest)(nil), "zetachain.zetacore.observer.QueryObserversByChainRequest") + proto.RegisterType((*QueryObserversByChainResponse)(nil), "zetachain.zetacore.observer.QueryObserversByChainResponse") + proto.RegisterType((*QueryAllObserverMappersRequest)(nil), "zetachain.zetacore.observer.QueryAllObserverMappersRequest") + proto.RegisterType((*QueryAllObserverMappersResponse)(nil), "zetachain.zetacore.observer.QueryAllObserverMappersResponse") + proto.RegisterType((*QuerySupportedChains)(nil), "zetachain.zetacore.observer.QuerySupportedChains") + proto.RegisterType((*QuerySupportedChainsResponse)(nil), "zetachain.zetacore.observer.QuerySupportedChainsResponse") + proto.RegisterType((*QueryGetCoreParamsForChainRequest)(nil), "zetachain.zetacore.observer.QueryGetCoreParamsForChainRequest") + proto.RegisterType((*QueryGetCoreParamsForChainResponse)(nil), "zetachain.zetacore.observer.QueryGetCoreParamsForChainResponse") + proto.RegisterType((*QueryGetCoreParamsRequest)(nil), "zetachain.zetacore.observer.QueryGetCoreParamsRequest") + proto.RegisterType((*QueryGetCoreParamsResponse)(nil), "zetachain.zetacore.observer.QueryGetCoreParamsResponse") + proto.RegisterType((*QueryGetNodeAccountRequest)(nil), "zetachain.zetacore.observer.QueryGetNodeAccountRequest") + proto.RegisterType((*QueryGetNodeAccountResponse)(nil), "zetachain.zetacore.observer.QueryGetNodeAccountResponse") + proto.RegisterType((*QueryAllNodeAccountRequest)(nil), "zetachain.zetacore.observer.QueryAllNodeAccountRequest") + proto.RegisterType((*QueryAllNodeAccountResponse)(nil), "zetachain.zetacore.observer.QueryAllNodeAccountResponse") + proto.RegisterType((*QueryGetCrosschainFlagsRequest)(nil), "zetachain.zetacore.observer.QueryGetCrosschainFlagsRequest") + proto.RegisterType((*QueryGetCrosschainFlagsResponse)(nil), "zetachain.zetacore.observer.QueryGetCrosschainFlagsResponse") + proto.RegisterType((*QueryGetKeygenRequest)(nil), "zetachain.zetacore.observer.QueryGetKeygenRequest") + proto.RegisterType((*QueryGetKeygenResponse)(nil), "zetachain.zetacore.observer.QueryGetKeygenResponse") + proto.RegisterType((*QueryShowObserverCountRequest)(nil), "zetachain.zetacore.observer.QueryShowObserverCountRequest") + proto.RegisterType((*QueryShowObserverCountResponse)(nil), "zetachain.zetacore.observer.QueryShowObserverCountResponse") + proto.RegisterType((*QueryBlameByIdentifierRequest)(nil), "zetachain.zetacore.observer.QueryBlameByIdentifierRequest") + proto.RegisterType((*QueryBlameByIdentifierResponse)(nil), "zetachain.zetacore.observer.QueryBlameByIdentifierResponse") + proto.RegisterType((*QueryAllBlameRecordsRequest)(nil), "zetachain.zetacore.observer.QueryAllBlameRecordsRequest") + proto.RegisterType((*QueryAllBlameRecordsResponse)(nil), "zetachain.zetacore.observer.QueryAllBlameRecordsResponse") + proto.RegisterType((*QueryBlameByChainAndNonceRequest)(nil), "zetachain.zetacore.observer.QueryBlameByChainAndNonceRequest") + proto.RegisterType((*QueryBlameByChainAndNonceResponse)(nil), "zetachain.zetacore.observer.QueryBlameByChainAndNonceResponse") + proto.RegisterType((*QueryAllBlockHeaderRequest)(nil), "zetachain.zetacore.observer.QueryAllBlockHeaderRequest") + proto.RegisterType((*QueryAllBlockHeaderResponse)(nil), "zetachain.zetacore.observer.QueryAllBlockHeaderResponse") + proto.RegisterType((*QueryGetBlockHeaderByHashRequest)(nil), "zetachain.zetacore.observer.QueryGetBlockHeaderByHashRequest") + proto.RegisterType((*QueryGetBlockHeaderByHashResponse)(nil), "zetachain.zetacore.observer.QueryGetBlockHeaderByHashResponse") + proto.RegisterType((*QueryGetBlockHeaderStateRequest)(nil), "zetachain.zetacore.observer.QueryGetBlockHeaderStateRequest") + proto.RegisterType((*QueryGetBlockHeaderStateResponse)(nil), "zetachain.zetacore.observer.QueryGetBlockHeaderStateResponse") } -func (m *QueryAllObserverMappersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ObserverMappers) > 0 { - for iNdEx := len(m.ObserverMappers) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ObserverMappers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil +func init() { proto.RegisterFile("observer/query.proto", fileDescriptor_dcb801e455adaee4) } + +var fileDescriptor_dcb801e455adaee4 = []byte{ + // 2593 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x5a, 0xdd, 0x6f, 0x1c, 0x57, + 0x15, 0xcf, 0xc4, 0xb5, 0x63, 0x1f, 0xdb, 0x89, 0x7d, 0xe3, 0x34, 0xc9, 0x38, 0x71, 0xdc, 0x9b, + 0xa6, 0x49, 0xec, 0x64, 0xb7, 0x71, 0x4a, 0x9b, 0x34, 0x71, 0x5a, 0x6f, 0x48, 0xec, 0x7c, 0x34, + 0x49, 0xd7, 0xa6, 0x45, 0x29, 0xb0, 0xcc, 0xee, 0x5e, 0xef, 0x4e, 0x3b, 0x9e, 0xd9, 0xce, 0x8c, + 0x5d, 0x6f, 0x8d, 0x05, 0xe2, 0xb1, 0xe2, 0xa1, 0x12, 0x12, 0xbc, 0xf6, 0x05, 0xde, 0x40, 0xa8, + 0x12, 0x02, 0x09, 0xf1, 0x00, 0x2f, 0xf4, 0x01, 0xa1, 0x22, 0x24, 0x04, 0x0f, 0xa0, 0x2a, 0x81, + 0xbf, 0x03, 0x34, 0x77, 0xce, 0xcc, 0xdc, 0xf9, 0xd8, 0xd9, 0xbb, 0xee, 0xf6, 0x69, 0x67, 0xee, + 0xbd, 0xe7, 0xdc, 0xdf, 0xef, 0xdc, 0xaf, 0xf3, 0x9b, 0xbd, 0x30, 0x65, 0x55, 0x1d, 0x66, 0x6f, + 0x31, 0xbb, 0xf8, 0xfe, 0x26, 0xb3, 0xdb, 0x85, 0x96, 0x6d, 0xb9, 0x16, 0x99, 0xfe, 0x90, 0xb9, + 0x5a, 0xad, 0xa9, 0xe9, 0x66, 0x81, 0x3f, 0x59, 0x36, 0x2b, 0x04, 0x0d, 0xd5, 0xc3, 0x35, 0x6b, + 0x63, 0xc3, 0x32, 0x8b, 0xfe, 0x8f, 0x6f, 0xa1, 0xce, 0xd5, 0x2c, 0x67, 0xc3, 0x72, 0x8a, 0x55, + 0xcd, 0x61, 0xbe, 0xab, 0xe2, 0xd6, 0xa5, 0x2a, 0x73, 0xb5, 0x4b, 0xc5, 0x96, 0xd6, 0xd0, 0x4d, + 0xcd, 0xd5, 0xc3, 0xb6, 0x53, 0x0d, 0xab, 0x61, 0xf1, 0xc7, 0xa2, 0xf7, 0x84, 0xa5, 0x27, 0x1a, + 0x96, 0xd5, 0x30, 0x58, 0x51, 0x6b, 0xe9, 0x45, 0xcd, 0x34, 0x2d, 0x97, 0x9b, 0x38, 0x58, 0x7b, + 0x24, 0xc4, 0x59, 0xd5, 0x0c, 0xc3, 0x72, 0x03, 0x57, 0x51, 0xb1, 0xa1, 0x6d, 0x30, 0x2c, 0x9d, + 0x16, 0x4a, 0xad, 0xda, 0x7b, 0x95, 0x26, 0xd3, 0xea, 0xcc, 0x4e, 0x55, 0x72, 0x82, 0x15, 0xd3, + 0x32, 0x6b, 0x2c, 0xe8, 0xe6, 0x54, 0x54, 0x69, 0x5b, 0x8e, 0xe3, 0xb7, 0x58, 0x37, 0xb4, 0x46, + 0x1a, 0xc7, 0x7b, 0xac, 0xdd, 0x60, 0x66, 0xca, 0xa9, 0x69, 0xd5, 0x59, 0x45, 0xab, 0xd5, 0xac, + 0x4d, 0x33, 0x00, 0x79, 0x34, 0xac, 0x0c, 0x1e, 0x52, 0xce, 0x5a, 0x9a, 0xad, 0x6d, 0x04, 0x7d, + 0x9c, 0x8c, 0x8a, 0x99, 0x59, 0xd7, 0xcd, 0x46, 0x1c, 0x23, 0x09, 0xab, 0x5d, 0x07, 0xcb, 0xe8, + 0x02, 0xa8, 0x6f, 0x7a, 0x41, 0x5f, 0x66, 0xee, 0x4d, 0x0f, 0xf3, 0x03, 0x6e, 0x50, 0x66, 0xef, + 0x6f, 0x32, 0xc7, 0x25, 0x53, 0x30, 0xa8, 0x9b, 0x75, 0xb6, 0x7d, 0x4c, 0x99, 0x55, 0xce, 0x8d, + 0x94, 0xfd, 0x17, 0x6a, 0xc1, 0x74, 0xa6, 0x8d, 0xd3, 0xb2, 0x4c, 0x87, 0x91, 0x47, 0x30, 0x2a, + 0x14, 0x73, 0xd3, 0xd1, 0x85, 0x73, 0x85, 0x9c, 0x99, 0x51, 0x10, 0xda, 0x97, 0x9e, 0xf9, 0xec, + 0xdf, 0xa7, 0xf6, 0x95, 0x45, 0x17, 0xb4, 0x8e, 0x20, 0x97, 0x0c, 0x23, 0x03, 0xe4, 0x6d, 0x80, + 0x68, 0xa6, 0x60, 0x77, 0x2f, 0x14, 0xfc, 0x69, 0x55, 0xf0, 0xa6, 0x55, 0xc1, 0x9f, 0xa1, 0x38, + 0xad, 0x0a, 0x8f, 0xb4, 0x06, 0x43, 0xdb, 0xb2, 0x60, 0x49, 0x7f, 0xab, 0x20, 0xaf, 0x64, 0x37, + 0x9d, 0x78, 0x0d, 0x7c, 0x49, 0x5e, 0x64, 0x39, 0x86, 0x7c, 0x3f, 0x47, 0x7e, 0xb6, 0x2b, 0x72, + 0x1f, 0x4e, 0x0c, 0xfa, 0x3a, 0x9c, 0x08, 0x90, 0x3f, 0xf2, 0x47, 0xfe, 0xab, 0x09, 0xd1, 0x1f, + 0x14, 0x38, 0xd9, 0xa1, 0x23, 0x0c, 0xd2, 0xdb, 0x70, 0x30, 0x3e, 0xf7, 0x30, 0x4e, 0x73, 0xb9, + 0x71, 0x8a, 0xf9, 0xc2, 0x48, 0x8d, 0xb7, 0xc4, 0xc2, 0xfe, 0xc5, 0x6a, 0x11, 0x66, 0x39, 0x85, + 0x78, 0x9f, 0x6d, 0x3e, 0x2e, 0x41, 0xbc, 0x8e, 0xc3, 0xb0, 0xbf, 0x82, 0xf5, 0x3a, 0x8f, 0xd6, + 0x40, 0xf9, 0x00, 0x7f, 0xbf, 0x53, 0xa7, 0xdf, 0x83, 0xe7, 0x72, 0xcc, 0x73, 0xa2, 0xa0, 0xf4, + 0x21, 0x0a, 0x74, 0x0a, 0x48, 0xb0, 0xf4, 0xd6, 0x56, 0x57, 0x11, 0x2e, 0x7d, 0x08, 0x87, 0x63, + 0xa5, 0x88, 0xe2, 0x0a, 0x0c, 0xac, 0xad, 0xae, 0x62, 0xd7, 0xb3, 0xb9, 0x5d, 0xaf, 0xad, 0xae, + 0x62, 0x87, 0x9e, 0x09, 0xbd, 0x05, 0xc7, 0x43, 0x87, 0x8e, 0xb3, 0x54, 0xaf, 0xdb, 0xcc, 0x09, + 0x27, 0xd3, 0x39, 0x98, 0xa8, 0xea, 0x6e, 0xcd, 0xd2, 0xcd, 0x4a, 0x18, 0xa4, 0xfd, 0x3c, 0x48, + 0x07, 0xb1, 0xfc, 0x26, 0xc6, 0xea, 0xf5, 0x68, 0x73, 0x11, 0xdd, 0x20, 0xbc, 0x09, 0x18, 0x60, + 0x6e, 0x13, 0xb7, 0x16, 0xef, 0xd1, 0x2b, 0xa9, 0xba, 0x35, 0xee, 0x6c, 0xa4, 0xec, 0x3d, 0xd2, + 0x8f, 0x14, 0x98, 0x4b, 0xbb, 0x28, 0xb5, 0x6f, 0xeb, 0xa6, 0x66, 0xe8, 0x1f, 0xb2, 0xfa, 0x0a, + 0xd3, 0x1b, 0x4d, 0x37, 0x80, 0xb6, 0x00, 0x47, 0xd6, 0x83, 0x9a, 0x8a, 0xc7, 0xb2, 0xd2, 0xe4, + 0xf5, 0x38, 0x88, 0x87, 0xc3, 0xca, 0xc7, 0xcc, 0xd5, 0x7c, 0xd3, 0x1e, 0xe8, 0xbc, 0x09, 0xf3, + 0x52, 0x58, 0x7a, 0xe0, 0xf7, 0x5d, 0x78, 0x96, 0xbb, 0x5c, 0x73, 0x9c, 0x15, 0xdd, 0x71, 0x2d, + 0xbb, 0xdd, 0xef, 0x25, 0xfb, 0x33, 0x05, 0x8e, 0xa6, 0xba, 0x40, 0x84, 0x4b, 0x30, 0xec, 0x3a, + 0x4e, 0xc5, 0xd0, 0x1d, 0x17, 0x97, 0xa9, 0xec, 0x2c, 0x39, 0xe0, 0x3a, 0xce, 0x7d, 0xdd, 0x71, + 0xfb, 0xb7, 0x2c, 0x7f, 0xae, 0xc0, 0xa4, 0xbf, 0xb0, 0x6c, 0x6b, 0x8b, 0x75, 0x5f, 0x88, 0xe4, + 0x28, 0x1c, 0x70, 0xb7, 0x2b, 0x4d, 0xcd, 0x69, 0x62, 0x40, 0x87, 0xdc, 0xed, 0x15, 0xcd, 0x69, + 0x92, 0xd3, 0x30, 0xd8, 0xb2, 0x2d, 0x6b, 0xfd, 0xd8, 0x00, 0x47, 0x33, 0x5e, 0xc0, 0x7c, 0xe3, + 0x91, 0x57, 0x58, 0xf6, 0xeb, 0xc8, 0x49, 0x00, 0x3c, 0xe2, 0x3d, 0x07, 0xcf, 0x70, 0x07, 0x23, + 0xbc, 0x84, 0xfb, 0x38, 0x0e, 0xc3, 0xee, 0x76, 0xc5, 0x3f, 0xfb, 0x06, 0xfd, 0x7e, 0xdd, 0xed, + 0x3b, 0xfc, 0xf4, 0x9b, 0xc3, 0x25, 0x88, 0x38, 0x31, 0x94, 0x53, 0x30, 0xb8, 0xa5, 0x19, 0x88, + 0x72, 0xb8, 0xec, 0xbf, 0x84, 0xcb, 0xf5, 0x11, 0x3f, 0xa5, 0x83, 0xe5, 0xfa, 0x4d, 0x5c, 0xae, + 0x41, 0x69, 0x38, 0x1a, 0x43, 0xfe, 0x69, 0x8e, 0xa3, 0x7d, 0x3a, 0x7f, 0xb3, 0xe0, 0x4d, 0x71, + 0x38, 0xd0, 0x90, 0x36, 0x61, 0x8a, 0x7b, 0x5e, 0xd1, 0x9c, 0xb7, 0x2c, 0x97, 0xd5, 0x83, 0x30, + 0xce, 0xc3, 0xa4, 0x9f, 0xfd, 0x54, 0xf4, 0x3a, 0x33, 0x5d, 0x7d, 0x5d, 0x67, 0x36, 0x4e, 0xcc, + 0x09, 0xbf, 0xe2, 0x4e, 0x58, 0x4e, 0x4e, 0xc3, 0xf8, 0x96, 0xe5, 0x32, 0xbb, 0xa2, 0xf9, 0x33, + 0x1c, 0xc3, 0x3b, 0xc6, 0x0b, 0x71, 0xd6, 0xd3, 0x97, 0xe0, 0x48, 0xa2, 0x27, 0x64, 0x31, 0x0d, + 0x23, 0x4d, 0xcd, 0xa9, 0x78, 0x8d, 0x83, 0x60, 0x0c, 0x37, 0xb1, 0x11, 0x7d, 0x03, 0x66, 0xb8, + 0x55, 0x89, 0xf7, 0x59, 0x6a, 0x47, 0xbd, 0xee, 0x05, 0x29, 0x75, 0x61, 0xc4, 0xf3, 0x6b, 0xf3, + 0x99, 0x98, 0x82, 0xad, 0xa4, 0x61, 0x93, 0x12, 0x8c, 0x78, 0xef, 0x15, 0xb7, 0xdd, 0x62, 0x9c, + 0xd7, 0xc1, 0x85, 0x33, 0xb9, 0x61, 0xf6, 0xfc, 0xaf, 0xb5, 0x5b, 0xac, 0x3c, 0xbc, 0x85, 0x4f, + 0xf4, 0x37, 0xfb, 0xe1, 0x54, 0x47, 0x16, 0x18, 0x85, 0x9e, 0x02, 0x7e, 0x03, 0x86, 0x38, 0x48, + 0x2f, 0xd2, 0x03, 0x7c, 0x99, 0x77, 0x43, 0xc4, 0x19, 0x97, 0xd1, 0x8a, 0xbc, 0x0d, 0x13, 0x7e, + 0x2d, 0x5f, 0x49, 0x3e, 0xb7, 0x01, 0xce, 0xed, 0x42, 0xae, 0xa7, 0x87, 0x91, 0x11, 0xa7, 0x78, + 0xc8, 0x8a, 0x17, 0x90, 0x07, 0x30, 0x8e, 0x2c, 0x1c, 0x57, 0x73, 0x37, 0x1d, 0xbe, 0x4e, 0x0e, + 0x2e, 0x9c, 0xcf, 0xf5, 0xea, 0x47, 0x65, 0x95, 0x1b, 0x94, 0xc7, 0xaa, 0xc2, 0x1b, 0xbd, 0x87, + 0x69, 0xca, 0x43, 0x6c, 0x9b, 0x3c, 0x76, 0xe7, 0x61, 0x52, 0x24, 0xc2, 0x7b, 0x08, 0xa2, 0x26, + 0x54, 0x70, 0x1b, 0xba, 0x88, 0xa9, 0x48, 0xda, 0x19, 0x8e, 0xc1, 0x09, 0x18, 0x09, 0x40, 0xf9, + 0x59, 0xc8, 0x48, 0x39, 0x2a, 0xa0, 0xb3, 0x38, 0x15, 0x97, 0x0c, 0x23, 0xf0, 0xf0, 0x86, 0xd6, + 0x6a, 0x31, 0x3b, 0x5c, 0xa6, 0x6d, 0x1c, 0xe6, 0xac, 0x16, 0xd8, 0xc5, 0x5b, 0x41, 0xe4, 0x99, + 0x5d, 0xd9, 0xf0, 0xeb, 0x70, 0x23, 0x9d, 0x97, 0x88, 0x7c, 0xe0, 0x2f, 0x08, 0x7c, 0xe8, 0x9f, + 0x3e, 0x8b, 0xeb, 0x78, 0x75, 0xb3, 0xd5, 0xb2, 0x6c, 0x97, 0xd5, 0x39, 0x33, 0x87, 0xde, 0xc2, + 0x00, 0x26, 0xca, 0x43, 0x3c, 0x67, 0x60, 0x88, 0x77, 0x19, 0xa0, 0x08, 0xf7, 0x3e, 0x3f, 0x32, + 0x58, 0x49, 0x6f, 0x60, 0x0e, 0xe3, 0x25, 0xf0, 0x96, 0xcd, 0xfc, 0xad, 0xe4, 0xb6, 0x65, 0xcb, + 0xe6, 0x40, 0x26, 0xd0, 0x3c, 0x7b, 0x04, 0xb3, 0x02, 0xa3, 0x1e, 0xeb, 0x4a, 0x6c, 0x53, 0x3b, + 0x9b, 0x9f, 0x2f, 0x87, 0xde, 0xca, 0x50, 0x0b, 0x9f, 0xe9, 0x74, 0x94, 0x8e, 0x08, 0x2d, 0x70, + 0x98, 0xde, 0x15, 0x14, 0x8c, 0x50, 0x89, 0x20, 0xee, 0x67, 0x81, 0x98, 0x97, 0x04, 0xc1, 0x57, + 0x99, 0x08, 0x44, 0x50, 0x4b, 0x0f, 0xac, 0x3a, 0x5b, 0xf2, 0xd5, 0x5a, 0xbe, 0x5a, 0x7a, 0x37, + 0x52, 0x4b, 0x31, 0x1b, 0x04, 0x78, 0x0f, 0xc6, 0x44, 0xe5, 0x27, 0x25, 0x97, 0x44, 0x3f, 0xa3, + 0x66, 0xf4, 0x22, 0x0a, 0xa5, 0x0c, 0x7c, 0xfd, 0x4a, 0x29, 0x3e, 0x15, 0x84, 0x52, 0x16, 0xa5, + 0xbb, 0x30, 0x2a, 0x14, 0x4b, 0x09, 0xa5, 0x18, 0x23, 0xe1, 0xa5, 0x7f, 0xf9, 0x45, 0xb0, 0xde, + 0xbd, 0x69, 0x12, 0x2a, 0xf4, 0xdb, 0x9e, 0x40, 0x0f, 0x26, 0xd2, 0x0f, 0x14, 0x5c, 0xf0, 0x59, + 0x4d, 0x90, 0xda, 0xb7, 0x61, 0x22, 0xa9, 0xef, 0x31, 0x90, 0xf9, 0x5b, 0x6d, 0xc2, 0x1f, 0x1e, + 0xdb, 0x87, 0x6a, 0xf1, 0x62, 0x7a, 0x14, 0x4f, 0xd5, 0x65, 0xe6, 0xde, 0xe3, 0x5f, 0x09, 0x02, + 0x6c, 0xdf, 0xc0, 0x3c, 0x51, 0xa8, 0x40, 0x44, 0xd7, 0x60, 0xc8, 0xff, 0xa0, 0x20, 0x95, 0x35, + 0xa0, 0x31, 0x9a, 0xd0, 0x53, 0xb8, 0x87, 0xae, 0x36, 0xad, 0x0f, 0x82, 0x3d, 0xe9, 0xa6, 0x30, + 0x65, 0xbc, 0x98, 0xcc, 0x74, 0x6a, 0x81, 0x00, 0xbe, 0x03, 0x87, 0x0d, 0xcd, 0x71, 0x2b, 0xe1, + 0x46, 0x28, 0xce, 0xe3, 0x42, 0x2e, 0x9a, 0xfb, 0x9a, 0xe3, 0xc6, 0x9d, 0x4e, 0x1a, 0xc9, 0x22, + 0x7a, 0x17, 0x31, 0x96, 0x0c, 0x6d, 0x83, 0x65, 0xa5, 0x0c, 0xe7, 0x61, 0x82, 0x7f, 0xc3, 0x49, + 0x1f, 0xb5, 0x87, 0x78, 0xb9, 0x90, 0x30, 0xd4, 0x82, 0xfc, 0x23, 0xed, 0x2b, 0x4c, 0xc2, 0x00, + 0x9d, 0x99, 0xeb, 0x16, 0x92, 0xa0, 0xf9, 0xe7, 0x9d, 0xd7, 0xdc, 0xcb, 0x1d, 0xbd, 0xae, 0xcc, + 0x75, 0x8b, 0xb2, 0x68, 0x75, 0xf8, 0x75, 0xac, 0x66, 0xd9, 0xf5, 0xbe, 0x6b, 0xf1, 0x5f, 0x29, + 0x91, 0xe8, 0x8f, 0xf7, 0x83, 0x54, 0x96, 0x13, 0x54, 0x06, 0xe4, 0xa8, 0xe0, 0xdc, 0x8c, 0x08, + 0xf5, 0x6f, 0x0d, 0xae, 0xa2, 0xf4, 0xc6, 0xf0, 0xf3, 0xe3, 0x62, 0xc9, 0xac, 0x73, 0x6d, 0x2b, + 0x91, 0xf1, 0x4f, 0xc1, 0x20, 0x57, 0xd3, 0x28, 0xcf, 0xfc, 0x17, 0xba, 0x8e, 0x87, 0x59, 0xb6, + 0xd3, 0x0e, 0xc3, 0x3a, 0xd0, 0xfb, 0xb0, 0x0a, 0x7b, 0x6b, 0x89, 0xeb, 0x04, 0xfe, 0x6d, 0xb0, + 0xdf, 0xa3, 0xfa, 0x89, 0x22, 0xce, 0x1e, 0xa1, 0x9b, 0x50, 0xd3, 0x8f, 0x8b, 0x9f, 0x26, 0x83, + 0x83, 0xfe, 0x70, 0x70, 0xd0, 0x8b, 0x36, 0x63, 0xd5, 0xe8, 0xa5, 0x8f, 0x1f, 0x50, 0x96, 0x70, + 0x14, 0x97, 0x99, 0x2b, 0xf4, 0x56, 0xf2, 0xa4, 0x40, 0x33, 0x08, 0x47, 0x5c, 0x5e, 0x79, 0xe1, + 0x18, 0x13, 0xe4, 0x15, 0x7d, 0x27, 0x4a, 0x40, 0x32, 0x5c, 0x20, 0xd5, 0x97, 0x61, 0x4c, 0xa4, + 0x8a, 0x41, 0xcd, 0x64, 0x3a, 0x2a, 0x30, 0xa5, 0xd7, 0xa3, 0x6d, 0x5c, 0x68, 0xe3, 0xa5, 0xa0, + 0x12, 0x93, 0x8c, 0x7e, 0x3f, 0x93, 0x1d, 0x5a, 0x23, 0xb2, 0x77, 0x80, 0x88, 0xc8, 0x78, 0x76, + 0xcc, 0x10, 0xdf, 0xc5, 0x2e, 0xb3, 0x2a, 0xe1, 0x72, 0xa2, 0x9a, 0x28, 0x59, 0xf8, 0xdf, 0x79, + 0x18, 0xe4, 0x08, 0xc8, 0xc7, 0x0a, 0x0c, 0xf9, 0x89, 0x07, 0x29, 0xe6, 0x7a, 0x4d, 0x6b, 0x4c, + 0xf5, 0x45, 0x79, 0x03, 0x9f, 0x14, 0x3d, 0xfd, 0xc3, 0xbf, 0xfd, 0xe7, 0xc7, 0xfb, 0x4f, 0x92, + 0xe9, 0xa2, 0xd7, 0xfe, 0x22, 0x37, 0x2d, 0x26, 0xbe, 0x33, 0x93, 0xdf, 0x2b, 0x30, 0x1c, 0x48, + 0x3e, 0x72, 0xa9, 0x7b, 0x1f, 0x09, 0x21, 0xaa, 0x2e, 0xf4, 0x62, 0x82, 0xc0, 0xee, 0x72, 0x60, + 0x5f, 0x27, 0xa5, 0x4c, 0x60, 0xa1, 0xd8, 0x2c, 0xee, 0xa4, 0x14, 0xd7, 0x6e, 0x71, 0x27, 0x26, + 0x09, 0x77, 0xc9, 0xdf, 0x15, 0x20, 0x69, 0xd9, 0x46, 0xae, 0x75, 0x87, 0xd5, 0x51, 0xb2, 0xaa, + 0xd7, 0xf7, 0x66, 0x8c, 0xec, 0x6e, 0x71, 0x76, 0xaf, 0x91, 0xc5, 0x4c, 0x76, 0x48, 0xa9, 0xda, + 0x16, 0x58, 0x65, 0x11, 0x25, 0x7f, 0x51, 0x60, 0x22, 0xa9, 0x84, 0xc8, 0xd5, 0xee, 0xc8, 0x3a, + 0x48, 0x31, 0xf5, 0xd5, 0xbd, 0x98, 0x22, 0xa5, 0x9b, 0x9c, 0xd2, 0x22, 0xb9, 0x96, 0x49, 0x29, + 0x94, 0x60, 0x1e, 0x2b, 0xbf, 0x6e, 0x27, 0xa5, 0xfa, 0x76, 0xc9, 0x1f, 0x15, 0x20, 0x69, 0xe5, + 0x25, 0x33, 0x52, 0x1d, 0x15, 0x9d, 0xcc, 0x48, 0x75, 0x16, 0x7b, 0xf4, 0x12, 0xa7, 0x35, 0x4f, + 0xce, 0x67, 0xd2, 0xd2, 0x0c, 0xa3, 0x92, 0xd4, 0x82, 0xe4, 0x17, 0x0a, 0x1c, 0x4a, 0x68, 0x35, + 0x99, 0x55, 0x93, 0x30, 0x51, 0xaf, 0xf6, 0x6c, 0x12, 0x82, 0xbe, 0xc0, 0x41, 0xbf, 0x40, 0x9e, + 0xcf, 0x04, 0xed, 0x24, 0xb0, 0xfd, 0x4b, 0x81, 0x23, 0x99, 0xa2, 0x8e, 0xdc, 0xe8, 0x0e, 0x21, + 0x4f, 0x4d, 0xaa, 0xaf, 0xed, 0xd9, 0x5e, 0x6a, 0x52, 0x35, 0x98, 0x5b, 0xa9, 0x19, 0x3a, 0x33, + 0x5d, 0x54, 0x7a, 0x95, 0x75, 0xcb, 0x0e, 0x66, 0x57, 0xb0, 0xd5, 0xef, 0x92, 0x5f, 0x2a, 0x30, + 0x1e, 0xeb, 0x86, 0xbc, 0xdc, 0x23, 0xae, 0x80, 0xcf, 0x2b, 0x3d, 0xdb, 0x49, 0x0d, 0x08, 0xe7, + 0x11, 0xe9, 0x55, 0xf2, 0xa9, 0x12, 0xd3, 0x52, 0x44, 0xae, 0xdb, 0xb4, 0xf6, 0x53, 0xaf, 0xf4, + 0x6e, 0x88, 0x80, 0x5f, 0xe4, 0x80, 0xe7, 0xc8, 0xb9, 0x4c, 0xc0, 0x82, 0xfa, 0x2c, 0xee, 0x70, + 0xc1, 0xbb, 0xeb, 0xcd, 0xfa, 0x83, 0x82, 0xa7, 0x25, 0xc3, 0x90, 0xc1, 0x9d, 0xa9, 0x59, 0x65, + 0x70, 0x67, 0xab, 0x50, 0x7a, 0x8e, 0xe3, 0xa6, 0x64, 0xb6, 0x1b, 0x6e, 0xf2, 0x3b, 0x05, 0x0e, + 0x25, 0x04, 0x9a, 0xcc, 0x3e, 0xd3, 0x51, 0x49, 0xca, 0xec, 0x33, 0x9d, 0x35, 0x26, 0xbd, 0xc8, + 0x81, 0x9f, 0x25, 0x67, 0x32, 0x81, 0x27, 0xe5, 0x27, 0xf9, 0x89, 0x02, 0x43, 0xbe, 0xac, 0x23, + 0x0b, 0x52, 0xfd, 0xc6, 0x94, 0xa5, 0x7a, 0xb9, 0x27, 0x1b, 0xa9, 0x5c, 0xc1, 0x17, 0x97, 0xe4, + 0x4f, 0x0a, 0x4c, 0xa6, 0x64, 0x23, 0x91, 0x38, 0x58, 0x3a, 0xa9, 0x51, 0xf5, 0xda, 0x9e, 0x6c, + 0x11, 0xf3, 0x55, 0x8e, 0xf9, 0x32, 0xb9, 0x24, 0x62, 0x0e, 0xbc, 0x08, 0x5b, 0x62, 0xd3, 0xfa, + 0x20, 0xa1, 0x65, 0xc9, 0x5f, 0x15, 0x98, 0x4c, 0x49, 0x46, 0x19, 0x26, 0x9d, 0x34, 0xab, 0x0c, + 0x93, 0x8e, 0x1a, 0xb5, 0xcb, 0x56, 0xe8, 0xeb, 0x9c, 0x64, 0xc6, 0x90, 0x10, 0xc8, 0xbb, 0x5e, + 0x26, 0x47, 0x96, 0x99, 0x9b, 0x10, 0x8f, 0x44, 0x6e, 0xbd, 0x65, 0xe8, 0x5a, 0x99, 0x43, 0xaa, + 0x83, 0x52, 0xa5, 0x0b, 0x9c, 0xd0, 0x05, 0x32, 0xd7, 0x71, 0x4f, 0xf4, 0x4e, 0x57, 0x9f, 0x83, + 0x8d, 0x40, 0xbf, 0x50, 0xe0, 0x08, 0x77, 0xe6, 0x24, 0x34, 0x1f, 0x59, 0x94, 0x8e, 0x6d, 0x96, + 0x00, 0x55, 0x6f, 0xec, 0xd5, 0x1c, 0xc9, 0xac, 0x70, 0x32, 0x25, 0xf2, 0x7a, 0xfe, 0xe8, 0xf8, + 0x4b, 0x58, 0x33, 0xeb, 0xfe, 0x3f, 0xc4, 0xc2, 0x29, 0x55, 0xdc, 0xe1, 0x25, 0xbb, 0xde, 0xbe, + 0x14, 0x0e, 0x91, 0x20, 0xe4, 0x5e, 0x91, 0x0c, 0x74, 0x52, 0xa3, 0xaa, 0x57, 0x7a, 0x37, 0xec, + 0x71, 0x80, 0x04, 0x61, 0x4a, 0xfe, 0xa9, 0xc0, 0x54, 0x96, 0xbe, 0x93, 0x19, 0x9f, 0x1c, 0x69, + 0xa9, 0xde, 0xd8, 0xab, 0x39, 0x72, 0x29, 0x71, 0x2e, 0xd7, 0xc9, 0xab, 0x1d, 0xb9, 0xc4, 0xb4, + 0x5d, 0xb5, 0xcd, 0x35, 0xac, 0xb7, 0x84, 0x02, 0x3d, 0xbb, 0x4b, 0xfe, 0xab, 0x80, 0x9a, 0x21, + 0x10, 0x83, 0xbc, 0xfb, 0x7a, 0xaf, 0x10, 0x45, 0x71, 0xaa, 0x2e, 0xee, 0xd1, 0x5a, 0x4a, 0x2e, + 0xa5, 0xf8, 0x71, 0xed, 0x1a, 0x4d, 0x48, 0xbd, 0x2e, 0xe6, 0x4b, 0x3f, 0x52, 0x60, 0x90, 0xff, + 0xcf, 0x49, 0x0a, 0x12, 0x7a, 0x52, 0xf8, 0xe3, 0x56, 0x2d, 0x4a, 0xb7, 0x47, 0xd8, 0x94, 0xc3, + 0x3e, 0x41, 0xd4, 0x6c, 0xf9, 0xc9, 0x41, 0x60, 0xfa, 0x16, 0xfd, 0xf9, 0x2e, 0x99, 0xbe, 0xa5, + 0xee, 0x30, 0x48, 0xa6, 0x6f, 0xe9, 0x4b, 0x0b, 0x12, 0xe9, 0x9b, 0xeb, 0x38, 0x81, 0xde, 0x24, + 0x3f, 0xdd, 0x0f, 0x33, 0xf9, 0xb7, 0x05, 0xc8, 0x72, 0x8f, 0x48, 0x3a, 0xdd, 0x7d, 0x50, 0x57, + 0xbe, 0xbc, 0x23, 0xe4, 0x58, 0xe5, 0x1c, 0xbf, 0x45, 0x1e, 0xcb, 0x70, 0xac, 0x34, 0xf9, 0xa5, + 0x02, 0xbd, 0xa6, 0x19, 0xc5, 0x9d, 0xcc, 0xcb, 0x17, 0xbb, 0xc5, 0x9d, 0xe4, 0x05, 0x8b, 0x5d, + 0xf2, 0x91, 0xc2, 0x2f, 0xa7, 0xc8, 0x7c, 0xd8, 0x88, 0xdd, 0x75, 0x91, 0xf9, 0xb0, 0x11, 0xbf, + 0x06, 0x43, 0x67, 0x39, 0x1d, 0x95, 0x1c, 0xcb, 0xa4, 0xe3, 0x81, 0xf8, 0x44, 0x01, 0x88, 0xae, + 0x47, 0x10, 0x89, 0x94, 0x28, 0x75, 0x5f, 0x43, 0x7d, 0xa9, 0x37, 0x23, 0xc4, 0x76, 0x96, 0x63, + 0x7b, 0x8e, 0x9c, 0xca, 0xc4, 0xe6, 0x46, 0x98, 0x7e, 0xad, 0xc0, 0x44, 0xec, 0x7e, 0x90, 0x97, + 0x55, 0xcb, 0x1d, 0xb9, 0x59, 0x37, 0xc2, 0x64, 0xf4, 0x7d, 0xa7, 0x3b, 0x5e, 0x74, 0x8e, 0x83, + 0x7e, 0x9e, 0xd0, 0xec, 0xa5, 0x1a, 0xbb, 0xb6, 0xf5, 0x67, 0x05, 0xa6, 0xb2, 0xae, 0x4a, 0xc9, + 0x9c, 0x02, 0x39, 0x37, 0xb4, 0x64, 0x4e, 0x81, 0xbc, 0x1b, 0x5a, 0xf4, 0x6b, 0x9c, 0x43, 0x91, + 0x5c, 0xec, 0xce, 0x41, 0xdc, 0x10, 0x3d, 0x3d, 0x26, 0xde, 0xe0, 0x93, 0x94, 0x81, 0xa9, 0x4b, + 0x8b, 0x92, 0x7a, 0x2c, 0xe3, 0x1a, 0x62, 0x17, 0x3d, 0x56, 0x8b, 0x2c, 0x62, 0x7a, 0x4c, 0xf0, + 0x24, 0xaf, 0xc7, 0xf6, 0x86, 0x3b, 0xfb, 0xfa, 0x64, 0x17, 0x3d, 0x26, 0xe0, 0x2e, 0xdd, 0xf9, + 0xec, 0xc9, 0x8c, 0xf2, 0xf9, 0x93, 0x19, 0xe5, 0x8b, 0x27, 0x33, 0xca, 0xc7, 0x4f, 0x67, 0xf6, + 0x7d, 0xfe, 0x74, 0x66, 0xdf, 0x3f, 0x9e, 0xce, 0xec, 0x7b, 0x5c, 0x6c, 0xe8, 0x6e, 0x73, 0xb3, + 0x5a, 0xa8, 0x59, 0x1b, 0x99, 0x59, 0xfc, 0xb6, 0xb0, 0x76, 0xda, 0x2d, 0xe6, 0x54, 0x87, 0xf8, + 0x2d, 0xd7, 0xcb, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x0f, 0x98, 0x37, 0x26, 0xae, 0x2c, 0x00, + 0x00, } -func (m *QuerySupportedChains) 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 +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// 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 { + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Query if a voter has voted for a ballot + HasVoted(ctx context.Context, in *QueryHasVotedRequest, opts ...grpc.CallOption) (*QueryHasVotedResponse, error) + // Queries a list of VoterByIdentifier items. + BallotByIdentifier(ctx context.Context, in *QueryBallotByIdentifierRequest, opts ...grpc.CallOption) (*QueryBallotByIdentifierResponse, error) + // Queries a list of ObserversByChainAndType items. + ObserversByChain(ctx context.Context, in *QueryObserversByChainRequest, opts ...grpc.CallOption) (*QueryObserversByChainResponse, error) + AllObserverMappers(ctx context.Context, in *QueryAllObserverMappersRequest, opts ...grpc.CallOption) (*QueryAllObserverMappersResponse, error) + SupportedChains(ctx context.Context, in *QuerySupportedChains, opts ...grpc.CallOption) (*QuerySupportedChainsResponse, error) + // Queries a list of GetClientParamsForChain items. + GetCoreParamsForChain(ctx context.Context, in *QueryGetCoreParamsForChainRequest, opts ...grpc.CallOption) (*QueryGetCoreParamsForChainResponse, error) + // Queries a list of GetCoreParams items. + GetCoreParams(ctx context.Context, in *QueryGetCoreParamsRequest, opts ...grpc.CallOption) (*QueryGetCoreParamsResponse, error) + // Queries a nodeAccount by index. + NodeAccount(ctx context.Context, in *QueryGetNodeAccountRequest, opts ...grpc.CallOption) (*QueryGetNodeAccountResponse, error) + // Queries a list of nodeAccount items. + NodeAccountAll(ctx context.Context, in *QueryAllNodeAccountRequest, opts ...grpc.CallOption) (*QueryAllNodeAccountResponse, error) + CrosschainFlags(ctx context.Context, in *QueryGetCrosschainFlagsRequest, opts ...grpc.CallOption) (*QueryGetCrosschainFlagsResponse, error) + // Queries a keygen by index. + Keygen(ctx context.Context, in *QueryGetKeygenRequest, opts ...grpc.CallOption) (*QueryGetKeygenResponse, error) + // Queries a list of ShowObserverCount items. + ShowObserverCount(ctx context.Context, in *QueryShowObserverCountRequest, opts ...grpc.CallOption) (*QueryShowObserverCountResponse, error) + // Queries a list of VoterByIdentifier items. + BlameByIdentifier(ctx context.Context, in *QueryBlameByIdentifierRequest, opts ...grpc.CallOption) (*QueryBlameByIdentifierResponse, error) + // Queries a list of VoterByIdentifier items. + GetAllBlameRecords(ctx context.Context, in *QueryAllBlameRecordsRequest, opts ...grpc.CallOption) (*QueryAllBlameRecordsResponse, error) + // Queries a list of VoterByIdentifier items. + BlamesByChainAndNonce(ctx context.Context, in *QueryBlameByChainAndNonceRequest, opts ...grpc.CallOption) (*QueryBlameByChainAndNonceResponse, error) + GetAllBlockHeaders(ctx context.Context, in *QueryAllBlockHeaderRequest, opts ...grpc.CallOption) (*QueryAllBlockHeaderResponse, error) + GetBlockHeaderByHash(ctx context.Context, in *QueryGetBlockHeaderByHashRequest, opts ...grpc.CallOption) (*QueryGetBlockHeaderByHashResponse, error) + GetBlockHeaderStateByChain(ctx context.Context, in *QueryGetBlockHeaderStateRequest, opts ...grpc.CallOption) (*QueryGetBlockHeaderStateResponse, error) + // merkle proof verification + Prove(ctx context.Context, in *QueryProveRequest, opts ...grpc.CallOption) (*QueryProveResponse, error) + // Queries a list of GetTssAddress items. + GetTssAddress(ctx context.Context, in *QueryGetTssAddressRequest, opts ...grpc.CallOption) (*QueryGetTssAddressResponse, error) + GetTssAddressByFinalizedHeight(ctx context.Context, in *QueryGetTssAddressByFinalizedHeightRequest, opts ...grpc.CallOption) (*QueryGetTssAddressByFinalizedHeightResponse, error) + // Queries a tSS by index. + TSS(ctx context.Context, in *QueryGetTSSRequest, opts ...grpc.CallOption) (*QueryGetTSSResponse, error) + TssHistory(ctx context.Context, in *QueryTssHistoryRequest, opts ...grpc.CallOption) (*QueryTssHistoryResponse, error) + PendingNoncesAll(ctx context.Context, in *QueryAllPendingNoncesRequest, opts ...grpc.CallOption) (*QueryAllPendingNoncesResponse, error) + PendingNoncesByChain(ctx context.Context, in *QueryPendingNoncesByChainRequest, opts ...grpc.CallOption) (*QueryPendingNoncesByChainResponse, error) + // Queries a chainNonces by index. + ChainNonces(ctx context.Context, in *QueryGetChainNoncesRequest, opts ...grpc.CallOption) (*QueryGetChainNoncesResponse, error) + // Queries a list of chainNonces items. + ChainNoncesAll(ctx context.Context, in *QueryAllChainNoncesRequest, opts ...grpc.CallOption) (*QueryAllChainNoncesResponse, error) } -func (m *QuerySupportedChains) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +type queryClient struct { + cc grpc1.ClientConn } -func (m *QuerySupportedChains) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} } -func (m *QuerySupportedChainsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/Params", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QuerySupportedChainsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) HasVoted(ctx context.Context, in *QueryHasVotedRequest, opts ...grpc.CallOption) (*QueryHasVotedResponse, error) { + out := new(QueryHasVotedResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/HasVoted", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QuerySupportedChainsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Chains) > 0 { - for iNdEx := len(m.Chains) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Chains[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } +func (c *queryClient) BallotByIdentifier(ctx context.Context, in *QueryBallotByIdentifierRequest, opts ...grpc.CallOption) (*QueryBallotByIdentifierResponse, error) { + out := new(QueryBallotByIdentifierResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/BallotByIdentifier", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryGetCoreParamsForChainRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) ObserversByChain(ctx context.Context, in *QueryObserversByChainRequest, opts ...grpc.CallOption) (*QueryObserversByChainResponse, error) { + out := new(QueryObserversByChainResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/ObserversByChain", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryGetCoreParamsForChainRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) AllObserverMappers(ctx context.Context, in *QueryAllObserverMappersRequest, opts ...grpc.CallOption) (*QueryAllObserverMappersResponse, error) { + out := new(QueryAllObserverMappersResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/AllObserverMappers", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryGetCoreParamsForChainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ChainId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ChainId)) - i-- - dAtA[i] = 0x8 +func (c *queryClient) SupportedChains(ctx context.Context, in *QuerySupportedChains, opts ...grpc.CallOption) (*QuerySupportedChainsResponse, error) { + out := new(QuerySupportedChainsResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/SupportedChains", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryGetCoreParamsForChainResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) GetCoreParamsForChain(ctx context.Context, in *QueryGetCoreParamsForChainRequest, opts ...grpc.CallOption) (*QueryGetCoreParamsForChainResponse, error) { + out := new(QueryGetCoreParamsForChainResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetCoreParamsForChain", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryGetCoreParamsForChainResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) GetCoreParams(ctx context.Context, in *QueryGetCoreParamsRequest, opts ...grpc.CallOption) (*QueryGetCoreParamsResponse, error) { + out := new(QueryGetCoreParamsResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetCoreParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryGetCoreParamsForChainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.CoreParams != nil { - { - size, err := m.CoreParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa +func (c *queryClient) NodeAccount(ctx context.Context, in *QueryGetNodeAccountRequest, opts ...grpc.CallOption) (*QueryGetNodeAccountResponse, error) { + out := new(QueryGetNodeAccountResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/NodeAccount", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryGetCoreParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) NodeAccountAll(ctx context.Context, in *QueryAllNodeAccountRequest, opts ...grpc.CallOption) (*QueryAllNodeAccountResponse, error) { + out := new(QueryAllNodeAccountResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/NodeAccountAll", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryGetCoreParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return out, nil } -func (m *QueryGetCoreParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil +func (c *queryClient) CrosschainFlags(ctx context.Context, in *QueryGetCrosschainFlagsRequest, opts ...grpc.CallOption) (*QueryGetCrosschainFlagsResponse, error) { + out := new(QueryGetCrosschainFlagsResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/CrosschainFlags", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryGetCoreParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) Keygen(ctx context.Context, in *QueryGetKeygenRequest, opts ...grpc.CallOption) (*QueryGetKeygenResponse, error) { + out := new(QueryGetKeygenResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/Keygen", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryGetCoreParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) ShowObserverCount(ctx context.Context, in *QueryShowObserverCountRequest, opts ...grpc.CallOption) (*QueryShowObserverCountResponse, error) { + out := new(QueryShowObserverCountResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/ShowObserverCount", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryGetCoreParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.CoreParams != nil { - { - size, err := m.CoreParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa +func (c *queryClient) BlameByIdentifier(ctx context.Context, in *QueryBlameByIdentifierRequest, opts ...grpc.CallOption) (*QueryBlameByIdentifierResponse, error) { + out := new(QueryBlameByIdentifierResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/BlameByIdentifier", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryGetNodeAccountRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) GetAllBlameRecords(ctx context.Context, in *QueryAllBlameRecordsRequest, opts ...grpc.CallOption) (*QueryAllBlameRecordsResponse, error) { + out := new(QueryAllBlameRecordsResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetAllBlameRecords", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryGetNodeAccountRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) BlamesByChainAndNonce(ctx context.Context, in *QueryBlameByChainAndNonceRequest, opts ...grpc.CallOption) (*QueryBlameByChainAndNonceResponse, error) { + out := new(QueryBlameByChainAndNonceResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/BlamesByChainAndNonce", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryGetNodeAccountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Index) > 0 { - i -= len(m.Index) - copy(dAtA[i:], m.Index) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Index))) - i-- - dAtA[i] = 0xa +func (c *queryClient) GetAllBlockHeaders(ctx context.Context, in *QueryAllBlockHeaderRequest, opts ...grpc.CallOption) (*QueryAllBlockHeaderResponse, error) { + out := new(QueryAllBlockHeaderResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetAllBlockHeaders", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryGetNodeAccountResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) GetBlockHeaderByHash(ctx context.Context, in *QueryGetBlockHeaderByHashRequest, opts ...grpc.CallOption) (*QueryGetBlockHeaderByHashResponse, error) { + out := new(QueryGetBlockHeaderByHashResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetBlockHeaderByHash", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryGetNodeAccountResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) GetBlockHeaderStateByChain(ctx context.Context, in *QueryGetBlockHeaderStateRequest, opts ...grpc.CallOption) (*QueryGetBlockHeaderStateResponse, error) { + out := new(QueryGetBlockHeaderStateResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetBlockHeaderStateByChain", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryGetNodeAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.NodeAccount != nil { - { - size, err := m.NodeAccount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa +func (c *queryClient) Prove(ctx context.Context, in *QueryProveRequest, opts ...grpc.CallOption) (*QueryProveResponse, error) { + out := new(QueryProveResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/Prove", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryAllNodeAccountRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) GetTssAddress(ctx context.Context, in *QueryGetTssAddressRequest, opts ...grpc.CallOption) (*QueryGetTssAddressResponse, error) { + out := new(QueryGetTssAddressResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetTssAddress", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryAllNodeAccountRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) GetTssAddressByFinalizedHeight(ctx context.Context, in *QueryGetTssAddressByFinalizedHeightRequest, opts ...grpc.CallOption) (*QueryGetTssAddressByFinalizedHeightResponse, error) { + out := new(QueryGetTssAddressByFinalizedHeightResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetTssAddressByFinalizedHeight", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryAllNodeAccountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa +func (c *queryClient) TSS(ctx context.Context, in *QueryGetTSSRequest, opts ...grpc.CallOption) (*QueryGetTSSResponse, error) { + out := new(QueryGetTSSResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/TSS", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryAllNodeAccountResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) TssHistory(ctx context.Context, in *QueryTssHistoryRequest, opts ...grpc.CallOption) (*QueryTssHistoryResponse, error) { + out := new(QueryTssHistoryResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/TssHistory", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryAllNodeAccountResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) PendingNoncesAll(ctx context.Context, in *QueryAllPendingNoncesRequest, opts ...grpc.CallOption) (*QueryAllPendingNoncesResponse, error) { + out := new(QueryAllPendingNoncesResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/PendingNoncesAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryAllNodeAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.NodeAccount) > 0 { - for iNdEx := len(m.NodeAccount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.NodeAccount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } +func (c *queryClient) PendingNoncesByChain(ctx context.Context, in *QueryPendingNoncesByChainRequest, opts ...grpc.CallOption) (*QueryPendingNoncesByChainResponse, error) { + out := new(QueryPendingNoncesByChainResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/PendingNoncesByChain", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryGetCrosschainFlagsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) ChainNonces(ctx context.Context, in *QueryGetChainNoncesRequest, opts ...grpc.CallOption) (*QueryGetChainNoncesResponse, error) { + out := new(QueryGetChainNoncesResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/ChainNonces", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryGetCrosschainFlagsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) ChainNoncesAll(ctx context.Context, in *QueryAllChainNoncesRequest, opts ...grpc.CallOption) (*QueryAllChainNoncesResponse, error) { + out := new(QueryAllChainNoncesResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/ChainNoncesAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryGetCrosschainFlagsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Query if a voter has voted for a ballot + HasVoted(context.Context, *QueryHasVotedRequest) (*QueryHasVotedResponse, error) + // Queries a list of VoterByIdentifier items. + BallotByIdentifier(context.Context, *QueryBallotByIdentifierRequest) (*QueryBallotByIdentifierResponse, error) + // Queries a list of ObserversByChainAndType items. + ObserversByChain(context.Context, *QueryObserversByChainRequest) (*QueryObserversByChainResponse, error) + AllObserverMappers(context.Context, *QueryAllObserverMappersRequest) (*QueryAllObserverMappersResponse, error) + SupportedChains(context.Context, *QuerySupportedChains) (*QuerySupportedChainsResponse, error) + // Queries a list of GetClientParamsForChain items. + GetCoreParamsForChain(context.Context, *QueryGetCoreParamsForChainRequest) (*QueryGetCoreParamsForChainResponse, error) + // Queries a list of GetCoreParams items. + GetCoreParams(context.Context, *QueryGetCoreParamsRequest) (*QueryGetCoreParamsResponse, error) + // Queries a nodeAccount by index. + NodeAccount(context.Context, *QueryGetNodeAccountRequest) (*QueryGetNodeAccountResponse, error) + // Queries a list of nodeAccount items. + NodeAccountAll(context.Context, *QueryAllNodeAccountRequest) (*QueryAllNodeAccountResponse, error) + CrosschainFlags(context.Context, *QueryGetCrosschainFlagsRequest) (*QueryGetCrosschainFlagsResponse, error) + // Queries a keygen by index. + Keygen(context.Context, *QueryGetKeygenRequest) (*QueryGetKeygenResponse, error) + // Queries a list of ShowObserverCount items. + ShowObserverCount(context.Context, *QueryShowObserverCountRequest) (*QueryShowObserverCountResponse, error) + // Queries a list of VoterByIdentifier items. + BlameByIdentifier(context.Context, *QueryBlameByIdentifierRequest) (*QueryBlameByIdentifierResponse, error) + // Queries a list of VoterByIdentifier items. + GetAllBlameRecords(context.Context, *QueryAllBlameRecordsRequest) (*QueryAllBlameRecordsResponse, error) + // Queries a list of VoterByIdentifier items. + BlamesByChainAndNonce(context.Context, *QueryBlameByChainAndNonceRequest) (*QueryBlameByChainAndNonceResponse, error) + GetAllBlockHeaders(context.Context, *QueryAllBlockHeaderRequest) (*QueryAllBlockHeaderResponse, error) + GetBlockHeaderByHash(context.Context, *QueryGetBlockHeaderByHashRequest) (*QueryGetBlockHeaderByHashResponse, error) + GetBlockHeaderStateByChain(context.Context, *QueryGetBlockHeaderStateRequest) (*QueryGetBlockHeaderStateResponse, error) + // merkle proof verification + Prove(context.Context, *QueryProveRequest) (*QueryProveResponse, error) + // Queries a list of GetTssAddress items. + GetTssAddress(context.Context, *QueryGetTssAddressRequest) (*QueryGetTssAddressResponse, error) + GetTssAddressByFinalizedHeight(context.Context, *QueryGetTssAddressByFinalizedHeightRequest) (*QueryGetTssAddressByFinalizedHeightResponse, error) + // Queries a tSS by index. + TSS(context.Context, *QueryGetTSSRequest) (*QueryGetTSSResponse, error) + TssHistory(context.Context, *QueryTssHistoryRequest) (*QueryTssHistoryResponse, error) + PendingNoncesAll(context.Context, *QueryAllPendingNoncesRequest) (*QueryAllPendingNoncesResponse, error) + PendingNoncesByChain(context.Context, *QueryPendingNoncesByChainRequest) (*QueryPendingNoncesByChainResponse, error) + // Queries a chainNonces by index. + ChainNonces(context.Context, *QueryGetChainNoncesRequest) (*QueryGetChainNoncesResponse, error) + // Queries a list of chainNonces items. + ChainNoncesAll(context.Context, *QueryAllChainNoncesRequest) (*QueryAllChainNoncesResponse, error) } -func (m *QueryGetCrosschainFlagsResponse) 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 +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { } -func (m *QueryGetCrosschainFlagsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } - -func (m *QueryGetCrosschainFlagsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.CrosschainFlags.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil +func (*UnimplementedQueryServer) HasVoted(ctx context.Context, req *QueryHasVotedRequest) (*QueryHasVotedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HasVoted not implemented") } - -func (m *QueryGetKeygenRequest) 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 (*UnimplementedQueryServer) BallotByIdentifier(ctx context.Context, req *QueryBallotByIdentifierRequest) (*QueryBallotByIdentifierResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BallotByIdentifier not implemented") } - -func (m *QueryGetKeygenRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (*UnimplementedQueryServer) ObserversByChain(ctx context.Context, req *QueryObserversByChainRequest) (*QueryObserversByChainResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ObserversByChain not implemented") } - -func (m *QueryGetKeygenRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil +func (*UnimplementedQueryServer) AllObserverMappers(ctx context.Context, req *QueryAllObserverMappersRequest) (*QueryAllObserverMappersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AllObserverMappers not implemented") } - -func (m *QueryGetKeygenResponse) 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 (*UnimplementedQueryServer) SupportedChains(ctx context.Context, req *QuerySupportedChains) (*QuerySupportedChainsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SupportedChains not implemented") } - -func (m *QueryGetKeygenResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (*UnimplementedQueryServer) GetCoreParamsForChain(ctx context.Context, req *QueryGetCoreParamsForChainRequest) (*QueryGetCoreParamsForChainResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCoreParamsForChain not implemented") } - -func (m *QueryGetKeygenResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Keygen != nil { - { - size, err := m.Keygen.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil +func (*UnimplementedQueryServer) GetCoreParams(ctx context.Context, req *QueryGetCoreParamsRequest) (*QueryGetCoreParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCoreParams not implemented") } - -func (m *QueryShowObserverCountRequest) 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 (*UnimplementedQueryServer) NodeAccount(ctx context.Context, req *QueryGetNodeAccountRequest) (*QueryGetNodeAccountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NodeAccount not implemented") } - -func (m *QueryShowObserverCountRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (*UnimplementedQueryServer) NodeAccountAll(ctx context.Context, req *QueryAllNodeAccountRequest) (*QueryAllNodeAccountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NodeAccountAll not implemented") } - -func (m *QueryShowObserverCountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil +func (*UnimplementedQueryServer) CrosschainFlags(ctx context.Context, req *QueryGetCrosschainFlagsRequest) (*QueryGetCrosschainFlagsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CrosschainFlags not implemented") } - -func (m *QueryShowObserverCountResponse) 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 (*UnimplementedQueryServer) Keygen(ctx context.Context, req *QueryGetKeygenRequest) (*QueryGetKeygenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Keygen not implemented") +} +func (*UnimplementedQueryServer) ShowObserverCount(ctx context.Context, req *QueryShowObserverCountRequest) (*QueryShowObserverCountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ShowObserverCount not implemented") +} +func (*UnimplementedQueryServer) BlameByIdentifier(ctx context.Context, req *QueryBlameByIdentifierRequest) (*QueryBlameByIdentifierResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BlameByIdentifier not implemented") +} +func (*UnimplementedQueryServer) GetAllBlameRecords(ctx context.Context, req *QueryAllBlameRecordsRequest) (*QueryAllBlameRecordsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAllBlameRecords not implemented") +} +func (*UnimplementedQueryServer) BlamesByChainAndNonce(ctx context.Context, req *QueryBlameByChainAndNonceRequest) (*QueryBlameByChainAndNonceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BlamesByChainAndNonce not implemented") +} +func (*UnimplementedQueryServer) GetAllBlockHeaders(ctx context.Context, req *QueryAllBlockHeaderRequest) (*QueryAllBlockHeaderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAllBlockHeaders not implemented") +} +func (*UnimplementedQueryServer) GetBlockHeaderByHash(ctx context.Context, req *QueryGetBlockHeaderByHashRequest) (*QueryGetBlockHeaderByHashResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBlockHeaderByHash not implemented") +} +func (*UnimplementedQueryServer) GetBlockHeaderStateByChain(ctx context.Context, req *QueryGetBlockHeaderStateRequest) (*QueryGetBlockHeaderStateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBlockHeaderStateByChain not implemented") +} +func (*UnimplementedQueryServer) Prove(ctx context.Context, req *QueryProveRequest) (*QueryProveResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Prove not implemented") +} +func (*UnimplementedQueryServer) GetTssAddress(ctx context.Context, req *QueryGetTssAddressRequest) (*QueryGetTssAddressResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetTssAddress not implemented") +} +func (*UnimplementedQueryServer) GetTssAddressByFinalizedHeight(ctx context.Context, req *QueryGetTssAddressByFinalizedHeightRequest) (*QueryGetTssAddressByFinalizedHeightResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetTssAddressByFinalizedHeight not implemented") +} +func (*UnimplementedQueryServer) TSS(ctx context.Context, req *QueryGetTSSRequest) (*QueryGetTSSResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TSS not implemented") +} +func (*UnimplementedQueryServer) TssHistory(ctx context.Context, req *QueryTssHistoryRequest) (*QueryTssHistoryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TssHistory not implemented") +} +func (*UnimplementedQueryServer) PendingNoncesAll(ctx context.Context, req *QueryAllPendingNoncesRequest) (*QueryAllPendingNoncesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PendingNoncesAll not implemented") +} +func (*UnimplementedQueryServer) PendingNoncesByChain(ctx context.Context, req *QueryPendingNoncesByChainRequest) (*QueryPendingNoncesByChainResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PendingNoncesByChain not implemented") +} +func (*UnimplementedQueryServer) ChainNonces(ctx context.Context, req *QueryGetChainNoncesRequest) (*QueryGetChainNoncesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ChainNonces not implemented") +} +func (*UnimplementedQueryServer) ChainNoncesAll(ctx context.Context, req *QueryAllChainNoncesRequest) (*QueryAllChainNoncesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ChainNoncesAll not implemented") } -func (m *QueryShowObserverCountResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) } -func (m *QueryShowObserverCountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.LastObserverCount != nil { - { - size, err := m.LastObserverCount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err } - return len(dAtA) - i, nil + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryBlameByIdentifierRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_HasVoted_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryHasVotedRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).HasVoted(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/HasVoted", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).HasVoted(ctx, req.(*QueryHasVotedRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryBlameByIdentifierRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryBlameByIdentifierRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.BlameIdentifier) > 0 { - i -= len(m.BlameIdentifier) - copy(dAtA[i:], m.BlameIdentifier) - i = encodeVarintQuery(dAtA, i, uint64(len(m.BlameIdentifier))) - i-- - dAtA[i] = 0xa +func _Query_BallotByIdentifier_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBallotByIdentifierRequest) + if err := dec(in); err != nil { + return nil, err } - return len(dAtA) - i, nil + if interceptor == nil { + return srv.(QueryServer).BallotByIdentifier(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/BallotByIdentifier", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).BallotByIdentifier(ctx, req.(*QueryBallotByIdentifierRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryBlameByIdentifierResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_ObserversByChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryObserversByChainRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryBlameByIdentifierResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryBlameByIdentifierResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.BlameInfo != nil { - { - size, err := m.BlameInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa + if interceptor == nil { + return srv.(QueryServer).ObserversByChain(ctx, in) } - return len(dAtA) - i, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/ObserversByChain", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ObserversByChain(ctx, req.(*QueryObserversByChainRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryAllBlameRecordsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_AllObserverMappers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllObserverMappersRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryAllBlameRecordsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllBlameRecordsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil + if interceptor == nil { + return srv.(QueryServer).AllObserverMappers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/AllObserverMappers", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AllObserverMappers(ctx, req.(*QueryAllObserverMappersRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryAllBlameRecordsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_SupportedChains_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySupportedChains) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryAllBlameRecordsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + if interceptor == nil { + return srv.(QueryServer).SupportedChains(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/SupportedChains", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).SupportedChains(ctx, req.(*QuerySupportedChains)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryAllBlameRecordsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.BlameInfo) > 0 { - for iNdEx := len(m.BlameInfo) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.BlameInfo[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } +func _Query_GetCoreParamsForChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetCoreParamsForChainRequest) + if err := dec(in); err != nil { + return nil, err } - return len(dAtA) - i, nil + if interceptor == nil { + return srv.(QueryServer).GetCoreParamsForChain(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/GetCoreParamsForChain", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetCoreParamsForChain(ctx, req.(*QueryGetCoreParamsForChainRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryBlameByChainAndNonceRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_GetCoreParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetCoreParamsRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).GetCoreParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/GetCoreParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetCoreParams(ctx, req.(*QueryGetCoreParamsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryBlameByChainAndNonceRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_NodeAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetNodeAccountRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).NodeAccount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/NodeAccount", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).NodeAccount(ctx, req.(*QueryGetNodeAccountRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryBlameByChainAndNonceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Nonce != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Nonce)) - i-- - dAtA[i] = 0x10 +func _Query_NodeAccountAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllNodeAccountRequest) + if err := dec(in); err != nil { + return nil, err } - if m.ChainId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ChainId)) - i-- - dAtA[i] = 0x8 + if interceptor == nil { + return srv.(QueryServer).NodeAccountAll(ctx, in) } - return len(dAtA) - i, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/NodeAccountAll", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).NodeAccountAll(ctx, req.(*QueryAllNodeAccountRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryBlameByChainAndNonceResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_CrosschainFlags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetCrosschainFlagsRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).CrosschainFlags(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/CrosschainFlags", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).CrosschainFlags(ctx, req.(*QueryGetCrosschainFlagsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryBlameByChainAndNonceResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryBlameByChainAndNonceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.BlameInfo) > 0 { - for iNdEx := len(m.BlameInfo) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.BlameInfo[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } +func _Query_Keygen_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetKeygenRequest) + if err := dec(in); err != nil { + return nil, err } - return len(dAtA) - i, nil + if interceptor == nil { + return srv.(QueryServer).Keygen(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/Keygen", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Keygen(ctx, req.(*QueryGetKeygenRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryAllBlockHeaderRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_ShowObserverCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryShowObserverCountRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryAllBlockHeaderRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllBlockHeaderRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa + if interceptor == nil { + return srv.(QueryServer).ShowObserverCount(ctx, in) } - return len(dAtA) - i, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/ShowObserverCount", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ShowObserverCount(ctx, req.(*QueryShowObserverCountRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryAllBlockHeaderResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_BlameByIdentifier_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBlameByIdentifierRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryAllBlockHeaderResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + if interceptor == nil { + return srv.(QueryServer).BlameByIdentifier(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/BlameByIdentifier", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).BlameByIdentifier(ctx, req.(*QueryBlameByIdentifierRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryAllBlockHeaderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 +func _Query_GetAllBlameRecords_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllBlameRecordsRequest) + if err := dec(in); err != nil { + return nil, err } - if len(m.BlockHeaders) > 0 { - for iNdEx := len(m.BlockHeaders) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.BlockHeaders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + if interceptor == nil { + return srv.(QueryServer).GetAllBlameRecords(ctx, in) } - return len(dAtA) - i, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/GetAllBlameRecords", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetAllBlameRecords(ctx, req.(*QueryAllBlameRecordsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryGetBlockHeaderByHashRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_BlamesByChainAndNonce_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBlameByChainAndNonceRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).BlamesByChainAndNonce(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/BlamesByChainAndNonce", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).BlamesByChainAndNonce(ctx, req.(*QueryBlameByChainAndNonceRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryGetBlockHeaderByHashRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_GetAllBlockHeaders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllBlockHeaderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetAllBlockHeaders(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/GetAllBlockHeaders", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetAllBlockHeaders(ctx, req.(*QueryAllBlockHeaderRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryGetBlockHeaderByHashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.BlockHash) > 0 { - i -= len(m.BlockHash) - copy(dAtA[i:], m.BlockHash) - i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockHash))) - i-- - dAtA[i] = 0xa +func _Query_GetBlockHeaderByHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetBlockHeaderByHashRequest) + if err := dec(in); err != nil { + return nil, err } - return len(dAtA) - i, nil + if interceptor == nil { + return srv.(QueryServer).GetBlockHeaderByHash(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/GetBlockHeaderByHash", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetBlockHeaderByHash(ctx, req.(*QueryGetBlockHeaderByHashRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryGetBlockHeaderByHashResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_GetBlockHeaderStateByChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetBlockHeaderStateRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).GetBlockHeaderStateByChain(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/GetBlockHeaderStateByChain", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetBlockHeaderStateByChain(ctx, req.(*QueryGetBlockHeaderStateRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryGetBlockHeaderByHashResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_Prove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryProveRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Prove(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/Prove", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Prove(ctx, req.(*QueryProveRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryGetBlockHeaderByHashResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) +func _Query_GetTssAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetTssAddressRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetTssAddress(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/GetTssAddress", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetTssAddress(ctx, req.(*QueryGetTssAddressRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetTssAddressByFinalizedHeight_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetTssAddressByFinalizedHeightRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetTssAddressByFinalizedHeight(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/GetTssAddressByFinalizedHeight", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetTssAddressByFinalizedHeight(ctx, req.(*QueryGetTssAddressByFinalizedHeightRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_TSS_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetTSSRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TSS(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/TSS", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TSS(ctx, req.(*QueryGetTSSRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_TssHistory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTssHistoryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TssHistory(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/TssHistory", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TssHistory(ctx, req.(*QueryTssHistoryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_PendingNoncesAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllPendingNoncesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).PendingNoncesAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/PendingNoncesAll", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).PendingNoncesAll(ctx, req.(*QueryAllPendingNoncesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_PendingNoncesByChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPendingNoncesByChainRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).PendingNoncesByChain(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/PendingNoncesByChain", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).PendingNoncesByChain(ctx, req.(*QueryPendingNoncesByChainRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ChainNonces_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetChainNoncesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ChainNonces(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/ChainNonces", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ChainNonces(ctx, req.(*QueryGetChainNoncesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ChainNoncesAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllChainNoncesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ChainNoncesAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/ChainNoncesAll", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ChainNoncesAll(ctx, req.(*QueryAllChainNoncesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "zetachain.zetacore.observer.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "HasVoted", + Handler: _Query_HasVoted_Handler, + }, + { + MethodName: "BallotByIdentifier", + Handler: _Query_BallotByIdentifier_Handler, + }, + { + MethodName: "ObserversByChain", + Handler: _Query_ObserversByChain_Handler, + }, + { + MethodName: "AllObserverMappers", + Handler: _Query_AllObserverMappers_Handler, + }, + { + MethodName: "SupportedChains", + Handler: _Query_SupportedChains_Handler, + }, + { + MethodName: "GetCoreParamsForChain", + Handler: _Query_GetCoreParamsForChain_Handler, + }, + { + MethodName: "GetCoreParams", + Handler: _Query_GetCoreParams_Handler, + }, + { + MethodName: "NodeAccount", + Handler: _Query_NodeAccount_Handler, + }, + { + MethodName: "NodeAccountAll", + Handler: _Query_NodeAccountAll_Handler, + }, + { + MethodName: "CrosschainFlags", + Handler: _Query_CrosschainFlags_Handler, + }, + { + MethodName: "Keygen", + Handler: _Query_Keygen_Handler, + }, + { + MethodName: "ShowObserverCount", + Handler: _Query_ShowObserverCount_Handler, + }, + { + MethodName: "BlameByIdentifier", + Handler: _Query_BlameByIdentifier_Handler, + }, + { + MethodName: "GetAllBlameRecords", + Handler: _Query_GetAllBlameRecords_Handler, + }, + { + MethodName: "BlamesByChainAndNonce", + Handler: _Query_BlamesByChainAndNonce_Handler, + }, + { + MethodName: "GetAllBlockHeaders", + Handler: _Query_GetAllBlockHeaders_Handler, + }, + { + MethodName: "GetBlockHeaderByHash", + Handler: _Query_GetBlockHeaderByHash_Handler, + }, + { + MethodName: "GetBlockHeaderStateByChain", + Handler: _Query_GetBlockHeaderStateByChain_Handler, + }, + { + MethodName: "Prove", + Handler: _Query_Prove_Handler, + }, + { + MethodName: "GetTssAddress", + Handler: _Query_GetTssAddress_Handler, + }, + { + MethodName: "GetTssAddressByFinalizedHeight", + Handler: _Query_GetTssAddressByFinalizedHeight_Handler, + }, + { + MethodName: "TSS", + Handler: _Query_TSS_Handler, + }, + { + MethodName: "TssHistory", + Handler: _Query_TssHistory_Handler, + }, + { + MethodName: "PendingNoncesAll", + Handler: _Query_PendingNoncesAll_Handler, + }, + { + MethodName: "PendingNoncesByChain", + Handler: _Query_PendingNoncesByChain_Handler, + }, + { + MethodName: "ChainNonces", + Handler: _Query_ChainNonces_Handler, + }, + { + MethodName: "ChainNoncesAll", + Handler: _Query_ChainNoncesAll_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "observer/query.proto", +} + +func (m *QueryGetChainNoncesRequest) 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 *QueryGetChainNoncesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetChainNoncesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.BlockHeader != nil { - { - size, err := m.BlockHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } + if len(m.Index) > 0 { + i -= len(m.Index) + copy(dAtA[i:], m.Index) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Index))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryGetBlockHeaderStateRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryGetChainNoncesResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3944,25 +3995,30 @@ func (m *QueryGetBlockHeaderStateRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryGetBlockHeaderStateRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryGetChainNoncesResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetBlockHeaderStateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryGetChainNoncesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.ChainId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ChainId)) - i-- - dAtA[i] = 0x8 + { + size, err := m.ChainNonces.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *QueryGetBlockHeaderStateResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryAllChainNoncesRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3972,19 +4028,19 @@ func (m *QueryGetBlockHeaderStateResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryGetBlockHeaderStateResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryAllChainNoncesRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetBlockHeaderStateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryAllChainNoncesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.BlockHeaderState != nil { + if m.Pagination != nil { { - size, err := m.BlockHeaderState.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -3997,543 +4053,4118 @@ func (m *QueryGetBlockHeaderStateResponse) MarshalToSizedBuffer(dAtA []byte) (in return len(dAtA) - i, nil } -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *QueryAllChainNoncesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *QueryProveRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ChainId != 0 { - n += 1 + sovQuery(uint64(m.ChainId)) - } - l = len(m.TxHash) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Proof != nil { - l = m.Proof.Size() - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.BlockHash) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.TxIndex != 0 { - n += 1 + sovQuery(uint64(m.TxIndex)) - } - return n + +func (m *QueryAllChainNoncesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryProveResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryAllChainNoncesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.Valid { - n += 2 + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - return n + if len(m.ChainNonces) > 0 { + for iNdEx := len(m.ChainNonces) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ChainNonces[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil } -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryAllPendingNoncesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n +func (m *QueryAllPendingNoncesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryBallotByIdentifierRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryAllPendingNoncesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.BallotIdentifier) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *VoterList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.VoterAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.VoteType != 0 { - n += 1 + sovQuery(uint64(m.VoteType)) +func (m *QueryAllPendingNoncesResponse) 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 n + return dAtA[:n], nil } -func (m *QueryBallotByIdentifierResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryAllPendingNoncesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllPendingNoncesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.BallotIdentifier) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if len(m.Voters) > 0 { - for _, e := range m.Voters { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 } - if m.ObservationType != 0 { - n += 1 + sovQuery(uint64(m.ObservationType)) - } - if m.BallotStatus != 0 { - n += 1 + sovQuery(uint64(m.BallotStatus)) + if len(m.PendingNonces) > 0 { + for iNdEx := len(m.PendingNonces) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PendingNonces[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return n + return len(dAtA) - i, nil } -func (m *QueryObserversByChainRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ObservationChain) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryPendingNoncesByChainRequest) 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 n + return dAtA[:n], nil } -func (m *QueryObserversByChainResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryPendingNoncesByChainRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPendingNoncesByChainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.Observers) > 0 { - for _, s := range m.Observers { - l = len(s) - n += 1 + l + sovQuery(uint64(l)) - } + if m.ChainId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ChainId)) + i-- + dAtA[i] = 0x8 } - return n + return len(dAtA) - i, nil } -func (m *QueryAllObserverMappersRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryPendingNoncesByChainResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *QueryAllObserverMappersResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryPendingNoncesByChainResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPendingNoncesByChainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.ObserverMappers) > 0 { - for _, e := range m.ObserverMappers { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) + { + size, err := m.PendingNonces.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - return n + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *QuerySupportedChains) Size() (n int) { - if m == nil { - return 0 +func (m *QueryGetTSSRequest) 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 *QueryGetTSSRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetTSSRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - return n + return len(dAtA) - i, nil } -func (m *QuerySupportedChainsResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryGetTSSResponse) 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 *QueryGetTSSResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetTSSResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.Chains) > 0 { - for _, e := range m.Chains { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) + { + size, err := m.TSS.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - return n + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *QueryGetCoreParamsForChainRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ChainId != 0 { - n += 1 + sovQuery(uint64(m.ChainId)) +func (m *QueryGetTssAddressRequest) 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 n + return dAtA[:n], nil } -func (m *QueryGetCoreParamsForChainResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryGetTssAddressRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetTssAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.CoreParams != nil { - l = m.CoreParams.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.BitcoinChainId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.BitcoinChainId)) + i-- + dAtA[i] = 0x10 } - return n + return len(dAtA) - i, nil } -func (m *QueryGetCoreParamsRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryGetTssAddressResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *QueryGetCoreParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.CoreParams != nil { - l = m.CoreParams.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n +func (m *QueryGetTssAddressResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetNodeAccountRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryGetTssAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Index) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.Btc) > 0 { + i -= len(m.Btc) + copy(dAtA[i:], m.Btc) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Btc))) + i-- + dAtA[i] = 0x12 } - return n + if len(m.Eth) > 0 { + i -= len(m.Eth) + copy(dAtA[i:], m.Eth) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Eth))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *QueryGetNodeAccountResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.NodeAccount != nil { - l = m.NodeAccount.Size() - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryGetTssAddressByFinalizedHeightRequest) 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 n + return dAtA[:n], nil } -func (m *QueryAllNodeAccountRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n +func (m *QueryGetTssAddressByFinalizedHeightRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllNodeAccountResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryGetTssAddressByFinalizedHeightRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.NodeAccount) > 0 { - for _, e := range m.NodeAccount { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } + if m.BitcoinChainId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.BitcoinChainId)) + i-- + dAtA[i] = 0x10 } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.FinalizedZetaHeight != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.FinalizedZetaHeight)) + i-- + dAtA[i] = 0x8 } - return n + return len(dAtA) - i, nil } -func (m *QueryGetCrosschainFlagsRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryGetTssAddressByFinalizedHeightResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *QueryGetCrosschainFlagsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.CrosschainFlags.Size() - n += 1 + l + sovQuery(uint64(l)) - return n +func (m *QueryGetTssAddressByFinalizedHeightResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetKeygenRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryGetTssAddressByFinalizedHeightResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - return n -} - -func (m *QueryGetKeygenResponse) Size() (n int) { - if m == nil { - return 0 + if len(m.Btc) > 0 { + i -= len(m.Btc) + copy(dAtA[i:], m.Btc) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Btc))) + i-- + dAtA[i] = 0x12 } - var l int - _ = l - if m.Keygen != nil { - l = m.Keygen.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.Eth) > 0 { + i -= len(m.Eth) + copy(dAtA[i:], m.Eth) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Eth))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryShowObserverCountRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryTssHistoryRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *QueryShowObserverCountResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryTssHistoryRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTssHistoryRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.LastObserverCount != nil { - l = m.LastObserverCount.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryBlameByIdentifierRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.BlameIdentifier) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryTssHistoryResponse) 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 n + return dAtA[:n], nil } -func (m *QueryBlameByIdentifierResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryTssHistoryResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTssHistoryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.BlameInfo != nil { - l = m.BlameInfo.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - return n + if len(m.TssList) > 0 { + for iNdEx := len(m.TssList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TssList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil } -func (m *QueryAllBlameRecordsRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryProveRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *QueryAllBlameRecordsResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryProveRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProveRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.BlameInfo) > 0 { - for _, e := range m.BlameInfo { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.TxIndex != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.TxIndex)) + i-- + dAtA[i] = 0x28 + } + if len(m.BlockHash) > 0 { + i -= len(m.BlockHash) + copy(dAtA[i:], m.BlockHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockHash))) + i-- + dAtA[i] = 0x22 + } + if m.Proof != nil { + { + size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x1a } - return n -} - -func (m *QueryBlameByChainAndNonceRequest) Size() (n int) { - if m == nil { - return 0 + if len(m.TxHash) > 0 { + i -= len(m.TxHash) + copy(dAtA[i:], m.TxHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.TxHash))) + i-- + dAtA[i] = 0x12 } - var l int - _ = l if m.ChainId != 0 { - n += 1 + sovQuery(uint64(m.ChainId)) - } - if m.Nonce != 0 { - n += 1 + sovQuery(uint64(m.Nonce)) + i = encodeVarintQuery(dAtA, i, uint64(m.ChainId)) + i-- + dAtA[i] = 0x8 } - return n + return len(dAtA) - i, nil } -func (m *QueryBlameByChainAndNonceResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.BlameInfo) > 0 { - for _, e := range m.BlameInfo { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } +func (m *QueryProveResponse) 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 n + return dAtA[:n], nil } -func (m *QueryAllBlockHeaderRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n +func (m *QueryProveResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAllBlockHeaderResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryProveResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.BlockHeaders) > 0 { - for _, e := range m.BlockHeaders { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.Valid { + i-- + if m.Valid { + dAtA[i] = 1 + } else { + dAtA[i] = 0 } + i-- + dAtA[i] = 0x8 } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n + return len(dAtA) - i, nil } -func (m *QueryGetBlockHeaderByHashRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.BlockHash) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryParamsRequest) 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 n + return dAtA[:n], nil } -func (m *QueryGetBlockHeaderByHashResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BlockHeader != nil { - l = m.BlockHeader.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetBlockHeaderStateRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.ChainId != 0 { - n += 1 + sovQuery(uint64(m.ChainId)) - } - return n + return len(dAtA) - i, nil } -func (m *QueryGetBlockHeaderStateResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BlockHeaderState != nil { - l = m.BlockHeaderState.Size() - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryParamsResponse) 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 n + return dAtA[:n], nil } -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryHasVotedRequest) 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 *QueryHasVotedRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryHasVotedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.VoterAddress) > 0 { + i -= len(m.VoterAddress) + copy(dAtA[i:], m.VoterAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.VoterAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.BallotIdentifier) > 0 { + i -= len(m.BallotIdentifier) + copy(dAtA[i:], m.BallotIdentifier) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BallotIdentifier))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryHasVotedResponse) 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 *QueryHasVotedResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryHasVotedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.HasVoted { + i-- + if m.HasVoted { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryBallotByIdentifierRequest) 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 *QueryBallotByIdentifierRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBallotByIdentifierRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BallotIdentifier) > 0 { + i -= len(m.BallotIdentifier) + copy(dAtA[i:], m.BallotIdentifier) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BallotIdentifier))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *VoterList) 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 *VoterList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VoterList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.VoteType != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.VoteType)) + i-- + dAtA[i] = 0x10 + } + if len(m.VoterAddress) > 0 { + i -= len(m.VoterAddress) + copy(dAtA[i:], m.VoterAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.VoterAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBallotByIdentifierResponse) 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 *QueryBallotByIdentifierResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBallotByIdentifierResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BallotStatus != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.BallotStatus)) + i-- + dAtA[i] = 0x20 + } + if m.ObservationType != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ObservationType)) + i-- + dAtA[i] = 0x18 + } + if len(m.Voters) > 0 { + for iNdEx := len(m.Voters) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Voters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.BallotIdentifier) > 0 { + i -= len(m.BallotIdentifier) + copy(dAtA[i:], m.BallotIdentifier) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BallotIdentifier))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryObserversByChainRequest) 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 *QueryObserversByChainRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryObserversByChainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ObservationChain) > 0 { + i -= len(m.ObservationChain) + copy(dAtA[i:], m.ObservationChain) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ObservationChain))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryObserversByChainResponse) 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 *QueryObserversByChainResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryObserversByChainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Observers) > 0 { + for iNdEx := len(m.Observers) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Observers[iNdEx]) + copy(dAtA[i:], m.Observers[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Observers[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryAllObserverMappersRequest) 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 *QueryAllObserverMappersRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllObserverMappersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryAllObserverMappersResponse) 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 *QueryAllObserverMappersResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllObserverMappersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ObserverMappers) > 0 { + for iNdEx := len(m.ObserverMappers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ObserverMappers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QuerySupportedChains) 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 *QuerySupportedChains) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySupportedChains) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QuerySupportedChainsResponse) 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 *QuerySupportedChainsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySupportedChainsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Chains) > 0 { + for iNdEx := len(m.Chains) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Chains[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryGetCoreParamsForChainRequest) 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 *QueryGetCoreParamsForChainRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetCoreParamsForChainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ChainId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ChainId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryGetCoreParamsForChainResponse) 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 *QueryGetCoreParamsForChainResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetCoreParamsForChainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CoreParams != nil { + { + size, err := m.CoreParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetCoreParamsRequest) 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 *QueryGetCoreParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetCoreParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryGetCoreParamsResponse) 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 *QueryGetCoreParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetCoreParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CoreParams != nil { + { + size, err := m.CoreParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetNodeAccountRequest) 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 *QueryGetNodeAccountRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetNodeAccountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Index) > 0 { + i -= len(m.Index) + copy(dAtA[i:], m.Index) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Index))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetNodeAccountResponse) 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 *QueryGetNodeAccountResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetNodeAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.NodeAccount != nil { + { + size, err := m.NodeAccount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllNodeAccountRequest) 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 *QueryAllNodeAccountRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllNodeAccountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllNodeAccountResponse) 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 *QueryAllNodeAccountResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllNodeAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.NodeAccount) > 0 { + for iNdEx := len(m.NodeAccount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.NodeAccount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryGetCrosschainFlagsRequest) 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 *QueryGetCrosschainFlagsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetCrosschainFlagsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryGetCrosschainFlagsResponse) 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 *QueryGetCrosschainFlagsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetCrosschainFlagsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.CrosschainFlags.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryGetKeygenRequest) 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 *QueryGetKeygenRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetKeygenRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryGetKeygenResponse) 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 *QueryGetKeygenResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetKeygenResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Keygen != nil { + { + size, err := m.Keygen.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryShowObserverCountRequest) 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 *QueryShowObserverCountRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryShowObserverCountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryShowObserverCountResponse) 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 *QueryShowObserverCountResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryShowObserverCountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LastObserverCount != nil { + { + size, err := m.LastObserverCount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBlameByIdentifierRequest) 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 *QueryBlameByIdentifierRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBlameByIdentifierRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BlameIdentifier) > 0 { + i -= len(m.BlameIdentifier) + copy(dAtA[i:], m.BlameIdentifier) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BlameIdentifier))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBlameByIdentifierResponse) 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 *QueryBlameByIdentifierResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBlameByIdentifierResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BlameInfo != nil { + { + size, err := m.BlameInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllBlameRecordsRequest) 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 *QueryAllBlameRecordsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllBlameRecordsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllBlameRecordsResponse) 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 *QueryAllBlameRecordsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllBlameRecordsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.BlameInfo) > 0 { + for iNdEx := len(m.BlameInfo) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BlameInfo[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryBlameByChainAndNonceRequest) 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 *QueryBlameByChainAndNonceRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBlameByChainAndNonceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Nonce != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Nonce)) + i-- + dAtA[i] = 0x10 + } + if m.ChainId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ChainId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryBlameByChainAndNonceResponse) 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 *QueryBlameByChainAndNonceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBlameByChainAndNonceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BlameInfo) > 0 { + for iNdEx := len(m.BlameInfo) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BlameInfo[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryAllBlockHeaderRequest) 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 *QueryAllBlockHeaderRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllBlockHeaderRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllBlockHeaderResponse) 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 *QueryAllBlockHeaderResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllBlockHeaderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.BlockHeaders) > 0 { + for iNdEx := len(m.BlockHeaders) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BlockHeaders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryGetBlockHeaderByHashRequest) 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 *QueryGetBlockHeaderByHashRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetBlockHeaderByHashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BlockHash) > 0 { + i -= len(m.BlockHash) + copy(dAtA[i:], m.BlockHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetBlockHeaderByHashResponse) 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 *QueryGetBlockHeaderByHashResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetBlockHeaderByHashResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BlockHeader != nil { + { + size, err := m.BlockHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetBlockHeaderStateRequest) 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 *QueryGetBlockHeaderStateRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetBlockHeaderStateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ChainId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ChainId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryGetBlockHeaderStateResponse) 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 *QueryGetBlockHeaderStateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetBlockHeaderStateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BlockHeaderState != nil { + { + size, err := m.BlockHeaderState.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryGetChainNoncesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Index) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetChainNoncesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ChainNonces.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryAllChainNoncesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllChainNoncesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ChainNonces) > 0 { + for _, e := range m.ChainNonces { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllPendingNoncesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllPendingNoncesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.PendingNonces) > 0 { + for _, e := range m.PendingNonces { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPendingNoncesByChainRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ChainId != 0 { + n += 1 + sovQuery(uint64(m.ChainId)) + } + return n +} + +func (m *QueryPendingNoncesByChainResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.PendingNonces.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGetTSSRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryGetTSSResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.TSS.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGetTssAddressRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BitcoinChainId != 0 { + n += 1 + sovQuery(uint64(m.BitcoinChainId)) + } + return n +} + +func (m *QueryGetTssAddressResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Eth) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Btc) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetTssAddressByFinalizedHeightRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.FinalizedZetaHeight != 0 { + n += 1 + sovQuery(uint64(m.FinalizedZetaHeight)) + } + if m.BitcoinChainId != 0 { + n += 1 + sovQuery(uint64(m.BitcoinChainId)) + } + return n +} + +func (m *QueryGetTssAddressByFinalizedHeightResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Eth) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Btc) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryTssHistoryRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryTssHistoryResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.TssList) > 0 { + for _, e := range m.TssList { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryProveRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ChainId != 0 { + n += 1 + sovQuery(uint64(m.ChainId)) + } + l = len(m.TxHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Proof != nil { + l = m.Proof.Size() + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.BlockHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.TxIndex != 0 { + n += 1 + sovQuery(uint64(m.TxIndex)) + } + return n +} + +func (m *QueryProveResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Valid { + n += 2 + } + return n +} + +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryHasVotedRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BallotIdentifier) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.VoterAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryHasVotedResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.HasVoted { + n += 2 + } + return n +} + +func (m *QueryBallotByIdentifierRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BallotIdentifier) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *VoterList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.VoterAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.VoteType != 0 { + n += 1 + sovQuery(uint64(m.VoteType)) + } + return n +} + +func (m *QueryBallotByIdentifierResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BallotIdentifier) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if len(m.Voters) > 0 { + for _, e := range m.Voters { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.ObservationType != 0 { + n += 1 + sovQuery(uint64(m.ObservationType)) + } + if m.BallotStatus != 0 { + n += 1 + sovQuery(uint64(m.BallotStatus)) + } + return n +} + +func (m *QueryObserversByChainRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ObservationChain) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryObserversByChainResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Observers) > 0 { + for _, s := range m.Observers { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryAllObserverMappersRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryAllObserverMappersResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ObserverMappers) > 0 { + for _, e := range m.ObserverMappers { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QuerySupportedChains) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QuerySupportedChainsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Chains) > 0 { + for _, e := range m.Chains { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryGetCoreParamsForChainRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ChainId != 0 { + n += 1 + sovQuery(uint64(m.ChainId)) + } + return n +} + +func (m *QueryGetCoreParamsForChainResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CoreParams != nil { + l = m.CoreParams.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetCoreParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryGetCoreParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CoreParams != nil { + l = m.CoreParams.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetNodeAccountRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Index) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetNodeAccountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.NodeAccount != nil { + l = m.NodeAccount.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllNodeAccountRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllNodeAccountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.NodeAccount) > 0 { + for _, e := range m.NodeAccount { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetCrosschainFlagsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryGetCrosschainFlagsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CrosschainFlags.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGetKeygenRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryGetKeygenResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Keygen != nil { + l = m.Keygen.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryShowObserverCountRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryShowObserverCountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.LastObserverCount != nil { + l = m.LastObserverCount.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBlameByIdentifierRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BlameIdentifier) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBlameByIdentifierResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BlameInfo != nil { + l = m.BlameInfo.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllBlameRecordsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllBlameRecordsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.BlameInfo) > 0 { + for _, e := range m.BlameInfo { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBlameByChainAndNonceRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ChainId != 0 { + n += 1 + sovQuery(uint64(m.ChainId)) + } + if m.Nonce != 0 { + n += 1 + sovQuery(uint64(m.Nonce)) + } + return n +} + +func (m *QueryBlameByChainAndNonceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.BlameInfo) > 0 { + for _, e := range m.BlameInfo { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryAllBlockHeaderRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllBlockHeaderResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.BlockHeaders) > 0 { + for _, e := range m.BlockHeaders { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetBlockHeaderByHashRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BlockHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetBlockHeaderByHashResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BlockHeader != nil { + l = m.BlockHeader.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetBlockHeaderStateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ChainId != 0 { + n += 1 + sovQuery(uint64(m.ChainId)) + } + return n +} + +func (m *QueryGetBlockHeaderStateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BlockHeaderState != nil { + l = m.BlockHeaderState.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryGetChainNoncesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetChainNoncesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetChainNoncesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Index = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetChainNoncesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetChainNoncesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetChainNoncesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainNonces", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ChainNonces.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllChainNoncesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllChainNoncesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllChainNoncesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllChainNoncesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllChainNoncesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllChainNoncesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainNonces", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainNonces = append(m.ChainNonces, ChainNonces{}) + if err := m.ChainNonces[len(m.ChainNonces)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllPendingNoncesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllPendingNoncesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllPendingNoncesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllPendingNoncesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryAllPendingNoncesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllPendingNoncesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PendingNonces", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PendingNonces = append(m.PendingNonces, PendingNonces{}) + if err := m.PendingNonces[len(m.PendingNonces)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryPendingNoncesByChainRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryPendingNoncesByChainRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPendingNoncesByChainRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + m.ChainId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ChainId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryPendingNoncesByChainResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryPendingNoncesByChainResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPendingNoncesByChainResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PendingNonces", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.PendingNonces.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetTSSRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetTSSRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetTSSRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetTSSResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetTSSResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetTSSResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TSS", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TSS.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetTssAddressRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetTssAddressRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetTssAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BitcoinChainId", wireType) + } + m.BitcoinChainId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BitcoinChainId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetTssAddressResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetTssAddressResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetTssAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Eth", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Eth = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Btc", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Btc = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetTssAddressByFinalizedHeightRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetTssAddressByFinalizedHeightRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetTssAddressByFinalizedHeightRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FinalizedZetaHeight", wireType) + } + m.FinalizedZetaHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FinalizedZetaHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BitcoinChainId", wireType) + } + m.BitcoinChainId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BitcoinChainId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetTssAddressByFinalizedHeightResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetTssAddressByFinalizedHeightResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetTssAddressByFinalizedHeightResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Eth", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Eth = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Btc", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Btc = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTssHistoryRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTssHistoryRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTssHistoryRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTssHistoryResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTssHistoryResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTssHistoryResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TssList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TssList = append(m.TssList, TSS{}) + if err := m.TssList[len(m.TssList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } func (m *QueryProveRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) @@ -4926,6 +8557,190 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryHasVotedRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryHasVotedRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryHasVotedRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BallotIdentifier", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BallotIdentifier = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VoterAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VoterAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryHasVotedResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryHasVotedResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryHasVotedResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HasVoted", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.HasVoted = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *QueryBallotByIdentifierRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -6962,6 +10777,42 @@ func (m *QueryAllBlameRecordsRequest) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: QueryAllBlameRecordsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -7041,11 +10892,47 @@ func (m *QueryAllBlameRecordsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.BlameInfo = append(m.BlameInfo, &Blame{}) + m.BlameInfo = append(m.BlameInfo, Blame{}) if err := m.BlameInfo[len(m.BlameInfo)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/observer/types/query.pb.gw.go b/x/observer/types/query.pb.gw.go index 2650422fe8..91f2afabd8 100644 --- a/x/observer/types/query.pb.gw.go +++ b/x/observer/types/query.pb.gw.go @@ -51,6 +51,82 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } +func request_Query_HasVoted_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryHasVotedRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["ballot_identifier"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "ballot_identifier") + } + + protoReq.BallotIdentifier, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "ballot_identifier", err) + } + + val, ok = pathParams["voter_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "voter_address") + } + + protoReq.VoterAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "voter_address", err) + } + + msg, err := client.HasVoted(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_HasVoted_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryHasVotedRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["ballot_identifier"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "ballot_identifier") + } + + protoReq.BallotIdentifier, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "ballot_identifier", err) + } + + val, ok = pathParams["voter_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "voter_address") + } + + protoReq.VoterAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "voter_address", err) + } + + msg, err := server.HasVoted(ctx, &protoReq) + return msg, metadata, err + +} + func request_Query_BallotByIdentifier_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryBallotByIdentifierRequest var metadata runtime.ServerMetadata @@ -465,10 +541,21 @@ func local_request_Query_BlameByIdentifier_0(ctx context.Context, marshaler runt } +var ( + filter_Query_GetAllBlameRecords_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + func request_Query_GetAllBlameRecords_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryAllBlameRecordsRequest var metadata runtime.ServerMetadata + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetAllBlameRecords_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.GetAllBlameRecords(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -478,6 +565,13 @@ func local_request_Query_GetAllBlameRecords_0(ctx context.Context, marshaler run var protoReq QueryAllBlameRecordsRequest var metadata runtime.ServerMetadata + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetAllBlameRecords_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.GetAllBlameRecords(ctx, &protoReq) return msg, metadata, err @@ -739,36 +833,589 @@ func local_request_Query_Prove_0(ctx context.Context, marshaler runtime.Marshale } -// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". -// UnaryRPC :call QueryServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. -func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { +var ( + filter_Query_GetTssAddress_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } +func request_Query_GetTssAddress_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetTssAddressRequest + var metadata runtime.ServerMetadata - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetTssAddress_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetTssAddress(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetTssAddress_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetTssAddressRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetTssAddress_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GetTssAddress(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GetTssAddressByFinalizedHeight_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetTssAddressByFinalizedHeightRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["finalized_zeta_height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "finalized_zeta_height") + } + + protoReq.FinalizedZetaHeight, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "finalized_zeta_height", err) + } + + val, ok = pathParams["bitcoin_chain_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bitcoin_chain_id") + } + + protoReq.BitcoinChainId, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bitcoin_chain_id", err) + } + + msg, err := client.GetTssAddressByFinalizedHeight(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetTssAddressByFinalizedHeight_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetTssAddressByFinalizedHeightRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["finalized_zeta_height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "finalized_zeta_height") + } + + protoReq.FinalizedZetaHeight, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "finalized_zeta_height", err) + } + + val, ok = pathParams["bitcoin_chain_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bitcoin_chain_id") + } + + protoReq.BitcoinChainId, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bitcoin_chain_id", err) + } + + msg, err := server.GetTssAddressByFinalizedHeight(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_TSS_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetTSSRequest + var metadata runtime.ServerMetadata + + msg, err := client.TSS(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TSS_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetTSSRequest + var metadata runtime.ServerMetadata + + msg, err := server.TSS(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_TssHistory_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_TssHistory_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTssHistoryRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_TssHistory_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.TssHistory(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TssHistory_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTssHistoryRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_TssHistory_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.TssHistory(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_PendingNoncesAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_PendingNoncesAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllPendingNoncesRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_PendingNoncesAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.PendingNoncesAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_PendingNoncesAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllPendingNoncesRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_PendingNoncesAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.PendingNoncesAll(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_PendingNoncesByChain_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPendingNoncesByChainRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["chain_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") + } + + protoReq.ChainId, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) + } + + msg, err := client.PendingNoncesByChain(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_PendingNoncesByChain_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPendingNoncesByChainRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["chain_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") + } + + protoReq.ChainId, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) + } + + msg, err := server.PendingNoncesByChain(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_ChainNonces_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetChainNoncesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["index"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index") + } + + protoReq.Index, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err) + } + + msg, err := client.ChainNonces(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ChainNonces_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetChainNoncesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["index"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index") + } + + protoReq.Index, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err) + } + + msg, err := server.ChainNonces(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_ChainNoncesAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_ChainNoncesAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllChainNoncesRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ChainNoncesAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ChainNoncesAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ChainNoncesAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllChainNoncesRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ChainNoncesAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ChainNoncesAll(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_HasVoted_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_HasVoted_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_HasVoted_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BallotByIdentifier_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_BallotByIdentifier_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_BallotByIdentifier_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ObserversByChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ObserversByChain_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ObserversByChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AllObserverMappers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_AllObserverMappers_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AllObserverMappers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SupportedChains_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_SupportedChains_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SupportedChains_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetCoreParamsForChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetCoreParamsForChain_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetCoreParamsForChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetCoreParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetCoreParams_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetCoreParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_NodeAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_NodeAccount_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_NodeAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_NodeAccountAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_NodeAccountAll_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_NodeAccountAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_BallotByIdentifier_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_CrosschainFlags_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -779,7 +1426,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_BallotByIdentifier_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_CrosschainFlags_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 { @@ -787,11 +1434,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_BallotByIdentifier_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_CrosschainFlags_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ObserversByChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_Keygen_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -802,7 +1449,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_ObserversByChain_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_Keygen_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 { @@ -810,11 +1457,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_ObserversByChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Keygen_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_AllObserverMappers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ShowObserverCount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -825,7 +1472,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_AllObserverMappers_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_ShowObserverCount_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 { @@ -833,11 +1480,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_AllObserverMappers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ShowObserverCount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_SupportedChains_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_BlameByIdentifier_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -848,7 +1495,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_SupportedChains_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_BlameByIdentifier_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 { @@ -856,11 +1503,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_SupportedChains_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_BlameByIdentifier_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_GetCoreParamsForChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GetAllBlameRecords_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -871,7 +1518,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_GetCoreParamsForChain_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_GetAllBlameRecords_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 { @@ -879,11 +1526,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_GetCoreParamsForChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GetAllBlameRecords_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_GetCoreParams_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_BlamesByChainAndNonce_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -894,7 +1541,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_GetCoreParams_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_BlamesByChainAndNonce_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 { @@ -902,11 +1549,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_GetCoreParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_BlamesByChainAndNonce_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_NodeAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GetAllBlockHeaders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -917,7 +1564,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_NodeAccount_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_GetAllBlockHeaders_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 { @@ -925,11 +1572,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_NodeAccount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GetAllBlockHeaders_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_NodeAccountAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GetBlockHeaderByHash_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -940,7 +1587,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_NodeAccountAll_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_GetBlockHeaderByHash_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 { @@ -948,11 +1595,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_NodeAccountAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GetBlockHeaderByHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_CrosschainFlags_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GetBlockHeaderStateByChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -963,7 +1610,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_CrosschainFlags_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_GetBlockHeaderStateByChain_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 { @@ -971,11 +1618,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_CrosschainFlags_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GetBlockHeaderStateByChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_Keygen_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_Prove_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -986,7 +1633,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_Keygen_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_Prove_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 { @@ -994,11 +1641,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_Keygen_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Prove_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ShowObserverCount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GetTssAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1009,7 +1656,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_ShowObserverCount_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_GetTssAddress_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 { @@ -1017,11 +1664,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_ShowObserverCount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GetTssAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_BlameByIdentifier_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_GetTssAddressByFinalizedHeight_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1032,7 +1679,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_BlameByIdentifier_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_GetTssAddressByFinalizedHeight_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 { @@ -1040,11 +1687,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_BlameByIdentifier_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_GetTssAddressByFinalizedHeight_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_GetAllBlameRecords_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_TSS_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1055,7 +1702,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_GetAllBlameRecords_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_TSS_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 { @@ -1063,11 +1710,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_GetAllBlameRecords_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_TSS_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_BlamesByChainAndNonce_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_TssHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1078,7 +1725,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_BlamesByChainAndNonce_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_TssHistory_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 { @@ -1086,11 +1733,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_BlamesByChainAndNonce_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_TssHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_GetAllBlockHeaders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_PendingNoncesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1101,7 +1748,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_GetAllBlockHeaders_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_PendingNoncesAll_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 { @@ -1109,11 +1756,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_GetAllBlockHeaders_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_PendingNoncesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_GetBlockHeaderByHash_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_PendingNoncesByChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1124,7 +1771,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_GetBlockHeaderByHash_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_PendingNoncesByChain_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 { @@ -1132,11 +1779,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_GetBlockHeaderByHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_PendingNoncesByChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_GetBlockHeaderStateByChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ChainNonces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1147,7 +1794,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_GetBlockHeaderStateByChain_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_ChainNonces_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 { @@ -1155,11 +1802,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_GetBlockHeaderStateByChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ChainNonces_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_Prove_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ChainNoncesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1170,7 +1817,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_Prove_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_ChainNoncesAll_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 { @@ -1178,7 +1825,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_Prove_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ChainNoncesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1243,6 +1890,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_HasVoted_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_HasVoted_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_HasVoted_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_BallotByIdentifier_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1603,12 +2270,174 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_GetTssAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_GetTssAddress_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_GetTssAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetTssAddressByFinalizedHeight_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_GetTssAddressByFinalizedHeight_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_GetTssAddressByFinalizedHeight_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TSS_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_TSS_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_TSS_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TssHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_TssHistory_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_TssHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_PendingNoncesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_PendingNoncesAll_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_PendingNoncesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_PendingNoncesByChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_PendingNoncesByChain_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_PendingNoncesByChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ChainNonces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_ChainNonces_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_ChainNonces_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ChainNoncesAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_ChainNoncesAll_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_ChainNoncesAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "params"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_HasVoted_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"zeta-chain", "observer", "has_voted", "ballot_identifier", "voter_address"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_BallotByIdentifier_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "observer", "ballot_by_identifier", "ballot_identifier"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_ObserversByChain_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "observer", "observers_by_chain", "observation_chain"}, "", runtime.AssumeColonVerbOpt(false))) @@ -1644,11 +2473,29 @@ var ( pattern_Query_GetBlockHeaderStateByChain_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "observer", "get_block_header_state_by_chain_id", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Prove_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "prove"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GetTssAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "get_tss_address"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GetTssAddressByFinalizedHeight_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"zeta-chain", "observer", "get_tss_address_historical", "finalized_zeta_height", "bitcoin_chain_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_TSS_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "TSS"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_TssHistory_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "tssHistory"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_PendingNoncesAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "pendingNonces"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_PendingNoncesByChain_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "observer", "pendingNonces", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_ChainNonces_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "observer", "chainNonces", "index"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_ChainNoncesAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "chainNonces"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_Params_0 = runtime.ForwardResponseMessage + forward_Query_HasVoted_0 = runtime.ForwardResponseMessage + forward_Query_BallotByIdentifier_0 = runtime.ForwardResponseMessage forward_Query_ObserversByChain_0 = runtime.ForwardResponseMessage @@ -1684,4 +2531,20 @@ var ( forward_Query_GetBlockHeaderStateByChain_0 = runtime.ForwardResponseMessage forward_Query_Prove_0 = runtime.ForwardResponseMessage + + forward_Query_GetTssAddress_0 = runtime.ForwardResponseMessage + + forward_Query_GetTssAddressByFinalizedHeight_0 = runtime.ForwardResponseMessage + + forward_Query_TSS_0 = runtime.ForwardResponseMessage + + forward_Query_TssHistory_0 = runtime.ForwardResponseMessage + + forward_Query_PendingNoncesAll_0 = runtime.ForwardResponseMessage + + forward_Query_PendingNoncesByChain_0 = runtime.ForwardResponseMessage + + forward_Query_ChainNonces_0 = runtime.ForwardResponseMessage + + forward_Query_ChainNoncesAll_0 = runtime.ForwardResponseMessage ) diff --git a/x/observer/types/test_data.go b/x/observer/types/test_data.go index 611e9a0127..bac2ae27a5 100644 --- a/x/observer/types/test_data.go +++ b/x/observer/types/test_data.go @@ -8,6 +8,8 @@ import ( "github.com/zeta-chain/zetacore/common" ) +const PrefixOutput = "Output1" + func CreateObserverMapperList(items int, chain common.Chain) (list []*ObserverMapper) { SetConfig(false) for i := 0; i < items; i++ { @@ -15,10 +17,10 @@ func CreateObserverMapperList(items int, chain common.Chain) (list []*ObserverMa Index: "Index" + strconv.Itoa(i), ObserverChain: &chain, ObserverList: []string{ - sdk.AccAddress(crypto.AddressHash([]byte("Output1" + strconv.Itoa(i)))).String(), - sdk.AccAddress(crypto.AddressHash([]byte("Output1" + strconv.Itoa(i+1)))).String(), - sdk.AccAddress(crypto.AddressHash([]byte("Output1" + strconv.Itoa(i+2)))).String(), - sdk.AccAddress(crypto.AddressHash([]byte("Output1" + strconv.Itoa(i+3)))).String(), + sdk.AccAddress(crypto.AddressHash([]byte(PrefixOutput + strconv.Itoa(i)))).String(), + sdk.AccAddress(crypto.AddressHash([]byte(PrefixOutput + strconv.Itoa(i+1)))).String(), + sdk.AccAddress(crypto.AddressHash([]byte(PrefixOutput + strconv.Itoa(i+2)))).String(), + sdk.AccAddress(crypto.AddressHash([]byte(PrefixOutput + strconv.Itoa(i+3)))).String(), }, } list = append(list, mapper) diff --git a/x/crosschain/types/tss.pb.go b/x/observer/types/tss.pb.go similarity index 84% rename from x/crosschain/types/tss.pb.go rename to x/observer/types/tss.pb.go index 7351ddbce3..f1910beb8c 100644 --- a/x/crosschain/types/tss.pb.go +++ b/x/observer/types/tss.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: crosschain/tss.proto +// source: observer/tss.proto package types @@ -36,7 +36,7 @@ func (m *TSS) Reset() { *m = TSS{} } func (m *TSS) String() string { return proto.CompactTextString(m) } func (*TSS) ProtoMessage() {} func (*TSS) Descriptor() ([]byte, []int) { - return fileDescriptor_ba8ccd105b767be6, []int{0} + return fileDescriptor_debc03bce4d6c8c3, []int{0} } func (m *TSS) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -101,31 +101,31 @@ func (m *TSS) GetKeyGenZetaHeight() int64 { } func init() { - proto.RegisterType((*TSS)(nil), "zetachain.zetacore.crosschain.TSS") + proto.RegisterType((*TSS)(nil), "zetachain.zetacore.observer.TSS") } -func init() { proto.RegisterFile("crosschain/tss.proto", fileDescriptor_ba8ccd105b767be6) } +func init() { proto.RegisterFile("observer/tss.proto", fileDescriptor_debc03bce4d6c8c3) } -var fileDescriptor_ba8ccd105b767be6 = []byte{ +var fileDescriptor_debc03bce4d6c8c3 = []byte{ // 286 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xc1, 0x4a, 0xf3, 0x40, - 0x14, 0x46, 0x3b, 0xe4, 0xff, 0x2b, 0x9d, 0x95, 0x4c, 0x2b, 0x04, 0xa1, 0x43, 0x70, 0x15, 0x04, - 0x93, 0xaa, 0x4f, 0xa0, 0x1b, 0x05, 0x5d, 0x48, 0xea, 0xaa, 0x9b, 0x30, 0x49, 0xc6, 0x64, 0x68, - 0xcd, 0x84, 0xb9, 0xb7, 0x60, 0xfa, 0x14, 0x3e, 0x96, 0xcb, 0x2e, 0x5d, 0x4a, 0xb2, 0xf1, 0x31, - 0x24, 0x13, 0x4a, 0x0b, 0xba, 0xbb, 0xdc, 0x73, 0xbe, 0xcd, 0xa1, 0x93, 0xd4, 0x68, 0x80, 0xb4, - 0x10, 0xaa, 0x0c, 0x11, 0x20, 0xa8, 0x8c, 0x46, 0xcd, 0xa6, 0x1b, 0x89, 0xc2, 0x3e, 0x03, 0x7b, - 0x69, 0x23, 0x83, 0xbd, 0x78, 0x3a, 0xc9, 0x75, 0xae, 0xad, 0x19, 0x76, 0x57, 0x3f, 0x3a, 0xfb, - 0x26, 0xd4, 0x79, 0x9e, 0xcf, 0xd9, 0x94, 0x52, 0x04, 0x88, 0xab, 0x75, 0xb2, 0x94, 0xb5, 0xeb, - 0x78, 0xc4, 0x1f, 0x45, 0x23, 0x04, 0x78, 0xb2, 0x0f, 0x36, 0xa3, 0x13, 0x8b, 0x85, 0x41, 0x95, - 0xaa, 0x4a, 0x94, 0x18, 0xaf, 0x14, 0xa0, 0xfb, 0xcf, 0x73, 0xfc, 0x51, 0xc4, 0x3a, 0x71, 0x8f, - 0x1e, 0x15, 0x20, 0xbb, 0xa2, 0x27, 0xba, 0x92, 0x46, 0xa0, 0x36, 0xb1, 0xc8, 0x32, 0x23, 0x01, - 0xfa, 0xc9, 0x7f, 0x3b, 0x19, 0xef, 0xe0, 0x4d, 0xcf, 0xec, 0x66, 0x46, 0xc7, 0x2f, 0xaa, 0x14, - 0x2b, 0xb5, 0x91, 0xd9, 0x42, 0xa2, 0xb8, 0x97, 0x2a, 0x2f, 0xd0, 0x1d, 0x7a, 0xc4, 0x77, 0xa2, - 0xbf, 0x10, 0x3b, 0xa7, 0xc7, 0x4b, 0x59, 0xdf, 0xc9, 0xf2, 0x40, 0x3f, 0xb2, 0xfa, 0xaf, 0xff, - 0xed, 0xc3, 0x47, 0xc3, 0xc9, 0xb6, 0xe1, 0xe4, 0xab, 0xe1, 0xe4, 0xbd, 0xe5, 0x83, 0x6d, 0xcb, - 0x07, 0x9f, 0x2d, 0x1f, 0x2c, 0x2e, 0x73, 0x85, 0xc5, 0x3a, 0x09, 0x52, 0xfd, 0x1a, 0x76, 0xe9, - 0x2e, 0xfa, 0xb4, 0xbb, 0x8a, 0xe1, 0x5b, 0x78, 0x18, 0xbc, 0xae, 0x24, 0x24, 0x43, 0x9b, 0xef, - 0xfa, 0x27, 0x00, 0x00, 0xff, 0xff, 0xa4, 0x52, 0x84, 0x75, 0x8b, 0x01, 0x00, 0x00, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xc1, 0x4a, 0xc3, 0x40, + 0x10, 0x86, 0xbb, 0x44, 0x2b, 0xdd, 0x93, 0x6c, 0x2b, 0x14, 0xc5, 0xa5, 0x78, 0x2a, 0x82, 0xd9, + 0xa2, 0x4f, 0xa0, 0x17, 0x15, 0x3c, 0x48, 0xeb, 0xa9, 0x97, 0xb2, 0x69, 0xc7, 0x64, 0x69, 0xcd, + 0x86, 0x9d, 0xa9, 0x98, 0x3e, 0x85, 0x8f, 0xe5, 0xb1, 0x47, 0x8f, 0x92, 0x5c, 0x7c, 0x0c, 0xc9, + 0x86, 0x50, 0x41, 0x6f, 0xc3, 0x7c, 0xdf, 0x7f, 0xf9, 0xb8, 0xb0, 0x11, 0x82, 0x7b, 0x05, 0xa7, + 0x08, 0x31, 0xcc, 0x9c, 0x25, 0x2b, 0x4e, 0x36, 0x40, 0x7a, 0x9e, 0x68, 0x93, 0x86, 0xfe, 0xb2, + 0x0e, 0xc2, 0x46, 0x3b, 0xee, 0xc5, 0x36, 0xb6, 0xde, 0x53, 0xd5, 0x55, 0x4f, 0xce, 0xbe, 0x19, + 0x0f, 0x9e, 0x26, 0x13, 0x71, 0xca, 0x39, 0x21, 0xce, 0xb2, 0x75, 0xb4, 0x84, 0xbc, 0x1f, 0x0c, + 0xd8, 0xb0, 0x33, 0xee, 0x10, 0xe2, 0xa3, 0x7f, 0x88, 0x11, 0xef, 0x79, 0xac, 0x1d, 0x99, 0xb9, + 0xc9, 0x74, 0x4a, 0xb3, 0x95, 0x41, 0xea, 0xef, 0x0d, 0x82, 0x61, 0x67, 0x2c, 0x2a, 0x71, 0x87, + 0x1e, 0x0c, 0x92, 0xb8, 0xe4, 0x47, 0x36, 0x03, 0xa7, 0xc9, 0xba, 0x99, 0x5e, 0x2c, 0x1c, 0x20, + 0xd6, 0x93, 0x7d, 0x3f, 0xe9, 0x36, 0xf0, 0xba, 0x66, 0x7e, 0x33, 0xe2, 0xdd, 0x67, 0x93, 0xea, + 0x95, 0xd9, 0xc0, 0x62, 0x0a, 0xa4, 0xef, 0xc0, 0xc4, 0x09, 0xf5, 0xdb, 0x03, 0x36, 0x0c, 0xc6, + 0xff, 0x21, 0x71, 0xce, 0x0f, 0x97, 0x90, 0xdf, 0x42, 0xfa, 0x4b, 0x3f, 0xf0, 0xfa, 0x9f, 0xff, + 0xcd, 0xfd, 0x47, 0x21, 0xd9, 0xb6, 0x90, 0xec, 0xab, 0x90, 0xec, 0xbd, 0x94, 0xad, 0x6d, 0x29, + 0x5b, 0x9f, 0xa5, 0x6c, 0x4d, 0x55, 0x6c, 0x28, 0x59, 0x47, 0xe1, 0xdc, 0xbe, 0xa8, 0x2a, 0xdc, + 0x85, 0x6f, 0xa8, 0x9a, 0x86, 0xea, 0x4d, 0xed, 0x62, 0xe7, 0x19, 0x60, 0xd4, 0xf6, 0xf1, 0xae, + 0x7e, 0x02, 0x00, 0x00, 0xff, 0xff, 0xd8, 0x52, 0xdf, 0xf3, 0x85, 0x01, 0x00, 0x00, } func (m *TSS) Marshal() (dAtA []byte, err error) { diff --git a/x/observer/types/tss_funds_migrator.pb.go b/x/observer/types/tss_funds_migrator.pb.go new file mode 100644 index 0000000000..7169b0cb14 --- /dev/null +++ b/x/observer/types/tss_funds_migrator.pb.go @@ -0,0 +1,356 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: observer/tss_funds_migrator.proto + +package types + +import ( + fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type TssFundMigratorInfo struct { + ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + MigrationCctxIndex string `protobuf:"bytes,2,opt,name=migration_cctx_index,json=migrationCctxIndex,proto3" json:"migration_cctx_index,omitempty"` +} + +func (m *TssFundMigratorInfo) Reset() { *m = TssFundMigratorInfo{} } +func (m *TssFundMigratorInfo) String() string { return proto.CompactTextString(m) } +func (*TssFundMigratorInfo) ProtoMessage() {} +func (*TssFundMigratorInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_bb561ac1748a50be, []int{0} +} +func (m *TssFundMigratorInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TssFundMigratorInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TssFundMigratorInfo.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 *TssFundMigratorInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_TssFundMigratorInfo.Merge(m, src) +} +func (m *TssFundMigratorInfo) XXX_Size() int { + return m.Size() +} +func (m *TssFundMigratorInfo) XXX_DiscardUnknown() { + xxx_messageInfo_TssFundMigratorInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_TssFundMigratorInfo proto.InternalMessageInfo + +func (m *TssFundMigratorInfo) GetChainId() int64 { + if m != nil { + return m.ChainId + } + return 0 +} + +func (m *TssFundMigratorInfo) GetMigrationCctxIndex() string { + if m != nil { + return m.MigrationCctxIndex + } + return "" +} + +func init() { + proto.RegisterType((*TssFundMigratorInfo)(nil), "zetachain.zetacore.observer.TssFundMigratorInfo") +} + +func init() { proto.RegisterFile("observer/tss_funds_migrator.proto", fileDescriptor_bb561ac1748a50be) } + +var fileDescriptor_bb561ac1748a50be = []byte{ + // 231 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcc, 0x4f, 0x2a, 0x4e, + 0x2d, 0x2a, 0x4b, 0x2d, 0xd2, 0x2f, 0x29, 0x2e, 0x8e, 0x4f, 0x2b, 0xcd, 0x4b, 0x29, 0x8e, 0xcf, + 0xcd, 0x4c, 0x2f, 0x4a, 0x2c, 0xc9, 0x2f, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0xae, + 0x4a, 0x2d, 0x49, 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x03, 0xb3, 0xf2, 0x8b, 0x52, 0xf5, 0x60, + 0xba, 0xa4, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0xea, 0xf4, 0x41, 0x2c, 0x88, 0x16, 0xa5, 0x24, + 0x2e, 0xe1, 0x90, 0xe2, 0x62, 0xb7, 0xd2, 0xbc, 0x14, 0x5f, 0xa8, 0x59, 0x9e, 0x79, 0x69, 0xf9, + 0x42, 0x92, 0x5c, 0x1c, 0x60, 0x73, 0xe2, 0x33, 0x53, 0x24, 0x18, 0x15, 0x18, 0x35, 0x98, 0x83, + 0xd8, 0xc1, 0x7c, 0xcf, 0x14, 0x21, 0x03, 0x2e, 0x11, 0x88, 0xb5, 0x99, 0xf9, 0x79, 0xf1, 0xc9, + 0xc9, 0x25, 0x15, 0xf1, 0x99, 0x79, 0x29, 0xa9, 0x15, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, + 0x42, 0x70, 0x39, 0xe7, 0xe4, 0x92, 0x0a, 0x4f, 0x90, 0x8c, 0x93, 0xe7, 0x89, 0x47, 0x72, 0x8c, + 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, + 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0xe9, 0xa7, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, + 0xe7, 0xea, 0x83, 0x5c, 0xac, 0x0b, 0xb6, 0x44, 0x1f, 0xe6, 0x78, 0xfd, 0x0a, 0x7d, 0x84, 0xa7, + 0x2b, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xae, 0x36, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xb7, + 0x95, 0x68, 0x68, 0x0d, 0x01, 0x00, 0x00, +} + +func (m *TssFundMigratorInfo) 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 *TssFundMigratorInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TssFundMigratorInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.MigrationCctxIndex) > 0 { + i -= len(m.MigrationCctxIndex) + copy(dAtA[i:], m.MigrationCctxIndex) + i = encodeVarintTssFundsMigrator(dAtA, i, uint64(len(m.MigrationCctxIndex))) + i-- + dAtA[i] = 0x12 + } + if m.ChainId != 0 { + i = encodeVarintTssFundsMigrator(dAtA, i, uint64(m.ChainId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintTssFundsMigrator(dAtA []byte, offset int, v uint64) int { + offset -= sovTssFundsMigrator(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *TssFundMigratorInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ChainId != 0 { + n += 1 + sovTssFundsMigrator(uint64(m.ChainId)) + } + l = len(m.MigrationCctxIndex) + if l > 0 { + n += 1 + l + sovTssFundsMigrator(uint64(l)) + } + return n +} + +func sovTssFundsMigrator(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTssFundsMigrator(x uint64) (n int) { + return sovTssFundsMigrator(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *TssFundMigratorInfo) 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 ErrIntOverflowTssFundsMigrator + } + 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: TssFundMigratorInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TssFundMigratorInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + m.ChainId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTssFundsMigrator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ChainId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MigrationCctxIndex", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTssFundsMigrator + } + 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 ErrInvalidLengthTssFundsMigrator + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTssFundsMigrator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MigrationCctxIndex = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTssFundsMigrator(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTssFundsMigrator + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTssFundsMigrator(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTssFundsMigrator + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTssFundsMigrator + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTssFundsMigrator + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTssFundsMigrator + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTssFundsMigrator + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTssFundsMigrator + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTssFundsMigrator = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTssFundsMigrator = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTssFundsMigrator = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/observer/types/tx.pb.go b/x/observer/types/tx.pb.go index 47f67f97da..43d63bdabe 100644 --- a/x/observer/types/tx.pb.go +++ b/x/observer/types/tx.pb.go @@ -441,7 +441,7 @@ var xxx_messageInfo_MsgAddObserverResponse proto.InternalMessageInfo type MsgAddBlameVote struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - BlameInfo *Blame `protobuf:"bytes,3,opt,name=blame_info,json=blameInfo,proto3" json:"blame_info,omitempty"` + BlameInfo Blame `protobuf:"bytes,3,opt,name=blame_info,json=blameInfo,proto3" json:"blame_info"` } func (m *MsgAddBlameVote) Reset() { *m = MsgAddBlameVote{} } @@ -491,11 +491,11 @@ func (m *MsgAddBlameVote) GetChainId() int64 { return 0 } -func (m *MsgAddBlameVote) GetBlameInfo() *Blame { +func (m *MsgAddBlameVote) GetBlameInfo() Blame { if m != nil { return m.BlameInfo } - return nil + return Blame{} } type MsgAddBlameVoteResponse struct { @@ -754,63 +754,64 @@ func init() { func init() { proto.RegisterFile("observer/tx.proto", fileDescriptor_1bcd40fa296a2b1d) } var fileDescriptor_1bcd40fa296a2b1d = []byte{ - // 886 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x4d, 0x6f, 0xdb, 0x46, - 0x10, 0x35, 0xe3, 0xc4, 0x71, 0xc6, 0xae, 0x63, 0x33, 0x76, 0x2c, 0xcb, 0x8d, 0x62, 0xf0, 0x52, - 0xb7, 0x75, 0x45, 0x47, 0x69, 0x8b, 0xb6, 0x40, 0x0f, 0x72, 0x3f, 0x1c, 0xa1, 0x48, 0x6d, 0x10, - 0xa8, 0x0f, 0xbd, 0x10, 0x4b, 0xee, 0x98, 0x24, 0x42, 0xed, 0x0a, 0x5c, 0xaa, 0xb1, 0x0a, 0xb4, - 0xf7, 0x1e, 0x0a, 0xf4, 0xaf, 0xf4, 0x3f, 0xf4, 0x90, 0x63, 0x8e, 0x3d, 0x15, 0x85, 0x7d, 0xea, - 0x2f, 0xe8, 0x35, 0xe0, 0x2e, 0xb9, 0x12, 0x25, 0x99, 0x96, 0x72, 0x12, 0x77, 0xf7, 0xcd, 0x9b, - 0x79, 0x33, 0x8f, 0x5c, 0xc1, 0x06, 0xf7, 0x04, 0x26, 0x3f, 0x61, 0x62, 0xa7, 0x17, 0xcd, 0x5e, - 0xc2, 0x53, 0x6e, 0xee, 0xfe, 0x8c, 0x29, 0xf1, 0x43, 0x12, 0xb1, 0xa6, 0x7c, 0xe2, 0x09, 0x36, - 0x0b, 0x54, 0xfd, 0x81, 0xcf, 0xbb, 0x5d, 0xce, 0x6c, 0xf5, 0xa3, 0x22, 0xea, 0x9b, 0x01, 0x0f, - 0xb8, 0x7c, 0xb4, 0xb3, 0xa7, 0x62, 0x57, 0x53, 0x7b, 0x31, 0xe9, 0x62, 0xbe, 0xfb, 0x58, 0xef, - 0xfa, 0x09, 0x17, 0x42, 0xe6, 0x71, 0xcf, 0x63, 0x12, 0x88, 0x1c, 0xb0, 0xad, 0x01, 0xc5, 0x43, - 0x7e, 0xb0, 0xa5, 0x0f, 0x7a, 0x24, 0x21, 0xdd, 0x1c, 0x6f, 0xfd, 0x67, 0xc0, 0xc6, 0x73, 0x11, - 0xfc, 0xd0, 0xa3, 0x24, 0xc5, 0x93, 0x1c, 0x62, 0xd6, 0xe0, 0xae, 0x9f, 0x20, 0x49, 0x79, 0x52, - 0x33, 0xf6, 0x8c, 0xfd, 0x7b, 0x4e, 0xb1, 0x34, 0x0f, 0x61, 0x93, 0xc7, 0xd4, 0x2d, 0xc8, 0x5c, - 0x42, 0x69, 0x82, 0x42, 0xd4, 0x6e, 0x49, 0x98, 0xc9, 0x63, 0x5a, 0x90, 0xb4, 0xd5, 0x49, 0x16, - 0xc1, 0xf0, 0xe5, 0x64, 0xc4, 0xa2, 0x8a, 0x60, 0xf8, 0x72, 0x3c, 0xe2, 0x0c, 0xde, 0xe9, 0xcb, - 0x7a, 0xdc, 0x04, 0x89, 0xe0, 0xac, 0x76, 0x7b, 0xcf, 0xd8, 0x5f, 0x6b, 0x3d, 0x69, 0x56, 0xb4, - 0xb6, 0x59, 0x90, 0x28, 0x25, 0x8e, 0x0c, 0x74, 0x56, 0xfb, 0x23, 0x2b, 0x6b, 0x17, 0x76, 0x26, - 0xa4, 0x3a, 0x28, 0x7a, 0x9c, 0x09, 0xb4, 0xfe, 0x54, 0x8d, 0x68, 0x53, 0x7a, 0x14, 0x73, 0xff, - 0xc5, 0x33, 0x24, 0xb4, 0xb2, 0x11, 0x3b, 0xb0, 0xac, 0xba, 0x1f, 0x51, 0x29, 0x7e, 0xd1, 0xb9, - 0x2b, 0xd7, 0x1d, 0x6a, 0x3e, 0x02, 0xf0, 0x32, 0x0e, 0x37, 0x24, 0x22, 0x94, 0x3a, 0x57, 0x9d, - 0x7b, 0x72, 0xe7, 0x19, 0x11, 0xa1, 0xf9, 0x10, 0x96, 0x42, 0x8c, 0x82, 0x30, 0x95, 0xba, 0x16, - 0x9d, 0x7c, 0x65, 0x1e, 0x66, 0xfb, 0x59, 0xd6, 0xda, 0x9d, 0x3d, 0x63, 0x7f, 0xa5, 0x65, 0x36, - 0x73, 0x9b, 0xa8, 0x5a, 0xbe, 0x26, 0x29, 0x39, 0xba, 0xfd, 0xea, 0x9f, 0xc7, 0x0b, 0x4e, 0x8e, - 0xcb, 0x05, 0x95, 0x4b, 0xd6, 0x82, 0x2e, 0xe0, 0x81, 0x56, 0xfb, 0x15, 0x4f, 0xf0, 0x54, 0x8e, - 0xbd, 0x42, 0xd1, 0x31, 0x80, 0xaf, 0x71, 0x52, 0xd3, 0x4a, 0xeb, 0xbd, 0xca, 0x9e, 0x0f, 0x69, - 0x9d, 0x91, 0x50, 0xeb, 0x11, 0xec, 0x4e, 0xc9, 0xac, 0x0b, 0xfb, 0xcb, 0x80, 0x35, 0x55, 0xf6, - 0x0c, 0x7e, 0x7b, 0x1f, 0xd6, 0xaf, 0xf1, 0xda, 0x7d, 0x3e, 0x66, 0x9b, 0x2f, 0x60, 0x47, 0x96, - 0x18, 0x47, 0xc8, 0x52, 0x37, 0x48, 0x08, 0x4b, 0x11, 0xdd, 0x5e, 0xdf, 0x7b, 0x81, 0x83, 0xdc, - 0x6d, 0xdb, 0x43, 0xc0, 0xb1, 0x3a, 0x3f, 0x95, 0xc7, 0xe6, 0x13, 0xd8, 0x22, 0x94, 0xba, 0x8c, - 0x53, 0x74, 0x89, 0xef, 0xf3, 0x3e, 0x4b, 0x5d, 0xce, 0xe2, 0x81, 0x1c, 0xd1, 0xb2, 0x63, 0x12, - 0x4a, 0xbf, 0xe7, 0x14, 0xdb, 0xea, 0xe8, 0x84, 0xc5, 0x03, 0xab, 0x06, 0x0f, 0xcb, 0x2a, 0xb4, - 0xc0, 0xdf, 0x0c, 0xb8, 0x5f, 0xcc, 0x85, 0x74, 0xf1, 0x8c, 0xa7, 0xf8, 0x76, 0x46, 0x6a, 0x67, - 0x46, 0x22, 0x5d, 0x74, 0x23, 0x76, 0xce, 0xa5, 0x84, 0x95, 0x96, 0x55, 0x39, 0x11, 0x99, 0x30, - 0x33, 0x1b, 0xe9, 0x62, 0x87, 0x9d, 0x73, 0x6b, 0x07, 0xb6, 0xc7, 0x4a, 0xd1, 0x65, 0xfe, 0x7f, - 0x0b, 0x6a, 0xc3, 0x39, 0xe9, 0xcf, 0xc9, 0xb7, 0xd9, 0xd7, 0xa4, 0xa2, 0xde, 0x0f, 0x60, 0x3d, - 0x12, 0x1d, 0xe6, 0xf1, 0x3e, 0xa3, 0xdf, 0x30, 0xe2, 0xc5, 0x48, 0x65, 0x69, 0xcb, 0xce, 0xc4, - 0xbe, 0x79, 0x00, 0x1b, 0x91, 0x38, 0xe9, 0xa7, 0x25, 0xb0, 0x6a, 0xe9, 0xe4, 0x81, 0x19, 0xc2, - 0x56, 0x40, 0xc4, 0x69, 0x12, 0xf9, 0xd8, 0x61, 0x59, 0x3a, 0x81, 0xb2, 0x98, 0xfc, 0x7d, 0x68, - 0x55, 0x2a, 0x3f, 0x9e, 0x16, 0xe9, 0x4c, 0x27, 0x34, 0x7f, 0x81, 0x77, 0xbd, 0xe1, 0x2b, 0x73, - 0x86, 0x49, 0x74, 0x1e, 0xf9, 0x24, 0x8d, 0xb8, 0x52, 0x5f, 0x5b, 0x92, 0x09, 0x3f, 0xbf, 0xa1, - 0xd5, 0xd7, 0x13, 0x38, 0x95, 0xf4, 0x96, 0x05, 0x7b, 0xd7, 0x35, 0x5e, 0x4f, 0xa7, 0x2d, 0x3d, - 0xa4, 0x30, 0xdf, 0xe1, 0x20, 0x40, 0x56, 0x31, 0x93, 0x4d, 0xb8, 0x23, 0x13, 0xe6, 0x06, 0x52, - 0x8b, 0x7c, 0xf6, 0xa3, 0x14, 0x05, 0x7b, 0xeb, 0x72, 0x09, 0x16, 0x9f, 0x8b, 0xc0, 0xe4, 0xb0, - 0x32, 0xfa, 0x1e, 0x7e, 0x58, 0xa9, 0xb8, 0x6c, 0xf7, 0xfa, 0xd3, 0x39, 0xc0, 0x45, 0x62, 0xf3, - 0x02, 0xd6, 0xc6, 0xee, 0x9a, 0xe6, 0x4d, 0x34, 0x65, 0x7c, 0xfd, 0xd3, 0xf9, 0xf0, 0x3a, 0xf3, - 0xaf, 0xb0, 0x3e, 0xf1, 0x31, 0x3c, 0x9c, 0x8d, 0x6b, 0x18, 0x51, 0xff, 0x6c, 0xde, 0x08, 0x9d, - 0x3f, 0x81, 0xd5, 0xd2, 0x17, 0xe1, 0x60, 0x86, 0xf6, 0x69, 0x74, 0xfd, 0xe3, 0x79, 0xd0, 0x3a, - 0xe7, 0xef, 0x06, 0x6c, 0x4d, 0x7f, 0xbf, 0x3f, 0x99, 0x51, 0x47, 0x39, 0xac, 0xfe, 0xe5, 0x5b, - 0x85, 0x8d, 0xf6, 0xa0, 0xe4, 0xe8, 0x83, 0xd9, 0xe8, 0x14, 0xfa, 0xe6, 0x1e, 0x4c, 0xb3, 0x7a, - 0xe6, 0xb8, 0xb1, 0x4b, 0xbd, 0x39, 0x53, 0x2f, 0x35, 0xfe, 0x66, 0xc7, 0x4d, 0xbf, 0x81, 0x8f, - 0x3a, 0xaf, 0x2e, 0x1b, 0xc6, 0xeb, 0xcb, 0x86, 0xf1, 0xef, 0x65, 0xc3, 0xf8, 0xe3, 0xaa, 0xb1, - 0xf0, 0xfa, 0xaa, 0xb1, 0xf0, 0xf7, 0x55, 0x63, 0xe1, 0x47, 0x3b, 0x88, 0xd2, 0xb0, 0xef, 0x65, - 0x17, 0xbc, 0x9d, 0x31, 0x7e, 0x24, 0xc9, 0xed, 0x82, 0xdc, 0xbe, 0xb0, 0x87, 0x7f, 0x2c, 0x07, - 0x3d, 0x14, 0xde, 0x92, 0xfc, 0xb7, 0xf6, 0xf4, 0x4d, 0x00, 0x00, 0x00, 0xff, 0xff, 0x26, 0x4e, - 0x23, 0xa3, 0x71, 0x0a, 0x00, 0x00, + // 903 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcd, 0x6e, 0xdb, 0x46, + 0x10, 0x36, 0xe3, 0xc4, 0xb1, 0xc7, 0xae, 0x63, 0x6f, 0xec, 0x58, 0x96, 0x6b, 0xc5, 0xe0, 0xa5, + 0x6e, 0xeb, 0x4a, 0x8e, 0xd2, 0x16, 0x6d, 0x81, 0x1e, 0xec, 0xfe, 0x38, 0x42, 0x91, 0xda, 0x20, + 0x50, 0x1f, 0x7a, 0x21, 0x96, 0xdc, 0x31, 0x45, 0x84, 0xda, 0x15, 0xb8, 0x54, 0x63, 0x15, 0x68, + 0xdf, 0xa0, 0x68, 0x5f, 0xa5, 0xef, 0xd0, 0x43, 0x8e, 0x39, 0xf6, 0x54, 0x14, 0xf6, 0xa9, 0x4f, + 0xd0, 0x6b, 0xc0, 0x5d, 0x72, 0x25, 0x4a, 0x32, 0x2d, 0xe5, 0x24, 0xee, 0xcc, 0x37, 0xdf, 0xcc, + 0x37, 0x33, 0xe4, 0x0a, 0xd6, 0x85, 0x27, 0x31, 0xfe, 0x09, 0xe3, 0x46, 0x72, 0x59, 0xef, 0xc6, + 0x22, 0x11, 0x64, 0xe7, 0x67, 0x4c, 0xa8, 0xdf, 0xa6, 0x21, 0xaf, 0xab, 0x27, 0x11, 0x63, 0x3d, + 0x47, 0x55, 0x1f, 0xfa, 0xa2, 0xd3, 0x11, 0xbc, 0xa1, 0x7f, 0x74, 0x44, 0x75, 0x23, 0x10, 0x81, + 0x50, 0x8f, 0x8d, 0xf4, 0x29, 0xb7, 0x1a, 0x6a, 0x2f, 0xa2, 0x1d, 0xcc, 0xac, 0x8f, 0x8d, 0xd5, + 0x8f, 0x85, 0x94, 0x2a, 0x8f, 0x7b, 0x11, 0xd1, 0x40, 0x66, 0x80, 0x2d, 0x03, 0xc8, 0x1f, 0x32, + 0xc7, 0xa6, 0x71, 0x74, 0x69, 0x4c, 0x3b, 0x39, 0x7e, 0x77, 0x60, 0x46, 0xce, 0x42, 0x1e, 0xb8, + 0x5c, 0x70, 0x1f, 0x73, 0x37, 0x19, 0x08, 0x94, 0x99, 0xcd, 0xfe, 0xcf, 0x82, 0xf5, 0xe7, 0x32, + 0xf8, 0xa1, 0xcb, 0x68, 0x82, 0xa7, 0x99, 0x9f, 0x54, 0xe0, 0xbe, 0x1f, 0x23, 0x4d, 0x44, 0x5c, + 0xb1, 0xf6, 0xac, 0xfd, 0x25, 0x27, 0x3f, 0x92, 0x43, 0xd8, 0x10, 0x11, 0x73, 0x73, 0x26, 0x97, + 0x32, 0x16, 0xa3, 0x94, 0x95, 0x3b, 0x0a, 0x46, 0x44, 0xc4, 0x72, 0x92, 0x23, 0xed, 0x49, 0x23, + 0x38, 0xbe, 0x1c, 0x8f, 0x98, 0xd7, 0x11, 0x1c, 0x5f, 0x8e, 0x46, 0x9c, 0xc3, 0x3b, 0x3d, 0x55, + 0x8f, 0x1b, 0x23, 0x95, 0x82, 0x57, 0xee, 0xee, 0x59, 0xfb, 0xab, 0xcd, 0x27, 0xf5, 0x92, 0x69, + 0xd4, 0x73, 0x12, 0xad, 0xc4, 0x51, 0x81, 0xce, 0x4a, 0x6f, 0xe8, 0x64, 0xef, 0xc0, 0xf6, 0x98, + 0x54, 0x07, 0x65, 0x57, 0x70, 0x89, 0xf6, 0x9f, 0xba, 0x11, 0x47, 0x8c, 0x1d, 0x47, 0xc2, 0x7f, + 0xf1, 0x0c, 0x29, 0x2b, 0x6d, 0xc4, 0x36, 0x2c, 0xea, 0x81, 0x85, 0x4c, 0x89, 0x9f, 0x77, 0xee, + 0xab, 0x73, 0x8b, 0x91, 0x5d, 0x00, 0x2f, 0xe5, 0x70, 0xdb, 0x54, 0xb6, 0x95, 0xce, 0x15, 0x67, + 0x49, 0x59, 0x9e, 0x51, 0xd9, 0x26, 0x8f, 0x60, 0xa1, 0x8d, 0x61, 0xd0, 0x4e, 0x94, 0xae, 0x79, + 0x27, 0x3b, 0x91, 0xc3, 0xd4, 0x9e, 0x66, 0xad, 0xdc, 0xdb, 0xb3, 0xf6, 0x97, 0x9b, 0xa4, 0x9e, + 0x6d, 0x96, 0xae, 0xe5, 0x6b, 0x9a, 0xd0, 0xe3, 0xbb, 0xaf, 0xfe, 0x79, 0x3c, 0xe7, 0x64, 0xb8, + 0x4c, 0x50, 0xb1, 0x64, 0x23, 0xe8, 0x12, 0x1e, 0x1a, 0xb5, 0x5f, 0x89, 0x18, 0xcf, 0xd4, 0xa6, + 0x94, 0x28, 0x3a, 0x01, 0xf0, 0x0d, 0x4e, 0x69, 0x5a, 0x6e, 0xbe, 0x57, 0xda, 0xf3, 0x01, 0xad, + 0x33, 0x14, 0x6a, 0xef, 0xc2, 0xce, 0x84, 0xcc, 0xa6, 0xb0, 0xbf, 0x2c, 0x58, 0xd5, 0x65, 0x4f, + 0xb1, 0x6f, 0xef, 0xc3, 0xda, 0x0d, 0xbb, 0xf6, 0x40, 0x8c, 0xac, 0xcd, 0x17, 0xb0, 0xad, 0x4a, + 0x8c, 0x42, 0xe4, 0x89, 0x1b, 0xc4, 0x94, 0x27, 0x88, 0x6e, 0xb7, 0xe7, 0xbd, 0xc0, 0x7e, 0xb6, + 0x6d, 0x5b, 0x03, 0xc0, 0x89, 0xf6, 0x9f, 0x29, 0x37, 0x79, 0x02, 0x9b, 0x94, 0x31, 0x97, 0x0b, + 0x86, 0x2e, 0xf5, 0x7d, 0xd1, 0xe3, 0x89, 0x2b, 0x78, 0xd4, 0x57, 0x23, 0x5a, 0x74, 0x08, 0x65, + 0xec, 0x7b, 0xc1, 0xf0, 0x48, 0xbb, 0x4e, 0x79, 0xd4, 0xb7, 0x2b, 0xf0, 0xa8, 0xa8, 0xc2, 0x08, + 0xfc, 0xdd, 0x82, 0x07, 0xf9, 0x5c, 0x68, 0x07, 0xcf, 0x45, 0x82, 0x6f, 0xb7, 0x48, 0x27, 0xe9, + 0x22, 0xd1, 0x0e, 0xba, 0x21, 0xbf, 0x10, 0x4a, 0xc2, 0x72, 0xd3, 0x2e, 0x9d, 0x88, 0x4a, 0x98, + 0x6d, 0xc9, 0x92, 0x8a, 0x6d, 0xf1, 0x0b, 0x61, 0x6f, 0xc3, 0xd6, 0x48, 0x41, 0xa6, 0xd8, 0xff, + 0xef, 0x40, 0x65, 0x30, 0x2d, 0xf3, 0x1d, 0xfa, 0x36, 0xfd, 0x0c, 0x95, 0x54, 0xfd, 0x01, 0xac, + 0x85, 0xb2, 0xc5, 0x3d, 0xd1, 0xe3, 0xec, 0x1b, 0x4e, 0xbd, 0x08, 0x99, 0x2a, 0x70, 0xd1, 0x19, + 0xb3, 0x93, 0x03, 0x58, 0x0f, 0xe5, 0x69, 0x2f, 0x29, 0x80, 0x75, 0x63, 0xc7, 0x1d, 0xa4, 0x0d, + 0x9b, 0x01, 0x95, 0x67, 0x71, 0xe8, 0x63, 0x8b, 0xa7, 0xe9, 0x24, 0xaa, 0x62, 0xb2, 0xb7, 0xa2, + 0x59, 0xaa, 0xff, 0x64, 0x52, 0xa4, 0x33, 0x99, 0x90, 0xfc, 0x02, 0xef, 0x7a, 0x83, 0x17, 0xe7, + 0x1c, 0xe3, 0xf0, 0x22, 0xf4, 0x69, 0x12, 0x0a, 0xad, 0xbe, 0xb2, 0xa0, 0x12, 0x7e, 0x7e, 0x4b, + 0xc3, 0x6f, 0x26, 0x70, 0x4a, 0xe9, 0x6d, 0x1b, 0xf6, 0x6e, 0x6a, 0xbc, 0x99, 0xce, 0x91, 0xda, + 0x24, 0x8d, 0xf9, 0x0e, 0xfb, 0x01, 0xf2, 0x92, 0x99, 0x6c, 0xc0, 0x3d, 0x95, 0x30, 0x5b, 0x23, + 0x7d, 0xc8, 0x66, 0x3f, 0x4c, 0x91, 0xb3, 0x37, 0xaf, 0x16, 0x60, 0xfe, 0xb9, 0x0c, 0x88, 0x80, + 0xe5, 0xe1, 0xb7, 0xf1, 0xc3, 0x52, 0xc5, 0xc5, 0xa5, 0xaf, 0x3e, 0x9d, 0x01, 0x9c, 0x27, 0x26, + 0x97, 0xb0, 0x3a, 0x72, 0xe3, 0xd4, 0x6f, 0xa3, 0x29, 0xe2, 0xab, 0x9f, 0xce, 0x86, 0x37, 0x99, + 0x7f, 0x85, 0xb5, 0xb1, 0x4f, 0xe2, 0xe1, 0x74, 0x5c, 0x83, 0x88, 0xea, 0x67, 0xb3, 0x46, 0x98, + 0xfc, 0x31, 0xac, 0x14, 0xbe, 0x0b, 0x07, 0x53, 0xb4, 0xcf, 0xa0, 0xab, 0x1f, 0xcf, 0x82, 0x36, + 0x39, 0x7f, 0xb3, 0x60, 0x73, 0xf2, 0xfb, 0xfd, 0xc9, 0x94, 0x3a, 0x8a, 0x61, 0xd5, 0x2f, 0xdf, + 0x2a, 0x6c, 0xb8, 0x07, 0x85, 0x8d, 0x3e, 0x98, 0x8e, 0x4e, 0xa3, 0x6f, 0xef, 0xc1, 0xa4, 0x55, + 0x4f, 0x37, 0x6e, 0xe4, 0x6a, 0xaf, 0x4f, 0xd5, 0x4b, 0x83, 0xbf, 0x7d, 0xe3, 0x26, 0xdf, 0xc3, + 0xc7, 0xad, 0x57, 0x57, 0x35, 0xeb, 0xf5, 0x55, 0xcd, 0xfa, 0xf7, 0xaa, 0x66, 0xfd, 0x71, 0x5d, + 0x9b, 0x7b, 0x7d, 0x5d, 0x9b, 0xfb, 0xfb, 0xba, 0x36, 0xf7, 0x63, 0x23, 0x08, 0x93, 0x76, 0xcf, + 0x4b, 0xaf, 0xf9, 0x46, 0xca, 0xf8, 0x91, 0x22, 0x6f, 0xe4, 0xe4, 0x8d, 0xcb, 0xc6, 0xe0, 0x0f, + 0x5b, 0xbf, 0x8b, 0xd2, 0x5b, 0x50, 0xff, 0xd9, 0x9e, 0xbe, 0x09, 0x00, 0x00, 0xff, 0xff, 0xb7, + 0xd1, 0x06, 0xc3, 0xaa, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1423,18 +1424,16 @@ func (m *MsgAddBlameVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.BlameInfo != nil { - { - size, err := m.BlameInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) + { + size, err := m.BlameInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0x1a + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x1a if m.ChainId != 0 { i = encodeVarintTx(dAtA, i, uint64(m.ChainId)) i-- @@ -1778,10 +1777,8 @@ func (m *MsgAddBlameVote) Size() (n int) { if m.ChainId != 0 { n += 1 + sovTx(uint64(m.ChainId)) } - if m.BlameInfo != nil { - l = m.BlameInfo.Size() - n += 1 + l + sovTx(uint64(l)) - } + l = m.BlameInfo.Size() + n += 1 + l + sovTx(uint64(l)) return n } @@ -2806,9 +2803,6 @@ func (m *MsgAddBlameVote) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.BlameInfo == nil { - m.BlameInfo = &Blame{} - } if err := m.BlameInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/zetaclient/bitcoin_client.go b/zetaclient/bitcoin_client.go index 6b6ca7d7aa..085fc413d3 100644 --- a/zetaclient/bitcoin_client.go +++ b/zetaclient/bitcoin_client.go @@ -207,14 +207,11 @@ func (ob *BitcoinChainClient) Stop() { ob.logger.ChainLogger.Info().Msgf("%s observer stopped", ob.chain.String()) } -func (ob *BitcoinChainClient) SetLastBlockHeight(block int64) { - if block < 0 { +func (ob *BitcoinChainClient) SetLastBlockHeight(height int64) { + if height < 0 { panic("lastBlock is negative") } - if block >= math.MaxInt64 { - panic("lastBlock is too large") - } - atomic.StoreInt64(&ob.lastBlock, block) + atomic.StoreInt64(&ob.lastBlock, height) } func (ob *BitcoinChainClient) GetLastBlockHeight() int64 { @@ -222,21 +219,16 @@ func (ob *BitcoinChainClient) GetLastBlockHeight() int64 { if height < 0 { panic("lastBlock is negative") } - if height >= math.MaxInt64 { - panic("lastBlock is too large") - } return height } -func (ob *BitcoinChainClient) SetLastBlockHeightScanned(block int64) { - if block < 0 { +func (ob *BitcoinChainClient) SetLastBlockHeightScanned(height int64) { + if height < 0 { panic("lastBlockScanned is negative") } - if block >= math.MaxInt64 { - panic("lastBlockScanned is too large") - } - atomic.StoreInt64(&ob.lastBlockScanned, block) - ob.ts.SetLastScannedBlockNumber((ob.chain.ChainId), (block)) + atomic.StoreInt64(&ob.lastBlockScanned, height) + // #nosec G701 checked as positive + ob.ts.SetLastScannedBlockNumber((ob.chain.ChainId), uint64(height)) } func (ob *BitcoinChainClient) GetLastBlockHeightScanned() int64 { @@ -244,9 +236,6 @@ func (ob *BitcoinChainClient) GetLastBlockHeightScanned() int64 { if height < 0 { panic("lastBlockScanned is negative") } - if height >= math.MaxInt64 { - panic("lastBlockScanned is too large") - } return height } @@ -264,7 +253,12 @@ func (ob *BitcoinChainClient) GetBaseGasPrice() *big.Int { } func (ob *BitcoinChainClient) WatchInTx() { - ticker := NewDynamicTicker("Bitcoin_WatchInTx", ob.GetCoreParams().InTxTicker) + ticker, err := NewDynamicTicker("Bitcoin_WatchInTx", ob.GetCoreParams().InTxTicker) + if err != nil { + ob.logger.WatchInTx.Error().Err(err).Msg("WatchInTx error") + return + } + defer ticker.Stop() for { select { @@ -316,21 +310,20 @@ func (ob *BitcoinChainClient) postBlockHeader(tip int64) error { return err } -// TODO func (ob *BitcoinChainClient) observeInTx() error { cnt, err := ob.rpcClient.GetBlockCount() if err != nil { return fmt.Errorf("error getting block count: %s", err) } - if cnt < 0 || cnt >= math.MaxInt64 { - return fmt.Errorf("block count is out of range: %d", cnt) + if cnt < 0 { + return fmt.Errorf("block count is negative: %d", cnt) } // "confirmed" current block number // #nosec G701 always in range confirmedBlockNum := cnt - int64(ob.GetCoreParams().ConfirmationCount) - if confirmedBlockNum < 0 || confirmedBlockNum > math.MaxInt64 { - return fmt.Errorf("skipping observer , confirmedBlockNum is negative or too large ") + if confirmedBlockNum < 0 { + return fmt.Errorf("skipping observer , current block number %d is too small", cnt) } ob.SetLastBlockHeight(confirmedBlockNum) @@ -342,9 +335,8 @@ func (ob *BitcoinChainClient) observeInTx() error { return errors.New("inbound TXS / Send has been disabled by the protocol") } - lastBN := ob.GetLastBlockHeightScanned() - // query incoming gas asset + lastBN := ob.GetLastBlockHeightScanned() if confirmedBlockNum > lastBN { bn := lastBN + 1 res, err := ob.GetBlockByNumberCached(bn) @@ -373,7 +365,13 @@ func (ob *BitcoinChainClient) observeInTx() error { tssAddress := ob.Tss.BTCAddress() // #nosec G701 always positive - inTxs := FilterAndParseIncomingTx(res.Block.Tx, uint64(res.Block.Height), tssAddress, &ob.logger.WatchInTx) + inTxs := FilterAndParseIncomingTx( + res.Block.Tx, + uint64(res.Block.Height), + tssAddress, + &ob.logger.WatchInTx, + ob.chain.ChainId, + ) for _, inTx := range inTxs { msg := ob.GetInboundVoteMessageFromBtcEvent(inTx) @@ -387,7 +385,8 @@ func (ob *BitcoinChainClient) observeInTx() error { // Save LastBlockHeight ob.SetLastBlockHeightScanned(bn) - if err := ob.db.Save(clienttypes.ToLastBlockSQLType(ob.GetLastBlockHeightScanned())).Error; err != nil { + // #nosec G701 always positive + if err := ob.db.Save(clienttypes.ToLastBlockSQLType(uint64(ob.GetLastBlockHeightScanned()))).Error; err != nil { ob.logger.WatchInTx.Error().Err(err).Msg("error writing Block to db") } } @@ -414,21 +413,7 @@ func (ob *BitcoinChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64 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 - } - - // 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 - } - - // Get original cctx parameters - params, err = ob.GetPendingCctxParams(nonce) + params, err := ob.GetCctxParams(nonce) if err != nil { ob.logger.ObserveOutTx.Info().Msgf("IsSendOutTxProcessed: can't find pending cctx for nonce %d", nonce) return false, false, err @@ -475,7 +460,7 @@ func (ob *BitcoinChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64 } logger.Debug().Msgf("Bitcoin outTx confirmed: txid %s, amount %s\n", res.TxID, amountInSat.String()) - zetaHash, err := ob.zetaClient.PostReceiveConfirmation( + zetaHash, ballot, err := ob.zetaClient.PostReceiveConfirmation( sendHash, res.TxID, // #nosec G701 always positive @@ -490,15 +475,20 @@ func (ob *BitcoinChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64 common.CoinType_Gas, ) if err != nil { - logger.Error().Err(err).Msgf("error posting to zeta core") - } else { - logger.Info().Msgf("Bitcoin outTx %s confirmed: PostReceiveConfirmation zeta tx: %s", res.TxID, zetaHash) + logger.Error().Err(err).Msgf("IsSendOutTxProcessed: error confirming bitcoin outTx %s, nonce %d ballot %s", res.TxID, nonce, ballot) + } else if zetaHash != "" { + logger.Info().Msgf("IsSendOutTxProcessed: confirmed Bitcoin outTx %s, zeta tx hash %s nonce %d ballot %s", res.TxID, zetaHash, nonce, ballot) } return true, true, nil } func (ob *BitcoinChainClient) WatchGasPrice() { - ticker := NewDynamicTicker("Bitcoin_WatchGasPrice", ob.GetCoreParams().GasPriceTicker) + ticker, err := NewDynamicTicker("Bitcoin_WatchGasPrice", ob.GetCoreParams().GasPriceTicker) + if err != nil { + ob.logger.WatchGasPrice.Error().Err(err).Msg("WatchGasPrice error") + return + } + defer ticker.Stop() for { select { @@ -542,7 +532,7 @@ func (ob *BitcoinChainClient) PostGasPrice() error { if *feeResult.FeeRate > math.MaxInt64 { return fmt.Errorf("gas price is too large: %f", *feeResult.FeeRate) } - feeRatePerByte := feeRateToSatPerByte(*feeResult.FeeRate) + feeRatePerByte := FeeRateToSatPerByte(*feeResult.FeeRate) bn, err := ob.rpcClient.GetBlockCount() if err != nil { return err @@ -570,13 +560,19 @@ type BTCInTxEvnet struct { // relevant tx must have the following vouts as the first two vouts: // vout0: p2wpkh to the TSS address (targetAddress) // vout1: OP_RETURN memo, base64 encoded -func FilterAndParseIncomingTx(txs []btcjson.TxRawResult, blockNumber uint64, targetAddress string, logger *zerolog.Logger) []*BTCInTxEvnet { +func FilterAndParseIncomingTx( + txs []btcjson.TxRawResult, + blockNumber uint64, + targetAddress string, + logger *zerolog.Logger, + chainID int64, +) []*BTCInTxEvnet { inTxs := make([]*BTCInTxEvnet, 0) for idx, tx := range txs { if idx == 0 { continue // the first tx is coinbase; we do not process coinbase tx } - inTx, err := GetBtcEvent(tx, targetAddress, blockNumber, logger) + inTx, err := GetBtcEvent(tx, targetAddress, blockNumber, logger, chainID) if err != nil { logger.Error().Err(err).Msg("error getting btc event") continue @@ -599,7 +595,7 @@ func (ob *BitcoinChainClient) GetInboundVoteMessageFromBtcEvent(inTx *BTCInTxEvn ob.chain.ChainId, inTx.FromAddress, inTx.FromAddress, - common.ZetaChain().ChainId, + ob.zetaClient.ZetaChain().ChainId, cosmosmath.NewUintFromBigInt(amountInt), message, inTx.TxHash, @@ -612,7 +608,13 @@ func (ob *BitcoinChainClient) GetInboundVoteMessageFromBtcEvent(inTx *BTCInTxEvn ) } -func GetBtcEvent(tx btcjson.TxRawResult, targetAddress string, blockNumber uint64, logger *zerolog.Logger) (*BTCInTxEvnet, error) { +func GetBtcEvent( + tx btcjson.TxRawResult, + targetAddress string, + blockNumber uint64, + logger *zerolog.Logger, + chainID int64, +) (*BTCInTxEvnet, error) { found := false var value float64 var memo []byte @@ -625,14 +627,24 @@ func GetBtcEvent(tx btcjson.TxRawResult, targetAddress string, blockNumber uint6 if err != nil { return nil, err } - wpkhAddress, err := btcutil.NewAddressWitnessPubKeyHash(hash, config.BitconNetParams) + + bitcoinNetParams, err := common.BitcoinNetParamsFromChainID(chainID) + if err != nil { + return nil, fmt.Errorf("btc: error getting bitcoin net params : %v", err) + } + wpkhAddress, err := btcutil.NewAddressWitnessPubKeyHash(hash, bitcoinNetParams) if err != nil { return nil, err } if wpkhAddress.EncodeAddress() != targetAddress { return nil, err } - value = out.Value + // deposit amount has to be no less than the minimum depositor fee + if out.Value < BtcDepositorFeeMin { + return nil, fmt.Errorf("btc deposit amount %v in txid %s is less than minimum depositor fee %v", value, tx.Txid, BtcDepositorFeeMin) + } + value = out.Value - BtcDepositorFeeMin + out = tx.Vout[1] script = out.ScriptPubKey.Hex if len(script) >= 4 && script[:2] == "6a" { // OP_RETURN @@ -648,7 +660,7 @@ func GetBtcEvent(tx btcjson.TxRawResult, targetAddress string, blockNumber uint6 logger.Warn().Err(err).Msgf("error hex decoding memo") return nil, fmt.Errorf("error hex decoding memo: %s", err) } - if bytes.Compare(memoBytes, []byte(DonationMessage)) == 0 { + if bytes.Equal(memoBytes, []byte(DonationMessage)) { logger.Info().Msgf("donation tx: %s; value %f", tx.Txid, value) return nil, fmt.Errorf("donation tx: %s; value %f", tx.Txid, value) } @@ -656,10 +668,9 @@ func GetBtcEvent(tx btcjson.TxRawResult, targetAddress string, blockNumber uint6 found = true } } - } if found { - fmt.Println("found tx: ", tx.Txid) + logger.Info().Msgf("found bitcoin intx: %s", tx.Txid) var fromAddress string if len(tx.Vin) > 0 { vin := tx.Vin[0] @@ -671,7 +682,13 @@ func GetBtcEvent(tx btcjson.TxRawResult, targetAddress string, blockNumber uint6 return nil, errors.Wrapf(err, "error decoding pubkey") } hash := btcutil.Hash160(pkBytes) - addr, err := btcutil.NewAddressWitnessPubKeyHash(hash, config.BitconNetParams) + + bitcoinNetParams, err := common.BitcoinNetParamsFromChainID(chainID) + if err != nil { + return nil, fmt.Errorf("btc: error getting bitcoin net params : %v", err) + } + + addr, err := btcutil.NewAddressWitnessPubKeyHash(hash, bitcoinNetParams) if err != nil { return nil, errors.Wrapf(err, "error decoding pubkey hash") } @@ -691,7 +708,12 @@ func GetBtcEvent(tx btcjson.TxRawResult, targetAddress string, blockNumber uint6 } func (ob *BitcoinChainClient) WatchUTXOS() { - ticker := NewDynamicTicker("Bitcoin_WatchUTXOS", ob.GetCoreParams().WatchUtxoTicker) + ticker, err := NewDynamicTicker("Bitcoin_WatchUTXOS", ob.GetCoreParams().WatchUtxoTicker) + if err != nil { + ob.logger.WatchUTXOS.Error().Err(err).Msg("WatchUTXOS error") + return + } + defer ticker.Stop() for { select { @@ -727,7 +749,11 @@ func (ob *BitcoinChainClient) FetchUTXOS() error { // List unspent. tssAddr := ob.Tss.BTCAddress() - address, err := btcutil.DecodeAddress(tssAddr, config.BitconNetParams) + bitcoinNetParams, err := common.BitcoinNetParamsFromChainID(ob.chain.ChainId) + if err != nil { + return fmt.Errorf("btc: error getting bitcoin net params : %v", err) + } + address, err := btcutil.DecodeAddress(tssAddr, bitcoinNetParams) if err != nil { return fmt.Errorf("btc: error decoding wallet address (%s) : %s", tssAddr, err.Error()) } @@ -738,7 +764,6 @@ func (ob *BitcoinChainClient) FetchUTXOS() error { if err != nil { return err } - //ob.logger.WatchUTXOS.Debug().Msgf("btc: fetched %d utxos in confirmation range [0, %d]", len(unspents), maxConfirmations) // rigid sort to make utxo list deterministic sort.SliceStable(utxos, func(i, j int) bool { @@ -751,9 +776,17 @@ func (ob *BitcoinChainClient) FetchUTXOS() error { return utxos[i].Amount < utxos[j].Amount }) + // filter UTXOs big enough to cover the cost of spending themselves + utxosFiltered := make([]btcjson.ListUnspentResult, 0) + for _, utxo := range utxos { + if utxo.Amount >= BtcDepositorFeeMin { + utxosFiltered = append(utxosFiltered, utxo) + } + } + ob.Mu.Lock() - ob.ts.SetNumberOfUTXOs(len(utxos)) - ob.utxos = utxos + ob.ts.SetNumberOfUTXOs(len(utxosFiltered)) + ob.utxos = utxosFiltered ob.Mu.Unlock() return nil } @@ -828,7 +861,7 @@ func (ob *BitcoinChainClient) findNonceMarkUTXO(nonce uint64, txid string) (int, tssAddress := ob.Tss.BTCAddressWitnessPubkeyHash().EncodeAddress() amount := common.NonceMarkAmount(nonce) for i, utxo := range ob.utxos { - sats, err := getSatoshis(utxo.Amount) + sats, err := GetSatoshis(utxo.Amount) if err != nil { ob.logger.ObserveOutTx.Error().Err(err).Msgf("findNonceMarkUTXO: error getting satoshis for utxo %v", utxo) } @@ -935,11 +968,12 @@ func (ob *BitcoinChainClient) SaveBroadcastedTx(txHash string, nonce uint64) { broadcastEntry := clienttypes.ToOutTxHashSQLType(txHash, outTxID) if err := ob.db.Save(&broadcastEntry).Error; err != nil { - ob.logger.ObserveOutTx.Error().Err(err).Msg("observeOutTx: error saving broadcasted tx") + ob.logger.ObserveOutTx.Error().Err(err).Msgf("SaveBroadcastedTx: error saving broadcasted txHash %s for outTx %s", txHash, outTxID) } + ob.logger.ObserveOutTx.Info().Msgf("SaveBroadcastedTx: saved broadcasted txHash %s for outTx %s", txHash, outTxID) } -func (ob *BitcoinChainClient) GetPendingCctxParams(nonce uint64) (types.OutboundTxParams, error) { +func (ob *BitcoinChainClient) GetCctxParams(nonce uint64) (types.OutboundTxParams, error) { send, err := ob.zetaClient.GetCctxByNonce(ob.chain.ChainId, nonce) if err != nil { return types.OutboundTxParams{}, err @@ -947,19 +981,21 @@ func (ob *BitcoinChainClient) GetPendingCctxParams(nonce uint64) (types.Outbound if send.GetCurrentOutTxParam() == nil { // never happen return types.OutboundTxParams{}, fmt.Errorf("GetPendingCctx: nil outbound tx params") } - if send.CctxStatus.Status == types.CctxStatus_PendingOutbound || send.CctxStatus.Status == types.CctxStatus_PendingRevert { - return *send.GetCurrentOutTxParam(), nil - } - return types.OutboundTxParams{}, fmt.Errorf("GetPendingCctx: not a pending cctx") + return *send.GetCurrentOutTxParam(), nil } func (ob *BitcoinChainClient) observeOutTx() { - ticker := NewDynamicTicker("Bitcoin_observeOutTx", ob.GetCoreParams().OutTxTicker) + ticker, err := NewDynamicTicker("Bitcoin_observeOutTx", ob.GetCoreParams().OutTxTicker) + if err != nil { + ob.logger.ObserveOutTx.Error().Err(err).Msg("observeOutTx: error creating ticker") + return + } + defer ticker.Stop() for { select { case <-ticker.C(): - trackers, err := ob.zetaClient.GetAllOutTxTrackerByChain(ob.chain, Ascending) + trackers, err := ob.zetaClient.GetAllOutTxTrackerByChain(ob.chain.ChainId, Ascending) if err != nil { ob.logger.ObserveOutTx.Error().Err(err).Msg("observeOutTx: error GetAllOutTxTrackerByChain") continue @@ -967,9 +1003,9 @@ func (ob *BitcoinChainClient) observeOutTx() { for _, tracker := range trackers { // get original cctx parameters outTxID := ob.GetTxID(tracker.Nonce) - params, err := ob.GetPendingCctxParams(tracker.Nonce) + params, err := ob.GetCctxParams(tracker.Nonce) if err != nil { - ob.logger.ObserveOutTx.Info().Err(err).Msgf("observeOutTx: can't find pending cctx for nonce %d", tracker.Nonce) + ob.logger.ObserveOutTx.Info().Err(err).Msgf("observeOutTx: can't find cctx for nonce %d", tracker.Nonce) break } if tracker.Nonce != params.OutboundTxTssNonce { // Tanmay: it doesn't hurt to check @@ -1096,9 +1132,10 @@ func (ob *BitcoinChainClient) getRawTxResult(hash *chainhash.Hash, res *btcjson. return btcjson.TxRawResult{}, errors.Wrapf(err, "getRawTxResult: invalid outTx with invalid block index, TxID %s, BlockIndex %d", res.TxID, res.BlockIndex) } return block.Tx[res.BlockIndex], nil - } else { // res.Confirmations < 0 (meaning not included) - return btcjson.TxRawResult{}, fmt.Errorf("getRawTxResult: tx %s not included yet", hash) } + + // res.Confirmations < 0 (meaning not included) + return btcjson.TxRawResult{}, fmt.Errorf("getRawTxResult: tx %s not included yet", hash) } // checkTSSVin checks vin is valid if: @@ -1145,7 +1182,7 @@ func (ob *BitcoinChainClient) checkTSSVout(vouts []btcjson.Vout, params types.Ou tssAddress := ob.Tss.BTCAddress() for _, vout := range vouts { - amount, err := getSatoshis(vout.Value) + amount, err := GetSatoshis(vout.Value) if err != nil { return errors.Wrap(err, "checkTSSVout: error getting satoshis") } @@ -1221,10 +1258,12 @@ func (ob *BitcoinChainClient) LoadLastBlock() error { ob.logger.ChainLogger.Info().Msg("LastBlockNum not found in DB, scan from latest") ob.SetLastBlockHeightScanned(bn) } else { - ob.SetLastBlockHeightScanned(lastBlockNum.Num) + // #nosec G701 always in range + lastBN := int64(lastBlockNum.Num) + ob.SetLastBlockHeightScanned(lastBN) //If persisted block number is too low, use the latest height - if (bn - lastBlockNum.Num) > maxHeightDiff { + if (bn - lastBN) > maxHeightDiff { ob.logger.ChainLogger.Info().Msgf("LastBlockNum too low: %d, scan from latest", lastBlockNum.Num) ob.SetLastBlockHeightScanned(bn) } diff --git a/zetaclient/bitcoin_client_test.go b/zetaclient/bitcoin_client_test.go index 4779bd9c75..49685b1f58 100644 --- a/zetaclient/bitcoin_client_test.go +++ b/zetaclient/bitcoin_client_test.go @@ -96,7 +96,13 @@ func (suite *BitcoinClientTestSuite) Test1() { suite.T().Logf("block confirmation %d", block.Confirmations) suite.T().Logf("block txs len %d", len(block.Tx)) - inTxs := FilterAndParseIncomingTx(block.Tx, uint64(block.Height), "tb1qsa222mn2rhdq9cruxkz8p2teutvxuextx3ees2", &log.Logger) + inTxs := FilterAndParseIncomingTx( + block.Tx, + uint64(block.Height), + "tb1qsa222mn2rhdq9cruxkz8p2teutvxuextx3ees2", + &log.Logger, + common.BtcRegtestChain().ChainId, + ) suite.Require().Equal(1, len(inTxs)) suite.Require().Equal(inTxs[0].Value, 0.0001) @@ -126,7 +132,13 @@ func (suite *BitcoinClientTestSuite) Test2() { suite.T().Logf("block height %d", block.Height) suite.T().Logf("block txs len %d", len(block.Tx)) - inTxs := FilterAndParseIncomingTx(block.Tx, uint64(block.Height), "tb1qsa222mn2rhdq9cruxkz8p2teutvxuextx3ees2", &log.Logger) + inTxs := FilterAndParseIncomingTx( + block.Tx, + uint64(block.Height), + "tb1qsa222mn2rhdq9cruxkz8p2teutvxuextx3ees2", + &log.Logger, + common.BtcRegtestChain().ChainId, + ) suite.Require().Equal(0, len(inTxs)) } diff --git a/zetaclient/broadcast.go b/zetaclient/broadcast.go index d69c6c2778..f9faf1d9a2 100644 --- a/zetaclient/broadcast.go +++ b/zetaclient/broadcast.go @@ -6,6 +6,9 @@ import ( "strconv" "strings" + "github.com/zeta-chain/zetacore/cmd/zetacored/config" + + "github.com/zeta-chain/zetacore/common/cosmos" "github.com/zeta-chain/zetacore/zetaclient/hsm" "github.com/cosmos/cosmos-sdk/client" @@ -17,9 +20,13 @@ import ( rpchttp "github.com/tendermint/tendermint/rpc/client/http" ) +const ( + // DefaultBaseGasPrice is the default base gas price + DefaultBaseGasPrice = 1_000_000 +) + // Broadcast Broadcasts tx to metachain. Returns txHash and error func (b *ZetaCoreBridge) Broadcast(gaslimit uint64, authzWrappedMsg sdktypes.Msg, authzSigner AuthZSigner) (string, error) { - gaslimit = gaslimit * 3 b.broadcastLock.Lock() defer b.broadcastLock.Unlock() var err error @@ -28,6 +35,13 @@ func (b *ZetaCoreBridge) Broadcast(gaslimit uint64, authzWrappedMsg sdktypes.Msg if err != nil { return "", err } + baseGasPrice, err := b.GetBaseGasPrice() + if err != nil { + return "", err + } + if baseGasPrice == 0 { + baseGasPrice = DefaultBaseGasPrice // shoudn't happen, but just in case + } if blockHeight > b.blockHeight { b.blockHeight = blockHeight @@ -57,14 +71,15 @@ func (b *ZetaCoreBridge) Broadcast(gaslimit uint64, authzWrappedMsg sdktypes.Msg return "", err } builder.SetGasLimit(gaslimit) - fee := sdktypes.NewCoins(sdktypes.NewCoin("azeta", sdktypes.NewInt(40000))) + // #nosec G701 always in range + fee := sdktypes.NewCoins(sdktypes.NewCoin(config.BaseDenom, + cosmos.NewInt(int64(gaslimit)).Mul(cosmos.NewInt(baseGasPrice)))) builder.SetFeeAmount(fee) //fmt.Printf("signing from name: %s\n", ctx.GetFromName()) err = b.SignTx(factory, ctx.GetFromName(), builder, true, ctx.TxConfig) if err != nil { return "", err } - txBytes, err := ctx.TxConfig.TxEncoder()(builder.GetTx()) if err != nil { return "", err @@ -106,7 +121,6 @@ func (b *ZetaCoreBridge) Broadcast(gaslimit uint64, authzWrappedMsg sdktypes.Msg //seq := b.seqNumber[authzSigner.KeyType] //atomic.AddUint64(&seq, 1) b.seqNumber[authzSigner.KeyType] = b.seqNumber[authzSigner.KeyType] + 1 - //b.logger.Debug().Msgf("b.sequence number increased to %d", b.seqNumber) return commit.TxHash, nil } diff --git a/zetaclient/broadcast_test.go b/zetaclient/broadcast_test.go index 981caf9824..01c910aa72 100644 --- a/zetaclient/broadcast_test.go +++ b/zetaclient/broadcast_test.go @@ -8,7 +8,6 @@ import ( ) type BcastSuite struct { - bridge *ZetaCoreBridge } var _ = Suite(&BcastSuite{}) diff --git a/zetaclient/btc_signer.go b/zetaclient/btc_signer.go index 37969b2977..435e9cbcc9 100644 --- a/zetaclient/btc_signer.go +++ b/zetaclient/btc_signer.go @@ -23,16 +23,19 @@ import ( const ( maxNoOfInputsPerTx = 20 - consolidationRank = 10 // the rank below (or equal to) which we consolidate UTXOs - outTxBytesMin = 400 // 500B is an estimated size for a 2-input, 3-output SegWit tx - outTxBytesMax = 3250 // 3250B is an estimated size 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 + consolidationRank = 10 // the rank below (or equal to) which we consolidate UTXOs ) +var ( + outTxBytesMin uint64 + outTxBytesMax uint64 +) + +func init() { + outTxBytesMin = EstimateSegWitTxSize(2, 3) // 403B, estimated size for a 2-input, 3-output SegWit tx + outTxBytesMax = EstimateSegWitTxSize(21, 3) // 3234B, estimated size for a 21-input, 3-output SegWit tx +} + type BTCSigner struct { tssSigner TSSSigner rpcClient BTCRPCClient @@ -77,7 +80,7 @@ func (signer *BTCSigner) SignWithdrawTx( nonce uint64, chain *common.Chain, ) (*wire.MsgTx, error) { - estimateFee := float64(gasPrice.Uint64()) * outTxBytesMax / 1e8 + estimateFee := float64(gasPrice.Uint64()*outTxBytesMax) / 1e8 nonceMark := common.NonceMarkAmount(nonce) // refresh unspent UTXOs and continue with keysign regardless of error @@ -104,13 +107,13 @@ func (signer *BTCSigner) SignWithdrawTx( tx.AddTxIn(txIn) } - amountSatoshis, err := getSatoshis(amount) + amountSatoshis, err := GetSatoshis(amount) if err != nil { return nil, err } // size checking - // #nosec G701 check as positive + // #nosec G701 always positive 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) @@ -119,9 +122,9 @@ func (signer *BTCSigner) SignWithdrawTx( 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 + if txSize > outTxBytesMax { // in case of accident + signer.logger.Warn().Msgf("sizeLimit %d is greater than outTxBytesMax %d; use outTxBytesMax", sizeLimit, outTxBytesMax) + txSize = outTxBytesMax } // fee calculation @@ -137,18 +140,16 @@ func (signer *BTCSigner) SignWithdrawTx( return nil, err } remaining := total - amount - remainingSats, err := getSatoshis(remaining) + remainingSats, err := GetSatoshis(remaining) if err != nil { return nil, err } remainingSats -= fees.Int64() remainingSats -= nonceMark if remainingSats < 0 { - fmt.Printf("BTCSigner: SignWithdrawTx: Remainder Value is negative! : %d\n", remainingSats) - fmt.Printf("BTCSigner: SignWithdrawTx: Number of inputs : %d\n", len(tx.TxIn)) - return nil, fmt.Errorf("remainder value is negative") + return nil, fmt.Errorf("remainder value is negative: %d", remainingSats) } else if remainingSats == nonceMark { - fmt.Printf("BTCSigner: SignWithdrawTx: Adjust remainder value to avoid duplicate nonce-mark: %d\n", remainingSats) + signer.logger.Info().Msgf("SignWithdrawTx: adjust remainder value to avoid duplicate nonce-mark: %d", remainingSats) remainingSats-- } @@ -174,7 +175,7 @@ func (signer *BTCSigner) SignWithdrawTx( sigHashes := txscript.NewTxSigHashes(tx) witnessHashes := make([][]byte, len(tx.TxIn)) for ix := range tx.TxIn { - amt, err := getSatoshis(prevOuts[ix].Amount) + amt, err := GetSatoshis(prevOuts[ix].Amount) if err != nil { return nil, err } @@ -233,7 +234,7 @@ func (signer *BTCSigner) Broadcast(signedTx *wire.MsgTx) error { } func (signer *BTCSigner) TryProcessOutTx( - send *types.CrossChainTx, + cctx *types.CrossChainTx, outTxMan *OutTxProcessorManager, outTxID string, chainclient ChainClient, @@ -243,22 +244,22 @@ func (signer *BTCSigner) TryProcessOutTx( defer func() { outTxMan.EndTryProcess(outTxID) if err := recover(); err != nil { - signer.logger.Error().Msgf("BTC TryProcessOutTx: %s, caught panic error: %v", send.Index, err) + signer.logger.Error().Msgf("BTC TryProcessOutTx: %s, caught panic error: %v", cctx.Index, err) } }() logger := signer.logger.With(). Str("OutTxID", outTxID). - Str("SendHash", send.Index). + Str("SendHash", cctx.Index). Logger() - params := send.GetCurrentOutTxParam() + params := cctx.GetCurrentOutTxParam() if params.CoinType == common.CoinType_Zeta || params.CoinType == common.CoinType_ERC20 { logger.Error().Msgf("BTC TryProcessOutTx: can only send BTC to a BTC network") return } - logger.Info().Msgf("BTC TryProcessOutTx: %s, value %d to %s", send.Index, params.Amount.BigInt(), params.Receiver) + logger.Info().Msgf("BTC TryProcessOutTx: %s, value %d to %s", cctx.Index, params.Amount.BigInt(), params.Receiver) btcClient, ok := chainclient.(*BitcoinChainClient) if !ok { logger.Error().Msgf("chain client is not a bitcoin client") @@ -277,9 +278,9 @@ func (signer *BTCSigner) TryProcessOutTx( // Early return if the send is already processed // FIXME: handle revert case outboundTxTssNonce := params.OutboundTxTssNonce - included, confirmed, err := btcClient.IsSendOutTxProcessed(send.Index, outboundTxTssNonce, common.CoinType_Gas, logger) + included, confirmed, err := btcClient.IsSendOutTxProcessed(cctx.Index, outboundTxTssNonce, common.CoinType_Gas, logger) if err != nil { - logger.Error().Err(err).Msgf("cannot check if send %s is processed", send.Index) + logger.Error().Err(err).Msgf("cannot check if send %s is processed", cctx.Index) return } if included || confirmed { @@ -295,13 +296,23 @@ func (signer *BTCSigner) TryProcessOutTx( } // Check receiver P2WPKH address - addr, err := btcutil.DecodeAddress(params.Receiver, config.BitconNetParams) + bitcoinNetParams, err := common.BitcoinNetParamsFromChainID(params.ReceiverChainId) + if err != nil { + logger.Error().Err(err).Msgf("cannot get bitcoin net params%v", err) + return + } + + addr, err := btcutil.DecodeAddress(params.Receiver, bitcoinNetParams) if err != nil { logger.Error().Err(err).Msgf("cannot decode address %s ", params.Receiver) return } - if !addr.IsForNet(config.BitconNetParams) { - logger.Error().Msgf("address %s is not for network %s", params.Receiver, config.BitconNetParams.Name) + if !addr.IsForNet(bitcoinNetParams) { + logger.Error().Msgf( + "address %s is not for network %s", + params.Receiver, + bitcoinNetParams.Name, + ) return } to, ok := addr.(*btcutil.AddressWitnessPubKeyHash) @@ -316,7 +327,7 @@ func (signer *BTCSigner) TryProcessOutTx( logger.Error().Err(err).Msgf("cannot get bitcoin network info") return } - satPerByte := feeRateToSatPerByte(networkInfo.RelayFee) + satPerByte := FeeRateToSatPerByte(networkInfo.RelayFee) gasprice.Add(gasprice, satPerByte) logger.Info().Msgf("SignWithdrawTx: to %s, value %d sats", addr.EncodeAddress(), params.Amount.Uint64()) @@ -336,7 +347,8 @@ func (signer *BTCSigner) TryProcessOutTx( logger.Warn().Err(err).Msgf("SignOutboundTx error: nonce %d chain %d", outboundTxTssNonce, params.ReceiverChainId) return } - logger.Info().Msgf("Key-sign success: %d => %s, nonce %d", send.InboundTxParams.SenderChainId, btcClient.chain.ChainName, outboundTxTssNonce) + logger.Info().Msgf("Key-sign success: %d => %s, nonce %d", cctx.InboundTxParams.SenderChainId, btcClient.chain.ChainName, outboundTxTssNonce) + // FIXME: add prometheus metrics _, err = zetaBridge.GetObserverList(btcClient.chain) if err != nil { diff --git a/zetaclient/btc_signer_test.go b/zetaclient/btc_signer_test.go index 38b648ebec..8bee941a98 100644 --- a/zetaclient/btc_signer_test.go +++ b/zetaclient/btc_signer_test.go @@ -4,6 +4,7 @@ import ( "encoding/hex" "fmt" "math" + "math/rand" "sort" "sync" "testing" @@ -163,9 +164,11 @@ func (s *BTCSignerSuite) TestP2WPH(c *C) { redeemTx.AddTxOut(txOut) txSigHashes := txscript.NewTxSigHashes(redeemTx) pkScript, err = payToWitnessPubKeyHashScript(addr.WitnessProgram()) + c.Assert(err, IsNil) { txWitness, err := txscript.WitnessSignature(redeemTx, txSigHashes, 0, 100000000, pkScript, txscript.SigHashAll, privKey, true) + c.Assert(err, IsNil) redeemTx.TxIn[0].Witness = txWitness // Prove that the transaction has been validly signed by executing the // script pair. @@ -184,6 +187,7 @@ func (s *BTCSignerSuite) TestP2WPH(c *C) { witnessHash, err := txscript.CalcWitnessSigHash(pkScript, txSigHashes, txscript.SigHashAll, redeemTx, 0, 100000000) c.Assert(err, IsNil) sig, err := privKey.Sign(witnessHash) + c.Assert(err, IsNil) txWitness := wire.TxWitness{append(sig.Serialize(), byte(txscript.SigHashAll)), pubKeyHash} redeemTx.TxIn[0].Witness = txWitness @@ -201,6 +205,185 @@ func (s *BTCSignerSuite) TestP2WPH(c *C) { fmt.Println("Transaction successfully signed") } +func generateKeyPair(t *testing.T, net *chaincfg.Params) (*btcec.PrivateKey, []byte) { + privateKey, err := btcec.NewPrivateKey(btcec.S256()) + require.Nil(t, err) + pubKeyHash := btcutil.Hash160(privateKey.PubKey().SerializeCompressed()) + addr, err := btcutil.NewAddressWitnessPubKeyHash(pubKeyHash, net) + require.Nil(t, err) + //fmt.Printf("New address: %s\n", addr.EncodeAddress()) + pkScript, err := payToWitnessPubKeyHashScript(addr.WitnessProgram()) + require.Nil(t, err) + return privateKey, pkScript +} + +func addTxInputs(t *testing.T, tx *wire.MsgTx, txids []string) { + preTxSize := tx.SerializeSize() + require.Equal(t, bytesEmptyTx, preTxSize) + for i, txid := range txids { + hash, err := chainhash.NewHashFromStr(txid) + require.Nil(t, err) + outpoint := wire.NewOutPoint(hash, uint32(i%3)) + txIn := wire.NewTxIn(outpoint, nil, nil) + tx.AddTxIn(txIn) + require.Equal(t, bytesPerInput, tx.SerializeSize()-preTxSize) + //fmt.Printf("tx size: %d, input %d size: %d\n", tx.SerializeSize(), i, tx.SerializeSize()-preTxSize) + preTxSize = tx.SerializeSize() + } +} + +func addTxOutputs(t *testing.T, tx *wire.MsgTx, payerScript, payeeScript []byte) { + preTxSize := tx.SerializeSize() + + // 1st output to payer + value1 := int64(1 + rand.Intn(100000000)) + txOut1 := wire.NewTxOut(value1, payerScript) + tx.AddTxOut(txOut1) + require.Equal(t, bytesPerOutput, tx.SerializeSize()-preTxSize) + //fmt.Printf("tx size: %d, output 1: %d\n", tx.SerializeSize(), tx.SerializeSize()-preTxSize) + preTxSize = tx.SerializeSize() + + // 2nd output to payee + value2 := int64(1 + rand.Intn(100000000)) + txOut2 := wire.NewTxOut(value2, payeeScript) + tx.AddTxOut(txOut2) + require.Equal(t, bytesPerOutput, tx.SerializeSize()-preTxSize) + //fmt.Printf("tx size: %d, output 2: %d\n", tx.SerializeSize(), tx.SerializeSize()-preTxSize) + preTxSize = tx.SerializeSize() + + // 3rd output to payee + value3 := int64(1 + rand.Intn(100000000)) + txOut3 := wire.NewTxOut(value3, payeeScript) + tx.AddTxOut(txOut3) + require.Equal(t, bytesPerOutput, tx.SerializeSize()-preTxSize) + //fmt.Printf("tx size: %d, output 3: %d\n", tx.SerializeSize(), tx.SerializeSize()-preTxSize) +} + +func signTx(t *testing.T, tx *wire.MsgTx, payerScript []byte, privateKey *btcec.PrivateKey) { + preTxSize := tx.SerializeSize() + sigHashes := txscript.NewTxSigHashes(tx) + for ix := range tx.TxIn { + amount := int64(1 + rand.Intn(100000000)) + witnessHash, err := txscript.CalcWitnessSigHash(payerScript, sigHashes, txscript.SigHashAll, tx, ix, amount) + require.Nil(t, err) + sig, err := privateKey.Sign(witnessHash) + require.Nil(t, err) + + pkCompressed := privateKey.PubKey().SerializeCompressed() + txWitness := wire.TxWitness{append(sig.Serialize(), byte(txscript.SigHashAll)), pkCompressed} + tx.TxIn[ix].Witness = txWitness + + //fmt.Printf("tx size: %d, witness %d: %d\n", tx.SerializeSize(), ix+1, tx.SerializeSize()-preTxSize) + if ix == 0 { + bytesIncur := bytes1stWitness + len(tx.TxIn) - 1 // e.g., 130 bytes for a 21-input tx + require.True(t, tx.SerializeSize()-preTxSize >= bytesIncur-5) + require.True(t, tx.SerializeSize()-preTxSize <= bytesIncur+5) + } else { + require.True(t, tx.SerializeSize()-preTxSize >= bytesPerWitness-5) + require.True(t, tx.SerializeSize()-preTxSize <= bytesPerWitness+5) + } + preTxSize = tx.SerializeSize() + } +} + +func TestP2WPHSize2In3Out(t *testing.T) { + // Generate payer/payee private keys and P2WPKH addresss + privateKey, payerScript := generateKeyPair(t, &chaincfg.TestNet3Params) + _, payeeScript := generateKeyPair(t, &chaincfg.TestNet3Params) + + // 2 example UTXO txids to use in the test. + utxosTxids := []string{ + "c1729638e1c9b6bfca57d11bf93047d98b65594b0bf75d7ee68bf7dc80dc164e", + "54f9ebbd9e3ad39a297da54bf34a609b6831acbea0361cb5b7b5c8374f5046aa", + } + + // Create a new transaction and add inputs + tx := wire.NewMsgTx(wire.TxVersion) + addTxInputs(t, tx, utxosTxids) + + // Add P2WPKH outputs + addTxOutputs(t, tx, payerScript, payeeScript) + + // Payer sign the redeeming transaction. + signTx(t, tx, payerScript, privateKey) + + // Estimate the tx size + // #nosec G701 always positive + txSize := uint64(tx.SerializeSize()) + sizeEstimated := EstimateSegWitTxSize(uint64(len(utxosTxids)), 3) + require.Equal(t, outTxBytesMin, sizeEstimated) + require.True(t, outTxBytesMin >= txSize) + require.True(t, outTxBytesMin-txSize <= 2) // 2 witness may vary +} + +func TestP2WPHSize21In3Out(t *testing.T) { + // Generate payer/payee private keys and P2WPKH addresss + privateKey, payerScript := generateKeyPair(t, &chaincfg.TestNet3Params) + _, payeeScript := generateKeyPair(t, &chaincfg.TestNet3Params) + + // 21 example UTXO txids to use in the test. + utxosTxids := []string{ + "c1729638e1c9b6bfca57d11bf93047d98b65594b0bf75d7ee68bf7dc80dc164e", + "54f9ebbd9e3ad39a297da54bf34a609b6831acbea0361cb5b7b5c8374f5046aa", + "b18a55a34319cfbedebfcfe1a80fef2b92ad8894d06caf8293a0344824c2cfbc", + "969fb309a4df7c299972700da788b5d601c0c04bab4ab46fff79d0335a7d75de", + "6c71913061246ffc20e268c1b0e65895055c36bfbf1f8faf92dcad6f8242121e", + "ba6d6e88cb5a97556684a1232719a3ffe409c5c9501061e1f59741bc412b3585", + "69b56c3c8c5d1851f9eaec256cd49f290b477a5d43e2aef42ef25d3c1d9f4b33", + "b87effd4cb46fe1a575b5b1ba0289313dc9b4bc9e615a3c6cbc0a14186921fdf", + "3135433054523f5e220621c9e3d48efbbb34a6a2df65635c2a3e7d462d3e1cda", + "8495c22a9ce6359ab53aa048c13b41c64fdf5fe141f516ba2573cc3f9313f06e", + "f31583544b475370d7b9187c9a01b92e44fb31ac5fcfa7fc55565ac64043aa9a", + "c03d55f9f717c1df978623e2e6b397b720999242f9ead7db9b5988fee3fb3933", + "ee55688439b47a5410cdc05bac46be0094f3af54d307456fdfe6ba8caf336e0b", + "61895f86c70f0bc3eef55d9a00347b509fa90f7a344606a9774be98a3ee9e02a", + "ffabb401a19d04327bd4a076671d48467dbcde95459beeab23df21686fd01525", + "b7e1c03b9b73e4e90fc06da893072c5604203c49e66699acbb2f61485d822981", + "185614d21973990138e478ce10e0a4014352df58044276d4e4c0093aa140f482", + "4a2800f13d15dc0c82308761d6fe8f6d13b65e42d7ca96a42a3a7048830e8c55", + "fb98f52e91db500735b185797cebb5848afbfe1289922d87e03b98c3da5b85ef", + "7901c5e36d9e8456ac61b29b82048650672a889596cbd30a9f8910a589ffc5b3", + "6bcd0850fd2fa1404290ed04d78d4ae718414f16d4fbfd344951add8dcf60326", + } + + // Create a new transaction and add inputs + tx := wire.NewMsgTx(wire.TxVersion) + require.Equal(t, bytesEmptyTx, tx.SerializeSize()) + addTxInputs(t, tx, utxosTxids) + + // Add P2WPKH outputs + addTxOutputs(t, tx, payerScript, payeeScript) + + // Payer sign the redeeming transaction. + signTx(t, tx, payerScript, privateKey) + + // Estimate the tx size + // #nosec G701 always positive + txSize := uint64(tx.SerializeSize()) + sizeEstimated := EstimateSegWitTxSize(uint64(len(utxosTxids)), 3) + require.Equal(t, outTxBytesMax, sizeEstimated) + require.True(t, outTxBytesMax >= txSize) + require.True(t, outTxBytesMax-txSize <= 21) // 21 witness may vary +} + +func TestP2WPHSizeBreakdown(t *testing.T) { + txSize2In3Out := EstimateSegWitTxSize(2, 3) + require.Equal(t, outTxBytesMin, txSize2In3Out) + + sz := EstimateSegWitTxSize(1, 1) + fmt.Printf("1 input, 1 output: %d\n", sz) + + txSizeDepositor := SegWitTxSizeDepositor() + require.Equal(t, uint64(149), txSizeDepositor) + + txSizeWithdrawer := SegWitTxSizeWithdrawer() + require.Equal(t, uint64(254), txSizeWithdrawer) + require.Equal(t, txSize2In3Out, txSizeDepositor+txSizeWithdrawer) // 403 = 149 + 254 + + depositFee := DepositorFee(5) + require.Equal(t, depositFee, 0.00000745) +} + // helper function to create a new BitcoinChainClient func createTestClient(t *testing.T) *BitcoinChainClient { skHex := "7b8507ba117e069f4a3f456f505276084f8c92aee86ac78ae37b4d1801d35fa8" diff --git a/zetaclient/config/config_testnet.go b/zetaclient/config/config_chain.go similarity index 94% rename from zetaclient/config/config_testnet.go rename to zetaclient/config/config_chain.go index 5a3bf948e0..f932be7305 100644 --- a/zetaclient/config/config_testnet.go +++ b/zetaclient/config/config_chain.go @@ -1,29 +1,18 @@ -//go:build TESTNET -// +build TESTNET - package config import ( - "github.com/btcsuite/btcd/chaincfg" "github.com/zeta-chain/zetacore/common" ) const ( + BtcConfirmationCount = 1 + DevEthConfirmationCount = 2 + + // TssTestPrivkey is the private key of the TSS address + // #nosec G101 - used for testing only TssTestPrivkey = "2082bc9775d6ee5a05ef221a9d1c00b3cc3ecb274a4317acc0a182bc1e05d1bb" TssTestAddress = "0xE80B6467863EbF8865092544f441da8fD3cF6074" - //TestReceiver = "0x566bF3b1993FFd4BA134c107A63bb2aebAcCdbA0" -) - -// Constants -// #nosec G101 -const ( - - // Ticker timers - EthBlockTime = 12 - PolygonBlockTime = 2 - BscBlockTime = 5 - // to catch up: MaxBlocksPerPeriod = 100 ) @@ -34,33 +23,36 @@ const ( [{"inputs":[{"internalType":"address","name":"_TSSAddress","type":"address"},{"internalType":"address","name":"_TSSAddressUpdater","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidSender","type":"error"},{"inputs":[],"name":"InvalidTSSUpdater","type":"error"},{"inputs":[],"name":"IsPaused","type":"error"},{"inputs":[],"name":"NotPaused","type":"error"},{"inputs":[],"name":"NotWhitelisted","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"recipient","type":"bytes"},{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"}],"name":"Unwhitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"}],"name":"Whitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"TSSAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TSSAddressUpdater","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"recipient","type":"bytes"},{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceTSSAddressUpdater","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"unwhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"updateTSSAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"whitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]` ) -var ( - BitconNetParams = &chaincfg.TestNet3Params -) - func GetConnectorABI() string { return ConnectorAbiString } + func GetERC20CustodyABI() string { return ERC20CustodyAbiString } -var BitcoinConfig = &BTCConfig{ - RPCUsername: "smoketest", - RPCPassword: "123", - RPCHost: "bitcoin:18443", - RPCParams: "regtest", -} - func New() Config { return Config{ - BitcoinConfig: BitcoinConfig, - EVMChainConfigs: evmChainsConfig, + EVMChainConfigs: evmChainsConfigs, + BitcoinConfig: bitcoinConfigRegnet, ChainsEnabled: []common.Chain{}, } } -var evmChainsConfig = map[int64]*EVMConfig{ +var bitcoinConfigRegnet = &BTCConfig{ + RPCUsername: "smoketest", + RPCPassword: "123", + RPCHost: "bitcoin:18443", + RPCParams: "regtest", +} + +var evmChainsConfigs = map[int64]*EVMConfig{ + common.EthChain().ChainId: { + Chain: common.EthChain(), + }, + common.BscMainnetChain().ChainId: { + Chain: common.BscMainnetChain(), + }, common.GoerliChain().ChainId: { Chain: common.GoerliChain(), Endpoint: "", @@ -73,4 +65,8 @@ var evmChainsConfig = map[int64]*EVMConfig{ Chain: common.MumbaiChain(), Endpoint: "", }, + common.GoerliLocalnetChain().ChainId: { + Chain: common.GoerliLocalnetChain(), + Endpoint: "http://eth:8545", + }, } diff --git a/zetaclient/config/config_mainnet.go b/zetaclient/config/config_mainnet.go deleted file mode 100644 index 646b8b3460..0000000000 --- a/zetaclient/config/config_mainnet.go +++ /dev/null @@ -1,63 +0,0 @@ -//go:build !PRIVNET && !TESTNET && !MOCK_MAINNET -// +build !PRIVNET,!TESTNET,!MOCK_MAINNET - -package config - -import ( - "github.com/btcsuite/btcd/chaincfg" - "github.com/zeta-chain/zetacore/common" -) - -const ( - BtcConfirmationCount = 1 - DevEthConfirmationCount = 2 -) - -const ( - // #nosec - TssTestPrivkey = "2082bc9775d6ee5a05ef221a9d1c00b3cc3ecb274a4317acc0a182bc1e05d1bb" - TssTestAddress = "0xE80B6467863EbF8865092544f441da8fD3cF6074" -) - -// Constants -// #nosec G101 -const ( - MaxBlocksPerPeriod = 100 -) - -const ( - ConnectorAbiString = ` -[{"inputs":[{"internalType":"address","name":"_zetaTokenAddress","type":"address"},{"internalType":"address","name":"_tssAddress","type":"address"},{"internalType":"address","name":"_tssAddressUpdater","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"originSenderAddress","type":"bytes"},{"indexed":true,"internalType":"uint256","name":"originChainId","type":"uint256"},{"indexed":true,"internalType":"address","name":"destinationAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"},{"indexed":true,"internalType":"bytes32","name":"internalSendHash","type":"bytes32"}],"name":"ZetaReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"originSenderAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"originChainId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"indexed":true,"internalType":"bytes","name":"destinationAddress","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"},{"indexed":true,"internalType":"bytes32","name":"internalSendHash","type":"bytes32"}],"name":"ZetaReverted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"originSenderAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"destinationAddress","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gasLimit","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"zetaParams","type":"bytes"}],"name":"ZetaSent","type":"event"},{"inputs":[],"name":"getLockedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"originSenderAddress","type":"bytes"},{"internalType":"uint256","name":"originChainId","type":"uint256"},{"internalType":"address","name":"destinationAddress","type":"address"},{"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"},{"internalType":"bytes32","name":"internalSendHash","type":"bytes32"}],"name":"onReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"originSenderAddress","type":"address"},{"internalType":"uint256","name":"originChainId","type":"uint256"},{"internalType":"bytes","name":"destinationAddress","type":"bytes"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"},{"internalType":"bytes32","name":"internalSendHash","type":"bytes32"}],"name":"onRevert","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceTssAddressUpdater","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"bytes","name":"destinationAddress","type":"bytes"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"},{"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"internalType":"bytes","name":"zetaParams","type":"bytes"}],"internalType":"struct ZetaInterfaces.SendInput","name":"input","type":"tuple"}],"name":"send","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tssAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tssAddressUpdater","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tssAddress","type":"address"}],"name":"updateTssAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"zetaToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]` - ERC20CustodyAbiString = ` -[{"inputs":[{"internalType":"address","name":"_TSSAddress","type":"address"},{"internalType":"address","name":"_TSSAddressUpdater","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidSender","type":"error"},{"inputs":[],"name":"InvalidTSSUpdater","type":"error"},{"inputs":[],"name":"IsPaused","type":"error"},{"inputs":[],"name":"NotPaused","type":"error"},{"inputs":[],"name":"NotWhitelisted","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"recipient","type":"bytes"},{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"}],"name":"Unwhitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"}],"name":"Whitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"TSSAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TSSAddressUpdater","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"recipient","type":"bytes"},{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceTSSAddressUpdater","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"unwhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"updateTSSAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"whitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]` -) - -func GetConnectorABI() string { - return ConnectorAbiString -} -func GetERC20CustodyABI() string { - return ERC20CustodyAbiString -} - -var ( - BitconNetParams = &chaincfg.MainNetParams -) - -func New() Config { - return Config{ - EVMChainConfigs: evmChainConfigs, - BitcoinConfig: BitcoinConfig, - ChainsEnabled: []common.Chain{}, - } -} - -var BitcoinConfig = &BTCConfig{} - -var evmChainConfigs = map[int64]*EVMConfig{ - common.EthChain().ChainId: { - Chain: common.EthChain(), - }, - common.BscMainnetChain().ChainId: { - Chain: common.BscMainnetChain(), - }, -} diff --git a/zetaclient/config/config_mock_mainnet.go b/zetaclient/config/config_mock_mainnet.go deleted file mode 100644 index fe7195d1cd..0000000000 --- a/zetaclient/config/config_mock_mainnet.go +++ /dev/null @@ -1,63 +0,0 @@ -//go:build MOCK_MAINNET -// +build MOCK_MAINNET - -package config - -import ( - "github.com/btcsuite/btcd/chaincfg" - "github.com/zeta-chain/zetacore/common" -) - -const ( - BtcConfirmationCount = 1 - DevEthConfirmationCount = 2 -) - -const ( - // #nosec G101 - TssTestPrivkey = "2082bc9775d6ee5a05ef221a9d1c00b3cc3ecb274a4317acc0a182bc1e05d1bb" - TssTestAddress = "0xE80B6467863EbF8865092544f441da8fD3cF6074" -) - -// Constants -// #nosec G101 -const ( - MaxBlocksPerPeriod = 100 -) - -const ( - ConnectorAbiString = ` -[{"inputs":[{"internalType":"address","name":"_zetaTokenAddress","type":"address"},{"internalType":"address","name":"_tssAddress","type":"address"},{"internalType":"address","name":"_tssAddressUpdater","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"originSenderAddress","type":"bytes"},{"indexed":true,"internalType":"uint256","name":"originChainId","type":"uint256"},{"indexed":true,"internalType":"address","name":"destinationAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"},{"indexed":true,"internalType":"bytes32","name":"internalSendHash","type":"bytes32"}],"name":"ZetaReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"originSenderAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"originChainId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"indexed":true,"internalType":"bytes","name":"destinationAddress","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"},{"indexed":true,"internalType":"bytes32","name":"internalSendHash","type":"bytes32"}],"name":"ZetaReverted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"originSenderAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"destinationAddress","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gasLimit","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"zetaParams","type":"bytes"}],"name":"ZetaSent","type":"event"},{"inputs":[],"name":"getLockedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"originSenderAddress","type":"bytes"},{"internalType":"uint256","name":"originChainId","type":"uint256"},{"internalType":"address","name":"destinationAddress","type":"address"},{"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"},{"internalType":"bytes32","name":"internalSendHash","type":"bytes32"}],"name":"onReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"originSenderAddress","type":"address"},{"internalType":"uint256","name":"originChainId","type":"uint256"},{"internalType":"bytes","name":"destinationAddress","type":"bytes"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"},{"internalType":"bytes32","name":"internalSendHash","type":"bytes32"}],"name":"onRevert","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceTssAddressUpdater","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"bytes","name":"destinationAddress","type":"bytes"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"},{"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"internalType":"bytes","name":"zetaParams","type":"bytes"}],"internalType":"struct ZetaInterfaces.SendInput","name":"input","type":"tuple"}],"name":"send","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tssAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tssAddressUpdater","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tssAddress","type":"address"}],"name":"updateTssAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"zetaToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]` - ERC20CustodyAbiString = ` -[{"inputs":[{"internalType":"address","name":"_TSSAddress","type":"address"},{"internalType":"address","name":"_TSSAddressUpdater","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidSender","type":"error"},{"inputs":[],"name":"InvalidTSSUpdater","type":"error"},{"inputs":[],"name":"IsPaused","type":"error"},{"inputs":[],"name":"NotPaused","type":"error"},{"inputs":[],"name":"NotWhitelisted","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"recipient","type":"bytes"},{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"}],"name":"Unwhitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"}],"name":"Whitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"TSSAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TSSAddressUpdater","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"recipient","type":"bytes"},{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceTSSAddressUpdater","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"unwhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"updateTSSAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"whitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]` -) - -func GetConnectorABI() string { - return ConnectorAbiString -} -func GetERC20CustodyABI() string { - return ERC20CustodyAbiString -} - -var ( - BitconNetParams = &chaincfg.MainNetParams -) - -func New() Config { - return Config{ - EVMChainConfigs: evmChainConfigs, - BitcoinConfig: BitcoinConfig, - ChainsEnabled: []common.Chain{}, - } -} - -var BitcoinConfig = &BTCConfig{} - -var evmChainConfigs = map[int64]*EVMConfig{ - common.EthChain().ChainId: { - Chain: common.EthChain(), - }, - common.BscMainnetChain().ChainId: { - Chain: common.BscMainnetChain(), - }, -} diff --git a/zetaclient/config/config_privnet.go b/zetaclient/config/config_privnet.go deleted file mode 100644 index d801c8dbd7..0000000000 --- a/zetaclient/config/config_privnet.go +++ /dev/null @@ -1,62 +0,0 @@ -//go:build PRIVNET -// +build PRIVNET - -package config - -import ( - "github.com/btcsuite/btcd/chaincfg" - "github.com/zeta-chain/zetacore/common" -) - -const ( - TssTestPrivkey = "2082bc9775d6ee5a05ef221a9d1c00b3cc3ecb274a4317acc0a182bc1e05d1bb" - TssTestAddress = "0xE80B6467863EbF8865092544f441da8fD3cF6074" -) - -// Constants -// #nosec G101 -const ( - // to catch up: - MaxBlocksPerPeriod = 100 -) - -const ( - ConnectorAbiString = ` -[{"inputs":[{"internalType":"address","name":"_zetaTokenAddress","type":"address"},{"internalType":"address","name":"_tssAddress","type":"address"},{"internalType":"address","name":"_tssAddressUpdater","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"originSenderAddress","type":"bytes"},{"indexed":true,"internalType":"uint256","name":"originChainId","type":"uint256"},{"indexed":true,"internalType":"address","name":"destinationAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"},{"indexed":true,"internalType":"bytes32","name":"internalSendHash","type":"bytes32"}],"name":"ZetaReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"originSenderAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"originChainId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"indexed":true,"internalType":"bytes","name":"destinationAddress","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"},{"indexed":true,"internalType":"bytes32","name":"internalSendHash","type":"bytes32"}],"name":"ZetaReverted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"originSenderAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"destinationAddress","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gasLimit","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"zetaParams","type":"bytes"}],"name":"ZetaSent","type":"event"},{"inputs":[],"name":"getLockedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"originSenderAddress","type":"bytes"},{"internalType":"uint256","name":"originChainId","type":"uint256"},{"internalType":"address","name":"destinationAddress","type":"address"},{"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"},{"internalType":"bytes32","name":"internalSendHash","type":"bytes32"}],"name":"onReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"originSenderAddress","type":"address"},{"internalType":"uint256","name":"originChainId","type":"uint256"},{"internalType":"bytes","name":"destinationAddress","type":"bytes"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"},{"internalType":"bytes32","name":"internalSendHash","type":"bytes32"}],"name":"onRevert","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceTssAddressUpdater","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"bytes","name":"destinationAddress","type":"bytes"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"},{"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"internalType":"bytes","name":"zetaParams","type":"bytes"}],"internalType":"struct ZetaInterfaces.SendInput","name":"input","type":"tuple"}],"name":"send","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tssAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tssAddressUpdater","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tssAddress","type":"address"}],"name":"updateTssAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"zetaToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]` - ERC20CustodyAbiString = ` -[{"inputs":[{"internalType":"address","name":"_TSSAddress","type":"address"},{"internalType":"address","name":"_TSSAddressUpdater","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidSender","type":"error"},{"inputs":[],"name":"InvalidTSSUpdater","type":"error"},{"inputs":[],"name":"IsPaused","type":"error"},{"inputs":[],"name":"NotPaused","type":"error"},{"inputs":[],"name":"NotWhitelisted","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"recipient","type":"bytes"},{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"}],"name":"Unwhitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"}],"name":"Whitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"TSSAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TSSAddressUpdater","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"recipient","type":"bytes"},{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceTSSAddressUpdater","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"unwhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"updateTSSAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"whitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]` -) - -func GetConnectorABI() string { - return ConnectorAbiString -} -func GetERC20CustodyABI() string { - return ERC20CustodyAbiString -} - -var ( - BitconNetParams = &chaincfg.RegressionNetParams -) - -var bitcoinConfig = &BTCConfig{ - RPCUsername: "smoketest", - RPCPassword: "123", - RPCHost: "bitcoin:18443", - RPCParams: "regtest", -} - -func New() Config { - return Config{ - ChainsEnabled: []common.Chain{}, - EVMChainConfigs: evmChainConfigs, - BitcoinConfig: bitcoinConfig, - } -} - -var evmChainConfigs = map[int64]*EVMConfig{ - - common.GoerliChain().ChainId: { - Chain: common.GoerliChain(), - Endpoint: "http://eth:8545", - }, -} diff --git a/zetaclient/config/types.go b/zetaclient/config/types.go index 7b1e549a91..8ae117f138 100644 --- a/zetaclient/config/types.go +++ b/zetaclient/config/types.go @@ -191,10 +191,12 @@ func (c *Config) UpdateCoreParams( } c.Keygen = *keygen c.ChainsEnabled = newChains - if c.BitcoinConfig != nil && btcCoreParams != nil { // update core params for bitcoin if it has config in file + // update core params for bitcoin if it has config in file + if c.BitcoinConfig != nil && btcCoreParams != nil { c.BitcoinConfig.CoreParams = *btcCoreParams } - for _, params := range evmCoreParams { // update core params for evm chains we have configs in file + // update core params for evm chains we have configs in file + for _, params := range evmCoreParams { curCfg, found := c.EVMChainConfigs[params.ChainId] if found { curCfg.CoreParams = *params diff --git a/zetaclient/evm_client.go b/zetaclient/evm_client.go index 5188a2767e..c146fb5057 100644 --- a/zetaclient/evm_client.go +++ b/zetaclient/evm_client.go @@ -68,8 +68,8 @@ type EVMChainClient struct { KlaytnClient KlaytnRPCClient zetaClient ZetaCoreBridger Tss TSSSigner - lastBlockScanned int64 - lastBlock int64 + lastBlockScanned uint64 + lastBlock uint64 BlockTimeExternalChain uint64 // block time in seconds txWatchList map[ethcommon.Hash]string Mu *sync.Mutex @@ -310,7 +310,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co if receipt.Status == 1 { recvStatus = common.ReceiveStatus_Success } - zetaHash, err := ob.zetaClient.PostReceiveConfirmation( + zetaTxHash, ballot, err := ob.zetaClient.PostReceiveConfirmation( sendHash, receipt.TxHash.Hex(), receipt.BlockNumber.Uint64(), @@ -325,13 +325,14 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co ) if err != nil { logger.Error().Err(err).Msgf("error posting confirmation to meta core for cctx %s nonce %d", sendHash, nonce) + } else if zetaTxHash != "" { + logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d ballot %s", zetaTxHash, sendHash, nonce, ballot) } - 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 if receipt.Status == 1 { - zetaHash, err := ob.zetaClient.PostReceiveConfirmation( + zetaTxHash, ballot, err := ob.zetaClient.PostReceiveConfirmation( sendHash, receipt.TxHash.Hex(), receipt.BlockNumber.Uint64(), @@ -346,12 +347,13 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co ) if err != nil { logger.Error().Err(err).Msgf("error posting confirmation to meta core for cctx %s nonce %d", sendHash, nonce) + } else if zetaTxHash != "" { + logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d ballot %s", zetaTxHash, sendHash, nonce, ballot) } - 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()) - zetaTxHash, err := ob.zetaClient.PostReceiveConfirmation( + zetaTxHash, ballot, err := ob.zetaClient.PostReceiveConfirmation( sendHash, receipt.TxHash.Hex(), receipt.BlockNumber.Uint64(), @@ -366,8 +368,9 @@ 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 cctx %s nonce %d", zetaTxHash, sendHash, nonce) + } else if zetaTxHash != "" { + logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d ballot %s", zetaTxHash, sendHash, nonce, ballot) } - 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 @@ -375,9 +378,6 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co logs := receipt.Logs for _, vLog := range logs { confHeight := vLog.BlockNumber + params.ConfirmationCount - if confHeight < 0 || confHeight >= math.MaxInt64 { - return false, false, fmt.Errorf("confHeight is out of range") - } // TODO rewrite this to return early if not confirmed connector, err := ob.GetConnectorContract() if err != nil { @@ -386,8 +386,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co receivedLog, err := connector.ZetaConnectorNonEthFilterer.ParseZetaReceived(*vLog) if err == nil { logger.Info().Msgf("Found (outTx) sendHash %s on chain %s txhash %s", sendHash, ob.chain.String(), vLog.TxHash.Hex()) - // #nosec G701 checked in range - if int64(confHeight) < ob.GetLastBlockHeight() { + if confHeight <= ob.GetLastBlockHeight() { logger.Info().Msg("Confirmed! Sending PostConfirmation to zetacore...") if len(vLog.Topics) != 4 { logger.Error().Msgf("wrong number of topics in log %d", len(vLog.Topics)) @@ -396,7 +395,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co sendhash := vLog.Topics[3].Hex() //var rxAddress string = ethcommon.HexToAddress(vLog.Topics[1].Hex()).Hex() mMint := receivedLog.ZetaValue - zetaHash, err := ob.zetaClient.PostReceiveConfirmation( + zetaTxHash, ballot, err := ob.zetaClient.PostReceiveConfirmation( sendhash, vLog.TxHash.Hex(), vLog.BlockNumber, @@ -412,19 +411,18 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co if err != nil { logger.Error().Err(err).Msgf("error posting confirmation to meta core for cctx %s nonce %d", sendHash, nonce) continue + } else if zetaTxHash != "" { + logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d ballot %s", zetaTxHash, sendHash, nonce, ballot) } - logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaHash, sendHash, nonce) return true, true, nil } - // #nosec G701 always in range - logger.Info().Msgf("Included; %d blocks before confirmed! chain %s nonce %d", int(vLog.BlockNumber+params.ConfirmationCount)-int(ob.GetLastBlockHeight()), ob.chain.String(), nonce) + logger.Info().Msgf("Included; %d blocks before confirmed! chain %s nonce %d", confHeight-ob.GetLastBlockHeight(), ob.chain.String(), nonce) return true, false, nil } revertedLog, err := connector.ZetaConnectorNonEthFilterer.ParseZetaReverted(*vLog) if err == nil { logger.Info().Msgf("Found (revertTx) sendHash %s on chain %s txhash %s", sendHash, ob.chain.String(), vLog.TxHash.Hex()) - // #nosec G701 checked in range - if int64(confHeight) < ob.GetLastBlockHeight() { + if confHeight <= ob.GetLastBlockHeight() { logger.Info().Msg("Confirmed! Sending PostConfirmation to zetacore...") if len(vLog.Topics) != 3 { logger.Error().Msgf("wrong number of topics in log %d", len(vLog.Topics)) @@ -432,7 +430,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co } sendhash := vLog.Topics[2].Hex() mMint := revertedLog.RemainingZetaValue - metaHash, err := ob.zetaClient.PostReceiveConfirmation( + zetaTxHash, ballot, err := ob.zetaClient.PostReceiveConfirmation( sendhash, vLog.TxHash.Hex(), vLog.BlockNumber, @@ -448,19 +446,19 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co if err != nil { logger.Err(err).Msgf("error posting confirmation to meta core for cctx %s nonce %d", sendHash, nonce) continue + } else if zetaTxHash != "" { + logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d ballot %s", zetaTxHash, sendHash, nonce, ballot) } - logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", metaHash, sendHash, nonce) return true, true, nil } - // #nosec G701 always in range - logger.Info().Msgf("Included; %d blocks before confirmed! chain %s nonce %d", int(vLog.BlockNumber+params.ConfirmationCount)-int(ob.GetLastBlockHeight()), ob.chain.String(), nonce) + logger.Info().Msgf("Included; %d blocks before confirmed! chain %s nonce %d", confHeight-ob.GetLastBlockHeight(), ob.chain.String(), nonce) return true, false, nil } } } else if receipt.Status == 0 { //FIXME: check nonce here by getTransaction RPC logger.Info().Msgf("Found (failed tx) sendHash %s on chain %s txhash %s", sendHash, ob.chain.String(), receipt.TxHash.Hex()) - zetaTxHash, err := ob.zetaClient.PostReceiveConfirmation( + zetaTxHash, ballot, err := ob.zetaClient.PostReceiveConfirmation( sendHash, receipt.TxHash.Hex(), receipt.BlockNumber.Uint64(), @@ -475,8 +473,9 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co ) if err != nil { logger.Error().Err(err).Msgf("error posting confirmation to meta core for cctx %s nonce %d", sendHash, nonce) + } else if zetaTxHash != "" { + logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d ballot %s", zetaTxHash, sendHash, nonce, ballot) } - logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaTxHash, sendHash, nonce) return true, true, nil } } else if cointype == common.CoinType_ERC20 { @@ -489,16 +488,11 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co for _, vLog := range logs { event, err := ERC20Custody.ParseWithdrawn(*vLog) confHeight := vLog.BlockNumber + params.ConfirmationCount - if confHeight < 0 || confHeight >= math.MaxInt64 { - return false, false, fmt.Errorf("confHeight is out of range") - } if err == nil { logger.Info().Msgf("Found (ERC20Custody.Withdrawn Event) sendHash %s on chain %s txhash %s", sendHash, ob.chain.String(), vLog.TxHash.Hex()) - // #nosec G701 checked in range - if int64(confHeight) < ob.GetLastBlockHeight() { - + if confHeight <= ob.GetLastBlockHeight() { logger.Info().Msg("Confirmed! Sending PostConfirmation to zetacore...") - zetaHash, err := ob.zetaClient.PostReceiveConfirmation( + zetaTxHash, ballot, err := ob.zetaClient.PostReceiveConfirmation( sendHash, vLog.TxHash.Hex(), vLog.BlockNumber, @@ -514,18 +508,18 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co if err != nil { logger.Error().Err(err).Msgf("error posting confirmation to meta core for cctx %s nonce %d", sendHash, nonce) continue + } else if zetaTxHash != "" { + logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d ballot %s", zetaTxHash, sendHash, nonce, ballot) } - logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaHash, sendHash, nonce) return true, true, nil } - // #nosec G701 always in range - logger.Info().Msgf("Included; %d blocks before confirmed! chain %s nonce %d", int(vLog.BlockNumber+params.ConfirmationCount)-int(ob.GetLastBlockHeight()), ob.chain.String(), nonce) + logger.Info().Msgf("Included; %d blocks before confirmed! chain %s nonce %d", confHeight-ob.GetLastBlockHeight(), ob.chain.String(), nonce) return true, false, nil } } } else { logger.Info().Msgf("Found (failed tx) sendHash %s on chain %s txhash %s", sendHash, ob.chain.String(), receipt.TxHash.Hex()) - zetaTxHash, err := ob.zetaClient.PostReceiveConfirmation( + zetaTxHash, ballot, err := ob.zetaClient.PostReceiveConfirmation( sendHash, receipt.TxHash.Hex(), receipt.BlockNumber.Uint64(), @@ -540,8 +534,9 @@ 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) + } else if zetaTxHash != "" { + logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d ballot %s", zetaTxHash, sendHash, nonce, ballot) } - logger.Info().Msgf("Zeta tx hash: %s cctx %s nonce %d", zetaTxHash, sendHash, nonce) return true, true, nil } } @@ -570,12 +565,17 @@ func (ob *EVMChainClient) observeOutTx() { } ob.logger.ObserveOutTx.Info().Msgf("observeOutTx using timeoutNonce %d seconds, rpcRestTime %d ms", timeoutNonce, rpcRestTime) - ticker := NewDynamicTicker(fmt.Sprintf("EVM_observeOutTx_%d", ob.chain.ChainId), ob.GetCoreParams().OutTxTicker) + ticker, err := NewDynamicTicker(fmt.Sprintf("EVM_observeOutTx_%d", ob.chain.ChainId), ob.GetCoreParams().OutTxTicker) + if err != nil { + ob.logger.ObserveOutTx.Error().Err(err).Msg("failed to create ticker") + return + } + defer ticker.Stop() for { select { case <-ticker.C(): - trackers, err := ob.zetaClient.GetAllOutTxTrackerByChain(ob.chain, Ascending) + trackers, err := ob.zetaClient.GetAllOutTxTrackerByChain(ob.chain.ChainId, Ascending) if err != nil { continue } @@ -640,11 +640,11 @@ func (ob *EVMChainClient) queryTxByHash(txHash string, nonce uint64) (*ethtypes. receipt, err := ob.evmClient.TransactionReceipt(ctxt, ethcommon.HexToHash(txHash)) if err != nil { if err != ethereum.NotFound { - logger.Warn().Err(err).Msgf("TransactionReceipt/TransactionByHash error, txHash %s", txHash) + logger.Warn().Err(err).Msgf("queryTxByHash: TransactionReceipt/TransactionByHash error, txHash %s nonce %d", txHash, nonce) } return nil, nil, err } - transaction, _, err := ob.evmClient.TransactionByHash(ctxt, ethcommon.HexToHash(txHash)) + transaction, isPending, err := ob.evmClient.TransactionByHash(ctxt, ethcommon.HexToHash(txHash)) if err != nil { return nil, nil, err } @@ -652,59 +652,45 @@ func (ob *EVMChainClient) queryTxByHash(txHash string, nonce uint64) (*ethtypes. return nil, nil, fmt.Errorf("queryTxByHash: txHash %s nonce mismatch: wanted %d, got tx nonce %d", txHash, nonce, transaction.Nonce()) } confHeight := receipt.BlockNumber.Uint64() + ob.GetCoreParams().ConfirmationCount - if confHeight < 0 || confHeight >= math.MaxInt64 { - return nil, nil, fmt.Errorf("confHeight is out of range") + if confHeight >= math.MaxInt64 { + return nil, nil, fmt.Errorf("queryTxByHash: confHeight is out of range") } - // #nosec G701 checked in range - if int64(confHeight) > ob.GetLastBlockHeight() { - log.Warn().Msgf("included but not confirmed: receipt block %d, current block %d", receipt.BlockNumber, ob.GetLastBlockHeight()) + if confHeight > ob.GetLastBlockHeight() { + log.Info().Msgf("queryTxByHash: txHash %s nonce %d included but not confirmed: receipt block %d, current block %d", txHash, nonce, receipt.BlockNumber, ob.GetLastBlockHeight()) return nil, nil, fmt.Errorf("included but not confirmed") } + // transaction must NOT be pending + if isPending { + log.Error().Msgf("queryTxByHash: confirmed but still pending: txHash %s nonce %d receipt block %d", txHash, nonce, receipt.BlockNumber) + return nil, nil, fmt.Errorf("confirmed but still pending") + } return receipt, transaction, nil } // SetLastBlockHeightScanned set last block height scanned (not necessarily caught up with external block; could be slow/paused) -func (ob *EVMChainClient) SetLastBlockHeightScanned(block int64) { - if block < 0 { - panic("lastBlockScanned is negative") - } - if block >= math.MaxInt64 { - panic("lastBlockScanned is too large") - } - atomic.StoreInt64(&ob.lastBlockScanned, block) - ob.ts.SetLastScannedBlockNumber(ob.chain.ChainId, block) +func (ob *EVMChainClient) SetLastBlockHeightScanned(height uint64) { + atomic.StoreUint64(&ob.lastBlockScanned, height) + ob.ts.SetLastScannedBlockNumber(ob.chain.ChainId, height) } // GetLastBlockHeightScanned get last block height scanned (not necessarily caught up with external block; could be slow/paused) -func (ob *EVMChainClient) GetLastBlockHeightScanned() int64 { - height := atomic.LoadInt64(&ob.lastBlockScanned) - if height < 0 { - panic("lastBlockScanned is negative") - } - if height >= math.MaxInt64 { - panic("lastBlockScanned is too large") - } +func (ob *EVMChainClient) GetLastBlockHeightScanned() uint64 { + height := atomic.LoadUint64(&ob.lastBlockScanned) return height } -// SetLastBlockHeight set external last block height (confirmed with confirmation count) -func (ob *EVMChainClient) SetLastBlockHeight(block int64) { - if block < 0 { - panic("lastBlock is negative") - } - if block >= math.MaxInt64 { +// SetLastBlockHeight set external last block height +func (ob *EVMChainClient) SetLastBlockHeight(height uint64) { + if height >= math.MaxInt64 { panic("lastBlock is too large") } - atomic.StoreInt64(&ob.lastBlock, block) + atomic.StoreUint64(&ob.lastBlock, height) } -// GetLastBlockHeight get external last block height (confirmed with confirmation count) -func (ob *EVMChainClient) GetLastBlockHeight() int64 { - height := atomic.LoadInt64(&ob.lastBlock) - if height < 0 { - panic("lastBlock is negative") - } +// GetLastBlockHeight get external last block height +func (ob *EVMChainClient) GetLastBlockHeight() uint64 { + height := atomic.LoadUint64(&ob.lastBlock) if height >= math.MaxInt64 { panic("lastBlock is too large") } @@ -713,7 +699,12 @@ func (ob *EVMChainClient) GetLastBlockHeight() int64 { func (ob *EVMChainClient) ExternalChainWatcher() { // At each tick, query the Connector contract - ticker := NewDynamicTicker(fmt.Sprintf("EVM_ExternalChainWatcher_%d", ob.chain.ChainId), ob.GetCoreParams().InTxTicker) + ticker, err := NewDynamicTicker(fmt.Sprintf("EVM_ExternalChainWatcher_%d", ob.chain.ChainId), ob.GetCoreParams().InTxTicker) + if err != nil { + ob.logger.ExternalChainWatcher.Error().Err(err).Msg("NewDynamicTicker error") + return + } + defer ticker.Stop() ob.logger.ExternalChainWatcher.Info().Msg("ExternalChainWatcher started") for { @@ -731,13 +722,13 @@ func (ob *EVMChainClient) ExternalChainWatcher() { } } -func (ob *EVMChainClient) postBlockHeader(tip int64) error { +func (ob *EVMChainClient) postBlockHeader(tip uint64) error { bn := tip res, err := ob.zetaClient.GetBlockHeaderStateByChain(ob.chain.ChainId) - if err == nil && res.BlockHeaderState != nil && res.BlockHeaderState.EarliestHeight > 0 { - bn = res.BlockHeaderState.LatestHeight + // #nosec G701 always positive + bn = uint64(res.BlockHeaderState.LatestHeight) } if bn > tip { @@ -773,10 +764,9 @@ func (ob *EVMChainClient) observeInTX() error { if err != nil { return err } - // "confirmed" current block number + // update last block height + ob.SetLastBlockHeight(header.Number.Uint64()) confirmedBlockNum := header.Number.Uint64() - ob.GetCoreParams().ConfirmationCount - // #nosec G701 always in range - ob.SetLastBlockHeight(int64(confirmedBlockNum)) crosschainFlags, err := ob.zetaClient.GetCrosschainFlags() if err != nil { @@ -793,34 +783,20 @@ func (ob *EVMChainClient) observeInTX() error { // skip if no new block is produced. sampledLogger := ob.logger.ExternalChainWatcher.Sample(&zerolog.BasicSampler{N: 10}) - if confirmedBlockNum < 0 || confirmedBlockNum > math.MaxUint64 { - sampledLogger.Error().Msg("Skipping observer , confirmedBlockNum is negative or too large ") - return nil - } - // #nosec G701 checked in range - if confirmedBlockNum <= uint64(ob.GetLastBlockHeightScanned()) { - sampledLogger.Debug().Msg("Skipping observer , No new block is produced ") + if confirmedBlockNum <= ob.GetLastBlockHeightScanned() { + sampledLogger.Debug().Msg("Skipping observer , No new block is produced") return nil } lastBlock := ob.GetLastBlockHeightScanned() startBlock := lastBlock + 1 - toBlock := lastBlock + config.MaxBlocksPerPeriod // read at most 10 blocks in one go - // #nosec G701 always positive - if uint64(toBlock) >= confirmedBlockNum { - // #nosec G701 checked in range - toBlock = int64(confirmedBlockNum) - } - if startBlock < 0 || startBlock >= math.MaxInt64 { - return fmt.Errorf("startBlock is negative or too large") - } - if toBlock < 0 || toBlock >= math.MaxInt64 { - return fmt.Errorf("toBlock is negative or too large") + toBlock := lastBlock + config.MaxBlocksPerPeriod // read at most 100 blocks in one go + if toBlock > confirmedBlockNum { + toBlock = confirmedBlockNum } ob.logger.ExternalChainWatcher.Info().Msgf("Checking for all inTX : startBlock %d, toBlock %d", startBlock, toBlock) //task 1: Query evm chain for zeta sent logs func() { - // #nosec G701 always positive - tb := uint64(toBlock) + toB := toBlock connector, err := ob.GetConnectorContract() if err != nil { ob.logger.ChainLogger.Warn().Err(err).Msgf("observeInTx: GetConnectorContract error:") @@ -833,9 +809,8 @@ func (ob *EVMChainClient) observeInTX() error { cnt.Inc() } logs, err := connector.FilterZetaSent(&bind.FilterOpts{ - // #nosec G701 always positive - Start: uint64(startBlock), - End: &tb, + Start: startBlock, + End: &toB, Context: context.TODO(), }, []ethcommon.Address{}, []*big.Int{}) if err != nil { @@ -861,16 +836,14 @@ func (ob *EVMChainClient) observeInTX() error { // task 2: Query evm chain for deposited logs func() { - // #nosec G701 always positive - toB := uint64(toBlock) + toB := toBlock erc20custody, err := ob.GetERC20CustodyContract() if err != nil { ob.logger.ExternalChainWatcher.Warn().Err(err).Msgf("observeInTx: GetERC20CustodyContract error:") return } depositedLogs, err := erc20custody.FilterDeposited(&bind.FilterOpts{ - // #nosec G701 always positive - Start: uint64(startBlock), + Start: startBlock, End: &toB, Context: context.TODO(), }, []ethcommon.Address{}) @@ -941,7 +914,7 @@ func (ob *EVMChainClient) observeInTX() error { if tx.To() == nil { continue } - if bytes.Compare(tx.Data(), []byte(DonationMessage)) == 0 { + if bytes.Equal(tx.Data(), []byte(DonationMessage)) { ob.logger.ExternalChainWatcher.Info().Msgf("thank you rich folk for your donation!: %s", tx.Hash().Hex()) continue } @@ -1001,7 +974,12 @@ func (ob *EVMChainClient) WatchGasPrice() { } } - ticker := NewDynamicTicker(fmt.Sprintf("EVM_WatchGasPrice_%d", ob.chain.ChainId), ob.GetCoreParams().GasPriceTicker) + ticker, err := NewDynamicTicker(fmt.Sprintf("EVM_WatchGasPrice_%d", ob.chain.ChainId), ob.GetCoreParams().GasPriceTicker) + if err != nil { + ob.logger.WatchGasPrice.Error().Err(err).Msg("NewDynamicTicker error") + return + } + defer ticker.Stop() for { select { @@ -1037,8 +1015,7 @@ func (ob *EVMChainClient) PostGasPrice() error { } // SUPPLY - var supply string // lockedAmount on ETH, totalSupply on other chains - supply = "100" + supply := "100" // lockedAmount on ETH, totalSupply on other chains zetaHash, err := ob.zetaClient.PostGasPrice(ob.chain, gasPrice.Uint64(), supply, blockNum) if err != nil { @@ -1053,13 +1030,12 @@ func (ob *EVMChainClient) PostGasPrice() error { // query ZetaCore about the last block that it has heard from a specific chain. // return 0 if not existent. -func (ob *EVMChainClient) getLastHeight() (int64, error) { +func (ob *EVMChainClient) getLastHeight() (uint64, error) { lastheight, err := ob.zetaClient.GetLastBlockHeightByChain(ob.chain) if err != nil { return 0, errors.Wrap(err, "getLastHeight") } - // #nosec G701 always in range - return int64(lastheight.LastSendHeight), nil + return lastheight.LastSendHeight, nil } func (ob *EVMChainClient) BuildBlockIndex() error { @@ -1073,9 +1049,9 @@ func (ob *EVMChainClient) BuildBlockIndex() error { if err != nil { return err } - ob.SetLastBlockHeightScanned(header.Number.Int64()) + ob.SetLastBlockHeightScanned(header.Number.Uint64()) } else { - scanFromBlockInt, err := strconv.ParseInt(scanFromBlock, 10, 64) + scanFromBlockInt, err := strconv.ParseUint(scanFromBlock, 10, 64) if err != nil { return err } @@ -1096,7 +1072,7 @@ func (ob *EVMChainClient) BuildBlockIndex() error { if err != nil { return err } - ob.SetLastBlockHeightScanned(header.Number.Int64()) + ob.SetLastBlockHeightScanned(header.Number.Uint64()) } if dbc := ob.db.Save(clienttypes.ToLastBlockSQLType(ob.GetLastBlockHeightScanned())); dbc.Error != nil { logger.Error().Err(dbc.Error).Msg("error writing ob.LastBlock to db: ") @@ -1162,6 +1138,7 @@ func (ob *EVMChainClient) LoadDB(dbPath string, chain common.Chain) error { &clienttypes.TransactionSQLType{}, &clienttypes.LastBlockSQLType{}) if err != nil { + ob.logger.ChainLogger.Error().Err(err).Msg("error migrating db") return err } @@ -1216,11 +1193,11 @@ func (ob *EVMChainClient) GetTxID(nonce uint64) string { return fmt.Sprintf("%d-%s-%d", ob.chain.ChainId, tssAddr, nonce) } -func (ob *EVMChainClient) GetBlockByNumberCached(blockNumber int64) (*ethtypes.Block, error) { +func (ob *EVMChainClient) GetBlockByNumberCached(blockNumber uint64) (*ethtypes.Block, error) { if block, ok := ob.BlockCache.Get(blockNumber); ok { return block.(*ethtypes.Block), nil } - block, err := ob.evmClient.BlockByNumber(context.Background(), big.NewInt(blockNumber)) + block, err := ob.evmClient.BlockByNumber(context.Background(), new(big.Int).SetUint64(blockNumber)) if err != nil { return nil, err } diff --git a/zetaclient/evm_client_db_test.go b/zetaclient/evm_client_db_test.go index 10566646cb..62a910702e 100644 --- a/zetaclient/evm_client_db_test.go +++ b/zetaclient/evm_client_db_test.go @@ -106,7 +106,7 @@ func (suite *EVMClientTestSuite) TestEVMTransactions() { } func (suite *EVMClientTestSuite) TestEVMLastBlock() { - lastBlockNum := int64(12345) + lastBlockNum := uint64(12345) dbc := suite.db.Create(clienttypes.ToLastBlockSQLType(lastBlockNum)) suite.NoError(dbc.Error) diff --git a/zetaclient/evm_signer.go b/zetaclient/evm_signer.go index e00741fb10..7ea8b841b6 100644 --- a/zetaclient/evm_signer.go +++ b/zetaclient/evm_signer.go @@ -449,7 +449,7 @@ func (signer *EVMSigner) TryProcessOutTx( return } tx, err = signer.SignCommandTx(msg[0], msg[1], to, send.GetCurrentOutTxParam(), gasLimit, gasprice, height) - } else if send.InboundTxParams.SenderChainId == common.ZetaChain().ChainId && send.CctxStatus.Status == types.CctxStatus_PendingOutbound && flags.IsOutboundEnabled { + } else if send.InboundTxParams.SenderChainId == zetaBridge.ZetaChain().ChainId && send.CctxStatus.Status == types.CctxStatus_PendingOutbound && flags.IsOutboundEnabled { if send.GetCurrentOutTxParam().CoinType == common.CoinType_Gas { logger.Info().Msgf("SignWithdrawTx: %d => %s, nonce %d, gasprice %d", send.InboundTxParams.SenderChainId, toChain, send.GetCurrentOutTxParam().OutboundTxTssNonce, gasprice) tx, err = signer.SignWithdrawTx( @@ -488,7 +488,7 @@ func (signer *EVMSigner) TryProcessOutTx( height, ) } - } else if send.CctxStatus.Status == types.CctxStatus_PendingRevert && send.OutboundTxParams[0].ReceiverChainId == common.ZetaChain().ChainId { + } else if send.CctxStatus.Status == types.CctxStatus_PendingRevert && send.OutboundTxParams[0].ReceiverChainId == zetaBridge.ZetaChain().ChainId { if send.GetCurrentOutTxParam().CoinType == common.CoinType_Gas { logger.Info().Msgf("SignWithdrawTx: %d => %s, nonce %d, gasprice %d", send.InboundTxParams.SenderChainId, toChain, send.GetCurrentOutTxParam().OutboundTxTssNonce, gasprice) tx, err = signer.SignWithdrawTx( diff --git a/zetaclient/inbound_tracker.go b/zetaclient/inbound_tracker.go index 8e6c7c01d2..1181a14747 100644 --- a/zetaclient/inbound_tracker.go +++ b/zetaclient/inbound_tracker.go @@ -16,7 +16,12 @@ import ( // ExternalChainWatcherForNewInboundTrackerSuggestions At each tick, gets a list of Inbound tracker suggestions from zeta-core and tries to check if the in-tx was confirmed. // If it was, it tries to broadcast the confirmation vote. If this zeta client has previously broadcast the vote, the tx would be rejected func (ob *EVMChainClient) ExternalChainWatcherForNewInboundTrackerSuggestions() { - ticker := NewDynamicTicker(fmt.Sprintf("EVM_ExternalChainWatcher_InboundTrackerSuggestions_%d", ob.chain.ChainId), ob.GetCoreParams().InTxTicker) + ticker, err := NewDynamicTicker(fmt.Sprintf("EVM_ExternalChainWatcher_InboundTrackerSuggestions_%d", ob.chain.ChainId), ob.GetCoreParams().InTxTicker) + if err != nil { + ob.logger.ExternalChainWatcher.Err(err).Msg("error creating ticker") + return + } + defer ticker.Stop() ob.logger.ExternalChainWatcher.Info().Msg("ExternalChainWatcher for inboundTrackerSuggestions started") for { @@ -35,7 +40,12 @@ func (ob *EVMChainClient) ExternalChainWatcherForNewInboundTrackerSuggestions() } func (ob *BitcoinChainClient) ExternalChainWatcherForNewInboundTrackerSuggestions() { - ticker := NewDynamicTicker("Bitcoin_WatchInTx_InboundTrackerSuggestions", ob.GetCoreParams().InTxTicker) + ticker, err := NewDynamicTicker("Bitcoin_WatchInTx_InboundTrackerSuggestions", ob.GetCoreParams().InTxTicker) + if err != nil { + ob.logger.WatchInTx.Err(err).Msg("error creating ticker") + return + } + defer ticker.Stop() for { select { @@ -90,7 +100,7 @@ func (ob *BitcoinChainClient) CheckReceiptForBtcTxHash(txHash string, vote bool) return "", err } // #nosec G701 always positive - event, err := GetBtcEvent(*tx, tss, uint64(block.Height), &ob.logger.WatchInTx) + event, err := GetBtcEvent(*tx, tss, uint64(block.Height), &ob.logger.WatchInTx, ob.chain.ChainId) if err != nil { return "", err } diff --git a/zetaclient/interfaces.go b/zetaclient/interfaces.go index 7752239733..39357435bf 100644 --- a/zetaclient/interfaces.go +++ b/zetaclient/interfaces.go @@ -4,6 +4,8 @@ import ( "context" "math/big" + sdkmath "cosmossdk.io/math" + "github.com/btcsuite/btcd/btcjson" "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/wire" @@ -59,7 +61,7 @@ type ZetaCoreBridger interface { chain common.Chain, nonce uint64, coinType common.CoinType, - ) (string, error) + ) (string, string, error) PostGasPrice(chain common.Chain, gasPrice uint64, supply string, blockNum uint64) (string, error) PostAddBlockHeader(chainID int64, txhash []byte, height int64, header common.HeaderData) (string, error) GetBlockHeaderStateByChain(chainID int64) (observertypes.QueryGetBlockHeaderStateResponse, error) @@ -77,18 +79,20 @@ type ZetaCoreBridger interface { GetBlockHeight() (int64, error) GetZetaBlockHeight() (int64, error) GetLastBlockHeightByChain(chain common.Chain) (*crosschaintypes.LastBlockHeight, error) - GetAllPendingCctx(chainID int64) ([]*crosschaintypes.CrossChainTx, error) - GetPendingNoncesByChain(chainID int64) (crosschaintypes.PendingNonces, error) + ListPendingCctx(chainID int64) ([]*crosschaintypes.CrossChainTx, uint64, error) + GetPendingNoncesByChain(chainID int64) (observertypes.PendingNonces, error) GetCctxByNonce(chainID int64, nonce uint64) (*crosschaintypes.CrossChainTx, error) - GetAllOutTxTrackerByChain(chain common.Chain, order Order) ([]crosschaintypes.OutTxTracker, error) + GetAllOutTxTrackerByChain(chainID int64, order Order) ([]crosschaintypes.OutTxTracker, error) GetCrosschainFlags() (observertypes.CrosschainFlags, error) GetObserverList(chain common.Chain) ([]string, error) GetKeyGen() (*observertypes.Keygen, error) GetBtcTssAddress() (string, error) GetInboundTrackersForChain(chainID int64) ([]crosschaintypes.InTxTracker, error) GetLogger() *zerolog.Logger + ZetaChain() common.Chain Pause() Unpause() + GetZetaHotKeyBalance() (sdkmath.Int, error) } // BTCRPCClient is the interface for BTC RPC client diff --git a/zetaclient/keys.go b/zetaclient/keys.go index 06289d7c72..6eae47850f 100644 --- a/zetaclient/keys.go +++ b/zetaclient/keys.go @@ -40,7 +40,7 @@ func NewKeysWithKeybase(kb ckeys.Keyring, granterAddress sdk.AccAddress, grantee } func GetGranteeKeyName(signerName string) string { - return fmt.Sprintf("%s", signerName) + return signerName } // GetKeyringKeybase return keyring and key info diff --git a/zetaclient/metrics/burn_rate.go b/zetaclient/metrics/burn_rate.go new file mode 100644 index 0000000000..e4c6053ccd --- /dev/null +++ b/zetaclient/metrics/burn_rate.go @@ -0,0 +1,111 @@ +package metrics + +import ( + "fmt" + + sdkmath "cosmossdk.io/math" +) + +type BurnRate struct { + blockLow int64 + blockHigh int64 + windowSize int64 + total int64 + queue []int64 +} + +func NewBurnRate(windowSize int64) *BurnRate { + return &BurnRate{ + blockLow: 1, + blockHigh: 1, + windowSize: windowSize, + total: 0, + queue: make([]int64, 1), + } +} + +// AddFee - adds fee amount spent on a tx for a particular block. It is added to a queue which is used to calculate +// +// the average burn rate for a range of blocks determined by the window size. +func (br *BurnRate) AddFee(amount int64, block int64) error { + // Check if block is in range of the window + if block < br.blockLow { + return fmt.Errorf("block out of range %d", block) + } + + // If block is greater than blockHigh, shift the window up + if block > br.blockHigh { + err := br.enqueueEntry(block, amount) + if err != nil { + return err + } + br.blockHigh = block + + if br.blockHigh-br.blockLow >= br.windowSize { + // Remove oldest block(s) from queue + err = br.dequeueOldEntries() + if err != nil { + return err + } + } + } else { + // Add amount to existing entry in queue + index := block - br.blockLow + br.queue[index] += amount + br.total += amount + } + + return nil +} + +// enqueueEntry - add fee entry into queue if is in range of the window. A padding is added if the block height is +// +// more than one block greater than the highest range. +func (br *BurnRate) enqueueEntry(block int64, amount int64) error { + diff := block - br.blockHigh + if diff < 1 { + return fmt.Errorf("enqueueEntry: block difference is too low: %d", diff) + } + // if difference in block num is greater than 1, need to pad the queue + if diff > 1 { + for i := int64(0); i < diff-1; i++ { + br.queue = append(br.queue, 0) + } + } + + // Adjust total with new entry + br.total += amount + + // enqueue latest entry + br.queue = append(br.queue, amount) + + return nil +} + +// dequeueOldEntries - when the window slides forward, older entries in the queue need to be cleared. +func (br *BurnRate) dequeueOldEntries() error { + diff := br.blockHigh - br.blockLow + if diff < br.windowSize { + return fmt.Errorf("dequeueOldEntries: queue is less than or equal to window size, no need to dequeue") + } + dequeueLen := diff - (br.windowSize - 1) + + // Adjust total with dequeued elements + for i := int64(0); i < dequeueLen; i++ { + br.total -= br.queue[i] + } + + // dequeue old entries + br.queue = br.queue[dequeueLen:] + br.blockLow += dequeueLen + + return nil +} + +// GetBurnRate - calculate current burn rate and return the value. +func (br *BurnRate) GetBurnRate() sdkmath.Int { + if br.blockHigh < br.windowSize { + return sdkmath.NewInt(br.total).QuoRaw(br.blockHigh) + } + return sdkmath.NewInt(br.total).QuoRaw(br.windowSize) +} diff --git a/zetaclient/metrics/burn_rate_test.go b/zetaclient/metrics/burn_rate_test.go new file mode 100644 index 0000000000..2de8c10c4e --- /dev/null +++ b/zetaclient/metrics/burn_rate_test.go @@ -0,0 +1,59 @@ +package metrics + +import ( + "testing" + + "github.com/stretchr/testify/suite" +) + +type BurnRateSuite struct { + suite.Suite + burnRate *BurnRate +} + +func TestBurnRateSuite(t *testing.T) { + suite.Run(t, new(BurnRateSuite)) +} + +func (brs *BurnRateSuite) SetupTest() { + brs.burnRate = NewBurnRate(10) +} + +func (brs *BurnRateSuite) TestBurnRate() { + // 1. Add number of entries less than window size and verify rate + for i := 1; i <= 5; i++ { + err := brs.burnRate.AddFee(int64(i)*10, int64(i)) + brs.NoError(err) + } + + rate := brs.burnRate.GetBurnRate() + brs.Equal(int64(30), rate.Int64()) + + // 2. Add number of entries equal to window size and verify rate + for i := 6; i <= 10; i++ { + err := brs.burnRate.AddFee(int64(i)*10, int64(i)) + brs.NoError(err) + } + + rate = brs.burnRate.GetBurnRate() + brs.Equal(int64(55), rate.Int64()) + + // 3. Add number of entries greater than window size and verify rate + for i := 11; i <= 15; i++ { + err := brs.burnRate.AddFee(int64(i)*10, int64(i)) + brs.NoError(err) + } + + rate = brs.burnRate.GetBurnRate() + brs.Equal(int64(105), rate.Int64()) + + // 4. Add non-contiguous block entries to queue and verify rate + entries := []int{16, 18, 22, 23, 24, 29} + for _, val := range entries { + err := brs.burnRate.AddFee(int64(val)*10, int64(val)) + brs.NoError(err) + } + + rate = brs.burnRate.GetBurnRate() + brs.Equal(int64(98), rate.Int64()) +} diff --git a/zetaclient/out_tx_processor_manager.go b/zetaclient/out_tx_processor_manager.go index 2d794e0380..5d6bb35110 100644 --- a/zetaclient/out_tx_processor_manager.go +++ b/zetaclient/out_tx_processor_manager.go @@ -1,6 +1,7 @@ package zetaclient import ( + "fmt" "sync" "time" @@ -60,3 +61,8 @@ func (outTxMan *OutTxProcessorManager) TimeInTryProcess(outTxID string) time.Dur } return 0 } + +// ToOutTxID returns the outTxID for OutTxProcessorManager to track +func ToOutTxID(index string, receiverChainID int64, nonce uint64) string { + return fmt.Sprintf("%s-%d-%d", index, receiverChainID, nonce) +} diff --git a/zetaclient/query.go b/zetaclient/query.go index 76d4573572..0a786bba6e 100644 --- a/zetaclient/query.go +++ b/zetaclient/query.go @@ -9,11 +9,11 @@ import ( sdkmath "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" "github.com/cosmos/cosmos-sdk/types/query" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - tmtypes "github.com/tendermint/tendermint/proto/tendermint/types" tmhttp "github.com/tendermint/tendermint/rpc/client/http" "github.com/zeta-chain/zetacore/cmd/zetacored/config" "github.com/zeta-chain/zetacore/common" @@ -126,23 +126,26 @@ func (b *ZetaCoreBridge) GetObserverList(chain common.Chain) ([]string, error) { return nil, err } -func (b *ZetaCoreBridge) GetAllPendingCctx(chainID int64) ([]*types.CrossChainTx, error) { +// ListPendingCctx returns a list of pending cctxs for a given chainID +// the returned list has a limited size of crosschainkeeper.MaxPendingCctxs +// the total number of pending cctxs is returned +func (b *ZetaCoreBridge) ListPendingCctx(chainID int64) ([]*types.CrossChainTx, uint64, error) { client := types.NewQueryClient(b.grpcConn) maxSizeOption := grpc.MaxCallRecvMsgSize(32 * 1024 * 1024) - resp, err := client.CctxAllPending(context.Background(), &types.QueryAllCctxPendingRequest{ChainId: chainID}, maxSizeOption) + resp, err := client.CctxListPending(context.Background(), &types.QueryListCctxPendingRequest{ChainId: chainID}, maxSizeOption) if err != nil { - return nil, err + return nil, 0, err } - return resp.CrossChainTx, nil + return resp.CrossChainTx, resp.TotalPending, nil } -func (b *ZetaCoreBridge) GetCctxByStatus(status types.CctxStatus) ([]types.CrossChainTx, error) { +func (b *ZetaCoreBridge) GetAbortedZetaAmount() (string, error) { client := types.NewQueryClient(b.grpcConn) - resp, err := client.CctxByStatus(context.Background(), &types.QueryCctxByStatusRequest{Status: status}) + resp, err := client.ZetaAccounting(context.Background(), &types.QueryZetaAccountingRequest{}) if err != nil { - return nil, err + return "", err } - return resp.CrossChainTx, nil + return resp.AbortedZetaAmount, nil } func (b *ZetaCoreBridge) GetGenesisSupply() (sdkmath.Int, error) { @@ -182,13 +185,13 @@ func (b *ZetaCoreBridge) GetLastBlockHeight() ([]*types.LastBlockHeight, error) return resp.LastBlockHeight, nil } -func (b *ZetaCoreBridge) GetLatestZetaBlock() (*tmtypes.Block, error) { +func (b *ZetaCoreBridge) GetLatestZetaBlock() (*tmservice.Block, error) { client := tmservice.NewServiceClient(b.grpcConn) res, err := client.GetLatestBlock(context.Background(), &tmservice.GetLatestBlockRequest{}) if err != nil { return nil, err } - return res.Block, nil + return res.SdkBlock, nil } func (b *ZetaCoreBridge) GetNodeInfo() (*tmservice.GetNodeInfoResponse, error) { @@ -223,11 +226,30 @@ func (b *ZetaCoreBridge) GetZetaBlockHeight() (int64, error) { return resp.Height, nil } -func (b *ZetaCoreBridge) GetNonceByChain(chain common.Chain) (*types.ChainNonces, error) { - client := types.NewQueryClient(b.grpcConn) - resp, err := client.ChainNonces(context.Background(), &types.QueryGetChainNoncesRequest{Index: chain.ChainName.String()}) +func (b *ZetaCoreBridge) GetBaseGasPrice() (int64, error) { + client := feemarkettypes.NewQueryClient(b.grpcConn) + resp, err := client.Params(context.Background(), &feemarkettypes.QueryParamsRequest{}) if err != nil { - return nil, err + return 0, err + } + if resp.Params.BaseFee.IsNil() { + return 0, fmt.Errorf("base fee is nil") + } + return resp.Params.BaseFee.Int64(), nil +} + +func (b *ZetaCoreBridge) GetBallotByID(id string) (*observertypes.QueryBallotByIdentifierResponse, error) { + client := observertypes.NewQueryClient(b.grpcConn) + return client.BallotByIdentifier(context.Background(), &observertypes.QueryBallotByIdentifierRequest{ + BallotIdentifier: id, + }) +} + +func (b *ZetaCoreBridge) GetNonceByChain(chain common.Chain) (observertypes.ChainNonces, error) { + client := observertypes.NewQueryClient(b.grpcConn) + resp, err := client.ChainNonces(context.Background(), &observertypes.QueryGetChainNoncesRequest{Index: chain.ChainName.String()}) + if err != nil { + return observertypes.ChainNonces{}, err } return resp.ChainNonces, nil } @@ -277,18 +299,18 @@ func (b *ZetaCoreBridge) GetInboundTrackersForChain(chainID int64) ([]types.InTx return resp.InTxTracker, nil } -func (b *ZetaCoreBridge) GetCurrentTss() (*types.TSS, error) { - client := types.NewQueryClient(b.grpcConn) - resp, err := client.TSS(context.Background(), &types.QueryGetTSSRequest{}) +func (b *ZetaCoreBridge) GetCurrentTss() (observertypes.TSS, error) { + client := observertypes.NewQueryClient(b.grpcConn) + resp, err := client.TSS(context.Background(), &observertypes.QueryGetTSSRequest{}) if err != nil { - return nil, err + return observertypes.TSS{}, err } return resp.TSS, nil } func (b *ZetaCoreBridge) GetEthTssAddress() (string, error) { - client := types.NewQueryClient(b.grpcConn) - resp, err := client.GetTssAddress(context.Background(), &types.QueryGetTssAddressRequest{}) + client := observertypes.NewQueryClient(b.grpcConn) + resp, err := client.GetTssAddress(context.Background(), &observertypes.QueryGetTssAddressRequest{}) if err != nil { return "", err } @@ -296,17 +318,17 @@ func (b *ZetaCoreBridge) GetEthTssAddress() (string, error) { } func (b *ZetaCoreBridge) GetBtcTssAddress() (string, error) { - client := types.NewQueryClient(b.grpcConn) - resp, err := client.GetTssAddress(context.Background(), &types.QueryGetTssAddressRequest{}) + client := observertypes.NewQueryClient(b.grpcConn) + resp, err := client.GetTssAddress(context.Background(), &observertypes.QueryGetTssAddressRequest{}) if err != nil { return "", err } return resp.Btc, nil } -func (b *ZetaCoreBridge) GetTssHistory() ([]types.TSS, error) { - client := types.NewQueryClient(b.grpcConn) - resp, err := client.TssHistory(context.Background(), &types.QueryTssHistoryRequest{}) +func (b *ZetaCoreBridge) GetTssHistory() ([]observertypes.TSS, error) { + client := observertypes.NewQueryClient(b.grpcConn) + resp, err := client.TssHistory(context.Background(), &observertypes.QueryTssHistoryRequest{}) if err != nil { return nil, err } @@ -325,10 +347,10 @@ func (b *ZetaCoreBridge) GetOutTxTracker(chain common.Chain, nonce uint64) (*typ return &resp.OutTxTracker, nil } -func (b *ZetaCoreBridge) GetAllOutTxTrackerByChain(chain common.Chain, order Order) ([]types.OutTxTracker, error) { +func (b *ZetaCoreBridge) GetAllOutTxTrackerByChain(chainID int64, order Order) ([]types.OutTxTracker, error) { client := types.NewQueryClient(b.grpcConn) resp, err := client.OutTxTrackerAllByChain(context.Background(), &types.QueryAllOutTxTrackerByChainRequest{ - Chain: chain.ChainId, + Chain: chainID, Pagination: &query.PageRequest{ Key: nil, Offset: 0, @@ -362,11 +384,11 @@ func (b *ZetaCoreBridge) GetClientParams(chainID int64) (observertypes.QueryGetC return *resp, nil } -func (b *ZetaCoreBridge) GetPendingNoncesByChain(chainID int64) (types.PendingNonces, error) { - client := types.NewQueryClient(b.grpcConn) - resp, err := client.PendingNoncesByChain(context.Background(), &types.QueryPendingNoncesByChainRequest{ChainId: chainID}) +func (b *ZetaCoreBridge) GetPendingNoncesByChain(chainID int64) (observertypes.PendingNonces, error) { + client := observertypes.NewQueryClient(b.grpcConn) + resp, err := client.PendingNoncesByChain(context.Background(), &observertypes.QueryPendingNoncesByChainRequest{ChainId: chainID}) if err != nil { - return types.PendingNonces{}, err + return observertypes.PendingNonces{}, err } return resp.PendingNonces, nil } @@ -389,9 +411,9 @@ func (b *ZetaCoreBridge) GetSupportedChains() ([]*common.Chain, error) { return resp.GetChains(), nil } -func (b *ZetaCoreBridge) GetPendingNonces() (*types.QueryAllPendingNoncesResponse, error) { - client := types.NewQueryClient(b.grpcConn) - resp, err := client.PendingNoncesAll(context.Background(), &types.QueryAllPendingNoncesRequest{}) +func (b *ZetaCoreBridge) GetPendingNonces() (*observertypes.QueryAllPendingNoncesResponse, error) { + client := observertypes.NewQueryClient(b.grpcConn) + resp, err := client.PendingNoncesAll(context.Background(), &observertypes.QueryAllPendingNoncesRequest{}) if err != nil { return nil, err } @@ -412,3 +434,27 @@ func (b *ZetaCoreBridge) Prove(blockHash string, txHash string, txIndex int64, p } return resp.Valid, nil } + +func (b *ZetaCoreBridge) HasVoted(ballotIndex string, voterAddress string) (bool, error) { + client := observertypes.NewQueryClient(b.grpcConn) + resp, err := client.HasVoted(context.Background(), &observertypes.QueryHasVotedRequest{ + BallotIdentifier: ballotIndex, + VoterAddress: voterAddress, + }) + if err != nil { + return false, err + } + return resp.HasVoted, nil +} + +func (b *ZetaCoreBridge) GetZetaHotKeyBalance() (sdkmath.Int, error) { + client := banktypes.NewQueryClient(b.grpcConn) + resp, err := client.Balance(context.Background(), &banktypes.QueryBalanceRequest{ + Address: b.keys.GetAddress().String(), + Denom: config.BaseDenom, + }) + if err != nil { + return sdkmath.ZeroInt(), err + } + return resp.Balance.Amount, nil +} diff --git a/zetaclient/signer_test.go b/zetaclient/signer_test.go index 5b5ff48c8f..5c0849bb88 100644 --- a/zetaclient/signer_test.go +++ b/zetaclient/signer_test.go @@ -7,7 +7,6 @@ import ( ) type SignerSuite struct { - signer *TestSigner } var _ = Suite(&SignerSuite{}) @@ -18,6 +17,7 @@ func (s *SignerSuite) SetUpTest(c *C) { // BTC testnet3: muGe9prUBjQwEnX19zG26fVRHNi8z7kSPo skHex := "7b8507ba117e069f4a3f456f505276084f8c92aee86ac78ae37b4d1801d35fa8" privateKey, err := crypto.HexToECDSA(skHex) + c.Assert(err, IsNil) pkBytes := crypto.FromECDSAPub(&privateKey.PublicKey) pk, err := btcec.ParsePubKey(pkBytes, btcec.S256()) c.Assert(err, IsNil) diff --git a/zetaclient/supported_chains.go b/zetaclient/supported_chains.go deleted file mode 100644 index 022029667a..0000000000 --- a/zetaclient/supported_chains.go +++ /dev/null @@ -1,10 +0,0 @@ -package zetaclient - -import ( - "github.com/zeta-chain/zetacore/common" -) - -// Modify to update this from the core later -func GetSupportedChains() []*common.Chain { - return common.DefaultChainsList() -} diff --git a/zetaclient/telemetry.go b/zetaclient/telemetry.go index 695459d597..9255b54247 100644 --- a/zetaclient/telemetry.go +++ b/zetaclient/telemetry.go @@ -13,6 +13,7 @@ import ( "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/zetaclient/metrics" "github.com/zeta-chain/zetacore/zetaclient/types" ) @@ -21,20 +22,22 @@ type TelemetryServer struct { logger zerolog.Logger s *http.Server p2pid string - lastScannedBlockNumber map[int64]int64 // chainid => block number + lastScannedBlockNumber map[int64]uint64 // chainid => block number lastCoreBlockNumber int64 mu sync.Mutex lastStartTimestamp time.Time status types.Status ipAddress string + hotKeyBurnRate *metrics.BurnRate } // NewTelemetryServer should only listen to the loopback func NewTelemetryServer() *TelemetryServer { hs := &TelemetryServer{ logger: log.With().Str("module", "http").Logger(), - lastScannedBlockNumber: make(map[int64]int64), + lastScannedBlockNumber: make(map[int64]uint64), lastStartTimestamp: time.Now(), + hotKeyBurnRate: metrics.NewBurnRate(100), } s := &http.Server{ Addr: ":8123", @@ -79,13 +82,13 @@ func (t *TelemetryServer) GetIPAddress() string { } // setter for lastScanned block number -func (t *TelemetryServer) SetLastScannedBlockNumber(chainID int64, blockNumber int64) { +func (t *TelemetryServer) SetLastScannedBlockNumber(chainID int64, blockNumber uint64) { t.mu.Lock() t.lastScannedBlockNumber[chainID] = blockNumber t.mu.Unlock() } -func (t *TelemetryServer) GetLastScannedBlockNumber(chainID int64) int64 { +func (t *TelemetryServer) GetLastScannedBlockNumber(chainID int64) uint64 { t.mu.Lock() defer t.mu.Unlock() return t.lastScannedBlockNumber[chainID] @@ -109,6 +112,15 @@ func (t *TelemetryServer) SetNumberOfUTXOs(numberOfUTXOs int) { t.mu.Unlock() } +func (t *TelemetryServer) AddFeeEntry(block int64, amount int64) { + t.mu.Lock() + err := t.hotKeyBurnRate.AddFee(amount, block) + if err != nil { + log.Error().Err(err).Msg("failed to update hotkey burn rate") + } + t.mu.Unlock() +} + // NewHandler registers the API routes and returns a new HTTP handler func (t *TelemetryServer) Handlers() http.Handler { router := mux.NewRouter() @@ -120,6 +132,7 @@ func (t *TelemetryServer) Handlers() http.Handler { router.Handle("/lastcoreblock", http.HandlerFunc(t.lastCoreBlockHandler)).Methods(http.MethodGet) router.Handle("/status", http.HandlerFunc(t.statusHandler)).Methods(http.MethodGet) router.Handle("/ip", http.HandlerFunc(t.ipHandler)).Methods(http.MethodGet) + router.Handle("/hotkeyburnrate", http.HandlerFunc(t.hotKeyFeeBurnRate)).Methods(http.MethodGet) // router.Handle("/debug/pprof/goroutine", pprof.Handler("goroutine")) // router.Handle("/debug/pprof/heap", pprof.Handler("heap")) // router.HandleFunc("/debug/pprof/", pprof.Index) @@ -232,3 +245,10 @@ func (t *TelemetryServer) lastStartTimestampHandler(w http.ResponseWriter, _ *ht defer t.mu.Unlock() fmt.Fprintf(w, "%s", t.lastStartTimestamp.Format(time.RFC3339)) } + +func (t *TelemetryServer) hotKeyFeeBurnRate(w http.ResponseWriter, _ *http.Request) { + w.WriteHeader(http.StatusOK) + t.mu.Lock() + defer t.mu.Unlock() + fmt.Fprintf(w, "%v", t.hotKeyBurnRate.GetBurnRate()) +} diff --git a/zetaclient/tss_signer.go b/zetaclient/tss_signer.go index 1291a95d15..bff6789ad7 100644 --- a/zetaclient/tss_signer.go +++ b/zetaclient/tss_signer.go @@ -27,7 +27,6 @@ import ( "github.com/zeta-chain/tss-lib/ecdsa/keygen" "github.com/zeta-chain/zetacore/common" zcommon "github.com/zeta-chain/zetacore/common/cosmos" - "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" "github.com/zeta-chain/zetacore/zetaclient/config" "github.com/zeta-chain/zetacore/zetaclient/metrics" @@ -68,6 +67,10 @@ type TSS struct { Signers []string CoreBridge ZetaCoreBridger Metrics *ChainMetrics + + // TODO: support multiple Bitcoin network, not just one network + // https://github.com/zeta-chain/node/issues/1397 + BitcoinChainID int64 } // NewTSS creates a new TSS instance @@ -77,19 +80,21 @@ func NewTSS( preParams *keygen.LocalPreParams, cfg *config.Config, bridge ZetaCoreBridger, - tssHistoricalList []types.TSS, + tssHistoricalList []observertypes.TSS, metrics *metrics.Metrics, + bitcoinChainID int64, ) (*TSS, error) { server, err := SetupTSSServer(peer, privkey, preParams, cfg) if err != nil { return nil, fmt.Errorf("SetupTSSServer error: %w", err) } newTss := TSS{ - Server: server, - Keys: make(map[string]*TSSKey), - CurrentPubkey: cfg.CurrentTssPubkey, - logger: log.With().Str("module", "tss_signer").Logger(), - CoreBridge: bridge, + Server: server, + Keys: make(map[string]*TSSKey), + CurrentPubkey: cfg.CurrentTssPubkey, + logger: log.With().Str("module", "tss_signer").Logger(), + CoreBridge: bridge, + BitcoinChainID: bitcoinChainID, } err = newTss.LoadTssFilesFromDirectory(cfg.TssPath) @@ -175,8 +180,9 @@ func (tss *TSS) Pubkey() []byte { return tss.Keys[tss.CurrentPubkey].PubkeyInBytes } +// Sign signs a digest // digest should be Hashes of some data -// Sign: Specify optionalPubkey to use a different pubkey than the current pubkey set during keygen +// NOTE: Specify optionalPubkey to use a different pubkey than the current pubkey set during keygen func (tss *TSS) Sign(digest []byte, height uint64, nonce uint64, chain *common.Chain, optionalPubKey string) ([65]byte, error) { H := digest log.Debug().Msgf("hash of digest is %s", H) @@ -334,7 +340,7 @@ func (tss *TSS) SignBatch(digests [][]byte, height uint64, nonce uint64, chain * return [][65]byte{}, fmt.Errorf("signuature verification fail") } compressedPubkey := crypto.CompressPubkey(sigPublicKey) - if bytes.Compare(pubkey.Bytes(), compressedPubkey) != 0 { + if !bytes.Equal(pubkey.Bytes(), compressedPubkey) { log.Warn().Msgf("%d-th pubkey %s recovered pubkey %s", j, pubkey.String(), hex.EncodeToString(compressedPubkey)) return [][65]byte{}, fmt.Errorf("signuature verification fail") } @@ -372,7 +378,7 @@ func (tss *TSS) EVMAddress() ethcommon.Address { // BTCAddress generates a bech32 p2wpkh address from pubkey func (tss *TSS) BTCAddress() string { - addr, err := GetTssAddrBTC(tss.CurrentPubkey) + addr, err := GetTssAddrBTC(tss.CurrentPubkey, tss.BitcoinChainID) if err != nil { log.Error().Err(err).Msg("getKeyAddr error") return "" @@ -381,7 +387,7 @@ func (tss *TSS) BTCAddress() string { } func (tss *TSS) BTCAddressWitnessPubkeyHash() *btcutil.AddressWitnessPubKeyHash { - addrWPKH, err := getKeyAddrBTCWitnessPubkeyHash(tss.CurrentPubkey) + addrWPKH, err := getKeyAddrBTCWitnessPubkeyHash(tss.CurrentPubkey, tss.BitcoinChainID) if err != nil { log.Error().Err(err).Msg("BTCAddressPubkeyHash error") return nil @@ -423,7 +429,7 @@ func (tss *TSS) RegisterMetrics(metrics *metrics.Metrics) error { return nil } -func (tss *TSS) VerifyKeysharesForPubkeys(tssList []types.TSS, granteePubKey32 string) error { +func (tss *TSS) VerifyKeysharesForPubkeys(tssList []observertypes.TSS, granteePubKey32 string) error { for _, t := range tssList { if wasNodePartOfTss(granteePubKey32, t.TssParticipantList) { if _, ok := tss.Keys[t.TssPubkey]; !ok { @@ -481,9 +487,8 @@ func (tss *TSS) LoadTssFilesFromDirectory(tssPath string) error { return nil } -// FIXME: mainnet/testnet -func GetTssAddrBTC(tssPubkey string) (string, error) { - addrWPKH, err := getKeyAddrBTCWitnessPubkeyHash(tssPubkey) +func GetTssAddrBTC(tssPubkey string, bitcoinChainID int64) (string, error) { + addrWPKH, err := getKeyAddrBTCWitnessPubkeyHash(tssPubkey, bitcoinChainID) if err != nil { log.Fatal().Err(err) return "", err @@ -572,7 +577,7 @@ func verifySignature(tssPubkey string, signature []keysign.Signature, H []byte) } compressedPubkey := crypto.CompressPubkey(sigPublicKey) log.Info().Msgf("pubkey %s recovered pubkey %s", pubkey.String(), hex.EncodeToString(compressedPubkey)) - return bytes.Compare(pubkey.Bytes(), compressedPubkey) == 0 + return bytes.Equal(pubkey.Bytes(), compressedPubkey) } func combineDigests(digestList []string) []byte { @@ -590,12 +595,18 @@ func wasNodePartOfTss(granteePubKey32 string, granteeList []string) bool { return false } -func getKeyAddrBTCWitnessPubkeyHash(tssPubkey string) (*btcutil.AddressWitnessPubKeyHash, error) { +func getKeyAddrBTCWitnessPubkeyHash(tssPubkey string, chainID int64) (*btcutil.AddressWitnessPubKeyHash, error) { pubk, err := zcommon.GetPubKeyFromBech32(zcommon.Bech32PubKeyTypeAccPub, tssPubkey) if err != nil { return nil, err } - addr, err := btcutil.NewAddressWitnessPubKeyHash(btcutil.Hash160(pubk.Bytes()), config.BitconNetParams) + + bitcoinNetParams, err := common.BitcoinNetParamsFromChainID(chainID) + if err != nil { + return nil, err + } + + addr, err := btcutil.NewAddressWitnessPubKeyHash(btcutil.Hash160(pubk.Bytes()), bitcoinNetParams) if err != nil { return nil, err } diff --git a/zetaclient/tss_signer_test.go b/zetaclient/tss_signer_test.go index c22759958f..3fffc9277d 100644 --- a/zetaclient/tss_signer_test.go +++ b/zetaclient/tss_signer_test.go @@ -43,6 +43,7 @@ func Test_LoadTssFilesFromDirectory(t *testing.T) { CurrentPubkey: "", } err = tss.LoadTssFilesFromDirectory(tempdir) + assert.NoError(t, err) assert.Equal(t, tc.n, len(tss.Keys)) }) } @@ -70,6 +71,9 @@ func GenerateKeyshareFiles(n int, dir string) error { return err } err = os.WriteFile(filename, b, 0644) + if err != nil { + return err + } } return nil } diff --git a/zetaclient/tx.go b/zetaclient/tx.go index 9006e402da..84ba3d3c40 100644 --- a/zetaclient/tx.go +++ b/zetaclient/tx.go @@ -8,6 +8,7 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/authz" + "github.com/pkg/errors" "github.com/zeta-chain/go-tss/blame" "github.com/zeta-chain/zetacore/common" @@ -20,9 +21,9 @@ const ( PostGasPriceGasLimit = 1_500_000 AddTxHashToOutTxTrackerGasLimit = 200_000 PostNonceGasLimit = 200_000 - PostSendEVMGasLimit = 1_500_000 // likely emit a lot of logs, so costly + PostSendEVMGasLimit = 4_000_000 // likely emit a lot of logs, so costly PostSendNonEVMGasLimit = 1_000_000 - PostReceiveConfirmationGasLimit = 200_000 + PostReceiveConfirmationGasLimit = 400_000 PostBlameDataGasLimit = 200_000 DefaultGasLimit = 200_000 PostProveOutboundTxGasLimit = 400_000 @@ -153,16 +154,7 @@ func (b *ZetaCoreBridge) PostReceiveConfirmation( chain common.Chain, nonce uint64, coinType common.CoinType, -) (string, error) { - lastReport, found := b.lastOutTxReportTime[outTxHash] - if found && time.Since(lastReport) < 10*time.Minute { - return "", fmt.Errorf( - "PostReceiveConfirmation: outTxHash %s already reported in last 10min; last report %s", - outTxHash, - lastReport, - ) - } - +) (string, string, error) { signerAddress := b.keys.GetOperatorAddress().String() msg := types.NewMsgVoteOnObservedOutboundTx( signerAddress, @@ -181,7 +173,17 @@ func (b *ZetaCoreBridge) PostReceiveConfirmation( authzMsg, authzSigner, err := b.WrapMessageWithAuthz(msg) if err != nil { - return "", err + return "", "", err + } + + // don't post confirmation if has already voted before + ballotIndex := msg.Digest() + hasVoted, err := b.HasVoted(ballotIndex, msg.Creator) + if err != nil { + return "", ballotIndex, errors.Wrapf(err, "PostReceiveConfirmation: unable to check if already voted for ballot %s voter %s", ballotIndex, msg.Creator) + } + if hasVoted { + return "", ballotIndex, nil } // FIXME: remove this gas limit stuff; in the special ante handler with no gas limit, add @@ -193,13 +195,12 @@ func (b *ZetaCoreBridge) PostReceiveConfirmation( for i := 0; i < DefaultRetryCount; i++ { zetaTxHash, err := b.Broadcast(gasLimit, authzMsg, authzSigner) if err == nil { - b.lastOutTxReportTime[outTxHash] = time.Now() // update last report time when bcast succeeds - return zetaTxHash, nil + return zetaTxHash, ballotIndex, nil } b.logger.Debug().Err(err).Msgf("PostReceive broadcast fail | Retry count : %d", i+1) time.Sleep(DefaultRetryInterval * time.Second) } - return "", fmt.Errorf("post receive failed after %d retries", DefaultRetryCount) + return "", ballotIndex, fmt.Errorf("post receive failed after %d retries", DefaultRetryCount) } func (b *ZetaCoreBridge) SetTSS(tssPubkey string, keyGenZetaHeight int64, status common.ReceiveStatus) (string, error) { @@ -244,7 +245,7 @@ func (b *ZetaCoreBridge) ConfigUpdater(cfg *config.Config) { func (b *ZetaCoreBridge) PostBlameData(blame *blame.Blame, chainID int64, index string) (string, error) { signerAddress := b.keys.GetOperatorAddress().String() - zetaBlame := &observerTypes.Blame{ + zetaBlame := observerTypes.Blame{ Index: index, FailureReason: blame.FailReason, Nodes: observerTypes.ConvertNodes(blame.BlameNodes), diff --git a/zetaclient/types/sql_evm.go b/zetaclient/types/sql_evm.go index a4d25888a9..f86df7cdd7 100644 --- a/zetaclient/types/sql_evm.go +++ b/zetaclient/types/sql_evm.go @@ -66,7 +66,7 @@ type TransactionSQLType struct { type LastBlockSQLType struct { gorm.Model - Num int64 + Num uint64 } // Type translation functions: @@ -154,7 +154,7 @@ func ToTransactionSQLType(transaction *ethtypes.Transaction, index string) (*Tra }, nil } -func ToLastBlockSQLType(lastBlock int64) *LastBlockSQLType { +func ToLastBlockSQLType(lastBlock uint64) *LastBlockSQLType { return &LastBlockSQLType{ Model: gorm.Model{ID: LastBlockNumID}, Num: lastBlock, diff --git a/zetaclient/utils.go b/zetaclient/utils.go index 2a3d3ef427..d3702a62e9 100644 --- a/zetaclient/utils.go +++ b/zetaclient/utils.go @@ -5,6 +5,7 @@ import ( "context" "encoding/base64" "encoding/hex" + "encoding/json" "fmt" "math" "math/big" @@ -27,16 +28,81 @@ import ( const ( satoshiPerBitcoin = 1e8 bytesPerKB = 1000 + bytesEmptyTx = 10 // an empty tx is about 10 bytes + bytesPerInput = 41 // each input is about 41 bytes + bytesPerOutput = 31 // each output is about 31 bytes + bytes1stWitness = 110 // the 1st witness incurs about 110 bytes and it may vary + bytesPerWitness = 108 // each additional witness incurs about 108 bytes and it may vary ) -// feeRateToSatPerByte converts a fee rate in BTC/KB to sat/byte. -func feeRateToSatPerByte(rate float64) *big.Int { +var ( + BtcOutTxBytesMin uint64 + BtcOutTxBytesMax uint64 + BtcOutTxBytesDepositor uint64 + BtcOutTxBytesWithdrawer uint64 + BtcDepositorFeeMin float64 +) + +func init() { + BtcOutTxBytesMin = EstimateSegWitTxSize(2, 3) // 403B, estimated size for a 2-input, 3-output SegWit tx + BtcOutTxBytesMax = EstimateSegWitTxSize(21, 3) // 3234B, estimated size for a 21-input, 3-output SegWit tx + BtcOutTxBytesDepositor = SegWitTxSizeDepositor() // 149B, the outtx size incurred by the depositor + BtcOutTxBytesWithdrawer = SegWitTxSizeWithdrawer() // 254B, the outtx size incurred by the withdrawer + + // depositor fee calculation is based on a fixed fee rate of 5 sat/byte just for simplicity. + // In reality, the fee rate on UTXO deposit is different from the fee rate when the UTXO is spent. + BtcDepositorFeeMin = DepositorFee(5) // 0.00000745 (5 * 149B / 100000000), the minimum deposit fee in BTC for 5 sat/byte +} + +func PrettyPrintStruct(val interface{}) (string, error) { + prettyStruct, err := json.MarshalIndent( + val, + "", + " ", + ) + if err != nil { + return "", err + } + return string(prettyStruct), nil +} + +// FeeRateToSatPerByte converts a fee rate in BTC/KB to sat/byte. +func FeeRateToSatPerByte(rate float64) *big.Int { // #nosec G701 always in range satPerKB := new(big.Int).SetInt64(int64(rate * satoshiPerBitcoin)) return new(big.Int).Div(satPerKB, big.NewInt(bytesPerKB)) } -func getSatoshis(btc float64) (int64, error) { +// EstimateSegWitTxSize estimates SegWit tx size +func EstimateSegWitTxSize(numInputs uint64, numOutputs uint64) uint64 { + if numInputs == 0 { + return 0 + } + bytesInput := numInputs * bytesPerInput + bytesOutput := numOutputs * bytesPerOutput + bytesWitness := bytes1stWitness + (numInputs-1)*bytesPerWitness + return bytesEmptyTx + bytesInput + bytesOutput + bytesWitness +} + +// SegWitTxSizeDepositor returns SegWit tx size (149B) incurred by the depositor +func SegWitTxSizeDepositor() uint64 { + return bytesPerInput + bytesPerWitness +} + +// SegWitTxSizeWithdrawer returns SegWit tx size (254B) incurred by the withdrawer +func SegWitTxSizeWithdrawer() uint64 { + bytesInput := uint64(1) * bytesPerInput // nonce mark + bytesOutput := uint64(3) * bytesPerOutput // 3 outputs: new nonce mark, payment, change + return bytesEmptyTx + bytesInput + bytesOutput + bytes1stWitness +} + +// DepositorFee calculates the depositor fee in BTC for a given sat/byte fee rate +// Note: the depositor fee is charged in order to cover the cost of spending the deposited UTXO in the future +func DepositorFee(satPerByte int64) float64 { + return float64(satPerByte) * float64(BtcOutTxBytesDepositor) / satoshiPerBitcoin +} + +func GetSatoshis(btc float64) (int64, error) { // The amount is only considered invalid if it cannot be represented // as an integer type. This may happen if f is NaN or +-Infinity. // BTC max amount is 21 mil and its at least 0 (Note: bitcoin allows creating 0-value outputs) @@ -74,12 +140,16 @@ type DynamicTicker struct { impl *time.Ticker } -func NewDynamicTicker(name string, interval uint64) *DynamicTicker { +func NewDynamicTicker(name string, interval uint64) (*DynamicTicker, error) { + if interval <= 0 { + return nil, fmt.Errorf("non-positive ticker interval %d for %s", interval, name) + } + return &DynamicTicker{ name: name, interval: interval, impl: time.NewTicker(time.Duration(interval) * time.Second), - } + }, nil } func (t *DynamicTicker) C() <-chan time.Time { @@ -102,7 +172,7 @@ func (t *DynamicTicker) Stop() { func (ob *EVMChainClient) GetInboundVoteMsgForDepositedEvent(event *erc20custody.ERC20CustodyDeposited) (types.MsgVoteOnObservedInboundTx, error) { ob.logger.ExternalChainWatcher.Info().Msgf("TxBlockNumber %d Transaction Hash: %s Message : %s", event.Raw.BlockNumber, event.Raw.TxHash, event.Message) - if bytes.Compare(event.Message, []byte(DonationMessage)) == 0 { + if bytes.Equal(event.Message, []byte(DonationMessage)) { ob.logger.ExternalChainWatcher.Info().Msgf("thank you rich folk for your donation!: %s", event.Raw.TxHash.Hex()) return types.MsgVoteOnObservedInboundTx{}, fmt.Errorf("thank you rich folk for your donation!: %s", event.Raw.TxHash.Hex()) } @@ -124,7 +194,7 @@ func (ob *EVMChainClient) GetInboundVoteMsgForDepositedEvent(event *erc20custody ob.chain.ChainId, "", clienttypes.BytesToEthHex(event.Recipient), - common.ZetaChain().ChainId, + ob.zetaClient.ZetaChain().ChainId, sdkmath.NewUintFromBigInt(event.Amount), hex.EncodeToString(event.Message), event.Raw.TxHash.Hex(), @@ -145,7 +215,7 @@ func (ob *EVMChainClient) GetInboundVoteMsgForZetaSentEvent(event *zetaconnector return types.MsgVoteOnObservedInboundTx{}, fmt.Errorf("chain id not supported %d", event.DestinationChainId.Int64()) } destAddr := clienttypes.BytesToEthHex(event.DestinationAddress) - if *destChain != common.ZetaChain() { + if !destChain.IsZetaChain() { cfgDest, found := ob.cfg.GetEVMConfig(destChain.ChainId) if !found { return types.MsgVoteOnObservedInboundTx{}, fmt.Errorf("chain id not present in EVMChainConfigs %d", event.DestinationChainId.Int64()) @@ -186,7 +256,7 @@ func (ob *EVMChainClient) GetInboundVoteMsgForTokenSentToTSS(txhash ethcommon.Ha ob.chain.ChainId, from.Hex(), from.Hex(), - common.ZetaChain().ChainId, + ob.zetaClient.ZetaChain().ChainId, sdkmath.NewUintFromBigInt(value), message, txhash.Hex(), diff --git a/zetaclient/zeta_supply_checker.go b/zetaclient/zeta_supply_checker.go index 13d40d3959..3a94152578 100644 --- a/zetaclient/zeta_supply_checker.go +++ b/zetaclient/zeta_supply_checker.go @@ -3,11 +3,10 @@ package zetaclient import ( "fmt" - "github.com/pkg/errors" - sdkmath "cosmossdk.io/math" ethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/ethclient" + "github.com/pkg/errors" "github.com/rs/zerolog" "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/crosschain/types" @@ -27,9 +26,14 @@ type ZetaSupplyChecker struct { } func NewZetaSupplyChecker(cfg *config.Config, zetaClient *ZetaCoreBridge, logger zerolog.Logger) (ZetaSupplyChecker, error) { + dynamicTicker, err := NewDynamicTicker("ZETASupplyTicker", 15) + if err != nil { + return ZetaSupplyChecker{}, err + } + zetaSupplyChecker := ZetaSupplyChecker{ stop: make(chan struct{}), - ticker: NewDynamicTicker(fmt.Sprintf("ZETASupplyTicker"), 15), + ticker: dynamicTicker, evmClient: make(map[int64]*ethclient.Client), logger: logger.With(). Str("module", "ZetaSupplyChecker"). @@ -150,6 +154,27 @@ func (zs *ZetaSupplyChecker) CheckZetaTokenSupply() error { return nil } +type ZetaSupplyCheckLogs struct { + Logger zerolog.Logger + AbortedTxAmounts sdkmath.Int `json:"aborted_tx_amounts"` + ZetaInTransit sdkmath.Int `json:"zeta_in_transit"` + ExternalChainTotalSupply sdkmath.Int `json:"external_chain_total_supply"` + ZetaTokenSupplyOnNode sdkmath.Int `json:"zeta_token_supply_on_node"` + EthLockedAmount sdkmath.Int `json:"eth_locked_amount"` + NodeAmounts sdkmath.Int `json:"node_amounts"` + LHS sdkmath.Int `json:"LHS"` + RHS sdkmath.Int `json:"RHS"` + SupplyCheckSuccess bool `json:"supply_check_success"` +} + +func (z ZetaSupplyCheckLogs) LogOutput() { + output, err := PrettyPrintStruct(z) + if err != nil { + z.Logger.Error().Err(err).Msgf("error pretty printing struct") + } + z.Logger.Info().Msgf(output) +} + func ValidateZetaSupply(logger zerolog.Logger, abortedTxAmounts, zetaInTransit, genesisAmounts, externalChainTotalSupply, zetaTokenSupplyOnNode, ethLockedAmount sdkmath.Int) bool { lhs := ethLockedAmount.Sub(abortedTxAmounts) rhs := zetaTokenSupplyOnNode.Add(zetaInTransit).Add(externalChainTotalSupply).Sub(genesisAmounts) @@ -157,35 +182,34 @@ func ValidateZetaSupply(logger zerolog.Logger, abortedTxAmounts, zetaInTransit, copyZetaTokenSupplyOnNode := zetaTokenSupplyOnNode copyGenesisAmounts := genesisAmounts nodeAmounts := copyZetaTokenSupplyOnNode.Sub(copyGenesisAmounts) - logger.Info().Msgf("--------------------------------------------------------------------------------") - logger.Info().Msgf("aborted tx amounts : %s", abortedTxAmounts.String()) - logger.Info().Msgf("zeta in transit : %s", zetaInTransit.String()) - logger.Info().Msgf("external chain total supply : %s", externalChainTotalSupply.String()) - logger.Info().Msgf("effective zeta supply on node : %s", nodeAmounts.String()) - logger.Info().Msgf("zeta token supply on node : %s", zetaTokenSupplyOnNode.String()) - logger.Info().Msgf("genesis amounts : %s", genesisAmounts.String()) - logger.Info().Msgf("eth locked amount : %s", ethLockedAmount.String()) + logs := ZetaSupplyCheckLogs{ + Logger: logger, + AbortedTxAmounts: abortedTxAmounts, + ZetaInTransit: zetaInTransit, + ExternalChainTotalSupply: externalChainTotalSupply, + NodeAmounts: nodeAmounts, + ZetaTokenSupplyOnNode: zetaTokenSupplyOnNode, + EthLockedAmount: ethLockedAmount, + LHS: lhs, + RHS: rhs, + } + defer logs.LogOutput() if !lhs.Equal(rhs) { - logger.Error().Msgf("zeta supply mismatch, lhs : %s , rhs : %s", lhs.String(), rhs.String()) + logs.SupplyCheckSuccess = false return false } - logger.Info().Msgf("zeta supply check passed, lhs : %s , rhs : %s", lhs.String(), rhs.String()) - logger.Info().Msgf("--------------------------------------------------------------------------------") + logs.SupplyCheckSuccess = true return true } func (zs *ZetaSupplyChecker) AbortedTxAmount() (sdkmath.Int, error) { - cctxList, err := zs.zetaClient.GetCctxByStatus(types.CctxStatus_Aborted) + amount, err := zs.zetaClient.GetAbortedZetaAmount() if err != nil { - return sdkmath.ZeroInt(), err + return sdkmath.ZeroInt(), errors.Wrap(err, "error getting aborted zeta amount") } - amount := sdkmath.ZeroUint() - for _, cctx := range cctxList { - amount = amount.Add(cctx.GetCurrentOutTxParam().Amount) - } - amountInt, ok := sdkmath.NewIntFromString(amount.String()) + amountInt, ok := sdkmath.NewIntFromString(amount) if !ok { - return sdkmath.ZeroInt(), errors.New("error parsing amount") + return sdkmath.ZeroInt(), errors.New("error parsing aborted zeta amount") } return amountInt, nil } @@ -207,7 +231,7 @@ func (zs *ZetaSupplyChecker) GetAmountOfZetaInTransit() sdkmath.Int { func (zs *ZetaSupplyChecker) GetPendingCCTXInTransit(receivingChains []common.Chain) []*types.CrossChainTx { cctxInTransit := make([]*types.CrossChainTx, 0) for _, chain := range receivingChains { - cctx, err := zs.zetaClient.GetAllPendingCctx(chain.ChainId) + cctx, _, err := zs.zetaClient.ListPendingCctx(chain.ChainId) if err != nil { continue } @@ -218,7 +242,7 @@ func (zs *ZetaSupplyChecker) GetPendingCCTXInTransit(receivingChains []common.Ch } } - trackers, err := zs.zetaClient.GetAllOutTxTrackerByChain(chain, Ascending) + trackers, err := zs.zetaClient.GetAllOutTxTrackerByChain(chain.ChainId, Ascending) if err != nil { continue } diff --git a/zetaclient/zetacore_bridge.go b/zetaclient/zetacore_bridge.go index a466fb91f1..3540a0dc70 100644 --- a/zetaclient/zetacore_bridge.go +++ b/zetaclient/zetacore_bridge.go @@ -25,24 +25,30 @@ var _ ZetaCoreBridger = &ZetaCoreBridge{} // ZetaCoreBridge will be used to send tx to ZetaCore. type ZetaCoreBridge struct { - logger zerolog.Logger - blockHeight int64 - accountNumber map[common.KeyType]uint64 - seqNumber map[common.KeyType]uint64 - grpcConn *grpc.ClientConn - httpClient *retryablehttp.Client - cfg config.ClientConfiguration - encodingCfg params.EncodingConfig - keys *Keys - broadcastLock *sync.RWMutex - zetaChainID string - lastOutTxReportTime map[string]time.Time - stop chan struct{} - pause chan struct{} + logger zerolog.Logger + blockHeight int64 + accountNumber map[common.KeyType]uint64 + seqNumber map[common.KeyType]uint64 + grpcConn *grpc.ClientConn + httpClient *retryablehttp.Client + cfg config.ClientConfiguration + encodingCfg params.EncodingConfig + keys *Keys + broadcastLock *sync.RWMutex + zetaChainID string + zetaChain common.Chain + stop chan struct{} + pause chan struct{} + Telemetry *TelemetryServer } // NewZetaCoreBridge create a new instance of ZetaCoreBridge -func NewZetaCoreBridge(k *Keys, chainIP string, signerName string, chainID string, hsmMode bool) (*ZetaCoreBridge, error) { +func NewZetaCoreBridge(k *Keys, chainIP string, + signerName string, + chainID string, + hsmMode bool, + telemetry *TelemetryServer) (*ZetaCoreBridge, error) { + // main module logger logger := log.With().Str("module", "CoreBridge").Logger() cfg := config.ClientConfiguration{ @@ -71,20 +77,26 @@ func NewZetaCoreBridge(k *Keys, chainIP string, signerName string, chainID strin seqMap[keyType] = 0 } + zetaChain, err := common.ZetaChainFromChainID(chainID) + if err != nil { + return nil, fmt.Errorf("invalid chain id %s, %w", chainID, err) + } + return &ZetaCoreBridge{ - logger: logger, - grpcConn: grpcConn, - httpClient: httpClient, - accountNumber: accountsMap, - seqNumber: seqMap, - cfg: cfg, - encodingCfg: app.MakeEncodingConfig(), - keys: k, - broadcastLock: &sync.RWMutex{}, - lastOutTxReportTime: map[string]time.Time{}, - stop: make(chan struct{}), - zetaChainID: chainID, - pause: make(chan struct{}), + logger: logger, + grpcConn: grpcConn, + httpClient: httpClient, + accountNumber: accountsMap, + seqNumber: seqMap, + cfg: cfg, + encodingCfg: app.MakeEncodingConfig(), + keys: k, + broadcastLock: &sync.RWMutex{}, + stop: make(chan struct{}), + zetaChainID: chainID, + zetaChain: zetaChain, + pause: make(chan struct{}), + Telemetry: telemetry, }, nil } @@ -102,10 +114,23 @@ func (b *ZetaCoreBridge) GetLogger() *zerolog.Logger { return &b.logger } -func (b *ZetaCoreBridge) UpdateChainID(chainID string) { +func (b *ZetaCoreBridge) UpdateChainID(chainID string) error { if b.zetaChainID != chainID { b.zetaChainID = chainID + + zetaChain, err := common.ZetaChainFromChainID(chainID) + if err != nil { + return fmt.Errorf("invalid chain id %s, %w", chainID, err) + } + b.zetaChain = zetaChain } + + return nil +} + +// ZetaChain returns the ZetaChain chain object +func (b *ZetaCoreBridge) ZetaChain() common.Chain { + return b.zetaChain } func (b *ZetaCoreBridge) Stop() { diff --git a/zetaclient/zetacore_observer.go b/zetaclient/zetacore_observer.go index fb208dd98d..4d6ee14c14 100644 --- a/zetaclient/zetacore_observer.go +++ b/zetaclient/zetacore_observer.go @@ -5,6 +5,8 @@ import ( "strings" "time" + sdkmath "cosmossdk.io/math" + "github.com/pkg/errors" prom "github.com/prometheus/client_golang/prometheus" "github.com/rs/zerolog" @@ -16,7 +18,9 @@ import ( ) const ( + MaxLookaheadNonce = 120 OutboundTxSignCount = "zetaclient_Outbound_tx_sign_count" + HotKeyBurnRate = "zetaclient_hotkey_burn_rate" ) type ZetaCoreLog struct { @@ -26,14 +30,15 @@ type ZetaCoreLog struct { // CoreObserver wraps the zetacore bridge and adds the client and signer maps to it . This is the high level object used for CCTX interactions type CoreObserver struct { - bridge ZetaCoreBridger - signerMap map[common.Chain]ChainSigner - clientMap map[common.Chain]ChainClient - metrics *metrics.Metrics - logger ZetaCoreLog - cfg *config.Config - ts *TelemetryServer - stop chan struct{} + bridge ZetaCoreBridger + signerMap map[common.Chain]ChainSigner + clientMap map[common.Chain]ChainClient + metrics *metrics.Metrics + logger ZetaCoreLog + cfg *config.Config + ts *TelemetryServer + stop chan struct{} + lastOperatorBalance sdkmath.Int } // NewCoreObserver creates a new CoreObserver @@ -69,6 +74,15 @@ func NewCoreObserver( if err != nil { co.logger.ChainLogger.Error().Err(err).Msg("error registering counter") } + err = metrics.RegisterGauge(HotKeyBurnRate, "Fee burn rate of the hotkey") + if err != nil { + co.logger.ChainLogger.Error().Err(err).Msg("error registering gauge") + } + balance, err := bridge.GetZetaHotKeyBalance() + if err != nil { + co.logger.ChainLogger.Error().Err(err).Msg("error getting last balance of the hot key") + } + co.lastOperatorBalance = balance return &co } @@ -85,10 +99,18 @@ func (co *CoreObserver) GetPromCounter(name string) (prom.Counter, error) { return cnt, nil } +func (co *CoreObserver) GetPromGauge(name string) (prom.Gauge, error) { + gauge, found := metrics.Gauges[name] + if !found { + return nil, errors.New("gauge not found") + } + return gauge, nil +} + func (co *CoreObserver) MonitorCore() { myid := co.bridge.GetKeys().GetAddress() co.logger.ZetaChainWatcher.Info().Msgf("Starting Send Scheduler for %s", myid) - go co.startSendScheduler() + go co.startCctxScheduler() go func() { // bridge queries UpgradePlan from zetacore and send to its pause channel if upgrade height is reached @@ -101,26 +123,25 @@ func (co *CoreObserver) MonitorCore() { }() } -// ZetaCore block is heart beat; each block we schedule some send according to -// retry schedule. ses -func (co *CoreObserver) startSendScheduler() { +// startCctxScheduler schedules keysigns for cctxs on each ZetaChain block (the ticker) +func (co *CoreObserver) startCctxScheduler() { outTxMan := NewOutTxProcessorManager(co.logger.ChainLogger) observeTicker := time.NewTicker(3 * time.Second) var lastBlockNum int64 for { select { case <-co.stop: - co.logger.ZetaChainWatcher.Warn().Msg("stop sendScheduler") + co.logger.ZetaChainWatcher.Warn().Msg("startCctxScheduler: stopped") return case <-observeTicker.C: { bn, err := co.bridge.GetZetaBlockHeight() if err != nil { - co.logger.ZetaChainWatcher.Error().Msg("GetZetaBlockHeight fail in startSendScheduler") + co.logger.ZetaChainWatcher.Error().Err(err).Msg("startCctxScheduler: GetZetaBlockHeight fail") continue } if bn < 0 { - co.logger.ZetaChainWatcher.Error().Msg("GetZetaBlockHeight returned negative height") + co.logger.ZetaChainWatcher.Error().Msg("startCctxScheduler: GetZetaBlockHeight returned negative height") continue } if lastBlockNum == 0 { @@ -129,126 +150,63 @@ func (co *CoreObserver) startSendScheduler() { if bn > lastBlockNum { // we have a new block bn = lastBlockNum + 1 if bn%10 == 0 { - co.logger.ZetaChainWatcher.Debug().Msgf("ZetaCore heart beat: %d", bn) + co.logger.ZetaChainWatcher.Debug().Msgf("startCctxScheduler: ZetaCore heart beat: %d", bn) } - //logger.Info().Dur("elapsed", time.Since(tStart)).Msgf("GetAllPendingCctx %d", len(sendList)) + balance, err := co.bridge.GetZetaHotKeyBalance() + if err != nil { + co.logger.ZetaChainWatcher.Error().Err(err).Msgf("couldn't get operator balance") + } else { + diff := co.lastOperatorBalance.Sub(balance) + if diff.GT(sdkmath.NewInt(0)) { + co.ts.AddFeeEntry(bn, diff.Int64()) + co.lastOperatorBalance = balance + } + } + + // Set Current Hot key burn rate + gauge, err := co.GetPromGauge(HotKeyBurnRate) + if err != nil { + co.logger.ZetaChainWatcher.Error().Err(err).Msgf("scheduleCctxEVM: failed to get prometheus gauge: %s for observer", metrics.PendingTxs) + continue + } // Gauge only takes float values + gauge.Set(float64(co.ts.hotKeyBurnRate.GetBurnRate().Int64())) + + // schedule keysign for pending cctxs on each chain supportedChains := co.Config().GetEnabledChains() for _, c := range supportedChains { - if c.ChainId == common.ZetaChain().ChainId { + if c.ChainId == co.bridge.ZetaChain().ChainId { continue } signer := co.signerMap[c] - cctxList, err := co.bridge.GetAllPendingCctx(c.ChainId) + cctxList, totalPending, err := co.bridge.ListPendingCctx(c.ChainId) if err != nil { - co.logger.ZetaChainWatcher.Error().Err(err).Msgf("failed to GetAllPendingCctx for chain %s", c.ChainName.String()) + co.logger.ZetaChainWatcher.Error().Err(err).Msgf("startCctxScheduler: ListPendingCctx failed for chain %d", c.ChainId) continue } ob, err := co.getUpdatedChainOb(c.ChainId) if err != nil { - co.logger.ZetaChainWatcher.Error().Err(err).Msgf("getTargetChainOb fail, Chain ID: %s", c.ChainName) - continue - } - chain, err := common.GetChainNameFromChainID(c.ChainId) - if err != nil { - co.logger.ZetaChainWatcher.Error().Err(err).Msgf("GetTargetChain fail, Chain ID: %s", c.ChainName) + co.logger.ZetaChainWatcher.Error().Err(err).Msgf("startCctxScheduler: getTargetChainOb failed for chain %d", c.ChainId) continue } - res, err := co.bridge.GetAllOutTxTrackerByChain(c, Ascending) - if err != nil { - co.logger.ZetaChainWatcher.Warn().Err(err).Msgf("failed to GetAllOutTxTrackerByChain for chain %s", c.ChainName.String()) - continue - } - trackerMap := make(map[uint64]bool) - for _, v := range res { - trackerMap[v.Nonce] = true - } - + // Set Pending transactions prometheus gauge gauge, err := ob.GetPromGauge(metrics.PendingTxs) if err != nil { - co.logger.ZetaChainWatcher.Error().Err(err).Msgf("failed to get prometheus gauge: %s", metrics.PendingTxs) + co.logger.ZetaChainWatcher.Error().Err(err).Msgf("scheduleCctxEVM: failed to get prometheus gauge: %s for chain %d", metrics.PendingTxs, c.ChainId) continue } - gauge.Set(float64(len(cctxList))) - - for idx, cctx := range cctxList { - params := cctx.GetCurrentOutTxParam() - if params.ReceiverChainId != c.ChainId { - co.logger.ZetaChainWatcher.Error().Msgf("mismatch chainid: want %d, got %d", c.ChainId, params.ReceiverChainId) - continue - } - const MaxLookaheadNonce = 120 - if params.OutboundTxTssNonce > cctxList[0].GetCurrentOutTxParam().OutboundTxTssNonce+MaxLookaheadNonce { - co.logger.ZetaChainWatcher.Error().Msgf("nonce too high: signing %d, earliest pending %d", params.OutboundTxTssNonce, cctxList[0].GetCurrentOutTxParam().OutboundTxTssNonce) - break - } - // #nosec G701 range is verified - currentHeight := uint64(bn) - nonce := params.OutboundTxTssNonce - outTxID := fmt.Sprintf("%s-%d-%d", cctx.Index, params.ReceiverChainId, nonce) // would outTxID a better ID? - - // Process Bitcoin OutTx - 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 - } - continue - } - - // Monitor Core Logger for OutboundTxTssNonce - included, _, err := ob.IsSendOutTxProcessed(cctx.Index, params.OutboundTxTssNonce, params.CoinType, co.logger.ZetaChainWatcher) - if err != nil { - co.logger.ZetaChainWatcher.Error().Err(err).Msgf("IsSendOutTxProcessed fail, Chain ID: %s", c.ChainName) - continue - } - if included { - co.logger.ZetaChainWatcher.Info().Msgf("send outTx already included; do not schedule") - continue - } - - // #nosec G701 positive - interval := uint64(ob.GetCoreParams().OutboundTxScheduleInterval) - lookahead := ob.GetCoreParams().OutboundTxScheduleLookahead - - // determining critical outtx; if it satisfies following criteria - // 1. it's the first pending outtx for this chain - // 2. the following 5 nonces have been in tracker - criticalInterval := uint64(10) // for critical pending outTx we reduce re-try interval - nonCriticalInterval := interval * 2 // for non-critical pending outTx we increase re-try interval - if nonce%criticalInterval == currentHeight%criticalInterval { - count := 0 - for i := nonce + 1; i <= nonce+10; i++ { - if _, found := trackerMap[i]; found { - count++ - } - } - if count >= 5 { - interval = criticalInterval - } - } - // if it's already in tracker, we increase re-try interval - if _, ok := trackerMap[nonce]; ok { - interval = nonCriticalInterval - } - - // otherwise, the normal interval is used - if nonce%interval == currentHeight%interval && !outTxMan.IsOutTxActive(outTxID) { - outTxMan.StartTryProcess(outTxID) - co.logger.ZetaChainWatcher.Debug().Msgf("chain %s: Sign outtx %s with value %d\n", chain, outTxID, cctx.GetCurrentOutTxParam().Amount) - go signer.TryProcessOutTx(cctx, outTxMan, outTxID, ob, co.bridge, currentHeight) - } - - // #nosec G701 always in range - if int64(idx) >= lookahead-1 { // only look at 30 sends per chain - break - } + gauge.Set(float64(totalPending)) + + // #nosec G701 range is verified + zetaHeight := uint64(bn) + if common.IsEVMChain(c.ChainId) { + co.scheduleCctxEVM(outTxMan, zetaHeight, c.ChainId, cctxList, ob, signer) + } else if common.IsBitcoinChain(c.ChainId) { + co.scheduleCctxBTC(outTxMan, zetaHeight, c.ChainId, cctxList, ob, signer) + } else { + co.logger.ZetaChainWatcher.Error().Msgf("startCctxScheduler: unsupported chain %d", c.ChainId) + continue } } // update last processed block number @@ -256,44 +214,136 @@ func (co *CoreObserver) startSendScheduler() { co.ts.SetCoreBlockNumber(lastBlockNum) } } - } } } -// Bitcoin outtx is processed in a different way -// 1. schedule one keysign on each ticker -// 2. schedule keysign only when nonce-mark UTXO is available -// 3. stop processing when pendingNonce/lookahead is reached -// -// Returns whether to stop processing -func (co *CoreObserver) processBitcoinOutTx(outTxMan *OutTxProcessorManager, idx uint64, send *types.CrossChainTx, signer ChainSigner, ob ChainClient, currentHeight uint64) bool { - params := send.GetCurrentOutTxParam() - nonce := params.OutboundTxTssNonce - lookahead := ob.GetCoreParams().OutboundTxScheduleLookahead - outTxID := fmt.Sprintf("%s-%d-%d", send.Index, params.ReceiverChainId, nonce) +// scheduleCctxEVM schedules evm outtx keysign on each ZetaChain block (the ticker) +func (co *CoreObserver) scheduleCctxEVM( + outTxMan *OutTxProcessorManager, + zetaHeight uint64, + chainID int64, + cctxList []*types.CrossChainTx, + ob ChainClient, + signer ChainSigner) { + res, err := co.bridge.GetAllOutTxTrackerByChain(chainID, Ascending) + if err != nil { + co.logger.ZetaChainWatcher.Warn().Err(err).Msgf("scheduleCctxEVM: GetAllOutTxTrackerByChain failed for chain %d", chainID) + return + } + trackerMap := make(map[uint64]bool) + for _, v := range res { + trackerMap[v.Nonce] = true + } - // start go routine to process outtx - outTxMan.StartTryProcess(outTxID) - co.logger.ZetaChainWatcher.Debug().Msgf("Sign bitcoin outtx %s with value %d\n", outTxID, params.Amount) - go signer.TryProcessOutTx(send, outTxMan, outTxID, ob, co.bridge, currentHeight) + for idx, cctx := range cctxList { + params := cctx.GetCurrentOutTxParam() + nonce := params.OutboundTxTssNonce + outTxID := ToOutTxID(cctx.Index, params.ReceiverChainId, nonce) - // get bitcoin client + if params.ReceiverChainId != chainID { + co.logger.ZetaChainWatcher.Error().Msgf("scheduleCctxEVM: outtx %s chainid mismatch: want %d, got %d", outTxID, chainID, params.ReceiverChainId) + continue + } + if params.OutboundTxTssNonce > cctxList[0].GetCurrentOutTxParam().OutboundTxTssNonce+MaxLookaheadNonce { + co.logger.ZetaChainWatcher.Error().Msgf("scheduleCctxEVM: nonce too high: signing %d, earliest pending %d", params.OutboundTxTssNonce, cctxList[0].GetCurrentOutTxParam().OutboundTxTssNonce) + break + } + + // try confirming the outtx + included, _, err := ob.IsSendOutTxProcessed(cctx.Index, params.OutboundTxTssNonce, params.CoinType, co.logger.ZetaChainWatcher) + if err != nil { + co.logger.ZetaChainWatcher.Error().Err(err).Msgf("scheduleCctxEVM: IsSendOutTxProcessed faild for chain %d", chainID) + continue + } + if included { + co.logger.ZetaChainWatcher.Info().Msgf("scheduleCctxEVM: outtx %s already included; do not schedule keysign", outTxID) + continue + } + + // #nosec G701 positive + interval := uint64(ob.GetCoreParams().OutboundTxScheduleInterval) + lookahead := ob.GetCoreParams().OutboundTxScheduleLookahead + + // determining critical outtx; if it satisfies following criteria + // 1. it's the first pending outtx for this chain + // 2. the following 5 nonces have been in tracker + criticalInterval := uint64(10) // for critical pending outTx we reduce re-try interval + nonCriticalInterval := interval * 2 // for non-critical pending outTx we increase re-try interval + if nonce%criticalInterval == zetaHeight%criticalInterval { + count := 0 + for i := nonce + 1; i <= nonce+10; i++ { + if _, found := trackerMap[i]; found { + count++ + } + } + if count >= 5 { + interval = criticalInterval + } + } + // if it's already in tracker, we increase re-try interval + if _, ok := trackerMap[nonce]; ok { + interval = nonCriticalInterval + } + + // otherwise, the normal interval is used + if nonce%interval == zetaHeight%interval && !outTxMan.IsOutTxActive(outTxID) { + outTxMan.StartTryProcess(outTxID) + co.logger.ZetaChainWatcher.Debug().Msgf("scheduleCctxEVM: sign outtx %s with value %d\n", outTxID, cctx.GetCurrentOutTxParam().Amount) + go signer.TryProcessOutTx(cctx, outTxMan, outTxID, ob, co.bridge, zetaHeight) + } + + // #nosec G701 always in range + if int64(idx) >= lookahead-1 { // only look at 'lookahead' cctxs per chain + break + } + } +} + +// scheduleCctxBTC schedules bitcoin outtx keysign on each ZetaChain block (the ticker) +// 1. schedule at most one keysign per ticker +// 2. schedule keysign only when nonce-mark UTXO is available +// 3. stop keysign when lookahead is reached +func (co *CoreObserver) scheduleCctxBTC( + outTxMan *OutTxProcessorManager, + zetaHeight uint64, + chainID int64, + cctxList []*types.CrossChainTx, + ob ChainClient, + signer ChainSigner) { btcClient, ok := ob.(*BitcoinChainClient) if !ok { // should never happen - co.logger.ZetaChainWatcher.Error().Msgf("chain client is not a bitcoin client") - return true - } - // stop if the nonce being processed reaches the artificial pending nonce - if nonce >= btcClient.GetPendingNonce() { - return true + co.logger.ZetaChainWatcher.Error().Msgf("scheduleCctxBTC: chain client is not a bitcoin client") + return } - // stop if lookahead is reached. 2 bitcoin confirmations span is 20 minutes on average. We look ahead up to 100 pending cctx to target TPM of 5. - // #nosec G701 always in range - if int64(idx) >= lookahead-1 { - return true + lookahead := ob.GetCoreParams().OutboundTxScheduleLookahead + + // schedule at most one keysign per ticker + for idx, cctx := range cctxList { + params := cctx.GetCurrentOutTxParam() + nonce := params.OutboundTxTssNonce + outTxID := ToOutTxID(cctx.Index, params.ReceiverChainId, nonce) + + if params.ReceiverChainId != chainID { + co.logger.ZetaChainWatcher.Error().Msgf("scheduleCctxBTC: outtx %s chainid mismatch: want %d, got %d", outTxID, chainID, params.ReceiverChainId) + continue + } + // stop if the nonce being processed is higher than the pending nonce + if nonce > btcClient.GetPendingNonce() { + break + } + // stop if lookahead is reached + if int64(idx) >= lookahead { // 2 bitcoin confirmations span is 20 minutes on average. We look ahead up to 100 pending cctx to target TPM of 5. + co.logger.ZetaChainWatcher.Warn().Msgf("scheduleCctxBTC: lookahead reached, signing %d, earliest pending %d", nonce, cctxList[0].GetCurrentOutTxParam().OutboundTxTssNonce) + break + } + // try confirming the outtx or scheduling a keysign + if !outTxMan.IsOutTxActive(outTxID) { + outTxMan.StartTryProcess(outTxID) + co.logger.ZetaChainWatcher.Debug().Msgf("scheduleCctxBTC: sign outtx %s with value %d\n", outTxID, params.Amount) + go signer.TryProcessOutTx(cctx, outTxMan, outTxID, ob, co.bridge, zetaHeight) + } } - return false // otherwise, continue } func (co *CoreObserver) getUpdatedChainOb(chainID int64) (ChainClient, error) {