diff --git a/.github/actions/build-binaries/readme.md b/.github/actions/build-binaries/readme.md index 191dd50bda..b45e46479c 100644 --- a/.github/actions/build-binaries/readme.md +++ b/.github/actions/build-binaries/readme.md @@ -7,5 +7,5 @@ with: run-tests: ${{ env.GITHUB_REF_NAME != 'develop' }} build-indexer: false - go-version: '1.19' + go-version: '1.20' ``` \ No newline at end of file diff --git a/.github/actions/install-dependencies/action.yml b/.github/actions/install-dependencies/action.yml index 624fde00ce..aa51cb5d67 100644 --- a/.github/actions/install-dependencies/action.yml +++ b/.github/actions/install-dependencies/action.yml @@ -33,7 +33,7 @@ runs: - uses: actions/setup-go@v4 if: ${{ inputs.skip_go == 'false' }} with: - go-version: '1.19.0' + go-version: '1.20' cache: false - uses: actions/setup-python@v4 diff --git a/.github/actions/upgrade-testing/Dockerfile b/.github/actions/upgrade-testing/Dockerfile index 428f241fc3..28b44e3840 100644 --- a/.github/actions/upgrade-testing/Dockerfile +++ b/.github/actions/upgrade-testing/Dockerfile @@ -1,7 +1,7 @@ ################ # BUILD ZETAVISOR ################ -FROM golang:1.19 AS cosmovisor +FROM golang:1.20 AS cosmovisor ENV GOBIN=/go/bin ENV GOPATH=/go ENV CGO_ENABLED=0 @@ -16,7 +16,7 @@ RUN apt update && \ FROM ubuntu:latest RUN apt-get update && apt-get install -y curl ca-certificates -ENV GO_VERSION 1.19 +ENV GO_VERSION 1.20 RUN curl -L https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz -o go.tar.gz && \ tar -C /usr/local -xzf go.tar.gz && \ rm go.tar.gz diff --git a/.github/workflows/sast-linters.yml b/.github/workflows/sast-linters.yml index 7f5bc04e13..8b86ea3c6c 100644 --- a/.github/workflows/sast-linters.yml +++ b/.github/workflows/sast-linters.yml @@ -25,9 +25,9 @@ jobs: fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: '1.20' # - name: Install Pipeline Dependencies # uses: ./.github/actions/install-dependencies @@ -59,24 +59,94 @@ jobs: lint: runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 env: GO111MODULE: on steps: - name: Checkout Source uses: actions/checkout@v2 - - # - name: Install Pipeline Dependencies - # uses: ./.github/actions/install-dependencies + with: + fetch-depth: 0 + + - name: Install Pipeline Dependencies + uses: ./.github/actions/install-dependencies - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: '1.19' - name: Run golangci-lint uses: golangci/golangci-lint-action@v3 with: version: v1.50 skip-cache: true - args: --timeout=30m + args: --timeout=15m + + nosec_alert: + runs-on: ubuntu-latest + timeout-minutes: 10 + env: + GO111MODULE: on + steps: + - name: Checkout Source + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Getting files updated in the PR + id: changed-files + uses: tj-actions/changed-files@v39 + with: + base_sha: ${{ github.event.pull_request.base.sha }} + + - name: List all changed files + run: | + for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + echo "$file was changed" + done + + - name: Report nosec usage + run: | + nosec_list=() + nosec_detected=0 + echo "Changed files: ${{ steps.changed-files.outputs.all_changed_files }}" + + for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + if git diff ${{ github.event.pull_request.base.sha }} $file | grep -q nosec; then + echo "nosec detected in $file" + nosec_list+=("$file,") + nosec_detected=1 + else + echo "nosec not detected in $file" + fi + done + + nosec_list_string="${nosec_list[@]}" + nosec_list_string="${nosec_list_string%,}" + echo "nosec_files=$nosec_list_string" >> $GITHUB_ENV + echo "nosec_detected=$nosec_detected" >> $GITHUB_ENV + + - name: Report nosec uses + uses: mshick/add-pr-comment@v2 + if: env.nosec_detected == 1 + with: + message: | + *!!!WARNING!!!* + `nosec` detected in the following files: ${{ env.nosec_files }} + + Be very careful about using `#nosec` in code. It can be a quick way to suppress security warnings and move forward with development, it should be employed with caution. Suppressing warnings with #nosec can hide potentially serious vulnerabilities. Only use #nosec when you're absolutely certain that the security issue is either a false positive or has been mitigated in another way. + + Pay extra attention to the way `#nosec` is being used in the files listed above. + + - name: Add Label + uses: actions/github-script@v6 + if: env.nosec_detected == 1 + with: + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ["nosec"] + }) diff --git a/.golangci.yml b/.golangci.yml index 9565682069..f393d5880f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -13,7 +13,6 @@ linters: - typecheck - misspell - prealloc - - depguard - dogsled - goconst - bodyclose diff --git a/Dockerfile b/Dockerfile index 89a153ab9b..a5e32fc20a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.19-alpine +FROM golang:1.20-alpine ENV GOPATH /go ENV GOOS=linux @@ -19,7 +19,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ RUN --mount=type=cache,target=/root/.cache/go-build \ make install-smoketest # -#FROM golang:1.19-alpine +#FROM golang:1.20-alpine #RUN apk --no-cache add openssh jq tmux vim curl bash RUN ssh-keygen -A diff --git a/Dockerfile-athens3-ubuntu b/Dockerfile-athens3-ubuntu index a44f80a9c7..737d4d03d1 100644 --- a/Dockerfile-athens3-ubuntu +++ b/Dockerfile-athens3-ubuntu @@ -1,4 +1,4 @@ -FROM golang:1.19-bullseye +FROM golang:1.20-bullseye ENV GOPATH /go ENV GOOS=linux diff --git a/app/ante/handler_options.go b/app/ante/handler_options.go index 7e0d0355b9..3745b3aad3 100644 --- a/app/ante/handler_options.go +++ b/app/ante/handler_options.go @@ -170,7 +170,7 @@ func (sud SetUpContextDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate } // SetGasMeter returns a new context with a gas meter set from a given context. -func SetGasMeter(simulate bool, ctx sdk.Context, gasLimit uint64) sdk.Context { +func SetGasMeter(_ bool, ctx sdk.Context, gasLimit uint64) sdk.Context { // In various cases such as simulation and during the genesis block, we do not // meter any gas utilization. //if simulate || ctx.BlockHeight() == 0 { diff --git a/app/app.go b/app/app.go index 86fbec2bef..42c2cc6d20 100644 --- a/app/app.go +++ b/app/app.go @@ -431,7 +431,10 @@ func New( // If evidence needs to be handled for the app, set routes in router here and seal app.EvidenceKeeper = *evidenceKeeper - app.EvmKeeper = app.EvmKeeper.SetHooks(app.ZetaCoreKeeper.Hooks()) + app.EvmKeeper = app.EvmKeeper.SetHooks(evmkeeper.NewMultiEvmHooks( + app.ZetaCoreKeeper.Hooks(), + app.FungibleKeeper.EVMHooks(), + )) /**** Module Options ****/ diff --git a/cmd/zetaclientd/p2p_diagnostics.go b/cmd/zetaclientd/p2p_diagnostics.go index 9d94b3c64a..f07441beb5 100644 --- a/cmd/zetaclientd/p2p_diagnostics.go +++ b/cmd/zetaclientd/p2p_diagnostics.go @@ -8,7 +8,7 @@ import ( "time" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - "github.com/libp2p/go-libp2p" + libp2p "github.com/libp2p/go-libp2p" dht "github.com/libp2p/go-libp2p-kad-dht" "github.com/libp2p/go-libp2p/core/crypto" "github.com/libp2p/go-libp2p/core/network" diff --git a/contrib/localnet/orchestrator/Dockerfile b/contrib/localnet/orchestrator/Dockerfile index 3d04384ee3..5e7c2013c9 100644 --- a/contrib/localnet/orchestrator/Dockerfile +++ b/contrib/localnet/orchestrator/Dockerfile @@ -1,6 +1,6 @@ FROM zetanode:latest as zeta FROM ethereum/client-go:v1.10.26 as geth -FROM golang:1.19-alpine as orchestrator +FROM golang:1.20-alpine as orchestrator RUN apk --no-cache add jq curl bash make git build-base diff --git a/contrib/localnet/orchestrator/Dockerfile.fastbuild b/contrib/localnet/orchestrator/Dockerfile.fastbuild index b7e86eb396..e4c4381be6 100644 --- a/contrib/localnet/orchestrator/Dockerfile.fastbuild +++ b/contrib/localnet/orchestrator/Dockerfile.fastbuild @@ -1,6 +1,6 @@ FROM zetanode:latest as zeta FROM ethereum/client-go:v1.10.26 as geth -FROM golang:1.19-alpine as orchestrator +FROM golang:1.20-alpine as orchestrator RUN apk --no-cache add jq curl bash make git build-base diff --git a/contrib/localnet/orchestrator/smoketest/contracts/vault/Vault.abi b/contrib/localnet/orchestrator/smoketest/contracts/vault/Vault.abi new file mode 100644 index 0000000000..ad62c9b204 --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/contracts/vault/Vault.abi @@ -0,0 +1,62 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balances", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/contrib/localnet/orchestrator/smoketest/contracts/vault/Vault.bin b/contrib/localnet/orchestrator/smoketest/contracts/vault/Vault.bin new file mode 100644 index 0000000000..3f2cd75865 --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/contracts/vault/Vault.bin @@ -0,0 +1 @@ +608060405234801561001057600080fd5b50610904806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806347e7ef2414610046578063c23f001f14610062578063f3fef3a314610092575b600080fd5b610060600480360381019061005b9190610564565b6100ae565b005b61007c600480360381019061007791906105a4565b61024c565b60405161008991906105f3565b60405180910390f35b6100ac60048036038101906100a79190610564565b610271565b005b600081116100f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100e89061066b565b60405180910390fd5b60008290508073ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b81526004016101339392919061069a565b6020604051808303816000875af1158015610152573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101769190610709565b6101b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ac90610782565b60405180910390fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461024091906107d1565b92505081905550505050565b6000602052816000526040600020602052806000526040600020600091509150505481565b600081116102b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102ab9061066b565b60405180910390fd5b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610372576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161036990610851565b60405180910390fd5b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546103fd9190610871565b9250508190555060008290508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846040518363ffffffff1660e01b81526004016104449291906108a5565b6020604051808303816000875af1158015610463573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104879190610709565b6104c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104bd90610782565b60405180910390fd5b505050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006104fb826104d0565b9050919050565b61050b816104f0565b811461051657600080fd5b50565b60008135905061052881610502565b92915050565b6000819050919050565b6105418161052e565b811461054c57600080fd5b50565b60008135905061055e81610538565b92915050565b6000806040838503121561057b5761057a6104cb565b5b600061058985828601610519565b925050602061059a8582860161054f565b9150509250929050565b600080604083850312156105bb576105ba6104cb565b5b60006105c985828601610519565b92505060206105da85828601610519565b9150509250929050565b6105ed8161052e565b82525050565b600060208201905061060860008301846105e4565b92915050565b600082825260208201905092915050565b7f416d6f756e742073686f756c642062652067726561746572207468616e203000600082015250565b6000610655601f8361060e565b91506106608261061f565b602082019050919050565b6000602082019050818103600083015261068481610648565b9050919050565b610694816104f0565b82525050565b60006060820190506106af600083018661068b565b6106bc602083018561068b565b6106c960408301846105e4565b949350505050565b60008115159050919050565b6106e6816106d1565b81146106f157600080fd5b50565b600081519050610703816106dd565b92915050565b60006020828403121561071f5761071e6104cb565b5b600061072d848285016106f4565b91505092915050565b7f5472616e73666572206661696c65640000000000000000000000000000000000600082015250565b600061076c600f8361060e565b915061077782610736565b602082019050919050565b6000602082019050818103600083015261079b8161075f565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006107dc8261052e565b91506107e78361052e565b92508282019050808211156107ff576107fe6107a2565b5b92915050565b7f496e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b600061083b60148361060e565b915061084682610805565b602082019050919050565b6000602082019050818103600083015261086a8161082e565b9050919050565b600061087c8261052e565b91506108878361052e565b925082820390508181111561089f5761089e6107a2565b5b92915050565b60006040820190506108ba600083018561068b565b6108c760208301846105e4565b939250505056fea2646970667358221220a4c5411c946fad1845e3d501f7c432ddc24537e71ab463a59742ccbcc57c107264736f6c63430008150033 diff --git a/contrib/localnet/orchestrator/smoketest/contracts/vault/Vault.go b/contrib/localnet/orchestrator/smoketest/contracts/vault/Vault.go new file mode 100644 index 0000000000..8f3f921205 --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/contracts/vault/Vault.go @@ -0,0 +1,276 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package vault + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// VaultMetaData contains all meta data concerning the Vault contract. +var VaultMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balances\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x608060405234801561001057600080fd5b50610904806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806347e7ef2414610046578063c23f001f14610062578063f3fef3a314610092575b600080fd5b610060600480360381019061005b9190610564565b6100ae565b005b61007c600480360381019061007791906105a4565b61024c565b60405161008991906105f3565b60405180910390f35b6100ac60048036038101906100a79190610564565b610271565b005b600081116100f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100e89061066b565b60405180910390fd5b60008290508073ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b81526004016101339392919061069a565b6020604051808303816000875af1158015610152573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101769190610709565b6101b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ac90610782565b60405180910390fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461024091906107d1565b92505081905550505050565b6000602052816000526040600020602052806000526040600020600091509150505481565b600081116102b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102ab9061066b565b60405180910390fd5b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610372576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161036990610851565b60405180910390fd5b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546103fd9190610871565b9250508190555060008290508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846040518363ffffffff1660e01b81526004016104449291906108a5565b6020604051808303816000875af1158015610463573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104879190610709565b6104c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104bd90610782565b60405180910390fd5b505050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006104fb826104d0565b9050919050565b61050b816104f0565b811461051657600080fd5b50565b60008135905061052881610502565b92915050565b6000819050919050565b6105418161052e565b811461054c57600080fd5b50565b60008135905061055e81610538565b92915050565b6000806040838503121561057b5761057a6104cb565b5b600061058985828601610519565b925050602061059a8582860161054f565b9150509250929050565b600080604083850312156105bb576105ba6104cb565b5b60006105c985828601610519565b92505060206105da85828601610519565b9150509250929050565b6105ed8161052e565b82525050565b600060208201905061060860008301846105e4565b92915050565b600082825260208201905092915050565b7f416d6f756e742073686f756c642062652067726561746572207468616e203000600082015250565b6000610655601f8361060e565b91506106608261061f565b602082019050919050565b6000602082019050818103600083015261068481610648565b9050919050565b610694816104f0565b82525050565b60006060820190506106af600083018661068b565b6106bc602083018561068b565b6106c960408301846105e4565b949350505050565b60008115159050919050565b6106e6816106d1565b81146106f157600080fd5b50565b600081519050610703816106dd565b92915050565b60006020828403121561071f5761071e6104cb565b5b600061072d848285016106f4565b91505092915050565b7f5472616e73666572206661696c65640000000000000000000000000000000000600082015250565b600061076c600f8361060e565b915061077782610736565b602082019050919050565b6000602082019050818103600083015261079b8161075f565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006107dc8261052e565b91506107e78361052e565b92508282019050808211156107ff576107fe6107a2565b5b92915050565b7f496e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b600061083b60148361060e565b915061084682610805565b602082019050919050565b6000602082019050818103600083015261086a8161082e565b9050919050565b600061087c8261052e565b91506108878361052e565b925082820390508181111561089f5761089e6107a2565b5b92915050565b60006040820190506108ba600083018561068b565b6108c760208301846105e4565b939250505056fea2646970667358221220a4c5411c946fad1845e3d501f7c432ddc24537e71ab463a59742ccbcc57c107264736f6c63430008150033", +} + +// VaultABI is the input ABI used to generate the binding from. +// Deprecated: Use VaultMetaData.ABI instead. +var VaultABI = VaultMetaData.ABI + +// VaultBin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use VaultMetaData.Bin instead. +var VaultBin = VaultMetaData.Bin + +// DeployVault deploys a new Ethereum contract, binding an instance of Vault to it. +func DeployVault(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Vault, error) { + parsed, err := VaultMetaData.GetAbi() + if err != nil { + return common.Address{}, nil, nil, err + } + if parsed == nil { + return common.Address{}, nil, nil, errors.New("GetABI returned nil") + } + + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(VaultBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &Vault{VaultCaller: VaultCaller{contract: contract}, VaultTransactor: VaultTransactor{contract: contract}, VaultFilterer: VaultFilterer{contract: contract}}, nil +} + +// Vault is an auto generated Go binding around an Ethereum contract. +type Vault struct { + VaultCaller // Read-only binding to the contract + VaultTransactor // Write-only binding to the contract + VaultFilterer // Log filterer for contract events +} + +// VaultCaller is an auto generated read-only Go binding around an Ethereum contract. +type VaultCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// VaultTransactor is an auto generated write-only Go binding around an Ethereum contract. +type VaultTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// VaultFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type VaultFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// VaultSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type VaultSession struct { + Contract *Vault // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// VaultCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type VaultCallerSession struct { + Contract *VaultCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// VaultTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type VaultTransactorSession struct { + Contract *VaultTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// VaultRaw is an auto generated low-level Go binding around an Ethereum contract. +type VaultRaw struct { + Contract *Vault // Generic contract binding to access the raw methods on +} + +// VaultCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type VaultCallerRaw struct { + Contract *VaultCaller // Generic read-only contract binding to access the raw methods on +} + +// VaultTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type VaultTransactorRaw struct { + Contract *VaultTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewVault creates a new instance of Vault, bound to a specific deployed contract. +func NewVault(address common.Address, backend bind.ContractBackend) (*Vault, error) { + contract, err := bindVault(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Vault{VaultCaller: VaultCaller{contract: contract}, VaultTransactor: VaultTransactor{contract: contract}, VaultFilterer: VaultFilterer{contract: contract}}, nil +} + +// NewVaultCaller creates a new read-only instance of Vault, bound to a specific deployed contract. +func NewVaultCaller(address common.Address, caller bind.ContractCaller) (*VaultCaller, error) { + contract, err := bindVault(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &VaultCaller{contract: contract}, nil +} + +// NewVaultTransactor creates a new write-only instance of Vault, bound to a specific deployed contract. +func NewVaultTransactor(address common.Address, transactor bind.ContractTransactor) (*VaultTransactor, error) { + contract, err := bindVault(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &VaultTransactor{contract: contract}, nil +} + +// NewVaultFilterer creates a new log filterer instance of Vault, bound to a specific deployed contract. +func NewVaultFilterer(address common.Address, filterer bind.ContractFilterer) (*VaultFilterer, error) { + contract, err := bindVault(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &VaultFilterer{contract: contract}, nil +} + +// bindVault binds a generic wrapper to an already deployed contract. +func bindVault(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := VaultMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Vault *VaultRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Vault.Contract.VaultCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Vault *VaultRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Vault.Contract.VaultTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Vault *VaultRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Vault.Contract.VaultTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Vault *VaultCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Vault.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Vault *VaultTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Vault.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Vault *VaultTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Vault.Contract.contract.Transact(opts, method, params...) +} + +// Balances is a free data retrieval call binding the contract method 0xc23f001f. +// +// Solidity: function balances(address , address ) view returns(uint256) +func (_Vault *VaultCaller) Balances(opts *bind.CallOpts, arg0 common.Address, arg1 common.Address) (*big.Int, error) { + var out []interface{} + err := _Vault.contract.Call(opts, &out, "balances", arg0, arg1) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// Balances is a free data retrieval call binding the contract method 0xc23f001f. +// +// Solidity: function balances(address , address ) view returns(uint256) +func (_Vault *VaultSession) Balances(arg0 common.Address, arg1 common.Address) (*big.Int, error) { + return _Vault.Contract.Balances(&_Vault.CallOpts, arg0, arg1) +} + +// Balances is a free data retrieval call binding the contract method 0xc23f001f. +// +// Solidity: function balances(address , address ) view returns(uint256) +func (_Vault *VaultCallerSession) Balances(arg0 common.Address, arg1 common.Address) (*big.Int, error) { + return _Vault.Contract.Balances(&_Vault.CallOpts, arg0, arg1) +} + +// Deposit is a paid mutator transaction binding the contract method 0x47e7ef24. +// +// Solidity: function deposit(address tokenAddress, uint256 amount) returns() +func (_Vault *VaultTransactor) Deposit(opts *bind.TransactOpts, tokenAddress common.Address, amount *big.Int) (*types.Transaction, error) { + return _Vault.contract.Transact(opts, "deposit", tokenAddress, amount) +} + +// Deposit is a paid mutator transaction binding the contract method 0x47e7ef24. +// +// Solidity: function deposit(address tokenAddress, uint256 amount) returns() +func (_Vault *VaultSession) Deposit(tokenAddress common.Address, amount *big.Int) (*types.Transaction, error) { + return _Vault.Contract.Deposit(&_Vault.TransactOpts, tokenAddress, amount) +} + +// Deposit is a paid mutator transaction binding the contract method 0x47e7ef24. +// +// Solidity: function deposit(address tokenAddress, uint256 amount) returns() +func (_Vault *VaultTransactorSession) Deposit(tokenAddress common.Address, amount *big.Int) (*types.Transaction, error) { + return _Vault.Contract.Deposit(&_Vault.TransactOpts, tokenAddress, amount) +} + +// Withdraw is a paid mutator transaction binding the contract method 0xf3fef3a3. +// +// Solidity: function withdraw(address tokenAddress, uint256 amount) returns() +func (_Vault *VaultTransactor) Withdraw(opts *bind.TransactOpts, tokenAddress common.Address, amount *big.Int) (*types.Transaction, error) { + return _Vault.contract.Transact(opts, "withdraw", tokenAddress, amount) +} + +// Withdraw is a paid mutator transaction binding the contract method 0xf3fef3a3. +// +// Solidity: function withdraw(address tokenAddress, uint256 amount) returns() +func (_Vault *VaultSession) Withdraw(tokenAddress common.Address, amount *big.Int) (*types.Transaction, error) { + return _Vault.Contract.Withdraw(&_Vault.TransactOpts, tokenAddress, amount) +} + +// Withdraw is a paid mutator transaction binding the contract method 0xf3fef3a3. +// +// Solidity: function withdraw(address tokenAddress, uint256 amount) returns() +func (_Vault *VaultTransactorSession) Withdraw(tokenAddress common.Address, amount *big.Int) (*types.Transaction, error) { + return _Vault.Contract.Withdraw(&_Vault.TransactOpts, tokenAddress, amount) +} diff --git a/contrib/localnet/orchestrator/smoketest/contracts/vault/Vault.json b/contrib/localnet/orchestrator/smoketest/contracts/vault/Vault.json new file mode 100644 index 0000000000..cf3757becc --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/contracts/vault/Vault.json @@ -0,0 +1,65 @@ +{ + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balances", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bin": "608060405234801561001057600080fd5b50610904806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806347e7ef2414610046578063c23f001f14610062578063f3fef3a314610092575b600080fd5b610060600480360381019061005b9190610564565b6100ae565b005b61007c600480360381019061007791906105a4565b61024c565b60405161008991906105f3565b60405180910390f35b6100ac60048036038101906100a79190610564565b610271565b005b600081116100f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100e89061066b565b60405180910390fd5b60008290508073ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b81526004016101339392919061069a565b6020604051808303816000875af1158015610152573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101769190610709565b6101b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ac90610782565b60405180910390fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461024091906107d1565b92505081905550505050565b6000602052816000526040600020602052806000526040600020600091509150505481565b600081116102b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102ab9061066b565b60405180910390fd5b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610372576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161036990610851565b60405180910390fd5b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546103fd9190610871565b9250508190555060008290508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846040518363ffffffff1660e01b81526004016104449291906108a5565b6020604051808303816000875af1158015610463573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104879190610709565b6104c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104bd90610782565b60405180910390fd5b505050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006104fb826104d0565b9050919050565b61050b816104f0565b811461051657600080fd5b50565b60008135905061052881610502565b92915050565b6000819050919050565b6105418161052e565b811461054c57600080fd5b50565b60008135905061055e81610538565b92915050565b6000806040838503121561057b5761057a6104cb565b5b600061058985828601610519565b925050602061059a8582860161054f565b9150509250929050565b600080604083850312156105bb576105ba6104cb565b5b60006105c985828601610519565b92505060206105da85828601610519565b9150509250929050565b6105ed8161052e565b82525050565b600060208201905061060860008301846105e4565b92915050565b600082825260208201905092915050565b7f416d6f756e742073686f756c642062652067726561746572207468616e203000600082015250565b6000610655601f8361060e565b91506106608261061f565b602082019050919050565b6000602082019050818103600083015261068481610648565b9050919050565b610694816104f0565b82525050565b60006060820190506106af600083018661068b565b6106bc602083018561068b565b6106c960408301846105e4565b949350505050565b60008115159050919050565b6106e6816106d1565b81146106f157600080fd5b50565b600081519050610703816106dd565b92915050565b60006020828403121561071f5761071e6104cb565b5b600061072d848285016106f4565b91505092915050565b7f5472616e73666572206661696c65640000000000000000000000000000000000600082015250565b600061076c600f8361060e565b915061077782610736565b602082019050919050565b6000602082019050818103600083015261079b8161075f565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006107dc8261052e565b91506107e78361052e565b92508282019050808211156107ff576107fe6107a2565b5b92915050565b7f496e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b600061083b60148361060e565b915061084682610805565b602082019050919050565b6000602082019050818103600083015261086a8161082e565b9050919050565b600061087c8261052e565b91506108878361052e565b925082820390508181111561089f5761089e6107a2565b5b92915050565b60006040820190506108ba600083018561068b565b6108c760208301846105e4565b939250505056fea2646970667358221220a4c5411c946fad1845e3d501f7c432ddc24537e71ab463a59742ccbcc57c107264736f6c63430008150033" +} diff --git a/contrib/localnet/orchestrator/smoketest/contracts/vault/Vault.sol b/contrib/localnet/orchestrator/smoketest/contracts/vault/Vault.sol new file mode 100644 index 0000000000..394c5ecc4e --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/contracts/vault/Vault.sol @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.7; + +interface IERC20 { + function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); + function transfer(address recipient, uint256 amount) external returns (bool); + function balanceOf(address account) external view returns (uint256); +} + +// Sample contract that locks and unlocks tokens +contract Vault { + mapping(address => mapping(address => uint256)) public balances; + + function deposit(address tokenAddress, uint256 amount) external { + require(amount > 0, "Amount should be greater than 0"); + + IERC20 token = IERC20(tokenAddress); + require(token.transferFrom(msg.sender, address(this), amount), "Transfer failed"); + + balances[msg.sender][tokenAddress] += amount; + } + + function withdraw(address tokenAddress, uint256 amount) external { + require(amount > 0, "Amount should be greater than 0"); + require(balances[msg.sender][tokenAddress] >= amount, "Insufficient balance"); + + balances[msg.sender][tokenAddress] -= amount; + + IERC20 token = IERC20(tokenAddress); + require(token.transfer(msg.sender, amount), "Transfer failed"); + } +} \ No newline at end of file diff --git a/contrib/localnet/orchestrator/smoketest/contracts/vault/bindings.go b/contrib/localnet/orchestrator/smoketest/contracts/vault/bindings.go new file mode 100644 index 0000000000..99e71fb736 --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/contracts/vault/bindings.go @@ -0,0 +1,6 @@ +//go:generate sh -c "solc --evm-version paris Vault.sol --combined-json abi,bin | jq '.contracts.\"Vault.sol:Vault\"' > Vault.json" +//go:generate sh -c "cat Vault.json | jq .abi > Vault.abi" +//go:generate sh -c "cat Vault.json | jq .bin | tr -d '\"' > Vault.bin" +//go:generate sh -c "abigen --abi Vault.abi --bin Vault.bin --pkg vault --type Vault --out Vault.go" + +package vault diff --git a/contrib/localnet/orchestrator/smoketest/main.go b/contrib/localnet/orchestrator/smoketest/main.go index 21e26e630b..2939ea2181 100644 --- a/contrib/localnet/orchestrator/smoketest/main.go +++ b/contrib/localnet/orchestrator/smoketest/main.go @@ -8,42 +8,34 @@ import ( "fmt" "math/big" "os" - "sync" "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/spf13/cobra" - "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/contracts/contextapp" - "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/contracts/zevmswap" - observertypes "github.com/zeta-chain/zetacore/x/observer/types" - "github.com/zeta-chain/zetacore/zetaclient/config" - - "github.com/btcsuite/btcd/rpcclient" "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" - 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" - systemcontract "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/systemcontract.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" - "github.com/zeta-chain/zetacore/x/crosschain/types" + "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) - BLOCK = 2 * time.Second // should be 2x block time BigZero = big.NewInt(0) SmokeTestTimeout = 24 * time.Hour // smoke test fails if timeout is reached USDTZRC20Addr = "0x48f80608B672DC30DC7e3dbBd0343c5F02C738Eb" @@ -54,50 +46,13 @@ var ( //SystemContractAddr = "0x91d18e54DAf4F677cB28167158d6dd21F6aB3921" //ZEVMSwapAppAddr = "0x65a45c57636f9BcCeD4fe193A602008578BcA90b" HexToAddress = ethcommon.HexToAddress -) -type SmokeTest struct { - zevmClient *ethclient.Client - goerliClient *ethclient.Client - btcRPCClient *rpcclient.Client - - cctxClient types.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 - - ERC20CustodyAddr ethcommon.Address - ERC20Custody *erc20custody.ERC20Custody - USDTERC20Addr ethcommon.Address - USDTERC20 *erc20.USDT - USDTZRC20Addr ethcommon.Address - USDTZRC20 *zrc20.ZRC20 - ETHZRC20Addr ethcommon.Address - ETHZRC20 *zrc20.ZRC20 - BTCZRC20Addr ethcommon.Address - BTCZRC20 *zrc20.ZRC20 - UniswapV2FactoryAddr ethcommon.Address - UniswapV2Factory *uniswapv2factory.UniswapV2Factory - UniswapV2RouterAddr ethcommon.Address - UniswapV2Router *uniswapv2router.UniswapV2Router02 - TestDAppAddr ethcommon.Address - ZEVMSwapAppAddr ethcommon.Address - ZEVMSwapApp *zevmswap.ZEVMSwapApp - ContextAppAddr ethcommon.Address - ContextApp *contextapp.ContextApp - - SystemContract *systemcontract.SystemContract - SystemContractAddr ethcommon.Address -} + // 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", @@ -110,58 +65,21 @@ var LocalCmd = &cobra.Command{ Run: LocalSmokeTest, } -func init() { - RootCmd.AddCommand(LocalCmd) +type localArgs struct { + contractsDeployed bool } -func NewSmokeTest(goerliClient *ethclient.Client, zevmClient *ethclient.Client, - cctxClient types.QueryClient, fungibleClient fungibletypes.QueryClient, - authClient authtypes.QueryClient, bankClient banktypes.QueryClient, observerClient observertypes.QueryClient, - 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) +var localTestArgs = localArgs{} - SystemContract, err := systemcontract.NewSystemContract(HexToAddress(systemContractAddr.SystemContract.SystemContract), zevmClient) - if err != nil { - panic(err) - } - SystemContractAddr := HexToAddress(systemContractAddr.SystemContract.SystemContract) - - response := &types.QueryGetTssAddressResponse{} - for { - response, err = cctxClient.GetTssAddress(context.Background(), &types.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 - } +func init() { + RootCmd.AddCommand(LocalCmd) + LocalCmd.Flags().BoolVar(&localTestArgs.contractsDeployed, "deployed", false, "set to to true if running smoketest again with existing state") +} - 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, - cctxClient: cctxClient, - fungibleClient: fungibleClient, - authClient: authClient, - bankClient: bankClient, - observerClient: observerClient, - wg: sync.WaitGroup{}, - goerliAuth: goerliAuth, - zevmAuth: zevmAuth, - btcRPCClient: btcRPCClient, - SystemContract: SystemContract, - SystemContractAddr: SystemContractAddr, +func main() { + if err := RootCmd.Execute(); err != nil { + fmt.Println(err) + os.Exit(-1) } } @@ -176,6 +94,12 @@ func LocalSmokeTest(_ *cobra.Command, _ []string) { os.Exit(1) }() + // 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", @@ -218,17 +142,27 @@ func LocalSmokeTest(_ *cobra.Command, _ []string) { panic(err) } - cctxClient := types.NewQueryClient(grpcConn) + cctxClient := crosschaintypes.NewQueryClient(grpcConn) fungibleClient := fungibletypes.NewQueryClient(grpcConn) authClient := authtypes.NewQueryClient(grpcConn) bankClient := banktypes.NewQueryClient(grpcConn) observerClient := observertypes.NewQueryClient(grpcConn) + // initialize client to send messages to ZetaChain + zetaTxServer, err := NewZetaTxServer( + "http://zetacore0:26657", + []string{FungibleAdminName}, + []string{FungibleAdminMnemonic}, + ) + if err != nil { + panic(err) + } + // 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{}) + response, err := cctxClient.LastZetaHeight(context.Background(), &crosschaintypes.QueryLastZetaHeightRequest{}) if err != nil { fmt.Printf("cctxClient.LastZetaHeight error: %s", err) continue @@ -259,7 +193,19 @@ func LocalSmokeTest(_ *cobra.Command, _ []string) { panic(err) } - smokeTest := NewSmokeTest(goerliClient, zevmClient, cctxClient, fungibleClient, authClient, bankClient, observerClient, goerliAuth, zevmAuth, btcRPCClient) + 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 ==================== @@ -286,7 +232,7 @@ func LocalSmokeTest(_ *cobra.Command, _ []string) { smokeTest.ZEVMSwapAppAddr = zevmSwapAppAddr smokeTest.ZEVMSwapApp = zevmSwapApp - // test system contract context upgrade + //test system contract context upgrade contextAppAddr, tx, _, err := contextapp.DeployContextApp(smokeTest.zevmAuth, smokeTest.zevmClient) if err != nil { panic(err) @@ -310,6 +256,7 @@ func LocalSmokeTest(_ *cobra.Command, _ []string) { 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() @@ -348,48 +295,11 @@ func LocalSmokeTest(_ *cobra.Command, _ []string) { smokeTest.TestMessagePassingRevertSuccess() smokeTest.CheckZRC20ReserveAndSupply() + smokeTest.TestPauseZRC20() + smokeTest.CheckZRC20ReserveAndSupply() + // add your dev test here smokeTest.TestMyTest() - //{ - // LoudPrintf("Test ZRC20 blocked methods\n") - // sampleZRC20, err := zrc20.NewZRC20(smokeTest.USDTZRC20Addr, zevmClient) - // if err != nil { - // panic(err) - // } - // - // _, err = sampleZRC20.Approve(smokeTest.zevmAuth, smokeTest.ERC20CustodyAddr, big.NewInt(1000000)) - // if err != nil { - // panic(err) - // } - // tx, err := sampleZRC20.IncreaseAllowance(smokeTest.zevmAuth, smokeTest.ERC20CustodyAddr, big.NewInt(1000000)) - // if err != nil { - // panic(err) - // } - // receipt := MustWaitForTxReceipt(zevmClient, tx) - // if receipt.Status != 0 { - // panic("IncreaseAllowance should be blocked!") - // } else { - // fmt.Printf("IncreaseAllowance is blocked as expected\n") - // } - // tx, err = sampleZRC20.DecreaseAllowance(smokeTest.zevmAuth, smokeTest.ERC20CustodyAddr, big.NewInt(1000000)) - // if err != nil { - // panic(err) - // } - // receipt = MustWaitForTxReceipt(zevmClient, tx) - // if receipt.Status != 0 { - // panic("IncreaseAllowance should be blocked!") - // } else { - // fmt.Printf("IncreaseAllowance is blocked as expected\n") - // } - //} - smokeTest.wg.Wait() } - -func main() { - if err := RootCmd.Execute(); err != nil { - fmt.Println(err) - os.Exit(-1) - } -} diff --git a/contrib/localnet/orchestrator/smoketest/smoketest.go b/contrib/localnet/orchestrator/smoketest/smoketest.go new file mode 100644 index 0000000000..de9146bb3f --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/smoketest.go @@ -0,0 +1,137 @@ +//go:build PRIVNET +// +build PRIVNET + +package main + +import ( + "context" + "fmt" + "sync" + "time" + + "github.com/btcsuite/btcd/rpcclient" + "github.com/btcsuite/btcutil" + 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/ethclient" + "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/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/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" + 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 + + ERC20CustodyAddr ethcommon.Address + ERC20Custody *erc20custody.ERC20Custody + USDTERC20Addr ethcommon.Address + USDTERC20 *erc20.USDT + USDTZRC20Addr ethcommon.Address + USDTZRC20 *zrc20.ZRC20 + ETHZRC20Addr ethcommon.Address + ETHZRC20 *zrc20.ZRC20 + BTCZRC20Addr ethcommon.Address + BTCZRC20 *zrc20.ZRC20 + UniswapV2FactoryAddr ethcommon.Address + UniswapV2Factory *uniswapv2factory.UniswapV2Factory + UniswapV2RouterAddr ethcommon.Address + UniswapV2Router *uniswapv2router.UniswapV2Router02 + TestDAppAddr ethcommon.Address + ZEVMSwapAppAddr ethcommon.Address + ZEVMSwapApp *zevmswap.ZEVMSwapApp + ContextAppAddr ethcommon.Address + ContextApp *contextapp.ContextApp + + SystemContract *systemcontract.SystemContract + SystemContractAddr ethcommon.Address +} + +func NewSmokeTest( + goerliClient *ethclient.Client, + zevmClient *ethclient.Client, + cctxClient crosschaintypes.QueryClient, + zetaTxServer ZetaTxServer, + fungibleClient fungibletypes.QueryClient, + authClient authtypes.QueryClient, + bankClient banktypes.QueryClient, + observerClient observertypes.QueryClient, + 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) + + 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 + } + + 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, + } +} diff --git a/contrib/localnet/orchestrator/smoketest/test_bitcoin.go b/contrib/localnet/orchestrator/smoketest/test_bitcoin.go index bab484ec4a..736a2a1bfc 100644 --- a/contrib/localnet/orchestrator/smoketest/test_bitcoin.go +++ b/contrib/localnet/orchestrator/smoketest/test_bitcoin.go @@ -8,6 +8,7 @@ import ( "encoding/hex" "fmt" "math/big" + "strings" "time" "github.com/btcsuite/btcd/btcec" @@ -39,8 +40,11 @@ func (sm *SmokeTest) TestBitcoinSetup() { btc := sm.btcRPCClient _, err := btc.CreateWallet("smoketest", rpcclient.WithCreateWalletBlank()) if err != nil { - panic(err) + if !strings.Contains(err.Error(), "Database already exists") { + panic(err) + } } + skBytes, err := hex.DecodeString(DeployerPrivateKey) if err != nil { panic(err) @@ -153,6 +157,7 @@ func (sm *SmokeTest) DepositBTC() { } 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 { diff --git a/contrib/localnet/orchestrator/smoketest/test_crosschain_swap.go b/contrib/localnet/orchestrator/smoketest/test_crosschain_swap.go index 8c51b71d09..d4e5c5c604 100644 --- a/contrib/localnet/orchestrator/smoketest/test_crosschain_swap.go +++ b/contrib/localnet/orchestrator/smoketest/test_crosschain_swap.go @@ -9,9 +9,8 @@ import ( "time" "github.com/btcsuite/btcd/chaincfg/chainhash" - "github.com/zeta-chain/zetacore/x/crosschain/types" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/zeta-chain/zetacore/x/crosschain/types" ) func (sm *SmokeTest) TestCrosschainSwap() { @@ -29,22 +28,27 @@ func (sm *SmokeTest) TestCrosschainSwap() { WaitCctxMinedByInTxHash(txhash.Hex(), sm.cctxClient) sm.zevmAuth.GasLimit = 10000000 - tx, err := sm.UniswapV2Factory.CreatePair(sm.zevmAuth, sm.USDTZRC20Addr, sm.BTCZRC20Addr) - if err != nil { - panic(err) + if !localTestArgs.contractsDeployed { + tx, err := sm.UniswapV2Factory.CreatePair(sm.zevmAuth, sm.USDTZRC20Addr, sm.BTCZRC20Addr) + if err != nil { + panic(err) + } + receipt := MustWaitForTxReceipt(sm.zevmClient, tx) + + fmt.Printf("USDT-BTC pair receipt txhash %s status %d\n", receipt.TxHash, receipt.Status) } - receipt := MustWaitForTxReceipt(sm.zevmClient, tx) + usdtBtcPair, err := sm.UniswapV2Factory.GetPair(&bind.CallOpts{}, sm.USDTZRC20Addr, sm.BTCZRC20Addr) if err != nil { panic(err) } - fmt.Printf("USDT-BTC pair receipt txhash %s status %d pair addr %s\n", receipt.TxHash, receipt.Status, usdtBtcPair.Hex()) + 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 := 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)) @@ -59,7 +63,7 @@ func (sm *SmokeTest) TestCrosschainSwap() { if err != nil { panic(err) } - fmt.Printf("balance of deployer on BTC ZRC20: %d\n", bal) + fmt.Printf("balance of deployer on USDT ZRC20: %d\n", bal) bal, err = sm.USDTZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) if err != nil { panic(err) diff --git a/contrib/localnet/orchestrator/smoketest/test_deposit_eth.go b/contrib/localnet/orchestrator/smoketest/test_deposit_eth.go index f44fcb44aa..b65fdb5691 100644 --- a/contrib/localnet/orchestrator/smoketest/test_deposit_eth.go +++ b/contrib/localnet/orchestrator/smoketest/test_deposit_eth.go @@ -71,9 +71,6 @@ func (sm *SmokeTest) TestDepositEtherIntoZRC20() { }() sm.wg.Add(1) go func() { - defer sm.wg.Done() - <-c - systemContract := sm.SystemContract if err != nil { panic(err) @@ -89,14 +86,23 @@ func (sm *SmokeTest) TestDepositEtherIntoZRC20() { panic(err) } sm.ETHZRC20 = ethZRC20 - ethZRC20Balance, err := ethZRC20.BalanceOf(nil, DeployerAddress) + initialBalance, err := ethZRC20.BalanceOf(nil, DeployerAddress) if err != nil { panic(err) } - fmt.Printf("eth zrc20 balance: %s\n", ethZRC20Balance.String()) - if ethZRC20Balance.Cmp(value) != 0 { - fmt.Printf("eth zrc20 bal wanted %d, got %d\n", value, ethZRC20Balance) + 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") } diff --git a/contrib/localnet/orchestrator/smoketest/test_erc20.go b/contrib/localnet/orchestrator/smoketest/test_erc20.go index fd8c177716..d70b73cbf5 100644 --- a/contrib/localnet/orchestrator/smoketest/test_erc20.go +++ b/contrib/localnet/orchestrator/smoketest/test_erc20.go @@ -21,23 +21,29 @@ func (sm *SmokeTest) TestERC20Deposit() { fmt.Printf("test finishes in %s\n", time.Since(startTime)) }() LoudPrintf("Deposit USDT ERC20 into ZEVM\n") - txhash := sm.DepositERC20(big.NewInt(1e9), []byte{}) - WaitCctxMinedByInTxHash(txhash.Hex(), sm.cctxClient) - usdtZRC20, err := zrc20.NewZRC20(ethcommon.HexToAddress(USDTZRC20Addr), sm.zevmClient) + + initialBal, err := sm.USDTZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) if err != nil { panic(err) } - bal, err := usdtZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress) + 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 := usdtZRC20.TotalSupply(&bind.CallOpts{}) + supply, err := sm.USDTZRC20.TotalSupply(&bind.CallOpts{}) if err != nil { panic(err) } fmt.Printf("supply of USDT ZRC20: %d\n", supply) - if bal.Int64() != 1e9 { + if diff.Int64() != 1e9 { panic("balance is not correct") } } @@ -108,9 +114,6 @@ func (sm *SmokeTest) WithdrawERC20() { panic(err) } fmt.Printf("supply of USDT ZRC20: %d\n", supply) - if bal.Int64() != 1e9 { - panic("balance is not correct") - } gasZRC20, gasFee, err := usdtZRC20.WithdrawGasFee(&bind.CallOpts{}) if err != nil { diff --git a/contrib/localnet/orchestrator/smoketest/test_pause_zrc20.go b/contrib/localnet/orchestrator/smoketest/test_pause_zrc20.go new file mode 100644 index 0000000000..f0d0f43c8b --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/test_pause_zrc20.go @@ -0,0 +1,180 @@ +//go:build PRIVNET +// +build PRIVNET + +package main + +import ( + "context" + "fmt" + "math/big" + "time" + + "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/contracts/vault" + "github.com/zeta-chain/zetacore/testutil/sample" + fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" +) + +func (sm *SmokeTest) TestPauseZRC20() { + LoudPrintf("Test ZRC20 pause\n") + startTime := time.Now() + defer func() { + fmt.Printf("test finishes in %s\n", time.Since(startTime)) + }() + + // Setup vault used to test zrc20 interactions + fmt.Println("Deploying vault") + 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)) + if err != nil { + panic(err) + } + receipt := MustWaitForTxReceipt(sm.zevmClient, tx) + if receipt.Status == 0 { + panic("Vault approval should succeed") + } + tx, err = sm.BTCZRC20.Approve(sm.zevmAuth, vaultAddr, big.NewInt(1e18)) + if err != nil { + panic(err) + } + receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + if receipt.Status == 0 { + panic("Vault approval should succeed") + } + + // Pause ETH ZRC20 + fmt.Println("Pausing ETH") + msg := fungibletypes.NewMsgUpdateZRC20PausedStatus( + FungibleAdminAddress, + []string{sm.ETHZRC20Addr.Hex()}, + fungibletypes.UpdatePausedStatusAction_PAUSE, + ) + res, err := sm.zetaTxServer.BroadcastTx(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{ + Index: sm.ETHZRC20Addr.Hex(), + }) + if err != nil { + panic(err) + } + if !fcRes.GetForeignCoins().Paused { + panic("ETH should be paused") + } else { + 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)) + if err != nil { + panic(err) + } + receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + if receipt.Status == 1 { + panic("transfer should fail") + } + tx, err = sm.ETHZRC20.Burn(sm.zevmAuth, big.NewInt(1e5)) + if err != nil { + panic(err) + } + receipt = 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)) + if err != nil { + panic(err) + } + receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + if receipt.Status == 1 { + panic("deposit should fail") + } + fmt.Println("Operations all failed") + + // 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)) + if err != nil { + panic(err) + } + receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + if receipt.Status == 0 { + panic("BTC transfer should succeed") + } + tx, err = vaultContract.Deposit(sm.zevmAuth, sm.BTCZRC20Addr, big.NewInt(1e3)) + if err != nil { + panic(err) + } + receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + if receipt.Status == 0 { + panic("BTC vault deposit should succeed") + } + + // Unpause ETH ZRC20 + fmt.Println("Unpausing ETH") + msg = fungibletypes.NewMsgUpdateZRC20PausedStatus( + FungibleAdminAddress, + []string{sm.ETHZRC20Addr.Hex()}, + fungibletypes.UpdatePausedStatusAction_UNPAUSE, + ) + res, err = sm.zetaTxServer.BroadcastTx(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{ + Index: sm.ETHZRC20Addr.Hex(), + }) + if err != nil { + panic(err) + } + if fcRes.GetForeignCoins().Paused { + panic("ETH should be unpaused") + } else { + 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)) + if err != nil { + panic(err) + } + receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + if receipt.Status == 0 { + panic("transfer should succeed") + } + tx, err = sm.ETHZRC20.Burn(sm.zevmAuth, big.NewInt(1e5)) + if err != nil { + panic(err) + } + receipt = 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)) + if err != nil { + panic(err) + } + receipt = MustWaitForTxReceipt(sm.zevmClient, tx) + if receipt.Status == 0 { + panic("deposit should succeed") + } + + fmt.Println("Operations all succeeded") +} diff --git a/contrib/localnet/orchestrator/smoketest/test_setup.go b/contrib/localnet/orchestrator/smoketest/test_setup.go index e09e254030..1a77089023 100644 --- a/contrib/localnet/orchestrator/smoketest/test_setup.go +++ b/contrib/localnet/orchestrator/smoketest/test_setup.go @@ -7,8 +7,10 @@ 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" @@ -24,28 +26,43 @@ import ( 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 - chainid, err := goerliClient.ChainID(context.Background()) - if err != nil { - panic(err) - } - deployerPrivkey, err := crypto.HexToECDSA(DeployerPrivateKey) + auth := sm.getDeployerAuth() + + LoudPrintf("Deploy ZetaETH ConnectorETH ERC20Custody USDT\n") + + initialNonce, err := goerliClient.PendingNonceAt(context.Background(), DeployerAddress) if err != nil { panic(err) } - auth, err := bind.NewKeyedTransactorWithChainID(deployerPrivkey, chainid) + + res, err := sm.fungibleClient.ForeignCoinsAll(context.Background(), &fungibletypes.QueryAllForeignCoinsRequest{}) if err != nil { panic(err) } - LoudPrintf("Deploy ZetaETH ConnectorETH ERC20Custody USDT\n") - if err := CheckNonce(goerliClient, DeployerAddress, 0); err != nil { + 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)) @@ -57,8 +74,9 @@ func (sm *SmokeTest) TestSetupZetaTokenAndConnectorAndZEVMContracts() { 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, 1); err != nil { + if err := CheckNonce(goerliClient, DeployerAddress, initialNonce+1); err != nil { panic(err) } connectorEthAddr, tx, ConnectorEth, err := zetaconnectoreth.DeployZetaConnectorEth(auth, goerliClient, zetaEthAddr, @@ -71,10 +89,11 @@ func (sm *SmokeTest) TestSetupZetaTokenAndConnectorAndZEVMContracts() { 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, 2); err != nil { + 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")) @@ -87,11 +106,12 @@ func (sm *SmokeTest) TestSetupZetaTokenAndConnectorAndZEVMContracts() { 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, 3); err != nil { + if err := CheckNonce(goerliClient, DeployerAddress, initialNonce+3); err != nil { panic(err) } usdtAddr, tx, _, err := erc20.DeployUSDT(auth, goerliClient, "USDT", "USDT", 6) @@ -104,6 +124,7 @@ func (sm *SmokeTest) TestSetupZetaTokenAndConnectorAndZEVMContracts() { 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 { @@ -121,14 +142,14 @@ func (sm *SmokeTest) TestSetupZetaTokenAndConnectorAndZEVMContracts() { 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{}) + res, err = fungibleClient.ForeignCoinsAll(context.Background(), &fungibletypes.QueryAllForeignCoinsRequest{}) if err != nil { panic(err) } found := false zrc20addr := "" for _, fcoin := range res.ForeignCoins { - if ethcommon.HexToAddress(fcoin.Asset) == usdtAddr { + if fcoin.Asset == USDTERC20Addr { found = true zrc20addr = fcoin.Zrc20ContractAddress } @@ -141,6 +162,7 @@ func (sm *SmokeTest) TestSetupZetaTokenAndConnectorAndZEVMContracts() { 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 { @@ -164,16 +186,102 @@ func (sm *SmokeTest) TestSetupZetaTokenAndConnectorAndZEVMContracts() { panic(err) } + fmt.Printf("UniswapV2FactoryAddr: %s, UniswapV2RouterAddr: %s", sm.UniswapV2FactoryAddr.String(), sm.UniswapV2RouterAddr.String()) + // deploy TestDApp contract //auth.GasLimit = 1_000_000 - appAddr, tx, _, err := testdapp.DeployTestDApp(auth, goerliClient, sm.ConnectorEthAddr, sm.ZetaEthAddr) + 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(goerliClient, tx) + 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, goerliClient) + dapp, err := testdapp.NewTestDApp(receipt.ContractAddress, sm.goerliClient) if err != nil { panic(err) } @@ -195,5 +303,20 @@ func (sm *SmokeTest) TestSetupZetaTokenAndConnectorAndZEVMContracts() { } } 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 index 46e4f35f7c..a927f3588a 100644 --- a/contrib/localnet/orchestrator/smoketest/test_stress.go +++ b/contrib/localnet/orchestrator/smoketest/test_stress.go @@ -143,7 +143,19 @@ func StressTest(_ *cobra.Command, _ []string) { panic(err) } - smokeTest := NewSmokeTest(goerliClient, zevmClient, cctxClient, fungibleClient, authClient, bankClient, observerClient, goerliAuth, zevmAuth, nil) + 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.local { diff --git a/contrib/localnet/orchestrator/smoketest/test_zeta_in_and_out.go b/contrib/localnet/orchestrator/smoketest/test_zeta_in_and_out.go index 01bd1b5f7a..ced758bad6 100644 --- a/contrib/localnet/orchestrator/smoketest/test_zeta_in_and_out.go +++ b/contrib/localnet/orchestrator/smoketest/test_zeta_in_and_out.go @@ -62,14 +62,21 @@ func (sm *SmokeTest) TestSendZetaIn() { 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()) + 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) - if bal.Cmp(amount) == 0 { + diff := big.NewInt(0) + diff.Sub(bal, initialBal) + + if diff.Cmp(amount) == 0 { fmt.Printf("Expected zeta balance; success!\n") break } diff --git a/contrib/localnet/orchestrator/smoketest/test_zrc20_swap.go b/contrib/localnet/orchestrator/smoketest/test_zrc20_swap.go index a2beaf3d6a..67452cfacf 100644 --- a/contrib/localnet/orchestrator/smoketest/test_zrc20_swap.go +++ b/contrib/localnet/orchestrator/smoketest/test_zrc20_swap.go @@ -18,22 +18,27 @@ func (sm *SmokeTest) TestZRC20Swap() { fmt.Printf("test finishes in %s\n", time.Since(startTime)) }() LoudPrintf("Swap ZRC20 USDT for ZRC20 ETH\n") - tx, err := sm.UniswapV2Factory.CreatePair(sm.zevmAuth, sm.USDTZRC20Addr, sm.ETHZRC20Addr) - if err != nil { - panic(err) + 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) } - receipt := MustWaitForTxReceipt(sm.zevmClient, tx) + usdtEthPair, err := sm.UniswapV2Factory.GetPair(&bind.CallOpts{}, sm.USDTZRC20Addr, sm.ETHZRC20Addr) if err != nil { panic(err) } - fmt.Printf("USDT-ETH pair receipt txhash %s status %d pair addr %s\n", receipt.TxHash, receipt.Status, usdtEthPair.Hex()) + fmt.Printf("USDT-ETH pair receipt pair addr %s\n", usdtEthPair.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 := 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)) diff --git a/contrib/localnet/orchestrator/smoketest/utils.go b/contrib/localnet/orchestrator/smoketest/utils.go index 6ac92e92b0..735d2d305a 100644 --- a/contrib/localnet/orchestrator/smoketest/utils.go +++ b/contrib/localnet/orchestrator/smoketest/utils.go @@ -23,7 +23,7 @@ import ( ethcommon "github.com/ethereum/go-ethereum/common" ) -// wait until cctx is mined; returns the cctxIndex (the last one) +// WaitCctxMinedByInTxHash waits until cctx is mined; returns the cctxIndex (the last one) func WaitCctxMinedByInTxHash(inTxHash string, cctxClient types.QueryClient) *types.CrossChainTx { var cctxIndexes []string for { @@ -82,7 +82,7 @@ func CheckNonce(client *ethclient.Client, addr ethcommon.Address, expectedNonce return nil } -// wait until a broadcasted tx to be mined and return its receipt +// 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() @@ -104,7 +104,7 @@ func MustWaitForTxReceipt(client *ethclient.Client, tx *ethtypes.Transaction) *e } } -// scriptPK is a hex string for P2WPKH script +// ScriptPKToAddress is a hex string for P2WPKH script func ScriptPKToAddress(scriptPKHex string) string { pkh, err := hex.DecodeString(scriptPKHex[4:]) if err == nil { diff --git a/contrib/localnet/orchestrator/smoketest/zeta_tx_server.go b/contrib/localnet/orchestrator/smoketest/zeta_tx_server.go new file mode 100644 index 0000000000..fac36b10fb --- /dev/null +++ b/contrib/localnet/orchestrator/smoketest/zeta_tx_server.go @@ -0,0 +1,190 @@ +//go:build PRIVNET +// +build PRIVNET + +package main + +import ( + "context" + "errors" + "fmt" + "os" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "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" + sdktypes "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/tx/signing" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/authz" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" + 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" + etherminttypes "github.com/evmos/ethermint/types" + evmtypes "github.com/evmos/ethermint/x/evm/types" + rpchttp "github.com/tendermint/tendermint/rpc/client/http" + 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" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" +) + +// ZetaTxServer is a ZetaChain tx server for smoke test +type ZetaTxServer struct { + clientCtx client.Context + txFactory tx.Factory +} + +// NewZetaTxServer returns a new TxServer with provided account +func NewZetaTxServer(rpcAddr string, names []string, mnemonics []string) (ZetaTxServer, error) { + ctx := context.Background() + + if len(names) != len(mnemonics) { + return ZetaTxServer{}, errors.New("invalid names and mnemonics") + } + + // initialize rpc and check status + rpc, err := rpchttp.New(rpcAddr, "/websocket") + if err != nil { + return ZetaTxServer{}, fmt.Errorf("failed to initialize rpc: %s", err.Error()) + } + if _, err = rpc.Status(ctx); err != nil { + return ZetaTxServer{}, fmt.Errorf("failed to query rpc: %s", err.Error()) + } + + // initialize codec + cdc, reg := newCodec() + + // initialize keyring + kr := keyring.NewInMemory(cdc) + + // 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() + 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(), + //) + } + + clientCtx := newContext(rpc, cdc, reg, kr) + txf := newFactory(clientCtx) + + return ZetaTxServer{ + clientCtx: clientCtx, + txFactory: txf, + }, nil +} + +// 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 + acc, err := zts.clientCtx.Keyring.Key(account) + if err != nil { + return nil, err + } + addr, err := acc.GetAddress() + if err != nil { + return nil, err + } + accountNumber, accountSeq, err := zts.clientCtx.AccountRetriever.GetAccountNumberSequence(zts.clientCtx, addr) + if err != nil { + return nil, err + } + zts.txFactory = zts.txFactory.WithAccountNumber(accountNumber).WithSequence(accountSeq) + + txBuilder, err := zts.txFactory.BuildUnsignedTx(msg) + if err != nil { + return nil, err + } + + // Sign tx + err = tx.Sign(zts.txFactory, account, txBuilder, true) + if err != nil { + return nil, err + } + txBytes, err := zts.clientCtx.TxConfig.TxEncoder()(txBuilder.GetTx()) + if err != nil { + return nil, err + } + + // Broadcast tx + return zts.clientCtx.BroadcastTx(txBytes) +} + +// newCodec returns the codec for msg server +func newCodec() (*codec.ProtoCodec, codectypes.InterfaceRegistry) { + interfaceRegistry := codectypes.NewInterfaceRegistry() + cdc := codec.NewProtoCodec(interfaceRegistry) + + sdktypes.RegisterInterfaces(interfaceRegistry) + cryptocodec.RegisterInterfaces(interfaceRegistry) + authtypes.RegisterInterfaces(interfaceRegistry) + authz.RegisterInterfaces(interfaceRegistry) + banktypes.RegisterInterfaces(interfaceRegistry) + stakingtypes.RegisterInterfaces(interfaceRegistry) + slashingtypes.RegisterInterfaces(interfaceRegistry) + upgradetypes.RegisterInterfaces(interfaceRegistry) + distrtypes.RegisterInterfaces(interfaceRegistry) + evidencetypes.RegisterInterfaces(interfaceRegistry) + crisistypes.RegisterInterfaces(interfaceRegistry) + evmtypes.RegisterInterfaces(interfaceRegistry) + etherminttypes.RegisterInterfaces(interfaceRegistry) + crosschaintypes.RegisterInterfaces(interfaceRegistry) + emissionstypes.RegisterInterfaces(interfaceRegistry) + fungibletypes.RegisterInterfaces(interfaceRegistry) + observertypes.RegisterInterfaces(interfaceRegistry) + + return cdc, 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 { + txConfig := authtx.NewTxConfig(cdc, authtx.DefaultSignModes) + return client.Context{}. + WithChainID(ZetaChainID). + WithInterfaceRegistry(reg). + WithCodec(cdc). + WithTxConfig(txConfig). + WithLegacyAmino(codec.NewLegacyAmino()). + WithInput(os.Stdin). + WithOutput(os.Stdout). + WithBroadcastMode(flags.BroadcastBlock). + WithClient(rpc). + WithSkipConfirmation(true). + WithFromName("creator"). + WithFromAddress(sdktypes.AccAddress{}). + WithKeyring(kr). + WithAccountRetriever(authtypes.AccountRetriever{}) +} + +// newFactory returns the tx factory for msg server +func newFactory(clientCtx client.Context) tx.Factory { + return tx.Factory{}. + WithChainID(clientCtx.ChainID). + WithKeybase(clientCtx.Keyring). + WithGas(300000). + WithGasAdjustment(1.0). + WithSignMode(signing.SignMode_SIGN_MODE_UNSPECIFIED). + WithAccountRetriever(clientCtx.AccountRetriever). + WithTxConfig(clientCtx.TxConfig). + WithFees("50azeta") +} diff --git a/contrib/localnet/orchestrator/start.sh b/contrib/localnet/orchestrator/start.sh index bcbceac097..a96c137da4 100644 --- a/contrib/localnet/orchestrator/start.sh +++ b/contrib/localnet/orchestrator/start.sh @@ -23,7 +23,6 @@ curl -sS http://eth:8545 \ echo "running smoketest..." smoketest "$SMOKETEST_CMD" SMOKETEST_EXIT_CODE=$? - if [ $SMOKETEST_EXIT_CODE -eq 0 ]; then echo "smoketest passed" exit 0 diff --git a/contrib/localnet/scripts/genesis.sh b/contrib/localnet/scripts/genesis.sh index fd67dce7b9..db84982177 100755 --- a/contrib/localnet/scripts/genesis.sh +++ b/contrib/localnet/scripts/genesis.sh @@ -77,7 +77,7 @@ then ssh zetaclient0 mkdir -p ~/.zetacored/ scp ~/.zetacored/os_info/os.json zetaclient0:/root/.zetacored/os.json -# 2. Add the observers , authorizations and required params to the genesis.json +# 2. Add the observers, authorizations, required params and accounts to the genesis.json zetacored collect-observer-info zetacored add-observer-list cat $HOME/.zetacored/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json @@ -88,6 +88,9 @@ then 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 + # set fungible admin account as admin for fungible token + zetacored add-genesis-account zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk 100000000000000000000000000azeta + cat $HOME/.zetacored/config/genesis.json | jq '.app_state["observer"]["params"]["admin_policy"][2]["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 diff --git a/contrib/localnet/zetacored/zetacored_zetacore0/config/genesis.json b/contrib/localnet/zetacored/zetacored_zetacore0/config/genesis.json index e3506a257c..0cdc9e0a4e 100644 --- a/contrib/localnet/zetacored/zetacored_zetacore0/config/genesis.json +++ b/contrib/localnet/zetacored/zetacored_zetacore0/config/genesis.json @@ -86,6 +86,16 @@ "sequence": "0" }, "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" + }, + { + "@type": "/ethermint.types.v1.EthAccount", + "base_account": { + "address": "zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk", + "pub_key": null, + "account_number": "0", + "sequence": "0" + }, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" } ] }, @@ -139,12 +149,21 @@ "amount": "100000000000000000000000000" } ] + }, + { + "address": "zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk", + "coins": [ + { + "denom": "azeta", + "amount": "100000000000000000000000000" + } + ] } ], "supply": [ { "denom": "azeta", - "amount": "400010000000000000000000000" + "amount": "500010000000000000000000000" } ], "denom_metadata": [] @@ -462,6 +481,7 @@ } }, "observer": { + "core_params_list": [], "observers": [ { "observer_chain": { @@ -621,7 +641,7 @@ }, { "policy_type": 1, - "address": "zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73" + "address": "zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk" } ] } diff --git a/contrib/localnet/zetacored/zetacored_zetacore1/config/genesis.json b/contrib/localnet/zetacored/zetacored_zetacore1/config/genesis.json index e3506a257c..0cdc9e0a4e 100644 --- a/contrib/localnet/zetacored/zetacored_zetacore1/config/genesis.json +++ b/contrib/localnet/zetacored/zetacored_zetacore1/config/genesis.json @@ -86,6 +86,16 @@ "sequence": "0" }, "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" + }, + { + "@type": "/ethermint.types.v1.EthAccount", + "base_account": { + "address": "zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk", + "pub_key": null, + "account_number": "0", + "sequence": "0" + }, + "code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" } ] }, @@ -139,12 +149,21 @@ "amount": "100000000000000000000000000" } ] + }, + { + "address": "zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk", + "coins": [ + { + "denom": "azeta", + "amount": "100000000000000000000000000" + } + ] } ], "supply": [ { "denom": "azeta", - "amount": "400010000000000000000000000" + "amount": "500010000000000000000000000" } ], "denom_metadata": [] @@ -462,6 +481,7 @@ } }, "observer": { + "core_params_list": [], "observers": [ { "observer_chain": { @@ -621,7 +641,7 @@ }, { "policy_type": 1, - "address": "zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73" + "address": "zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk" } ] } diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index 708b05795c..639510433c 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -50323,6 +50323,9 @@ definitions: format: uint64 outbound_tx_effective_gas_price: type: string + outbound_tx_effective_gas_limit: + type: string + format: uint64 tss_pubkey: type: string crosschainPendingNonces: @@ -50580,12 +50583,16 @@ definitions: gas_limit: type: string format: uint64 + paused: + type: boolean fungibleMsgDeployFungibleCoinZRC20Response: type: object fungibleMsgRemoveForeignCoinResponse: type: object fungibleMsgUpdateSystemContractResponse: type: object + fungibleMsgUpdateZRC20PausedStatusResponse: + type: object fungibleMsgUpdateZRC20WithdrawFeeResponse: type: object fungibleQueryAllForeignCoinsResponse: @@ -50629,6 +50636,12 @@ definitions: type: string connector_zevm: type: string + fungibleUpdatePausedStatusAction: + type: string + enum: + - PAUSE + - UNPAUSE + default: PAUSE googlerpcStatus: type: object properties: diff --git a/docs/spec/crosschain/messages.md b/docs/spec/crosschain/messages.md index a051202e8c..6ef9aed746 100644 --- a/docs/spec/crosschain/messages.md +++ b/docs/spec/crosschain/messages.md @@ -134,6 +134,7 @@ message MsgVoteOnObservedOutboundTx { uint64 observed_outTx_blockHeight = 4; uint64 observed_outTx_gas_used = 10; string observed_outTx_effective_gas_price = 11; + uint64 observed_outTx_effective_gas_limit = 12; string zeta_minted = 5; common.ReceiveStatus status = 6; int64 outTx_chain = 7; diff --git a/docs/spec/fungible/messages.md b/docs/spec/fungible/messages.md index 66b20811fc..5e67f9131b 100644 --- a/docs/spec/fungible/messages.md +++ b/docs/spec/fungible/messages.md @@ -66,3 +66,16 @@ message MsgUpdateZRC20WithdrawFee { } ``` +## MsgUpdateZRC20PausedStatus + +UpdateZRC20PausedStatus updates the paused status of a ZRC20 +The list of ZRC20s are either paused or unpaused + +```proto +message MsgUpdateZRC20PausedStatus { + string creator = 1; + string zrc20_addresses = 2; + UpdatePausedStatusAction action = 3; +} +``` + diff --git a/go.mod b/go.mod index 4b4ce32773..cc29fa1ce0 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/zeta-chain/zetacore -go 1.19 +go 1.20 require ( github.com/cosmos/cosmos-sdk v0.46.13 @@ -11,13 +11,13 @@ require ( github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-retryablehttp v0.7.0 - github.com/multiformats/go-multiaddr v0.6.0 + github.com/multiformats/go-multiaddr v0.9.0 github.com/prometheus/client_golang v1.14.0 github.com/rs/zerolog v1.29.1 github.com/spf13/cast v1.5.0 github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.4 github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/tendermint v0.34.28 github.com/tendermint/tm-db v0.6.7 @@ -40,8 +40,8 @@ require ( github.com/evmos/ethermint v0.22.0 github.com/pkg/errors v0.9.1 github.com/rakyll/statik v0.1.7 - github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20230816152528-db7d2bf9144b github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 + github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20230816152528-db7d2bf9144b gitlab.com/thorchain/tss/go-tss v0.0.0-00010101000000-000000000000 google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc gopkg.in/yaml.v2 v2.4.0 @@ -69,10 +69,22 @@ require ( github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/dustin/go-humanize v1.0.0 // indirect github.com/getsentry/sentry-go v0.18.0 // indirect + github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/glog v1.1.0 // indirect + github.com/golang/mock v1.6.0 // indirect + github.com/google/pprof v0.0.0-20230602150820-91b7bce49751 // indirect + github.com/ipfs/boxo v0.10.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect + github.com/libp2p/go-yamux/v4 v4.0.0 // indirect github.com/linxGnu/grocksdb v1.7.15 // indirect + github.com/onsi/ginkgo/v2 v2.9.7 // indirect github.com/prometheus/tsdb v0.7.1 // indirect + github.com/quic-go/qpack v0.4.0 // indirect + github.com/quic-go/qtls-go1-19 v0.3.3 // indirect + github.com/quic-go/qtls-go1-20 v0.2.3 // indirect + github.com/quic-go/quic-go v0.33.0 // indirect + github.com/quic-go/webtransport-go v0.5.3 // indirect github.com/rjeczalik/notify v0.9.1 // indirect github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect github.com/tidwall/gjson v1.14.4 // indirect @@ -80,6 +92,12 @@ require ( github.com/tidwall/pretty v1.2.0 // indirect github.com/tidwall/sjson v1.2.5 // indirect go.etcd.io/bbolt v1.3.7 // indirect + go.opentelemetry.io/otel v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/trace v1.16.0 // indirect + go.uber.org/dig v1.17.0 // indirect + go.uber.org/fx v1.19.2 // indirect + gonum.org/v1/gonum v0.13.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect ) @@ -97,7 +115,7 @@ require ( github.com/Workiva/go-datastructures v1.0.53 // indirect github.com/armon/go-metrics v0.4.1 // indirect github.com/aws/aws-sdk-go v1.44.122 // indirect - github.com/benbjohnson/clock v1.3.0 // indirect + github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect @@ -105,14 +123,13 @@ require ( github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd // indirect github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 // indirect - github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/cheekybits/genny v1.0.0 // indirect - github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect + github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect github.com/coinbase/rosetta-sdk-go v0.7.9 github.com/confio/ics23/go v0.9.0 // indirect - github.com/containerd/cgroups v1.0.4 // indirect + github.com/containerd/cgroups v1.1.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect @@ -126,7 +143,7 @@ require ( github.com/davecgh/go-spew v1.1.1 github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect github.com/deckarep/golang-set v1.8.0 // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dlclark/regexp2 v1.7.0 // indirect github.com/docker/go-units v0.5.0 // indirect @@ -175,86 +192,76 @@ require ( github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/holiman/uint256 v1.2.2 // indirect - github.com/huin/goupnp v1.0.3 // indirect + github.com/huin/goupnp v1.2.0 // indirect github.com/improbable-eng/grpc-web v0.15.0 github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/ipfs/go-cid v0.3.2 // indirect - github.com/ipfs/go-datastore v0.5.1 // indirect + github.com/ipfs/go-cid v0.4.1 // indirect + github.com/ipfs/go-datastore v0.6.0 // indirect github.com/ipfs/go-ipfs-util v0.0.2 // indirect - github.com/ipfs/go-ipns v0.2.0 // indirect + github.com/ipfs/go-ipns v0.3.0 // indirect github.com/ipfs/go-log v1.0.5 // indirect github.com/ipfs/go-log/v2 v2.5.1 // indirect - github.com/ipld/go-ipld-prime v0.19.0 // indirect + github.com/ipld/go-ipld-prime v0.20.0 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect github.com/jbenet/goprocess v0.1.4 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect - github.com/klauspost/compress v1.16.0 // indirect - github.com/klauspost/cpuid/v2 v2.1.0 // indirect - github.com/koron/go-ssdp v0.0.3 // indirect + github.com/klauspost/compress v1.16.5 // indirect + github.com/klauspost/cpuid/v2 v2.2.5 // indirect + github.com/koron/go-ssdp v0.0.4 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/libp2p/go-cidranger v1.1.0 // indirect github.com/libp2p/go-flow-metrics v0.1.0 // indirect - github.com/libp2p/go-libp2p v0.22.0 - github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect + github.com/libp2p/go-libp2p v0.27.8 + github.com/libp2p/go-libp2p-asn-util v0.3.0 // indirect github.com/libp2p/go-libp2p-core v0.20.0 // indirect - github.com/libp2p/go-libp2p-kad-dht v0.18.0 - github.com/libp2p/go-libp2p-kbucket v0.4.7 // indirect + github.com/libp2p/go-libp2p-kad-dht v0.24.2 + github.com/libp2p/go-libp2p-kbucket v0.6.3 // indirect github.com/libp2p/go-libp2p-record v0.2.0 // indirect - github.com/libp2p/go-msgio v0.2.0 // indirect + github.com/libp2p/go-msgio v0.3.0 // indirect github.com/libp2p/go-nat v0.1.0 // indirect - github.com/libp2p/go-netroute v0.2.0 // indirect - github.com/libp2p/go-openssl v0.1.0 // indirect - github.com/libp2p/go-reuseport v0.2.0 // indirect - github.com/libp2p/go-yamux/v3 v3.1.2 // indirect - github.com/lucas-clemente/quic-go v0.28.1 // indirect + github.com/libp2p/go-netroute v0.2.1 // indirect + github.com/libp2p/go-reuseport v0.3.0 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect - github.com/marten-seemann/qtls-go1-16 v0.1.5 // indirect - github.com/marten-seemann/qtls-go1-17 v0.1.2 // indirect - github.com/marten-seemann/qtls-go1-18 v0.1.2 // indirect - github.com/marten-seemann/qtls-go1-19 v0.1.0 // indirect github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.18 // indirect - github.com/mattn/go-pointer v0.0.1 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/miekg/dns v1.1.50 // indirect + github.com/miekg/dns v1.1.54 // indirect github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect github.com/minio/highwayhash v1.0.2 // indirect - github.com/minio/sha256-simd v1.0.0 // indirect + github.com/minio/sha256-simd v1.0.1 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/mtibben/percent v0.2.1 // indirect - github.com/multiformats/go-base32 v0.0.4 // indirect - github.com/multiformats/go-base36 v0.1.0 // indirect + github.com/multiformats/go-base32 v0.1.0 // indirect + github.com/multiformats/go-base36 v0.2.0 // indirect github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect - github.com/multiformats/go-multibase v0.1.1 // indirect - github.com/multiformats/go-multicodec v0.6.0 // indirect - github.com/multiformats/go-multihash v0.2.1 // indirect - github.com/multiformats/go-multistream v0.3.3 // indirect - github.com/multiformats/go-varint v0.0.6 // indirect - github.com/nxadm/tail v1.4.8 // indirect + github.com/multiformats/go-multibase v0.2.0 // indirect + github.com/multiformats/go-multicodec v0.9.0 // indirect + github.com/multiformats/go-multihash v0.2.3 // indirect + github.com/multiformats/go-multistream v0.4.1 // indirect + github.com/multiformats/go-varint v0.0.7 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect - github.com/onsi/ginkgo v1.16.5 // indirect github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/otiai10/primes v0.0.0-20180210170552-f6d2a1ba97c4 // indirect github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect - github.com/pelletier/go-toml/v2 v2.0.7 // indirect + github.com/pelletier/go-toml/v2 v2.0.7 github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e // indirect - github.com/prometheus/client_model v0.3.0 // indirect + github.com/polydawn/refmt v0.89.0 // indirect + github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect github.com/raulk/go-watchdog v1.3.0 // indirect @@ -264,7 +271,6 @@ require ( github.com/rs/cors v1.8.3 github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect - github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/afero v1.9.3 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect @@ -284,29 +290,28 @@ require ( github.com/zondax/ledger-go v0.14.1 // indirect gitlab.com/thorchain/binance-sdk v1.2.3-0.20210117202539-d569b6b9ba5d // indirect go.opencensus.io v0.24.0 // indirect - go.uber.org/atomic v1.10.0 // indirect - go.uber.org/multierr v1.8.0 // indirect - go.uber.org/zap v1.23.0 // indirect - golang.org/x/crypto v0.7.0 // indirect - golang.org/x/exp v0.0.0-20230310171629-522b1b587ee0 // indirect - golang.org/x/mod v0.9.0 // indirect + go.uber.org/atomic v1.11.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.24.0 // indirect + golang.org/x/crypto v0.10.0 // indirect + golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect + golang.org/x/mod v0.10.0 // indirect golang.org/x/net v0.10.0 golang.org/x/oauth2 v0.8.0 // indirect - golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/term v0.8.0 // indirect - golang.org/x/text v0.9.0 // indirect - golang.org/x/tools v0.7.0 // indirect + golang.org/x/sync v0.2.0 // indirect + golang.org/x/sys v0.9.0 // indirect + golang.org/x/term v0.9.0 // indirect + golang.org/x/text v0.10.0 // indirect + golang.org/x/tools v0.9.1 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.114.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect - gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - lukechampine.com/blake3 v1.1.7 // indirect - nhooyr.io/websocket v1.8.6 // indirect + lukechampine.com/blake3 v1.2.1 // indirect + nhooyr.io/websocket v1.8.7 // indirect sigs.k8s.io/yaml v1.3.0 // indirect ) diff --git a/go.sum b/go.sum index 9f3c1d5295..9a52b53dcc 100644 --- a/go.sum +++ b/go.sum @@ -692,6 +692,8 @@ github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiU github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= +github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -780,6 +782,8 @@ github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInq github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= +github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -799,15 +803,16 @@ github.com/chavacava/garif v0.0.0-20220630083739-93517212f375/go.mod h1:4m1Rv7xf github.com/checkpoint-restore/go-criu/v4 v4.1.0/go.mod h1:xUQBLp4RLc5zJtWY++yjOoMoB5lihDt7fai+75m+rGw= github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M= github.com/checkpoint-restore/go-criu/v5 v5.3.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E= -github.com/cheekybits/genny v1.0.0 h1:uGGa4nei+j20rOSeDeP5Of12XVm7TGUd4dJA9RDitfE= -github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= -github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8= +github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM= +github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8= +github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= +github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04= +github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8= github.com/cilium/ebpf v0.0.0-20200110133405-4032b1d8aae3/go.mod h1:MA5e5Lr8slmEg9bt0VpxxWqJlO4iwu3FBdHUzV7wQVg= github.com/cilium/ebpf v0.0.0-20200702112145-1c8d4c9ef775/go.mod h1:7cR51M8ViRLIdUjrmSXlK9pkrsDlLHbO8jiB8X8JnOc= github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= @@ -886,8 +891,8 @@ github.com/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTF github.com/containerd/cgroups v0.0.0-20210114181951-8a68de567b68/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= github.com/containerd/cgroups v1.0.1/go.mod h1:0SJrPIenamHDcZhEcJMNBB85rHcUsw4f25ZfBiPYRkU= github.com/containerd/cgroups v1.0.3/go.mod h1:/ofk34relqNjSGyqPrmEULrO4Sc8LJhvJmWbUCUKqj8= -github.com/containerd/cgroups v1.0.4 h1:jN/mbWBEaz+T1pi5OFtnkQ+8qnmEbAr1Oo1FRm5B0dA= -github.com/containerd/cgroups v1.0.4/go.mod h1:nLNQtsF7Sl2HxNebu77i1R0oDlhiTG+kO4JTrUzo6IA= +github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= +github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= github.com/containerd/console v0.0.0-20181022165439-0650fd9eeb50/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= github.com/containerd/console v0.0.0-20191206165004-02ecf6a7291e/go.mod h1:8Pf4gM6VEbTNRIT26AyyU7hxdQU3MvAvxVI0sc00XBE= @@ -1028,6 +1033,7 @@ github.com/cosmos/ibc-go/v6 v6.1.0 h1:o7oXws2vKkKfOFzJI+oNylRn44PCNt5wzHd/zKQKbv github.com/cosmos/ibc-go/v6 v6.1.0/go.mod h1:CY3zh2HLfetRiW8LY6kVHMATe90Wj/UOoY8T6cuB0is= github.com/cosmos/ledger-cosmos-go v0.12.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA= github.com/cosmos/ledger-cosmos-go v0.12.2/go.mod h1:ZcqYgnfNJ6lAXe4HPtWgarNEY+B74i+2/8MhZw4ziiI= +github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI= github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= @@ -1066,10 +1072,13 @@ github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsP github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= +github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= github.com/decred/dcrd/dcrec/edwards/v2 v2.0.0/go.mod h1:d0H8xGMWbiIQP7gN3v2rByWUcuZPm9YsgmnfoxgbINc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw= @@ -1237,6 +1246,7 @@ github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2 github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= +github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= @@ -1309,7 +1319,10 @@ github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= @@ -1369,6 +1382,7 @@ github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslW github.com/go-toolsmith/typep v1.0.0/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= github.com/go-toolsmith/typep v1.0.2/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= +github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= github.com/go-zookeeper/zk v1.0.2/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= @@ -1554,8 +1568,11 @@ github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20230405160723-4a4c7d95572b h1:Qcx5LM0fSiks9uCyFZwDBUasd3lxd1RM0GYpL+Li5o4= +github.com/google/pprof v0.0.0-20230405160723-4a4c7d95572b/go.mod h1:79YE0hCXdHag9sBkw2o+N/YnZtTkXi0UT9Nnixa5eYk= +github.com/google/pprof v0.0.0-20230602150820-91b7bce49751 h1:hR7/MlvK23p6+lIw9SN1TigNLn9ZnF3W4SYRKq2gAHs= +github.com/google/pprof v0.0.0-20230602150820-91b7bce49751/go.mod h1:Jh3hGz2jkYak8qXPD19ryItVnUgpgeqzdkY/D0EaeuA= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/rpmpack v0.0.0-20191226140753-aa36bfddb3a0/go.mod h1:RaTPr0KUf2K7fnZYLNDrr8rxAamWs3iNywJLtQ2AzBg= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= @@ -1758,8 +1775,10 @@ github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmK github.com/hudl/fargo v1.4.0/go.mod h1:9Ai6uvFy5fQNq6VPKtg+Ceq1+eTY4nKUlR2JElEOcDo= github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= github.com/huin/goupnp v1.0.3-0.20220313090229-ca81a64b4204/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= -github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= -github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= +github.com/huin/goupnp v1.1.0 h1:gEe0Dp/lZmPZiDFzJJaOfUpOvv2MKUkoBX8lDrn9vKU= +github.com/huin/goupnp v1.1.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= +github.com/huin/goupnp v1.2.0 h1:uOKW26NG1hsSSbXIZ1IR7XP9Gjd1U8pnLaCMgntmkmY= +github.com/huin/goupnp v1.2.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= github.com/hydrogen18/memlistener v0.0.0-20141126152155-54553eb933fb/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= github.com/hydrogen18/memlistener v0.0.0-20200120041712-dcc25e7acd91/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= @@ -1796,14 +1815,16 @@ github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mq github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:Wbbw6tYNvwa5dlB6304Sd+82Z3f7PmVZHVKU637d4po= github.com/informalsystems/tm-load-test v1.3.0/go.mod h1:OQ5AQ9TbT5hKWBNIwsMjn6Bf4O0U4b1kRc+0qZlQJKw= github.com/intel/goresctrl v0.2.0/go.mod h1:+CZdzouYFn5EsxgqAQTEzMfwKwuc0fVdMrT9FCCAVRQ= +github.com/ipfs/boxo v0.10.0 h1:tdDAxq8jrsbRkYoF+5Rcqyeb91hgWe2hp7iLu7ORZLY= +github.com/ipfs/boxo v0.10.0/go.mod h1:Fg+BnfxZ0RPzR0nOodzdIq3A7KgoWAOWsEIImrIQdBM= github.com/ipfs/go-cid v0.0.5/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog= github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= -github.com/ipfs/go-cid v0.3.2 h1:OGgOd+JCFM+y1DjWPmVH+2/4POtpDzwcr7VgnB7mZXc= -github.com/ipfs/go-cid v0.3.2/go.mod h1:gQ8pKqT/sUxGY+tIwy1RPpAojYu7jAyCp5Tz1svoupw= +github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= +github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= github.com/ipfs/go-datastore v0.4.1/go.mod h1:SX/xMIKoCszPqp+z9JhPYCmoOoXTvaa13XEbGtsFUhA= github.com/ipfs/go-datastore v0.4.4/go.mod h1:SX/xMIKoCszPqp+z9JhPYCmoOoXTvaa13XEbGtsFUhA= -github.com/ipfs/go-datastore v0.5.1 h1:WkRhLuISI+XPD0uk3OskB0fYFSyqK8Ob5ZYew9Qa1nQ= -github.com/ipfs/go-datastore v0.5.1/go.mod h1:9zhEApYMTl17C8YDp7JmU7sQZi2/wqiYh73hakZ90Bk= +github.com/ipfs/go-datastore v0.6.0 h1:JKyz+Gvz1QEZw0LsX1IBn+JFCJQH4SJVFtM4uWU0Myk= +github.com/ipfs/go-datastore v0.6.0/go.mod h1:rt5M3nNbSO/8q1t4LNkLyUwRs8HupMeN/8O4Vn9YAT8= github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= github.com/ipfs/go-ds-badger v0.2.3/go.mod h1:pEYw0rgg3FIrywKKnL+Snr+w/LjJZVMTBRn4FS6UHUk= @@ -1813,6 +1834,7 @@ github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2PO github.com/ipfs/go-ipfs-util v0.0.2/go.mod h1:CbPtkWJzjLdEcezDns2XYaehFVNXG9zrdrtMecczcsQ= github.com/ipfs/go-ipns v0.2.0 h1:BgmNtQhqOw5XEZ8RAfWEpK4DhqaYiuP6h71MhIp7xXU= github.com/ipfs/go-ipns v0.2.0/go.mod h1:3cLT2rbvgPZGkHJoPO1YMJeh6LtkxopCkKFcio/wE24= +github.com/ipfs/go-ipns v0.3.0/go.mod h1:3cLT2rbvgPZGkHJoPO1YMJeh6LtkxopCkKFcio/wE24= github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= github.com/ipfs/go-log v1.0.3/go.mod h1:OsLySYkwIbiSUR/yBTdv1qPtcE4FW3WPWk/ewz9Ru+A= github.com/ipfs/go-log v1.0.4/go.mod h1:oDCg2FkjogeFOhqqb+N39l2RpTNPL6F/StPkB3kPgcs= @@ -1826,6 +1848,8 @@ github.com/ipfs/go-log/v2 v2.5.1 h1:1XdUzF7048prq4aBjDQQ4SL5RxftpRGdXhNRwKSAlcY= github.com/ipfs/go-log/v2 v2.5.1/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI= github.com/ipld/go-ipld-prime v0.19.0 h1:5axC7rJmPc17Emw6TelxGwnzALk0PdupZ2oj2roDj04= github.com/ipld/go-ipld-prime v0.19.0/go.mod h1:Q9j3BaVXwaA3o5JUDNvptDDr/x8+F7FG6XJ8WI3ILg4= +github.com/ipld/go-ipld-prime v0.20.0 h1:Ud3VwE9ClxpO2LkCYP7vWPc0Fo+dYdYzgxUJZ3uRG4g= +github.com/ipld/go-ipld-prime v0.20.0/go.mod h1:PzqZ/ZR981eKbgdr3y2DJYeD/8bgMawdGVlJDE8kK+M= github.com/iris-contrib/blackfriday v2.0.0+incompatible/go.mod h1:UzZ2bDEoaSGPbkg6SAB4att1aAwTmVIx/5gCVqeyUdI= github.com/iris-contrib/go.uuid v2.0.0+incompatible/go.mod h1:iz2lgM/1UnEf1kP0L/+fafWORmlnuysV2EMP8MW+qe0= github.com/iris-contrib/i18n v0.0.0-20171121225848-987a633949d0/go.mod h1:pMCz62A0xJL6I+umB2YTlFRwWXaDFA0jy+5HzGiJjqI= @@ -1926,6 +1950,7 @@ github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d/go.mod h1:NV88laa9UiiD github.com/kataras/pio v0.0.2/go.mod h1:hAoW0t9UmXi4R5Oyq5Z4irTbaTsOemSrDGUtaTl7Dro= github.com/kataras/sitemap v0.0.5/go.mod h1:KY2eugMKiPwsJgx7+U103YZehfvNGOXURubcGyk0Bz8= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= +github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/errcheck v1.6.2/go.mod h1:nXw/i/MfnvRHqXa7XXmQMUB0oNFGuBrNI8d8NLy0LPw= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -1947,16 +1972,20 @@ github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47e github.com/klauspost/compress v1.15.1/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= github.com/klauspost/compress v1.15.15/go.mod h1:ZcK2JAFqKOpnBlxcLsJzYfrS9X1akm9fHZNnD9+Vo/4= -github.com/klauspost/compress v1.16.0 h1:iULayQNOReoYUe+1qtKOqw9CwJv3aNQu8ivo7lw1HU4= -github.com/klauspost/compress v1.16.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.16.4 h1:91KN02FnsOYhuunwU4ssRe8lc2JosWmizWa91B5v1PU= +github.com/klauspost/compress v1.16.4/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI= +github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid v0.0.0-20180405133222-e7e905edc00e/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.1.0 h1:eyi1Ad2aNJMW95zcSbmGg7Cg6cq3ADwLpMAP96d8rF0= -github.com/klauspost/cpuid/v2 v2.1.0/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= +github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= +github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= +github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= +github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= @@ -1964,8 +1993,8 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk= -github.com/koron/go-ssdp v0.0.3 h1:JivLMY45N76b4p/vsWGOKewBQu6uf39y8l+AQ7sDKx8= -github.com/koron/go-ssdp v0.0.3/go.mod h1:b2MxI6yh02pKrsyNoQUsk4+YNikaGhe4894J+Q5lDvA= +github.com/koron/go-ssdp v0.0.4 h1:1IDwrghSKYM7yLf7XCzbByg2sJ/JcNOZRXS2jczTwz0= +github.com/koron/go-ssdp v0.0.4/go.mod h1:oDXq+E5IL5q0U8uSBcoAXzTzInwy5lEgC91HoKtbmZk= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -2016,51 +2045,53 @@ github.com/libp2p/go-cidranger v1.1.0/go.mod h1:KWZTfSr+r9qEo9OkI9/SIEeAtw+NNoU0 github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs= github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= -github.com/libp2p/go-libp2p v0.22.0 h1:2Tce0kHOp5zASFKJbNzRElvh0iZwdtG5uZheNW8chIw= -github.com/libp2p/go-libp2p v0.22.0/go.mod h1:UDolmweypBSjQb2f7xutPnwZ/fxioLbMBxSjRksxxU4= +github.com/libp2p/go-libp2p v0.27.8 h1:IX5x/4yKwyPQeVS2AXHZ3J4YATM9oHBGH1gBc23jBAI= +github.com/libp2p/go-libp2p v0.27.8/go.mod h1:eCFFtd0s5i/EVKR7+5Ki8bM7qwkNW3TPTTSSW9sz8NE= github.com/libp2p/go-libp2p-asn-util v0.0.0-20200825225859-85005c6cf052/go.mod h1:nRMRTab+kZuk0LnKZpxhOVH/ndsdr2Nr//Zltc/vwgo= -github.com/libp2p/go-libp2p-asn-util v0.2.0 h1:rg3+Os8jbnO5DxkC7K/Utdi+DkY3q/d1/1q+8WeNAsw= -github.com/libp2p/go-libp2p-asn-util v0.2.0/go.mod h1:WoaWxbHKBymSN41hWSq/lGKJEca7TNm58+gGJi2WsLI= +github.com/libp2p/go-libp2p-asn-util v0.3.0 h1:gMDcMyYiZKkocGXDQ5nsUQyquC9+H+iLEQHwOCZ7s8s= +github.com/libp2p/go-libp2p-asn-util v0.3.0/go.mod h1:B1mcOrKUE35Xq/ASTmQ4tN3LNzVVaMNmq2NACuqyB9w= github.com/libp2p/go-libp2p-core v0.5.4/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= github.com/libp2p/go-libp2p-core v0.6.1/go.mod h1:FfewUH/YpvWbEB+ZY9AQRQ4TAD8sJBt/G1rVvhz5XT8= github.com/libp2p/go-libp2p-core v0.20.0 h1:PGKM74+T+O/FaZNARNW32i90RMBHCcgd/hkum2UQ5eY= github.com/libp2p/go-libp2p-core v0.20.0/go.mod h1:6zR8H7CvQWgYLsbG4on6oLNSGcyKaYFSEYyDt51+bIY= github.com/libp2p/go-libp2p-kad-dht v0.18.0 h1:akqO3gPMwixR7qFSFq70ezRun97g5hrA/lBW9jrjUYM= github.com/libp2p/go-libp2p-kad-dht v0.18.0/go.mod h1:Gb92MYIPm3K2pJLGn8wl0m8wiKDvHrYpg+rOd0GzzPA= +github.com/libp2p/go-libp2p-kad-dht v0.24.2 h1:zd7myKBKCmtZBhI3I0zm8xBkb28v3gmSEtQfBdAdFwc= +github.com/libp2p/go-libp2p-kad-dht v0.24.2/go.mod h1:BShPzRbK6+fN3hk8a0WGAYKpb8m4k+DtchkqouGTrSg= github.com/libp2p/go-libp2p-kbucket v0.4.7 h1:spZAcgxifvFZHBD8tErvppbnNiKA5uokDu3CV7axu70= github.com/libp2p/go-libp2p-kbucket v0.4.7/go.mod h1:XyVo99AfQH0foSf176k4jY1xUJ2+jUJIZCSDm7r2YKk= +github.com/libp2p/go-libp2p-kbucket v0.6.3 h1:p507271wWzpy2f1XxPzCQG9NiN6R6lHL9GiSErbQQo0= +github.com/libp2p/go-libp2p-kbucket v0.6.3/go.mod h1:RCseT7AH6eJWxxk2ol03xtP9pEHetYSPXOaJnOiD8i0= github.com/libp2p/go-libp2p-peerstore v0.2.6/go.mod h1:ss/TWTgHZTMpsU/oKVVPQCGuDHItOpf2W8RxAi50P2s= github.com/libp2p/go-libp2p-peerstore v0.8.0 h1:bzTG693TA1Ju/zKmUCQzDLSqiJnyRFVwPpuloZ/OZtI= github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0= github.com/libp2p/go-libp2p-record v0.2.0/go.mod h1:I+3zMkvvg5m2OcSdoL0KPljyJyvNDFGKX7QdlpYUcwk= -github.com/libp2p/go-libp2p-testing v0.11.0 h1:+R7FRl/U3Y00neyBSM2qgDzqz3HkWH24U9nMlascHL4= +github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA= github.com/libp2p/go-maddr-filter v0.1.0/go.mod h1:VzZhTXkMucEGGEOSKddrwGiOv0tUhgnKqNEmIAz/bPU= github.com/libp2p/go-msgio v0.0.4/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= github.com/libp2p/go-msgio v0.0.6/go.mod h1:4ecVB6d9f4BDSL5fqvPiC4A3KivjWn+Venn/1ALLMWA= -github.com/libp2p/go-msgio v0.2.0 h1:W6shmB+FeynDrUVl2dgFQvzfBZcXiyqY4VmpQLu9FqU= -github.com/libp2p/go-msgio v0.2.0/go.mod h1:dBVM1gW3Jk9XqHkU4eKdGvVHdLa51hoGfll6jMJMSlY= +github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0= +github.com/libp2p/go-msgio v0.3.0/go.mod h1:nyRM819GmVaF9LX3l03RMh10QdOroF++NBbxAb0mmDM= github.com/libp2p/go-nat v0.1.0 h1:MfVsH6DLcpa04Xr+p8hmVRG4juse0s3J8HyNWYHffXg= github.com/libp2p/go-nat v0.1.0/go.mod h1:X7teVkwRHNInVNWQiO/tAiAVRwSr5zoRz4YSTC3uRBM= github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk= -github.com/libp2p/go-netroute v0.2.0 h1:0FpsbsvuSnAhXFnCY0VLFbJOzaK0VnP0r1QT/o4nWRE= -github.com/libp2p/go-netroute v0.2.0/go.mod h1:Vio7LTzZ+6hoT4CMZi5/6CpY3Snzh2vgZhWgxMNwlQI= +github.com/libp2p/go-netroute v0.2.1 h1:V8kVrpD8GK0Riv15/7VN6RbUQ3URNZVosw7H2v9tksU= +github.com/libp2p/go-netroute v0.2.1/go.mod h1:hraioZr0fhBjG0ZRXJJ6Zj2IVEVNx6tDTFQfSmcq7mQ= github.com/libp2p/go-openssl v0.0.4/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= github.com/libp2p/go-openssl v0.0.7/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= -github.com/libp2p/go-openssl v0.1.0 h1:LBkKEcUv6vtZIQLVTegAil8jbNpJErQ9AnT+bWV+Ooo= -github.com/libp2p/go-openssl v0.1.0/go.mod h1:OiOxwPpL3n4xlenjx2h7AwSGaFSC/KZvf6gNdOBQMtc= github.com/libp2p/go-reuseport v0.2.0 h1:18PRvIMlpY6ZK85nIAicSBuXXvrYoSw3dsBAR7zc560= github.com/libp2p/go-reuseport v0.2.0/go.mod h1:bvVho6eLMm6Bz5hmU0LYN3ixd3nPPvtIlaURZZgOY4k= +github.com/libp2p/go-reuseport v0.3.0 h1:iiZslO5byUYZEg9iCwJGf5h+sf1Agmqx2V2FDjPyvUw= +github.com/libp2p/go-reuseport v0.3.0/go.mod h1:laea40AimhtfEqysZ71UpYj4S+R9VpH8PgqLo7L+SwI= github.com/libp2p/go-sockaddr v0.0.2/go.mod h1:syPvOmNs24S3dFVGJA1/mrqdeijPxLV2Le3BRLKd68k= -github.com/libp2p/go-yamux/v3 v3.1.2 h1:lNEy28MBk1HavUAlzKgShp+F6mn/ea1nDYWftZhFW9Q= -github.com/libp2p/go-yamux/v3 v3.1.2/go.mod h1:jeLEQgLXqE2YqX1ilAClIfCMDY+0uXQUKmmb/qp0gT4= +github.com/libp2p/go-yamux/v4 v4.0.0 h1:+Y80dV2Yx/kv7Y7JKu0LECyVdMXm1VUoko+VQ9rBfZQ= +github.com/libp2p/go-yamux/v4 v4.0.0/go.mod h1:NWjl8ZTLOGlozrXSOZ/HlfG++39iKNnM5wwmtQP1YB4= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/linuxkit/virtsock v0.0.0-20201010232012-f8cee7dfc7a3/go.mod h1:3r6x7q95whyfWQpmGZTu3gk3v2YkMi05HEzl7Tf7YEo= github.com/linxGnu/grocksdb v1.7.15 h1:AEhP28lkeAybv5UYNYviYISpR6bJejEnKuYbnWAnxx0= github.com/linxGnu/grocksdb v1.7.15/go.mod h1:pY55D0o+r8yUYLq70QmhdudxYvoDb9F+9puf4m3/W+U= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= -github.com/lucas-clemente/quic-go v0.28.1 h1:Uo0lvVxWg5la9gflIF9lwa39ONq85Xq2D91YNEIslzU= -github.com/lucas-clemente/quic-go v0.28.1/go.mod h1:oGz5DKK41cJt5+773+BSO9BXDsREY4HLf7+0odGAPO0= github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4= github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= @@ -2088,16 +2119,6 @@ github.com/maratori/testableexamples v1.0.0/go.mod h1:4rhjL1n20TUTT4vdh3RDqSizKL github.com/maratori/testpackage v1.0.1/go.mod h1:ddKdw+XG0Phzhx8BFDTKgpWP4i7MpApTE5fXSKAqwDU= github.com/maratori/testpackage v1.1.0/go.mod h1:PeAhzU8qkCwdGEMTEupsHJNlQu2gZopMC6RjbhmHeDc= github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= -github.com/marten-seemann/qpack v0.2.1/go.mod h1:F7Gl5L1jIgN1D11ucXefiuJS9UMVP2opoCp2jDKb7wc= -github.com/marten-seemann/qtls-go1-16 v0.1.5 h1:o9JrYPPco/Nukd/HpOHMHZoBDXQqoNtUCmny98/1uqQ= -github.com/marten-seemann/qtls-go1-16 v0.1.5/go.mod h1:gNpI2Ol+lRS3WwSOtIUUtRwZEQMXjYK+dQSBFbethAk= -github.com/marten-seemann/qtls-go1-17 v0.1.2 h1:JADBlm0LYiVbuSySCHeY863dNkcpMmDR7s0bLKJeYlQ= -github.com/marten-seemann/qtls-go1-17 v0.1.2/go.mod h1:C2ekUKcDdz9SDWxec1N/MvcXBpaX9l3Nx67XaR84L5s= -github.com/marten-seemann/qtls-go1-18 v0.1.2 h1:JH6jmzbduz0ITVQ7ShevK10Av5+jBEKAHMntXmIV7kM= -github.com/marten-seemann/qtls-go1-18 v0.1.2/go.mod h1:mJttiymBAByA49mhlNZZGrH5u1uXYZJ+RW28Py7f4m4= -github.com/marten-seemann/qtls-go1-19 v0.1.0-beta.1/go.mod h1:5HTDWtVudo/WFsHKRNuOhWlbdjrfs5JHrYb0wIJqGpI= -github.com/marten-seemann/qtls-go1-19 v0.1.0 h1:rLFKD/9mp/uq1SYGYuVZhm83wkmU95pK5df3GufyYYU= -github.com/marten-seemann/qtls-go1-19 v0.1.0/go.mod h1:5HTDWtVudo/WFsHKRNuOhWlbdjrfs5JHrYb0wIJqGpI= github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd h1:br0buuQ854V8u83wA0rVZ8ttrq5CpaPZdvrK0LP2lOk= github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs1Nt24+FYQEqAAncTDPJIuGs+LxK1MCiFL25pMU= github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= @@ -2133,8 +2154,8 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-pointer v0.0.1 h1:n+XhsuGeVO6MEAp7xyEukFINEa+Quek5psIR/ylA6o0= -github.com/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= @@ -2173,8 +2194,10 @@ github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKju github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= -github.com/miekg/dns v1.1.50 h1:DQUfb9uc6smULcREF09Uc+/Gd46YWqJd5DbpPE9xkcA= -github.com/miekg/dns v1.1.50/go.mod h1:e3IlAVfNqAllflbibAZEWOXOQ+Ynzk/dDozDxY7XnME= +github.com/miekg/dns v1.1.53 h1:ZBkuHr5dxHtB1caEOlZTLPo7D3L3TWckgUUs/RHfDxw= +github.com/miekg/dns v1.1.53/go.mod h1:uInx36IzPl7FYnDcMeVWxj9byh7DutNykX4G9Sj60FY= +github.com/miekg/dns v1.1.54 h1:5jon9mWcb0sFJGpnI99tOMhCPyJ+RPVz5b63MQG0VWI= +github.com/miekg/dns v1.1.54/go.mod h1:uInx36IzPl7FYnDcMeVWxj9byh7DutNykX4G9Sj60FY= github.com/miekg/pkcs11 v1.0.2/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/miekg/pkcs11 v1.1.1/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= @@ -2195,6 +2218,8 @@ github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1 github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= +github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= +github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= @@ -2274,18 +2299,19 @@ github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-base32 v0.0.4 h1:+qMh4a2f37b4xTNs6mqitDinryCI+tfO2dRVMN9mjSE= -github.com/multiformats/go-base32 v0.0.4/go.mod h1:jNLFzjPZtp3aIARHbJRZIaPuspdH0J6q39uUM5pnABM= -github.com/multiformats/go-base36 v0.1.0 h1:JR6TyF7JjGd3m6FbLU2cOxhC0Li8z8dLNGQ89tUg4F4= +github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE= +github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM= +github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= +github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= github.com/multiformats/go-multiaddr v0.2.1/go.mod h1:s/Apk6IyxfvMjDafnhJgJ3/46z7tZ04iMk5wP4QMGGE= github.com/multiformats/go-multiaddr v0.2.2/go.mod h1:NtfXiOtHvghW9KojvtySjH5y0u0xW5UouOmQQrn6a3Y= github.com/multiformats/go-multiaddr v0.3.0/go.mod h1:dF9kph9wfJ+3VLAaeBqo9Of8x4fJxp6ggJGteB8HQTI= github.com/multiformats/go-multiaddr v0.3.1/go.mod h1:uPbspcUPd5AfaP6ql3ujFY+QWzmBD8uLLL4bXW0XfGc= -github.com/multiformats/go-multiaddr v0.6.0 h1:qMnoOPj2s8xxPU5kZ57Cqdr0hHhARz7mFsPMIiYNqzg= -github.com/multiformats/go-multiaddr v0.6.0/go.mod h1:F4IpaKZuPP360tOMn2Tpyu0At8w23aRyVqeK0DbFeGM= +github.com/multiformats/go-multiaddr v0.9.0 h1:3h4V1LHIk5w4hJHekMKWALPXErDfz/sggzwC/NcqbDQ= +github.com/multiformats/go-multiaddr v0.9.0/go.mod h1:mI67Lb1EeTOYb8GQfL/7wpIZwc46ElrvzhYnoJOmTT0= github.com/multiformats/go-multiaddr-dns v0.3.1 h1:QgQgR+LQVt3NPTjbrLLpsaT2ufAA2y0Mkk+QRVJbW3A= github.com/multiformats/go-multiaddr-dns v0.3.1/go.mod h1:G/245BRQ6FJGmryJCrOuTdB37AMA5AMOVuO6NY3JwTk= github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= @@ -2294,22 +2320,27 @@ github.com/multiformats/go-multiaddr-net v0.1.4/go.mod h1:ilNnaM9HbmVFqsb/qcNysj github.com/multiformats/go-multiaddr-net v0.2.0/go.mod h1:gGdH3UXny6U3cKKYCvpXI5rnK7YaOIEOPVDI9tsJbEA= github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc= -github.com/multiformats/go-multibase v0.1.1 h1:3ASCDsuLX8+j4kx58qnJ4YFq/JWTJpCyDW27ztsVTOI= -github.com/multiformats/go-multibase v0.1.1/go.mod h1:ZEjHE+IsUrgp5mhlEAYjMtZwK1k4haNkcaPg9aoe1a8= -github.com/multiformats/go-multicodec v0.6.0 h1:KhH2kSuCARyuJraYMFxrNO3DqIaYhOdS039kbhgVwpE= -github.com/multiformats/go-multicodec v0.6.0/go.mod h1:GUC8upxSBE4oG+q3kWZRw/+6yC1BqO550bjhWsJbZlw= +github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= +github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk= +github.com/multiformats/go-multicodec v0.8.1 h1:ycepHwavHafh3grIbR1jIXnKCsFm0fqsfEOsJ8NtKE8= +github.com/multiformats/go-multicodec v0.8.1/go.mod h1:L3QTQvMIaVBkXOXXtVmYE+LI16i14xuaojr/H7Ai54k= +github.com/multiformats/go-multicodec v0.9.0 h1:pb/dlPnzee/Sxv/j4PmkDRxCOi3hXTz3IbPKOXWJkmg= +github.com/multiformats/go-multicodec v0.9.0/go.mod h1:L3QTQvMIaVBkXOXXtVmYE+LI16i14xuaojr/H7Ai54k= github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= github.com/multiformats/go-multihash v0.0.14/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= github.com/multiformats/go-multihash v0.2.1 h1:aem8ZT0VA2nCHHk7bPJ1BjUbHNciqZC/d16Vve9l108= github.com/multiformats/go-multihash v0.2.1/go.mod h1:WxoMcYG85AZVQUyRyo9s4wULvW5qrI9vb2Lt6evduFc= -github.com/multiformats/go-multistream v0.3.3 h1:d5PZpjwRgVlbwfdTDjife7XszfZd8KYWfROYFlGcR8o= -github.com/multiformats/go-multistream v0.3.3/go.mod h1:ODRoqamLUsETKS9BNcII4gcRsJBU5VAwRIv7O39cEXg= +github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U= +github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= +github.com/multiformats/go-multistream v0.4.1 h1:rFy0Iiyn3YT0asivDUIR05leAdwZq3de4741sbiSdfo= +github.com/multiformats/go-multistream v0.4.1/go.mod h1:Mz5eykRVAjJWckE2U78c6xqdtyNUEhKSM0Lwar2p77Q= github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.2/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= -github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2W/KhfNY= github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= +github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= +github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= @@ -2378,10 +2409,12 @@ github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9k github.com/onsi/ginkgo v1.16.2/go.mod h1:CObGmKUOKaSC0RjmoAK7tKyn4Azo5P2IWuoMnvwxz1E= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= github.com/onsi/ginkgo/v2 v2.9.2 h1:BA2GMJOtfGAfagzYtrAlufIP0lq6QERkFmHLMLPwFSU= +github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxeMeDuts= +github.com/onsi/ginkgo/v2 v2.9.7 h1:06xGQy5www2oN160RtEZoTvnP2sPhEfePYmCDc2szss= +github.com/onsi/ginkgo/v2 v2.9.7/go.mod h1:cxrmXWykAwTwhQsJOPfdIDiJ+l2RYq7U8hFU+M/1uw0= github.com/onsi/gomega v0.0.0-20151007035656-2152b45fa28a/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= @@ -2399,6 +2432,7 @@ github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAl github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/onsi/gomega v1.20.0/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE= +github.com/onsi/gomega v1.27.7 h1:fVih9JD6ogIiHUN6ePK7HJidyEDpWGVB5mzM7cWNXoU= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= @@ -2521,6 +2555,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e h1:ZOcivgkkFRnjfoTcGsDq3UQYiBmekwLA+qg0OjyB/ls= github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o= +github.com/polydawn/refmt v0.89.0 h1:ADJTApkvkeBZsN0tBTx8QjpD9JkmxbKp0cxfr9qszm4= +github.com/polydawn/refmt v0.89.0/go.mod h1:/zvteZs/GwLtCgZ4BL6CBsk9IKIlexP43ObX9AxTqTw= github.com/polyfloyd/go-errorlint v1.0.5/go.mod h1:APVvOesVSAnne5SClsPxPdfvZTVDojXh1/G3qb5wjGI= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= @@ -2550,6 +2586,8 @@ github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6T github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= +github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= @@ -2600,6 +2638,18 @@ github.com/quasilyte/go-ruleguard/rules v0.0.0-20211022131956-028d6511ab71/go.mo github.com/quasilyte/gogrep v0.0.0-20220828223005-86e4605de09f/go.mod h1:Cm9lpz9NZjEoL1tgZ2OgeUKPIxL1meE7eo60Z6Sk+Ng= github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= +github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= +github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= +github.com/quic-go/qtls-go1-19 v0.3.3 h1:wznEHvJwd+2X3PqftRha0SUKmGsnb6dfArMhy9PeJVE= +github.com/quic-go/qtls-go1-19 v0.3.3/go.mod h1:ySOI96ew8lnoKPtSqx2BlI5wCpUVPT05RMAlajtnyOI= +github.com/quic-go/qtls-go1-20 v0.2.3 h1:m575dovXn1y2ATOb1XrRFcrv0F+EQmlowTkoraNkDPI= +github.com/quic-go/qtls-go1-20 v0.2.3/go.mod h1:JKtK6mjbAVcUTN/9jZpvLbGxvdWIKS8uT7EiStoU1SM= +github.com/quic-go/quic-go v0.33.0 h1:ItNoTDN/Fm/zBlq769lLJc8ECe9gYaW40veHCCco7y0= +github.com/quic-go/quic-go v0.33.0/go.mod h1:YMuhaAV9/jIu0XclDXwZPAsP/2Kgr5yMYhe9oxhhOFA= +github.com/quic-go/webtransport-go v0.5.2 h1:GA6Bl6oZY+g/flt00Pnu0XtivSD8vukOu3lYhJjnGEk= +github.com/quic-go/webtransport-go v0.5.2/go.mod h1:OhmmgJIzTTqXK5xvtuX0oBpLV2GkLWNDA+UeTGJXErU= +github.com/quic-go/webtransport-go v0.5.3 h1:5XMlzemqB4qmOlgIus5zB45AcZ2kCgCy2EptUrfOPWU= +github.com/quic-go/webtransport-go v0.5.3/go.mod h1:OhmmgJIzTTqXK5xvtuX0oBpLV2GkLWNDA+UeTGJXErU= github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtBsk= @@ -2726,10 +2776,14 @@ github.com/skeema/knownhosts v1.1.0/go.mod h1:sKFq3RD6/TKZkSWn8boUbDC7Qkgcv+8XXi github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v1.0.0 h1:UVQPSSmc3qtTi+zPPkCXvZX9VvW/xT/NsRvKfwY81a8= github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= +github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs= +github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg= +github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM= github.com/smartystreets/gunit v1.0.0/go.mod h1:qwPWnhz6pn0NnRBP++URONOVyNkPyr4SauJk4cUOwJs= github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= @@ -2741,7 +2795,6 @@ github.com/sourcegraph/go-diff v0.5.1/go.mod h1:j2dHj3m8aZgQO8lMTcTnBcXkRRRqi34c github.com/sourcegraph/go-diff v0.5.3/go.mod h1:v9JDtjCE4HHHCZGId75rg8gkKKa98RVjBcBGsVmMmak= github.com/sourcegraph/go-diff v0.6.1/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= @@ -2825,6 +2878,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/subosito/gotenv v1.3.0/go.mod h1:YzJjq/33h7nrwdY+iHMhEOEEbW0ovIz0tB6t6PwAXzs= github.com/subosito/gotenv v1.4.0/go.mod h1:mZd6rFysKEcUhUHXJk0C/08wAgyDBFuwEYL7vWWGaGo= @@ -2930,6 +2985,8 @@ github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtX github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli v1.22.4 h1:u7tSpNPPswAFymm8IehJhy4uJMlUuU/GmqSkvJ1InXA= github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/urfave/cli v1.22.10 h1:p8Fspmz3iTctJstry1PYS3HVdllxnEzTEsgIgtxTrCk= +github.com/urfave/cli v1.22.10/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/urfave/cli/v2 v2.10.2 h1:x3p8awjp/2arX+Nl/G2040AZpOCHS/eMJJ1/a+mye4Y= github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= @@ -2963,6 +3020,8 @@ github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/vmware/govmomi v0.20.3/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU= github.com/warpfork/go-wish v0.0.0-20200122115046-b9ea61034e4a h1:G++j5e0OC488te356JvdhaM8YS6nMsjLAYF7JxCv07w= +github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0 h1:GDDkbFiaK8jsSDJfjId/PEGEShv6ugrt4kYsC5UIDaQ= +github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k= github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= @@ -3070,6 +3129,8 @@ go.opentelemetry.io/otel v1.3.0/go.mod h1:PWIKzi6JCp7sM0k9yZ43VX+T345uNbAkDKwHVj go.opentelemetry.io/otel v1.4.0/go.mod h1:jeAqMFKy2uLIxCtKxoFj0FAL5zAPKQagc3+GtBWakzk= go.opentelemetry.io/otel v1.4.1/go.mod h1:StM6F/0fSwpd8dKWDCdRr7uRvEPYdW0hBSlbdTiUde4= go.opentelemetry.io/otel v1.11.0/go.mod h1:H2KtuEphyMvlhZ+F7tg9GRhAOe60moNx61Ex+WmiKkk= +go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s= +go.opentelemetry.io/otel v1.16.0/go.mod h1:vl0h9NUa1D5s1nv3A5vZOYWn8av4K8Ml6JDeHrT/bx4= go.opentelemetry.io/otel/exporters/jaeger v1.4.1/go.mod h1:ZW7vkOu9nC1CxsD8bHNHCia5JUbwP39vxgd1q4Z5rCI= go.opentelemetry.io/otel/exporters/otlp v0.20.0/go.mod h1:YIieizyaN77rtLJra0buKiNBOm9XQfkPEKBeuhoMwAM= go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0/go.mod h1:VpP4/RMn8bv8gNo9uK7/IMY4mtWLELsS+JIP0inH0h4= @@ -3084,6 +3145,8 @@ go.opentelemetry.io/otel/internal/metric v0.27.0/go.mod h1:n1CVxRqKqYZtqyTh9U/on go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU= go.opentelemetry.io/otel/metric v0.27.0/go.mod h1:raXDJ7uP2/Jc0nVZWQjJtzoyssOYWu/+pjZqRzfvZ7g= go.opentelemetry.io/otel/metric v0.32.3/go.mod h1:pgiGmKohxHyTPHGOff+vrtIH39/R9fiO/WoenUQ3kcc= +go.opentelemetry.io/otel/metric v1.16.0 h1:RbrpwVG1Hfv85LgnZ7+txXioPDoh6EdbZHo26Q3hqOo= +go.opentelemetry.io/otel/metric v1.16.0/go.mod h1:QE47cpOmkwipPiefDwo2wDzwJrlfxxNYodqc4xnGCo4= go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw= go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc= go.opentelemetry.io/otel/sdk v1.3.0/go.mod h1:rIo4suHNhQwBIPg9axF8V9CA72Wz2mKF1teNrup8yzs= @@ -3095,6 +3158,8 @@ go.opentelemetry.io/otel/trace v1.3.0/go.mod h1:c/VDhno8888bvQYmbYLqe41/Ldmr/KKu go.opentelemetry.io/otel/trace v1.4.0/go.mod h1:uc3eRsqDfWs9R7b92xbQbU42/eTNz4N+gLP8qJCi4aE= go.opentelemetry.io/otel/trace v1.4.1/go.mod h1:iYEVbroFCNut9QkwEczV9vMRPHNKSSwYZjulEtsmhFc= go.opentelemetry.io/otel/trace v1.11.0/go.mod h1:nyYjis9jy0gytE9LXGU+/m1sHTKbRY0fX0hulNNDP1U= +go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs= +go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLkqr2QVwea0ef0= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.11.0/go.mod h1:QpEjXPrNQzrFDZgoTo49dgHR9RYRSrg3NAKnUGl9YpQ= go.opentelemetry.io/proto/otlp v0.12.0/go.mod h1:TsIjwGWIx5VFYv9KGVlOpxoBl5Dy+63SUguV7GGvlSQ= @@ -3107,6 +3172,14 @@ go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= +go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/dig v1.16.1 h1:+alNIBsl0qfY0j6epRubp/9obgtrObRAc5aD+6jbWY8= +go.uber.org/dig v1.16.1/go.mod h1:557JTAUZT5bUK0SvCwikmLPPtdQhfvLYtO5tJgQSbnk= +go.uber.org/dig v1.17.0 h1:5Chju+tUvcC+N7N6EV08BJz41UZuO3BmHcN4A287ZLI= +go.uber.org/dig v1.17.0/go.mod h1:rTxpf7l5I0eBTlE6/9RL+lDybC7WFwY2QH55ZSjy1mU= +go.uber.org/fx v1.19.2 h1:SyFgYQFr1Wl0AYstE8vyYIzP4bFz2URrScjwC4cwUvY= +go.uber.org/fx v1.19.2/go.mod h1:43G1VcqSzbIv77y00p1DRAsyZS8WdzuYdhZXmEUkMyQ= go.uber.org/goleak v1.0.0/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= @@ -3119,8 +3192,9 @@ go.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+ go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= -go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8= go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= @@ -3130,8 +3204,9 @@ go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= -go.uber.org/zap v1.23.0 h1:OjGQ5KQDEUawVHxNwQgPpiypGHOxo2mNZsOqTak4fFY= go.uber.org/zap v1.23.0/go.mod h1:D+nX8jyLsMHMYrln8A0rJjFt/T/9/bGgIhAqxv5URuY= +go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= +go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= gocloud.dev v0.19.0/go.mod h1:SmKwiR8YwIMMJvQBKLsC3fHNyMwXLw3PMDO+VVteJMI= golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= @@ -3160,7 +3235,6 @@ golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200602180216-279210d13fed/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -3193,6 +3267,8 @@ golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4 golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM= +golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -3210,8 +3286,8 @@ golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMk golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= golang.org/x/exp v0.0.0-20200513190911-00229845015e/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= -golang.org/x/exp v0.0.0-20230310171629-522b1b587ee0 h1:LGJsf5LRplCck6jUCH3dBL2dmycNruWNF5xugkSlfXw= -golang.org/x/exp v0.0.0-20230310171629-522b1b587ee0/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug= +golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20220613132600-b0d781184e0d/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= @@ -3250,8 +3326,8 @@ golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2 golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= -golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= +golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -3320,7 +3396,6 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= -golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -3328,7 +3403,6 @@ golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -3416,6 +3490,8 @@ golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -3533,7 +3609,6 @@ golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210426080607-c94f62235c83/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -3568,6 +3643,7 @@ golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220405210540-1e041c57c461/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -3601,6 +3677,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -3616,6 +3694,8 @@ golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.9.0 h1:GRRCnKYhdQrD8kfRAdQ6Zcw1P0OcELxGLKJvtjVMZ28= +golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -3633,6 +3713,8 @@ golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58= +golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -3768,7 +3850,6 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.9-0.20211228192929-ee1ca4ffc4da/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= @@ -3783,6 +3864,8 @@ golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= +golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= +golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -3797,6 +3880,8 @@ gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJ gonum.org/v1/gonum v0.0.0-20190331200053-3d26580ed485/go.mod h1:2ltnJ7xHfj0zHS40VVPYEAAMTa3ZGguvHGBSJeRWqE0= gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= +gonum.org/v1/gonum v0.13.0 h1:a0T3bh+7fhRyqeNbiC3qVHYmkiQgit3wnNan/2c0HMM= +gonum.org/v1/gonum v0.13.0/go.mod h1:/WPYRckkfWrhWefxyYTfrTtQR0KH4iyHNuzxqXAKyAU= gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e/go.mod h1:kS+toOQn6AQKjmKJ7gzohV1XkqsFehRA2FbsbkopSuQ= @@ -4268,6 +4353,8 @@ k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b/go.mod h1:jPW/WVKK9YHAvNhRxK0md/ k8s.io/utils v0.0.0-20211116205334-6203023598ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= lukechampine.com/blake3 v1.1.7 h1:GgRMhmdsuK8+ii6UZFDL8Nb+VyMwadAgcJyfYHxG6n0= lukechampine.com/blake3 v1.1.7/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA= +lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI= +lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw= modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= @@ -4279,8 +4366,9 @@ mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jC mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw= mvdan.cc/unparam v0.0.0-20200501210554-b37ab49443f7/go.mod h1:HGC5lll35J70Y5v7vCGb9oLhHoScFwkHDJm/05RdSTc= mvdan.cc/unparam v0.0.0-20220706161116-678bad134442/go.mod h1:F/Cxw/6mVrNKqrR2YjFf5CaW0Bw4RL8RfbEf4GRggJk= -nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= +nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= +nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= pack.ag/amqp v0.11.2/go.mod h1:4/cbmt4EJXSKlG6LCfWHoqmN0uFdy5i/+YFz+fTfhV4= pgregory.net/rapid v0.5.5 h1:jkgx1TjbQPD/feRoK+S/mXw9e1uj6WilpHrXJowi6oA= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/proto/crosschain/cross_chain_tx.proto b/proto/crosschain/cross_chain_tx.proto index 25ed36fa76..fd2851af79 100644 --- a/proto/crosschain/cross_chain_tx.proto +++ b/proto/crosschain/cross_chain_tx.proto @@ -53,6 +53,7 @@ message OutboundTxParams { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; + uint64 outbound_tx_effective_gas_limit = 22; string tss_pubkey = 11; } diff --git a/proto/crosschain/tx.proto b/proto/crosschain/tx.proto index 14df92d4c8..da2a21beb6 100644 --- a/proto/crosschain/tx.proto +++ b/proto/crosschain/tx.proto @@ -91,6 +91,7 @@ message MsgVoteOnObservedOutboundTx { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; + uint64 observed_outTx_effective_gas_limit = 12; string zeta_minted = 5 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint", (gogoproto.nullable) = false, diff --git a/proto/fungible/events.proto b/proto/fungible/events.proto index 6a45afeb64..37c4feb10f 100644 --- a/proto/fungible/events.proto +++ b/proto/fungible/events.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package zetachain.zetacore.fungible; import "common/common.proto"; +import "fungible/tx.proto"; import "gogoproto/gogo.proto"; option go_package = "github.com/zeta-chain/zetacore/x/fungible/types"; @@ -34,3 +35,10 @@ message EventZRC20WithdrawFeeUpdated { string new_withdraw_fee = 6; string signer = 7; } + +message EventZRC20PausedStatusUpdated { + string msg_type_url = 1; + repeated string zrc20_addresses = 2; + UpdatePausedStatusAction action = 3; + string signer = 4; +} diff --git a/proto/fungible/foreign_coins.proto b/proto/fungible/foreign_coins.proto index 9cf19429ab..73447d6c92 100644 --- a/proto/fungible/foreign_coins.proto +++ b/proto/fungible/foreign_coins.proto @@ -15,4 +15,5 @@ message ForeignCoins { string symbol = 7; common.CoinType coin_type = 8; uint64 gas_limit = 9; + bool paused = 10; } diff --git a/proto/fungible/tx.proto b/proto/fungible/tx.proto index 44ae7d9fbc..c26e0adea2 100644 --- a/proto/fungible/tx.proto +++ b/proto/fungible/tx.proto @@ -12,6 +12,7 @@ service Msg { rpc RemoveForeignCoin(MsgRemoveForeignCoin) returns (MsgRemoveForeignCoinResponse); rpc UpdateSystemContract(MsgUpdateSystemContract) returns (MsgUpdateSystemContractResponse); rpc UpdateZRC20WithdrawFee(MsgUpdateZRC20WithdrawFee) returns (MsgUpdateZRC20WithdrawFeeResponse); + rpc UpdateZRC20PausedStatus(MsgUpdateZRC20PausedStatus) returns (MsgUpdateZRC20PausedStatusResponse); } message MsgUpdateZRC20WithdrawFee { @@ -51,3 +52,16 @@ message MsgRemoveForeignCoin { } message MsgRemoveForeignCoinResponse {} + +enum UpdatePausedStatusAction { + PAUSE = 0; + UNPAUSE = 1; +} + +message MsgUpdateZRC20PausedStatus { + string creator = 1; + repeated string zrc20_addresses = 2; + UpdatePausedStatusAction action = 3; +} + +message MsgUpdateZRC20PausedStatusResponse {} diff --git a/proto/observer/genesis.proto b/proto/observer/genesis.proto index 7bec282a84..fb3421937e 100644 --- a/proto/observer/genesis.proto +++ b/proto/observer/genesis.proto @@ -19,4 +19,5 @@ message GenesisState { Params params = 5; Keygen keygen = 6; LastObserverCount last_observer_count = 7; + CoreParamsList core_params_list = 8 [(gogoproto.nullable) = false]; } diff --git a/readme.md b/readme.md index 2e4606598a..d4139da5d8 100644 --- a/readme.md +++ b/readme.md @@ -5,7 +5,7 @@ smart contracts and messaging between any blockchain. ## Prerequisites -- [Go](https://golang.org/doc/install) 1.19 +- [Go](https://golang.org/doc/install) 1.20 - [Docker](https://docs.docker.com/install/) and [Docker Compose](https://docs.docker.com/compose/install/) (optional, for running tests locally) diff --git a/rpc/backend/node_info.go b/rpc/backend/node_info.go index 87be24f1d7..04ac8eb297 100644 --- a/rpc/backend/node_info.go +++ b/rpc/backend/node_info.go @@ -247,9 +247,9 @@ func (b *Backend) ListAccounts() ([]common.Address, error) { return addrs, nil } -// NewAccount will create a new account and returns the address for the new account. +// NewMnemonic will create a new account and returns the address for the new account. func (b *Backend) NewMnemonic(uid string, - language keyring.Language, + _ keyring.Language, hdPath, bip39Passphrase string, algo keyring.SignatureAlgo, diff --git a/rpc/namespaces/ethereum/eth/api.go b/rpc/namespaces/ethereum/eth/api.go index f7270b12e6..d62ddbe18c 100644 --- a/rpc/namespaces/ethereum/eth/api.go +++ b/rpc/namespaces/ethereum/eth/api.go @@ -353,22 +353,22 @@ func (e *PublicAPI) ChainId() (*hexutil.Big, error) { //nolint /////////////////////////////////////////////////////////////////////////////// // GetUncleByBlockHashAndIndex returns the uncle identified by hash and index. Always returns nil. -func (e *PublicAPI) GetUncleByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) map[string]interface{} { +func (e *PublicAPI) GetUncleByBlockHashAndIndex(_ common.Hash, _ hexutil.Uint) map[string]interface{} { return nil } // GetUncleByBlockNumberAndIndex returns the uncle identified by number and index. Always returns nil. -func (e *PublicAPI) GetUncleByBlockNumberAndIndex(number, idx hexutil.Uint) map[string]interface{} { +func (e *PublicAPI) GetUncleByBlockNumberAndIndex(_, _ hexutil.Uint) map[string]interface{} { return nil } // GetUncleCountByBlockHash returns the number of uncles in the block identified by hash. Always zero. -func (e *PublicAPI) GetUncleCountByBlockHash(hash common.Hash) hexutil.Uint { +func (e *PublicAPI) GetUncleCountByBlockHash(_ common.Hash) hexutil.Uint { return 0 } // GetUncleCountByBlockNumber returns the number of uncles in the block identified by number. Always zero. -func (e *PublicAPI) GetUncleCountByBlockNumber(blockNum rpctypes.BlockNumber) hexutil.Uint { +func (e *PublicAPI) GetUncleCountByBlockNumber(_ rpctypes.BlockNumber) hexutil.Uint { return 0 } diff --git a/rpc/namespaces/ethereum/eth/filters/filters.go b/rpc/namespaces/ethereum/eth/filters/filters.go index d70199de5a..7bcb08fd75 100644 --- a/rpc/namespaces/ethereum/eth/filters/filters.go +++ b/rpc/namespaces/ethereum/eth/filters/filters.go @@ -107,7 +107,7 @@ const ( // Logs searches the blockchain for matching log entries, returning all from the // first block that contains matches, updating the start of the filter accordingly. -func (f *Filter) Logs(ctx context.Context, logLimit int, blockLimit int64) ([]*ethtypes.Log, error) { +func (f *Filter) Logs(_ context.Context, logLimit int, blockLimit int64) ([]*ethtypes.Log, error) { logs := []*ethtypes.Log{} var err error diff --git a/rpc/namespaces/ethereum/miner/unsupported.go b/rpc/namespaces/ethereum/miner/unsupported.go index bd7d5b7a75..d07ac006ac 100644 --- a/rpc/namespaces/ethereum/miner/unsupported.go +++ b/rpc/namespaces/ethereum/miner/unsupported.go @@ -31,7 +31,7 @@ func (api *API) GetHashrate() uint64 { // SetExtra sets the extra data string that is included when this miner mines a block. // Unsupported in Ethermint -func (api *API) SetExtra(extra string) (bool, error) { +func (api *API) SetExtra(_ string) (bool, error) { api.logger.Debug("miner_setExtra") api.logger.Debug("Unsupported rpc function: miner_setExtra") return false, errors.New("unsupported rpc function: miner_setExtra") @@ -39,7 +39,7 @@ func (api *API) SetExtra(extra string) (bool, error) { // SetGasLimit sets the gaslimit to target towards during mining. // Unsupported in Ethermint -func (api *API) SetGasLimit(gasLimit hexutil.Uint64) bool { +func (api *API) SetGasLimit(_ hexutil.Uint64) bool { api.logger.Debug("miner_setGasLimit") api.logger.Debug("Unsupported rpc function: miner_setGasLimit") return false @@ -51,7 +51,7 @@ func (api *API) SetGasLimit(gasLimit hexutil.Uint64) bool { // number of threads allowed to use and updates the minimum price required by the // transaction pool. // Unsupported in Ethermint -func (api *API) Start(threads *int) error { +func (api *API) Start(_ *int) error { api.logger.Debug("miner_start") api.logger.Debug("Unsupported rpc function: miner_start") return errors.New("unsupported rpc function: miner_start") diff --git a/rpc/websockets.go b/rpc/websockets.go index 77ba4df808..c76a028ea3 100644 --- a/rpc/websockets.go +++ b/rpc/websockets.go @@ -682,7 +682,7 @@ func (api *pubSubAPI) subscribePendingTransactions(wsConn *wsConn, subID rpc.ID) return unsubFn, nil } -func (api *pubSubAPI) subscribeSyncing(wsConn *wsConn, subID rpc.ID) (pubsub.UnsubscribeFunc, error) { +func (api *pubSubAPI) subscribeSyncing(_ *wsConn, _ rpc.ID) (pubsub.UnsubscribeFunc, error) { return nil, errors.New("syncing subscription is not implemented") } diff --git a/testutil/keeper/crosschain.go b/testutil/keeper/crosschain.go index b5c66023e9..c8bb95e435 100644 --- a/testutil/keeper/crosschain.go +++ b/testutil/keeper/crosschain.go @@ -3,63 +3,144 @@ package keeper import ( "testing" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/store" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" tmdb "github.com/tendermint/tm-db" + crosschainmocks "github.com/zeta-chain/zetacore/testutil/keeper/mocks/crosschain" "github.com/zeta-chain/zetacore/x/crosschain/keeper" "github.com/zeta-chain/zetacore/x/crosschain/types" fungiblekeeper "github.com/zeta-chain/zetacore/x/fungible/keeper" - observerkeeper "github.com/zeta-chain/zetacore/x/observer/keeper" ) -func CrosschainKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { +type CrosschainMockOptions struct { + UseBankMock bool + UseAccountMock bool + UseStakingMock bool + UseObserverMock bool + UseFungibleMock bool +} + +var ( + CrosschainMocksAll = CrosschainMockOptions{ + UseBankMock: true, + UseAccountMock: true, + UseStakingMock: true, + UseObserverMock: true, + UseFungibleMock: true, + } + CrosschainNoMocks = CrosschainMockOptions{} +) + +// CrosschainKeeper initializes a crosschain keeper for testing purposes with option to mock specific keepers +func CrosschainKeeperWithMocks(t testing.TB, mockOptions CrosschainMockOptions) (*keeper.Keeper, sdk.Context) { storeKey := sdk.NewKVStoreKey(types.StoreKey) memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) + // Initialize local store db := tmdb.NewMemDB() stateStore := store.NewCommitMultiStore(db) + cdc := NewCodec() + + // Create regular keepers + sdkKeepers := NewSDKKeepers(cdc, db, stateStore) + + // Create observer keeper + var observerKeeper types.ZetaObserverKeeper = initObserverKeeper( + cdc, + db, + stateStore, + sdkKeepers.StakingKeeper, + sdkKeepers.ParamsKeeper, + ) + + // Create the fungible keeper stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) require.NoError(t, stateStore.LoadLatestVersion()) - registry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(registry) + ctx := NewContext(stateStore) - paramsSubspace := paramstypes.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "ZetacoreParams", - ) + // Initialize modules genesis + sdkKeepers.InitGenesis(ctx) + + // Add a proposer to the context + ctx = sdkKeepers.InitBlockProposer(t, ctx) - bankKeeper := bankkeeper.BaseKeeper{} - authKeeper := authkeeper.AccountKeeper{} - observerKeeper := observerkeeper.Keeper{} - fungibleKeeper := fungiblekeeper.Keeper{} + // Initialize mocks for mocked keepers + var authKeeper types.AccountKeeper = sdkKeepers.AuthKeeper + var bankKeeper types.BankKeeper = sdkKeepers.BankKeeper + var stakingKeeper types.StakingKeeper = sdkKeepers.StakingKeeper + var fungibleKeeper types.FungibleKeeper = &fungiblekeeper.Keeper{} + if mockOptions.UseAccountMock { + authKeeper = crosschainmocks.NewCrosschainAccountKeeper(t) + } + if mockOptions.UseBankMock { + bankKeeper = crosschainmocks.NewCrosschainBankKeeper(t) + } + if mockOptions.UseStakingMock { + stakingKeeper = crosschainmocks.NewCrosschainStakingKeeper(t) + } + if mockOptions.UseObserverMock { + observerKeeper = crosschainmocks.NewCrosschainObserverKeeper(t) + } + if mockOptions.UseFungibleMock { + fungibleKeeper = crosschainmocks.NewCrosschainFungibleKeeper(t) + } k := keeper.NewKeeper( - codec.NewProtoCodec(registry), + cdc, storeKey, memStoreKey, - stakingkeeper.Keeper{}, // custom - paramsSubspace, + stakingKeeper, + sdkKeepers.ParamsKeeper.Subspace(types.ModuleName), authKeeper, bankKeeper, observerKeeper, - &fungibleKeeper, + fungibleKeeper, ) - ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) return k, ctx } + +// CrosschainKeeperAllMocks initializes a crosschain keeper for testing purposes with all mocks +func CrosschainKeeperAllMocks(t testing.TB) (*keeper.Keeper, sdk.Context) { + return CrosschainKeeperWithMocks(t, CrosschainMocksAll) +} + +// CrosschainKeeper initializes a crosschain keeper for testing purposes +func CrosschainKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { + return CrosschainKeeperWithMocks(t, CrosschainNoMocks) +} + +func GetCrosschainAccountMock(t testing.TB, keeper *keeper.Keeper) *crosschainmocks.CrosschainAccountKeeper { + cak, ok := keeper.GetAuthKeeper().(*crosschainmocks.CrosschainAccountKeeper) + require.True(t, ok) + return cak +} + +func GetCrosschainBankMock(t testing.TB, keeper *keeper.Keeper) *crosschainmocks.CrosschainBankKeeper { + cbk, ok := keeper.GetBankKeeper().(*crosschainmocks.CrosschainBankKeeper) + require.True(t, ok) + return cbk +} + +func GetCrosschainStakingMock(t testing.TB, keeper *keeper.Keeper) *crosschainmocks.CrosschainStakingKeeper { + csk, ok := keeper.GetStakingKeeper().(*crosschainmocks.CrosschainStakingKeeper) + require.True(t, ok) + return csk +} + +func GetCrosschainObserverMock(t testing.TB, keeper *keeper.Keeper) *crosschainmocks.CrosschainObserverKeeper { + cok, ok := keeper.GetObserverKeeper().(*crosschainmocks.CrosschainObserverKeeper) + require.True(t, ok) + return cok +} + +func GetCrosschainFungibleMock(t testing.TB, keeper *keeper.Keeper) *crosschainmocks.CrosschainFungibleKeeper { + cfk, ok := keeper.GetFungibleKeeper().(*crosschainmocks.CrosschainFungibleKeeper) + require.True(t, ok) + return cfk +} diff --git a/testutil/keeper/fungible.go b/testutil/keeper/fungible.go index 609832b510..fe9df11be8 100644 --- a/testutil/keeper/fungible.go +++ b/testutil/keeper/fungible.go @@ -2,16 +2,12 @@ package keeper import ( "testing" - "time" "github.com/cosmos/cosmos-sdk/store" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/crypto/tmhash" - "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" tmdb "github.com/tendermint/tm-db" fungiblemocks "github.com/zeta-chain/zetacore/testutil/keeper/mocks/fungible" @@ -38,7 +34,7 @@ var ( ) // FungibleKeeperWithMocks initializes a fungible keeper for testing purposes with option to mock specific keepers -func FungibleKeeperWithMocks(t testing.TB, mockOptions FungibleMockOptions) (*keeper.Keeper, sdk.Context, SDKKeepers) { +func FungibleKeeperWithMocks(t testing.TB, mockOptions FungibleMockOptions) (*keeper.Keeper, sdk.Context, SDKKeepers, ZetaKeepers) { storeKey := sdk.NewKVStoreKey(types.StoreKey) memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) @@ -51,44 +47,28 @@ func FungibleKeeperWithMocks(t testing.TB, mockOptions FungibleMockOptions) (*ke sdkKeepers := NewSDKKeepers(cdc, db, stateStore) // Create observer keeper - var observerKeeper types.ObserverKeeper = initObserverKeeper( + observerKeeperTmp := initObserverKeeper( cdc, db, stateStore, sdkKeepers.StakingKeeper, sdkKeepers.ParamsKeeper, ) + zetaKeepers := ZetaKeepers{ + ObserverKeeper: observerKeeperTmp, + } + var observerKeeper types.ObserverKeeper = observerKeeperTmp // Create the fungible keeper stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) require.NoError(t, stateStore.LoadLatestVersion()) - // Initialize the context - header := tmproto.Header{ - Height: 1, - ChainID: "test_1-1", - Time: time.Now().UTC(), - LastBlockId: tmproto.BlockID{ - Hash: tmhash.Sum([]byte("block_id")), - PartSetHeader: tmproto.PartSetHeader{ - Total: 11, - Hash: tmhash.Sum([]byte("partset_header")), - }, - }, - AppHash: tmhash.Sum([]byte("app")), - DataHash: tmhash.Sum([]byte("data")), - EvidenceHash: tmhash.Sum([]byte("evidence")), - ValidatorsHash: tmhash.Sum([]byte("validators")), - NextValidatorsHash: tmhash.Sum([]byte("next_validators")), - ConsensusHash: tmhash.Sum([]byte("consensus")), - LastResultsHash: tmhash.Sum([]byte("last_result")), - } - ctx := sdk.NewContext(stateStore, header, false, log.NewNopLogger()) - ctx = ctx.WithHeaderHash(tmhash.Sum([]byte("header"))) + ctx := NewContext(stateStore) // Initialize modules genesis sdkKeepers.InitGenesis(ctx) + zetaKeepers.InitGenesis(ctx) // Add a proposer to the context ctx = sdkKeepers.InitBlockProposer(t, ctx) @@ -123,19 +103,19 @@ func FungibleKeeperWithMocks(t testing.TB, mockOptions FungibleMockOptions) (*ke fungiblemodule.InitGenesis(ctx, *k, *types.DefaultGenesis()) - return k, ctx, sdkKeepers + return k, ctx, sdkKeepers, zetaKeepers } // FungibleKeeperAllMocks initializes a fungible keeper for testing purposes with all keeper mocked func FungibleKeeperAllMocks(t testing.TB) (*keeper.Keeper, sdk.Context) { - k, ctx, _ := FungibleKeeperWithMocks(t, FungibleMocksAll) + k, ctx, _, _ := FungibleKeeperWithMocks(t, FungibleMocksAll) return k, ctx } // FungibleKeeper initializes a fungible keeper for testing purposes -func FungibleKeeper(t testing.TB) (*keeper.Keeper, sdk.Context, SDKKeepers) { - k, ctx, sdkk := FungibleKeeperWithMocks(t, FungibleNoMocks) - return k, ctx, sdkk +func FungibleKeeper(t testing.TB) (*keeper.Keeper, sdk.Context, SDKKeepers, ZetaKeepers) { + k, ctx, sdkk, zk := FungibleKeeperWithMocks(t, FungibleNoMocks) + return k, ctx, sdkk, zk } func GetFungibleAccountMock(t testing.TB, keeper *keeper.Keeper) *fungiblemocks.FungibleAccountKeeper { diff --git a/testutil/keeper/keeper.go b/testutil/keeper/keeper.go index d99737fdb1..316dc4c598 100644 --- a/testutil/keeper/keeper.go +++ b/testutil/keeper/keeper.go @@ -3,6 +3,7 @@ package keeper import ( "math/rand" "testing" + "time" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store" @@ -29,13 +30,51 @@ import ( feemarketkeeper "github.com/evmos/ethermint/x/feemarket/keeper" feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/crypto/tmhash" + "github.com/tendermint/tendermint/libs/log" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" tmdb "github.com/tendermint/tm-db" "github.com/zeta-chain/zetacore/testutil/sample" + 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" + emissionsmodule "github.com/zeta-chain/zetacore/x/emissions" + emissionskeeper "github.com/zeta-chain/zetacore/x/emissions/keeper" emissionstypes "github.com/zeta-chain/zetacore/x/emissions/types" + fungiblemodule "github.com/zeta-chain/zetacore/x/fungible" + fungiblekeeper "github.com/zeta-chain/zetacore/x/fungible/keeper" fungibletypes "github.com/zeta-chain/zetacore/x/fungible/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" ) +// NewContext creates a new sdk.Context for testing purposes with initialized header +func NewContext(stateStore sdk.CommitMultiStore) sdk.Context { + header := tmproto.Header{ + Height: 1, + ChainID: "test_1-1", + Time: time.Now().UTC(), + LastBlockId: tmproto.BlockID{ + Hash: tmhash.Sum([]byte("block_id")), + PartSetHeader: tmproto.PartSetHeader{ + Total: 11, + Hash: tmhash.Sum([]byte("partset_header")), + }, + }, + AppHash: tmhash.Sum([]byte("app")), + DataHash: tmhash.Sum([]byte("data")), + EvidenceHash: tmhash.Sum([]byte("evidence")), + ValidatorsHash: tmhash.Sum([]byte("validators")), + NextValidatorsHash: tmhash.Sum([]byte("next_validators")), + ConsensusHash: tmhash.Sum([]byte("consensus")), + LastResultsHash: tmhash.Sum([]byte("last_result")), + } + ctx := sdk.NewContext(stateStore, header, false, log.NewNopLogger()) + ctx = ctx.WithHeaderHash(tmhash.Sum([]byte("header"))) + return ctx +} + // SDKKeepers is a struct containing regular SDK module keepers for test purposes type SDKKeepers struct { ParamsKeeper paramskeeper.Keeper @@ -46,6 +85,14 @@ type SDKKeepers struct { EvmKeeper *evmkeeper.Keeper } +// ZetaKeepers is a struct containing Zeta module keepers for test purposes +type ZetaKeepers struct { + CrosschainKeeper *crosschainkeeper.Keeper + EmissionsKeeper *emissionskeeper.Keeper + FungibleKeeper *fungiblekeeper.Keeper + ObserverKeeper *observerkeeper.Keeper +} + var moduleAccountPerms = map[string][]string{ authtypes.FeeCollectorName: nil, distrtypes.ModuleName: nil, @@ -309,3 +356,19 @@ func (sdkk SDKKeepers) InitBlockProposer(t testing.TB, ctx sdk.Context) sdk.Cont require.NoError(t, err) return ctx.WithProposer(consAddr) } + +// InitGenesis initializes the test modules genesis state for defined Zeta modules +func (zk ZetaKeepers) InitGenesis(ctx sdk.Context) { + if zk.CrosschainKeeper != nil { + crosschainmodule.InitGenesis(ctx, *zk.CrosschainKeeper, *crosschaintypes.DefaultGenesis()) + } + if zk.EmissionsKeeper != nil { + emissionsmodule.InitGenesis(ctx, *zk.EmissionsKeeper, *emissionstypes.DefaultGenesis()) + } + if zk.FungibleKeeper != nil { + fungiblemodule.InitGenesis(ctx, *zk.FungibleKeeper, *fungibletypes.DefaultGenesis()) + } + if zk.ObserverKeeper != nil { + observermodule.InitGenesis(ctx, *zk.ObserverKeeper, *observertypes.DefaultGenesis()) + } +} diff --git a/testutil/keeper/mocks.go b/testutil/keeper/mocks.go index 4267e1593b..90d3835197 100644 --- a/testutil/keeper/mocks.go +++ b/testutil/keeper/mocks.go @@ -1,9 +1,43 @@ package keeper import ( + crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" ) +/** + * Crosschain Mocks + */ + +//go:generate mockery --name CrosschainAccountKeeper --filename account.go --case underscore --output ./mocks/crosschain +type CrosschainAccountKeeper interface { + crosschaintypes.AccountKeeper +} + +//go:generate mockery --name CrosschainBankKeeper --filename bank.go --case underscore --output ./mocks/crosschain +type CrosschainBankKeeper interface { + crosschaintypes.BankKeeper +} + +//go:generate mockery --name CrosschainStakingKeeper --filename staking.go --case underscore --output ./mocks/crosschain +type CrosschainStakingKeeper interface { + crosschaintypes.StakingKeeper +} + +//go:generate mockery --name CrosschainObserverKeeper --filename observer.go --case underscore --output ./mocks/crosschain +type CrosschainObserverKeeper interface { + crosschaintypes.ZetaObserverKeeper +} + +//go:generate mockery --name CrosschainFungibleKeeper --filename fungible.go --case underscore --output ./mocks/crosschain +type CrosschainFungibleKeeper interface { + crosschaintypes.FungibleKeeper +} + +/** + * Fungible Mocks + */ + //go:generate mockery --name FungibleAccountKeeper --filename account.go --case underscore --output ./mocks/fungible type FungibleAccountKeeper interface { fungibletypes.AccountKeeper diff --git a/testutil/keeper/mocks/crosschain/account.go b/testutil/keeper/mocks/crosschain/account.go new file mode 100644 index 0000000000..7e8c1ae7da --- /dev/null +++ b/testutil/keeper/mocks/crosschain/account.go @@ -0,0 +1,83 @@ +// Code generated by mockery v2.32.3. DO NOT EDIT. + +package mocks + +import ( + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + mock "github.com/stretchr/testify/mock" + + types "github.com/cosmos/cosmos-sdk/types" +) + +// CrosschainAccountKeeper is an autogenerated mock type for the CrosschainAccountKeeper type +type CrosschainAccountKeeper struct { + mock.Mock +} + +// GetAccount provides a mock function with given fields: ctx, addr +func (_m *CrosschainAccountKeeper) GetAccount(ctx types.Context, addr types.AccAddress) authtypes.AccountI { + ret := _m.Called(ctx, addr) + + var r0 authtypes.AccountI + if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress) authtypes.AccountI); ok { + r0 = rf(ctx, addr) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(authtypes.AccountI) + } + } + + return r0 +} + +// GetModuleAccount provides a mock function with given fields: ctx, name +func (_m *CrosschainAccountKeeper) GetModuleAccount(ctx types.Context, name string) authtypes.ModuleAccountI { + ret := _m.Called(ctx, name) + + var r0 authtypes.ModuleAccountI + if rf, ok := ret.Get(0).(func(types.Context, string) authtypes.ModuleAccountI); ok { + r0 = rf(ctx, name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(authtypes.ModuleAccountI) + } + } + + return r0 +} + +// GetModuleAddress provides a mock function with given fields: name +func (_m *CrosschainAccountKeeper) GetModuleAddress(name string) types.AccAddress { + ret := _m.Called(name) + + var r0 types.AccAddress + if rf, ok := ret.Get(0).(func(string) types.AccAddress); ok { + r0 = rf(name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(types.AccAddress) + } + } + + return r0 +} + +// SetModuleAccount provides a mock function with given fields: _a0, _a1 +func (_m *CrosschainAccountKeeper) SetModuleAccount(_a0 types.Context, _a1 authtypes.ModuleAccountI) { + _m.Called(_a0, _a1) +} + +// NewCrosschainAccountKeeper creates a new instance of CrosschainAccountKeeper. 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 NewCrosschainAccountKeeper(t interface { + mock.TestingT + Cleanup(func()) +}) *CrosschainAccountKeeper { + mock := &CrosschainAccountKeeper{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/testutil/keeper/mocks/crosschain/bank.go b/testutil/keeper/mocks/crosschain/bank.go new file mode 100644 index 0000000000..39acac1f3a --- /dev/null +++ b/testutil/keeper/mocks/crosschain/bank.go @@ -0,0 +1,145 @@ +// Code generated by mockery v2.32.3. DO NOT EDIT. + +package mocks + +import ( + types "github.com/cosmos/cosmos-sdk/types" + mock "github.com/stretchr/testify/mock" +) + +// CrosschainBankKeeper is an autogenerated mock type for the CrosschainBankKeeper type +type CrosschainBankKeeper struct { + mock.Mock +} + +// BurnCoins provides a mock function with given fields: ctx, name, amt +func (_m *CrosschainBankKeeper) BurnCoins(ctx types.Context, name string, amt types.Coins) error { + ret := _m.Called(ctx, name, amt) + + var r0 error + if rf, ok := ret.Get(0).(func(types.Context, string, types.Coins) error); ok { + r0 = rf(ctx, name, amt) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// GetAllBalances provides a mock function with given fields: ctx, addr +func (_m *CrosschainBankKeeper) GetAllBalances(ctx types.Context, addr types.AccAddress) types.Coins { + ret := _m.Called(ctx, addr) + + var r0 types.Coins + if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress) types.Coins); ok { + r0 = rf(ctx, addr) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(types.Coins) + } + } + + return r0 +} + +// GetBalance provides a mock function with given fields: ctx, addr, denom +func (_m *CrosschainBankKeeper) GetBalance(ctx types.Context, addr types.AccAddress, denom string) types.Coin { + ret := _m.Called(ctx, addr, denom) + + var r0 types.Coin + if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, string) types.Coin); ok { + r0 = rf(ctx, addr, denom) + } else { + r0 = ret.Get(0).(types.Coin) + } + + return r0 +} + +// LockedCoins provides a mock function with given fields: ctx, addr +func (_m *CrosschainBankKeeper) LockedCoins(ctx types.Context, addr types.AccAddress) types.Coins { + ret := _m.Called(ctx, addr) + + var r0 types.Coins + if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress) types.Coins); ok { + r0 = rf(ctx, addr) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(types.Coins) + } + } + + return r0 +} + +// MintCoins provides a mock function with given fields: ctx, moduleName, amt +func (_m *CrosschainBankKeeper) MintCoins(ctx types.Context, moduleName string, amt types.Coins) error { + ret := _m.Called(ctx, moduleName, amt) + + var r0 error + if rf, ok := ret.Get(0).(func(types.Context, string, types.Coins) error); ok { + r0 = rf(ctx, moduleName, amt) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SendCoinsFromAccountToModule provides a mock function with given fields: ctx, senderAddr, recipientModule, amt +func (_m *CrosschainBankKeeper) SendCoinsFromAccountToModule(ctx types.Context, senderAddr types.AccAddress, recipientModule string, amt types.Coins) error { + ret := _m.Called(ctx, senderAddr, recipientModule, amt) + + 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) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SendCoinsFromModuleToAccount provides a mock function with given fields: ctx, senderModule, recipientAddr, amt +func (_m *CrosschainBankKeeper) SendCoinsFromModuleToAccount(ctx types.Context, senderModule string, recipientAddr types.AccAddress, amt types.Coins) error { + ret := _m.Called(ctx, senderModule, recipientAddr, amt) + + 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) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SpendableCoins provides a mock function with given fields: ctx, addr +func (_m *CrosschainBankKeeper) SpendableCoins(ctx types.Context, addr types.AccAddress) types.Coins { + ret := _m.Called(ctx, addr) + + var r0 types.Coins + if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress) types.Coins); ok { + r0 = rf(ctx, addr) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(types.Coins) + } + } + + return r0 +} + +// NewCrosschainBankKeeper creates a new instance of CrosschainBankKeeper. 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 NewCrosschainBankKeeper(t interface { + mock.TestingT + Cleanup(func()) +}) *CrosschainBankKeeper { + mock := &CrosschainBankKeeper{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/testutil/keeper/mocks/crosschain/fungible.go b/testutil/keeper/mocks/crosschain/fungible.go new file mode 100644 index 0000000000..8daca22327 --- /dev/null +++ b/testutil/keeper/mocks/crosschain/fungible.go @@ -0,0 +1,332 @@ +// Code generated by mockery v2.32.3. DO NOT EDIT. + +package mocks + +import ( + big "math/big" + + common "github.com/ethereum/go-ethereum/common" + evmtypes "github.com/evmos/ethermint/x/evm/types" + + fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" + + mock "github.com/stretchr/testify/mock" + + types "github.com/cosmos/cosmos-sdk/types" + + zetacorecommon "github.com/zeta-chain/zetacore/common" +) + +// CrosschainFungibleKeeper is an autogenerated mock type for the CrosschainFungibleKeeper type +type CrosschainFungibleKeeper struct { + mock.Mock +} + +// CallUniswapv2RouterSwapExactETHForToken provides a mock function with given fields: ctx, sender, to, amountIn, outZRC4, noEthereumTxEvent +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) + + 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 { + return rf(ctx, sender, to, amountIn, outZRC4, noEthereumTxEvent) + } + if rf, ok := ret.Get(0).(func(types.Context, common.Address, common.Address, *big.Int, common.Address, bool) []*big.Int); ok { + r0 = rf(ctx, sender, to, amountIn, outZRC4, noEthereumTxEvent) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*big.Int) + } + } + + if rf, ok := ret.Get(1).(func(types.Context, common.Address, common.Address, *big.Int, common.Address, bool) error); ok { + r1 = rf(ctx, sender, to, amountIn, outZRC4, noEthereumTxEvent) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CallZRC20Burn provides a mock function with given fields: ctx, sender, zrc20address, amount, noEthereumTxEvent +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) + + 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) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// DeployZRC20Contract provides a mock function with given fields: ctx, name, symbol, decimals, chainID, coinType, erc20Contract, gasLimit +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) + + 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 { + return rf(ctx, name, symbol, decimals, chainID, coinType, erc20Contract, gasLimit) + } + if rf, ok := ret.Get(0).(func(types.Context, string, string, uint8, int64, zetacorecommon.CoinType, string, *big.Int) common.Address); ok { + r0 = rf(ctx, name, symbol, decimals, chainID, coinType, erc20Contract, gasLimit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(common.Address) + } + } + + if rf, ok := ret.Get(1).(func(types.Context, string, string, uint8, int64, zetacorecommon.CoinType, string, *big.Int) error); ok { + r1 = rf(ctx, name, symbol, decimals, chainID, coinType, erc20Contract, gasLimit) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// DepositCoinZeta provides a mock function with given fields: ctx, to, amount +func (_m *CrosschainFungibleKeeper) DepositCoinZeta(ctx types.Context, to common.Address, amount *big.Int) error { + ret := _m.Called(ctx, to, amount) + + var r0 error + if rf, ok := ret.Get(0).(func(types.Context, common.Address, *big.Int) error); ok { + r0 = rf(ctx, to, amount) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// FundGasStabilityPool provides a mock function with given fields: ctx, chainID, amount +func (_m *CrosschainFungibleKeeper) FundGasStabilityPool(ctx types.Context, chainID int64, amount *big.Int) error { + ret := _m.Called(ctx, chainID, amount) + + var r0 error + if rf, ok := ret.Get(0).(func(types.Context, int64, *big.Int) error); ok { + r0 = rf(ctx, chainID, amount) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// GetAllForeignCoins provides a mock function with given fields: ctx +func (_m *CrosschainFungibleKeeper) GetAllForeignCoins(ctx types.Context) []fungibletypes.ForeignCoins { + ret := _m.Called(ctx) + + var r0 []fungibletypes.ForeignCoins + if rf, ok := ret.Get(0).(func(types.Context) []fungibletypes.ForeignCoins); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]fungibletypes.ForeignCoins) + } + } + + return r0 +} + +// GetAllForeignCoinsForChain provides a mock function with given fields: ctx, foreignChainID +func (_m *CrosschainFungibleKeeper) GetAllForeignCoinsForChain(ctx types.Context, foreignChainID int64) []fungibletypes.ForeignCoins { + ret := _m.Called(ctx, foreignChainID) + + var r0 []fungibletypes.ForeignCoins + if rf, ok := ret.Get(0).(func(types.Context, int64) []fungibletypes.ForeignCoins); ok { + r0 = rf(ctx, foreignChainID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]fungibletypes.ForeignCoins) + } + } + + return r0 +} + +// GetForeignCoins provides a mock function with given fields: ctx, zrc20Addr +func (_m *CrosschainFungibleKeeper) GetForeignCoins(ctx types.Context, zrc20Addr string) (fungibletypes.ForeignCoins, bool) { + ret := _m.Called(ctx, zrc20Addr) + + var r0 fungibletypes.ForeignCoins + var r1 bool + if rf, ok := ret.Get(0).(func(types.Context, string) (fungibletypes.ForeignCoins, bool)); ok { + return rf(ctx, zrc20Addr) + } + if rf, ok := ret.Get(0).(func(types.Context, string) fungibletypes.ForeignCoins); ok { + r0 = rf(ctx, zrc20Addr) + } else { + r0 = ret.Get(0).(fungibletypes.ForeignCoins) + } + + if rf, ok := ret.Get(1).(func(types.Context, string) bool); ok { + r1 = rf(ctx, zrc20Addr) + } else { + r1 = ret.Get(1).(bool) + } + + return r0, r1 +} + +// GetSystemContract provides a mock function with given fields: ctx +func (_m *CrosschainFungibleKeeper) GetSystemContract(ctx types.Context) (fungibletypes.SystemContract, bool) { + ret := _m.Called(ctx) + + var r0 fungibletypes.SystemContract + var r1 bool + if rf, ok := ret.Get(0).(func(types.Context) (fungibletypes.SystemContract, bool)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(types.Context) fungibletypes.SystemContract); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(fungibletypes.SystemContract) + } + + if rf, ok := ret.Get(1).(func(types.Context) bool); ok { + r1 = rf(ctx) + } else { + r1 = ret.Get(1).(bool) + } + + return r0, r1 +} + +// QuerySystemContractGasCoinZRC20 provides a mock function with given fields: ctx, chainID +func (_m *CrosschainFungibleKeeper) QuerySystemContractGasCoinZRC20(ctx types.Context, chainID *big.Int) (common.Address, error) { + ret := _m.Called(ctx, chainID) + + var r0 common.Address + var r1 error + if rf, ok := ret.Get(0).(func(types.Context, *big.Int) (common.Address, error)); ok { + return rf(ctx, chainID) + } + if rf, ok := ret.Get(0).(func(types.Context, *big.Int) common.Address); ok { + r0 = rf(ctx, chainID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(common.Address) + } + } + + if rf, ok := ret.Get(1).(func(types.Context, *big.Int) error); ok { + r1 = rf(ctx, chainID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// QueryUniswapv2RouterGetAmountsIn provides a mock function with given fields: ctx, amountOut, outZRC4 +func (_m *CrosschainFungibleKeeper) QueryUniswapv2RouterGetAmountsIn(ctx types.Context, amountOut *big.Int, outZRC4 common.Address) (*big.Int, error) { + ret := _m.Called(ctx, amountOut, outZRC4) + + var r0 *big.Int + var r1 error + if rf, ok := ret.Get(0).(func(types.Context, *big.Int, common.Address) (*big.Int, error)); ok { + return rf(ctx, amountOut, outZRC4) + } + if rf, ok := ret.Get(0).(func(types.Context, *big.Int, common.Address) *big.Int); ok { + r0 = rf(ctx, amountOut, outZRC4) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*big.Int) + } + } + + if rf, ok := ret.Get(1).(func(types.Context, *big.Int, common.Address) error); ok { + r1 = rf(ctx, amountOut, outZRC4) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SetForeignCoins provides a mock function with given fields: ctx, foreignCoins +func (_m *CrosschainFungibleKeeper) SetForeignCoins(ctx types.Context, foreignCoins fungibletypes.ForeignCoins) { + _m.Called(ctx, foreignCoins) +} + +// SetGasPrice provides a mock function with given fields: ctx, chainID, gasPrice +func (_m *CrosschainFungibleKeeper) SetGasPrice(ctx types.Context, chainID *big.Int, gasPrice *big.Int) (uint64, error) { + ret := _m.Called(ctx, chainID, gasPrice) + + var r0 uint64 + var r1 error + if rf, ok := ret.Get(0).(func(types.Context, *big.Int, *big.Int) (uint64, error)); ok { + return rf(ctx, chainID, gasPrice) + } + if rf, ok := ret.Get(0).(func(types.Context, *big.Int, *big.Int) uint64); ok { + r0 = rf(ctx, chainID, gasPrice) + } else { + r0 = ret.Get(0).(uint64) + } + + if rf, ok := ret.Get(1).(func(types.Context, *big.Int, *big.Int) error); ok { + r1 = rf(ctx, chainID, gasPrice) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// WithdrawFromGasStabilityPool provides a mock function with given fields: ctx, chainID, amount +func (_m *CrosschainFungibleKeeper) WithdrawFromGasStabilityPool(ctx types.Context, chainID int64, amount *big.Int) error { + ret := _m.Called(ctx, chainID, amount) + + var r0 error + if rf, ok := ret.Get(0).(func(types.Context, int64, *big.Int) error); ok { + r0 = rf(ctx, chainID, amount) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// ZRC20DepositAndCallContract provides a mock function with given fields: ctx, from, to, amount, senderChain, message, contract, data, coinType, asset +func (_m *CrosschainFungibleKeeper) ZRC20DepositAndCallContract(ctx types.Context, from []byte, to common.Address, amount *big.Int, senderChain *zetacorecommon.Chain, message string, contract common.Address, data []byte, coinType zetacorecommon.CoinType, asset string) (*evmtypes.MsgEthereumTxResponse, error) { + ret := _m.Called(ctx, from, to, amount, senderChain, message, contract, data, coinType, asset) + + var r0 *evmtypes.MsgEthereumTxResponse + var r1 error + if rf, ok := ret.Get(0).(func(types.Context, []byte, common.Address, *big.Int, *zetacorecommon.Chain, string, common.Address, []byte, zetacorecommon.CoinType, string) (*evmtypes.MsgEthereumTxResponse, error)); ok { + return rf(ctx, from, to, amount, senderChain, message, contract, data, coinType, asset) + } + if rf, ok := ret.Get(0).(func(types.Context, []byte, common.Address, *big.Int, *zetacorecommon.Chain, string, common.Address, []byte, zetacorecommon.CoinType, string) *evmtypes.MsgEthereumTxResponse); ok { + r0 = rf(ctx, from, to, amount, senderChain, message, contract, data, coinType, asset) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*evmtypes.MsgEthereumTxResponse) + } + } + + if rf, ok := ret.Get(1).(func(types.Context, []byte, common.Address, *big.Int, *zetacorecommon.Chain, string, common.Address, []byte, zetacorecommon.CoinType, string) error); ok { + r1 = rf(ctx, from, to, amount, senderChain, message, contract, data, coinType, asset) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// NewCrosschainFungibleKeeper creates a new instance of CrosschainFungibleKeeper. 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 NewCrosschainFungibleKeeper(t interface { + mock.TestingT + Cleanup(func()) +}) *CrosschainFungibleKeeper { + mock := &CrosschainFungibleKeeper{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/testutil/keeper/mocks/crosschain/observer.go b/testutil/keeper/mocks/crosschain/observer.go new file mode 100644 index 0000000000..08735e93dd --- /dev/null +++ b/testutil/keeper/mocks/crosschain/observer.go @@ -0,0 +1,382 @@ +// Code generated by mockery v2.32.3. DO NOT EDIT. + +package mocks + +import ( + 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" +) + +// CrosschainObserverKeeper is an autogenerated mock type for the CrosschainObserverKeeper type +type CrosschainObserverKeeper struct { + mock.Mock +} + +// AddBallotToList provides a mock function with given fields: ctx, ballot +func (_m *CrosschainObserverKeeper) AddBallotToList(ctx types.Context, ballot observertypes.Ballot) { + _m.Called(ctx, ballot) +} + +// AddVoteToBallot provides a mock function with given fields: ctx, ballot, address, observationType +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) + + 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 { + return rf(ctx, ballot, address, observationType) + } + if rf, ok := ret.Get(0).(func(types.Context, observertypes.Ballot, string, observertypes.VoteType) observertypes.Ballot); ok { + r0 = rf(ctx, ballot, address, observationType) + } else { + r0 = ret.Get(0).(observertypes.Ballot) + } + + if rf, ok := ret.Get(1).(func(types.Context, observertypes.Ballot, string, observertypes.VoteType) error); ok { + r1 = rf(ctx, ballot, address, observationType) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CheckIfFinalizingVote provides a mock function with given fields: ctx, ballot +func (_m *CrosschainObserverKeeper) CheckIfFinalizingVote(ctx types.Context, ballot observertypes.Ballot) (observertypes.Ballot, bool) { + ret := _m.Called(ctx, ballot) + + var r0 observertypes.Ballot + var r1 bool + if rf, ok := ret.Get(0).(func(types.Context, observertypes.Ballot) (observertypes.Ballot, bool)); ok { + return rf(ctx, ballot) + } + if rf, ok := ret.Get(0).(func(types.Context, observertypes.Ballot) observertypes.Ballot); ok { + r0 = rf(ctx, ballot) + } else { + r0 = ret.Get(0).(observertypes.Ballot) + } + + if rf, ok := ret.Get(1).(func(types.Context, observertypes.Ballot) bool); ok { + r1 = rf(ctx, ballot) + } 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) + + var r0 observertypes.Ballot + var r1 bool + var r2 error + if rf, ok := ret.Get(0).(func(types.Context, string, *common.Chain, observertypes.ObservationType) (observertypes.Ballot, bool, error)); ok { + return rf(ctx, index, chain, observationType) + } + if rf, ok := ret.Get(0).(func(types.Context, string, *common.Chain, observertypes.ObservationType) observertypes.Ballot); ok { + r0 = rf(ctx, index, chain, observationType) + } else { + r0 = ret.Get(0).(observertypes.Ballot) + } + + if rf, ok := ret.Get(1).(func(types.Context, string, *common.Chain, observertypes.ObservationType) bool); ok { + r1 = rf(ctx, index, chain, observationType) + } else { + r1 = ret.Get(1).(bool) + } + + if rf, ok := ret.Get(2).(func(types.Context, string, *common.Chain, observertypes.ObservationType) error); ok { + r2 = rf(ctx, index, chain, observationType) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// GetAllBallots provides a mock function with given fields: ctx +func (_m *CrosschainObserverKeeper) GetAllBallots(ctx types.Context) []*observertypes.Ballot { + ret := _m.Called(ctx) + + var r0 []*observertypes.Ballot + if rf, ok := ret.Get(0).(func(types.Context) []*observertypes.Ballot); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*observertypes.Ballot) + } + } + + return r0 +} + +// GetAllNodeAccount provides a mock function with given fields: ctx +func (_m *CrosschainObserverKeeper) GetAllNodeAccount(ctx types.Context) []observertypes.NodeAccount { + ret := _m.Called(ctx) + + var r0 []observertypes.NodeAccount + if rf, ok := ret.Get(0).(func(types.Context) []observertypes.NodeAccount); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]observertypes.NodeAccount) + } + } + + return r0 +} + +// GetAllObserverMappers provides a mock function with given fields: ctx +func (_m *CrosschainObserverKeeper) GetAllObserverMappers(ctx types.Context) []*observertypes.ObserverMapper { + ret := _m.Called(ctx) + + var r0 []*observertypes.ObserverMapper + if rf, ok := ret.Get(0).(func(types.Context) []*observertypes.ObserverMapper); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*observertypes.ObserverMapper) + } + } + + 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) + + var r0 observertypes.Ballot + var r1 bool + if rf, ok := ret.Get(0).(func(types.Context, string) (observertypes.Ballot, bool)); ok { + return rf(ctx, index) + } + if rf, ok := ret.Get(0).(func(types.Context, string) observertypes.Ballot); ok { + r0 = rf(ctx, index) + } else { + r0 = ret.Get(0).(observertypes.Ballot) + } + + 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) + + var r0 *observertypes.CoreParams + var r1 bool + if rf, ok := ret.Get(0).(func(types.Context, int64) (*observertypes.CoreParams, bool)); ok { + return rf(ctx, chainID) + } + if rf, ok := ret.Get(0).(func(types.Context, int64) *observertypes.CoreParams); ok { + r0 = rf(ctx, chainID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*observertypes.CoreParams) + } + } + + 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) + + var r0 observertypes.Keygen + var r1 bool + if rf, ok := ret.Get(0).(func(types.Context) (observertypes.Keygen, bool)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(types.Context) observertypes.Keygen); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(observertypes.Keygen) + } + + if rf, ok := ret.Get(1).(func(types.Context) bool); ok { + r1 = rf(ctx) + } else { + r1 = ret.Get(1).(bool) + } + + return r0, r1 +} + +// GetNodeAccount provides a mock function with given fields: ctx, address +func (_m *CrosschainObserverKeeper) GetNodeAccount(ctx types.Context, address string) (observertypes.NodeAccount, bool) { + ret := _m.Called(ctx, address) + + var r0 observertypes.NodeAccount + var r1 bool + if rf, ok := ret.Get(0).(func(types.Context, string) (observertypes.NodeAccount, bool)); ok { + return rf(ctx, address) + } + if rf, ok := ret.Get(0).(func(types.Context, string) observertypes.NodeAccount); ok { + r0 = rf(ctx, address) + } else { + r0 = ret.Get(0).(observertypes.NodeAccount) + } + + if rf, ok := ret.Get(1).(func(types.Context, string) bool); ok { + r1 = rf(ctx, address) + } 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) + + var r0 observertypes.ObserverMapper + var r1 bool + if rf, ok := ret.Get(0).(func(types.Context, *common.Chain) (observertypes.ObserverMapper, bool)); ok { + return rf(ctx, chain) + } + if rf, ok := ret.Get(0).(func(types.Context, *common.Chain) observertypes.ObserverMapper); ok { + r0 = rf(ctx, chain) + } else { + r0 = ret.Get(0).(observertypes.ObserverMapper) + } + + if rf, ok := ret.Get(1).(func(types.Context, *common.Chain) bool); ok { + r1 = rf(ctx, chain) + } else { + r1 = ret.Get(1).(bool) + } + + return r0, r1 +} + +// GetParams provides a mock function with given fields: ctx +func (_m *CrosschainObserverKeeper) GetParams(ctx types.Context) observertypes.Params { + ret := _m.Called(ctx) + + var r0 observertypes.Params + if rf, ok := ret.Get(0).(func(types.Context) observertypes.Params); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(observertypes.Params) + } + + return r0 +} + +// IsAuthorized provides a mock function with given fields: ctx, address, chain +func (_m *CrosschainObserverKeeper) IsAuthorized(ctx types.Context, address string, chain *common.Chain) (bool, error) { + ret := _m.Called(ctx, address, chain) + + var r0 bool + var r1 error + if rf, ok := ret.Get(0).(func(types.Context, string, *common.Chain) (bool, error)); ok { + return rf(ctx, address, chain) + } + if rf, ok := ret.Get(0).(func(types.Context, string, *common.Chain) bool); ok { + r0 = rf(ctx, address, chain) + } else { + r0 = ret.Get(0).(bool) + } + + if rf, ok := ret.Get(1).(func(types.Context, string, *common.Chain) error); ok { + r1 = rf(ctx, address, chain) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// IsInboundEnabled provides a mock function with given fields: ctx +func (_m *CrosschainObserverKeeper) IsInboundEnabled(ctx types.Context) bool { + ret := _m.Called(ctx) + + var r0 bool + if rf, ok := ret.Get(0).(func(types.Context) bool); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// IsOutboundAllowed provides a mock function with given fields: ctx +func (_m *CrosschainObserverKeeper) IsOutboundAllowed(ctx types.Context) bool { + ret := _m.Called(ctx) + + var r0 bool + if rf, ok := ret.Get(0).(func(types.Context) bool); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// SetBallot provides a mock function with given fields: ctx, ballot +func (_m *CrosschainObserverKeeper) SetBallot(ctx types.Context, ballot *observertypes.Ballot) { + _m.Called(ctx, ballot) +} + +// SetKeygen provides a mock function with given fields: ctx, keygen +func (_m *CrosschainObserverKeeper) SetKeygen(ctx types.Context, keygen observertypes.Keygen) { + _m.Called(ctx, keygen) +} + +// SetLastObserverCount provides a mock function with given fields: ctx, lbc +func (_m *CrosschainObserverKeeper) SetLastObserverCount(ctx types.Context, lbc *observertypes.LastObserverCount) { + _m.Called(ctx, lbc) +} + +// SetNodeAccount provides a mock function with given fields: ctx, nodeAccount +func (_m *CrosschainObserverKeeper) SetNodeAccount(ctx types.Context, nodeAccount observertypes.NodeAccount) { + _m.Called(ctx, nodeAccount) +} + +// SetObserverMapper provides a mock function with given fields: ctx, om +func (_m *CrosschainObserverKeeper) SetObserverMapper(ctx types.Context, om *observertypes.ObserverMapper) { + _m.Called(ctx, om) +} + +// SetPermissionFlags provides a mock function with given fields: ctx, permissionFlags +func (_m *CrosschainObserverKeeper) SetPermissionFlags(ctx types.Context, permissionFlags observertypes.PermissionFlags) { + _m.Called(ctx, permissionFlags) +} + +// 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 { + mock.TestingT + Cleanup(func()) +}) *CrosschainObserverKeeper { + mock := &CrosschainObserverKeeper{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/testutil/keeper/mocks/crosschain/staking.go b/testutil/keeper/mocks/crosschain/staking.go new file mode 100644 index 0000000000..a6c02e638d --- /dev/null +++ b/testutil/keeper/mocks/crosschain/staking.go @@ -0,0 +1,69 @@ +// Code generated by mockery v2.32.3. DO NOT EDIT. + +package mocks + +import ( + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + mock "github.com/stretchr/testify/mock" + + types "github.com/cosmos/cosmos-sdk/types" +) + +// CrosschainStakingKeeper is an autogenerated mock type for the CrosschainStakingKeeper type +type CrosschainStakingKeeper struct { + mock.Mock +} + +// GetAllValidators provides a mock function with given fields: ctx +func (_m *CrosschainStakingKeeper) GetAllValidators(ctx types.Context) []stakingtypes.Validator { + ret := _m.Called(ctx) + + var r0 []stakingtypes.Validator + if rf, ok := ret.Get(0).(func(types.Context) []stakingtypes.Validator); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]stakingtypes.Validator) + } + } + + return r0 +} + +// GetValidator provides a mock function with given fields: ctx, addr +func (_m *CrosschainStakingKeeper) GetValidator(ctx types.Context, addr types.ValAddress) (stakingtypes.Validator, bool) { + ret := _m.Called(ctx, addr) + + var r0 stakingtypes.Validator + var r1 bool + if rf, ok := ret.Get(0).(func(types.Context, types.ValAddress) (stakingtypes.Validator, bool)); ok { + return rf(ctx, addr) + } + if rf, ok := ret.Get(0).(func(types.Context, types.ValAddress) stakingtypes.Validator); ok { + r0 = rf(ctx, addr) + } else { + r0 = ret.Get(0).(stakingtypes.Validator) + } + + if rf, ok := ret.Get(1).(func(types.Context, types.ValAddress) bool); ok { + r1 = rf(ctx, addr) + } else { + r1 = ret.Get(1).(bool) + } + + return r0, r1 +} + +// NewCrosschainStakingKeeper creates a new instance of CrosschainStakingKeeper. 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 NewCrosschainStakingKeeper(t interface { + mock.TestingT + Cleanup(func()) +}) *CrosschainStakingKeeper { + mock := &CrosschainStakingKeeper{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/testutil/sample/crosschain.go b/testutil/sample/crosschain.go index b6ad260738..90027101a2 100644 --- a/testutil/sample/crosschain.go +++ b/testutil/sample/crosschain.go @@ -78,10 +78,12 @@ func OutboundTxParams(r *rand.Rand) *types.OutboundTxParams { Amount: math.NewUint(uint64(r.Int63())), OutboundTxTssNonce: r.Uint64(), OutboundTxGasLimit: r.Uint64(), - OutboundTxGasPrice: String(), + OutboundTxGasPrice: math.NewUint(uint64(r.Int63())).String(), OutboundTxHash: StringRandom(r, 32), OutboundTxBallotIndex: StringRandom(r, 32), OutboundTxObservedExternalHeight: r.Uint64(), + OutboundTxGasUsed: r.Uint64(), + OutboundTxEffectiveGasPrice: math.NewInt(r.Int63()), } } diff --git a/testutil/sample/fungible.go b/testutil/sample/fungible.go index 6344a3f349..0310870046 100644 --- a/testutil/sample/fungible.go +++ b/testutil/sample/fungible.go @@ -7,13 +7,12 @@ import ( "github.com/zeta-chain/zetacore/x/fungible/types" ) -func ForeignCoins(t *testing.T) types.ForeignCoins { - addr := EthAddress().String() - r := newRandFromStringSeed(t, addr) +func ForeignCoins(t *testing.T, address string) types.ForeignCoins { + r := newRandFromStringSeed(t, address) return types.ForeignCoins{ - Zrc20ContractAddress: addr, - Asset: StringRandom(r, 32), + Zrc20ContractAddress: address, + Asset: EthAddress().String(), ForeignChainId: r.Int63(), Decimals: uint32(r.Uint64()), Name: StringRandom(r, 32), diff --git a/testutil/sample/observer.go b/testutil/sample/observer.go index dd2761f03c..d88a431454 100644 --- a/testutil/sample/observer.go +++ b/testutil/sample/observer.go @@ -5,6 +5,7 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -69,3 +70,30 @@ func LastObserverCount(lastChangeHeight int64) *types.LastObserverCount { LastChangeHeight: lastChangeHeight, } } + +func CoreParams(chainID int64) *types.CoreParams { + r := newRandFromSeed(chainID) + + return &types.CoreParams{ + ChainId: chainID, + ConfirmationCount: r.Uint64(), + GasPriceTicker: r.Uint64(), + InTxTicker: r.Uint64(), + OutTxTicker: r.Uint64(), + WatchUtxoTicker: r.Uint64(), + ZetaTokenContractAddress: EthAddress().String(), + ConnectorContractAddress: EthAddress().String(), + Erc20CustodyContractAddress: EthAddress().String(), + OutboundTxScheduleInterval: r.Int63(), + OutboundTxScheduleLookahead: r.Int63(), + } +} + +func CoreParamsList() (cpl types.CoreParamsList) { + chainList := common.DefaultChainsList() + + for _, chain := range chainList { + cpl.CoreParams = append(cpl.CoreParams, CoreParams(chain.ChainId)) + } + return +} diff --git a/testutil/sample/sample.go b/testutil/sample/sample.go index cef0e5b4dc..22b57c6cde 100644 --- a/testutil/sample/sample.go +++ b/testutil/sample/sample.go @@ -37,7 +37,14 @@ func PubKey(r *rand.Rand) cryptotypes.PubKey { return ed25519.GenPrivKeyFromSecret(seed).PubKey() } -// AccAddress returns a sample account address +// Bech32AccAddress returns a sample account address +func Bech32AccAddress() sdk.AccAddress { + pk := ed25519.GenPrivKey().PubKey() + addr := pk.Address() + return sdk.AccAddress(addr) +} + +// AccAddress returns a sample account address in string func AccAddress() string { pk := ed25519.GenPrivKey().PubKey() addr := pk.Address() @@ -84,7 +91,7 @@ func PrivKeyAddressPair() (*ed25519.PrivKey, sdk.AccAddress) { // EthAddress returns a sample ethereum address func EthAddress() ethcommon.Address { - return ethcommon.HexToAddress(AccAddress()) + return ethcommon.BytesToAddress(sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()).Bytes()) } // Bytes returns a sample byte array diff --git a/testutil/sample/sample_test.go b/testutil/sample/sample_test.go index b7ad49d4b5..3cd0687c08 100644 --- a/testutil/sample/sample_test.go +++ b/testutil/sample/sample_test.go @@ -10,4 +10,8 @@ import ( func TestEthAddress(t *testing.T) { ethAddress := EthAddress() require.NotEqual(t, ethcommon.Address{}, ethAddress) + + // don't generate the same address + ethAddress2 := EthAddress() + require.NotEqual(t, ethAddress, ethAddress2) } diff --git a/x/crosschain/client/cli/cli_cctx.go b/x/crosschain/client/cli/cli_cctx.go index 584513a11b..11e4e814a5 100644 --- a/x/crosschain/client/cli/cli_cctx.go +++ b/x/crosschain/client/cli/cli_cctx.go @@ -141,9 +141,9 @@ func CmdCCTXInboundVoter() *cobra.Command { func CmdCCTXOutboundVoter() *cobra.Command { cmd := &cobra.Command{ - Use: "outbound-voter [sendHash] [outTxHash] [outBlockHeight] [outGasUsed] [outEffectiveGasPrice] [ZetaMinted] [Status] [chain] [outTXNonce] [coinType]", + Use: "outbound-voter [sendHash] [outTxHash] [outBlockHeight] [outGasUsed] [outEffectiveGasPrice] [outEffectiveGasLimit] [ZetaMinted] [Status] [chain] [outTXNonce] [coinType]", Short: "Broadcast message receiveConfirmation", - Args: cobra.ExactArgs(10), + Args: cobra.ExactArgs(11), RunE: func(cmd *cobra.Command, args []string) error { argsSendHash := args[0] argsOutTxHash := args[1] @@ -163,28 +163,33 @@ func CmdCCTXOutboundVoter() *cobra.Command { return errors.New("invalid effective gas price, enter 0 if unused") } - argsMMint := args[5] + argsOutEffectiveGasLimit, err := strconv.ParseUint(args[5], 10, 64) + if err != nil { + return err + } + + argsMMint := args[6] var status common.ReceiveStatus - if args[6] == "0" { + if args[7] == "0" { status = common.ReceiveStatus_Success - } else if args[6] == "1" { + } else if args[7] == "1" { status = common.ReceiveStatus_Failed } else { return fmt.Errorf("wrong status") } - chain, err := strconv.ParseInt(args[7], 10, 64) + chain, err := strconv.ParseInt(args[8], 10, 64) if err != nil { return err } - outTxNonce, err := strconv.ParseUint(args[8], 10, 64) + outTxNonce, err := strconv.ParseUint(args[9], 10, 64) if err != nil { return err } - argsCoinType := common.CoinType(common.CoinType_value[args[9]]) + argsCoinType := common.CoinType(common.CoinType_value[args[10]]) clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err @@ -197,6 +202,7 @@ func CmdCCTXOutboundVoter() *cobra.Command { argsOutBlockHeight, argsOutGasUsed, argsOutEffectiveGasPrice, + argsOutEffectiveGasLimit, math.NewUintFromString(argsMMint), status, chain, diff --git a/x/crosschain/client/cli/query.go b/x/crosschain/client/cli/query.go index 88069a864f..c87c38771c 100644 --- a/x/crosschain/client/cli/query.go +++ b/x/crosschain/client/cli/query.go @@ -15,7 +15,7 @@ import ( ) // GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { +func GetQueryCmd(_ string) *cobra.Command { // Group crosschain queries under a subcommand cmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/crosschain/client/integrationtests/cli_helpers.go b/x/crosschain/client/integrationtests/cli_helpers.go index c090808a5f..16922f18da 100644 --- a/x/crosschain/client/integrationtests/cli_helpers.go +++ b/x/crosschain/client/integrationtests/cli_helpers.go @@ -136,6 +136,7 @@ func BuildSignedOutboundVote(t testing.TB, val *network.Validator, denom string, "1", "0", "0", + "0", zetaminted, status, strconv.FormatInt(common.GoerliChain().ChainId, 10), @@ -219,6 +220,7 @@ func GetBallotIdentifierOutBound(cctxindex, outtxHash, zetaminted string) string 1, 0, math.ZeroInt(), + 0, math.NewUintFromString(zetaminted), 0, common.GoerliChain().ChainId, diff --git a/x/crosschain/keeper/abci.go b/x/crosschain/keeper/abci.go new file mode 100644 index 0000000000..b40b0f1838 --- /dev/null +++ b/x/crosschain/keeper/abci.go @@ -0,0 +1,119 @@ +package keeper + +import ( + "fmt" + "strconv" + "time" + + cosmoserrors "cosmossdk.io/errors" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +const ( + // EpochLength is the number of blocks in an epoch before triggering a gas price increase + // TODO: determine value + EpochLength = 100 + + // RetryInterval is the number of blocks to wait before incrementing the gas price again + // TODO: determine value + RetryInterval = time.Minute * 10 + + // GasPriceIncreasePercent is the percentage of median gas price by which to increase the gas price during an increment + // 100 means the gas price is increased by the median gas price + // TODO: determine value + GasPriceIncreasePercent = 100 + + // RemainingFeesToStabilityPoolPercent is the percentage of remaining fees used to fund the gas stability pool + // TODO: determine value + RemainingFeesToStabilityPoolPercent = 95 +) + +// IterateAndUpdateCctxGasPrice iterates through all cctx and updates the gas price if pending for too long +func (k Keeper) IterateAndUpdateCctxGasPrice(ctx sdk.Context) error { + // skip if haven't reached epoch end + if ctx.BlockHeight()%EpochLength != 0 { + return nil + } + + // iterate all chains' pending cctx + chains := common.DefaultChainsList() + for _, chain := range chains { + res, err := k.CctxAllPending(sdk.UnwrapSDKContext(ctx), &types.QueryAllCctxPendingRequest{ + ChainId: uint64(chain.ChainId), + }) + if err != nil { + return err + } + + // iterate through all pending cctx + for _, pendingCctx := range res.CrossChainTx { + if pendingCctx != nil { + _, _, err := k.CheckAndUpdateCctxGasPrice(ctx, *pendingCctx) + if err != nil { + return err + } + } + } + } + + return nil +} + +// CheckAndUpdateCctxGasPrice checks if the retry interval is reached and updates the gas price if so +// The function returns the gas price increase and the additional fees paid +func (k Keeper) CheckAndUpdateCctxGasPrice(ctx sdk.Context, cctx types.CrossChainTx) (math.Uint, math.Uint, error) { + // skip if gas price or gas limit is not set + if cctx.GetCurrentOutTxParam().OutboundTxGasPrice == "" || cctx.GetCurrentOutTxParam().OutboundTxGasLimit == 0 { + return math.ZeroUint(), math.ZeroUint(), nil + } + + // skip if retry interval is not reached + lastUpdated := time.Unix(cctx.CctxStatus.LastUpdateTimestamp, 0) + if ctx.BlockTime().Before(lastUpdated.Add(RetryInterval)) { + return math.ZeroUint(), math.ZeroUint(), nil + } + + // compute gas price increase + chainID := cctx.GetCurrentOutTxParam().ReceiverChainId + medianGasPrice, isFound := k.GetMedianGasPriceInUint(ctx, chainID) + if !isFound { + return math.ZeroUint(), math.ZeroUint(), cosmoserrors.Wrap( + types.ErrUnableToGetGasPrice, + fmt.Sprintf("cannot get gas price for chain %d", chainID), + ) + } + gasPriceIncrease := medianGasPrice.MulUint64(GasPriceIncreasePercent).QuoUint64(100) + + // withdraw additional fees from the gas stability pool + gasLimit := math.NewUint(cctx.GetCurrentOutTxParam().OutboundTxGasLimit) + additionalFees := gasLimit.Mul(gasPriceIncrease) + if err := k.fungibleKeeper.WithdrawFromGasStabilityPool(ctx, chainID, additionalFees.BigInt()); err != nil { + return math.ZeroUint(), math.ZeroUint(), cosmoserrors.Wrap( + types.ErrNotEnoughFunds, + fmt.Sprintf("cannot withdraw %s from gas stability pool", additionalFees.String()), + ) + } + + // Increase the cctx value + err := k.IncreaseCctxGasPrice(ctx, cctx, gasPriceIncrease) + + return gasPriceIncrease, additionalFees, err +} + +// IncreaseCctxGasPrice increases the gas price associated with a CCTX and updates it in the store +func (k Keeper) IncreaseCctxGasPrice(ctx sdk.Context, cctx types.CrossChainTx, gasPriceIncrease math.Uint) error { + currentGasPrice, err := strconv.ParseUint(cctx.GetCurrentOutTxParam().OutboundTxGasPrice, 10, 64) + if err != nil { + return fmt.Errorf("unable to parse cctx gas price %s: %s", cctx.GetCurrentOutTxParam().OutboundTxGasPrice, err.Error()) + } + + // increase gas price and set last update timestamp + cctx.GetCurrentOutTxParam().OutboundTxGasPrice = math.NewUint(currentGasPrice).Add(gasPriceIncrease).String() + cctx.CctxStatus.LastUpdateTimestamp = ctx.BlockHeader().Time.Unix() + k.SetCrossChainTx(ctx, cctx) + + return nil +} diff --git a/x/crosschain/keeper/abci_test.go b/x/crosschain/keeper/abci_test.go new file mode 100644 index 0000000000..374f307f73 --- /dev/null +++ b/x/crosschain/keeper/abci_test.go @@ -0,0 +1,237 @@ +package keeper_test + +import ( + "errors" + "testing" + "time" + + "cosmossdk.io/math" + "github.com/stretchr/testify/require" + testkeeper "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" +) + +func TestKeeper_CheckAndUpdateCctxGasPrice(t *testing.T) { + sampleTimestamp := time.Now() + retryIntervalReached := sampleTimestamp.Add(keeper.RetryInterval + time.Second) + retryIntervalNotReached := sampleTimestamp.Add(keeper.RetryInterval - time.Second) + + tt := []struct { + name string + cctx types.CrossChainTx + blockTimestamp time.Time + medianGasPrice uint64 + withdrawFromGasStabilityPoolReturn error + expectWithdrawFromGasStabilityPoolCall bool + expectedGasPriceIncrease math.Uint + expectedAdditionalFees math.Uint + isError bool + }{ + { + name: "can update gas price when retry interval is reached", + cctx: types.CrossChainTx{ + Index: "a1", + CctxStatus: &types.Status{ + LastUpdateTimestamp: sampleTimestamp.Unix(), + }, + OutboundTxParams: []*types.OutboundTxParams{ + { + ReceiverChainId: 42, + OutboundTxGasLimit: 1000, + OutboundTxGasPrice: "100", + }, + }, + }, + blockTimestamp: retryIntervalReached, + medianGasPrice: 50, + withdrawFromGasStabilityPoolReturn: nil, + expectWithdrawFromGasStabilityPoolCall: true, + expectedGasPriceIncrease: math.NewUint(50), // 100% medianGasPrice + expectedAdditionalFees: math.NewUint(50000), // gasLimit * increase + }, + { + name: "skip if gas price is not set", + cctx: types.CrossChainTx{ + Index: "b1", + CctxStatus: &types.Status{ + LastUpdateTimestamp: sampleTimestamp.Unix(), + }, + OutboundTxParams: []*types.OutboundTxParams{ + { + ReceiverChainId: 42, + OutboundTxGasLimit: 100, + OutboundTxGasPrice: "", + }, + }, + }, + blockTimestamp: retryIntervalReached, + medianGasPrice: 100, + expectWithdrawFromGasStabilityPoolCall: false, + expectedGasPriceIncrease: math.NewUint(0), + expectedAdditionalFees: math.NewUint(0), + }, + { + name: "skip if gas limit is not set", + cctx: types.CrossChainTx{ + Index: "b2", + CctxStatus: &types.Status{ + LastUpdateTimestamp: sampleTimestamp.Unix(), + }, + OutboundTxParams: []*types.OutboundTxParams{ + { + ReceiverChainId: 42, + OutboundTxGasLimit: 0, + OutboundTxGasPrice: "100", + }, + }, + }, + blockTimestamp: retryIntervalReached, + medianGasPrice: 100, + expectWithdrawFromGasStabilityPoolCall: false, + expectedGasPriceIncrease: math.NewUint(0), + expectedAdditionalFees: math.NewUint(0), + }, + { + name: "skip if retry interval is not reached", + cctx: types.CrossChainTx{ + Index: "b3", + CctxStatus: &types.Status{ + LastUpdateTimestamp: sampleTimestamp.Unix(), + }, + OutboundTxParams: []*types.OutboundTxParams{ + { + ReceiverChainId: 42, + OutboundTxGasLimit: 0, + OutboundTxGasPrice: "100", + }, + }, + }, + blockTimestamp: retryIntervalNotReached, + medianGasPrice: 100, + expectWithdrawFromGasStabilityPoolCall: false, + expectedGasPriceIncrease: math.NewUint(0), + expectedAdditionalFees: math.NewUint(0), + }, + { + name: "returns error if can't find median gas price", + cctx: types.CrossChainTx{ + Index: "c1", + CctxStatus: &types.Status{ + LastUpdateTimestamp: sampleTimestamp.Unix(), + }, + OutboundTxParams: []*types.OutboundTxParams{ + { + ReceiverChainId: 42, + OutboundTxGasLimit: 1000, + OutboundTxGasPrice: "100", + }, + }, + }, + expectWithdrawFromGasStabilityPoolCall: false, + blockTimestamp: retryIntervalReached, + medianGasPrice: 0, + isError: true, + }, + { + name: "returns error if can't withdraw from gas stability pool", + cctx: types.CrossChainTx{ + Index: "c2", + CctxStatus: &types.Status{ + LastUpdateTimestamp: sampleTimestamp.Unix(), + }, + OutboundTxParams: []*types.OutboundTxParams{ + { + ReceiverChainId: 42, + OutboundTxGasLimit: 1000, + OutboundTxGasPrice: "100", + }, + }, + }, + blockTimestamp: retryIntervalReached, + medianGasPrice: 50, + expectWithdrawFromGasStabilityPoolCall: true, + expectedGasPriceIncrease: math.NewUint(50), // 100% medianGasPrice + expectedAdditionalFees: math.NewUint(50000), // gasLimit * increase + withdrawFromGasStabilityPoolReturn: errors.New("withdraw error"), + isError: true, + }, + } + for _, tc := range tt { + tc := tc + t.Run(tc.name, func(t *testing.T) { + k, ctx := testkeeper.CrosschainKeeperAllMocks(t) + fungibleMock := testkeeper.GetCrosschainFungibleMock(t, k) + chainID := tc.cctx.GetCurrentOutTxParam().ReceiverChainId + + // set median gas price if not zero + if tc.medianGasPrice != 0 { + k.SetGasPrice(ctx, types.GasPrice{ + ChainId: chainID, + Prices: []uint64{tc.medianGasPrice}, + MedianIndex: 0, + }) + + // ensure median gas price is set + medianGasPrice, isFound := k.GetMedianGasPriceInUint(ctx, chainID) + require.True(t, isFound) + require.True(t, medianGasPrice.Equal(math.NewUint(tc.medianGasPrice))) + } + + // set block timestamp + ctx = ctx.WithBlockTime(tc.blockTimestamp) + + if tc.expectWithdrawFromGasStabilityPoolCall { + fungibleMock.On( + "WithdrawFromGasStabilityPool", ctx, chainID, tc.expectedAdditionalFees.BigInt(), + ).Return(tc.withdrawFromGasStabilityPoolReturn) + } + + // check and update gas price + gasPriceIncrease, feesPaid, err := k.CheckAndUpdateCctxGasPrice(ctx, tc.cctx) + + if tc.isError { + require.Error(t, err) + return + } + require.NoError(t, err) + + // check values + require.True(t, gasPriceIncrease.Equal(tc.expectedGasPriceIncrease), "expected %s, got %s", tc.expectedGasPriceIncrease.String(), gasPriceIncrease.String()) + require.True(t, feesPaid.Equal(tc.expectedAdditionalFees), "expected %s, got %s", tc.expectedAdditionalFees.String(), feesPaid.String()) + }) + } +} + +func TestKeeper_IncreaseCctxGasPrice(t *testing.T) { + k, ctx := testkeeper.CrosschainKeeper(t) + + t.Run("can increase gas", func(t *testing.T) { + // sample cctx + cctx := *sample.CrossChainTx(t, "foo") + previousGasPrice, ok := math.NewIntFromString(cctx.GetCurrentOutTxParam().OutboundTxGasPrice) + require.True(t, ok) + + // increase gas price + err := k.IncreaseCctxGasPrice(ctx, cctx, math.NewUint(42)) + require.NoError(t, err) + + // can retrieve cctx + cctx, found := k.GetCrossChainTx(ctx, "foo") + require.True(t, found) + + // gas price increased + currentGasPrice, ok := math.NewIntFromString(cctx.GetCurrentOutTxParam().OutboundTxGasPrice) + require.True(t, ok) + require.True(t, currentGasPrice.Equal(previousGasPrice.Add(math.NewInt(42)))) + }) + + t.Run("fail if invalid cctx", func(t *testing.T) { + cctx := *sample.CrossChainTx(t, "foo") + cctx.GetCurrentOutTxParam().OutboundTxGasPrice = "invalid" + err := k.IncreaseCctxGasPrice(ctx, cctx, math.NewUint(42)) + require.Error(t, err) + }) + +} diff --git a/x/crosschain/keeper/keeper.go b/x/crosschain/keeper/keeper.go index 14ef01faef..0a44254be7 100644 --- a/x/crosschain/keeper/keeper.go +++ b/x/crosschain/keeper/keeper.go @@ -62,6 +62,22 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } +func (k Keeper) GetAuthKeeper() types.AccountKeeper { + return k.authKeeper +} + +func (k Keeper) GetBankKeeper() types.BankKeeper { + return k.bankKeeper +} + +func (k Keeper) GetStakingKeeper() types.StakingKeeper { + return k.StakingKeeper +} + +func (k Keeper) GetFungibleKeeper() types.FungibleKeeper { + return k.fungibleKeeper +} + func (k Keeper) GetObserverKeeper() types.ZetaObserverKeeper { return k.zetaObserverKeeper } diff --git a/x/crosschain/keeper/keeper_cross_chain_tx_vote_outbound_tx.go b/x/crosschain/keeper/keeper_cross_chain_tx_vote_outbound_tx.go index 4d6c55071c..42d01988dd 100644 --- a/x/crosschain/keeper/keeper_cross_chain_tx_vote_outbound_tx.go +++ b/x/crosschain/keeper/keeper_cross_chain_tx_vote_outbound_tx.go @@ -3,6 +3,9 @@ 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" @@ -107,19 +110,29 @@ func (k msgServer) VoteOnObservedOutboundTx(goCtx context.Context, msg *types.Ms } if ballot.BallotStatus != observerTypes.BallotStatus_BallotFinalized_FailureObservation { if !msg.ZetaMinted.Equal(cctx.GetCurrentOutTxParam().Amount) { - log.Error().Msgf("ReceiveConfirmation: Mint mismatch: %s zeta minted vs %s cctx amount", + log.Error().Msgf("VoteOnObservedOutboundTx: Mint mismatch: %s zeta minted vs %s cctx amount", msg.ZetaMinted, cctx.GetCurrentOutTxParam().Amount) return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("ZetaMinted %s does not match send ZetaMint %s", msg.ZetaMinted, cctx.GetCurrentOutTxParam().Amount)) } } + // Update CCTX values cctx.GetCurrentOutTxParam().OutboundTxHash = msg.ObservedOutTxHash cctx.GetCurrentOutTxParam().OutboundTxGasUsed = msg.ObservedOutTxGasUsed cctx.GetCurrentOutTxParam().OutboundTxEffectiveGasPrice = msg.ObservedOutTxEffectiveGasPrice + cctx.GetCurrentOutTxParam().OutboundTxEffectiveGasLimit = msg.ObservedOutTxEffectiveGasLimit cctx.CctxStatus.LastUpdateTimestamp = ctx.BlockHeader().Time.Unix() + // Fund the gas stability pool with the remaining funds + if err := k.FundGasStabilityPoolFromRemainingFees(ctx, *cctx.GetCurrentOutTxParam(), msg.OutTxChain); err != nil { + log.Error().Msgf( + "VoteOnObservedOutboundTx: CCTX: %s Can't fund the gas stability pool with remaining fees %s", cctx.Index, err.Error(), + ) + } + tss, _ := k.GetTSS(ctx) + // FinalizeOutbound sets final status for a successful vote // FinalizeOutbound updates CCTX Prices and Nonce for a revert @@ -138,7 +151,8 @@ 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 { + if msg.CoinType == common.CoinType_Cmd || cctx.InboundTxParams.SenderChainId == common.ZetaChain().ChainId { + // 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 { switch oldStatus { @@ -186,3 +200,35 @@ func (k msgServer) VoteOnObservedOutboundTx(goCtx context.Context, msg *types.Ms k.SetCctxAndNonceToCctxAndInTxHashToCctx(ctx, cctx) return &types.MsgVoteOnObservedOutboundTxResponse{}, nil } + +func percentOf(n *big.Int, percent int64) *big.Int { + n = n.Mul(n, big.NewInt(percent)) + n = n.Div(n, big.NewInt(100)) + return n +} + +// FundGasStabilityPoolFromRemainingFees funds the gas stability pool with the remaining fees of an outbound tx +func (k Keeper) FundGasStabilityPoolFromRemainingFees(ctx sdk.Context, outboundTxParams types.OutboundTxParams, chainID int64) error { + gasUsed := outboundTxParams.OutboundTxGasUsed + gasLimit := outboundTxParams.OutboundTxEffectiveGasLimit + gasPrice := math.NewUintFromBigInt(outboundTxParams.OutboundTxEffectiveGasPrice.BigInt()) + + // We skip gas stability pool funding if one of the params is zero + if gasLimit > 0 && gasUsed > 0 && !gasPrice.IsZero() { + if gasLimit >= gasUsed { + remainingGas := gasLimit - gasUsed + remainingFees := math.NewUint(remainingGas).Mul(gasPrice).BigInt() + + // We fund the stability pool with a portion of the remaining fees + remainingFees = percentOf(remainingFees, RemainingFeesToStabilityPoolPercent) + + // Fund the gas stability pool + if err := k.fungibleKeeper.FundGasStabilityPool(ctx, chainID, remainingFees); err != nil { + return err + } + } else { + return fmt.Errorf("VoteOnObservedOutboundTx: The gas limit %d is less than the gas used %d", gasLimit, gasUsed) + } + } + return nil +} diff --git a/x/crosschain/keeper/keeper_cross_chain_tx_vote_outbound_tx_test.go b/x/crosschain/keeper/keeper_cross_chain_tx_vote_outbound_tx_test.go new file mode 100644 index 0000000000..1cb362df6f --- /dev/null +++ b/x/crosschain/keeper/keeper_cross_chain_tx_vote_outbound_tx_test.go @@ -0,0 +1,106 @@ +package keeper_test + +import ( + "errors" + "math/big" + "math/rand" + "testing" + + "cosmossdk.io/math" + "github.com/stretchr/testify/require" + testkeeper "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/crosschain/keeper" +) + +func TestKeeper_FundGasStabilityPoolFromRemainingFees(t *testing.T) { + r := rand.New(rand.NewSource(42)) + + tt := []struct { + name string + gasUsed uint64 + effectiveGasPrice math.Int + effectiveGasLimit uint64 + fundStabilityPoolReturn error + expectFundStabilityPoolCall bool + fundStabilityPoolExpectedRemainingFee *big.Int + isError bool + }{ + { + name: "no call if gasLimit is 0", + effectiveGasLimit: 0, + gasUsed: 42, + effectiveGasPrice: math.NewInt(42), + expectFundStabilityPoolCall: false, + }, + { + name: "no call if gasUsed is 0", + effectiveGasLimit: 42, + gasUsed: 0, + effectiveGasPrice: math.NewInt(42), + expectFundStabilityPoolCall: false, + }, + { + name: "no call if effectiveGasPrice is 0", + effectiveGasLimit: 42, + gasUsed: 42, + effectiveGasPrice: math.NewInt(0), + expectFundStabilityPoolCall: false, + }, + { + name: "should return error if gas limit is less than gas used", + effectiveGasLimit: 41, + gasUsed: 42, + effectiveGasPrice: math.NewInt(42), + isError: true, + }, + { + name: "should call fund stability pool with correct remaining fees", + effectiveGasLimit: 100, + gasUsed: 90, + effectiveGasPrice: math.NewInt(100), + fundStabilityPoolReturn: nil, + expectFundStabilityPoolCall: true, + fundStabilityPoolExpectedRemainingFee: big.NewInt(10 * keeper.RemainingFeesToStabilityPoolPercent), // (100-90)*100 = 1000 => statbilityPool% of 1000 = 10 * statbilityPool + }, + { + name: "should return error if fund stability pool returns error", + effectiveGasLimit: 100, + gasUsed: 90, + effectiveGasPrice: math.NewInt(100), + fundStabilityPoolReturn: errors.New("fund stability pool error"), + expectFundStabilityPoolCall: true, + fundStabilityPoolExpectedRemainingFee: big.NewInt(10 * keeper.RemainingFeesToStabilityPoolPercent), + isError: true, + }, + } + + for _, tc := range tt { + tc := tc + t.Run(tc.name, func(t *testing.T) { + k, ctx := testkeeper.CrosschainKeeperAllMocks(t) + fungibleMock := testkeeper.GetCrosschainFungibleMock(t, k) + + // OutboundTxParams + outbound := sample.OutboundTxParams(r) + outbound.OutboundTxEffectiveGasLimit = tc.effectiveGasLimit + outbound.OutboundTxGasUsed = tc.gasUsed + outbound.OutboundTxEffectiveGasPrice = tc.effectiveGasPrice + + if tc.expectFundStabilityPoolCall { + fungibleMock.On( + "FundGasStabilityPool", ctx, int64(42), tc.fundStabilityPoolExpectedRemainingFee, + ).Return(tc.fundStabilityPoolReturn) + } + + err := k.FundGasStabilityPoolFromRemainingFees(ctx, *outbound, 42) + if tc.isError { + require.Error(t, err) + return + } + require.NoError(t, err) + + fungibleMock.AssertExpectations(t) + }) + } +} diff --git a/x/crosschain/keeper/keeper_params.go b/x/crosschain/keeper/keeper_params.go index 333919e5de..b81567feb5 100644 --- a/x/crosschain/keeper/keeper_params.go +++ b/x/crosschain/keeper/keeper_params.go @@ -10,7 +10,7 @@ import ( ) // GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { +func (k Keeper) GetParams(_ sdk.Context) types.Params { return types.NewParams() } diff --git a/x/crosschain/keeper/keeper_utils.go b/x/crosschain/keeper/keeper_utils.go index 1351dc1032..77882f6a2b 100644 --- a/x/crosschain/keeper/keeper_utils.go +++ b/x/crosschain/keeper/keeper_utils.go @@ -13,7 +13,7 @@ import ( zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types" ) -// IsAuthorized 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 +// 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) if found { diff --git a/x/crosschain/keeper/test_testnet.go b/x/crosschain/keeper/test_testnet.go index 9475782951..7a3a7375b8 100644 --- a/x/crosschain/keeper/test_testnet.go +++ b/x/crosschain/keeper/test_testnet.go @@ -7,6 +7,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -func (k Keeper) TestWhitelistERC20(ctx sdk.Context) error { +func (k Keeper) TestWhitelistERC20(_ sdk.Context) error { return nil } diff --git a/x/crosschain/keeper/zeta_conversion_rate.go b/x/crosschain/keeper/zeta_conversion_rate.go index e6fd7acdea..b1c0e4df61 100644 --- a/x/crosschain/keeper/zeta_conversion_rate.go +++ b/x/crosschain/keeper/zeta_conversion_rate.go @@ -41,7 +41,7 @@ func (k Keeper) ConvertGasToZeta(context context.Context, request *types.QueryCo }, nil } -func (k Keeper) ProtocolFee(context context.Context, req *types.QueryMessagePassingProtocolFeeRequest) (*types.QueryMessagePassingProtocolFeeResponse, error) { +func (k Keeper) ProtocolFee(_ context.Context, _ *types.QueryMessagePassingProtocolFeeRequest) (*types.QueryMessagePassingProtocolFeeResponse, error) { return &types.QueryMessagePassingProtocolFeeResponse{ FeeInZeta: types.GetProtocolFee().String(), }, nil diff --git a/x/crosschain/module.go b/x/crosschain/module.go index 79543b077d..314af4cc07 100644 --- a/x/crosschain/module.go +++ b/x/crosschain/module.go @@ -5,7 +5,6 @@ import ( "encoding/json" "fmt" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" @@ -63,7 +62,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis performs genesis state validation for the crosschain module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var genState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genState); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -72,7 +71,7 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod } // RegisterRESTRoutes registers the crosschain module's REST service handlers. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { +func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) { } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. @@ -135,7 +134,7 @@ func (am AppModule) Route() sdk.Route { func (AppModule) QuerierRoute() string { return types.QuerierRoute } // LegacyQuerierHandler returns the crosschain module's Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { +func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { return nil } @@ -185,15 +184,15 @@ func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { panic(err) } } + + err := am.keeper.IterateAndUpdateCctxGasPrice(ctx) + if err != nil { + ctx.Logger().Error("Error iterating and updating pending cctx gas price", "err", err.Error()) + } } // EndBlock executes all ABCI EndBlock logic respective to the crosschain module. It // returns no validator updates. -func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - +func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { return []abci.ValidatorUpdate{} } - -var ( - ModuleAddress = authtypes.NewModuleAddress(types.ModuleName) -) diff --git a/x/crosschain/module_simulation.go b/x/crosschain/module_simulation.go index cfc647ad6d..ef8ecee194 100644 --- a/x/crosschain/module_simulation.go +++ b/x/crosschain/module_simulation.go @@ -36,7 +36,7 @@ func (am AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} // WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { +func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { operations := make([]simtypes.WeightedOperation, 0) return operations diff --git a/x/crosschain/types/cross_chain_tx.pb.go b/x/crosschain/types/cross_chain_tx.pb.go index 93554fd8da..1b09cbe090 100644 --- a/x/crosschain/types/cross_chain_tx.pb.go +++ b/x/crosschain/types/cross_chain_tx.pb.go @@ -187,6 +187,7 @@ type OutboundTxParams struct { OutboundTxObservedExternalHeight uint64 `protobuf:"varint,10,opt,name=outbound_tx_observed_external_height,json=outboundTxObservedExternalHeight,proto3" json:"outbound_tx_observed_external_height,omitempty"` OutboundTxGasUsed uint64 `protobuf:"varint,20,opt,name=outbound_tx_gas_used,json=outboundTxGasUsed,proto3" json:"outbound_tx_gas_used,omitempty"` OutboundTxEffectiveGasPrice github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,21,opt,name=outbound_tx_effective_gas_price,json=outboundTxEffectiveGasPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"outbound_tx_effective_gas_price"` + OutboundTxEffectiveGasLimit uint64 `protobuf:"varint,22,opt,name=outbound_tx_effective_gas_limit,json=outboundTxEffectiveGasLimit,proto3" json:"outbound_tx_effective_gas_limit,omitempty"` TssPubkey string `protobuf:"bytes,11,opt,name=tss_pubkey,json=tssPubkey,proto3" json:"tss_pubkey,omitempty"` } @@ -293,6 +294,13 @@ func (m *OutboundTxParams) GetOutboundTxGasUsed() uint64 { return 0 } +func (m *OutboundTxParams) GetOutboundTxEffectiveGasLimit() uint64 { + if m != nil { + return m.OutboundTxEffectiveGasLimit + } + return 0 +} + func (m *OutboundTxParams) GetTssPubkey() string { if m != nil { return m.TssPubkey @@ -456,69 +464,70 @@ func init() { func init() { proto.RegisterFile("crosschain/cross_chain_tx.proto", fileDescriptor_af3a0ad055343c21) } var fileDescriptor_af3a0ad055343c21 = []byte{ - // 987 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xdd, 0x6e, 0x1b, 0x45, - 0x14, 0xce, 0x62, 0xc7, 0xb1, 0x8f, 0x9b, 0x78, 0x33, 0x71, 0x60, 0x95, 0x52, 0xdb, 0x32, 0xb4, - 0x75, 0x91, 0x62, 0x2b, 0x41, 0xa8, 0x12, 0x77, 0x4d, 0xd4, 0xb4, 0x11, 0x6d, 0x13, 0x2d, 0xc9, - 0x4d, 0x24, 0xb4, 0x8c, 0x77, 0x4f, 0xec, 0x51, 0xbd, 0x3b, 0xd6, 0xce, 0x38, 0xda, 0x54, 0x5c, - 0xf1, 0x04, 0x3c, 0x04, 0x48, 0x3c, 0x4a, 0x2f, 0xb8, 0xe8, 0x25, 0xe2, 0x22, 0x42, 0xc9, 0x1b, - 0xf0, 0x04, 0x68, 0x66, 0x76, 0xed, 0x8d, 0x49, 0x09, 0xa8, 0x57, 0x3e, 0x3f, 0xf3, 0x9d, 0x39, - 0x3f, 0xdf, 0x1c, 0x2f, 0x34, 0xfd, 0x98, 0x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xf6, 0xa3, 0xee, 0xbf, 0x2e, - 0xd4, 0xee, 0xae, 0x2f, 0x13, 0x03, 0x75, 0x53, 0x20, 0xb9, 0x0f, 0x2b, 0x46, 0xf2, 0x42, 0x14, - 0x82, 0x0e, 0x50, 0x3f, 0x80, 0x8a, 0xbb, 0x6c, 0xac, 0x2f, 0x8d, 0x91, 0x6c, 0x41, 0x7d, 0x44, - 0x85, 0x3c, 0x1e, 0x07, 0x54, 0xa2, 0x27, 0x59, 0x88, 0x42, 0xd2, 0x70, 0xac, 0x5f, 0x42, 0xc1, - 0x5d, 0x9b, 0xf9, 0x8e, 0x32, 0x57, 0xfb, 0xb7, 0x02, 0xdc, 0xd9, 0x55, 0x77, 0xeb, 0x27, 0x74, - 0x94, 0x10, 0x07, 0x96, 0xfc, 0x18, 0xa9, 0xe4, 0xd9, 0x43, 0xcc, 0x54, 0xb5, 0x1d, 0x0d, 0x1d, - 0xcc, 0xdd, 0x46, 0x21, 0xdf, 0x43, 0x45, 0x6f, 0x80, 0x53, 0x44, 0x61, 0xf6, 0xe6, 0xce, 0xee, - 0xff, 0x7c, 0x46, 0x7f, 0x5d, 0x34, 0xed, 0x73, 0x1a, 0x8e, 0xbe, 0x6e, 0x4f, 0x23, 0xb5, 0xdd, - 0xb2, 0x92, 0xf7, 0x10, 0x05, 0x79, 0x08, 0xb5, 0x18, 0x47, 0xf4, 0x1c, 0x83, 0x69, 0xf5, 0x25, - 0x43, 0xe1, 0xd4, 0x9c, 0x95, 0xbf, 0x07, 0x55, 0xdf, 0x97, 0x89, 0x97, 0x76, 0x5b, 0xf1, 0xbc, - 0xba, 0x7d, 0xff, 0x96, 0x6e, 0xa7, 0x9d, 0x06, 0x7f, 0xda, 0x75, 0x72, 0x02, 0xab, 0xb9, 0x4d, - 0x37, 0xd6, 0x1b, 0x4a, 0xbf, 0x81, 0xea, 0x76, 0xf7, 0x96, 0x68, 0x73, 0xff, 0x6e, 0x6e, 0x8d, - 0xcd, 0xfd, 0xdd, 0x7d, 0x07, 0x24, 0x4f, 0xd6, 0x34, 0x38, 0xb4, 0x0a, 0x9d, 0xea, 0x76, 0xef, - 0x96, 0xe0, 0xf3, 0x5b, 0xd3, 0xb5, 0xf9, 0x9c, 0xe5, 0x8b, 0x1f, 0x00, 0x66, 0xf4, 0x21, 0x04, - 0x56, 0x0e, 0x31, 0x0a, 0x58, 0x34, 0x48, 0xf3, 0xb2, 0x17, 0xc8, 0x1a, 0xd4, 0x52, 0x5b, 0x16, - 0xce, 0xb6, 0xc8, 0x2a, 0x2c, 0x67, 0xda, 0x4b, 0x16, 0x61, 0x60, 0x17, 0x94, 0x29, 0x3d, 0xe7, - 0xe2, 0x19, 0xc6, 0xd2, 0x2e, 0x92, 0x3b, 0x50, 0x36, 0x32, 0x06, 0xf6, 0x22, 0xa9, 0xc2, 0xd2, - 0x93, 0x3e, 0xd7, 0x4a, 0x69, 0xa3, 0xf8, 0xeb, 0xcf, 0x0d, 0x6b, 0xe7, 0x9b, 0xb7, 0x97, 0x0d, - 0xeb, 0xdd, 0x65, 0xc3, 0xfa, 0xf3, 0xb2, 0x61, 0xfd, 0x74, 0xd5, 0x58, 0x78, 0x77, 0xd5, 0x58, - 0xf8, 0xfd, 0xaa, 0xb1, 0x70, 0xb2, 0x95, 0xa3, 0x82, 0x2a, 0x6d, 0xd3, 0x7c, 0x6f, 0x64, 0x55, - 0xf6, 0x92, 0x5e, 0xee, 0x2b, 0x44, 0x33, 0xa3, 0x5f, 0xd2, 0xdf, 0x0c, 0x5f, 0xfe, 0x1d, 0x00, - 0x00, 0xff, 0xff, 0xaa, 0x2f, 0x84, 0xc3, 0xa0, 0x08, 0x00, 0x00, + // 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, 0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9a, 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, } func (m *InboundTxParams) Marshal() (dAtA []byte, err error) { @@ -629,6 +638,13 @@ func (m *OutboundTxParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.OutboundTxEffectiveGasLimit != 0 { + i = encodeVarintCrossChainTx(dAtA, i, uint64(m.OutboundTxEffectiveGasLimit)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xb0 + } { size := m.OutboundTxEffectiveGasPrice.Size() i -= size @@ -955,6 +971,9 @@ func (m *OutboundTxParams) Size() (n int) { } l = m.OutboundTxEffectiveGasPrice.Size() n += 2 + l + sovCrossChainTx(uint64(l)) + if m.OutboundTxEffectiveGasLimit != 0 { + n += 2 + sovCrossChainTx(uint64(m.OutboundTxEffectiveGasLimit)) + } return n } @@ -1711,6 +1730,25 @@ func (m *OutboundTxParams) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 22: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OutboundTxEffectiveGasLimit", wireType) + } + m.OutboundTxEffectiveGasLimit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCrossChainTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OutboundTxEffectiveGasLimit |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipCrossChainTx(dAtA[iNdEx:]) diff --git a/x/crosschain/types/errors.go b/x/crosschain/types/errors.go index c2ba28b6ae..aa78a52a87 100644 --- a/x/crosschain/types/errors.go +++ b/x/crosschain/types/errors.go @@ -29,4 +29,5 @@ var ( ErrInvalidAddress = errorsmod.Register(ModuleName, 1128, "Invalid address") ErrDeployContract = errorsmod.Register(ModuleName, 1129, "Unable to deploy contract") ErrUnableToUpdateTss = errorsmod.Register(ModuleName, 1130, "Unable to update TSS address") + ErrNotEnoughFunds = errorsmod.Register(ModuleName, 1131, "Not enough funds") ) diff --git a/x/crosschain/types/expected_keepers.go b/x/crosschain/types/expected_keepers.go index 59d5372749..fe35310c01 100644 --- a/x/crosschain/types/expected_keepers.go +++ b/x/crosschain/types/expected_keepers.go @@ -108,4 +108,6 @@ type FungibleKeeper interface { erc20Contract string, gasLimit *big.Int, ) (eth.Address, error) + FundGasStabilityPool(ctx sdk.Context, chainID int64, amount *big.Int) error + WithdrawFromGasStabilityPool(ctx sdk.Context, chainID int64, amount *big.Int) error } diff --git a/x/crosschain/types/message_vote_on_observed_outbound_tx.go b/x/crosschain/types/message_vote_on_observed_outbound_tx.go index 4474fe9ac9..9bccf434c6 100644 --- a/x/crosschain/types/message_vote_on_observed_outbound_tx.go +++ b/x/crosschain/types/message_vote_on_observed_outbound_tx.go @@ -17,6 +17,7 @@ func NewMsgVoteOnObservedOutboundTx( outBlockHeight, outTxGasUsed uint64, outTxEffectiveGasPrice math.Int, + outTxEffectiveGasLimit uint64, mMint math.Uint, status common.ReceiveStatus, chain int64, @@ -30,6 +31,7 @@ func NewMsgVoteOnObservedOutboundTx( ObservedOutTxBlockHeight: outBlockHeight, ObservedOutTxGasUsed: outTxGasUsed, ObservedOutTxEffectiveGasPrice: outTxEffectiveGasPrice, + ObservedOutTxEffectiveGasLimit: outTxEffectiveGasLimit, ZetaMinted: mMint, Status: status, OutTxChain: chain, diff --git a/x/crosschain/types/message_vote_on_observed_outbound_tx_test.go b/x/crosschain/types/message_vote_on_observed_outbound_tx_test.go index 9e09d98f20..7df78fd94d 100644 --- a/x/crosschain/types/message_vote_on_observed_outbound_tx_test.go +++ b/x/crosschain/types/message_vote_on_observed_outbound_tx_test.go @@ -27,6 +27,7 @@ func TestMsgVoteOnObservedOutboundTx_ValidateBasic(t *testing.T) { ObservedOutTxBlockHeight: 42, ObservedOutTxGasUsed: 42, ObservedOutTxEffectiveGasPrice: math.NewInt(42), + ObservedOutTxEffectiveGasLimit: 42, ZetaMinted: math.NewUint(42), Status: common.ReceiveStatus_Created, OutTxChain: 42, @@ -58,6 +59,7 @@ func TestMsgVoteOnObservedOutboundTx_ValidateBasic(t *testing.T) { ObservedOutTxBlockHeight: 42, ObservedOutTxGasUsed: 42, ObservedOutTxEffectiveGasPrice: math.NewInt(42), + ObservedOutTxEffectiveGasLimit: 42, ZetaMinted: math.NewUint(42), Status: common.ReceiveStatus_Created, OutTxChain: 42, @@ -75,6 +77,7 @@ func TestMsgVoteOnObservedOutboundTx_ValidateBasic(t *testing.T) { ObservedOutTxBlockHeight: 42, ObservedOutTxGasUsed: 42, ObservedOutTxEffectiveGasPrice: math.NewInt(42), + ObservedOutTxEffectiveGasLimit: 42, ZetaMinted: math.NewUint(42), Status: common.ReceiveStatus_Created, OutTxChain: -1, @@ -106,6 +109,7 @@ func TestMsgVoteOnObservedOutboundTx_Digest(t *testing.T) { ObservedOutTxBlockHeight: 42, ObservedOutTxGasUsed: 42, ObservedOutTxEffectiveGasPrice: math.NewInt(42), + ObservedOutTxEffectiveGasLimit: 42, ZetaMinted: math.NewUint(42), Status: common.ReceiveStatus_Created, OutTxChain: 42, @@ -157,6 +161,12 @@ func TestMsgVoteOnObservedOutboundTx_Digest(t *testing.T) { hash2 = msg2.Digest() require.NotEqual(t, hash, hash2, "observed outbound tx effective gas price should change hash") + // observed outbound tx effective gas limit used + msg2 = msg + msg2.ObservedOutTxEffectiveGasLimit = 43 + hash2 = msg2.Digest() + require.NotEqual(t, hash, hash2, "observed outbound tx effective gas limit should change hash") + // zeta minted used msg2 = msg msg2.ZetaMinted = math.NewUint(43) diff --git a/x/crosschain/types/tx.pb.go b/x/crosschain/types/tx.pb.go index 240f500032..303a06633a 100644 --- a/x/crosschain/types/tx.pb.go +++ b/x/crosschain/types/tx.pb.go @@ -766,6 +766,7 @@ type MsgVoteOnObservedOutboundTx struct { ObservedOutTxBlockHeight uint64 `protobuf:"varint,4,opt,name=observed_outTx_blockHeight,json=observedOutTxBlockHeight,proto3" json:"observed_outTx_blockHeight,omitempty"` ObservedOutTxGasUsed uint64 `protobuf:"varint,10,opt,name=observed_outTx_gas_used,json=observedOutTxGasUsed,proto3" json:"observed_outTx_gas_used,omitempty"` ObservedOutTxEffectiveGasPrice github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,11,opt,name=observed_outTx_effective_gas_price,json=observedOutTxEffectiveGasPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"observed_outTx_effective_gas_price"` + ObservedOutTxEffectiveGasLimit uint64 `protobuf:"varint,12,opt,name=observed_outTx_effective_gas_limit,json=observedOutTxEffectiveGasLimit,proto3" json:"observed_outTx_effective_gas_limit,omitempty"` ZetaMinted github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,5,opt,name=zeta_minted,json=zetaMinted,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"zeta_minted" yaml:"zeta_minted"` Status common.ReceiveStatus `protobuf:"varint,6,opt,name=status,proto3,enum=common.ReceiveStatus" json:"status,omitempty"` OutTxChain int64 `protobuf:"varint,7,opt,name=outTx_chain,json=outTxChain,proto3" json:"outTx_chain,omitempty"` @@ -841,6 +842,13 @@ func (m *MsgVoteOnObservedOutboundTx) GetObservedOutTxGasUsed() uint64 { return 0 } +func (m *MsgVoteOnObservedOutboundTx) GetObservedOutTxEffectiveGasLimit() uint64 { + if m != nil { + return m.ObservedOutTxEffectiveGasLimit + } + return 0 +} + func (m *MsgVoteOnObservedOutboundTx) GetStatus() common.ReceiveStatus { if m != nil { return m.Status @@ -1198,89 +1206,90 @@ func init() { func init() { proto.RegisterFile("crosschain/tx.proto", fileDescriptor_81d6d611190b7635) } var fileDescriptor_81d6d611190b7635 = []byte{ - // 1300 bytes of a gzipped FileDescriptorProto + // 1313 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0x36, 0x89, 0x63, 0xbf, 0xd4, 0x69, 0x32, 0x49, 0x9b, 0xed, 0xa6, 0x75, 0xda, 0x2d, - 0x2d, 0x15, 0x6a, 0xec, 0x92, 0x82, 0x28, 0x85, 0x03, 0x4d, 0x54, 0xd2, 0xaa, 0x38, 0xa9, 0x36, - 0x2e, 0x48, 0xbd, 0xac, 0xd6, 0xbb, 0x93, 0xf5, 0x2a, 0xde, 0x1d, 0x6b, 0x67, 0x1c, 0xd9, 0x15, - 0x27, 0x04, 0x07, 0x6e, 0x1c, 0x90, 0x40, 0x7c, 0x01, 0xbe, 0x4a, 0xb9, 0x55, 0x9c, 0x10, 0x87, - 0x0a, 0x9a, 0x6f, 0xc0, 0x27, 0x40, 0xf3, 0x67, 0x37, 0x5e, 0x27, 0xb6, 0xe3, 0x20, 0x4e, 0x3b, - 0xef, 0xed, 0xbc, 0xf7, 0x7e, 0xef, 0xcd, 0xef, 0xcd, 0x1f, 0x58, 0x74, 0x63, 0x42, 0xa9, 0xdb, - 0x70, 0x82, 0xa8, 0xc2, 0x3a, 0xe5, 0x56, 0x4c, 0x18, 0x41, 0x57, 0x5f, 0x62, 0xe6, 0x08, 0x5d, - 0x59, 0x8c, 0x48, 0x8c, 0xcb, 0x47, 0xf3, 0x8c, 0x45, 0x97, 0x84, 0x21, 0x89, 0x2a, 0xf2, 0x23, - 0x6d, 0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09, 0x43, 0x12, 0x55, 0xe4, 0x47, 0xfa, + 0x18, 0xcb, 0x3e, 0xf1, 0x89, 0x18, 0x56, 0xf8, 0x48, 0x6a, 0xcd, 0x1d, 0x58, 0xaa, 0x52, 0xff, + 0x59, 0xcb, 0x73, 0x18, 0xae, 0x51, 0xfa, 0xc0, 0xf3, 0x62, 0x4c, 0x29, 0xd2, 0x61, 0xc6, 0x8d, + 0xb1, 0xc3, 0x48, 0xac, 0x6b, 0x57, 0xb5, 0x5b, 0x05, 0x2b, 0x11, 0xd1, 0x15, 0x00, 0x46, 0xa9, + 0xdd, 0x6a, 0xd7, 0x0f, 0x70, 0x57, 0x3f, 0x27, 0x7e, 0x16, 0x18, 0xa5, 0x4f, 0x85, 0xc2, 0xbc, + 0x02, 0xab, 0x27, 0xc4, 0xb3, 0x30, 0x6d, 0x91, 0x88, 0x62, 0xf3, 0x77, 0x0d, 0x16, 0xab, 0xd4, + 0xff, 0xba, 0x11, 0x30, 0xdc, 0x0c, 0x28, 0x7b, 0x68, 0x6d, 0x6d, 0xdc, 0x19, 0x92, 0xed, 0x3a, + 0x14, 0x71, 0xec, 0x6e, 0xdc, 0xb1, 0x1d, 0x19, 0x48, 0x25, 0x9c, 0x13, 0xca, 0x04, 0xec, 0x25, + 0xc8, 0x8b, 0xba, 0xed, 0xc0, 0xd3, 0x27, 0xaf, 0x6a, 0xb7, 0x26, 0xad, 0x19, 0x21, 0x3f, 0xf6, + 0x10, 0x82, 0xa9, 0xc8, 0x09, 0xb1, 0x3e, 0x25, 0xdc, 0xc4, 0x18, 0x5d, 0x84, 0x1c, 0xed, 0x86, + 0x75, 0xd2, 0xd4, 0xa7, 0x85, 0x56, 0x49, 0xc8, 0x80, 0xbc, 0x87, 0xdd, 0x20, 0x74, 0x9a, 0x54, + 0xcf, 0x5d, 0xd5, 0x6e, 0x15, 0xad, 0x54, 0x46, 0xab, 0x50, 0xf0, 0x1d, 0x6a, 0x37, 0x83, 0x30, + 0x60, 0xfa, 0x8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57, 0x12, 0x2f, 0x47, 0x8e, 0xec, 0xbe, 0xa3, 0xb0, 0x28, + 0xd5, 0x5b, 0xaa, 0x43, 0x0d, 0xc8, 0xc7, 0x72, 0xc2, 0x62, 0x75, 0x58, 0xa4, 0x32, 0xba, 0x01, + 0xf3, 0xc9, 0x58, 0x4d, 0xdb, 0xb4, 0x0c, 0x91, 0x68, 0xe5, 0xcc, 0x6d, 0x43, 0xce, 0x09, 0x49, + 0x3b, 0x62, 0x62, 0x25, 0x0a, 0x9b, 0x95, 0x31, 0x17, 0xdb, 0x52, 0xee, 0xbc, 0xca, 0x10, 0x53, + 0xea, 0xf8, 0x72, 0xea, 0x0b, 0x56, 0x22, 0xa2, 0xcb, 0x00, 0x7c, 0xca, 0x55, 0xe3, 0x16, 0x24, + 0xce, 0x20, 0x52, 0xfd, 0x7a, 0x13, 0xce, 0x07, 0x91, 0xec, 0x51, 0xbb, 0x21, 0x9b, 0x54, 0x76, + 0x5a, 0x31, 0x88, 0x7a, 0x3b, 0x33, 0x73, 0x68, 0xcf, 0x0a, 0x8b, 0xf4, 0xd0, 0xce, 0xae, 0xeb, + 0xdc, 0xa8, 0x75, 0xe5, 0xb1, 0x58, 0xc7, 0x26, 0x71, 0xe0, 0x07, 0x91, 0x5e, 0x94, 0x80, 0x58, + 0x67, 0x57, 0xc8, 0x7c, 0xdb, 0x73, 0x28, 0xc5, 0x4c, 0x9f, 0x17, 0x3f, 0xa4, 0x60, 0xbe, 0x03, + 0xe6, 0xe0, 0x25, 0x4e, 0x99, 0xf0, 0xbd, 0x06, 0xf3, 0x55, 0xea, 0xef, 0x61, 0xb6, 0x43, 0x3c, + 0xfc, 0x04, 0x77, 0x87, 0x5d, 0xbe, 0x2a, 0x50, 0x90, 0xe7, 0xdd, 0x1e, 0x66, 0x82, 0x00, 0xb3, + 0x1b, 0x8b, 0x09, 0xe8, 0xa7, 0xed, 0xfa, 0x13, 0xf1, 0xc3, 0x3a, 0xb2, 0x41, 0xb7, 0x01, 0x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 0x31, 0x3a, 0x5c, 0xbf, 0x8f, 0x71, 0x7f, 0x7c, 0x9f, 0x04, 0xc4, 0xe6, + 0x93, 0x97, 0x6f, 0x4a, 0xda, 0xab, 0x37, 0x25, 0xed, 0xaf, 0x37, 0x25, 0xed, 0x87, 0xb7, 0xa5, + 0x89, 0x57, 0x6f, 0x4b, 0x13, 0x7f, 0xbc, 0x2d, 0x4d, 0x3c, 0x7f, 0xbf, 0xe7, 0x04, 0xe3, 0x51, + 0xd7, 0xe5, 0xb3, 0x3b, 0x49, 0x50, 0xe9, 0x54, 0x7a, 0x1f, 0xe3, 0xfc, 0x40, 0xab, 0xe7, 0xc4, + 0x33, 0xfa, 0xee, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x7d, 0xa2, 0x25, 0x9b, 0xa7, 0x0f, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2161,6 +2170,11 @@ func (m *MsgVoteOnObservedOutboundTx) MarshalToSizedBuffer(dAtA []byte) (int, er _ = i var l int _ = l + if m.ObservedOutTxEffectiveGasLimit != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ObservedOutTxEffectiveGasLimit)) + i-- + dAtA[i] = 0x60 + } { size := m.ObservedOutTxEffectiveGasPrice.Size() i -= size @@ -2735,6 +2749,9 @@ func (m *MsgVoteOnObservedOutboundTx) Size() (n int) { } l = m.ObservedOutTxEffectiveGasPrice.Size() n += 1 + l + sovTx(uint64(l)) + if m.ObservedOutTxEffectiveGasLimit != 0 { + n += 1 + sovTx(uint64(m.ObservedOutTxEffectiveGasLimit)) + } return n } @@ -4567,6 +4584,25 @@ func (m *MsgVoteOnObservedOutboundTx) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ObservedOutTxEffectiveGasLimit", wireType) + } + m.ObservedOutTxEffectiveGasLimit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ObservedOutTxEffectiveGasLimit |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/emissions/client/cli/query.go b/x/emissions/client/cli/query.go index d1e41b3027..b4ae1a4e03 100644 --- a/x/emissions/client/cli/query.go +++ b/x/emissions/client/cli/query.go @@ -14,7 +14,7 @@ import ( ) // GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { +func GetQueryCmd(_ string) *cobra.Command { // Group emissions queries under a subcommand cmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/emissions/keeper/grpc_query_list_balances.go b/x/emissions/keeper/grpc_query_list_balances.go index 0f150db479..1b9e9864a6 100644 --- a/x/emissions/keeper/grpc_query_list_balances.go +++ b/x/emissions/keeper/grpc_query_list_balances.go @@ -8,7 +8,7 @@ import ( "google.golang.org/grpc/status" ) -func (k Keeper) ListPoolAddresses(ctx context.Context, req *types.QueryListPoolAddressesRequest) (*types.QueryListPoolAddressesResponse, error) { +func (k Keeper) ListPoolAddresses(_ context.Context, req *types.QueryListPoolAddressesRequest) (*types.QueryListPoolAddressesResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } diff --git a/x/emissions/keeper/params.go b/x/emissions/keeper/params.go index 02364fd93d..2e93eb1cde 100644 --- a/x/emissions/keeper/params.go +++ b/x/emissions/keeper/params.go @@ -6,7 +6,7 @@ import ( ) // GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { +func (k Keeper) GetParams(_ sdk.Context) types.Params { return types.NewParams() } diff --git a/x/emissions/module.go b/x/emissions/module.go index b264853733..c9614c6ab4 100644 --- a/x/emissions/module.go +++ b/x/emissions/module.go @@ -62,7 +62,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis performs genesis state validation for the emissions module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var genState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genState); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -71,11 +71,11 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod } // RegisterRESTRoutes registers the emissions module's REST service handlers. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { +func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) { } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { +func (AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *runtime.ServeMux) { } // GetTxCmd returns the emissions module's root tx command. @@ -126,7 +126,7 @@ func (am AppModule) Route() sdk.Route { func (AppModule) QuerierRoute() string { return types.QuerierRoute } // LegacyQuerierHandler returns the emissions module's Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { +func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { return nil } diff --git a/x/emissions/types/codec.go b/x/emissions/types/codec.go index b70e2a444a..4f0a3e3b48 100644 --- a/x/emissions/types/codec.go +++ b/x/emissions/types/codec.go @@ -6,7 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/msgservice" ) -func RegisterCodec(cdc *codec.LegacyAmino) { +func RegisterCodec(_ *codec.LegacyAmino) { } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { diff --git a/x/fungible/client/cli/query.go b/x/fungible/client/cli/query.go index dd3e3c64b6..f4e4e7994e 100644 --- a/x/fungible/client/cli/query.go +++ b/x/fungible/client/cli/query.go @@ -14,7 +14,7 @@ import ( ) // GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { +func GetQueryCmd(_ string) *cobra.Command { // Group fungible queries under a subcommand cmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/fungible/genesis_test.go b/x/fungible/genesis_test.go index 8222561318..119e862a18 100644 --- a/x/fungible/genesis_test.go +++ b/x/fungible/genesis_test.go @@ -15,15 +15,15 @@ func TestGenesis(t *testing.T) { genesisState := types.GenesisState{ Params: types.DefaultParams(), ForeignCoinsList: []types.ForeignCoins{ - sample.ForeignCoins(t), - sample.ForeignCoins(t), - sample.ForeignCoins(t), + sample.ForeignCoins(t, sample.EthAddress().String()), + sample.ForeignCoins(t, sample.EthAddress().String()), + sample.ForeignCoins(t, sample.EthAddress().String()), }, SystemContract: sample.SystemContract(), } // Init and export - k, ctx, _ := keepertest.FungibleKeeper(t) + k, ctx, _, _ := keepertest.FungibleKeeper(t) fungible.InitGenesis(ctx, *k, genesisState) got := fungible.ExportGenesis(ctx, *k) require.NotNil(t, got) diff --git a/x/fungible/keeper/begin_blocker_deploy_system_contracts.go b/x/fungible/keeper/begin_blocker_deploy_system_contracts.go index 1c36e56a65..495a51563d 100644 --- a/x/fungible/keeper/begin_blocker_deploy_system_contracts.go +++ b/x/fungible/keeper/begin_blocker_deploy_system_contracts.go @@ -7,12 +7,12 @@ import ( "context" ) -func (k Keeper) BlockOneDeploySystemContracts(goCtx context.Context) error { +func (k Keeper) BlockOneDeploySystemContracts(_ context.Context) error { return nil } -func (k Keeper) TestUpdateSystemContractAddress(goCtx context.Context) error { +func (k Keeper) TestUpdateSystemContractAddress(_ context.Context) error { return nil } -func (k Keeper) TestUpdateZRC20WithdrawFee(goCtx context.Context) error { +func (k Keeper) TestUpdateZRC20WithdrawFee(_ context.Context) error { return nil } diff --git a/x/fungible/keeper/evm_hooks.go b/x/fungible/keeper/evm_hooks.go new file mode 100644 index 0000000000..80d4303089 --- /dev/null +++ b/x/fungible/keeper/evm_hooks.go @@ -0,0 +1,57 @@ +package keeper + +import ( + cosmoserrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + ethcommon "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" + ethtypes "github.com/ethereum/go-ethereum/core/types" + evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/zeta-chain/zetacore/x/fungible/types" +) + +var _ evmtypes.EvmHooks = EVMHooks{} + +type EVMHooks struct { + k Keeper +} + +func (k Keeper) EVMHooks() EVMHooks { + return EVMHooks{k} +} + +// PostTxProcessing is a wrapper for calling the EVM PostTxProcessing hook on the module keeper +func (h EVMHooks) PostTxProcessing(ctx sdk.Context, _ core.Message, receipt *ethtypes.Receipt) error { + return h.k.CheckPausedZRC20(ctx, receipt) +} + +// CheckPausedZRC20 checks the events of the receipt +// if an event is emitted from a paused ZRC20 contract it will revert the transaction +func (k Keeper) CheckPausedZRC20(ctx sdk.Context, receipt *ethtypes.Receipt) error { + if receipt == nil { + return nil + } + + // get non-duplicated list of all addresses that emitted logs + var addresses []ethcommon.Address + addressExist := make(map[ethcommon.Address]struct{}) + for _, log := range receipt.Logs { + if log == nil { + continue + } + if _, ok := addressExist[log.Address]; !ok { + addressExist[log.Address] = struct{}{} + addresses = append(addresses, log.Address) + } + } + + // check if any of the addresses are from a paused ZRC20 contract + for _, address := range addresses { + fc, found := k.GetForeignCoins(ctx, address.Hex()) + if found && fc.Paused { + return cosmoserrors.Wrap(types.ErrPausedZRC20, address.Hex()) + } + } + + return nil +} diff --git a/x/fungible/keeper/evm_hooks_test.go b/x/fungible/keeper/evm_hooks_test.go new file mode 100644 index 0000000000..43e8a58326 --- /dev/null +++ b/x/fungible/keeper/evm_hooks_test.go @@ -0,0 +1,134 @@ +package keeper_test + +import ( + "testing" + + ethtypes "github.com/ethereum/go-ethereum/core/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/fungible/types" +) + +func TestKeeper_CheckPausedZRC20(t *testing.T) { + addrUnpausedZRC20A, addrUnpausedZRC20B, addrUnpausedZRC20C, addrPausedZRC20 := + sample.EthAddress(), + sample.EthAddress(), + sample.EthAddress(), + sample.EthAddress() + + tt := []struct { + name string + receipt *ethtypes.Receipt + wantErr bool + }{ + { + name: "should pass if receipt is nil", + receipt: nil, + wantErr: false, + }, + { + name: "should pass if receipt is empty", + receipt: ðtypes.Receipt{ + Logs: []*ethtypes.Log{}, + }, + wantErr: false, + }, + { + name: "should pass if receipt contains unpaused ZRC20 and non ZRC20 addresses", + receipt: ðtypes.Receipt{ + Logs: []*ethtypes.Log{ + { + Address: sample.EthAddress(), + }, + { + Address: addrUnpausedZRC20A, + }, + { + Address: addrUnpausedZRC20B, + }, + { + Address: addrUnpausedZRC20C, + }, + { + Address: addrUnpausedZRC20A, + }, + { + Address: addrUnpausedZRC20A, + }, + nil, + { + Address: sample.EthAddress(), + }, + }, + }, + wantErr: false, + }, + { + name: "should fail if receipt contains paused ZRC20 and non ZRC20 addresses", + receipt: ðtypes.Receipt{ + Logs: []*ethtypes.Log{ + { + Address: sample.EthAddress(), + }, + { + Address: addrUnpausedZRC20A, + }, + { + Address: addrUnpausedZRC20B, + }, + { + Address: addrUnpausedZRC20C, + }, + { + Address: addrPausedZRC20, + }, + { + Address: sample.EthAddress(), + }, + }, + }, + wantErr: true, + }, + } + + for _, tc := range tt { + tc := tc + t.Run(tc.name, func(t *testing.T) { + k, ctx, _, _ := keepertest.FungibleKeeper(t) + + requireUnpaused := func(zrc20 string) { + fc, found := k.GetForeignCoins(ctx, zrc20) + require.True(t, found) + require.False(t, fc.Paused) + } + requirePaused := func(zrc20 string) { + fc, found := k.GetForeignCoins(ctx, zrc20) + require.True(t, found) + require.True(t, fc.Paused) + } + + // setup ZRC20 + k.SetForeignCoins(ctx, sample.ForeignCoins(t, addrUnpausedZRC20A.Hex())) + k.SetForeignCoins(ctx, sample.ForeignCoins(t, addrUnpausedZRC20B.Hex())) + k.SetForeignCoins(ctx, sample.ForeignCoins(t, addrUnpausedZRC20C.Hex())) + pausedZRC20 := sample.ForeignCoins(t, addrPausedZRC20.Hex()) + pausedZRC20.Paused = true + k.SetForeignCoins(ctx, pausedZRC20) + + // check paused status + requireUnpaused(addrUnpausedZRC20A.Hex()) + requireUnpaused(addrUnpausedZRC20B.Hex()) + requireUnpaused(addrUnpausedZRC20C.Hex()) + requirePaused(addrPausedZRC20.Hex()) + + // process test + err := k.CheckPausedZRC20(ctx, tc.receipt) + if tc.wantErr { + require.ErrorIs(t, err, types.ErrPausedZRC20) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/fungible/keeper/evm_test.go b/x/fungible/keeper/evm_test.go index 5f5a5b53e5..63559fc249 100644 --- a/x/fungible/keeper/evm_test.go +++ b/x/fungible/keeper/evm_test.go @@ -78,7 +78,7 @@ func deploySystemContracts( func TestKeeper_DeployZRC20Contract(t *testing.T) { t.Run("can deploy the zrc20 contract", func(t *testing.T) { - k, ctx, sdkk := testkeeper.FungibleKeeper(t) + k, ctx, sdkk, _ := testkeeper.FungibleKeeper(t) _ = k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) chainID := getValidChainID(t) @@ -137,7 +137,7 @@ func TestKeeper_DeployZRC20Contract(t *testing.T) { func TestKeeper_DeploySystemContract(t *testing.T) { t.Run("can deploy the system contracts", func(t *testing.T) { - k, ctx, sdkk := testkeeper.FungibleKeeper(t) + k, ctx, sdkk, _ := testkeeper.FungibleKeeper(t) _ = k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) // deploy the system contracts @@ -165,7 +165,7 @@ func TestKeeper_DeploySystemContract(t *testing.T) { }) t.Run("can deposit into wzeta", func(t *testing.T) { - k, ctx, sdkk := testkeeper.FungibleKeeper(t) + k, ctx, sdkk, _ := testkeeper.FungibleKeeper(t) _ = k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) wzeta, _, _, _, _ := deploySystemContracts(t, ctx, k, sdkk.EvmKeeper) diff --git a/x/fungible/keeper/gas_coin_and_pool_test.go b/x/fungible/keeper/gas_coin_and_pool_test.go index 0a1676ae62..0bff359dad 100644 --- a/x/fungible/keeper/gas_coin_and_pool_test.go +++ b/x/fungible/keeper/gas_coin_and_pool_test.go @@ -38,7 +38,7 @@ func setupGasCoin( func TestKeeper_SetupChainGasCoinAndPool(t *testing.T) { t.Run("can setup a new chain gas coin", func(t *testing.T) { - k, ctx, sdkk := testkeeper.FungibleKeeper(t) + k, ctx, sdkk, _ := testkeeper.FungibleKeeper(t) _ = k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) chainID := getValidChainID(t) diff --git a/x/fungible/keeper/gas_stability_pool.go b/x/fungible/keeper/gas_stability_pool.go index b234582794..5bbdfc4e9e 100644 --- a/x/fungible/keeper/gas_stability_pool.go +++ b/x/fungible/keeper/gas_stability_pool.go @@ -47,17 +47,13 @@ func (k Keeper) FundGasStabilityPool( } // call deposit ZRC20 method - if err := k.CallZRC20Deposit( + return k.CallZRC20Deposit( ctx, types.ModuleAddressEVM, gasZRC20, types.GasStabilityPoolAddressEVM(), amount, - ); err != nil { - return err - } - - return nil + ) } // WithdrawFromGasStabilityPool burns the ZRC20 from the gas stability pool @@ -74,16 +70,12 @@ func (k Keeper) WithdrawFromGasStabilityPool( return err } - // call withdraw ZRC20 method - if err := k.CallZRC20Burn( + // call burn ZRC20 method + return k.CallZRC20Burn( ctx, types.GasStabilityPoolAddressEVM(), gasZRC20, amount, false, - ); err != nil { - return err - } - - return nil + ) } diff --git a/x/fungible/keeper/gas_stability_pool_test.go b/x/fungible/keeper/gas_stability_pool_test.go index d3634d945f..1c9bbc7b12 100644 --- a/x/fungible/keeper/gas_stability_pool_test.go +++ b/x/fungible/keeper/gas_stability_pool_test.go @@ -11,7 +11,7 @@ import ( func TestKeeper_EnsureGasStabilityPoolAccountCreated(t *testing.T) { t.Run("can create the gas stability pool account if doesn't exist", func(t *testing.T) { - k, ctx, _ := testkeeper.FungibleKeeper(t) + k, ctx, _, _ := testkeeper.FungibleKeeper(t) // account doesn't exist acc := k.GetAuthKeeper().GetAccount(ctx, types.GasStabilityPoolAddress()) @@ -35,7 +35,7 @@ func TestKeeper_EnsureGasStabilityPoolAccountCreated(t *testing.T) { func TestKeeper_FundGasStabilityPool(t *testing.T) { t.Run("can fund the gas stability pool and withdraw", func(t *testing.T) { - k, ctx, sdkk := testkeeper.FungibleKeeper(t) + k, ctx, sdkk, _ := testkeeper.FungibleKeeper(t) _ = k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) chainID := getValidChainID(t) diff --git a/x/fungible/keeper/grpc_query_foreign_coins_test.go b/x/fungible/keeper/grpc_query_foreign_coins_test.go index fa3459fcab..76b4b2e7c0 100644 --- a/x/fungible/keeper/grpc_query_foreign_coins_test.go +++ b/x/fungible/keeper/grpc_query_foreign_coins_test.go @@ -15,11 +15,8 @@ import ( "github.com/zeta-chain/zetacore/x/fungible/types" ) -// Prevent strconv unused error -var _ = strconv.IntSize - func TestForeignCoinsQuerySingle(t *testing.T) { - keeper, ctx, _ := keepertest.FungibleKeeper(t) + keeper, ctx, _, _ := keepertest.FungibleKeeper(t) wctx := sdk.WrapSDKContext(ctx) msgs := createNForeignCoins(keeper, ctx, 2) for _, tc := range []struct { @@ -70,7 +67,7 @@ func TestForeignCoinsQuerySingle(t *testing.T) { } func TestForeignCoinsQueryPaginated(t *testing.T) { - keeper, ctx, _ := keepertest.FungibleKeeper(t) + keeper, ctx, _, _ := keepertest.FungibleKeeper(t) wctx := sdk.WrapSDKContext(ctx) msgs := createNForeignCoins(keeper, ctx, 5) diff --git a/x/fungible/keeper/grpc_query_params_test.go b/x/fungible/keeper/grpc_query_params_test.go index 6801bf174a..634c6a38f6 100644 --- a/x/fungible/keeper/grpc_query_params_test.go +++ b/x/fungible/keeper/grpc_query_params_test.go @@ -10,7 +10,7 @@ import ( ) func TestParamsQuery(t *testing.T) { - keeper, ctx, _ := testkeeper.FungibleKeeper(t) + keeper, ctx, _, _ := testkeeper.FungibleKeeper(t) wctx := sdk.WrapSDKContext(ctx) params := types.DefaultParams() keeper.SetParams(ctx, params) diff --git a/x/fungible/keeper/msg_server_test.go b/x/fungible/keeper/msg_server_test.go index f3533252a0..b4b4427f8e 100644 --- a/x/fungible/keeper/msg_server_test.go +++ b/x/fungible/keeper/msg_server_test.go @@ -11,6 +11,6 @@ import ( ) func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { - k, ctx, _ := keepertest.FungibleKeeper(t) + k, ctx, _, _ := keepertest.FungibleKeeper(t) return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx) } diff --git a/x/fungible/keeper/msg_server_update_zrc20_paused_status.go b/x/fungible/keeper/msg_server_update_zrc20_paused_status.go new file mode 100644 index 0000000000..0e5fe54c35 --- /dev/null +++ b/x/fungible/keeper/msg_server_update_zrc20_paused_status.go @@ -0,0 +1,65 @@ +package keeper + +import ( + "context" + + cosmoserrors "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" +) + +// UpdateZRC20PausedStatus updates the paused status of a ZRC20 +// The list of ZRC20s are either paused or unpaused +func (k Keeper) UpdateZRC20PausedStatus( + goCtx context.Context, + msg *types.MsgUpdateZRC20PausedStatus, +) (*types.MsgUpdateZRC20PausedStatusResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // check message validity + if err := msg.ValidateBasic(); err != nil { + return nil, err + } + + // check if the sender is the admin + if msg.Creator != k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_deploy_fungible_coin) { + return nil, cosmoserrors.Wrap(sdkerrors.ErrUnauthorized, "Update can only be executed by the correct policy account") + } + + pausedStatus := true + if msg.Action == types.UpdatePausedStatusAction_UNPAUSE { + pausedStatus = false + } + + // iterate all foreign coins and set paused status + for _, zrc20 := range msg.Zrc20Addresses { + fc, found := k.GetForeignCoins(ctx, zrc20) + if !found { + return nil, cosmoserrors.Wrapf(types.ErrForeignCoinNotFound, "foreign coin not found %s", zrc20) + } + + fc.Paused = pausedStatus + k.SetForeignCoins(ctx, fc) + } + + err := ctx.EventManager().EmitTypedEvent( + &types.EventZRC20PausedStatusUpdated{ + MsgTypeUrl: sdk.MsgTypeURL(&types.MsgUpdateZRC20PausedStatus{}), + Action: msg.Action, + Zrc20Addresses: msg.Zrc20Addresses, + Signer: msg.Creator, + }, + ) + if err != nil { + k.Logger(ctx).Error("failed to emit event", + "event", "EventZRC20PausedStatusUpdated", + "error", err.Error(), + ) + return nil, cosmoserrors.Wrapf(types.ErrEmitEvent, "failed to emit event (%s)", err.Error()) + } + + return &types.MsgUpdateZRC20PausedStatusResponse{}, nil +} diff --git a/x/fungible/keeper/msg_server_update_zrc20_paused_status_test.go b/x/fungible/keeper/msg_server_update_zrc20_paused_status_test.go new file mode 100644 index 0000000000..a6b452747c --- /dev/null +++ b/x/fungible/keeper/msg_server_update_zrc20_paused_status_test.go @@ -0,0 +1,179 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "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" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" +) + +func setAdminDeployFungibleCoin(ctx sdk.Context, zk keepertest.ZetaKeepers, admin string) { + zk.ObserverKeeper.SetParams(ctx, observertypes.Params{ + AdminPolicy: []*observertypes.Admin_Policy{ + { + PolicyType: observertypes.Policy_Type_deploy_fungible_coin, + Address: admin, + }, + }, + }) +} + +func TestKeeper_UpdateZRC20PausedStatus(t *testing.T) { + t.Run("can update the paused status of zrc20", func(t *testing.T) { + k, ctx, _, zk := keepertest.FungibleKeeper(t) + admin := sample.AccAddress() + setAdminDeployFungibleCoin(ctx, zk, admin) + + requireUnpaused := func(zrc20 string) { + fc, found := k.GetForeignCoins(ctx, zrc20) + require.True(t, found) + require.False(t, fc.Paused) + } + requirePaused := func(zrc20 string) { + fc, found := k.GetForeignCoins(ctx, zrc20) + require.True(t, found) + require.True(t, fc.Paused) + } + + // setup zrc20 + zrc20A, zrc20B, zrc20C := sample.EthAddress().String(), sample.EthAddress().String(), sample.EthAddress().String() + k.SetForeignCoins(ctx, sample.ForeignCoins(t, zrc20A)) + k.SetForeignCoins(ctx, sample.ForeignCoins(t, zrc20B)) + k.SetForeignCoins(ctx, sample.ForeignCoins(t, zrc20C)) + requireUnpaused(zrc20A) + requireUnpaused(zrc20B) + requireUnpaused(zrc20C) + + // can pause zrc20 + _, err := k.UpdateZRC20PausedStatus(ctx, types.NewMsgUpdateZRC20PausedStatus( + admin, + []string{ + zrc20A, + zrc20B, + }, + types.UpdatePausedStatusAction_PAUSE, + )) + require.NoError(t, err) + requirePaused(zrc20A) + requirePaused(zrc20B) + requireUnpaused(zrc20C) + + // can unpause zrc20 + _, err = k.UpdateZRC20PausedStatus(ctx, types.NewMsgUpdateZRC20PausedStatus( + admin, + []string{ + zrc20A, + }, + types.UpdatePausedStatusAction_UNPAUSE, + )) + require.NoError(t, err) + requireUnpaused(zrc20A) + requirePaused(zrc20B) + requireUnpaused(zrc20C) + + // can pause already paused zrc20 + _, err = k.UpdateZRC20PausedStatus(ctx, types.NewMsgUpdateZRC20PausedStatus( + admin, + []string{ + zrc20B, + }, + types.UpdatePausedStatusAction_PAUSE, + )) + require.NoError(t, err) + requireUnpaused(zrc20A) + requirePaused(zrc20B) + requireUnpaused(zrc20C) + + // can unpause already unpaused zrc20 + _, err = k.UpdateZRC20PausedStatus(ctx, types.NewMsgUpdateZRC20PausedStatus( + admin, + []string{ + zrc20C, + }, + types.UpdatePausedStatusAction_UNPAUSE, + )) + require.NoError(t, err) + requireUnpaused(zrc20A) + requirePaused(zrc20B) + requireUnpaused(zrc20C) + + // can pause all zrc20 + _, err = k.UpdateZRC20PausedStatus(ctx, types.NewMsgUpdateZRC20PausedStatus( + admin, + []string{ + zrc20A, + zrc20B, + zrc20C, + }, + types.UpdatePausedStatusAction_PAUSE, + )) + require.NoError(t, err) + requirePaused(zrc20A) + requirePaused(zrc20B) + requirePaused(zrc20C) + + // can unpause all zrc20 + _, err = k.UpdateZRC20PausedStatus(ctx, types.NewMsgUpdateZRC20PausedStatus( + admin, + []string{ + zrc20A, + zrc20B, + zrc20C, + }, + types.UpdatePausedStatusAction_UNPAUSE, + )) + require.NoError(t, err) + requireUnpaused(zrc20A) + requireUnpaused(zrc20B) + requireUnpaused(zrc20C) + }) + + t.Run("should fail if invalid message", func(t *testing.T) { + k, ctx, _, zk := keepertest.FungibleKeeper(t) + admin := sample.AccAddress() + setAdminDeployFungibleCoin(ctx, zk, admin) + + invalidMsg := types.NewMsgUpdateZRC20PausedStatus(admin, []string{}, types.UpdatePausedStatusAction_PAUSE) + require.ErrorIs(t, invalidMsg.ValidateBasic(), sdkerrors.ErrInvalidRequest) + + _, err := k.UpdateZRC20PausedStatus(ctx, invalidMsg) + require.ErrorIs(t, err, sdkerrors.ErrInvalidRequest) + }) + + t.Run("should fail if not authorized", func(t *testing.T) { + k, ctx, _, _ := keepertest.FungibleKeeper(t) + + _, err := k.UpdateZRC20PausedStatus(ctx, types.NewMsgUpdateZRC20PausedStatus( + sample.AccAddress(), + []string{sample.EthAddress().String()}, + types.UpdatePausedStatusAction_PAUSE, + )) + require.ErrorIs(t, err, sdkerrors.ErrUnauthorized) + }) + + t.Run("should fail if zrc20 does not exist", func(t *testing.T) { + k, ctx, _, zk := keepertest.FungibleKeeper(t) + admin := sample.AccAddress() + setAdminDeployFungibleCoin(ctx, zk, admin) + + zrc20A, zrc20B := sample.EthAddress().String(), sample.EthAddress().String() + k.SetForeignCoins(ctx, sample.ForeignCoins(t, zrc20A)) + k.SetForeignCoins(ctx, sample.ForeignCoins(t, zrc20B)) + + _, err := k.UpdateZRC20PausedStatus(ctx, types.NewMsgUpdateZRC20PausedStatus( + admin, + []string{ + zrc20A, + sample.EthAddress().String(), + zrc20B, + }, + types.UpdatePausedStatusAction_PAUSE, + )) + require.ErrorIs(t, err, types.ErrForeignCoinNotFound) + }) +} diff --git a/x/fungible/keeper/params.go b/x/fungible/keeper/params.go index 1d032eba9d..18b311c264 100644 --- a/x/fungible/keeper/params.go +++ b/x/fungible/keeper/params.go @@ -6,7 +6,7 @@ import ( ) // GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { +func (k Keeper) GetParams(_ sdk.Context) types.Params { return types.NewParams() } diff --git a/x/fungible/keeper/params_test.go b/x/fungible/keeper/params_test.go index 1bac2e667e..b3b9497a74 100644 --- a/x/fungible/keeper/params_test.go +++ b/x/fungible/keeper/params_test.go @@ -9,7 +9,7 @@ import ( ) func TestGetParams(t *testing.T) { - k, ctx, _ := testkeeper.FungibleKeeper(t) + k, ctx, _, _ := testkeeper.FungibleKeeper(t) params := types.DefaultParams() k.SetParams(ctx, params) diff --git a/x/fungible/keeper/system_contract.go b/x/fungible/keeper/system_contract.go index 9ddff379dd..5c2c888b74 100644 --- a/x/fungible/keeper/system_contract.go +++ b/x/fungible/keeper/system_contract.go @@ -54,10 +54,6 @@ func (k *Keeper) GetSystemContractAddress(ctx sdk.Context) (ethcommon.Address, e return systemAddress, nil } -func (k *Keeper) QuerySystemContract(ctx sdk.Context, method string, args ...interface{}) { - -} - func (k *Keeper) GetWZetaContractAddress(ctx sdk.Context) (ethcommon.Address, error) { system, found := k.GetSystemContract(ctx) if !found { diff --git a/x/fungible/keeper/system_contract_test.go b/x/fungible/keeper/system_contract_test.go index 57cbf00477..ff60389a13 100644 --- a/x/fungible/keeper/system_contract_test.go +++ b/x/fungible/keeper/system_contract_test.go @@ -9,7 +9,7 @@ import ( ) func TestKeeper_GetSystemContract(t *testing.T) { - keeper, ctx, _ := keepertest.FungibleKeeper(t) + keeper, ctx, _, _ := keepertest.FungibleKeeper(t) keeper.SetSystemContract(ctx, types.SystemContract{SystemContract: "test"}) val, b := keeper.GetSystemContract(ctx) fmt.Println(val, b) diff --git a/x/fungible/keeper/zeta.go b/x/fungible/keeper/zeta.go index e46646ed6f..0a5e72b31d 100644 --- a/x/fungible/keeper/zeta.go +++ b/x/fungible/keeper/zeta.go @@ -4,14 +4,13 @@ import ( "math/big" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/zeta-chain/zetacore/cmd/zetacored/config" "github.com/zeta-chain/zetacore/x/fungible/types" ) // MintZetaToEVMAccount mints ZETA (gas token) to the given address +// NOTE: this method should be used with a temporary context, and it should not be committed if the method returns an error func (k *Keeper) MintZetaToEVMAccount(ctx sdk.Context, to sdk.AccAddress, amount *big.Int) error { - balanceCoin := k.bankKeeper.GetBalance(ctx, to, config.BaseDenom) coins := sdk.NewCoins(sdk.NewCoin(config.BaseDenom, sdk.NewIntFromBigInt(amount))) // Mint coins if err := k.bankKeeper.MintCoins(ctx, types.ModuleName, coins); err != nil { @@ -19,29 +18,5 @@ func (k *Keeper) MintZetaToEVMAccount(ctx sdk.Context, to sdk.AccAddress, amount } // Send minted coins to the receiver - err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, to, coins) - - if err == nil { - // Check expected receiver balance after transfer - balanceCoinAfter := k.bankKeeper.GetBalance(ctx, to, config.BaseDenom) - expCoin := balanceCoin.Add(coins[0]) - - if ok := balanceCoinAfter.IsEqual(expCoin); !ok { - err = sdkerrors.Wrapf( - types.ErrBalanceInvariance, - "invalid coin balance - expected: %v, actual: %v", - expCoin, balanceCoinAfter, - ) - } - } - - if err != nil { - // Revert minting if an error is found. - if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, coins); err != nil { - return err - } - return err - } - - return nil + return k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, to, coins) } diff --git a/x/fungible/keeper/zeta_test.go b/x/fungible/keeper/zeta_test.go new file mode 100644 index 0000000000..cec34d06ea --- /dev/null +++ b/x/fungible/keeper/zeta_test.go @@ -0,0 +1,77 @@ +package keeper_test + +import ( + "errors" + "math/big" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/cmd/zetacored/config" + testkeeper "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/fungible/types" +) + +func TestKeeper_MintZetaToEVMAccount(t *testing.T) { + t.Run("should mint the token in the specified balance", func(t *testing.T) { + k, ctx, sdkk, _ := testkeeper.FungibleKeeper(t) + k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) + + acc := sample.Bech32AccAddress() + bal := sdkk.BankKeeper.GetBalance(ctx, acc, config.BaseDenom) + require.True(t, bal.IsZero()) + + err := k.MintZetaToEVMAccount(ctx, acc, big.NewInt(42)) + require.NoError(t, err) + bal = sdkk.BankKeeper.GetBalance(ctx, acc, config.BaseDenom) + require.True(t, bal.Amount.Equal(sdk.NewInt(42))) + }) + + coins42 := sdk.NewCoins(sdk.NewCoin(config.BaseDenom, sdk.NewInt(42))) + + t.Run("should fail if minting fail", func(t *testing.T) { + k, ctx := testkeeper.FungibleKeeperAllMocks(t) + + mockBankKeeper := testkeeper.GetFungibleBankMock(t, k) + + mockBankKeeper.On( + "MintCoins", + ctx, + types.ModuleName, + coins42, + ).Return(errors.New("error")) + + err := k.MintZetaToEVMAccount(ctx, sample.Bech32AccAddress(), big.NewInt(42)) + require.Error(t, err) + + mockBankKeeper.AssertExpectations(t) + }) + + t.Run("should fail if sending coins fail", func(t *testing.T) { + k, ctx := testkeeper.FungibleKeeperAllMocks(t) + acc := sample.Bech32AccAddress() + + mockBankKeeper := testkeeper.GetFungibleBankMock(t, k) + + mockBankKeeper.On( + "MintCoins", + ctx, + types.ModuleName, + coins42, + ).Return(nil) + + mockBankKeeper.On( + "SendCoinsFromModuleToAccount", + ctx, + types.ModuleName, + acc, + coins42, + ).Return(errors.New("error")) + + err := k.MintZetaToEVMAccount(ctx, acc, big.NewInt(42)) + require.Error(t, err) + + mockBankKeeper.AssertExpectations(t) + }) +} diff --git a/x/fungible/module.go b/x/fungible/module.go index 3b2cd61ee1..7ea3ff45d0 100644 --- a/x/fungible/module.go +++ b/x/fungible/module.go @@ -63,7 +63,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis performs genesis state validation for the fungible module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var genState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genState); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -72,7 +72,7 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod } // RegisterRESTRoutes registers the fungible module's REST service handlers. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { +func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) { } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. @@ -134,7 +134,7 @@ func (am AppModule) Route() sdk.Route { func (AppModule) QuerierRoute() string { return types.QuerierRoute } // LegacyQuerierHandler returns the fungible module's Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { +func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { return nil } diff --git a/x/fungible/module_simulation.go b/x/fungible/module_simulation.go index 3a94d3ed03..0754216df7 100644 --- a/x/fungible/module_simulation.go +++ b/x/fungible/module_simulation.go @@ -36,7 +36,7 @@ func (am AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} // WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { +func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { operations := make([]simtypes.WeightedOperation, 0) return operations diff --git a/x/fungible/types/errors.go b/x/fungible/types/errors.go index d945bd2f8d..64e770b547 100644 --- a/x/fungible/types/errors.go +++ b/x/fungible/types/errors.go @@ -27,4 +27,6 @@ var ( 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") + ErrPausedZRC20 = sdkerrors.Register(ModuleName, 1120, "ZRC20 is paused") + ErrForeignCoinNotFound = sdkerrors.Register(ModuleName, 1121, "foreign coin not found") ) diff --git a/x/fungible/types/events.pb.go b/x/fungible/types/events.pb.go index a072a39dbe..c00e084019 100644 --- a/x/fungible/types/events.pb.go +++ b/x/fungible/types/events.pb.go @@ -293,47 +293,121 @@ func (m *EventZRC20WithdrawFeeUpdated) GetSigner() string { return "" } +type EventZRC20PausedStatusUpdated struct { + MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"` + Zrc20Addresses []string `protobuf:"bytes,2,rep,name=zrc20_addresses,json=zrc20Addresses,proto3" json:"zrc20_addresses,omitempty"` + Action UpdatePausedStatusAction `protobuf:"varint,3,opt,name=action,proto3,enum=zetachain.zetacore.fungible.UpdatePausedStatusAction" json:"action,omitempty"` + Signer string `protobuf:"bytes,4,opt,name=signer,proto3" json:"signer,omitempty"` +} + +func (m *EventZRC20PausedStatusUpdated) Reset() { *m = EventZRC20PausedStatusUpdated{} } +func (m *EventZRC20PausedStatusUpdated) String() string { return proto.CompactTextString(m) } +func (*EventZRC20PausedStatusUpdated) ProtoMessage() {} +func (*EventZRC20PausedStatusUpdated) Descriptor() ([]byte, []int) { + return fileDescriptor_858e6494730deffd, []int{3} +} +func (m *EventZRC20PausedStatusUpdated) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventZRC20PausedStatusUpdated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventZRC20PausedStatusUpdated.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 *EventZRC20PausedStatusUpdated) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventZRC20PausedStatusUpdated.Merge(m, src) +} +func (m *EventZRC20PausedStatusUpdated) XXX_Size() int { + return m.Size() +} +func (m *EventZRC20PausedStatusUpdated) XXX_DiscardUnknown() { + xxx_messageInfo_EventZRC20PausedStatusUpdated.DiscardUnknown(m) +} + +var xxx_messageInfo_EventZRC20PausedStatusUpdated proto.InternalMessageInfo + +func (m *EventZRC20PausedStatusUpdated) GetMsgTypeUrl() string { + if m != nil { + return m.MsgTypeUrl + } + return "" +} + +func (m *EventZRC20PausedStatusUpdated) GetZrc20Addresses() []string { + if m != nil { + return m.Zrc20Addresses + } + return nil +} + +func (m *EventZRC20PausedStatusUpdated) GetAction() UpdatePausedStatusAction { + if m != nil { + return m.Action + } + return UpdatePausedStatusAction_PAUSE +} + +func (m *EventZRC20PausedStatusUpdated) 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") } func init() { proto.RegisterFile("fungible/events.proto", fileDescriptor_858e6494730deffd) } var fileDescriptor_858e6494730deffd = []byte{ - // 496 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xc7, 0xe3, 0xa4, 0xcd, 0xc7, 0xaa, 0x54, 0xd5, 0x12, 0x90, 0x49, 0x91, 0x15, 0x85, 0x4b, - 0x2e, 0x8d, 0xa3, 0xf0, 0x04, 0x10, 0x40, 0xaa, 0xc4, 0x29, 0x50, 0x21, 0xf5, 0x62, 0x6d, 0xbc, - 0x53, 0x67, 0xa5, 0xf5, 0xae, 0xe5, 0xdd, 0x60, 0xdc, 0xa7, 0xe0, 0xc6, 0x81, 0x37, 0xe1, 0x09, - 0x38, 0xf6, 0xc8, 0x11, 0x25, 0x2f, 0x82, 0x76, 0xd7, 0x4e, 0x53, 0x90, 0x68, 0x4f, 0x99, 0x71, - 0xfe, 0xb3, 0xf3, 0x9b, 0x2f, 0xf4, 0xe4, 0x6a, 0x2d, 0x12, 0xb6, 0xe4, 0x10, 0xc2, 0x67, 0x10, - 0x5a, 0x4d, 0xb2, 0x5c, 0x6a, 0x89, 0x4f, 0xaf, 0x41, 0x93, 0x78, 0x45, 0x98, 0x98, 0x58, 0x4b, - 0xe6, 0x30, 0xa9, 0x95, 0x83, 0xc7, 0xb1, 0x4c, 0x53, 0x29, 0x42, 0xf7, 0xe3, 0x22, 0x06, 0xfd, - 0x44, 0x26, 0xd2, 0x9a, 0xa1, 0xb1, 0xdc, 0xd7, 0xd1, 0x0f, 0x0f, 0x0d, 0xde, 0x9a, 0x87, 0x3f, - 0x94, 0x4a, 0x43, 0x3a, 0x97, 0x42, 0xe7, 0x24, 0xd6, 0x17, 0x19, 0x25, 0x1a, 0x28, 0x1e, 0x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0xce, 0x52, 0xa6, 0xfd, 0x9e, 0xcb, 0x90, 0x10, 0xf5, - 0xde, 0xf8, 0xa3, 0xef, 0x4d, 0xf4, 0xfc, 0xb6, 0x33, 0x9f, 0x98, 0x5e, 0xd1, 0x9c, 0x14, 0xef, - 0x00, 0x1e, 0x3e, 0xd8, 0xff, 0xf4, 0xe8, 0x0e, 0x7f, 0xeb, 0x5e, 0xfe, 0x17, 0xe8, 0xd1, 0xb5, - 0x41, 0xde, 0x4d, 0xda, 0xf5, 0xef, 0xc8, 0x7e, 0xac, 0x67, 0x3c, 0x46, 0x27, 0x66, 0x2b, 0x8a, - 0x0a, 0x35, 0xba, 0x02, 0xa8, 0x3a, 0x7a, 0x2c, 0x39, 0xdd, 0xab, 0xc0, 0x28, 0xcd, 0xc6, 0xdd, - 0x51, 0xb6, 0x9d, 0x52, 0x40, 0xb1, 0xaf, 0xbc, 0xdd, 0x9b, 0xce, 0xfe, 0xde, 0xbc, 0x3e, 0xff, - 0xb9, 0x09, 0xbc, 0x9b, 0x4d, 0xe0, 0xfd, 0xde, 0x04, 0xde, 0xd7, 0x6d, 0xd0, 0xb8, 0xd9, 0x06, - 0x8d, 0x5f, 0xdb, 0xa0, 0x71, 0x19, 0x26, 0x4c, 0xaf, 0xd6, 0x4b, 0x53, 0x4c, 0x68, 0xee, 0xea, - 0xcc, 0x96, 0x1c, 0xd6, 0x27, 0x16, 0x7e, 0x09, 0x77, 0xe7, 0x68, 0x8a, 0x57, 0xcb, 0xb6, 0x3d, - 0xa3, 0x97, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x33, 0xde, 0x4c, 0x80, 0xa7, 0x03, 0x00, 0x00, + // 564 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xdd, 0x6e, 0xd3, 0x30, + 0x14, 0xc7, 0x97, 0x75, 0xeb, 0x5a, 0x6b, 0x8c, 0x61, 0x0a, 0x0a, 0x1d, 0x44, 0x55, 0xb9, 0xa0, + 0x37, 0x4b, 0xaa, 0x22, 0x1e, 0x60, 0x14, 0x90, 0x26, 0x81, 0x84, 0x3a, 0x26, 0xa4, 0xdd, 0x44, + 0x6e, 0x7c, 0x96, 0x5a, 0x4a, 0xec, 0x28, 0x76, 0xe9, 0xb2, 0xa7, 0xe0, 0x8e, 0x0b, 0xde, 0x84, + 0x27, 0xe0, 0x72, 0xdc, 0x71, 0x89, 0xda, 0x17, 0x41, 0x76, 0xdc, 0x2f, 0x10, 0xa3, 0x57, 0x3d, + 0xc7, 0x3d, 0x1f, 0x3f, 0xff, 0xcf, 0x89, 0xd1, 0x83, 0xcb, 0x31, 0x8f, 0xd9, 0x30, 0x81, 0x00, + 0x3e, 0x01, 0x57, 0xd2, 0xcf, 0x72, 0xa1, 0x04, 0x3e, 0xba, 0x06, 0x45, 0xa2, 0x11, 0x61, 0xdc, + 0x37, 0x96, 0xc8, 0xc1, 0x9f, 0x47, 0x36, 0xef, 0x47, 0x22, 0x4d, 0x05, 0x0f, 0xca, 0x9f, 0x32, + 0xa3, 0x79, 0x6f, 0x51, 0x48, 0x5d, 0xd9, 0xa3, 0x46, 0x2c, 0x62, 0x61, 0xcc, 0x40, 0x5b, 0xe5, + 0x69, 0xfb, 0x9b, 0x83, 0x9a, 0xaf, 0x75, 0xaf, 0xb3, 0x42, 0x2a, 0x48, 0xfb, 0x82, 0xab, 0x9c, + 0x44, 0xea, 0x3c, 0xa3, 0x44, 0x01, 0xc5, 0x2d, 0xb4, 0x9f, 0xca, 0x38, 0x54, 0x45, 0x06, 0xe1, + 0x38, 0x4f, 0x5c, 0xa7, 0xe5, 0x74, 0xea, 0x03, 0x94, 0xca, 0xf8, 0x43, 0x91, 0xc1, 0x79, 0x9e, + 0xe0, 0x2e, 0x6a, 0x70, 0x98, 0x84, 0x91, 0x4d, 0x0c, 0x09, 0xa5, 0x39, 0x48, 0xe9, 0x6e, 0x9b, + 0x48, 0xc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xd6, 0xc8, 0x8b, 0x49, 0x97, 0xfa, 0xed, + 0x9b, 0xc3, 0xf9, 0x8c, 0x3b, 0xe8, 0x50, 0x6f, 0xc5, 0xc4, 0xa2, 0x86, 0x97, 0x00, 0x56, 0xd1, + 0x03, 0x91, 0xd0, 0x95, 0x1b, 0xe8, 0x48, 0xbd, 0x71, 0x6b, 0x91, 0xd5, 0x32, 0x92, 0xc3, 0x64, + 0x35, 0x72, 0xb9, 0x37, 0x7b, 0x6b, 0x7b, 0xf3, 0xc3, 0x41, 0x4f, 0x96, 0xea, 0xbc, 0x27, 0x63, + 0x09, 0xf4, 0x4c, 0x11, 0x35, 0x96, 0x9b, 0xcb, 0xf3, 0x0c, 0xdd, 0x5d, 0xbb, 0x14, 0xe8, 0x95, + 0xaf, 0x68, 0x88, 0xd5, 0x6b, 0x81, 0xc4, 0xef, 0x50, 0x95, 0x44, 0x8a, 0x09, 0x6e, 0x95, 0x7a, + 0xe1, 0xdf, 0xf2, 0x35, 0xfb, 0x25, 0xc0, 0x2a, 0xd2, 0x89, 0x49, 0x1e, 0xd8, 0x22, 0xff, 0xfa, + 0x16, 0x5e, 0x9e, 0x7e, 0x9f, 0x7a, 0xce, 0xcd, 0xd4, 0x73, 0x7e, 0x4d, 0x3d, 0xe7, 0xf3, 0xcc, + 0xdb, 0xba, 0x99, 0x79, 0x5b, 0x3f, 0x67, 0xde, 0xd6, 0x45, 0x10, 0x33, 0x35, 0x1a, 0x0f, 0xf5, + 0x80, 0x02, 0xdd, 0xf0, 0xd8, 0xf4, 0x0e, 0xe6, 0xbd, 0x83, 0xab, 0x60, 0xf9, 0x58, 0x14, 0x19, + 0xc8, 0x61, 0xd5, 0x3c, 0x0d, 0xcf, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x63, 0xa1, 0x97, 0xec, + 0x8e, 0x04, 0x00, 0x00, } func (m *EventSystemContractUpdated) Marshal() (dAtA []byte, err error) { @@ -533,6 +607,57 @@ func (m *EventZRC20WithdrawFeeUpdated) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } +func (m *EventZRC20PausedStatusUpdated) 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 *EventZRC20PausedStatusUpdated) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventZRC20PausedStatusUpdated) 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] = 0x22 + } + if m.Action != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.Action)) + i-- + dAtA[i] = 0x18 + } + if len(m.Zrc20Addresses) > 0 { + for iNdEx := len(m.Zrc20Addresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Zrc20Addresses[iNdEx]) + copy(dAtA[i:], m.Zrc20Addresses[iNdEx]) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Zrc20Addresses[iNdEx]))) + 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 @@ -645,6 +770,32 @@ func (m *EventZRC20WithdrawFeeUpdated) Size() (n int) { return n } +func (m *EventZRC20PausedStatusUpdated) 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)) + } + if len(m.Zrc20Addresses) > 0 { + for _, s := range m.Zrc20Addresses { + l = len(s) + n += 1 + l + sovEvents(uint64(l)) + } + } + if m.Action != 0 { + n += 1 + sovEvents(uint64(m.Action)) + } + 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 } @@ -1363,6 +1514,171 @@ func (m *EventZRC20WithdrawFeeUpdated) Unmarshal(dAtA []byte) error { } return nil } +func (m *EventZRC20PausedStatusUpdated) 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: EventZRC20PausedStatusUpdated: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventZRC20PausedStatusUpdated: 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 Zrc20Addresses", 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.Zrc20Addresses = append(m.Zrc20Addresses, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Action", wireType) + } + m.Action = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Action |= UpdatePausedStatusAction(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + 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/foreign_coins.pb.go b/x/fungible/types/foreign_coins.pb.go index 4158066524..59546724b7 100644 --- a/x/fungible/types/foreign_coins.pb.go +++ b/x/fungible/types/foreign_coins.pb.go @@ -34,6 +34,7 @@ type ForeignCoins struct { Symbol string `protobuf:"bytes,7,opt,name=symbol,proto3" json:"symbol,omitempty"` CoinType common.CoinType `protobuf:"varint,8,opt,name=coin_type,json=coinType,proto3,enum=common.CoinType" json:"coin_type,omitempty"` GasLimit uint64 `protobuf:"varint,9,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"` + Paused bool `protobuf:"varint,10,opt,name=paused,proto3" json:"paused,omitempty"` } func (m *ForeignCoins) Reset() { *m = ForeignCoins{} } @@ -125,6 +126,13 @@ func (m *ForeignCoins) GetGasLimit() uint64 { return 0 } +func (m *ForeignCoins) GetPaused() bool { + if m != nil { + return m.Paused + } + return false +} + func init() { proto.RegisterType((*ForeignCoins)(nil), "zetachain.zetacore.fungible.ForeignCoins") } @@ -132,28 +140,29 @@ func init() { func init() { proto.RegisterFile("fungible/foreign_coins.proto", fileDescriptor_5285bb476cecbbf8) } var fileDescriptor_5285bb476cecbbf8 = []byte{ - // 336 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0x51, 0xbd, 0x6a, 0xc3, 0x30, - 0x18, 0x8c, 0xf2, 0x57, 0x5b, 0xb4, 0x21, 0xa8, 0x21, 0x88, 0xa4, 0x18, 0xd3, 0xc9, 0x4b, 0xec, - 0x92, 0xf6, 0x05, 0xda, 0x40, 0x21, 0xd0, 0xc9, 0x74, 0xea, 0x62, 0x64, 0x59, 0x71, 0x04, 0xb6, - 0x14, 0x2c, 0x05, 0x9a, 0x3c, 0x45, 0xc7, 0x3e, 0x52, 0x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0x60, 0x3e, 0x0c, 0x9b, 0xc0, 0x26, 0xdf, 0xfb, 0x6e, 0xc3, 0x62, 0x87, 0x36, 0x13, 0x9a, 0x42, - 0x37, 0x27, 0x2a, 0x29, 0x78, 0xc9, 0x35, 0x76, 0x7d, 0x10, 0x74, 0x63, 0x27, 0x27, 0xea, 0xcd, - 0xe0, 0x97, 0xe5, 0xcf, 0xd1, 0x03, 0x87, 0xa3, 0x07, 0xfe, 0x8e, 0x1e, 0xf8, 0x3a, 0x79, 0xad, - 0xc3, 0xc9, 0x6b, 0xfd, 0x9e, 0xbc, 0xd6, 0x47, 0x94, 0x73, 0xbd, 0xde, 0xa6, 0x46, 0x38, 0x32, - 0x3d, 0xcf, 0x6c, 0xba, 0xe8, 0x5c, 0x79, 0xf4, 0x19, 0x5d, 0x5e, 0xc9, 0x18, 0x51, 0x69, 0xdf, - 0x96, 0xfd, 0xf8, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x82, 0xb0, 0x87, 0xed, 0xbe, 0x01, 0x00, 0x00, + // 352 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0x51, 0x4d, 0x6a, 0xeb, 0x30, + 0x10, 0x8e, 0xf2, 0xf7, 0x6c, 0xf1, 0x5e, 0x08, 0x7a, 0x21, 0x88, 0xa4, 0x18, 0xd3, 0x95, 0x37, + 0xb1, 0x4b, 0xda, 0x0b, 0xb4, 0x81, 0x42, 0xa0, 0x2b, 0xd3, 0x55, 0x37, 0x46, 0x96, 0x15, 0x47, + 0x60, 0x4b, 0xc6, 0x52, 0xa0, 0xc9, 0x29, 0x7a, 0x94, 0x1e, 0xa3, 0xcb, 0x2c, 0xbb, 0x2c, 0xc9, + 0x45, 0x8a, 0x64, 0x27, 0x2b, 0xcd, 0x37, 0xa3, 0x99, 0xf9, 0xbe, 0xf9, 0xe0, 0xcd, 0x66, 0x27, + 0x72, 0x9e, 0x16, 0x2c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xc6, 0xae, 0x0f, 0x82, 0x7e, 0xec, + 0xe4, 0x44, 0xbd, 0x18, 0x6c, 0x76, 0x54, 0x64, 0xa7, 0x58, 0x86, 0xa1, 0x0f, 0x02, 0x27, 0x6e, + 0xd1, 0xd3, 0xfa, 0xeb, 0xe4, 0x81, 0xe3, 0xc9, 0x03, 0x3f, 0x27, 0x0f, 0x7c, 0x9c, 0xbd, 0xce, + 0xf1, 0xec, 0x75, 0xbe, 0xcf, 0x5e, 0xe7, 0x2d, 0xca, 0xb9, 0xde, 0xee, 0x52, 0xb3, 0x30, 0x32, + 0xf7, 0x5f, 0x58, 0xd5, 0xd1, 0xc5, 0x8a, 0xe8, 0x3d, 0xba, 0xba, 0x67, 0x08, 0xaa, 0x74, 0x68, + 0x4d, 0xb8, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xe9, 0xed, 0x99, 0xa3, 0xd6, 0x01, 0x00, 0x00, } func (m *ForeignCoins) Marshal() (dAtA []byte, err error) { @@ -176,6 +185,16 @@ func (m *ForeignCoins) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Paused { + i-- + if m.Paused { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x50 + } if m.GasLimit != 0 { i = encodeVarintForeignCoins(dAtA, i, uint64(m.GasLimit)) i-- @@ -272,6 +291,9 @@ func (m *ForeignCoins) Size() (n int) { if m.GasLimit != 0 { n += 1 + sovForeignCoins(uint64(m.GasLimit)) } + if m.Paused { + n += 2 + } return n } @@ -514,6 +536,26 @@ func (m *ForeignCoins) Unmarshal(dAtA []byte) error { break } } + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Paused", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowForeignCoins + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Paused = bool(v != 0) default: iNdEx = preIndex skippy, err := skipForeignCoins(dAtA[iNdEx:]) diff --git a/x/fungible/types/message_update_zrc20_paused_status.go b/x/fungible/types/message_update_zrc20_paused_status.go new file mode 100644 index 0000000000..9eb1b77bd5 --- /dev/null +++ b/x/fungible/types/message_update_zrc20_paused_status.go @@ -0,0 +1,64 @@ +package types + +import ( + cosmoserrors "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" +) + +const TypeMsgUpdateZRC20PausedStatus = "update_zrc20_withdraw_fee" + +var _ sdk.Msg = &MsgUpdateZRC20PausedStatus{} + +func NewMsgUpdateZRC20PausedStatus(creator string, zrc20 []string, action UpdatePausedStatusAction) *MsgUpdateZRC20PausedStatus { + return &MsgUpdateZRC20PausedStatus{ + Creator: creator, + Zrc20Addresses: zrc20, + Action: action, + } +} + +func (msg *MsgUpdateZRC20PausedStatus) Route() string { + return RouterKey +} + +func (msg *MsgUpdateZRC20PausedStatus) Type() string { + return TypeMsgUpdateZRC20PausedStatus +} + +func (msg *MsgUpdateZRC20PausedStatus) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgUpdateZRC20PausedStatus) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgUpdateZRC20PausedStatus) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + + if msg.Action != UpdatePausedStatusAction_PAUSE && msg.Action != UpdatePausedStatusAction_UNPAUSE { + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid action (%d)", msg.Action) + } + + if len(msg.Zrc20Addresses) == 0 { + return cosmoserrors.Wrap(sdkerrors.ErrInvalidRequest, "no zrc20 to update") + } + + // check if all zrc20 addresses are valid + for _, zrc20 := range msg.Zrc20Addresses { + if !ethcommon.IsHexAddress(zrc20) { + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid zrc20 contract address (%s)", zrc20) + } + } + return nil +} diff --git a/x/fungible/types/message_update_zrc20_paused_status_test.go b/x/fungible/types/message_update_zrc20_paused_status_test.go new file mode 100644 index 0000000000..326af3fe96 --- /dev/null +++ b/x/fungible/types/message_update_zrc20_paused_status_test.go @@ -0,0 +1,103 @@ +package types_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/fungible/types" +) + +func TestMMsgUpdateZRC20PausedStatus_ValidateBasic(t *testing.T) { + tt := []struct { + name string + msg types.MsgUpdateZRC20PausedStatus + wantErr bool + }{ + { + name: "valid pause message", + msg: types.MsgUpdateZRC20PausedStatus{ + Creator: sample.AccAddress(), + Zrc20Addresses: []string{ + sample.EthAddress().String(), + sample.EthAddress().String(), + sample.EthAddress().String(), + }, + Action: types.UpdatePausedStatusAction_PAUSE, + }, + wantErr: false, + }, + { + name: "valid unpause message", + msg: types.MsgUpdateZRC20PausedStatus{ + Creator: sample.AccAddress(), + Zrc20Addresses: []string{ + sample.EthAddress().String(), + sample.EthAddress().String(), + sample.EthAddress().String(), + }, + Action: types.UpdatePausedStatusAction_UNPAUSE, + }, + wantErr: false, + }, + { + name: "invalid creator address", + msg: types.MsgUpdateZRC20PausedStatus{ + Creator: "invalid", + Zrc20Addresses: []string{ + sample.EthAddress().String(), + sample.EthAddress().String(), + sample.EthAddress().String(), + }, + Action: types.UpdatePausedStatusAction_PAUSE, + }, + wantErr: true, + }, + { + name: "invalid empty zrc20 address", + msg: types.MsgUpdateZRC20PausedStatus{ + Creator: sample.AccAddress(), + Zrc20Addresses: []string{}, + Action: types.UpdatePausedStatusAction_PAUSE, + }, + wantErr: true, + }, + { + name: "invalid zrc20 address", + msg: types.MsgUpdateZRC20PausedStatus{ + Creator: sample.AccAddress(), + Zrc20Addresses: []string{ + sample.EthAddress().String(), + "invalid", + sample.EthAddress().String(), + }, + Action: types.UpdatePausedStatusAction_PAUSE, + }, + wantErr: true, + }, + { + name: "invalid action", + msg: types.MsgUpdateZRC20PausedStatus{ + Creator: sample.AccAddress(), + Zrc20Addresses: []string{ + sample.EthAddress().String(), + sample.EthAddress().String(), + sample.EthAddress().String(), + }, + Action: 3, + }, + wantErr: true, + }, + } + for _, tc := range tt { + tc := tc + t.Run(tc.name, func(t *testing.T) { + err := tc.msg.ValidateBasic() + if tc.wantErr { + require.Error(t, err) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/fungible/types/tx.pb.go b/x/fungible/types/tx.pb.go index a56fcebf3b..c1df08fe31 100644 --- a/x/fungible/types/tx.pb.go +++ b/x/fungible/types/tx.pb.go @@ -31,6 +31,31 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type UpdatePausedStatusAction int32 + +const ( + UpdatePausedStatusAction_PAUSE UpdatePausedStatusAction = 0 + UpdatePausedStatusAction_UNPAUSE UpdatePausedStatusAction = 1 +) + +var UpdatePausedStatusAction_name = map[int32]string{ + 0: "PAUSE", + 1: "UNPAUSE", +} + +var UpdatePausedStatusAction_value = map[string]int32{ + "PAUSE": 0, + "UNPAUSE": 1, +} + +func (x UpdatePausedStatusAction) String() string { + return proto.EnumName(UpdatePausedStatusAction_name, int32(x)) +} + +func (UpdatePausedStatusAction) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_197fdedece277fa0, []int{0} +} + 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"` @@ -432,7 +457,104 @@ func (m *MsgRemoveForeignCoinResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRemoveForeignCoinResponse proto.InternalMessageInfo +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"` + Action UpdatePausedStatusAction `protobuf:"varint,3,opt,name=action,proto3,enum=zetachain.zetacore.fungible.UpdatePausedStatusAction" json:"action,omitempty"` +} + +func (m *MsgUpdateZRC20PausedStatus) Reset() { *m = MsgUpdateZRC20PausedStatus{} } +func (m *MsgUpdateZRC20PausedStatus) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateZRC20PausedStatus) ProtoMessage() {} +func (*MsgUpdateZRC20PausedStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_197fdedece277fa0, []int{8} +} +func (m *MsgUpdateZRC20PausedStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateZRC20PausedStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateZRC20PausedStatus.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 *MsgUpdateZRC20PausedStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateZRC20PausedStatus.Merge(m, src) +} +func (m *MsgUpdateZRC20PausedStatus) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateZRC20PausedStatus) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateZRC20PausedStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateZRC20PausedStatus proto.InternalMessageInfo + +func (m *MsgUpdateZRC20PausedStatus) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgUpdateZRC20PausedStatus) GetZrc20Addresses() []string { + if m != nil { + return m.Zrc20Addresses + } + return nil +} + +func (m *MsgUpdateZRC20PausedStatus) GetAction() UpdatePausedStatusAction { + if m != nil { + return m.Action + } + return UpdatePausedStatusAction_PAUSE +} + +type MsgUpdateZRC20PausedStatusResponse struct { +} + +func (m *MsgUpdateZRC20PausedStatusResponse) Reset() { *m = MsgUpdateZRC20PausedStatusResponse{} } +func (m *MsgUpdateZRC20PausedStatusResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateZRC20PausedStatusResponse) ProtoMessage() {} +func (*MsgUpdateZRC20PausedStatusResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_197fdedece277fa0, []int{9} +} +func (m *MsgUpdateZRC20PausedStatusResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateZRC20PausedStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateZRC20PausedStatusResponse.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 *MsgUpdateZRC20PausedStatusResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateZRC20PausedStatusResponse.Merge(m, src) +} +func (m *MsgUpdateZRC20PausedStatusResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateZRC20PausedStatusResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateZRC20PausedStatusResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateZRC20PausedStatusResponse proto.InternalMessageInfo + func init() { + proto.RegisterEnum("zetachain.zetacore.fungible.UpdatePausedStatusAction", UpdatePausedStatusAction_name, UpdatePausedStatusAction_value) proto.RegisterType((*MsgUpdateZRC20WithdrawFee)(nil), "zetachain.zetacore.fungible.MsgUpdateZRC20WithdrawFee") proto.RegisterType((*MsgUpdateZRC20WithdrawFeeResponse)(nil), "zetachain.zetacore.fungible.MsgUpdateZRC20WithdrawFeeResponse") proto.RegisterType((*MsgUpdateSystemContract)(nil), "zetachain.zetacore.fungible.MsgUpdateSystemContract") @@ -441,52 +563,61 @@ func init() { proto.RegisterType((*MsgDeployFungibleCoinZRC20Response)(nil), "zetachain.zetacore.fungible.MsgDeployFungibleCoinZRC20Response") proto.RegisterType((*MsgRemoveForeignCoin)(nil), "zetachain.zetacore.fungible.MsgRemoveForeignCoin") proto.RegisterType((*MsgRemoveForeignCoinResponse)(nil), "zetachain.zetacore.fungible.MsgRemoveForeignCoinResponse") + proto.RegisterType((*MsgUpdateZRC20PausedStatus)(nil), "zetachain.zetacore.fungible.MsgUpdateZRC20PausedStatus") + proto.RegisterType((*MsgUpdateZRC20PausedStatusResponse)(nil), "zetachain.zetacore.fungible.MsgUpdateZRC20PausedStatusResponse") } func init() { proto.RegisterFile("fungible/tx.proto", fileDescriptor_197fdedece277fa0) } var fileDescriptor_197fdedece277fa0 = []byte{ - // 631 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcf, 0x4f, 0xd4, 0x40, - 0x14, 0xde, 0xe1, 0xe7, 0xf2, 0x22, 0x04, 0xc6, 0x0d, 0xd4, 0x62, 0xca, 0x52, 0x4c, 0xdc, 0x0b, - 0x2d, 0xae, 0x46, 0x63, 0xe2, 0x8f, 0xc8, 0x22, 0x09, 0x89, 0x7b, 0xa9, 0x12, 0x23, 0x97, 0xa6, - 0xdb, 0x3e, 0xca, 0xc4, 0xed, 0xcc, 0xa6, 0x33, 0xb8, 0x2c, 0x37, 0xaf, 0x9c, 0x48, 0xfc, 0x5b, - 0x3c, 0x7b, 0xe5, 0xc8, 0xd1, 0x78, 0x20, 0x06, 0xfe, 0x11, 0xd3, 0x6e, 0xbb, 0x20, 0xb0, 0x8b, - 0x72, 0xea, 0x7b, 0xaf, 0xef, 0xfb, 0xe6, 0xfb, 0xe6, 0x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0xfe, 0x77, 0xd1, 0xbb, 0xb2, 0x35, 0x28, 0xd5, 0x65, - 0xe8, 0x60, 0x24, 0xbe, 0xe0, 0x7a, 0x66, 0x4a, 0x30, 0x3e, 0xe0, 0xae, 0x72, 0x3f, 0x43, 0xe7, - 0x7e, 0x4c, 0x03, 0xee, 0x5f, 0xc7, 0x92, 0x9f, 0x52, 0xfd, 0x31, 0x02, 0xc3, 0x75, 0x19, 0xd2, - 0x6f, 0x04, 0xe6, 0xfa, 0x4d, 0xe7, 0x99, 0x35, 0xe0, 0xcf, 0xb3, 0xfa, 0x5b, 0xd1, 0x5f, 0xdf, - 0x12, 0x98, 0xab, 0xa3, 0x5f, 0x09, 0xcc, 0x5c, 0xbd, 0x81, 0x47, 0x37, 0xd1, 0x5e, 0x81, 0xe8, - 0xcf, 0xff, 0x1b, 0xd2, 0xd3, 0x70, 0x40, 0xa0, 0x74, 0xed, 0xff, 0xf4, 0xe4, 0x26, 0xce, 0xeb, - 0x50, 0xfa, 0x8b, 0xdb, 0xa0, 0x7a, 0x62, 0x0e, 0x09, 0xcc, 0xf6, 0x59, 0x5c, 0x4f, 0xff, 0x8d, - 0xf8, 0x32, 0x4e, 0x7f, 0x75, 0x3b, 0x5c, 0x2e, 0x69, 0x75, 0xe3, 0xe8, 0xd4, 0x20, 0xc7, 0xa7, - 0x06, 0xf9, 0x7d, 0x6a, 0x90, 0xc3, 0x33, 0xa3, 0x70, 0x7c, 0x66, 0x14, 0x7e, 0x9e, 0x19, 0x85, - 0x2d, 0xfb, 0xc2, 0xa6, 0x4b, 0x98, 0x97, 0xd3, 0x43, 0xec, 0xfc, 0x10, 0x7b, 0xcf, 0x3e, 0x5f, - 0xf2, 0xc9, 0xda, 0x6b, 0x8c, 0xa5, 0x0b, 0xfa, 0xf1, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x56, - 0x98, 0x26, 0x72, 0xfd, 0x05, 0x00, 0x00, + // 744 bytes of a gzipped FileDescriptorProto + 0x1f, 0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fa, 0xf8, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xc4, 0xe2, 0x45, 0x29, 0x9e, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -505,6 +636,7 @@ type MsgClient interface { RemoveForeignCoin(ctx context.Context, in *MsgRemoveForeignCoin, opts ...grpc.CallOption) (*MsgRemoveForeignCoinResponse, error) UpdateSystemContract(ctx context.Context, in *MsgUpdateSystemContract, opts ...grpc.CallOption) (*MsgUpdateSystemContractResponse, error) UpdateZRC20WithdrawFee(ctx context.Context, in *MsgUpdateZRC20WithdrawFee, opts ...grpc.CallOption) (*MsgUpdateZRC20WithdrawFeeResponse, error) + UpdateZRC20PausedStatus(ctx context.Context, in *MsgUpdateZRC20PausedStatus, opts ...grpc.CallOption) (*MsgUpdateZRC20PausedStatusResponse, error) } type msgClient struct { @@ -551,12 +683,22 @@ func (c *msgClient) UpdateZRC20WithdrawFee(ctx context.Context, in *MsgUpdateZRC return out, nil } +func (c *msgClient) UpdateZRC20PausedStatus(ctx context.Context, in *MsgUpdateZRC20PausedStatus, opts ...grpc.CallOption) (*MsgUpdateZRC20PausedStatusResponse, error) { + out := new(MsgUpdateZRC20PausedStatusResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.fungible.Msg/UpdateZRC20PausedStatus", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { DeployFungibleCoinZRC20(context.Context, *MsgDeployFungibleCoinZRC20) (*MsgDeployFungibleCoinZRC20Response, error) RemoveForeignCoin(context.Context, *MsgRemoveForeignCoin) (*MsgRemoveForeignCoinResponse, error) UpdateSystemContract(context.Context, *MsgUpdateSystemContract) (*MsgUpdateSystemContractResponse, error) UpdateZRC20WithdrawFee(context.Context, *MsgUpdateZRC20WithdrawFee) (*MsgUpdateZRC20WithdrawFeeResponse, error) + UpdateZRC20PausedStatus(context.Context, *MsgUpdateZRC20PausedStatus) (*MsgUpdateZRC20PausedStatusResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -575,6 +717,9 @@ func (*UnimplementedMsgServer) UpdateSystemContract(ctx context.Context, req *Ms func (*UnimplementedMsgServer) UpdateZRC20WithdrawFee(ctx context.Context, req *MsgUpdateZRC20WithdrawFee) (*MsgUpdateZRC20WithdrawFeeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateZRC20WithdrawFee not implemented") } +func (*UnimplementedMsgServer) UpdateZRC20PausedStatus(ctx context.Context, req *MsgUpdateZRC20PausedStatus) (*MsgUpdateZRC20PausedStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateZRC20PausedStatus not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -652,6 +797,24 @@ func _Msg_UpdateZRC20WithdrawFee_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } +func _Msg_UpdateZRC20PausedStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateZRC20PausedStatus) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateZRC20PausedStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.fungible.Msg/UpdateZRC20PausedStatus", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateZRC20PausedStatus(ctx, req.(*MsgUpdateZRC20PausedStatus)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "zetachain.zetacore.fungible.Msg", HandlerType: (*MsgServer)(nil), @@ -672,6 +835,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateZRC20WithdrawFee", Handler: _Msg_UpdateZRC20WithdrawFee_Handler, }, + { + MethodName: "UpdateZRC20PausedStatus", + Handler: _Msg_UpdateZRC20PausedStatus_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "fungible/tx.proto", @@ -961,6 +1128,73 @@ func (m *MsgRemoveForeignCoinResponse) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } +func (m *MsgUpdateZRC20PausedStatus) 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 *MsgUpdateZRC20PausedStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateZRC20PausedStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Action != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Action)) + i-- + dAtA[i] = 0x18 + } + if len(m.Zrc20Addresses) > 0 { + for iNdEx := len(m.Zrc20Addresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Zrc20Addresses[iNdEx]) + copy(dAtA[i:], m.Zrc20Addresses[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.Zrc20Addresses[iNdEx]))) + 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 *MsgUpdateZRC20PausedStatusResponse) 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 *MsgUpdateZRC20PausedStatusResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateZRC20PausedStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -1098,6 +1332,37 @@ func (m *MsgRemoveForeignCoinResponse) Size() (n int) { return n } +func (m *MsgUpdateZRC20PausedStatus) 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 len(m.Zrc20Addresses) > 0 { + for _, s := range m.Zrc20Addresses { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + if m.Action != 0 { + n += 1 + sovTx(uint64(m.Action)) + } + return n +} + +func (m *MsgUpdateZRC20PausedStatusResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1934,6 +2199,189 @@ func (m *MsgRemoveForeignCoinResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateZRC20PausedStatus) 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: MsgUpdateZRC20PausedStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateZRC20PausedStatus: 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 Zrc20Addresses", 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.Zrc20Addresses = append(m.Zrc20Addresses, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Action", wireType) + } + m.Action = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Action |= UpdatePausedStatusAction(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateZRC20PausedStatusResponse) 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: MsgUpdateZRC20PausedStatusResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateZRC20PausedStatusResponse: 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/observer/client/cli/query.go b/x/observer/client/cli/query.go index a6db31fc0d..1d72c987d6 100644 --- a/x/observer/client/cli/query.go +++ b/x/observer/client/cli/query.go @@ -14,7 +14,7 @@ import ( ) // GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { +func GetQueryCmd(_ string) *cobra.Command { // Group observer queries under a subcommand cmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/observer/genesis.go b/x/observer/genesis.go index 92f0f63ab9..5725c6aa29 100644 --- a/x/observer/genesis.go +++ b/x/observer/genesis.go @@ -18,7 +18,12 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) } } - k.SetCoreParams(ctx, types.GetCoreParams()) + // If core params are defined set them, otherwise set default + if len(genState.CoreParamsList.CoreParams) > 0 { + k.SetCoreParams(ctx, genState.CoreParamsList) + } else { + k.SetCoreParams(ctx, types.GetCoreParams()) + } // Set all the nodeAccount for _, elem := range genState.NodeAccountList { @@ -73,6 +78,11 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { params := k.GetParams(ctx) + coreParams, found := k.GetAllCoreParams(ctx) + if !found { + coreParams = types.CoreParamsList{} + } + // Get all node accounts nodeAccountList := k.GetAllNodeAccount(ctx) nodeAccounts := make([]*types.NodeAccount, len(nodeAccountList)) @@ -103,6 +113,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { return &types.GenesisState{ Ballots: k.GetAllBallots(ctx), Observers: k.GetAllObserverMappers(ctx), + CoreParamsList: coreParams, Params: ¶ms, NodeAccountList: nodeAccounts, PermissionFlags: &pf, diff --git a/x/observer/genesis_test.go b/x/observer/genesis_test.go index 4da10aac81..2fe7bb455f 100644 --- a/x/observer/genesis_test.go +++ b/x/observer/genesis_test.go @@ -34,6 +34,7 @@ func TestGenesis(t *testing.T) { PermissionFlags: sample.PermissionFlags(), Keygen: sample.Keygen(t), LastObserverCount: sample.LastObserverCount(1000), + CoreParamsList: sample.CoreParamsList(), } // Init and export diff --git a/x/observer/module.go b/x/observer/module.go index d46ae22f63..785196d0cc 100644 --- a/x/observer/module.go +++ b/x/observer/module.go @@ -63,7 +63,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis performs genesis state validation for the observer module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var genState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genState); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -72,7 +72,7 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod } // RegisterRESTRoutes registers the observer module's REST service handlers. -func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { +func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) { } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. @@ -134,7 +134,7 @@ func (am AppModule) Route() sdk.Route { func (AppModule) QuerierRoute() string { return types.QuerierRoute } // LegacyQuerierHandler returns the observer module's Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { +func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { return nil } diff --git a/x/observer/types/genesis.go b/x/observer/types/genesis.go index a9981b1d65..350d039509 100644 --- a/x/observer/types/genesis.go +++ b/x/observer/types/genesis.go @@ -40,11 +40,7 @@ func (gs GenesisState) Validate() error { nodeAccountIndexMap[elem.GetOperator()] = true } - if err := VerifyObserverMapper(gs.Observers); err != nil { - return err - } - - return nil + return VerifyObserverMapper(gs.Observers) } func GetGenesisStateFromAppState(marshaler codec.JSONCodec, appState map[string]json.RawMessage) GenesisState { diff --git a/x/observer/types/genesis.pb.go b/x/observer/types/genesis.pb.go index 347c5fc23a..260e2aaf60 100644 --- a/x/observer/types/genesis.pb.go +++ b/x/observer/types/genesis.pb.go @@ -32,6 +32,7 @@ type GenesisState struct { 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"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -116,6 +117,13 @@ func (m *GenesisState) GetLastObserverCount() *LastObserverCount { return nil } +func (m *GenesisState) GetCoreParamsList() CoreParamsList { + if m != nil { + return m.CoreParamsList + } + return CoreParamsList{} +} + func init() { proto.RegisterType((*GenesisState)(nil), "zetachain.zetacore.observer.GenesisState") } @@ -123,32 +131,35 @@ func init() { func init() { proto.RegisterFile("observer/genesis.proto", fileDescriptor_15ea8c9d44da7399) } var fileDescriptor_15ea8c9d44da7399 = []byte{ - // 398 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xcf, 0x4a, 0xeb, 0x40, - 0x18, 0xc5, 0x9b, 0xdb, 0xde, 0x96, 0x3b, 0xbd, 0x50, 0x8d, 0xff, 0x42, 0x0b, 0xb1, 0xe8, 0xa6, - 0xa0, 0x66, 0xa0, 0x2e, 0xc5, 0x85, 0x15, 0x94, 0x62, 0xd5, 0x32, 0x2e, 0x04, 0x17, 0x86, 0x49, - 0x1c, 0xd3, 0x60, 0x9a, 0x09, 0x33, 0x53, 0xb1, 0x3e, 0x85, 0x6f, 0xe0, 0xeb, 0xb8, 0xec, 0xd2, - 0xa5, 0xb4, 0x2f, 0x22, 0x99, 0x64, 0x52, 0x6c, 0x21, 0xb8, 0xfb, 0x38, 0x73, 0xce, 0x6f, 0x66, - 0x0e, 0x1f, 0xd8, 0xa4, 0x0e, 0x27, 0xec, 0x99, 0x30, 0xe8, 0x91, 0x90, 0x70, 0x9f, 0x5b, 0x11, - 0xa3, 0x82, 0xea, 0x8d, 0x57, 0x22, 0xb0, 0x3b, 0xc0, 0x7e, 0x68, 0xc9, 0x89, 0x32, 0x62, 0x29, - 0x6b, 0x7d, 0xdd, 0xa3, 0x1e, 0x95, 0x3e, 0x18, 0x4f, 0x49, 0xa4, 0xbe, 0x91, 0xa1, 0x1c, 0x1c, - 0x04, 0x54, 0x2c, 0xc9, 0x4f, 0x64, 0xec, 0x91, 0x30, 0x95, 0x1b, 0x99, 0x1c, 0xd2, 0x07, 0x62, - 0x63, 0xd7, 0xa5, 0xa3, 0x50, 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 0x4a, 0x9d, 0xee, 0xc7, 0xd4, - 0xd4, 0x26, 0x53, 0x53, 0xfb, 0x9a, 0x9a, 0xda, 0xdb, 0xcc, 0x2c, 0x4c, 0x66, 0x66, 0xe1, 0x73, - 0x66, 0x16, 0xee, 0xa0, 0xe7, 0x8b, 0xc1, 0xc8, 0xb1, 0x5c, 0x3a, 0x84, 0x31, 0xfc, 0x40, 0xde, - 0x03, 0xd5, 0x3d, 0xf0, 0x25, 0x5b, 0x52, 0x28, 0xc6, 0x11, 0xe1, 0x4e, 0x59, 0xee, 0xdc, 0xe1, - 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6e, 0x2e, 0xbd, 0xd8, 0x5c, 0x03, 0x00, 0x00, + // 433 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x5f, 0xcb, 0xd3, 0x30, + 0x14, 0xc6, 0x5b, 0x37, 0x37, 0xcd, 0xc4, 0xcd, 0xf8, 0xaf, 0x6c, 0xd0, 0x0d, 0xbd, 0x19, 0xa8, + 0x2d, 0xcc, 0x4b, 0xf1, 0xc2, 0x0d, 0x94, 0xe1, 0xd4, 0x11, 0x2f, 0x04, 0x05, 0x4b, 0x5a, 0x63, + 0x57, 0xec, 0x9a, 0x92, 0x64, 0xe2, 0xfc, 0x14, 0x7e, 0xac, 0x5d, 0xee, 0xd2, 0x2b, 0x91, 0xed, + 0x6b, 0xbc, 0x17, 0x2f, 0x49, 0x9a, 0x8e, 0x6d, 0x50, 0xde, 0xbb, 0xc3, 0x93, 0xf3, 0xfc, 0x7a, + 0xce, 0x93, 0x14, 0x3c, 0xa0, 0x21, 0x27, 0xec, 0x27, 0x61, 0x7e, 0x4c, 0x32, 0xc2, 0x13, 0xee, + 0xe5, 0x8c, 0x0a, 0x0a, 0x7b, 0xbf, 0x89, 0xc0, 0xd1, 0x02, 0x27, 0x99, 0xa7, 0x2a, 0xca, 0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85, 0x45, 0x9a, 0xf5, 0x13, 0x70, 0x1a, 0x57, 0x30, 0xbf, 0x55, 0xad, + 0xa8, 0xb0, 0xc0, 0xaf, 0xe0, 0x6e, 0x8a, 0xb9, 0x08, 0xcc, 0x79, 0xa0, 0xb6, 0x75, 0x9a, 0x8a, + 0xe4, 0x55, 0x92, 0x66, 0x98, 0x0b, 0x93, 0xff, 0x44, 0x05, 0x76, 0x27, 0x3d, 0x95, 0xe0, 0x17, + 0xd0, 0x91, 0xae, 0x40, 0xcf, 0x1a, 0xa4, 0xf2, 0x1e, 0x6e, 0x28, 0x78, 0xf5, 0xc5, 0x4e, 0x28, + 0x23, 0x7a, 0x4f, 0x99, 0xfc, 0xb8, 0xbe, 0xf9, 0xd7, 0xb7, 0xd0, 0xed, 0xe8, 0x58, 0x9d, 0x6e, + 0x76, 0xae, 0xbd, 0xdd, 0xb9, 0xf6, 0xff, 0x9d, 0x6b, 0xff, 0xd9, 0xbb, 0xd6, 0x76, 0xef, 0x5a, + 0x7f, 0xf7, 0xae, 0xf5, 0xd9, 0x8f, 0x13, 0xb1, 0x58, 0x85, 0x5e, 0x44, 0x97, 0xbe, 0x84, 0x3f, + 0x53, 0xdf, 0xf1, 0xcd, 0x77, 0xfc, 0x5f, 0xe5, 0x1f, 0xe0, 0x8b, 0x75, 0x4e, 0x78, 0xd8, 0x50, + 0x0f, 0xfa, 0xf9, 0x65, 0x00, 0x00, 0x00, 0xff, 0xff, 0x59, 0xe1, 0x6d, 0xc3, 0xb9, 0x03, 0x00, + 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -171,6 +182,16 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.CoreParamsList.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 if m.LastObserverCount != nil { { size, err := m.LastObserverCount.MarshalToSizedBuffer(dAtA[:i]) @@ -315,6 +336,8 @@ func (m *GenesisState) Size() (n int) { l = m.LastObserverCount.Size() n += 1 + l + sovGenesis(uint64(l)) } + l = m.CoreParamsList.Size() + n += 1 + l + sovGenesis(uint64(l)) return n } @@ -599,6 +622,39 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CoreParamsList", 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 err := m.CoreParamsList.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/observer/types/params.go b/x/observer/types/params.go index 65ce1824c0..92ba0d5e0b 100644 --- a/x/observer/types/params.go +++ b/x/observer/types/params.go @@ -44,6 +44,8 @@ func DefaultAdminPolicy() []*Admin_Policy { PolicyType: Policy_Type_stop_inbound_cctx, Address: GroupID1Address, }, + // NOTE: smoke test setting depends on this type being at position 2 + // contrib/localnet/scripts/genesis.sh:93 { PolicyType: Policy_Type_deploy_fungible_coin, Address: GroupID1Address, diff --git a/zetaclient/bitcoin_client.go b/zetaclient/bitcoin_client.go index 19b5205524..c84ff232b7 100644 --- a/zetaclient/bitcoin_client.go +++ b/zetaclient/bitcoin_client.go @@ -386,6 +386,7 @@ func (ob *BitcoinChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64 uint64(res.BlockIndex), 0, // gas used not used with Bitcoin nil, // gas price not used with Bitcoin + 0, // gas limit not used with Bitcoin amountInSat, common.ReceiveStatus_Success, ob.chain, diff --git a/zetaclient/evm_client.go b/zetaclient/evm_client.go index 192d4c97bf..7162091f3d 100644 --- a/zetaclient/evm_client.go +++ b/zetaclient/evm_client.go @@ -238,6 +238,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co receipt.BlockNumber.Uint64(), receipt.GasUsed, transaction.GasPrice(), + transaction.Gas(), transaction.Value(), recvStatus, ob.chain, @@ -258,6 +259,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co receipt.BlockNumber.Uint64(), receipt.GasUsed, transaction.GasPrice(), + transaction.Gas(), transaction.Value(), common.ReceiveStatus_Success, ob.chain, @@ -277,6 +279,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co receipt.BlockNumber.Uint64(), receipt.GasUsed, transaction.GasPrice(), + transaction.Gas(), big.NewInt(0), common.ReceiveStatus_Failed, ob.chain, @@ -320,6 +323,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co vLog.BlockNumber, receipt.GasUsed, transaction.GasPrice(), + transaction.Gas(), mMint, common.ReceiveStatus_Success, ob.chain, @@ -353,6 +357,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co vLog.BlockNumber, receipt.GasUsed, transaction.GasPrice(), + transaction.Gas(), mMint, common.ReceiveStatus_Success, ob.chain, @@ -379,6 +384,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co receipt.BlockNumber.Uint64(), receipt.GasUsed, transaction.GasPrice(), + transaction.Gas(), big.NewInt(0), common.ReceiveStatus_Failed, ob.chain, @@ -415,6 +421,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co vLog.BlockNumber, receipt.GasUsed, transaction.GasPrice(), + transaction.Gas(), event.Amount, common.ReceiveStatus_Success, ob.chain, diff --git a/zetaclient/evm_signer.go b/zetaclient/evm_signer.go index 116bb42481..6f9984e3e0 100644 --- a/zetaclient/evm_signer.go +++ b/zetaclient/evm_signer.go @@ -317,21 +317,42 @@ func (signer *EVMSigner) TryProcessOutTx(send *types.CrossChainTx, outTxMan *Out // use dynamic gas price for ethereum chains var gasprice *big.Int - if common.IsEthereumChain(toChain.ChainId) { - suggested, err := signer.client.SuggestGasPrice(context.Background()) - if err != nil { - logger.Error().Err(err).Msgf("cannot get gas price from chain %s ", toChain) - return - } - gasprice = roundUpToNearestGwei(suggested) - } else { - specified, ok := new(big.Int).SetString(send.GetCurrentOutTxParam().OutboundTxGasPrice, 10) - if !ok { + + // The code below is a fix for https://github.com/zeta-chain/node/issues/1085 + // doesn't close directly the issue because we should determine if we want to keep using SuggestGasPrice if no OutboundTxGasPrice + // we should possibly remove it completely and return an error if no OutboundTxGasPrice is provided because it means no fee is processed on ZetaChain + specified, ok := new(big.Int).SetString(send.GetCurrentOutTxParam().OutboundTxGasPrice, 10) + if !ok { + if common.IsEthereumChain(toChain.ChainId) { + suggested, err := signer.client.SuggestGasPrice(context.Background()) + if err != nil { + logger.Error().Err(err).Msgf("cannot get gas price from chain %s ", toChain) + return + } + gasprice = roundUpToNearestGwei(suggested) + } else { logger.Error().Err(err).Msgf("cannot convert gas price %s ", send.GetCurrentOutTxParam().OutboundTxGasPrice) return } + } else { gasprice = specified } + //if common.IsEthereumChain(toChain.ChainId) { + // suggested, err := signer.client.SuggestGasPrice(context.Background()) + // if err != nil { + // logger.Error().Err(err).Msgf("cannot get gas price from chain %s ", toChain) + // return + // } + // gasprice = roundUpToNearestGwei(suggested) + //} else { + // specified, ok := new(big.Int).SetString(send.GetCurrentOutTxParam().OutboundTxGasPrice, 10) + // if !ok { + // logger.Error().Err(err).Msgf("cannot convert gas price %s ", send.GetCurrentOutTxParam().OutboundTxGasPrice) + // return + // } + // gasprice = specified + //} + flags, err := zetaBridge.GetPermissionFlags() if err != nil { logger.Error().Err(err).Msgf("cannot get permission flags") @@ -526,7 +547,7 @@ func (signer *EVMSigner) SignERC20WithdrawTx(recipient ethcommon.Address, asset // function unwhitelist( // address asset, // ) external onlyTssAddress -func (signer *EVMSigner) SignWhitelistTx(action string, recipient ethcommon.Address, asset ethcommon.Address, gasLimit uint64, nonce uint64, gasPrice *big.Int, height uint64) (*ethtypes.Transaction, error) { +func (signer *EVMSigner) SignWhitelistTx(action string, _ ethcommon.Address, asset ethcommon.Address, gasLimit uint64, nonce uint64, gasPrice *big.Int, height uint64) (*ethtypes.Transaction, error) { var data []byte var err error diff --git a/zetaclient/tx.go b/zetaclient/tx.go index 9f648519c0..ea0335ee01 100644 --- a/zetaclient/tx.go +++ b/zetaclient/tx.go @@ -87,6 +87,7 @@ func (b *ZetaCoreBridge) PostReceiveConfirmation( outBlockHeight uint64, outTxGasUsed uint64, outTxEffectiveGasPrice *big.Int, + outTxEffectiveGasLimit uint64, amount *big.Int, status common.ReceiveStatus, chain common.Chain, @@ -106,6 +107,7 @@ func (b *ZetaCoreBridge) PostReceiveConfirmation( outBlockHeight, outTxGasUsed, math.NewIntFromBigInt(outTxEffectiveGasPrice), + outTxEffectiveGasLimit, math.NewUintFromBigInt(amount), status, chain.ChainId,