diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index ec904b1899..7c2bcf799b 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -1 +1,3 @@
* @brewmaster012 @kingpinXD @kevinssgh @fadeev @lumtis @ws4charlie
+
+.github/** @zeta-chain/devops
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/actions/upgrade-testing/action.yml b/.github/actions/upgrade-testing/action.yml
index b01862ea1a..da9019e8df 100644
--- a/.github/actions/upgrade-testing/action.yml
+++ b/.github/actions/upgrade-testing/action.yml
@@ -48,7 +48,7 @@ runs:
BINARY_NAME_SUFFIX: "ubuntu-22-amd64"
UPGRADES_SLEEP_TIME: 300
DEBUG_UPGRADES: "false"
- #BINARY_DOWNLOAD_LIST: '{"binary_download_list":[["v8.3.3", "zetacored-ubuntu-22-amd64"],["v9.0.0", "zetacored-ubuntu-22-amd64"]]}'
+ #BINARY_DOWNLOAD_LIST: '{"binary_download_list":[["v8.3.3", "zetacored-testnet-linux-amd64"],["v9.0.0", "zetacored-ubuntu-22-amd64"]]}'
#TAG_LIST: '{"tag_list":["v8.3.3","v9.0.0"]}'
STARTING_VERSION: "v8.3.3"
#END_VERSION: "v9.0.0"
@@ -60,7 +60,7 @@ runs:
echo "***********Change Permission of Zetacored*********************"
chmod a+x zetacored*
chmod -R 777 zetacored*
- mv zetacored-ubuntu-22-amd64 zetacored
+ mv zetacored-testnet-linux-amd64 zetacored
export PATH=$(pwd):$PATH
echo "***********Change Directories into the Upgrade Testing Directory.*********************"
diff --git a/.github/actions/upgrade-testing/create_genesis.py b/.github/actions/upgrade-testing/create_genesis.py
new file mode 100644
index 0000000000..75ef7f9f66
--- /dev/null
+++ b/.github/actions/upgrade-testing/create_genesis.py
@@ -0,0 +1,54 @@
+import json
+import os
+
+genesis = open(os.environ["NEW_GENESIS"], "r").read()
+genesis_json_object = json.loads(genesis)
+
+#cut this out for now because it fails to start when done in python with the exact same keys being replaced with same value. Will fix later.
+# genesis_json_object["staking"]["params"]["bond_denom"] = "azeta"
+# genesis_json_object["crisis"]["constant_fee"]["denom"] = "azeta"
+# genesis_json_object["gov"]["deposit_params"]["min_deposit"][0]["denom"] = "azeta"
+# genesis_json_object["mint"]["params"]["mint_denom"] = "azeta"
+# genesis_json_object["evm"]["params"]["evm_denom"] = "azeta"
+# genesis_json_object["block"]["max_gas"] = "10000000"
+# genesis_json_object["gov"]["voting_params"]["voting_period"] = '60s'
+
+exported_genesis = open(os.environ["OLD_GENESIS"], "r").read()
+exported_genesis_json_object = json.loads(exported_genesis)
+
+crosschain = exported_genesis_json_object["app_state"]["crosschain"]
+observer = exported_genesis_json_object["app_state"]["observer"]
+emissions = exported_genesis_json_object["app_state"]["emissions"]
+fungible = exported_genesis_json_object["app_state"]["fungible"]
+evm = exported_genesis_json_object["app_state"]["evm"]
+auth_accounts = exported_genesis_json_object["app_state"]["auth"]["accounts"]
+
+genesis_json_object["app_state"]["auth"]["accounts"] = genesis_json_object["app_state"]["auth"]["accounts"] + auth_accounts
+genesis_json_object["app_state"]["crosschain"] = crosschain
+genesis_json_object["app_state"]["observer"] = observer
+genesis_json_object["app_state"]["emissions"] = emissions
+genesis_json_object["app_state"]["fungible"] = fungible
+
+evm_accounts = []
+for index, account in enumerate(evm["accounts"]):
+ if account["address"] == "0x0000000000000000000000000000000000000001":
+ print("pop account", account["address"])
+ elif account["address"] == "0x0000000000000000000000000000000000000006":
+ print("pop account", account["address"])
+ elif account["address"] == "0x0000000000000000000000000000000000000002":
+ print("pop account", account["address"])
+ elif account["address"] == "0x0000000000000000000000000000000000000002":
+ print("pop account", account["address"])
+ elif account["address"] == "0x0000000000000000000000000000000000000008":
+ print("pop account", account["address"])
+ else:
+ evm_accounts.append(account)
+
+evm["accounts"] = evm_accounts
+genesis_json_object["app_state"]["evm"] = evm
+
+genesis = open("genesis-edited.json", "w")
+genesis_string = json.dumps(genesis_json_object, indent=2)
+dumped_genesis_object = genesis_string.replace("0x0000000000000000000000000000000000000001","0x387A12B28fe02DcAa467c6a1070D19B82F718Bb5")
+genesis.write(genesis_string)
+genesis.close()
diff --git a/.github/actions/upgrade-testing/scripts/create_genesis.py b/.github/actions/upgrade-testing/scripts/create_genesis.py
new file mode 100644
index 0000000000..ce5e3627dd
--- /dev/null
+++ b/.github/actions/upgrade-testing/scripts/create_genesis.py
@@ -0,0 +1,49 @@
+import json
+import os
+
+print("OPEN NEW GENESIS")
+genesis = open(os.environ["NEW_GENESIS"], "r").read()
+genesis_json_object = json.loads(genesis)
+
+print("OPEN OLD GENESIS")
+exported_genesis = open(os.environ["OLD_GENESIS"], "r").read()
+exported_genesis_json_object = json.loads(exported_genesis)
+
+print("PULL STATE OUT OF OLD GENESIS")
+crosschain = exported_genesis_json_object["app_state"]["crosschain"]
+observer = exported_genesis_json_object["app_state"]["observer"]
+emissions = exported_genesis_json_object["app_state"]["emissions"]
+fungible = exported_genesis_json_object["app_state"]["fungible"]
+evm = exported_genesis_json_object["app_state"]["evm"]
+auth_accounts = exported_genesis_json_object["app_state"]["auth"]["accounts"]
+
+print("MANIPULATE NEW GENESIS")
+genesis_json_object["app_state"]["auth"]["accounts"] = genesis_json_object["app_state"]["auth"]["accounts"] + auth_accounts
+genesis_json_object["app_state"]["crosschain"] = crosschain
+genesis_json_object["app_state"]["observer"] = observer
+genesis_json_object["app_state"]["emissions"] = emissions
+genesis_json_object["app_state"]["fungible"] = fungible
+
+evm_accounts = []
+for index, account in enumerate(evm["accounts"]):
+ if account["address"] == "0x0000000000000000000000000000000000000001":
+ print("pop account", account["address"])
+ elif account["address"] == "0x0000000000000000000000000000000000000006":
+ print("pop account", account["address"])
+ elif account["address"] == "0x0000000000000000000000000000000000000002":
+ print("pop account", account["address"])
+ elif account["address"] == "0x0000000000000000000000000000000000000002":
+ print("pop account", account["address"])
+ elif account["address"] == "0x0000000000000000000000000000000000000008":
+ print("pop account", account["address"])
+ else:
+ evm_accounts.append(account)
+evm["accounts"] = evm_accounts
+genesis_json_object["app_state"]["evm"] = evm
+
+print("WRITE GENESIS-EDITED")
+genesis = open("genesis-edited.json", "w")
+genesis_string = json.dumps(genesis_json_object, indent=2)
+dumped_genesis_object = genesis_string.replace("0x0000000000000000000000000000000000000001","0x387A12B28fe02DcAa467c6a1070D19B82F718Bb5")
+genesis.write(genesis_string)
+genesis.close()
diff --git a/.github/actions/upgrade-testing/scripts/get_proposal_id.py b/.github/actions/upgrade-testing/scripts/get_proposal_id.py
new file mode 100644
index 0000000000..39105228de
--- /dev/null
+++ b/.github/actions/upgrade-testing/scripts/get_proposal_id.py
@@ -0,0 +1,23 @@
+import json
+import subprocess
+import os
+
+os.environ['NODE'] = "http://127.0.0.1:26657"
+def run_command(self, cmd):
+ COMMAND_PREFIX = "export PATH=" + self.go_path + ":${PATH} && "
+ cmd = COMMAND_PREFIX + cmd
+ result = subprocess.run(cmd, stdout=subprocess.PIPE, shell=True)
+ result_output = result.stdout.decode('utf-8')
+ return result_output
+
+try:
+ QUERY_GOV_PROPOSAL = f"""zetacored query gov proposals --output json --node {os.environ['NODE']}"""
+ GOV_PROPOSALS = json.loads(run_command(QUERY_GOV_PROPOSAL))
+ for proposal in GOV_PROPOSALS["proposals"]:
+ try:
+ PROPOSAL_ID = proposal["id"]
+ except Exception as e:
+ print(1)
+ print(PROPOSAL_ID)
+except Exception as e:
+ print(1)
\ No newline at end of file
diff --git a/.github/actions/upgrade-testing/scripts/raise_gov_proposal.py b/.github/actions/upgrade-testing/scripts/raise_gov_proposal.py
new file mode 100644
index 0000000000..cd33a1a116
--- /dev/null
+++ b/.github/actions/upgrade-testing/scripts/raise_gov_proposal.py
@@ -0,0 +1,63 @@
+import os
+import requests
+import json
+
+os.environ['NODE'] = "http://127.0.0.1:26657"
+CURRENT_HEIGHT = requests.get(f"{os.environ['NODE']}/status").json()["result"]["sync_info"]["latest_block_height"]
+UPGRADE_HEIGHT = int(CURRENT_HEIGHT) + (
+ int(os.environ['PROPOSAL_TIME_SECONDS']) / int(os.environ['BLOCK_TIME_SECONDS'])) + 20
+github_file = open(os.environ["GITHUB_ENV"], "a+")
+github_file.write(f"UPGRADE_HEIGHT={UPGRADE_HEIGHT}")
+github_file.close()
+
+proposal_json = {
+ "messages": [
+ {
+ "@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade",
+ "authority": os.environ["GOV_ADDRESS"],
+ "plan": {
+ "name": os.environ['UPGRADE_NAME'],
+ "time": "0001-01-01T00:00:00Z",
+ "height": str(UPGRADE_HEIGHT).split('.')[0],
+ "info": os.environ["UPGRADE_INFO"],
+ "upgraded_client_state": None
+ }
+ }
+ ],
+ "metadata": os.environ["METADATA"],
+ "deposit": os.environ["DEPOSIT"]
+}
+
+proposal_json = json.dumps(proposal_json)
+write_gov_json = open("gov.json", "w")
+write_gov_json.write(proposal_json)
+write_gov_json.close()
+
+# GOV_PROPOSAL = f"""zetacored tx gov submit-proposal gov.json \
+# --from {os.environ['MONIKER']} \
+# --chain-id "{os.environ['CHAINID']}" \
+# --keyring-backend test \
+# --node "{os.environ['NODE']}" \
+# --gas=auto \
+# --gas-adjustment=2 \
+# --gas-prices={os.environ['GAS_PRICES']} \
+# -y
+# """
+
+GOV_PROPOSAL = f"""zetacored tx gov submit-legacy-proposal software-upgrade "{os.environ['UPGRADE_NAME']}" \
+ --from "{os.environ['MONIKER']}" \
+ --deposit {os.environ["DEPOSIT"]} \
+ --upgrade-height "{str(UPGRADE_HEIGHT).split('.')[0]}" \
+ --upgrade-info '{os.environ["UPGRADE_INFO"]}' \
+ --title "{os.environ['VERSION']}" \
+ --description "Zeta Release {os.environ['UPGRADE_NAME']}" \
+ --chain-id "{os.environ['CHAINID']}" \
+ --node "{os.environ['NODE']}" \
+ --keyring-backend test \
+ --gas=auto \
+ --gas-adjustment=2 \
+ --gas-prices={os.environ['GAS_PRICES']} \
+ -y \
+ --no-validate"""
+
+print(GOV_PROPOSAL)
diff --git a/.github/labeler.yml b/.github/labeler.yml
index aebf63e968..293796511c 100644
--- a/.github/labeler.yml
+++ b/.github/labeler.yml
@@ -4,3 +4,6 @@ breaking:proto:
breaking:cli:
- "x/*/client/cli/*.go"
- "cmd/**/*.go"
+
+ci:
+ - ".github/**"
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ce4ba4a4dc..fd459bafef 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,16 +1,9 @@
-name: Build
+name: PR Testing
on:
- push:
- branches:
- - develop
- - athens2-develop
- tags:
- - "*"
pull_request:
branches:
- develop
- - athens2-develop
types:
- synchronize
- opened
@@ -18,7 +11,7 @@ on:
- ready_for_review
concurrency:
- group: build-${{ github.head_ref || github.run_id }}
+ group: pr-testing-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
@@ -28,13 +21,11 @@ env:
GITHUB_REF_NAME: "$(echo ${{ github.ref_name }} | tr '//' '-')"
jobs:
- build-and-test-single-arch:
- runs-on: ubuntu-latest
- # runs-on: ["zeta-runners"]
- timeout-minutes: 20
- if: (! startsWith(github.ref, 'refs/tags/')) || (! startsWith(github.ref, 'refs/heads/develop') )
+ build-and-test:
+ runs-on: buildjet-4vcpu-ubuntu-2004
+ timeout-minutes: 15
concurrency:
- group: "build-and-test-single-arch"
+ group: "build-and-test"
steps:
- uses: actions/checkout@v3
@@ -86,205 +77,9 @@ jobs:
shell: bash
run: rm -rf *
- build-and-test-multi-arch:
- strategy:
- matrix:
- runs-on:
- [
- buildjet-4vcpu-ubuntu-2204-arm,
- buildjet-4vcpu-ubuntu-2204,
- buildjet-4vcpu-ubuntu-2004
- ]
-
- runs-on: ${{matrix.runs-on}}
- timeout-minutes: 30
- if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/develop')
- steps:
- - uses: actions/checkout@v3
-
- - name: Set CPU Architecture
- shell: bash
- run: |
- if [ "$(uname -m)" == "aarch64" ]; then
- echo "CPU_ARCH=arm64" >> $GITHUB_ENV
- elif [ "$(uname -m)" == "x86_64" ]; then
- echo "CPU_ARCH=amd64" >> $GITHUB_ENV
- else
- echo "Unsupported architecture" >&2
- exit 1
- fi
-
- - name: Install Pipeline Dependencies
- uses: ./.github/actions/install-dependencies
- timeout-minutes: 8
- with:
- cpu_architecture: ${{ env.CPU_ARCH }}
- skip_python: "true"
- skip_aws_cli: "true"
- skip_docker_compose: "true"
-
- # - uses: buildjet/cache
- # timeout-minutes: 5
- # with:
- # path: |
- # ~/.cache/go-build
- # ~/go/pkg/mod
- # key: ${{ matrix.runs-on }}-go-${{ hashFiles('**/go.sum') }}
- # restore-keys: |
- # ${{ matrix.runs-on }}-go-
-
- - name: Test
- uses: nick-fields/retry@v2
- with:
- timeout_minutes: 20
- max_attempts: 2
- retry_on: error
- command: |
- echo "Running Build Tests"
- make clean
- make test
-
- - name: Build zetacored and zetaclientd
- env:
- CGO_ENABLED: 1
- GOOS: linux
- GOARCH: ${{ env.CPU_ARCH }}
- run: |
- make install-testnet
- cp "$HOME"/go/bin/* ./
- chmod a+x ./zetacored
- ./zetacored version
-
-
- - name: Name Binaries
- if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/develop')
- env:
- CPU_ARCH: ${{ env.CPU_ARCH }}
- run: |
- OS_VERSION=$(cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d '=' -f 2 | cut -d '.' -f 1)
- cp zetacored zetacored-ubuntu-$OS_VERSION-$CPU_ARCH
- cp zetaclientd zetaclientd-ubuntu-$OS_VERSION-$CPU_ARCH
-
- - name: Save Binaries as Artifacts
- uses: actions/upload-artifact@v3
- if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/develop')
- with:
- name: binaries-${{ github.sha }}
- path: |
- zetacored-ubuntu-*
- zetaclientd-ubuntu-*
-
- - name: Clean Up Workspace
- if: always()
- shell: bash
- run: rm -rf *
-
- build-alpine-and-test:
- runs-on: ["ubuntu-latest"]
- timeout-minutes: 30
- if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/develop')
- concurrency:
- group: "alpine-build-test"
- steps:
- - uses: actions/checkout@v3
-
- - name: Set CPU Architecture
- shell: bash
- run: |
- if [ "$(uname -m)" == "aarch64" ]; then
- echo "CPU_ARCH=arm64" >> $GITHUB_ENV
- elif [ "$(uname -m)" == "x86_64" ]; then
- echo "CPU_ARCH=amd64" >> $GITHUB_ENV
- else
- echo "Unsupported architecture" >&2
- exit 1
- fi
-
- - name: Install Pipeline Dependencies
- uses: ./.github/actions/install-dependencies
- timeout-minutes: 8
- with:
- cpu_architecture: ${{ env.CPU_ARCH }}
- skip_python: "true"
- skip_aws_cli: "true"
- skip_docker_compose: "false"
-
- - uses: jirutka/setup-alpine@v1
- with:
- branch: v3.17
- arch: x86_64
- packages: >
- build-base
- pkgconf
- lld
- go
- gcc
- g++
- libusb-dev
- linux-headers
- git
- shell-name: alpine.sh
-
- - name: Test
- env:
- CGO_ENABLED: 1
- GOOS: linux
- GOARCH: ${{ env.CPU_ARCH }}
- shell: alpine.sh --root {0}
- run: |
- echo "Running Build Tests"
- apk add --no-cache --update
- make clean
- make test
-
- - name: Build zetacored and zetaclientd
- env:
- CGO_ENABLED: 1
- GOOS: linux
- GOARCH: ${{ env.CPU_ARCH }}
- shell: alpine.sh --root {0}
- run: |
- git config --global --add safe.directory '*'
- go mod tidy
- make install-testnet
- cp "$HOME"/go/bin/* ./
-
- - name: Binary Docker Test
- env:
- CPU_ARCH: ${{ env.CPU_ARCH }}
- shell: alpine.sh --root {0}
- run: |
- chmod a+x ./zetacored
- ./zetacored version
- mv zetacored zetacored-alpine-$CPU_ARCH
- mv zetaclientd zetaclientd-alpine-$CPU_ARCH
-
- - name: Save Binaries as Artifacts
- if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/develop')
- uses: actions/upload-artifact@v3
- with:
- name: binaries-${{ github.sha }}
- path: |
- zetacored-alpine-*
- zetaclientd-alpine-*
-
- - name: Clean Up Alpine Workspace
- if: always()
- shell: alpine.sh --root {0}
- run: |
- set -e # fail on error
- rm -rf *
-
- - name: Clean Up Workspace
- if: always()
- shell: bash
- run: rm -rf *
-
-
smoke-test:
- runs-on: ["zeta-runners"]
- #runs-on: ubuntu-latest
- timeout-minutes: 20
+ runs-on: ["zeta-runners"] # 20 minutes
+ timeout-minutes: 25
steps:
- uses: actions/checkout@v3
@@ -342,252 +137,4 @@ jobs:
shell: bash
run: rm -rf *
- upload:
- runs-on: ["zeta-runners"]
- #runs-on: ubuntu-latest
- timeout-minutes: 15
- if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/develop')
- needs:
- - build-and-test-multi-arch
- - smoke-test
- - build-alpine-and-test
- steps:
- - uses: actions/checkout@v3
-
- - name: Install Pipeline Dependencies
- uses: ./.github/actions/install-dependencies
- timeout-minutes: 8
- with:
- cpu_architecture: ${{ env.CPU_ARCH }}
- skip_python: "true"
- skip_aws_cli: "false"
- skip_docker_compose: "true"
-
- - name: Get branch name
- id: branch-name
- uses: tj-actions/branch-names@v6
-
- - name: Git Hash
- run: |
- echo "GIT_HASH=$(git rev-parse --short HEAD)" >> ${GITHUB_ENV}
- echo "WORKSPACE_DIR=$(pwd)" >> ${GITHUB_ENV}
-
- - name: set-branch-name
- uses: ./.github/actions/set-branch-name
- with:
- github_ref: "${{github.ref}}"
- github_event: "${{ github.event_name }}"
- github_head_ref: "${{ github.event.pull_request.head.ref }}"
- github_commit_sha: "${{ env.GIT_HASH }}"
- current_branch_name: "${{ steps.branch-name.outputs.current_branch }}"
-
- - uses: actions/download-artifact@v3
- with:
- name: binaries-${{ github.sha }}
- path: ./
-
- - name: Configure AWS Credentials
- uses: aws-actions/configure-aws-credentials@v1
- with:
- aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
- aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- aws-region: ${{ env.AWS_REGION }}
-
- - name: upload-files-to-s3
- uses: ./.github/actions/upload-to-s3
- with:
- bucket-name: ${{ env.S3_BUCKET_PATH }}
- release-name: ${{ env.RELEASE_NAME }}
- git-sha: ${{ github.sha }}
- files: |
- zetacored-alpine-amd64
- zetaclientd-alpine-amd64
- zetacored-ubuntu-22-arm64
- zetaclientd-ubuntu-22-arm64
- zetacored-ubuntu-22-amd64
- zetaclientd-ubuntu-22-amd64
- zetacored-ubuntu-20-amd64
- zetaclientd-ubuntu-20-amd64
-
- # # Approval will be required closer to mainnet
- # - name: Require Approval To Create a Release
- # uses: softprops/action-gh-release@v1
- # if: startsWith(github.ref, 'refs/tags/v')
- # with:
- # token: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }}
- # files: |
- # zetacored-alpine-amd64
- # zetaclientd-alpine-amd64
- # zetacored-ubuntu-22-arm64
- # zetaclientd-ubuntu-22-arm64
- # zetacored-ubuntu-22-amd64
- # zetaclientd-ubuntu-22-amd64
- # zetacored-ubuntu-20-amd64
- # zetaclientd-ubuntu-20-amd64
-
- - name: Build, tag, and push docker images
- uses: ./.github/actions/build-docker-images
- with:
- DOCKER_FILENAME: Dockerfile
- REPOSITORY_NAME: zeta-node
- IMAGE_TAG: ${{ env.TAG_NAME }}
- GHCR_USERNAME: ${{ secrets.PAT_GITHUB_SERVICE_ACCT_USERNAME }}
- GHCR_TOKEN: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }}
-
- - name: Create GitHub Release for ZetaCore/ZetaClient
- uses: softprops/action-gh-release@v1
- if: startsWith(github.ref, 'refs/tags/v')
- with:
- token: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }}
- generate_release_notes: true
- files: |
- zetacored-alpine-amd64
- zetaclientd-alpine-amd64
- zetacored-ubuntu-22-arm64
- zetaclientd-ubuntu-22-arm64
- zetacored-ubuntu-22-amd64
- zetaclientd-ubuntu-22-amd64
- zetacored-ubuntu-20-amd64
- zetaclientd-ubuntu-20-amd64
-
- - name: Clean Up Workspace
- if: always()
- shell: bash
- run: rm -rf *
-
- upgrade_path_testing:
- runs-on: ["buildjet-4vcpu-ubuntu-2204"]
- timeout-minutes: 60
- if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/release')
- needs:
- - build-and-test-multi-arch
- - build-alpine-and-test
- - upload
- steps:
- - uses: actions/checkout@v3
- with:
- fetch-depth: 0
-
- - name: Major Version in Upgrade Handler Must Match Tag
- if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/release')
- run: |
- UPGRADE_HANDLER_MAJOR_VERSION=$(cat app/setup_handlers.go | grep "const releaseVersion" | cut -d ' ' -f4 | tr -d '"' | cut -d '.' -f1)
- echo $UPGRADE_HANDLER_MAJOR_VERSION
- GITHUB_TAG_MAJOR_VERSION=$(echo ${{ github.ref_name }} | cut -d '.' -f1)
- if [ $GITHUB_TAG_MAJOR_VERSION != $UPGRADE_HANDLER_MAJOR_VERSION ]; then
- echo "ERROR: The major version of this release (${{ github.ref_name }}) does not match the major version in the releaseVersion constant ($UPGRADE_HANDLER_MAJOR_VERSION) found in app/setup_handlers.go"
- echo "Did you forget to update the 'releaseVersion' in app/setup_handlers.go?"
- exit 1
- fi
- echo "The major version found in 'releaseVersion' in app/setup_handlers.go matches this tagged release - Moving Forward!"
-
- - name: upgrade-path-testing
- uses: ./.github/actions/upgrade-testing
- with:
- github_token: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }}
-
- - name: Clean Up Workspace
- if: always()
- shell: bash
- run: rm -rf *
-
- upload_s3_public:
- #runs-on: ubuntu-latest
- runs-on: ["zeta-runners"]
- timeout-minutes: 15
- if: startsWith(github.ref, 'refs/tags/')
- needs:
- - build-and-test-multi-arch
- - build-alpine-and-test
- - upload
-
- steps:
- - uses: actions/checkout@v3
-
- - name: Install Pipeline Dependencies
- uses: ./.github/actions/install-dependencies
- timeout-minutes: 8
- with:
- cpu_architecture: ${{ env.CPU_ARCH }}
- skip_python: "true"
- skip_aws_cli: "false"
- skip_docker_compose: "true"
-
- - uses: actions/download-artifact@v3
- with:
- name: binaries-${{ github.sha }}
- path: ./
-
- - name: Configure AWS Credentials
- uses: aws-actions/configure-aws-credentials@v1
- with:
- aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
- aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- aws-region: ${{ env.AWS_REGION }}
-
- - name: Get Version
- run: |
- VERSION=$(cat app/setup_handlers.go | grep "const releaseVersion" | cut -d ' ' -f4 | tr -d '"')
- echo "BINARY_VERSION=${VERSION}" >> ${GITHUB_ENV}
-
- - name: upload-files-to-s3
- uses: ./.github/actions/upload-to-s3
- with:
- bucket-name: ${{ env.S3_PUBLIC_BUCKET_PATH }}
- release-name: "binaries/athens3/${{ env.BINARY_VERSION }}"
- git-sha: ${{ github.sha }}
- files: |
- zetacored-alpine-amd64
- zetaclientd-alpine-amd64
- zetacored-ubuntu-22-arm64
- zetaclientd-ubuntu-22-arm64
- zetacored-ubuntu-22-amd64
- zetaclientd-ubuntu-22-amd64
- zetacored-ubuntu-20-amd64
- zetaclientd-ubuntu-20-amd64
-
- - name: Determine Release Type
- run: |
- if [[ "${{ env.BINARY_VERSION }}" =~ ^v[0-9]+\.0\.0+$ ]]; then
- echo "RELEASE_TYPE=major" >> ${GITHUB_ENV}
- elif [[ "${{ env.BINARY_VERSION }}" =~ ^v[0-9]+\.[0-9]+\.[1-9]+$ ]]; then
- echo "RELEASE_TYPE=minor" >> ${GITHUB_ENV}
- else
- echo "RELEASE_TYPE=unknown" >> ${GITHUB_ENV}
- fi
- id: determine_release_type
-
- - name: "SEND:DISCORD:MESSAGE"
- if: steps.determine_release_type.outputs.RELEASE_TYPE == 'major'
- uses: gzukel/CosmosComposites/send_discord_message@main
- with:
- discord_token: "${{ secrets.DISCORD_TOKEN }}"
- discord_channel_id: "${{ secrets.DISCORD_CHANNEL_ID }}"
- discord_message: |
- Hey <@&1122981184255840306>! A new version of the ZetaChain software has been released.
-
- Major Version Upgrade (e.g. v5.x.x to V6.x.x) must be completed through a governance proposal.
- We will submit a governance proposal in the next few days.
- More specific information including block height will be shared as part of the governance proposal.
-
- See the release notes for more details. https://github.com/zeta-chain/node/releases/tag/${{ env.BINARY_VERSION }}
-
- # - name: "SEND:DISCORD:MESSAGE"
- # if: steps.determine_release_type.outputs.RELEASE_TYPE == 'minor'
- # uses: gzukel/CosmosComposites/send_discord_message@main
- # with:
- # discord_token: "${{ secrets.DISCORD_TOKEN }}"
- # discord_channel_id: "${{ secrets.DISCORD_CHANNEL_ID }}"
- # discord_message: |
- # Hey <@&1122981184255840306>! A new version of the zetachain node has been released.
-
- # Minor Version Upgrade (e.g. v5.0.x to v5.1.x) can be applied without a governance proposal.
- # Please review the release notes for any specific upgrade instructions or considerations.
-
- # See the release notes for more details. https://github.com/zeta-chain/node/releases/tag/${{ env.BINARY_VERSION }}
-
- - name: Clean Up Workspace
- if: always()
- shell: bash
- run: rm -rf *
\ No newline at end of file
diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml
new file mode 100644
index 0000000000..7f88220c26
--- /dev/null
+++ b/.github/workflows/publish-release.yml
@@ -0,0 +1,233 @@
+name: Publish Release
+
+on:
+ push:
+ tags:
+ - "v*.*.*"
+
+concurrency:
+ group: publish-release
+ cancel-in-progress: false
+
+env:
+ GITHUB_REF_NAME: "$(echo ${{ github.ref_name }} | tr '//' '-')"
+
+jobs:
+ pre-release-checks:
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Major Version in Upgrade Handler Must Match Tag
+ run: |
+ UPGRADE_HANDLER_MAJOR_VERSION=$(cat app/setup_handlers.go | grep "const releaseVersion" | cut -d ' ' -f4 | tr -d '"' | cut -d '.' -f1)
+ echo $UPGRADE_HANDLER_MAJOR_VERSION
+ GITHUB_TAG_MAJOR_VERSION=$(echo ${{ github.ref_name }} | cut -d '.' -f1)
+ if [ $GITHUB_TAG_MAJOR_VERSION != $UPGRADE_HANDLER_MAJOR_VERSION ]; then
+ echo "ERROR: The major version of this release (${{ github.ref_name }}) does not match the major version in the releaseVersion constant ($UPGRADE_HANDLER_MAJOR_VERSION) found in app/setup_handlers.go"
+ echo "Did you forget to update the 'releaseVersion' in app/setup_handlers.go?"
+ exit 1
+ fi
+ echo "The major version found in 'releaseVersion' in app/setup_handlers.go matches this tagged release - Moving Forward!"
+
+ publish-release:
+ runs-on: buildjet-4vcpu-ubuntu-2004
+ timeout-minutes: 60
+ needs:
+ - pre-release-checks
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Set CPU Architecture
+ shell: bash
+ run: |
+ if [ "$(uname -m)" == "aarch64" ]; then
+ echo "CPU_ARCH=arm64" >> $GITHUB_ENV
+ elif [ "$(uname -m)" == "x86_64" ]; then
+ echo "CPU_ARCH=amd64" >> $GITHUB_ENV
+ else
+ echo "Unsupported architecture" >&2
+ exit 1
+ fi
+
+ - name: Install Pipeline Dependencies
+ uses: ./.github/actions/install-dependencies
+ timeout-minutes: 8
+ with:
+ cpu_architecture: ${{ env.CPU_ARCH }}
+ skip_python: "true"
+ skip_aws_cli: "true"
+ skip_docker_compose: "true"
+
+ - name: Create GitHub Release
+ uses: softprops/action-gh-release@v1
+ with:
+ token: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }}
+ generate_release_notes: true
+
+ - name: Publish Release Files
+ env:
+ GITHUB_TOKEN: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }}
+ run: |
+ touch .release-env
+ make release
+
+ ## TODO - Will add in later after optimizing docker images
+ # - name: Build, tag, and push docker images
+ # uses: ./.github/actions/build-docker-images
+ # with:
+ # DOCKER_FILENAME: Dockerfile
+ # REPOSITORY_NAME: zeta-node
+ # IMAGE_TAG: ${{ env.TAG_NAME }}
+ # GHCR_USERNAME: ${{ secrets.PAT_GITHUB_SERVICE_ACCT_USERNAME }}
+ # GHCR_TOKEN: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }}
+
+ build-alpine:
+ runs-on: ["ubuntu-latest"]
+ timeout-minutes: 30
+ concurrency:
+ group: "alpine-build-test"
+ needs:
+ - pre-release-checks
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Set CPU Architecture
+ shell: bash
+ run: |
+ if [ "$(uname -m)" == "aarch64" ]; then
+ echo "CPU_ARCH=arm64" >> $GITHUB_ENV
+ elif [ "$(uname -m)" == "x86_64" ]; then
+ echo "CPU_ARCH=amd64" >> $GITHUB_ENV
+ else
+ echo "Unsupported architecture" >&2
+ exit 1
+ fi
+
+ - name: Install Pipeline Dependencies
+ uses: ./.github/actions/install-dependencies
+ timeout-minutes: 8
+ with:
+ cpu_architecture: ${{ env.CPU_ARCH }}
+ skip_python: "true"
+ skip_aws_cli: "true"
+ skip_docker_compose: "false"
+
+ - uses: jirutka/setup-alpine@v1
+ with:
+ branch: v3.17
+ arch: x86_64
+ packages: >
+ build-base
+ pkgconf
+ lld
+ go
+ gcc
+ g++
+ libusb-dev
+ linux-headers
+ git
+ shell-name: alpine.sh
+
+ - name: Build zetacored and zetaclientd
+ env:
+ CGO_ENABLED: 1
+ GOOS: linux
+ GOARCH: ${{ env.CPU_ARCH }}
+ shell: alpine.sh --root {0}
+ run: |
+ git config --global --add safe.directory '*'
+ make install-testnet
+ cp "$HOME"/go/bin/* ./
+
+ - name: Binary Docker Test
+ env:
+ CPU_ARCH: ${{ env.CPU_ARCH }}
+ shell: alpine.sh --root {0}
+ run: |
+ chmod a+x ./zetacored
+ ./zetacored version
+ mv zetacored zetacored-testnet-alpine-$CPU_ARCH
+ mv zetaclientd zetaclientd-testnet-alpine-$CPU_ARCH
+
+ - name: Create GitHub Release
+ uses: softprops/action-gh-release@v1
+ with:
+ token: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }}
+ generate_release_notes: true
+ files: |
+ zetacored-*
+ zetaclientd-*
+
+ - name: Clean Up Alpine Workspace
+ if: always()
+ shell: alpine.sh --root {0}
+ run: |
+ set -e # fail on error
+ rm -rf *
+
+ - name: Clean Up Workspace
+ if: always()
+ shell: bash
+ run: rm -rf *
+
+ announce-release:
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+ needs:
+ - publish-release
+ - build-alpine
+ steps:
+ - uses: actions/checkout@v3
+ - name: Get Version
+ run: |
+ VERSION=$(cat app/setup_handlers.go | grep "const releaseVersion" | cut -d ' ' -f4 | tr -d '"')
+ echo "BINARY_VERSION=${VERSION}" >> ${GITHUB_ENV}
+
+ - name: Determine Release Type
+ id: determine_release_type
+ run: |
+ if [[ "${{ env.BINARY_VERSION }}" =~ ^v[0-9]+\.0\.0+$ ]]; then
+ echo "RELEASE_TYPE=major" >> ${GITHUB_ENV}
+ elif [[ "${{ env.BINARY_VERSION }}" =~ ^v[0-9]+\.[0-9]+\.[1-9]+$ ]]; then
+ echo "RELEASE_TYPE=minor" >> ${GITHUB_ENV}
+ else
+ echo "RELEASE_TYPE=unknown" >> ${GITHUB_ENV}
+ fi
+
+ - name: "SEND:DISCORD:MESSAGE"
+ if: steps.determine_release_type.outputs.RELEASE_TYPE == 'major'
+ uses: gzukel/CosmosComposites/send_discord_message@main
+ with:
+ discord_token: "${{ secrets.DISCORD_TOKEN }}"
+ discord_channel_id: "${{ secrets.DISCORD_CHANNEL_ID }}"
+ discord_message: |
+ Hey <@&1122981184255840306>! A new version of the ZetaChain software has been released.
+
+ Major Version Upgrade (e.g. v5.x.x to V6.x.x) must be completed through a governance proposal.
+ We will submit a governance proposal in the next few days.
+ More specific information including block height will be shared as part of the governance proposal.
+
+ See the release notes for more details. https://github.com/zeta-chain/node/releases/tag/${{ env.BINARY_VERSION }}
+
+ # - name: "SEND:DISCORD:MESSAGE"
+ # if: steps.determine_release_type.outputs.RELEASE_TYPE == 'minor'
+ # uses: gzukel/CosmosComposites/send_discord_message@main
+ # with:
+ # discord_token: "${{ secrets.DISCORD_TOKEN }}"
+ # discord_channel_id: "${{ secrets.DISCORD_CHANNEL_ID }}"
+ # discord_message: |
+ # Hey <@&1122981184255840306>! A new version of the zetachain node has been released.
+
+ # Minor Version Upgrade (e.g. v5.0.x to v5.1.x) can be applied without a governance proposal.
+ # Please review the release notes for any specific upgrade instructions or considerations.
+
+ # See the release notes for more details. https://github.com/zeta-chain/node/releases/tag/${{ env.BINARY_VERSION }}
+
+ - name: Clean Up Workspace
+ if: always()
+ shell: bash
+ run: rm -rf *
diff --git a/.github/workflows/sast-linters.yml b/.github/workflows/sast-linters.yml
index 7f5bc04e13..6e78d8383f 100644
--- a/.github/workflows/sast-linters.yml
+++ b/.github/workflows/sast-linters.yml
@@ -25,18 +25,42 @@ 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
- name: Run Gosec Security Scanner
- run: |
- export PATH=$PATH:$(go env GOPATH)/bin
- go install github.com/securego/gosec/v2/cmd/gosec@latest
- gosec ./...
+ uses: securego/gosec@master
+ with:
+ args: ./...
+
+ gosec-cosmos:
+ runs-on: ubuntu-latest
+ env:
+ GO111MODULE: on
+ steps:
+ - name: Checkout Source
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+
+ - name: Set up Go
+ uses: actions/setup-go@v3
+ with:
+ go-version: '1.20'
+
+ # - name: Install Pipeline Dependencies
+ # uses: ./.github/actions/install-dependencies
+
+ - name: Run Cosmos Gosec Security Scanner
+ run: make lint-cosmos-gosec
+# uses: cosmos/gosec@master
+# with:
+# args: '-include=G701,G703,G704 ./...' # Disabled G702 as it doesn't seem to be relevant 2023-09-14
+
git-guardian:
runs-on: ubuntu-latest
@@ -59,24 +83,105 @@ jobs:
lint:
runs-on: ubuntu-latest
- timeout-minutes: 10
+ timeout-minutes: 15
env:
GO111MODULE: on
steps:
- name: Checkout Source
uses: actions/checkout@v2
-
+ 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.20'
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
- version: v1.50
+ version: v1.54
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.
+
+ Only suppress a single rule (or a specific set of rules) within a section of code, while continuing to scan for other problems. To do this, you can list the rule(s) to be suppressed within the #nosec annotation, e.g: /* #nosec G401 */ or //#nosec G201 G202 G203
+ Broad `#nosec` annotations should be avoided, as they can hide other vulnerabilities. **The CI will block you from merging this PR until you remove `#nosec` annotations that do not target specific rules**.
+
+ 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"]
+ })
+
+ - name: Check for '#nosec' without a specific rule
+ run: |
+ DIFF=$(git diff ${{ github.event.pull_request.base.sha }})
+ echo "$DIFF" | grep -P '#nosec(?!(\sG\d{3}))(?![^\s\t])([\s\t]*|$)' && echo "nosec without specified rule found!" && exit 1 || exit 0
+
+
+
\ No newline at end of file
diff --git a/.github/workflows/upgrade_path_testing.yaml b/.github/workflows/upgrade_path_testing.yaml
new file mode 100644
index 0000000000..002c1df6d6
--- /dev/null
+++ b/.github/workflows/upgrade_path_testing.yaml
@@ -0,0 +1,432 @@
+name: "UPGRADE_PATH_TESTING"
+
+on:
+ workflow_dispatch:
+ inputs:
+ version:
+ description: 'The new version of tag you are going to download the binary from..'
+ required: true
+ default: 'v10.0.0-rc2'
+ upgrade_name:
+ description: 'The version that is set in setup_handlers.go'
+ required: true
+ default: 'v10.0.0'
+
+jobs:
+ upgrade_path_test_state_export:
+ name: "UPGRADE_PATH_TEST_STATE_EXPORT"
+ runs-on: ["buildjet-8vcpu-ubuntu-2204"]
+ env:
+ latest_state_export: "https://zetachain-external-files.s3.amazonaws.com/state-export/athens3/latest.json"
+ github_binary_version_link: "https://github.com/zeta-chain/node/releases/download/${{ github.event.inputs.version }}/zetacored-testnet-linux-amd64"
+ downloaded_binary_name: "zetacored-testnet-linux-amd64"
+ VERSION: "${{ github.event.inputs.version }}"
+ aws_region: "us-east-1"
+ GAS_PRICES: "1.0azeta"
+ DEPOSIT: "10000000000000000000azeta"
+ METADATA: "ipfs://QmeABfwZ2nAxDzYyqZ1LEypPgQFMjEyrx8FfnoPLkF8R3f"
+ LOG_LEVEL: "INFO"
+ CHAINID: "localnet_101-1"
+ DAEMON_HOME: "/home/runner/.zetacored"
+ UPGRADE_NAME: "${{ github.event.inputs.upgrade_name }}"
+ DAEMON_NAME: "zetacored"
+ DENOM: "azeta"
+ DAEMON_ALLOW_DOWNLOAD_BINARIES: "true"
+ DAEMON_RESTART_AFTER_UPGRADE: "true"
+ MONIKER: "zeta"
+ BLOCK_TIME_SECONDS: "6"
+ PROPOSAL_TIME_SECONDS: "60"
+ UNSAFE_SKIP_BACKUP: "true"
+ CLIENT_DAEMON_NAME: "zetaclientd"
+ CLIENT_DAEMON_ARGS: "-enable-chains,GOERLI,-val,zeta"
+ CLIENT_SKIP_UPGRADE: "true"
+ CLIENT_START_PROCESS: "false"
+ BINARY_NAME_SUFFIX: "ubuntu-22-amd64"
+ UPGRADES_SLEEP_TIME: "300"
+ KEYRING: "test"
+ STATUS_ENDPOINT: "http://127.0.0.1:26657/status"
+ ABCI_ENDPOINT: "http://127.0.0.1:26657/abci_info"
+ ENDPOINT: "http://127.0.0.1:26657"
+ SLEEP_DURATION: "5"
+ GOV_ADDRESS: "zeta10d07y265gmmuvt4z0w9aw880jnsr700jvxasvr"
+ previous_height: "-1"
+ stalled_count: "0"
+ first: "true"
+ MAX_TRIES: "100"
+ count: "0"
+ steps:
+ - uses: actions/checkout@v1
+
+ - id: install-aws-cli
+ uses: unfor19/install-aws-cli-action@v1
+ with:
+ version: 2
+
+ - uses: actions/setup-go@v4
+ with:
+ check-latest: false
+ go-version: '^1.20'
+
+ - name: "CLONE:ZETAVISOR:REPOSITORY"
+ uses: actions/checkout@v2
+ with:
+ repository: zeta-chain/cosmos-sdk
+ path: zetavisor/
+ ref: zetavisor-v0.1.5
+
+ - name: "INSTALL_APT_PACKAGES"
+ working-directory: "zetavisor/cosmovisor"
+ run: |
+ echo "*********INSTALL SOME APT PACKAGES*********"
+ sudo apt update
+ sudo apt install unzip psmisc -y
+
+ - name: "INSTALL_ZETAVISOR"
+ working-directory: "zetavisor/cosmovisor"
+ run: |
+ echo "*********INSTALL ZETAVISOR*********"
+ go get github.com/zeta-chain/cosmos-sdk/cosmovisor/cmd/zetavisor
+ go install github.com/zeta-chain/cosmos-sdk/cosmovisor/cmd/zetavisor
+ zetavisor version || echo "zetavisor failed to install."
+
+ echo "*********SETUP ZETAVISOR DIRECTORIES*********"
+ rm -rf /home/runner/.zetacored
+ mkdir -p /home/runner/.zetacored/zetavisor
+ mkdir -p /home/runner/.zetacored/zetavisor/genesis/bin
+ mkdir -p /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin
+ mkdir -p /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.upgrade_name }}/bin
+
+ - name: "DOWNLOAD_STATE_EXPORT_AND_BINARIES"
+ run: |
+ echo "*********DOWNLOAD STATE EXPORT*********"
+ wget -q ${latest_state_export}
+
+ echo "*********DOWNLOAD UPGRADE BINARY AND PUT IN ZETAVISOR UPGRADES FOLDER*********"
+ wget -q ${github_binary_version_link} -O /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin/zetacored
+ ZETACORED_CHECKSUM=$(shasum -b -a 256 /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin/zetacored | cut -d ' ' -f 1)
+ sudo chmod a+x /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin/zetacored
+
+ echo "UPGRADE_INFO=${UPGRADE_INFO}" >> ${GITHUB_ENV}
+ ls -lah /home/runner/.zetacored/zetavisor/upgrades/
+ ls -lah /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin/zetacored
+
+ wget -q ${github_binary_version_link} -O /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.upgrade_name }}/bin/zetacored
+ ZETACORED_CHECKSUM=$(shasum -b -a 256 /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.upgrade_name }}/bin/zetacored | cut -d ' ' -f 1)
+ sudo chmod a+x /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.upgrade_name }}/bin/zetacored
+
+ echo "UPGRADE_INFO=${UPGRADE_INFO}" >> ${GITHUB_ENV}
+ ls -lah /home/runner/.zetacored/zetavisor/upgrades/
+ ls -lah /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.upgrade_name }}/bin/zetacored
+
+ echo "ZETACORED_CHECKSUM=${ZETACORED_CHECKSUM}" >> ${GITHUB_ENV}
+ UPGRADE_INFO='{"binaries": {"zetacored-linux/amd64": "https://github.com/zeta-chain/node/releases/download/${{ github.event.inputs.version }}/zetacored-testnet-linux-amd64?checksum=sha256:'${ZETACORED_CHECKSUM}'"}}'
+ echo ${UPGRADE_INFO}
+
+
+
+ echo "*********DOWNLOAD CURRENT BINARY AND PUT IN ZETAVISOR GENESIS & CURRENT FOLDER*********"
+ current_version=$(curl https://rpc-archive.athens.zetachain.com:26657/abci_info -s | jq .result.response.version -r | tr -d '\n')
+ echo "STARTING_VERSION=${current_version}" >> ${GITHUB_ENV}
+ echo "STARTING_VERSION=${current_version}"
+ wget -q https://github.com/zeta-chain/node/releases/download/${current_version}/zetacored-testnet-linux-amd64 -O /home/runner/.zetacored/zetavisor/genesis/bin/zetacored
+ sudo chmod a+x /home/runner/.zetacored/zetavisor/genesis/bin/zetacored
+ echo "PATH=/home/runner/.zetacored/zetavisor/genesis/bin:$PATH" >> ${GITHUB_ENV}
+
+ - name: "START_TESTING_NETWORK"
+ run: |
+ zetacored config keyring-backend $KEYRING --home ${DAEMON_HOME}
+
+ zetacored config chain-id $CHAINID --home ${DAEMON_HOME}
+
+ zetacored keys delete zetaa --keyring-backend $KEYRING -y > /dev/null 2>&1 || echo "doesn't exist"
+ zetacored keys delete executer_zeta --keyring-backend $KEYRING -y > /dev/null 2>&1 || echo "doesn't exist"
+ zetacored keys delete mario --keyring-backend $KEYRING -y > /dev/null 2>&1 || echo "doesn't exist"
+ zetacored keys delete executer_mario --keyring-backend $KEYRING -y > /dev/null 2>&1 || echo "doesn't exist"
+
+ echo "race draft rival universe maid cheese steel logic crowd fork comic easy truth drift tomorrow eye buddy head time cash swing swift midnight borrow" | zetacored keys add zeta --algo=secp256k1 --recover --keyring-backend=$KEYRING
+ echo "hand inmate canvas head lunar naive increase recycle dog ecology inhale december wide bubble hockey dice worth gravity ketchup feed balance parent secret orchard" | zetacored keys add mario --algo secp256k1 --recover --keyring-backend=$KEYRING
+ echo "lounge supply patch festival retire duck foster decline theme horror decline poverty behind clever harsh layer primary syrup depart fantasy session fossil dismiss east" | zetacored keys add executer_zeta --recover --keyring-backend=$KEYRING --algo secp256k1
+ echo "debris dumb among crew celery derive judge spoon road oyster dad panic adult song attack net pole merge mystery pig actual penalty neither peasant"| zetacored keys add executer_mario --algo=secp256k1 --recover --keyring-backend=$KEYRING
+
+ echo '
+ [
+ {
+ "IsObserver": "y",
+ "ObserverAddress": "zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax",
+ "ZetaClientGranteeAddress": "zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n",
+ "ZetaClientGranteePubKey": "zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp"
+ },
+ {
+ "IsObserver": "y",
+ "ObserverAddress": "zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2",
+ "ZetaClientGranteeAddress": "zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx",
+ "ZetaClientGranteePubKey": "zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045"
+ }
+ ]
+ ' > observers.json
+
+ zetacored init Zetanode-Localnet --chain-id=$CHAINID
+
+ #Set config to use azeta
+ cat $DAEMON_HOME/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="azeta"' > $DAEMON_HOME/config/tmp_genesis.json && mv $DAEMON_HOME/config/tmp_genesis.json $DAEMON_HOME/config/genesis.json
+ cat $DAEMON_HOME/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="azeta"' > $DAEMON_HOME/config/tmp_genesis.json && mv $DAEMON_HOME/config/tmp_genesis.json $DAEMON_HOME/config/genesis.json
+ cat $DAEMON_HOME/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="azeta"' > ~/.zetacored/config/tmp_genesis.json && mv $DAEMON_HOME/config/tmp_genesis.json $DAEMON_HOME/config/genesis.json
+ cat $DAEMON_HOME/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="azeta"' > $DAEMON_HOME/config/tmp_genesis.json && mv $DAEMON_HOME/config/tmp_genesis.json $DAEMON_HOME/config/genesis.json
+ cat $DAEMON_HOME/config/genesis.json | jq '.app_state["evm"]["params"]["evm_denom"]="azeta"' > $DAEMON_HOME/config/tmp_genesis.json && mv $DAEMON_HOME/config/tmp_genesis.json $DAEMON_HOME/config/genesis.json
+ cat $DAEMON_HOME/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="10000000"' > $DAEMON_HOME/config/tmp_genesis.json && mv $DAEMON_HOME/config/tmp_genesis.json $DAEMON_HOME/config/genesis.json
+ cat $DAEMON_HOME/config/genesis.json | jq '.app_state["gov"]["voting_params"]["voting_period"]="60s"' > $DAEMON_HOME/config/tmp_genesis.json && mv $DAEMON_HOME/config/tmp_genesis.json $DAEMON_HOME/config/genesis.json
+
+ sed -i '/\[api\]/,+3 s/enable = false/enable = true/' $DAEMON_HOME/config/app.toml
+
+ zetacored add-observer-list observers.json --keygen-block=5
+
+ zetacored gentx zeta 1000000000000000000000azeta --chain-id=$CHAINID --keyring-backend=$KEYRING
+
+ echo "Collecting genesis txs..."
+ zetacored collect-gentxs
+
+ echo "Validating genesis file..."
+ zetacored validate-genesis
+
+ cp $DAEMON_HOME/config/genesis.json ./genesis.json
+
+ echo "Do Genesis Manipulation"
+ export OLD_GENESIS=./latest.json
+ export NEW_GENESIS=./genesis.json
+
+ python .github/actions/upgrade-testing/scripts/create_genesis.py
+
+ echo "Move Manipulated Genesis"
+ cp ./genesis-edited.json $DAEMON_HOME/config/genesis.json
+
+ echo "Start Network"
+ nohup zetavisor start --rpc.laddr tcp://0.0.0.0:26657 --minimum-gas-prices ${GAS_PRICES} "--grpc.enable=true" > cosmovisor.log 2>&1 &
+
+ sleep ${UPGRADES_SLEEP_TIME}
+ cat cosmovisor.log
+
+ - name: "DETERMINE_UPGRADE_TYPE"
+ shell: python
+ run: |
+ import os
+
+ first_version=os.environ["STARTING_VERSION"]
+ first_major_version = first_version.split(".")[0]
+ first_minor_version = first_version.split(".")[1]
+ first_sub_version = first_version.split(".")[2]
+
+ version="${{ github.event.inputs.version }}"
+ major_version = version.split(".")[0]
+ minor_version = version.split(".")[1]
+ sub_version = version.split(".")[2]
+
+ git_env_file = open(os.environ["GITHUB_ENV"], "a+")
+ if major_version == first_major_version and minor_version != first_minor_version:
+ git_env_file.write("UPGRADE_TYPE=NONCON")
+ elif major_version == first_major_version and minor_version == first_minor_version and sub_version != first_sub_version:
+ git_env_file.write("UPGRADE_TYPE=NONCON")
+ else:
+ git_env_file.write("UPGRADE_TYPE=GOV")
+ git_env_file.close()
+
+ - name: "NON_CONSENSUS_BREAKING_UPGRADE"
+ if: env.UPGRADE_TYPE == 'NONCON'
+ run: |
+ echo ${UPGRADE_TYPE}
+ echo "*********CHECK VERSION BEFORE BINARY SWITCH*********"
+ zetavisor version
+
+ echo "*********KILLALL ZETAVISOR*********"
+ killall zetavisor
+
+ echo "*********COPY UPGRADE BINARY TO NEW LOCATION*********"
+ rm -rf /home/runner/.zetacored/zetavisor/genesis/bin/zetacored
+ rm -rf /home/runner/.zetacored/zetavisor/current/bin/zetacored
+
+ cp /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin/zetacored /home/runner/.zetacored/zetavisor/genesis/bin/zetacored
+ cp /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin/zetacored /home/runner/.zetacored/zetavisor/current/bin/zetacored
+ nohup zetavisor start --rpc.laddr tcp://0.0.0.0:26657 --minimum-gas-prices ${GAS_PRICES} "--grpc.enable=true" > cosmovisor.log 2>&1 &
+
+ sleep ${UPGRADES_SLEEP_TIME}
+ cat cosmovisor.log
+ echo "*********CHECK VERSION AFTER BINARY SWITCH*********"
+ check_version=$(zetavisor version | tr -d '\n')
+ http_version=$(curl http://127.0.0.1:26657/abci_info | jq .result.response.version -r | tr -d '\n')
+
+ echo "END_VERSION=${{ github.event.inputs.version }}"
+ echo "CURRENT_VERSION_BINARY=${check_version}"
+ echo "CURRENT_VERSION_HTTP=${http_version}"
+
+ if [ "${{ github.event.inputs.version }}" == "${check_version}" ]; then
+ if [ "${{ github.event.inputs.version }}" == "${http_version}" ]; then
+ echo "*********VERSION MATCHES UPGRADE SUCCESS*********"
+ exit 0
+ else
+ echo "*********VERSION DOESN'T MATCH UPGRADE FAILED*********"
+ exit 2
+ fi
+ else
+ echo "*********VERSION DOESN'T MATCH UPGRADE FAILED*********"
+ exit 2
+ fi
+
+ - name: "CONSENSUS_BREAKING_UPGRADE"
+ if: env.UPGRADE_TYPE == 'GOV' #GOV
+ run: |
+ echo "*****UPGRADE TYPE*****"
+ echo ${UPGRADE_TYPE}
+
+ echo "*****BUILD GOV PROPOSAL*****"
+ GOV_PROPOSAL=$(python .github/actions/upgrade-testing/scripts/raise_gov_proposal.py)
+
+ echo "${GOV_PROPOSAL}"
+ cat gov.json
+
+ GOV_PROPOSAL_OUTPUT=$(eval ${GOV_PROPOSAL})
+
+ echo "*****GOV PROPOSAL OUTPUT*****"
+ echo ${GOV_PROPOSAL_OUTPUT}
+
+ echo "*****GET TX HASH*****"
+ TX_HASH=$(echo ${GOV_PROPOSAL_OUTPUT} | awk -F'txhash: ' '{print $2}' | tr -d '\n' | tr -d ' ')
+ echo "****TXHASH: ${TX_HASH}****"
+
+ echo "*****SLEEP FOR 1 MIN TO ALLOW TX TO MAKE IT ON NETWORK*****"
+ sleep 15
+
+ zetacored query tx --type=hash ${TX_HASH}
+
+ proposal_id=$(python .github/actions/upgrade-testing/scripts/get_proposal_id.py)
+ echo "****PROPOSAL_ID: ${proposal_id}****"
+
+ source ${GITHUB_ENV}
+
+ zetacored tx gov vote "${proposal_id}" yes \
+ --from ${MONIKER} \
+ --keyring-backend test \
+ --chain-id ${CHAINID} \
+ --node http://127.0.0.1:26657 \
+ --gas=auto \
+ --gas-adjustment=2 \
+ --gas-prices=${{ env.GAS_PRICES }} \
+ -y
+
+ sleep 5
+ zetacored query gov proposal ${proposal_id} --node http://127.0.0.1:26657
+
+ TARGET_HEIGHT=$(echo ${UPGRADE_HEIGHT} | cut -d '.' -f 1)
+
+ echo "**** CHECK FOR HEIGHT ${TARGET_HEIGHT} ****"
+ while [[ $count -lt $MAX_TRIES ]]
+ do
+ echo "CURL FOR CURRENT HEIGHT"
+ response=$(curl -s "$ENDPOINT/status" || echo "failed curl")
+ if [ $? -ne 0 ]; then
+ echo "CURL failed with exit code $?"
+ else
+ echo "curl success"
+ fi
+ echo "curl success"
+ echo "${response}"
+ current_height=$(echo $response | jq '.result.sync_info.latest_block_height' | tr -d '"')
+ echo "Current Height: $current_height"
+ echo "Target Height: $TARGET_HEIGHT"
+
+ if [[ $current_height -ge $TARGET_HEIGHT ]]; then
+ echo "Reached target height: $current_height. Sleep and wait for upgrade to take place."
+ sleep 120
+ break
+ fi
+
+ echo "attempt number ${count} of ${MAX_TRIES}"
+ ((count=count+1))
+ echo "sleep and ty again."
+ sleep 10
+ done
+
+ if [[ $count -eq $MAX_TRIES ]]; then
+ cat cosmovisor.log
+ echo "Max tries reached without achieving target height."
+ exit 2
+ fi
+
+ for (( i=1; i<=MAX_TRIES; i++ ))
+ do
+ pgrep zetavisor > /dev/null
+ if [[ $? -ne 0 ]]; then
+ cat cosmovisor.log
+ echo "zetavisor process not found."
+ exit 2
+ fi
+
+ response=$(curl -s "$STATUS_ENDPOINT")
+
+ # If curl fails
+ if [[ $? -ne 0 ]]; then
+ cat cosmovisor.log
+ echo "Failed to get a response from the status endpoint on try $i."
+ exit 2
+ fi
+
+ # Extracting the current height from the response
+ current_height=$(echo $response | jq '.result.sync_info.latest_block_height' | tr -d '"')
+
+ # If jq fails or height is empty
+ if [[ $? -ne 0 || -z "$current_height" ]]; then
+ cat cosmovisor.log
+ echo "Failed to extract block height from the response on try $i."
+ exit 2
+ fi
+
+ # If the block height has changed since last check
+ if [[ $current_height -ne $previous_height ]]; then
+ if [ "${first}" == "true" ]; then
+ stalled_count=0
+ first="false"
+ else
+ echo "Network appears to be processing blocks"
+ stalled_count=0
+
+ # Query the ABCI endpoint for version info
+ abci_response=$(curl -s "$ABCI_ENDPOINT")
+
+ # Extracting the version from the response
+ app_version=$(echo $abci_response | jq '.result.response.version' | tr -d '"')
+
+ # If jq fails or version is empty
+ if [[ $? -ne 0 || -z "$app_version" ]]; then
+ cat cosmovisor.log
+ echo "Failed to extract version from the ABCI response on try $i."
+ exit 2
+ fi
+
+ # Compare the extracted version with the expected version
+ if [[ "$app_version" == "$VERSION" ]]; then
+ echo "Version matches the expected version. Exiting..."
+ echo "ABCI RESPONSE \n ${abci_response}"
+ echo "Versions: $VERSION, Found: $app_version"
+ exit 0
+ else
+ cat cosmovisor.log
+ echo "Version mismatch. Expected: $VERSION, Found: $app_version"
+ echo "ABCI RESPONSE \n ${abci_response}"
+ exit 2
+ fi
+ fi
+ else
+ ((stalled_count=stalled_count+1))
+ fi
+
+ # Update the previous height
+ previous_height=$current_height
+
+ # If we're on the last iteration and the block height hasn't changed for all tries
+ if [[ $i -eq $MAX_TRIES && $stalled_count -eq $MAX_TRIES ]]; then
+ cat cosmovisor.log
+ echo "Block height hasn't changed for $MAX_TRIES consecutive checks. Network might be stalled."
+ exit 2
+ fi
+
+ # Sleep for the specified duration
+ sleep $SLEEP_DURATION
+ done
\ No newline at end of file
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/.goreleaser.yaml b/.goreleaser.yaml
new file mode 100644
index 0000000000..1995d6b43d
--- /dev/null
+++ b/.goreleaser.yaml
@@ -0,0 +1,169 @@
+# Make sure to check the documentation at https://goreleaser.com
+
+## Test locally with `make release-dry-run`
+
+## TODO
+# - Add SBOMs
+# - Add Docker Builds
+# - SLSA - https://github.com/goreleaser/goreleaser-example-slsa-provenance
+# - Add Code Signing
+
+env:
+ - CGO_ENABLED=1
+ - CC_darwin_arm64=oa64-clang
+ - CXX_darwin_arm64=oa64-clang++
+ - CC_darwin_amd64=o64-clang
+ - CXX_darwin_amd64=o64-clang+
+ - CC_linux_arm64=aarch64-linux-gnu-gcc
+ - CXX_linux_arm64=aarch64-linux-gnu-g++
+ - CC_linux_amd64=x86_64-linux-gnu-gcc
+ - CXX_linux_amd64=x86_64-linux-gnu-g++
+ - CC_windows_amd64=x86_64-w64-mingw32-gcc
+ - CXX_windows_amd64=x86_64-w64-mingw32-g++
+ - VERSION={{ .Version }}
+ - COMMIT={{ .Commit }}
+ - BUILDTIME={{ .Date }}
+ # - CC_windows_arm64= NOT_CREATING_WINDOWS_ARM64_BINARIES
+ # - CXX_windows_arm64= NOT_CREATING_WINDOWS_ARM64_BINARIES
+
+before:
+ hooks:
+ - go mod download
+ - go mod tidy
+
+builds:
+ - id: "zetacored_testnet"
+ main: ./cmd/zetacored
+ binary: "zetacored_testnet-{{ .Os }}-{{ .Arch }}"
+ env:
+ - 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}'
+ - 'CXX={{ index .Env (print "CXX_" .Os "_" .Arch) }}'
+ goos:
+ - linux
+ - darwin
+ - windows
+ goarch:
+ - arm64
+ - amd64
+ ignore:
+ - goos: windows
+ goarch: arm64
+ flags: &default_testnet_flags
+ - -tags=TESTNET,pebbledb,ledger,cgo,netgo
+ - -installsuffix=static
+ ldflags: &default_ldflags
+ - -X github.com/cosmos/cosmos-sdk/version.Name=zetacore
+ - -X github.com/cosmos/cosmos-sdk/version.ServerName=zetacored
+ - -X github.com/cosmos/cosmos-sdk/version.ClientName=zetaclientd
+ - -X github.com/cosmos/cosmos-sdk/version.Version={{ .Version }}
+ - -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Env.COMMIT }}
+ - -X github.com/zeta-chain/zetacore/common.Name=zetacored
+ - -X github.com/zeta-chain/zetacore/common.Version={{ .Version }}
+ - -X github.com/zeta-chain/zetacore/common.CommitHash={{ .Env.COMMIT }}
+ - -X github.com/zeta-chain/zetacore/common.BuildTime=={{ .Env.BUILDTIME }}
+ - -X github.com/cosmos/cosmos-sdk/types.DBBackend=pebbledb
+W
+ - id: "zetaclientd_testnet"
+ main: ./cmd/zetaclientd
+ binary: "zetaclientd_testnet-{{ .Os }}-{{ .Arch }}"
+ env:
+ - 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}'
+ - 'CXX={{ index .Env (print "CXX_" .Os "_" .Arch) }}'
+ goos:
+ - linux
+ # - darwin
+ # - windows
+ goarch:
+ - arm64
+ - amd64
+ ignore:
+ - goos: windows
+ goarch: arm64
+ flags: *default_testnet_flags
+ ldflags: *default_ldflags
+
+ - id: "zetacored_mock_mainnet"
+ main: ./cmd/zetacored
+ binary: "zetacored_mock_mainnet-{{ .Os }}-{{ .Arch }}"
+ env:
+ - 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}'
+ - 'CXX={{ index .Env (print "CXX_" .Os "_" .Arch) }}'
+ goos:
+ - linux
+ - darwin
+ - windows
+ goarch:
+ - arm64
+ - amd64
+ ignore:
+ - goos: windows
+ goarch: arm64
+ flags: &default_mock_mainnet_flags
+ - -tags=MOCK_MAINNET,pebbledb,ledger,cgo
+ ldflags: *default_ldflags
+
+ - id: "zetaclientd_mock_mainnet"
+ main: ./cmd/zetaclientd
+ binary: "zetaclientd_mock_mainnet-{{ .Os }}-{{ .Arch }}"
+ env:
+ - 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}'
+ - 'CXX={{ index .Env (print "CXX_" .Os "_" .Arch) }}'
+ goos:
+ - linux
+ # - darwin
+ # - windows
+ goarch:
+ - arm64
+ - amd64
+ ignore:
+ - goos: windows
+ goarch: arm64
+ flags: *default_mock_mainnet_flags
+ ldflags: *default_ldflags
+
+archives:
+ - format: binary
+ name_template: "{{ .Binary }}"
+
+checksum:
+ name_template: "checksums.txt"
+changelog:
+ sort: asc
+ filters:
+ exclude:
+ - "^docs:"
+ - "^test:"
+snapshot:
+ name_template: "{{ .Tag }}-next"
+
+release:
+ # If set to true, will not auto-publish the release.
+ # Available only for GitHub and Gitea.
+ draft: false
+
+ target_commitish: "{{ .Commit }}"
+
+ # If set, will create a release discussion in the category specified.
+ #
+ # Warning: do not use categories in the 'Announcement' format.
+ # Check https://github.com/goreleaser/goreleaser/issues/2304 for more info.
+ #
+ # Default is empty.
+ # discussion_category_name: General
+
+ # If set to auto, will mark the release as not ready for production
+ # in case there is an indicator for this in the tag e.g. v1.0.0-rc1
+ # If set to true, will mark the release as not ready for production.
+ # Default is false.
+ prerelease: auto
+
+ # What to do with the release notes in case there the release already exists.
+ #
+ # Valid options are:
+ # - `keep-existing`: keep the existing notes
+ # - `append`: append the current release notes to the existing notes
+ # - `prepend`: prepend the current release notes to the existing notes
+ # - `replace`: replace existing notes
+ #
+ # Default is `keep-existing`.
+ mode: append
\ No newline at end of file
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/Dockerfile-versioned b/Dockerfile-versioned
new file mode 100644
index 0000000000..0ec85f149e
--- /dev/null
+++ b/Dockerfile-versioned
@@ -0,0 +1,70 @@
+FROM golang:1.19-alpine
+
+ENV GOPATH /go
+ENV GOOS=linux
+ENV CGO_ENABLED=1
+
+ARG old_version
+ARG new_version
+
+RUN apk --no-cache add git make build-base jq openssh libusb-dev linux-headers bash curl tmux
+RUN ssh-keygen -b 2048 -t rsa -f /root/.ssh/localtest.pem -q -N ""
+
+WORKDIR /go/delivery/zeta-node
+
+RUN mkdir -p $GOPATH/bin/old
+RUN mkdir -p $GOPATH/bin/new
+
+ENV NEW_VERSION=${new_version}
+
+# Checkout and build new binary
+RUN git clone https://github.com/zeta-chain/node.git
+RUN cd node && git fetch
+RUN cd node && git checkout ${new_version}
+RUN cd node && make install
+RUN cd node && make install-smoketest
+RUN cp $GOPATH/bin/zetacored $GOPATH/bin/new/
+RUN cp $GOPATH/bin/zetaclientd $GOPATH/bin/new/
+RUN cp $GOPATH/bin/smoketest $GOPATH/bin/new/
+
+# Checkout and build old binary
+RUN cd node && git checkout ${old_version}
+RUN cd node && git pull
+RUN cd node && make install
+RUN cd node && make install-smoketest
+RUN cp $GOPATH/bin/zetacored $GOPATH/bin/old/
+RUN cp $GOPATH/bin/zetaclientd $GOPATH/bin/old/
+RUN cp $GOPATH/bin/smoketest $GOPATH/bin/old/
+
+RUN git clone https://github.com/zeta-chain/cosmos-sdk.git
+RUN cd cosmos-sdk && git checkout zetavisor-v0.1.5
+RUN cd cosmos-sdk/cosmovisor && make zetavisor
+#
+#FROM golang:1.19-alpine
+
+#RUN apk --no-cache add openssh jq tmux vim curl bash
+RUN ssh-keygen -A
+WORKDIR /root
+
+RUN cp /root/.ssh/localtest.pem.pub /root/.ssh/authorized_keys
+
+RUN cp /go/bin/zetaclientd /usr/local/bin
+RUN cp /go/bin/zetacored /usr/local/bin
+RUN cp /go/bin/smoketest /usr/local/bin
+RUN cp /go/bin/zetavisor /usr/local/bin
+
+COPY contrib/localnet/scripts /root
+COPY contrib/localnet/preparams /root/preparams
+COPY contrib/localnet/ssh_config /root/.ssh/config
+COPY contrib/localnet/zetacored /root/zetacored
+COPY contrib/localnet/tss /root/tss
+
+RUN chmod 755 /root/*.sh
+RUN chmod 700 /root/.ssh
+RUN chmod 600 /root/.ssh/*
+
+WORKDIR /usr/local/bin
+ENV SHELL /bin/sh
+EXPOSE 22
+
+ENTRYPOINT ["/usr/sbin/sshd", "-D"]
diff --git a/Makefile b/Makefile
index 019f5cef68..575057ef70 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,5 @@
.PHONY: build
-
-PACKAGES=$(shell go list ./... | grep -v '/simulation')
VERSION := $(shell git describe --tags)
COMMIT := $(shell [ -z "${COMMIT_ID}" ] && git log -1 --format='%H' || echo ${COMMIT_ID} )
BUILDTIME := $(shell date -u +"%Y%m%d.%H%M%S" )
@@ -22,6 +20,8 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=zetacore \
BUILD_FLAGS := -ldflags '$(ldflags)' -tags PRIVNET,pebbledb,ledger
TESTNET_BUILD_FLAGS := -ldflags '$(ldflags)' -tags TESTNET,pebbledb,ledger
+MOCK_MAINNET_BUILD_FLAGS := -ldflags '$(ldflags)' -tags MOCK_MAINNET,pebbledb,ledger
+MAINNET_BUILD_FLAGS := -ldflags '$(ldflags)' -tags pebbledb,ledger
TEST_DIR?="./..."
TEST_BUILD_FLAGS := -tags TESTNET,pebbledb,ledger
@@ -82,8 +82,19 @@ build-testnet-ubuntu: go.sum
install: go.sum
@echo "--> Installing zetacored & zetaclientd"
- @go install -mod=readonly $(BUILD_FLAGS) ./cmd/zetacored
- @go install -mod=readonly $(BUILD_FLAGS) ./cmd/zetaclientd
+ @go install -race -mod=readonly $(BUILD_FLAGS) ./cmd/zetacored
+ @go install -race -mod=readonly $(BUILD_FLAGS) ./cmd/zetaclientd
+
+install-mainnet: go.sum
+ @echo "--> Installing zetacored & zetaclientd"
+ @go install -mod=readonly $(MAINNET_BUILD_FLAGS) ./cmd/zetacored
+ @go install -mod=readonly $(MAINNET_BUILD_FLAGS) ./cmd/zetaclientd
+
+install-mock-mainnet: go.sum
+ @echo "--> Installing zetacored & zetaclientd"
+ @go install -mod=readonly $(MOCK_MAINNET_BUILD_FLAGS) ./cmd/zetacored
+ @go install -mod=readonly $(MOCK_MAINNET_BUILD_FLAGS) ./cmd/zetaclientd
+
install-zetaclient: go.sum
@echo "--> Installing zetaclientd"
@@ -129,6 +140,9 @@ chain-stop:
chain-init-testnet: clean install-zetacore-testnet init
chain-run-testnet: clean install-zetacore-testnet init run
+chain-init-mock-mainnet: clean install-mock-mainnet init
+chain-run-mock-mainnet: clean install-mock-mainnet init run
+
lint-pre:
@test -z $(gofmt -l .)
@GOFLAGS=$(GOFLAGS) go mod verify
@@ -136,6 +150,9 @@ lint-pre:
lint: lint-pre
@golangci-lint run
+lint-cosmos-gosec:
+ @bash ./scripts/cosmos-gosec.sh
+
proto:
@echo "--> Removing old Go types "
@find . -name '*.pb.go' -type f -delete
@@ -157,6 +174,10 @@ specs:
@go run ./scripts/gen-spec.go
.PHONY: specs
+mocks:
+ @echo "--> Generating mocks"
+ @bash ./scripts/mocks-generate.sh
+
generate: proto openapi specs
.PHONY: generate
@@ -197,4 +218,48 @@ stress-test: zetanode
cd contrib/localnet/ && $(DOCKER) compose -f docker-compose-stresstest.yml up -d
stop-stress-test:
- cd contrib/localnet/ && $(DOCKER) compose -f docker-compose-stresstest.yml down --remove-orphans
\ No newline at end of file
+ cd contrib/localnet/ && $(DOCKER) compose -f docker-compose-stresstest.yml down --remove-orphans
+
+stateful-upgrade:
+ @echo "--> Starting stateful smoketest"
+ $(DOCKER) build --build-arg old_version=v9.0.0-rc2 --build-arg new_version=v10.0.0 -t zetanode -f ./Dockerfile-versioned .
+ $(DOCKER) build -t orchestrator -f contrib/localnet/orchestrator/Dockerfile-upgrade.fastbuild .
+ cd contrib/localnet/ && $(DOCKER) compose -f docker-compose-stateful.yml up -d
+
+stop-stateful-upgrade:
+ cd contrib/localnet/ && $(DOCKER) compose -f docker-compose-stateful.yml down --remove-orphans
+
+
+###############################################################################
+### GoReleaser ###
+###############################################################################
+PACKAGE_NAME := github.com/zeta-chain/node
+GOLANG_CROSS_VERSION ?= v1.20
+GOPATH ?= '$(HOME)/go'
+release-dry-run:
+ docker run \
+ --rm \
+ --privileged \
+ -e CGO_ENABLED=1 \
+ -v /var/run/docker.sock:/var/run/docker.sock \
+ -v `pwd`:/go/src/$(PACKAGE_NAME) \
+ -v ${GOPATH}/pkg:/go/pkg \
+ -w /go/src/$(PACKAGE_NAME) \
+ ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
+ --clean --skip-validate --skip-publish --snapshot
+
+release:
+ @if [ ! -f ".release-env" ]; then \
+ echo "\033[91m.release-env is required for release\033[0m";\
+ exit 1;\
+ fi
+ docker run \
+ --rm \
+ --privileged \
+ -e CGO_ENABLED=1 \
+ -e "GITHUB_TOKEN=${GITHUB_TOKEN}" \
+ -v /var/run/docker.sock:/var/run/docker.sock \
+ -v `pwd`:/go/src/$(PACKAGE_NAME) \
+ -w /go/src/$(PACKAGE_NAME) \
+ ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
+ release --clean --skip-validate
\ No newline at end of file
diff --git a/app/ante/ante.go b/app/ante/ante.go
index b6029c33c9..e45378b175 100644
--- a/app/ante/ante.go
+++ b/app/ante/ante.go
@@ -120,7 +120,10 @@ func NewAnteHandler(options ethante.HandlerOptions) (sdk.AnteHandler, error) {
func Recover(logger tmlog.Logger, err *error) {
if r := recover(); r != nil {
- *err = errorsmod.Wrapf(errortypes.ErrPanic, "%v", r)
+ if err != nil {
+ // #nosec G703 err is checked non-nil above
+ *err = errorsmod.Wrapf(errortypes.ErrPanic, "%v", r)
+ }
if e, ok := r.(error); ok {
logger.Error(
diff --git a/app/ante/authz.go b/app/ante/authz.go
index e43baa1baa..c81dcf97b5 100644
--- a/app/ante/authz.go
+++ b/app/ante/authz.go
@@ -11,7 +11,7 @@ import (
)
// maxNestedMsgs defines a cap for the number of nested messages on a MsgExec message
-const maxNestedMsgs = 7
+const maxNestedMsgs = 15
// AuthzLimiterDecorator blocks certain msg types from being granted or executed
// within the authorization module.
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..53bfee51cd 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 ****/
@@ -461,7 +464,7 @@ func New(
groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, interfaceRegistry),
evm.NewAppModule(app.EvmKeeper, app.AccountKeeper, evmSs),
feemarket.NewAppModule(app.FeeMarketKeeper, feeSs),
- zetaCoreModule.NewAppModule(appCodec, app.ZetaCoreKeeper, app.StakingKeeper),
+ zetaCoreModule.NewAppModule(appCodec, app.ZetaCoreKeeper, app.StakingKeeper, app.AccountKeeper),
zetaObserverModule.NewAppModule(appCodec, *app.ZetaObserverKeeper, app.AccountKeeper, app.BankKeeper),
fungibleModule.NewAppModule(appCodec, app.FungibleKeeper, app.AccountKeeper, app.BankKeeper),
emissionsModule.NewAppModule(appCodec, app.EmissionsKeeper, app.AccountKeeper),
diff --git a/app/export.go b/app/export.go
index 066e8dd41b..2ae0db042e 100644
--- a/app/export.go
+++ b/app/export.go
@@ -111,14 +111,23 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str
feePool.CommunityPool = feePool.CommunityPool.Add(scraps...)
app.DistrKeeper.SetFeePool(ctx, feePool)
- _ = app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator())
+ err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator())
+ if err != nil {
+ panic(err)
+ }
return false
})
// reinitialize all delegations
for _, del := range dels {
- _ = app.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, del.GetDelegatorAddr(), del.GetValidatorAddr())
- _ = app.DistrKeeper.Hooks().AfterDelegationModified(ctx, del.GetDelegatorAddr(), del.GetValidatorAddr())
+ err := app.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, del.GetDelegatorAddr(), del.GetValidatorAddr())
+ if err != nil {
+ panic(err)
+ }
+ err = app.DistrKeeper.Hooks().AfterDelegationModified(ctx, del.GetDelegatorAddr(), del.GetValidatorAddr())
+ if err != nil {
+ panic(err)
+ }
}
// reset context height
diff --git a/app/setup_handlers.go b/app/setup_handlers.go
index 66e168f7ee..47d63564ad 100644
--- a/app/setup_handlers.go
+++ b/app/setup_handlers.go
@@ -5,23 +5,18 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/upgrade/types"
- crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types"
- observertypes "github.com/zeta-chain/zetacore/x/observer/types"
)
-const releaseVersion = "v9.0.0"
+const releaseVersion = "v10.0.0"
func SetupHandlers(app *App) {
app.UpgradeKeeper.SetUpgradeHandler(releaseVersion, func(ctx sdk.Context, plan types.Plan, vm module.VersionMap) (module.VersionMap, error) {
app.Logger().Info("Running upgrade handler for " + releaseVersion)
-
// Updated version map to the latest consensus versions from each module
for m, mb := range app.mm.Modules {
vm[m] = mb.ConsensusVersion()
}
- vm[observertypes.ModuleName] = vm[observertypes.ModuleName] - 1
- vm[crosschaintypes.ModuleName] = vm[crosschaintypes.ModuleName] - 1
- SetParams(app, ctx)
+
return app.mm.RunMigrations(ctx, app.configurator, vm)
})
@@ -40,11 +35,3 @@ func SetupHandlers(app *App) {
app.SetStoreLoader(types.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}
}
-
-// SetParams sets the default params for the observer module
-// A new policy has been added for add_observer.
-func SetParams(app *App, ctx sdk.Context) {
- params := app.ZetaObserverKeeper.GetParamsIsExists(ctx)
- params.AdminPolicy = observertypes.DefaultAdminPolicy()
- app.ZetaObserverKeeper.SetParams(ctx, params)
-}
diff --git a/cmd/config_mainnet.go b/cmd/config_mainnet.go
index bb50270c19..dcc8c4f9e2 100644
--- a/cmd/config_mainnet.go
+++ b/cmd/config_mainnet.go
@@ -1,5 +1,5 @@
-//go:build !PRIVNET && !TESTNET
-// +build !PRIVNET,!TESTNET
+//go:build !PRIVNET && !TESTNET && !MOCK_MAINNET
+// +build !PRIVNET,!TESTNET,!MOCK_MAINNET
package cmd
@@ -13,9 +13,4 @@ const (
DenomRegex = `[a-zA-Z][a-zA-Z0-9:\\/\\\-\\_\\.]{2,127}`
ZetaChainCoinType uint32 = 60
ZetaChainHDPath string = `m/44'/60'/0'/0/0`
- NET = "TESTNET"
-)
-
-var (
- CHAINID = "zeta_7001-1"
)
diff --git a/cmd/config_mock_mainnet.go b/cmd/config_mock_mainnet.go
new file mode 100644
index 0000000000..c8f775c61c
--- /dev/null
+++ b/cmd/config_mock_mainnet.go
@@ -0,0 +1,16 @@
+//go:build MOCK_MAINNET
+// +build MOCK_MAINNET
+
+package cmd
+
+const (
+ Bech32PrefixAccAddr = "zeta"
+ Bech32PrefixAccPub = "zetapub"
+ Bech32PrefixValAddr = "zetav"
+ Bech32PrefixValPub = "zetavpub"
+ Bech32PrefixConsAddr = "zetac"
+ Bech32PrefixConsPub = "zetacpub"
+ DenomRegex = `[a-zA-Z][a-zA-Z0-9:\\/\\\-\\_\\.]{2,127}`
+ ZetaChainCoinType uint32 = 60
+ ZetaChainHDPath string = `m/44'/60'/0'/0/0`
+)
diff --git a/cmd/zetaclientd/init.go b/cmd/zetaclientd/init.go
index 303ce02e90..8db8b18386 100644
--- a/cmd/zetaclientd/init.go
+++ b/cmd/zetaclientd/init.go
@@ -1,10 +1,8 @@
package main
import (
- etherminttypes "github.com/evmos/ethermint/types"
"github.com/rs/zerolog"
"github.com/spf13/cobra"
- "github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/zetaclient/config"
)
@@ -58,7 +56,10 @@ func init() {
}
func Initialize(_ *cobra.Command, _ []string) error {
- setHomeDir()
+ err := setHomeDir()
+ if err != nil {
+ return err
+ }
//Create new config struct
configData := config.New()
@@ -86,16 +87,7 @@ func Initialize(_ *cobra.Command, _ []string) error {
configData.TssPath = initArgs.TssPath
configData.P2PDiagnosticTicker = initArgs.p2pDiagnosticTicker
configData.ConfigUpdateTicker = initArgs.configUpdateTicker
- initChainID(&configData)
//Save config file
return config.Save(&configData, rootArgs.zetaCoreHome)
}
-
-func initChainID(configData *config.Config) {
- ZEVMChainID, err := etherminttypes.ParseChainID(configData.ChainID)
- if err != nil {
- panic(err)
- }
- configData.EVMChainConfigs[common.ZetaChain().ChainId].Chain.ChainId = ZEVMChainID.Int64()
-}
diff --git a/cmd/zetaclientd/keygen_tss.go b/cmd/zetaclientd/keygen_tss.go
index d06848e071..3b303450c3 100644
--- a/cmd/zetaclientd/keygen_tss.go
+++ b/cmd/zetaclientd/keygen_tss.go
@@ -15,14 +15,15 @@ import (
observerTypes "github.com/zeta-chain/zetacore/x/observer/types"
mc "github.com/zeta-chain/zetacore/zetaclient"
"github.com/zeta-chain/zetacore/zetaclient/config"
+ "github.com/zeta-chain/zetacore/zetaclient/metrics"
tsscommon "gitlab.com/thorchain/tss/go-tss/common"
"gitlab.com/thorchain/tss/go-tss/keygen"
"gitlab.com/thorchain/tss/go-tss/p2p"
)
-func GenerateTss(logger zerolog.Logger, cfg *config.Config, zetaBridge *mc.ZetaCoreBridge, peers p2p.AddrList, priKey secp256k1.PrivKey, ts *mc.TelemetryServer, tssHistoricalList []types.TSS) (*mc.TSS, error) {
+func GenerateTss(logger zerolog.Logger, cfg *config.Config, zetaBridge *mc.ZetaCoreBridge, peers p2p.AddrList, priKey secp256k1.PrivKey, ts *mc.TelemetryServer, tssHistoricalList []types.TSS, metrics *metrics.Metrics) (*mc.TSS, error) {
keygenLogger := logger.With().Str("module", "keygen").Logger()
- tss, err := mc.NewTSS(peers, priKey, preParams, cfg, zetaBridge, tssHistoricalList)
+ tss, err := mc.NewTSS(peers, priKey, preParams, cfg, zetaBridge, tssHistoricalList, metrics)
if err != nil {
keygenLogger.Error().Err(err).Msg("NewTSS error")
return nil, err
@@ -69,7 +70,7 @@ func GenerateTss(logger zerolog.Logger, cfg *config.Config, zetaBridge *mc.ZetaC
if currentBlock != keyGen.BlockNumber {
if currentBlock > lastBlock {
lastBlock = currentBlock
- keygenLogger.Info().Msgf("Waiting For Keygen Block to arrive or new keygen block to be set. Keygen Block : %d Current Block : %d", keyGen.BlockNumber, currentBlock)
+ keygenLogger.Info().Msgf("Waiting For Keygen Block to arrive or new keygen block to be set. Keygen Block : %d Current Block : %d ChainID %s ", keyGen.BlockNumber, currentBlock, cfg.ChainID)
}
continue
}
diff --git a/cmd/zetaclientd/p2p_diagnostics.go b/cmd/zetaclientd/p2p_diagnostics.go
index 9d94b3c64a..a33c0257cf 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"
@@ -124,7 +124,11 @@ func RunDiagnostics(startLogger zerolog.Logger, peers p2p.AddrList, bridgePk cry
var wg sync.WaitGroup
for _, peerAddr := range peers {
- peerinfo, _ := peer.AddrInfoFromP2pAddr(peerAddr)
+ peerinfo, err := peer.AddrInfoFromP2pAddr(peerAddr)
+ if err != nil {
+ startLogger.Error().Err(err).Msgf("fail to parse peer address %s", peerAddr)
+ continue
+ }
wg.Add(1)
go func() {
defer wg.Done()
diff --git a/cmd/zetaclientd/root.go b/cmd/zetaclientd/root.go
index bc9c02bee1..eb358c0fb5 100644
--- a/cmd/zetaclientd/root.go
+++ b/cmd/zetaclientd/root.go
@@ -15,6 +15,8 @@ type rootArguments struct {
zetaCoreHome string
}
-func setHomeDir() {
- rootArgs.zetaCoreHome, _ = RootCmd.Flags().GetString(tmcli.HomeFlag)
+func setHomeDir() error {
+ var err error
+ rootArgs.zetaCoreHome, err = RootCmd.Flags().GetString(tmcli.HomeFlag)
+ return err
}
diff --git a/cmd/zetaclientd/start.go b/cmd/zetaclientd/start.go
index 2cfb8d4a0a..bab4924167 100644
--- a/cmd/zetaclientd/start.go
+++ b/cmd/zetaclientd/start.go
@@ -39,8 +39,13 @@ func init() {
}
func start(_ *cobra.Command, _ []string) error {
- setHomeDir()
+ err := setHomeDir()
+ if err != nil {
+ return err
+ }
+
SetupConfigForTest()
+
//Load Config file given path
cfg, err := config.Load(rootArgs.zetaCoreHome)
if err != nil {
@@ -81,6 +86,7 @@ func start(_ *cobra.Command, _ []string) error {
if strings.Compare(res.GetDefaultNodeInfo().Network, cfg.ChainID) != 0 {
startLogger.Warn().Msgf("chain id mismatch, zeta-core chain id %s, zeta client chain id %s; reset zeta client chain id", res.GetDefaultNodeInfo().Network, cfg.ChainID)
cfg.ChainID = res.GetDefaultNodeInfo().Network
+ zetaBridge.UpdateChainID(cfg.ChainID)
}
// CreateAuthzSigner : which is used to sign all authz messages . All votes broadcast to zetacore are wrapped in authz exec .
@@ -135,6 +141,14 @@ func start(_ *cobra.Command, _ []string) error {
startLogger.Error().Err(err).Msg("telemetryServer error")
}
}()
+
+ metrics, err := metrics2.NewMetrics()
+ if err != nil {
+ log.Error().Err(err).Msg("NewMetrics")
+ return err
+ }
+ metrics.Start()
+
var tssHistoricalList []types.TSS
tssHistoricalList, err = zetaBridge.GetTssHistory()
if err != nil {
@@ -142,7 +156,7 @@ func start(_ *cobra.Command, _ []string) error {
}
telemetryServer.SetIPAddress(cfg.PublicIP)
- tss, err := GenerateTss(masterLogger, cfg, zetaBridge, peers, priKey, telemetryServer, tssHistoricalList)
+ tss, err := GenerateTss(masterLogger, cfg, zetaBridge, peers, priKey, telemetryServer, tssHistoricalList, metrics)
if err != nil {
return err
}
@@ -204,23 +218,13 @@ func start(_ *cobra.Command, _ []string) error {
return err
}
- metrics, err := metrics2.NewMetrics()
+ userDir, err := os.UserHomeDir()
if err != nil {
- log.Error().Err(err).Msg("NewMetrics")
+ log.Error().Err(err).Msg("os.UserHomeDir")
return err
}
- metrics.Start()
-
- userDir, _ := os.UserHomeDir()
dbpath := filepath.Join(userDir, ".zetaclient/chainobserver")
- // Register zetaclient.TSS prometheus metrics
- err = tss.RegisterMetrics(metrics)
- if err != nil {
- startLogger.Err(err).Msg("tss.RegisterMetrics")
- return err
- }
-
// CreateChainClientMap : This creates a map of all chain clients . Each chain client is responsible for listening to events on the chain and processing them
chainClientMap, err := CreateChainClientMap(zetaBridge, tss, dbpath, metrics, masterLogger, cfg, telemetryServer)
if err != nil {
@@ -242,8 +246,8 @@ func start(_ *cobra.Command, _ []string) error {
startLogger.Info().Msgf("stop signal received: %s", sig)
// stop zetacore observer
- for _, chain := range cfg.GetEnabledChains() {
- (chainClientMap)[chain].Stop()
+ for _, client := range chainClientMap {
+ client.Stop()
}
zetaBridge.Stop()
diff --git a/cmd/zetacore_utils/main.go b/cmd/zetacore_utils/main.go
index bcc9bf2302..cee1b46a48 100644
--- a/cmd/zetacore_utils/main.go
+++ b/cmd/zetacore_utils/main.go
@@ -34,14 +34,23 @@ type TokenDistribution struct {
}
func main() {
- file, _ := filepath.Abs(filepath.Join("cmd", "zetacore_utils", "address-list.json"))
+ file, err := filepath.Abs(filepath.Join("cmd", "zetacore_utils", "address-list.json"))
+ if err != nil {
+ panic(err)
+ }
addresses, err := readLines(file)
if err != nil {
panic(err)
}
addresses = removeDuplicates(addresses)
- fileS, _ := filepath.Abs(filepath.Join("cmd", "zetacore_utils", "successful_address.json"))
- fileF, _ := filepath.Abs(filepath.Join("cmd", "zetacore_utils", "failed_address.json"))
+ fileS, err := filepath.Abs(filepath.Join("cmd", "zetacore_utils", "successful_address.json"))
+ if err != nil {
+ panic(err)
+ }
+ fileF, err := filepath.Abs(filepath.Join("cmd", "zetacore_utils", "failed_address.json"))
+ if err != nil {
+ panic(err)
+ }
distributionList := make([]TokenDistribution, len(addresses))
for i, address := range addresses {
@@ -111,11 +120,22 @@ func main() {
failedDistributions = append(failedDistributions, distribution)
}
}
- successFile, _ := json.MarshalIndent(successfullDistributions, "", " ")
- _ = os.WriteFile(fileS, successFile, 0600)
- failedFile, _ := json.MarshalIndent(failedDistributions, "", " ")
- _ = os.WriteFile(fileF, failedFile, 0600)
-
+ successFile, err := json.MarshalIndent(successfullDistributions, "", " ")
+ if err != nil {
+ panic(err)
+ }
+ err = os.WriteFile(fileS, successFile, 0600)
+ if err != nil {
+ panic(err)
+ }
+ failedFile, err := json.MarshalIndent(failedDistributions, "", " ")
+ if err != nil {
+ panic(err)
+ }
+ err = os.WriteFile(fileF, failedFile, 0600)
+ if err != nil {
+ panic(err)
+ }
}
func readLines(path string) ([]string, error) {
diff --git a/cmd/zetacored/collect_observer_info.go b/cmd/zetacored/collect_observer_info.go
index 9b74042422..f9c351636c 100644
--- a/cmd/zetacored/collect_observer_info.go
+++ b/cmd/zetacored/collect_observer_info.go
@@ -46,8 +46,14 @@ func CollectObserverInfoCmd() *cobra.Command {
}
observerInfoList = append(observerInfoList, observerInfo)
}
- file, _ := json.MarshalIndent(observerInfoList, "", " ")
- _ = os.WriteFile("observer_info.json", file, 0600)
+ file, err := json.MarshalIndent(observerInfoList, "", " ")
+ if err != nil {
+ return err
+ }
+ err = os.WriteFile("observer_info.json", file, 0600)
+ if err != nil {
+ return err
+ }
return nil
},
}
diff --git a/cmd/zetacored/observer_accounts.go b/cmd/zetacored/observer_accounts.go
index 5efc118277..397146a688 100644
--- a/cmd/zetacored/observer_accounts.go
+++ b/cmd/zetacored/observer_accounts.go
@@ -28,6 +28,10 @@ import (
"github.com/zeta-chain/zetacore/x/observer/types"
)
+// Token distribution
+// Validators Only = ValidatorTokens sent to their operator address
+// Observer = ObserverTokens sent to their operator address + HotkeyTokens sent to their hotkey address
+// HotkeyTokens are for operational expenses such as paying for gas fees
const (
ValidatorTokens = "100000000000000000000000"
ObserverTokens = "4100000000000000000000000"
diff --git a/cmd/zetacored/parsers.go b/cmd/zetacored/parsers.go
index 037f2e80da..008777cec7 100644
--- a/cmd/zetacored/parsers.go
+++ b/cmd/zetacored/parsers.go
@@ -20,7 +20,10 @@ type ObserverInfoReader struct {
}
func (o ObserverInfoReader) String() string {
- s, _ := json.MarshalIndent(o, "", "\t")
+ s, err := json.MarshalIndent(o, "", "\t")
+ if err != nil {
+ return ""
+ }
return string(s)
}
diff --git a/common/chain.go b/common/chain.go
index c0286a1f8d..0952a64b49 100644
--- a/common/chain.go
+++ b/common/chain.go
@@ -102,6 +102,12 @@ func IsEVMChain(chainID int64) bool {
chainID == 137 // polygon mainnet
}
+func IsEthereum(chainID int64) bool {
+ return chainID == 5 || // Goerli
+ chainID == 1337 || // eth privnet
+ chainID == 1 // eth mainnet
+}
+
func (chain Chain) IsKlaytnChain() bool {
return chain.ChainId == 1001
}
diff --git a/common/common.pb.go b/common/common.pb.go
index 683a844041..4277cc8dc6 100644
--- a/common/common.pb.go
+++ b/common/common.pb.go
@@ -11,6 +11,7 @@ import (
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/gogo/protobuf/proto"
+ ethereum "github.com/zeta-chain/zetacore/common/ethereum"
)
// Reference imports to suppress errors if they are not otherwise used.
@@ -255,48 +256,284 @@ func (m *Chain) GetChainId() int64 {
return 0
}
+type BlockHeader struct {
+ Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
+ Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
+ ParentHash []byte `protobuf:"bytes,3,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty"`
+ ChainId int64 `protobuf:"varint,4,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
+ // chain specific header
+ Header HeaderData `protobuf:"bytes,5,opt,name=header,proto3" json:"header"`
+}
+
+func (m *BlockHeader) Reset() { *m = BlockHeader{} }
+func (m *BlockHeader) String() string { return proto.CompactTextString(m) }
+func (*BlockHeader) ProtoMessage() {}
+func (*BlockHeader) Descriptor() ([]byte, []int) {
+ return fileDescriptor_8f954d82c0b891f6, []int{2}
+}
+func (m *BlockHeader) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *BlockHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_BlockHeader.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 *BlockHeader) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_BlockHeader.Merge(m, src)
+}
+func (m *BlockHeader) XXX_Size() int {
+ return m.Size()
+}
+func (m *BlockHeader) XXX_DiscardUnknown() {
+ xxx_messageInfo_BlockHeader.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_BlockHeader proto.InternalMessageInfo
+
+func (m *BlockHeader) GetHeight() int64 {
+ if m != nil {
+ return m.Height
+ }
+ return 0
+}
+
+func (m *BlockHeader) GetHash() []byte {
+ if m != nil {
+ return m.Hash
+ }
+ return nil
+}
+
+func (m *BlockHeader) GetParentHash() []byte {
+ if m != nil {
+ return m.ParentHash
+ }
+ return nil
+}
+
+func (m *BlockHeader) GetChainId() int64 {
+ if m != nil {
+ return m.ChainId
+ }
+ return 0
+}
+
+func (m *BlockHeader) GetHeader() HeaderData {
+ if m != nil {
+ return m.Header
+ }
+ return HeaderData{}
+}
+
+type HeaderData struct {
+ // Types that are valid to be assigned to Data:
+ //
+ // *HeaderData_EthereumHeader
+ Data isHeaderData_Data `protobuf_oneof:"data"`
+}
+
+func (m *HeaderData) Reset() { *m = HeaderData{} }
+func (m *HeaderData) String() string { return proto.CompactTextString(m) }
+func (*HeaderData) ProtoMessage() {}
+func (*HeaderData) Descriptor() ([]byte, []int) {
+ return fileDescriptor_8f954d82c0b891f6, []int{3}
+}
+func (m *HeaderData) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *HeaderData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_HeaderData.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 *HeaderData) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_HeaderData.Merge(m, src)
+}
+func (m *HeaderData) XXX_Size() int {
+ return m.Size()
+}
+func (m *HeaderData) XXX_DiscardUnknown() {
+ xxx_messageInfo_HeaderData.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_HeaderData proto.InternalMessageInfo
+
+type isHeaderData_Data interface {
+ isHeaderData_Data()
+ MarshalTo([]byte) (int, error)
+ Size() int
+}
+
+type HeaderData_EthereumHeader struct {
+ EthereumHeader []byte `protobuf:"bytes,1,opt,name=ethereum_header,json=ethereumHeader,proto3,oneof" json:"ethereum_header,omitempty"`
+}
+
+func (*HeaderData_EthereumHeader) isHeaderData_Data() {}
+
+func (m *HeaderData) GetData() isHeaderData_Data {
+ if m != nil {
+ return m.Data
+ }
+ return nil
+}
+
+func (m *HeaderData) GetEthereumHeader() []byte {
+ if x, ok := m.GetData().(*HeaderData_EthereumHeader); ok {
+ return x.EthereumHeader
+ }
+ return nil
+}
+
+// XXX_OneofWrappers is for the internal use of the proto package.
+func (*HeaderData) XXX_OneofWrappers() []interface{} {
+ return []interface{}{
+ (*HeaderData_EthereumHeader)(nil),
+ }
+}
+
+type Proof struct {
+ // Types that are valid to be assigned to Proof:
+ //
+ // *Proof_EthereumProof
+ Proof isProof_Proof `protobuf_oneof:"proof"`
+}
+
+func (m *Proof) Reset() { *m = Proof{} }
+func (m *Proof) String() string { return proto.CompactTextString(m) }
+func (*Proof) ProtoMessage() {}
+func (*Proof) Descriptor() ([]byte, []int) {
+ return fileDescriptor_8f954d82c0b891f6, []int{4}
+}
+func (m *Proof) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *Proof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_Proof.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 *Proof) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Proof.Merge(m, src)
+}
+func (m *Proof) XXX_Size() int {
+ return m.Size()
+}
+func (m *Proof) XXX_DiscardUnknown() {
+ xxx_messageInfo_Proof.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Proof proto.InternalMessageInfo
+
+type isProof_Proof interface {
+ isProof_Proof()
+ MarshalTo([]byte) (int, error)
+ Size() int
+}
+
+type Proof_EthereumProof struct {
+ EthereumProof *ethereum.Proof `protobuf:"bytes,1,opt,name=ethereum_proof,json=ethereumProof,proto3,oneof" json:"ethereum_proof,omitempty"`
+}
+
+func (*Proof_EthereumProof) isProof_Proof() {}
+
+func (m *Proof) GetProof() isProof_Proof {
+ if m != nil {
+ return m.Proof
+ }
+ return nil
+}
+
+func (m *Proof) GetEthereumProof() *ethereum.Proof {
+ if x, ok := m.GetProof().(*Proof_EthereumProof); ok {
+ return x.EthereumProof
+ }
+ return nil
+}
+
+// XXX_OneofWrappers is for the internal use of the proto package.
+func (*Proof) XXX_OneofWrappers() []interface{} {
+ return []interface{}{
+ (*Proof_EthereumProof)(nil),
+ }
+}
+
func init() {
proto.RegisterEnum("common.ReceiveStatus", ReceiveStatus_name, ReceiveStatus_value)
proto.RegisterEnum("common.CoinType", CoinType_name, CoinType_value)
proto.RegisterEnum("common.ChainName", ChainName_name, ChainName_value)
proto.RegisterType((*PubKeySet)(nil), "common.PubKeySet")
proto.RegisterType((*Chain)(nil), "common.Chain")
+ proto.RegisterType((*BlockHeader)(nil), "common.BlockHeader")
+ proto.RegisterType((*HeaderData)(nil), "common.HeaderData")
+ proto.RegisterType((*Proof)(nil), "common.Proof")
}
func init() { proto.RegisterFile("common/common.proto", fileDescriptor_8f954d82c0b891f6) }
var fileDescriptor_8f954d82c0b891f6 = []byte{
- // 476 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x92, 0x41, 0x8b, 0xd3, 0x40,
- 0x14, 0xc7, 0x93, 0x76, 0x9b, 0x34, 0xaf, 0x6b, 0x3b, 0xce, 0x0a, 0xae, 0x7b, 0xc8, 0xca, 0xa2,
- 0x20, 0x0b, 0x6e, 0x77, 0x2b, 0x55, 0xc4, 0x83, 0xb0, 0x41, 0x45, 0x04, 0x91, 0x74, 0x4f, 0x7b,
- 0x29, 0x93, 0xc9, 0x23, 0x09, 0x26, 0x99, 0x90, 0x4c, 0x84, 0xfa, 0x29, 0xfc, 0x0a, 0x82, 0x07,
- 0x3f, 0x8a, 0xc7, 0x3d, 0x7a, 0x5a, 0xa4, 0xfd, 0x16, 0x9e, 0x64, 0x26, 0x4d, 0xea, 0x29, 0x6f,
- 0x7e, 0xf3, 0x7b, 0xf3, 0xfe, 0x64, 0x06, 0x0e, 0xb8, 0xc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0a, 0x36, 0xa4, 0x95, 0x6d, 0xac, 0x26, 0x21, 0xd0, 0xf5,
+ 0x19, 0xa6, 0x8b, 0x70, 0xce, 0x31, 0xe3, 0x82, 0x69, 0x82, 0x45, 0xcb, 0xc8, 0xa1, 0x1b, 0xd6,
+ 0x12, 0xdd, 0x7c, 0x1a, 0x53, 0x37, 0xc0, 0x0a, 0xb6, 0x85, 0xe8, 0x50, 0xe6, 0x50, 0xa7, 0x62,
+ 0x7a, 0x39, 0xa1, 0x04, 0x50, 0xad, 0x5a, 0x12, 0xa3, 0x5c, 0xb5, 0x04, 0x1d, 0xd9, 0x3c, 0x5f,
+ 0x62, 0xc1, 0x5c, 0xba, 0x10, 0xb0, 0x5b, 0x5a, 0x29, 0xfa, 0x42, 0x34, 0x7b, 0xf9, 0x77, 0x34,
+ 0x3e, 0xbd, 0x5a, 0x5b, 0xea, 0xf5, 0xda, 0x52, 0x7f, 0xad, 0x2d, 0xf5, 0xcb, 0xad, 0xa5, 0x5c,
+ 0xdf, 0x5a, 0xca, 0xcf, 0x5b, 0x4b, 0xb9, 0x78, 0xe0, 0x87, 0x3c, 0x58, 0x3a, 0xe2, 0x45, 0x3b,
+ 0x12, 0x13, 0x1f, 0xc9, 0x77, 0x51, 0x86, 0x2e, 0x4b, 0xb1, 0xf8, 0x57, 0x70, 0x34, 0xf9, 0xc3,
+ 0x7e, 0xfc, 0x27, 0x00, 0x00, 0xff, 0xff, 0x2e, 0x3c, 0x8a, 0x97, 0x2d, 0x04, 0x00, 0x00,
}
func (m *PubKeySet) Marshal() (dAtA []byte, err error) {
@@ -369,6 +606,164 @@ func (m *Chain) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
+func (m *BlockHeader) 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 *BlockHeader) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *BlockHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ {
+ size, err := m.Header.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintCommon(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x2a
+ if m.ChainId != 0 {
+ i = encodeVarintCommon(dAtA, i, uint64(m.ChainId))
+ i--
+ dAtA[i] = 0x20
+ }
+ if len(m.ParentHash) > 0 {
+ i -= len(m.ParentHash)
+ copy(dAtA[i:], m.ParentHash)
+ i = encodeVarintCommon(dAtA, i, uint64(len(m.ParentHash)))
+ i--
+ dAtA[i] = 0x1a
+ }
+ if len(m.Hash) > 0 {
+ i -= len(m.Hash)
+ copy(dAtA[i:], m.Hash)
+ i = encodeVarintCommon(dAtA, i, uint64(len(m.Hash)))
+ i--
+ dAtA[i] = 0x12
+ }
+ if m.Height != 0 {
+ i = encodeVarintCommon(dAtA, i, uint64(m.Height))
+ i--
+ dAtA[i] = 0x8
+ }
+ return len(dAtA) - i, nil
+}
+
+func (m *HeaderData) 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 *HeaderData) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *HeaderData) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.Data != nil {
+ {
+ size := m.Data.Size()
+ i -= size
+ if _, err := m.Data.MarshalTo(dAtA[i:]); err != nil {
+ return 0, err
+ }
+ }
+ }
+ return len(dAtA) - i, nil
+}
+
+func (m *HeaderData_EthereumHeader) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *HeaderData_EthereumHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ if m.EthereumHeader != nil {
+ i -= len(m.EthereumHeader)
+ copy(dAtA[i:], m.EthereumHeader)
+ i = encodeVarintCommon(dAtA, i, uint64(len(m.EthereumHeader)))
+ i--
+ dAtA[i] = 0xa
+ }
+ return len(dAtA) - i, nil
+}
+func (m *Proof) 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 *Proof) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *Proof) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.Proof != nil {
+ {
+ size := m.Proof.Size()
+ i -= size
+ if _, err := m.Proof.MarshalTo(dAtA[i:]); err != nil {
+ return 0, err
+ }
+ }
+ }
+ return len(dAtA) - i, nil
+}
+
+func (m *Proof_EthereumProof) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *Proof_EthereumProof) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ if m.EthereumProof != nil {
+ {
+ size, err := m.EthereumProof.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintCommon(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0xa
+ }
+ return len(dAtA) - i, nil
+}
func encodeVarintCommon(dAtA []byte, offset int, v uint64) int {
offset -= sovCommon(v)
base := offset
@@ -394,31 +789,307 @@ func (m *PubKeySet) Size() (n int) {
if l > 0 {
n += 1 + l + sovCommon(uint64(l))
}
- return n
-}
+ return n
+}
+
+func (m *Chain) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.ChainName != 0 {
+ n += 1 + sovCommon(uint64(m.ChainName))
+ }
+ if m.ChainId != 0 {
+ n += 1 + sovCommon(uint64(m.ChainId))
+ }
+ return n
+}
+
+func (m *BlockHeader) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.Height != 0 {
+ n += 1 + sovCommon(uint64(m.Height))
+ }
+ l = len(m.Hash)
+ if l > 0 {
+ n += 1 + l + sovCommon(uint64(l))
+ }
+ l = len(m.ParentHash)
+ if l > 0 {
+ n += 1 + l + sovCommon(uint64(l))
+ }
+ if m.ChainId != 0 {
+ n += 1 + sovCommon(uint64(m.ChainId))
+ }
+ l = m.Header.Size()
+ n += 1 + l + sovCommon(uint64(l))
+ return n
+}
+
+func (m *HeaderData) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.Data != nil {
+ n += m.Data.Size()
+ }
+ return n
+}
+
+func (m *HeaderData_EthereumHeader) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.EthereumHeader != nil {
+ l = len(m.EthereumHeader)
+ n += 1 + l + sovCommon(uint64(l))
+ }
+ return n
+}
+func (m *Proof) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.Proof != nil {
+ n += m.Proof.Size()
+ }
+ return n
+}
+
+func (m *Proof_EthereumProof) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.EthereumProof != nil {
+ l = m.EthereumProof.Size()
+ n += 1 + l + sovCommon(uint64(l))
+ }
+ return n
+}
+
+func sovCommon(x uint64) (n int) {
+ return (math_bits.Len64(x|1) + 6) / 7
+}
+func sozCommon(x uint64) (n int) {
+ return sovCommon(uint64((x << 1) ^ uint64((int64(x) >> 63))))
+}
+func (m *PubKeySet) 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 ErrIntOverflowCommon
+ }
+ 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: PubKeySet: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: PubKeySet: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Secp256k1", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowCommon
+ }
+ 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 ErrInvalidLengthCommon
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthCommon
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Secp256k1 = PubKey(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Ed25519", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowCommon
+ }
+ 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 ErrInvalidLengthCommon
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthCommon
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Ed25519 = PubKey(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipCommon(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthCommon
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func (m *Chain) 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 ErrIntOverflowCommon
+ }
+ 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: Chain: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: Chain: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field ChainName", wireType)
+ }
+ m.ChainName = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowCommon
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.ChainName |= ChainName(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ case 2:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
+ }
+ m.ChainId = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowCommon
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.ChainId |= int64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ default:
+ iNdEx = preIndex
+ skippy, err := skipCommon(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthCommon
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
-func (m *Chain) Size() (n int) {
- if m == nil {
- return 0
- }
- var l int
- _ = l
- if m.ChainName != 0 {
- n += 1 + sovCommon(uint64(m.ChainName))
- }
- if m.ChainId != 0 {
- n += 1 + sovCommon(uint64(m.ChainId))
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
}
- return n
-}
-
-func sovCommon(x uint64) (n int) {
- return (math_bits.Len64(x|1) + 6) / 7
-}
-func sozCommon(x uint64) (n int) {
- return sovCommon(uint64((x << 1) ^ uint64((int64(x) >> 63))))
+ return nil
}
-func (m *PubKeySet) Unmarshal(dAtA []byte) error {
+func (m *BlockHeader) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -441,17 +1112,36 @@ func (m *PubKeySet) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: PubKeySet: wiretype end group for non-group")
+ return fmt.Errorf("proto: BlockHeader: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: PubKeySet: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: BlockHeader: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType)
+ }
+ m.Height = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowCommon
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.Height |= int64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ case 2:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Secp256k1", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType)
}
- var stringLen uint64
+ var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCommon
@@ -461,29 +1151,31 @@ func (m *PubKeySet) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
- stringLen |= uint64(b&0x7F) << shift
+ byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
- intStringLen := int(stringLen)
- if intStringLen < 0 {
+ if byteLen < 0 {
return ErrInvalidLengthCommon
}
- postIndex := iNdEx + intStringLen
+ postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthCommon
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
- m.Secp256k1 = PubKey(dAtA[iNdEx:postIndex])
+ m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...)
+ if m.Hash == nil {
+ m.Hash = []byte{}
+ }
iNdEx = postIndex
- case 2:
+ case 3:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Ed25519", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field ParentHash", wireType)
}
- var stringLen uint64
+ var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCommon
@@ -493,23 +1185,77 @@ func (m *PubKeySet) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
- stringLen |= uint64(b&0x7F) << shift
+ byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
- intStringLen := int(stringLen)
- if intStringLen < 0 {
+ if byteLen < 0 {
return ErrInvalidLengthCommon
}
- postIndex := iNdEx + intStringLen
+ postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthCommon
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
- m.Ed25519 = PubKey(dAtA[iNdEx:postIndex])
+ m.ParentHash = append(m.ParentHash[:0], dAtA[iNdEx:postIndex]...)
+ if m.ParentHash == nil {
+ m.ParentHash = []byte{}
+ }
+ iNdEx = postIndex
+ case 4:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
+ }
+ m.ChainId = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowCommon
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.ChainId |= int64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ case 5:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowCommon
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthCommon
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthCommon
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
iNdEx = postIndex
default:
iNdEx = preIndex
@@ -532,7 +1278,7 @@ func (m *PubKeySet) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *Chain) Unmarshal(dAtA []byte) error {
+func (m *HeaderData) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -555,17 +1301,17 @@ func (m *Chain) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: Chain: wiretype end group for non-group")
+ return fmt.Errorf("proto: HeaderData: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: Chain: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: HeaderData: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ChainName", wireType)
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field EthereumHeader", wireType)
}
- m.ChainName = 0
+ var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCommon
@@ -575,16 +1321,80 @@ func (m *Chain) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
- m.ChainName |= ChainName(b&0x7F) << shift
+ byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
- case 2:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
+ if byteLen < 0 {
+ return ErrInvalidLengthCommon
}
- m.ChainId = 0
+ postIndex := iNdEx + byteLen
+ if postIndex < 0 {
+ return ErrInvalidLengthCommon
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ v := make([]byte, postIndex-iNdEx)
+ copy(v, dAtA[iNdEx:postIndex])
+ m.Data = &HeaderData_EthereumHeader{v}
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipCommon(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthCommon
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func (m *Proof) 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 ErrIntOverflowCommon
+ }
+ 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: Proof: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: Proof: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field EthereumProof", wireType)
+ }
+ var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCommon
@@ -594,11 +1404,27 @@ func (m *Chain) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
- m.ChainId |= int64(b&0x7F) << shift
+ msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
+ if msglen < 0 {
+ return ErrInvalidLengthCommon
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthCommon
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ v := ðereum.Proof{}
+ if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ m.Proof = &Proof_EthereumProof{v}
+ iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipCommon(dAtA[iNdEx:])
diff --git a/common/default_chains_mainnet.go b/common/default_chains_mainnet.go
index c57cd2f1be..18868b5a13 100644
--- a/common/default_chains_mainnet.go
+++ b/common/default_chains_mainnet.go
@@ -1,5 +1,5 @@
-//go:build !PRIVNET && !TESTNET
-// +build !PRIVNET,!TESTNET
+//go:build !PRIVNET && !TESTNET && !MOCK_MAINNET
+// +build !PRIVNET,!TESTNET,!MOCK_MAINNET
package common
@@ -20,7 +20,7 @@ func BscMainnetChain() Chain {
func ZetaChain() Chain {
return Chain{
ChainName: ChainName_zeta_mainnet,
- ChainId: 101,
+ ChainId: 7000,
}
}
@@ -41,7 +41,6 @@ func PolygonChain() Chain {
func DefaultChainsList() []*Chain {
chains := []Chain{
BtcMainnetChain(),
- PolygonChain(),
BscMainnetChain(),
EthChain(),
ZetaChain(),
@@ -52,3 +51,16 @@ func DefaultChainsList() []*Chain {
}
return c
}
+
+func ExternalChainList() []*Chain {
+ chains := []Chain{
+ BtcMainnetChain(),
+ BscMainnetChain(),
+ EthChain(),
+ }
+ var c []*Chain
+ for i := 0; i < len(chains); i++ {
+ c = append(c, &chains[i])
+ }
+ return c
+}
diff --git a/common/default_chains_mock_mainnet.go b/common/default_chains_mock_mainnet.go
new file mode 100644
index 0000000000..6498ed087e
--- /dev/null
+++ b/common/default_chains_mock_mainnet.go
@@ -0,0 +1,66 @@
+//go:build MOCK_MAINNET
+// +build MOCK_MAINNET
+
+package common
+
+func EthChain() Chain {
+ return Chain{
+ ChainName: ChainName_eth_mainnet,
+ ChainId: 1,
+ }
+}
+
+func BscMainnetChain() Chain {
+ return Chain{
+ ChainName: ChainName_bsc_mainnet,
+ ChainId: 56,
+ }
+}
+
+func ZetaChain() Chain {
+ return Chain{
+ ChainName: ChainName_zeta_mainnet,
+ ChainId: 70000,
+ }
+}
+
+func BtcMainnetChain() Chain {
+ return Chain{
+ ChainName: ChainName_btc_mainnet,
+ ChainId: 8332,
+ }
+}
+
+func PolygonChain() Chain {
+ return Chain{
+ ChainName: ChainName_polygon_mainnet,
+ ChainId: 137,
+ }
+}
+
+func DefaultChainsList() []*Chain {
+ chains := []Chain{
+ BtcMainnetChain(),
+ BscMainnetChain(),
+ EthChain(),
+ ZetaChain(),
+ }
+ var c []*Chain
+ for i := 0; i < len(chains); i++ {
+ c = append(c, &chains[i])
+ }
+ return c
+}
+
+func ExternalChainList() []*Chain {
+ chains := []Chain{
+ BtcMainnetChain(),
+ BscMainnetChain(),
+ EthChain(),
+ }
+ var c []*Chain
+ for i := 0; i < len(chains); i++ {
+ c = append(c, &chains[i])
+ }
+ return c
+}
diff --git a/common/default_chains_privnet.go b/common/default_chains_privnet.go
index 328799d7c8..f415cc0af7 100644
--- a/common/default_chains_privnet.go
+++ b/common/default_chains_privnet.go
@@ -36,3 +36,15 @@ func DefaultChainsList() []*Chain {
}
return c
}
+
+func ExternalChainList() []*Chain {
+ chains := []Chain{
+ BtcRegtestChain(),
+ GoerliChain(),
+ }
+ var c []*Chain
+ for i := 0; i < len(chains); i++ {
+ c = append(c, &chains[i])
+ }
+ return c
+}
diff --git a/common/default_chains_testnet.go b/common/default_chains_testnet.go
index 23942c1e22..74473464ca 100644
--- a/common/default_chains_testnet.go
+++ b/common/default_chains_testnet.go
@@ -52,3 +52,17 @@ func DefaultChainsList() []*Chain {
}
return c
}
+
+func ExternalChainList() []*Chain {
+ chains := []Chain{
+ BtcTestNetChain(),
+ MumbaiChain(),
+ BscTestnetChain(),
+ GoerliChain(),
+ }
+ var c []*Chain
+ for i := 0; i < len(chains); i++ {
+ c = append(c, &chains[i])
+ }
+ return c
+}
diff --git a/common/ethereum/ethereum.pb.go b/common/ethereum/ethereum.pb.go
new file mode 100644
index 0000000000..8dd8096019
--- /dev/null
+++ b/common/ethereum/ethereum.pb.go
@@ -0,0 +1,374 @@
+// Code generated by protoc-gen-gogo. DO NOT EDIT.
+// source: common/ethereum/ethereum.proto
+
+package ethereum
+
+import (
+ fmt "fmt"
+ io "io"
+ math "math"
+ math_bits "math/bits"
+
+ proto "github.com/gogo/protobuf/proto"
+)
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
+
+type Proof struct {
+ Keys [][]byte `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"`
+ Values [][]byte `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"`
+}
+
+func (m *Proof) Reset() { *m = Proof{} }
+func (m *Proof) String() string { return proto.CompactTextString(m) }
+func (*Proof) ProtoMessage() {}
+func (*Proof) Descriptor() ([]byte, []int) {
+ return fileDescriptor_93e74b59a4555c70, []int{0}
+}
+func (m *Proof) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *Proof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_Proof.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 *Proof) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Proof.Merge(m, src)
+}
+func (m *Proof) XXX_Size() int {
+ return m.Size()
+}
+func (m *Proof) XXX_DiscardUnknown() {
+ xxx_messageInfo_Proof.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Proof proto.InternalMessageInfo
+
+func (m *Proof) GetKeys() [][]byte {
+ if m != nil {
+ return m.Keys
+ }
+ return nil
+}
+
+func (m *Proof) GetValues() [][]byte {
+ if m != nil {
+ return m.Values
+ }
+ return nil
+}
+
+func init() {
+ proto.RegisterType((*Proof)(nil), "ethereum.Proof")
+}
+
+func init() { proto.RegisterFile("common/ethereum/ethereum.proto", fileDescriptor_93e74b59a4555c70) }
+
+var fileDescriptor_93e74b59a4555c70 = []byte{
+ // 159 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xce, 0xcf, 0xcd,
+ 0xcd, 0xcf, 0xd3, 0x4f, 0x2d, 0xc9, 0x48, 0x2d, 0x4a, 0x2d, 0xcd, 0x85, 0x33, 0xf4, 0x0a, 0x8a,
+ 0xf2, 0x4b, 0xf2, 0x85, 0x38, 0x60, 0x7c, 0x25, 0x63, 0x2e, 0xd6, 0x80, 0xa2, 0xfc, 0xfc, 0x34,
+ 0x21, 0x21, 0x2e, 0x96, 0xec, 0xd4, 0xca, 0x62, 0x09, 0x46, 0x05, 0x66, 0x0d, 0x9e, 0x20, 0x30,
+ 0x5b, 0x48, 0x8c, 0x8b, 0xad, 0x2c, 0x31, 0xa7, 0x34, 0xb5, 0x58, 0x82, 0x09, 0x2c, 0x0a, 0xe5,
+ 0x39, 0x79, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13,
+ 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x5e, 0x7a, 0x66,
+ 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x55, 0x6a, 0x49, 0xa2, 0x6e, 0x72, 0x46,
+ 0x62, 0x66, 0x1e, 0x98, 0x99, 0x9c, 0x5f, 0x94, 0xaa, 0x8f, 0xe6, 0xae, 0x24, 0x36, 0xb0, 0x7b,
+ 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x31, 0x9b, 0x72, 0x4f, 0xb1, 0x00, 0x00, 0x00,
+}
+
+func (m *Proof) 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 *Proof) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *Proof) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if len(m.Values) > 0 {
+ for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- {
+ i -= len(m.Values[iNdEx])
+ copy(dAtA[i:], m.Values[iNdEx])
+ i = encodeVarintEthereum(dAtA, i, uint64(len(m.Values[iNdEx])))
+ i--
+ dAtA[i] = 0x12
+ }
+ }
+ if len(m.Keys) > 0 {
+ for iNdEx := len(m.Keys) - 1; iNdEx >= 0; iNdEx-- {
+ i -= len(m.Keys[iNdEx])
+ copy(dAtA[i:], m.Keys[iNdEx])
+ i = encodeVarintEthereum(dAtA, i, uint64(len(m.Keys[iNdEx])))
+ i--
+ dAtA[i] = 0xa
+ }
+ }
+ return len(dAtA) - i, nil
+}
+
+func encodeVarintEthereum(dAtA []byte, offset int, v uint64) int {
+ offset -= sovEthereum(v)
+ base := offset
+ for v >= 1<<7 {
+ dAtA[offset] = uint8(v&0x7f | 0x80)
+ v >>= 7
+ offset++
+ }
+ dAtA[offset] = uint8(v)
+ return base
+}
+func (m *Proof) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if len(m.Keys) > 0 {
+ for _, b := range m.Keys {
+ l = len(b)
+ n += 1 + l + sovEthereum(uint64(l))
+ }
+ }
+ if len(m.Values) > 0 {
+ for _, b := range m.Values {
+ l = len(b)
+ n += 1 + l + sovEthereum(uint64(l))
+ }
+ }
+ return n
+}
+
+func sovEthereum(x uint64) (n int) {
+ return (math_bits.Len64(x|1) + 6) / 7
+}
+func sozEthereum(x uint64) (n int) {
+ return sovEthereum(uint64((x << 1) ^ uint64((int64(x) >> 63))))
+}
+func (m *Proof) 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 ErrIntOverflowEthereum
+ }
+ 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: Proof: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: Proof: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Keys", wireType)
+ }
+ var byteLen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowEthereum
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ byteLen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if byteLen < 0 {
+ return ErrInvalidLengthEthereum
+ }
+ postIndex := iNdEx + byteLen
+ if postIndex < 0 {
+ return ErrInvalidLengthEthereum
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Keys = append(m.Keys, make([]byte, postIndex-iNdEx))
+ copy(m.Keys[len(m.Keys)-1], dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType)
+ }
+ var byteLen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowEthereum
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ byteLen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if byteLen < 0 {
+ return ErrInvalidLengthEthereum
+ }
+ postIndex := iNdEx + byteLen
+ if postIndex < 0 {
+ return ErrInvalidLengthEthereum
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Values = append(m.Values, make([]byte, postIndex-iNdEx))
+ copy(m.Values[len(m.Values)-1], dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipEthereum(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthEthereum
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func skipEthereum(dAtA []byte) (n int, err error) {
+ l := len(dAtA)
+ iNdEx := 0
+ depth := 0
+ for iNdEx < l {
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return 0, ErrIntOverflowEthereum
+ }
+ if iNdEx >= l {
+ return 0, io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= (uint64(b) & 0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ wireType := int(wire & 0x7)
+ switch wireType {
+ case 0:
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return 0, ErrIntOverflowEthereum
+ }
+ if iNdEx >= l {
+ return 0, io.ErrUnexpectedEOF
+ }
+ iNdEx++
+ if dAtA[iNdEx-1] < 0x80 {
+ break
+ }
+ }
+ case 1:
+ iNdEx += 8
+ case 2:
+ var length int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return 0, ErrIntOverflowEthereum
+ }
+ if iNdEx >= l {
+ return 0, io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ length |= (int(b) & 0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if length < 0 {
+ return 0, ErrInvalidLengthEthereum
+ }
+ iNdEx += length
+ case 3:
+ depth++
+ case 4:
+ if depth == 0 {
+ return 0, ErrUnexpectedEndOfGroupEthereum
+ }
+ depth--
+ case 5:
+ iNdEx += 4
+ default:
+ return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
+ }
+ if iNdEx < 0 {
+ return 0, ErrInvalidLengthEthereum
+ }
+ if depth == 0 {
+ return iNdEx, nil
+ }
+ }
+ return 0, io.ErrUnexpectedEOF
+}
+
+var (
+ ErrInvalidLengthEthereum = fmt.Errorf("proto: negative length found during unmarshaling")
+ ErrIntOverflowEthereum = fmt.Errorf("proto: integer overflow")
+ ErrUnexpectedEndOfGroupEthereum = fmt.Errorf("proto: unexpected end of group")
+)
diff --git a/common/ethereum/proof.go b/common/ethereum/proof.go
new file mode 100644
index 0000000000..6d457bc444
--- /dev/null
+++ b/common/ethereum/proof.go
@@ -0,0 +1,178 @@
+// This file was adapted from go-ethereum. Here's the go-ethereum license reproduced:
+
+// Copyright 2014 The go-ethereum Authors
+// This file is part of the go-ethereum library.
+//
+// The go-ethereum library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// The go-ethereum library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with the go-ethereum library. If not, see .
+
+// Package trie implements Merkle Patricia Tries.
+
+package ethereum
+
+import (
+ "bytes"
+ "errors"
+ "sync"
+
+ "github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/rlp"
+ "github.com/ethereum/go-ethereum/trie"
+)
+
+func NewProof() *Proof {
+ return &Proof{
+ Keys: make([][]byte, 0),
+ Values: make([][]byte, 0),
+ }
+}
+
+func (m *Proof) Put(key []byte, value []byte) error {
+ for i := 0; i < len(m.Keys); i++ {
+ if bytes.Equal(m.Keys[i], key) {
+ m.Values[i] = value
+ return nil
+ }
+ }
+ m.Keys = append(m.Keys, key)
+ m.Values = append(m.Values, value)
+
+ return nil
+}
+
+func (m *Proof) Delete(key []byte) error {
+ found := false
+ index := -1
+ for i := 0; i < len(m.Keys); i++ {
+ if bytes.Equal(m.Keys[i], key) {
+ found = true
+ index = i
+ break
+ }
+ }
+ if !found {
+ return errors.New("key not found")
+ }
+ copy(m.Keys[index:len(m.Keys)-1], m.Keys[index+1:])
+ copy(m.Values[index:len(m.Values)-1], m.Values[index+1:])
+ m.Keys = m.Keys[:len(m.Keys)-1]
+ m.Values = m.Values[:len(m.Values)-1]
+
+ return nil
+}
+
+func (m *Proof) Has(key []byte) (bool, error) {
+ for i := 0; i < len(m.Keys); i++ {
+ if bytes.Equal(m.Keys[i], key) {
+
+ return true, nil
+ }
+ }
+ return false, nil
+}
+
+func (m *Proof) Get(key []byte) ([]byte, error) {
+ found := false
+ index := -1
+ for i := 0; i < len(m.Keys); i++ {
+ if bytes.Equal(m.Keys[i], key) {
+ found = true
+ index = i
+ break
+ }
+ }
+ if !found {
+ return nil, errors.New("key not found")
+ }
+
+ return m.Values[index], nil
+}
+
+// Verify verifies the proof against the given root hash and key.
+// Typically, the rootHash is from a trusted source (e.g. a trusted block header),
+// and the key is the index of the transaction in the block.
+func (m *Proof) Verify(rootHash common.Hash, key int) ([]byte, error) {
+ if key < 0 {
+ return nil, errors.New("key not found")
+ }
+ var indexBuf []byte
+ // #nosec G701 range is valid
+ indexBuf = rlp.AppendUint64(indexBuf[:0], uint64(key))
+ return trie.VerifyProof(rootHash, indexBuf, m)
+}
+
+type Trie struct {
+ *trie.Trie
+}
+
+var encodeBufferPool = sync.Pool{
+ New: func() interface{} { return new(bytes.Buffer) },
+}
+
+func encodeForDerive(list types.DerivableList, i int, buf *bytes.Buffer) []byte {
+ buf.Reset()
+ list.EncodeIndex(i, buf)
+ // It's really unfortunate that we need to do perform this copy.
+ // StackTrie holds onto the values until Hash is called, so the values
+ // written to it must not alias.
+ return common.CopyBytes(buf.Bytes())
+}
+
+func (t *Trie) GenerateProof(txIndex int) (*Proof, error) {
+ if txIndex < 0 {
+ return nil, errors.New("transaction index out of range")
+ }
+ var indexBuf []byte
+ // #nosec G701 checked as non-negative
+ indexBuf = rlp.AppendUint64(indexBuf[:0], uint64(txIndex))
+ proof := NewProof()
+ err := t.Prove(indexBuf, 0, proof)
+ if err != nil {
+ return nil, err
+ }
+ return proof, nil
+}
+
+// NewTrie builds a trie from a DerivableList. The DerivableList must be types.Transactions
+// or types.Receipts.
+func NewTrie(list types.DerivableList) Trie {
+ hasher := new(trie.Trie)
+ hasher.Reset()
+
+ valueBuf := encodeBufferPool.Get().(*bytes.Buffer)
+ defer encodeBufferPool.Put(valueBuf)
+
+ // StackTrie requires values to be inserted in increasing hash order, which is not the
+ // order that `list` provides hashes in. This insertion sequence ensures that the
+ // order is correct.
+ var indexBuf []byte
+ for i := 1; i < list.Len() && i <= 0x7f; i++ {
+ // #nosec G701 iterator
+ indexBuf = rlp.AppendUint64(indexBuf[:0], uint64(i))
+ value := encodeForDerive(list, i, valueBuf)
+ hasher.Update(indexBuf, value)
+ }
+ if list.Len() > 0 {
+ indexBuf = rlp.AppendUint64(indexBuf[:0], 0)
+ value := encodeForDerive(list, 0, valueBuf)
+ hasher.Update(indexBuf, value)
+ }
+ for i := 0x80; i < list.Len(); i++ {
+ // #nosec G701 iterator
+ indexBuf = rlp.AppendUint64(indexBuf[:0], uint64(i))
+ value := encodeForDerive(list, i, valueBuf)
+ hasher.Update(indexBuf, value)
+ }
+ return Trie{hasher}
+}
diff --git a/common/ethereum/proof_test.go b/common/ethereum/proof_test.go
new file mode 100644
index 0000000000..14a153ffc7
--- /dev/null
+++ b/common/ethereum/proof_test.go
@@ -0,0 +1,125 @@
+package ethereum
+
+import (
+ "context"
+ "math/big"
+ "testing"
+ "time"
+
+ "github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/ethclient"
+ "github.com/ethereum/go-ethereum/rlp"
+ "github.com/ethereum/go-ethereum/trie"
+)
+
+func TestProofGeneration(t *testing.T) {
+ RPC_URL := "https://rpc.ankr.com/eth_goerli"
+ client, err := ethclient.Dial(RPC_URL)
+ if err != nil {
+ t.Fatal(err)
+ }
+ bn := int64(9509129)
+ block, err := client.BlockByNumber(context.Background(), big.NewInt(bn))
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ headerRLP, _ := rlp.EncodeToBytes(block.Header())
+ t.Logf("block header size %d\n", len(headerRLP))
+
+ var header types.Header
+ rlp.DecodeBytes(headerRLP, &header)
+
+ t.Logf("block %d\n", block.Number())
+ t.Logf(" tx root %x\n", header.TxHash)
+
+ //ttt := new(trie.Trie)
+ tr := NewTrie(block.Transactions())
+ t.Logf(" sha2 %x\n", tr.Hash())
+ if tr.Hash() != header.TxHash {
+ t.Fatal("tx root mismatch")
+ } else {
+ t.Logf(" tx root hash & block tx root match\n")
+ }
+
+ var indexBuf []byte
+ for i := 0; i < len(block.Transactions()); i++ {
+
+ indexBuf = rlp.AppendUint64(indexBuf[:0], uint64(i))
+
+ proof := NewProof()
+ tr.Prove(indexBuf, 0, proof)
+ t.Logf("proof len %d\n", len(proof.Keys))
+ value, err := proof.Verify(block.Header().TxHash, i)
+ //value, err := trie.VerifyProof(tr.trie.Hash(), indexBuf, proof)
+ t.Logf("pass? %v\n", err == nil)
+ //t.Logf("value %x\n", value)
+
+ var txx types.Transaction
+ txx.UnmarshalBinary(value)
+ t.Logf(" tx %+v\n", txx.To().Hex())
+ t.Logf(" tx hash %+v\n", txx.Hash().Hex())
+ if txx.Hash() != block.Transactions()[i].Hash() {
+ t.Fatal("tx hash mismatch")
+ } else {
+ t.Logf(" tx hash & block tx hash match\n")
+ }
+ signer := types.NewLondonSigner(txx.ChainId())
+ sender, err := types.Sender(signer, &txx)
+ t.Logf(" tx from %s\n", sender.Hex())
+ }
+
+ //for k, v := range proof.Proof {
+ // key, _ := base64.StdEncoding.DecodeString(k)
+ // t.Logf("k: %x, v: %x\n", key, v)
+ //}
+
+ {
+ var receipts types.Receipts
+ for _, tx := range block.Transactions() {
+ receipt, err := client.TransactionReceipt(context.Background(), tx.Hash())
+ if err != nil {
+ t.Fatal(err)
+ }
+ receipts = append(receipts, receipt)
+ time.Sleep(200 * time.Millisecond)
+ }
+
+ receiptTree := NewTrie(receipts)
+ t.Logf(" block receipt root %x\n", block.Header().ReceiptHash)
+ t.Logf(" receipt tree root %x\n", receiptTree.Hash())
+ if receiptTree.Hash() != block.Header().ReceiptHash {
+ t.Fatal("receipt root mismatch")
+ } else {
+ t.Logf(" receipt root hash & block receipt root match\n")
+ }
+
+ i := 1
+ proof := NewProof()
+ indexBuf = rlp.AppendUint64(indexBuf[:0], uint64(i))
+ err = receiptTree.Prove(indexBuf, 0, proof)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ // NOTE: eth receipts only hashes the following fields
+ // data := &receiptRLP{r.statusEncoding(), r.CumulativeGasUsed, r.Bloom, r.Logs}
+ value, err := trie.VerifyProof(block.Header().ReceiptHash, indexBuf, proof)
+ t.Logf("pass? %v\n", err == nil)
+ t.Logf("value %x\n", value)
+ value, err = proof.Verify(block.Header().ReceiptHash, i)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ var receipt types.Receipt
+ receipt.UnmarshalBinary(value)
+
+ t.Logf(" receipt %+v\n", receipt)
+ t.Logf(" receipt tx hash %+v\n", receipt.TxHash.Hex())
+
+ for _, log := range receipt.Logs {
+ t.Logf(" log %+v\n", log)
+ }
+ }
+}
diff --git a/common/headers.go b/common/headers.go
new file mode 100644
index 0000000000..e05a3f0c18
--- /dev/null
+++ b/common/headers.go
@@ -0,0 +1,68 @@
+package common
+
+import (
+ "bytes"
+ "encoding/hex"
+ "errors"
+ "fmt"
+
+ ethtypes "github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/rlp"
+)
+
+// NewEthereumHeader returns a new HeaderData containing an Ethereum header
+func NewEthereumHeader(header []byte) HeaderData {
+ return HeaderData{
+ Data: &HeaderData_EthereumHeader{
+ EthereumHeader: header,
+ },
+ }
+}
+
+// ParentHash extracts the parent hash from the header
+func (h HeaderData) ParentHash() ([]byte, error) {
+ switch data := h.Data.(type) {
+ case *HeaderData_EthereumHeader:
+ var header ethtypes.Header
+ if err := rlp.DecodeBytes(data.EthereumHeader, &header); err != nil {
+ return nil, err
+ }
+ return header.ParentHash.Bytes(), nil
+ default:
+ return nil, errors.New("unrecognized header type")
+ }
+}
+
+// Validate performs a basic validation of the HeaderData
+func (h HeaderData) Validate(blockHash []byte, height int64) error {
+ switch data := h.Data.(type) {
+ case *HeaderData_EthereumHeader:
+ return validateEthereumHeader(data.EthereumHeader, blockHash, height)
+ default:
+ return errors.New("unrecognized header type")
+ }
+}
+
+// validateEthereumHeader performs a basic validation of the Ethereum header
+func validateEthereumHeader(headerBytes []byte, blockHash []byte, height int64) error {
+ // on ethereum the block header is ~538 bytes in RLP encoding
+ if len(headerBytes) > 1024 {
+ return fmt.Errorf("header too long (%d)", len(headerBytes))
+ }
+
+ // RLP encoded block header
+ var header ethtypes.Header
+ if err := rlp.DecodeBytes(headerBytes, &header); err != nil {
+ return fmt.Errorf("cannot decode RLP (%s)", err)
+ }
+ if err := header.SanityCheck(); err != nil {
+ return fmt.Errorf("sanity check failed (%s)", err)
+ }
+ if bytes.Compare(blockHash, header.Hash().Bytes()) != 0 {
+ return fmt.Errorf("tx hash mismatch (%s) vs (%s)", hex.EncodeToString(blockHash), header.Hash().Hex())
+ }
+ if height != header.Number.Int64() {
+ return fmt.Errorf("height mismatch (%d) vs (%d)", height, header.Number.Int64())
+ }
+ return nil
+}
diff --git a/common/proof.go b/common/proof.go
new file mode 100644
index 0000000000..615c39b1f5
--- /dev/null
+++ b/common/proof.go
@@ -0,0 +1,61 @@
+package common
+
+import (
+ "errors"
+
+ ethtypes "github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/rlp"
+ "github.com/zeta-chain/zetacore/common/ethereum"
+)
+
+// ErrInvalidProof is a error type for invalid proofs embedding the underlying error
+type ErrInvalidProof struct {
+ Err error
+}
+
+func NewErrInvalidProof(err error) ErrInvalidProof {
+ return ErrInvalidProof{
+ Err: err,
+ }
+}
+
+func (e ErrInvalidProof) Error() string {
+ return e.Err.Error()
+}
+
+// IsErrorInvalidProof returns true if the error is an ErrInvalidProof
+func IsErrorInvalidProof(err error) bool {
+ return errors.As(err, &ErrInvalidProof{})
+}
+
+// NewEthereumProof returns a new Proof containing an Ethereum proof
+func NewEthereumProof(proof *ethereum.Proof) *Proof {
+ return &Proof{
+ Proof: &Proof_EthereumProof{
+ EthereumProof: proof,
+ },
+ }
+}
+
+// Verify verifies the proof against the header
+func (p Proof) Verify(headerData HeaderData, txIndex int) ([]byte, error) {
+ switch proof := p.Proof.(type) {
+ case *Proof_EthereumProof:
+ ethHeaderBytes := headerData.GetEthereumHeader()
+ if ethHeaderBytes == nil {
+ return nil, errors.New("can't verify ethereum proof against non-ethereum header")
+ }
+ var ethHeader ethtypes.Header
+ err := rlp.DecodeBytes(ethHeaderBytes, ðHeader)
+ if err != nil {
+ return nil, err
+ }
+ val, err := proof.EthereumProof.Verify(ethHeader.TxHash, txIndex)
+ if err != nil {
+ return nil, NewErrInvalidProof(err)
+ }
+ return val, nil
+ default:
+ return nil, errors.New("unrecognized proof type")
+ }
+}
diff --git a/common/proof_test.go b/common/proof_test.go
new file mode 100644
index 0000000000..0615407684
--- /dev/null
+++ b/common/proof_test.go
@@ -0,0 +1,15 @@
+package common_test
+
+import (
+ "errors"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+ "github.com/zeta-chain/zetacore/common"
+)
+
+func Test_IsErrorInvalidProof(t *testing.T) {
+ require.False(t, common.IsErrorInvalidProof(nil))
+ require.False(t, common.IsErrorInvalidProof(errors.New("foo")))
+ require.True(t, common.IsErrorInvalidProof(common.NewErrInvalidProof(errors.New("foo"))))
+}
diff --git a/contrib/localnet/docker-compose-stateful.yml b/contrib/localnet/docker-compose-stateful.yml
new file mode 100644
index 0000000000..d577d96b2d
--- /dev/null
+++ b/contrib/localnet/docker-compose-stateful.yml
@@ -0,0 +1,109 @@
+version: "3"
+
+networks:
+ mynetwork:
+ ipam:
+ config:
+ - subnet: 172.20.0.0/24
+
+
+services:
+ zetacore0:
+ image: zetanode:latest
+ container_name: zetacore0
+ build:
+ context: ../../.
+ dockerfile: Dockerfile
+ hostname: zetacore0
+ ports:
+ - "1317:1317"
+ - "9545:8545"
+ - "9546:8546"
+ networks:
+ mynetwork:
+ ipv4_address: 172.20.0.11
+ entrypoint: ["/root/genesis-stateful.sh", "2"] # Need to specify that there are 2 nodes
+
+
+ zetacore1:
+ image: zetanode:latest
+ container_name: zetacore1
+ build:
+ context: ../../.
+ dockerfile: Dockerfile
+ hostname: zetacore1
+ networks:
+ mynetwork:
+ ipv4_address: 172.20.0.12
+ entrypoint: ["/root/genesis-stateful.sh", "2"]
+
+ zetaclient0:
+ image: zetanode:latest
+ container_name: zetaclient0
+ build:
+ context: ../../.
+ dockerfile: Dockerfile
+ hostname: zetaclient0
+ networks:
+ mynetwork:
+ ipv4_address: 172.20.0.21
+ entrypoint: /root/start-zetaclientd-background.sh
+ environment:
+ - ETHDEV_ENDPOINT=http://eth:8545
+
+ zetaclient1:
+ image: zetanode:latest
+ container_name: zetaclient1
+ build:
+ context: ../../.
+ dockerfile: Dockerfile
+ hostname: zetaclient1
+ networks:
+ mynetwork:
+ ipv4_address: 172.20.0.22
+ entrypoint: /root/start-zetaclientd-background.sh
+ environment:
+ - ETHDEV_ENDPOINT=http://eth:8545
+
+ bitcoin:
+ image: ruimarinho/bitcoin-core:22 # version 23 is not working with btcd 0.22.0 due to change in createwallet rpc
+ container_name: bitcoin
+ hostname: bitcoin
+ networks:
+ mynetwork:
+ ipv4_address: 172.20.0.101
+ ports:
+ - "18443:18443"
+ command:
+ -printtoconsole
+ -regtest=1
+ -rpcallowip=172.20.0.0/16
+ -rpcbind=0.0.0.0
+ -rpcauth=smoketest:63acf9b8dccecce914d85ff8c044b78b$$5892f9bbc84f4364e79f0970039f88bdd823f168d4acc76099ab97b14a766a99
+ -txindex=1
+
+ eth:
+ image: ethereum/client-go:v1.10.26
+ container_name: eth
+ hostname: eth
+ ports:
+ - "8545:8545"
+ networks:
+ mynetwork:
+ ipv4_address: 172.20.0.100
+ entrypoint: [ "geth", "--dev", "--http", "--http.addr", "172.20.0.100", "--http.vhosts", "*", "--http.api", "eth,web3,net", "--http.corsdomain", "https://remix.ethereum.org", "--dev.period", "2" ]
+
+ orchestrator:
+ image: orchestrator:latest
+ container_name: orchestrator
+ build:
+ context: ../../.
+ dockerfile: contrib/localnet/orchestrator/Dockerfile
+ depends_on:
+ - zetacore0
+ - eth
+ hostname: orchestrator
+ networks:
+ mynetwork:
+ ipv4_address: 172.20.0.2
+ entrypoint: [ "/work/start-upgrade.sh", "local"]
diff --git a/contrib/localnet/orchestrator/Dockerfile b/contrib/localnet/orchestrator/Dockerfile
index 3d04384ee3..e57670b3d6 100644
--- a/contrib/localnet/orchestrator/Dockerfile
+++ b/contrib/localnet/orchestrator/Dockerfile
@@ -1,8 +1,8 @@
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
+RUN apk --no-cache add jq curl bash make git build-base openssh
COPY --from=zeta /usr/local/bin/zetacored /usr/local/bin/
COPY --from=zeta /usr/local/bin/zetaclientd /usr/local/bin/
@@ -12,7 +12,9 @@ COPY --from=zeta /root/.ssh/localtest.pem.pub /root/.ssh/authorized_keys
COPY --from=zeta /root/.ssh/localtest.pem /root/.ssh/localtest.pem
COPY contrib/localnet/orchestrator/start.sh /work/
-RUN chmod +x /work/start.sh
+COPY contrib/localnet/orchestrator/start-upgrade.sh /work/
+COPY contrib/localnet/orchestrator/restart-zetaclientd.sh /work/
+RUN chmod +x /work/*.sh
ENV GOPATH /go
ENV GOOS=linux
diff --git a/contrib/localnet/orchestrator/Dockerfile-upgrade.fastbuild b/contrib/localnet/orchestrator/Dockerfile-upgrade.fastbuild
new file mode 100644
index 0000000000..3fb6b69e67
--- /dev/null
+++ b/contrib/localnet/orchestrator/Dockerfile-upgrade.fastbuild
@@ -0,0 +1,24 @@
+FROM zetanode:latest as zeta
+FROM ethereum/client-go:v1.10.26 as geth
+FROM golang:1.20-alpine as orchestrator
+
+RUN apk --no-cache add jq curl bash make git build-base openssh
+
+COPY --from=zeta /usr/local/bin/zetacored /usr/local/bin/
+COPY --from=zeta /usr/local/bin/zetaclientd /usr/local/bin/
+COPY --from=geth /usr/local/bin/geth /usr/local/bin/
+
+COPY --from=zeta /root/.ssh/localtest.pem.pub /root/.ssh/authorized_keys
+COPY --from=zeta /root/.ssh/localtest.pem /root/.ssh/localtest.pem
+
+COPY contrib/localnet/orchestrator/start.sh /work/
+COPY contrib/localnet/orchestrator/start-upgrade.sh /work/
+COPY contrib/localnet/orchestrator/restart-zetaclientd.sh /work/
+RUN chmod +x /work/*.sh
+
+
+COPY --from=zeta /go/bin/old/smoketest /usr/local/bin/smoketest-old
+COPY --from=zeta /go/bin/new/smoketest /usr/local/bin/smoketest-new
+RUN chmod +x /usr/local/bin/smoketest-*
+
+WORKDIR /work
diff --git a/contrib/localnet/orchestrator/Dockerfile.fastbuild b/contrib/localnet/orchestrator/Dockerfile.fastbuild
index b7e86eb396..20cd3d1f56 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
@@ -18,4 +18,4 @@ RUN chmod +x /work/start.sh
COPY --from=zeta /usr/local/bin/smoketest /usr/local/bin/
RUN chmod +x /usr/local/bin/smoketest
-WORKDIR /work
+WORKDIR /work
\ No newline at end of file
diff --git a/contrib/localnet/orchestrator/restart-zetaclientd.sh b/contrib/localnet/orchestrator/restart-zetaclientd.sh
new file mode 100644
index 0000000000..d5f8b1becc
--- /dev/null
+++ b/contrib/localnet/orchestrator/restart-zetaclientd.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+clibuilder()
+{
+ echo ""
+ echo "Usage: $0 -u UPGRADE_HEIGHT"
+ echo -e "\t-u Height of upgrade, should match governance proposal"
+ echo -e "\t-n Number of clients in the network"
+ exit 1 # Exit script after printing help
+}
+
+while getopts "u:n:" opt
+do
+ case "$opt" in
+ u ) UPGRADE_HEIGHT="$OPTARG" ;;
+ n ) NUM_OF_NODES="$OPTARG" ;;
+ ? ) clibuilder ;; # Print cliBuilder in case parameter is non-existent
+ esac
+done
+
+# generate client list
+START=0
+END=$((NUM_OF_NODES-1))
+CLIENT_LIST=()
+for i in $(eval echo "{$START..$END}")
+do
+ CLIENT_LIST+=("zetaclient$i")
+done
+
+echo "$UPGRADE_HEIGHT"
+
+CURRENT_HEIGHT=0
+
+while [[ $CURRENT_HEIGHT -lt $UPGRADE_HEIGHT ]]
+do
+ CURRENT_HEIGHT=$(curl zetacore0:26657/status | jq '.result.sync_info.latest_block_height' | tr -d '"')
+ sleep 5
+done
+
+echo current height is "$CURRENT_HEIGHT", restarting zetaclients
+for NODE in "${CLIENT_LIST[@]}"; do
+ ssh -o "StrictHostKeyChecking no" "$NODE" -i ~/.ssh/localtest.pem killall zetaclientd
+ ssh -o "StrictHostKeyChecking no" "$NODE" -i ~/.ssh/localtest.pem "$GOPATH/bin/new/zetaclientd start < /dev/null > $HOME/zetaclient.log 2>&1 &"
+done
diff --git a/contrib/localnet/orchestrator/smoketest/contracts/testzrc20/TestZRC20.abi b/contrib/localnet/orchestrator/smoketest/contracts/testzrc20/TestZRC20.abi
new file mode 100644
index 0000000000..ec8cc79f66
--- /dev/null
+++ b/contrib/localnet/orchestrator/smoketest/contracts/testzrc20/TestZRC20.abi
@@ -0,0 +1,670 @@
+[
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "chainid_",
+ "type": "uint256"
+ },
+ {
+ "internalType": "enum CoinType",
+ "name": "coinType_",
+ "type": "uint8"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ },
+ {
+ "inputs": [],
+ "name": "CallerIsNotFungibleModule",
+ "type": "error"
+ },
+ {
+ "inputs": [],
+ "name": "GasFeeTransferFailed",
+ "type": "error"
+ },
+ {
+ "inputs": [],
+ "name": "InvalidSender",
+ "type": "error"
+ },
+ {
+ "inputs": [],
+ "name": "LowAllowance",
+ "type": "error"
+ },
+ {
+ "inputs": [],
+ "name": "LowBalance",
+ "type": "error"
+ },
+ {
+ "inputs": [],
+ "name": "ZeroAddress",
+ "type": "error"
+ },
+ {
+ "inputs": [],
+ "name": "ZeroGasCoin",
+ "type": "error"
+ },
+ {
+ "inputs": [],
+ "name": "ZeroGasPrice",
+ "type": "error"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "spender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Approval",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "internalType": "bytes",
+ "name": "from",
+ "type": "bytes"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "to",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Deposit",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "from",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "to",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "gasLimit",
+ "type": "uint256"
+ }
+ ],
+ "name": "UpdatedGasLimit",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "protocolFlatFee",
+ "type": "uint256"
+ }
+ ],
+ "name": "UpdatedProtocolFlatFee",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "internalType": "address",
+ "name": "systemContract",
+ "type": "address"
+ }
+ ],
+ "name": "UpdatedSystemContract",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "from",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "bytes",
+ "name": "to",
+ "type": "bytes"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "gasfee",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "protocolFlatFee",
+ "type": "uint256"
+ }
+ ],
+ "name": "Withdrawal",
+ "type": "event"
+ },
+ {
+ "inputs": [],
+ "name": "CHAIN_ID",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "COIN_TYPE",
+ "outputs": [
+ {
+ "internalType": "enum CoinType",
+ "name": "",
+ "type": "uint8"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "FUNGIBLE_MODULE_ADDRESS",
+ "outputs": [
+ {
+ "internalType": "address",
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "GAS_LIMIT",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "PROTOCOL_FLAT_FEE",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "SYSTEM_CONTRACT_ADDRESS",
+ "outputs": [
+ {
+ "internalType": "address",
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "owner",
+ "type": "address"
+ },
+ {
+ "internalType": "address",
+ "name": "spender",
+ "type": "address"
+ }
+ ],
+ "name": "allowance",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "spender",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "approve",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "account",
+ "type": "address"
+ }
+ ],
+ "name": "balanceOf",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "burn",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "decimals",
+ "outputs": [
+ {
+ "internalType": "uint8",
+ "name": "",
+ "type": "uint8"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "spender",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "decreaseAllowance",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "to",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "deposit",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "spender",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "increaseAllowance",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "name",
+ "outputs": [
+ {
+ "internalType": "string",
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "newField",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "newPublicField",
+ "outputs": [
+ {
+ "internalType": "string",
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "symbol",
+ "outputs": [
+ {
+ "internalType": "string",
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "totalSupply",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "recipient",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "transfer",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "sender",
+ "type": "address"
+ },
+ {
+ "internalType": "address",
+ "name": "recipient",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "transferFrom",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "gasLimit",
+ "type": "uint256"
+ }
+ ],
+ "name": "updateGasLimit",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "newField_",
+ "type": "uint256"
+ }
+ ],
+ "name": "updateNewField",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "protocolFlatFee",
+ "type": "uint256"
+ }
+ ],
+ "name": "updateProtocolFlatFee",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ }
+ ],
+ "name": "updateSystemContractAddress",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "bytes",
+ "name": "to",
+ "type": "bytes"
+ },
+ {
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "withdraw",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "withdrawGasFee",
+ "outputs": [
+ {
+ "internalType": "address",
+ "name": "",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ }
+]
diff --git a/contrib/localnet/orchestrator/smoketest/contracts/testzrc20/TestZRC20.bin b/contrib/localnet/orchestrator/smoketest/contracts/testzrc20/TestZRC20.bin
new file mode 100644
index 0000000000..9e74c2aaa3
--- /dev/null
+++ b/contrib/localnet/orchestrator/smoketest/contracts/testzrc20/TestZRC20.bin
@@ -0,0 +1 @@
+60c06040523480156200001157600080fd5b5060405162002566380380620025668339818101604052810190620000379190620000e1565b816080818152505080600281111562000055576200005462000128565b5b60a08160028111156200006d576200006c62000128565b5b81525050505062000157565b600080fd5b6000819050919050565b62000093816200007e565b81146200009f57600080fd5b50565b600081519050620000b38162000088565b92915050565b60038110620000c757600080fd5b50565b600081519050620000db81620000b9565b92915050565b60008060408385031215620000fb57620000fa62000079565b5b60006200010b85828601620000a2565b92505060206200011e85828601620000ca565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60805160a0516123db6200018b6000396000610aa40152600081816109ee01528181610f59015261107e01526123db6000f3fe608060405234801561001057600080fd5b50600436106101a95760003560e01c806385e1f4d0116100f9578063c701262611610097578063dd62ed3e11610071578063dd62ed3e146104ff578063eddeb1231461052f578063f2441b321461054b578063f687d12a14610569576101a9565b8063c701262614610494578063c835d7cc146104c4578063d9eeebed146104e0576101a9565b8063a457c2d7116100d3578063a457c2d7146103f8578063a7605f4514610428578063a9059cbb14610446578063b92894ba14610476576101a9565b806385e1f4d01461039e57806395d89b41146103bc578063a3413d03146103da576101a9565b8063395093511161016657806347e7ef241161014057806347e7ef24146103045780634d8943bb1461033457806370a0823114610352578063732bb0e414610382576101a9565b806339509351146102865780633ce4a5bc146102b657806342966c68146102d4576101a9565b806306fdde03146101ae578063091d2788146101cc578063095ea7b3146101ea57806318160ddd1461021a57806323b872dd14610238578063313ce56714610268575b600080fd5b6101b6610585565b6040516101c39190611b20565b60405180910390f35b6101d4610617565b6040516101e19190611b5b565b60405180910390f35b61020460048036038101906101ff9190611c14565b61061d565b6040516102119190611c6f565b60405180910390f35b61022261063b565b60405161022f9190611b5b565b60405180910390f35b610252600480360381019061024d9190611c8a565b610645565b60405161025f9190611c6f565b60405180910390f35b61027061073d565b60405161027d9190611cf9565b60405180910390f35b6102a0600480360381019061029b9190611c14565b610754565b6040516102ad9190611c6f565b60405180910390f35b6102be6107fa565b6040516102cb9190611d23565b60405180910390f35b6102ee60048036038101906102e99190611d3e565b610812565b6040516102fb9190611c6f565b60405180910390f35b61031e60048036038101906103199190611c14565b610827565b60405161032b9190611c6f565b60405180910390f35b61033c610993565b6040516103499190611b5b565b60405180910390f35b61036c60048036038101906103679190611d6b565b610999565b6040516103799190611b5b565b60405180910390f35b61039c60048036038101906103979190611d3e565b6109e2565b005b6103a66109ec565b6040516103b39190611b5b565b60405180910390f35b6103c4610a10565b6040516103d19190611b20565b60405180910390f35b6103e2610aa2565b6040516103ef9190611e0f565b60405180910390f35b610412600480360381019061040d9190611c14565b610ac6565b60405161041f9190611c6f565b60405180910390f35b610430610c29565b60405161043d9190611b5b565b60405180910390f35b610460600480360381019061045b9190611c14565b610c2f565b60405161046d9190611c6f565b60405180910390f35b61047e610c4d565b60405161048b9190611b20565b60405180910390f35b6104ae60048036038101906104a99190611f5f565b610cdb565b6040516104bb9190611c6f565b60405180910390f35b6104de60048036038101906104d99190611d6b565b610e22565b005b6104e8610f15565b6040516104f6929190611fbb565b60405180910390f35b61051960048036038101906105149190611fe4565b611162565b6040516105269190611b5b565b60405180910390f35b61054960048036038101906105449190611d3e565b6111e9565b005b6105536112a3565b6040516105609190611d23565b60405180910390f35b610583600480360381019061057e9190611d3e565b6112c7565b005b60606006805461059490612053565b80601f01602080910402602001604051908101604052809291908181526020018280546105c090612053565b801561060d5780601f106105e25761010080835404028352916020019161060d565b820191906000526020600020905b8154815290600101906020018083116105f057829003601f168201915b5050505050905090565b60015481565b600061063161062a611381565b8484611389565b6001905092915050565b6000600554905090565b6000610652848484611540565b6000600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061069d611381565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610714576040517f10bad14700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61073185610720611381565b858461072c91906120b3565b611389565b60019150509392505050565b6000600860009054906101000a900460ff16905090565b600081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107a0611381565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546107e991906120e7565b925050819055506001905092915050565b73735b14bb79463307aacbed86daf3322b1e6226ab81565b600061081e338361179a565b60019050919050565b600073735b14bb79463307aacbed86daf3322b1e6226ab73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141580156108c5575060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b156108fc576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109068383611951565b8273ffffffffffffffffffffffffffffffffffffffff167f67fc7bdaed5b0ec550d8706b87d60568ab70c6b781263c70101d54cd1564aab373735b14bb79463307aacbed86daf3322b1e6226ab6040516020016109639190612163565b604051602081830303815290604052846040516109819291906121d3565b60405180910390a26001905092915050565b60025481565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b8060098190555050565b7f000000000000000000000000000000000000000000000000000000000000000081565b606060078054610a1f90612053565b80601f0160208091040260200160405190810160405280929190818152602001828054610a4b90612053565b8015610a985780601f10610a6d57610100808354040283529160200191610a98565b820191906000526020600020905b815481529060010190602001808311610a7b57829003601f168201915b5050505050905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b600081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610b12611381565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610b85576040517f10bad14700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610bcf611381565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610c1891906120b3565b925050819055506001905092915050565b60095481565b6000610c43610c3c611381565b8484611540565b6001905092915050565b600a8054610c5a90612053565b80601f0160208091040260200160405190810160405280929190818152602001828054610c8690612053565b8015610cd35780601f10610ca857610100808354040283529160200191610cd3565b820191906000526020600020905b815481529060010190602001808311610cb657829003601f168201915b505050505081565b6000806000610ce8610f15565b915091508173ffffffffffffffffffffffffffffffffffffffff166323b872dd3373735b14bb79463307aacbed86daf3322b1e6226ab846040518463ffffffff1660e01b8152600401610d3d93929190612203565b6020604051808303816000875af1158015610d5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d809190612266565b610db6576040517f0a7cd6d600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610dc0338561179a565b3373ffffffffffffffffffffffffffffffffffffffff167f9ffbffc04a397460ee1dbe8c9503e098090567d6b7f4b3c02a8617d800b6d955868684600254604051610e0e9493929190612293565b60405180910390a260019250505092915050565b73735b14bb79463307aacbed86daf3322b1e6226ab73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e9b576040517f2b2add3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fd55614e962c5fd6ece71614f6348d702468a997a394dd5e5c1677950226d97ae81604051610f0a9190611d23565b60405180910390a150565b60008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630be155477f00000000000000000000000000000000000000000000000000000000000000006040518263ffffffff1660e01b8152600401610f949190611b5b565b602060405180830381865afa158015610fb1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd591906122f4565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361103d576040517f78fff39600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d7fd7afb7f00000000000000000000000000000000000000000000000000000000000000006040518263ffffffff1660e01b81526004016110b99190611b5b565b602060405180830381865afa1580156110d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fa9190612336565b905060008103611136576040517fe661aed000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600254600154836111499190612363565b61115391906120e7565b90508281945094505050509091565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b73735b14bb79463307aacbed86daf3322b1e6226ab73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611262576040517f2b2add3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806002819055507fef13af88e424b5d15f49c77758542c1938b08b8b95b91ed0751f98ba99000d8f816040516112989190611b5b565b60405180910390a150565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b73735b14bb79463307aacbed86daf3322b1e6226ab73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611340576040517f2b2add3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001819055507fff5788270f43bfc1ca41c503606d2594aa3023a1a7547de403a3e2f146a4a80a816040516113769190611b5b565b60405180910390a150565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036113ef576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611455576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115339190611b5b565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036115a6576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361160c576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561168a576040517ffe382aa700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b818161169691906120b3565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461172891906120e7565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161178c9190611b5b565b60405180910390a350505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611800576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561187e576040517ffe382aa700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b818161188a91906120b3565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600560008282546118df91906120b3565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516119449190611b5b565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036119b7576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600560008282546119c991906120e7565b9250508190555080600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611a1f91906120e7565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611a849190611b5b565b60405180910390a35050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611aca578082015181840152602081019050611aaf565b60008484015250505050565b6000601f19601f8301169050919050565b6000611af282611a90565b611afc8185611a9b565b9350611b0c818560208601611aac565b611b1581611ad6565b840191505092915050565b60006020820190508181036000830152611b3a8184611ae7565b905092915050565b6000819050919050565b611b5581611b42565b82525050565b6000602082019050611b706000830184611b4c565b92915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611bb582611b8a565b9050919050565b611bc581611baa565b8114611bd057600080fd5b50565b600081359050611be281611bbc565b92915050565b611bf181611b42565b8114611bfc57600080fd5b50565b600081359050611c0e81611be8565b92915050565b60008060408385031215611c2b57611c2a611b80565b5b6000611c3985828601611bd3565b9250506020611c4a85828601611bff565b9150509250929050565b60008115159050919050565b611c6981611c54565b82525050565b6000602082019050611c846000830184611c60565b92915050565b600080600060608486031215611ca357611ca2611b80565b5b6000611cb186828701611bd3565b9350506020611cc286828701611bd3565b9250506040611cd386828701611bff565b9150509250925092565b600060ff82169050919050565b611cf381611cdd565b82525050565b6000602082019050611d0e6000830184611cea565b92915050565b611d1d81611baa565b82525050565b6000602082019050611d386000830184611d14565b92915050565b600060208284031215611d5457611d53611b80565b5b6000611d6284828501611bff565b91505092915050565b600060208284031215611d8157611d80611b80565b5b6000611d8f84828501611bd3565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60038110611dd857611dd7611d98565b5b50565b6000819050611de982611dc7565b919050565b6000611df982611ddb565b9050919050565b611e0981611dee565b82525050565b6000602082019050611e246000830184611e00565b92915050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611e6c82611ad6565b810181811067ffffffffffffffff82111715611e8b57611e8a611e34565b5b80604052505050565b6000611e9e611b76565b9050611eaa8282611e63565b919050565b600067ffffffffffffffff821115611eca57611ec9611e34565b5b611ed382611ad6565b9050602081019050919050565b82818337600083830152505050565b6000611f02611efd84611eaf565b611e94565b905082815260208101848484011115611f1e57611f1d611e2f565b5b611f29848285611ee0565b509392505050565b600082601f830112611f4657611f45611e2a565b5b8135611f56848260208601611eef565b91505092915050565b60008060408385031215611f7657611f75611b80565b5b600083013567ffffffffffffffff811115611f9457611f93611b85565b5b611fa085828601611f31565b9250506020611fb185828601611bff565b9150509250929050565b6000604082019050611fd06000830185611d14565b611fdd6020830184611b4c565b9392505050565b60008060408385031215611ffb57611ffa611b80565b5b600061200985828601611bd3565b925050602061201a85828601611bd3565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061206b57607f821691505b60208210810361207e5761207d612024565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006120be82611b42565b91506120c983611b42565b92508282039050818111156120e1576120e0612084565b5b92915050565b60006120f282611b42565b91506120fd83611b42565b925082820190508082111561211557612114612084565b5b92915050565b60008160601b9050919050565b60006121338261211b565b9050919050565b600061214582612128565b9050919050565b61215d61215882611baa565b61213a565b82525050565b600061216f828461214c565b60148201915081905092915050565b600081519050919050565b600082825260208201905092915050565b60006121a58261217e565b6121af8185612189565b93506121bf818560208601611aac565b6121c881611ad6565b840191505092915050565b600060408201905081810360008301526121ed818561219a565b90506121fc6020830184611b4c565b9392505050565b60006060820190506122186000830186611d14565b6122256020830185611d14565b6122326040830184611b4c565b949350505050565b61224381611c54565b811461224e57600080fd5b50565b6000815190506122608161223a565b92915050565b60006020828403121561227c5761227b611b80565b5b600061228a84828501612251565b91505092915050565b600060808201905081810360008301526122ad818761219a565b90506122bc6020830186611b4c565b6122c96040830185611b4c565b6122d66060830184611b4c565b95945050505050565b6000815190506122ee81611bbc565b92915050565b60006020828403121561230a57612309611b80565b5b6000612318848285016122df565b91505092915050565b60008151905061233081611be8565b92915050565b60006020828403121561234c5761234b611b80565b5b600061235a84828501612321565b91505092915050565b600061236e82611b42565b915061237983611b42565b925082820261238781611b42565b9150828204841483151761239e5761239d612084565b5b509291505056fea264697066735822122011fda4fba218fc7f911b68b0418884c426f5ddb324eb1572e2e793fcb60edf6c64736f6c63430008150033
diff --git a/contrib/localnet/orchestrator/smoketest/contracts/testzrc20/TestZRC20.go b/contrib/localnet/orchestrator/smoketest/contracts/testzrc20/TestZRC20.go
new file mode 100644
index 0000000000..aef95ec0d1
--- /dev/null
+++ b/contrib/localnet/orchestrator/smoketest/contracts/testzrc20/TestZRC20.go
@@ -0,0 +1,1925 @@
+// Code generated - DO NOT EDIT.
+// This file is a generated binding and any manual changes will be lost.
+
+package testzrc20
+
+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
+)
+
+// TestZRC20MetaData contains all meta data concerning the TestZRC20 contract.
+var TestZRC20MetaData = &bind.MetaData{
+ ABI: "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainid_\",\"type\":\"uint256\"},{\"internalType\":\"enumCoinType\",\"name\":\"coinType_\",\"type\":\"uint8\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CallerIsNotFungibleModule\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"GasFeeTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSender\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LowAllowance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LowBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroGasCoin\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroGasPrice\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"from\",\"type\":\"bytes\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Deposit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"}],\"name\":\"UpdatedGasLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"protocolFlatFee\",\"type\":\"uint256\"}],\"name\":\"UpdatedProtocolFlatFee\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"systemContract\",\"type\":\"address\"}],\"name\":\"UpdatedSystemContract\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"to\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"gasfee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"protocolFlatFee\",\"type\":\"uint256\"}],\"name\":\"Withdrawal\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"CHAIN_ID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"COIN_TYPE\",\"outputs\":[{\"internalType\":\"enumCoinType\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FUNGIBLE_MODULE_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GAS_LIMIT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PROTOCOL_FLAT_FEE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SYSTEM_CONTRACT_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"newField\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"newPublicField\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"}],\"name\":\"updateGasLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newField_\",\"type\":\"uint256\"}],\"name\":\"updateNewField\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"protocolFlatFee\",\"type\":\"uint256\"}],\"name\":\"updateProtocolFlatFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"updateSystemContractAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"to\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawGasFee\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]",
+ Bin: "0x60c06040523480156200001157600080fd5b5060405162002566380380620025668339818101604052810190620000379190620000e1565b816080818152505080600281111562000055576200005462000128565b5b60a08160028111156200006d576200006c62000128565b5b81525050505062000157565b600080fd5b6000819050919050565b62000093816200007e565b81146200009f57600080fd5b50565b600081519050620000b38162000088565b92915050565b60038110620000c757600080fd5b50565b600081519050620000db81620000b9565b92915050565b60008060408385031215620000fb57620000fa62000079565b5b60006200010b85828601620000a2565b92505060206200011e85828601620000ca565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60805160a0516123db6200018b6000396000610aa40152600081816109ee01528181610f59015261107e01526123db6000f3fe608060405234801561001057600080fd5b50600436106101a95760003560e01c806385e1f4d0116100f9578063c701262611610097578063dd62ed3e11610071578063dd62ed3e146104ff578063eddeb1231461052f578063f2441b321461054b578063f687d12a14610569576101a9565b8063c701262614610494578063c835d7cc146104c4578063d9eeebed146104e0576101a9565b8063a457c2d7116100d3578063a457c2d7146103f8578063a7605f4514610428578063a9059cbb14610446578063b92894ba14610476576101a9565b806385e1f4d01461039e57806395d89b41146103bc578063a3413d03146103da576101a9565b8063395093511161016657806347e7ef241161014057806347e7ef24146103045780634d8943bb1461033457806370a0823114610352578063732bb0e414610382576101a9565b806339509351146102865780633ce4a5bc146102b657806342966c68146102d4576101a9565b806306fdde03146101ae578063091d2788146101cc578063095ea7b3146101ea57806318160ddd1461021a57806323b872dd14610238578063313ce56714610268575b600080fd5b6101b6610585565b6040516101c39190611b20565b60405180910390f35b6101d4610617565b6040516101e19190611b5b565b60405180910390f35b61020460048036038101906101ff9190611c14565b61061d565b6040516102119190611c6f565b60405180910390f35b61022261063b565b60405161022f9190611b5b565b60405180910390f35b610252600480360381019061024d9190611c8a565b610645565b60405161025f9190611c6f565b60405180910390f35b61027061073d565b60405161027d9190611cf9565b60405180910390f35b6102a0600480360381019061029b9190611c14565b610754565b6040516102ad9190611c6f565b60405180910390f35b6102be6107fa565b6040516102cb9190611d23565b60405180910390f35b6102ee60048036038101906102e99190611d3e565b610812565b6040516102fb9190611c6f565b60405180910390f35b61031e60048036038101906103199190611c14565b610827565b60405161032b9190611c6f565b60405180910390f35b61033c610993565b6040516103499190611b5b565b60405180910390f35b61036c60048036038101906103679190611d6b565b610999565b6040516103799190611b5b565b60405180910390f35b61039c60048036038101906103979190611d3e565b6109e2565b005b6103a66109ec565b6040516103b39190611b5b565b60405180910390f35b6103c4610a10565b6040516103d19190611b20565b60405180910390f35b6103e2610aa2565b6040516103ef9190611e0f565b60405180910390f35b610412600480360381019061040d9190611c14565b610ac6565b60405161041f9190611c6f565b60405180910390f35b610430610c29565b60405161043d9190611b5b565b60405180910390f35b610460600480360381019061045b9190611c14565b610c2f565b60405161046d9190611c6f565b60405180910390f35b61047e610c4d565b60405161048b9190611b20565b60405180910390f35b6104ae60048036038101906104a99190611f5f565b610cdb565b6040516104bb9190611c6f565b60405180910390f35b6104de60048036038101906104d99190611d6b565b610e22565b005b6104e8610f15565b6040516104f6929190611fbb565b60405180910390f35b61051960048036038101906105149190611fe4565b611162565b6040516105269190611b5b565b60405180910390f35b61054960048036038101906105449190611d3e565b6111e9565b005b6105536112a3565b6040516105609190611d23565b60405180910390f35b610583600480360381019061057e9190611d3e565b6112c7565b005b60606006805461059490612053565b80601f01602080910402602001604051908101604052809291908181526020018280546105c090612053565b801561060d5780601f106105e25761010080835404028352916020019161060d565b820191906000526020600020905b8154815290600101906020018083116105f057829003601f168201915b5050505050905090565b60015481565b600061063161062a611381565b8484611389565b6001905092915050565b6000600554905090565b6000610652848484611540565b6000600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061069d611381565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610714576040517f10bad14700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61073185610720611381565b858461072c91906120b3565b611389565b60019150509392505050565b6000600860009054906101000a900460ff16905090565b600081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107a0611381565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546107e991906120e7565b925050819055506001905092915050565b73735b14bb79463307aacbed86daf3322b1e6226ab81565b600061081e338361179a565b60019050919050565b600073735b14bb79463307aacbed86daf3322b1e6226ab73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141580156108c5575060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b156108fc576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109068383611951565b8273ffffffffffffffffffffffffffffffffffffffff167f67fc7bdaed5b0ec550d8706b87d60568ab70c6b781263c70101d54cd1564aab373735b14bb79463307aacbed86daf3322b1e6226ab6040516020016109639190612163565b604051602081830303815290604052846040516109819291906121d3565b60405180910390a26001905092915050565b60025481565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b8060098190555050565b7f000000000000000000000000000000000000000000000000000000000000000081565b606060078054610a1f90612053565b80601f0160208091040260200160405190810160405280929190818152602001828054610a4b90612053565b8015610a985780601f10610a6d57610100808354040283529160200191610a98565b820191906000526020600020905b815481529060010190602001808311610a7b57829003601f168201915b5050505050905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b600081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610b12611381565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610b85576040517f10bad14700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610bcf611381565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610c1891906120b3565b925050819055506001905092915050565b60095481565b6000610c43610c3c611381565b8484611540565b6001905092915050565b600a8054610c5a90612053565b80601f0160208091040260200160405190810160405280929190818152602001828054610c8690612053565b8015610cd35780601f10610ca857610100808354040283529160200191610cd3565b820191906000526020600020905b815481529060010190602001808311610cb657829003601f168201915b505050505081565b6000806000610ce8610f15565b915091508173ffffffffffffffffffffffffffffffffffffffff166323b872dd3373735b14bb79463307aacbed86daf3322b1e6226ab846040518463ffffffff1660e01b8152600401610d3d93929190612203565b6020604051808303816000875af1158015610d5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d809190612266565b610db6576040517f0a7cd6d600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610dc0338561179a565b3373ffffffffffffffffffffffffffffffffffffffff167f9ffbffc04a397460ee1dbe8c9503e098090567d6b7f4b3c02a8617d800b6d955868684600254604051610e0e9493929190612293565b60405180910390a260019250505092915050565b73735b14bb79463307aacbed86daf3322b1e6226ab73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e9b576040517f2b2add3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fd55614e962c5fd6ece71614f6348d702468a997a394dd5e5c1677950226d97ae81604051610f0a9190611d23565b60405180910390a150565b60008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630be155477f00000000000000000000000000000000000000000000000000000000000000006040518263ffffffff1660e01b8152600401610f949190611b5b565b602060405180830381865afa158015610fb1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd591906122f4565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361103d576040517f78fff39600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d7fd7afb7f00000000000000000000000000000000000000000000000000000000000000006040518263ffffffff1660e01b81526004016110b99190611b5b565b602060405180830381865afa1580156110d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fa9190612336565b905060008103611136576040517fe661aed000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600254600154836111499190612363565b61115391906120e7565b90508281945094505050509091565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b73735b14bb79463307aacbed86daf3322b1e6226ab73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611262576040517f2b2add3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806002819055507fef13af88e424b5d15f49c77758542c1938b08b8b95b91ed0751f98ba99000d8f816040516112989190611b5b565b60405180910390a150565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b73735b14bb79463307aacbed86daf3322b1e6226ab73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611340576040517f2b2add3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001819055507fff5788270f43bfc1ca41c503606d2594aa3023a1a7547de403a3e2f146a4a80a816040516113769190611b5b565b60405180910390a150565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036113ef576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611455576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115339190611b5b565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036115a6576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361160c576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561168a576040517ffe382aa700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b818161169691906120b3565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461172891906120e7565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161178c9190611b5b565b60405180910390a350505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611800576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561187e576040517ffe382aa700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b818161188a91906120b3565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600560008282546118df91906120b3565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516119449190611b5b565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036119b7576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600560008282546119c991906120e7565b9250508190555080600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611a1f91906120e7565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611a849190611b5b565b60405180910390a35050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611aca578082015181840152602081019050611aaf565b60008484015250505050565b6000601f19601f8301169050919050565b6000611af282611a90565b611afc8185611a9b565b9350611b0c818560208601611aac565b611b1581611ad6565b840191505092915050565b60006020820190508181036000830152611b3a8184611ae7565b905092915050565b6000819050919050565b611b5581611b42565b82525050565b6000602082019050611b706000830184611b4c565b92915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611bb582611b8a565b9050919050565b611bc581611baa565b8114611bd057600080fd5b50565b600081359050611be281611bbc565b92915050565b611bf181611b42565b8114611bfc57600080fd5b50565b600081359050611c0e81611be8565b92915050565b60008060408385031215611c2b57611c2a611b80565b5b6000611c3985828601611bd3565b9250506020611c4a85828601611bff565b9150509250929050565b60008115159050919050565b611c6981611c54565b82525050565b6000602082019050611c846000830184611c60565b92915050565b600080600060608486031215611ca357611ca2611b80565b5b6000611cb186828701611bd3565b9350506020611cc286828701611bd3565b9250506040611cd386828701611bff565b9150509250925092565b600060ff82169050919050565b611cf381611cdd565b82525050565b6000602082019050611d0e6000830184611cea565b92915050565b611d1d81611baa565b82525050565b6000602082019050611d386000830184611d14565b92915050565b600060208284031215611d5457611d53611b80565b5b6000611d6284828501611bff565b91505092915050565b600060208284031215611d8157611d80611b80565b5b6000611d8f84828501611bd3565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60038110611dd857611dd7611d98565b5b50565b6000819050611de982611dc7565b919050565b6000611df982611ddb565b9050919050565b611e0981611dee565b82525050565b6000602082019050611e246000830184611e00565b92915050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611e6c82611ad6565b810181811067ffffffffffffffff82111715611e8b57611e8a611e34565b5b80604052505050565b6000611e9e611b76565b9050611eaa8282611e63565b919050565b600067ffffffffffffffff821115611eca57611ec9611e34565b5b611ed382611ad6565b9050602081019050919050565b82818337600083830152505050565b6000611f02611efd84611eaf565b611e94565b905082815260208101848484011115611f1e57611f1d611e2f565b5b611f29848285611ee0565b509392505050565b600082601f830112611f4657611f45611e2a565b5b8135611f56848260208601611eef565b91505092915050565b60008060408385031215611f7657611f75611b80565b5b600083013567ffffffffffffffff811115611f9457611f93611b85565b5b611fa085828601611f31565b9250506020611fb185828601611bff565b9150509250929050565b6000604082019050611fd06000830185611d14565b611fdd6020830184611b4c565b9392505050565b60008060408385031215611ffb57611ffa611b80565b5b600061200985828601611bd3565b925050602061201a85828601611bd3565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061206b57607f821691505b60208210810361207e5761207d612024565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006120be82611b42565b91506120c983611b42565b92508282039050818111156120e1576120e0612084565b5b92915050565b60006120f282611b42565b91506120fd83611b42565b925082820190508082111561211557612114612084565b5b92915050565b60008160601b9050919050565b60006121338261211b565b9050919050565b600061214582612128565b9050919050565b61215d61215882611baa565b61213a565b82525050565b600061216f828461214c565b60148201915081905092915050565b600081519050919050565b600082825260208201905092915050565b60006121a58261217e565b6121af8185612189565b93506121bf818560208601611aac565b6121c881611ad6565b840191505092915050565b600060408201905081810360008301526121ed818561219a565b90506121fc6020830184611b4c565b9392505050565b60006060820190506122186000830186611d14565b6122256020830185611d14565b6122326040830184611b4c565b949350505050565b61224381611c54565b811461224e57600080fd5b50565b6000815190506122608161223a565b92915050565b60006020828403121561227c5761227b611b80565b5b600061228a84828501612251565b91505092915050565b600060808201905081810360008301526122ad818761219a565b90506122bc6020830186611b4c565b6122c96040830185611b4c565b6122d66060830184611b4c565b95945050505050565b6000815190506122ee81611bbc565b92915050565b60006020828403121561230a57612309611b80565b5b6000612318848285016122df565b91505092915050565b60008151905061233081611be8565b92915050565b60006020828403121561234c5761234b611b80565b5b600061235a84828501612321565b91505092915050565b600061236e82611b42565b915061237983611b42565b925082820261238781611b42565b9150828204841483151761239e5761239d612084565b5b509291505056fea264697066735822122011fda4fba218fc7f911b68b0418884c426f5ddb324eb1572e2e793fcb60edf6c64736f6c63430008150033",
+}
+
+// TestZRC20ABI is the input ABI used to generate the binding from.
+// Deprecated: Use TestZRC20MetaData.ABI instead.
+var TestZRC20ABI = TestZRC20MetaData.ABI
+
+// TestZRC20Bin is the compiled bytecode used for deploying new contracts.
+// Deprecated: Use TestZRC20MetaData.Bin instead.
+var TestZRC20Bin = TestZRC20MetaData.Bin
+
+// DeployTestZRC20 deploys a new Ethereum contract, binding an instance of TestZRC20 to it.
+func DeployTestZRC20(auth *bind.TransactOpts, backend bind.ContractBackend, chainid_ *big.Int, coinType_ uint8) (common.Address, *types.Transaction, *TestZRC20, error) {
+ parsed, err := TestZRC20MetaData.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(TestZRC20Bin), backend, chainid_, coinType_)
+ if err != nil {
+ return common.Address{}, nil, nil, err
+ }
+ return address, tx, &TestZRC20{TestZRC20Caller: TestZRC20Caller{contract: contract}, TestZRC20Transactor: TestZRC20Transactor{contract: contract}, TestZRC20Filterer: TestZRC20Filterer{contract: contract}}, nil
+}
+
+// TestZRC20 is an auto generated Go binding around an Ethereum contract.
+type TestZRC20 struct {
+ TestZRC20Caller // Read-only binding to the contract
+ TestZRC20Transactor // Write-only binding to the contract
+ TestZRC20Filterer // Log filterer for contract events
+}
+
+// TestZRC20Caller is an auto generated read-only Go binding around an Ethereum contract.
+type TestZRC20Caller struct {
+ contract *bind.BoundContract // Generic contract wrapper for the low level calls
+}
+
+// TestZRC20Transactor is an auto generated write-only Go binding around an Ethereum contract.
+type TestZRC20Transactor struct {
+ contract *bind.BoundContract // Generic contract wrapper for the low level calls
+}
+
+// TestZRC20Filterer is an auto generated log filtering Go binding around an Ethereum contract events.
+type TestZRC20Filterer struct {
+ contract *bind.BoundContract // Generic contract wrapper for the low level calls
+}
+
+// TestZRC20Session is an auto generated Go binding around an Ethereum contract,
+// with pre-set call and transact options.
+type TestZRC20Session struct {
+ Contract *TestZRC20 // 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
+}
+
+// TestZRC20CallerSession is an auto generated read-only Go binding around an Ethereum contract,
+// with pre-set call options.
+type TestZRC20CallerSession struct {
+ Contract *TestZRC20Caller // Generic contract caller binding to set the session for
+ CallOpts bind.CallOpts // Call options to use throughout this session
+}
+
+// TestZRC20TransactorSession is an auto generated write-only Go binding around an Ethereum contract,
+// with pre-set transact options.
+type TestZRC20TransactorSession struct {
+ Contract *TestZRC20Transactor // Generic contract transactor binding to set the session for
+ TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
+}
+
+// TestZRC20Raw is an auto generated low-level Go binding around an Ethereum contract.
+type TestZRC20Raw struct {
+ Contract *TestZRC20 // Generic contract binding to access the raw methods on
+}
+
+// TestZRC20CallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
+type TestZRC20CallerRaw struct {
+ Contract *TestZRC20Caller // Generic read-only contract binding to access the raw methods on
+}
+
+// TestZRC20TransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
+type TestZRC20TransactorRaw struct {
+ Contract *TestZRC20Transactor // Generic write-only contract binding to access the raw methods on
+}
+
+// NewTestZRC20 creates a new instance of TestZRC20, bound to a specific deployed contract.
+func NewTestZRC20(address common.Address, backend bind.ContractBackend) (*TestZRC20, error) {
+ contract, err := bindTestZRC20(address, backend, backend, backend)
+ if err != nil {
+ return nil, err
+ }
+ return &TestZRC20{TestZRC20Caller: TestZRC20Caller{contract: contract}, TestZRC20Transactor: TestZRC20Transactor{contract: contract}, TestZRC20Filterer: TestZRC20Filterer{contract: contract}}, nil
+}
+
+// NewTestZRC20Caller creates a new read-only instance of TestZRC20, bound to a specific deployed contract.
+func NewTestZRC20Caller(address common.Address, caller bind.ContractCaller) (*TestZRC20Caller, error) {
+ contract, err := bindTestZRC20(address, caller, nil, nil)
+ if err != nil {
+ return nil, err
+ }
+ return &TestZRC20Caller{contract: contract}, nil
+}
+
+// NewTestZRC20Transactor creates a new write-only instance of TestZRC20, bound to a specific deployed contract.
+func NewTestZRC20Transactor(address common.Address, transactor bind.ContractTransactor) (*TestZRC20Transactor, error) {
+ contract, err := bindTestZRC20(address, nil, transactor, nil)
+ if err != nil {
+ return nil, err
+ }
+ return &TestZRC20Transactor{contract: contract}, nil
+}
+
+// NewTestZRC20Filterer creates a new log filterer instance of TestZRC20, bound to a specific deployed contract.
+func NewTestZRC20Filterer(address common.Address, filterer bind.ContractFilterer) (*TestZRC20Filterer, error) {
+ contract, err := bindTestZRC20(address, nil, nil, filterer)
+ if err != nil {
+ return nil, err
+ }
+ return &TestZRC20Filterer{contract: contract}, nil
+}
+
+// bindTestZRC20 binds a generic wrapper to an already deployed contract.
+func bindTestZRC20(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
+ parsed, err := TestZRC20MetaData.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 (_TestZRC20 *TestZRC20Raw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
+ return _TestZRC20.Contract.TestZRC20Caller.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 (_TestZRC20 *TestZRC20Raw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
+ return _TestZRC20.Contract.TestZRC20Transactor.contract.Transfer(opts)
+}
+
+// Transact invokes the (paid) contract method with params as input values.
+func (_TestZRC20 *TestZRC20Raw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
+ return _TestZRC20.Contract.TestZRC20Transactor.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 (_TestZRC20 *TestZRC20CallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
+ return _TestZRC20.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 (_TestZRC20 *TestZRC20TransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
+ return _TestZRC20.Contract.contract.Transfer(opts)
+}
+
+// Transact invokes the (paid) contract method with params as input values.
+func (_TestZRC20 *TestZRC20TransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
+ return _TestZRC20.Contract.contract.Transact(opts, method, params...)
+}
+
+// CHAINID is a free data retrieval call binding the contract method 0x85e1f4d0.
+//
+// Solidity: function CHAIN_ID() view returns(uint256)
+func (_TestZRC20 *TestZRC20Caller) CHAINID(opts *bind.CallOpts) (*big.Int, error) {
+ var out []interface{}
+ err := _TestZRC20.contract.Call(opts, &out, "CHAIN_ID")
+
+ if err != nil {
+ return *new(*big.Int), err
+ }
+
+ out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
+
+ return out0, err
+
+}
+
+// CHAINID is a free data retrieval call binding the contract method 0x85e1f4d0.
+//
+// Solidity: function CHAIN_ID() view returns(uint256)
+func (_TestZRC20 *TestZRC20Session) CHAINID() (*big.Int, error) {
+ return _TestZRC20.Contract.CHAINID(&_TestZRC20.CallOpts)
+}
+
+// CHAINID is a free data retrieval call binding the contract method 0x85e1f4d0.
+//
+// Solidity: function CHAIN_ID() view returns(uint256)
+func (_TestZRC20 *TestZRC20CallerSession) CHAINID() (*big.Int, error) {
+ return _TestZRC20.Contract.CHAINID(&_TestZRC20.CallOpts)
+}
+
+// COINTYPE is a free data retrieval call binding the contract method 0xa3413d03.
+//
+// Solidity: function COIN_TYPE() view returns(uint8)
+func (_TestZRC20 *TestZRC20Caller) COINTYPE(opts *bind.CallOpts) (uint8, error) {
+ var out []interface{}
+ err := _TestZRC20.contract.Call(opts, &out, "COIN_TYPE")
+
+ if err != nil {
+ return *new(uint8), err
+ }
+
+ out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8)
+
+ return out0, err
+
+}
+
+// COINTYPE is a free data retrieval call binding the contract method 0xa3413d03.
+//
+// Solidity: function COIN_TYPE() view returns(uint8)
+func (_TestZRC20 *TestZRC20Session) COINTYPE() (uint8, error) {
+ return _TestZRC20.Contract.COINTYPE(&_TestZRC20.CallOpts)
+}
+
+// COINTYPE is a free data retrieval call binding the contract method 0xa3413d03.
+//
+// Solidity: function COIN_TYPE() view returns(uint8)
+func (_TestZRC20 *TestZRC20CallerSession) COINTYPE() (uint8, error) {
+ return _TestZRC20.Contract.COINTYPE(&_TestZRC20.CallOpts)
+}
+
+// FUNGIBLEMODULEADDRESS is a free data retrieval call binding the contract method 0x3ce4a5bc.
+//
+// Solidity: function FUNGIBLE_MODULE_ADDRESS() view returns(address)
+func (_TestZRC20 *TestZRC20Caller) FUNGIBLEMODULEADDRESS(opts *bind.CallOpts) (common.Address, error) {
+ var out []interface{}
+ err := _TestZRC20.contract.Call(opts, &out, "FUNGIBLE_MODULE_ADDRESS")
+
+ if err != nil {
+ return *new(common.Address), err
+ }
+
+ out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
+
+ return out0, err
+
+}
+
+// FUNGIBLEMODULEADDRESS is a free data retrieval call binding the contract method 0x3ce4a5bc.
+//
+// Solidity: function FUNGIBLE_MODULE_ADDRESS() view returns(address)
+func (_TestZRC20 *TestZRC20Session) FUNGIBLEMODULEADDRESS() (common.Address, error) {
+ return _TestZRC20.Contract.FUNGIBLEMODULEADDRESS(&_TestZRC20.CallOpts)
+}
+
+// FUNGIBLEMODULEADDRESS is a free data retrieval call binding the contract method 0x3ce4a5bc.
+//
+// Solidity: function FUNGIBLE_MODULE_ADDRESS() view returns(address)
+func (_TestZRC20 *TestZRC20CallerSession) FUNGIBLEMODULEADDRESS() (common.Address, error) {
+ return _TestZRC20.Contract.FUNGIBLEMODULEADDRESS(&_TestZRC20.CallOpts)
+}
+
+// GASLIMIT is a free data retrieval call binding the contract method 0x091d2788.
+//
+// Solidity: function GAS_LIMIT() view returns(uint256)
+func (_TestZRC20 *TestZRC20Caller) GASLIMIT(opts *bind.CallOpts) (*big.Int, error) {
+ var out []interface{}
+ err := _TestZRC20.contract.Call(opts, &out, "GAS_LIMIT")
+
+ if err != nil {
+ return *new(*big.Int), err
+ }
+
+ out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
+
+ return out0, err
+
+}
+
+// GASLIMIT is a free data retrieval call binding the contract method 0x091d2788.
+//
+// Solidity: function GAS_LIMIT() view returns(uint256)
+func (_TestZRC20 *TestZRC20Session) GASLIMIT() (*big.Int, error) {
+ return _TestZRC20.Contract.GASLIMIT(&_TestZRC20.CallOpts)
+}
+
+// GASLIMIT is a free data retrieval call binding the contract method 0x091d2788.
+//
+// Solidity: function GAS_LIMIT() view returns(uint256)
+func (_TestZRC20 *TestZRC20CallerSession) GASLIMIT() (*big.Int, error) {
+ return _TestZRC20.Contract.GASLIMIT(&_TestZRC20.CallOpts)
+}
+
+// PROTOCOLFLATFEE is a free data retrieval call binding the contract method 0x4d8943bb.
+//
+// Solidity: function PROTOCOL_FLAT_FEE() view returns(uint256)
+func (_TestZRC20 *TestZRC20Caller) PROTOCOLFLATFEE(opts *bind.CallOpts) (*big.Int, error) {
+ var out []interface{}
+ err := _TestZRC20.contract.Call(opts, &out, "PROTOCOL_FLAT_FEE")
+
+ if err != nil {
+ return *new(*big.Int), err
+ }
+
+ out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
+
+ return out0, err
+
+}
+
+// PROTOCOLFLATFEE is a free data retrieval call binding the contract method 0x4d8943bb.
+//
+// Solidity: function PROTOCOL_FLAT_FEE() view returns(uint256)
+func (_TestZRC20 *TestZRC20Session) PROTOCOLFLATFEE() (*big.Int, error) {
+ return _TestZRC20.Contract.PROTOCOLFLATFEE(&_TestZRC20.CallOpts)
+}
+
+// PROTOCOLFLATFEE is a free data retrieval call binding the contract method 0x4d8943bb.
+//
+// Solidity: function PROTOCOL_FLAT_FEE() view returns(uint256)
+func (_TestZRC20 *TestZRC20CallerSession) PROTOCOLFLATFEE() (*big.Int, error) {
+ return _TestZRC20.Contract.PROTOCOLFLATFEE(&_TestZRC20.CallOpts)
+}
+
+// SYSTEMCONTRACTADDRESS is a free data retrieval call binding the contract method 0xf2441b32.
+//
+// Solidity: function SYSTEM_CONTRACT_ADDRESS() view returns(address)
+func (_TestZRC20 *TestZRC20Caller) SYSTEMCONTRACTADDRESS(opts *bind.CallOpts) (common.Address, error) {
+ var out []interface{}
+ err := _TestZRC20.contract.Call(opts, &out, "SYSTEM_CONTRACT_ADDRESS")
+
+ if err != nil {
+ return *new(common.Address), err
+ }
+
+ out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
+
+ return out0, err
+
+}
+
+// SYSTEMCONTRACTADDRESS is a free data retrieval call binding the contract method 0xf2441b32.
+//
+// Solidity: function SYSTEM_CONTRACT_ADDRESS() view returns(address)
+func (_TestZRC20 *TestZRC20Session) SYSTEMCONTRACTADDRESS() (common.Address, error) {
+ return _TestZRC20.Contract.SYSTEMCONTRACTADDRESS(&_TestZRC20.CallOpts)
+}
+
+// SYSTEMCONTRACTADDRESS is a free data retrieval call binding the contract method 0xf2441b32.
+//
+// Solidity: function SYSTEM_CONTRACT_ADDRESS() view returns(address)
+func (_TestZRC20 *TestZRC20CallerSession) SYSTEMCONTRACTADDRESS() (common.Address, error) {
+ return _TestZRC20.Contract.SYSTEMCONTRACTADDRESS(&_TestZRC20.CallOpts)
+}
+
+// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e.
+//
+// Solidity: function allowance(address owner, address spender) view returns(uint256)
+func (_TestZRC20 *TestZRC20Caller) Allowance(opts *bind.CallOpts, owner common.Address, spender common.Address) (*big.Int, error) {
+ var out []interface{}
+ err := _TestZRC20.contract.Call(opts, &out, "allowance", owner, spender)
+
+ if err != nil {
+ return *new(*big.Int), err
+ }
+
+ out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
+
+ return out0, err
+
+}
+
+// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e.
+//
+// Solidity: function allowance(address owner, address spender) view returns(uint256)
+func (_TestZRC20 *TestZRC20Session) Allowance(owner common.Address, spender common.Address) (*big.Int, error) {
+ return _TestZRC20.Contract.Allowance(&_TestZRC20.CallOpts, owner, spender)
+}
+
+// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e.
+//
+// Solidity: function allowance(address owner, address spender) view returns(uint256)
+func (_TestZRC20 *TestZRC20CallerSession) Allowance(owner common.Address, spender common.Address) (*big.Int, error) {
+ return _TestZRC20.Contract.Allowance(&_TestZRC20.CallOpts, owner, spender)
+}
+
+// BalanceOf is a free data retrieval call binding the contract method 0x70a08231.
+//
+// Solidity: function balanceOf(address account) view returns(uint256)
+func (_TestZRC20 *TestZRC20Caller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {
+ var out []interface{}
+ err := _TestZRC20.contract.Call(opts, &out, "balanceOf", account)
+
+ if err != nil {
+ return *new(*big.Int), err
+ }
+
+ out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
+
+ return out0, err
+
+}
+
+// BalanceOf is a free data retrieval call binding the contract method 0x70a08231.
+//
+// Solidity: function balanceOf(address account) view returns(uint256)
+func (_TestZRC20 *TestZRC20Session) BalanceOf(account common.Address) (*big.Int, error) {
+ return _TestZRC20.Contract.BalanceOf(&_TestZRC20.CallOpts, account)
+}
+
+// BalanceOf is a free data retrieval call binding the contract method 0x70a08231.
+//
+// Solidity: function balanceOf(address account) view returns(uint256)
+func (_TestZRC20 *TestZRC20CallerSession) BalanceOf(account common.Address) (*big.Int, error) {
+ return _TestZRC20.Contract.BalanceOf(&_TestZRC20.CallOpts, account)
+}
+
+// Decimals is a free data retrieval call binding the contract method 0x313ce567.
+//
+// Solidity: function decimals() view returns(uint8)
+func (_TestZRC20 *TestZRC20Caller) Decimals(opts *bind.CallOpts) (uint8, error) {
+ var out []interface{}
+ err := _TestZRC20.contract.Call(opts, &out, "decimals")
+
+ if err != nil {
+ return *new(uint8), err
+ }
+
+ out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8)
+
+ return out0, err
+
+}
+
+// Decimals is a free data retrieval call binding the contract method 0x313ce567.
+//
+// Solidity: function decimals() view returns(uint8)
+func (_TestZRC20 *TestZRC20Session) Decimals() (uint8, error) {
+ return _TestZRC20.Contract.Decimals(&_TestZRC20.CallOpts)
+}
+
+// Decimals is a free data retrieval call binding the contract method 0x313ce567.
+//
+// Solidity: function decimals() view returns(uint8)
+func (_TestZRC20 *TestZRC20CallerSession) Decimals() (uint8, error) {
+ return _TestZRC20.Contract.Decimals(&_TestZRC20.CallOpts)
+}
+
+// Name is a free data retrieval call binding the contract method 0x06fdde03.
+//
+// Solidity: function name() view returns(string)
+func (_TestZRC20 *TestZRC20Caller) Name(opts *bind.CallOpts) (string, error) {
+ var out []interface{}
+ err := _TestZRC20.contract.Call(opts, &out, "name")
+
+ if err != nil {
+ return *new(string), err
+ }
+
+ out0 := *abi.ConvertType(out[0], new(string)).(*string)
+
+ return out0, err
+
+}
+
+// Name is a free data retrieval call binding the contract method 0x06fdde03.
+//
+// Solidity: function name() view returns(string)
+func (_TestZRC20 *TestZRC20Session) Name() (string, error) {
+ return _TestZRC20.Contract.Name(&_TestZRC20.CallOpts)
+}
+
+// Name is a free data retrieval call binding the contract method 0x06fdde03.
+//
+// Solidity: function name() view returns(string)
+func (_TestZRC20 *TestZRC20CallerSession) Name() (string, error) {
+ return _TestZRC20.Contract.Name(&_TestZRC20.CallOpts)
+}
+
+// NewField is a free data retrieval call binding the contract method 0xa7605f45.
+//
+// Solidity: function newField() view returns(uint256)
+func (_TestZRC20 *TestZRC20Caller) NewField(opts *bind.CallOpts) (*big.Int, error) {
+ var out []interface{}
+ err := _TestZRC20.contract.Call(opts, &out, "newField")
+
+ if err != nil {
+ return *new(*big.Int), err
+ }
+
+ out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
+
+ return out0, err
+
+}
+
+// NewField is a free data retrieval call binding the contract method 0xa7605f45.
+//
+// Solidity: function newField() view returns(uint256)
+func (_TestZRC20 *TestZRC20Session) NewField() (*big.Int, error) {
+ return _TestZRC20.Contract.NewField(&_TestZRC20.CallOpts)
+}
+
+// NewField is a free data retrieval call binding the contract method 0xa7605f45.
+//
+// Solidity: function newField() view returns(uint256)
+func (_TestZRC20 *TestZRC20CallerSession) NewField() (*big.Int, error) {
+ return _TestZRC20.Contract.NewField(&_TestZRC20.CallOpts)
+}
+
+// NewPublicField is a free data retrieval call binding the contract method 0xb92894ba.
+//
+// Solidity: function newPublicField() view returns(string)
+func (_TestZRC20 *TestZRC20Caller) NewPublicField(opts *bind.CallOpts) (string, error) {
+ var out []interface{}
+ err := _TestZRC20.contract.Call(opts, &out, "newPublicField")
+
+ if err != nil {
+ return *new(string), err
+ }
+
+ out0 := *abi.ConvertType(out[0], new(string)).(*string)
+
+ return out0, err
+
+}
+
+// NewPublicField is a free data retrieval call binding the contract method 0xb92894ba.
+//
+// Solidity: function newPublicField() view returns(string)
+func (_TestZRC20 *TestZRC20Session) NewPublicField() (string, error) {
+ return _TestZRC20.Contract.NewPublicField(&_TestZRC20.CallOpts)
+}
+
+// NewPublicField is a free data retrieval call binding the contract method 0xb92894ba.
+//
+// Solidity: function newPublicField() view returns(string)
+func (_TestZRC20 *TestZRC20CallerSession) NewPublicField() (string, error) {
+ return _TestZRC20.Contract.NewPublicField(&_TestZRC20.CallOpts)
+}
+
+// Symbol is a free data retrieval call binding the contract method 0x95d89b41.
+//
+// Solidity: function symbol() view returns(string)
+func (_TestZRC20 *TestZRC20Caller) Symbol(opts *bind.CallOpts) (string, error) {
+ var out []interface{}
+ err := _TestZRC20.contract.Call(opts, &out, "symbol")
+
+ if err != nil {
+ return *new(string), err
+ }
+
+ out0 := *abi.ConvertType(out[0], new(string)).(*string)
+
+ return out0, err
+
+}
+
+// Symbol is a free data retrieval call binding the contract method 0x95d89b41.
+//
+// Solidity: function symbol() view returns(string)
+func (_TestZRC20 *TestZRC20Session) Symbol() (string, error) {
+ return _TestZRC20.Contract.Symbol(&_TestZRC20.CallOpts)
+}
+
+// Symbol is a free data retrieval call binding the contract method 0x95d89b41.
+//
+// Solidity: function symbol() view returns(string)
+func (_TestZRC20 *TestZRC20CallerSession) Symbol() (string, error) {
+ return _TestZRC20.Contract.Symbol(&_TestZRC20.CallOpts)
+}
+
+// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd.
+//
+// Solidity: function totalSupply() view returns(uint256)
+func (_TestZRC20 *TestZRC20Caller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) {
+ var out []interface{}
+ err := _TestZRC20.contract.Call(opts, &out, "totalSupply")
+
+ if err != nil {
+ return *new(*big.Int), err
+ }
+
+ out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
+
+ return out0, err
+
+}
+
+// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd.
+//
+// Solidity: function totalSupply() view returns(uint256)
+func (_TestZRC20 *TestZRC20Session) TotalSupply() (*big.Int, error) {
+ return _TestZRC20.Contract.TotalSupply(&_TestZRC20.CallOpts)
+}
+
+// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd.
+//
+// Solidity: function totalSupply() view returns(uint256)
+func (_TestZRC20 *TestZRC20CallerSession) TotalSupply() (*big.Int, error) {
+ return _TestZRC20.Contract.TotalSupply(&_TestZRC20.CallOpts)
+}
+
+// WithdrawGasFee is a free data retrieval call binding the contract method 0xd9eeebed.
+//
+// Solidity: function withdrawGasFee() view returns(address, uint256)
+func (_TestZRC20 *TestZRC20Caller) WithdrawGasFee(opts *bind.CallOpts) (common.Address, *big.Int, error) {
+ var out []interface{}
+ err := _TestZRC20.contract.Call(opts, &out, "withdrawGasFee")
+
+ if err != nil {
+ return *new(common.Address), *new(*big.Int), err
+ }
+
+ out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
+ out1 := *abi.ConvertType(out[1], new(*big.Int)).(**big.Int)
+
+ return out0, out1, err
+
+}
+
+// WithdrawGasFee is a free data retrieval call binding the contract method 0xd9eeebed.
+//
+// Solidity: function withdrawGasFee() view returns(address, uint256)
+func (_TestZRC20 *TestZRC20Session) WithdrawGasFee() (common.Address, *big.Int, error) {
+ return _TestZRC20.Contract.WithdrawGasFee(&_TestZRC20.CallOpts)
+}
+
+// WithdrawGasFee is a free data retrieval call binding the contract method 0xd9eeebed.
+//
+// Solidity: function withdrawGasFee() view returns(address, uint256)
+func (_TestZRC20 *TestZRC20CallerSession) WithdrawGasFee() (common.Address, *big.Int, error) {
+ return _TestZRC20.Contract.WithdrawGasFee(&_TestZRC20.CallOpts)
+}
+
+// Approve is a paid mutator transaction binding the contract method 0x095ea7b3.
+//
+// Solidity: function approve(address spender, uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20Transactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.contract.Transact(opts, "approve", spender, amount)
+}
+
+// Approve is a paid mutator transaction binding the contract method 0x095ea7b3.
+//
+// Solidity: function approve(address spender, uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20Session) Approve(spender common.Address, amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.Contract.Approve(&_TestZRC20.TransactOpts, spender, amount)
+}
+
+// Approve is a paid mutator transaction binding the contract method 0x095ea7b3.
+//
+// Solidity: function approve(address spender, uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20TransactorSession) Approve(spender common.Address, amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.Contract.Approve(&_TestZRC20.TransactOpts, spender, amount)
+}
+
+// Burn is a paid mutator transaction binding the contract method 0x42966c68.
+//
+// Solidity: function burn(uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20Transactor) Burn(opts *bind.TransactOpts, amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.contract.Transact(opts, "burn", amount)
+}
+
+// Burn is a paid mutator transaction binding the contract method 0x42966c68.
+//
+// Solidity: function burn(uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20Session) Burn(amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.Contract.Burn(&_TestZRC20.TransactOpts, amount)
+}
+
+// Burn is a paid mutator transaction binding the contract method 0x42966c68.
+//
+// Solidity: function burn(uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20TransactorSession) Burn(amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.Contract.Burn(&_TestZRC20.TransactOpts, amount)
+}
+
+// DecreaseAllowance is a paid mutator transaction binding the contract method 0xa457c2d7.
+//
+// Solidity: function decreaseAllowance(address spender, uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20Transactor) DecreaseAllowance(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.contract.Transact(opts, "decreaseAllowance", spender, amount)
+}
+
+// DecreaseAllowance is a paid mutator transaction binding the contract method 0xa457c2d7.
+//
+// Solidity: function decreaseAllowance(address spender, uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20Session) DecreaseAllowance(spender common.Address, amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.Contract.DecreaseAllowance(&_TestZRC20.TransactOpts, spender, amount)
+}
+
+// DecreaseAllowance is a paid mutator transaction binding the contract method 0xa457c2d7.
+//
+// Solidity: function decreaseAllowance(address spender, uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20TransactorSession) DecreaseAllowance(spender common.Address, amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.Contract.DecreaseAllowance(&_TestZRC20.TransactOpts, spender, amount)
+}
+
+// Deposit is a paid mutator transaction binding the contract method 0x47e7ef24.
+//
+// Solidity: function deposit(address to, uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20Transactor) Deposit(opts *bind.TransactOpts, to common.Address, amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.contract.Transact(opts, "deposit", to, amount)
+}
+
+// Deposit is a paid mutator transaction binding the contract method 0x47e7ef24.
+//
+// Solidity: function deposit(address to, uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20Session) Deposit(to common.Address, amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.Contract.Deposit(&_TestZRC20.TransactOpts, to, amount)
+}
+
+// Deposit is a paid mutator transaction binding the contract method 0x47e7ef24.
+//
+// Solidity: function deposit(address to, uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20TransactorSession) Deposit(to common.Address, amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.Contract.Deposit(&_TestZRC20.TransactOpts, to, amount)
+}
+
+// IncreaseAllowance is a paid mutator transaction binding the contract method 0x39509351.
+//
+// Solidity: function increaseAllowance(address spender, uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20Transactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.contract.Transact(opts, "increaseAllowance", spender, amount)
+}
+
+// IncreaseAllowance is a paid mutator transaction binding the contract method 0x39509351.
+//
+// Solidity: function increaseAllowance(address spender, uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20Session) IncreaseAllowance(spender common.Address, amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.Contract.IncreaseAllowance(&_TestZRC20.TransactOpts, spender, amount)
+}
+
+// IncreaseAllowance is a paid mutator transaction binding the contract method 0x39509351.
+//
+// Solidity: function increaseAllowance(address spender, uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20TransactorSession) IncreaseAllowance(spender common.Address, amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.Contract.IncreaseAllowance(&_TestZRC20.TransactOpts, spender, amount)
+}
+
+// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb.
+//
+// Solidity: function transfer(address recipient, uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20Transactor) Transfer(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.contract.Transact(opts, "transfer", recipient, amount)
+}
+
+// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb.
+//
+// Solidity: function transfer(address recipient, uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20Session) Transfer(recipient common.Address, amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.Contract.Transfer(&_TestZRC20.TransactOpts, recipient, amount)
+}
+
+// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb.
+//
+// Solidity: function transfer(address recipient, uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20TransactorSession) Transfer(recipient common.Address, amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.Contract.Transfer(&_TestZRC20.TransactOpts, recipient, amount)
+}
+
+// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd.
+//
+// Solidity: function transferFrom(address sender, address recipient, uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20Transactor) TransferFrom(opts *bind.TransactOpts, sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.contract.Transact(opts, "transferFrom", sender, recipient, amount)
+}
+
+// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd.
+//
+// Solidity: function transferFrom(address sender, address recipient, uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20Session) TransferFrom(sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.Contract.TransferFrom(&_TestZRC20.TransactOpts, sender, recipient, amount)
+}
+
+// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd.
+//
+// Solidity: function transferFrom(address sender, address recipient, uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20TransactorSession) TransferFrom(sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.Contract.TransferFrom(&_TestZRC20.TransactOpts, sender, recipient, amount)
+}
+
+// UpdateGasLimit is a paid mutator transaction binding the contract method 0xf687d12a.
+//
+// Solidity: function updateGasLimit(uint256 gasLimit) returns()
+func (_TestZRC20 *TestZRC20Transactor) UpdateGasLimit(opts *bind.TransactOpts, gasLimit *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.contract.Transact(opts, "updateGasLimit", gasLimit)
+}
+
+// UpdateGasLimit is a paid mutator transaction binding the contract method 0xf687d12a.
+//
+// Solidity: function updateGasLimit(uint256 gasLimit) returns()
+func (_TestZRC20 *TestZRC20Session) UpdateGasLimit(gasLimit *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.Contract.UpdateGasLimit(&_TestZRC20.TransactOpts, gasLimit)
+}
+
+// UpdateGasLimit is a paid mutator transaction binding the contract method 0xf687d12a.
+//
+// Solidity: function updateGasLimit(uint256 gasLimit) returns()
+func (_TestZRC20 *TestZRC20TransactorSession) UpdateGasLimit(gasLimit *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.Contract.UpdateGasLimit(&_TestZRC20.TransactOpts, gasLimit)
+}
+
+// UpdateNewField is a paid mutator transaction binding the contract method 0x732bb0e4.
+//
+// Solidity: function updateNewField(uint256 newField_) returns()
+func (_TestZRC20 *TestZRC20Transactor) UpdateNewField(opts *bind.TransactOpts, newField_ *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.contract.Transact(opts, "updateNewField", newField_)
+}
+
+// UpdateNewField is a paid mutator transaction binding the contract method 0x732bb0e4.
+//
+// Solidity: function updateNewField(uint256 newField_) returns()
+func (_TestZRC20 *TestZRC20Session) UpdateNewField(newField_ *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.Contract.UpdateNewField(&_TestZRC20.TransactOpts, newField_)
+}
+
+// UpdateNewField is a paid mutator transaction binding the contract method 0x732bb0e4.
+//
+// Solidity: function updateNewField(uint256 newField_) returns()
+func (_TestZRC20 *TestZRC20TransactorSession) UpdateNewField(newField_ *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.Contract.UpdateNewField(&_TestZRC20.TransactOpts, newField_)
+}
+
+// UpdateProtocolFlatFee is a paid mutator transaction binding the contract method 0xeddeb123.
+//
+// Solidity: function updateProtocolFlatFee(uint256 protocolFlatFee) returns()
+func (_TestZRC20 *TestZRC20Transactor) UpdateProtocolFlatFee(opts *bind.TransactOpts, protocolFlatFee *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.contract.Transact(opts, "updateProtocolFlatFee", protocolFlatFee)
+}
+
+// UpdateProtocolFlatFee is a paid mutator transaction binding the contract method 0xeddeb123.
+//
+// Solidity: function updateProtocolFlatFee(uint256 protocolFlatFee) returns()
+func (_TestZRC20 *TestZRC20Session) UpdateProtocolFlatFee(protocolFlatFee *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.Contract.UpdateProtocolFlatFee(&_TestZRC20.TransactOpts, protocolFlatFee)
+}
+
+// UpdateProtocolFlatFee is a paid mutator transaction binding the contract method 0xeddeb123.
+//
+// Solidity: function updateProtocolFlatFee(uint256 protocolFlatFee) returns()
+func (_TestZRC20 *TestZRC20TransactorSession) UpdateProtocolFlatFee(protocolFlatFee *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.Contract.UpdateProtocolFlatFee(&_TestZRC20.TransactOpts, protocolFlatFee)
+}
+
+// UpdateSystemContractAddress is a paid mutator transaction binding the contract method 0xc835d7cc.
+//
+// Solidity: function updateSystemContractAddress(address addr) returns()
+func (_TestZRC20 *TestZRC20Transactor) UpdateSystemContractAddress(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) {
+ return _TestZRC20.contract.Transact(opts, "updateSystemContractAddress", addr)
+}
+
+// UpdateSystemContractAddress is a paid mutator transaction binding the contract method 0xc835d7cc.
+//
+// Solidity: function updateSystemContractAddress(address addr) returns()
+func (_TestZRC20 *TestZRC20Session) UpdateSystemContractAddress(addr common.Address) (*types.Transaction, error) {
+ return _TestZRC20.Contract.UpdateSystemContractAddress(&_TestZRC20.TransactOpts, addr)
+}
+
+// UpdateSystemContractAddress is a paid mutator transaction binding the contract method 0xc835d7cc.
+//
+// Solidity: function updateSystemContractAddress(address addr) returns()
+func (_TestZRC20 *TestZRC20TransactorSession) UpdateSystemContractAddress(addr common.Address) (*types.Transaction, error) {
+ return _TestZRC20.Contract.UpdateSystemContractAddress(&_TestZRC20.TransactOpts, addr)
+}
+
+// Withdraw is a paid mutator transaction binding the contract method 0xc7012626.
+//
+// Solidity: function withdraw(bytes to, uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20Transactor) Withdraw(opts *bind.TransactOpts, to []byte, amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.contract.Transact(opts, "withdraw", to, amount)
+}
+
+// Withdraw is a paid mutator transaction binding the contract method 0xc7012626.
+//
+// Solidity: function withdraw(bytes to, uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20Session) Withdraw(to []byte, amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.Contract.Withdraw(&_TestZRC20.TransactOpts, to, amount)
+}
+
+// Withdraw is a paid mutator transaction binding the contract method 0xc7012626.
+//
+// Solidity: function withdraw(bytes to, uint256 amount) returns(bool)
+func (_TestZRC20 *TestZRC20TransactorSession) Withdraw(to []byte, amount *big.Int) (*types.Transaction, error) {
+ return _TestZRC20.Contract.Withdraw(&_TestZRC20.TransactOpts, to, amount)
+}
+
+// TestZRC20ApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the TestZRC20 contract.
+type TestZRC20ApprovalIterator struct {
+ Event *TestZRC20Approval // Event containing the contract specifics and raw log
+
+ contract *bind.BoundContract // Generic contract to use for unpacking event data
+ event string // Event name to use for unpacking event data
+
+ logs chan types.Log // Log channel receiving the found contract events
+ sub ethereum.Subscription // Subscription for errors, completion and termination
+ done bool // Whether the subscription completed delivering logs
+ fail error // Occurred error to stop iteration
+}
+
+// Next advances the iterator to the subsequent event, returning whether there
+// are any more events found. In case of a retrieval or parsing error, false is
+// returned and Error() can be queried for the exact failure.
+func (it *TestZRC20ApprovalIterator) Next() bool {
+ // If the iterator failed, stop iterating
+ if it.fail != nil {
+ return false
+ }
+ // If the iterator completed, deliver directly whatever's available
+ if it.done {
+ select {
+ case log := <-it.logs:
+ it.Event = new(TestZRC20Approval)
+ if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
+ it.fail = err
+ return false
+ }
+ it.Event.Raw = log
+ return true
+
+ default:
+ return false
+ }
+ }
+ // Iterator still in progress, wait for either a data or an error event
+ select {
+ case log := <-it.logs:
+ it.Event = new(TestZRC20Approval)
+ if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
+ it.fail = err
+ return false
+ }
+ it.Event.Raw = log
+ return true
+
+ case err := <-it.sub.Err():
+ it.done = true
+ it.fail = err
+ return it.Next()
+ }
+}
+
+// Error returns any retrieval or parsing error occurred during filtering.
+func (it *TestZRC20ApprovalIterator) Error() error {
+ return it.fail
+}
+
+// Close terminates the iteration process, releasing any pending underlying
+// resources.
+func (it *TestZRC20ApprovalIterator) Close() error {
+ it.sub.Unsubscribe()
+ return nil
+}
+
+// TestZRC20Approval represents a Approval event raised by the TestZRC20 contract.
+type TestZRC20Approval struct {
+ Owner common.Address
+ Spender common.Address
+ Value *big.Int
+ Raw types.Log // Blockchain specific contextual infos
+}
+
+// FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925.
+//
+// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value)
+func (_TestZRC20 *TestZRC20Filterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*TestZRC20ApprovalIterator, error) {
+
+ var ownerRule []interface{}
+ for _, ownerItem := range owner {
+ ownerRule = append(ownerRule, ownerItem)
+ }
+ var spenderRule []interface{}
+ for _, spenderItem := range spender {
+ spenderRule = append(spenderRule, spenderItem)
+ }
+
+ logs, sub, err := _TestZRC20.contract.FilterLogs(opts, "Approval", ownerRule, spenderRule)
+ if err != nil {
+ return nil, err
+ }
+ return &TestZRC20ApprovalIterator{contract: _TestZRC20.contract, event: "Approval", logs: logs, sub: sub}, nil
+}
+
+// WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925.
+//
+// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value)
+func (_TestZRC20 *TestZRC20Filterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *TestZRC20Approval, owner []common.Address, spender []common.Address) (event.Subscription, error) {
+
+ var ownerRule []interface{}
+ for _, ownerItem := range owner {
+ ownerRule = append(ownerRule, ownerItem)
+ }
+ var spenderRule []interface{}
+ for _, spenderItem := range spender {
+ spenderRule = append(spenderRule, spenderItem)
+ }
+
+ logs, sub, err := _TestZRC20.contract.WatchLogs(opts, "Approval", ownerRule, spenderRule)
+ if err != nil {
+ return nil, err
+ }
+ return event.NewSubscription(func(quit <-chan struct{}) error {
+ defer sub.Unsubscribe()
+ for {
+ select {
+ case log := <-logs:
+ // New log arrived, parse the event and forward to the user
+ event := new(TestZRC20Approval)
+ if err := _TestZRC20.contract.UnpackLog(event, "Approval", log); err != nil {
+ return err
+ }
+ event.Raw = log
+
+ select {
+ case sink <- event:
+ case err := <-sub.Err():
+ return err
+ case <-quit:
+ return nil
+ }
+ case err := <-sub.Err():
+ return err
+ case <-quit:
+ return nil
+ }
+ }
+ }), nil
+}
+
+// ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925.
+//
+// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value)
+func (_TestZRC20 *TestZRC20Filterer) ParseApproval(log types.Log) (*TestZRC20Approval, error) {
+ event := new(TestZRC20Approval)
+ if err := _TestZRC20.contract.UnpackLog(event, "Approval", log); err != nil {
+ return nil, err
+ }
+ event.Raw = log
+ return event, nil
+}
+
+// TestZRC20DepositIterator is returned from FilterDeposit and is used to iterate over the raw logs and unpacked data for Deposit events raised by the TestZRC20 contract.
+type TestZRC20DepositIterator struct {
+ Event *TestZRC20Deposit // Event containing the contract specifics and raw log
+
+ contract *bind.BoundContract // Generic contract to use for unpacking event data
+ event string // Event name to use for unpacking event data
+
+ logs chan types.Log // Log channel receiving the found contract events
+ sub ethereum.Subscription // Subscription for errors, completion and termination
+ done bool // Whether the subscription completed delivering logs
+ fail error // Occurred error to stop iteration
+}
+
+// Next advances the iterator to the subsequent event, returning whether there
+// are any more events found. In case of a retrieval or parsing error, false is
+// returned and Error() can be queried for the exact failure.
+func (it *TestZRC20DepositIterator) Next() bool {
+ // If the iterator failed, stop iterating
+ if it.fail != nil {
+ return false
+ }
+ // If the iterator completed, deliver directly whatever's available
+ if it.done {
+ select {
+ case log := <-it.logs:
+ it.Event = new(TestZRC20Deposit)
+ if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
+ it.fail = err
+ return false
+ }
+ it.Event.Raw = log
+ return true
+
+ default:
+ return false
+ }
+ }
+ // Iterator still in progress, wait for either a data or an error event
+ select {
+ case log := <-it.logs:
+ it.Event = new(TestZRC20Deposit)
+ if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
+ it.fail = err
+ return false
+ }
+ it.Event.Raw = log
+ return true
+
+ case err := <-it.sub.Err():
+ it.done = true
+ it.fail = err
+ return it.Next()
+ }
+}
+
+// Error returns any retrieval or parsing error occurred during filtering.
+func (it *TestZRC20DepositIterator) Error() error {
+ return it.fail
+}
+
+// Close terminates the iteration process, releasing any pending underlying
+// resources.
+func (it *TestZRC20DepositIterator) Close() error {
+ it.sub.Unsubscribe()
+ return nil
+}
+
+// TestZRC20Deposit represents a Deposit event raised by the TestZRC20 contract.
+type TestZRC20Deposit struct {
+ From []byte
+ To common.Address
+ Value *big.Int
+ Raw types.Log // Blockchain specific contextual infos
+}
+
+// FilterDeposit is a free log retrieval operation binding the contract event 0x67fc7bdaed5b0ec550d8706b87d60568ab70c6b781263c70101d54cd1564aab3.
+//
+// Solidity: event Deposit(bytes from, address indexed to, uint256 value)
+func (_TestZRC20 *TestZRC20Filterer) FilterDeposit(opts *bind.FilterOpts, to []common.Address) (*TestZRC20DepositIterator, error) {
+
+ var toRule []interface{}
+ for _, toItem := range to {
+ toRule = append(toRule, toItem)
+ }
+
+ logs, sub, err := _TestZRC20.contract.FilterLogs(opts, "Deposit", toRule)
+ if err != nil {
+ return nil, err
+ }
+ return &TestZRC20DepositIterator{contract: _TestZRC20.contract, event: "Deposit", logs: logs, sub: sub}, nil
+}
+
+// WatchDeposit is a free log subscription operation binding the contract event 0x67fc7bdaed5b0ec550d8706b87d60568ab70c6b781263c70101d54cd1564aab3.
+//
+// Solidity: event Deposit(bytes from, address indexed to, uint256 value)
+func (_TestZRC20 *TestZRC20Filterer) WatchDeposit(opts *bind.WatchOpts, sink chan<- *TestZRC20Deposit, to []common.Address) (event.Subscription, error) {
+
+ var toRule []interface{}
+ for _, toItem := range to {
+ toRule = append(toRule, toItem)
+ }
+
+ logs, sub, err := _TestZRC20.contract.WatchLogs(opts, "Deposit", toRule)
+ if err != nil {
+ return nil, err
+ }
+ return event.NewSubscription(func(quit <-chan struct{}) error {
+ defer sub.Unsubscribe()
+ for {
+ select {
+ case log := <-logs:
+ // New log arrived, parse the event and forward to the user
+ event := new(TestZRC20Deposit)
+ if err := _TestZRC20.contract.UnpackLog(event, "Deposit", log); err != nil {
+ return err
+ }
+ event.Raw = log
+
+ select {
+ case sink <- event:
+ case err := <-sub.Err():
+ return err
+ case <-quit:
+ return nil
+ }
+ case err := <-sub.Err():
+ return err
+ case <-quit:
+ return nil
+ }
+ }
+ }), nil
+}
+
+// ParseDeposit is a log parse operation binding the contract event 0x67fc7bdaed5b0ec550d8706b87d60568ab70c6b781263c70101d54cd1564aab3.
+//
+// Solidity: event Deposit(bytes from, address indexed to, uint256 value)
+func (_TestZRC20 *TestZRC20Filterer) ParseDeposit(log types.Log) (*TestZRC20Deposit, error) {
+ event := new(TestZRC20Deposit)
+ if err := _TestZRC20.contract.UnpackLog(event, "Deposit", log); err != nil {
+ return nil, err
+ }
+ event.Raw = log
+ return event, nil
+}
+
+// TestZRC20TransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the TestZRC20 contract.
+type TestZRC20TransferIterator struct {
+ Event *TestZRC20Transfer // Event containing the contract specifics and raw log
+
+ contract *bind.BoundContract // Generic contract to use for unpacking event data
+ event string // Event name to use for unpacking event data
+
+ logs chan types.Log // Log channel receiving the found contract events
+ sub ethereum.Subscription // Subscription for errors, completion and termination
+ done bool // Whether the subscription completed delivering logs
+ fail error // Occurred error to stop iteration
+}
+
+// Next advances the iterator to the subsequent event, returning whether there
+// are any more events found. In case of a retrieval or parsing error, false is
+// returned and Error() can be queried for the exact failure.
+func (it *TestZRC20TransferIterator) Next() bool {
+ // If the iterator failed, stop iterating
+ if it.fail != nil {
+ return false
+ }
+ // If the iterator completed, deliver directly whatever's available
+ if it.done {
+ select {
+ case log := <-it.logs:
+ it.Event = new(TestZRC20Transfer)
+ if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
+ it.fail = err
+ return false
+ }
+ it.Event.Raw = log
+ return true
+
+ default:
+ return false
+ }
+ }
+ // Iterator still in progress, wait for either a data or an error event
+ select {
+ case log := <-it.logs:
+ it.Event = new(TestZRC20Transfer)
+ if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
+ it.fail = err
+ return false
+ }
+ it.Event.Raw = log
+ return true
+
+ case err := <-it.sub.Err():
+ it.done = true
+ it.fail = err
+ return it.Next()
+ }
+}
+
+// Error returns any retrieval or parsing error occurred during filtering.
+func (it *TestZRC20TransferIterator) Error() error {
+ return it.fail
+}
+
+// Close terminates the iteration process, releasing any pending underlying
+// resources.
+func (it *TestZRC20TransferIterator) Close() error {
+ it.sub.Unsubscribe()
+ return nil
+}
+
+// TestZRC20Transfer represents a Transfer event raised by the TestZRC20 contract.
+type TestZRC20Transfer struct {
+ From common.Address
+ To common.Address
+ Value *big.Int
+ Raw types.Log // Blockchain specific contextual infos
+}
+
+// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef.
+//
+// Solidity: event Transfer(address indexed from, address indexed to, uint256 value)
+func (_TestZRC20 *TestZRC20Filterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*TestZRC20TransferIterator, error) {
+
+ var fromRule []interface{}
+ for _, fromItem := range from {
+ fromRule = append(fromRule, fromItem)
+ }
+ var toRule []interface{}
+ for _, toItem := range to {
+ toRule = append(toRule, toItem)
+ }
+
+ logs, sub, err := _TestZRC20.contract.FilterLogs(opts, "Transfer", fromRule, toRule)
+ if err != nil {
+ return nil, err
+ }
+ return &TestZRC20TransferIterator{contract: _TestZRC20.contract, event: "Transfer", logs: logs, sub: sub}, nil
+}
+
+// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef.
+//
+// Solidity: event Transfer(address indexed from, address indexed to, uint256 value)
+func (_TestZRC20 *TestZRC20Filterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *TestZRC20Transfer, from []common.Address, to []common.Address) (event.Subscription, error) {
+
+ var fromRule []interface{}
+ for _, fromItem := range from {
+ fromRule = append(fromRule, fromItem)
+ }
+ var toRule []interface{}
+ for _, toItem := range to {
+ toRule = append(toRule, toItem)
+ }
+
+ logs, sub, err := _TestZRC20.contract.WatchLogs(opts, "Transfer", fromRule, toRule)
+ if err != nil {
+ return nil, err
+ }
+ return event.NewSubscription(func(quit <-chan struct{}) error {
+ defer sub.Unsubscribe()
+ for {
+ select {
+ case log := <-logs:
+ // New log arrived, parse the event and forward to the user
+ event := new(TestZRC20Transfer)
+ if err := _TestZRC20.contract.UnpackLog(event, "Transfer", log); err != nil {
+ return err
+ }
+ event.Raw = log
+
+ select {
+ case sink <- event:
+ case err := <-sub.Err():
+ return err
+ case <-quit:
+ return nil
+ }
+ case err := <-sub.Err():
+ return err
+ case <-quit:
+ return nil
+ }
+ }
+ }), nil
+}
+
+// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef.
+//
+// Solidity: event Transfer(address indexed from, address indexed to, uint256 value)
+func (_TestZRC20 *TestZRC20Filterer) ParseTransfer(log types.Log) (*TestZRC20Transfer, error) {
+ event := new(TestZRC20Transfer)
+ if err := _TestZRC20.contract.UnpackLog(event, "Transfer", log); err != nil {
+ return nil, err
+ }
+ event.Raw = log
+ return event, nil
+}
+
+// TestZRC20UpdatedGasLimitIterator is returned from FilterUpdatedGasLimit and is used to iterate over the raw logs and unpacked data for UpdatedGasLimit events raised by the TestZRC20 contract.
+type TestZRC20UpdatedGasLimitIterator struct {
+ Event *TestZRC20UpdatedGasLimit // Event containing the contract specifics and raw log
+
+ contract *bind.BoundContract // Generic contract to use for unpacking event data
+ event string // Event name to use for unpacking event data
+
+ logs chan types.Log // Log channel receiving the found contract events
+ sub ethereum.Subscription // Subscription for errors, completion and termination
+ done bool // Whether the subscription completed delivering logs
+ fail error // Occurred error to stop iteration
+}
+
+// Next advances the iterator to the subsequent event, returning whether there
+// are any more events found. In case of a retrieval or parsing error, false is
+// returned and Error() can be queried for the exact failure.
+func (it *TestZRC20UpdatedGasLimitIterator) Next() bool {
+ // If the iterator failed, stop iterating
+ if it.fail != nil {
+ return false
+ }
+ // If the iterator completed, deliver directly whatever's available
+ if it.done {
+ select {
+ case log := <-it.logs:
+ it.Event = new(TestZRC20UpdatedGasLimit)
+ if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
+ it.fail = err
+ return false
+ }
+ it.Event.Raw = log
+ return true
+
+ default:
+ return false
+ }
+ }
+ // Iterator still in progress, wait for either a data or an error event
+ select {
+ case log := <-it.logs:
+ it.Event = new(TestZRC20UpdatedGasLimit)
+ if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
+ it.fail = err
+ return false
+ }
+ it.Event.Raw = log
+ return true
+
+ case err := <-it.sub.Err():
+ it.done = true
+ it.fail = err
+ return it.Next()
+ }
+}
+
+// Error returns any retrieval or parsing error occurred during filtering.
+func (it *TestZRC20UpdatedGasLimitIterator) Error() error {
+ return it.fail
+}
+
+// Close terminates the iteration process, releasing any pending underlying
+// resources.
+func (it *TestZRC20UpdatedGasLimitIterator) Close() error {
+ it.sub.Unsubscribe()
+ return nil
+}
+
+// TestZRC20UpdatedGasLimit represents a UpdatedGasLimit event raised by the TestZRC20 contract.
+type TestZRC20UpdatedGasLimit struct {
+ GasLimit *big.Int
+ Raw types.Log // Blockchain specific contextual infos
+}
+
+// FilterUpdatedGasLimit is a free log retrieval operation binding the contract event 0xff5788270f43bfc1ca41c503606d2594aa3023a1a7547de403a3e2f146a4a80a.
+//
+// Solidity: event UpdatedGasLimit(uint256 gasLimit)
+func (_TestZRC20 *TestZRC20Filterer) FilterUpdatedGasLimit(opts *bind.FilterOpts) (*TestZRC20UpdatedGasLimitIterator, error) {
+
+ logs, sub, err := _TestZRC20.contract.FilterLogs(opts, "UpdatedGasLimit")
+ if err != nil {
+ return nil, err
+ }
+ return &TestZRC20UpdatedGasLimitIterator{contract: _TestZRC20.contract, event: "UpdatedGasLimit", logs: logs, sub: sub}, nil
+}
+
+// WatchUpdatedGasLimit is a free log subscription operation binding the contract event 0xff5788270f43bfc1ca41c503606d2594aa3023a1a7547de403a3e2f146a4a80a.
+//
+// Solidity: event UpdatedGasLimit(uint256 gasLimit)
+func (_TestZRC20 *TestZRC20Filterer) WatchUpdatedGasLimit(opts *bind.WatchOpts, sink chan<- *TestZRC20UpdatedGasLimit) (event.Subscription, error) {
+
+ logs, sub, err := _TestZRC20.contract.WatchLogs(opts, "UpdatedGasLimit")
+ if err != nil {
+ return nil, err
+ }
+ return event.NewSubscription(func(quit <-chan struct{}) error {
+ defer sub.Unsubscribe()
+ for {
+ select {
+ case log := <-logs:
+ // New log arrived, parse the event and forward to the user
+ event := new(TestZRC20UpdatedGasLimit)
+ if err := _TestZRC20.contract.UnpackLog(event, "UpdatedGasLimit", log); err != nil {
+ return err
+ }
+ event.Raw = log
+
+ select {
+ case sink <- event:
+ case err := <-sub.Err():
+ return err
+ case <-quit:
+ return nil
+ }
+ case err := <-sub.Err():
+ return err
+ case <-quit:
+ return nil
+ }
+ }
+ }), nil
+}
+
+// ParseUpdatedGasLimit is a log parse operation binding the contract event 0xff5788270f43bfc1ca41c503606d2594aa3023a1a7547de403a3e2f146a4a80a.
+//
+// Solidity: event UpdatedGasLimit(uint256 gasLimit)
+func (_TestZRC20 *TestZRC20Filterer) ParseUpdatedGasLimit(log types.Log) (*TestZRC20UpdatedGasLimit, error) {
+ event := new(TestZRC20UpdatedGasLimit)
+ if err := _TestZRC20.contract.UnpackLog(event, "UpdatedGasLimit", log); err != nil {
+ return nil, err
+ }
+ event.Raw = log
+ return event, nil
+}
+
+// TestZRC20UpdatedProtocolFlatFeeIterator is returned from FilterUpdatedProtocolFlatFee and is used to iterate over the raw logs and unpacked data for UpdatedProtocolFlatFee events raised by the TestZRC20 contract.
+type TestZRC20UpdatedProtocolFlatFeeIterator struct {
+ Event *TestZRC20UpdatedProtocolFlatFee // Event containing the contract specifics and raw log
+
+ contract *bind.BoundContract // Generic contract to use for unpacking event data
+ event string // Event name to use for unpacking event data
+
+ logs chan types.Log // Log channel receiving the found contract events
+ sub ethereum.Subscription // Subscription for errors, completion and termination
+ done bool // Whether the subscription completed delivering logs
+ fail error // Occurred error to stop iteration
+}
+
+// Next advances the iterator to the subsequent event, returning whether there
+// are any more events found. In case of a retrieval or parsing error, false is
+// returned and Error() can be queried for the exact failure.
+func (it *TestZRC20UpdatedProtocolFlatFeeIterator) Next() bool {
+ // If the iterator failed, stop iterating
+ if it.fail != nil {
+ return false
+ }
+ // If the iterator completed, deliver directly whatever's available
+ if it.done {
+ select {
+ case log := <-it.logs:
+ it.Event = new(TestZRC20UpdatedProtocolFlatFee)
+ if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
+ it.fail = err
+ return false
+ }
+ it.Event.Raw = log
+ return true
+
+ default:
+ return false
+ }
+ }
+ // Iterator still in progress, wait for either a data or an error event
+ select {
+ case log := <-it.logs:
+ it.Event = new(TestZRC20UpdatedProtocolFlatFee)
+ if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
+ it.fail = err
+ return false
+ }
+ it.Event.Raw = log
+ return true
+
+ case err := <-it.sub.Err():
+ it.done = true
+ it.fail = err
+ return it.Next()
+ }
+}
+
+// Error returns any retrieval or parsing error occurred during filtering.
+func (it *TestZRC20UpdatedProtocolFlatFeeIterator) Error() error {
+ return it.fail
+}
+
+// Close terminates the iteration process, releasing any pending underlying
+// resources.
+func (it *TestZRC20UpdatedProtocolFlatFeeIterator) Close() error {
+ it.sub.Unsubscribe()
+ return nil
+}
+
+// TestZRC20UpdatedProtocolFlatFee represents a UpdatedProtocolFlatFee event raised by the TestZRC20 contract.
+type TestZRC20UpdatedProtocolFlatFee struct {
+ ProtocolFlatFee *big.Int
+ Raw types.Log // Blockchain specific contextual infos
+}
+
+// FilterUpdatedProtocolFlatFee is a free log retrieval operation binding the contract event 0xef13af88e424b5d15f49c77758542c1938b08b8b95b91ed0751f98ba99000d8f.
+//
+// Solidity: event UpdatedProtocolFlatFee(uint256 protocolFlatFee)
+func (_TestZRC20 *TestZRC20Filterer) FilterUpdatedProtocolFlatFee(opts *bind.FilterOpts) (*TestZRC20UpdatedProtocolFlatFeeIterator, error) {
+
+ logs, sub, err := _TestZRC20.contract.FilterLogs(opts, "UpdatedProtocolFlatFee")
+ if err != nil {
+ return nil, err
+ }
+ return &TestZRC20UpdatedProtocolFlatFeeIterator{contract: _TestZRC20.contract, event: "UpdatedProtocolFlatFee", logs: logs, sub: sub}, nil
+}
+
+// WatchUpdatedProtocolFlatFee is a free log subscription operation binding the contract event 0xef13af88e424b5d15f49c77758542c1938b08b8b95b91ed0751f98ba99000d8f.
+//
+// Solidity: event UpdatedProtocolFlatFee(uint256 protocolFlatFee)
+func (_TestZRC20 *TestZRC20Filterer) WatchUpdatedProtocolFlatFee(opts *bind.WatchOpts, sink chan<- *TestZRC20UpdatedProtocolFlatFee) (event.Subscription, error) {
+
+ logs, sub, err := _TestZRC20.contract.WatchLogs(opts, "UpdatedProtocolFlatFee")
+ if err != nil {
+ return nil, err
+ }
+ return event.NewSubscription(func(quit <-chan struct{}) error {
+ defer sub.Unsubscribe()
+ for {
+ select {
+ case log := <-logs:
+ // New log arrived, parse the event and forward to the user
+ event := new(TestZRC20UpdatedProtocolFlatFee)
+ if err := _TestZRC20.contract.UnpackLog(event, "UpdatedProtocolFlatFee", log); err != nil {
+ return err
+ }
+ event.Raw = log
+
+ select {
+ case sink <- event:
+ case err := <-sub.Err():
+ return err
+ case <-quit:
+ return nil
+ }
+ case err := <-sub.Err():
+ return err
+ case <-quit:
+ return nil
+ }
+ }
+ }), nil
+}
+
+// ParseUpdatedProtocolFlatFee is a log parse operation binding the contract event 0xef13af88e424b5d15f49c77758542c1938b08b8b95b91ed0751f98ba99000d8f.
+//
+// Solidity: event UpdatedProtocolFlatFee(uint256 protocolFlatFee)
+func (_TestZRC20 *TestZRC20Filterer) ParseUpdatedProtocolFlatFee(log types.Log) (*TestZRC20UpdatedProtocolFlatFee, error) {
+ event := new(TestZRC20UpdatedProtocolFlatFee)
+ if err := _TestZRC20.contract.UnpackLog(event, "UpdatedProtocolFlatFee", log); err != nil {
+ return nil, err
+ }
+ event.Raw = log
+ return event, nil
+}
+
+// TestZRC20UpdatedSystemContractIterator is returned from FilterUpdatedSystemContract and is used to iterate over the raw logs and unpacked data for UpdatedSystemContract events raised by the TestZRC20 contract.
+type TestZRC20UpdatedSystemContractIterator struct {
+ Event *TestZRC20UpdatedSystemContract // Event containing the contract specifics and raw log
+
+ contract *bind.BoundContract // Generic contract to use for unpacking event data
+ event string // Event name to use for unpacking event data
+
+ logs chan types.Log // Log channel receiving the found contract events
+ sub ethereum.Subscription // Subscription for errors, completion and termination
+ done bool // Whether the subscription completed delivering logs
+ fail error // Occurred error to stop iteration
+}
+
+// Next advances the iterator to the subsequent event, returning whether there
+// are any more events found. In case of a retrieval or parsing error, false is
+// returned and Error() can be queried for the exact failure.
+func (it *TestZRC20UpdatedSystemContractIterator) Next() bool {
+ // If the iterator failed, stop iterating
+ if it.fail != nil {
+ return false
+ }
+ // If the iterator completed, deliver directly whatever's available
+ if it.done {
+ select {
+ case log := <-it.logs:
+ it.Event = new(TestZRC20UpdatedSystemContract)
+ if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
+ it.fail = err
+ return false
+ }
+ it.Event.Raw = log
+ return true
+
+ default:
+ return false
+ }
+ }
+ // Iterator still in progress, wait for either a data or an error event
+ select {
+ case log := <-it.logs:
+ it.Event = new(TestZRC20UpdatedSystemContract)
+ if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
+ it.fail = err
+ return false
+ }
+ it.Event.Raw = log
+ return true
+
+ case err := <-it.sub.Err():
+ it.done = true
+ it.fail = err
+ return it.Next()
+ }
+}
+
+// Error returns any retrieval or parsing error occurred during filtering.
+func (it *TestZRC20UpdatedSystemContractIterator) Error() error {
+ return it.fail
+}
+
+// Close terminates the iteration process, releasing any pending underlying
+// resources.
+func (it *TestZRC20UpdatedSystemContractIterator) Close() error {
+ it.sub.Unsubscribe()
+ return nil
+}
+
+// TestZRC20UpdatedSystemContract represents a UpdatedSystemContract event raised by the TestZRC20 contract.
+type TestZRC20UpdatedSystemContract struct {
+ SystemContract common.Address
+ Raw types.Log // Blockchain specific contextual infos
+}
+
+// FilterUpdatedSystemContract is a free log retrieval operation binding the contract event 0xd55614e962c5fd6ece71614f6348d702468a997a394dd5e5c1677950226d97ae.
+//
+// Solidity: event UpdatedSystemContract(address systemContract)
+func (_TestZRC20 *TestZRC20Filterer) FilterUpdatedSystemContract(opts *bind.FilterOpts) (*TestZRC20UpdatedSystemContractIterator, error) {
+
+ logs, sub, err := _TestZRC20.contract.FilterLogs(opts, "UpdatedSystemContract")
+ if err != nil {
+ return nil, err
+ }
+ return &TestZRC20UpdatedSystemContractIterator{contract: _TestZRC20.contract, event: "UpdatedSystemContract", logs: logs, sub: sub}, nil
+}
+
+// WatchUpdatedSystemContract is a free log subscription operation binding the contract event 0xd55614e962c5fd6ece71614f6348d702468a997a394dd5e5c1677950226d97ae.
+//
+// Solidity: event UpdatedSystemContract(address systemContract)
+func (_TestZRC20 *TestZRC20Filterer) WatchUpdatedSystemContract(opts *bind.WatchOpts, sink chan<- *TestZRC20UpdatedSystemContract) (event.Subscription, error) {
+
+ logs, sub, err := _TestZRC20.contract.WatchLogs(opts, "UpdatedSystemContract")
+ if err != nil {
+ return nil, err
+ }
+ return event.NewSubscription(func(quit <-chan struct{}) error {
+ defer sub.Unsubscribe()
+ for {
+ select {
+ case log := <-logs:
+ // New log arrived, parse the event and forward to the user
+ event := new(TestZRC20UpdatedSystemContract)
+ if err := _TestZRC20.contract.UnpackLog(event, "UpdatedSystemContract", log); err != nil {
+ return err
+ }
+ event.Raw = log
+
+ select {
+ case sink <- event:
+ case err := <-sub.Err():
+ return err
+ case <-quit:
+ return nil
+ }
+ case err := <-sub.Err():
+ return err
+ case <-quit:
+ return nil
+ }
+ }
+ }), nil
+}
+
+// ParseUpdatedSystemContract is a log parse operation binding the contract event 0xd55614e962c5fd6ece71614f6348d702468a997a394dd5e5c1677950226d97ae.
+//
+// Solidity: event UpdatedSystemContract(address systemContract)
+func (_TestZRC20 *TestZRC20Filterer) ParseUpdatedSystemContract(log types.Log) (*TestZRC20UpdatedSystemContract, error) {
+ event := new(TestZRC20UpdatedSystemContract)
+ if err := _TestZRC20.contract.UnpackLog(event, "UpdatedSystemContract", log); err != nil {
+ return nil, err
+ }
+ event.Raw = log
+ return event, nil
+}
+
+// TestZRC20WithdrawalIterator is returned from FilterWithdrawal and is used to iterate over the raw logs and unpacked data for Withdrawal events raised by the TestZRC20 contract.
+type TestZRC20WithdrawalIterator struct {
+ Event *TestZRC20Withdrawal // Event containing the contract specifics and raw log
+
+ contract *bind.BoundContract // Generic contract to use for unpacking event data
+ event string // Event name to use for unpacking event data
+
+ logs chan types.Log // Log channel receiving the found contract events
+ sub ethereum.Subscription // Subscription for errors, completion and termination
+ done bool // Whether the subscription completed delivering logs
+ fail error // Occurred error to stop iteration
+}
+
+// Next advances the iterator to the subsequent event, returning whether there
+// are any more events found. In case of a retrieval or parsing error, false is
+// returned and Error() can be queried for the exact failure.
+func (it *TestZRC20WithdrawalIterator) Next() bool {
+ // If the iterator failed, stop iterating
+ if it.fail != nil {
+ return false
+ }
+ // If the iterator completed, deliver directly whatever's available
+ if it.done {
+ select {
+ case log := <-it.logs:
+ it.Event = new(TestZRC20Withdrawal)
+ if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
+ it.fail = err
+ return false
+ }
+ it.Event.Raw = log
+ return true
+
+ default:
+ return false
+ }
+ }
+ // Iterator still in progress, wait for either a data or an error event
+ select {
+ case log := <-it.logs:
+ it.Event = new(TestZRC20Withdrawal)
+ if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil {
+ it.fail = err
+ return false
+ }
+ it.Event.Raw = log
+ return true
+
+ case err := <-it.sub.Err():
+ it.done = true
+ it.fail = err
+ return it.Next()
+ }
+}
+
+// Error returns any retrieval or parsing error occurred during filtering.
+func (it *TestZRC20WithdrawalIterator) Error() error {
+ return it.fail
+}
+
+// Close terminates the iteration process, releasing any pending underlying
+// resources.
+func (it *TestZRC20WithdrawalIterator) Close() error {
+ it.sub.Unsubscribe()
+ return nil
+}
+
+// TestZRC20Withdrawal represents a Withdrawal event raised by the TestZRC20 contract.
+type TestZRC20Withdrawal struct {
+ From common.Address
+ To []byte
+ Value *big.Int
+ Gasfee *big.Int
+ ProtocolFlatFee *big.Int
+ Raw types.Log // Blockchain specific contextual infos
+}
+
+// FilterWithdrawal is a free log retrieval operation binding the contract event 0x9ffbffc04a397460ee1dbe8c9503e098090567d6b7f4b3c02a8617d800b6d955.
+//
+// Solidity: event Withdrawal(address indexed from, bytes to, uint256 value, uint256 gasfee, uint256 protocolFlatFee)
+func (_TestZRC20 *TestZRC20Filterer) FilterWithdrawal(opts *bind.FilterOpts, from []common.Address) (*TestZRC20WithdrawalIterator, error) {
+
+ var fromRule []interface{}
+ for _, fromItem := range from {
+ fromRule = append(fromRule, fromItem)
+ }
+
+ logs, sub, err := _TestZRC20.contract.FilterLogs(opts, "Withdrawal", fromRule)
+ if err != nil {
+ return nil, err
+ }
+ return &TestZRC20WithdrawalIterator{contract: _TestZRC20.contract, event: "Withdrawal", logs: logs, sub: sub}, nil
+}
+
+// WatchWithdrawal is a free log subscription operation binding the contract event 0x9ffbffc04a397460ee1dbe8c9503e098090567d6b7f4b3c02a8617d800b6d955.
+//
+// Solidity: event Withdrawal(address indexed from, bytes to, uint256 value, uint256 gasfee, uint256 protocolFlatFee)
+func (_TestZRC20 *TestZRC20Filterer) WatchWithdrawal(opts *bind.WatchOpts, sink chan<- *TestZRC20Withdrawal, from []common.Address) (event.Subscription, error) {
+
+ var fromRule []interface{}
+ for _, fromItem := range from {
+ fromRule = append(fromRule, fromItem)
+ }
+
+ logs, sub, err := _TestZRC20.contract.WatchLogs(opts, "Withdrawal", fromRule)
+ if err != nil {
+ return nil, err
+ }
+ return event.NewSubscription(func(quit <-chan struct{}) error {
+ defer sub.Unsubscribe()
+ for {
+ select {
+ case log := <-logs:
+ // New log arrived, parse the event and forward to the user
+ event := new(TestZRC20Withdrawal)
+ if err := _TestZRC20.contract.UnpackLog(event, "Withdrawal", log); err != nil {
+ return err
+ }
+ event.Raw = log
+
+ select {
+ case sink <- event:
+ case err := <-sub.Err():
+ return err
+ case <-quit:
+ return nil
+ }
+ case err := <-sub.Err():
+ return err
+ case <-quit:
+ return nil
+ }
+ }
+ }), nil
+}
+
+// ParseWithdrawal is a log parse operation binding the contract event 0x9ffbffc04a397460ee1dbe8c9503e098090567d6b7f4b3c02a8617d800b6d955.
+//
+// Solidity: event Withdrawal(address indexed from, bytes to, uint256 value, uint256 gasfee, uint256 protocolFlatFee)
+func (_TestZRC20 *TestZRC20Filterer) ParseWithdrawal(log types.Log) (*TestZRC20Withdrawal, error) {
+ event := new(TestZRC20Withdrawal)
+ if err := _TestZRC20.contract.UnpackLog(event, "Withdrawal", log); err != nil {
+ return nil, err
+ }
+ event.Raw = log
+ return event, nil
+}
diff --git a/contrib/localnet/orchestrator/smoketest/contracts/testzrc20/TestZRC20.json b/contrib/localnet/orchestrator/smoketest/contracts/testzrc20/TestZRC20.json
new file mode 100644
index 0000000000..b4d7b68b26
--- /dev/null
+++ b/contrib/localnet/orchestrator/smoketest/contracts/testzrc20/TestZRC20.json
@@ -0,0 +1,673 @@
+{
+ "abi": [
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "chainid_",
+ "type": "uint256"
+ },
+ {
+ "internalType": "enum CoinType",
+ "name": "coinType_",
+ "type": "uint8"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ },
+ {
+ "inputs": [],
+ "name": "CallerIsNotFungibleModule",
+ "type": "error"
+ },
+ {
+ "inputs": [],
+ "name": "GasFeeTransferFailed",
+ "type": "error"
+ },
+ {
+ "inputs": [],
+ "name": "InvalidSender",
+ "type": "error"
+ },
+ {
+ "inputs": [],
+ "name": "LowAllowance",
+ "type": "error"
+ },
+ {
+ "inputs": [],
+ "name": "LowBalance",
+ "type": "error"
+ },
+ {
+ "inputs": [],
+ "name": "ZeroAddress",
+ "type": "error"
+ },
+ {
+ "inputs": [],
+ "name": "ZeroGasCoin",
+ "type": "error"
+ },
+ {
+ "inputs": [],
+ "name": "ZeroGasPrice",
+ "type": "error"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "spender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Approval",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "internalType": "bytes",
+ "name": "from",
+ "type": "bytes"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "to",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Deposit",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "from",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "to",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "gasLimit",
+ "type": "uint256"
+ }
+ ],
+ "name": "UpdatedGasLimit",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "protocolFlatFee",
+ "type": "uint256"
+ }
+ ],
+ "name": "UpdatedProtocolFlatFee",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "internalType": "address",
+ "name": "systemContract",
+ "type": "address"
+ }
+ ],
+ "name": "UpdatedSystemContract",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "internalType": "address",
+ "name": "from",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "bytes",
+ "name": "to",
+ "type": "bytes"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "gasfee",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "protocolFlatFee",
+ "type": "uint256"
+ }
+ ],
+ "name": "Withdrawal",
+ "type": "event"
+ },
+ {
+ "inputs": [],
+ "name": "CHAIN_ID",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "COIN_TYPE",
+ "outputs": [
+ {
+ "internalType": "enum CoinType",
+ "name": "",
+ "type": "uint8"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "FUNGIBLE_MODULE_ADDRESS",
+ "outputs": [
+ {
+ "internalType": "address",
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "GAS_LIMIT",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "PROTOCOL_FLAT_FEE",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "SYSTEM_CONTRACT_ADDRESS",
+ "outputs": [
+ {
+ "internalType": "address",
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "owner",
+ "type": "address"
+ },
+ {
+ "internalType": "address",
+ "name": "spender",
+ "type": "address"
+ }
+ ],
+ "name": "allowance",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "spender",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "approve",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "account",
+ "type": "address"
+ }
+ ],
+ "name": "balanceOf",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "burn",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "decimals",
+ "outputs": [
+ {
+ "internalType": "uint8",
+ "name": "",
+ "type": "uint8"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "spender",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "decreaseAllowance",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "to",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "deposit",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "spender",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "increaseAllowance",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "name",
+ "outputs": [
+ {
+ "internalType": "string",
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "newField",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "newPublicField",
+ "outputs": [
+ {
+ "internalType": "string",
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "symbol",
+ "outputs": [
+ {
+ "internalType": "string",
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "totalSupply",
+ "outputs": [
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "recipient",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "transfer",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "sender",
+ "type": "address"
+ },
+ {
+ "internalType": "address",
+ "name": "recipient",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "transferFrom",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "gasLimit",
+ "type": "uint256"
+ }
+ ],
+ "name": "updateGasLimit",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "newField_",
+ "type": "uint256"
+ }
+ ],
+ "name": "updateNewField",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "uint256",
+ "name": "protocolFlatFee",
+ "type": "uint256"
+ }
+ ],
+ "name": "updateProtocolFlatFee",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ }
+ ],
+ "name": "updateSystemContractAddress",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "bytes",
+ "name": "to",
+ "type": "bytes"
+ },
+ {
+ "internalType": "uint256",
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "withdraw",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "withdrawGasFee",
+ "outputs": [
+ {
+ "internalType": "address",
+ "name": "",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ }
+ ],
+ "bin": "60c06040523480156200001157600080fd5b5060405162002566380380620025668339818101604052810190620000379190620000e1565b816080818152505080600281111562000055576200005462000128565b5b60a08160028111156200006d576200006c62000128565b5b81525050505062000157565b600080fd5b6000819050919050565b62000093816200007e565b81146200009f57600080fd5b50565b600081519050620000b38162000088565b92915050565b60038110620000c757600080fd5b50565b600081519050620000db81620000b9565b92915050565b60008060408385031215620000fb57620000fa62000079565b5b60006200010b85828601620000a2565b92505060206200011e85828601620000ca565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60805160a0516123db6200018b6000396000610aa40152600081816109ee01528181610f59015261107e01526123db6000f3fe608060405234801561001057600080fd5b50600436106101a95760003560e01c806385e1f4d0116100f9578063c701262611610097578063dd62ed3e11610071578063dd62ed3e146104ff578063eddeb1231461052f578063f2441b321461054b578063f687d12a14610569576101a9565b8063c701262614610494578063c835d7cc146104c4578063d9eeebed146104e0576101a9565b8063a457c2d7116100d3578063a457c2d7146103f8578063a7605f4514610428578063a9059cbb14610446578063b92894ba14610476576101a9565b806385e1f4d01461039e57806395d89b41146103bc578063a3413d03146103da576101a9565b8063395093511161016657806347e7ef241161014057806347e7ef24146103045780634d8943bb1461033457806370a0823114610352578063732bb0e414610382576101a9565b806339509351146102865780633ce4a5bc146102b657806342966c68146102d4576101a9565b806306fdde03146101ae578063091d2788146101cc578063095ea7b3146101ea57806318160ddd1461021a57806323b872dd14610238578063313ce56714610268575b600080fd5b6101b6610585565b6040516101c39190611b20565b60405180910390f35b6101d4610617565b6040516101e19190611b5b565b60405180910390f35b61020460048036038101906101ff9190611c14565b61061d565b6040516102119190611c6f565b60405180910390f35b61022261063b565b60405161022f9190611b5b565b60405180910390f35b610252600480360381019061024d9190611c8a565b610645565b60405161025f9190611c6f565b60405180910390f35b61027061073d565b60405161027d9190611cf9565b60405180910390f35b6102a0600480360381019061029b9190611c14565b610754565b6040516102ad9190611c6f565b60405180910390f35b6102be6107fa565b6040516102cb9190611d23565b60405180910390f35b6102ee60048036038101906102e99190611d3e565b610812565b6040516102fb9190611c6f565b60405180910390f35b61031e60048036038101906103199190611c14565b610827565b60405161032b9190611c6f565b60405180910390f35b61033c610993565b6040516103499190611b5b565b60405180910390f35b61036c60048036038101906103679190611d6b565b610999565b6040516103799190611b5b565b60405180910390f35b61039c60048036038101906103979190611d3e565b6109e2565b005b6103a66109ec565b6040516103b39190611b5b565b60405180910390f35b6103c4610a10565b6040516103d19190611b20565b60405180910390f35b6103e2610aa2565b6040516103ef9190611e0f565b60405180910390f35b610412600480360381019061040d9190611c14565b610ac6565b60405161041f9190611c6f565b60405180910390f35b610430610c29565b60405161043d9190611b5b565b60405180910390f35b610460600480360381019061045b9190611c14565b610c2f565b60405161046d9190611c6f565b60405180910390f35b61047e610c4d565b60405161048b9190611b20565b60405180910390f35b6104ae60048036038101906104a99190611f5f565b610cdb565b6040516104bb9190611c6f565b60405180910390f35b6104de60048036038101906104d99190611d6b565b610e22565b005b6104e8610f15565b6040516104f6929190611fbb565b60405180910390f35b61051960048036038101906105149190611fe4565b611162565b6040516105269190611b5b565b60405180910390f35b61054960048036038101906105449190611d3e565b6111e9565b005b6105536112a3565b6040516105609190611d23565b60405180910390f35b610583600480360381019061057e9190611d3e565b6112c7565b005b60606006805461059490612053565b80601f01602080910402602001604051908101604052809291908181526020018280546105c090612053565b801561060d5780601f106105e25761010080835404028352916020019161060d565b820191906000526020600020905b8154815290600101906020018083116105f057829003601f168201915b5050505050905090565b60015481565b600061063161062a611381565b8484611389565b6001905092915050565b6000600554905090565b6000610652848484611540565b6000600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061069d611381565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610714576040517f10bad14700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61073185610720611381565b858461072c91906120b3565b611389565b60019150509392505050565b6000600860009054906101000a900460ff16905090565b600081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107a0611381565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546107e991906120e7565b925050819055506001905092915050565b73735b14bb79463307aacbed86daf3322b1e6226ab81565b600061081e338361179a565b60019050919050565b600073735b14bb79463307aacbed86daf3322b1e6226ab73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141580156108c5575060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b156108fc576040517fddb5de5e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109068383611951565b8273ffffffffffffffffffffffffffffffffffffffff167f67fc7bdaed5b0ec550d8706b87d60568ab70c6b781263c70101d54cd1564aab373735b14bb79463307aacbed86daf3322b1e6226ab6040516020016109639190612163565b604051602081830303815290604052846040516109819291906121d3565b60405180910390a26001905092915050565b60025481565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b8060098190555050565b7f000000000000000000000000000000000000000000000000000000000000000081565b606060078054610a1f90612053565b80601f0160208091040260200160405190810160405280929190818152602001828054610a4b90612053565b8015610a985780601f10610a6d57610100808354040283529160200191610a98565b820191906000526020600020905b815481529060010190602001808311610a7b57829003601f168201915b5050505050905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b600081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610b12611381565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610b85576040517f10bad14700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610bcf611381565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610c1891906120b3565b925050819055506001905092915050565b60095481565b6000610c43610c3c611381565b8484611540565b6001905092915050565b600a8054610c5a90612053565b80601f0160208091040260200160405190810160405280929190818152602001828054610c8690612053565b8015610cd35780601f10610ca857610100808354040283529160200191610cd3565b820191906000526020600020905b815481529060010190602001808311610cb657829003601f168201915b505050505081565b6000806000610ce8610f15565b915091508173ffffffffffffffffffffffffffffffffffffffff166323b872dd3373735b14bb79463307aacbed86daf3322b1e6226ab846040518463ffffffff1660e01b8152600401610d3d93929190612203565b6020604051808303816000875af1158015610d5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d809190612266565b610db6576040517f0a7cd6d600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610dc0338561179a565b3373ffffffffffffffffffffffffffffffffffffffff167f9ffbffc04a397460ee1dbe8c9503e098090567d6b7f4b3c02a8617d800b6d955868684600254604051610e0e9493929190612293565b60405180910390a260019250505092915050565b73735b14bb79463307aacbed86daf3322b1e6226ab73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e9b576040517f2b2add3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fd55614e962c5fd6ece71614f6348d702468a997a394dd5e5c1677950226d97ae81604051610f0a9190611d23565b60405180910390a150565b60008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630be155477f00000000000000000000000000000000000000000000000000000000000000006040518263ffffffff1660e01b8152600401610f949190611b5b565b602060405180830381865afa158015610fb1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd591906122f4565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361103d576040517f78fff39600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d7fd7afb7f00000000000000000000000000000000000000000000000000000000000000006040518263ffffffff1660e01b81526004016110b99190611b5b565b602060405180830381865afa1580156110d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fa9190612336565b905060008103611136576040517fe661aed000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600254600154836111499190612363565b61115391906120e7565b90508281945094505050509091565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b73735b14bb79463307aacbed86daf3322b1e6226ab73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611262576040517f2b2add3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806002819055507fef13af88e424b5d15f49c77758542c1938b08b8b95b91ed0751f98ba99000d8f816040516112989190611b5b565b60405180910390a150565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b73735b14bb79463307aacbed86daf3322b1e6226ab73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611340576040517f2b2add3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001819055507fff5788270f43bfc1ca41c503606d2594aa3023a1a7547de403a3e2f146a4a80a816040516113769190611b5b565b60405180910390a150565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036113ef576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611455576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115339190611b5b565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036115a6576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361160c576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561168a576040517ffe382aa700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b818161169691906120b3565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461172891906120e7565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161178c9190611b5b565b60405180910390a350505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611800576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561187e576040517ffe382aa700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b818161188a91906120b3565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600560008282546118df91906120b3565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516119449190611b5b565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036119b7576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600560008282546119c991906120e7565b9250508190555080600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611a1f91906120e7565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611a849190611b5b565b60405180910390a35050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611aca578082015181840152602081019050611aaf565b60008484015250505050565b6000601f19601f8301169050919050565b6000611af282611a90565b611afc8185611a9b565b9350611b0c818560208601611aac565b611b1581611ad6565b840191505092915050565b60006020820190508181036000830152611b3a8184611ae7565b905092915050565b6000819050919050565b611b5581611b42565b82525050565b6000602082019050611b706000830184611b4c565b92915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611bb582611b8a565b9050919050565b611bc581611baa565b8114611bd057600080fd5b50565b600081359050611be281611bbc565b92915050565b611bf181611b42565b8114611bfc57600080fd5b50565b600081359050611c0e81611be8565b92915050565b60008060408385031215611c2b57611c2a611b80565b5b6000611c3985828601611bd3565b9250506020611c4a85828601611bff565b9150509250929050565b60008115159050919050565b611c6981611c54565b82525050565b6000602082019050611c846000830184611c60565b92915050565b600080600060608486031215611ca357611ca2611b80565b5b6000611cb186828701611bd3565b9350506020611cc286828701611bd3565b9250506040611cd386828701611bff565b9150509250925092565b600060ff82169050919050565b611cf381611cdd565b82525050565b6000602082019050611d0e6000830184611cea565b92915050565b611d1d81611baa565b82525050565b6000602082019050611d386000830184611d14565b92915050565b600060208284031215611d5457611d53611b80565b5b6000611d6284828501611bff565b91505092915050565b600060208284031215611d8157611d80611b80565b5b6000611d8f84828501611bd3565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60038110611dd857611dd7611d98565b5b50565b6000819050611de982611dc7565b919050565b6000611df982611ddb565b9050919050565b611e0981611dee565b82525050565b6000602082019050611e246000830184611e00565b92915050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611e6c82611ad6565b810181811067ffffffffffffffff82111715611e8b57611e8a611e34565b5b80604052505050565b6000611e9e611b76565b9050611eaa8282611e63565b919050565b600067ffffffffffffffff821115611eca57611ec9611e34565b5b611ed382611ad6565b9050602081019050919050565b82818337600083830152505050565b6000611f02611efd84611eaf565b611e94565b905082815260208101848484011115611f1e57611f1d611e2f565b5b611f29848285611ee0565b509392505050565b600082601f830112611f4657611f45611e2a565b5b8135611f56848260208601611eef565b91505092915050565b60008060408385031215611f7657611f75611b80565b5b600083013567ffffffffffffffff811115611f9457611f93611b85565b5b611fa085828601611f31565b9250506020611fb185828601611bff565b9150509250929050565b6000604082019050611fd06000830185611d14565b611fdd6020830184611b4c565b9392505050565b60008060408385031215611ffb57611ffa611b80565b5b600061200985828601611bd3565b925050602061201a85828601611bd3565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061206b57607f821691505b60208210810361207e5761207d612024565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006120be82611b42565b91506120c983611b42565b92508282039050818111156120e1576120e0612084565b5b92915050565b60006120f282611b42565b91506120fd83611b42565b925082820190508082111561211557612114612084565b5b92915050565b60008160601b9050919050565b60006121338261211b565b9050919050565b600061214582612128565b9050919050565b61215d61215882611baa565b61213a565b82525050565b600061216f828461214c565b60148201915081905092915050565b600081519050919050565b600082825260208201905092915050565b60006121a58261217e565b6121af8185612189565b93506121bf818560208601611aac565b6121c881611ad6565b840191505092915050565b600060408201905081810360008301526121ed818561219a565b90506121fc6020830184611b4c565b9392505050565b60006060820190506122186000830186611d14565b6122256020830185611d14565b6122326040830184611b4c565b949350505050565b61224381611c54565b811461224e57600080fd5b50565b6000815190506122608161223a565b92915050565b60006020828403121561227c5761227b611b80565b5b600061228a84828501612251565b91505092915050565b600060808201905081810360008301526122ad818761219a565b90506122bc6020830186611b4c565b6122c96040830185611b4c565b6122d66060830184611b4c565b95945050505050565b6000815190506122ee81611bbc565b92915050565b60006020828403121561230a57612309611b80565b5b6000612318848285016122df565b91505092915050565b60008151905061233081611be8565b92915050565b60006020828403121561234c5761234b611b80565b5b600061235a84828501612321565b91505092915050565b600061236e82611b42565b915061237983611b42565b925082820261238781611b42565b9150828204841483151761239e5761239d612084565b5b509291505056fea264697066735822122011fda4fba218fc7f911b68b0418884c426f5ddb324eb1572e2e793fcb60edf6c64736f6c63430008150033"
+}
diff --git a/contrib/localnet/orchestrator/smoketest/contracts/testzrc20/TestZRC20.sol b/contrib/localnet/orchestrator/smoketest/contracts/testzrc20/TestZRC20.sol
new file mode 100644
index 0000000000..c31ccb4686
--- /dev/null
+++ b/contrib/localnet/orchestrator/smoketest/contracts/testzrc20/TestZRC20.sol
@@ -0,0 +1,363 @@
+// SPDX-License-Identifier: MIT
+pragma solidity ^0.8.7;
+
+/**
+ * @dev Custom errors for ZRC20
+ */
+interface ZRC20Errors {
+ error CallerIsNotFungibleModule();
+ error InvalidSender();
+ error GasFeeTransferFailed();
+ error ZeroGasCoin();
+ error ZeroGasPrice();
+ error LowAllowance();
+ error LowBalance();
+ error ZeroAddress();
+}
+
+/**
+ * @dev Interfaces of SystemContract and ZRC20 to make easier to import.
+ */
+interface ISystem {
+ function FUNGIBLE_MODULE_ADDRESS() external view returns (address);
+ function wZetaContractAddress() external view returns (address);
+ function uniswapv2FactoryAddress() external view returns (address);
+ function gasPriceByChainId(uint256 chainID) external view returns (uint256);
+ function gasCoinZRC20ByChainId(uint256 chainID) external view returns (address);
+ function gasZetaPoolByChainId(uint256 chainID) external view returns (address);
+}
+
+interface IZRC20 {
+ function totalSupply() external view returns (uint256);
+ function balanceOf(address account) external view returns (uint256);
+ function transfer(address recipient, uint256 amount) external returns (bool);
+ function allowance(address owner, address spender) external view returns (uint256);
+ function approve(address spender, uint256 amount) external returns (bool);
+ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
+ function deposit(address to, uint256 amount) external returns (bool);
+ function withdraw(bytes memory to, uint256 amount) external returns (bool);
+ function withdrawGasFee() external view returns (address, uint256);
+
+ event Transfer(address indexed from, address indexed to, uint256 value);
+ event Approval(address indexed owner, address indexed spender, uint256 value);
+ event Deposit(bytes from, address indexed to, uint256 value);
+ event Withdrawal(address indexed from, bytes to, uint256 value, uint256 gasfee, uint256 protocolFlatFee);
+ event UpdatedSystemContract(address systemContract);
+ event UpdatedGasLimit(uint256 gasLimit);
+ event UpdatedProtocolFlatFee(uint256 protocolFlatFee);
+}
+
+interface IZRC20Metadata is IZRC20 {
+ function name() external view returns (string memory);
+ function symbol() external view returns (string memory);
+ function decimals() external view returns (uint8);
+}
+
+/// @dev Coin types for ZRC20. Zeta value should not be used.
+enum CoinType {
+ Zeta,
+ Gas,
+ ERC20
+}
+
+/**
+ * @dev TestZRC20 is a test implementation of ZRC20 that extends the contract with new fields to test contract
+ bytecode upgrade
+ */
+contract TestZRC20 is IZRC20, IZRC20Metadata, ZRC20Errors {
+ /// @notice Fungible address is always the same, maintained at the protocol level
+ address public constant FUNGIBLE_MODULE_ADDRESS = 0x735b14BB79463307AAcBED86DAf3322B1e6226aB;
+ /// @notice Chain id.abi
+ uint256 public immutable CHAIN_ID;
+ /// @notice Coin type, checkout Interfaces.sol.
+ CoinType public immutable COIN_TYPE;
+ /// @notice System contract address.
+ address public SYSTEM_CONTRACT_ADDRESS;
+ /// @notice Gas limit.
+ uint256 public GAS_LIMIT;
+ /// @notice Protocol flat fee.
+ uint256 public PROTOCOL_FLAT_FEE;
+
+ mapping(address => uint256) private _balances;
+ mapping(address => mapping(address => uint256)) private _allowances;
+ uint256 private _totalSupply;
+ string private _name;
+ string private _symbol;
+ uint8 private _decimals;
+
+ /// @notice extend the contract with new fields to test contract bytecode upgrade
+ uint256 public newField;
+ string public newPublicField;
+
+ function _msgSender() internal view virtual returns (address) {
+ return msg.sender;
+ }
+
+ function _msgData() internal view virtual returns (bytes calldata) {
+ return msg.data;
+ }
+
+ /**
+ * @dev Only fungible module modifier.
+ */
+ modifier onlyFungible() {
+ if (msg.sender != FUNGIBLE_MODULE_ADDRESS) revert CallerIsNotFungibleModule();
+ _;
+ }
+
+ /**
+ * @dev Constructor
+ */
+ constructor(
+ uint256 chainid_,
+ CoinType coinType_
+ ) {
+ CHAIN_ID = chainid_;
+ COIN_TYPE = coinType_;
+ }
+
+ /**
+ * @dev ZRC20 name
+ * @return name as string
+ */
+ function name() public view virtual override returns (string memory) {
+ return _name;
+ }
+
+ /**
+ * @dev ZRC20 symbol.
+ * @return symbol as string.
+ */
+ function symbol() public view virtual override returns (string memory) {
+ return _symbol;
+ }
+
+ /**
+ * @dev ZRC20 decimals.
+ * @return returns uint8 decimals.
+ */
+ function decimals() public view virtual override returns (uint8) {
+ return _decimals;
+ }
+
+ /**
+ * @dev ZRC20 total supply.
+ * @return returns uint256 total supply.
+ */
+ function totalSupply() public view virtual override returns (uint256) {
+ return _totalSupply;
+ }
+
+ /**
+ * @dev Returns ZRC20 balance of an account.
+ * @param account, account address for which balance is requested.
+ * @return uint256 account balance.
+ */
+ function balanceOf(address account) public view virtual override returns (uint256) {
+ return _balances[account];
+ }
+
+ /**
+ * @dev Returns ZRC20 balance of an account.
+ * @param recipient, recipiuent address to which transfer is done.
+ * @return true/false if transfer succeeded/failed.
+ */
+ function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
+ _transfer(_msgSender(), recipient, amount);
+ return true;
+ }
+
+ /**
+ * @dev Returns token allowance from owner to spender.
+ * @param owner, owner address.
+ * @return uint256 allowance.
+ */
+ function allowance(address owner, address spender) public view virtual override returns (uint256) {
+ return _allowances[owner][spender];
+ }
+
+ /**
+ * @dev Approves amount transferFrom for spender.
+ * @param spender, spender address.
+ * @param amount, amount to approve.
+ * @return true/false if succeeded/failed.
+ */
+ function approve(address spender, uint256 amount) public virtual override returns (bool) {
+ _approve(_msgSender(), spender, amount);
+ return true;
+ }
+
+ /**
+ * @dev Increases allowance by amount for spender.
+ * @param spender, spender address.
+ * @param amount, amount by which to increase allownace.
+ * @return true/false if succeeded/failed.
+ */
+ function increaseAllowance(address spender, uint256 amount) external virtual returns (bool) {
+ _allowances[spender][_msgSender()] += amount;
+ return true;
+ }
+
+ /**
+ * @dev Decreases allowance by amount for spender.
+ * @param spender, spender address.
+ * @param amount, amount by which to decrease allownace.
+ * @return true/false if succeeded/failed.
+ */
+ function decreaseAllowance(address spender, uint256 amount) external virtual returns (bool) {
+ if (_allowances[spender][_msgSender()] < amount) revert LowAllowance();
+ _allowances[spender][_msgSender()] -= amount;
+ return true;
+ }
+
+ /**
+ * @dev Transfers tokens from sender to recipient.
+ * @param sender, sender address.
+ * @param recipient, recipient address.
+ * @param amount, amount to transfer.
+ * @return true/false if succeeded/failed.
+ */
+ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
+ _transfer(sender, recipient, amount);
+
+ uint256 currentAllowance = _allowances[sender][_msgSender()];
+ if (currentAllowance < amount) revert LowAllowance();
+
+ _approve(sender, _msgSender(), currentAllowance - amount);
+
+ return true;
+ }
+
+ /**
+ * @dev Burns an amount of tokens.
+ * @param amount, amount to burn.
+ * @return true/false if succeeded/failed.
+ */
+ function burn(uint256 amount) external returns (bool) {
+ _burn(msg.sender, amount);
+ return true;
+ }
+
+ function _transfer(address sender, address recipient, uint256 amount) internal virtual {
+ if (sender == address(0)) revert ZeroAddress();
+ if (recipient == address(0)) revert ZeroAddress();
+
+ uint256 senderBalance = _balances[sender];
+ if (senderBalance < amount) revert LowBalance();
+
+ _balances[sender] = senderBalance - amount;
+ _balances[recipient] += amount;
+
+ emit Transfer(sender, recipient, amount);
+ }
+
+ function _mint(address account, uint256 amount) internal virtual {
+ if (account == address(0)) revert ZeroAddress();
+
+ _totalSupply += amount;
+ _balances[account] += amount;
+ emit Transfer(address(0), account, amount);
+ }
+
+ function _burn(address account, uint256 amount) internal virtual {
+ if (account == address(0)) revert ZeroAddress();
+
+ uint256 accountBalance = _balances[account];
+ if (accountBalance < amount) revert LowBalance();
+
+ _balances[account] = accountBalance - amount;
+ _totalSupply -= amount;
+
+ emit Transfer(account, address(0), amount);
+ }
+
+ function _approve(address owner, address spender, uint256 amount) internal virtual {
+ if (owner == address(0)) revert ZeroAddress();
+ if (spender == address(0)) revert ZeroAddress();
+
+ _allowances[owner][spender] = amount;
+ emit Approval(owner, spender, amount);
+ }
+
+ /**
+ * @dev Deposits corresponding tokens from external chain, only callable by Fungible module.
+ * @param to, recipient address.
+ * @param amount, amount to deposit.
+ * @return true/false if succeeded/failed.
+ */
+ function deposit(address to, uint256 amount) external override returns (bool) {
+ if (msg.sender != FUNGIBLE_MODULE_ADDRESS && msg.sender != SYSTEM_CONTRACT_ADDRESS) revert InvalidSender();
+ _mint(to, amount);
+ emit Deposit(abi.encodePacked(FUNGIBLE_MODULE_ADDRESS), to, amount);
+ return true;
+ }
+
+ /**
+ * @dev Withdraws gas fees.
+ * @return returns the ZRC20 address for gas on the same chain of this ZRC20, and calculates the gas fee for withdraw()
+ */
+ function withdrawGasFee() public view override returns (address, uint256) {
+ address gasZRC20 = ISystem(SYSTEM_CONTRACT_ADDRESS).gasCoinZRC20ByChainId(CHAIN_ID);
+ if (gasZRC20 == address(0)) {
+ revert ZeroGasCoin();
+ }
+ uint256 gasPrice = ISystem(SYSTEM_CONTRACT_ADDRESS).gasPriceByChainId(CHAIN_ID);
+ if (gasPrice == 0) {
+ revert ZeroGasPrice();
+ }
+ uint256 gasFee = gasPrice * GAS_LIMIT + PROTOCOL_FLAT_FEE;
+ return (gasZRC20, gasFee);
+ }
+
+ /**
+ * @dev Withraws ZRC20 tokens to external chains, this function causes cctx module to send out outbound tx to the outbound chain
+ * this contract should be given enough allowance of the gas ZRC20 to pay for outbound tx gas fee.
+ * @param to, recipient address.
+ * @param amount, amount to deposit.
+ * @return true/false if succeeded/failed.
+ */
+ function withdraw(bytes memory to, uint256 amount) external override returns (bool) {
+ (address gasZRC20, uint256 gasFee) = withdrawGasFee();
+ if (!IZRC20(gasZRC20).transferFrom(msg.sender, FUNGIBLE_MODULE_ADDRESS, gasFee)) {
+ revert GasFeeTransferFailed();
+ }
+ _burn(msg.sender, amount);
+ emit Withdrawal(msg.sender, to, amount, gasFee, PROTOCOL_FLAT_FEE);
+ return true;
+ }
+
+ /**
+ * @dev Updates system contract address. Can only be updated by the fungible module.
+ * @param addr, new system contract address.
+ */
+ function updateSystemContractAddress(address addr) external onlyFungible {
+ SYSTEM_CONTRACT_ADDRESS = addr;
+ emit UpdatedSystemContract(addr);
+ }
+
+ /**
+ * @dev Updates gas limit. Can only be updated by the fungible module.
+ * @param gasLimit, new gas limit.
+ */
+ function updateGasLimit(uint256 gasLimit) external onlyFungible {
+ GAS_LIMIT = gasLimit;
+ emit UpdatedGasLimit(gasLimit);
+ }
+
+ /**
+ * @dev Updates protocol flat fee. Can only be updated by the fungible module.
+ * @param protocolFlatFee, new protocol flat fee.
+ */
+ function updateProtocolFlatFee(uint256 protocolFlatFee) external onlyFungible {
+ PROTOCOL_FLAT_FEE = protocolFlatFee;
+ emit UpdatedProtocolFlatFee(protocolFlatFee);
+ }
+
+ /**
+ * @dev Updates newField. Can only be updated by the fungible module.
+ * @param newField_, new newField.
+ */
+ function updateNewField(uint256 newField_) external {
+ newField = newField_;
+ }
+}
diff --git a/contrib/localnet/orchestrator/smoketest/contracts/testzrc20/bindings.go b/contrib/localnet/orchestrator/smoketest/contracts/testzrc20/bindings.go
new file mode 100644
index 0000000000..dc615b9770
--- /dev/null
+++ b/contrib/localnet/orchestrator/smoketest/contracts/testzrc20/bindings.go
@@ -0,0 +1,6 @@
+//go:generate sh -c "solc --evm-version paris TestZRC20.sol --combined-json abi,bin | jq '.contracts.\"TestZRC20.sol:TestZRC20\"' > TestZRC20.json"
+//go:generate sh -c "cat TestZRC20.json | jq .abi > TestZRC20.abi"
+//go:generate sh -c "cat TestZRC20.json | jq .bin | tr -d '\"' > TestZRC20.bin"
+//go:generate sh -c "abigen --abi TestZRC20.abi --bin TestZRC20.bin --pkg testzrc20 --type TestZRC20 --out TestZRC20.go"
+
+package testzrc20
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..95ee48389e 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,23 @@ var LocalCmd = &cobra.Command{
Run: LocalSmokeTest,
}
-func init() {
- RootCmd.AddCommand(LocalCmd)
+type localArgs struct {
+ contractsDeployed bool
+ waitForHeight int64
}
-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")
+ LocalCmd.Flags().Int64Var(&localTestArgs.waitForHeight, "wait-for", 0, "block height for smoketest to begin, ex. --wait-for 100")
+}
- 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 +96,16 @@ func LocalSmokeTest(_ *cobra.Command, _ []string) {
os.Exit(1)
}()
+ if localTestArgs.waitForHeight != 0 {
+ WaitForBlockHeight(localTestArgs.waitForHeight)
+ }
+
+ // set account prefix to zeta
+ cfg := sdk.GetConfig()
+ cfg.SetBech32PrefixForAccount(app.Bech32PrefixAccAddr, app.Bech32PrefixAccPub)
+ cfg.Seal()
+
+ // initialize clients
connCfg := &rpcclient.ConnConfig{
Host: "bitcoin:18443",
User: "smoketest",
@@ -218,17 +148,29 @@ 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)
- // Wait for Genesis and keygen to be completed. ~ height 30
+ //Wait for Genesis
time.Sleep(20 * time.Second)
+
+ // initialize client to send messages to ZetaChain
+ zetaTxServer, err := NewZetaTxServer(
+ "http://zetacore0:26657",
+ []string{FungibleAdminName},
+ []string{FungibleAdminMnemonic},
+ )
+ if err != nil {
+ panic(err)
+ }
+
+ //Wait for keygen to be completed. ~ height 30
for {
time.Sleep(5 * time.Second)
- response, err := cctxClient.LastZetaHeight(context.Background(), &types.QueryLastZetaHeightRequest{})
+ response, err := cctxClient.LastZetaHeight(context.Background(), &crosschaintypes.QueryLastZetaHeightRequest{})
if err != nil {
fmt.Printf("cctxClient.LastZetaHeight error: %s", err)
continue
@@ -259,7 +201,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 +240,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 +264,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()
@@ -337,7 +292,7 @@ func LocalSmokeTest(_ *cobra.Command, _ []string) {
smokeTest.CheckZRC20ReserveAndSupply()
smokeTest.TestBitcoinWithdraw()
- smokeTest.CheckZRC20ReserveAndSupply()
+ //smokeTest.CheckZRC20ReserveAndSupply()
smokeTest.TestCrosschainSwap()
smokeTest.CheckZRC20ReserveAndSupply()
@@ -348,48 +303,17 @@ func LocalSmokeTest(_ *cobra.Command, _ []string) {
smokeTest.TestMessagePassingRevertSuccess()
smokeTest.CheckZRC20ReserveAndSupply()
+ smokeTest.TestPauseZRC20()
+ smokeTest.CheckZRC20ReserveAndSupply()
+
+ smokeTest.TestERC20DepositAndCallRefund()
+ smokeTest.CheckZRC20ReserveAndSupply()
+
+ smokeTest.TestUpdateBytecode()
+ 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..7e40cb8084 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)
@@ -166,7 +170,8 @@ func (sm *SmokeTest) TestCrosschainSwap() {
memo = append(sm.ZEVMSwapAppAddr.Bytes(), memo...)
fmt.Printf("memo length %d\n", len(memo))
- txid, err := SendToTSSFromDeployerWithMemo(BTCTSSAddress, 0.001, utxos[0:2], sm.btcRPCClient, memo)
+ amount := 0.1
+ txid, err := SendToTSSFromDeployerWithMemo(BTCTSSAddress, amount, utxos[0:2], sm.btcRPCClient, memo)
fmt.Printf("Sent BTC to TSS txid %s; now mining 10 blocks for confirmation\n", txid)
_, err = sm.btcRPCClient.GenerateToAddress(10, BTCDeployerAddress, nil)
if err != nil {
@@ -178,6 +183,7 @@ func (sm *SmokeTest) TestCrosschainSwap() {
fmt.Printf(" inboudn tx hash %s\n", cctx.InboundTxParams.InboundTxObservedHash)
fmt.Printf(" status %s\n", cctx.CctxStatus.Status.String())
fmt.Printf(" status msg: %s\n", cctx.CctxStatus.StatusMessage)
+
if cctx.CctxStatus.Status != types.CctxStatus_Reverted {
panic(fmt.Sprintf("expected reverted status; got %s", cctx.CctxStatus.Status.String()))
}
diff --git a/contrib/localnet/orchestrator/smoketest/test_deposit_eth.go b/contrib/localnet/orchestrator/smoketest/test_deposit_eth.go
index f44fcb44aa..cf3e03b4c1 100644
--- a/contrib/localnet/orchestrator/smoketest/test_deposit_eth.go
+++ b/contrib/localnet/orchestrator/smoketest/test_deposit_eth.go
@@ -9,15 +9,17 @@ import (
"math/big"
"time"
- ethcommon "github.com/ethereum/go-ethereum/common"
- "github.com/zeta-chain/zetacore/x/crosschain/types"
- "github.com/zeta-chain/zetacore/zetaclient"
+ "github.com/zeta-chain/zetacore/common/ethereum"
+ observertypes "github.com/zeta-chain/zetacore/x/observer/types"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
+ ethcommon "github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
zrc20 "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol"
"github.com/zeta-chain/zetacore/common"
+ "github.com/zeta-chain/zetacore/x/crosschain/types"
+ "github.com/zeta-chain/zetacore/zetaclient"
)
// this tests sending ZETA out of ZetaChain to Ethereum
@@ -39,6 +41,26 @@ func (sm *SmokeTest) TestDepositEtherIntoZRC20() {
}
fmt.Printf("GOERLI deployer balance: %s\n", bal.String())
+ systemContract := sm.SystemContract
+ if err != nil {
+ panic(err)
+ }
+ ethZRC20Addr, err := systemContract.GasCoinZRC20ByChainId(&bind.CallOpts{}, big.NewInt(common.GoerliChain().ChainId))
+ if err != nil {
+ panic(err)
+ }
+ sm.ETHZRC20Addr = ethZRC20Addr
+ fmt.Printf("eth zrc20 address: %s\n", ethZRC20Addr.String())
+ ethZRC20, err := zrc20.NewZRC20(ethZRC20Addr, sm.zevmClient)
+ if err != nil {
+ panic(err)
+ }
+ sm.ETHZRC20 = ethZRC20
+ initialBalance, err := ethZRC20.BalanceOf(nil, DeployerAddress)
+ if err != nil {
+ panic(err)
+ }
+
value := big.NewInt(1000000000000000000) // in wei (1 eth)
signedTx, err := sm.SendEther(TSSAddress, value, nil)
if err != nil {
@@ -53,6 +75,67 @@ func (sm *SmokeTest) TestDepositEtherIntoZRC20() {
fmt.Printf(" value: %d\n", signedTx.Value())
fmt.Printf(" block num: %d\n", receipt.BlockNumber)
+ {
+ LoudPrintf("Merkle Proof\n")
+ txHash := receipt.TxHash
+ blockHash := receipt.BlockHash
+ txIndex := int(receipt.TransactionIndex)
+
+ block, err := sm.goerliClient.BlockByHash(context.Background(), blockHash)
+ if err != nil {
+ panic(err)
+ }
+ i := 0
+ for {
+ if i > 20 {
+ panic("block header not found")
+ }
+ _, err := sm.observerClient.GetBlockHeaderByHash(context.Background(), &observertypes.QueryGetBlockHeaderByHashRequest{
+ BlockHash: blockHash.Bytes(),
+ })
+ if err != nil {
+ fmt.Printf("WARN: block header not found; retrying... error: %s \n", err.Error())
+ time.Sleep(5 * time.Second)
+ } else {
+ fmt.Printf("OK: block header found\n")
+ break
+ }
+ i++
+ }
+
+ trie := ethereum.NewTrie(block.Transactions())
+ if trie.Hash() != block.Header().TxHash {
+ panic("tx root hash & block tx root mismatch")
+ }
+ txProof, err := trie.GenerateProof(txIndex)
+ if err != nil {
+ panic("error generating txProof")
+ }
+ val, err := txProof.Verify(block.TxHash(), txIndex)
+ if err != nil {
+ panic("error verifying txProof")
+ }
+ var txx ethtypes.Transaction
+ err = txx.UnmarshalBinary(val)
+ if err != nil {
+ panic("error unmarshalling txProof'd tx")
+ }
+ res, err := sm.observerClient.Prove(context.Background(), &observertypes.QueryProveRequest{
+ BlockHash: blockHash.Hex(),
+ TxIndex: int64(txIndex),
+ TxHash: txHash.Hex(),
+ Proof: common.NewEthereumProof(txProof),
+ ChainId: 0,
+ })
+ if err != nil {
+ panic(err)
+ }
+ if !res.Valid {
+ panic("txProof invalid") // FIXME: don't do this in production
+ }
+ fmt.Printf("OK: txProof verified\n")
+ }
+
{
tx, err := sm.SendEther(TSSAddress, big.NewInt(101000000000000000), []byte(zetaclient.DonationMessage))
if err != nil {
@@ -74,29 +157,15 @@ func (sm *SmokeTest) TestDepositEtherIntoZRC20() {
defer sm.wg.Done()
<-c
- systemContract := sm.SystemContract
- if err != nil {
- panic(err)
- }
- ethZRC20Addr, err := systemContract.GasCoinZRC20ByChainId(&bind.CallOpts{}, big.NewInt(common.GoerliChain().ChainId))
- if err != nil {
- panic(err)
- }
- sm.ETHZRC20Addr = ethZRC20Addr
- fmt.Printf("eth zrc20 address: %s\n", ethZRC20Addr.String())
- ethZRC20, err := zrc20.NewZRC20(ethZRC20Addr, sm.zevmClient)
- if err != nil {
- panic(err)
- }
- sm.ETHZRC20 = ethZRC20
- ethZRC20Balance, err := ethZRC20.BalanceOf(nil, DeployerAddress)
+ currentBalance, 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)
+ 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")
}
@@ -126,12 +195,17 @@ func (sm *SmokeTest) TestDepositAndCallRefund() {
if err != nil {
panic(err)
}
- value := big.NewInt(100000000000000000) // in wei (1 eth)
- gasLimit := uint64(23000) // in units
+
+ // in wei (10 eth)
+ value := big.NewInt(1e18)
+ value = value.Mul(value, big.NewInt(10))
+
+ gasLimit := uint64(23000) // in units
gasPrice, err := goerliClient.SuggestGasPrice(context.Background())
if err != nil {
panic(err)
}
+
data := append(sm.BTCZRC20Addr.Bytes(), []byte("hello sailors")...) // this data
tx := ethtypes.NewTransaction(nonce, TSSAddress, value, gasLimit, gasPrice, data)
chainID, err := goerliClient.NetworkID(context.Background())
@@ -164,6 +238,7 @@ func (sm *SmokeTest) TestDepositAndCallRefund() {
fmt.Printf("cctx status message: %s", cctx.CctxStatus.StatusMessage)
revertTxHash := cctx.GetCurrentOutTxParam().OutboundTxHash
fmt.Printf("GOERLI revert tx receipt: status %d\n", receipt.Status)
+
tx, _, err := sm.goerliClient.TransactionByHash(context.Background(), ethcommon.HexToHash(revertTxHash))
if err != nil {
panic(err)
@@ -172,13 +247,41 @@ func (sm *SmokeTest) TestDepositAndCallRefund() {
if err != nil {
panic(err)
}
- if cctx.CctxStatus.Status != types.CctxStatus_Reverted || receipt.Status == 0 || *tx.To() != DeployerAddress || tx.Value().Cmp(value) != 0 {
+
+ printTxInfo := func() {
// debug info when test fails
fmt.Printf(" tx: %+v\n", tx)
fmt.Printf(" receipt: %+v\n", receipt)
fmt.Printf("cctx http://localhost:1317/zeta-chain/crosschain/cctx/%s\n", cctx.Index)
- panic(fmt.Sprintf("expected cctx status PendingRevert; got %s", cctx.CctxStatus.Status))
}
+
+ if cctx.CctxStatus.Status != types.CctxStatus_Reverted {
+ printTxInfo()
+ panic(fmt.Sprintf("expected cctx status to be PendingRevert; got %s", cctx.CctxStatus.Status))
+ }
+
+ if receipt.Status == 0 {
+ printTxInfo()
+ panic("expected the revert tx receipt to have status 1; got 0")
+ }
+
+ if *tx.To() != DeployerAddress {
+ printTxInfo()
+ panic(fmt.Sprintf("expected tx to %s; got %s", DeployerAddress.Hex(), tx.To().Hex()))
+ }
+
+ // the received value must be lower than the original value because of the paid fees for the revert tx
+ // we check that the value is still greater than 0
+ if tx.Value().Cmp(value) != -1 || tx.Value().Cmp(big.NewInt(0)) != 1 {
+ printTxInfo()
+ panic(fmt.Sprintf("expected tx value %s; should be non-null and lower than %s", tx.Value().String(), value.String()))
+ }
+
+ fmt.Printf("REVERT tx receipt: %d\n", receipt.Status)
+ fmt.Printf(" tx hash: %s\n", receipt.TxHash.String())
+ fmt.Printf(" to: %s\n", tx.To().String())
+ fmt.Printf(" value: %s\n", tx.Value().String())
+ fmt.Printf(" block num: %d\n", receipt.BlockNumber)
}()
}
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_erc20_refund.go b/contrib/localnet/orchestrator/smoketest/test_erc20_refund.go
new file mode 100644
index 0000000000..e8d5686313
--- /dev/null
+++ b/contrib/localnet/orchestrator/smoketest/test_erc20_refund.go
@@ -0,0 +1,200 @@
+//go:build PRIVNET
+// +build PRIVNET
+
+package main
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "math/big"
+ "time"
+
+ "github.com/ethereum/go-ethereum/accounts/abi/bind"
+ ethcommon "github.com/ethereum/go-ethereum/common"
+
+ "github.com/zeta-chain/zetacore/x/crosschain/types"
+)
+
+func (sm *SmokeTest) TestERC20DepositAndCallRefund() {
+ startTime := time.Now()
+ defer func() {
+ fmt.Printf("test finishes in %s\n", time.Since(startTime))
+ }()
+ LoudPrintf("Deposit a non-gas ZRC20 into ZEVM and call a contract that reverts; should refund on ZetaChain if no liquidity pool, should refund on origin if liquidity pool\n")
+
+ // Get the initial balance of the deployer
+ initialBal, err := sm.USDTZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress)
+ if err != nil {
+ panic(err)
+ }
+
+ fmt.Println("Sending a deposit that should revert without a liquidity pool makes the cctx aborted")
+
+ amount := big.NewInt(1e4)
+
+ // send the deposit
+ inTxHash, err := sm.sendInvalidUSDTDeposit(amount)
+ if err != nil {
+ panic(err)
+ }
+
+ // There is no liquidity pool, therefore the cctx should abort
+ cctx := WaitCctxMinedByInTxHash(inTxHash, sm.cctxClient)
+ if cctx.CctxStatus.Status != types.CctxStatus_Aborted {
+ panic(fmt.Sprintf("expected cctx status to be Aborted; got %s", cctx.CctxStatus.Status))
+ }
+
+ // Check that the erc20 in the aborted cctx was refunded on ZetaChain
+ newBalance, err := sm.USDTZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress)
+ if err != nil {
+ panic(err)
+ }
+ expectedBalance := initialBal.Add(initialBal, amount)
+ if newBalance.Cmp(expectedBalance) != 0 {
+ panic(fmt.Sprintf("expected balance to be %s after refund; got %s", expectedBalance.String(), newBalance.String()))
+ }
+ fmt.Println("CCTX has been aborted and the erc20 has been refunded on ZetaChain")
+
+ amount = big.NewInt(1e7)
+ goerliBalance, err := sm.USDTERC20.BalanceOf(&bind.CallOpts{}, DeployerAddress)
+ if err != nil {
+ panic(err)
+ }
+
+ fmt.Println("Sending a deposit that should revert with a liquidity pool")
+
+ fmt.Println("Creating the liquidity pool USTD/ZETA")
+ err = sm.createZetaERC20LiquidityPool()
+ if err != nil {
+ panic(err)
+ }
+ fmt.Println("Liquidity pool created")
+
+ // send the deposit
+ inTxHash, err = sm.sendInvalidUSDTDeposit(amount)
+ if err != nil {
+ panic(err)
+ }
+
+ // there is a liquidity pool, therefore the cctx should revert
+ cctx = WaitCctxMinedByInTxHash(inTxHash, sm.cctxClient)
+
+ // the revert tx creation will fail because the sender, used as the recipient, is not defined in the cctx
+ if cctx.CctxStatus.Status != types.CctxStatus_Reverted {
+ panic(fmt.Sprintf("expected cctx status to be PendingRevert; got %s", cctx.CctxStatus.Status))
+ }
+
+ // get revert tx
+ revertTxHash := cctx.GetCurrentOutTxParam().OutboundTxHash
+ _, _, err = sm.goerliClient.TransactionByHash(context.Background(), ethcommon.HexToHash(revertTxHash))
+ if err != nil {
+ panic(err)
+ }
+ receipt, err := sm.goerliClient.TransactionReceipt(context.Background(), ethcommon.HexToHash(revertTxHash))
+ if err != nil {
+ panic(err)
+ }
+ if receipt.Status == 0 {
+ panic("expected the revert tx receipt to have status 1; got 0")
+ }
+
+ // check that the erc20 in the reverted cctx was refunded on Goerli
+ newGoerliBalance, err := sm.USDTERC20.BalanceOf(&bind.CallOpts{}, DeployerAddress)
+ if err != nil {
+ panic(err)
+ }
+ // the new balance must be higher than the previous one because of the revert refund
+ if goerliBalance.Cmp(newGoerliBalance) != -1 {
+ panic(fmt.Sprintf("expected balance to be higher than %s after refund; got %s", goerliBalance.String(), newGoerliBalance.String()))
+ }
+ // it must also be lower than the previous balance + the amount because of the gas fee for the revert tx
+ balancePlusAmount := goerliBalance.Add(goerliBalance, amount)
+ if newGoerliBalance.Cmp(balancePlusAmount) != -1 {
+ panic(fmt.Sprintf("expected balance to be lower than %s after refund; got %s", balancePlusAmount.String(), newGoerliBalance.String()))
+ }
+
+ fmt.Println("ERC20 CCTX successfully reverted")
+ fmt.Println("\tbalance before refund: ", goerliBalance.String())
+ fmt.Println("\tamount: ", amount.String())
+ fmt.Println("\tbalance after refund: ", newGoerliBalance.String())
+}
+
+func (sm *SmokeTest) createZetaERC20LiquidityPool() error {
+ amount := big.NewInt(1e10)
+ txHash := sm.DepositERC20(amount, []byte{})
+ WaitCctxMinedByInTxHash(txHash.Hex(), sm.cctxClient)
+
+ tx, err := sm.USDTZRC20.Approve(sm.zevmAuth, sm.UniswapV2RouterAddr, big.NewInt(1e10))
+ if err != nil {
+ return err
+ }
+ receipt := MustWaitForTxReceipt(sm.zevmClient, tx)
+ if receipt.Status == 0 {
+ return errors.New("approve failed")
+ }
+
+ previousValue := sm.zevmAuth.Value
+ sm.zevmAuth.Value = big.NewInt(1e10)
+ tx, err = sm.UniswapV2Router.AddLiquidityETH(
+ sm.zevmAuth,
+ sm.USDTZRC20Addr,
+ amount,
+ BigZero,
+ BigZero,
+ DeployerAddress,
+ big.NewInt(time.Now().Add(10*time.Minute).Unix()),
+ )
+ sm.zevmAuth.Value = previousValue
+ if err != nil {
+ return err
+ }
+ receipt = MustWaitForTxReceipt(sm.zevmClient, tx)
+ if receipt.Status == 0 {
+ return errors.New("add liquidity failed")
+ }
+
+ return nil
+}
+
+func (sm *SmokeTest) sendInvalidUSDTDeposit(amount *big.Int) (string, error) {
+ // send the tx
+ USDT := sm.USDTERC20
+ tx, err := USDT.Mint(sm.goerliAuth, amount)
+ if err != nil {
+ return "", err
+ }
+ receipt := MustWaitForTxReceipt(sm.goerliClient, tx)
+ fmt.Printf("Mint receipt tx hash: %s\n", tx.Hash().Hex())
+
+ tx, err = USDT.Approve(sm.goerliAuth, sm.ERC20CustodyAddr, amount)
+ if err != nil {
+ return "", err
+ }
+ receipt = MustWaitForTxReceipt(sm.goerliClient, tx)
+ fmt.Printf("USDT Approve receipt tx hash: %s\n", tx.Hash().Hex())
+
+ tx, err = sm.ERC20Custody.Deposit(
+ sm.goerliAuth,
+ DeployerAddress.Bytes(),
+ sm.USDTERC20Addr,
+ amount,
+ []byte("this is an invalid msg that will cause the contract to revert"),
+ )
+ if err != nil {
+ return "", err
+ }
+
+ fmt.Printf("GOERLI tx sent: %s; to %s, nonce %d\n", tx.Hash().String(), tx.To().Hex(), tx.Nonce())
+ receipt = MustWaitForTxReceipt(sm.goerliClient, tx)
+ if receipt.Status == 0 {
+ return "", errors.New("expected the tx receipt to have status 1; got 0")
+ }
+ fmt.Printf("GOERLI tx receipt: %d\n", receipt.Status)
+ fmt.Printf(" tx hash: %s\n", receipt.TxHash.String())
+ fmt.Printf(" to: %s\n", tx.To().String())
+ fmt.Printf(" value: %d\n", tx.Value())
+ fmt.Printf(" block num: %d\n", receipt.BlockNumber)
+
+ return tx.Hash().Hex(), 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..bd03f5b1c7 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 {
@@ -206,7 +218,7 @@ func (sm *SmokeTest) EchoNetworkMetrics() {
numTicks++
// Get all pending outbound transactions
cctxResp, err := sm.cctxClient.CctxAllPending(context.Background(), &types2.QueryAllCctxPendingRequest{
- ChainId: uint64(common.GoerliChain().ChainId),
+ ChainId: common.GoerliChain().ChainId,
})
if err != nil {
continue
diff --git a/contrib/localnet/orchestrator/smoketest/test_update_bytecode.go b/contrib/localnet/orchestrator/smoketest/test_update_bytecode.go
new file mode 100644
index 0000000000..f8350b9a12
--- /dev/null
+++ b/contrib/localnet/orchestrator/smoketest/test_update_bytecode.go
@@ -0,0 +1,189 @@
+//go:build PRIVNET
+// +build PRIVNET
+
+package main
+
+import (
+ "fmt"
+ "math/big"
+ "time"
+
+ "github.com/ethereum/go-ethereum/accounts/abi/bind"
+ "github.com/zeta-chain/zetacore/common"
+ "github.com/zeta-chain/zetacore/contrib/localnet/orchestrator/smoketest/contracts/testzrc20"
+ "github.com/zeta-chain/zetacore/testutil/sample"
+ fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types"
+)
+
+// TestUpdateBytecode tests updating the bytecode of a zrc20 and interact with it
+func (sm *SmokeTest) TestUpdateBytecode() {
+ startTime := time.Now()
+ defer func() {
+ fmt.Printf("test finishes in %s\n", time.Since(startTime))
+ }()
+ LoudPrintf("Testing updating ZRC20 bytecode swap...\n")
+
+ // Random approval
+ approved := sample.EthAddress()
+ tx, err := sm.ETHZRC20.Approve(sm.zevmAuth, approved, big.NewInt(1e10))
+ if err != nil {
+ panic(err)
+ }
+ receipt := MustWaitForTxReceipt(sm.zevmClient, tx)
+ if receipt.Status != 1 {
+ panic("approval failed")
+ }
+
+ // Deploy the TestZRC20 contract
+ fmt.Println("Deploying contract with new bytecode")
+ newZRC20Address, _, newZRC20Contract, err := testzrc20.DeployTestZRC20(sm.zevmAuth, sm.zevmClient, big.NewInt(5), uint8(common.CoinType_Gas))
+ if err != nil {
+ panic(err)
+ }
+
+ // Get current info of the ZRC20
+ name, err := sm.ETHZRC20.Name(&bind.CallOpts{})
+ if err != nil {
+ panic(err)
+ }
+ symbol, err := sm.ETHZRC20.Symbol(&bind.CallOpts{})
+ if err != nil {
+ panic(err)
+ }
+ decimals, err := sm.ETHZRC20.Decimals(&bind.CallOpts{})
+ if err != nil {
+ panic(err)
+ }
+ totalSupply, err := sm.ETHZRC20.TotalSupply(&bind.CallOpts{})
+ if err != nil {
+ panic(err)
+ }
+ balance, err := sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress)
+ if err != nil {
+ panic(err)
+ }
+ approval, err := sm.ETHZRC20.Allowance(&bind.CallOpts{}, DeployerAddress, approved)
+ if err != nil {
+ panic(err)
+ }
+
+ fmt.Println("Updating the bytecode of the ZRC20")
+ msg := fungibletypes.NewMsgUpdateContractBytecode(
+ FungibleAdminAddress,
+ sm.ETHZRC20Addr,
+ newZRC20Address,
+ )
+ res, err := sm.zetaTxServer.BroadcastTx(FungibleAdminName, msg)
+ if err != nil {
+ panic(err)
+ }
+ fmt.Printf("Update zrc20 bytecode tx hash: %s\n", res.TxHash)
+
+ // Get new info of the ZRC20
+ fmt.Println("Checking the state of the ZRC20 remains the same")
+ newName, err := sm.ETHZRC20.Name(&bind.CallOpts{})
+ if err != nil {
+ panic(err)
+ }
+ if name != newName {
+ panic("name shouldn't change upon bytecode update")
+ }
+ newSymbol, err := sm.ETHZRC20.Symbol(&bind.CallOpts{})
+ if err != nil {
+ panic(err)
+ }
+ if symbol != newSymbol {
+ panic("symbol shouldn't change upon bytecode update")
+ }
+ newDecimals, err := sm.ETHZRC20.Decimals(&bind.CallOpts{})
+ if err != nil {
+ panic(err)
+ }
+ if decimals != newDecimals {
+ panic("decimals shouldn't change upon bytecode update")
+ }
+ newTotalSupply, err := sm.ETHZRC20.TotalSupply(&bind.CallOpts{})
+ if err != nil {
+ panic(err)
+ }
+ if totalSupply.Cmp(newTotalSupply) != 0 {
+ panic("total supply shouldn't change upon bytecode update")
+ }
+ newBalance, err := sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, DeployerAddress)
+ if err != nil {
+ panic(err)
+ }
+ if balance.Cmp(newBalance) != 0 {
+ panic("balance shouldn't change upon bytecode update")
+ }
+ newApproval, err := sm.ETHZRC20.Allowance(&bind.CallOpts{}, DeployerAddress, approved)
+ if err != nil {
+ panic(err)
+ }
+ if approval.Cmp(newApproval) != 0 {
+ panic("approval shouldn't change upon bytecode update")
+ }
+
+ fmt.Println("Can interact with the new code of the contract")
+ testZRC20Contract, err := testzrc20.NewTestZRC20(sm.ETHZRC20Addr, sm.zevmClient)
+ if err != nil {
+ panic(err)
+ }
+ tx, err = testZRC20Contract.UpdateNewField(sm.zevmAuth, big.NewInt(1e10))
+ if err != nil {
+ panic(err)
+ }
+ receipt = MustWaitForTxReceipt(sm.zevmClient, tx)
+ if receipt.Status != 1 {
+ panic("update new field failed")
+ }
+ newField, err := testZRC20Contract.NewField(&bind.CallOpts{})
+ if err != nil {
+ panic(err)
+ }
+ if newField.Cmp(big.NewInt(1e10)) != 0 {
+ panic("new field value mismatch")
+ }
+
+ fmt.Println("Interacting with the bytecode contract doesn't disrupt the zrc20 contract")
+ tx, err = newZRC20Contract.UpdateNewField(sm.zevmAuth, big.NewInt(1e5))
+ if err != nil {
+ panic(err)
+ }
+ receipt = MustWaitForTxReceipt(sm.zevmClient, tx)
+ if receipt.Status != 1 {
+ panic("update new field failed")
+ }
+ newField, err = newZRC20Contract.NewField(&bind.CallOpts{})
+ if err != nil {
+ panic(err)
+ }
+ if newField.Cmp(big.NewInt(1e5)) != 0 {
+ panic("new field value mismatch on bytecode contract")
+ }
+ newField, err = testZRC20Contract.NewField(&bind.CallOpts{})
+ if err != nil {
+ panic(err)
+ }
+ if newField.Cmp(big.NewInt(1e10)) != 0 {
+ panic("new field value mismatch on zrc20 contract")
+ }
+
+ // can continue to operate the ZRC20
+ fmt.Println("Checking the ZRC20 can continue to operate after state change")
+ tx, err = sm.ETHZRC20.Transfer(sm.zevmAuth, approved, big.NewInt(1e14))
+ if err != nil {
+ panic(err)
+ }
+ receipt = MustWaitForTxReceipt(sm.zevmClient, tx)
+ if receipt.Status != 1 {
+ panic("transfer failed")
+ }
+ newBalance, err = sm.ETHZRC20.BalanceOf(&bind.CallOpts{}, approved)
+ if err != nil {
+ panic(err)
+ }
+ if newBalance.Cmp(big.NewInt(1e14)) != 0 {
+ panic("balance not updated")
+ }
+}
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..be9dd03f5f 100644
--- a/contrib/localnet/orchestrator/smoketest/utils.go
+++ b/contrib/localnet/orchestrator/smoketest/utils.go
@@ -11,19 +11,20 @@ import (
"sync"
"time"
+ rpchttp "github.com/tendermint/tendermint/rpc/client/http"
+ coretypes "github.com/tendermint/tendermint/rpc/core/types"
+
"github.com/ethereum/go-ethereum"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcutil"
-
+ ethcommon "github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/zeta-chain/zetacore/x/crosschain/types"
-
- 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 +83,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 +105,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 {
@@ -115,3 +116,17 @@ func ScriptPKToAddress(scriptPKHex string) string {
}
return ""
}
+
+func WaitForBlockHeight(height int64) {
+ // initialize rpc and check status
+ rpc, err := rpchttp.New("http://zetacore0:26657", "/websocket")
+ if err != nil {
+ panic(err)
+ }
+ status := &coretypes.ResultStatus{}
+ for status.SyncInfo.LatestBlockHeight < height {
+ status, _ = rpc.Status(context.Background())
+ time.Sleep(time.Second * 5)
+ fmt.Printf("waiting for block: %d, current height: %d\n", height, status.SyncInfo.LatestBlockHeight)
+ }
+}
diff --git a/contrib/localnet/orchestrator/smoketest/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-upgrade.sh b/contrib/localnet/orchestrator/start-upgrade.sh
new file mode 100644
index 0000000000..b787a5b0da
--- /dev/null
+++ b/contrib/localnet/orchestrator/start-upgrade.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+SMOKETEST_CMD=$1
+
+echo "waiting for geth RPC to start..."
+sleep 6
+echo "funding deployer address 0xE5C5367B8224807Ac2207d350E60e1b6F27a7ecC with 100 Ether"
+geth --exec 'eth.sendTransaction({from: eth.coinbase, to: "0xE5C5367B8224807Ac2207d350E60e1b6F27a7ecC", value: web3.toWei(100,"ether")})' attach http://eth:8545
+echo "funding TSS address 0xF421292cb0d3c97b90EEEADfcD660B893592c6A2 with 1 Ether"
+geth --exec 'eth.sendTransaction({from: eth.coinbase, to: "0xF421292cb0d3c97b90EEEADfcD660B893592c6A2", value: web3.toWei(100,"ether")})' attach http://eth:8545
+
+echo "waiting for 6s for the transaction to be mined"
+sleep 6
+echo "the new balance of the deployer addrees:"
+curl -sS http://eth:8545 \
+ -X POST \
+ -H "Content-Type: application/json" \
+ --data '{"method":"eth_getBalance","params":["0xE5C5367B8224807Ac2207d350E60e1b6F27a7ecC", "latest"],"id":1,"jsonrpc":"2.0"}'
+curl -sS http://eth:8545 \
+ -X POST \
+ -H "Content-Type: application/json" \
+ --data '{"method":"eth_getBalance","params":["0xF421292cb0d3c97b90EEEADfcD660B893592c6A2", "latest"],"id":1,"jsonrpc":"2.0"}'
+echo "running smoketest..."
+smoketest-old "$SMOKETEST_CMD"
+SMOKETEST_EXIT_CODE=$?
+if [ $SMOKETEST_EXIT_CODE -ne 0 ]; then
+ echo "smoketest failed"
+ exit 1
+fi
+
+# Restart zetaclients at upgrade height
+/work/restart-zetaclientd.sh -u 330 -n 2
+
+smoketest-new "$SMOKETEST_CMD" --deployed --wait-for 335
+
+if [ $SMOKETEST_EXIT_CODE -eq 0 ]; then
+ echo "smoketest passed"
+ exit 0
+else
+ echo "smoketest failed"
+ exit 1
+fi
\ No newline at end of file
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-stateful.sh b/contrib/localnet/scripts/genesis-stateful.sh
new file mode 100755
index 0000000000..5f9f293f1b
--- /dev/null
+++ b/contrib/localnet/scripts/genesis-stateful.sh
@@ -0,0 +1,185 @@
+#!/bin/bash
+
+/usr/sbin/sshd
+
+if [ $# -ne 1 ]
+then
+ echo "Usage: genesis.sh "
+ exit 1
+fi
+NUMOFNODES=$1
+
+# create keys
+CHAINID="athens_101-1"
+KEYRING="test"
+HOSTNAME=$(hostname)
+INDEX=${HOSTNAME:0-1}
+
+export DAEMON_HOME=$HOME/.zetacored
+export DAEMON_NAME=zetacored
+export DAEMON_ALLOW_DOWNLOAD_BINARIES=true
+export DAEMON_RESTART_AFTER_UPGRADE=true
+export CLIENT_DAEMON_NAME=zetaclientd
+export CLIENT_DAEMON_ARGS="-enable-chains,GOERLI,-val,operator"
+export DAEMON_DATA_BACKUP_DIR=$DAEMON_HOME
+export CLIENT_SKIP_UPGRADE=true
+export CLIENT_START_PROCESS=false
+export UNSAFE_SKIP_BACKUP=true
+export UpgradeName=${NEW_VERSION}
+
+# generate node list
+START=1
+# shellcheck disable=SC2100
+END=$((NUMOFNODES - 1))
+NODELIST=()
+for i in $(eval echo "{$START..$END}")
+do
+ NODELIST+=("zetacore$i")
+done
+
+echo "HOSTNAME: $HOSTNAME"
+
+# Init a new node to generate genesis file .
+# Copy config files from existing folders which get copied via Docker Copy when building images
+mkdir -p ~/.backup/config
+zetacored init Zetanode-Localnet --chain-id=$CHAINID
+rm -rf ~/.zetacored/config/app.toml
+rm -rf ~/.zetacored/config/client.toml
+rm -rf ~/.zetacored/config/config.toml
+cp -r ~/zetacored/common/app.toml ~/.zetacored/config/
+cp -r ~/zetacored/common/client.toml ~/.zetacored/config/
+cp -r ~/zetacored/common/config.toml ~/.zetacored/config/
+sed -i -e "/moniker =/s/=.*/= \"$HOSTNAME\"/" "$HOME"/.zetacored/config/config.toml
+
+# Add two new keys for operator and hotkey and create the required json structure for os_info
+source ~/os-info.sh
+
+# Pause other nodes so that the primary can node can do the genesis creation
+if [ $HOSTNAME != "zetacore0" ]
+then
+ echo "Waiting for zetacore0 to create genesis.json"
+ sleep $((7*NUMOFNODES))
+ echo "genesis.json created"
+fi
+
+# Genesis creation following steps
+# 1. Accumulate all the os_info files from other nodes on zetcacore0 and create a genesis.json
+# 2. Add the observers , authorizations and required params to the genesis.json
+# 3. Copy the genesis.json to all the nodes .And use it to create a gentx for every node
+# 4. Collect all the gentx files in zetacore0 and create the final genesis.json
+# 5. Copy the final genesis.json to all the nodes and start the nodes
+# 6. Update Config in zetacore0 so that it has the correct persistent peer list
+# 7. Start the nodes
+
+# Start of genesis creation . This is done only on zetacore0
+if [ $HOSTNAME == "zetacore0" ]
+then
+ # Misc : Copying the keyring to the client nodes so that they can sign the transactions
+ ssh zetaclient0 mkdir -p ~/.zetacored/keyring-test/
+ scp ~/.zetacored/keyring-test/* zetaclient0:~/.zetacored/keyring-test/
+
+# 1. Accumulate all the os_info files from other nodes on zetcacore0 and create a genesis.json
+ for NODE in "${NODELIST[@]}"; do
+ INDEX=${NODE:0-1}
+ ssh zetaclient"$INDEX" mkdir -p ~/.zetacored/
+ scp "$NODE":~/.zetacored/os_info/os.json ~/.zetacored/os_info/os_z"$INDEX".json
+ scp ~/.zetacored/os_info/os_z"$INDEX".json zetaclient"$INDEX":~/.zetacored/os.json
+ done
+
+ 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
+ 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
+ cat $HOME/.zetacored/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json
+ cat $HOME/.zetacored/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json
+ cat $HOME/.zetacored/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json
+ cat $HOME/.zetacored/config/genesis.json | jq '.app_state["evm"]["params"]["evm_denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json
+ cat $HOME/.zetacored/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="500000000"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json
+ cat $HOME/.zetacored/config/genesis.json | jq '.app_state["gov"]["voting_params"]["voting_period"]="100s"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json
+
+ # 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
+ # Copy host gentx to other nodes
+ for NODE in "${NODELIST[@]}"; do
+ ssh $NODE mkdir -p ~/.zetacored/config/gentx/peer/
+ scp ~/.zetacored/config/gentx/* $NODE:~/.zetacored/config/gentx/peer/
+ done
+ # Create gentx files on other nodes and copy them to host node
+ mkdir ~/.zetacored/config/gentx/z2gentx
+ for NODE in "${NODELIST[@]}"; do
+ ssh $NODE rm -rf ~/.zetacored/genesis.json
+ scp ~/.zetacored/config/genesis.json $NODE:~/.zetacored/config/genesis.json
+ ssh $NODE zetacored gentx operator 1000000000000000000000azeta --chain-id=$CHAINID --keyring-backend=$KEYRING
+ scp $NODE:~/.zetacored/config/gentx/* ~/.zetacored/config/gentx/
+ scp $NODE:~/.zetacored/config/gentx/* ~/.zetacored/config/gentx/z2gentx/
+ done
+
+# 4. Collect all the gentx files in zetacore0 and create the final genesis.json
+ zetacored collect-gentxs
+ zetacored validate-genesis
+# 5. Copy the final genesis.json to all the nodes
+ for NODE in "${NODELIST[@]}"; do
+ ssh $NODE rm -rf ~/.zetacored/genesis.json
+ scp ~/.zetacored/config/genesis.json $NODE:~/.zetacored/config/genesis.json
+ done
+# 6. Update Config in zetacore0 so that it has the correct persistent peer list
+ sleep 2
+ pp=$(cat $HOME/.zetacored/config/gentx/z2gentx/*.json | jq '.body.memo' )
+ pps=${pp:1:58}
+ sed -i -e "/persistent_peers =/s/=.*/= \"$pps\"/" "$HOME"/.zetacored/config/config.toml
+fi
+# End of genesis creation steps . The steps below are common to all the nodes
+
+# Update persistent peers
+if [ $HOSTNAME != "zetacore0" ]
+then
+ # Misc : Copying the keyring to the client nodes so that they can sign the transactions
+ ssh zetaclient"$INDEX" mkdir -p ~/.zetacored/keyring-test/
+ scp ~/.zetacored/keyring-test/* "zetaclient$INDEX":~/.zetacored/keyring-test/
+
+ pp=$(cat $HOME/.zetacored/config/gentx/peer/*.json | jq '.body.memo' )
+ pps=${pp:1:58}
+ sed -i -e "/persistent_peers =/s/=.*/= \"$pps\"/" "$HOME"/.zetacored/config/config.toml
+fi
+
+mkdir -p $DAEMON_HOME/zetavisor/genesis/bin
+mkdir -p $DAEMON_HOME/zetavisor/upgrades/"$UpgradeName"/bin
+
+# Setup zetavisor
+# Genesis
+cp $GOPATH/bin/old/zetacored $DAEMON_HOME/zetavisor/genesis/bin
+cp $GOPATH/bin/zetaclientd $DAEMON_HOME/zetavisor/genesis/bin
+
+#Upgrades
+cp $GOPATH/bin/new/zetacored $DAEMON_HOME/zetavisor/upgrades/$UpgradeName/bin/
+
+#Permissions
+chmod +x $DAEMON_HOME/zetavisor/genesis/bin/zetacored
+chmod +x $DAEMON_HOME/zetavisor/genesis/bin/zetaclientd
+chmod +x $DAEMON_HOME/zetavisor/upgrades/$UpgradeName/bin/zetacored
+
+
+# 7 Start the nodes
+zetavisor start --pruning=nothing --minimum-gas-prices=0.0001azeta --json-rpc.api eth,txpool,personal,net,debug,web3,miner --api.enable --home /root/.zetacored >> zetanode.log 2>&1 &
+sleep 20
+echo
+
+if [ $HOSTNAME = "zetacore0" ]
+then
+/root/.zetacored/zetavisor/current/bin/zetacored tx gov submit-legacy-proposal software-upgrade $UpgradeName --from hotkey --deposit 100000000azeta --upgrade-height 320 --title $UpgradeName --description $UpgradeName --keyring-backend test --chain-id $CHAINID --yes --no-validate --fees=200azeta --broadcast-mode block
+fi
+
+sleep 8
+/root/.zetacored/zetavisor/current/bin/zetacored tx gov vote 1 yes --from operator --keyring-backend test --chain-id $CHAINID --yes --fees=200azeta --broadcast-mode block
+sleep 7
+/root/.zetacored/zetavisor/current/bin/zetacored query gov proposal 1
+
+tail -f zetanode.log
\ No newline at end of file
diff --git a/contrib/localnet/scripts/genesis.sh b/contrib/localnet/scripts/genesis.sh
index fd67dce7b9..242dc8a56d 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,10 @@ 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 admin account
+ zetacored add-genesis-account zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk 100000000000000000000000000azeta
+ cat $HOME/.zetacored/config/genesis.json | jq '.app_state["observer"]["params"]["admin_policy"][0]["address"]="zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk"' > $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["observer"]["params"]["admin_policy"][1]["address"]="zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json
# 3. Copy the genesis.json to all the nodes .And use it to create a gentx for every node
zetacored gentx operator 1000000000000000000000azeta --chain-id=$CHAINID --keyring-backend=$KEYRING
diff --git a/contrib/localnet/scripts/start-zetaclientd-background.sh b/contrib/localnet/scripts/start-zetaclientd-background.sh
new file mode 100644
index 0000000000..76726958cc
--- /dev/null
+++ b/contrib/localnet/scripts/start-zetaclientd-background.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+/usr/sbin/sshd
+
+HOSTNAME=$(hostname)
+
+cp /root/preparams/PreParams_$HOSTNAME.json /root/preParams.json
+num=$(echo $HOSTNAME | tr -dc '0-9')
+node="zetacore$num"
+#mv /root/zetacored/zetacored_$node /root/.zetacored
+#mv /root/tss/$HOSTNAME /root/.tss
+
+echo "Wait for zetacore to exchange genesis file"
+sleep 30
+operator=$(cat $HOME/.zetacored/os.json | jq '.ObserverAddress' )
+operatorAddress=$(echo "$operator" | tr -d '"')
+echo "operatorAddress: $operatorAddress"
+echo "Start zetaclientd"
+if [ $HOSTNAME == "zetaclient0" ]
+then
+ rm ~/.tss/*
+ MYIP=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
+ zetaclientd init --zetacore-url zetacore0 --chain-id athens_101-1 --operator "$operatorAddress" --log-format=text --public-ip "$MYIP"
+ zetaclientd start > $HOME/zetaclient.log 2>&1 &
+else
+ num=$(echo $HOSTNAME | tr -dc '0-9')
+ node="zetacore$num"
+ MYIP=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
+ SEED=$(curl --retry 10 --retry-delay 5 --retry-connrefused -s zetaclient0:8123/p2p)
+ rm ~/.tss/*
+ zetaclientd init --peer /ip4/172.20.0.21/tcp/6668/p2p/"$SEED" --zetacore-url "$node" --chain-id athens_101-1 --operator "$operatorAddress" --log-format=text --public-ip "$MYIP" --log-level 0
+ zetaclientd start > $HOME/zetaclient.log 2>&1 &
+fi
+
+sleep 3
+tail -f $HOME/zetaclient.log
\ No newline at end of file
diff --git a/contrib/localnet/zetacored/zetacored_zetacore0/config/genesis.json b/contrib/localnet/zetacored/zetacored_zetacore0/config/genesis.json
index e3506a257c..52ac2072b8 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": {
@@ -617,11 +637,12 @@
],
"admin_policy": [
{
- "address": "zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73"
+ "policy_type": "group1",
+ "address": "zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk"
},
{
- "policy_type": 1,
- "address": "zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73"
+ "policy_type": "group2",
+ "address": "zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk"
}
]
}
diff --git a/contrib/localnet/zetacored/zetacored_zetacore1/config/genesis.json b/contrib/localnet/zetacored/zetacored_zetacore1/config/genesis.json
index e3506a257c..52ac2072b8 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": {
@@ -617,11 +637,12 @@
],
"admin_policy": [
{
- "address": "zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73"
+ "policy_type": "group1",
+ "address": "zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk"
},
{
- "policy_type": 1,
- "address": "zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73"
+ "policy_type": "group2",
+ "address": "zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk"
}
]
}
diff --git a/contrib/rpctest/main.go b/contrib/rpctest/main.go
index e909c97bd3..7d314bc888 100644
--- a/contrib/rpctest/main.go
+++ b/contrib/rpctest/main.go
@@ -51,10 +51,15 @@ func main() {
fmt.Printf("Start testing the zEVM ETH JSON-RPC for all txs...\n")
fmt.Printf("Test1: simple gas voter tx\n")
- bn, err := strconv.Atoi(os.Args[1])
+ bn, err := strconv.ParseInt(os.Args[1], 10, 64)
if err != nil {
panic(err)
}
+ if bn < 0 {
+ panic("Block number must be non-negative")
+ }
+ // #nosec G701 check as positive
+ bnUint64 := uint64(bn)
if false {
// THIS WOULD NOT WORK: see https://github.com/zeta-chain/zeta-node/pull/445
@@ -64,7 +69,7 @@ func main() {
panic(err)
}
- block, err := zevmClient.BlockByNumber(context.Background(), big.NewInt(int64(bn)))
+ block, err := zevmClient.BlockByNumber(context.Background(), big.NewInt(bn))
if err != nil {
panic(err)
}
@@ -76,7 +81,7 @@ func main() {
Endpoint: "http://localhost:8545",
HTTPClient: &http.Client{},
}
- resp := client.EthGetBlockByNumber(uint64(bn), false)
+ resp := client.EthGetBlockByNumber(bnUint64, false)
var jsonObject map[string]interface{}
if resp.Error != nil {
fmt.Printf("Error: %s (code %d)\n", resp.Error.Message, resp.Error.Code)
@@ -118,7 +123,7 @@ func main() {
// HeaderByHash works; BlockByHash does not work;
// main offending RPC is the transaction type; we have custom type id 56
// which is not recognized by the go-ethereum client.
- blockHeader, err := zevmClient.HeaderByNumber(context.Background(), big.NewInt(int64(bn)))
+ blockHeader, err := zevmClient.HeaderByNumber(context.Background(), big.NewInt(bn))
if err != nil {
panic(err)
}
@@ -209,9 +214,9 @@ func main() {
panic(err)
}
fmt.Printf("Gas price: %s\n", gas.String())
- toBlock := uint64(bn)
+ toBlock := bnUint64
gasPriceIter, err := sys.FilterSetGasPrice(&bind.FilterOpts{
- Start: uint64(bn),
+ Start: bnUint64,
End: &toBlock,
})
if err != nil {
diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml
index 5223becae8..6afb90290d 100644
--- a/docs/openapi/openapi.swagger.yaml
+++ b/docs/openapi/openapi.swagger.yaml
@@ -26596,11 +26596,11 @@ paths:
schema:
$ref: '#/definitions/googlerpcStatus'
parameters:
- - name: chainId
+ - name: chain_id
in: query
required: false
type: string
- format: uint64
+ format: int64
- name: pagination.key
description: |-
key is a value returned in PageResponse.next_key to begin
@@ -27290,6 +27290,26 @@ paths:
$ref: '#/definitions/googlerpcStatus'
tags:
- Query
+ /zeta-chain/crosschain/pendingNonces/{chain_id}:
+ get:
+ operationId: Query_PendingNoncesByChain
+ responses:
+ "200":
+ description: A successful response.
+ schema:
+ $ref: '#/definitions/crosschainQueryPendingNoncesByChainResponse'
+ default:
+ description: An unexpected error response.
+ schema:
+ $ref: '#/definitions/googlerpcStatus'
+ parameters:
+ - name: chain_id
+ in: path
+ required: true
+ type: string
+ format: int64
+ tags:
+ - Query
/zeta-chain/crosschain/protocolFee:
get:
operationId: Query_ProtocolFee
@@ -27372,6 +27392,20 @@ paths:
type: string
tags:
- Query
+ /zeta-chain/observer/crosschain_flags:
+ get:
+ operationId: Query_CrosschainFlags
+ responses:
+ "200":
+ description: A successful response.
+ schema:
+ $ref: '#/definitions/observerQueryGetCrosschainFlagsResponse'
+ default:
+ description: An unexpected error response.
+ schema:
+ $ref: '#/definitions/googlerpcStatus'
+ tags:
+ - Query
/zeta-chain/observer/get_all_blame_records:
get:
summary: Queries a list of VoterByIdentifier items.
@@ -27387,6 +27421,84 @@ paths:
$ref: '#/definitions/googlerpcStatus'
tags:
- Query
+ /zeta-chain/observer/get_all_block_headers:
+ get:
+ operationId: Query_GetAllBlockHeaders
+ responses:
+ "200":
+ description: A successful response.
+ schema:
+ $ref: '#/definitions/observerQueryAllBlockHeaderResponse'
+ default:
+ description: An unexpected error response.
+ schema:
+ $ref: '#/definitions/googlerpcStatus'
+ parameters:
+ - name: pagination.key
+ description: |-
+ key is a value returned in PageResponse.next_key to begin
+ querying the next page most efficiently. Only one of offset or key
+ should be set.
+ in: query
+ required: false
+ type: string
+ format: byte
+ - name: pagination.offset
+ description: |-
+ offset is a numeric offset that can be used when key is unavailable.
+ It is less efficient than using key. Only one of offset or key should
+ be set.
+ in: query
+ required: false
+ type: string
+ format: uint64
+ - name: pagination.limit
+ description: |-
+ limit is the total number of results to be returned in the result page.
+ If left empty it will default to a value to be set by each app.
+ in: query
+ required: false
+ type: string
+ format: uint64
+ - name: pagination.count_total
+ description: |-
+ count_total is set to true to indicate that the result set should include
+ a count of the total number of items available for pagination in UIs.
+ count_total is only respected when offset is used. It is ignored when key
+ is set.
+ in: query
+ required: false
+ type: boolean
+ - name: pagination.reverse
+ description: |-
+ reverse is set to true if results are to be returned in the descending order.
+
+ Since: cosmos-sdk 0.43
+ in: query
+ required: false
+ type: boolean
+ tags:
+ - Query
+ /zeta-chain/observer/get_block_header_by_hash/{block_hash}:
+ get:
+ operationId: Query_GetBlockHeaderByHash
+ responses:
+ "200":
+ description: A successful response.
+ schema:
+ $ref: '#/definitions/observerQueryGetBlockHeaderByHashResponse'
+ default:
+ description: An unexpected error response.
+ schema:
+ $ref: '#/definitions/googlerpcStatus'
+ parameters:
+ - name: block_hash
+ in: path
+ required: true
+ type: string
+ format: byte
+ tags:
+ - Query
/zeta-chain/observer/get_client_params_for_chain/{chain_id}:
get:
summary: Queries a list of GetClientParamsForChain items.
@@ -27552,18 +27664,54 @@ paths:
$ref: '#/definitions/googlerpcStatus'
tags:
- Query
- /zeta-chain/observer/permission_flags:
+ /zeta-chain/observer/prove:
get:
- operationId: Query_PermissionFlags
+ summary: merkle proof verification
+ operationId: Query_Prove
responses:
"200":
description: A successful response.
schema:
- $ref: '#/definitions/observerQueryGetPermissionFlagsResponse'
+ $ref: '#/definitions/observerQueryProveResponse'
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/googlerpcStatus'
+ parameters:
+ - name: chain_id
+ in: query
+ required: false
+ type: string
+ format: uint64
+ - name: tx_hash
+ in: query
+ required: false
+ type: string
+ - name: proof.ethereum_proof.keys
+ in: query
+ required: false
+ type: array
+ items:
+ type: string
+ format: byte
+ collectionFormat: multi
+ - name: proof.ethereum_proof.values
+ in: query
+ required: false
+ type: array
+ items:
+ type: string
+ format: byte
+ collectionFormat: multi
+ - name: block_hash
+ in: query
+ required: false
+ type: string
+ - name: tx_index
+ in: query
+ required: false
+ type: string
+ format: int64
tags:
- Query
/zeta-chain/observer/supportedChains:
@@ -50131,6 +50279,24 @@ definitions:
- VOTE_OPTION_ABSTAIN: VOTE_OPTION_ABSTAIN defines an abstain vote option.
- VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option.
- VOTE_OPTION_NO_WITH_VETO: VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option.
+ commonBlockHeader:
+ type: object
+ properties:
+ height:
+ type: string
+ format: int64
+ hash:
+ type: string
+ format: byte
+ parent_hash:
+ type: string
+ format: byte
+ chain_id:
+ type: string
+ format: int64
+ header:
+ $ref: '#/definitions/commonHeaderData'
+ title: chain specific header
commonChain:
type: object
properties:
@@ -50176,6 +50342,18 @@ definitions:
- Gas: Ether, BNB, Matic, Klay, BTC, etc
- ERC20: ERC20 token
- Cmd: not a real coin, rather a command
+ commonHeaderData:
+ type: object
+ properties:
+ ethereum_header:
+ type: string
+ format: byte
+ title: binary encoded headers; RLP for ethereum
+ commonProof:
+ type: object
+ properties:
+ ethereum_proof:
+ $ref: '#/definitions/ethereumProof'
commonPubKeySet:
type: object
properties:
@@ -50412,6 +50590,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:
@@ -50606,6 +50787,11 @@ definitions:
properties:
feeInZeta:
type: string
+ crosschainQueryPendingNoncesByChainResponse:
+ type: object
+ properties:
+ pending_nonces:
+ $ref: '#/definitions/crosschainPendingNonces'
crosschainQueryTssHistoryResponse:
type: object
properties:
@@ -50640,6 +50826,8 @@ definitions:
type: string
tx_signer:
type: string
+ proved:
+ type: boolean
emissionsQueryGetEmmisonsFactorsResponse:
type: object
properties:
@@ -50663,6 +50851,19 @@ definitions:
properties:
amount:
type: string
+ ethereumProof:
+ type: object
+ properties:
+ keys:
+ type: array
+ items:
+ type: string
+ format: byte
+ values:
+ type: array
+ items:
+ type: string
+ format: byte
fungibleForeignCoins:
type: object
properties:
@@ -50687,12 +50888,25 @@ definitions:
gas_limit:
type: string
format: uint64
+ paused:
+ type: boolean
fungibleMsgDeployFungibleCoinZRC20Response:
type: object
+ properties:
+ address:
+ type: string
fungibleMsgRemoveForeignCoinResponse:
type: object
+ fungibleMsgUpdateContractBytecodeResponse:
+ type: object
+ properties:
+ new_bytecode_hash:
+ type: string
+ format: byte
fungibleMsgUpdateSystemContractResponse:
type: object
+ fungibleMsgUpdateZRC20PausedStatusResponse:
+ type: object
fungibleMsgUpdateZRC20WithdrawFeeResponse:
type: object
fungibleQueryAllForeignCoinsResponse:
@@ -50736,6 +50950,12 @@ definitions:
type: string
connector_zevm:
type: string
+ fungibleUpdatePausedStatusAction:
+ type: string
+ enum:
+ - PAUSE
+ - UNPAUSE
+ default: PAUSE
googlerpcStatus:
type: object
properties:
@@ -50816,6 +51036,26 @@ definitions:
items:
type: object
$ref: '#/definitions/observerCoreParams'
+ observerCrosschainFlags:
+ type: object
+ properties:
+ isInboundEnabled:
+ type: boolean
+ isOutboundEnabled:
+ type: boolean
+ gasPriceIncreaseFlags:
+ $ref: '#/definitions/observerGasPriceIncreaseFlags'
+ observerGasPriceIncreaseFlags:
+ type: object
+ properties:
+ epochLength:
+ type: string
+ format: int64
+ retryInterval:
+ type: string
+ gasPriceIncreasePercent:
+ type: integer
+ format: int64
observerKeygen:
type: object
properties:
@@ -50848,13 +51088,15 @@ definitions:
format: int64
observerMsgAddBlameVoteResponse:
type: object
+ observerMsgAddBlockHeaderResponse:
+ type: object
observerMsgAddObserverResponse:
type: object
observerMsgUpdateCoreParamsResponse:
type: object
- observerMsgUpdateKeygenResponse:
+ observerMsgUpdateCrosschainFlagsResponse:
type: object
- observerMsgUpdatePermissionFlagsResponse:
+ observerMsgUpdateKeygenResponse:
type: object
observerNode:
type: object
@@ -50919,24 +51161,12 @@ definitions:
type: string
is_supported:
type: boolean
- observerPermissionFlags:
- type: object
- properties:
- isInboundEnabled:
- type: boolean
- isOutboundEnabled:
- type: boolean
observerPolicy_Type:
type: string
enum:
- - stop_inbound_cctx
- - deploy_fungible_coin
- - update_client_params
- - update_keygen_block
- - out_tx_tracker
- - add_observer
- default: stop_inbound_cctx
- title: '- stop_inbound_cctx: some observer sees inbound tx'
+ - group1
+ - group2
+ default: group1
observerQueryAllBlameRecordsResponse:
type: object
properties:
@@ -50945,6 +51175,16 @@ definitions:
items:
type: object
$ref: '#/definitions/observerBlame'
+ observerQueryAllBlockHeaderResponse:
+ type: object
+ properties:
+ block_headers:
+ type: array
+ items:
+ type: object
+ $ref: '#/definitions/commonBlockHeader'
+ pagination:
+ $ref: '#/definitions/v1beta1PageResponse'
observerQueryAllNodeAccountResponse:
type: object
properties:
@@ -50982,6 +51222,11 @@ definitions:
properties:
blame_info:
$ref: '#/definitions/observerBlame'
+ observerQueryGetBlockHeaderByHashResponse:
+ type: object
+ properties:
+ block_header:
+ $ref: '#/definitions/commonBlockHeader'
observerQueryGetCoreParamsForChainResponse:
type: object
properties:
@@ -50992,6 +51237,11 @@ definitions:
properties:
core_params:
$ref: '#/definitions/observerCoreParamsList'
+ observerQueryGetCrosschainFlagsResponse:
+ type: object
+ properties:
+ crosschain_flags:
+ $ref: '#/definitions/observerCrosschainFlags'
observerQueryGetKeygenResponse:
type: object
properties:
@@ -51002,11 +51252,6 @@ definitions:
properties:
node_account:
$ref: '#/definitions/observerNodeAccount'
- observerQueryGetPermissionFlagsResponse:
- type: object
- properties:
- permission_flags:
- $ref: '#/definitions/observerPermissionFlags'
observerQueryObserversByChainResponse:
type: object
properties:
@@ -51014,6 +51259,11 @@ definitions:
type: array
items:
type: string
+ observerQueryProveResponse:
+ type: object
+ properties:
+ valid:
+ type: boolean
observerQueryShowObserverCountResponse:
type: object
properties:
diff --git a/docs/spec/crosschain/messages.md b/docs/spec/crosschain/messages.md
index 64d0cd6a82..3cc1894372 100644
--- a/docs/spec/crosschain/messages.md
+++ b/docs/spec/crosschain/messages.md
@@ -2,10 +2,8 @@
## MsgAddToOutTxTracker
-Adds a new record to the outbound transaction tracker.
-
-Only the admin policy account and the observer validators are authorized to
-broadcast this message.
+AddToOutTxTracker adds a new record to the outbound transaction tracker.
+only the admin policy account and the observer validators are authorized to broadcast this message.
```proto
message MsgAddToOutTxTracker {
@@ -13,6 +11,9 @@ message MsgAddToOutTxTracker {
int64 chain_id = 2;
uint64 nonce = 3;
string tx_hash = 4;
+ common.Proof proof = 5;
+ string block_hash = 6;
+ int64 tx_index = 7;
}
```
@@ -29,9 +30,8 @@ message MsgAddToInTxTracker {
## MsgRemoveFromOutTxTracker
-Removes a record from the outbound transaction tracker by chain ID and nonce.
-
-Only the admin policy account is authorized to broadcast this message.
+RemoveFromOutTxTracker removes a record from the outbound transaction tracker by chain ID and nonce.
+only the admin policy account is authorized to broadcast this message.
```proto
message MsgRemoveFromOutTxTracker {
@@ -43,7 +43,7 @@ message MsgRemoveFromOutTxTracker {
## MsgCreateTSSVoter
-Vote on creating a TSS key and recording the information about it (public
+CreateTSSVoter votes on creating a TSS key and recording the information about it (public
key, participant and operator addresses, finalized and keygen heights).
If the vote passes, the information about the TSS key is recorded on chain
@@ -95,7 +95,7 @@ message MsgNonceVoter {
## MsgVoteOnObservedOutboundTx
-Casts a vote on an outbound transaction observed on a connected chain (after
+VoteOnObservedOutboundTx casts a vote on an outbound transaction observed on a connected chain (after
it has been broadcasted to and finalized on a connected chain). If this is
the first vote, a new ballot is created. When a threshold of votes is
reached, the ballot is finalized. When a ballot is finalized, the outbound
@@ -145,7 +145,8 @@ message MsgVoteOnObservedOutboundTx {
uint64 observed_outTx_blockHeight = 4;
uint64 observed_outTx_gas_used = 10;
string observed_outTx_effective_gas_price = 11;
- string zeta_minted = 5;
+ uint64 observed_outTx_effective_gas_limit = 12;
+ string value_received = 5;
common.ReceiveStatus status = 6;
int64 outTx_chain = 7;
uint64 outTx_tss_nonce = 8;
@@ -155,7 +156,7 @@ message MsgVoteOnObservedOutboundTx {
## MsgVoteOnObservedInboundTx
-Casts a vote on an inbound transaction observed on a connected chain. If this
+VoteOnObservedInboundTx casts a vote on an inbound transaction observed on a connected chain. If this
is the first vote, a new ballot is created. When a threshold of votes is
reached, the ballot is finalized. When a ballot is finalized, a new CCTX is
created.
diff --git a/docs/spec/fungible/messages.md b/docs/spec/fungible/messages.md
index 66b20811fc..9f86674b5b 100644
--- a/docs/spec/fungible/messages.md
+++ b/docs/spec/fungible/messages.md
@@ -66,3 +66,31 @@ message MsgUpdateZRC20WithdrawFee {
}
```
+## MsgUpdateContractBytecode
+
+UpdateContractBytecode updates the bytecode of a contract from the bytecode of an existing contract
+Only a ZRC20 contract or the WZeta connector contract can be updated
+IMPORTANT: the new contract bytecode must have the same storage layout as the old contract bytecode
+the new contract can add new variable but cannot remove any existing variable
+
+```proto
+message MsgUpdateContractBytecode {
+ string creator = 1;
+ string contract_address = 2;
+ string new_bytecode_address = 3;
+}
+```
+
+## 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/docs/spec/observer/messages.md b/docs/spec/observer/messages.md
index 6ae205a88e..5373e16993 100644
--- a/docs/spec/observer/messages.md
+++ b/docs/spec/observer/messages.md
@@ -16,7 +16,7 @@ message MsgAddObserver {
## MsgUpdateCoreParams
-Updates core parameters for a specific chain. Core parameters include
+UpdateCoreParams updates core parameters for a specific chain. Core parameters include
confirmation count, outbound transaction schedule interval, ZETA token,
connector and ERC20 custody contract addresses, etc.
@@ -41,25 +41,23 @@ message MsgAddBlameVote {
}
```
-## MsgUpdatePermissionFlags
-
-Updates permissions. Currently, this is only used to enable/disable the
-inbound transactions.
+## MsgUpdateCrosschainFlags
+UpdateCrosschainFlags updates the crosschain related flags.
Only the admin policy account is authorized to broadcast this message.
```proto
-message MsgUpdatePermissionFlags {
+message MsgUpdateCrosschainFlags {
string creator = 1;
bool isInboundEnabled = 3;
bool isOutboundEnabled = 4;
+ GasPriceIncreaseFlags gasPriceIncreaseFlags = 5;
}
```
## MsgUpdateKeygen
-Updates the block height of the keygen and sets the status to "pending
-keygen".
+UpdateKeygen updates the block height of the keygen and sets the status to "pending keygen".
Only the admin policy account is authorized to broadcast this message.
@@ -70,3 +68,17 @@ message MsgUpdateKeygen {
}
```
+## MsgAddBlockHeader
+
+AddBlockHeader handles adding a block header to the store, through majority voting of observers
+
+```proto
+message MsgAddBlockHeader {
+ string creator = 1;
+ int64 chain_id = 2;
+ bytes block_hash = 3;
+ int64 height = 4;
+ common.HeaderData header = 5;
+}
+```
+
diff --git a/go.mod b/go.mod
index fb5687672f..037cb886c0 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
@@ -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
@@ -170,91 +187,78 @@ require (
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
- github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
+ github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d
github.com/hashicorp/hcl v1.0.0 // indirect
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-ipfs-util v0.0.2 // indirect
- github.com/ipfs/go-ipns v0.2.0 // indirect
+ github.com/ipfs/go-cid v0.4.1 // indirect
+ github.com/ipfs/go-datastore v0.6.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-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 v0.27.8
+ github.com/libp2p/go-libp2p-asn-util v0.3.0 // 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 +268,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 +287,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
+ google.golang.org/protobuf v1.30.0
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
)
@@ -315,7 +317,6 @@ replace (
github.com/btcsuite/btcd => github.com/btcsuite/btcd v0.22.3
github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0
- github.com/cosmos/cosmos-sdk => github.com/brewmaster012/cosmos-sdk v0.46.14-0.20230818184835-7b40e2ee9f2f
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
// replace broken goleveldb
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
diff --git a/go.sum b/go.sum
index 9f3c1d5295..3ccf99bb4d 100644
--- a/go.sum
+++ b/go.sum
@@ -690,8 +690,9 @@ github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=
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=
@@ -724,8 +725,6 @@ github.com/bombsimon/wsl/v3 v3.3.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
github.com/breml/bidichk v0.2.3/go.mod h1:8u2C6DnAy0g2cEq+k/A2+tr9O1s+vHGxWn0LTc70T2A=
github.com/breml/errchkjson v0.3.0/go.mod h1:9Cogkyv9gcT8HREpzi3TiqBxCqDzo8awa92zSDFcofU=
-github.com/brewmaster012/cosmos-sdk v0.46.14-0.20230818184835-7b40e2ee9f2f h1:iFcUpBqZvMf/7VMi1yOsFV1UdAn8aOhLZvLkfRlJWQk=
-github.com/brewmaster012/cosmos-sdk v0.46.14-0.20230818184835-7b40e2ee9f2f/go.mod h1:EfY521ATNEla8eJ6oJuZBdgP5+p360s7InnRqX+TWdM=
github.com/brewmaster012/go-tss v0.0.0-20230724230849-ce080275bbad h1:/Jqi03d/vQ9SXDjubEKYGpv2usH5Ejjrmrdv405UFNo=
github.com/brewmaster012/go-tss v0.0.0-20230724230849-ce080275bbad/go.mod h1:RYOe4ihG8KkoQQhW6ljiyxyW6F3CoZA3ozyyEb5HVmI=
github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk=
@@ -778,8 +777,9 @@ github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEe
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
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 +799,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 +887,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=
@@ -1015,6 +1016,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk=
github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis=
github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o=
github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I=
+github.com/cosmos/cosmos-sdk v0.46.13 h1:LhL6WDBadczqBuCW0t5BHUzGQR3vbujdOYOfU0ORt+o=
+github.com/cosmos/cosmos-sdk v0.46.13/go.mod h1:EfY521ATNEla8eJ6oJuZBdgP5+p360s7InnRqX+TWdM=
github.com/cosmos/cosmos-sdk/ics23/go v0.8.0 h1:iKclrn3YEOwk4jQHT2ulgzuXyxmzmPczUalMwW4XH9k=
github.com/cosmos/cosmos-sdk/ics23/go v0.8.0/go.mod h1:2a4dBq88TUoqoWAU5eu0lGvpFP3wWDPgdHPargtyw30=
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
@@ -1064,12 +1067,12 @@ github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U=
github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4=
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=
@@ -1080,10 +1083,8 @@ github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE=
github.com/devigned/tab v0.1.1/go.mod h1:XG9mPq0dFghrYvoBF3xdRrJzSTX1b7IQrvaL9mzjeJY=
github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=
-github.com/dgraph-io/badger v1.6.1/go.mod h1:FRmFw3uxvcpa8zG3Rxs0th+hCLIuaQg8HlNV5bjgnuU=
github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o=
github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk=
-github.com/dgraph-io/ristretto v0.0.2/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E=
github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E=
github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E=
github.com/dgraph-io/ristretto v0.1.0 h1:Jv3CGQHp9OjuMBSne1485aDpUkTKEcUqF+jm/LuerPI=
@@ -1235,8 +1236,8 @@ github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVB
github.com/franela/goblin v0.0.0-20210519012713-85d372ac71e2/go.mod h1:VzmDKDJVZI3aJmnRI9VjAn9nJ8qPPsN1fqzr9dqInIo=
github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20=
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=
@@ -1307,9 +1308,11 @@ github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTg
github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
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 +1372,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 +1558,9 @@ 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-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=
@@ -1600,8 +1605,8 @@ github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8
github.com/gookit/color v1.2.4/go.mod h1:AhIE+pS6D4Ql0SQWbBeXPHw7gY0/sjHoA4s/n1KB7xg=
github.com/gookit/color v1.5.1/go.mod h1:wZFzea4X8qN6vHOSP2apMb4/+w/orMznEzYsIHPaqKM=
github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8=
-github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
+github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c h1:7lF+Vz0LqiRidnzC1Oq86fpX1q/iEv2KJdrCtttYjT4=
github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU=
github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0=
github.com/goreleaser/goreleaser v0.136.0/go.mod h1:wiKrPUeSNh6Wu8nUHxZydSOVQ/OZvOaO7DTtFqie904=
@@ -1758,8 +1763,8 @@ 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.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,36 +1801,25 @@ 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/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-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/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.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.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=
-github.com/ipfs/go-ds-leveldb v0.4.2/go.mod h1:jpbku/YqBSsBc1qgME8BkWS4AxzF2cEu1Ii2r79Hh9s=
-github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw=
github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2POp8=
-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-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=
github.com/ipfs/go-log v1.0.5 h1:2dOuUCB1Z7uoczMWgAyDck5JLb72zHzrMnGnCNNbvY8=
github.com/ipfs/go-log v1.0.5/go.mod h1:j0b8ZoR+7+R99LD9jZ6+AJsrzkPbSXbZfGakb5JPtIo=
-github.com/ipfs/go-log/v2 v2.0.3/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBWFaa9+0=
github.com/ipfs/go-log/v2 v2.0.5/go.mod h1:eZs4Xt4ZUJQFM3DlanGhy7TkwwawCZcSByscwkWG+dw=
github.com/ipfs/go-log/v2 v2.1.1/go.mod h1:2v2nsGfZsvvAJz13SyFzf9ObaqwHiHxsPLEHntrv9KM=
github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Axpmri6g=
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=
@@ -1843,7 +1837,6 @@ github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5D
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jbenet/go-temp-err-catcher v0.1.0 h1:zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABoLk/+KKHggpk=
github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk=
-github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY=
github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o=
github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4=
github.com/jdxcode/netrc v0.0.0-20210204082910-926c7f70242a/go.mod h1:Zi/ZFkEqFHTm7qkjyNJjaWH4LQA9LQhGJyF0lTYGpxw=
@@ -1947,16 +1940,14 @@ 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.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.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 +1955,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=
@@ -2007,60 +1998,41 @@ github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw=
github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
-github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ=
-github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM=
github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8=
github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg=
github.com/libp2p/go-cidranger v1.1.0 h1:ewPN8EZ0dd1LSnrtuwd4709PXVcITVeuwbag38yPW7c=
github.com/libp2p/go-cidranger v1.1.0/go.mod h1:KWZTfSr+r9qEo9OkI9/SIEeAtw+NNoU0dXIXt15Okic=
-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-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-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-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-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 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.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-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.6.3 h1:p507271wWzpy2f1XxPzCQG9NiN6R6lHL9GiSErbQQo0=
+github.com/libp2p/go-libp2p-kbucket v0.6.3/go.mod h1:RCseT7AH6eJWxxk2ol03xtP9pEHetYSPXOaJnOiD8i0=
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-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-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
+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-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-netroute v0.2.1 h1:V8kVrpD8GK0Riv15/7VN6RbUQ3URNZVosw7H2v9tksU=
+github.com/libp2p/go-netroute v0.2.1/go.mod h1:hraioZr0fhBjG0ZRXJJ6Zj2IVEVNx6tDTFQfSmcq7mQ=
+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 +2060,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=
@@ -2131,10 +2093,8 @@ github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOA
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
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 +2133,8 @@ 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.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=
@@ -2192,9 +2152,8 @@ github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLT
github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g=
github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY=
github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM=
-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=
@@ -2263,9 +2222,7 @@ github.com/mozilla/scribe v0.0.0-20180711195314-fb71baf557c1/go.mod h1:FIczTrinK
github.com/mozilla/tls-observatory v0.0.0-20190404164649-a3c1b6cfecfd/go.mod h1:SrKMQvPiws7F7iqYp8/TX+IhxCYhzr6N/1yb8cwHsGk=
github.com/mozilla/tls-observatory v0.0.0-20200317151703-4fa42e1c2dee/go.mod h1:SrKMQvPiws7F7iqYp8/TX+IhxCYhzr6N/1yb8cwHsGk=
github.com/mozilla/tls-observatory v0.0.0-20210609171429-7bc42856d2e5/go.mod h1:FUqVoUPHSEdDR0MnFM3Dh8AU0pZHLXUD127SAJGER/s=
-github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8=
github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
-github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
github.com/mrunalp/fileutils v0.0.0-20200520151820-abd8a0e76976/go.mod h1:x8F1gnqOkIEiO4rqoeEEEqQbo7HjGMTvyoq3gej4iT0=
@@ -2273,43 +2230,30 @@ github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2
github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg=
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-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM=
+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.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=
github.com/multiformats/go-multiaddr-fmt v0.1.0/go.mod h1:hGtDIW4PU4BqJ50gW2quDuPVjyWNZxToGUh/HwTZYJo=
-github.com/multiformats/go-multiaddr-net v0.1.4/go.mod h1:ilNnaM9HbmVFqsb/qcNysjCu4PVONlrBZpHIrw/qQuA=
-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.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 +2322,10 @@ 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.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=
@@ -2398,7 +2342,7 @@ github.com/onsi/gomega v1.15.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+t
github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
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=
@@ -2519,8 +2463,8 @@ github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUI
github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
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=
@@ -2548,8 +2492,9 @@ github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
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 +2545,16 @@ 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.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=
@@ -2724,12 +2679,14 @@ github.com/sivchari/nosnakecase v1.7.0/go.mod h1:CwDzrzPea40/GB6uynrNLiorAlgFRvR
github.com/sivchari/tenv v1.7.0/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg=
github.com/skeema/knownhosts v1.1.0/go.mod h1:sKFq3RD6/TKZkSWn8boUbDC7Qkgcv+8XXijpFO6roag=
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,8 +2698,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=
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
@@ -2823,8 +2778,9 @@ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1F
github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
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=
@@ -2928,8 +2884,9 @@ github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
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=
@@ -2962,10 +2919,10 @@ github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f/go.mod h1:DD4vA1
github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc=
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=
github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI=
@@ -3070,6 +3027,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 +3043,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 +3056,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=
@@ -3105,9 +3068,13 @@ go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
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/goleak v1.0.0/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
+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.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.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
@@ -3119,8 +3086,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 +3098,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 +3129,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=
@@ -3191,8 +3159,8 @@ golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
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 +3178,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 +3218,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=
@@ -3269,7 +3237,6 @@ golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73r
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190313220215-9f648a60d977/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
@@ -3320,7 +3287,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 +3294,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=
@@ -3414,8 +3379,9 @@ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
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 +3499,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 +3533,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=
@@ -3582,7 +3548,6 @@ golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -3599,8 +3564,8 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
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=
@@ -3614,8 +3579,8 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA=
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=
@@ -3631,8 +3596,8 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
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 +3733,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=
@@ -3781,8 +3745,8 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc
golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA=
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 +3761,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=
@@ -4266,8 +4232,8 @@ k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/
k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
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 +4245,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/common/common.proto b/proto/common/common.proto
index a98fe621db..161f533034 100644
--- a/proto/common/common.proto
+++ b/proto/common/common.proto
@@ -1,10 +1,10 @@
syntax = "proto3";
package common;
+import "common/ethereum/ethereum.proto";
//option (gogoproto.goproto_stringer_all) = false;
//option (gogoproto.stringer_all) = false;
//option (gogoproto.goproto_getters_all) = false;
-
import "gogoproto/gogo.proto";
option go_package = "github.com/zeta-chain/zetacore/common";
@@ -32,7 +32,7 @@ enum CoinType {
ERC20 = 2; // ERC20 token
Cmd = 3; // not a real coin, rather a command
}
- R
+
enum ChainName {
option (gogoproto.goproto_enum_stringer) = true;
empty = 0;
@@ -62,3 +62,24 @@ message Chain {
ChainName chain_name = 1;
int64 chain_id = 2;
}
+
+message BlockHeader {
+ int64 height = 1;
+ bytes hash = 2;
+ bytes parent_hash = 3;
+ int64 chain_id = 4;
+ // chain specific header
+ HeaderData header = 5 [(gogoproto.nullable) = false];
+}
+
+message HeaderData {
+ oneof data {
+ bytes ethereum_header = 1; // binary encoded headers; RLP for ethereum
+ }
+}
+
+message Proof {
+ oneof proof {
+ ethereum.Proof ethereum_proof = 1;
+ }
+}
diff --git a/proto/common/ethereum/ethereum.proto b/proto/common/ethereum/ethereum.proto
new file mode 100644
index 0000000000..92d3813035
--- /dev/null
+++ b/proto/common/ethereum/ethereum.proto
@@ -0,0 +1,9 @@
+syntax = "proto3";
+package ethereum;
+
+option go_package = "github.com/zeta-chain/zetacore/common/ethereum";
+
+message Proof {
+ repeated bytes keys = 1;
+ repeated bytes values = 2;
+}
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/events.proto b/proto/crosschain/events.proto
index cc022fb368..90fff428fb 100644
--- a/proto/crosschain/events.proto
+++ b/proto/crosschain/events.proto
@@ -48,7 +48,7 @@ message EventOutboundFailure {
string cctx_index = 2;
string old_status = 3;
string new_status = 4;
- string zeta_minted = 5;
+ string value_received = 5;
}
message EventOutboundSuccess {
@@ -56,5 +56,5 @@ message EventOutboundSuccess {
string cctx_index = 2;
string old_status = 3;
string new_status = 4;
- string zeta_minted = 5;
+ string value_received = 5;
}
diff --git a/proto/crosschain/out_tx_tracker.proto b/proto/crosschain/out_tx_tracker.proto
index 16fa43d6d3..43d2a05f2c 100644
--- a/proto/crosschain/out_tx_tracker.proto
+++ b/proto/crosschain/out_tx_tracker.proto
@@ -6,6 +6,7 @@ option go_package = "github.com/zeta-chain/zetacore/x/crosschain/types";
message TxHashList {
string tx_hash = 1;
string tx_signer = 2;
+ bool proved = 3;
}
message OutTxTracker {
string index = 1; // format: "chain-nonce"
diff --git a/proto/crosschain/query.proto b/proto/crosschain/query.proto
index 59edc0fb7e..64f18e8152 100644
--- a/proto/crosschain/query.proto
+++ b/proto/crosschain/query.proto
@@ -102,6 +102,10 @@ service Query {
option (google.api.http).get = "/zeta-chain/crosschain/pendingNonces";
}
+ rpc PendingNoncesByChain(QueryPendingNoncesByChainRequest) returns (QueryPendingNoncesByChainResponse) {
+ option (google.api.http).get = "/zeta-chain/crosschain/pendingNonces/{chain_id}";
+ }
+
// Queries a lastBlockHeight by index.
rpc LastBlockHeight(QueryGetLastBlockHeightRequest) returns (QueryGetLastBlockHeightResponse) {
option (google.api.http).get = "/zeta-chain/crosschain/lastBlockHeight/{index}";
@@ -277,6 +281,14 @@ message QueryAllPendingNoncesResponse {
repeated PendingNonces pending_nonces = 1;
}
+message QueryPendingNoncesByChainRequest {
+ int64 chain_id = 1;
+}
+
+message QueryPendingNoncesByChainResponse {
+ PendingNonces pending_nonces = 1 [(gogoproto.nullable) = false];
+}
+
message QueryGetLastBlockHeightRequest {
string index = 1;
}
@@ -317,7 +329,7 @@ message QueryAllCctxResponse {
}
message QueryAllCctxPendingRequest {
- uint64 chainId = 1;
+ int64 chain_id = 1;
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
diff --git a/proto/crosschain/tx.proto b/proto/crosschain/tx.proto
index 92d667c7a8..785b4dae06 100644
--- a/proto/crosschain/tx.proto
+++ b/proto/crosschain/tx.proto
@@ -18,6 +18,7 @@ service Msg {
rpc VoteOnObservedInboundTx(MsgVoteOnObservedInboundTx) returns (MsgVoteOnObservedInboundTxResponse);
rpc WhitelistERC20(MsgWhitelistERC20) returns (MsgWhitelistERC20Response);
rpc UpdateTssAddress(MsgUpdateTssAddress) returns (MsgUpdateTssAddressResponse);
+ // rpc ProveOutboundTx(MsgProveOutboundTx) returns (MsgProveOutboundTxResponse);
}
message MsgAddToInTxTracker {
@@ -34,6 +35,7 @@ message MsgUpdateTssAddress {
}
message MsgUpdateTssAddressResponse {}
+
message MsgWhitelistERC20 {
string creator = 1;
string erc20_address = 2;
@@ -51,6 +53,9 @@ message MsgAddToOutTxTracker {
int64 chain_id = 2;
uint64 nonce = 3;
string tx_hash = 4;
+ common.Proof proof = 5;
+ string block_hash = 6;
+ int64 tx_index = 7;
}
message MsgAddToOutTxTrackerResponse {}
@@ -100,10 +105,11 @@ message MsgVoteOnObservedOutboundTx {
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
- string zeta_minted = 5 [
+ uint64 observed_outTx_effective_gas_limit = 12;
+ string value_received = 5 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false,
- (gogoproto.moretags) = "yaml:\"zeta_minted\""
+ (gogoproto.moretags) = "yaml:\"value_received\""
];
common.ReceiveStatus status = 6;
int64 outTx_chain = 7;
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..bd7a67794a 100644
--- a/proto/fungible/tx.proto
+++ b/proto/fungible/tx.proto
@@ -12,6 +12,8 @@ service Msg {
rpc RemoveForeignCoin(MsgRemoveForeignCoin) returns (MsgRemoveForeignCoinResponse);
rpc UpdateSystemContract(MsgUpdateSystemContract) returns (MsgUpdateSystemContractResponse);
rpc UpdateZRC20WithdrawFee(MsgUpdateZRC20WithdrawFee) returns (MsgUpdateZRC20WithdrawFeeResponse);
+ rpc UpdateContractBytecode(MsgUpdateContractBytecode) returns (MsgUpdateContractBytecodeResponse);
+ rpc UpdateZRC20PausedStatus(MsgUpdateZRC20PausedStatus) returns (MsgUpdateZRC20PausedStatusResponse);
}
message MsgUpdateZRC20WithdrawFee {
@@ -43,7 +45,9 @@ message MsgDeployFungibleCoinZRC20 {
int64 gas_limit = 8;
}
-message MsgDeployFungibleCoinZRC20Response {}
+message MsgDeployFungibleCoinZRC20Response {
+ string address = 1;
+}
message MsgRemoveForeignCoin {
string creator = 1;
@@ -51,3 +55,26 @@ message MsgRemoveForeignCoin {
}
message MsgRemoveForeignCoinResponse {}
+
+message MsgUpdateContractBytecode {
+ string creator = 1;
+ string contract_address = 2;
+ string new_bytecode_address = 3;
+}
+
+message MsgUpdateContractBytecodeResponse {
+ bytes new_bytecode_hash = 1;
+}
+
+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/crosschain_flags.proto b/proto/observer/crosschain_flags.proto
new file mode 100644
index 0000000000..af52a75f46
--- /dev/null
+++ b/proto/observer/crosschain_flags.proto
@@ -0,0 +1,22 @@
+syntax = "proto3";
+package zetachain.zetacore.observer;
+
+import "gogoproto/gogo.proto";
+import "google/protobuf/duration.proto";
+
+option go_package = "github.com/zeta-chain/zetacore/x/observer/types";
+
+message GasPriceIncreaseFlags {
+ int64 epochLength = 1;
+ google.protobuf.Duration retryInterval = 2 [
+ (gogoproto.nullable) = false,
+ (gogoproto.stdduration) = true
+ ];
+ uint32 gasPriceIncreasePercent = 3;
+}
+
+message CrosschainFlags {
+ bool isInboundEnabled = 1;
+ bool isOutboundEnabled = 2;
+ GasPriceIncreaseFlags gasPriceIncreaseFlags = 3;
+}
diff --git a/proto/observer/events.proto b/proto/observer/events.proto
index a5e726b5c4..66fff998f4 100644
--- a/proto/observer/events.proto
+++ b/proto/observer/events.proto
@@ -2,6 +2,7 @@ syntax = "proto3";
package zetachain.zetacore.observer;
import "gogoproto/gogo.proto";
+import "observer/crosschain_flags.proto";
import "observer/observer.proto";
option go_package = "github.com/zeta-chain/zetacore/x/observer/types";
@@ -27,3 +28,11 @@ message EventNewObserverAdded {
string zetaclient_grantee_pubkey = 4;
uint64 observer_last_block_count = 5;
}
+
+message EventCrosschainFlagsUpdated {
+ string msg_type_url = 1;
+ bool isInboundEnabled = 2;
+ bool isOutboundEnabled = 3;
+ GasPriceIncreaseFlags gasPriceIncreaseFlags = 4;
+ string signer = 5;
+}
diff --git a/proto/observer/genesis.proto b/proto/observer/genesis.proto
index 7bec282a84..4c3b03a4fb 100644
--- a/proto/observer/genesis.proto
+++ b/proto/observer/genesis.proto
@@ -3,11 +3,11 @@ package zetachain.zetacore.observer;
import "gogoproto/gogo.proto";
import "observer/ballot.proto";
+import "observer/crosschain_flags.proto";
import "observer/keygen.proto";
import "observer/node_account.proto";
import "observer/observer.proto";
import "observer/params.proto";
-import "observer/permission_flags.proto";
option go_package = "github.com/zeta-chain/zetacore/x/observer/types";
@@ -15,8 +15,9 @@ message GenesisState {
repeated Ballot ballots = 1;
repeated ObserverMapper observers = 2;
repeated NodeAccount nodeAccountList = 3;
- PermissionFlags permission_flags = 4;
+ CrosschainFlags crosschain_flags = 4;
Params params = 5;
Keygen keygen = 6;
LastObserverCount last_observer_count = 7;
+ CoreParamsList core_params_list = 8 [(gogoproto.nullable) = false];
}
diff --git a/proto/observer/keygen.proto b/proto/observer/keygen.proto
index 127cb78a43..9368f221fc 100644
--- a/proto/observer/keygen.proto
+++ b/proto/observer/keygen.proto
@@ -11,6 +11,7 @@ enum KeygenStatus {
KeyGenSuccess = 1;
KeyGenFailed = 3;
}
+
message Keygen {
KeygenStatus status = 2; // 0--to generate key; 1--generated; 2--error
repeated string granteePubkeys = 3;
diff --git a/proto/observer/params.proto b/proto/observer/params.proto
index e1f9f42b65..4d403b99d0 100644
--- a/proto/observer/params.proto
+++ b/proto/observer/params.proto
@@ -39,12 +39,8 @@ message ObserverParams {
enum Policy_Type {
option (gogoproto.goproto_enum_stringer) = true;
- stop_inbound_cctx = 0; // some observer sees inbound tx
- deploy_fungible_coin = 1;
- update_client_params = 2;
- update_keygen_block = 3;
- out_tx_tracker = 4;
- add_observer = 5;
+ group1 = 0;
+ group2 = 1;
}
message Admin_Policy {
diff --git a/proto/observer/permission_flags.proto b/proto/observer/permission_flags.proto
deleted file mode 100644
index ca3a267b2a..0000000000
--- a/proto/observer/permission_flags.proto
+++ /dev/null
@@ -1,9 +0,0 @@
-syntax = "proto3";
-package zetachain.zetacore.observer;
-
-option go_package = "github.com/zeta-chain/zetacore/x/observer/types";
-
-message PermissionFlags {
- bool isInboundEnabled = 1;
- bool isOutboundEnabled = 2;
-}
diff --git a/proto/observer/query.proto b/proto/observer/query.proto
index b5de301651..fdd0733f04 100644
--- a/proto/observer/query.proto
+++ b/proto/observer/query.proto
@@ -7,11 +7,11 @@ import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "observer/ballot.proto";
import "observer/blame.proto";
+import "observer/crosschain_flags.proto";
import "observer/keygen.proto";
import "observer/node_account.proto";
import "observer/observer.proto";
import "observer/params.proto";
-import "observer/permission_flags.proto";
option go_package = "github.com/zeta-chain/zetacore/x/observer/types";
@@ -57,8 +57,8 @@ service Query {
rpc NodeAccountAll(QueryAllNodeAccountRequest) returns (QueryAllNodeAccountResponse) {
option (google.api.http).get = "/zeta-chain/observer/nodeAccount";
}
- rpc PermissionFlags(QueryGetPermissionFlagsRequest) returns (QueryGetPermissionFlagsResponse) {
- option (google.api.http).get = "/zeta-chain/observer/permission_flags";
+ rpc CrosschainFlags(QueryGetCrosschainFlagsRequest) returns (QueryGetCrosschainFlagsResponse) {
+ option (google.api.http).get = "/zeta-chain/observer/crosschain_flags";
}
// Queries a keygen by index.
rpc Keygen(QueryGetKeygenRequest) returns (QueryGetKeygenResponse) {
@@ -79,6 +79,31 @@ service Query {
rpc GetAllBlameRecords(QueryAllBlameRecordsRequest) returns (QueryAllBlameRecordsResponse) {
option (google.api.http).get = "/zeta-chain/observer/get_all_blame_records";
}
+
+ rpc GetAllBlockHeaders(QueryAllBlockHeaderRequest) returns (QueryAllBlockHeaderResponse) {
+ option (google.api.http).get = "/zeta-chain/observer/get_all_block_headers";
+ }
+
+ rpc GetBlockHeaderByHash(QueryGetBlockHeaderByHashRequest) returns (QueryGetBlockHeaderByHashResponse) {
+ option (google.api.http).get = "/zeta-chain/observer/get_block_header_by_hash/{block_hash}";
+ }
+
+ // merkle proof verification
+ rpc Prove(QueryProveRequest) returns (QueryProveResponse) {
+ option (google.api.http).get = "/zeta-chain/observer/prove";
+ }
+}
+
+message QueryProveRequest {
+ uint64 chain_id = 1;
+ string tx_hash = 2;
+ common.Proof proof = 3;
+ string block_hash = 4;
+ int64 tx_index = 5;
+}
+
+message QueryProveResponse {
+ bool valid = 1;
}
message QueryParamsRequest {}
@@ -154,10 +179,10 @@ message QueryAllNodeAccountResponse {
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
-message QueryGetPermissionFlagsRequest {}
+message QueryGetCrosschainFlagsRequest {}
-message QueryGetPermissionFlagsResponse {
- PermissionFlags permission_flags = 1 [(gogoproto.nullable) = false];
+message QueryGetCrosschainFlagsResponse {
+ CrosschainFlags crosschain_flags = 1 [(gogoproto.nullable) = false];
}
message QueryGetKeygenRequest {}
@@ -185,3 +210,20 @@ message QueryAllBlameRecordsRequest {}
message QueryAllBlameRecordsResponse {
repeated Blame blame_info = 1;
}
+
+message QueryAllBlockHeaderRequest {
+ cosmos.base.query.v1beta1.PageRequest pagination = 1;
+}
+
+message QueryAllBlockHeaderResponse {
+ repeated common.BlockHeader block_headers = 1;
+ cosmos.base.query.v1beta1.PageResponse pagination = 2;
+}
+
+message QueryGetBlockHeaderByHashRequest {
+ bytes block_hash = 1;
+}
+
+message QueryGetBlockHeaderByHashResponse {
+ common.BlockHeader block_header = 1;
+}
diff --git a/proto/observer/tx.proto b/proto/observer/tx.proto
index 76a414cbae..441fa01b8b 100644
--- a/proto/observer/tx.proto
+++ b/proto/observer/tx.proto
@@ -4,6 +4,7 @@ package zetachain.zetacore.observer;
import "common/common.proto";
import "gogoproto/gogo.proto";
import "observer/blame.proto";
+import "observer/crosschain_flags.proto";
import "observer/observer.proto";
import "observer/params.proto";
@@ -14,10 +15,21 @@ service Msg {
rpc AddObserver(MsgAddObserver) returns (MsgAddObserverResponse);
rpc UpdateCoreParams(MsgUpdateCoreParams) returns (MsgUpdateCoreParamsResponse);
rpc AddBlameVote(MsgAddBlameVote) returns (MsgAddBlameVoteResponse);
- rpc UpdatePermissionFlags(MsgUpdatePermissionFlags) returns (MsgUpdatePermissionFlagsResponse);
+ rpc UpdateCrosschainFlags(MsgUpdateCrosschainFlags) returns (MsgUpdateCrosschainFlagsResponse);
rpc UpdateKeygen(MsgUpdateKeygen) returns (MsgUpdateKeygenResponse);
+ rpc AddBlockHeader(MsgAddBlockHeader) returns (MsgAddBlockHeaderResponse);
}
+message MsgAddBlockHeader {
+ string creator = 1;
+ int64 chain_id = 2;
+ bytes block_hash = 3;
+ int64 height = 4;
+ common.HeaderData header = 5 [(gogoproto.nullable) = false];
+}
+
+message MsgAddBlockHeaderResponse {}
+
message MsgUpdateCoreParams {
string creator = 1;
CoreParams coreParams = 2;
@@ -41,12 +53,14 @@ message MsgAddBlameVote {
}
message MsgAddBlameVoteResponse {}
-message MsgUpdatePermissionFlags {
+
+message MsgUpdateCrosschainFlags {
string creator = 1;
bool isInboundEnabled = 3;
bool isOutboundEnabled = 4;
+ GasPriceIncreaseFlags gasPriceIncreaseFlags = 5;
}
-message MsgUpdatePermissionFlagsResponse {}
+message MsgUpdateCrosschainFlagsResponse {}
message MsgUpdateKeygen {
string creator = 1;
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/apis.go b/rpc/apis.go
index 3256f42d77..da130ad0a1 100644
--- a/rpc/apis.go
+++ b/rpc/apis.go
@@ -20,21 +20,14 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/server"
-
"github.com/ethereum/go-ethereum/rpc"
-
ethermint "github.com/evmos/ethermint/types"
+ rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client"
"github.com/zeta-chain/zetacore/rpc/backend"
- "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/debug"
"github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/eth"
"github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/eth/filters"
- "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/miner"
"github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/net"
- "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/personal"
- "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/txpool"
"github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/web3"
-
- rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client"
)
// RPC namespaces and API version
@@ -47,8 +40,8 @@ const (
Web3Namespace = "web3"
EthNamespace = "eth"
- PersonalNamespace = "personal"
NetNamespace = "net"
+ PersonalNamespace = "personal"
TxPoolNamespace = "txpool"
DebugNamespace = "debug"
MinerNamespace = "miner"
@@ -112,64 +105,66 @@ func init() {
},
}
},
- PersonalNamespace: func(ctx *server.Context,
- clientCtx client.Context,
- _ *rpcclient.WSClient,
- allowUnprotectedTxs bool,
- indexer ethermint.EVMTxIndexer,
- ) []rpc.API {
- evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
- return []rpc.API{
- {
- Namespace: PersonalNamespace,
- Version: apiVersion,
- Service: personal.NewAPI(ctx.Logger, evmBackend),
- Public: false,
- },
- }
- },
- TxPoolNamespace: func(ctx *server.Context, _ client.Context, _ *rpcclient.WSClient, _ bool, _ ethermint.EVMTxIndexer) []rpc.API {
- return []rpc.API{
- {
- Namespace: TxPoolNamespace,
- Version: apiVersion,
- Service: txpool.NewPublicAPI(ctx.Logger),
- Public: true,
- },
- }
- },
- DebugNamespace: func(ctx *server.Context,
- clientCtx client.Context,
- _ *rpcclient.WSClient,
- allowUnprotectedTxs bool,
- indexer ethermint.EVMTxIndexer,
- ) []rpc.API {
- evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
- return []rpc.API{
- {
- Namespace: DebugNamespace,
- Version: apiVersion,
- Service: debug.NewAPI(ctx, evmBackend),
- Public: true,
- },
- }
- },
- MinerNamespace: func(ctx *server.Context,
- clientCtx client.Context,
- _ *rpcclient.WSClient,
- allowUnprotectedTxs bool,
- indexer ethermint.EVMTxIndexer,
- ) []rpc.API {
- evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
- return []rpc.API{
- {
- Namespace: MinerNamespace,
- Version: apiVersion,
- Service: miner.NewPrivateAPI(ctx, evmBackend),
- Public: false,
- },
- }
- },
+ // Disabled
+ // NOTE: Public field of API is deprecated and defined only for compatibility.
+ //PersonalNamespace: func(ctx *server.Context,
+ // clientCtx client.Context,
+ // _ *rpcclient.WSClient,
+ // allowUnprotectedTxs bool,
+ // indexer ethermint.EVMTxIndexer,
+ //) []rpc.API {
+ // evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
+ // return []rpc.API{
+ // {
+ // Namespace: PersonalNamespace,
+ // Version: apiVersion,
+ // Service: personal.NewAPI(ctx.Logger, evmBackend),
+ // Public: false,
+ // },
+ // }
+ //},
+ //TxPoolNamespace: func(ctx *server.Context, _ client.Context, _ *rpcclient.WSClient, _ bool, _ ethermint.EVMTxIndexer) []rpc.API {
+ // return []rpc.API{
+ // {
+ // Namespace: TxPoolNamespace,
+ // Version: apiVersion,
+ // Service: txpool.NewPublicAPI(ctx.Logger),
+ // Public: true,
+ // },
+ // }
+ //},
+ //DebugNamespace: func(ctx *server.Context,
+ // clientCtx client.Context,
+ // _ *rpcclient.WSClient,
+ // allowUnprotectedTxs bool,
+ // indexer ethermint.EVMTxIndexer,
+ //) []rpc.API {
+ // evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
+ // return []rpc.API{
+ // {
+ // Namespace: DebugNamespace,
+ // Version: apiVersion,
+ // Service: debug.NewAPI(ctx, evmBackend),
+ // Public: true,
+ // },
+ // }
+ //},
+ //MinerNamespace: func(ctx *server.Context,
+ // clientCtx client.Context,
+ // _ *rpcclient.WSClient,
+ // allowUnprotectedTxs bool,
+ // indexer ethermint.EVMTxIndexer,
+ //) []rpc.API {
+ // evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
+ // return []rpc.API{
+ // {
+ // Namespace: MinerNamespace,
+ // Version: apiVersion,
+ // Service: miner.NewPrivateAPI(ctx, evmBackend),
+ // Public: false,
+ // },
+ // }
+ //},
}
}
diff --git a/rpc/backend/account_info.go b/rpc/backend/account_info.go
index c7335e11b7..b6175b5cd1 100644
--- a/rpc/backend/account_info.go
+++ b/rpc/backend/account_info.go
@@ -77,6 +77,7 @@ func (b *Backend) GetProof(address common.Address, storageKeys []string, blockNr
return nil, fmt.Errorf("not able to query block number greater than MaxInt64")
}
+ // #nosec G701 range checked
height = int64(bn)
}
@@ -194,8 +195,13 @@ func (b *Backend) GetTransactionCount(address common.Address, blockNum rpctypes.
if err != nil {
return &n, err
}
+ if bn > math.MaxInt64 {
+ return nil, fmt.Errorf("not able to query block number greater than MaxInt64")
+ }
height := blockNum.Int64()
+ // #nosec G701 range checked
currentHeight := int64(bn)
+
if height > currentHeight {
return &n, errorsmod.Wrapf(
sdkerrors.ErrInvalidHeight,
diff --git a/rpc/backend/blocks.go b/rpc/backend/blocks.go
index f659085d51..8fa721ccf0 100644
--- a/rpc/backend/blocks.go
+++ b/rpc/backend/blocks.go
@@ -18,6 +18,7 @@ package backend
import (
"bytes"
"fmt"
+ "math"
"math/big"
"strconv"
@@ -174,6 +175,10 @@ func (b *Backend) TendermintBlockByNumber(blockNum rpctypes.BlockNumber) (*tmrpc
if err != nil {
return nil, err
}
+ if n > math.MaxInt64 {
+ return nil, fmt.Errorf("block number %d is greater than max int64", n)
+ }
+ // #nosec G701 range checked
height = int64(n)
}
resBlock, err := b.clientCtx.Client.Block(b.ctx, &height)
@@ -396,12 +401,15 @@ func (b *Backend) RPCBlockFromTendermintBlock(
rpcTx, err = rpctypes.NewRPCTransaction(
tx,
common.BytesToHash(block.Hash()),
+ // #nosec G701 non negative value
uint64(block.Height),
+ // #nosec G701 non negative value
uint64(txIndex),
baseFee,
b.chainID,
)
} else {
+ // #nosec G701 non negative value
rpcTx, err = rpctypes.NewRPCTransactionFromIncompleteMsg(ethMsg, common.BytesToHash(block.Hash()), uint64(block.Height), uint64(txIndex), baseFee, b.chainID, txsAdditional[txIndex])
}
if err != nil {
@@ -455,6 +463,7 @@ func (b *Backend) RPCBlockFromTendermintBlock(
// block gas limit has exceeded, other txs must have failed with same reason.
break
}
+ // #nosec G701 non negative value
gasUsed += uint64(txsResult.GetGasUsed())
}
diff --git a/rpc/backend/call_tx.go b/rpc/backend/call_tx.go
index 0eb9ade41e..fd757d2f04 100644
--- a/rpc/backend/call_tx.go
+++ b/rpc/backend/call_tx.go
@@ -244,7 +244,10 @@ func (b *Backend) SetTxDefaults(args evmtypes.TransactionArgs) (evmtypes.Transac
if args.Nonce == nil {
// get the nonce from the account retriever
// ignore error in case tge account doesn't exist yet
- nonce, _ := b.getAccountNonce(*args.From, true, 0, b.logger)
+ nonce, err := b.getAccountNonce(*args.From, true, 0, b.logger)
+ if err != nil {
+ nonce = 0
+ }
args.Nonce = (*hexutil.Uint64)(&nonce)
}
diff --git a/rpc/backend/chain_info.go b/rpc/backend/chain_info.go
index 2f12631460..2cc0b1d465 100644
--- a/rpc/backend/chain_info.go
+++ b/rpc/backend/chain_info.go
@@ -17,6 +17,7 @@ package backend
import (
"fmt"
+ "math"
"math/big"
"strconv"
@@ -104,7 +105,11 @@ func (b *Backend) BaseFee(blockRes *tmrpctypes.ResultBlockResults) (*big.Int, er
// CurrentHeader returns the latest block header
func (b *Backend) CurrentHeader() *ethtypes.Header {
- header, _ := b.HeaderByNumber(rpctypes.EthLatestBlockNumber)
+ header, err := b.HeaderByNumber(rpctypes.EthLatestBlockNumber)
+ if err != nil {
+ b.logger.Debug("failed to fetch latest header", "error", err.Error())
+ return nil
+ }
return header
}
@@ -149,7 +154,10 @@ func (b *Backend) GetCoinbase() (sdk.AccAddress, error) {
return nil, err
}
- address, _ := sdk.AccAddressFromBech32(res.AccountAddress)
+ address, err := sdk.AccAddressFromBech32(res.AccountAddress)
+ if err != nil {
+ return nil, err
+ }
return address, nil
}
@@ -166,9 +174,17 @@ func (b *Backend) FeeHistory(
if err != nil {
return nil, err
}
+ if blockNumber > math.MaxInt64 {
+ return nil, fmt.Errorf("not able to query block number greater than MaxInt64")
+ }
+ // #nosec G701 range checked
blockEnd = int64(blockNumber)
}
+ if userBlockCount > math.MaxInt64 {
+ return nil, fmt.Errorf("not able to query block count greater than MaxInt64")
+ }
+ // #nosec G701 range checked
blocks := int64(userBlockCount)
maxBlockCount := int64(b.cfg.JSONRPC.FeeHistoryCap)
if blocks > maxBlockCount {
@@ -197,6 +213,7 @@ func (b *Backend) FeeHistory(
// fetch block
for blockID := blockStart; blockID <= blockEnd; blockID++ {
+ // #nosec G701 range checked
index := int32(blockID - blockStart)
// tendermint block
tendermintblock, err := b.TendermintBlockByNumber(rpctypes.BlockNumber(blockID))
@@ -273,6 +290,7 @@ func (b *Backend) SuggestGasTipCap(baseFee *big.Int) (*big.Int, error) {
// MaxDelta = BaseFee * (GasLimit - GasLimit / ElasticityMultiplier) / (GasLimit / ElasticityMultiplier) / Denominator
// = BaseFee * (ElasticityMultiplier - 1) / Denominator
// ```
+ // #nosec G701 range checked
maxDelta := baseFee.Int64() * (int64(params.Params.ElasticityMultiplier) - 1) / int64(params.Params.BaseFeeChangeDenominator)
if maxDelta < 0 {
// impossible if the parameter validation passed.
diff --git a/rpc/backend/node_info.go b/rpc/backend/node_info.go
index 87be24f1d7..52826bbc60 100644
--- a/rpc/backend/node_info.go
+++ b/rpc/backend/node_info.go
@@ -213,7 +213,10 @@ func (b *Backend) ImportRawKey(privkey, password string) (common.Address, error)
}
// ignore error as we only care about the length of the list
- list, _ := b.clientCtx.Keyring.List()
+ list, err := b.clientCtx.Keyring.List()
+ if err != nil {
+ list = []*keyring.Record{}
+ }
privKeyName := fmt.Sprintf("personal_%d", len(list))
armor := sdkcrypto.EncryptArmorPrivKey(privKey, password, ethsecp256k1.KeyType)
@@ -247,9 +250,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/backend/tracing.go b/rpc/backend/tracing.go
index fb961d2c28..145b45ec5e 100644
--- a/rpc/backend/tracing.go
+++ b/rpc/backend/tracing.go
@@ -50,6 +50,7 @@ func (b *Backend) TraceTransaction(hash common.Hash, config *evmtypes.TraceConfi
}
// check tx index is not out of bound
+ // #nosec G701 txs number in block is always less than MaxUint32
if uint32(len(blk.Block.Txs)) < transaction.TxIndex {
b.logger.Debug("tx index out of bounds", "index", transaction.TxIndex, "hash", hash.String(), "height", blk.Block.Height)
return nil, fmt.Errorf("transaction not included in block %v", blk.Block.Height)
@@ -79,6 +80,7 @@ func (b *Backend) TraceTransaction(hash common.Hash, config *evmtypes.TraceConfi
}
// add predecessor messages in current cosmos tx
+ // #nosec G701 always in range
for i := 0; i < int(transaction.MsgIndex); i++ {
ethMsg, ok := tx.GetMsgs()[i].(*evmtypes.MsgEthereumTx)
if !ok {
diff --git a/rpc/backend/tx_info.go b/rpc/backend/tx_info.go
index a53863df2d..c81f289d9e 100644
--- a/rpc/backend/tx_info.go
+++ b/rpc/backend/tx_info.go
@@ -74,6 +74,7 @@ func (b *Backend) GetTransactionByHash(txHash common.Hash) (*rpctypes.RPCTransac
msgs, _ := b.EthMsgsFromTendermintBlock(block, blockRes)
for i := range msgs {
if msgs[i].Hash == hexTx {
+ // #nosec G701 always in range
res.EthTxIndex = int32(i)
break
}
@@ -96,7 +97,9 @@ func (b *Backend) GetTransactionByHash(txHash common.Hash) (*rpctypes.RPCTransac
return rpctypes.NewTransactionFromMsg(
msg,
common.BytesToHash(block.BlockID.Hash.Bytes()),
+ // #nosec G701 always positive
uint64(res.Height),
+ // #nosec G701 always positive
uint64(res.EthTxIndex),
baseFee,
b.chainID,
@@ -189,6 +192,7 @@ func (b *Backend) GetTransactionReceipt(hash common.Hash) (map[string]interface{
return nil, nil
}
for _, txResult := range blockRes.TxsResults[0:res.TxIndex] {
+ // #nosec G701 always positive
cumulativeGasUsed += uint64(txResult.GasUsed)
}
cumulativeGasUsed += res.CumulativeGasUsed
@@ -218,6 +222,7 @@ func (b *Backend) GetTransactionReceipt(hash common.Hash) (map[string]interface{
}
// parse tx logs from events
+ // #nosec G701 always in range
logs, err := TxLogsFromEvents(blockRes.TxsResults[res.TxIndex].Events, int(res.MsgIndex))
if err != nil {
b.logger.Debug("failed to parse logs", "hash", hexTx, "error", err.Error())
@@ -228,6 +233,7 @@ func (b *Backend) GetTransactionReceipt(hash common.Hash) (map[string]interface{
msgs, _ := b.EthMsgsFromTendermintBlock(resBlock, blockRes)
for i := range msgs {
if msgs[i].Hash == hexTx {
+ // #nosec G701 always in range
res.EthTxIndex = int32(i)
break
}
@@ -245,6 +251,7 @@ func (b *Backend) GetTransactionReceipt(hash common.Hash) (map[string]interface{
var txType uint8
if txData == nil {
+ // #nosec G701 always in range
txType = uint8(additional.Type)
*to = additional.Recipient
} else {
@@ -361,6 +368,7 @@ func (b *Backend) GetTxByEthHash(hash common.Hash) (*ethermint.TxResult, *rpctyp
// GetTxByTxIndex uses `/tx_query` to find transaction by tx index of valid ethereum txs
func (b *Backend) GetTxByTxIndex(height int64, index uint) (*ethermint.TxResult, *rpctypes.TxResultAdditionalFields, error) {
if b.indexer != nil {
+ // #nosec G701 always in range
txRes, err := b.indexer.GetByBlockAndIndex(height, int32(index))
if err == nil {
return txRes, nil, nil
@@ -373,6 +381,7 @@ func (b *Backend) GetTxByTxIndex(height int64, index uint) (*ethermint.TxResult,
evmtypes.AttributeKeyTxIndex, index,
)
txResult, txAdditional, err := b.queryTendermintTxIndexer(query, func(txs *rpctypes.ParsedTxs) *rpctypes.ParsedTx {
+ // #nosec G701 always in range
return txs.GetTxByTxIndex(int(index))
})
if err != nil {
@@ -416,6 +425,7 @@ func (b *Backend) GetTransactionByBlockAndIndex(block *tmrpctypes.ResultBlock, i
var msg *evmtypes.MsgEthereumTx
// find in tx indexer
+ // #nosec G701 always in range
res, additional, err := b.GetTxByTxIndex(block.Block.Height, uint(idx))
if err == nil {
tx, err := b.clientCtx.TxConfig.TxDecoder()(block.Block.Txs[res.TxIndex])
@@ -438,6 +448,7 @@ func (b *Backend) GetTransactionByBlockAndIndex(block *tmrpctypes.ResultBlock, i
}
}
} else {
+ // #nosec G701 always in range
i := int(idx)
ethMsgs, _ := b.EthMsgsFromTendermintBlock(block, blockRes)
if i >= len(ethMsgs) {
@@ -457,7 +468,9 @@ func (b *Backend) GetTransactionByBlockAndIndex(block *tmrpctypes.ResultBlock, i
return rpctypes.NewTransactionFromMsg(
msg,
common.BytesToHash(block.Block.Hash()),
+ // #nosec G701 always positive
uint64(block.Block.Height),
+ // #nosec G701 always positive
uint64(idx),
baseFee,
b.chainID,
diff --git a/rpc/backend/utils.go b/rpc/backend/utils.go
index 334ac408cc..b20d6e068e 100644
--- a/rpc/backend/utils.go
+++ b/rpc/backend/utils.go
@@ -182,6 +182,7 @@ func (b *Backend) processBlock(
b.logger.Debug("failed to decode transaction in block", "height", blockHeight, "error", err.Error())
continue
}
+ // #nosec G701 always positive
txGasUsed := uint64(eachTendermintTxResult.GasUsed)
for _, msg := range tx.GetMsgs() {
ethMsg, ok := msg.(*evmtypes.MsgEthereumTx)
@@ -209,6 +210,7 @@ func (b *Backend) processBlock(
sumGasUsed := sorter[0].gasUsed
for i, p := range rewardPercentiles {
+ // #nosec G701 always positive
thresholdGasUsed := uint64(blockGasUsed * p / 100)
for sumGasUsed < thresholdGasUsed && txIndex < ethTxCount-1 {
txIndex++
diff --git a/rpc/namespaces/ethereum/debug/api.go b/rpc/namespaces/ethereum/debug/api.go
index 0620b67be0..94f771ab39 100644
--- a/rpc/namespaces/ethereum/debug/api.go
+++ b/rpc/namespaces/ethereum/debug/api.go
@@ -27,18 +27,14 @@ import (
"sync"
"time"
- "github.com/davecgh/go-spew/spew"
-
- evmtypes "github.com/evmos/ethermint/x/evm/types"
-
- stderrors "github.com/pkg/errors"
-
"github.com/cosmos/cosmos-sdk/server"
-
+ "github.com/davecgh/go-spew/spew"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/rlp"
+ evmtypes "github.com/evmos/ethermint/x/evm/types"
+ stderrors "github.com/pkg/errors"
"github.com/tendermint/tendermint/libs/log"
"github.com/zeta-chain/zetacore/rpc/backend"
rpctypes "github.com/zeta-chain/zetacore/rpc/types"
diff --git a/rpc/namespaces/ethereum/eth/api.go b/rpc/namespaces/ethereum/eth/api.go
index f7270b12e6..5200e26495 100644
--- a/rpc/namespaces/ethereum/eth/api.go
+++ b/rpc/namespaces/ethereum/eth/api.go
@@ -18,20 +18,14 @@ package eth
import (
"context"
- "github.com/ethereum/go-ethereum/signer/core/apitypes"
-
- "github.com/ethereum/go-ethereum/rpc"
-
- "github.com/tendermint/tendermint/libs/log"
-
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
ethtypes "github.com/ethereum/go-ethereum/core/types"
-
- "github.com/zeta-chain/zetacore/rpc/backend"
-
+ "github.com/ethereum/go-ethereum/rpc"
ethermint "github.com/evmos/ethermint/types"
evmtypes "github.com/evmos/ethermint/x/evm/types"
+ "github.com/tendermint/tendermint/libs/log"
+ "github.com/zeta-chain/zetacore/rpc/backend"
rpctypes "github.com/zeta-chain/zetacore/rpc/types"
)
@@ -67,7 +61,6 @@ type EthereumAPI interface {
// Allows developers to both send ETH from one address to another, write data
// on-chain, and interact with smart contracts.
SendRawTransaction(data hexutil.Bytes) (common.Hash, error)
- SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error)
// eth_sendPrivateTransaction
// eth_cancel PrivateTransaction
@@ -111,9 +104,7 @@ type EthereumAPI interface {
// Other
Syncing() (interface{}, error)
Coinbase() (string, error)
- Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error)
GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, error)
- SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error)
FillTransaction(args evmtypes.TransactionArgs) (*rpctypes.SignTransactionResult, error)
Resend(ctx context.Context, args evmtypes.TransactionArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (common.Hash, error)
GetPendingTransactions() ([]*rpctypes.RPCTransaction, error)
@@ -125,6 +116,11 @@ type EthereumAPI interface {
// eth_getWork (on Ethereum.org)
// eth_submitWork (on Ethereum.org)
// eth_submitHashrate (on Ethereum.org)
+
+ // Disabled APIs for security reasons
+ //SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error)
+ //Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error)
+ //SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error)
}
var _ EthereumAPI = (*PublicAPI)(nil)
@@ -230,12 +226,6 @@ func (e *PublicAPI) SendRawTransaction(data hexutil.Bytes) (common.Hash, error)
return e.backend.SendRawTransaction(data)
}
-// SendTransaction sends an Ethereum transaction.
-func (e *PublicAPI) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) {
- e.logger.Debug("eth_sendTransaction", "args", args.String())
- return e.backend.SendTransaction(args)
-}
-
///////////////////////////////////////////////////////////////////////////////
/// Account Information ///
///////////////////////////////////////////////////////////////////////////////
@@ -353,22 +343,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
}
@@ -416,12 +406,6 @@ func (e *PublicAPI) Coinbase() (string, error) {
return ethAddr.Hex(), nil
}
-// Sign signs the provided data using the private key of address via Geth's signature standard.
-func (e *PublicAPI) Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) {
- e.logger.Debug("eth_sign", "address", address.Hex(), "data", common.Bytes2Hex(data))
- return e.backend.Sign(address, data)
-}
-
// GetTransactionLogs returns the logs given a transaction hash.
func (e *PublicAPI) GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, error) {
e.logger.Debug("eth_getTransactionLogs", "hash", txHash)
@@ -445,15 +429,10 @@ func (e *PublicAPI) GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, err
}
// parse tx logs from events
+ // #nosec G701 always in range
return backend.TxLogsFromEvents(resBlockResult.TxsResults[res.TxIndex].Events, int(res.MsgIndex))
}
-// SignTypedData signs EIP-712 conformant typed data
-func (e *PublicAPI) SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error) {
- e.logger.Debug("eth_signTypedData", "address", address.Hex(), "data", typedData)
- return e.backend.SignTypedData(address, typedData)
-}
-
// FillTransaction fills the defaults (nonce, gas, gasPrice or 1559 fields)
// on a given unsigned transaction, and returns it to the caller for further
// processing (signing + broadcast).
@@ -527,3 +506,25 @@ func (e *PublicAPI) GetPendingTransactions() ([]*rpctypes.RPCTransaction, error)
return result, nil
}
+
+///////////////////////////////////////////////////////////////////////////////
+/// Disabled ///
+///////////////////////////////////////////////////////////////////////////////
+
+//// SendTransaction sends an Ethereum transaction.
+//func (e *PublicAPI) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) {
+// e.logger.Debug("eth_sendTransaction", "args", args.String())
+// return e.backend.SendTransaction(args)
+//}
+//
+//// Sign signs the provided data using the private key of address via Geth's signature standard.
+//func (e *PublicAPI) Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) {
+// e.logger.Debug("eth_sign", "address", address.Hex(), "data", common.Bytes2Hex(data))
+// return e.backend.Sign(address, data)
+//}
+//
+//// SignTypedData signs EIP-712 conformant typed data
+//func (e *PublicAPI) SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error) {
+// e.logger.Debug("eth_signTypedData", "address", address.Hex(), "data", typedData)
+// return e.backend.SignTypedData(address, typedData)
+//}
diff --git a/rpc/namespaces/ethereum/eth/filters/api.go b/rpc/namespaces/ethereum/eth/filters/api.go
index f6a9135a16..f6a6ca4f1e 100644
--- a/rpc/namespaces/ethereum/eth/filters/api.go
+++ b/rpc/namespaces/ethereum/eth/filters/api.go
@@ -22,20 +22,16 @@ import (
"time"
"github.com/cosmos/cosmos-sdk/client"
- "github.com/zeta-chain/zetacore/rpc/types"
-
- "github.com/tendermint/tendermint/libs/log"
-
- coretypes "github.com/tendermint/tendermint/rpc/core/types"
- rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client"
- tmtypes "github.com/tendermint/tendermint/types"
-
"github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth/filters"
"github.com/ethereum/go-ethereum/rpc"
-
evmtypes "github.com/evmos/ethermint/x/evm/types"
+ "github.com/tendermint/tendermint/libs/log"
+ coretypes "github.com/tendermint/tendermint/rpc/core/types"
+ rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client"
+ tmtypes "github.com/tendermint/tendermint/types"
+ "github.com/zeta-chain/zetacore/rpc/types"
)
// FilterAPI gathers
@@ -252,7 +248,10 @@ func (api *PublicFilterAPI) NewPendingTransactions(ctx context.Context) (*rpc.Su
for _, msg := range tx.GetMsgs() {
ethTx, ok := msg.(*evmtypes.MsgEthereumTx)
if ok {
- _ = notifier.Notify(rpcSub.ID, ethTx.AsTransaction().Hash())
+ err = notifier.Notify(rpcSub.ID, ethTx.AsTransaction().Hash())
+ if err != nil {
+ api.logger.Debug("failed to notify", "error", err.Error())
+ }
}
}
case <-rpcSub.Err():
@@ -360,7 +359,10 @@ func (api *PublicFilterAPI) NewHeads(ctx context.Context) (*rpc.Subscription, er
// TODO: fetch bloom from events
header := types.EthHeaderFromTendermint(data.Header, ethtypes.Bloom{}, baseFee)
- _ = notifier.Notify(rpcSub.ID, header)
+ err = notifier.Notify(rpcSub.ID, header)
+ if err != nil {
+ api.logger.Debug("failed to notify", "error", err.Error())
+ }
case <-rpcSub.Err():
headersSub.Unsubscribe(api.events)
return
@@ -424,7 +426,10 @@ func (api *PublicFilterAPI) Logs(ctx context.Context, crit filters.FilterCriteri
logs := FilterLogs(evmtypes.LogsToEthereum(txResponse.Logs), crit.FromBlock, crit.ToBlock, crit.Addresses, crit.Topics)
for _, log := range logs {
- _ = notifier.Notify(rpcSub.ID, log)
+ err = notifier.Notify(rpcSub.ID, log)
+ if err != nil {
+ api.logger.Debug("failed to notify", "error", err.Error())
+ }
}
case <-rpcSub.Err(): // client send an unsubscribe request
logsSub.Unsubscribe(api.events)
diff --git a/rpc/namespaces/ethereum/eth/filters/filter_system.go b/rpc/namespaces/ethereum/eth/filters/filter_system.go
index ac69cfc53d..ba203cf685 100644
--- a/rpc/namespaces/ethereum/eth/filters/filter_system.go
+++ b/rpc/namespaces/ethereum/eth/filters/filter_system.go
@@ -21,23 +21,19 @@ import (
"sync"
"time"
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ "github.com/ethereum/go-ethereum/common"
+ ethtypes "github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/eth/filters"
+ "github.com/ethereum/go-ethereum/rpc"
+ evmtypes "github.com/evmos/ethermint/x/evm/types"
"github.com/pkg/errors"
-
tmjson "github.com/tendermint/tendermint/libs/json"
"github.com/tendermint/tendermint/libs/log"
tmquery "github.com/tendermint/tendermint/libs/pubsub/query"
coretypes "github.com/tendermint/tendermint/rpc/core/types"
rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client"
tmtypes "github.com/tendermint/tendermint/types"
-
- "github.com/ethereum/go-ethereum/common"
- ethtypes "github.com/ethereum/go-ethereum/core/types"
- "github.com/ethereum/go-ethereum/eth/filters"
- "github.com/ethereum/go-ethereum/rpc"
-
- sdk "github.com/cosmos/cosmos-sdk/types"
-
- evmtypes "github.com/evmos/ethermint/x/evm/types"
"github.com/zeta-chain/zetacore/rpc/ethereum/pubsub"
)
diff --git a/rpc/namespaces/ethereum/eth/filters/filters.go b/rpc/namespaces/ethereum/eth/filters/filters.go
index d70199de5a..4355182001 100644
--- a/rpc/namespaces/ethereum/eth/filters/filters.go
+++ b/rpc/namespaces/ethereum/eth/filters/filters.go
@@ -21,17 +21,15 @@ import (
"fmt"
"math/big"
- "github.com/zeta-chain/zetacore/rpc/backend"
- "github.com/zeta-chain/zetacore/rpc/types"
-
- "github.com/pkg/errors"
- "github.com/tendermint/tendermint/libs/log"
- tmrpctypes "github.com/tendermint/tendermint/rpc/core/types"
-
"github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth/filters"
+ "github.com/pkg/errors"
+ "github.com/tendermint/tendermint/libs/log"
+ tmrpctypes "github.com/tendermint/tendermint/rpc/core/types"
+ "github.com/zeta-chain/zetacore/rpc/backend"
+ "github.com/zeta-chain/zetacore/rpc/types"
)
// BloomIV represents the bit indexes and value inside the bloom filter that belong
@@ -107,7 +105,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/api.go b/rpc/namespaces/ethereum/miner/api.go
index 901c567a46..9d5e8fc556 100644
--- a/rpc/namespaces/ethereum/miner/api.go
+++ b/rpc/namespaces/ethereum/miner/api.go
@@ -17,12 +17,9 @@ package miner
import (
"github.com/cosmos/cosmos-sdk/server"
-
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
-
"github.com/tendermint/tendermint/libs/log"
-
"github.com/zeta-chain/zetacore/rpc/backend"
)
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/namespaces/ethereum/personal/api.go b/rpc/namespaces/ethereum/personal/api.go
index 49b654c8dc..fa182c4759 100644
--- a/rpc/namespaces/ethereum/personal/api.go
+++ b/rpc/namespaces/ethereum/personal/api.go
@@ -21,22 +21,17 @@ import (
"os"
"time"
- "github.com/zeta-chain/zetacore/rpc/backend"
-
- "github.com/evmos/ethermint/crypto/hd"
- ethermint "github.com/evmos/ethermint/types"
-
- "github.com/tendermint/tendermint/libs/log"
-
"github.com/cosmos/cosmos-sdk/crypto/keyring"
sdk "github.com/cosmos/cosmos-sdk/types"
-
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
-
+ "github.com/evmos/ethermint/crypto/hd"
+ ethermint "github.com/evmos/ethermint/types"
evmtypes "github.com/evmos/ethermint/x/evm/types"
+ "github.com/tendermint/tendermint/libs/log"
+ "github.com/zeta-chain/zetacore/rpc/backend"
)
// PrivateAccountAPI is the personal_ prefixed set of APIs in the Web3 JSON-RPC spec.
diff --git a/rpc/namespaces/ethereum/txpool/api.go b/rpc/namespaces/ethereum/txpool/api.go
index e8320b6655..89fb056bde 100644
--- a/rpc/namespaces/ethereum/txpool/api.go
+++ b/rpc/namespaces/ethereum/txpool/api.go
@@ -16,10 +16,8 @@
package txpool
import (
- "github.com/tendermint/tendermint/libs/log"
-
"github.com/ethereum/go-ethereum/common/hexutil"
-
+ "github.com/tendermint/tendermint/libs/log"
"github.com/zeta-chain/zetacore/rpc/types"
)
diff --git a/rpc/namespaces/ethereum/web3/api.go b/rpc/namespaces/ethereum/web3/api.go
index 47f522785d..46e09d9637 100644
--- a/rpc/namespaces/ethereum/web3/api.go
+++ b/rpc/namespaces/ethereum/web3/api.go
@@ -19,10 +19,9 @@ import (
"fmt"
"runtime"
- "github.com/zeta-chain/zetacore/common"
-
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
+ "github.com/zeta-chain/zetacore/common"
)
// PublicAPI is the web3_ prefixed set of APIs in the Web3 JSON-RPC spec.
diff --git a/rpc/types/block.go b/rpc/types/block.go
index 9f4b533950..4079d264de 100644
--- a/rpc/types/block.go
+++ b/rpc/types/block.go
@@ -107,6 +107,7 @@ func (bn *BlockNumber) UnmarshalJSON(data []byte) error {
if blckNum > math.MaxInt64 {
return fmt.Errorf("block number larger than int64")
}
+ // #nosec G701 range checked
*bn = BlockNumber(blckNum)
return nil
diff --git a/rpc/types/events.go b/rpc/types/events.go
index e760c9b4cb..71fd7a789f 100644
--- a/rpc/types/events.go
+++ b/rpc/types/events.go
@@ -162,6 +162,7 @@ func ParseTxResult(result *abci.ResponseDeliverTx, tx sdk.Tx) (*ParsedTxs, error
// some old versions miss some events, fill it with tx result
if len(p.Txs) == 1 {
+ // #nosec G701 always positive
p.Txs[0].GasUsed = uint64(result.GasUsed)
}
@@ -191,8 +192,9 @@ func ParseTxIndexerResult(txResult *tmrpctypes.ResultTx, tx sdk.Tx, getter func(
}
if parsedTx.Type == 88 {
return ðermint.TxResult{
- Height: txResult.Height,
- TxIndex: txResult.Index,
+ Height: txResult.Height,
+ TxIndex: txResult.Index,
+ // #nosec G701 always in range
MsgIndex: uint32(parsedTx.MsgIndex),
EthTxIndex: parsedTx.EthTxIndex,
Failed: parsedTx.Failed,
@@ -208,8 +210,9 @@ func ParseTxIndexerResult(txResult *tmrpctypes.ResultTx, tx sdk.Tx, getter func(
}, nil
}
return ðermint.TxResult{
- Height: txResult.Height,
- TxIndex: txResult.Index,
+ Height: txResult.Height,
+ TxIndex: txResult.Index,
+ // #nosec G701 always in range
MsgIndex: uint32(parsedTx.MsgIndex),
EthTxIndex: parsedTx.EthTxIndex,
Failed: parsedTx.Failed,
@@ -231,8 +234,10 @@ func ParseTxBlockResult(txResult *abci.ResponseDeliverTx, tx sdk.Tx, txIndex int
parsedTx := txs.Txs[0]
if parsedTx.Type == 88 {
return ðermint.TxResult{
- Height: height,
- TxIndex: uint32(txIndex),
+ Height: height,
+ // #nosec G701 always in range
+ TxIndex: uint32(txIndex),
+ // #nosec G701 always in range
MsgIndex: uint32(parsedTx.MsgIndex),
EthTxIndex: parsedTx.EthTxIndex,
Failed: parsedTx.Failed,
@@ -249,8 +254,10 @@ func ParseTxBlockResult(txResult *abci.ResponseDeliverTx, tx sdk.Tx, txIndex int
}, nil
}
return ðermint.TxResult{
- Height: height,
- TxIndex: uint32(txIndex),
+ Height: height,
+ // #nosec G701 always in range
+ TxIndex: uint32(txIndex),
+ // #nosec G701 always in range
MsgIndex: uint32(parsedTx.MsgIndex),
EthTxIndex: parsedTx.EthTxIndex,
Failed: parsedTx.Failed,
@@ -336,6 +343,7 @@ func fillTxAttribute(tx *ParsedTx, key []byte, value []byte) error {
if err != nil {
return err
}
+ // #nosec G701 always in range
tx.EthTxIndex = int32(txIndex)
case evmtypes.AttributeKeyTxGasUsed:
gasUsed, err := strconv.ParseUint(string(value), 10, 64)
diff --git a/rpc/types/utils.go b/rpc/types/utils.go
index c3831deb26..62d947dfe5 100644
--- a/rpc/types/utils.go
+++ b/rpc/types/utils.go
@@ -82,11 +82,12 @@ func EthHeaderFromTendermint(header tmtypes.Header, bloom ethtypes.Bloom, baseFe
Number: big.NewInt(header.Height),
GasLimit: 0,
GasUsed: 0,
- Time: uint64(header.Time.UTC().Unix()),
- Extra: []byte{},
- MixDigest: common.Hash{},
- Nonce: ethtypes.BlockNonce{},
- BaseFee: baseFee,
+ // #nosec G701 always positive
+ Time: uint64(header.Time.UTC().Unix()),
+ Extra: []byte{},
+ MixDigest: common.Hash{},
+ Nonce: ethtypes.BlockNonce{},
+ BaseFee: baseFee,
}
}
@@ -94,6 +95,7 @@ func EthHeaderFromTendermint(header tmtypes.Header, bloom ethtypes.Bloom, baseFe
func BlockMaxGasFromConsensusParams(goCtx context.Context, clientCtx client.Context, blockHeight int64) (int64, error) {
resConsParams, err := clientCtx.Client.ConsensusParams(goCtx, &blockHeight)
if err != nil {
+ // #nosec G701 always in range
return int64(^uint32(0)), err
}
@@ -102,6 +104,7 @@ func BlockMaxGasFromConsensusParams(goCtx context.Context, clientCtx client.Cont
// Sets gas limit to max uint32 to not error with javascript dev tooling
// This -1 value indicating no block gas limit is set to max uint64 with geth hexutils
// which errors certain javascript dev tooling which only supports up to 53 bits
+ // #nosec G701 always in range
gasLimit = int64(^uint32(0))
}
@@ -186,7 +189,10 @@ func NewRPCTransaction(
} else {
signer = ethtypes.HomesteadSigner{}
}
- from, _ := ethtypes.Sender(signer, tx)
+ from, err := ethtypes.Sender(signer, tx)
+ if err != nil {
+ return nil, err
+ }
v, r, s := tx.RawSignatureValues()
result := &RPCTransaction{
Type: hexutil.Uint64(tx.Type()),
diff --git a/rpc/websockets.go b/rpc/websockets.go
index 77ba4df808..1346aad955 100644
--- a/rpc/websockets.go
+++ b/rpc/websockets.go
@@ -27,27 +27,28 @@ import (
"sync"
"github.com/cosmos/cosmos-sdk/client"
- "github.com/gorilla/mux"
- "github.com/gorilla/websocket"
- "github.com/pkg/errors"
-
"github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth/filters"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc"
-
+ evmtypes "github.com/evmos/ethermint/x/evm/types"
+ "github.com/gorilla/mux"
+ "github.com/gorilla/websocket"
+ "github.com/pkg/errors"
"github.com/tendermint/tendermint/libs/log"
rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client"
tmtypes "github.com/tendermint/tendermint/types"
-
- evmtypes "github.com/evmos/ethermint/x/evm/types"
"github.com/zeta-chain/zetacore/rpc/ethereum/pubsub"
rpcfilters "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/eth/filters"
"github.com/zeta-chain/zetacore/rpc/types"
"github.com/zeta-chain/zetacore/server/config"
)
+const (
+ messageSizeLimit = 32 * 1024 * 1024 // 32MB
+)
+
type WebsocketsServer interface {
Start()
}
@@ -91,7 +92,10 @@ type websocketsServer struct {
func NewWebsocketsServer(clientCtx client.Context, logger log.Logger, tmWSClient *rpcclient.WSClient, cfg *config.Config) WebsocketsServer {
logger = logger.With("api", "websocket-server")
- _, port, _ := net.SplitHostPort(cfg.JSONRPC.Address)
+ _, port, err := net.SplitHostPort(cfg.JSONRPC.Address)
+ if err != nil {
+ logger.Error("failed to parse rpc address", "error", err.Error())
+ }
return &websocketsServer{
rpcAddr: "localhost:" + port, // FIXME: this shouldn't be hardcoded to localhost
@@ -139,6 +143,8 @@ func (s *websocketsServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
+ conn.SetReadLimit(messageSizeLimit)
+
s.readLoop(&wsConn{
mux: new(sync.Mutex),
conn: conn,
@@ -155,7 +161,10 @@ func (s *websocketsServer) sendErrResponse(wsConn *wsConn, msg string) {
ID: nil,
}
- _ = wsConn.WriteJSON(res)
+ err := wsConn.WriteJSON(res)
+ if err != nil {
+ s.logger.Debug("error writing error response", "error", err.Error())
+ }
}
type wsConn struct {
@@ -196,7 +205,10 @@ func (s *websocketsServer) readLoop(wsConn *wsConn) {
for {
_, mb, err := wsConn.ReadMessage()
if err != nil {
- _ = wsConn.Close()
+ err = wsConn.Close()
+ if err != nil {
+ s.logger.Debug("error closing websocket connection", "error", err.Error())
+ }
s.logger.Error("read message error, breaking read loop", "error", err.Error())
return
}
@@ -427,7 +439,10 @@ func (api *pubSubAPI) subscribeNewHeads(wsConn *wsConn, subID rpc.ID) (pubsub.Un
try(func() {
if err != websocket.ErrCloseSent {
- _ = wsConn.Close()
+ err = wsConn.Close()
+ if err != nil {
+ api.logger.Debug("error closing websocket peer", "error", err.Error())
+ }
}
}, api.logger, "closing websocket peer sub")
}
@@ -606,8 +621,11 @@ func (api *pubSubAPI) subscribeLogs(wsConn *wsConn, subID rpc.ID, extra interfac
err = wsConn.WriteJSON(res)
if err != nil {
try(func() {
- if err != websocket.ErrCloseSent {
- _ = wsConn.Close()
+ if !errors.Is(err, websocket.ErrCloseSent) {
+ err = wsConn.Close()
+ if err != nil {
+ api.logger.Debug("error closing websocket peer", "error", err.Error())
+ }
}
}, api.logger, "closing websocket peer sub")
}
@@ -664,8 +682,11 @@ func (api *pubSubAPI) subscribePendingTransactions(wsConn *wsConn, subID rpc.ID)
api.logger.Debug("error writing header, will drop peer", "error", err.Error())
try(func() {
- if err != websocket.ErrCloseSent {
- _ = wsConn.Close()
+ if !errors.Is(err, websocket.ErrCloseSent) {
+ err = wsConn.Close()
+ if err != nil {
+ api.logger.Debug("error closing websocket peer", "error", err.Error())
+ }
}
}, api.logger, "closing websocket peer sub")
}
@@ -682,7 +703,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/scripts/cosmos-gosec.sh b/scripts/cosmos-gosec.sh
new file mode 100644
index 0000000000..0863a94cce
--- /dev/null
+++ b/scripts/cosmos-gosec.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+# Install gosec
+go install github.com/cosmos/gosec/v2/cmd/gosec@latest
+
+# Run gosec
+gosec -include=G701,G703,G704 ./...
\ No newline at end of file
diff --git a/scripts/mocks-generate.sh b/scripts/mocks-generate.sh
new file mode 100644
index 0000000000..8e7dc5222b
--- /dev/null
+++ b/scripts/mocks-generate.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+# Install mockery
+go install github.com/vektra/mockery/v2@latest
+
+# Run generate command for mocks
+cd ./testutil/keeper/mocks
+go generate "mocks.go"
+
+# Print a message to indicate completion
+echo "Mocks generated."
\ No newline at end of file
diff --git a/server/start.go b/server/start.go
index 14a07c0ebd..e490886733 100644
--- a/server/start.go
+++ b/server/start.go
@@ -135,7 +135,10 @@ which accepts a path for the resulting pprof file.
return err
}
- withTM, _ := cmd.Flags().GetBool(srvflags.WithTendermint)
+ withTM, err := cmd.Flags().GetBool(srvflags.WithTendermint)
+ if err != nil {
+ withTM = false
+ }
if !withTM {
serverCtx.Logger.Info("starting ABCI without Tendermint")
return startStandAlone(serverCtx, opts)
@@ -144,7 +147,10 @@ which accepts a path for the resulting pprof file.
serverCtx.Logger.Info("Unlocking keyring")
// fire unlock precess for keyring
- keyringBackend, _ := cmd.Flags().GetString(flags.FlagKeyringBackend)
+ keyringBackend, err := cmd.Flags().GetString(flags.FlagKeyringBackend)
+ if err != nil {
+ keyringBackend = ""
+ }
if keyringBackend == keyring.BackendFile {
_, err = clientCtx.Keyring.List()
if err != nil {
@@ -393,7 +399,7 @@ func startInProcess(ctx *server.Context, clientCtx client.Context, opts StartOpt
defer func() {
if tmNode.IsRunning() {
- _ = tmNode.Stop()
+ err = tmNode.Stop()
}
}()
}
diff --git a/standalone-network/run-zetaclient.sh b/standalone-network/run-zetaclient.sh
index 8c8a27b71e..5ad3375ea9 100644
--- a/standalone-network/run-zetaclient.sh
+++ b/standalone-network/run-zetaclient.sh
@@ -1,2 +1,2 @@
-zetaclientd init --chain-id localnet_101-1 --operator zeta1syavy2npfyt9tcncdtsdzf7kny9lh777heefxk --hotkey=zeta --public-ip=0.0.0.0
+zetaclientd init --chain-id localnet_101-1 --operator zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax --hotkey=zeta --public-ip=0.0.0.0
zetaclientd start
\ No newline at end of file
diff --git a/standalone-network/upgrade-integration.sh b/standalone-network/upgrade-integration.sh
index 4bf9571307..9d421eeaec 100755
--- a/standalone-network/upgrade-integration.sh
+++ b/standalone-network/upgrade-integration.sh
@@ -117,4 +117,3 @@ sleep 7
zetacored query gov proposal 1
tail -f zetanode.log
-
diff --git a/testutil/keeper/crosschain.go b/testutil/keeper/crosschain.go
index b5c66023e9..f96dc7e87c 100644
--- a/testutil/keeper/crosschain.go
+++ b/testutil/keeper/crosschain.go
@@ -3,63 +3,162 @@ 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, SDKKeepers, ZetaKeepers) {
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 zeta keepers
+ observerKeeperTmp := initObserverKeeper(
+ cdc,
+ db,
+ stateStore,
+ sdkKeepers.StakingKeeper,
+ sdkKeepers.ParamsKeeper,
+ )
+ fungiblekeeperTmp := initFungibleKeeper(
+ cdc,
+ db,
+ stateStore,
+ sdkKeepers.ParamsKeeper,
+ sdkKeepers.AuthKeeper,
+ sdkKeepers.BankKeeper,
+ sdkKeepers.EvmKeeper,
+ observerKeeperTmp,
+ )
+ zetaKeepers := ZetaKeepers{
+ ObserverKeeper: observerKeeperTmp,
+ FungibleKeeper: fungiblekeeperTmp,
+ }
+ var observerKeeper types.ZetaObserverKeeper = observerKeeperTmp
+ var fungibleKeeper types.FungibleKeeper = fungiblekeeperTmp
+
+ // 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)
+ zetaKeepers.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
+ 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, sdkKeepers, zetaKeepers
+}
+
+// CrosschainKeeperAllMocks initializes a crosschain keeper for testing purposes with all mocks
+func CrosschainKeeperAllMocks(t testing.TB) (*keeper.Keeper, sdk.Context) {
+ k, ctx, _, _ := CrosschainKeeperWithMocks(t, CrosschainMocksAll)
return k, ctx
}
+
+// CrosschainKeeper initializes a crosschain keeper for testing purposes
+func CrosschainKeeper(t testing.TB) (*keeper.Keeper, sdk.Context, SDKKeepers, ZetaKeepers) {
+ 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..6f26a2733e 100644
--- a/testutil/keeper/fungible.go
+++ b/testutil/keeper/fungible.go
@@ -2,18 +2,15 @@ package keeper
import (
"testing"
- "time"
+ "github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/store"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
+ paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
"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"
fungiblemodule "github.com/zeta-chain/zetacore/x/fungible"
"github.com/zeta-chain/zetacore/x/fungible/keeper"
@@ -37,8 +34,35 @@ var (
FungibleNoMocks = FungibleMockOptions{}
)
+func initFungibleKeeper(
+ cdc codec.Codec,
+ db *tmdb.MemDB,
+ ss store.CommitMultiStore,
+ paramKeeper paramskeeper.Keeper,
+ authKeeper types.AccountKeeper,
+ bankKeepr types.BankKeeper,
+ evmKeeper types.EVMKeeper,
+ observerKeeper types.ObserverKeeper,
+) *keeper.Keeper {
+ storeKey := sdk.NewKVStoreKey(types.StoreKey)
+ memKey := storetypes.NewMemoryStoreKey(types.MemStoreKey)
+ ss.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db)
+ ss.MountStoreWithDB(memKey, storetypes.StoreTypeMemory, db)
+
+ return keeper.NewKeeper(
+ cdc,
+ storeKey,
+ memKey,
+ paramKeeper.Subspace(types.ModuleName),
+ authKeeper,
+ evmKeeper,
+ bankKeepr,
+ observerKeeper,
+ )
+}
+
// 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 +75,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 +131,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
deleted file mode 100644
index 4267e1593b..0000000000
--- a/testutil/keeper/mocks.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package keeper
-
-import (
- fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types"
-)
-
-//go:generate mockery --name FungibleAccountKeeper --filename account.go --case underscore --output ./mocks/fungible
-type FungibleAccountKeeper interface {
- fungibletypes.AccountKeeper
-}
-
-//go:generate mockery --name FungibleBankKeeper --filename bank.go --case underscore --output ./mocks/fungible
-type FungibleBankKeeper interface {
- fungibletypes.BankKeeper
-}
-
-//go:generate mockery --name FungibleObserverKeeper --filename observer.go --case underscore --output ./mocks/fungible
-type FungibleObserverKeeper interface {
- fungibletypes.ObserverKeeper
-}
-
-//go:generate mockery --name FungibleEVMKeeper --filename evm.go --case underscore --output ./mocks/fungible
-type FungibleEVMKeeper interface {
- fungibletypes.EVMKeeper
-}
diff --git a/testutil/keeper/mocks/crosschain/account.go b/testutil/keeper/mocks/crosschain/account.go
new file mode 100644
index 0000000000..626900da83
--- /dev/null
+++ b/testutil/keeper/mocks/crosschain/account.go
@@ -0,0 +1,82 @@
+// Code generated by mockery v2.33.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..cdf1e371ef
--- /dev/null
+++ b/testutil/keeper/mocks/crosschain/bank.go
@@ -0,0 +1,146 @@
+// Code generated by mockery v2.33.3. DO NOT EDIT.
+
+package mocks
+
+import (
+ mock "github.com/stretchr/testify/mock"
+
+ types "github.com/cosmos/cosmos-sdk/types"
+)
+
+// 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..a6b763b8a3
--- /dev/null
+++ b/testutil/keeper/mocks/crosschain/fungible.go
@@ -0,0 +1,552 @@
+// Code generated by mockery v2.33.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
+}
+
+// CallUniswapV2RouterSwapExactTokensForTokens provides a mock function with given fields: ctx, sender, to, amountIn, inZRC4, outZRC4, noEthereumTxEvent
+func (_m *CrosschainFungibleKeeper) CallUniswapV2RouterSwapExactTokensForTokens(ctx types.Context, sender common.Address, to common.Address, amountIn *big.Int, inZRC4 common.Address, outZRC4 common.Address, noEthereumTxEvent bool) ([]*big.Int, error) {
+ ret := _m.Called(ctx, sender, to, amountIn, inZRC4, outZRC4, noEthereumTxEvent)
+
+ var r0 []*big.Int
+ var r1 error
+ if rf, ok := ret.Get(0).(func(types.Context, common.Address, common.Address, *big.Int, common.Address, common.Address, bool) ([]*big.Int, error)); ok {
+ return rf(ctx, sender, to, amountIn, inZRC4, outZRC4, noEthereumTxEvent)
+ }
+ if rf, ok := ret.Get(0).(func(types.Context, common.Address, common.Address, *big.Int, common.Address, common.Address, bool) []*big.Int); ok {
+ r0 = rf(ctx, sender, to, amountIn, inZRC4, 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, common.Address, bool) error); ok {
+ r1 = rf(ctx, sender, to, amountIn, inZRC4, outZRC4, noEthereumTxEvent)
+ } else {
+ r1 = ret.Error(1)
+ }
+
+ return r0, r1
+}
+
+// CallZRC20Approve provides a mock function with given fields: ctx, owner, zrc20address, spender, amount, noEthereumTxEvent
+func (_m *CrosschainFungibleKeeper) CallZRC20Approve(ctx types.Context, owner common.Address, zrc20address common.Address, spender common.Address, amount *big.Int, noEthereumTxEvent bool) error {
+ ret := _m.Called(ctx, owner, zrc20address, spender, amount, noEthereumTxEvent)
+
+ var r0 error
+ if rf, ok := ret.Get(0).(func(types.Context, common.Address, common.Address, common.Address, *big.Int, bool) error); ok {
+ r0 = rf(ctx, owner, zrc20address, spender, amount, noEthereumTxEvent)
+ } else {
+ r0 = ret.Error(0)
+ }
+
+ return r0
+}
+
+// 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
+}
+
+// DepositZRC20 provides a mock function with given fields: ctx, contract, to, amount
+func (_m *CrosschainFungibleKeeper) DepositZRC20(ctx types.Context, contract common.Address, to common.Address, amount *big.Int) (*evmtypes.MsgEthereumTxResponse, error) {
+ ret := _m.Called(ctx, contract, to, amount)
+
+ var r0 *evmtypes.MsgEthereumTxResponse
+ var r1 error
+ if rf, ok := ret.Get(0).(func(types.Context, common.Address, common.Address, *big.Int) (*evmtypes.MsgEthereumTxResponse, error)); ok {
+ return rf(ctx, contract, to, amount)
+ }
+ if rf, ok := ret.Get(0).(func(types.Context, common.Address, common.Address, *big.Int) *evmtypes.MsgEthereumTxResponse); ok {
+ r0 = rf(ctx, contract, to, amount)
+ } else {
+ if ret.Get(0) != nil {
+ r0 = ret.Get(0).(*evmtypes.MsgEthereumTxResponse)
+ }
+ }
+
+ if rf, ok := ret.Get(1).(func(types.Context, common.Address, common.Address, *big.Int) error); ok {
+ r1 = rf(ctx, contract, to, amount)
+ } else {
+ r1 = ret.Error(1)
+ }
+
+ return r0, r1
+}
+
+// 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
+}
+
+// GetForeignCoinFromAsset provides a mock function with given fields: ctx, asset, chainID
+func (_m *CrosschainFungibleKeeper) GetForeignCoinFromAsset(ctx types.Context, asset string, chainID int64) (fungibletypes.ForeignCoins, bool) {
+ ret := _m.Called(ctx, asset, chainID)
+
+ var r0 fungibletypes.ForeignCoins
+ var r1 bool
+ if rf, ok := ret.Get(0).(func(types.Context, string, int64) (fungibletypes.ForeignCoins, bool)); ok {
+ return rf(ctx, asset, chainID)
+ }
+ if rf, ok := ret.Get(0).(func(types.Context, string, int64) fungibletypes.ForeignCoins); ok {
+ r0 = rf(ctx, asset, chainID)
+ } else {
+ r0 = ret.Get(0).(fungibletypes.ForeignCoins)
+ }
+
+ if rf, ok := ret.Get(1).(func(types.Context, string, int64) bool); ok {
+ r1 = rf(ctx, asset, chainID)
+ } else {
+ r1 = ret.Get(1).(bool)
+ }
+
+ return r0, r1
+}
+
+// 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
+}
+
+// GetUniswapV2Router02Address provides a mock function with given fields: ctx
+func (_m *CrosschainFungibleKeeper) GetUniswapV2Router02Address(ctx types.Context) (common.Address, error) {
+ ret := _m.Called(ctx)
+
+ var r0 common.Address
+ var r1 error
+ if rf, ok := ret.Get(0).(func(types.Context) (common.Address, error)); ok {
+ return rf(ctx)
+ }
+ if rf, ok := ret.Get(0).(func(types.Context) common.Address); ok {
+ r0 = rf(ctx)
+ } else {
+ if ret.Get(0) != nil {
+ r0 = ret.Get(0).(common.Address)
+ }
+ }
+
+ if rf, ok := ret.Get(1).(func(types.Context) error); ok {
+ r1 = rf(ctx)
+ } else {
+ r1 = ret.Error(1)
+ }
+
+ return r0, r1
+}
+
+// QueryGasLimit provides a mock function with given fields: ctx, contract
+func (_m *CrosschainFungibleKeeper) QueryGasLimit(ctx types.Context, contract common.Address) (*big.Int, error) {
+ ret := _m.Called(ctx, contract)
+
+ var r0 *big.Int
+ var r1 error
+ if rf, ok := ret.Get(0).(func(types.Context, common.Address) (*big.Int, error)); ok {
+ return rf(ctx, contract)
+ }
+ if rf, ok := ret.Get(0).(func(types.Context, common.Address) *big.Int); ok {
+ r0 = rf(ctx, contract)
+ } else {
+ if ret.Get(0) != nil {
+ r0 = ret.Get(0).(*big.Int)
+ }
+ }
+
+ if rf, ok := ret.Get(1).(func(types.Context, common.Address) error); ok {
+ r1 = rf(ctx, contract)
+ } else {
+ r1 = ret.Error(1)
+ }
+
+ return r0, r1
+}
+
+// QueryProtocolFlatFee provides a mock function with given fields: ctx, contract
+func (_m *CrosschainFungibleKeeper) QueryProtocolFlatFee(ctx types.Context, contract common.Address) (*big.Int, error) {
+ ret := _m.Called(ctx, contract)
+
+ var r0 *big.Int
+ var r1 error
+ if rf, ok := ret.Get(0).(func(types.Context, common.Address) (*big.Int, error)); ok {
+ return rf(ctx, contract)
+ }
+ if rf, ok := ret.Get(0).(func(types.Context, common.Address) *big.Int); ok {
+ r0 = rf(ctx, contract)
+ } else {
+ if ret.Get(0) != nil {
+ r0 = ret.Get(0).(*big.Int)
+ }
+ }
+
+ if rf, ok := ret.Get(1).(func(types.Context, common.Address) error); ok {
+ r1 = rf(ctx, contract)
+ } else {
+ r1 = ret.Error(1)
+ }
+
+ 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
+}
+
+// QueryUniswapV2RouterGetZRC4AmountsIn provides a mock function with given fields: ctx, amountOut, inZRC4
+func (_m *CrosschainFungibleKeeper) QueryUniswapV2RouterGetZRC4AmountsIn(ctx types.Context, amountOut *big.Int, inZRC4 common.Address) (*big.Int, error) {
+ ret := _m.Called(ctx, amountOut, inZRC4)
+
+ 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, inZRC4)
+ }
+ if rf, ok := ret.Get(0).(func(types.Context, *big.Int, common.Address) *big.Int); ok {
+ r0 = rf(ctx, amountOut, inZRC4)
+ } 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, inZRC4)
+ } else {
+ r1 = ret.Error(1)
+ }
+
+ return r0, r1
+}
+
+// QueryUniswapV2RouterGetZRC4ToZRC4AmountsIn provides a mock function with given fields: ctx, amountOut, inZRC4, outZRC4
+func (_m *CrosschainFungibleKeeper) QueryUniswapV2RouterGetZRC4ToZRC4AmountsIn(ctx types.Context, amountOut *big.Int, inZRC4 common.Address, outZRC4 common.Address) (*big.Int, error) {
+ ret := _m.Called(ctx, amountOut, inZRC4, outZRC4)
+
+ var r0 *big.Int
+ var r1 error
+ if rf, ok := ret.Get(0).(func(types.Context, *big.Int, common.Address, common.Address) (*big.Int, error)); ok {
+ return rf(ctx, amountOut, inZRC4, outZRC4)
+ }
+ if rf, ok := ret.Get(0).(func(types.Context, *big.Int, common.Address, common.Address) *big.Int); ok {
+ r0 = rf(ctx, amountOut, inZRC4, 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, common.Address) error); ok {
+ r1 = rf(ctx, amountOut, inZRC4, outZRC4)
+ } else {
+ r1 = ret.Error(1)
+ }
+
+ return r0, r1
+}
+
+// QueryUniswapV2RouterGetZetaAmountsIn provides a mock function with given fields: ctx, amountOut, outZRC4
+func (_m *CrosschainFungibleKeeper) QueryUniswapV2RouterGetZetaAmountsIn(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..5eba61daaa
--- /dev/null
+++ b/testutil/keeper/mocks/crosschain/observer.go
@@ -0,0 +1,415 @@
+// Code generated by mockery v2.33.3. DO NOT EDIT.
+
+package mocks
+
+import (
+ mock "github.com/stretchr/testify/mock"
+ common "github.com/zeta-chain/zetacore/common"
+
+ 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
+}
+
+// GetBlockHeader provides a mock function with given fields: ctx, hash
+func (_m *CrosschainObserverKeeper) GetBlockHeader(ctx types.Context, hash []byte) (common.BlockHeader, bool) {
+ ret := _m.Called(ctx, hash)
+
+ var r0 common.BlockHeader
+ var r1 bool
+ if rf, ok := ret.Get(0).(func(types.Context, []byte) (common.BlockHeader, bool)); ok {
+ return rf(ctx, hash)
+ }
+ if rf, ok := ret.Get(0).(func(types.Context, []byte) common.BlockHeader); ok {
+ r0 = rf(ctx, hash)
+ } else {
+ r0 = ret.Get(0).(common.BlockHeader)
+ }
+
+ if rf, ok := ret.Get(1).(func(types.Context, []byte) bool); ok {
+ r1 = rf(ctx, hash)
+ } 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
+}
+
+// GetCrosschainFlags provides a mock function with given fields: ctx
+func (_m *CrosschainObserverKeeper) GetCrosschainFlags(ctx types.Context) (observertypes.CrosschainFlags, bool) {
+ ret := _m.Called(ctx)
+
+ var r0 observertypes.CrosschainFlags
+ var r1 bool
+ if rf, ok := ret.Get(0).(func(types.Context) (observertypes.CrosschainFlags, bool)); ok {
+ return rf(ctx)
+ }
+ if rf, ok := ret.Get(0).(func(types.Context) observertypes.CrosschainFlags); ok {
+ r0 = rf(ctx)
+ } else {
+ r0 = ret.Get(0).(observertypes.CrosschainFlags)
+ }
+
+ if rf, ok := ret.Get(1).(func(types.Context) bool); ok {
+ r1 = rf(ctx)
+ } 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
+}
+
+// SetBallot provides a mock function with given fields: ctx, ballot
+func (_m *CrosschainObserverKeeper) SetBallot(ctx types.Context, ballot *observertypes.Ballot) {
+ _m.Called(ctx, ballot)
+}
+
+// SetCrosschainFlags provides a mock function with given fields: ctx, crosschainFlags
+func (_m *CrosschainObserverKeeper) SetCrosschainFlags(ctx types.Context, crosschainFlags observertypes.CrosschainFlags) {
+ _m.Called(ctx, crosschainFlags)
+}
+
+// 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)
+}
+
+// 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..3027f516b1
--- /dev/null
+++ b/testutil/keeper/mocks/crosschain/staking.go
@@ -0,0 +1,70 @@
+// Code generated by mockery v2.33.3. DO NOT EDIT.
+
+package mocks
+
+import (
+ mock "github.com/stretchr/testify/mock"
+
+ stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
+
+ 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/keeper/mocks/fungible/account.go b/testutil/keeper/mocks/fungible/account.go
index 301f6d882a..8ca9535cad 100644
--- a/testutil/keeper/mocks/fungible/account.go
+++ b/testutil/keeper/mocks/fungible/account.go
@@ -1,10 +1,9 @@
-// Code generated by mockery v2.32.3. DO NOT EDIT.
+// Code generated by mockery v2.33.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"
diff --git a/testutil/keeper/mocks/fungible/bank.go b/testutil/keeper/mocks/fungible/bank.go
index dbbb384d3e..a061b091f4 100644
--- a/testutil/keeper/mocks/fungible/bank.go
+++ b/testutil/keeper/mocks/fungible/bank.go
@@ -1,10 +1,9 @@
-// Code generated by mockery v2.32.3. DO NOT EDIT.
+// Code generated by mockery v2.33.3. DO NOT EDIT.
package mocks
import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
-
mock "github.com/stretchr/testify/mock"
types "github.com/cosmos/cosmos-sdk/types"
diff --git a/testutil/keeper/mocks/fungible/evm.go b/testutil/keeper/mocks/fungible/evm.go
index e05034a958..81653bd4a4 100644
--- a/testutil/keeper/mocks/fungible/evm.go
+++ b/testutil/keeper/mocks/fungible/evm.go
@@ -1,4 +1,4 @@
-// Code generated by mockery v2.32.3. DO NOT EDIT.
+// Code generated by mockery v2.33.3. DO NOT EDIT.
package mocks
@@ -6,12 +6,16 @@ import (
context "context"
big "math/big"
+ common "github.com/ethereum/go-ethereum/common"
+
core "github.com/ethereum/go-ethereum/core"
evmtypes "github.com/evmos/ethermint/x/evm/types"
mock "github.com/stretchr/testify/mock"
+ statedb "github.com/evmos/ethermint/x/evm/statedb"
+
types "github.com/cosmos/cosmos-sdk/types"
vm "github.com/ethereum/go-ethereum/core/vm"
@@ -90,6 +94,22 @@ func (_m *FungibleEVMKeeper) EstimateGas(c context.Context, req *evmtypes.EthCal
return r0, r1
}
+// GetAccount provides a mock function with given fields: ctx, addr
+func (_m *FungibleEVMKeeper) GetAccount(ctx types.Context, addr common.Address) *statedb.Account {
+ ret := _m.Called(ctx, addr)
+
+ var r0 *statedb.Account
+ if rf, ok := ret.Get(0).(func(types.Context, common.Address) *statedb.Account); ok {
+ r0 = rf(ctx, addr)
+ } else {
+ if ret.Get(0) != nil {
+ r0 = ret.Get(0).(*statedb.Account)
+ }
+ }
+
+ return r0
+}
+
// GetBlockBloomTransient provides a mock function with given fields: ctx
func (_m *FungibleEVMKeeper) GetBlockBloomTransient(ctx types.Context) *big.Int {
ret := _m.Called(ctx)
@@ -120,6 +140,20 @@ func (_m *FungibleEVMKeeper) GetLogSizeTransient(ctx types.Context) uint64 {
return r0
}
+// SetAccount provides a mock function with given fields: ctx, addr, account
+func (_m *FungibleEVMKeeper) SetAccount(ctx types.Context, addr common.Address, account statedb.Account) error {
+ ret := _m.Called(ctx, addr, account)
+
+ var r0 error
+ if rf, ok := ret.Get(0).(func(types.Context, common.Address, statedb.Account) error); ok {
+ r0 = rf(ctx, addr, account)
+ } else {
+ r0 = ret.Error(0)
+ }
+
+ return r0
+}
+
// SetBlockBloomTransient provides a mock function with given fields: ctx, bloom
func (_m *FungibleEVMKeeper) SetBlockBloomTransient(ctx types.Context, bloom *big.Int) {
_m.Called(ctx, bloom)
diff --git a/testutil/keeper/mocks/fungible/observer.go b/testutil/keeper/mocks/fungible/observer.go
index 7d8248a6ae..13f419d80a 100644
--- a/testutil/keeper/mocks/fungible/observer.go
+++ b/testutil/keeper/mocks/fungible/observer.go
@@ -1,11 +1,10 @@
-// Code generated by mockery v2.32.3. DO NOT EDIT.
+// Code generated by mockery v2.33.3. DO NOT EDIT.
package mocks
import (
- common "github.com/zeta-chain/zetacore/common"
-
mock "github.com/stretchr/testify/mock"
+ common "github.com/zeta-chain/zetacore/common"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
diff --git a/testutil/keeper/mocks/mocks.go b/testutil/keeper/mocks/mocks.go
new file mode 100644
index 0000000000..53e5842e65
--- /dev/null
+++ b/testutil/keeper/mocks/mocks.go
@@ -0,0 +1,59 @@
+package mocks
+
+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 ./crosschain
+type CrosschainAccountKeeper interface {
+ crosschaintypes.AccountKeeper
+}
+
+//go:generate mockery --name CrosschainBankKeeper --filename bank.go --case underscore --output ./crosschain
+type CrosschainBankKeeper interface {
+ crosschaintypes.BankKeeper
+}
+
+//go:generate mockery --name CrosschainStakingKeeper --filename staking.go --case underscore --output ./crosschain
+type CrosschainStakingKeeper interface {
+ crosschaintypes.StakingKeeper
+}
+
+//go:generate mockery --name CrosschainObserverKeeper --filename observer.go --case underscore --output ./crosschain
+type CrosschainObserverKeeper interface {
+ crosschaintypes.ZetaObserverKeeper
+}
+
+//go:generate mockery --name CrosschainFungibleKeeper --filename fungible.go --case underscore --output ./crosschain
+type CrosschainFungibleKeeper interface {
+ crosschaintypes.FungibleKeeper
+}
+
+/**
+ * Fungible Mocks
+ */
+
+//go:generate mockery --name FungibleAccountKeeper --filename account.go --case underscore --output ./fungible
+type FungibleAccountKeeper interface {
+ fungibletypes.AccountKeeper
+}
+
+//go:generate mockery --name FungibleBankKeeper --filename bank.go --case underscore --output ./fungible
+type FungibleBankKeeper interface {
+ fungibletypes.BankKeeper
+}
+
+//go:generate mockery --name FungibleObserverKeeper --filename observer.go --case underscore --output ./fungible
+type FungibleObserverKeeper interface {
+ fungibletypes.ObserverKeeper
+}
+
+//go:generate mockery --name FungibleEVMKeeper --filename evm.go --case underscore --output ./fungible
+type FungibleEVMKeeper interface {
+ fungibletypes.EVMKeeper
+}
diff --git a/testutil/keeper/observer.go b/testutil/keeper/observer.go
index 2d8908d0c0..417decd0ca 100644
--- a/testutil/keeper/observer.go
+++ b/testutil/keeper/observer.go
@@ -4,15 +4,12 @@ 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"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
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"
"github.com/zeta-chain/zetacore/x/observer/keeper"
"github.com/zeta-chain/zetacore/x/observer/types"
@@ -41,23 +38,39 @@ func initObserverKeeper(
// ObserverKeeper instantiates an observer keeper for testing purposes
func ObserverKeeper(t testing.TB) (*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 the observer keeper
+ stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db)
+ stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil)
+ require.NoError(t, stateStore.LoadLatestVersion())
+
+ ctx := NewContext(stateStore)
- registry := codectypes.NewInterfaceRegistry()
- cdc := codec.NewProtoCodec(registry)
+ // Initialize modules genesis
+ sdkKeepers.InitGenesis(ctx)
- k := initObserverKeeper(
+ // Add a proposer to the context
+ ctx = sdkKeepers.InitBlockProposer(t, ctx)
+
+ k := keeper.NewKeeper(
cdc,
- db,
- stateStore,
- stakingkeeper.Keeper{},
- ParamsKeeper(cdc, db, stateStore),
+ storeKey,
+ memStoreKey,
+ sdkKeepers.ParamsKeeper.Subspace(types.ModuleName),
+ sdkKeepers.StakingKeeper,
)
- require.NoError(t, stateStore.LoadLatestVersion())
-
- ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger())
k.SetParams(ctx, types.DefaultParams())
+
return k, ctx
}
diff --git a/testutil/network/genesis_state.go b/testutil/network/genesis_state.go
index 71d7b9740d..334c258746 100644
--- a/testutil/network/genesis_state.go
+++ b/testutil/network/genesis_state.go
@@ -81,7 +81,7 @@ func SetupZetaGenesisState(t *testing.T, genesisState map[string]json.RawMessage
BlockNumber: 5,
}
assert.NoError(t, observerGenesis.Validate())
- observerGenesis.PermissionFlags = &observerTypes.PermissionFlags{
+ observerGenesis.CrosschainFlags = &observerTypes.CrosschainFlags{
IsInboundEnabled: true,
IsOutboundEnabled: true,
}
@@ -104,12 +104,12 @@ func AddObserverData(t *testing.T, genesisState map[string]json.RawMessage, code
//params.BallotMaturityBlocks = 3
state.Params.BallotMaturityBlocks = 3
state.Keygen = &observerTypes.Keygen{BlockNumber: 10, GranteePubkeys: []string{}}
- permissionFlags := &observerTypes.PermissionFlags{
+ crosschainFlags := &observerTypes.CrosschainFlags{
IsInboundEnabled: true,
IsOutboundEnabled: true,
}
- nullify.Fill(&permissionFlags)
- state.PermissionFlags = permissionFlags
+ nullify.Fill(&crosschainFlags)
+ state.CrosschainFlags = crosschainFlags
assert.NoError(t, state.Validate())
diff --git a/testutil/network/network_config.go b/testutil/network/network_config.go
index 29391739af..2aabd219e1 100644
--- a/testutil/network/network_config.go
+++ b/testutil/network/network_config.go
@@ -24,6 +24,7 @@ import (
// genesis and single validator. All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig
func DefaultConfig() Config {
encoding := app.MakeEncodingConfig()
+
return Config{
Codec: encoding.Codec,
TxConfig: encoding.TxConfig,
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..3e1d4c7208 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"
)
@@ -44,9 +45,10 @@ func NodeAccount() *types.NodeAccount {
}
}
-func PermissionFlags() *types.PermissionFlags {
- return &types.PermissionFlags{
- IsInboundEnabled: true,
+func CrosschainFlags() *types.CrosschainFlags {
+ return &types.CrosschainFlags{
+ IsInboundEnabled: true,
+ IsOutboundEnabled: true,
}
}
@@ -69,3 +71,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..2eef2b61b0 100644
--- a/testutil/sample/sample.go
+++ b/testutil/sample/sample.go
@@ -7,6 +7,8 @@ import (
"strconv"
"testing"
+ "github.com/zeta-chain/zetacore/cmd/zetacored/config"
+
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
@@ -37,7 +39,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 +93,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
@@ -106,3 +115,8 @@ func StringRandom(r *rand.Rand, length int) string {
}
return string(result)
}
+
+// Coins returns a sample sdk.Coins
+func Coins() sdk.Coins {
+ return sdk.NewCoins(sdk.NewCoin(config.BaseDenom, sdk.NewInt(42)))
+}
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..058233bb77 100644
--- a/x/crosschain/client/cli/cli_cctx.go
+++ b/x/crosschain/client/cli/cli_cctx.go
@@ -99,14 +99,23 @@ func CmdCCTXInboundVoter() *cobra.Command {
}
amount := math.NewUintFromString(args[5])
+
argsMessage := args[6]
argsInTxHash := args[7]
+
argsInBlockHeight, err := strconv.ParseUint(args[8], 10, 64)
- argsCoinType := common.CoinType(common.CoinType_value[args[9]])
- argsAsset := args[10]
if err != nil {
return err
}
+
+ coinType, ok := common.CoinType_value[args[9]]
+ if !ok {
+ return fmt.Errorf("wrong coin type %s", args[9])
+ }
+ argsCoinType := common.CoinType(coinType)
+
+ argsAsset := args[10]
+
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
@@ -141,9 +150,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] [valueReceived] [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 +172,38 @@ 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]])
+ coinType, ok := common.CoinType_value[args[10]]
+ if !ok {
+ return fmt.Errorf("wrong coin type %s", args[10])
+ }
+ argsCoinType := common.CoinType(coinType)
+
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
@@ -197,6 +216,7 @@ func CmdCCTXOutboundVoter() *cobra.Command {
argsOutBlockHeight,
argsOutGasUsed,
argsOutEffectiveGasPrice,
+ argsOutEffectiveGasLimit,
math.NewUintFromString(argsMMint),
status,
chain,
diff --git a/x/crosschain/client/cli/cli_chain_nonce.go b/x/crosschain/client/cli/cli_chain_nonce.go
index e6add33648..dd1ddb2b0d 100644
--- a/x/crosschain/client/cli/cli_chain_nonce.go
+++ b/x/crosschain/client/cli/cli_chain_nonce.go
@@ -84,7 +84,7 @@ func CmdNonceVoter() *cobra.Command {
if err != nil {
return err
}
- argsNonce, err := strconv.Atoi(args[1])
+ argsNonce, err := strconv.ParseUint(args[1], 10, 64)
if err != nil {
return err
}
@@ -93,7 +93,7 @@ func CmdNonceVoter() *cobra.Command {
return err
}
- msg := types.NewMsgNonceVoter(clientCtx.GetFromAddress().String(), argsChain, uint64(argsNonce))
+ msg := types.NewMsgNonceVoter(clientCtx.GetFromAddress().String(), argsChain, argsNonce)
if err := msg.ValidateBasic(); err != nil {
return err
}
diff --git a/x/crosschain/client/cli/cli_out_tx_tracker.go b/x/crosschain/client/cli/cli_out_tx_tracker.go
index 87535ea0be..fc87399818 100644
--- a/x/crosschain/client/cli/cli_out_tx_tracker.go
+++ b/x/crosschain/client/cli/cli_out_tx_tracker.go
@@ -58,14 +58,14 @@ func CmdShowOutTxTracker() *cobra.Command {
if err != nil {
return err
}
- argNonce, err := strconv.ParseInt(args[1], 10, 64)
+ argNonce, err := strconv.ParseUint(args[1], 10, 64)
if err != nil {
return err
}
params := &types.QueryGetOutTxTrackerRequest{
ChainID: argChain,
- Nonce: uint64(argNonce),
+ Nonce: argNonce,
}
res, err := queryClient.OutTxTracker(context.Background(), params)
@@ -94,7 +94,7 @@ func CmdAddToWatchList() *cobra.Command {
if err != nil {
return err
}
- argNonce, err := strconv.ParseInt(args[1], 10, 64)
+ argNonce, err := strconv.ParseUint(args[1], 10, 64)
if err != nil {
return err
}
@@ -108,8 +108,11 @@ func CmdAddToWatchList() *cobra.Command {
msg := types.NewMsgAddToOutTxTracker(
clientCtx.GetFromAddress().String(),
argChain,
- uint64(argNonce),
+ argNonce,
argTxHash,
+ nil, // TODO: add option to provide a proof from CLI arguments https://github.com/zeta-chain/node/issues/1134
+ "",
+ -1,
)
if err := msg.ValidateBasic(); err != nil {
return err
@@ -133,7 +136,7 @@ func CmdRemoveFromWatchList() *cobra.Command {
if err != nil {
return err
}
- argNonce, err := strconv.ParseInt(args[1], 10, 64)
+ argNonce, err := strconv.ParseUint(args[1], 10, 64)
if err != nil {
return err
}
@@ -146,7 +149,7 @@ func CmdRemoveFromWatchList() *cobra.Command {
msg := types.NewMsgRemoveFromOutTxTracker(
clientCtx.GetFromAddress().String(),
argChain,
- uint64(argNonce),
+ argNonce,
)
if err := msg.ValidateBasic(); err != nil {
return err
diff --git a/x/crosschain/client/cli/query.go b/x/crosschain/client/cli/query.go
index c247ee5bdb..e7ced83fe1 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..e86f1021c5 100644
--- a/x/crosschain/client/integrationtests/cli_helpers.go
+++ b/x/crosschain/client/integrationtests/cli_helpers.go
@@ -27,12 +27,6 @@ import (
"github.com/zeta-chain/zetacore/x/crosschain/client/cli"
)
-func MsgVoteOnObservedInboundTxExec(clientCtx client.Context, chain, obsType fmt.Stringer, extraArgs ...string) (testutil.BufferWriter, error) {
- args := []string{chain.String(), obsType.String()}
- args = append(args, extraArgs...)
- return clitestutil.ExecTestCLICmd(clientCtx, cli.CmdCCTXInboundVoter(), args)
-}
-
func TxSignExec(clientCtx client.Context, from fmt.Stringer, filename string, extraArgs ...string) (testutil.BufferWriter, error) {
args := []string{
fmt.Sprintf("--%s=%s", flags.FlagKeyringBackend, keyring.BackendTest),
@@ -128,7 +122,8 @@ func BuildSignedTssVote(t testing.TB, val *network.Validator, denom string, acco
return WriteToNewTempFile(t, res.String())
}
-func BuildSignedOutboundVote(t testing.TB, val *network.Validator, denom string, account authtypes.AccountI, cctxIndex, outTxHash, zetaminted, status string) *os.File {
+func BuildSignedOutboundVote(t testing.TB, val *network.Validator, denom string, account authtypes.AccountI, nonce uint64,
+ cctxIndex, outTxHash, valueReceived, status string) *os.File {
cmd := cli.CmdCCTXOutboundVoter()
outboundVoterArgs := []string{
cctxIndex,
@@ -136,11 +131,12 @@ func BuildSignedOutboundVote(t testing.TB, val *network.Validator, denom string,
"1",
"0",
"0",
- zetaminted,
+ "0",
+ valueReceived,
status,
strconv.FormatInt(common.GoerliChain().ChainId, 10),
- "1",
- "Gas",
+ strconv.FormatUint(nonce, 10),
+ "Zeta",
}
txArgs := []string{
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address),
@@ -171,7 +167,7 @@ func BuildSignedInboundVote(t testing.TB, val *network.Validator, denom string,
message,
"0x19398991572a825894b34b904ac1e3692720895351466b5c9e6bb7ae1e21d680",
"100",
- "Gas",
+ "Zeta",
"",
}
txArgs := []string{
@@ -203,15 +199,13 @@ func GetBallotIdentifier(message string) string {
"0x19398991572a825894b34b904ac1e3692720895351466b5c9e6bb7ae1e21d680",
100,
250_000,
- common.CoinType_Gas,
+ common.CoinType_Zeta,
"",
)
return msg.Digest()
}
-func GetBallotIdentifierOutBound(cctxindex, outtxHash, zetaminted string) string {
- math.NewUintFromString(zetaminted)
-
+func GetBallotIdentifierOutBound(nonce uint64, cctxindex, outtxHash, valueReceived string) string {
msg := types.NewMsgVoteOnObservedOutboundTx(
"",
cctxindex,
@@ -219,11 +213,12 @@ func GetBallotIdentifierOutBound(cctxindex, outtxHash, zetaminted string) string
1,
0,
math.ZeroInt(),
- math.NewUintFromString(zetaminted),
+ 0,
+ math.NewUintFromString(valueReceived),
0,
common.GoerliChain().ChainId,
- 1,
- common.CoinType_Gas,
+ nonce,
+ common.CoinType_Zeta,
)
return msg.Digest()
}
diff --git a/x/crosschain/client/integrationtests/inbound_voter_test.go b/x/crosschain/client/integrationtests/inbound_voter_test.go
index c78b990199..6305295b2a 100644
--- a/x/crosschain/client/integrationtests/inbound_voter_test.go
+++ b/x/crosschain/client/integrationtests/inbound_voter_test.go
@@ -129,8 +129,12 @@ func (s *IntegrationTestSuite) TestCCTXInboundVoter() {
test := test
s.Run(test.name, func() {
broadcaster := s.network.Validators[0]
+
+ // Vote the gas price
for _, val := range s.network.Validators {
out, err := clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetAccountCmd(), []string{val.Address.String(), "--output", "json"})
+ s.Require().NoError(err)
+
var account authtypes.AccountI
s.NoError(val.ClientCtx.Codec.UnmarshalInterfaceJSON(out.Bytes(), &account))
signedTx := BuildSignedGasPriceVote(s.T(), val, s.cfg.BondDenom, account)
@@ -138,8 +142,12 @@ func (s *IntegrationTestSuite) TestCCTXInboundVoter() {
s.Require().NoError(err)
}
s.Require().NoError(s.network.WaitForNBlocks(2))
+
+ // Vote the tss
for _, val := range s.network.Validators {
out, err := clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetAccountCmd(), []string{val.Address.String(), "--output", "json"})
+ s.Require().NoError(err)
+
var account authtypes.AccountI
s.NoError(val.ClientCtx.Codec.UnmarshalInterfaceJSON(out.Bytes(), &account))
signedTx := BuildSignedTssVote(s.T(), val, s.cfg.BondDenom, account)
@@ -147,6 +155,8 @@ func (s *IntegrationTestSuite) TestCCTXInboundVoter() {
s.Require().NoError(err)
}
s.Require().NoError(s.network.WaitForNBlocks(2))
+
+ // Vote the inbound tx
for _, val := range s.network.Validators {
vote := test.votes[val.Address.String()]
if vote == observerTypes.VoteType_NotYetVoted {
@@ -164,14 +174,16 @@ func (s *IntegrationTestSuite) TestCCTXInboundVoter() {
out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetBroadcastCommand(), []string{signedTx.Name(), "--broadcast-mode", "sync"})
s.Require().NoError(err)
}
-
s.Require().NoError(s.network.WaitForNBlocks(2))
+
+ // Get the ballot
ballotIdentifier := GetBallotIdentifier(test.name)
out, err := clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, observerCli.CmdBallotByIdentifier(), []string{ballotIdentifier, "--output", "json"})
s.Require().NoError(err)
ballot := observerTypes.QueryBallotByIdentifierResponse{}
s.NoError(broadcaster.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &ballot))
+ // Check the vote in the ballot
s.Assert().Equal(len(test.votes), len(ballot.Voters))
for _, vote := range ballot.Voters {
if test.votes[vote.VoterAddress] == observerTypes.VoteType_FailureObservation {
@@ -182,6 +194,7 @@ func (s *IntegrationTestSuite) TestCCTXInboundVoter() {
}
s.Assert().Equal(test.ballotResult, ballot.BallotStatus)
+ // Get the cctx and check its status
cctxIdentifier := ballotIdentifier
if test.falseBallotIdentifier != "" {
cctxIdentifier = test.falseBallotIdentifier
@@ -189,7 +202,6 @@ func (s *IntegrationTestSuite) TestCCTXInboundVoter() {
out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, crosschainCli.CmdShowSend(), []string{cctxIdentifier, "--output", "json"})
cctx := crosschaintypes.QueryGetCctxResponse{}
if test.cctxStatus == crosschaintypes.CctxStatus_PendingRevert {
- s.Require().Error(err)
s.Require().Contains(out.String(), "not found")
} else {
s.NoError(broadcaster.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &cctx))
diff --git a/x/crosschain/client/integrationtests/outbound_voter_test.go b/x/crosschain/client/integrationtests/outbound_voter_test.go
index dee7ea514e..92237b62b9 100644
--- a/x/crosschain/client/integrationtests/outbound_voter_test.go
+++ b/x/crosschain/client/integrationtests/outbound_voter_test.go
@@ -22,7 +22,7 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() {
tt := []struct {
name string
votes []Vote
- zetaMinted string // TODO : calculate this value
+ valueReceived string // TODO : calculate this value
correctBallotResult observerTypes.BallotStatus
cctxStatus crosschaintypes.CctxStatus
falseBallotIdentifier string
@@ -43,7 +43,7 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() {
},
correctBallotResult: observerTypes.BallotStatus_BallotFinalized_SuccessObservation,
cctxStatus: crosschaintypes.CctxStatus_OutboundMined,
- zetaMinted: "7991636132140714751",
+ valueReceived: "7991636132140714751",
},
{
name: "1 fake vote but ballot still success",
@@ -61,7 +61,7 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() {
},
correctBallotResult: observerTypes.BallotStatus_BallotFinalized_SuccessObservation,
cctxStatus: crosschaintypes.CctxStatus_OutboundMined,
- zetaMinted: "7990439496224753106",
+ valueReceived: "7990439496224753106",
},
{
name: "Half success and half false",
@@ -79,7 +79,7 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() {
},
correctBallotResult: observerTypes.BallotStatus_BallotInProgress,
cctxStatus: crosschaintypes.CctxStatus_PendingOutbound,
- zetaMinted: "7993442360774956232",
+ valueReceived: "7993442360774956232",
},
{
name: "Fake ballot has more votes outbound gets finalized",
@@ -97,7 +97,7 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() {
},
correctBallotResult: observerTypes.BallotStatus_BallotInProgress,
cctxStatus: crosschaintypes.CctxStatus_OutboundMined,
- zetaMinted: "7987124742653889020",
+ valueReceived: "7987124742653889020",
},
{
name: "5 success 5 Failed votes ",
@@ -115,13 +115,15 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() {
},
correctBallotResult: observerTypes.BallotStatus_BallotInProgress,
cctxStatus: crosschaintypes.CctxStatus_PendingOutbound,
- zetaMinted: "7991636132140714751",
+ valueReceived: "7991636132140714751",
},
}
for _, test := range tt {
test := test
s.Run(test.name, func() {
broadcaster := s.network.Validators[0]
+
+ // Vote the gas price
for _, val := range s.network.Validators {
out, err := clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetAccountCmd(), []string{val.Address.String(), "--output", "json"})
var account authtypes.AccountI
@@ -131,6 +133,8 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() {
s.Require().NoError(err)
}
s.Require().NoError(s.network.WaitForNBlocks(2))
+
+ // Vote the tss
for _, val := range s.network.Validators {
out, err := clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetAccountCmd(), []string{val.Address.String(), "--output", "json"})
var account authtypes.AccountI
@@ -140,6 +144,8 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() {
s.Require().NoError(err)
}
s.Require().NoError(s.network.WaitForNBlocks(2))
+
+ // Vote the inbound tx
for _, val := range s.network.Validators {
out, err := clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetAccountCmd(), []string{val.Address.String(), "--output", "json"})
var account authtypes.AccountI
@@ -149,14 +155,16 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() {
out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetBroadcastCommand(), []string{signedTx.Name(), "--broadcast-mode", "sync"})
s.Require().NoError(err)
}
-
s.Require().NoError(s.network.WaitForNBlocks(2))
+
+ // Get the ballot
cctxIdentifier := GetBallotIdentifier(test.name)
out, err := clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, crosschainCli.CmdShowSend(), []string{cctxIdentifier, "--output", "json"})
cctx := crosschaintypes.QueryGetCctxResponse{}
s.NoError(broadcaster.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &cctx))
s.Assert().Equal(crosschaintypes.CctxStatus_PendingOutbound, cctx.CrossChainTx.CctxStatus.Status)
-
+ nonce := cctx.CrossChainTx.GetCurrentOutTxParam().OutboundTxTssNonce
+ // Check the vote in the ballot and vote the outbound tx
fakeVotes := []string{}
for _, val := range s.network.Validators {
valVote := Vote{}
@@ -171,6 +179,7 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() {
out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetAccountCmd(), []string{val.Address.String(), "--output", "json"})
var account authtypes.AccountI
s.NoError(val.ClientCtx.Codec.UnmarshalInterfaceJSON(out.Bytes(), &account))
+
outTxhash := test.name
if valVote.isFakeVote {
outTxhash = outTxhash + "falseVote"
@@ -184,21 +193,27 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() {
votestring = "1"
}
- signedTx := BuildSignedOutboundVote(s.T(), val, s.cfg.BondDenom, account, cctxIdentifier, outTxhash, test.zetaMinted, votestring)
- out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetBroadcastCommand(), []string{signedTx.Name(), "--broadcast-mode", "sync"})
+ // Vote the outbound tx
+ signedTx := BuildSignedOutboundVote(s.T(), val, s.cfg.BondDenom, account, nonce, cctxIdentifier, outTxhash, test.valueReceived, votestring)
+ out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetBroadcastCommand(), []string{signedTx.Name(), "--broadcast-mode", "sync", "--output", "json"})
s.Require().NoError(err)
}
s.Require().NoError(s.network.WaitForNBlocks(2))
+
+ // Get the cctx
out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, crosschainCli.CmdShowSend(), []string{cctxIdentifier, "--output", "json"})
cctx = crosschaintypes.QueryGetCctxResponse{}
s.NoError(broadcaster.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &cctx))
s.Assert().Equal(test.cctxStatus, cctx.CrossChainTx.CctxStatus.Status)
- outboundBallotIdentifier := GetBallotIdentifierOutBound(cctxIdentifier, test.name, test.zetaMinted)
+
+ outboundBallotIdentifier := GetBallotIdentifierOutBound(nonce, cctxIdentifier, test.name, test.valueReceived)
+
out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, observerCli.CmdBallotByIdentifier(), []string{outboundBallotIdentifier, "--output", "json"})
s.Require().NoError(err)
ballot := observerTypes.QueryBallotByIdentifierResponse{}
s.NoError(broadcaster.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &ballot))
+ // Check the votes
s.Require().Equal(test.correctBallotResult, ballot.BallotStatus)
for _, vote := range test.votes {
for _, ballotvote := range ballot.Voters {
@@ -213,25 +228,22 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() {
}
}
if len(fakeVotes) > 0 {
- outboundFakeBallotIdentifier := GetBallotIdentifierOutBound(cctxIdentifier, test.name+"falseVote", test.zetaMinted)
+ outboundFakeBallotIdentifier := GetBallotIdentifierOutBound(nonce, cctxIdentifier, test.name+"falseVote", test.valueReceived)
out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, observerCli.CmdBallotByIdentifier(), []string{outboundFakeBallotIdentifier, "--output", "json"})
s.Require().NoError(err)
fakeBallot := observerTypes.QueryBallotByIdentifierResponse{}
s.NoError(broadcaster.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &fakeBallot))
for _, vote := range test.votes {
if vote.isFakeVote {
- for _, ballotvote := range fakeBallot.Voters {
- if vote.voterAddress == ballotvote.VoterAddress {
- s.Assert().Equal(vote.voteType, ballotvote.VoteType)
+ for _, ballotVote := range fakeBallot.Voters {
+ if vote.voterAddress == ballotVote.VoterAddress {
+ s.Assert().Equal(vote.voteType, ballotVote.VoteType)
break
}
}
}
}
-
}
-
})
-
}
}
diff --git a/x/crosschain/client/querytests/cctx.go b/x/crosschain/client/querytests/cctx.go
index 7125f9c6af..2cc4ef4d91 100644
--- a/x/crosschain/client/querytests/cctx.go
+++ b/x/crosschain/client/querytests/cctx.go
@@ -34,6 +34,7 @@ func (s *CliTestSuite) TestListCCTX() {
s.Run("ByOffset", func() {
step := 2
for i := 0; i < len(objs); i += step {
+ // #nosec G701 always in range
args := request(nil, uint64(i), uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListSend(), args)
s.Require().NoError(err)
@@ -48,6 +49,7 @@ func (s *CliTestSuite) TestListCCTX() {
step := 2
var next []byte
for i := 0; i < len(objs); i += step {
+ // #nosec G701 always in range
args := request(next, 0, uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListSend(), args)
s.Require().NoError(err)
@@ -66,6 +68,7 @@ func (s *CliTestSuite) TestListCCTX() {
var resp types.QueryAllCctxResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NoError(err)
+ // #nosec G701 always in range
s.Require().Equal(len(objs), int(resp.Pagination.Total))
s.Require().Equal(objs, resp.CrossChainTx)
})
diff --git a/x/crosschain/client/querytests/chain_nonces.go b/x/crosschain/client/querytests/chain_nonces.go
index a3bab5c4ed..0e42078974 100644
--- a/x/crosschain/client/querytests/chain_nonces.go
+++ b/x/crosschain/client/querytests/chain_nonces.go
@@ -79,6 +79,7 @@ func (s *CliTestSuite) TestListChainNonces() {
s.Run("ByOffset", func() {
step := 2
for i := 0; i < len(objs); i += step {
+ // #nosec G701 always in range
args := request(nil, uint64(i), uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListChainNonces(), args)
s.Require().NoError(err)
@@ -93,6 +94,7 @@ func (s *CliTestSuite) TestListChainNonces() {
step := 2
var next []byte
for i := 0; i < len(objs); i += step {
+ // #nosec G701 always in range
args := request(next, 0, uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListChainNonces(), args)
s.Require().NoError(err)
@@ -105,12 +107,14 @@ func (s *CliTestSuite) TestListChainNonces() {
}
})
s.Run("Total", func() {
+ // #nosec G701 always in range
args := request(nil, 0, uint64(len(objs)), true)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListChainNonces(), args)
s.Require().NoError(err)
var resp types.QueryAllChainNoncesResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NoError(err)
+ // #nosec G701 always in range
s.Require().Equal(len(objs), int(resp.Pagination.Total))
s.Require().Equal(objs, resp.ChainNonces)
})
diff --git a/x/crosschain/client/querytests/gas_price.go b/x/crosschain/client/querytests/gas_price.go
index 077733702d..b4ac9ec62f 100644
--- a/x/crosschain/client/querytests/gas_price.go
+++ b/x/crosschain/client/querytests/gas_price.go
@@ -79,6 +79,7 @@ func (s *CliTestSuite) TestListGasPrice() {
s.Run("ByOffset", func() {
step := 2
for i := 0; i < len(objs); i += step {
+ // #nosec G701 always in range
args := request(nil, uint64(i), uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListGasPrice(), args)
s.Require().NoError(err)
@@ -93,6 +94,7 @@ func (s *CliTestSuite) TestListGasPrice() {
step := 2
var next []byte
for i := 0; i < len(objs); i += step {
+ // #nosec G701 always in range
args := request(next, 0, uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListGasPrice(), args)
s.Require().NoError(err)
@@ -105,12 +107,14 @@ func (s *CliTestSuite) TestListGasPrice() {
}
})
s.Run("Total", func() {
+ // #nosec G701 always in range
args := request(nil, 0, uint64(len(objs)), true)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListGasPrice(), args)
s.Require().NoError(err)
var resp types.QueryAllGasPriceResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NoError(err)
+ // #nosec G701 always in range
s.Require().Equal(len(objs), int(resp.Pagination.Total))
s.Require().Equal(objs, resp.GasPrice)
})
diff --git a/x/crosschain/client/querytests/intx_hash.go b/x/crosschain/client/querytests/intx_hash.go
index 989822aecc..0c7c4b6321 100644
--- a/x/crosschain/client/querytests/intx_hash.go
+++ b/x/crosschain/client/querytests/intx_hash.go
@@ -91,6 +91,7 @@ func (s *CliTestSuite) TestListInTxHashToCctx() {
s.Run("ByOffset", func() {
step := 2
for i := 0; i < len(objs); i += step {
+ // #nosec G701 always in range
args := request(nil, uint64(i), uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListInTxHashToCctx(), args)
s.Require().NoError(err)
@@ -106,6 +107,7 @@ func (s *CliTestSuite) TestListInTxHashToCctx() {
step := 2
var next []byte
for i := 0; i < len(objs); i += step {
+ // #nosec G701 always in range
args := request(next, 0, uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListInTxHashToCctx(), args)
s.Require().NoError(err)
@@ -119,6 +121,7 @@ func (s *CliTestSuite) TestListInTxHashToCctx() {
}
})
s.Run("Total", func() {
+ // #nosec G701 always in range
args := request(nil, 0, uint64(len(objs)), true)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListInTxHashToCctx(), args)
s.Require().NoError(err)
@@ -126,6 +129,7 @@ func (s *CliTestSuite) TestListInTxHashToCctx() {
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NoError(err)
// saving CCTX also adds a new mapping
+ // #nosec G701 always in range
s.Require().Equal(len(objs)+cctxCount, int(resp.Pagination.Total))
s.Require().ElementsMatch(nullify.Fill(objs),
nullify.Fill(resp.InTxHashToCctx),
diff --git a/x/crosschain/client/querytests/last_block_height.go b/x/crosschain/client/querytests/last_block_height.go
index c6116d268e..d100715048 100644
--- a/x/crosschain/client/querytests/last_block_height.go
+++ b/x/crosschain/client/querytests/last_block_height.go
@@ -79,6 +79,7 @@ func (s *CliTestSuite) TestListLastBlockHeight() {
s.Run("ByOffset", func() {
step := 2
for i := 0; i < len(objs); i += step {
+ // #nosec G701 always in range
args := request(nil, uint64(i), uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListLastBlockHeight(), args)
s.Require().NoError(err)
@@ -93,6 +94,7 @@ func (s *CliTestSuite) TestListLastBlockHeight() {
step := 2
var next []byte
for i := 0; i < len(objs); i += step {
+ // #nosec G701 always in range
args := request(next, 0, uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListLastBlockHeight(), args)
s.Require().NoError(err)
@@ -105,12 +107,14 @@ func (s *CliTestSuite) TestListLastBlockHeight() {
}
})
s.Run("Total", func() {
+ // #nosec G701 always in range
args := request(nil, 0, uint64(len(objs)), true)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListLastBlockHeight(), args)
s.Require().NoError(err)
var resp types.QueryAllLastBlockHeightResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NoError(err)
+ // #nosec G701 always in range
s.Require().Equal(len(objs), int(resp.Pagination.Total))
s.Require().Equal(objs, resp.LastBlockHeight)
})
diff --git a/x/crosschain/client/querytests/out_tx_tracker.go b/x/crosschain/client/querytests/out_tx_tracker.go
index 119970612a..85f00522f7 100644
--- a/x/crosschain/client/querytests/out_tx_tracker.go
+++ b/x/crosschain/client/querytests/out_tx_tracker.go
@@ -32,6 +32,7 @@ func (s *CliTestSuite) TestListOutTxTracker() {
s.Run("ByOffset", func() {
step := 2
for i := 0; i < len(objs); i += step {
+ // #nosec G701 always in range
args := request(nil, uint64(i), uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListOutTxTracker(), args)
s.Require().NoError(err)
@@ -47,6 +48,7 @@ func (s *CliTestSuite) TestListOutTxTracker() {
step := 2
var next []byte
for i := 0; i < len(objs); i += step {
+ // #nosec G701 always in range
args := request(next, 0, uint64(step), false)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListOutTxTracker(), args)
s.Require().NoError(err)
@@ -61,12 +63,14 @@ func (s *CliTestSuite) TestListOutTxTracker() {
}
})
s.Run("Total", func() {
+ // #nosec G701 always in range
args := request(nil, 0, uint64(len(objs)), true)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdListOutTxTracker(), args)
s.Require().NoError(err)
var resp types.QueryAllOutTxTrackerResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
s.Require().NoError(err)
+ // #nosec G701 always in range
s.Require().Equal(len(objs), int(resp.Pagination.Total))
s.Require().ElementsMatch(nullify.Fill(objs),
nullify.Fill(resp.OutTxTracker),
diff --git a/x/crosschain/genesis_test.go b/x/crosschain/genesis_test.go
index af745a938d..994c83f67a 100644
--- a/x/crosschain/genesis_test.go
+++ b/x/crosschain/genesis_test.go
@@ -48,7 +48,7 @@ func TestGenesis(t *testing.T) {
}
// Init and export
- k, ctx := keepertest.CrosschainKeeper(t)
+ k, ctx, _, _ := keepertest.CrosschainKeeper(t)
crosschain.InitGenesis(ctx, *k, genesisState)
got := crosschain.ExportGenesis(ctx, *k)
require.NotNil(t, got)
diff --git a/x/crosschain/keeper/abci.go b/x/crosschain/keeper/abci.go
new file mode 100644
index 0000000000..6ad3b8cd6d
--- /dev/null
+++ b/x/crosschain/keeper/abci.go
@@ -0,0 +1,117 @@
+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"
+ observertypes "github.com/zeta-chain/zetacore/x/observer/types"
+)
+
+const (
+ // RemainingFeesToStabilityPoolPercent is the percentage of remaining fees used to fund the gas stability pool
+ 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 {
+ // fetch the gas price increase flags or use default
+ gasPriceIncreaseFlags := observertypes.DefaultGasPriceIncreaseFlags
+ crosschainFlags, found := k.zetaObserverKeeper.GetCrosschainFlags(ctx)
+ if found && crosschainFlags.GasPriceIncreaseFlags != nil {
+ gasPriceIncreaseFlags = *crosschainFlags.GasPriceIncreaseFlags
+ }
+
+ // skip if haven't reached epoch end
+ if ctx.BlockHeight()%gasPriceIncreaseFlags.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: 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, gasPriceIncreaseFlags)
+ 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,
+ flags observertypes.GasPriceIncreaseFlags,
+) (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(flags.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(uint64(flags.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..383d77e6fb
--- /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/types"
+ observertypes "github.com/zeta-chain/zetacore/x/observer/types"
+)
+
+func TestKeeper_CheckAndUpdateCctxGasPrice(t *testing.T) {
+ sampleTimestamp := time.Now()
+ retryIntervalReached := sampleTimestamp.Add(observertypes.DefaultGasPriceIncreaseFlags.RetryInterval + time.Second)
+ retryIntervalNotReached := sampleTimestamp.Add(observertypes.DefaultGasPriceIncreaseFlags.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, observertypes.DefaultGasPriceIncreaseFlags)
+
+ 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/cctx_utils.go b/x/crosschain/keeper/cctx_utils.go
new file mode 100644
index 0000000000..b04b79a9b5
--- /dev/null
+++ b/x/crosschain/keeper/cctx_utils.go
@@ -0,0 +1,88 @@
+package keeper
+
+import (
+ "errors"
+ "fmt"
+
+ "cosmossdk.io/math"
+
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
+ ethcommon "github.com/ethereum/go-ethereum/common"
+ "github.com/zeta-chain/zetacore/common"
+ "github.com/zeta-chain/zetacore/x/crosschain/types"
+ zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types"
+)
+
+// UpdateNonce sets the CCTX outbound nonce to the next nonce, and updates the nonce of blockchain state.
+// It also updates the PendingNonces that is used to track the unfulfilled outbound txs.
+func (k Keeper) UpdateNonce(ctx sdk.Context, receiveChainID int64, cctx *types.CrossChainTx) error {
+ chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(receiveChainID)
+ if chain == nil {
+ return zetaObserverTypes.ErrSupportedChains
+ }
+
+ nonce, found := k.GetChainNonces(ctx, chain.ChainName.String())
+ if !found {
+ return sdkerrors.Wrap(types.ErrCannotFindReceiverNonce, fmt.Sprintf("Chain(%s) | Identifiers : %s ", chain.ChainName.String(), cctx.LogIdentifierForCCTX()))
+ }
+
+ // SET nonce
+ cctx.GetCurrentOutTxParam().OutboundTxTssNonce = nonce.Nonce
+ tss, found := k.GetTSS(ctx)
+ if !found {
+ return sdkerrors.Wrap(types.ErrCannotFindTSSKeys, fmt.Sprintf("Chain(%s) | Identifiers : %s ", chain.ChainName.String(), cctx.LogIdentifierForCCTX()))
+ }
+
+ p, found := k.GetPendingNonces(ctx, tss.TssPubkey, receiveChainID)
+ if !found {
+ return sdkerrors.Wrap(types.ErrCannotFindPendingNonces, fmt.Sprintf("chain_id %d, nonce %d", receiveChainID, nonce.Nonce))
+ }
+
+ // #nosec G701 always in range
+ if p.NonceHigh != int64(nonce.Nonce) {
+ return sdkerrors.Wrap(types.ErrNonceMismatch, fmt.Sprintf("chain_id %d, high nonce %d, current nonce %d", receiveChainID, p.NonceHigh, nonce.Nonce))
+ }
+
+ nonce.Nonce++
+ p.NonceHigh++
+ k.SetChainNonces(ctx, nonce)
+ k.SetPendingNonces(ctx, p)
+ return nil
+}
+
+// RefundAmountOnZetaChain refunds the amount of the cctx on ZetaChain in case of aborted cctx
+// NOTE: GetCurrentOutTxParam should contain the last up to date cctx amount
+func (k Keeper) RefundAmountOnZetaChain(ctx sdk.Context, cctx types.CrossChainTx, inputAmount math.Uint) error {
+ // preliminary checks
+ if cctx.InboundTxParams.CoinType != common.CoinType_ERC20 {
+ return errors.New("unsupported coin type for refund on ZetaChain")
+ }
+ if !common.IsEVMChain(cctx.InboundTxParams.SenderChainId) {
+ return errors.New("only EVM chains are supported for refund on ZetaChain")
+ }
+ sender := ethcommon.HexToAddress(cctx.InboundTxParams.Sender)
+ if sender == (ethcommon.Address{}) {
+ return errors.New("invalid sender address")
+ }
+ if inputAmount.IsNil() || inputAmount.IsZero() {
+ return errors.New("no amount to refund")
+ }
+
+ // get address of the zrc20
+ fc, found := k.fungibleKeeper.GetForeignCoinFromAsset(ctx, cctx.InboundTxParams.Asset, cctx.InboundTxParams.SenderChainId)
+ if !found {
+ return fmt.Errorf("asset %s zrc not found", cctx.InboundTxParams.Asset)
+ }
+ zrc20 := ethcommon.HexToAddress(fc.Zrc20ContractAddress)
+ if zrc20 == (ethcommon.Address{}) {
+ return fmt.Errorf("asset %s invalid zrc address", cctx.InboundTxParams.Asset)
+ }
+
+ // deposit the amount to the sender
+ if _, err := k.fungibleKeeper.DepositZRC20(ctx, zrc20, sender, inputAmount.BigInt()); err != nil {
+ return errors.New("failed to deposit zrc20 on ZetaChain" + err.Error())
+ }
+
+ return nil
+}
diff --git a/x/crosschain/keeper/cctx_utils_test.go b/x/crosschain/keeper/cctx_utils_test.go
new file mode 100644
index 0000000000..bdeb9eff4d
--- /dev/null
+++ b/x/crosschain/keeper/cctx_utils_test.go
@@ -0,0 +1,140 @@
+package keeper_test
+
+import (
+ "testing"
+
+ "cosmossdk.io/math"
+
+ "github.com/stretchr/testify/require"
+ "github.com/zeta-chain/zetacore/common"
+ keepertest "github.com/zeta-chain/zetacore/testutil/keeper"
+ "github.com/zeta-chain/zetacore/testutil/sample"
+ "github.com/zeta-chain/zetacore/x/crosschain/types"
+ fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types"
+)
+
+func TestKeeper_RefundAmountOnZetaChain(t *testing.T) {
+ t.Run("should refund amount on zeta chain", func(t *testing.T) {
+ k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName)
+ asset := sample.EthAddress().String()
+ sender := sample.EthAddress()
+ chainID := getValidEthChainID(t)
+
+ // deploy zrc20
+ deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper)
+ zrc20Addr := deployZRC20(
+ t,
+ ctx,
+ zk.FungibleKeeper,
+ sdkk.EvmKeeper,
+ chainID,
+ "bar",
+ asset,
+ "bar",
+ )
+
+ err := k.RefundAmountOnZetaChain(ctx, types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: common.CoinType_ERC20,
+ SenderChainId: chainID,
+ Sender: sender.String(),
+ Asset: asset,
+ }},
+ math.NewUint(42),
+ )
+ require.NoError(t, err)
+
+ // check amount deposited in balance
+ balance, err := zk.FungibleKeeper.BalanceOfZRC4(ctx, zrc20Addr, sender)
+ require.NoError(t, err)
+ require.Equal(t, uint64(42), balance.Uint64())
+
+ // can refund again
+ err = k.RefundAmountOnZetaChain(ctx, types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: common.CoinType_ERC20,
+ SenderChainId: chainID,
+ Sender: sender.String(),
+ Asset: asset,
+ }},
+ math.NewUint(42),
+ )
+ require.NoError(t, err)
+ balance, err = zk.FungibleKeeper.BalanceOfZRC4(ctx, zrc20Addr, sender)
+ require.NoError(t, err)
+ require.Equal(t, uint64(84), balance.Uint64())
+ })
+
+ t.Run("should fail with invalid cctx", func(t *testing.T) {
+ k, ctx, _, _ := keepertest.CrosschainKeeper(t)
+
+ err := k.RefundAmountOnZetaChain(ctx, types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: common.CoinType_Zeta,
+ }},
+ math.NewUint(42),
+ )
+ require.ErrorContains(t, err, "unsupported coin type")
+
+ err = k.RefundAmountOnZetaChain(ctx, types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: common.CoinType_Gas,
+ }},
+ math.NewUint(42),
+ )
+ require.ErrorContains(t, err, "unsupported coin type")
+
+ err = k.RefundAmountOnZetaChain(ctx, types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: common.CoinType_ERC20,
+ SenderChainId: 999999,
+ }},
+ math.NewUint(42),
+ )
+ require.ErrorContains(t, err, "only EVM chains are supported")
+
+ err = k.RefundAmountOnZetaChain(ctx, types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: common.CoinType_ERC20,
+ SenderChainId: getValidEthChainID(t),
+ Sender: "invalid",
+ }},
+ math.NewUint(42),
+ )
+ require.ErrorContains(t, err, "invalid sender address")
+
+ err = k.RefundAmountOnZetaChain(ctx, types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: common.CoinType_ERC20,
+ SenderChainId: getValidEthChainID(t),
+ Sender: sample.EthAddress().String(),
+ },
+ },
+ math.Uint{},
+ )
+ require.ErrorContains(t, err, "no amount to refund")
+
+ err = k.RefundAmountOnZetaChain(ctx, types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: common.CoinType_ERC20,
+ SenderChainId: getValidEthChainID(t),
+ Sender: sample.EthAddress().String(),
+ }},
+ math.ZeroUint(),
+ )
+ require.ErrorContains(t, err, "no amount to refund")
+
+ // the foreign coin has not been set
+ err = k.RefundAmountOnZetaChain(ctx, types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: common.CoinType_ERC20,
+ SenderChainId: getValidEthChainID(t),
+ Sender: sample.EthAddress().String(),
+ Asset: sample.EthAddress().String(),
+ }},
+ math.NewUint(42),
+ )
+ require.ErrorContains(t, err, "zrc not found")
+ })
+}
diff --git a/x/crosschain/keeper/events.go b/x/crosschain/keeper/events.go
index 3306b7d1f8..2f6a88908c 100644
--- a/x/crosschain/keeper/events.go
+++ b/x/crosschain/keeper/events.go
@@ -61,11 +61,11 @@ func EmitZetaWithdrawCreated(ctx sdk.Context, cctx types.CrossChainTx) {
func EmitOutboundSuccess(ctx sdk.Context, msg *types.MsgVoteOnObservedOutboundTx, oldStatus string, newStatus string, cctx types.CrossChainTx) {
err := ctx.EventManager().EmitTypedEvents(&types.EventOutboundSuccess{
- MsgTypeUrl: sdk.MsgTypeURL(&types.MsgVoteOnObservedOutboundTx{}),
- CctxIndex: cctx.Index,
- ZetaMinted: msg.ZetaMinted.String(),
- OldStatus: oldStatus,
- NewStatus: newStatus,
+ MsgTypeUrl: sdk.MsgTypeURL(&types.MsgVoteOnObservedOutboundTx{}),
+ CctxIndex: cctx.Index,
+ ValueReceived: msg.ValueReceived.String(),
+ OldStatus: oldStatus,
+ NewStatus: newStatus,
})
if err != nil {
ctx.Logger().Error("Error emitting MsgVoteOnObservedOutboundTx :", err)
@@ -75,11 +75,11 @@ func EmitOutboundSuccess(ctx sdk.Context, msg *types.MsgVoteOnObservedOutboundTx
func EmitOutboundFailure(ctx sdk.Context, msg *types.MsgVoteOnObservedOutboundTx, oldStatus string, newStatus string, cctx types.CrossChainTx) {
err := ctx.EventManager().EmitTypedEvents(&types.EventOutboundFailure{
- MsgTypeUrl: sdk.MsgTypeURL(&types.MsgVoteOnObservedOutboundTx{}),
- CctxIndex: cctx.Index,
- ZetaMinted: msg.ZetaMinted.String(),
- OldStatus: oldStatus,
- NewStatus: newStatus,
+ MsgTypeUrl: sdk.MsgTypeURL(&types.MsgVoteOnObservedOutboundTx{}),
+ CctxIndex: cctx.Index,
+ ValueReceived: msg.ValueReceived.String(),
+ OldStatus: oldStatus,
+ NewStatus: newStatus,
})
if err != nil {
ctx.Logger().Error("Error emitting MsgVoteOnObservedOutboundTx :", err)
diff --git a/x/crosschain/keeper/evm_deposit.go b/x/crosschain/keeper/evm_deposit.go
index 15cc9a8fa4..ee6620c950 100644
--- a/x/crosschain/keeper/evm_deposit.go
+++ b/x/crosschain/keeper/evm_deposit.go
@@ -24,6 +24,7 @@ func (k msgServer) HandleEVMDeposit(ctx sdk.Context, cctx *types.CrossChainTx, m
hash := tmbytes.HexBytes(tmtypes.Tx(ctx.TxBytes()).Hash())
ethTxHash = ethcommon.BytesToHash(hash)
cctx.GetCurrentOutTxParam().OutboundTxHash = ethTxHash.String()
+ // #nosec G701 always positive
cctx.GetCurrentOutTxParam().OutboundTxObservedExternalHeight = uint64(ctx.BlockHeight())
}
diff --git a/x/crosschain/keeper/evm_hooks.go b/x/crosschain/keeper/evm_hooks.go
index 260df6dc3a..a9779766d8 100644
--- a/x/crosschain/keeper/evm_hooks.go
+++ b/x/crosschain/keeper/evm_hooks.go
@@ -4,10 +4,12 @@ import (
"bytes"
"encoding/hex"
"fmt"
+ "math/big"
"strings"
errorsmod "cosmossdk.io/errors"
"cosmossdk.io/math"
+ "github.com/btcsuite/btcutil"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
@@ -79,9 +81,6 @@ func (k Keeper) PostTxProcessing(
// from registered ZRC20 contract, new CCTX will be created to trigger and track outbound
// transaction.
func (k Keeper) ProcessLogs(ctx sdk.Context, logs []*ethtypes.Log, emittingContract ethcommon.Address, txOrigin string) error {
- if !k.zetaObserverKeeper.IsInboundEnabled(ctx) {
- return types.ErrNotEnoughPermissions
- }
system, found := k.fungibleKeeper.GetSystemContract(ctx)
if !found {
return fmt.Errorf("cannot find system contract")
@@ -111,6 +110,9 @@ func (k Keeper) ProcessLogs(ctx sdk.Context, logs []*ethtypes.Log, emittingContr
// ProcessZRC20WithdrawalEvent creates a new CCTX to process the withdrawal event
// error indicates system error and non-recoverable; should abort
func (k Keeper) ProcessZRC20WithdrawalEvent(ctx sdk.Context, event *zrc20.ZRC20Withdrawal, emittingContract ethcommon.Address, txOrigin string) error {
+ if !k.zetaObserverKeeper.IsInboundEnabled(ctx) {
+ return types.ErrNotEnoughPermissions
+ }
ctx.Logger().Info("ZRC20 withdrawal to %s amount %d\n", hex.EncodeToString(event.To), event.Value)
tss, found := k.GetTSS(ctx)
if !found {
@@ -162,6 +164,9 @@ func (k Keeper) ProcessZRC20WithdrawalEvent(ctx sdk.Context, event *zrc20.ZRC20W
}
func (k Keeper) ProcessZetaSentEvent(ctx sdk.Context, event *connectorzevm.ZetaConnectorZEVMZetaSent, emittingContract ethcommon.Address, txOrigin string) error {
+ if !k.zetaObserverKeeper.IsInboundEnabled(ctx) {
+ return types.ErrNotEnoughPermissions
+ }
ctx.Logger().Info(fmt.Sprintf(
"Zeta withdrawal to %s amount %d to chain with chainId %d",
hex.EncodeToString(event.DestinationAddress),
@@ -219,8 +224,13 @@ func (k Keeper) ProcessZetaSentEvent(ctx sdk.Context, event *connectorzevm.ZetaC
// Create the CCTX
cctx := k.CreateNewCCTX(ctx, msg, sendHash, tss.TssPubkey, types.CctxStatus_PendingOutbound, &senderChain, receiverChain)
- // Pay gas in Zeta and update the amount for the cctx
- if err := k.PayGasInZetaAndUpdateCctx(ctx, receiverChain.ChainId, &cctx, true); err != nil {
+ if err := k.PayGasAndUpdateCctx(
+ ctx,
+ receiverChain.ChainId,
+ &cctx,
+ amount,
+ true,
+ ); err != nil {
return fmt.Errorf("ProcessWithdrawalEvent: pay gas failed: %s", err.Error())
}
@@ -256,10 +266,28 @@ func (k Keeper) ParseZRC20WithdrawalEvent(ctx sdk.Context, log ethtypes.Log) (*z
return nil, err
}
- _, found := k.fungibleKeeper.GetForeignCoins(ctx, event.Raw.Address.Hex())
+ coin, found := k.fungibleKeeper.GetForeignCoins(ctx, event.Raw.Address.Hex())
if !found {
return nil, fmt.Errorf("ParseZRC20WithdrawalEvent: cannot find foreign coin with contract address %s", event.Raw.Address.Hex())
}
+ chainID := coin.ForeignChainId
+ if common.IsBitcoinChain(chainID) {
+ if event.Value.Cmp(big.NewInt(0)) <= 0 {
+ return nil, fmt.Errorf("ParseZRC20WithdrawalEvent: invalid amount %s", event.Value.String())
+ }
+ btcChainParams, err := common.GetBTCChainParams(chainID)
+ if err != nil {
+ return nil, err
+ }
+ addr, err := btcutil.DecodeAddress(string(event.To), btcChainParams)
+ if err != nil {
+ return nil, fmt.Errorf("ParseZRC20WithdrawalEvent: invalid address %s: %s", event.To, err)
+ }
+ _, ok := addr.(*btcutil.AddressWitnessPubKeyHash)
+ if !ok {
+ return nil, fmt.Errorf("ParseZRC20WithdrawalEvent: invalid address %s (not P2WPKH address)", event.To)
+ }
+ }
return event, nil
}
diff --git a/x/crosschain/keeper/gas_payment.go b/x/crosschain/keeper/gas_payment.go
new file mode 100644
index 0000000000..9cd5e0f916
--- /dev/null
+++ b/x/crosschain/keeper/gas_payment.go
@@ -0,0 +1,352 @@
+package keeper
+
+import (
+ "errors"
+ "fmt"
+ "math/big"
+
+ cosmoserrors "cosmossdk.io/errors"
+ "cosmossdk.io/math"
+
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ ethcommon "github.com/ethereum/go-ethereum/common"
+ "github.com/zeta-chain/zetacore/cmd/zetacored/config"
+ "github.com/zeta-chain/zetacore/common"
+ "github.com/zeta-chain/zetacore/x/crosschain/types"
+ fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types"
+ zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types"
+)
+
+// PayGasAndUpdateCctx updates the outbound tx with the new amount after paying the gas fee
+// **Caller should feed temporary ctx into this function**
+func (k Keeper) PayGasAndUpdateCctx(
+ ctx sdk.Context,
+ chainID int64,
+ cctx *types.CrossChainTx,
+ inputAmount math.Uint,
+ noEthereumTxEvent bool,
+) error {
+ // Dispatch to the correct function based on the coin type
+ switch cctx.InboundTxParams.CoinType {
+ case common.CoinType_Zeta:
+ return k.PayGasInZetaAndUpdateCctx(ctx, chainID, cctx, inputAmount, noEthereumTxEvent)
+ case common.CoinType_Gas:
+ return k.PayGasNativeAndUpdateCctx(ctx, chainID, cctx, inputAmount)
+ case common.CoinType_ERC20:
+ return k.PayGasInERC20AndUpdateCctx(ctx, chainID, cctx, inputAmount, noEthereumTxEvent)
+ default:
+ // can't pay gas with coin type
+ return fmt.Errorf("can't pay gas with coin type %s", cctx.InboundTxParams.CoinType.String())
+ }
+}
+
+// ChainGasParams returns the params to calculates the fees for gas for a chain
+// tha gas address, the gas limit, gas price and protocol flat fee are returned
+func (k Keeper) ChainGasParams(
+ ctx sdk.Context,
+ chainID int64,
+) (gasZRC20 ethcommon.Address, gasLimit, gasPrice, protocolFee math.Uint, err error) {
+ gasZRC20, err = k.fungibleKeeper.QuerySystemContractGasCoinZRC20(ctx, big.NewInt(chainID))
+ if err != nil {
+ return gasZRC20, gasLimit, gasPrice, protocolFee, err
+ }
+
+ // get the gas limit
+ gasLimitQueried, err := k.fungibleKeeper.QueryGasLimit(ctx, gasZRC20)
+ if err != nil {
+ return gasZRC20, gasLimit, gasPrice, protocolFee, err
+ }
+ if gasLimitQueried == nil {
+ return gasZRC20, gasLimit, gasPrice, protocolFee, errors.New("gas limit is nil")
+ }
+ gasLimit = math.NewUintFromBigInt(gasLimitQueried)
+
+ // get the protocol flat fee
+ protocolFlatFeeQueried, err := k.fungibleKeeper.QueryProtocolFlatFee(ctx, gasZRC20)
+ if err != nil {
+ return gasZRC20, gasLimit, gasPrice, protocolFee, err
+ }
+ if protocolFlatFeeQueried == nil {
+ return gasZRC20, gasLimit, gasPrice, protocolFee, errors.New("protocol flat fee is nil")
+ }
+ protocolFee = math.NewUintFromBigInt(protocolFlatFeeQueried)
+
+ // get the gas price
+ gasPrice, isFound := k.GetMedianGasPriceInUint(ctx, chainID)
+ if !isFound {
+ return gasZRC20, gasLimit, gasPrice, protocolFee, types.ErrUnableToGetGasPrice
+ }
+
+ return
+}
+
+// PayGasNativeAndUpdateCctx updates the outbound tx with the new amount subtracting the gas fee
+// **Caller should feed temporary ctx into this function**
+func (k Keeper) PayGasNativeAndUpdateCctx(
+ ctx sdk.Context,
+ chainID int64,
+ cctx *types.CrossChainTx,
+ inputAmount math.Uint,
+) error {
+ // preliminary checks
+ if cctx.InboundTxParams.CoinType != common.CoinType_Gas {
+ return cosmoserrors.Wrapf(types.ErrInvalidCoinType, "can't pay gas in native gas with %s", cctx.InboundTxParams.CoinType.String())
+ }
+ if chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(chainID); chain == nil {
+ return zetaObserverTypes.ErrSupportedChains
+ }
+
+ // get gas params
+ _, gasLimit, gasPrice, protocolFlatFee, err := k.ChainGasParams(ctx, chainID)
+ if err != nil {
+ return cosmoserrors.Wrap(types.ErrCannotFindGasParams, err.Error())
+ }
+
+ // calculate the final gas fee
+ outTxGasFee := gasLimit.Mul(gasPrice).Add(protocolFlatFee)
+
+ // subtract the withdraw fee from the input amount
+ if outTxGasFee.GT(inputAmount) {
+ return cosmoserrors.Wrap(types.ErrNotEnoughGas, fmt.Sprintf("outTxGasFee(%s) more than available gas for tx (%s) | Identifiers : %s ",
+ outTxGasFee,
+ inputAmount,
+ cctx.LogIdentifierForCCTX()),
+ )
+ }
+ ctx.Logger().Info("Subtracting amount from inbound tx", "amount", inputAmount.String(), "fee", outTxGasFee.String())
+ newAmount := inputAmount.Sub(outTxGasFee)
+
+ // update cctx
+ cctx.GetCurrentOutTxParam().Amount = newAmount
+ cctx.GetCurrentOutTxParam().OutboundTxGasLimit = gasLimit.Uint64()
+ cctx.GetCurrentOutTxParam().OutboundTxGasPrice = gasPrice.String()
+
+ return nil
+}
+
+// PayGasInERC20AndUpdateCctx updates parameter cctx amount subtracting the gas fee
+// the gas fee in ERC20 is calculated by swapping ERC20 -> Zeta -> Gas
+// if the route is not available, the gas payment will fail
+// **Caller should feed temporary ctx into this function**
+func (k Keeper) PayGasInERC20AndUpdateCctx(
+ ctx sdk.Context,
+ chainID int64,
+ cctx *types.CrossChainTx,
+ inputAmount math.Uint,
+ noEthereumTxEvent bool,
+) error {
+ // preliminary checks
+ if cctx.InboundTxParams.CoinType != common.CoinType_ERC20 {
+ return cosmoserrors.Wrapf(types.ErrInvalidCoinType, "can't pay gas in erc20 with %s", cctx.InboundTxParams.CoinType.String())
+ }
+ if chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(chainID); chain == nil {
+ return zetaObserverTypes.ErrSupportedChains
+ }
+
+ // get gas params
+ gasZRC20, gasLimit, gasPrice, protocolFlatFee, err := k.ChainGasParams(ctx, chainID)
+ if err != nil {
+ return cosmoserrors.Wrap(types.ErrCannotFindGasParams, err.Error())
+ }
+ outTxGasFee := gasLimit.Mul(gasPrice).Add(protocolFlatFee)
+
+ // get address of the zrc20
+ fc, found := k.fungibleKeeper.GetForeignCoinFromAsset(ctx, cctx.InboundTxParams.Asset, chainID)
+ if !found {
+ return cosmoserrors.Wrapf(types.ErrForeignCoinNotFound, "zrc20 from asset %s not found", cctx.InboundTxParams.Asset)
+ }
+ zrc20 := ethcommon.HexToAddress(fc.Zrc20ContractAddress)
+ if zrc20 == (ethcommon.Address{}) {
+ return cosmoserrors.Wrapf(types.ErrForeignCoinNotFound, "zrc20 from asset %s invalid address", cctx.InboundTxParams.Asset)
+ }
+
+ // get the necessary ERC20 amount for gas
+ feeInZRC20, err := k.fungibleKeeper.QueryUniswapV2RouterGetZRC4ToZRC4AmountsIn(ctx, outTxGasFee.BigInt(), zrc20, gasZRC20)
+ if err != nil {
+ // NOTE: this is the first method that fails when a liquidity pool is not set for the gas ZRC20, so we return a specific error
+ return cosmoserrors.Wrap(types.ErrNoLiquidityPool, err.Error())
+ }
+
+ // subtract the withdraw fee from the input amount
+ if math.NewUintFromBigInt(feeInZRC20).GT(inputAmount) {
+ return cosmoserrors.Wrap(types.ErrNotEnoughGas, fmt.Sprintf("feeInZRC20(%s) more than available gas for tx (%s) | Identifiers : %s ",
+ feeInZRC20,
+ inputAmount,
+ cctx.LogIdentifierForCCTX()),
+ )
+ }
+ newAmount := inputAmount.Sub(math.NewUintFromBigInt(feeInZRC20))
+
+ // mint the amount of ERC20 to be burnt as gas fee
+ _, err = k.fungibleKeeper.DepositZRC20(ctx, zrc20, types.ModuleAddressEVM, feeInZRC20)
+ if err != nil {
+ return cosmoserrors.Wrap(fungibletypes.ErrContractCall, err.Error())
+ }
+ ctx.Logger().Info("Minted ERC20 for gas fee",
+ "zrc20", zrc20.Hex(),
+ "amount", feeInZRC20,
+ )
+
+ // approve the uniswapv2 router to spend the ERC20
+ routerAddress, err := k.fungibleKeeper.GetUniswapV2Router02Address(ctx)
+ if err != nil {
+ return cosmoserrors.Wrap(fungibletypes.ErrContractCall, err.Error())
+ }
+ err = k.fungibleKeeper.CallZRC20Approve(
+ ctx,
+ types.ModuleAddressEVM,
+ zrc20,
+ routerAddress,
+ feeInZRC20,
+ noEthereumTxEvent,
+ )
+ if err != nil {
+ return cosmoserrors.Wrap(fungibletypes.ErrContractCall, err.Error())
+ }
+
+ // swap the fee in ERC20 into gas passing through Zeta and burn the gas ZRC20
+ amounts, err := k.fungibleKeeper.CallUniswapV2RouterSwapExactTokensForTokens(
+ ctx,
+ types.ModuleAddressEVM,
+ types.ModuleAddressEVM,
+ feeInZRC20,
+ zrc20,
+ gasZRC20,
+ noEthereumTxEvent,
+ )
+ if err != nil {
+ return cosmoserrors.Wrap(fungibletypes.ErrContractCall, err.Error())
+ }
+ ctx.Logger().Info("CallUniswapV2RouterSwapExactTokensForTokens",
+ "zrc20AmountIn", amounts[0],
+ "gasAmountOut", amounts[2],
+ )
+ gasObtained := amounts[2]
+
+ // check if the final gas received after swap matches the gas fee defined
+ // if not there might be issues with the pool liquidity and it is safer from an accounting perspective to return an error
+ if gasObtained.Cmp(outTxGasFee.BigInt()) != 0 {
+ return cosmoserrors.Wrapf(types.ErrInvalidGasAmount, "gas obtained for burn (%s) not equal to gas fee(%s)", gasObtained, outTxGasFee)
+ }
+
+ // burn the gas ZRC20
+ err = k.fungibleKeeper.CallZRC20Burn(ctx, types.ModuleAddressEVM, gasZRC20, gasObtained, noEthereumTxEvent)
+ if err != nil {
+ return cosmoserrors.Wrap(fungibletypes.ErrContractCall, err.Error())
+ }
+ ctx.Logger().Info("Burning gas ZRC20",
+ "zrc20", gasZRC20.Hex(),
+ "amount", gasObtained,
+ )
+
+ // update cctx
+ cctx.GetCurrentOutTxParam().Amount = newAmount
+ cctx.GetCurrentOutTxParam().OutboundTxGasLimit = gasLimit.Uint64()
+ cctx.GetCurrentOutTxParam().OutboundTxGasPrice = gasPrice.String()
+
+ return nil
+}
+
+// PayGasInZetaAndUpdateCctx updates parameter cctx with the gas price and gas fee for the outbound tx;
+// it also makes a trade to fulfill the outbound tx gas fee in ZETA by swapping ZETA for some gas ZRC20 balances
+// The gas ZRC20 balance is subsequently burned to account for the expense of TSS address gas fee payment in the outbound tx.
+// zetaBurnt represents the amount of Zeta that has been burnt for the tx, the final amount for the tx is zetaBurnt - gasFee
+// **Caller should feed temporary ctx into this function**
+func (k Keeper) PayGasInZetaAndUpdateCctx(
+ ctx sdk.Context,
+ chainID int64,
+ cctx *types.CrossChainTx,
+ zetaBurnt math.Uint,
+ noEthereumTxEvent bool,
+) error {
+ // preliminary checks
+ if cctx.InboundTxParams.CoinType != common.CoinType_Zeta {
+ return cosmoserrors.Wrapf(types.ErrInvalidCoinType, "can't pay gas in zeta with %s", cctx.InboundTxParams.CoinType.String())
+ }
+ if chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(chainID); chain == nil {
+ return zetaObserverTypes.ErrSupportedChains
+ }
+
+ gasZRC20, err := k.fungibleKeeper.QuerySystemContractGasCoinZRC20(ctx, big.NewInt(chainID))
+ if err != nil {
+ return cosmoserrors.Wrap(err, "PayGasInZetaAndUpdateCctx: unable to get system contract gas coin")
+ }
+
+ // get the gas price
+ gasPrice, isFound := k.GetMedianGasPriceInUint(ctx, chainID)
+ if !isFound {
+ return cosmoserrors.Wrap(types.ErrUnableToGetGasPrice, fmt.Sprintf(" chain %d | Identifiers : %s ",
+ chainID,
+ cctx.LogIdentifierForCCTX()),
+ )
+ }
+ gasPrice = gasPrice.MulUint64(2) // overpays gas price by 2x
+
+ // get the gas fee in gas token
+ gasLimit := sdk.NewUint(cctx.GetCurrentOutTxParam().OutboundTxGasLimit)
+ outTxGasFee := gasLimit.Mul(gasPrice)
+
+ // get the gas fee in Zeta using system uniswapv2 pool wzeta/gasZRC20 and adding the protocol fee
+ outTxGasFeeInZeta, err := k.fungibleKeeper.QueryUniswapV2RouterGetZetaAmountsIn(ctx, outTxGasFee.BigInt(), gasZRC20)
+ if err != nil {
+ return cosmoserrors.Wrap(err, "PayGasInZetaAndUpdateCctx: unable to QueryUniswapv2RouterGetAmountsIn")
+ }
+ feeInZeta := types.GetProtocolFee().Add(math.NewUintFromBigInt(outTxGasFeeInZeta))
+
+ // reduce the amount of the outbound tx
+ if feeInZeta.GT(zetaBurnt) {
+ return cosmoserrors.Wrap(types.ErrNotEnoughZetaBurnt, fmt.Sprintf("feeInZeta(%s) more than zetaBurnt (%s) | Identifiers : %s ",
+ feeInZeta,
+ zetaBurnt,
+ cctx.LogIdentifierForCCTX()),
+ )
+ }
+ ctx.Logger().Info("Subtracting amount from inbound tx",
+ "amount", zetaBurnt.String(),
+ "feeInZeta", feeInZeta.String(),
+ )
+ newAmount := zetaBurnt.Sub(feeInZeta)
+
+ // ** The following logic converts the outTxGasFeeInZeta into gasZRC20 and burns it **
+ // swap the outTxGasFeeInZeta portion of zeta to the real gas ZRC20 and burn it, in a temporary context.
+ {
+ coins := sdk.NewCoins(sdk.NewCoin(config.BaseDenom, sdk.NewIntFromBigInt(feeInZeta.BigInt())))
+ err := k.bankKeeper.MintCoins(ctx, types.ModuleName, coins)
+ if err != nil {
+ return cosmoserrors.Wrap(err, "PayGasInZetaAndUpdateCctx: unable to mint coins")
+ }
+
+ amounts, err := k.fungibleKeeper.CallUniswapV2RouterSwapExactETHForToken(
+ ctx,
+ types.ModuleAddressEVM,
+ types.ModuleAddressEVM,
+ outTxGasFeeInZeta,
+ gasZRC20,
+ noEthereumTxEvent,
+ )
+ if err != nil {
+ return cosmoserrors.Wrap(err, "PayGasInZetaAndUpdateCctx: unable to CallUniswapv2RouterSwapExactETHForToken")
+ }
+
+ ctx.Logger().Info("gas fee", "outTxGasFee", outTxGasFee, "outTxGasFeeInZeta", outTxGasFeeInZeta)
+ ctx.Logger().Info("CallUniswapv2RouterSwapExactETHForToken",
+ "zetaAmountIn", amounts[0],
+ "zrc20AmountOut", amounts[1],
+ )
+ err = k.fungibleKeeper.CallZRC20Burn(ctx, types.ModuleAddressEVM, gasZRC20, amounts[1], noEthereumTxEvent)
+ if err != nil {
+ return cosmoserrors.Wrap(err, "PayGasInZetaAndUpdateCctx: unable to CallZRC20Burn")
+ }
+ }
+
+ // Update the cctx
+ cctx.GetCurrentOutTxParam().OutboundTxGasPrice = gasPrice.String()
+ cctx.GetCurrentOutTxParam().Amount = newAmount
+ if cctx.ZetaFees.IsNil() {
+ cctx.ZetaFees = feeInZeta
+ } else {
+ cctx.ZetaFees = cctx.ZetaFees.Add(feeInZeta)
+ }
+
+ return nil
+}
diff --git a/x/crosschain/keeper/gas_payment_test.go b/x/crosschain/keeper/gas_payment_test.go
new file mode 100644
index 0000000000..e917df3ea3
--- /dev/null
+++ b/x/crosschain/keeper/gas_payment_test.go
@@ -0,0 +1,806 @@
+package keeper_test
+
+import (
+ "math/big"
+ "testing"
+
+ "cosmossdk.io/math"
+
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
+ "github.com/ethereum/go-ethereum/common"
+ evmkeeper "github.com/evmos/ethermint/x/evm/keeper"
+ "github.com/stretchr/testify/require"
+ "github.com/zeta-chain/protocol-contracts/pkg/uniswap/v2-periphery/contracts/uniswapv2router02.sol"
+ "github.com/zeta-chain/zetacore/cmd/zetacored/config"
+ zetacommon "github.com/zeta-chain/zetacore/common"
+ testkeeper "github.com/zeta-chain/zetacore/testutil/keeper"
+ "github.com/zeta-chain/zetacore/testutil/sample"
+ "github.com/zeta-chain/zetacore/x/crosschain/types"
+ fungiblekeeper "github.com/zeta-chain/zetacore/x/fungible/keeper"
+ fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types"
+ observertypes "github.com/zeta-chain/zetacore/x/observer/types"
+)
+
+// get a valid chain id independently of the build flag
+func getValidEthChainID(t *testing.T) int64 {
+ list := zetacommon.DefaultChainsList()
+ require.True(t, len(list) > 1)
+ require.NotNil(t, list[1])
+ require.False(t, zetacommon.IsBitcoinChain(list[1].ChainId))
+
+ return list[1].ChainId
+}
+
+// assert that a contract has been deployed by checking stored code is non-empty.
+func assertContractDeployment(t *testing.T, k *evmkeeper.Keeper, ctx sdk.Context, contractAddress common.Address) {
+ acc := k.GetAccount(ctx, contractAddress)
+ require.NotNil(t, acc)
+
+ code := k.GetCode(ctx, common.BytesToHash(acc.CodeHash))
+ require.NotEmpty(t, code)
+}
+
+// deploySystemContracts deploys the system contracts and returns their addresses.
+func deploySystemContracts(
+ t *testing.T,
+ ctx sdk.Context,
+ k *fungiblekeeper.Keeper,
+ evmk *evmkeeper.Keeper,
+) (wzeta, uniswapV2Factory, uniswapV2Router, connector, systemContract common.Address) {
+ var err error
+
+ wzeta, err = k.DeployWZETA(ctx)
+ require.NoError(t, err)
+ require.NotEmpty(t, wzeta)
+ assertContractDeployment(t, evmk, ctx, wzeta)
+
+ uniswapV2Factory, err = k.DeployUniswapV2Factory(ctx)
+ require.NoError(t, err)
+ require.NotEmpty(t, uniswapV2Factory)
+ assertContractDeployment(t, evmk, ctx, uniswapV2Factory)
+
+ uniswapV2Router, err = k.DeployUniswapV2Router02(ctx, uniswapV2Factory, wzeta)
+ require.NoError(t, err)
+ require.NotEmpty(t, uniswapV2Router)
+ assertContractDeployment(t, evmk, ctx, uniswapV2Router)
+
+ connector, err = k.DeployConnectorZEVM(ctx, wzeta)
+ require.NoError(t, err)
+ require.NotEmpty(t, connector)
+ assertContractDeployment(t, evmk, ctx, connector)
+
+ systemContract, err = k.DeploySystemContract(ctx, wzeta, uniswapV2Factory, uniswapV2Router)
+ require.NoError(t, err)
+ require.NotEmpty(t, systemContract)
+ assertContractDeployment(t, evmk, ctx, systemContract)
+
+ return
+}
+
+// setupGasCoin is a helper function to setup the gas coin for testing
+func setupGasCoin(
+ t *testing.T,
+ ctx sdk.Context,
+ k *fungiblekeeper.Keeper,
+ evmk *evmkeeper.Keeper,
+ chainID int64,
+ assetName string,
+ symbol string,
+) (zrc20 common.Address) {
+ addr, err := k.SetupChainGasCoinAndPool(
+ ctx,
+ chainID,
+ assetName,
+ symbol,
+ 8,
+ )
+ require.NoError(t, err)
+ assertContractDeployment(t, evmk, ctx, addr)
+ return addr
+}
+
+// deployZRC20 deploys a ZRC20 contract and returns its address
+func deployZRC20(
+ t *testing.T,
+ ctx sdk.Context,
+ k *fungiblekeeper.Keeper,
+ evmk *evmkeeper.Keeper,
+ chainID int64,
+ assetName string,
+ assetAddress string,
+ symbol string,
+) (zrc20 common.Address) {
+ addr, err := k.DeployZRC20Contract(
+ ctx,
+ assetName,
+ symbol,
+ 8,
+ chainID,
+ 0,
+ assetAddress,
+ big.NewInt(21_000),
+ )
+ require.NoError(t, err)
+ assertContractDeployment(t, evmk, ctx, addr)
+ return addr
+}
+
+// setupZRC20Pool setup a Uniswap pool with liquidity for the pair zeta/asset
+func setupZRC20Pool(
+ t *testing.T,
+ ctx sdk.Context,
+ k *fungiblekeeper.Keeper,
+ bankKeeper bankkeeper.Keeper,
+ zrc20Addr common.Address,
+) {
+ routerAddress, err := k.GetUniswapV2Router02Address(ctx)
+ require.NoError(t, err)
+ routerABI, err := uniswapv2router02.UniswapV2Router02MetaData.GetAbi()
+ require.NoError(t, err)
+
+ // enough for the small numbers used in test
+ liquidityAmount := big.NewInt(1e17)
+
+ // mint some zrc20 and zeta
+ _, err = k.DepositZRC20(ctx, zrc20Addr, types.ModuleAddressEVM, liquidityAmount)
+ require.NoError(t, err)
+ err = bankKeeper.MintCoins(
+ ctx,
+ types.ModuleName,
+ sdk.NewCoins(sdk.NewCoin(config.BaseDenom, sdk.NewIntFromBigInt(liquidityAmount))),
+ )
+ require.NoError(t, err)
+
+ // approve the router to spend the zeta
+ err = k.CallZRC20Approve(
+ ctx,
+ types.ModuleAddressEVM,
+ zrc20Addr,
+ routerAddress,
+ liquidityAmount,
+ false,
+ )
+ require.NoError(t, err)
+
+ // add the liquidity
+ //function addLiquidityETH(
+ // address token,
+ // uint amountTokenDesired,
+ // uint amountTokenMin,
+ // uint amountETHMin,
+ // address to,
+ // uint deadline
+ //)
+ _, err = k.CallEVM(
+ ctx,
+ *routerABI,
+ types.ModuleAddressEVM,
+ routerAddress,
+ liquidityAmount,
+ big.NewInt(5_000_000),
+ true,
+ false,
+ "addLiquidityETH",
+ zrc20Addr,
+ liquidityAmount,
+ fungiblekeeper.BigIntZero,
+ fungiblekeeper.BigIntZero,
+ types.ModuleAddressEVM,
+ liquidityAmount,
+ )
+ require.NoError(t, err)
+}
+
+func setAdminPolicies(ctx sdk.Context, zk testkeeper.ZetaKeepers, admin string) {
+ params := zk.ObserverKeeper.GetParams(ctx)
+ params.AdminPolicy = []*observertypes.Admin_Policy{
+ {
+ PolicyType: observertypes.Policy_Type_group1,
+ Address: admin,
+ },
+ {
+ PolicyType: observertypes.Policy_Type_group2,
+ Address: admin,
+ },
+ }
+ zk.ObserverKeeper.SetParams(ctx, params)
+}
+
+var (
+ // gasLimit = big.NewInt(21_000) - value used in SetupChainGasCoinAndPool for gas limit initialization
+ withdrawFee uint64 = 1000
+ gasPrice uint64 = 2
+ inputAmount uint64 = 100000
+)
+
+func TestKeeper_PayGasNativeAndUpdateCctx(t *testing.T) {
+ t.Run("can pay gas in native gas", func(t *testing.T) {
+ k, ctx, sdkk, zk := testkeeper.CrosschainKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin)
+
+ // deploy gas coin and set fee params
+ chainID := getValidEthChainID(t)
+ deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper)
+ zrc20 := setupGasCoin(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper, chainID, "foobar", "foobar")
+ _, err := zk.FungibleKeeper.UpdateZRC20WithdrawFee(
+ sdk.UnwrapSDKContext(ctx),
+ fungibletypes.NewMsgUpdateZRC20WithdrawFee(admin, zrc20.String(), sdk.NewUint(withdrawFee)),
+ )
+ require.NoError(t, err)
+ k.SetGasPrice(ctx, types.GasPrice{
+ ChainId: chainID,
+ MedianIndex: 0,
+ Prices: []uint64{gasPrice},
+ })
+
+ // create a cctx reverted from zeta
+ cctx := types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: zetacommon.CoinType_Gas,
+ },
+ OutboundTxParams: []*types.OutboundTxParams{
+ {
+ ReceiverChainId: zetacommon.ZetaChain().ChainId,
+ },
+ {
+ ReceiverChainId: chainID,
+ },
+ },
+ }
+
+ // total fees must be 21000*2+1000=43000
+ // if the input amount of the cctx is 100000, the output amount must be 100000-43000=57000
+ err = k.PayGasNativeAndUpdateCctx(ctx, chainID, &cctx, math.NewUint(inputAmount))
+ require.NoError(t, err)
+ require.Equal(t, uint64(57000), cctx.GetCurrentOutTxParam().Amount.Uint64())
+ require.Equal(t, uint64(21_000), cctx.GetCurrentOutTxParam().OutboundTxGasLimit)
+ require.Equal(t, "2", cctx.GetCurrentOutTxParam().OutboundTxGasPrice)
+ })
+
+ t.Run("should fail if not coin type gas", func(t *testing.T) {
+ k, ctx, _, _ := testkeeper.CrosschainKeeper(t)
+ chainID := getValidEthChainID(t)
+ cctx := types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: zetacommon.CoinType_Zeta,
+ },
+ }
+ err := k.PayGasNativeAndUpdateCctx(ctx, chainID, &cctx, math.NewUint(inputAmount))
+ require.ErrorIs(t, err, types.ErrInvalidCoinType)
+ })
+
+ t.Run("should fail if chain is not supported", func(t *testing.T) {
+ k, ctx, _, _ := testkeeper.CrosschainKeeper(t)
+ cctx := types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: zetacommon.CoinType_Gas,
+ },
+ }
+ err := k.PayGasNativeAndUpdateCctx(ctx, 999999, &cctx, math.NewUint(inputAmount))
+ require.ErrorIs(t, err, observertypes.ErrSupportedChains)
+ })
+
+ t.Run("should fail if can't query the gas price", func(t *testing.T) {
+ k, ctx, sdkk, zk := testkeeper.CrosschainKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin)
+
+ // deploy gas coin and set fee params
+ chainID := getValidEthChainID(t)
+ deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper)
+ setupGasCoin(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper, chainID, "foobar", "foobar")
+
+ // create a cctx reverted from zeta
+ cctx := types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: zetacommon.CoinType_Gas,
+ },
+ OutboundTxParams: []*types.OutboundTxParams{
+ {
+ ReceiverChainId: zetacommon.ZetaChain().ChainId,
+ },
+ {
+ ReceiverChainId: chainID,
+ },
+ },
+ }
+
+ err := k.PayGasNativeAndUpdateCctx(ctx, chainID, &cctx, math.NewUint(inputAmount))
+ require.ErrorIs(t, err, types.ErrCannotFindGasParams)
+ })
+
+ t.Run("should fail if not enough amount for the fee", func(t *testing.T) {
+ k, ctx, sdkk, zk := testkeeper.CrosschainKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin)
+
+ // deploy gas coin and set fee params
+ chainID := getValidEthChainID(t)
+ deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper)
+ zrc20 := setupGasCoin(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper, chainID, "foobar", "foobar")
+ _, err := zk.FungibleKeeper.UpdateZRC20WithdrawFee(
+ sdk.UnwrapSDKContext(ctx),
+ fungibletypes.NewMsgUpdateZRC20WithdrawFee(admin, zrc20.String(), sdk.NewUint(withdrawFee)),
+ )
+ require.NoError(t, err)
+ k.SetGasPrice(ctx, types.GasPrice{
+ ChainId: chainID,
+ MedianIndex: 0,
+ Prices: []uint64{gasPrice},
+ })
+
+ cctx := types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: zetacommon.CoinType_Gas,
+ },
+ OutboundTxParams: []*types.OutboundTxParams{
+ {
+ ReceiverChainId: zetacommon.ZetaChain().ChainId,
+ },
+ {
+ ReceiverChainId: chainID,
+ },
+ },
+ }
+
+ // 42999 < 43000
+ err = k.PayGasNativeAndUpdateCctx(ctx, chainID, &cctx, math.NewUint(42999))
+ require.ErrorIs(t, err, types.ErrNotEnoughGas)
+ })
+}
+
+func TestKeeper_PayGasInERC20AndUpdateCctx(t *testing.T) {
+ t.Run("can pay gas in erc20", func(t *testing.T) {
+ k, ctx, sdkk, zk := testkeeper.CrosschainKeeper(t)
+
+ k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin)
+
+ // deploy gas coin, erc20 and set fee params
+ chainID := getValidEthChainID(t)
+ assetAddress := sample.EthAddress().String()
+ deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper)
+ gasZRC20 := setupGasCoin(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper, chainID, "foo", "foo")
+ zrc20Addr := deployZRC20(
+ t,
+ ctx,
+ zk.FungibleKeeper,
+ sdkk.EvmKeeper,
+ chainID,
+ "bar",
+ assetAddress,
+ "bar",
+ )
+ _, err := zk.FungibleKeeper.UpdateZRC20WithdrawFee(
+ sdk.UnwrapSDKContext(ctx),
+ fungibletypes.NewMsgUpdateZRC20WithdrawFee(admin, gasZRC20.String(), sdk.NewUint(withdrawFee)),
+ )
+ require.NoError(t, err)
+ k.SetGasPrice(ctx, types.GasPrice{
+ ChainId: chainID,
+ MedianIndex: 0,
+ Prices: []uint64{gasPrice},
+ })
+
+ setupZRC20Pool(
+ t,
+ ctx,
+ zk.FungibleKeeper,
+ sdkk.BankKeeper,
+ zrc20Addr,
+ )
+
+ // create a cctx reverted from zeta
+ cctx := types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: zetacommon.CoinType_ERC20,
+ Asset: assetAddress,
+ },
+ OutboundTxParams: []*types.OutboundTxParams{
+ {
+ ReceiverChainId: zetacommon.ZetaChain().ChainId,
+ },
+ {
+ ReceiverChainId: chainID,
+ },
+ },
+ }
+
+ // total fees in gas must be 21000*2+1000=43000
+ // we calculate what it represents in erc20
+ expectedInZeta, err := zk.FungibleKeeper.QueryUniswapV2RouterGetZetaAmountsIn(ctx, big.NewInt(43000), gasZRC20)
+ require.NoError(t, err)
+ expectedInZRC20, err := zk.FungibleKeeper.QueryUniswapV2RouterGetZRC4AmountsIn(ctx, expectedInZeta, zrc20Addr)
+ require.NoError(t, err)
+
+ err = k.PayGasInERC20AndUpdateCctx(ctx, chainID, &cctx, math.NewUint(inputAmount), false)
+ require.NoError(t, err)
+ require.Equal(t, inputAmount-expectedInZRC20.Uint64(), cctx.GetCurrentOutTxParam().Amount.Uint64())
+ require.Equal(t, uint64(21_000), cctx.GetCurrentOutTxParam().OutboundTxGasLimit)
+ require.Equal(t, "2", cctx.GetCurrentOutTxParam().OutboundTxGasPrice)
+ })
+
+ t.Run("should fail if not coin type erc20", func(t *testing.T) {
+ k, ctx, _, _ := testkeeper.CrosschainKeeper(t)
+ chainID := getValidEthChainID(t)
+ cctx := types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: zetacommon.CoinType_Gas,
+ },
+ }
+ err := k.PayGasInERC20AndUpdateCctx(ctx, chainID, &cctx, math.NewUint(inputAmount), false)
+ require.ErrorIs(t, err, types.ErrInvalidCoinType)
+ })
+
+ t.Run("should fail if chain is not supported", func(t *testing.T) {
+ k, ctx, _, _ := testkeeper.CrosschainKeeper(t)
+ cctx := types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: zetacommon.CoinType_ERC20,
+ },
+ }
+ err := k.PayGasInERC20AndUpdateCctx(ctx, 999999, &cctx, math.NewUint(inputAmount), false)
+ require.ErrorIs(t, err, observertypes.ErrSupportedChains)
+ })
+
+ t.Run("should fail if can't query the gas price", func(t *testing.T) {
+ k, ctx, sdkk, zk := testkeeper.CrosschainKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin)
+
+ // deploy gas coin and set fee params
+ chainID := getValidEthChainID(t)
+ deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper)
+ setupGasCoin(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper, chainID, "foobar", "foobar")
+
+ // create a cctx reverted from zeta
+ cctx := types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: zetacommon.CoinType_ERC20,
+ },
+ OutboundTxParams: []*types.OutboundTxParams{
+ {
+ ReceiverChainId: zetacommon.ZetaChain().ChainId,
+ },
+ {
+ ReceiverChainId: chainID,
+ },
+ },
+ }
+
+ err := k.PayGasInERC20AndUpdateCctx(ctx, chainID, &cctx, math.NewUint(inputAmount), false)
+ require.ErrorIs(t, err, types.ErrCannotFindGasParams)
+ })
+
+ t.Run("should fail if can't find the ZRC20", func(t *testing.T) {
+ k, ctx, sdkk, zk := testkeeper.CrosschainKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin)
+
+ // deploy gas coin, erc20 and set fee params
+ chainID := getValidEthChainID(t)
+ assetAddress := sample.EthAddress().String()
+ deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper)
+ gasZRC20 := setupGasCoin(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper, chainID, "foo", "foo")
+ _, err := zk.FungibleKeeper.UpdateZRC20WithdrawFee(
+ sdk.UnwrapSDKContext(ctx),
+ fungibletypes.NewMsgUpdateZRC20WithdrawFee(admin, gasZRC20.String(), sdk.NewUint(withdrawFee)),
+ )
+ require.NoError(t, err)
+ k.SetGasPrice(ctx, types.GasPrice{
+ ChainId: chainID,
+ MedianIndex: 0,
+ Prices: []uint64{gasPrice},
+ })
+
+ // zrc20 not deployed
+
+ // create a cctx reverted from zeta
+ cctx := types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: zetacommon.CoinType_ERC20,
+ Asset: assetAddress,
+ },
+ OutboundTxParams: []*types.OutboundTxParams{
+ {
+ ReceiverChainId: zetacommon.ZetaChain().ChainId,
+ },
+ {
+ ReceiverChainId: chainID,
+ },
+ },
+ }
+
+ err = k.PayGasInERC20AndUpdateCctx(ctx, chainID, &cctx, math.NewUint(inputAmount), false)
+ require.ErrorIs(t, err, types.ErrForeignCoinNotFound)
+ })
+
+ t.Run("should fail if liquidity pool not setup", func(t *testing.T) {
+ k, ctx, sdkk, zk := testkeeper.CrosschainKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin)
+
+ // deploy gas coin, erc20 and set fee params
+ chainID := getValidEthChainID(t)
+ assetAddress := sample.EthAddress().String()
+ deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper)
+ gasZRC20 := setupGasCoin(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper, chainID, "foo", "foo")
+ deployZRC20(
+ t,
+ ctx,
+ zk.FungibleKeeper,
+ sdkk.EvmKeeper,
+ chainID,
+ "bar",
+ assetAddress,
+ "bar",
+ )
+ _, err := zk.FungibleKeeper.UpdateZRC20WithdrawFee(
+ sdk.UnwrapSDKContext(ctx),
+ fungibletypes.NewMsgUpdateZRC20WithdrawFee(admin, gasZRC20.String(), sdk.NewUint(withdrawFee)),
+ )
+ require.NoError(t, err)
+ k.SetGasPrice(ctx, types.GasPrice{
+ ChainId: chainID,
+ MedianIndex: 0,
+ Prices: []uint64{gasPrice},
+ })
+
+ // liquidity pool not set
+
+ // create a cctx reverted from zeta
+ cctx := types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: zetacommon.CoinType_ERC20,
+ Asset: assetAddress,
+ },
+ OutboundTxParams: []*types.OutboundTxParams{
+ {
+ ReceiverChainId: zetacommon.ZetaChain().ChainId,
+ },
+ {
+ ReceiverChainId: chainID,
+ },
+ },
+ }
+
+ err = k.PayGasInERC20AndUpdateCctx(ctx, chainID, &cctx, math.NewUint(inputAmount), false)
+ require.ErrorIs(t, err, types.ErrNoLiquidityPool)
+ })
+
+ t.Run("should fail if not enough amount for the fee", func(t *testing.T) {
+ k, ctx, sdkk, zk := testkeeper.CrosschainKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin)
+
+ // deploy gas coin, erc20 and set fee params
+ chainID := getValidEthChainID(t)
+ assetAddress := sample.EthAddress().String()
+ deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper)
+ gasZRC20 := setupGasCoin(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper, chainID, "foo", "foo")
+ zrc20Addr := deployZRC20(
+ t,
+ ctx,
+ zk.FungibleKeeper,
+ sdkk.EvmKeeper,
+ chainID,
+ "bar",
+ assetAddress,
+ "bar",
+ )
+ _, err := zk.FungibleKeeper.UpdateZRC20WithdrawFee(
+ sdk.UnwrapSDKContext(ctx),
+ fungibletypes.NewMsgUpdateZRC20WithdrawFee(admin, gasZRC20.String(), sdk.NewUint(withdrawFee)),
+ )
+ require.NoError(t, err)
+ k.SetGasPrice(ctx, types.GasPrice{
+ ChainId: chainID,
+ MedianIndex: 0,
+ Prices: []uint64{gasPrice},
+ })
+
+ setupZRC20Pool(
+ t,
+ ctx,
+ zk.FungibleKeeper,
+ sdkk.BankKeeper,
+ zrc20Addr,
+ )
+
+ // create a cctx reverted from zeta
+ cctx := types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: zetacommon.CoinType_ERC20,
+ Asset: assetAddress,
+ },
+ OutboundTxParams: []*types.OutboundTxParams{
+ {
+ ReceiverChainId: zetacommon.ZetaChain().ChainId,
+ },
+ {
+ ReceiverChainId: chainID,
+ },
+ },
+ }
+
+ // total fees in gas must be 21000*2+1000=43000
+ // we calculate what it represents in erc20
+ expectedInZeta, err := zk.FungibleKeeper.QueryUniswapV2RouterGetZetaAmountsIn(ctx, big.NewInt(43000), gasZRC20)
+ require.NoError(t, err)
+ expectedInZRC20, err := zk.FungibleKeeper.QueryUniswapV2RouterGetZRC4AmountsIn(ctx, expectedInZeta, zrc20Addr)
+ require.NoError(t, err)
+
+ // Provide expected value minus 1
+ err = k.PayGasInERC20AndUpdateCctx(ctx, chainID, &cctx, math.NewUintFromBigInt(expectedInZRC20).SubUint64(1), false)
+ require.ErrorIs(t, err, types.ErrNotEnoughGas)
+ })
+}
+
+func TestKeeper_PayGasInZetaAndUpdateCctx(t *testing.T) {
+ t.Run("can pay gas in zeta", func(t *testing.T) {
+ k, ctx, sdkk, zk := testkeeper.CrosschainKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin)
+
+ // deploy gas coin and set fee params
+ chainID := getValidEthChainID(t)
+ deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper)
+ zrc20 := setupGasCoin(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper, chainID, "foobar", "foobar")
+ k.SetGasPrice(ctx, types.GasPrice{
+ ChainId: chainID,
+ MedianIndex: 0,
+ Prices: []uint64{gasPrice},
+ })
+
+ // create a cctx reverted from zeta
+ cctx := types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: zetacommon.CoinType_Zeta,
+ },
+ OutboundTxParams: []*types.OutboundTxParams{
+ {
+ ReceiverChainId: chainID,
+ OutboundTxGasLimit: 1000,
+ },
+ },
+ ZetaFees: math.NewUint(100),
+ }
+ // gasLimit * gasPrice * 2 = 1000 * 2 * 2 = 4000
+ expectedOutTxGasFeeInZeta, err := zk.FungibleKeeper.QueryUniswapV2RouterGetZetaAmountsIn(ctx, big.NewInt(4000), zrc20)
+ require.NoError(t, err)
+
+ // the output amount must be input amount - (out tx fee in zeta + protocol flat fee)
+ expectedFeeInZeta := types.GetProtocolFee().Add(math.NewUintFromBigInt(expectedOutTxGasFeeInZeta))
+ inputAmount := expectedFeeInZeta.Add(math.NewUint(100000))
+ err = k.PayGasInZetaAndUpdateCctx(ctx, chainID, &cctx, inputAmount, false)
+ require.NoError(t, err)
+ require.Equal(t, "100000", cctx.GetCurrentOutTxParam().Amount.String())
+ require.Equal(t, "4", cctx.GetCurrentOutTxParam().OutboundTxGasPrice) // gas price is doubled
+ require.True(t, cctx.ZetaFees.Equal(expectedFeeInZeta.Add(math.NewUint(100))), "expected %s, got %s", expectedFeeInZeta.String(), cctx.ZetaFees.String())
+
+ // can call with undefined zeta fees
+ cctx = types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: zetacommon.CoinType_Zeta,
+ },
+ OutboundTxParams: []*types.OutboundTxParams{
+ {
+ ReceiverChainId: chainID,
+ OutboundTxGasLimit: 1000,
+ },
+ },
+ }
+ expectedOutTxGasFeeInZeta, err = zk.FungibleKeeper.QueryUniswapV2RouterGetZetaAmountsIn(ctx, big.NewInt(4000), zrc20)
+ require.NoError(t, err)
+ expectedFeeInZeta = types.GetProtocolFee().Add(math.NewUintFromBigInt(expectedOutTxGasFeeInZeta))
+ inputAmount = expectedFeeInZeta.Add(math.NewUint(100000))
+ err = k.PayGasInZetaAndUpdateCctx(ctx, chainID, &cctx, inputAmount, false)
+ require.NoError(t, err)
+ require.Equal(t, "100000", cctx.GetCurrentOutTxParam().Amount.String())
+ require.Equal(t, "4", cctx.GetCurrentOutTxParam().OutboundTxGasPrice) // gas price is doubled
+ require.True(t, cctx.ZetaFees.Equal(expectedFeeInZeta), "expected %s, got %s", expectedFeeInZeta.String(), cctx.ZetaFees.String())
+ })
+
+ t.Run("should fail if pay gas in zeta with coin type other than zeta", func(t *testing.T) {
+ k, ctx, _, _ := testkeeper.CrosschainKeeper(t)
+ chainID := getValidEthChainID(t)
+ cctx := types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: zetacommon.CoinType_Gas,
+ },
+ }
+ err := k.PayGasInZetaAndUpdateCctx(ctx, chainID, &cctx, math.NewUint(100000), false)
+ require.ErrorIs(t, err, types.ErrInvalidCoinType)
+ })
+
+ t.Run("should fail if chain is not supported", func(t *testing.T) {
+ k, ctx, _, _ := testkeeper.CrosschainKeeper(t)
+ cctx := types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: zetacommon.CoinType_Zeta,
+ },
+ }
+ err := k.PayGasInZetaAndUpdateCctx(ctx, 999999, &cctx, math.NewUint(100000), false)
+ require.ErrorIs(t, err, observertypes.ErrSupportedChains)
+ })
+
+ t.Run("should fail if can't query the gas price", func(t *testing.T) {
+ k, ctx, sdkk, zk := testkeeper.CrosschainKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin)
+
+ // deploy gas coin and set fee params
+ chainID := getValidEthChainID(t)
+ deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper)
+ setupGasCoin(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper, chainID, "foobar", "foobar")
+
+ // gas price not set
+
+ // create a cctx reverted from zeta
+ cctx := types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: zetacommon.CoinType_Zeta,
+ },
+ OutboundTxParams: []*types.OutboundTxParams{
+ {
+ ReceiverChainId: chainID,
+ OutboundTxGasLimit: 1000,
+ },
+ },
+ }
+
+ err := k.PayGasInZetaAndUpdateCctx(ctx, chainID, &cctx, math.NewUint(100000), false)
+ require.ErrorIs(t, err, types.ErrUnableToGetGasPrice)
+ })
+
+ t.Run("should fail if not enough amount for the fee", func(t *testing.T) {
+ k, ctx, sdkk, zk := testkeeper.CrosschainKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin)
+
+ // deploy gas coin and set fee params
+ chainID := getValidEthChainID(t)
+ deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper)
+ zrc20 := setupGasCoin(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper, chainID, "foobar", "foobar")
+ k.SetGasPrice(ctx, types.GasPrice{
+ ChainId: chainID,
+ MedianIndex: 0,
+ Prices: []uint64{gasPrice},
+ })
+
+ // create a cctx reverted from zeta
+ cctx := types.CrossChainTx{
+ InboundTxParams: &types.InboundTxParams{
+ CoinType: zetacommon.CoinType_Zeta,
+ },
+ OutboundTxParams: []*types.OutboundTxParams{
+ {
+ ReceiverChainId: chainID,
+ OutboundTxGasLimit: 1000,
+ },
+ },
+ ZetaFees: math.NewUint(100),
+ }
+ expectedOutTxGasFeeInZeta, err := zk.FungibleKeeper.QueryUniswapV2RouterGetZetaAmountsIn(ctx, big.NewInt(4000), zrc20)
+ require.NoError(t, err)
+ expectedFeeInZeta := types.GetProtocolFee().Add(math.NewUintFromBigInt(expectedOutTxGasFeeInZeta))
+
+ // set input amount lower than total zeta fee
+ inputAmount := expectedFeeInZeta.Sub(math.NewUint(1))
+ err = k.PayGasInZetaAndUpdateCctx(ctx, chainID, &cctx, inputAmount, false)
+ require.ErrorIs(t, err, types.ErrNotEnoughZetaBurnt)
+ })
+}
diff --git a/x/crosschain/keeper/grpc_query_in_tx_hash_to_cctx_test.go b/x/crosschain/keeper/grpc_query_in_tx_hash_to_cctx_test.go
index 0bcce1517b..5704fdc54a 100644
--- a/x/crosschain/keeper/grpc_query_in_tx_hash_to_cctx_test.go
+++ b/x/crosschain/keeper/grpc_query_in_tx_hash_to_cctx_test.go
@@ -20,7 +20,7 @@ import (
)
func TestInTxHashToCctxQuerySingle(t *testing.T) {
- keeper, ctx := keepertest.CrosschainKeeper(t)
+ keeper, ctx, _, _ := keepertest.CrosschainKeeper(t)
wctx := sdk.WrapSDKContext(ctx)
msgs := createNInTxHashToCctx(keeper, ctx, 2)
for _, tc := range []struct {
@@ -71,7 +71,7 @@ func TestInTxHashToCctxQuerySingle(t *testing.T) {
}
func TestInTxHashToCctxQueryPaginated(t *testing.T) {
- keeper, ctx := keepertest.CrosschainKeeper(t)
+ keeper, ctx, _, _ := keepertest.CrosschainKeeper(t)
wctx := sdk.WrapSDKContext(ctx)
msgs := createNInTxHashToCctx(keeper, ctx, 5)
@@ -148,7 +148,7 @@ func createInTxHashToCctxWithCctxs(keeper *crosschainkeeper.Keeper, ctx sdk.Cont
}
func TestKeeper_InTxHashToCctxDataQuery(t *testing.T) {
- keeper, ctx := keepertest.CrosschainKeeper(t)
+ keeper, ctx, _, _ := keepertest.CrosschainKeeper(t)
wctx := sdk.WrapSDKContext(ctx)
t.Run("can query all cctxs data with in tx hash", func(t *testing.T) {
diff --git a/x/crosschain/keeper/grpc_zevm.go b/x/crosschain/keeper/grpc_zevm.go
index bccb527496..820ac57dcd 100644
--- a/x/crosschain/keeper/grpc_zevm.go
+++ b/x/crosschain/keeper/grpc_zevm.go
@@ -42,10 +42,12 @@ func (k Keeper) ZEVMGetBlock(c context.Context, req *types.QueryZEVMGetBlockByNu
if height >= math.MaxInt64 {
return nil, status.Error(codes.OutOfRange, "invalid height , the height is too large")
}
+ // #nosec G701 range checked
blockResults, err := GetTendermintBlockResultsByNumber(ctx, int64(req.Height))
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
+ // #nosec G701 range checked
block, err := GetTendermintBlockByNumber(ctx, int64(req.Height))
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
diff --git a/x/crosschain/keeper/in_tx_hash_to_cctx_test.go b/x/crosschain/keeper/in_tx_hash_to_cctx_test.go
index 550b3395e1..6eb0118cf9 100644
--- a/x/crosschain/keeper/in_tx_hash_to_cctx_test.go
+++ b/x/crosschain/keeper/in_tx_hash_to_cctx_test.go
@@ -24,7 +24,7 @@ func createNInTxHashToCctx(keeper *keeper.Keeper, ctx sdk.Context, n int) []type
}
func TestInTxHashToCctxGet(t *testing.T) {
- keeper, ctx := keepertest.CrosschainKeeper(t)
+ keeper, ctx, _, _ := keepertest.CrosschainKeeper(t)
items := createNInTxHashToCctx(keeper, ctx, 10)
for _, item := range items {
rst, found := keeper.GetInTxHashToCctx(ctx,
@@ -38,7 +38,7 @@ func TestInTxHashToCctxGet(t *testing.T) {
}
}
func TestInTxHashToCctxRemove(t *testing.T) {
- keeper, ctx := keepertest.CrosschainKeeper(t)
+ keeper, ctx, _, _ := keepertest.CrosschainKeeper(t)
items := createNInTxHashToCctx(keeper, ctx, 10)
for _, item := range items {
keeper.RemoveInTxHashToCctx(ctx,
@@ -52,7 +52,7 @@ func TestInTxHashToCctxRemove(t *testing.T) {
}
func TestInTxHashToCctxGetAll(t *testing.T) {
- keeper, ctx := keepertest.CrosschainKeeper(t)
+ keeper, ctx, _, _ := keepertest.CrosschainKeeper(t)
items := createNInTxHashToCctx(keeper, ctx, 10)
require.ElementsMatch(t,
nullify.Fill(items),
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.go b/x/crosschain/keeper/keeper_cross_chain_tx.go
index 8fd5fdc2da..a53c1159c4 100644
--- a/x/crosschain/keeper/keeper_cross_chain_tx.go
+++ b/x/crosschain/keeper/keeper_cross_chain_tx.go
@@ -44,7 +44,8 @@ func (k Keeper) SetCctxAndNonceToCctxAndInTxHashToCctx(ctx sdk.Context, send typ
// set mapping nonce => cctxIndex
if send.CctxStatus.Status == types.CctxStatus_PendingOutbound || send.CctxStatus.Status == types.CctxStatus_PendingRevert {
k.SetNonceToCctx(ctx, types.NonceToCctx{
- ChainId: send.GetCurrentOutTxParam().ReceiverChainId,
+ ChainId: send.GetCurrentOutTxParam().ReceiverChainId,
+ // #nosec G701 always in range
Nonce: int64(send.GetCurrentOutTxParam().OutboundTxTssNonce),
CctxIndex: send.Index,
Tss: tss.TssPubkey,
@@ -149,6 +150,7 @@ func (k Keeper) CctxByNonce(c context.Context, req *types.QueryGetCctxByNonceReq
if !found {
return nil, status.Error(codes.Internal, "tss not found")
}
+ // #nosec G701 always in range
res, found := k.GetNonceToCctx(ctx, tss.TssPubkey, req.ChainID, int64(req.Nonce))
if !found {
return nil, status.Error(codes.Internal, fmt.Sprintf("nonceToCctx not found: nonce %d, chainid %d", req.Nonce, req.ChainID))
@@ -184,7 +186,7 @@ func (k Keeper) CctxAllPending(c context.Context, req *types.QueryAllCctxPending
startNonce = 0
}
for i := startNonce; i < p.NonceLow; i++ {
- res, found := k.GetNonceToCctx(ctx, tss.TssPubkey, int64(req.ChainId), i)
+ res, found := k.GetNonceToCctx(ctx, tss.TssPubkey, req.ChainId, i)
if !found {
return nil, status.Error(codes.Internal, fmt.Sprintf("nonceToCctx not found: nonce %d, chainid %d", i, req.ChainId))
}
@@ -199,7 +201,7 @@ func (k Keeper) CctxAllPending(c context.Context, req *types.QueryAllCctxPending
// now query the pending nonces that we know are pending
for i := p.NonceLow; i < p.NonceHigh; i++ {
- ntc, found := k.GetNonceToCctx(ctx, tss.TssPubkey, int64(req.ChainId), i)
+ ntc, found := k.GetNonceToCctx(ctx, tss.TssPubkey, req.ChainId, i)
if !found {
return nil, status.Error(codes.Internal, "nonceToCctx not found")
}
diff --git a/x/crosschain/keeper/keeper_cross_chain_tx_vote_inbound_tx.go b/x/crosschain/keeper/keeper_cross_chain_tx_vote_inbound_tx.go
index 6cee5e7a5b..033f12b60c 100644
--- a/x/crosschain/keeper/keeper_cross_chain_tx_vote_inbound_tx.go
+++ b/x/crosschain/keeper/keeper_cross_chain_tx_vote_inbound_tx.go
@@ -14,7 +14,7 @@ import (
// FIXME: use more specific error types & codes
-// Casts a vote on an inbound transaction observed on a connected chain. If this
+// VoteOnObservedInboundTx casts a vote on an inbound transaction observed on a connected chain. If this
// is the first vote, a new ballot is created. When a threshold of votes is
// reached, the ballot is finalized. When a ballot is finalized, a new CCTX is
// created.
@@ -57,6 +57,7 @@ import (
// Only observer validators are authorized to broadcast this message.
func (k msgServer) VoteOnObservedInboundTx(goCtx context.Context, msg *types.MsgVoteOnObservedInboundTx) (*types.MsgVoteOnObservedInboundTxResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
+
observationType := observerTypes.ObservationType_InBoundTx
if !k.zetaObserverKeeper.IsInboundEnabled(ctx) {
return nil, types.ErrNotEnoughPermissions
@@ -104,12 +105,14 @@ func (k msgServer) VoteOnObservedInboundTx(goCtx context.Context, msg *types.Msg
}
// Validation if we want to send ZETA to external chain, but there is no ZETA token.
- coreParams, found := k.zetaObserverKeeper.GetCoreParamsByChainID(ctx, receiverChain.ChainId)
- if !found {
- return nil, types.ErrNotFoundCoreParams
- }
- if receiverChain.IsExternalChain() && coreParams.ZetaTokenContractAddress == "" && msg.CoinType == common.CoinType_Zeta {
- return nil, types.ErrUnableToSendCoinType
+ if receiverChain.IsExternalChain() {
+ coreParams, found := k.zetaObserverKeeper.GetCoreParamsByChainID(ctx, receiverChain.ChainId)
+ if !found {
+ return nil, types.ErrNotFoundCoreParams
+ }
+ if coreParams.ZetaTokenContractAddress == "" && msg.CoinType == common.CoinType_Zeta {
+ return nil, types.ErrUnableToSendCoinType
+ }
}
// ******************************************************************************
@@ -120,6 +123,7 @@ func (k msgServer) VoteOnObservedInboundTx(goCtx context.Context, msg *types.Msg
cctx := k.CreateNewCCTX(ctx, msg, index, tssPub, types.CctxStatus_PendingInbound, observationChain, receiverChain)
defer func() {
EmitEventInboundFinalized(ctx, &cctx)
+ // #nosec G701 always positive
cctx.InboundTxParams.InboundTxFinalizedZetaHeight = uint64(ctx.BlockHeight())
k.RemoveInTxTrackerIfExists(ctx, cctx.InboundTxParams.SenderChainId, cctx.InboundTxParams.InboundTxObservedHash)
k.SetCctxAndNonceToCctxAndInTxHashToCctx(ctx, cctx)
@@ -129,6 +133,7 @@ func (k msgServer) VoteOnObservedInboundTx(goCtx context.Context, msg *types.Msg
if receiverChain.IsZetaChain() {
tmpCtx, commit := ctx.CacheContext()
isContractReverted, err := k.HandleEVMDeposit(tmpCtx, &cctx, *msg, observationChain)
+
if err != nil && !isContractReverted { // exceptional case; internal error; should abort CCTX
cctx.CctxStatus.ChangeStatus(types.CctxStatus_Aborted, err.Error())
return &types.MsgVoteOnObservedInboundTxResponse{}, nil
@@ -139,27 +144,60 @@ func (k msgServer) VoteOnObservedInboundTx(goCtx context.Context, msg *types.Msg
cctx.CctxStatus.ChangeStatus(types.CctxStatus_Aborted, "invalid sender chain")
return &types.MsgVoteOnObservedInboundTxResponse{}, nil
}
- medianGasPrice, isFound := k.GetMedianGasPriceInUint(ctx, chain.ChainId)
- if !isFound {
- cctx.CctxStatus.ChangeStatus(types.CctxStatus_Aborted, "cannot find gas price")
- return &types.MsgVoteOnObservedInboundTxResponse{}, nil
- }
// create new OutboundTxParams for the revert
cctx.OutboundTxParams = append(cctx.OutboundTxParams, &types.OutboundTxParams{
- Receiver: cctx.InboundTxParams.Sender,
- ReceiverChainId: cctx.InboundTxParams.SenderChainId,
- Amount: cctx.InboundTxParams.Amount,
- CoinType: cctx.InboundTxParams.CoinType,
- OutboundTxGasLimit: 0, // for fungible refund, use default gasLimit
- OutboundTxGasPrice: medianGasPrice.MulUint64(2).String(),
+ Receiver: cctx.InboundTxParams.Sender,
+ ReceiverChainId: cctx.InboundTxParams.SenderChainId,
+ Amount: cctx.InboundTxParams.Amount,
+ CoinType: cctx.InboundTxParams.CoinType,
+ // use same gas limit as outbound
+ //TODO: determine a specific revert gas limit https://github.com/zeta-chain/node/issues/1065
+ OutboundTxGasLimit: msg.GasLimit,
})
- if err = k.UpdateNonce(ctx, chain.ChainId, &cctx); err != nil {
+
+ // we create a new cached context, and we don't commit the previous one with EVM deposit
+ tmpCtx, commit := ctx.CacheContext()
+ err = func() error {
+ err := k.PayGasAndUpdateCctx(
+ tmpCtx,
+ chain.ChainId,
+ &cctx,
+ cctx.InboundTxParams.Amount,
+ false,
+ )
+ if err != nil {
+ return err
+ }
+ err = k.UpdateNonce(tmpCtx, chain.ChainId, &cctx)
+ if err != nil {
+ return err
+ }
+ return nil
+ }()
+ if err != nil {
+ // do not commit anything here as the CCTX should be aborted
+
+ // gas payment for erc20 type might fail because no liquidity pool is defined to swap the zrc20 token into the gas token
+ // in this gas we should refund the sender on ZetaChain
+ if cctx.InboundTxParams.CoinType == common.CoinType_ERC20 {
+
+ if err := k.RefundAmountOnZetaChain(ctx, cctx, cctx.InboundTxParams.Amount); err != nil {
+ // log the error
+ k.Logger(ctx).Error("failed to refund amount of aborted cctx on ZetaChain",
+ "error", err,
+ "sender", cctx.InboundTxParams.Sender,
+ "amount", cctx.InboundTxParams.Amount.String(),
+ )
+ }
+ }
+
cctx.CctxStatus.ChangeStatus(types.CctxStatus_Aborted, err.Error())
return &types.MsgVoteOnObservedInboundTxResponse{}, nil
}
- // do not commit() here;
+ commit()
cctx.CctxStatus.ChangeStatus(types.CctxStatus_PendingRevert, revertMessage)
return &types.MsgVoteOnObservedInboundTxResponse{}, nil
+
} else { // successful HandleEVMDeposit;
commit()
cctx.CctxStatus.ChangeStatus(types.CctxStatus_OutboundMined, "Remote omnichain contract call completed")
@@ -168,7 +206,13 @@ func (k msgServer) VoteOnObservedInboundTx(goCtx context.Context, msg *types.Msg
} else { // Cross Chain SWAP
tmpCtx, commit := ctx.CacheContext()
err = func() error {
- err := k.PayGasInZetaAndUpdateCctx(tmpCtx, receiverChain.ChainId, &cctx, false)
+ err := k.PayGasAndUpdateCctx(
+ tmpCtx,
+ receiverChain.ChainId,
+ &cctx,
+ cctx.InboundTxParams.Amount,
+ false,
+ )
if err != nil {
return err
}
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..f8b845a925 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"
@@ -13,7 +16,7 @@ import (
observerTypes "github.com/zeta-chain/zetacore/x/observer/types"
)
-// Casts a vote on an outbound transaction observed on a connected chain (after
+// VoteOnObservedOutboundTx casts a vote on an outbound transaction observed on a connected chain (after
// it has been broadcasted to and finalized on a connected chain). If this is
// the first vote, a new ballot is created. When a threshold of votes is
// reached, the ballot is finalized. When a ballot is finalized, the outbound
@@ -81,6 +84,10 @@ func (k msgServer) VoteOnObservedOutboundTx(goCtx context.Context, msg *types.Ms
return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("CCTX %s does not exist", msg.CctxHash))
}
+ if cctx.GetCurrentOutTxParam().OutboundTxTssNonce != msg.OutTxTssNonce {
+ return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("OutTxTssNonce %d does not match CCTX OutTxTssNonce %d", msg.OutTxTssNonce, cctx.GetCurrentOutTxParam().OutboundTxTssNonce))
+ }
+
ballotIndex := msg.Digest()
// Add votes and Set Ballot
ballot, isNew, err := k.zetaObserverKeeper.FindBallot(ctx, ballotIndex, observationChain, observationType)
@@ -106,20 +113,30 @@ func (k msgServer) VoteOnObservedOutboundTx(goCtx context.Context, msg *types.Ms
return &types.MsgVoteOnObservedOutboundTxResponse{}, nil
}
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",
- msg.ZetaMinted,
+ if !msg.ValueReceived.Equal(cctx.GetCurrentOutTxParam().Amount) {
+ log.Error().Msgf("VoteOnObservedOutboundTx: Mint mismatch: %s value received vs %s cctx amount",
+ msg.ValueReceived,
cctx.GetCurrentOutTxParam().Amount)
- return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("ZetaMinted %s does not match send ZetaMint %s", msg.ZetaMinted, cctx.GetCurrentOutTxParam().Amount))
+ return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("ValueReceived %s does not match sent value %s", msg.ValueReceived, 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,20 +155,29 @@ 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 {
case types.CctxStatus_PendingOutbound:
// create new OutboundTxParams for the revert
cctx.OutboundTxParams = append(cctx.OutboundTxParams, &types.OutboundTxParams{
- Receiver: cctx.InboundTxParams.Sender,
- ReceiverChainId: cctx.InboundTxParams.SenderChainId,
- Amount: cctx.InboundTxParams.Amount,
- CoinType: cctx.InboundTxParams.CoinType,
- OutboundTxGasLimit: cctx.OutboundTxParams[0].OutboundTxGasLimit, // NOTE(pwu): revert gas limit = initial outbound gas limit set by user;
+ Receiver: cctx.InboundTxParams.Sender,
+ ReceiverChainId: cctx.InboundTxParams.SenderChainId,
+ Amount: cctx.InboundTxParams.Amount,
+ CoinType: cctx.InboundTxParams.CoinType,
+ // NOTE(pwu): revert gas limit = initial outbound gas limit set by user
+ //TODO: determine a specific revert gas limit https://github.com/zeta-chain/node/issues/1065
+ OutboundTxGasLimit: cctx.OutboundTxParams[0].OutboundTxGasLimit,
})
- err := k.PayGasInZetaAndUpdateCctx(tmpCtx, cctx.InboundTxParams.SenderChainId, &cctx, false)
+ err := k.PayGasAndUpdateCctx(
+ tmpCtx,
+ cctx.InboundTxParams.SenderChainId,
+ &cctx,
+ cctx.OutboundTxParams[0].Amount,
+ false,
+ )
if err != nil {
return err
}
@@ -173,6 +199,7 @@ func (k msgServer) VoteOnObservedOutboundTx(goCtx context.Context, msg *types.Ms
// do not commit tmpCtx
cctx.CctxStatus.ChangeStatus(types.CctxStatus_Aborted, err.Error())
ctx.Logger().Error(err.Error())
+ // #nosec G701 always in range
k.RemoveFromPendingNonces(ctx, tss.TssPubkey, msg.OutTxChain, int64(msg.OutTxTssNonce))
k.RemoveOutTxTracker(ctx, msg.OutTxChain, msg.OutTxTssNonce)
k.SetCctxAndNonceToCctxAndInTxHashToCctx(ctx, cctx)
@@ -181,8 +208,41 @@ func (k msgServer) VoteOnObservedOutboundTx(goCtx context.Context, msg *types.Ms
commit()
// Set the ballot index to the finalized ballot
cctx.GetCurrentOutTxParam().OutboundTxBallotIndex = ballotIndex
+ // #nosec G701 always in range
k.RemoveFromPendingNonces(ctx, tss.TssPubkey, msg.OutTxChain, int64(msg.OutTxTssNonce))
k.RemoveOutTxTracker(ctx, msg.OutTxChain, msg.OutTxTssNonce)
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_gas_price.go b/x/crosschain/keeper/keeper_gas_price.go
index 5566336e23..63ea8e527f 100644
--- a/x/crosschain/keeper/keeper_gas_price.go
+++ b/x/crosschain/keeper/keeper_gas_price.go
@@ -166,11 +166,17 @@ func (k msgServer) GasPriceVoter(goCtx context.Context, msg *types.MsgGasPriceVo
}
// recompute the median gas price
mi := medianOfArray(gasPrice.Prices)
+ // #nosec G701 always positive
gasPrice.MedianIndex = uint64(mi)
}
k.SetGasPrice(ctx, gasPrice)
chainIDBigINT := big.NewInt(chain.ChainId)
- gasUsed, err := k.fungibleKeeper.SetGasPrice(ctx, chainIDBigINT, big.NewInt(int64(gasPrice.Prices[gasPrice.MedianIndex])))
+
+ gasUsed, err := k.fungibleKeeper.SetGasPrice(
+ ctx,
+ chainIDBigINT,
+ math.NewUint(gasPrice.Prices[gasPrice.MedianIndex]).BigInt(),
+ )
if err != nil {
return nil, err
}
diff --git a/x/crosschain/keeper/keeper_in_tx_tracker.go b/x/crosschain/keeper/keeper_in_tx_tracker.go
index 59288c0839..6e1f5995e3 100644
--- a/x/crosschain/keeper/keeper_in_tx_tracker.go
+++ b/x/crosschain/keeper/keeper_in_tx_tracker.go
@@ -88,7 +88,7 @@ func (k msgServer) AddToInTxTracker(goCtx context.Context, msg *types.MsgAddToIn
return nil, zetaObserverTypes.ErrSupportedChains
}
- adminPolicyAccount := k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_out_tx_tracker)
+ adminPolicyAccount := k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_group1)
isAdmin := msg.Creator == adminPolicyAccount
isObserver, err := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, chain)
diff --git a/x/crosschain/keeper/keeper_in_tx_tracker_test.go b/x/crosschain/keeper/keeper_in_tx_tracker_test.go
index 1504f0e2a4..c16deeb819 100644
--- a/x/crosschain/keeper/keeper_in_tx_tracker_test.go
+++ b/x/crosschain/keeper/keeper_in_tx_tracker_test.go
@@ -63,6 +63,11 @@ func TestKeeper_GetAllInTxTrackerForChain(t *testing.T) {
require.Equal(t, len(intxTrackers), int(pageRes.Total))
})
t.Run("Delete InTxTracker", func(t *testing.T) {
+ trackers := keeper.GetAllInTxTracker(ctx)
+ for _, item := range trackers {
+ keeper.RemoveInTxTrackerIfExists(ctx, item.ChainId, item.TxHash)
+ }
+
intxTrackers = createNInTxTracker(keeper, ctx, 10, 6)
for _, item := range intxTrackers {
keeper.RemoveInTxTrackerIfExists(ctx, item.ChainId, item.TxHash)
diff --git a/x/crosschain/keeper/keeper_out_tx_tracker.go b/x/crosschain/keeper/keeper_out_tx_tracker.go
index 030d12eadb..5053687bd4 100644
--- a/x/crosschain/keeper/keeper_out_tx_tracker.go
+++ b/x/crosschain/keeper/keeper_out_tx_tracker.go
@@ -5,12 +5,16 @@ import (
"fmt"
"strings"
+ cosmoserrors "cosmossdk.io/errors"
+
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/query"
+ eth "github.com/ethereum/go-ethereum/common"
+ ethtypes "github.com/ethereum/go-ethereum/core/types"
+ "github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/crosschain/types"
- zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types"
+ observertypes "github.com/zeta-chain/zetacore/x/observer/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
@@ -156,27 +160,74 @@ func (k Keeper) OutTxTracker(c context.Context, req *types.QueryGetOutTxTrackerR
// Messages
-// Adds a new record to the outbound transaction tracker.
-//
-// Only the admin policy account and the observer validators are authorized to
-// broadcast this message.
+// AddToOutTxTracker adds a new record to the outbound transaction tracker.
+// only the admin policy account and the observer validators are authorized to broadcast this message.
func (k msgServer) AddToOutTxTracker(goCtx context.Context, msg *types.MsgAddToOutTxTracker) (*types.MsgAddToOutTxTrackerResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(msg.ChainId)
if chain == nil {
- return nil, zetaObserverTypes.ErrSupportedChains
+ return nil, observertypes.ErrSupportedChains
}
- adminPolicyAccount := k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_out_tx_tracker)
- isAdmin := msg.Creator == adminPolicyAccount
+ if msg.Proof == nil { // without proof, only certain accounts can send this message
+ adminPolicyAccount := k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(observertypes.Policy_Type_group1)
+ isAdmin := msg.Creator == adminPolicyAccount
- isObserver, err := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, chain)
- if err != nil {
- ctx.Logger().Error("Error while checking if the account is an observer", err)
+ isObserver, err := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, chain)
+ if err != nil {
+ ctx.Logger().Error("Error while checking if the account is an observer", err)
+ return nil, cosmoserrors.Wrap(observertypes.ErrNotAuthorized, fmt.Sprintf("error IsAuthorized %s", msg.Creator))
+ }
+ // Sender needs to be either the admin policy account or an observer
+ if !(isAdmin || isObserver) {
+ return nil, cosmoserrors.Wrap(observertypes.ErrNotAuthorized, fmt.Sprintf("Creator %s", msg.Creator))
+ }
}
- // Sender needs to be either the admin policy account or an observer
- if !(isAdmin || isObserver) {
- return nil, sdkerrors.Wrap(zetaObserverTypes.ErrNotAuthorized, fmt.Sprintf("Creator %s", msg.Creator))
+
+ proven := false
+ if msg.Proof != nil {
+ blockHash := eth.HexToHash(msg.BlockHash)
+ res, found := k.zetaObserverKeeper.GetBlockHeader(ctx, blockHash.Bytes())
+ if !found {
+ return nil, cosmoserrors.Wrap(observertypes.ErrBlockHeaderNotFound, fmt.Sprintf("block header not found %s", msg.BlockHash))
+ }
+
+ // verify and process the proof
+ val, err := msg.Proof.Verify(res.Header, int(msg.TxIndex))
+ if err != nil && !common.IsErrorInvalidProof(err) {
+ return nil, err
+ }
+ if err == nil {
+ var txx ethtypes.Transaction
+ err = txx.UnmarshalBinary(val)
+ if err != nil {
+ return nil, err
+ }
+ signer := ethtypes.NewLondonSigner(txx.ChainId())
+ sender, err := ethtypes.Sender(signer, &txx)
+ if err != nil {
+ return nil, err
+ }
+ res, err := k.GetTssAddress(ctx, &types.QueryGetTssAddressRequest{})
+ if err != nil {
+ return nil, err
+ }
+ tssAddr := eth.HexToAddress(res.Eth)
+ if tssAddr == (eth.Address{}) {
+ return nil, fmt.Errorf("tss address not found")
+ }
+ if sender != tssAddr {
+ return nil, fmt.Errorf("sender is not tss address")
+ }
+ if txx.Nonce() != msg.Nonce {
+ return nil, fmt.Errorf("nonce mismatch")
+ }
+ proven = true
+ }
+
+ if !proven {
+ return nil, fmt.Errorf("proof failed")
+ }
}
tracker, found := k.GetOutTxTracker(ctx, msg.ChainId, msg.Nonce)
@@ -198,23 +249,34 @@ func (k msgServer) AddToOutTxTracker(goCtx context.Context, msg *types.MsgAddToO
for _, hash := range tracker.HashList {
if strings.EqualFold(hash.TxHash, msg.TxHash) {
isDup = true
+ if proven {
+ hash.Proved = true
+ k.SetOutTxTracker(ctx, tracker)
+ k.Logger(ctx).Info("Proof'd outbound transaction")
+ return &types.MsgAddToOutTxTrackerResponse{}, nil
+ }
break
}
}
if !isDup {
- tracker.HashList = append(tracker.HashList, &hash)
+ if proven {
+ hash.Proved = true
+ tracker.HashList = append([]*types.TxHashList{&hash}, tracker.HashList...)
+ k.Logger(ctx).Info("Proof'd outbound transaction")
+ } else {
+ tracker.HashList = append(tracker.HashList, &hash)
+ }
k.SetOutTxTracker(ctx, tracker)
}
return &types.MsgAddToOutTxTrackerResponse{}, nil
}
-// Removes a record from the outbound transaction tracker by chain ID and nonce.
-//
-// Only the admin policy account is authorized to broadcast this message.
+// RemoveFromOutTxTracker removes a record from the outbound transaction tracker by chain ID and nonce.
+// only the admin policy account is authorized to broadcast this message.
func (k msgServer) RemoveFromOutTxTracker(goCtx context.Context, msg *types.MsgRemoveFromOutTxTracker) (*types.MsgRemoveFromOutTxTrackerResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
- if msg.Creator != k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_out_tx_tracker) {
- return &types.MsgRemoveFromOutTxTrackerResponse{}, zetaObserverTypes.ErrNotAuthorizedPolicy
+ if msg.Creator != k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(observertypes.Policy_Type_group1) {
+ return &types.MsgRemoveFromOutTxTrackerResponse{}, observertypes.ErrNotAuthorizedPolicy
}
k.RemoveOutTxTracker(ctx, msg.ChainId, msg.Nonce)
diff --git a/x/crosschain/keeper/keeper_out_tx_tracker_test.go b/x/crosschain/keeper/keeper_out_tx_tracker_test.go
index 16570daad4..d6835b1623 100644
--- a/x/crosschain/keeper/keeper_out_tx_tracker_test.go
+++ b/x/crosschain/keeper/keeper_out_tx_tracker_test.go
@@ -31,7 +31,7 @@ func createNOutTxTracker(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.
}
func TestOutTxTrackerGet(t *testing.T) {
- keeper, ctx := keepertest.CrosschainKeeper(t)
+ keeper, ctx, _, _ := keepertest.CrosschainKeeper(t)
items := createNOutTxTracker(keeper, ctx, 10)
for _, item := range items {
rst, found := keeper.GetOutTxTracker(ctx,
@@ -46,7 +46,7 @@ func TestOutTxTrackerGet(t *testing.T) {
}
}
func TestOutTxTrackerRemove(t *testing.T) {
- k, ctx := keepertest.CrosschainKeeper(t)
+ k, ctx, _, _ := keepertest.CrosschainKeeper(t)
items := createNOutTxTracker(k, ctx, 10)
for _, item := range items {
k.RemoveOutTxTracker(ctx,
@@ -62,7 +62,7 @@ func TestOutTxTrackerRemove(t *testing.T) {
}
func TestOutTxTrackerGetAll(t *testing.T) {
- keeper, ctx := keepertest.CrosschainKeeper(t)
+ keeper, ctx, _, _ := keepertest.CrosschainKeeper(t)
items := createNOutTxTracker(keeper, ctx, 10)
require.ElementsMatch(t,
nullify.Fill(items),
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_pending_nonces.go b/x/crosschain/keeper/keeper_pending_nonces.go
index da1648b104..5d08fd069a 100644
--- a/x/crosschain/keeper/keeper_pending_nonces.go
+++ b/x/crosschain/keeper/keeper_pending_nonces.go
@@ -41,7 +41,7 @@ func (k Keeper) SetPendingNonces(ctx sdk.Context, pendingNonces types.PendingNon
store.Set(types.KeyPrefix(fmt.Sprintf("%s-%d", pendingNonces.Tss, pendingNonces.ChainId)), b)
}
-func (k Keeper) GetPendingNonces(ctx sdk.Context, tss string, chainID uint64) (val types.PendingNonces, found bool) {
+func (k Keeper) GetPendingNonces(ctx sdk.Context, tss string, chainID int64) (val types.PendingNonces, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PendingNoncesKeyPrefix))
b := store.Get(types.KeyPrefix(fmt.Sprintf("%s-%d", tss, chainID)))
@@ -74,7 +74,7 @@ func (k Keeper) RemovePendingNonces(ctx sdk.Context, pendingNonces types.Pending
// utility
func (k Keeper) RemoveFromPendingNonces(ctx sdk.Context, tssPubkey string, chainID int64, nonce int64) {
- p, found := k.GetPendingNonces(ctx, tssPubkey, uint64(chainID))
+ p, found := k.GetPendingNonces(ctx, tssPubkey, chainID)
if found && nonce >= p.NonceLow && nonce <= p.NonceHigh {
p.NonceLow = nonce + 1
k.SetPendingNonces(ctx, p)
@@ -93,3 +93,23 @@ func (k Keeper) PendingNoncesAll(c context.Context, req *types.QueryAllPendingNo
PendingNonces: list,
}, nil
}
+
+func (k Keeper) PendingNoncesByChain(c context.Context, req *types.QueryPendingNoncesByChainRequest) (*types.QueryPendingNoncesByChainResponse, error) {
+ if req == nil {
+ return nil, status.Error(codes.InvalidArgument, "invalid request")
+ }
+
+ ctx := sdk.UnwrapSDKContext(c)
+ tss, found := k.GetTSS(ctx)
+ if !found {
+ return nil, status.Error(codes.NotFound, "tss not found")
+ }
+ list, found := k.GetPendingNonces(ctx, tss.TssPubkey, req.ChainId)
+ if !found {
+ return nil, status.Error(codes.NotFound, fmt.Sprintf("pending nonces not found for chain id : %d", req.ChainId))
+ }
+
+ return &types.QueryPendingNoncesByChainResponse{
+ PendingNonces: list,
+ }, nil
+}
diff --git a/x/crosschain/keeper/keeper_tss.go b/x/crosschain/keeper/keeper_tss.go
index fc57e0013a..d1461539f9 100644
--- a/x/crosschain/keeper/keeper_tss.go
+++ b/x/crosschain/keeper/keeper_tss.go
@@ -23,7 +23,13 @@ func (k Keeper) SetTssAndUpdateNonce(ctx sdk.Context, tss types.TSS) {
// initialize the nonces and pending nonces of all enabled chains
supportedChains := k.zetaObserverKeeper.GetParams(ctx).GetSupportedChains()
for _, chain := range supportedChains {
- chainNonce := types.ChainNonces{Index: chain.ChainName.String(), ChainId: chain.ChainId, Nonce: 0, FinalizedHeight: uint64(ctx.BlockHeight())}
+ chainNonce := types.ChainNonces{
+ Index: chain.ChainName.String(),
+ ChainId: chain.ChainId,
+ Nonce: 0,
+ // #nosec G701 always positive
+ FinalizedHeight: uint64(ctx.BlockHeight()),
+ }
k.SetChainNonces(ctx, chainNonce)
p := types.PendingNonces{
diff --git a/x/crosschain/keeper/keeper_utils.go b/x/crosschain/keeper/keeper_utils.go
deleted file mode 100644
index 1351dc1032..0000000000
--- a/x/crosschain/keeper/keeper_utils.go
+++ /dev/null
@@ -1,143 +0,0 @@
-package keeper
-
-import (
- "fmt"
- "math/big"
-
- "github.com/zeta-chain/zetacore/cmd/zetacored/config"
-
- "cosmossdk.io/math"
- sdk "github.com/cosmos/cosmos-sdk/types"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
- "github.com/zeta-chain/zetacore/x/crosschain/types"
- 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
-func (k Keeper) IsAuthorizedNodeAccount(ctx sdk.Context, address string) bool {
- _, found := k.zetaObserverKeeper.GetNodeAccount(ctx, address)
- if found {
- return true
- }
- return false
-}
-
-// PayGasInZetaAndUpdateCctx updates parameter cctx with the gas price and gas fee for the outbound tx;
-// it also makes a trade to fulfill the outbound tx gas fee in ZETA by swapping ZETA for some gas ZRC20 balances
-// The gas ZRC20 balance is subsequently burned to account for the expense of TSS address gas fee payment in the outbound tx.
-// **Caller should feed temporary ctx into this function**
-func (k Keeper) PayGasInZetaAndUpdateCctx(ctx sdk.Context, chainID int64, cctx *types.CrossChainTx, noEthereumTxEvent bool) error {
- // TODO: this check currently break the integration tests, enable it when integration tests are fixed
- // https://github.com/zeta-chain/node/issues/1022
- //if cctx.InboundTxParams.CoinType != common.CoinType_Zeta {
- // return sdkerrors.Wrapf(zetaObserverTypes.ErrInvalidCoinType, "can't pay gas in zeta with %s", cctx.InboundTxParams.CoinType.String())
- //}
-
- chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(chainID)
- if chain == nil {
- return zetaObserverTypes.ErrSupportedChains
- }
- medianGasPrice, isFound := k.GetMedianGasPriceInUint(ctx, chain.ChainId)
- if !isFound {
- return sdkerrors.Wrap(types.ErrUnableToGetGasPrice, fmt.Sprintf(" chain %d | Identifiers : %s ",
- cctx.GetCurrentOutTxParam().ReceiverChainId,
- cctx.LogIdentifierForCCTX()),
- )
- }
- medianGasPrice = medianGasPrice.MulUint64(2) // overpays gas price by 2x
- cctx.GetCurrentOutTxParam().OutboundTxGasPrice = medianGasPrice.String()
- gasLimit := sdk.NewUint(cctx.GetCurrentOutTxParam().OutboundTxGasLimit)
- outTxGasFee := gasLimit.Mul(medianGasPrice)
-
- // the following logic computes outbound tx gas fee, and convert into ZETA using system uniswapv2 pool wzeta/gasZRC20
- gasZRC20, err := k.fungibleKeeper.QuerySystemContractGasCoinZRC20(ctx, big.NewInt(chain.ChainId))
- if err != nil {
- return sdkerrors.Wrap(err, "PayGasInZetaAndUpdateCctx: unable to get system contract gas coin")
- }
-
- outTxGasFeeInZeta, err := k.fungibleKeeper.QueryUniswapv2RouterGetAmountsIn(ctx, outTxGasFee.BigInt(), gasZRC20)
- if err != nil {
- return sdkerrors.Wrap(err, "PayGasInZetaAndUpdateCctx: unable to QueryUniswapv2RouterGetAmountsIn")
- }
- feeInZeta := types.GetProtocolFee().Add(math.NewUintFromBigInt(outTxGasFeeInZeta))
-
- cctx.ZetaFees = cctx.ZetaFees.Add(feeInZeta)
-
- if cctx.ZetaFees.GT(cctx.InboundTxParams.Amount) {
- return sdkerrors.Wrap(types.ErrNotEnoughZetaBurnt, fmt.Sprintf("feeInZeta(%s) more than zetaBurnt (%s) | Identifiers : %s ",
- cctx.ZetaFees,
- cctx.InboundTxParams.Amount,
- cctx.LogIdentifierForCCTX()),
- )
- }
-
- ctx.Logger().Info("Subtracting amount from inbound tx", "amount", cctx.InboundTxParams.Amount.String(), "feeInZeta",
- cctx.ZetaFees.String())
- cctx.GetCurrentOutTxParam().Amount = cctx.InboundTxParams.Amount.Sub(cctx.ZetaFees)
-
- // ** The following logic converts the outTxGasFeeInZeta into gasZRC20 and burns it **
- // swap the outTxGasFeeInZeta portion of zeta to the real gas ZRC20 and burn it, in a temporary context.
- {
- coins := sdk.NewCoins(sdk.NewCoin(config.BaseDenom, sdk.NewIntFromBigInt(feeInZeta.BigInt())))
- err := k.bankKeeper.MintCoins(ctx, types.ModuleName, coins)
- if err != nil {
- return sdkerrors.Wrap(err, "PayGasInZetaAndUpdateCctx: unable to mint coins")
- }
-
- amounts, err := k.fungibleKeeper.CallUniswapv2RouterSwapExactETHForToken(
- ctx,
- types.ModuleAddressEVM,
- types.ModuleAddressEVM,
- outTxGasFeeInZeta,
- gasZRC20,
- noEthereumTxEvent,
- )
- if err != nil {
- return sdkerrors.Wrap(err, "PayGasInZetaAndUpdateCctx: unable to CallUniswapv2RouterSwapExactETHForToken")
- }
- ctx.Logger().Info("gas fee", "outTxGasFee", outTxGasFee, "outTxGasFeeInZeta", outTxGasFeeInZeta)
- ctx.Logger().Info("CallUniswapv2RouterSwapExactETHForToken", "zetaAmountIn", amounts[0], "zrc20AmountOut", amounts[1])
- err = k.fungibleKeeper.CallZRC20Burn(ctx, types.ModuleAddressEVM, gasZRC20, amounts[1], noEthereumTxEvent)
- if err != nil {
- return sdkerrors.Wrap(err, "PayGasInZetaAndUpdateCctx: unable to CallZRC20Burn")
- }
- }
-
- return nil
-}
-
-// UpdateNonce sets the CCTX outbound nonce to the next nonce, and updates the nonce of blockchain state.
-// It also updates the PendingNonces that is used to track the unfulfilled outbound txs.
-func (k Keeper) UpdateNonce(ctx sdk.Context, receiveChainID int64, cctx *types.CrossChainTx) error {
- chain := k.zetaObserverKeeper.GetParams(ctx).GetChainFromChainID(receiveChainID)
- if chain == nil {
- return zetaObserverTypes.ErrSupportedChains
- }
-
- nonce, found := k.GetChainNonces(ctx, chain.ChainName.String())
- if !found {
- return sdkerrors.Wrap(types.ErrCannotFindReceiverNonce, fmt.Sprintf("Chain(%s) | Identifiers : %s ", chain.ChainName.String(), cctx.LogIdentifierForCCTX()))
- }
-
- // SET nonce
- cctx.GetCurrentOutTxParam().OutboundTxTssNonce = nonce.Nonce
- tss, found := k.GetTSS(ctx)
- if !found {
- return sdkerrors.Wrap(types.ErrCannotFindTSSKeys, fmt.Sprintf("Chain(%s) | Identifiers : %s ", chain.ChainName.String(), cctx.LogIdentifierForCCTX()))
- }
-
- p, found := k.GetPendingNonces(ctx, tss.TssPubkey, uint64(receiveChainID))
- if !found {
- return sdkerrors.Wrap(types.ErrCannotFindPendingNonces, fmt.Sprintf("chain_id %d, nonce %d", receiveChainID, nonce.Nonce))
- }
-
- if p.NonceHigh != int64(nonce.Nonce) {
- return sdkerrors.Wrap(types.ErrNonceMismatch, fmt.Sprintf("chain_id %d, high nonce %d, current nonce %d", receiveChainID, p.NonceHigh, nonce.Nonce))
- }
-
- nonce.Nonce++
- p.NonceHigh++
- k.SetChainNonces(ctx, nonce)
- k.SetPendingNonces(ctx, p)
- return nil
-}
diff --git a/x/crosschain/keeper/msg_server_whitelist_erc20.go b/x/crosschain/keeper/msg_server_whitelist_erc20.go
index 5075ee69d4..a4118fc774 100644
--- a/x/crosschain/keeper/msg_server_whitelist_erc20.go
+++ b/x/crosschain/keeper/msg_server_whitelist_erc20.go
@@ -20,7 +20,7 @@ import (
func (k Keeper) WhitelistERC20(goCtx context.Context, msg *types.MsgWhitelistERC20) (*types.MsgWhitelistERC20Response, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
- if msg.Creator != k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_deploy_fungible_coin) {
+ if msg.Creator != k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_group1) {
return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Deploy can only be executed by the correct policy account")
}
erc20Addr := ethcommon.HexToAddress(msg.Erc20Address)
@@ -48,7 +48,17 @@ func (k Keeper) WhitelistERC20(goCtx context.Context, msg *types.MsgWhitelistERC
tmpCtx, commit := ctx.CacheContext()
// add to the foreign coins. Deploy ZRC20 contract for it.
- zrc20Addr, err := k.fungibleKeeper.DeployZRC20Contract(tmpCtx, msg.Name, msg.Symbol, uint8(msg.Decimals), chain.ChainId, common.CoinType_ERC20, msg.Erc20Address, big.NewInt(msg.GasLimit))
+ zrc20Addr, err := k.fungibleKeeper.DeployZRC20Contract(
+ tmpCtx,
+ msg.Name,
+ msg.Symbol,
+ // #nosec G701 always in range
+ uint8(msg.Decimals),
+ chain.ChainId,
+ common.CoinType_ERC20,
+ msg.Erc20Address,
+ big.NewInt(msg.GasLimit),
+ )
if err != nil {
return nil, sdkerrors.Wrapf(types.ErrDeployContract, "failed to deploy ZRC20 contract for ERC20 contract address (%s) on chain (%d)", msg.Erc20Address, msg.ChainId)
}
@@ -122,7 +132,8 @@ func (k Keeper) WhitelistERC20(goCtx context.Context, msg *types.MsgWhitelistERC
Name: msg.Name,
Symbol: msg.Symbol,
CoinType: common.CoinType_ERC20,
- GasLimit: uint64(msg.GasLimit),
+ // #nosec G701 always positive
+ GasLimit: uint64(msg.GasLimit),
}
k.fungibleKeeper.SetForeignCoins(ctx, foreignCoin)
k.SetCctxAndNonceToCctxAndInTxHashToCctx(ctx, cctx)
diff --git a/x/crosschain/keeper/keeper_tss_voter.go b/x/crosschain/keeper/msg_tss_voter.go
similarity index 90%
rename from x/crosschain/keeper/keeper_tss_voter.go
rename to x/crosschain/keeper/msg_tss_voter.go
index f28904ba66..f81f43cd7b 100644
--- a/x/crosschain/keeper/keeper_tss_voter.go
+++ b/x/crosschain/keeper/msg_tss_voter.go
@@ -16,7 +16,7 @@ import (
// MESSAGES
-// Vote on creating a TSS key and recording the information about it (public
+// CreateTSSVoter votes on creating a TSS key and recording the information about it (public
// key, participant and operator addresses, finalized and keygen heights).
//
// If the vote passes, the information about the TSS key is recorded on chain
@@ -64,7 +64,7 @@ func (k msgServer) CreateTSSVoter(goCtx context.Context, msg *types.MsgCreateTSS
}
k.zetaObserverKeeper.AddBallotToList(ctx, ballot)
}
- err := error(nil)
+ var err error
if msg.Status == common.ReceiveStatus_Success {
ballot, err = k.zetaObserverKeeper.AddVoteToBallot(ctx, ballot, msg.Creator, observerTypes.VoteType_SuccessObservation)
if err != nil {
@@ -117,7 +117,7 @@ func (k msgServer) CreateTSSVoter(goCtx context.Context, msg *types.MsgCreateTSS
func (k msgServer) UpdateTssAddress(goCtx context.Context, msg *types.MsgUpdateTssAddress) (*types.MsgUpdateTssAddressResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
// TODO : Add a new policy type for updating the TSS address
- if msg.Creator != k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(observerTypes.Policy_Type_update_keygen_block) {
+ if msg.Creator != k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(observerTypes.Policy_Type_group2) {
return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "Update can only be executed by the correct policy account")
}
tss, ok := k.CheckIfTssPubkeyHasBeenGenerated(ctx, msg.TssPubkey)
@@ -128,3 +128,12 @@ func (k msgServer) UpdateTssAddress(goCtx context.Context, msg *types.MsgUpdateT
return &types.MsgUpdateTssAddressResponse{}, nil
}
+
+// IsAuthorizedNodeAccount checks whether a signer is authorized to sign , by checking their address against the observer mapper which contains the observer list for the chain and type
+func (k Keeper) IsAuthorizedNodeAccount(ctx sdk.Context, address string) bool {
+ _, found := k.zetaObserverKeeper.GetNodeAccount(ctx, address)
+ if found {
+ return true
+ }
+ return false
+}
diff --git a/x/crosschain/keeper/test_privnet.go b/x/crosschain/keeper/test_privnet.go
index 80efb8bb12..db2f68b2ad 100644
--- a/x/crosschain/keeper/test_privnet.go
+++ b/x/crosschain/keeper/test_privnet.go
@@ -12,7 +12,7 @@ import (
func (k Keeper) TestWhitelistERC20(ctx sdk.Context) error {
goCtx := sdk.UnwrapSDKContext(ctx)
- creator := k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_deploy_fungible_coin)
+ creator := k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_group1)
msg := types.NewMsgWhitelistERC20(creator, types.ModuleAddressEVM.Hex(), common.GoerliChain().ChainId, "test", "testerc20", 17, 90_000)
_, err := k.WhitelistERC20(goCtx, msg)
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..5bfb68a455 100644
--- a/x/crosschain/keeper/zeta_conversion_rate.go
+++ b/x/crosschain/keeper/zeta_conversion_rate.go
@@ -30,18 +30,19 @@ func (k Keeper) ConvertGasToZeta(context context.Context, request *types.QueryCo
if err != nil {
return nil, status.Error(codes.NotFound, "zrc20 not found")
}
- outTxGasFeeInZeta, err := k.fungibleKeeper.QueryUniswapv2RouterGetAmountsIn(ctx, outTxGasFee.BigInt(), zrc20)
+ outTxGasFeeInZeta, err := k.fungibleKeeper.QueryUniswapV2RouterGetZetaAmountsIn(ctx, outTxGasFee.BigInt(), zrc20)
if err != nil {
return nil, status.Error(codes.Internal, "zQueryUniswapv2RouterGetAmountsIn failed")
}
return &types.QueryConvertGasToZetaResponse{
OutboundGasInZeta: outTxGasFeeInZeta.String(),
ProtocolFeeInZeta: types.GetProtocolFee().String(),
- ZetaBlockHeight: uint64(ctx.BlockHeight()),
+ // #nosec G701 always positive
+ ZetaBlockHeight: uint64(ctx.BlockHeight()),
}, 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/migrations/v2/migrate.go b/x/crosschain/migrations/v2/migrate.go
index eb788042b6..0461ba107a 100644
--- a/x/crosschain/migrations/v2/migrate.go
+++ b/x/crosschain/migrations/v2/migrate.go
@@ -21,7 +21,7 @@ func MigrateStore(
// Using New Types from observer module as the structure is the same
var nodeAccounts []observerTypes.NodeAccount
- var permissionFlags observerTypes.PermissionFlags
+ var crosschainFlags observerTypes.CrosschainFlags
var keygen observerTypes.Keygen
writePermissionFlags := false
writeKeygen := false
@@ -46,7 +46,7 @@ func MigrateStore(
store = prefix.NewStore(ctx.KVStore(crossChainStoreKey), types.KeyPrefix(LegacyPermissionFlagsKey))
b = store.Get([]byte{0})
if b != nil {
- cdc.MustUnmarshal(b, &permissionFlags)
+ cdc.MustUnmarshal(b, &crosschainFlags)
writePermissionFlags = true
}
@@ -60,7 +60,7 @@ func MigrateStore(
observerKeeper.SetKeygen(ctx, keygen)
}
if writePermissionFlags {
- observerKeeper.SetPermissionFlags(ctx, permissionFlags)
+ observerKeeper.SetCrosschainFlags(ctx, crosschainFlags)
}
allObservers := observerKeeper.GetAllObserverMappers(ctx)
@@ -69,6 +69,7 @@ func MigrateStore(
totalObserverCountCurrentBlock += len(observer.ObserverList)
}
observerKeeper.SetLastObserverCount(ctx, &observerTypes.LastObserverCount{
+ // #nosec G701 always positive
Count: uint64(totalObserverCountCurrentBlock),
LastChangeHeight: ctx.BlockHeight(),
})
diff --git a/x/crosschain/module.go b/x/crosschain/module.go
index 79543b077d..4be40efde9 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.
@@ -108,16 +107,20 @@ type AppModule struct {
keeper keeper.Keeper
stakingKeeper types.StakingKeeper
+ authKeeper types.AccountKeeper
}
func NewAppModule(
cdc codec.Codec,
keeper keeper.Keeper,
- stakingKeeper types.StakingKeeper) AppModule {
+ stakingKeeper types.StakingKeeper,
+ authKeeper types.AccountKeeper,
+) AppModule {
return AppModule{
AppModuleBasic: NewAppModuleBasic(cdc),
keeper: keeper,
stakingKeeper: stakingKeeper,
+ authKeeper: authKeeper,
}
}
@@ -135,7 +138,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
}
@@ -165,6 +168,9 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.Ra
InitGenesis(ctx, am.keeper, genState)
+ // ensure account is created
+ am.authKeeper.GetModuleAccount(ctx, types.ModuleName)
+
return []abci.ValidatorUpdate{}
}
@@ -185,15 +191,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/cctx_utils.go b/x/crosschain/types/cctx_utils.go
index ba2afd7918..d6807b63b1 100644
--- a/x/crosschain/types/cctx_utils.go
+++ b/x/crosschain/types/cctx_utils.go
@@ -5,16 +5,32 @@ import (
"github.com/zeta-chain/zetacore/x/observer/types"
)
+// GetCurrentOutTxParam returns the current outbound tx params.
// There can only be one active outtx.
// OutboundTxParams[0] is the original outtx, if it reverts, then
// OutboundTxParams[1] is the new outtx.
-func (m *CrossChainTx) GetCurrentOutTxParam() *OutboundTxParams {
+func (m CrossChainTx) GetCurrentOutTxParam() *OutboundTxParams {
if len(m.OutboundTxParams) == 0 {
return &OutboundTxParams{}
}
return m.OutboundTxParams[len(m.OutboundTxParams)-1]
}
+// IsCurrentOutTxRevert returns true if the current outbound tx is the revert tx.
+func (m CrossChainTx) IsCurrentOutTxRevert() bool {
+ return len(m.OutboundTxParams) == 2
+}
+
+// OriginalDestinationChainID returns the original destination of the outbound tx, reverted or not
+// If there is no outbound tx, return -1
+func (m CrossChainTx) OriginalDestinationChainID() int64 {
+ if len(m.OutboundTxParams) == 0 {
+ return -1
+ }
+ return m.OutboundTxParams[0].ReceiverChainId
+}
+
+// GetAllAuthzZetaclientTxTypes returns all the authz types for zetaclient
func GetAllAuthzZetaclientTxTypes() []string {
return []string{
sdk.MsgTypeURL(&MsgNonceVoter{}),
@@ -26,5 +42,6 @@ func GetAllAuthzZetaclientTxTypes() []string {
sdk.MsgTypeURL(&MsgAddToOutTxTracker{}),
sdk.MsgTypeURL(&MsgSetNodeKeys{}),
sdk.MsgTypeURL(&types.MsgAddBlameVote{}),
+ sdk.MsgTypeURL(&types.MsgAddBlockHeader{}),
}
}
diff --git a/x/crosschain/types/cctx_utils_test.go b/x/crosschain/types/cctx_utils_test.go
new file mode 100644
index 0000000000..4fec09f3b6
--- /dev/null
+++ b/x/crosschain/types/cctx_utils_test.go
@@ -0,0 +1,52 @@
+package types_test
+
+import (
+ "math/rand"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+ "github.com/zeta-chain/zetacore/testutil/sample"
+ "github.com/zeta-chain/zetacore/x/crosschain/types"
+)
+
+func TestCrossChainTx_GetCurrentOutTxParam(t *testing.T) {
+ r := rand.New(rand.NewSource(42))
+ cctx := sample.CrossChainTx(t, "foo")
+
+ cctx.OutboundTxParams = []*types.OutboundTxParams{}
+ require.Equal(t, &types.OutboundTxParams{}, cctx.GetCurrentOutTxParam())
+
+ cctx.OutboundTxParams = []*types.OutboundTxParams{sample.OutboundTxParams(r)}
+ require.Equal(t, cctx.OutboundTxParams[0], cctx.GetCurrentOutTxParam())
+
+ cctx.OutboundTxParams = []*types.OutboundTxParams{sample.OutboundTxParams(r), sample.OutboundTxParams(r)}
+ require.Equal(t, cctx.OutboundTxParams[1], cctx.GetCurrentOutTxParam())
+}
+
+func TestCrossChainTx_IsCurrentOutTxRevert(t *testing.T) {
+ r := rand.New(rand.NewSource(42))
+ cctx := sample.CrossChainTx(t, "foo")
+
+ cctx.OutboundTxParams = []*types.OutboundTxParams{}
+ require.False(t, cctx.IsCurrentOutTxRevert())
+
+ cctx.OutboundTxParams = []*types.OutboundTxParams{sample.OutboundTxParams(r)}
+ require.False(t, cctx.IsCurrentOutTxRevert())
+
+ cctx.OutboundTxParams = []*types.OutboundTxParams{sample.OutboundTxParams(r), sample.OutboundTxParams(r)}
+ require.True(t, cctx.IsCurrentOutTxRevert())
+}
+
+func TestCrossChainTx_OriginalDestinationChainID(t *testing.T) {
+ r := rand.New(rand.NewSource(42))
+ cctx := sample.CrossChainTx(t, "foo")
+
+ cctx.OutboundTxParams = []*types.OutboundTxParams{}
+ require.Equal(t, int64(-1), cctx.OriginalDestinationChainID())
+
+ cctx.OutboundTxParams = []*types.OutboundTxParams{sample.OutboundTxParams(r)}
+ require.Equal(t, cctx.OutboundTxParams[0].ReceiverChainId, cctx.OriginalDestinationChainID())
+
+ cctx.OutboundTxParams = []*types.OutboundTxParams{sample.OutboundTxParams(r), sample.OutboundTxParams(r)}
+ require.Equal(t, cctx.OutboundTxParams[0].ReceiverChainId, cctx.OriginalDestinationChainID())
+}
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, 0x0b, 0xe1, 0x0f, 0x29, 0x8b, 0x7a, 0x5a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 0x0c, 0x23, 0x69, 0xe7, 0xc9, 0x1d, 0x28, 0x1a, 0x19, 0x03, 0x7b, 0x91, 0x94, 0x61, 0xe9,
+ 0x69, 0x97, 0x6b, 0xa5, 0xb0, 0x91, 0xff, 0xf9, 0xc7, 0x9a, 0xb5, 0xf3, 0xd5, 0xbb, 0xcb, 0x9a,
+ 0xf5, 0xfe, 0xb2, 0x66, 0xfd, 0x71, 0x59, 0xb3, 0x7e, 0xb8, 0xaa, 0x2d, 0xbc, 0xbf, 0xaa, 0x2d,
+ 0xfc, 0x76, 0x55, 0x5b, 0x38, 0xd9, 0xca, 0x50, 0x41, 0x95, 0xb6, 0x69, 0xbe, 0x5a, 0xd2, 0x2a,
+ 0x3b, 0x71, 0x27, 0xf3, 0x2d, 0xa3, 0x99, 0xd1, 0x2d, 0xe8, 0x2f, 0x8f, 0xcf, 0xfe, 0x0a, 0x00,
+ 0x00, 0xff, 0xff, 0x46, 0x27, 0x16, 0x29, 0xe6, 0x08, 0x00, 0x00,
}
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..b8191ef9fa 100644
--- a/x/crosschain/types/errors.go
+++ b/x/crosschain/types/errors.go
@@ -5,28 +5,37 @@ import (
)
var (
- ErrUnsupportedChain = errorsmod.Register(ModuleName, 1102, "chain parse error")
- ErrInvalidChainID = errorsmod.Register(ModuleName, 1101, "chain id cannot be negative")
- ErrInvalidPubKeySet = errorsmod.Register(ModuleName, 1106, "invalid pubkeyset")
- ErrUnableToGetGasPrice = errorsmod.Register(ModuleName, 1107, "unable to get gas price")
- ErrNotEnoughZetaBurnt = errorsmod.Register(ModuleName, 1109, "not enough zeta burnt")
- ErrCannotFindReceiverNonce = errorsmod.Register(ModuleName, 1110, "cannot find receiver chain nonce")
- ErrCannotFindPendingTxQueue = errorsmod.Register(ModuleName, 1111, "cannot find pending tx queue")
+ ErrUnsupportedChain = errorsmod.Register(ModuleName, 1102, "chain parse error")
+ ErrInvalidChainID = errorsmod.Register(ModuleName, 1101, "chain id cannot be negative")
+ ErrInvalidPubKeySet = errorsmod.Register(ModuleName, 1106, "invalid pubkeyset")
+ ErrUnableToGetGasPrice = errorsmod.Register(ModuleName, 1107, "unable to get gas price")
+ ErrNotEnoughZetaBurnt = errorsmod.Register(ModuleName, 1109, "not enough zeta burnt")
+ ErrCannotFindReceiverNonce = errorsmod.Register(ModuleName, 1110, "cannot find receiver chain nonce")
- ErrGasCoinNotFound = errorsmod.Register(ModuleName, 1113, "Err gas coin not found for SenderChain")
- ErrUnableToDepositZRC20 = errorsmod.Register(ModuleName, 1114, "Unable to deposit ZRC20 ")
- ErrUnableToParseContract = errorsmod.Register(ModuleName, 1115, "Cannot parse contract and data")
- ErrCannotProcessWithdrawal = errorsmod.Register(ModuleName, 1116, "Cannot process withdrawal event")
- ErrForeignCoinNotFound = errorsmod.Register(ModuleName, 1118, "Err gas coin not found for SenderChain")
- ErrNotEnoughPermissions = errorsmod.Register(ModuleName, 1119, "Not enough permissions for current actions")
+ ErrGasCoinNotFound = errorsmod.Register(ModuleName, 1113, "gas coin not found for SenderChain")
+ ErrUnableToParseContract = errorsmod.Register(ModuleName, 1115, "cannot parse contract and data")
+ ErrCannotProcessWithdrawal = errorsmod.Register(ModuleName, 1116, "cannot process withdrawal event")
+ ErrForeignCoinNotFound = errorsmod.Register(ModuleName, 1118, "gas coin not found for SenderChain")
+ ErrNotEnoughPermissions = errorsmod.Register(ModuleName, 1119, "not enough permissions for current actions")
- ErrCannotFindPendingNonces = errorsmod.Register(ModuleName, 1121, "Err Cannot find pending nonces")
- ErrCannotFindTSSKeys = errorsmod.Register(ModuleName, 1122, "Err Cannot find TSS keys")
- ErrNonceMismatch = errorsmod.Register(ModuleName, 1123, "Err Nonce mismatch")
- ErrNotFoundCoreParams = errorsmod.Register(ModuleName, 1126, "Not found chain core params")
- ErrUnableToSendCoinType = errorsmod.Register(ModuleName, 1127, "Unable to send this coin type to a receiver chain")
+ ErrCannotFindPendingNonces = errorsmod.Register(ModuleName, 1121, "cannot find pending nonces")
+ ErrCannotFindTSSKeys = errorsmod.Register(ModuleName, 1122, "cannot find TSS keys")
+ ErrNonceMismatch = errorsmod.Register(ModuleName, 1123, "nonce mismatch")
+ ErrNotFoundCoreParams = errorsmod.Register(ModuleName, 1126, "not found chain core params")
+ ErrUnableToSendCoinType = errorsmod.Register(ModuleName, 1127, "unable to send this coin type to a receiver chain")
- 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")
+ 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")
+ ErrNotEnoughGas = errorsmod.Register(ModuleName, 1131, "not enough gas")
+ ErrNotEnoughFunds = errorsmod.Register(ModuleName, 1132, "not enough funds")
+
+ ErrProofVerificationFail = errorsmod.Register(ModuleName, 1133, "Proof verification fail")
+ ErrCannotFindCctx = errorsmod.Register(ModuleName, 1134, "Cannot find cctx")
+ ErrStatusNotPending = errorsmod.Register(ModuleName, 1135, "Status not pending")
+
+ ErrCannotFindGasParams = errorsmod.Register(ModuleName, 1136, "cannot find gas params")
+ ErrInvalidGasAmount = errorsmod.Register(ModuleName, 1137, "invalid gas amount")
+ ErrNoLiquidityPool = errorsmod.Register(ModuleName, 1138, "no liquidity pool")
+ ErrInvalidCoinType = errorsmod.Register(ModuleName, 1139, "invalid coin type")
)
diff --git a/x/crosschain/types/events.pb.go b/x/crosschain/types/events.pb.go
index 0c60abeaaa..3fbc7f3fa3 100644
--- a/x/crosschain/types/events.pb.go
+++ b/x/crosschain/types/events.pb.go
@@ -358,11 +358,11 @@ func (m *EventZetaWithdrawCreated) GetNewStatus() string {
}
type EventOutboundFailure struct {
- MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"`
- CctxIndex string `protobuf:"bytes,2,opt,name=cctx_index,json=cctxIndex,proto3" json:"cctx_index,omitempty"`
- OldStatus string `protobuf:"bytes,3,opt,name=old_status,json=oldStatus,proto3" json:"old_status,omitempty"`
- NewStatus string `protobuf:"bytes,4,opt,name=new_status,json=newStatus,proto3" json:"new_status,omitempty"`
- ZetaMinted string `protobuf:"bytes,5,opt,name=zeta_minted,json=zetaMinted,proto3" json:"zeta_minted,omitempty"`
+ MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"`
+ CctxIndex string `protobuf:"bytes,2,opt,name=cctx_index,json=cctxIndex,proto3" json:"cctx_index,omitempty"`
+ OldStatus string `protobuf:"bytes,3,opt,name=old_status,json=oldStatus,proto3" json:"old_status,omitempty"`
+ NewStatus string `protobuf:"bytes,4,opt,name=new_status,json=newStatus,proto3" json:"new_status,omitempty"`
+ ValueReceived string `protobuf:"bytes,5,opt,name=value_received,json=valueReceived,proto3" json:"value_received,omitempty"`
}
func (m *EventOutboundFailure) Reset() { *m = EventOutboundFailure{} }
@@ -426,19 +426,19 @@ func (m *EventOutboundFailure) GetNewStatus() string {
return ""
}
-func (m *EventOutboundFailure) GetZetaMinted() string {
+func (m *EventOutboundFailure) GetValueReceived() string {
if m != nil {
- return m.ZetaMinted
+ return m.ValueReceived
}
return ""
}
type EventOutboundSuccess struct {
- MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"`
- CctxIndex string `protobuf:"bytes,2,opt,name=cctx_index,json=cctxIndex,proto3" json:"cctx_index,omitempty"`
- OldStatus string `protobuf:"bytes,3,opt,name=old_status,json=oldStatus,proto3" json:"old_status,omitempty"`
- NewStatus string `protobuf:"bytes,4,opt,name=new_status,json=newStatus,proto3" json:"new_status,omitempty"`
- ZetaMinted string `protobuf:"bytes,5,opt,name=zeta_minted,json=zetaMinted,proto3" json:"zeta_minted,omitempty"`
+ MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"`
+ CctxIndex string `protobuf:"bytes,2,opt,name=cctx_index,json=cctxIndex,proto3" json:"cctx_index,omitempty"`
+ OldStatus string `protobuf:"bytes,3,opt,name=old_status,json=oldStatus,proto3" json:"old_status,omitempty"`
+ NewStatus string `protobuf:"bytes,4,opt,name=new_status,json=newStatus,proto3" json:"new_status,omitempty"`
+ ValueReceived string `protobuf:"bytes,5,opt,name=value_received,json=valueReceived,proto3" json:"value_received,omitempty"`
}
func (m *EventOutboundSuccess) Reset() { *m = EventOutboundSuccess{} }
@@ -502,9 +502,9 @@ func (m *EventOutboundSuccess) GetNewStatus() string {
return ""
}
-func (m *EventOutboundSuccess) GetZetaMinted() string {
+func (m *EventOutboundSuccess) GetValueReceived() string {
if m != nil {
- return m.ZetaMinted
+ return m.ValueReceived
}
return ""
}
@@ -521,43 +521,43 @@ func init() { proto.RegisterFile("crosschain/events.proto", fileDescriptor_7398d
var fileDescriptor_7398db8b12b87b9e = []byte{
// 586 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0xcd, 0x6e, 0xd4, 0x30,
- 0x10, 0xc7, 0x9b, 0x76, 0x77, 0xbb, 0x3b, 0xfd, 0x92, 0x42, 0xa1, 0xa6, 0xa2, 0xa1, 0x54, 0xe2,
- 0xe3, 0xc2, 0x46, 0x88, 0x37, 0x68, 0x05, 0x6a, 0x85, 0xaa, 0x4a, 0xb4, 0x08, 0xa9, 0x17, 0xcb,
- 0x9b, 0x8c, 0x12, 0x8b, 0xc4, 0xae, 0x6c, 0xa7, 0x4d, 0xfb, 0x14, 0xbc, 0x08, 0x12, 0x27, 0x9e,
- 0x81, 0x63, 0x0f, 0x1c, 0x38, 0xa2, 0xee, 0x8b, 0x20, 0xdb, 0x1b, 0xe8, 0xa6, 0x12, 0x1c, 0x10,
- 0x88, 0xd3, 0x7a, 0x7e, 0x33, 0x99, 0xfd, 0xfb, 0x3f, 0xc9, 0xc0, 0x5a, 0xa2, 0xa4, 0xd6, 0x49,
- 0xce, 0xb8, 0x88, 0xf1, 0x14, 0x85, 0xd1, 0xc3, 0x13, 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 0x79, 0xdd, 0xa2, 0xce, 0x6f, 0x2d, 0x5a, 0xfd, 0xb5, 0x45, 0xdd, 0x05, 0x8b, 0x16,
+ 0x95, 0xef, 0x35, 0x94, 0xef, 0x7f, 0xf0, 0x10, 0x76, 0x7a, 0x81, 0xa6, 0xff, 0x4c, 0xb0, 0x45,
+ 0x35, 0x5a, 0x0d, 0x35, 0x16, 0x29, 0xb7, 0x9b, 0x94, 0x3f, 0x7a, 0x68, 0xdb, 0x52, 0x3e, 0x29,
+ 0xb4, 0xfb, 0x75, 0x29, 0xcb, 0x0a, 0x09, 0x7f, 0x4e, 0x77, 0x0f, 0x21, 0x91, 0xc5, 0xf5, 0x87,
+ 0x1d, 0xe5, 0x9e, 0xc8, 0xe2, 0xea, 0x96, 0x2e, 0xf2, 0x6a, 0xfd, 0xe4, 0x12, 0x8f, 0x69, 0x56,
+ 0x00, 0xa9, 0x8c, 0x89, 0x2b, 0xea, 0x1b, 0x16, 0x3d, 0xad, 0xc0, 0x9b, 0xf4, 0xcf, 0x8a, 0x28,
+ 0x02, 0xa5, 0xfe, 0x0f, 0xfa, 0x07, 0x2f, 0x3f, 0xcd, 0x02, 0xef, 0x6a, 0x16, 0x78, 0x5f, 0x67,
+ 0x81, 0xf7, 0x6e, 0x1e, 0x2c, 0x5d, 0xcd, 0x83, 0xa5, 0x2f, 0xf3, 0x60, 0xe9, 0xe2, 0x69, 0xc2,
+ 0x74, 0x5a, 0x0c, 0x07, 0x91, 0xc8, 0x43, 0xb3, 0x9c, 0x9f, 0xb8, 0xfd, 0x5d, 0xef, 0xe9, 0xb0,
+ 0x0c, 0xaf, 0x6d, 0x75, 0x73, 0x4a, 0x35, 0xec, 0xd8, 0x5d, 0xfc, 0xec, 0x5b, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xee, 0x0c, 0x96, 0x59, 0xf0, 0x05, 0x00, 0x00,
}
func (m *EventInboundFinalized) Marshal() (dAtA []byte, err error) {
@@ -845,10 +845,10 @@ func (m *EventOutboundFailure) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
- if len(m.ZetaMinted) > 0 {
- i -= len(m.ZetaMinted)
- copy(dAtA[i:], m.ZetaMinted)
- i = encodeVarintEvents(dAtA, i, uint64(len(m.ZetaMinted)))
+ if len(m.ValueReceived) > 0 {
+ i -= len(m.ValueReceived)
+ copy(dAtA[i:], m.ValueReceived)
+ i = encodeVarintEvents(dAtA, i, uint64(len(m.ValueReceived)))
i--
dAtA[i] = 0x2a
}
@@ -903,10 +903,10 @@ func (m *EventOutboundSuccess) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
- if len(m.ZetaMinted) > 0 {
- i -= len(m.ZetaMinted)
- copy(dAtA[i:], m.ZetaMinted)
- i = encodeVarintEvents(dAtA, i, uint64(len(m.ZetaMinted)))
+ if len(m.ValueReceived) > 0 {
+ i -= len(m.ValueReceived)
+ copy(dAtA[i:], m.ValueReceived)
+ i = encodeVarintEvents(dAtA, i, uint64(len(m.ValueReceived)))
i--
dAtA[i] = 0x2a
}
@@ -1113,7 +1113,7 @@ func (m *EventOutboundFailure) Size() (n int) {
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
- l = len(m.ZetaMinted)
+ l = len(m.ValueReceived)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
@@ -1142,7 +1142,7 @@ func (m *EventOutboundSuccess) Size() (n int) {
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
- l = len(m.ZetaMinted)
+ l = len(m.ValueReceived)
if l > 0 {
n += 1 + l + sovEvents(uint64(l))
}
@@ -2360,7 +2360,7 @@ func (m *EventOutboundFailure) Unmarshal(dAtA []byte) error {
iNdEx = postIndex
case 5:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field ZetaMinted", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field ValueReceived", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
@@ -2388,7 +2388,7 @@ func (m *EventOutboundFailure) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- m.ZetaMinted = string(dAtA[iNdEx:postIndex])
+ m.ValueReceived = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
@@ -2570,7 +2570,7 @@ func (m *EventOutboundSuccess) Unmarshal(dAtA []byte) error {
iNdEx = postIndex
case 5:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field ZetaMinted", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field ValueReceived", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
@@ -2598,7 +2598,7 @@ func (m *EventOutboundSuccess) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- m.ZetaMinted = string(dAtA[iNdEx:postIndex])
+ m.ValueReceived = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
diff --git a/x/crosschain/types/expected_keepers.go b/x/crosschain/types/expected_keepers.go
index 59d5372749..0ddb010735 100644
--- a/x/crosschain/types/expected_keepers.go
+++ b/x/crosschain/types/expected_keepers.go
@@ -56,16 +56,17 @@ type ZetaObserverKeeper interface {
GetAllNodeAccount(ctx sdk.Context) (nodeAccounts []zetaObserverTypes.NodeAccount)
SetNodeAccount(ctx sdk.Context, nodeAccount zetaObserverTypes.NodeAccount)
IsInboundEnabled(ctx sdk.Context) (found bool)
- IsOutboundAllowed(ctx sdk.Context) (found bool)
+ GetCrosschainFlags(ctx sdk.Context) (val zetaObserverTypes.CrosschainFlags, found bool)
GetKeygen(ctx sdk.Context) (val zetaObserverTypes.Keygen, found bool)
SetKeygen(ctx sdk.Context, keygen zetaObserverTypes.Keygen)
- SetPermissionFlags(ctx sdk.Context, permissionFlags zetaObserverTypes.PermissionFlags)
+ SetCrosschainFlags(ctx sdk.Context, crosschainFlags zetaObserverTypes.CrosschainFlags)
SetLastObserverCount(ctx sdk.Context, lbc *zetaObserverTypes.LastObserverCount)
AddVoteToBallot(ctx sdk.Context, ballot zetaObserverTypes.Ballot, address string, observationType zetaObserverTypes.VoteType) (zetaObserverTypes.Ballot, error)
CheckIfFinalizingVote(ctx sdk.Context, ballot zetaObserverTypes.Ballot) (zetaObserverTypes.Ballot, bool)
IsAuthorized(ctx sdk.Context, address string, chain *common.Chain) (bool, error)
FindBallot(ctx sdk.Context, index string, chain *common.Chain, observationType zetaObserverTypes.ObservationType) (ballot zetaObserverTypes.Ballot, isNew bool, err error)
AddBallotToList(ctx sdk.Context, ballot zetaObserverTypes.Ballot)
+ GetBlockHeader(ctx sdk.Context, hash []byte) (val common.BlockHeader, found bool)
}
type FungibleKeeper interface {
@@ -73,11 +74,23 @@ type FungibleKeeper interface {
GetAllForeignCoins(ctx sdk.Context) (list []fungibletypes.ForeignCoins)
SetForeignCoins(ctx sdk.Context, foreignCoins fungibletypes.ForeignCoins)
GetAllForeignCoinsForChain(ctx sdk.Context, foreignChainID int64) (list []fungibletypes.ForeignCoins)
+ GetForeignCoinFromAsset(ctx sdk.Context, asset string, chainID int64) (fungibletypes.ForeignCoins, bool)
GetSystemContract(ctx sdk.Context) (val fungibletypes.SystemContract, found bool)
QuerySystemContractGasCoinZRC20(ctx sdk.Context, chainID *big.Int) (eth.Address, error)
- QueryUniswapv2RouterGetAmountsIn(ctx sdk.Context, amountOut *big.Int, outZRC4 eth.Address) (*big.Int, error)
+ GetUniswapV2Router02Address(ctx sdk.Context) (eth.Address, error)
+ QueryUniswapV2RouterGetZetaAmountsIn(ctx sdk.Context, amountOut *big.Int, outZRC4 eth.Address) (*big.Int, error)
+ QueryUniswapV2RouterGetZRC4AmountsIn(ctx sdk.Context, amountOut *big.Int, inZRC4 eth.Address) (*big.Int, error)
+ QueryUniswapV2RouterGetZRC4ToZRC4AmountsIn(ctx sdk.Context, amountOut *big.Int, inZRC4, outZRC4 eth.Address) (*big.Int, error)
+ QueryGasLimit(ctx sdk.Context, contract eth.Address) (*big.Int, error)
+ QueryProtocolFlatFee(ctx sdk.Context, contract eth.Address) (*big.Int, error)
SetGasPrice(ctx sdk.Context, chainID *big.Int, gasPrice *big.Int) (uint64, error)
DepositCoinZeta(ctx sdk.Context, to eth.Address, amount *big.Int) error
+ DepositZRC20(
+ ctx sdk.Context,
+ contract eth.Address,
+ to eth.Address,
+ amount *big.Int,
+ ) (*evmtypes.MsgEthereumTxResponse, error)
ZRC20DepositAndCallContract(
ctx sdk.Context,
from []byte,
@@ -90,7 +103,16 @@ type FungibleKeeper interface {
coinType common.CoinType,
asset string,
) (*evmtypes.MsgEthereumTxResponse, error)
- CallUniswapv2RouterSwapExactETHForToken(
+ CallUniswapV2RouterSwapExactTokensForTokens(
+ ctx sdk.Context,
+ sender eth.Address,
+ to eth.Address,
+ amountIn *big.Int,
+ inZRC4,
+ outZRC4 eth.Address,
+ noEthereumTxEvent bool,
+ ) (ret []*big.Int, err error)
+ CallUniswapV2RouterSwapExactETHForToken(
ctx sdk.Context,
sender eth.Address,
to eth.Address,
@@ -99,6 +121,14 @@ type FungibleKeeper interface {
noEthereumTxEvent bool,
) ([]*big.Int, error)
CallZRC20Burn(ctx sdk.Context, sender eth.Address, zrc20address eth.Address, amount *big.Int, noEthereumTxEvent bool) error
+ CallZRC20Approve(
+ ctx sdk.Context,
+ owner eth.Address,
+ zrc20address eth.Address,
+ spender eth.Address,
+ amount *big.Int,
+ noEthereumTxEvent bool,
+ ) error
DeployZRC20Contract(
ctx sdk.Context,
name, symbol string,
@@ -108,4 +138,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/genesis_test.go b/x/crosschain/types/genesis_test.go
index c15934b783..2b8b5eb80f 100644
--- a/x/crosschain/types/genesis_test.go
+++ b/x/crosschain/types/genesis_test.go
@@ -47,9 +47,6 @@ func TestGenesisState_Validate(t *testing.T) {
InTxHash: "1",
},
},
- //PermissionFlags: &types.PermissionFlags{
- // IsInboundEnabled: true,
- //},
},
valid: true,
},
diff --git a/x/crosschain/types/message_add_to_out_tx_tracker.go b/x/crosschain/types/message_add_to_out_tx_tracker.go
index cdb878dd93..06716762a1 100644
--- a/x/crosschain/types/message_add_to_out_tx_tracker.go
+++ b/x/crosschain/types/message_add_to_out_tx_tracker.go
@@ -3,18 +3,30 @@ package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
+ "github.com/zeta-chain/zetacore/common"
)
const TypeMsgAddToOutTxTracker = "AddToTracker"
var _ sdk.Msg = &MsgAddToOutTxTracker{}
-func NewMsgAddToOutTxTracker(creator string, chain int64, nonce uint64, txHash string) *MsgAddToOutTxTracker {
+func NewMsgAddToOutTxTracker(
+ creator string,
+ chain int64,
+ nonce uint64,
+ txHash string,
+ proof *common.Proof,
+ blockHash string,
+ txIndex int64,
+) *MsgAddToOutTxTracker {
return &MsgAddToOutTxTracker{
- Creator: creator,
- ChainId: chain,
- Nonce: nonce,
- TxHash: txHash,
+ Creator: creator,
+ ChainId: chain,
+ Nonce: nonce,
+ TxHash: txHash,
+ Proof: proof,
+ BlockHash: blockHash,
+ TxIndex: txIndex,
}
}
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..bf940f6984 100644
--- a/x/crosschain/types/message_vote_on_observed_outbound_tx.go
+++ b/x/crosschain/types/message_vote_on_observed_outbound_tx.go
@@ -17,7 +17,8 @@ func NewMsgVoteOnObservedOutboundTx(
outBlockHeight,
outTxGasUsed uint64,
outTxEffectiveGasPrice math.Int,
- mMint math.Uint,
+ outTxEffectiveGasLimit uint64,
+ valueReceived math.Uint,
status common.ReceiveStatus,
chain int64,
nonce uint64,
@@ -30,7 +31,8 @@ func NewMsgVoteOnObservedOutboundTx(
ObservedOutTxBlockHeight: outBlockHeight,
ObservedOutTxGasUsed: outTxGasUsed,
ObservedOutTxEffectiveGasPrice: outTxEffectiveGasPrice,
- ZetaMinted: mMint,
+ ObservedOutTxEffectiveGasLimit: outTxEffectiveGasLimit,
+ ValueReceived: valueReceived,
Status: status,
OutTxChain: chain,
OutTxTssNonce: nonce,
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..cce6a29c3c 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,7 +27,8 @@ func TestMsgVoteOnObservedOutboundTx_ValidateBasic(t *testing.T) {
ObservedOutTxBlockHeight: 42,
ObservedOutTxGasUsed: 42,
ObservedOutTxEffectiveGasPrice: math.NewInt(42),
- ZetaMinted: math.NewUint(42),
+ ObservedOutTxEffectiveGasLimit: 42,
+ ValueReceived: math.NewUint(42),
Status: common.ReceiveStatus_Created,
OutTxChain: 42,
OutTxTssNonce: 42,
@@ -42,7 +43,7 @@ func TestMsgVoteOnObservedOutboundTx_ValidateBasic(t *testing.T) {
ObservedOutTxHash: sample.String(),
ObservedOutTxBlockHeight: 42,
ObservedOutTxGasUsed: 42,
- ZetaMinted: math.NewUint(42),
+ ValueReceived: math.NewUint(42),
Status: common.ReceiveStatus_Created,
OutTxChain: 42,
OutTxTssNonce: 42,
@@ -58,7 +59,8 @@ func TestMsgVoteOnObservedOutboundTx_ValidateBasic(t *testing.T) {
ObservedOutTxBlockHeight: 42,
ObservedOutTxGasUsed: 42,
ObservedOutTxEffectiveGasPrice: math.NewInt(42),
- ZetaMinted: math.NewUint(42),
+ ObservedOutTxEffectiveGasLimit: 42,
+ ValueReceived: math.NewUint(42),
Status: common.ReceiveStatus_Created,
OutTxChain: 42,
OutTxTssNonce: 42,
@@ -75,7 +77,8 @@ func TestMsgVoteOnObservedOutboundTx_ValidateBasic(t *testing.T) {
ObservedOutTxBlockHeight: 42,
ObservedOutTxGasUsed: 42,
ObservedOutTxEffectiveGasPrice: math.NewInt(42),
- ZetaMinted: math.NewUint(42),
+ ObservedOutTxEffectiveGasLimit: 42,
+ ValueReceived: math.NewUint(42),
Status: common.ReceiveStatus_Created,
OutTxChain: -1,
OutTxTssNonce: 42,
@@ -106,7 +109,8 @@ func TestMsgVoteOnObservedOutboundTx_Digest(t *testing.T) {
ObservedOutTxBlockHeight: 42,
ObservedOutTxGasUsed: 42,
ObservedOutTxEffectiveGasPrice: math.NewInt(42),
- ZetaMinted: math.NewUint(42),
+ ObservedOutTxEffectiveGasLimit: 42,
+ ValueReceived: math.NewUint(42),
Status: common.ReceiveStatus_Created,
OutTxChain: 42,
OutTxTssNonce: 42,
@@ -157,9 +161,15 @@ 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)
+ msg2.ValueReceived = math.NewUint(43)
hash2 = msg2.Digest()
require.NotEqual(t, hash, hash2, "zeta minted should change hash")
diff --git a/x/crosschain/types/out_tx_tracker.pb.go b/x/crosschain/types/out_tx_tracker.pb.go
index 86eba158a2..d9d021851a 100644
--- a/x/crosschain/types/out_tx_tracker.pb.go
+++ b/x/crosschain/types/out_tx_tracker.pb.go
@@ -26,6 +26,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type TxHashList struct {
TxHash string `protobuf:"bytes,1,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"`
TxSigner string `protobuf:"bytes,2,opt,name=tx_signer,json=txSigner,proto3" json:"tx_signer,omitempty"`
+ Proved bool `protobuf:"varint,3,opt,name=proved,proto3" json:"proved,omitempty"`
}
func (m *TxHashList) Reset() { *m = TxHashList{} }
@@ -75,6 +76,13 @@ func (m *TxHashList) GetTxSigner() string {
return ""
}
+func (m *TxHashList) GetProved() bool {
+ if m != nil {
+ return m.Proved
+ }
+ return false
+}
+
type OutTxTracker struct {
Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"`
ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
@@ -151,25 +159,26 @@ func init() {
func init() { proto.RegisterFile("crosschain/out_tx_tracker.proto", fileDescriptor_5638c11005e4d36d) }
var fileDescriptor_5638c11005e4d36d = []byte{
- // 287 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0xb1, 0x4e, 0xf3, 0x30,
- 0x14, 0x85, 0xeb, 0xbf, 0xfd, 0xdb, 0xc6, 0x30, 0x59, 0x48, 0x04, 0x21, 0x4c, 0xd4, 0x29, 0x0c,
- 0x38, 0x02, 0xde, 0xa0, 0x03, 0x02, 0x81, 0x84, 0x14, 0x32, 0xb1, 0x58, 0x69, 0x62, 0xd5, 0x16,
- 0x10, 0x57, 0xf6, 0x8d, 0x64, 0x78, 0x0a, 0x5e, 0x80, 0xf7, 0x61, 0xec, 0xc8, 0x88, 0x92, 0x17,
- 0x41, 0x71, 0x8a, 0xca, 0xc4, 0x76, 0x8f, 0x8e, 0xee, 0x77, 0xef, 0x39, 0xf8, 0xb8, 0x30, 0xda,
- 0xda, 0x42, 0xe6, 0xaa, 0x4a, 0x74, 0x0d, 0x1c, 0x1c, 0x07, 0x93, 0x17, 0x8f, 0xc2, 0xb0, 0x95,
- 0xd1, 0xa0, 0xc9, 0xd1, 0xab, 0x80, 0xdc, 0xfb, 0xcc, 0x4f, 0xda, 0x08, 0xb6, 0xdd, 0x99, 0xcd,
- 0x31, 0xce, 0xdc, 0x55, 0x6e, 0xe5, 0xad, 0xb2, 0x40, 0xf6, 0xf1, 0x04, 0x1c, 0x97, 0xb9, 0x95,
- 0x21, 0x8a, 0x50, 0x1c, 0xa4, 0x63, 0xf0, 0x26, 0x39, 0xc4, 0x01, 0x38, 0x6e, 0xd5, 0xb2, 0x12,
- 0x26, 0xfc, 0xe7, 0xad, 0x29, 0xb8, 0x7b, 0xaf, 0x67, 0xef, 0x08, 0xef, 0xde, 0xd5, 0x90, 0xb9,
- 0xac, 0xbf, 0x4c, 0xf6, 0xf0, 0x7f, 0x55, 0x95, 0xc2, 0x6d, 0x20, 0xbd, 0x20, 0x07, 0x78, 0xea,
- 0x6f, 0x72, 0x55, 0x7a, 0xc4, 0x30, 0x9d, 0x78, 0x7d, 0x5d, 0x76, 0x0b, 0x95, 0xae, 0x0a, 0x11,
- 0x0e, 0x23, 0x14, 0x8f, 0xd2, 0x5e, 0x90, 0x4b, 0x1c, 0x74, 0xaf, 0xf0, 0x27, 0x65, 0x21, 0x1c,
- 0x45, 0xc3, 0x78, 0xe7, 0xfc, 0x84, 0xfd, 0x19, 0x87, 0x6d, 0xb3, 0xa4, 0x53, 0xb9, 0x99, 0xe6,
- 0x37, 0x1f, 0x0d, 0x45, 0xeb, 0x86, 0xa2, 0xaf, 0x86, 0xa2, 0xb7, 0x96, 0x0e, 0xd6, 0x2d, 0x1d,
- 0x7c, 0xb6, 0x74, 0xf0, 0x70, 0xb6, 0x54, 0x20, 0xeb, 0x05, 0x2b, 0xf4, 0x73, 0xd2, 0xe1, 0x4e,
- 0xfb, 0x22, 0x7f, 0xc8, 0x89, 0x4b, 0x7e, 0xd5, 0x0b, 0x2f, 0x2b, 0x61, 0x17, 0x63, 0x5f, 0xeb,
- 0xc5, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5f, 0x97, 0x57, 0xaa, 0x79, 0x01, 0x00, 0x00,
+ // 299 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08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70, 0x9d, 0xbc, 0x05, 0xb2, 0x8f, 0x03, 0x9f, 0x85,
+ 0xab, 0xcc, 0xab, 0xfb, 0xf1, 0xc8, 0xf3, 0x75, 0xd6, 0x1c, 0xe4, 0x3a, 0x4f, 0x85, 0x17, 0x0f,
+ 0xe2, 0x16, 0xc8, 0x25, 0x1e, 0x37, 0x11, 0xf9, 0xa3, 0xb2, 0x10, 0x0e, 0x26, 0xfd, 0xd9, 0xd6,
+ 0xd9, 0x31, 0xfb, 0xf3, 0x4d, 0xb6, 0xf9, 0x31, 0x0e, 0x64, 0x37, 0x5d, 0xdc, 0x7c, 0x54, 0x14,
+ 0xad, 0x2b, 0x8a, 0xbe, 0x2a, 0x8a, 0xde, 0x6a, 0xda, 0x5b, 0xd7, 0xb4, 0xf7, 0x59, 0xd3, 0xde,
+ 0xe2, 0x74, 0xa5, 0x40, 0x96, 0x4b, 0x96, 0xea, 0xa7, 0xa8, 0xd1, 0x9d, 0xb4, 0x05, 0xff, 0x98,
+ 0x23, 0x17, 0xfd, 0xaa, 0x1d, 0x5e, 0x0a, 0x61, 0x97, 0x43, 0x5f, 0xf7, 0xf9, 0x77, 0x00, 0x00,
+ 0x00, 0xff, 0xff, 0x0c, 0x73, 0x3d, 0x85, 0x91, 0x01, 0x00, 0x00,
}
func (m *TxHashList) Marshal() (dAtA []byte, err error) {
@@ -192,6 +201,16 @@ func (m *TxHashList) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
+ if m.Proved {
+ i--
+ if m.Proved {
+ dAtA[i] = 1
+ } else {
+ dAtA[i] = 0
+ }
+ i--
+ dAtA[i] = 0x18
+ }
if len(m.TxSigner) > 0 {
i -= len(m.TxSigner)
copy(dAtA[i:], m.TxSigner)
@@ -288,6 +307,9 @@ func (m *TxHashList) Size() (n int) {
if l > 0 {
n += 1 + l + sovOutTxTracker(uint64(l))
}
+ if m.Proved {
+ n += 2
+ }
return n
}
@@ -415,6 +437,26 @@ func (m *TxHashList) Unmarshal(dAtA []byte) error {
}
m.TxSigner = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
+ case 3:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Proved", wireType)
+ }
+ var v int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowOutTxTracker
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ v |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ m.Proved = bool(v != 0)
default:
iNdEx = preIndex
skippy, err := skipOutTxTracker(dAtA[iNdEx:])
diff --git a/x/crosschain/types/params.go b/x/crosschain/types/params.go
index 45f08e2e10..7dda7b56d5 100644
--- a/x/crosschain/types/params.go
+++ b/x/crosschain/types/params.go
@@ -36,6 +36,9 @@ func (p Params) Validate() error {
// String implements the Stringer interface.
func (p Params) String() string {
- out, _ := yaml.Marshal(p)
+ out, err := yaml.Marshal(p)
+ if err != nil {
+ return ""
+ }
return string(out)
}
diff --git a/x/crosschain/types/query.pb.go b/x/crosschain/types/query.pb.go
index 09b7e2755d..4d3496ad39 100644
--- a/x/crosschain/types/query.pb.go
+++ b/x/crosschain/types/query.pb.go
@@ -1562,6 +1562,94 @@ func (m *QueryAllPendingNoncesResponse) GetPendingNonces() []*PendingNonces {
return nil
}
+type QueryPendingNoncesByChainRequest struct {
+ ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
+}
+
+func (m *QueryPendingNoncesByChainRequest) Reset() { *m = QueryPendingNoncesByChainRequest{} }
+func (m *QueryPendingNoncesByChainRequest) String() string { return proto.CompactTextString(m) }
+func (*QueryPendingNoncesByChainRequest) ProtoMessage() {}
+func (*QueryPendingNoncesByChainRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_65a992045e92a606, []int{34}
+}
+func (m *QueryPendingNoncesByChainRequest) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *QueryPendingNoncesByChainRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_QueryPendingNoncesByChainRequest.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 *QueryPendingNoncesByChainRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryPendingNoncesByChainRequest.Merge(m, src)
+}
+func (m *QueryPendingNoncesByChainRequest) XXX_Size() int {
+ return m.Size()
+}
+func (m *QueryPendingNoncesByChainRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryPendingNoncesByChainRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_QueryPendingNoncesByChainRequest proto.InternalMessageInfo
+
+func (m *QueryPendingNoncesByChainRequest) GetChainId() int64 {
+ if m != nil {
+ return m.ChainId
+ }
+ return 0
+}
+
+type QueryPendingNoncesByChainResponse struct {
+ PendingNonces PendingNonces `protobuf:"bytes,1,opt,name=pending_nonces,json=pendingNonces,proto3" json:"pending_nonces"`
+}
+
+func (m *QueryPendingNoncesByChainResponse) Reset() { *m = QueryPendingNoncesByChainResponse{} }
+func (m *QueryPendingNoncesByChainResponse) String() string { return proto.CompactTextString(m) }
+func (*QueryPendingNoncesByChainResponse) ProtoMessage() {}
+func (*QueryPendingNoncesByChainResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor_65a992045e92a606, []int{35}
+}
+func (m *QueryPendingNoncesByChainResponse) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *QueryPendingNoncesByChainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_QueryPendingNoncesByChainResponse.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 *QueryPendingNoncesByChainResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryPendingNoncesByChainResponse.Merge(m, src)
+}
+func (m *QueryPendingNoncesByChainResponse) XXX_Size() int {
+ return m.Size()
+}
+func (m *QueryPendingNoncesByChainResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryPendingNoncesByChainResponse.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_QueryPendingNoncesByChainResponse proto.InternalMessageInfo
+
+func (m *QueryPendingNoncesByChainResponse) GetPendingNonces() PendingNonces {
+ if m != nil {
+ return m.PendingNonces
+ }
+ return PendingNonces{}
+}
+
type QueryGetLastBlockHeightRequest struct {
Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"`
}
@@ -1570,7 +1658,7 @@ func (m *QueryGetLastBlockHeightRequest) Reset() { *m = QueryGetLastBloc
func (m *QueryGetLastBlockHeightRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetLastBlockHeightRequest) ProtoMessage() {}
func (*QueryGetLastBlockHeightRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{34}
+ return fileDescriptor_65a992045e92a606, []int{36}
}
func (m *QueryGetLastBlockHeightRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1614,7 +1702,7 @@ func (m *QueryGetLastBlockHeightResponse) Reset() { *m = QueryGetLastBlo
func (m *QueryGetLastBlockHeightResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetLastBlockHeightResponse) ProtoMessage() {}
func (*QueryGetLastBlockHeightResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{35}
+ return fileDescriptor_65a992045e92a606, []int{37}
}
func (m *QueryGetLastBlockHeightResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1658,7 +1746,7 @@ func (m *QueryAllLastBlockHeightRequest) Reset() { *m = QueryAllLastBloc
func (m *QueryAllLastBlockHeightRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllLastBlockHeightRequest) ProtoMessage() {}
func (*QueryAllLastBlockHeightRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{36}
+ return fileDescriptor_65a992045e92a606, []int{38}
}
func (m *QueryAllLastBlockHeightRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1703,7 +1791,7 @@ func (m *QueryAllLastBlockHeightResponse) Reset() { *m = QueryAllLastBlo
func (m *QueryAllLastBlockHeightResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllLastBlockHeightResponse) ProtoMessage() {}
func (*QueryAllLastBlockHeightResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{37}
+ return fileDescriptor_65a992045e92a606, []int{39}
}
func (m *QueryAllLastBlockHeightResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1754,7 +1842,7 @@ func (m *QueryGetCctxRequest) Reset() { *m = QueryGetCctxRequest{} }
func (m *QueryGetCctxRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetCctxRequest) ProtoMessage() {}
func (*QueryGetCctxRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{38}
+ return fileDescriptor_65a992045e92a606, []int{40}
}
func (m *QueryGetCctxRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1799,7 +1887,7 @@ func (m *QueryGetCctxByNonceRequest) Reset() { *m = QueryGetCctxByNonceR
func (m *QueryGetCctxByNonceRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetCctxByNonceRequest) ProtoMessage() {}
func (*QueryGetCctxByNonceRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{39}
+ return fileDescriptor_65a992045e92a606, []int{41}
}
func (m *QueryGetCctxByNonceRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1850,7 +1938,7 @@ func (m *QueryGetCctxResponse) Reset() { *m = QueryGetCctxResponse{} }
func (m *QueryGetCctxResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetCctxResponse) ProtoMessage() {}
func (*QueryGetCctxResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{40}
+ return fileDescriptor_65a992045e92a606, []int{42}
}
func (m *QueryGetCctxResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1894,7 +1982,7 @@ func (m *QueryAllCctxRequest) Reset() { *m = QueryAllCctxRequest{} }
func (m *QueryAllCctxRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllCctxRequest) ProtoMessage() {}
func (*QueryAllCctxRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{41}
+ return fileDescriptor_65a992045e92a606, []int{43}
}
func (m *QueryAllCctxRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1939,7 +2027,7 @@ func (m *QueryAllCctxResponse) Reset() { *m = QueryAllCctxResponse{} }
func (m *QueryAllCctxResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllCctxResponse) ProtoMessage() {}
func (*QueryAllCctxResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{42}
+ return fileDescriptor_65a992045e92a606, []int{44}
}
func (m *QueryAllCctxResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1983,7 +2071,7 @@ func (m *QueryAllCctxResponse) GetPagination() *query.PageResponse {
}
type QueryAllCctxPendingRequest struct {
- ChainId uint64 `protobuf:"varint,1,opt,name=chainId,proto3" json:"chainId,omitempty"`
+ ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
@@ -1991,7 +2079,7 @@ func (m *QueryAllCctxPendingRequest) Reset() { *m = QueryAllCctxPendingR
func (m *QueryAllCctxPendingRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllCctxPendingRequest) ProtoMessage() {}
func (*QueryAllCctxPendingRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{43}
+ return fileDescriptor_65a992045e92a606, []int{45}
}
func (m *QueryAllCctxPendingRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -2020,7 +2108,7 @@ func (m *QueryAllCctxPendingRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_QueryAllCctxPendingRequest proto.InternalMessageInfo
-func (m *QueryAllCctxPendingRequest) GetChainId() uint64 {
+func (m *QueryAllCctxPendingRequest) GetChainId() int64 {
if m != nil {
return m.ChainId
}
@@ -2043,7 +2131,7 @@ func (m *QueryAllCctxPendingResponse) Reset() { *m = QueryAllCctxPending
func (m *QueryAllCctxPendingResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllCctxPendingResponse) ProtoMessage() {}
func (*QueryAllCctxPendingResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{44}
+ return fileDescriptor_65a992045e92a606, []int{46}
}
func (m *QueryAllCctxPendingResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -2093,7 +2181,7 @@ func (m *QueryLastZetaHeightRequest) Reset() { *m = QueryLastZetaHeightR
func (m *QueryLastZetaHeightRequest) String() string { return proto.CompactTextString(m) }
func (*QueryLastZetaHeightRequest) ProtoMessage() {}
func (*QueryLastZetaHeightRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{45}
+ return fileDescriptor_65a992045e92a606, []int{47}
}
func (m *QueryLastZetaHeightRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -2130,7 +2218,7 @@ func (m *QueryLastZetaHeightResponse) Reset() { *m = QueryLastZetaHeight
func (m *QueryLastZetaHeightResponse) String() string { return proto.CompactTextString(m) }
func (*QueryLastZetaHeightResponse) ProtoMessage() {}
func (*QueryLastZetaHeightResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{46}
+ return fileDescriptor_65a992045e92a606, []int{48}
}
func (m *QueryLastZetaHeightResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -2175,7 +2263,7 @@ func (m *QueryConvertGasToZetaRequest) Reset() { *m = QueryConvertGasToZ
func (m *QueryConvertGasToZetaRequest) String() string { return proto.CompactTextString(m) }
func (*QueryConvertGasToZetaRequest) ProtoMessage() {}
func (*QueryConvertGasToZetaRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{47}
+ return fileDescriptor_65a992045e92a606, []int{49}
}
func (m *QueryConvertGasToZetaRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -2228,7 +2316,7 @@ func (m *QueryConvertGasToZetaResponse) Reset() { *m = QueryConvertGasTo
func (m *QueryConvertGasToZetaResponse) String() string { return proto.CompactTextString(m) }
func (*QueryConvertGasToZetaResponse) ProtoMessage() {}
func (*QueryConvertGasToZetaResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{48}
+ return fileDescriptor_65a992045e92a606, []int{50}
}
func (m *QueryConvertGasToZetaResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -2285,7 +2373,7 @@ func (m *QueryMessagePassingProtocolFeeRequest) Reset() { *m = QueryMess
func (m *QueryMessagePassingProtocolFeeRequest) String() string { return proto.CompactTextString(m) }
func (*QueryMessagePassingProtocolFeeRequest) ProtoMessage() {}
func (*QueryMessagePassingProtocolFeeRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{49}
+ return fileDescriptor_65a992045e92a606, []int{51}
}
func (m *QueryMessagePassingProtocolFeeRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -2324,7 +2412,7 @@ func (m *QueryMessagePassingProtocolFeeResponse) Reset() {
func (m *QueryMessagePassingProtocolFeeResponse) String() string { return proto.CompactTextString(m) }
func (*QueryMessagePassingProtocolFeeResponse) ProtoMessage() {}
func (*QueryMessagePassingProtocolFeeResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{50}
+ return fileDescriptor_65a992045e92a606, []int{52}
}
func (m *QueryMessagePassingProtocolFeeResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -2368,7 +2456,7 @@ func (m *QueryZEVMGetTransactionReceiptRequest) Reset() { *m = QueryZEVM
func (m *QueryZEVMGetTransactionReceiptRequest) String() string { return proto.CompactTextString(m) }
func (*QueryZEVMGetTransactionReceiptRequest) ProtoMessage() {}
func (*QueryZEVMGetTransactionReceiptRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{51}
+ return fileDescriptor_65a992045e92a606, []int{53}
}
func (m *QueryZEVMGetTransactionReceiptRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -2425,7 +2513,7 @@ func (m *QueryZEVMGetTransactionReceiptResponse) Reset() {
func (m *QueryZEVMGetTransactionReceiptResponse) String() string { return proto.CompactTextString(m) }
func (*QueryZEVMGetTransactionReceiptResponse) ProtoMessage() {}
func (*QueryZEVMGetTransactionReceiptResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{52}
+ return fileDescriptor_65a992045e92a606, []int{54}
}
func (m *QueryZEVMGetTransactionReceiptResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -2555,7 +2643,7 @@ func (m *Log) Reset() { *m = Log{} }
func (m *Log) String() string { return proto.CompactTextString(m) }
func (*Log) ProtoMessage() {}
func (*Log) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{53}
+ return fileDescriptor_65a992045e92a606, []int{55}
}
func (m *Log) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -2655,7 +2743,7 @@ func (m *QueryZEVMGetTransactionRequest) Reset() { *m = QueryZEVMGetTran
func (m *QueryZEVMGetTransactionRequest) String() string { return proto.CompactTextString(m) }
func (*QueryZEVMGetTransactionRequest) ProtoMessage() {}
func (*QueryZEVMGetTransactionRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{54}
+ return fileDescriptor_65a992045e92a606, []int{56}
}
func (m *QueryZEVMGetTransactionRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -2715,7 +2803,7 @@ func (m *QueryZEVMGetTransactionResponse) Reset() { *m = QueryZEVMGetTra
func (m *QueryZEVMGetTransactionResponse) String() string { return proto.CompactTextString(m) }
func (*QueryZEVMGetTransactionResponse) ProtoMessage() {}
func (*QueryZEVMGetTransactionResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{55}
+ return fileDescriptor_65a992045e92a606, []int{57}
}
func (m *QueryZEVMGetTransactionResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -2871,7 +2959,7 @@ func (m *QueryZEVMGetBlockByNumberRequest) Reset() { *m = QueryZEVMGetBl
func (m *QueryZEVMGetBlockByNumberRequest) String() string { return proto.CompactTextString(m) }
func (*QueryZEVMGetBlockByNumberRequest) ProtoMessage() {}
func (*QueryZEVMGetBlockByNumberRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{56}
+ return fileDescriptor_65a992045e92a606, []int{58}
}
func (m *QueryZEVMGetBlockByNumberRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -2935,7 +3023,7 @@ func (m *QueryZEVMGetBlockByNumberResponse) Reset() { *m = QueryZEVMGetB
func (m *QueryZEVMGetBlockByNumberResponse) String() string { return proto.CompactTextString(m) }
func (*QueryZEVMGetBlockByNumberResponse) ProtoMessage() {}
func (*QueryZEVMGetBlockByNumberResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_65a992045e92a606, []int{57}
+ return fileDescriptor_65a992045e92a606, []int{59}
}
func (m *QueryZEVMGetBlockByNumberResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -3146,6 +3234,8 @@ func init() {
proto.RegisterType((*QueryAllChainNoncesResponse)(nil), "zetachain.zetacore.crosschain.QueryAllChainNoncesResponse")
proto.RegisterType((*QueryAllPendingNoncesRequest)(nil), "zetachain.zetacore.crosschain.QueryAllPendingNoncesRequest")
proto.RegisterType((*QueryAllPendingNoncesResponse)(nil), "zetachain.zetacore.crosschain.QueryAllPendingNoncesResponse")
+ proto.RegisterType((*QueryPendingNoncesByChainRequest)(nil), "zetachain.zetacore.crosschain.QueryPendingNoncesByChainRequest")
+ proto.RegisterType((*QueryPendingNoncesByChainResponse)(nil), "zetachain.zetacore.crosschain.QueryPendingNoncesByChainResponse")
proto.RegisterType((*QueryGetLastBlockHeightRequest)(nil), "zetachain.zetacore.crosschain.QueryGetLastBlockHeightRequest")
proto.RegisterType((*QueryGetLastBlockHeightResponse)(nil), "zetachain.zetacore.crosschain.QueryGetLastBlockHeightResponse")
proto.RegisterType((*QueryAllLastBlockHeightRequest)(nil), "zetachain.zetacore.crosschain.QueryAllLastBlockHeightRequest")
@@ -3175,199 +3265,203 @@ func init() {
func init() { proto.RegisterFile("crosschain/query.proto", fileDescriptor_65a992045e92a606) }
var fileDescriptor_65a992045e92a606 = []byte{
- // 3067 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x5b, 0x4d, 0x6c, 0x1b, 0xc7,
- 0x15, 0xf6, 0x8a, 0xfa, 0x1d, 0x49, 0x96, 0x3c, 0x56, 0x1c, 0x86, 0xb1, 0x45, 0x67, 0x1d, 0xd9,
- 0x8e, 0x7f, 0xc8, 0x58, 0xb1, 0x95, 0xc4, 0x76, 0x82, 0x48, 0x76, 0xac, 0x18, 0x51, 0x12, 0x75,
- 0xa5, 0xb4, 0x85, 0x8b, 0x96, 0x58, 0x2d, 0xc7, 0xd4, 0x22,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0xf6, 0xf7,
+ 0xcf, 0xe6, 0xb4, 0x0f, 0x3e, 0x9f, 0x3b, 0xf2, 0xe9, 0xe7, 0x73, 0x47, 0xfe, 0xfc, 0xf9, 0xdc,
+ 0x91, 0xfb, 0x57, 0x2b, 0xb6, 0xd8, 0x6a, 0x6e, 0x16, 0x2c, 0xa7, 0xa6, 0x8a, 0xf1, 0x71, 0x14,
+ 0x77, 0x42, 0x12, 0x77, 0x1b, 0x8c, 0x6f, 0x8e, 0x40, 0xda, 0xf3, 0xdc, 0xbf, 0x03, 0x00, 0x00,
+ 0xff, 0xff, 0x22, 0x17, 0xad, 0xf0, 0xf4, 0x35, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -3412,6 +3506,7 @@ type QueryClient interface {
// Queries a list of chainNonces items.
ChainNoncesAll(ctx context.Context, in *QueryAllChainNoncesRequest, opts ...grpc.CallOption) (*QueryAllChainNoncesResponse, error)
PendingNoncesAll(ctx context.Context, in *QueryAllPendingNoncesRequest, opts ...grpc.CallOption) (*QueryAllPendingNoncesResponse, error)
+ PendingNoncesByChain(ctx context.Context, in *QueryPendingNoncesByChainRequest, opts ...grpc.CallOption) (*QueryPendingNoncesByChainResponse, error)
// Queries a lastBlockHeight by index.
LastBlockHeight(ctx context.Context, in *QueryGetLastBlockHeightRequest, opts ...grpc.CallOption) (*QueryGetLastBlockHeightResponse, error)
// Queries a list of lastBlockHeight items.
@@ -3599,6 +3694,15 @@ func (c *queryClient) PendingNoncesAll(ctx context.Context, in *QueryAllPendingN
return out, nil
}
+func (c *queryClient) PendingNoncesByChain(ctx context.Context, in *QueryPendingNoncesByChainRequest, opts ...grpc.CallOption) (*QueryPendingNoncesByChainResponse, error) {
+ out := new(QueryPendingNoncesByChainResponse)
+ err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/PendingNoncesByChain", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
func (c *queryClient) LastBlockHeight(ctx context.Context, in *QueryGetLastBlockHeightRequest, opts ...grpc.CallOption) (*QueryGetLastBlockHeightResponse, error) {
out := new(QueryGetLastBlockHeightResponse)
err := c.cc.Invoke(ctx, "/zetachain.zetacore.crosschain.Query/LastBlockHeight", in, out, opts...)
@@ -3703,6 +3807,7 @@ type QueryServer interface {
// Queries a list of chainNonces items.
ChainNoncesAll(context.Context, *QueryAllChainNoncesRequest) (*QueryAllChainNoncesResponse, error)
PendingNoncesAll(context.Context, *QueryAllPendingNoncesRequest) (*QueryAllPendingNoncesResponse, error)
+ PendingNoncesByChain(context.Context, *QueryPendingNoncesByChainRequest) (*QueryPendingNoncesByChainResponse, error)
// Queries a lastBlockHeight by index.
LastBlockHeight(context.Context, *QueryGetLastBlockHeightRequest) (*QueryGetLastBlockHeightResponse, error)
// Queries a list of lastBlockHeight items.
@@ -3778,6 +3883,9 @@ func (*UnimplementedQueryServer) ChainNoncesAll(ctx context.Context, req *QueryA
func (*UnimplementedQueryServer) PendingNoncesAll(ctx context.Context, req *QueryAllPendingNoncesRequest) (*QueryAllPendingNoncesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method PendingNoncesAll not implemented")
}
+func (*UnimplementedQueryServer) PendingNoncesByChain(ctx context.Context, req *QueryPendingNoncesByChainRequest) (*QueryPendingNoncesByChainResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method PendingNoncesByChain not implemented")
+}
func (*UnimplementedQueryServer) LastBlockHeight(ctx context.Context, req *QueryGetLastBlockHeightRequest) (*QueryGetLastBlockHeightResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method LastBlockHeight not implemented")
}
@@ -4131,6 +4239,24 @@ func _Query_PendingNoncesAll_Handler(srv interface{}, ctx context.Context, dec f
return interceptor(ctx, in, info, handler)
}
+func _Query_PendingNoncesByChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(QueryPendingNoncesByChainRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(QueryServer).PendingNoncesByChain(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/zetachain.zetacore.crosschain.Query/PendingNoncesByChain",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(QueryServer).PendingNoncesByChain(ctx, req.(*QueryPendingNoncesByChainRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
func _Query_LastBlockHeight_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetLastBlockHeightRequest)
if err := dec(in); err != nil {
@@ -4351,6 +4477,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{
MethodName: "PendingNoncesAll",
Handler: _Query_PendingNoncesAll_Handler,
},
+ {
+ MethodName: "PendingNoncesByChain",
+ Handler: _Query_PendingNoncesByChain_Handler,
+ },
{
MethodName: "LastBlockHeight",
Handler: _Query_LastBlockHeight_Handler,
@@ -5582,6 +5712,67 @@ func (m *QueryAllPendingNoncesResponse) MarshalToSizedBuffer(dAtA []byte) (int,
return len(dAtA) - i, nil
}
+func (m *QueryPendingNoncesByChainRequest) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *QueryPendingNoncesByChainRequest) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *QueryPendingNoncesByChainRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.ChainId != 0 {
+ i = encodeVarintQuery(dAtA, i, uint64(m.ChainId))
+ i--
+ dAtA[i] = 0x8
+ }
+ return len(dAtA) - i, nil
+}
+
+func (m *QueryPendingNoncesByChainResponse) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *QueryPendingNoncesByChainResponse) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *QueryPendingNoncesByChainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ {
+ size, err := m.PendingNonces.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintQuery(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0xa
+ return len(dAtA) - i, nil
+}
+
func (m *QueryGetLastBlockHeightRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@@ -7283,6 +7474,29 @@ func (m *QueryAllPendingNoncesResponse) Size() (n int) {
return n
}
+func (m *QueryPendingNoncesByChainRequest) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.ChainId != 0 {
+ n += 1 + sovQuery(uint64(m.ChainId))
+ }
+ return n
+}
+
+func (m *QueryPendingNoncesByChainResponse) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = m.PendingNonces.Size()
+ n += 1 + l + sovQuery(uint64(l))
+ return n
+}
+
func (m *QueryGetLastBlockHeightRequest) Size() (n int) {
if m == nil {
return 0
@@ -10797,6 +11011,158 @@ func (m *QueryAllPendingNoncesResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
+func (m *QueryPendingNoncesByChainRequest) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: QueryPendingNoncesByChainRequest: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: QueryPendingNoncesByChainRequest: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
+ }
+ m.ChainId = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.ChainId |= int64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ default:
+ iNdEx = preIndex
+ skippy, err := skipQuery(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func (m *QueryPendingNoncesByChainResponse) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: QueryPendingNoncesByChainResponse: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: QueryPendingNoncesByChainResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field PendingNonces", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if err := m.PendingNonces.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipQuery(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
func (m *QueryGetLastBlockHeightRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
@@ -11676,7 +12042,7 @@ func (m *QueryAllCctxPendingRequest) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
- m.ChainId |= uint64(b&0x7F) << shift
+ m.ChainId |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
diff --git a/x/crosschain/types/query.pb.gw.go b/x/crosschain/types/query.pb.gw.go
index dceab7699e..78e4bc5ddf 100644
--- a/x/crosschain/types/query.pb.gw.go
+++ b/x/crosschain/types/query.pb.gw.go
@@ -757,6 +757,60 @@ func local_request_Query_PendingNoncesAll_0(ctx context.Context, marshaler runti
}
+func request_Query_PendingNoncesByChain_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryPendingNoncesByChainRequest
+ var metadata runtime.ServerMetadata
+
+ var (
+ val string
+ ok bool
+ err error
+ _ = err
+ )
+
+ val, ok = pathParams["chain_id"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id")
+ }
+
+ protoReq.ChainId, err = runtime.Int64(val)
+
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err)
+ }
+
+ msg, err := client.PendingNoncesByChain(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+
+}
+
+func local_request_Query_PendingNoncesByChain_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryPendingNoncesByChainRequest
+ var metadata runtime.ServerMetadata
+
+ var (
+ val string
+ ok bool
+ err error
+ _ = err
+ )
+
+ val, ok = pathParams["chain_id"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id")
+ }
+
+ protoReq.ChainId, err = runtime.Int64(val)
+
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err)
+ }
+
+ msg, err := server.PendingNoncesByChain(ctx, &protoReq)
+ return msg, metadata, err
+
+}
+
func request_Query_LastBlockHeight_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryGetLastBlockHeightRequest
var metadata runtime.ServerMetadata
@@ -1505,6 +1559,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
})
+ mux.Handle("GET", pattern_Query_PendingNoncesByChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_Query_PendingNoncesByChain_0(rctx, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ ctx = runtime.NewServerMetadataContext(ctx, md)
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_Query_PendingNoncesByChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
mux.Handle("GET", pattern_Query_LastBlockHeight_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -2090,6 +2167,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
})
+ mux.Handle("GET", pattern_Query_PendingNoncesByChain_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ rctx, err := runtime.AnnotateContext(ctx, mux, req)
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_Query_PendingNoncesByChain_0(rctx, inboundMarshaler, client, req, pathParams)
+ ctx = runtime.NewServerMetadataContext(ctx, md)
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_Query_PendingNoncesByChain_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
mux.Handle("GET", pattern_Query_LastBlockHeight_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -2290,6 +2387,8 @@ var (
pattern_Query_PendingNoncesAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "pendingNonces"}, "", runtime.AssumeColonVerbOpt(false)))
+ pattern_Query_PendingNoncesByChain_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "crosschain", "pendingNonces", "chain_id"}, "", runtime.AssumeColonVerbOpt(false)))
+
pattern_Query_LastBlockHeight_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "crosschain", "lastBlockHeight", "index"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_LastBlockHeightAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "crosschain", "lastBlockHeight"}, "", runtime.AssumeColonVerbOpt(false)))
@@ -2344,6 +2443,8 @@ var (
forward_Query_PendingNoncesAll_0 = runtime.ForwardResponseMessage
+ forward_Query_PendingNoncesByChain_0 = runtime.ForwardResponseMessage
+
forward_Query_LastBlockHeight_0 = runtime.ForwardResponseMessage
forward_Query_LastBlockHeightAll_0 = runtime.ForwardResponseMessage
diff --git a/x/crosschain/types/tx.pb.go b/x/crosschain/types/tx.pb.go
index c05037ef51..0fb5cc6b25 100644
--- a/x/crosschain/types/tx.pb.go
+++ b/x/crosschain/types/tx.pb.go
@@ -352,10 +352,13 @@ func (m *MsgWhitelistERC20Response) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgWhitelistERC20Response proto.InternalMessageInfo
type MsgAddToOutTxTracker struct {
- Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
- ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
- Nonce uint64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"`
- TxHash string `protobuf:"bytes,4,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"`
+ Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
+ ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
+ Nonce uint64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"`
+ TxHash string `protobuf:"bytes,4,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"`
+ Proof *common.Proof `protobuf:"bytes,5,opt,name=proof,proto3" json:"proof,omitempty"`
+ BlockHash string `protobuf:"bytes,6,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`
+ TxIndex int64 `protobuf:"varint,7,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"`
}
func (m *MsgAddToOutTxTracker) Reset() { *m = MsgAddToOutTxTracker{} }
@@ -419,6 +422,27 @@ func (m *MsgAddToOutTxTracker) GetTxHash() string {
return ""
}
+func (m *MsgAddToOutTxTracker) GetProof() *common.Proof {
+ if m != nil {
+ return m.Proof
+ }
+ return nil
+}
+
+func (m *MsgAddToOutTxTracker) GetBlockHash() string {
+ if m != nil {
+ return m.BlockHash
+ }
+ return ""
+}
+
+func (m *MsgAddToOutTxTracker) GetTxIndex() int64 {
+ if m != nil {
+ return m.TxIndex
+ }
+ return 0
+}
+
type MsgAddToOutTxTrackerResponse struct {
}
@@ -870,7 +894,8 @@ 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"`
- 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"`
+ ObservedOutTxEffectiveGasLimit uint64 `protobuf:"varint,12,opt,name=observed_outTx_effective_gas_limit,json=observedOutTxEffectiveGasLimit,proto3" json:"observed_outTx_effective_gas_limit,omitempty"`
+ ValueReceived github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,5,opt,name=value_received,json=valueReceived,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"value_received" yaml:"value_received"`
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"`
OutTxTssNonce uint64 `protobuf:"varint,8,opt,name=outTx_tss_nonce,json=outTxTssNonce,proto3" json:"outTx_tss_nonce,omitempty"`
@@ -945,6 +970,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
@@ -1304,91 +1336,95 @@ func init() {
func init() { proto.RegisterFile("crosschain/tx.proto", fileDescriptor_81d6d611190b7635) }
var fileDescriptor_81d6d611190b7635 = []byte{
- // 1344 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcf, 0x6e, 0xdb, 0xc6,
- 0x13, 0x36, 0x7f, 0xb6, 0x65, 0x69, 0x1c, 0x39, 0x36, 0xed, 0xc4, 0x0c, 0x9d, 0xc8, 0x0e, 0xf3,
- 0x4b, 0x6a, 0x14, 0xb1, 0x94, 0x3a, 0x2d, 0x9a, 0xa6, 0x3d, 0x34, 0x36, 0x52, 0xc7, 0x48, 0x65,
- 0x07, 0xb4, 0xd2, 0x02, 0xb9, 0x10, 0x14, 0xb9, 0xa6, 0x08, 0x8b, 0x5c, 0x81, 0xbb, 0x32, 0xa4,
- 0xa0, 0xa7, 0xa2, 0x3d, 0xf4, 0x56, 0x14, 0x05, 0x5a, 0xf4, 0x05, 0xfa, 0x2a, 0x39, 0x15, 0x41,
- 0x4f, 0x45, 0x0f, 0x41, 0x9b, 0xbc, 0x41, 0x9f, 0xa0, 0xd8, 0x3f, 0xa4, 0x49, 0xd9, 0xfa, 0xe7,
- 0xa0, 0x27, 0x71, 0x86, 0xfb, 0xcd, 0x7c, 0x3b, 0xfb, 0xcd, 0xee, 0x52, 0xb0, 0xe8, 0x44, 0x98,
- 0x10, 0xa7, 0x61, 0xfb, 0x61, 0x85, 0x76, 0xca, 0xad, 0x08, 0x53, 0xac, 0x5e, 0x7b, 0x8e, 0xa8,
- 0xcd, 0x7d, 0x65, 0xfe, 0x84, 0x23, 0x54, 0x3e, 0x19, 0xa7, 0x2f,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48, 0xab, 0x1f, 0x56, 0xdf, 0x3a, 0x3f, 0x36, 0x21, 0xf7, 0x93, 0x02,
- 0xcb, 0xfd, 0x0e, 0x98, 0x8f, 0xc6, 0x8d, 0x9f, 0x40, 0xf5, 0x07, 0xe7, 0x86, 0xa6, 0x15, 0xda,
- 0xf3, 0xd5, 0x36, 0x82, 0x42, 0xb3, 0x88, 0x51, 0x14, 0x7a, 0xf6, 0x57, 0x14, 0xdf, 0x3b, 0x4e,
- 0x7d, 0xa4, 0x8e, 0xb0, 0x77, 0xf4, 0x62, 0x46, 0xd9, 0x3b, 0xfa, 0x7d, 0xbc, 0x6e, 0x3d, 0x7e,
- 0xf1, 0xba, 0xa4, 0xbc, 0x7c, 0x5d, 0x52, 0xfe, 0x7a, 0x5d, 0x52, 0xbe, 0x7f, 0x53, 0x9a, 0x78,
- 0xf9, 0xa6, 0x34, 0xf1, 0xc7, 0x9b, 0xd2, 0xc4, 0xb3, 0xf7, 0x52, 0xc7, 0x28, 0x8b, 0xba, 0x21,
- 0xfe, 0x63, 0x88, 0x13, 0x54, 0x3a, 0x95, 0xf4, 0x3f, 0x0f, 0xec, 0x54, 0xad, 0xe7, 0xf8, 0x7f,
- 0x06, 0x77, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x1f, 0xcf, 0x6d, 0x51, 0x94, 0x10, 0x00, 0x00,
+ // 1402 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x5f, 0x6f, 0xdb, 0x54,
+ 0x14, 0xaf, 0x69, 0x9b, 0x26, 0xa7, 0x4d, 0xd7, 0xba, 0xdd, 0xea, 0xb9, 0x5b, 0xda, 0xb9, 0x6c,
+ 0x54, 0x68, 0x4d, 0x46, 0x06, 0x62, 0x0c, 0x1e, 0x58, 0xab, 0xd1, 0x95, 0xd1, 0x76, 0x72, 0x33,
+ 0x90, 0xf6, 0x62, 0x39, 0x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 0xc1, 0x85, 0x45, 0x3b, 0x2b, 0xb4, 0xeb, 0x53, 0x73, 0x88, 0x0a, 0x4d, 0x4b,
+ 0x0c, 0x53, 0xa1, 0xe7, 0x7f, 0xfa, 0xf1, 0xbb, 0xe3, 0xcc, 0x97, 0xf5, 0x10, 0x77, 0x47, 0xb7,
+ 0xcc, 0x30, 0x77, 0x47, 0xaf, 0x2f, 0xee, 0xcd, 0xc7, 0x2f, 0x5e, 0x17, 0x94, 0x97, 0xaf, 0x0b,
+ 0xca, 0xdf, 0xaf, 0x0b, 0xca, 0xf7, 0x27, 0x85, 0xb1, 0x97, 0x27, 0x85, 0xb1, 0x3f, 0x4e, 0x0a,
+ 0x63, 0xcf, 0xde, 0xeb, 0x78, 0x46, 0x99, 0xd6, 0x0d, 0xf1, 0xc7, 0x48, 0x6c, 0xa0, 0xd4, 0x2a,
+ 0x75, 0xfe, 0x5d, 0xc2, 0x5e, 0xd5, 0x6a, 0x86, 0xff, 0xd1, 0x71, 0xf7, 0xbf, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0x3d, 0x9f, 0x45, 0x8d, 0x49, 0x11, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -2034,6 +2070,30 @@ func (m *MsgAddToOutTxTracker) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
+ if m.TxIndex != 0 {
+ i = encodeVarintTx(dAtA, i, uint64(m.TxIndex))
+ i--
+ dAtA[i] = 0x38
+ }
+ if len(m.BlockHash) > 0 {
+ i -= len(m.BlockHash)
+ copy(dAtA[i:], m.BlockHash)
+ i = encodeVarintTx(dAtA, i, uint64(len(m.BlockHash)))
+ i--
+ dAtA[i] = 0x32
+ }
+ if m.Proof != nil {
+ {
+ size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintTx(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x2a
+ }
if len(m.TxHash) > 0 {
i -= len(m.TxHash)
copy(dAtA[i:], m.TxHash)
@@ -2375,6 +2435,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
@@ -2411,9 +2476,9 @@ func (m *MsgVoteOnObservedOutboundTx) MarshalToSizedBuffer(dAtA []byte) (int, er
dAtA[i] = 0x30
}
{
- size := m.ZetaMinted.Size()
+ size := m.ValueReceived.Size()
i -= size
- if _, err := m.ZetaMinted.MarshalTo(dAtA[i:]); err != nil {
+ if _, err := m.ValueReceived.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintTx(dAtA, i, uint64(size))
@@ -2806,6 +2871,17 @@ func (m *MsgAddToOutTxTracker) Size() (n int) {
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
+ if m.Proof != nil {
+ l = m.Proof.Size()
+ n += 1 + l + sovTx(uint64(l))
+ }
+ l = len(m.BlockHash)
+ if l > 0 {
+ n += 1 + l + sovTx(uint64(l))
+ }
+ if m.TxIndex != 0 {
+ n += 1 + sovTx(uint64(m.TxIndex))
+ }
return n
}
@@ -2962,7 +3038,7 @@ func (m *MsgVoteOnObservedOutboundTx) Size() (n int) {
if m.ObservedOutTxBlockHeight != 0 {
n += 1 + sovTx(uint64(m.ObservedOutTxBlockHeight))
}
- l = m.ZetaMinted.Size()
+ l = m.ValueReceived.Size()
n += 1 + l + sovTx(uint64(l))
if m.Status != 0 {
n += 1 + sovTx(uint64(m.Status))
@@ -2981,6 +3057,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
}
@@ -3874,6 +3953,93 @@ func (m *MsgAddToOutTxTracker) Unmarshal(dAtA []byte) error {
}
m.TxHash = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
+ case 5:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTx
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthTx
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthTx
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if m.Proof == nil {
+ m.Proof = &common.Proof{}
+ }
+ if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ case 6:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTx
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthTx
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthTx
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.BlockHash = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 7:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field TxIndex", wireType)
+ }
+ m.TxIndex = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTx
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.TxIndex |= int64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
@@ -4854,7 +5020,7 @@ func (m *MsgVoteOnObservedOutboundTx) Unmarshal(dAtA []byte) error {
}
case 5:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field ZetaMinted", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field ValueReceived", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
@@ -4882,7 +5048,7 @@ func (m *MsgVoteOnObservedOutboundTx) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- if err := m.ZetaMinted.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ if err := m.ValueReceived.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
@@ -5015,6 +5181,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/emissions/types/params.go b/x/emissions/types/params.go
index 01efc2e17a..a61c4ecfea 100644
--- a/x/emissions/types/params.go
+++ b/x/emissions/types/params.go
@@ -63,7 +63,10 @@ func (p Params) Validate() error {
// String implements the Stringer interface.
func (p Params) String() string {
- out, _ := yaml.Marshal(p)
+ out, err := yaml.Marshal(p)
+ if err != nil {
+ return ""
+ }
return string(out)
}
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/client/cli/tx_deploy_fungible_coin_zrc_4.go b/x/fungible/client/cli/tx_deploy_fungible_coin_zrc_4.go
index ff876f71e0..3a82f7c75f 100644
--- a/x/fungible/client/cli/tx_deploy_fungible_coin_zrc_4.go
+++ b/x/fungible/client/cli/tx_deploy_fungible_coin_zrc_4.go
@@ -24,7 +24,7 @@ func CmdDeployFungibleCoinZRC4() *cobra.Command {
if err != nil {
return err
}
- argDecimals, err := strconv.ParseInt(args[2], 10, 32)
+ argDecimals, err := strconv.ParseUint(args[2], 10, 32)
if err != nil {
return err
}
@@ -48,6 +48,7 @@ func CmdDeployFungibleCoinZRC4() *cobra.Command {
clientCtx.GetFromAddress().String(),
argERC20,
argForeignChain,
+ // #nosec G701 parsed in range
uint32(argDecimals),
argName,
argSymbol,
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..8425f4e9a0 100644
--- a/x/fungible/keeper/begin_blocker_deploy_system_contracts.go
+++ b/x/fungible/keeper/begin_blocker_deploy_system_contracts.go
@@ -1,5 +1,5 @@
-//go:build !PRIVNET && !TESTNET
-// +build !PRIVNET,!TESTNET
+//go:build !PRIVNET && !TESTNET && !MOCK_MAINNET
+// +build !PRIVNET,!TESTNET,!MOCK_MAINNET
package keeper
@@ -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/begin_blocker_deploy_system_contracts_mock_mainnet.go b/x/fungible/keeper/begin_blocker_deploy_system_contracts_mock_mainnet.go
new file mode 100644
index 0000000000..44a45dacc9
--- /dev/null
+++ b/x/fungible/keeper/begin_blocker_deploy_system_contracts_mock_mainnet.go
@@ -0,0 +1,18 @@
+//go:build MOCK_MAINNET
+// +build MOCK_MAINNET
+
+package keeper
+
+import (
+ "context"
+)
+
+func (k Keeper) BlockOneDeploySystemContracts(_ context.Context) error {
+ return nil
+}
+func (k Keeper) TestUpdateSystemContractAddress(_ context.Context) error {
+ return nil
+}
+func (k Keeper) TestUpdateZRC20WithdrawFee(_ context.Context) error {
+ return nil
+}
diff --git a/x/fungible/keeper/begin_blocker_deploy_system_contracts_privnet.go b/x/fungible/keeper/begin_blocker_deploy_system_contracts_privnet.go
index 21a04c7f64..18301cb3d8 100644
--- a/x/fungible/keeper/begin_blocker_deploy_system_contracts_privnet.go
+++ b/x/fungible/keeper/begin_blocker_deploy_system_contracts_privnet.go
@@ -81,15 +81,17 @@ func (k Keeper) BlockOneDeploySystemContracts(goCtx context.Context) error {
return err
}
- _, err = k.SetupChainGasCoinAndPool(ctx, common.GoerliChain().ChainId, "ETH", "gETH", 18)
+ ETHZRC20Addr, err := k.SetupChainGasCoinAndPool(ctx, common.GoerliChain().ChainId, "ETH", "gETH", 18)
if err != nil {
return sdkerrors.Wrapf(err, "failed to setupChainGasCoinAndPool")
}
+ ctx.Logger().Info("Deployed ETH ZRC20 at " + ETHZRC20Addr.String())
- _, err = k.SetupChainGasCoinAndPool(ctx, common.BtcRegtestChain().ChainId, "BTC", "tBTC", 8)
+ BTCZRC20Addr, err := k.SetupChainGasCoinAndPool(ctx, common.BtcRegtestChain().ChainId, "BTC", "tBTC", 8)
if err != nil {
return sdkerrors.Wrapf(err, "failed to setupChainGasCoinAndPool")
}
+ ctx.Logger().Info("Deployed BTC ZRC20 at " + BTCZRC20Addr.String())
//FIXME: clean up and config the above based on localnet/testnet/mainnet
@@ -130,9 +132,10 @@ func (k Keeper) TestUpdateSystemContractAddress(goCtx context.Context) error {
if err != nil {
return sdkerrors.Wrapf(err, "failed to DeploySystemContract")
}
- creator := k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(observertypes.Policy_Type_deploy_fungible_coin)
- msg := types.NewMessageUpdateSystemContract(creator, SystemContractAddress.Hex())
+ creator := k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(observertypes.Policy_Type_group1)
+ msg := types.NewMsgUpdateSystemContract(creator, SystemContractAddress.Hex())
_, err = k.UpdateSystemContract(ctx, msg)
+ k.Logger(ctx).Info("System contract updated", "new address", SystemContractAddress.String())
return err
}
@@ -140,7 +143,7 @@ func (k Keeper) TestUpdateZRC20WithdrawFee(goCtx context.Context) error {
ctx := sdk.UnwrapSDKContext(goCtx)
foreignCoins := k.GetAllForeignCoins(ctx)
- creator := k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(observertypes.Policy_Type_deploy_fungible_coin)
+ creator := k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(observertypes.Policy_Type_group1)
for _, foreignCoin := range foreignCoins {
msg := types.NewMsgUpdateZRC20WithdrawFee(creator, foreignCoin.Zrc20ContractAddress, sdk.NewUint(uint64(foreignCoin.ForeignChainId)))
diff --git a/x/fungible/keeper/deposits.go b/x/fungible/keeper/deposits.go
index c95f6ed48f..8206f744bc 100644
--- a/x/fungible/keeper/deposits.go
+++ b/x/fungible/keeper/deposits.go
@@ -17,26 +17,28 @@ func (k Keeper) DepositCoinZeta(ctx sdk.Context, to eth.Address, amount *big.Int
return k.MintZetaToEVMAccount(ctx, zetaToAddress, amount)
}
-func (k Keeper) ZRC20DepositAndCallContract(ctx sdk.Context, from []byte, to eth.Address, amount *big.Int, senderChain *common.Chain,
- message string, contract eth.Address, data []byte, coinType common.CoinType, asset string) (*evmtypes.MsgEthereumTxResponse, error) {
+func (k Keeper) ZRC20DepositAndCallContract(
+ ctx sdk.Context,
+ from []byte,
+ to eth.Address,
+ amount *big.Int,
+ senderChain *common.Chain,
+ message string,
+ contract eth.Address,
+ data []byte,
+ coinType common.CoinType,
+ asset string,
+) (*evmtypes.MsgEthereumTxResponse, error) {
var Zrc20Contract eth.Address
var coin fungibletypes.ForeignCoins
+ var found bool
if coinType == common.CoinType_Gas {
- var found bool
coin, found = k.GetGasCoinForForeignCoin(ctx, senderChain.ChainId)
if !found {
return nil, types.ErrGasCoinNotFound
}
} else {
- foreignCoinList := k.GetAllForeignCoinsForChain(ctx, senderChain.ChainId)
- found := false
- for _, foreignCoin := range foreignCoinList {
- if foreignCoin.Asset == asset && foreignCoin.ForeignChainId == senderChain.ChainId {
- coin = foreignCoin
- found = true
- break
- }
- }
+ coin, found = k.GetForeignCoinFromAsset(ctx, asset, senderChain.ChainId)
if !found {
return nil, types.ErrForeignCoinNotFound
}
diff --git a/x/fungible/keeper/evm.go b/x/fungible/keeper/evm.go
index 731b57cad6..92a87cc1d3 100644
--- a/x/fungible/keeper/evm.go
+++ b/x/fungible/keeper/evm.go
@@ -3,6 +3,7 @@ package keeper
import (
"encoding/hex"
"encoding/json"
+ "errors"
"fmt"
"math/big"
"strconv"
@@ -37,12 +38,13 @@ var (
ZEVMGasLimitDepositAndCall = big.NewInt(1_000_000)
)
-func (k Keeper) deployContract(ctx sdk.Context, metadata *bind.MetaData, ctorArguments ...interface{}) (common.Address, error) {
- abi, err := metadata.GetAbi()
+// DeployContract deploys a new contract in the ZEVM
+func (k Keeper) DeployContract(ctx sdk.Context, metadata *bind.MetaData, ctorArguments ...interface{}) (common.Address, error) {
+ contractABI, err := metadata.GetAbi()
if err != nil {
return common.Address{}, cosmoserrors.Wrapf(types.ErrABIGet, "failed to get ABI: %s", err.Error())
}
- ctorArgs, err := abi.Pack(
+ ctorArgs, err := contractABI.Pack(
"", // function--empty string for constructor
ctorArguments..., // feeToSetter
)
@@ -103,13 +105,14 @@ func (k Keeper) DeployZRC20Contract(
if !found {
return common.Address{}, cosmoserrors.Wrapf(types.ErrSystemContractNotFound, "system contract not found")
}
- contractAddr, err := k.deployContract(ctx, zrc20.ZRC20MetaData,
+ contractAddr, err := k.DeployContract(ctx, zrc20.ZRC20MetaData,
name, // name
symbol, // symbol
decimals, // decimals
big.NewInt(chain.ChainId), // chainID
- uint8(coinType), // coinType: 0: Zeta 1: gas 2 ERC20
- gasLimit, //gas limit for transfer; 21k for gas asset; around 70k for ERC20
+ // #nosec G701 always in range
+ uint8(coinType), // coinType: 0: Zeta 1: gas 2 ERC20
+ gasLimit, //gas limit for transfer; 21k for gas asset; around 70k for ERC20
common.HexToAddress(system.SystemContract),
)
if err != nil {
@@ -133,7 +136,7 @@ func (k Keeper) DeployZRC20Contract(
func (k Keeper) DeploySystemContract(ctx sdk.Context, wzeta common.Address, v2factory common.Address, router02 common.Address) (common.Address, error) {
system, _ := k.GetSystemContract(ctx)
- contractAddr, err := k.deployContract(ctx, systemcontract.SystemContractMetaData, wzeta, v2factory, router02)
+ contractAddr, err := k.DeployContract(ctx, systemcontract.SystemContractMetaData, wzeta, v2factory, router02)
if err != nil {
return common.Address{}, cosmoserrors.Wrapf(err, "failed to deploy SystemContract")
}
@@ -149,7 +152,7 @@ func (k Keeper) DeployUniswapV2Factory(ctx sdk.Context) (common.Address, error)
// https://etherscan.io/address/0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f#code
refFactoryBytecode := "0x608060405234801561001057600080fd5b506040516136863803806136868339818101604052602081101561003357600080fd5b5051600180546001600160a01b0319166001600160a01b03909216919091179055613623806100636000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c8063a2e74af61161005b578063a2e74af6146100fd578063c9c6539614610132578063e6a439051461016d578063f46901ed146101a857610088565b8063017e7e581461008d578063094b7415146100be5780631e3dd18b146100c6578063574f2ba3146100e3575b600080fd5b6100956101db565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6100956101f7565b610095600480360360208110156100dc57600080fd5b5035610213565b6100eb610247565b60408051918252519081900360200190f35b6101306004803603602081101561011357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661024d565b005b6100956004803603604081101561014857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602001351661031a565b6100956004803603604081101561018357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602001351661076d565b610130600480360360208110156101be57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166107a0565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b6003818154811061022057fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b60035490565b60015473ffffffffffffffffffffffffffffffffffffffff1633146102d357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60008173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156103b757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f556e697377617056323a204944454e544943414c5f4144445245535345530000604482015290519081900360640190fd5b6000808373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16106103f45783856103f7565b84845b909250905073ffffffffffffffffffffffffffffffffffffffff821661047e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f556e697377617056323a205a45524f5f41444452455353000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff82811660009081526002602090815260408083208585168452909152902054161561051f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f556e697377617056323a20504149525f45584953545300000000000000000000604482015290519081900360640190fd5b6060604051806020016105319061086d565b6020820181038252601f19601f82011660405250905060008383604051602001808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b815260140192505050604051602081830303815290604052805190602001209050808251602084016000f5604080517f485cc95500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152868116602483015291519297509087169163485cc9559160448082019260009290919082900301818387803b15801561065e57600080fd5b505af1158015610672573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff84811660008181526002602081815260408084208987168086529083528185208054978d167fffffffffffffffffffffffff000000000000000000000000000000000000000098891681179091559383528185208686528352818520805488168517905560038054600181018255958190527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b90950180549097168417909655925483519283529082015281517f0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9929181900390910190a35050505092915050565b600260209081526000928352604080842090915290825290205473ffffffffffffffffffffffffffffffffffffffff1681565b60015473ffffffffffffffffffffffffffffffffffffffff16331461082657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b612d748061087b8339019056fe60806040526001600c5534801561001557600080fd5b506040514690806052612d228239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612c1d806101056000396000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429a265627a7a723158202760f92d7fa1db6f5aa16307bad65df4ebcc8550c4b1f03755ab8dfd830c178f64736f6c63430005100032"
uniswapv2factory.UniswapV2FactoryMetaData.Bin = refFactoryBytecode
- contractAddr, err := k.deployContract(ctx, uniswapv2factory.UniswapV2FactoryMetaData, types.ModuleAddressEVM)
+ contractAddr, err := k.DeployContract(ctx, uniswapv2factory.UniswapV2FactoryMetaData, types.ModuleAddressEVM)
if err != nil {
return common.Address{}, cosmoserrors.Wrapf(err, "UniswapV2FactoryContract")
}
@@ -158,7 +161,7 @@ func (k Keeper) DeployUniswapV2Factory(ctx sdk.Context) (common.Address, error)
}
func (k Keeper) DeployUniswapV2Router02(ctx sdk.Context, factory common.Address, wzeta common.Address) (common.Address, error) {
- contractAddr, err := k.deployContract(ctx, uniswapv2router02.UniswapV2Router02MetaData, factory, wzeta)
+ contractAddr, err := k.DeployContract(ctx, uniswapv2router02.UniswapV2Router02MetaData, factory, wzeta)
if err != nil {
return common.Address{}, cosmoserrors.Wrapf(err, "UniswapV2Router02")
}
@@ -166,7 +169,7 @@ func (k Keeper) DeployUniswapV2Router02(ctx sdk.Context, factory common.Address,
}
func (k Keeper) DeployWZETA(ctx sdk.Context) (common.Address, error) {
- contractAddr, err := k.deployContract(ctx, wzeta.WETH9MetaData)
+ contractAddr, err := k.DeployContract(ctx, wzeta.WETH9MetaData)
if err != nil {
return common.Address{}, cosmoserrors.Wrapf(err, "WZETA")
}
@@ -174,7 +177,7 @@ func (k Keeper) DeployWZETA(ctx sdk.Context) (common.Address, error) {
}
func (k Keeper) DeployConnectorZEVM(ctx sdk.Context, wzeta common.Address) (common.Address, error) {
- contractAddr, err := k.deployContract(ctx, connectorzevm.ZetaConnectorZEVMMetaData, wzeta)
+ contractAddr, err := k.DeployContract(ctx, connectorzevm.ZetaConnectorZEVMMetaData, wzeta)
if err != nil {
return common.Address{}, cosmoserrors.Wrapf(err, "ZetaConnectorZEVM")
}
@@ -194,12 +197,11 @@ func (k Keeper) DepositZRC20(
to common.Address,
amount *big.Int,
) (*evmtypes.MsgEthereumTxResponse, error) {
- //abi, err := zrc20.ZRC4MetaData.GetAbi()
- abi, err := zrc20.ZRC20MetaData.GetAbi()
+ zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi()
if err != nil {
return nil, err
}
- return k.CallEVM(ctx, *abi, types.ModuleAddressEVM, contract, BigIntZero, nil, true, false, "deposit", to, amount)
+ return k.CallEVM(ctx, *zrc20ABI, types.ModuleAddressEVM, contract, BigIntZero, nil, true, false, "deposit", to, amount)
}
// DepositZRC20AndCallContract deposits into ZRC4 and call contract function in a single tx
@@ -226,6 +228,117 @@ func (k Keeper) DepositZRC20AndCallContract(ctx sdk.Context,
"depositAndCall", context, zrc20Addr, amount, targetContract, message)
}
+// QueryWithdrawGasFee returns the gas fee for a withdrawal transaction associated with a given zrc20
+func (k Keeper) QueryWithdrawGasFee(ctx sdk.Context, contract common.Address) (*big.Int, error) {
+ zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi()
+ if err != nil {
+ return nil, err
+ }
+ res, err := k.CallEVM(
+ ctx,
+ *zrc20ABI,
+ types.ModuleAddressEVM,
+ contract,
+ BigIntZero,
+ nil,
+ false,
+ false,
+ "withdrawGasFee",
+ )
+ if err != nil {
+ return nil, err
+ }
+
+ unpacked, err := zrc20ABI.Unpack("withdrawGasFee", res.Ret)
+ if err != nil {
+ return nil, err
+ }
+ if len(unpacked) < 2 {
+ return nil, fmt.Errorf("expect 2 returned values, got %d", len(unpacked))
+ }
+
+ GasFee, ok := unpacked[1].(*big.Int)
+ if !ok {
+ return nil, errors.New("can't read returned value as big.Int")
+ }
+
+ return GasFee, nil
+}
+
+// QueryProtocolFlatFee returns the protocol flat fee associated with a given zrc20
+func (k Keeper) QueryProtocolFlatFee(ctx sdk.Context, contract common.Address) (*big.Int, error) {
+ zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi()
+ if err != nil {
+ return nil, err
+ }
+ res, err := k.CallEVM(
+ ctx,
+ *zrc20ABI,
+ types.ModuleAddressEVM,
+ contract,
+ BigIntZero,
+ nil,
+ false,
+ false,
+ "PROTOCOL_FLAT_FEE",
+ )
+ if err != nil {
+ return nil, err
+ }
+
+ unpacked, err := zrc20ABI.Unpack("PROTOCOL_FLAT_FEE", res.Ret)
+ if err != nil {
+ return nil, err
+ }
+ if len(unpacked) == 0 {
+ return nil, fmt.Errorf("expect 1 returned values, got %d", len(unpacked))
+ }
+
+ protocolGasFee, ok := unpacked[0].(*big.Int)
+ if !ok {
+ return nil, errors.New("can't read returned value as big.Int")
+ }
+
+ return protocolGasFee, nil
+}
+
+// QueryGasLimit returns the gas limit for a withdrawal transaction associated with a given zrc20
+func (k Keeper) QueryGasLimit(ctx sdk.Context, contract common.Address) (*big.Int, error) {
+ zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi()
+ if err != nil {
+ return nil, err
+ }
+ res, err := k.CallEVM(
+ ctx,
+ *zrc20ABI,
+ types.ModuleAddressEVM,
+ contract,
+ BigIntZero,
+ nil,
+ false,
+ false,
+ "GAS_LIMIT",
+ )
+ if err != nil {
+ return nil, err
+ }
+
+ unpacked, err := zrc20ABI.Unpack("GAS_LIMIT", res.Ret)
+ if err != nil {
+ return nil, err
+ }
+ if len(unpacked) == 0 {
+ return nil, fmt.Errorf("expect 1 returned values, got %d", len(unpacked))
+ }
+
+ gasLimit, ok := unpacked[0].(*big.Int)
+ if !ok {
+ return nil, errors.New("can't read returned value as big.Int")
+ }
+
+ return gasLimit, nil
+}
+
// QueryZRC20Data returns the data of a deployed ZRC20 contract
func (k Keeper) QueryZRC20Data(
ctx sdk.Context,
@@ -237,35 +350,40 @@ func (k Keeper) QueryZRC20Data(
decimalRes types.ZRC20Uint8Response
)
- zrc4, _ := zrc20.ZRC20MetaData.GetAbi()
+ zrc4ABI, err := zrc20.ZRC20MetaData.GetAbi()
+ if err != nil {
+ return types.ZRC20Data{}, sdkerrors.Wrapf(
+ types.ErrABIUnpack, "failed to get ABI: %s", err.Error(),
+ )
+ }
// Name
- res, err := k.CallEVM(ctx, *zrc4, types.ModuleAddressEVM, contract, BigIntZero, nil, false, false, "name")
+ res, err := k.CallEVM(ctx, *zrc4ABI, types.ModuleAddressEVM, contract, BigIntZero, nil, false, false, "name")
if err != nil {
return types.ZRC20Data{}, err
}
- if err := zrc4.UnpackIntoInterface(&nameRes, "name", res.Ret); err != nil {
+ if err := zrc4ABI.UnpackIntoInterface(&nameRes, "name", res.Ret); err != nil {
return types.ZRC20Data{}, cosmoserrors.Wrapf(types.ErrABIUnpack, "failed to unpack name: %s", err.Error())
}
// Symbol
- res, err = k.CallEVM(ctx, *zrc4, types.ModuleAddressEVM, contract, BigIntZero, nil, false, false, "symbol")
+ res, err = k.CallEVM(ctx, *zrc4ABI, types.ModuleAddressEVM, contract, BigIntZero, nil, false, false, "symbol")
if err != nil {
return types.ZRC20Data{}, err
}
- if err := zrc4.UnpackIntoInterface(&symbolRes, "symbol", res.Ret); err != nil {
+ if err := zrc4ABI.UnpackIntoInterface(&symbolRes, "symbol", res.Ret); err != nil {
return types.ZRC20Data{}, cosmoserrors.Wrapf(types.ErrABIUnpack, "failed to unpack symbol: %s", err.Error())
}
// Decimals
- res, err = k.CallEVM(ctx, *zrc4, types.ModuleAddressEVM, contract, BigIntZero, nil, false, false, "decimals")
+ res, err = k.CallEVM(ctx, *zrc4ABI, types.ModuleAddressEVM, contract, BigIntZero, nil, false, false, "decimals")
if err != nil {
return types.ZRC20Data{}, err
}
- if err := zrc4.UnpackIntoInterface(&decimalRes, "decimals", res.Ret); err != nil {
+ if err := zrc4ABI.UnpackIntoInterface(&decimalRes, "decimals", res.Ret); err != nil {
return types.ZRC20Data{}, cosmoserrors.Wrapf(types.ErrABIUnpack, "failed to unpack decimals: %s", err.Error())
}
@@ -277,17 +395,17 @@ func (k Keeper) BalanceOfZRC4(
ctx sdk.Context,
contract, account common.Address,
) (*big.Int, error) {
- abi, err := zrc20.ZRC20MetaData.GetAbi()
+ zrc4ABI, err := zrc20.ZRC20MetaData.GetAbi()
if err != nil {
return nil, cosmoserrors.Wrapf(types.ErrABIUnpack, err.Error())
}
- res, err := k.CallEVM(ctx, *abi, types.ModuleAddressEVM, contract, BigIntZero, nil, false, false, "balanceOf",
+ res, err := k.CallEVM(ctx, *zrc4ABI, types.ModuleAddressEVM, contract, BigIntZero, nil, false, false, "balanceOf",
account)
if err != nil {
return nil, err
}
- unpacked, err := abi.Unpack("balanceOf", res.Ret)
+ unpacked, err := zrc4ABI.Unpack("balanceOf", res.Ret)
if err != nil || len(unpacked) == 0 {
return nil, cosmoserrors.Wrapf(types.ErrABIUnpack, err.Error())
}
@@ -300,6 +418,60 @@ func (k Keeper) BalanceOfZRC4(
return balance, nil
}
+// TotalSupplyZRC4 queries the total supply of a given ZRC4 contract
+func (k Keeper) TotalSupplyZRC4(
+ ctx sdk.Context,
+ contract common.Address,
+) (*big.Int, error) {
+ abi, err := zrc20.ZRC20MetaData.GetAbi()
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(types.ErrABIUnpack, err.Error())
+ }
+ res, err := k.CallEVM(ctx, *abi, types.ModuleAddressEVM, contract, BigIntZero, nil, false, false, "totalSupply")
+ if err != nil {
+ return nil, err
+ }
+
+ unpacked, err := abi.Unpack("totalSupply", res.Ret)
+ if err != nil || len(unpacked) == 0 {
+ return nil, cosmoserrors.Wrapf(types.ErrABIUnpack, err.Error())
+ }
+
+ totalSupply, ok := unpacked[0].(*big.Int)
+ if !ok {
+ return nil, cosmoserrors.Wrapf(types.ErrABIUnpack, "failed to unpack total supply")
+ }
+
+ return totalSupply, nil
+}
+
+// QueryChainIDFromContract returns the chain id of the chain
+func (k Keeper) QueryChainIDFromContract(
+ ctx sdk.Context,
+ contract common.Address,
+) (*big.Int, error) {
+ abi, err := zrc20.ZRC20MetaData.GetAbi()
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(types.ErrABIUnpack, err.Error())
+ }
+ res, err := k.CallEVM(ctx, *abi, types.ModuleAddressEVM, contract, BigIntZero, nil, false, false, "CHAIN_ID")
+ if err != nil {
+ return nil, err
+ }
+
+ unpacked, err := abi.Unpack("CHAIN_ID", res.Ret)
+ if err != nil || len(unpacked) == 0 {
+ return nil, cosmoserrors.Wrapf(types.ErrABIUnpack, err.Error())
+ }
+
+ chainID, ok := unpacked[0].(*big.Int)
+ if !ok {
+ return nil, cosmoserrors.Wrapf(types.ErrABIUnpack, "failed to unpack chain ID")
+ }
+
+ return chainID, nil
+}
+
// CallEVM performs a smart contract method call using given args
// returns (msg,err) the EVM execution result if there is any, even if error is non-nil due to contract reverts
// Furthermore, err!=nil && msg!=nil && msg.Failed() means the contract call reverted.
@@ -401,7 +573,10 @@ func (k Keeper) CallEVMWithData(
// Emit events and log for the transaction if it is committed
if commit {
- msgBytes, _ := json.Marshal(msg)
+ msgBytes, err := json.Marshal(msg)
+ if err != nil {
+ return nil, cosmoserrors.Wrap(err, "failed to encode msg")
+ }
ethTxHash := common.BytesToHash(crypto.Keccak256(msgBytes)) // NOTE(pwu): this is a fake txhash
attrs := []sdk.Attribute{}
if len(ctx.TxBytes()) > 0 {
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/foreign_coins.go b/x/fungible/keeper/foreign_coins.go
index 7e51a90be6..7450b66cd8 100644
--- a/x/fungible/keeper/foreign_coins.go
+++ b/x/fungible/keeper/foreign_coins.go
@@ -80,6 +80,7 @@ func (k Keeper) GetAllForeignCoins(ctx sdk.Context) (list []types.ForeignCoins)
return
}
+// GetGasCoinForForeignCoin returns the gas coin for a given chain
func (k Keeper) GetGasCoinForForeignCoin(ctx sdk.Context, chainID int64) (types.ForeignCoins, bool) {
foreignCoinList := k.GetAllForeignCoinsForChain(ctx, chainID)
for _, coin := range foreignCoinList {
@@ -89,3 +90,14 @@ func (k Keeper) GetGasCoinForForeignCoin(ctx sdk.Context, chainID int64) (types.
}
return types.ForeignCoins{}, false
}
+
+// GetForeignCoinFromAsset returns the foreign coin for a given asset for a given chain
+func (k Keeper) GetForeignCoinFromAsset(ctx sdk.Context, asset string, chainID int64) (types.ForeignCoins, bool) {
+ foreignCoinList := k.GetAllForeignCoinsForChain(ctx, chainID)
+ for _, coin := range foreignCoinList {
+ if coin.Asset == asset && coin.ForeignChainId == chainID {
+ return coin, true
+ }
+ }
+ return types.ForeignCoins{}, false
+}
diff --git a/x/fungible/keeper/foreign_coins_test.go b/x/fungible/keeper/foreign_coins_test.go
index 56248eb016..347630002d 100644
--- a/x/fungible/keeper/foreign_coins_test.go
+++ b/x/fungible/keeper/foreign_coins_test.go
@@ -2,6 +2,12 @@ package keeper_test
import (
"strconv"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+ "github.com/zeta-chain/zetacore/common"
+ keepertest "github.com/zeta-chain/zetacore/testutil/keeper"
+ "github.com/zeta-chain/zetacore/testutil/sample"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/fungible/keeper"
@@ -17,3 +23,110 @@ func createNForeignCoins(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.
}
return items
}
+
+func setForeignCoins(ctx sdk.Context, k *keeper.Keeper, fc ...types.ForeignCoins) {
+ for _, item := range fc {
+ k.SetForeignCoins(ctx, item)
+ }
+}
+
+func TestKeeper_GetGasCoinForForeignCoin(t *testing.T) {
+ k, ctx, _, _ := keepertest.FungibleKeeper(t)
+
+ // populate
+ setForeignCoins(ctx, k,
+ types.ForeignCoins{
+ Zrc20ContractAddress: sample.EthAddress().String(),
+ ForeignChainId: 1,
+ CoinType: common.CoinType_ERC20,
+ Name: "foo",
+ },
+ types.ForeignCoins{
+ Zrc20ContractAddress: sample.EthAddress().String(),
+ ForeignChainId: 1,
+ CoinType: common.CoinType_ERC20,
+ Name: "foo",
+ },
+ types.ForeignCoins{
+ Zrc20ContractAddress: sample.EthAddress().String(),
+ ForeignChainId: 1,
+ CoinType: common.CoinType_Gas,
+ Name: "bar",
+ },
+ types.ForeignCoins{
+ Zrc20ContractAddress: sample.EthAddress().String(),
+ ForeignChainId: 2,
+ CoinType: common.CoinType_ERC20,
+ Name: "foo",
+ },
+ types.ForeignCoins{
+ Zrc20ContractAddress: sample.EthAddress().String(),
+ ForeignChainId: 2,
+ CoinType: common.CoinType_ERC20,
+ Name: "foo",
+ },
+ )
+
+ fc, found := k.GetGasCoinForForeignCoin(ctx, 1)
+ require.True(t, found)
+ require.Equal(t, "bar", fc.Name)
+ fc, found = k.GetGasCoinForForeignCoin(ctx, 2)
+ require.False(t, found)
+ fc, found = k.GetGasCoinForForeignCoin(ctx, 3)
+ require.False(t, found)
+}
+
+func TestKeeperGetForeignCoinFromAsset(t *testing.T) {
+ k, ctx, _, _ := keepertest.FungibleKeeper(t)
+
+ gasAsset := sample.EthAddress().String()
+
+ // populate
+ setForeignCoins(ctx, k,
+ types.ForeignCoins{
+ Zrc20ContractAddress: sample.EthAddress().String(),
+ Asset: sample.EthAddress().String(),
+ ForeignChainId: 1,
+ CoinType: common.CoinType_ERC20,
+ Name: "foo",
+ },
+ types.ForeignCoins{
+ Zrc20ContractAddress: sample.EthAddress().String(),
+ Asset: gasAsset,
+ ForeignChainId: 1,
+ CoinType: common.CoinType_ERC20,
+ Name: "bar",
+ },
+ types.ForeignCoins{
+ Zrc20ContractAddress: sample.EthAddress().String(),
+ Asset: sample.EthAddress().String(),
+ ForeignChainId: 1,
+ CoinType: common.CoinType_Gas,
+ Name: "foo",
+ },
+ types.ForeignCoins{
+ Zrc20ContractAddress: sample.EthAddress().String(),
+ Asset: sample.EthAddress().String(),
+ ForeignChainId: 2,
+ CoinType: common.CoinType_ERC20,
+ Name: "foo",
+ },
+ types.ForeignCoins{
+ Zrc20ContractAddress: sample.EthAddress().String(),
+ Asset: sample.EthAddress().String(),
+ ForeignChainId: 2,
+ CoinType: common.CoinType_ERC20,
+ Name: "foo",
+ },
+ )
+
+ fc, found := k.GetForeignCoinFromAsset(ctx, gasAsset, 1)
+ require.True(t, found)
+ require.Equal(t, "bar", fc.Name)
+ fc, found = k.GetForeignCoinFromAsset(ctx, sample.EthAddress().String(), 1)
+ require.False(t, found)
+ fc, found = k.GetForeignCoinFromAsset(ctx, gasAsset, 2)
+ require.False(t, found)
+ fc, found = k.GetForeignCoinFromAsset(ctx, gasAsset, 3)
+ require.False(t, found)
+}
diff --git a/x/fungible/keeper/gas_coin_and_pool.go b/x/fungible/keeper/gas_coin_and_pool.go
index b90731f86d..493977a879 100644
--- a/x/fungible/keeper/gas_coin_and_pool.go
+++ b/x/fungible/keeper/gas_coin_and_pool.go
@@ -44,6 +44,7 @@ func (k Keeper) SetupChainGasCoinAndPool(ctx sdk.Context, chainID int64, gasAsse
return ethcommon.Address{}, err
}
amount := big.NewInt(10)
+ // #nosec G701 always in range
amount.Exp(amount, big.NewInt(int64(decimals-1)), nil)
amountAZeta := big.NewInt(1e17)
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_price.go b/x/fungible/keeper/gas_price.go
index cca8c03597..f492ddb2ec 100644
--- a/x/fungible/keeper/gas_price.go
+++ b/x/fungible/keeper/gas_price.go
@@ -10,7 +10,7 @@ import (
"github.com/zeta-chain/zetacore/x/fungible/types"
)
-// sets gas price on the system contract in zEVM; return the gasUsed and error code
+// SetGasPrice sets gas price on the system contract in zEVM; return the gasUsed and error code
func (k Keeper) SetGasPrice(ctx sdk.Context, chainid *big.Int, gasPrice *big.Int) (uint64, error) {
system, found := k.GetSystemContract(ctx)
if !found {
@@ -66,9 +66,9 @@ func (k Keeper) SetGasZetaPool(ctx sdk.Context, chainid *big.Int, pool common.Ad
if err != nil {
return sdkerrors.Wrapf(types.ErrABIGet, "SystemContractMetaData")
}
- res, err := k.CallEVM(ctx, *abi, types.ModuleAddressEVM, oracle, BigIntZero, nil, true, false, "SetGasZetaPool", chainid, pool)
+ res, err := k.CallEVM(ctx, *abi, types.ModuleAddressEVM, oracle, BigIntZero, nil, true, false, "setGasZetaPool", chainid, pool)
if err != nil || res.Failed() {
- return sdkerrors.Wrapf(types.ErrContractCall, "SetGasZetaPool")
+ return sdkerrors.Wrapf(types.ErrContractCall, "setGasZetaPool")
}
return nil
diff --git a/x/fungible/keeper/gas_price_test.go b/x/fungible/keeper/gas_price_test.go
new file mode 100644
index 0000000000..ec1bf267d8
--- /dev/null
+++ b/x/fungible/keeper/gas_price_test.go
@@ -0,0 +1,75 @@
+package keeper_test
+
+import (
+ "math/big"
+ "testing"
+
+ ethcommon "github.com/ethereum/go-ethereum/common"
+ "github.com/stretchr/testify/require"
+ "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/systemcontract.sol"
+ keepertest "github.com/zeta-chain/zetacore/testutil/keeper"
+ "github.com/zeta-chain/zetacore/testutil/sample"
+ "github.com/zeta-chain/zetacore/x/fungible/keeper"
+ "github.com/zeta-chain/zetacore/x/fungible/types"
+)
+
+func TestKeeper_SetGasPrice(t *testing.T) {
+ k, ctx, sdkk, _ := keepertest.FungibleKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+
+ _, _, _, _, system := deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+
+ queryGasPrice := func(chainID *big.Int) *big.Int {
+ abi, err := systemcontract.SystemContractMetaData.GetAbi()
+ require.NoError(t, err)
+ res, err := k.CallEVM(ctx, *abi, types.ModuleAddressEVM, system, keeper.BigIntZero, nil, false, false, "gasPriceByChainId", chainID)
+ require.NoError(t, err)
+ unpacked, err := abi.Unpack("gasPriceByChainId", res.Ret)
+ require.NoError(t, err)
+ gasPrice, ok := unpacked[0].(*big.Int)
+ require.True(t, ok)
+ return gasPrice
+ }
+
+ _, err := k.SetGasPrice(ctx, big.NewInt(1), big.NewInt(42))
+ require.NoError(t, err)
+ require.Equal(t, big.NewInt(42), queryGasPrice(big.NewInt(1)))
+}
+
+func TestKeeper_SetGasCoin(t *testing.T) {
+ k, ctx, sdkk, _ := keepertest.FungibleKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+ gas := sample.EthAddress()
+
+ deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+ err := k.SetGasCoin(ctx, big.NewInt(1), gas)
+ require.NoError(t, err)
+
+ found, err := k.QuerySystemContractGasCoinZRC20(ctx, big.NewInt(1))
+ require.NoError(t, err)
+ require.Equal(t, gas.Hex(), found.Hex())
+}
+
+func TestKeeper_SetGasZetaPool(t *testing.T) {
+ k, ctx, sdkk, _ := keepertest.FungibleKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+ zrc20 := sample.EthAddress()
+
+ _, _, _, _, system := deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+
+ queryZetaPool := func(chainID *big.Int) ethcommon.Address {
+ abi, err := systemcontract.SystemContractMetaData.GetAbi()
+ require.NoError(t, err)
+ res, err := k.CallEVM(ctx, *abi, types.ModuleAddressEVM, system, keeper.BigIntZero, nil, false, false, "gasZetaPoolByChainId", chainID)
+ require.NoError(t, err)
+ unpacked, err := abi.Unpack("gasZetaPoolByChainId", res.Ret)
+ require.NoError(t, err)
+ pool, ok := unpacked[0].(ethcommon.Address)
+ require.True(t, ok)
+ return pool
+ }
+
+ err := k.SetGasZetaPool(ctx, big.NewInt(1), zrc20)
+ require.NoError(t, err)
+ require.NotEqual(t, ethcommon.Address{}, queryZetaPool(big.NewInt(1)))
+}
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_deploy_fungible_coin_zrc20.go b/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20.go
index 41b678e349..4784f3f3f6 100644
--- a/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20.go
+++ b/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20.go
@@ -4,6 +4,8 @@ import (
"context"
"math/big"
+ "github.com/ethereum/go-ethereum/common"
+
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
zetacommon "github.com/zeta-chain/zetacore/common"
@@ -31,41 +33,49 @@ import (
// Only the admin policy account is authorized to broadcast this message.
func (k msgServer) DeployFungibleCoinZRC20(goCtx context.Context, msg *types.MsgDeployFungibleCoinZRC20) (*types.MsgDeployFungibleCoinZRC20Response, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
- if msg.Creator != k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_deploy_fungible_coin) {
+
+ var address common.Address
+ var err error
+
+ if msg.Creator != k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_group2) {
return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Deploy can only be executed by the correct policy account")
}
if msg.Decimals > 255 {
return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "decimals must be less than 256")
}
if msg.CoinType == zetacommon.CoinType_Gas {
- _, err := k.SetupChainGasCoinAndPool(ctx, msg.ForeignChainId, msg.Name, msg.Symbol, uint8(msg.Decimals))
+ // #nosec G701 always in range
+ address, err = k.SetupChainGasCoinAndPool(ctx, msg.ForeignChainId, msg.Name, msg.Symbol, uint8(msg.Decimals))
if err != nil {
return nil, sdkerrors.Wrapf(err, "failed to setupChainGasCoinAndPool")
}
} else {
- addr, err := k.DeployZRC20Contract(ctx, msg.Name, msg.Symbol, uint8(msg.Decimals), msg.ForeignChainId, msg.CoinType, msg.ERC20, big.NewInt(msg.GasLimit))
+ // #nosec G701 always in range
+ address, err = k.DeployZRC20Contract(ctx, msg.Name, msg.Symbol, uint8(msg.Decimals), msg.ForeignChainId, msg.CoinType, msg.ERC20, big.NewInt(msg.GasLimit))
if err != nil {
return nil, err
}
+ }
- err = ctx.EventManager().EmitTypedEvent(
- &types.EventZRC20Deployed{
- MsgTypeUrl: sdk.MsgTypeURL(&types.MsgDeployFungibleCoinZRC20{}),
- ChainId: msg.ForeignChainId,
- Contract: addr.String(),
- Name: msg.Name,
- Symbol: msg.Symbol,
- Decimals: int64(msg.Decimals),
- CoinType: msg.CoinType,
- Erc20: msg.ERC20,
- GasLimit: msg.GasLimit,
- },
- )
- if err != nil {
- return nil, sdkerrors.Wrapf(err, "failed to emit event")
- }
-
+ err = ctx.EventManager().EmitTypedEvent(
+ &types.EventZRC20Deployed{
+ MsgTypeUrl: sdk.MsgTypeURL(&types.MsgDeployFungibleCoinZRC20{}),
+ ChainId: msg.ForeignChainId,
+ Contract: address.String(),
+ Name: msg.Name,
+ Symbol: msg.Symbol,
+ // #nosec G701 always in range
+ Decimals: int64(msg.Decimals),
+ CoinType: msg.CoinType,
+ Erc20: msg.ERC20,
+ GasLimit: msg.GasLimit,
+ },
+ )
+ if err != nil {
+ return nil, sdkerrors.Wrapf(err, "failed to emit event")
}
- return &types.MsgDeployFungibleCoinZRC20Response{}, nil
+ return &types.MsgDeployFungibleCoinZRC20Response{
+ Address: address.Hex(),
+ }, nil
}
diff --git a/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20_test.go b/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20_test.go
new file mode 100644
index 0000000000..e40c1af9ae
--- /dev/null
+++ b/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20_test.go
@@ -0,0 +1,147 @@
+package keeper_test
+
+import (
+ "math/big"
+ "testing"
+
+ sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
+ ethcommon "github.com/ethereum/go-ethereum/common"
+ "github.com/stretchr/testify/require"
+ "github.com/zeta-chain/zetacore/common"
+ keepertest "github.com/zeta-chain/zetacore/testutil/keeper"
+ "github.com/zeta-chain/zetacore/testutil/sample"
+ "github.com/zeta-chain/zetacore/x/fungible/keeper"
+ "github.com/zeta-chain/zetacore/x/fungible/types"
+ observertypes "github.com/zeta-chain/zetacore/x/observer/types"
+)
+
+func TestMsgServer_DeployFungibleCoinZRC20(t *testing.T) {
+ t.Run("can deploy a new zrc20", func(t *testing.T) {
+ k, ctx, sdkk, zk := keepertest.FungibleKeeper(t)
+ msgServer := keeper.NewMsgServerImpl(*k)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+ chainID := getValidChainID(t)
+
+ deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+
+ res, err := msgServer.DeployFungibleCoinZRC20(ctx, types.NewMsgDeployFungibleCoinZRC20(
+ admin,
+ sample.EthAddress().Hex(),
+ chainID,
+ 8,
+ "foo",
+ "foo",
+ common.CoinType_Gas,
+ 1000000,
+ ))
+ require.NoError(t, err)
+ gasAddress := res.Address
+ assertContractDeployment(t, sdkk.EvmKeeper, ctx, ethcommon.HexToAddress(gasAddress))
+
+ // can retrieve the gas coin
+ foreignCoin, found := k.GetForeignCoins(ctx, gasAddress)
+ require.True(t, found)
+ require.Equal(t, foreignCoin.CoinType, common.CoinType_Gas)
+ require.Contains(t, foreignCoin.Name, "foo")
+
+ gas, err := k.QuerySystemContractGasCoinZRC20(ctx, big.NewInt(chainID))
+ require.NoError(t, err)
+ require.Equal(t, gasAddress, gas.Hex())
+
+ // can deploy non-gas zrc20
+ res, err = msgServer.DeployFungibleCoinZRC20(ctx, types.NewMsgDeployFungibleCoinZRC20(
+ admin,
+ sample.EthAddress().Hex(),
+ chainID,
+ 8,
+ "bar",
+ "bar",
+ common.CoinType_ERC20,
+ 1000000,
+ ))
+ require.NoError(t, err)
+ assertContractDeployment(t, sdkk.EvmKeeper, ctx, ethcommon.HexToAddress(res.Address))
+
+ foreignCoin, found = k.GetForeignCoins(ctx, res.Address)
+ require.True(t, found)
+ require.Equal(t, foreignCoin.CoinType, common.CoinType_ERC20)
+ require.Contains(t, foreignCoin.Name, "bar")
+
+ // gas should remain the same
+ gas, err = k.QuerySystemContractGasCoinZRC20(ctx, big.NewInt(chainID))
+ require.NoError(t, err)
+ require.NotEqual(t, res.Address, gas.Hex())
+ require.Equal(t, gasAddress, gas.Hex())
+ })
+
+ t.Run("should not deploy a new zrc20 if not admin", func(t *testing.T) {
+ k, ctx, sdkk, _ := keepertest.FungibleKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+ chainID := getValidChainID(t)
+
+ deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+
+ // should not deploy a new zrc20 if not admin
+ _, err := keeper.NewMsgServerImpl(*k).DeployFungibleCoinZRC20(ctx, types.NewMsgDeployFungibleCoinZRC20(
+ sample.AccAddress(),
+ sample.EthAddress().Hex(),
+ chainID,
+ 8,
+ "foo",
+ "foo",
+ common.CoinType_Gas,
+ 1000000,
+ ))
+ require.Error(t, err)
+ require.ErrorIs(t, err, sdkerrors.ErrUnauthorized)
+ })
+
+ t.Run("should not deploy a new zrc20 with wrong decimal", func(t *testing.T) {
+ k, ctx, sdkk, zk := keepertest.FungibleKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+ chainID := getValidChainID(t)
+
+ deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+
+ // should not deploy a new zrc20 if not admin
+ _, err := keeper.NewMsgServerImpl(*k).DeployFungibleCoinZRC20(ctx, types.NewMsgDeployFungibleCoinZRC20(
+ admin,
+ sample.EthAddress().Hex(),
+ chainID,
+ 256,
+ "foo",
+ "foo",
+ common.CoinType_Gas,
+ 1000000,
+ ))
+ require.Error(t, err)
+ require.ErrorIs(t, err, sdkerrors.ErrInvalidRequest)
+ })
+
+ t.Run("should not deploy a new zrc20 with invalid chain ID", func(t *testing.T) {
+ k, ctx, sdkk, zk := keepertest.FungibleKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+
+ deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+
+ // should not deploy a new zrc20 if not admin
+ _, err := keeper.NewMsgServerImpl(*k).DeployFungibleCoinZRC20(ctx, types.NewMsgDeployFungibleCoinZRC20(
+ admin,
+ sample.EthAddress().Hex(),
+ 9999999,
+ 8,
+ "foo",
+ "foo",
+ common.CoinType_Gas,
+ 1000000,
+ ))
+ require.Error(t, err)
+ require.ErrorIs(t, err, observertypes.ErrSupportedChains)
+ })
+}
diff --git a/x/fungible/keeper/msg_server_remove_foreign_coin.go b/x/fungible/keeper/msg_server_remove_foreign_coin.go
index eb0f5a3c72..8231e2f9a2 100644
--- a/x/fungible/keeper/msg_server_remove_foreign_coin.go
+++ b/x/fungible/keeper/msg_server_remove_foreign_coin.go
@@ -14,7 +14,7 @@ import (
// Only the admin policy account is authorized to broadcast this message.
func (k msgServer) RemoveForeignCoin(goCtx context.Context, msg *types.MsgRemoveForeignCoin) (*types.MsgRemoveForeignCoinResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
- if msg.Creator != k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_deploy_fungible_coin) {
+ if msg.Creator != k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_group2) {
return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Removal can only be executed by the correct policy account")
}
index := msg.Name
diff --git a/x/fungible/keeper/msg_server_remove_foreign_coin_test.go b/x/fungible/keeper/msg_server_remove_foreign_coin_test.go
new file mode 100644
index 0000000000..fedfe7315b
--- /dev/null
+++ b/x/fungible/keeper/msg_server_remove_foreign_coin_test.go
@@ -0,0 +1,61 @@
+package keeper_test
+
+import (
+ "testing"
+
+ 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/keeper"
+ "github.com/zeta-chain/zetacore/x/fungible/types"
+ observertypes "github.com/zeta-chain/zetacore/x/observer/types"
+)
+
+func TestMsgServer_RemoveForeignCoin(t *testing.T) {
+ t.Run("can remove a foreign coin", func(t *testing.T) {
+ k, ctx, sdkk, zk := keepertest.FungibleKeeper(t)
+ msgServer := keeper.NewMsgServerImpl(*k)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+ chainID := getValidChainID(t)
+
+ deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+ zrc20 := setupGasCoin(t, ctx, k, sdkk.EvmKeeper, chainID, "foo", "foo")
+
+ _, found := k.GetForeignCoins(ctx, zrc20.Hex())
+ require.True(t, found)
+
+ _, err := msgServer.RemoveForeignCoin(ctx, types.NewMsgRemoveForeignCoin(admin, zrc20.Hex()))
+ require.NoError(t, err)
+ _, found = k.GetForeignCoins(ctx, zrc20.Hex())
+ require.False(t, found)
+ })
+
+ t.Run("should fail if not admin", func(t *testing.T) {
+ k, ctx, sdkk, _ := keepertest.FungibleKeeper(t)
+ msgServer := keeper.NewMsgServerImpl(*k)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+ chainID := getValidChainID(t)
+
+ deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+ zrc20 := setupGasCoin(t, ctx, k, sdkk.EvmKeeper, chainID, "foo", "foo")
+
+ _, err := msgServer.RemoveForeignCoin(ctx, types.NewMsgRemoveForeignCoin(sample.AccAddress(), zrc20.Hex()))
+ require.Error(t, err)
+ require.ErrorIs(t, err, sdkerrors.ErrUnauthorized)
+ })
+
+ t.Run("should fail if not found", func(t *testing.T) {
+ k, ctx, _, zk := keepertest.FungibleKeeper(t)
+ msgServer := keeper.NewMsgServerImpl(*k)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+
+ _, err := msgServer.RemoveForeignCoin(ctx, types.NewMsgRemoveForeignCoin(admin, sample.EthAddress().Hex()))
+ require.Error(t, err)
+ require.ErrorIs(t, err, sdkerrors.ErrInvalidRequest)
+ })
+}
diff --git a/x/fungible/keeper/msg_server_test.go b/x/fungible/keeper/msg_server_test.go
deleted file mode 100644
index f3533252a0..0000000000
--- a/x/fungible/keeper/msg_server_test.go
+++ /dev/null
@@ -1,16 +0,0 @@
-package keeper_test
-
-import (
- "context"
- "testing"
-
- sdk "github.com/cosmos/cosmos-sdk/types"
- keepertest "github.com/zeta-chain/zetacore/testutil/keeper"
- "github.com/zeta-chain/zetacore/x/fungible/keeper"
- "github.com/zeta-chain/zetacore/x/fungible/types"
-)
-
-func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) {
- k, ctx, _ := keepertest.FungibleKeeper(t)
- return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx)
-}
diff --git a/x/fungible/keeper/msg_server_update_contract_bytecode.go b/x/fungible/keeper/msg_server_update_contract_bytecode.go
new file mode 100644
index 0000000000..8664be1121
--- /dev/null
+++ b/x/fungible/keeper/msg_server_update_contract_bytecode.go
@@ -0,0 +1,83 @@
+package keeper
+
+import (
+ "context"
+
+ cosmoserror "cosmossdk.io/errors"
+
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
+ ethcommon "github.com/ethereum/go-ethereum/common"
+ "github.com/zeta-chain/zetacore/x/fungible/types"
+ observertypes "github.com/zeta-chain/zetacore/x/observer/types"
+)
+
+// UpdateContractBytecode updates the bytecode of a contract from the bytecode of an existing contract
+// Only a ZRC20 contract or the WZeta connector contract can be updated
+// IMPORTANT: the new contract bytecode must have the same storage layout as the old contract bytecode
+// the new contract can add new variable but cannot remove any existing variable
+func (k Keeper) UpdateContractBytecode(goCtx context.Context, msg *types.MsgUpdateContractBytecode) (*types.MsgUpdateContractBytecodeResponse, error) {
+ ctx := sdk.UnwrapSDKContext(goCtx)
+
+ // check authorization
+ if msg.Creator != k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(observertypes.Policy_Type_group2) {
+ return nil, cosmoserror.Wrap(sdkerrors.ErrUnauthorized, "Deploy can only be executed by the correct policy account")
+ }
+
+ // fetch account to update
+ if !ethcommon.IsHexAddress(msg.ContractAddress) {
+ return nil, cosmoserror.Wrapf(sdkerrors.ErrInvalidAddress, "invalid contract address (%s)", msg.ContractAddress)
+ }
+ contractAddress := ethcommon.HexToAddress(msg.ContractAddress)
+ acct := k.evmKeeper.GetAccount(ctx, contractAddress)
+ if acct == nil {
+ return nil, cosmoserror.Wrapf(types.ErrContractNotFound, "contract (%s) not found", contractAddress.Hex())
+ }
+
+ // check the contract is a zrc20
+ _, found := k.GetForeignCoins(ctx, msg.ContractAddress)
+ if !found {
+ // check contract is wzeta connector contract
+ systemContract, found := k.GetSystemContract(ctx)
+ if !found {
+ return nil, types.ErrSystemContractNotFound
+ }
+ if msg.ContractAddress != systemContract.ConnectorZevm {
+ // not a zrc20 or wzeta connector contract, can't be updated
+ return nil, cosmoserror.Wrapf(types.ErrInvalidContract, "contract (%s) is neither a zrc20 nor wzeta connector", msg.ContractAddress)
+ }
+ }
+
+ // fetch the account of the new bytecode
+ if !ethcommon.IsHexAddress(msg.NewBytecodeAddress) {
+ return nil, cosmoserror.Wrapf(sdkerrors.ErrInvalidAddress, "invalid contract address (%s)", msg.NewBytecodeAddress)
+ }
+ newBytecodeAddress := ethcommon.HexToAddress(msg.NewBytecodeAddress)
+ newBytecodeAcct := k.evmKeeper.GetAccount(ctx, newBytecodeAddress)
+ if newBytecodeAcct == nil {
+ return nil, cosmoserror.Wrapf(types.ErrContractNotFound, "contract (%s) not found", newBytecodeAddress.Hex())
+ }
+
+ // set the new CodeHash to the account
+ previousCodeHash := acct.CodeHash
+ acct.CodeHash = newBytecodeAcct.CodeHash
+ err := k.evmKeeper.SetAccount(ctx, contractAddress, *acct)
+ if err != nil {
+ return nil, cosmoserror.Wrapf(
+ types.ErrSetBytecode,
+ "failed to update contract (%s) bytecode (%s)",
+ contractAddress.Hex(),
+ err.Error(),
+ )
+ }
+ k.Logger(ctx).Info(
+ "updated contract bytecode",
+ "contract", contractAddress.Hex(),
+ "oldCodeHash", string(previousCodeHash),
+ "newCodeHash", string(acct.CodeHash),
+ )
+
+ return &types.MsgUpdateContractBytecodeResponse{
+ NewBytecodeHash: acct.CodeHash,
+ }, nil
+}
diff --git a/x/fungible/keeper/msg_server_update_contract_bytecode_test.go b/x/fungible/keeper/msg_server_update_contract_bytecode_test.go
new file mode 100644
index 0000000000..fc5900d342
--- /dev/null
+++ b/x/fungible/keeper/msg_server_update_contract_bytecode_test.go
@@ -0,0 +1,374 @@
+package keeper_test
+
+import (
+ "errors"
+ "math/big"
+ "testing"
+
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
+ "github.com/evmos/ethermint/x/evm/statedb"
+ "github.com/stretchr/testify/mock"
+ "github.com/stretchr/testify/require"
+ zetacommon "github.com/zeta-chain/zetacore/common"
+ keepertest "github.com/zeta-chain/zetacore/testutil/keeper"
+ "github.com/zeta-chain/zetacore/testutil/sample"
+ "github.com/zeta-chain/zetacore/x/fungible/types"
+ observertypes "github.com/zeta-chain/zetacore/x/observer/types"
+)
+
+func setAdminPolicies(ctx sdk.Context, zk keepertest.ZetaKeepers, admin string, policyType observertypes.Policy_Type) {
+ zk.ObserverKeeper.SetParams(ctx, observertypes.Params{
+ AdminPolicy: []*observertypes.Admin_Policy{
+ {
+ PolicyType: policyType,
+ Address: admin,
+ },
+ },
+ })
+}
+
+func TestKeeper_UpdateContractBytecode(t *testing.T) {
+ t.Run("can update the bytecode from another contract", func(t *testing.T) {
+ k, ctx, sdkk, zk := keepertest.FungibleKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+ admin := sample.AccAddress()
+
+ // set admin policy
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+
+ // sample chainIDs and addresses
+ chainList := zetacommon.DefaultChainsList()
+ require.True(t, len(chainList) > 1)
+ require.NotNil(t, chainList[0])
+ require.NotNil(t, chainList[1])
+ require.NotEqual(t, chainList[0].ChainId, chainList[1].ChainId)
+ chainID1 := chainList[0].ChainId
+ chainID2 := chainList[1].ChainId
+
+ addr1 := sample.EthAddress()
+ addr2 := sample.EthAddress()
+
+ // deploy the system contract and a ZRC20 contract
+ deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+ zrc20 := setupGasCoin(t, ctx, k, sdkk.EvmKeeper, chainID1, "alpha", "alpha")
+
+ // do some operation to populate the state
+ _, err := k.DepositZRC20(ctx, zrc20, addr1, big.NewInt(100))
+ require.NoError(t, err)
+ _, err = k.DepositZRC20(ctx, zrc20, addr2, big.NewInt(200))
+ require.NoError(t, err)
+
+ // check the state
+ checkState := func() {
+ // state that should not change
+ balance, err := k.BalanceOfZRC4(ctx, zrc20, addr1)
+ require.NoError(t, err)
+ require.Equal(t, int64(100), balance.Int64())
+ balance, err = k.BalanceOfZRC4(ctx, zrc20, addr2)
+ require.NoError(t, err)
+ require.Equal(t, int64(200), balance.Int64())
+ totalSupply, err := k.TotalSupplyZRC4(ctx, zrc20)
+ require.NoError(t, err)
+ require.Equal(t, int64(10000300), totalSupply.Int64()) // 10000000 minted on deploy
+ }
+
+ checkState()
+ chainID, err := k.QueryChainIDFromContract(ctx, zrc20)
+ require.NoError(t, err)
+ require.Equal(t, chainID1, chainID.Int64())
+
+ // deploy new zrc20
+ newCodeAddress, err := k.DeployZRC20Contract(
+ ctx,
+ "beta",
+ "BETA",
+ 18,
+ chainID2,
+ zetacommon.CoinType_ERC20,
+ "beta",
+ big.NewInt(90_000),
+ )
+ require.NoError(t, err)
+
+ // update the bytecode
+ res, err := k.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode(
+ admin,
+ zrc20,
+ newCodeAddress,
+ ))
+ require.NoError(t, err)
+
+ // check the returned new bytecode hash matches the one in the account
+ acct := sdkk.EvmKeeper.GetAccount(ctx, zrc20)
+ require.Equal(t, acct.CodeHash, res.NewBytecodeHash)
+
+ // check the state
+ // balances and total supply should remain
+ // BYTECODE value is immutable and therefore part of the code, this value should change
+ checkState()
+ chainID, err = k.QueryChainIDFromContract(ctx, zrc20)
+ require.NoError(t, err)
+ require.Equal(t, chainID2, chainID.Int64())
+
+ // can continue to interact with the contract
+ _, err = k.DepositZRC20(ctx, zrc20, addr1, big.NewInt(1000))
+ require.NoError(t, err)
+ balance, err := k.BalanceOfZRC4(ctx, zrc20, addr1)
+ require.NoError(t, err)
+ require.Equal(t, int64(1100), balance.Int64())
+ totalSupply, err := k.TotalSupplyZRC4(ctx, zrc20)
+ require.NoError(t, err)
+ require.Equal(t, int64(10001300), totalSupply.Int64())
+
+ // can change again bytecode
+ newCodeAddress, err = k.DeployZRC20Contract(
+ ctx,
+ "gamma",
+ "GAMMA",
+ 18,
+ chainID1,
+ zetacommon.CoinType_ERC20,
+ "gamma",
+ big.NewInt(90_000),
+ )
+ require.NoError(t, err)
+ _, err = k.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode(
+ admin,
+ zrc20,
+ newCodeAddress,
+ ))
+ require.NoError(t, err)
+ balance, err = k.BalanceOfZRC4(ctx, zrc20, addr1)
+ require.NoError(t, err)
+ require.Equal(t, int64(1100), balance.Int64())
+ totalSupply, err = k.TotalSupplyZRC4(ctx, zrc20)
+ require.NoError(t, err)
+ require.Equal(t, int64(10001300), totalSupply.Int64())
+ chainID, err = k.QueryChainIDFromContract(ctx, zrc20)
+ require.NoError(t, err)
+ require.Equal(t, chainID1, chainID.Int64())
+ })
+
+ t.Run("can update the bytecode of the wzeta connector contract", func(t *testing.T) {
+ k, ctx, sdkk, zk := keepertest.FungibleKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+ admin := sample.AccAddress()
+
+ // deploy a connector
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+ wzeta, _, _, oldConnector, _ := deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+
+ // deploy a new connector that will become official connector
+ newConnector, err := k.DeployConnectorZEVM(ctx, wzeta)
+ require.NoError(t, err)
+ require.NotEmpty(t, newConnector)
+ assertContractDeployment(t, sdkk.EvmKeeper, ctx, newConnector)
+
+ // can update the bytecode of the new connector with the old connector contract
+ _, err = k.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode(
+ admin,
+ newConnector,
+ oldConnector,
+ ))
+ require.NoError(t, err)
+ })
+
+ t.Run("should fail if unauthorized", func(t *testing.T) {
+ k, ctx, _, _ := keepertest.FungibleKeeper(t)
+
+ _, err := k.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode(
+ sample.AccAddress(),
+ sample.EthAddress(),
+ sample.EthAddress(),
+ ))
+ require.ErrorIs(t, err, sdkerrors.ErrUnauthorized)
+ })
+
+ t.Run("should fail invalid contract address", func(t *testing.T) {
+ k, ctx, _, zk := keepertest.FungibleKeeper(t)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+
+ _, err := k.UpdateContractBytecode(ctx, &types.MsgUpdateContractBytecode{
+ Creator: admin,
+ ContractAddress: "invalid",
+ NewBytecodeAddress: sample.EthAddress().Hex(),
+ })
+ require.ErrorIs(t, err, sdkerrors.ErrInvalidAddress)
+ })
+
+ t.Run("should fail if can't get contract account", func(t *testing.T) {
+ k, ctx, _, zk := keepertest.FungibleKeeperWithMocks(t, keepertest.FungibleMockOptions{
+ UseEVMMock: true,
+ })
+ mockEVMKeeper := keepertest.GetFungibleEVMMock(t, k)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+ contractAddr := sample.EthAddress()
+
+ mockEVMKeeper.On(
+ "GetAccount",
+ mock.Anything,
+ contractAddr,
+ ).Return(nil)
+
+ _, err := k.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode(
+ admin,
+ contractAddr,
+ sample.EthAddress(),
+ ))
+ require.ErrorIs(t, err, types.ErrContractNotFound)
+
+ mockEVMKeeper.AssertExpectations(t)
+ })
+
+ t.Run("should fail neither a zrc20 nor wzeta connector", func(t *testing.T) {
+ k, ctx, sdkk, zk := keepertest.FungibleKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+ admin := sample.AccAddress()
+
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+ wzeta, _, _, _, _ := deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+
+ // can't update the bytecode of the wzeta contract
+ _, err := k.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode(
+ admin,
+ wzeta,
+ sample.EthAddress(),
+ ))
+ require.ErrorIs(t, err, types.ErrInvalidContract)
+ })
+
+ t.Run("should fail if system contract not found", func(t *testing.T) {
+ k, ctx, sdkk, zk := keepertest.FungibleKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+ admin := sample.AccAddress()
+
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+ _, _, _, connector, _ := deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+
+ // remove system contract
+ k.RemoveSystemContract(ctx)
+
+ // can't update the bytecode of the wzeta contract
+ _, err := k.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode(
+ admin,
+ connector,
+ sample.EthAddress(),
+ ))
+ require.ErrorIs(t, err, types.ErrSystemContractNotFound)
+ })
+
+ t.Run("should fail if invalid bytecode address", func(t *testing.T) {
+ k, ctx, _, zk := keepertest.FungibleKeeperWithMocks(t, keepertest.FungibleMockOptions{
+ UseEVMMock: true,
+ })
+ mockEVMKeeper := keepertest.GetFungibleEVMMock(t, k)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+
+ // set the contract as the connector
+ contract := sample.EthAddress()
+ k.SetSystemContract(ctx, types.SystemContract{
+ ConnectorZevm: contract.Hex(),
+ })
+
+ mockEVMKeeper.On(
+ "GetAccount",
+ mock.Anything,
+ mock.Anything,
+ ).Return(&statedb.Account{})
+
+ _, err := k.UpdateContractBytecode(ctx, &types.MsgUpdateContractBytecode{
+ Creator: admin,
+ ContractAddress: contract.Hex(),
+ NewBytecodeAddress: "invalid",
+ })
+
+ require.ErrorIs(t, err, sdkerrors.ErrInvalidAddress)
+
+ mockEVMKeeper.AssertExpectations(t)
+ })
+
+ t.Run("should fail if can't get new bytecode account", func(t *testing.T) {
+ k, ctx, _, zk := keepertest.FungibleKeeperWithMocks(t, keepertest.FungibleMockOptions{
+ UseEVMMock: true,
+ })
+ mockEVMKeeper := keepertest.GetFungibleEVMMock(t, k)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+ contractAddr := sample.EthAddress()
+ newBytecodeAddr := sample.EthAddress()
+
+ // set the contract as the connector
+ k.SetSystemContract(ctx, types.SystemContract{
+ ConnectorZevm: contractAddr.String(),
+ })
+
+ mockEVMKeeper.On(
+ "GetAccount",
+ mock.Anything,
+ contractAddr,
+ ).Return(&statedb.Account{})
+
+ mockEVMKeeper.On(
+ "GetAccount",
+ mock.Anything,
+ newBytecodeAddr,
+ ).Return(nil)
+
+ _, err := k.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode(
+ admin,
+ contractAddr,
+ newBytecodeAddr,
+ ))
+ require.ErrorIs(t, err, types.ErrContractNotFound)
+
+ mockEVMKeeper.AssertExpectations(t)
+ })
+
+ t.Run("should fail if can't set account with new bytecode", func(t *testing.T) {
+ k, ctx, _, zk := keepertest.FungibleKeeperWithMocks(t, keepertest.FungibleMockOptions{
+ UseEVMMock: true,
+ })
+ mockEVMKeeper := keepertest.GetFungibleEVMMock(t, k)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+ contractAddr := sample.EthAddress()
+ newBytecodeAddr := sample.EthAddress()
+
+ // set the contract as the connector
+ k.SetSystemContract(ctx, types.SystemContract{
+ ConnectorZevm: contractAddr.String(),
+ })
+
+ mockEVMKeeper.On(
+ "GetAccount",
+ mock.Anything,
+ contractAddr,
+ ).Return(&statedb.Account{})
+
+ mockEVMKeeper.On(
+ "GetAccount",
+ mock.Anything,
+ newBytecodeAddr,
+ ).Return(&statedb.Account{})
+
+ mockEVMKeeper.On(
+ "SetAccount",
+ mock.Anything,
+ mock.Anything,
+ mock.Anything,
+ ).Return(errors.New("can't set account"))
+
+ _, err := k.UpdateContractBytecode(ctx, types.NewMsgUpdateContractBytecode(
+ admin,
+ contractAddr,
+ newBytecodeAddr,
+ ))
+ require.ErrorIs(t, err, types.ErrSetBytecode)
+
+ mockEVMKeeper.AssertExpectations(t)
+ })
+}
diff --git a/x/fungible/keeper/msg_server_update_system_contract.go b/x/fungible/keeper/msg_server_update_system_contract.go
index dcdb2f6bfc..f6de594ecf 100644
--- a/x/fungible/keeper/msg_server_update_system_contract.go
+++ b/x/fungible/keeper/msg_server_update_system_contract.go
@@ -16,7 +16,7 @@ import (
func (k Keeper) UpdateSystemContract(goCtx context.Context, msg *types.MsgUpdateSystemContract) (*types.MsgUpdateSystemContractResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
- if msg.Creator != k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_deploy_fungible_coin) {
+ if msg.Creator != k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_group2) {
return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Deploy can only be executed by the correct policy account")
}
newSystemContractAddr := ethcommon.HexToAddress(msg.NewSystemContractAddress)
diff --git a/x/fungible/keeper/msg_server_update_system_contract_test.go b/x/fungible/keeper/msg_server_update_system_contract_test.go
new file mode 100644
index 0000000000..ebd72cd0d5
--- /dev/null
+++ b/x/fungible/keeper/msg_server_update_system_contract_test.go
@@ -0,0 +1,109 @@
+package keeper_test
+
+import (
+ "math/big"
+ "testing"
+
+ sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
+ "github.com/ethereum/go-ethereum/common"
+ "github.com/stretchr/testify/require"
+ "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/systemcontract.sol"
+ "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol"
+ zetacommon "github.com/zeta-chain/zetacore/common"
+ keepertest "github.com/zeta-chain/zetacore/testutil/keeper"
+ "github.com/zeta-chain/zetacore/testutil/sample"
+ "github.com/zeta-chain/zetacore/x/fungible/keeper"
+ "github.com/zeta-chain/zetacore/x/fungible/types"
+ observertypes "github.com/zeta-chain/zetacore/x/observer/types"
+)
+
+func TestKeeper_UpdateSystemContract(t *testing.T) {
+ t.Run("can update the system contract", func(t *testing.T) {
+ k, ctx, sdkk, zk := keepertest.FungibleKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+
+ queryZRC20SystemContract := func(contract common.Address) string {
+ abi, err := zrc20.ZRC20MetaData.GetAbi()
+ require.NoError(t, err)
+ res, err := k.CallEVM(ctx, *abi, types.ModuleAddressEVM, contract, keeper.BigIntZero, nil, false, false, "SYSTEM_CONTRACT_ADDRESS")
+ require.NoError(t, err)
+ unpacked, err := abi.Unpack("SYSTEM_CONTRACT_ADDRESS", res.Ret)
+ require.NoError(t, err)
+ address, ok := unpacked[0].(common.Address)
+ require.True(t, ok)
+ return address.Hex()
+ }
+
+ chains := zetacommon.DefaultChainsList()
+ require.True(t, len(chains) > 1)
+ require.NotNil(t, chains[0])
+ require.NotNil(t, chains[1])
+ chainID1 := chains[0].ChainId
+ chainID2 := chains[1].ChainId
+
+ wzeta, factory, router, _, oldSystemContract := deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+ gas1 := setupGasCoin(t, ctx, k, sdkk.EvmKeeper, chainID1, "foo", "foo")
+ gas2 := setupGasCoin(t, ctx, k, sdkk.EvmKeeper, chainID2, "bar", "bar")
+
+ // deploy a new system contracts
+ newSystemContract, err := k.DeployContract(ctx, systemcontract.SystemContractMetaData, wzeta, factory, router)
+ require.NoError(t, err)
+ require.NotEqual(t, oldSystemContract, newSystemContract)
+
+ // can update the system contract
+ _, err = k.UpdateSystemContract(ctx, types.NewMsgUpdateSystemContract(admin, newSystemContract.Hex()))
+ require.NoError(t, err)
+
+ // can retrieve the system contract
+ sc, found := k.GetSystemContract(ctx)
+ require.True(t, found)
+ require.Equal(t, newSystemContract.Hex(), sc.SystemContract)
+
+ // check gas updated
+ foundGas1, err := k.QuerySystemContractGasCoinZRC20(ctx, big.NewInt(chainID1))
+ require.NoError(t, err)
+ require.Equal(t, gas1, foundGas1)
+ foundGas2, err := k.QuerySystemContractGasCoinZRC20(ctx, big.NewInt(chainID2))
+ require.NoError(t, err)
+ require.Equal(t, gas2, foundGas2)
+
+ require.Equal(t, newSystemContract.Hex(), queryZRC20SystemContract(gas1))
+ require.Equal(t, newSystemContract.Hex(), queryZRC20SystemContract(gas2))
+ })
+
+ t.Run("should not update the system contract if not admin", func(t *testing.T) {
+ k, ctx, sdkk, _ := keepertest.FungibleKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+
+ // deploy a new system contracts
+ wzeta, factory, router, _, oldSystemContract := deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+ newSystemContract, err := k.DeployContract(ctx, systemcontract.SystemContractMetaData, wzeta, factory, router)
+ require.NoError(t, err)
+ require.NotEqual(t, oldSystemContract, newSystemContract)
+
+ // should not update the system contract if not admin
+ _, err = k.UpdateSystemContract(ctx, types.NewMsgUpdateSystemContract(sample.AccAddress(), newSystemContract.Hex()))
+ require.Error(t, err)
+ require.ErrorIs(t, err, sdkerrors.ErrUnauthorized)
+ })
+
+ t.Run("should not update the system contract if invalid address", func(t *testing.T) {
+ k, ctx, sdkk, zk := keepertest.FungibleKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+
+ // deploy a new system contracts
+ wzeta, factory, router, _, oldSystemContract := deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+ newSystemContract, err := k.DeployContract(ctx, systemcontract.SystemContractMetaData, wzeta, factory, router)
+ require.NoError(t, err)
+ require.NotEqual(t, oldSystemContract, newSystemContract)
+
+ // should not update the system contract if invalid address
+ _, err = k.UpdateSystemContract(ctx, types.NewMsgUpdateSystemContract(admin, "invalid"))
+ require.Error(t, err)
+ require.ErrorIs(t, err, sdkerrors.ErrInvalidAddress)
+ })
+}
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..2c0b89a4d0
--- /dev/null
+++ b/x/fungible/keeper/msg_server_update_zrc20_paused_status.go
@@ -0,0 +1,70 @@
+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
+ // unpausing requires group2 admin
+ requirePolicyAccount := zetaObserverTypes.Policy_Type_group1
+ if msg.Action == types.UpdatePausedStatusAction_UNPAUSE {
+ requirePolicyAccount = zetaObserverTypes.Policy_Type_group2
+ }
+ if msg.Creator != k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(requirePolicyAccount) {
+ 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..33f02d8745
--- /dev/null
+++ b/x/fungible/keeper/msg_server_update_zrc20_paused_status_test.go
@@ -0,0 +1,188 @@
+package keeper_test
+
+import (
+ "testing"
+
+ 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 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()
+
+ 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)
+
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group1)
+
+ // 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)
+
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+
+ // 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)
+
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group1)
+
+ // 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)
+
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+
+ // 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)
+
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group1)
+
+ // 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)
+
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+
+ // 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()
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group1)
+
+ 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, _, zk := keepertest.FungibleKeeper(t)
+
+ _, err := k.UpdateZRC20PausedStatus(ctx, types.NewMsgUpdateZRC20PausedStatus(
+ sample.AccAddress(),
+ []string{sample.EthAddress().String()},
+ types.UpdatePausedStatusAction_PAUSE,
+ ))
+
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group1)
+
+ _, err = k.UpdateZRC20PausedStatus(ctx, types.NewMsgUpdateZRC20PausedStatus(
+ sample.AccAddress(),
+ []string{sample.EthAddress().String()},
+ types.UpdatePausedStatusAction_UNPAUSE,
+ ))
+
+ 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()
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group1)
+
+ 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/msg_server_update_zrc20_withdraw_fee.go b/x/fungible/keeper/msg_server_update_zrc20_withdraw_fee.go
index dc6d18864a..7c72496770 100644
--- a/x/fungible/keeper/msg_server_update_zrc20_withdraw_fee.go
+++ b/x/fungible/keeper/msg_server_update_zrc20_withdraw_fee.go
@@ -2,7 +2,8 @@ package keeper
import (
"context"
- "math/big"
+
+ cosmoserrors "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
@@ -14,55 +15,50 @@ import (
func (k Keeper) UpdateZRC20WithdrawFee(goCtx context.Context, msg *types.MsgUpdateZRC20WithdrawFee) (*types.MsgUpdateZRC20WithdrawFeeResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
- if msg.Creator != k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_deploy_fungible_coin) {
- return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Deploy can only be executed by the correct policy account")
- }
- zrc20Addr := ethcommon.HexToAddress(msg.Zrc20Address)
- if zrc20Addr == (ethcommon.Address{}) {
- return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid zrc20 contract address (%s)", msg.Zrc20Address)
- }
- // update contracts
- zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi()
- if err != nil {
- return nil, sdkerrors.Wrapf(types.ErrABIGet, "failed to get zrc20 abi")
+ // check signer permission
+ if msg.Creator != k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_group2) {
+ return nil, cosmoserrors.Wrap(sdkerrors.ErrUnauthorized, "deploy can only be executed by the correct policy account")
}
- foreignCoins := k.GetAllForeignCoins(ctx)
- found := false
- var coin types.ForeignCoins
- for _, fcoin := range foreignCoins {
- coinZRC20Addr := ethcommon.HexToAddress(fcoin.Zrc20ContractAddress)
- if coinZRC20Addr == (ethcommon.Address{}) {
- k.Logger(ctx).Error("invalid zrc20 contract address", "address", fcoin.Zrc20ContractAddress)
- continue
- }
- if coinZRC20Addr == zrc20Addr {
- coin = fcoin
- found = true
- break
- }
+ // check the zrc20 exists
+ zrc20Addr := ethcommon.HexToAddress(msg.Zrc20Address)
+ if zrc20Addr == (ethcommon.Address{}) {
+ return nil, cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid zrc20 contract address (%s)", msg.Zrc20Address)
}
-
+ coin, found := k.GetForeignCoins(ctx, msg.Zrc20Address)
if !found {
- return nil, sdkerrors.Wrapf(types.ErrInvalidAddress, "no foreign coin match requested zrc20 address (%s)", msg.Zrc20Address)
+ return nil, cosmoserrors.Wrapf(types.ErrForeignCoinNotFound, "no foreign coin match requested zrc20 address (%s)", msg.Zrc20Address)
}
- res, err := k.CallEVM(ctx, *zrc20ABI, types.ModuleAddressEVM, zrc20Addr, BigIntZero, nil, false, false, "PROTOCOL_FLAT_FEE")
+ // get the previous fee
+ oldWithdrawFee, err := k.QueryProtocolFlatFee(ctx, zrc20Addr)
if err != nil {
- return nil, sdkerrors.Wrapf(types.ErrContractCall, "failed to call zrc20 contract PROTOCOL_FLAT_FEE method (%s)", err.Error())
- }
- unpacked, err := zrc20ABI.Unpack("PROTOCOL_FLAT_FEE", res.Ret)
- if err != nil || len(unpacked) == 0 {
- return nil, sdkerrors.Wrapf(types.ErrContractCall, "failed to unpack zrc20 contract PROTOCOL_FLAT_FEE method (%s)", err.Error())
+ return nil, cosmoserrors.Wrapf(types.ErrContractCall, "failed to query protocol flat fee (%s)", err.Error())
}
- oldWithdrawFee, ok := unpacked[0].(*big.Int)
- if !ok {
- return nil, sdkerrors.Wrapf(types.ErrContractCall, "failed to interpret the returned unpacked zrc20 contract PROTOCOL_FLAT_FEE method; ret %x", res.Ret)
+
+ zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi()
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(types.ErrABIGet, "failed to get zrc20 abi")
}
+ // call the contract method to update the fee
tmpCtx, commit := ctx.CacheContext()
- _, err = k.CallEVM(tmpCtx, *zrc20ABI, types.ModuleAddressEVM, zrc20Addr, BigIntZero, nil, true, false, "updateProtocolFlatFee", msg.NewWithdrawFee.BigInt())
+ _, err = k.CallEVM(
+ tmpCtx,
+ *zrc20ABI,
+ types.ModuleAddressEVM,
+ zrc20Addr,
+ BigIntZero,
+ nil,
+ true,
+ false,
+ "updateProtocolFlatFee",
+ msg.NewWithdrawFee.BigInt(),
+ )
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(types.ErrContractCall, "failed to call zrc20 contract updateProtocolFlatFee method (%s)", err.Error())
+ }
err = ctx.EventManager().EmitTypedEvent(
&types.EventZRC20WithdrawFeeUpdated{
@@ -77,8 +73,9 @@ func (k Keeper) UpdateZRC20WithdrawFee(goCtx context.Context, msg *types.MsgUpda
)
if err != nil {
k.Logger(ctx).Error("failed to emit event", "error", err.Error())
- return nil, sdkerrors.Wrapf(types.ErrEmitEvent, "failed to emit event (%s)", err.Error())
+ return nil, cosmoserrors.Wrapf(types.ErrEmitEvent, "failed to emit event (%s)", err.Error())
}
commit()
+
return &types.MsgUpdateZRC20WithdrawFeeResponse{}, nil
}
diff --git a/x/fungible/keeper/msg_server_update_zrc20_withdraw_fee_test.go b/x/fungible/keeper/msg_server_update_zrc20_withdraw_fee_test.go
new file mode 100644
index 0000000000..1b2cc0374b
--- /dev/null
+++ b/x/fungible/keeper/msg_server_update_zrc20_withdraw_fee_test.go
@@ -0,0 +1,160 @@
+package keeper_test
+
+import (
+ "errors"
+ "math/big"
+ "testing"
+
+ "cosmossdk.io/math"
+
+ sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
+ evmtypes "github.com/evmos/ethermint/x/evm/types"
+ "github.com/stretchr/testify/mock"
+ "github.com/stretchr/testify/require"
+ "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol"
+ 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 TestKeeper_UpdateZRC20WithdrawFee(t *testing.T) {
+ t.Run("can update the withdraw fee", func(t *testing.T) {
+ k, ctx, sdkk, zk := keepertest.FungibleKeeper(t)
+ chainID := getValidChainID(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+
+ // set coin admin
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+
+ // deploy the system contract and a ZRC20 contract
+ deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+ zrc20Addr := setupGasCoin(t, ctx, k, sdkk.EvmKeeper, chainID, "alpha", "alpha")
+
+ // initial protocol fee is zero
+ fee, err := k.QueryProtocolFlatFee(ctx, zrc20Addr)
+ require.NoError(t, err)
+ require.Zero(t, fee.Uint64())
+
+ // can update the fee
+ _, err = k.UpdateZRC20WithdrawFee(ctx, types.NewMsgUpdateZRC20WithdrawFee(
+ admin,
+ zrc20Addr.String(),
+ math.NewUint(42),
+ ))
+ require.NoError(t, err)
+
+ // can query the updated fee
+ fee, err = k.QueryProtocolFlatFee(ctx, zrc20Addr)
+ require.NoError(t, err)
+ require.Equal(t, uint64(42), fee.Uint64())
+ })
+
+ t.Run("should fail if not authorized", func(t *testing.T) {
+ k, ctx, _, _ := keepertest.FungibleKeeper(t)
+
+ _, err := k.UpdateZRC20WithdrawFee(ctx, types.NewMsgUpdateZRC20WithdrawFee(
+ sample.AccAddress(),
+ sample.EthAddress().String(),
+ math.NewUint(42)),
+ )
+ require.ErrorIs(t, err, sdkerrors.ErrUnauthorized)
+ })
+
+ t.Run("should fail if invalid zrc20 address", func(t *testing.T) {
+ k, ctx, _, zk := keepertest.FungibleKeeper(t)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+
+ _, err := k.UpdateZRC20WithdrawFee(ctx, types.NewMsgUpdateZRC20WithdrawFee(
+ admin,
+ "invalid_address",
+ math.NewUint(42)),
+ )
+ require.ErrorIs(t, err, sdkerrors.ErrInvalidAddress)
+ })
+
+ t.Run("should fail if can't retrieve the foreign coin", func(t *testing.T) {
+ k, ctx, _, zk := keepertest.FungibleKeeper(t)
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+
+ _, err := k.UpdateZRC20WithdrawFee(ctx, types.NewMsgUpdateZRC20WithdrawFee(
+ admin,
+ sample.EthAddress().String(),
+ math.NewUint(42)),
+ )
+ require.ErrorIs(t, err, types.ErrForeignCoinNotFound)
+ })
+
+ t.Run("should fail if can't query old fee", func(t *testing.T) {
+ k, ctx, _, zk := keepertest.FungibleKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+
+ // setup
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+ zrc20 := sample.EthAddress()
+ k.SetForeignCoins(ctx, sample.ForeignCoins(t, zrc20.String()))
+
+ // the method shall fail since we only set the foreign coin manually in the store but didn't deploy the contract
+ _, err := k.UpdateZRC20WithdrawFee(ctx, types.NewMsgUpdateZRC20WithdrawFee(
+ admin,
+ zrc20.String(),
+ math.NewUint(42)),
+ )
+ require.ErrorIs(t, err, types.ErrContractCall)
+ })
+
+ t.Run("should fail if contract call for setting new fee fails", func(t *testing.T) {
+ k, ctx, _, zk := keepertest.FungibleKeeperWithMocks(t, keepertest.FungibleMockOptions{UseEVMMock: true})
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+ mockEVMKeeper := keepertest.GetFungibleEVMMock(t, k)
+
+ // setup
+ admin := sample.AccAddress()
+ setAdminPolicies(ctx, zk, admin, observertypes.Policy_Type_group2)
+ zrc20Addr := sample.EthAddress()
+ k.SetForeignCoins(ctx, sample.ForeignCoins(t, zrc20Addr.String()))
+
+ // evm mocks
+ mockEVMKeeper.On("EstimateGas", mock.Anything, mock.Anything).Maybe().Return(
+ &evmtypes.EstimateGasResponse{Gas: 1000},
+ nil,
+ )
+ mockEVMKeeper.On("WithChainID", mock.Anything).Maybe().Return(ctx)
+ mockEVMKeeper.On("ChainID").Maybe().Return(big.NewInt(1))
+
+ // this is the query (commit == false)
+ zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi()
+ require.NoError(t, err)
+ protocolFlatFee, err := zrc20ABI.Methods["PROTOCOL_FLAT_FEE"].Outputs.Pack(big.NewInt(42))
+ require.NoError(t, err)
+ mockEVMKeeper.On(
+ "ApplyMessage",
+ mock.Anything,
+ mock.Anything,
+ mock.Anything,
+ false,
+ ).Return(&evmtypes.MsgEthereumTxResponse{Ret: protocolFlatFee}, nil)
+
+ // this is the update call (commit == true)
+ mockEVMKeeper.On(
+ "ApplyMessage",
+ mock.Anything,
+ mock.Anything,
+ mock.Anything,
+ true,
+ ).Return(&evmtypes.MsgEthereumTxResponse{}, errors.New("transaction failed"))
+
+ _, err = k.UpdateZRC20WithdrawFee(ctx, types.NewMsgUpdateZRC20WithdrawFee(
+ admin,
+ zrc20Addr.String(),
+ math.NewUint(42)),
+ )
+ require.ErrorIs(t, err, types.ErrContractCall)
+
+ mockEVMKeeper.AssertExpectations(t)
+ })
+}
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..a6e1ae8e03 100644
--- a/x/fungible/keeper/system_contract.go
+++ b/x/fungible/keeper/system_contract.go
@@ -7,7 +7,6 @@ import (
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
ethcommon "github.com/ethereum/go-ethereum/common"
- "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/connectorzevm.sol"
"github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/systemcontract.sol"
"github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/wzeta.sol"
"github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol"
@@ -54,19 +53,29 @@ func (k *Keeper) GetSystemContractAddress(ctx sdk.Context) (ethcommon.Address, e
return systemAddress, nil
}
-func (k *Keeper) QuerySystemContract(ctx sdk.Context, method string, args ...interface{}) {
-
-}
-
+// GetWZetaContractAddress returns the wzeta contract address on ZetaChain
func (k *Keeper) GetWZetaContractAddress(ctx sdk.Context) (ethcommon.Address, error) {
system, found := k.GetSystemContract(ctx)
if !found {
return ethcommon.Address{}, cosmoserrors.Wrapf(types.ErrStateVariableNotFound, "failed to get system contract variable")
}
systemAddress := ethcommon.HexToAddress(system.SystemContract)
- sysABI, _ := systemcontract.SystemContractMetaData.GetAbi()
+ sysABI, err := systemcontract.SystemContractMetaData.GetAbi()
+ if err != nil {
+ return ethcommon.Address{}, cosmoserrors.Wrapf(err, "failed to get system contract abi")
+ }
- res, err := k.CallEVM(ctx, *sysABI, types.ModuleAddressEVM, systemAddress, BigIntZero, nil, false, false, "wZetaContractAddress")
+ res, err := k.CallEVM(
+ ctx,
+ *sysABI,
+ types.ModuleAddressEVM,
+ systemAddress,
+ BigIntZero,
+ nil,
+ false,
+ false,
+ "wZetaContractAddress",
+ )
if err != nil {
return ethcommon.Address{}, cosmoserrors.Wrapf(err, "failed to call wZetaContractAddress")
}
@@ -80,15 +89,29 @@ func (k *Keeper) GetWZetaContractAddress(ctx sdk.Context) (ethcommon.Address, er
return wzetaResponse.Value, nil
}
+// GetUniswapV2FactoryAddress returns the uniswapv2 factory contract address on ZetaChain
func (k *Keeper) GetUniswapV2FactoryAddress(ctx sdk.Context) (ethcommon.Address, error) {
system, found := k.GetSystemContract(ctx)
if !found {
return ethcommon.Address{}, cosmoserrors.Wrapf(types.ErrStateVariableNotFound, "failed to get system contract variable")
}
systemAddress := ethcommon.HexToAddress(system.SystemContract)
- sysABI, _ := systemcontract.SystemContractMetaData.GetAbi()
+ sysABI, err := systemcontract.SystemContractMetaData.GetAbi()
+ if err != nil {
+ return ethcommon.Address{}, cosmoserrors.Wrapf(err, "failed to get system contract abi")
+ }
- res, err := k.CallEVM(ctx, *sysABI, types.ModuleAddressEVM, systemAddress, BigIntZero, nil, false, false, "uniswapv2FactoryAddress")
+ res, err := k.CallEVM(
+ ctx,
+ *sysABI,
+ types.ModuleAddressEVM,
+ systemAddress,
+ BigIntZero,
+ nil,
+ false,
+ false,
+ "uniswapv2FactoryAddress",
+ )
if err != nil {
return ethcommon.Address{}, cosmoserrors.Wrapf(err, "failed to call uniswapv2FactoryAddress")
}
@@ -102,15 +125,29 @@ func (k *Keeper) GetUniswapV2FactoryAddress(ctx sdk.Context) (ethcommon.Address,
return wzetaResponse.Value, nil
}
+// GetUniswapV2Router02Address returns the uniswapv2 router02 address on ZetaChain
func (k *Keeper) GetUniswapV2Router02Address(ctx sdk.Context) (ethcommon.Address, error) {
system, found := k.GetSystemContract(ctx)
if !found {
return ethcommon.Address{}, cosmoserrors.Wrapf(types.ErrStateVariableNotFound, "failed to get system contract variable")
}
systemAddress := ethcommon.HexToAddress(system.SystemContract)
- sysABI, _ := systemcontract.SystemContractMetaData.GetAbi()
+ sysABI, err := systemcontract.SystemContractMetaData.GetAbi()
+ if err != nil {
+ return ethcommon.Address{}, cosmoserrors.Wrapf(err, "failed to get system contract abi")
+ }
- res, err := k.CallEVM(ctx, *sysABI, types.ModuleAddressEVM, systemAddress, BigIntZero, nil, false, false, "uniswapv2Router02Address")
+ res, err := k.CallEVM(
+ ctx,
+ *sysABI,
+ types.ModuleAddressEVM,
+ systemAddress,
+ BigIntZero,
+ nil,
+ false,
+ false,
+ "uniswapv2Router02Address",
+ )
if err != nil {
return ethcommon.Address{}, cosmoserrors.Wrapf(err, "failed to call uniswapv2Router02Address")
}
@@ -124,6 +161,7 @@ func (k *Keeper) GetUniswapV2Router02Address(ctx sdk.Context) (ethcommon.Address
return routerResponse.Value, nil
}
+// CallWZetaDeposit calls the deposit method of the wzeta contract
func (k *Keeper) CallWZetaDeposit(ctx sdk.Context, sender ethcommon.Address, amount *big.Int) error {
wzetaAddress, err := k.GetWZetaContractAddress(ctx)
if err != nil {
@@ -134,23 +172,52 @@ func (k *Keeper) CallWZetaDeposit(ctx sdk.Context, sender ethcommon.Address, amo
return err
}
gasLimit := big.NewInt(70_000) // for some reason, GasEstimate for this contract call is always insufficient
- _, err = k.CallEVM(ctx, *abi, sender, wzetaAddress, amount, gasLimit, true, false, "deposit")
+
+ _, err = k.CallEVM(
+ ctx,
+ *abi,
+ sender,
+ wzetaAddress,
+ amount,
+ gasLimit,
+ true,
+ false,
+ "deposit",
+ )
if err != nil {
return cosmoserrors.Wrapf(err, "failed to call wzeta deposit")
}
return nil
}
+// QueryWZetaBalanceOf returns the balance of the given address in the wzeta contract
func (k *Keeper) QueryWZetaBalanceOf(ctx sdk.Context, addr ethcommon.Address) (*big.Int, error) {
wzetaAddress, err := k.GetWZetaContractAddress(ctx)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to get wzeta contract address")
}
- wzetaABI, _ := connectorzevm.WZETAMetaData.GetAbi()
- res, err := k.CallEVM(ctx, *wzetaABI, addr, wzetaAddress, big.NewInt(0), nil, false, false, "balanceOf", addr)
+
+ wzetaABI, err := wzeta.WETH9MetaData.GetAbi()
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(err, "failed to get ABI")
+ }
+
+ res, err := k.CallEVM(
+ ctx,
+ *wzetaABI,
+ addr,
+ wzetaAddress,
+ big.NewInt(0),
+ nil,
+ false,
+ false,
+ "balanceOf",
+ addr,
+ )
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to call balanceOf")
}
+
type BigIntResponse struct {
Value *big.Int
}
@@ -158,21 +225,38 @@ func (k *Keeper) QueryWZetaBalanceOf(ctx sdk.Context, addr ethcommon.Address) (*
if err := wzetaABI.UnpackIntoInterface(&balanceResponse, "balanceOf", res.Ret); err != nil {
return nil, cosmoserrors.Wrapf(types.ErrABIUnpack, "failed to unpack balanceOf: %s", err.Error())
}
+
return balanceResponse.Value, nil
}
+// QuerySystemContractGasCoinZRC20 returns the gas coin zrc20 address for the given chain id
func (k *Keeper) QuerySystemContractGasCoinZRC20(ctx sdk.Context, chainid *big.Int) (ethcommon.Address, error) {
system, found := k.GetSystemContract(ctx)
if !found {
return ethcommon.Address{}, cosmoserrors.Wrapf(types.ErrStateVariableNotFound, "failed to get system contract variable")
}
systemAddress := ethcommon.HexToAddress(system.SystemContract)
- sysABI, _ := systemcontract.SystemContractMetaData.GetAbi()
+ sysABI, err := systemcontract.SystemContractMetaData.GetAbi()
+ if err != nil {
+ return ethcommon.Address{}, cosmoserrors.Wrapf(err, "failed to get system contract abi")
+ }
- res, err := k.CallEVM(ctx, *sysABI, types.ModuleAddressEVM, systemAddress, BigIntZero, nil, false, false, "gasCoinZRC20ByChainId", chainid)
+ res, err := k.CallEVM(
+ ctx,
+ *sysABI,
+ types.ModuleAddressEVM,
+ systemAddress,
+ BigIntZero,
+ nil,
+ false,
+ false,
+ "gasCoinZRC20ByChainId",
+ chainid,
+ )
if err != nil {
return ethcommon.Address{}, cosmoserrors.Wrapf(err, "failed to call gasCoinZRC20ByChainId")
}
+
type AddressResponse struct {
Value ethcommon.Address
}
@@ -183,14 +267,138 @@ func (k *Keeper) QuerySystemContractGasCoinZRC20(ctx sdk.Context, chainid *big.I
return zrc20Res.Value, nil
}
-// returns the amount [in, out]
-func (k *Keeper) CallUniswapv2RouterSwapExactETHForToken(ctx sdk.Context, sender ethcommon.Address,
- to ethcommon.Address, amountIn *big.Int, outZRC4 ethcommon.Address, noEthereumTxEvent bool) ([]*big.Int, error) {
+// CallUniswapV2RouterSwapExactTokensForTokens calls the swapExactTokensForETH method of the uniswapv2 router contract
+// to swap tokens to another tokens using wZeta as intermediary
+func (k *Keeper) CallUniswapV2RouterSwapExactTokensForTokens(
+ ctx sdk.Context,
+ sender ethcommon.Address,
+ to ethcommon.Address,
+ amountIn *big.Int,
+ inZRC4,
+ outZRC4 ethcommon.Address,
+ noEthereumTxEvent bool,
+) (ret []*big.Int, err error) {
+ routerABI, err := uniswapv2router02.UniswapV2Router02MetaData.GetAbi()
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(err, "failed to get router abi")
+ }
+ wzetaAddr, err := k.GetWZetaContractAddress(ctx)
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(err, "failed to GetWZetaContractAddress")
+ }
+ routerAddress, err := k.GetUniswapV2Router02Address(ctx)
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(err, "failed to GetUniswapV2Router02Address")
+ }
+
+ //function swapExactTokensForTokens(
+ // uint amountIn,
+ // uint amountOutMin,
+ // address[] calldata path,
+ // address to,
+ // uint deadline
+ //)
+ res, err := k.CallEVM(
+ ctx,
+ *routerABI,
+ sender,
+ routerAddress,
+ BigIntZero,
+ big.NewInt(1000_000),
+ true,
+ noEthereumTxEvent,
+ "swapExactTokensForTokens",
+ amountIn,
+ BigIntZero,
+ []ethcommon.Address{inZRC4, wzetaAddr, outZRC4},
+ to,
+ big.NewInt(1e17),
+ )
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(err, "failed to CallEVM method swapExactTokensForTokens")
+ }
+
+ amounts := new([3]*big.Int)
+ err = routerABI.UnpackIntoInterface(&amounts, "swapExactTokensForTokens", res.Ret)
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(err, "failed to UnpackIntoInterface swapExactTokensForTokens")
+ }
+ return (*amounts)[:], nil
+}
+
+// CallUniswapV2RouterSwapExactTokensForETH calls the swapExactTokensForETH method of the uniswapv2 router contract
+func (k *Keeper) CallUniswapV2RouterSwapExactTokensForETH(
+ ctx sdk.Context,
+ sender ethcommon.Address,
+ to ethcommon.Address,
+ amountIn *big.Int,
+ inZRC4 ethcommon.Address,
+ noEthereumTxEvent bool,
+) (ret []*big.Int, err error) {
+ routerABI, err := uniswapv2router02.UniswapV2Router02MetaData.GetAbi()
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(err, "failed to get router abi")
+ }
+ wzetaAddr, err := k.GetWZetaContractAddress(ctx)
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(err, "failed to GetWZetaContractAddress")
+ }
+ routerAddress, err := k.GetUniswapV2Router02Address(ctx)
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(err, "failed to GetUniswapV2Router02Address")
+ }
+
+ //function swapExactTokensForETH(
+ // uint amountIn,
+ // uint amountOutMin,
+ // address[] calldata path,
+ // address to,
+ // uint deadline
+ //)
+ ctx.Logger().Error("Calling swapExactTokensForETH")
+ res, err := k.CallEVM(
+ ctx,
+ *routerABI,
+ sender,
+ routerAddress,
+ BigIntZero,
+ big.NewInt(300_000),
+ true,
+ noEthereumTxEvent,
+ "swapExactTokensForETH",
+ amountIn,
+ BigIntZero,
+ []ethcommon.Address{inZRC4, wzetaAddr},
+ to,
+ big.NewInt(1e17),
+ )
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(err, "failed to CallEVM method swapExactTokensForETH")
+ }
+
+ amounts := new([2]*big.Int)
+ err = routerABI.UnpackIntoInterface(&amounts, "swapExactTokensForETH", res.Ret)
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(err, "failed to UnpackIntoInterface swapExactTokensForETH")
+ }
+ return (*amounts)[:], nil
+}
+
+// CallUniswapV2RouterSwapExactETHForToken calls the swapExactETHForTokens method of the uniswapv2 router contract
+func (k *Keeper) CallUniswapV2RouterSwapExactETHForToken(
+ ctx sdk.Context,
+ sender ethcommon.Address,
+ to ethcommon.Address,
+ amountIn *big.Int,
+ outZRC4 ethcommon.Address,
+ noEthereumTxEvent bool,
+) ([]*big.Int, error) {
routerABI, err := uniswapv2router02.UniswapV2Router02MetaData.GetAbi()
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to get router abi")
}
- wzeta, err := k.GetWZetaContractAddress(ctx)
+
+ wzetaAddr, err := k.GetWZetaContractAddress(ctx)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to GetWZetaContractAddress")
}
@@ -198,10 +406,24 @@ func (k *Keeper) CallUniswapv2RouterSwapExactETHForToken(ctx sdk.Context, sender
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to GetUniswapV2Router02Address")
}
+
//function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable
//returns (uint[] memory amounts);
- res, err := k.CallEVM(ctx, *routerABI, sender, routerAddress, amountIn, big.NewInt(300_000), true, noEthereumTxEvent,
- "swapExactETHForTokens", BigIntZero, []ethcommon.Address{wzeta, outZRC4}, to, big.NewInt(1e17))
+ res, err := k.CallEVM(
+ ctx,
+ *routerABI,
+ sender,
+ routerAddress,
+ amountIn,
+ big.NewInt(300_000),
+ true,
+ noEthereumTxEvent,
+ "swapExactETHForTokens",
+ BigIntZero,
+ []ethcommon.Address{wzetaAddr, outZRC4},
+ to,
+ big.NewInt(1e17),
+ )
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to CallEVM method swapExactETHForTokens")
}
@@ -214,13 +436,20 @@ func (k *Keeper) CallUniswapv2RouterSwapExactETHForToken(ctx sdk.Context, sender
return (*amounts)[:], nil
}
-func (k *Keeper) CallUniswapv2RouterSwapEthForExactToken(ctx sdk.Context, sender ethcommon.Address, to ethcommon.Address, maxAmountIn *big.Int, amountOut *big.Int, outZRC4 ethcommon.Address) ([]*big.Int, error) {
-
+// CallUniswapV2RouterSwapEthForExactToken calls the swapETHForExactTokens method of the uniswapv2 router contract
+func (k *Keeper) CallUniswapV2RouterSwapEthForExactToken(
+ ctx sdk.Context,
+ sender ethcommon.Address,
+ to ethcommon.Address,
+ maxAmountIn *big.Int,
+ amountOut *big.Int,
+ outZRC4 ethcommon.Address,
+) ([]*big.Int, error) {
routerABI, err := uniswapv2router02.UniswapV2Router02MetaData.GetAbi()
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to get router abi")
}
- wzeta, err := k.GetWZetaContractAddress(ctx)
+ wzetaAddr, err := k.GetWZetaContractAddress(ctx)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to GetWZetaContractAddress")
}
@@ -228,10 +457,24 @@ func (k *Keeper) CallUniswapv2RouterSwapEthForExactToken(ctx sdk.Context, sender
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to GetUniswapV2Router02Address")
}
+
//function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
//returns (uint[] memory amounts);
- res, err := k.CallEVM(ctx, *routerABI, sender, routerAddress, maxAmountIn, big.NewInt(300_000), true, false,
- "swapETHForExactTokens", amountOut, []ethcommon.Address{wzeta, outZRC4}, to, big.NewInt(1e17))
+ res, err := k.CallEVM(
+ ctx,
+ *routerABI,
+ sender,
+ routerAddress,
+ maxAmountIn,
+ big.NewInt(300_000),
+ true,
+ false,
+ "swapETHForExactTokens",
+ amountOut,
+ []ethcommon.Address{wzetaAddr, outZRC4},
+ to,
+ big.NewInt(1e17),
+ )
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to CallEVM method swapETHForExactTokens")
}
@@ -244,24 +487,77 @@ func (k *Keeper) CallUniswapv2RouterSwapEthForExactToken(ctx sdk.Context, sender
return (*amounts)[:], nil
}
-func (k *Keeper) QueryUniswapv2RouterGetAmountsIn(ctx sdk.Context, amountOut *big.Int, outZRC4 ethcommon.Address) (*big.Int, error) {
+// QueryUniswapV2RouterGetZetaAmountsIn returns the amount of zeta needed to buy the given amount of ZRC4 tokens
+func (k *Keeper) QueryUniswapV2RouterGetZetaAmountsIn(ctx sdk.Context, amountOut *big.Int, outZRC4 ethcommon.Address) (*big.Int, error) {
routerABI, err := uniswapv2router02.UniswapV2Router02MetaData.GetAbi()
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to get router abi")
}
- wzeta, err := k.GetWZetaContractAddress(ctx)
+ wzetaAddr, err := k.GetWZetaContractAddress(ctx)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to GetWZetaContractAddress")
}
+ routerAddress, err := k.GetUniswapV2Router02Address(ctx)
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(err, "failed to GetUniswapV2Router02Address")
+ }
+
+ //function getAmountsIn(uint amountOut, address[] memory path) public view returns (uint[] memory amounts);
+ k.Logger(ctx).Info("getAmountsIn", "outZRC20", outZRC4.Hex(), "amountOut", amountOut, "wzeta", wzetaAddr.Hex())
+ res, err := k.CallEVM(
+ ctx,
+ *routerABI,
+ types.ModuleAddressEVM,
+ routerAddress,
+ BigIntZero,
+ nil,
+ false,
+ false,
+ "getAmountsIn",
+ amountOut,
+ []ethcommon.Address{wzetaAddr, outZRC4},
+ )
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(err, "failed to CallEVM method getAmountsIn")
+ }
+
+ amounts := new([2]*big.Int)
+ err = routerABI.UnpackIntoInterface(&amounts, "getAmountsIn", res.Ret)
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(err, "failed to unpack getAmountsIn")
+ }
+ return (*amounts)[0], nil
+}
+// QueryUniswapV2RouterGetZRC4AmountsIn returns the amount of ZRC4 tokens needed to buy the given amount of zeta
+func (k *Keeper) QueryUniswapV2RouterGetZRC4AmountsIn(ctx sdk.Context, amountOut *big.Int, inZRC4 ethcommon.Address) (*big.Int, error) {
+ routerABI, err := uniswapv2router02.UniswapV2Router02MetaData.GetAbi()
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(err, "failed to get router abi")
+ }
+ wzetaAddr, err := k.GetWZetaContractAddress(ctx)
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(err, "failed to GetWZetaContractAddress")
+ }
routerAddress, err := k.GetUniswapV2Router02Address(ctx)
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to GetUniswapV2Router02Address")
}
+
//function getAmountsIn(uint amountOut, address[] memory path) public view returns (uint[] memory amounts);
- k.Logger(ctx).Info("getAmountsIn", "outZRC20", outZRC4.Hex(), "amountOut", amountOut, "wzeta", wzeta.Hex())
- res, err := k.CallEVM(ctx, *routerABI, types.ModuleAddressEVM, routerAddress, BigIntZero, nil, false, false,
- "getAmountsIn", amountOut, []ethcommon.Address{wzeta, outZRC4})
+ res, err := k.CallEVM(
+ ctx,
+ *routerABI,
+ types.ModuleAddressEVM,
+ routerAddress,
+ BigIntZero,
+ nil,
+ false,
+ false,
+ "getAmountsIn",
+ amountOut,
+ []ethcommon.Address{inZRC4, wzetaAddr},
+ )
if err != nil {
return nil, cosmoserrors.Wrapf(err, "failed to CallEVM method getAmountsIn")
}
@@ -274,30 +570,92 @@ func (k *Keeper) QueryUniswapv2RouterGetAmountsIn(ctx sdk.Context, amountOut *bi
return (*amounts)[0], nil
}
-func (k *Keeper) CallZRC20Burn(ctx sdk.Context, sender ethcommon.Address, zrc20address ethcommon.Address,
- amount *big.Int, noEthereumTxEvent bool) error {
+// QueryUniswapV2RouterGetZRC4ToZRC4AmountsIn returns the amount of ZRC4 tokens needed to buy another ZRC4 token, it uses the WZeta contract as a bridge
+func (k *Keeper) QueryUniswapV2RouterGetZRC4ToZRC4AmountsIn(ctx sdk.Context, amountOut *big.Int, inZRC4, outZRC4 ethcommon.Address) (*big.Int, error) {
+ routerABI, err := uniswapv2router02.UniswapV2Router02MetaData.GetAbi()
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(err, "failed to get router abi")
+ }
+ wzetaAddr, err := k.GetWZetaContractAddress(ctx)
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(err, "failed to GetWZetaContractAddress")
+ }
+ routerAddress, err := k.GetUniswapV2Router02Address(ctx)
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(err, "failed to GetUniswapV2Router02Address")
+ }
+
+ //function getAmountsIn(uint amountOut, address[] memory path) public view returns (uint[] memory amounts);
+ res, err := k.CallEVM(
+ ctx,
+ *routerABI,
+ types.ModuleAddressEVM,
+ routerAddress,
+ BigIntZero,
+ nil,
+ false,
+ false,
+ "getAmountsIn",
+ amountOut,
+ []ethcommon.Address{inZRC4, wzetaAddr, outZRC4},
+ )
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(err, "failed to CallEVM method getAmountsIn")
+ }
+
+ amounts := new([3]*big.Int)
+ err = routerABI.UnpackIntoInterface(&amounts, "getAmountsIn", res.Ret)
+ if err != nil {
+ return nil, cosmoserrors.Wrapf(err, "failed to unpack getAmountsIn")
+ }
+ return (*amounts)[0], nil
+}
+
+// CallZRC20Burn calls the burn method of the zrc20 contract
+func (k *Keeper) CallZRC20Burn(
+ ctx sdk.Context,
+ sender ethcommon.Address,
+ zrc20address ethcommon.Address,
+ amount *big.Int,
+ noEthereumTxEvent bool,
+) error {
zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi()
if err != nil {
return cosmoserrors.Wrapf(err, "failed to get zrc20 abi")
}
- _, err = k.CallEVM(ctx, *zrc20ABI, sender, zrc20address, big.NewInt(0), big.NewInt(100_000), true, noEthereumTxEvent,
- "burn", amount)
+
+ _, err = k.CallEVM(
+ ctx,
+ *zrc20ABI,
+ sender,
+ zrc20address,
+ big.NewInt(0),
+ big.NewInt(100_000),
+ true,
+ noEthereumTxEvent,
+ "burn",
+ amount,
+ )
if err != nil {
return cosmoserrors.Wrapf(err, "failed to CallEVM method burn")
}
+
return nil
}
+// CallZRC20Deposit calls the deposit method of the zrc20 contract
func (k *Keeper) CallZRC20Deposit(
ctx sdk.Context,
sender ethcommon.Address,
zrc20address ethcommon.Address,
to ethcommon.Address,
- amount *big.Int) error {
+ amount *big.Int,
+) error {
zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi()
if err != nil {
return cosmoserrors.Wrapf(err, "failed to get zrc20 abi")
}
+
_, err = k.CallEVM(
ctx,
*zrc20ABI,
@@ -316,3 +674,37 @@ func (k *Keeper) CallZRC20Deposit(
}
return nil
}
+
+// CallZRC20Approve calls the approve method of the zrc20 contract
+func (k *Keeper) CallZRC20Approve(
+ ctx sdk.Context,
+ owner ethcommon.Address,
+ zrc20address ethcommon.Address,
+ spender ethcommon.Address,
+ amount *big.Int,
+ noEthereumTxEvent bool,
+) error {
+ zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi()
+ if err != nil {
+ return cosmoserrors.Wrapf(err, "failed to get zrc20 abi")
+ }
+
+ _, err = k.CallEVM(
+ ctx,
+ *zrc20ABI,
+ owner,
+ zrc20address,
+ BigIntZero,
+ nil,
+ true,
+ noEthereumTxEvent,
+ "approve",
+ spender,
+ amount,
+ )
+ if err != nil {
+ return cosmoserrors.Wrapf(err, "failed to CallEVM method approve")
+ }
+
+ return nil
+}
diff --git a/x/fungible/keeper/system_contract_test.go b/x/fungible/keeper/system_contract_test.go
index 57cbf00477..3874f52435 100644
--- a/x/fungible/keeper/system_contract_test.go
+++ b/x/fungible/keeper/system_contract_test.go
@@ -1,16 +1,126 @@
package keeper_test
import (
- "fmt"
+ "math/big"
"testing"
+ "github.com/ethereum/go-ethereum/common"
+ "github.com/stretchr/testify/require"
keepertest "github.com/zeta-chain/zetacore/testutil/keeper"
+ "github.com/zeta-chain/zetacore/testutil/sample"
"github.com/zeta-chain/zetacore/x/fungible/types"
)
func TestKeeper_GetSystemContract(t *testing.T) {
- keeper, ctx, _ := keepertest.FungibleKeeper(t)
- keeper.SetSystemContract(ctx, types.SystemContract{SystemContract: "test"})
- val, b := keeper.GetSystemContract(ctx)
- fmt.Println(val, b)
+ k, ctx, _, _ := keepertest.FungibleKeeper(t)
+ k.SetSystemContract(ctx, types.SystemContract{SystemContract: "test"})
+ val, found := k.GetSystemContract(ctx)
+ require.True(t, found)
+ require.Equal(t, types.SystemContract{SystemContract: "test"}, val)
+
+ // can remove contract
+ k.RemoveSystemContract(ctx)
+ _, found = k.GetSystemContract(ctx)
+ require.False(t, found)
+}
+
+func TestKeeper_GetSystemContractAddress(t *testing.T) {
+ k, ctx, sdkk, _ := keepertest.FungibleKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+
+ _, err := k.GetSystemContractAddress(ctx)
+ require.Error(t, err)
+ require.ErrorIs(t, err, types.ErrStateVariableNotFound)
+
+ _, _, _, _, systemContract := deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+ found, err := k.GetSystemContractAddress(ctx)
+ require.NoError(t, err)
+ require.Equal(t, systemContract, found)
+}
+
+func TestKeeper_GetWZetaContractAddress(t *testing.T) {
+ k, ctx, sdkk, _ := keepertest.FungibleKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+
+ _, err := k.GetWZetaContractAddress(ctx)
+ require.Error(t, err)
+ require.ErrorIs(t, err, types.ErrStateVariableNotFound)
+
+ wzeta, _, _, _, _ := deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+ found, err := k.GetWZetaContractAddress(ctx)
+ require.NoError(t, err)
+ require.Equal(t, wzeta, found)
+}
+
+func TestKeeper_GetUniswapV2FactoryAddress(t *testing.T) {
+ k, ctx, sdkk, _ := keepertest.FungibleKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+
+ _, err := k.GetUniswapV2FactoryAddress(ctx)
+ require.Error(t, err)
+ require.ErrorIs(t, err, types.ErrStateVariableNotFound)
+
+ _, factory, _, _, _ := deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+ found, err := k.GetUniswapV2FactoryAddress(ctx)
+ require.NoError(t, err)
+ require.Equal(t, factory, found)
+}
+
+func TestKeeper_GetUniswapV2Router02Address(t *testing.T) {
+ k, ctx, sdkk, _ := keepertest.FungibleKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+
+ _, err := k.GetUniswapV2Router02Address(ctx)
+ require.Error(t, err)
+ require.ErrorIs(t, err, types.ErrStateVariableNotFound)
+
+ _, _, router, _, _ := deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+ found, err := k.GetUniswapV2Router02Address(ctx)
+ require.NoError(t, err)
+ require.Equal(t, router, found)
+}
+
+func TestKeeper_CallWZetaDeposit(t *testing.T) {
+ k, ctx, sdkk, _ := keepertest.FungibleKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+
+ // mint tokens
+ addr := sample.Bech32AccAddress()
+ ethAddr := common.BytesToAddress(addr.Bytes())
+ coins := sample.Coins()
+ err := sdkk.BankKeeper.MintCoins(ctx, types.ModuleName, sample.Coins())
+ require.NoError(t, err)
+ err = sdkk.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, addr, coins)
+ require.NoError(t, err)
+
+ // fail if no system contract
+ err = k.CallWZetaDeposit(ctx, ethAddr, big.NewInt(42))
+ require.Error(t, err)
+
+ deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+
+ // deposit
+ err = k.CallWZetaDeposit(ctx, ethAddr, big.NewInt(42))
+ require.NoError(t, err)
+
+ balance, err := k.QueryWZetaBalanceOf(ctx, ethAddr)
+ require.NoError(t, err)
+ require.Equal(t, big.NewInt(42), balance)
+}
+
+func TestKeeper_QuerySystemContractGasCoinZRC20(t *testing.T) {
+ k, ctx, sdkk, _ := keepertest.FungibleKeeper(t)
+ k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName)
+ chainID := getValidChainID(t)
+
+ _, err := k.QuerySystemContractGasCoinZRC20(ctx, big.NewInt(chainID))
+ require.Error(t, err)
+ require.ErrorIs(t, err, types.ErrStateVariableNotFound)
+
+ deploySystemContracts(t, ctx, k, sdkk.EvmKeeper)
+ zrc20 := setupGasCoin(t, ctx, k, sdkk.EvmKeeper, chainID, "foobar", "foobar")
+
+ found, err := k.QuerySystemContractGasCoinZRC20(ctx, big.NewInt(chainID))
+ require.NoError(t, err)
+ require.Equal(t, zrc20, found)
}
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..5b63632114 100644
--- a/x/fungible/types/errors.go
+++ b/x/fungible/types/errors.go
@@ -27,4 +27,8 @@ 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")
+ ErrSetBytecode = sdkerrors.Register(ModuleName, 1119, "set bytecode error")
+ ErrInvalidContract = sdkerrors.Register(ModuleName, 1120, "invalid contract")
+ ErrPausedZRC20 = sdkerrors.Register(ModuleName, 1121, "ZRC20 is paused")
+ ErrForeignCoinNotFound = sdkerrors.Register(ModuleName, 1122, "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, 0x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x8c, 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/expected_keepers.go b/x/fungible/types/expected_keepers.go
index fd3b5505f5..46450aab09 100644
--- a/x/fungible/types/expected_keepers.go
+++ b/x/fungible/types/expected_keepers.go
@@ -7,8 +7,10 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
+ ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/vm"
+ "github.com/evmos/ethermint/x/evm/statedb"
evmtypes "github.com/evmos/ethermint/x/evm/types"
"github.com/zeta-chain/zetacore/common"
@@ -63,4 +65,6 @@ type EVMKeeper interface {
tracer vm.EVMLogger,
commit bool,
) (*evmtypes.MsgEthereumTxResponse, error)
+ GetAccount(ctx sdk.Context, addr ethcommon.Address) *statedb.Account
+ SetAccount(ctx sdk.Context, addr ethcommon.Address, account statedb.Account) error
}
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, 0xc7, 0x8c, 0x1d, 0x4b, 0xf2, 0x22, 0x45,
- 0xb2, 0x93, 0xc9, 0xdf, 0x7d, 0xe7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, 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, 0xda, 0xc8, 0x9a, 0xf1, 0x5c, 0x24, 0x54, 0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 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_contract_bytecode.go b/x/fungible/types/message_update_contract_bytecode.go
new file mode 100644
index 0000000000..a8a10cb5bd
--- /dev/null
+++ b/x/fungible/types/message_update_contract_bytecode.go
@@ -0,0 +1,62 @@
+package types
+
+import (
+ cosmoserror "cosmossdk.io/errors"
+
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
+ ethcommon "github.com/ethereum/go-ethereum/common"
+)
+
+const TypeMsgUpdateContractBytecode = "update_contract_bytecode"
+
+var _ sdk.Msg = &MsgUpdateContractBytecode{}
+
+func NewMsgUpdateContractBytecode(
+ creator string, contractAddress ethcommon.Address, newBytecodeAddress ethcommon.Address,
+) *MsgUpdateContractBytecode {
+ return &MsgUpdateContractBytecode{
+ Creator: creator,
+ ContractAddress: contractAddress.Hex(),
+ NewBytecodeAddress: newBytecodeAddress.Hex(),
+ }
+}
+
+func (msg *MsgUpdateContractBytecode) Route() string {
+ return RouterKey
+}
+
+func (msg *MsgUpdateContractBytecode) Type() string {
+ return TypeMsgUpdateContractBytecode
+}
+
+func (msg *MsgUpdateContractBytecode) GetSigners() []sdk.AccAddress {
+ creator, err := sdk.AccAddressFromBech32(msg.Creator)
+ if err != nil {
+ panic(err)
+ }
+ return []sdk.AccAddress{creator}
+}
+
+func (msg *MsgUpdateContractBytecode) GetSignBytes() []byte {
+ bz := ModuleCdc.MustMarshalJSON(msg)
+ return sdk.MustSortJSON(bz)
+}
+
+func (msg *MsgUpdateContractBytecode) ValidateBasic() error {
+ if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil {
+ return cosmoserror.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
+ }
+
+ // check if the contract address is valid
+ if !ethcommon.IsHexAddress(msg.ContractAddress) {
+ return cosmoserror.Wrapf(sdkerrors.ErrInvalidAddress, "invalid contract address (%s)", msg.ContractAddress)
+ }
+
+ // check if the bytecode contract address is valid
+ if !ethcommon.IsHexAddress(msg.NewBytecodeAddress) {
+ return cosmoserror.Wrapf(sdkerrors.ErrInvalidAddress, "invalid contract address (%s)", msg.ContractAddress)
+ }
+
+ return nil
+}
diff --git a/x/fungible/types/message_update_contract_bytecode_test.go b/x/fungible/types/message_update_contract_bytecode_test.go
new file mode 100644
index 0000000000..23a1ee2d97
--- /dev/null
+++ b/x/fungible/types/message_update_contract_bytecode_test.go
@@ -0,0 +1,65 @@
+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 TestMsgUpdateContractBytecode_ValidateBasic(t *testing.T) {
+ tt := []struct {
+ name string
+ msg types.MsgUpdateContractBytecode
+ wantError bool
+ }{
+ {
+ name: "valid",
+ msg: types.MsgUpdateContractBytecode{
+ Creator: sample.AccAddress(),
+ ContractAddress: sample.EthAddress().Hex(),
+ NewBytecodeAddress: sample.EthAddress().Hex(),
+ },
+ wantError: false,
+ },
+ {
+ name: "invalid creator",
+ msg: types.MsgUpdateContractBytecode{
+ Creator: "invalid",
+ ContractAddress: sample.EthAddress().Hex(),
+ NewBytecodeAddress: sample.EthAddress().Hex(),
+ },
+ wantError: true,
+ },
+ {
+ name: "invalid contract address",
+ msg: types.MsgUpdateContractBytecode{
+ Creator: sample.AccAddress(),
+ ContractAddress: "invalid",
+ NewBytecodeAddress: sample.EthAddress().Hex(),
+ },
+ wantError: true,
+ },
+ {
+ name: "invalid bytecode address",
+ msg: types.MsgUpdateContractBytecode{
+ Creator: sample.AccAddress(),
+ ContractAddress: sample.EthAddress().Hex(),
+ NewBytecodeAddress: "invalid",
+ },
+ wantError: true,
+ },
+ }
+
+ for _, tc := range tt {
+ t.Run(tc.name, func(t *testing.T) {
+ err := tc.msg.ValidateBasic()
+ if tc.wantError {
+ require.Error(t, err)
+ } else {
+ require.NoError(t, err)
+ }
+ })
+ }
+}
diff --git a/x/fungible/types/message_update_system_contract.go b/x/fungible/types/message_update_system_contract.go
index 201aad573f..b6879f2ff6 100644
--- a/x/fungible/types/message_update_system_contract.go
+++ b/x/fungible/types/message_update_system_contract.go
@@ -10,7 +10,7 @@ const TypeMsgUpdateSystemContract = "update_system_contract"
var _ sdk.Msg = &MsgUpdateSystemContract{}
-func NewMessageUpdateSystemContract(creator string, systemContractAddr string) *MsgUpdateSystemContract {
+func NewMsgUpdateSystemContract(creator string, systemContractAddr string) *MsgUpdateSystemContract {
return &MsgUpdateSystemContract{
Creator: creator,
NewSystemContractAddress: systemContractAddr,
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/message_update_zrc20_withdraw_fee.go b/x/fungible/types/message_update_zrc20_withdraw_fee.go
index ba1c61183f..1b1d6de1ec 100644
--- a/x/fungible/types/message_update_zrc20_withdraw_fee.go
+++ b/x/fungible/types/message_update_zrc20_withdraw_fee.go
@@ -45,7 +45,7 @@ func (msg *MsgUpdateZRC20WithdrawFee) ValidateBasic() error {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
// check if the system contract address is valid
- if ethcommon.HexToAddress(msg.Zrc20Address) == (ethcommon.Address{}) {
+ if !ethcommon.IsHexAddress(msg.Zrc20Address) {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid system contract address (%s)", msg.Zrc20Address)
}
if msg.NewWithdrawFee.IsNil() {
diff --git a/x/fungible/types/params.go b/x/fungible/types/params.go
index 357196ad6a..4b348397da 100644
--- a/x/fungible/types/params.go
+++ b/x/fungible/types/params.go
@@ -34,6 +34,9 @@ func (p Params) Validate() error {
// String implements the Stringer interface.
func (p Params) String() string {
- out, _ := yaml.Marshal(p)
+ out, err := yaml.Marshal(p)
+ if err != nil {
+ return ""
+ }
return string(out)
}
diff --git a/x/fungible/types/tx.pb.go b/x/fungible/types/tx.pb.go
index a56fcebf3b..62cb8d4ac8 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"`
@@ -309,6 +334,7 @@ func (m *MsgDeployFungibleCoinZRC20) GetGasLimit() int64 {
}
type MsgDeployFungibleCoinZRC20Response struct {
+ Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
}
func (m *MsgDeployFungibleCoinZRC20Response) Reset() { *m = MsgDeployFungibleCoinZRC20Response{} }
@@ -344,6 +370,13 @@ func (m *MsgDeployFungibleCoinZRC20Response) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgDeployFungibleCoinZRC20Response proto.InternalMessageInfo
+func (m *MsgDeployFungibleCoinZRC20Response) GetAddress() string {
+ if m != nil {
+ return m.Address
+ }
+ return ""
+}
+
type MsgRemoveForeignCoin struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
@@ -432,7 +465,208 @@ func (m *MsgRemoveForeignCoinResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgRemoveForeignCoinResponse proto.InternalMessageInfo
+type MsgUpdateContractBytecode struct {
+ Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
+ ContractAddress string `protobuf:"bytes,2,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"`
+ NewBytecodeAddress string `protobuf:"bytes,3,opt,name=new_bytecode_address,json=newBytecodeAddress,proto3" json:"new_bytecode_address,omitempty"`
+}
+
+func (m *MsgUpdateContractBytecode) Reset() { *m = MsgUpdateContractBytecode{} }
+func (m *MsgUpdateContractBytecode) String() string { return proto.CompactTextString(m) }
+func (*MsgUpdateContractBytecode) ProtoMessage() {}
+func (*MsgUpdateContractBytecode) Descriptor() ([]byte, []int) {
+ return fileDescriptor_197fdedece277fa0, []int{8}
+}
+func (m *MsgUpdateContractBytecode) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *MsgUpdateContractBytecode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_MsgUpdateContractBytecode.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 *MsgUpdateContractBytecode) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_MsgUpdateContractBytecode.Merge(m, src)
+}
+func (m *MsgUpdateContractBytecode) XXX_Size() int {
+ return m.Size()
+}
+func (m *MsgUpdateContractBytecode) XXX_DiscardUnknown() {
+ xxx_messageInfo_MsgUpdateContractBytecode.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_MsgUpdateContractBytecode proto.InternalMessageInfo
+
+func (m *MsgUpdateContractBytecode) GetCreator() string {
+ if m != nil {
+ return m.Creator
+ }
+ return ""
+}
+
+func (m *MsgUpdateContractBytecode) GetContractAddress() string {
+ if m != nil {
+ return m.ContractAddress
+ }
+ return ""
+}
+
+func (m *MsgUpdateContractBytecode) GetNewBytecodeAddress() string {
+ if m != nil {
+ return m.NewBytecodeAddress
+ }
+ return ""
+}
+
+type MsgUpdateContractBytecodeResponse struct {
+ NewBytecodeHash []byte `protobuf:"bytes,1,opt,name=new_bytecode_hash,json=newBytecodeHash,proto3" json:"new_bytecode_hash,omitempty"`
+}
+
+func (m *MsgUpdateContractBytecodeResponse) Reset() { *m = MsgUpdateContractBytecodeResponse{} }
+func (m *MsgUpdateContractBytecodeResponse) String() string { return proto.CompactTextString(m) }
+func (*MsgUpdateContractBytecodeResponse) ProtoMessage() {}
+func (*MsgUpdateContractBytecodeResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor_197fdedece277fa0, []int{9}
+}
+func (m *MsgUpdateContractBytecodeResponse) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *MsgUpdateContractBytecodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_MsgUpdateContractBytecodeResponse.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 *MsgUpdateContractBytecodeResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_MsgUpdateContractBytecodeResponse.Merge(m, src)
+}
+func (m *MsgUpdateContractBytecodeResponse) XXX_Size() int {
+ return m.Size()
+}
+func (m *MsgUpdateContractBytecodeResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_MsgUpdateContractBytecodeResponse.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_MsgUpdateContractBytecodeResponse proto.InternalMessageInfo
+
+func (m *MsgUpdateContractBytecodeResponse) GetNewBytecodeHash() []byte {
+ if m != nil {
+ return m.NewBytecodeHash
+ }
+ return nil
+}
+
+type MsgUpdateZRC20PausedStatus struct {
+ Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
+ Zrc20Addresses []string `protobuf:"bytes,2,rep,name=zrc20_addresses,json=zrc20Addresses,proto3" json:"zrc20_addresses,omitempty"`
+ 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{10}
+}
+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{11}
+}
+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 +675,69 @@ 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((*MsgUpdateContractBytecode)(nil), "zetachain.zetacore.fungible.MsgUpdateContractBytecode")
+ proto.RegisterType((*MsgUpdateContractBytecodeResponse)(nil), "zetachain.zetacore.fungible.MsgUpdateContractBytecodeResponse")
+ 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, 0xb5, 0x0f, 0x66, 0xb6, 0x77, 0x79, 0xc8,
- 0x1a, 0x4d, 0xb4, 0xd5, 0x9e, 0xd5, 0x8a, 0x85, 0x12, 0x74, 0x7e, 0x1f, 0x95, 0xe7, 0xef, 0x78,
- 0x8c, 0x5b, 0x69, 0x24,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c, 0x2c, 0xf8,
+ 0x0f, 0xfb, 0xe2, 0x72, 0xc0, 0xf3, 0x71, 0xda, 0x83, 0xab, 0xc5, 0x2d, 0xa0, 0x74, 0xe1, 0xbe,
+ 0xb8, 0x24, 0xa5, 0xf9, 0xb8, 0xcb, 0x52, 0x2a, 0xbc, 0x0b, 0x22, 0x31, 0x17, 0x0d, 0xf7, 0xfd,
+ 0x77, 0x48, 0x37, 0x1f, 0xb8, 0x5a, 0xcc, 0x2b, 0xc6, 0xf3, 0xe8, 0xf1, 0xab, 0xb3, 0xa6, 0xf2,
+ 0xfa, 0xac, 0xa9, 0xfc, 0x7b, 0xd6, 0x54, 0x5e, 0x9e, 0x37, 0x4b, 0xaf, 0xcf, 0x9b, 0xa5, 0xbf,
+ 0xcf, 0x9b, 0xa5, 0xa7, 0x66, 0xee, 0x75, 0x10, 0x41, 0xef, 0xcb, 0x53, 0xcc, 0xf4, 0x14, 0xf3,
+ 0x99, 0xf9, 0xf6, 0x61, 0x14, 0x3d, 0x15, 0xfa, 0x15, 0xf9, 0xa8, 0xf9, 0xf4, 0xff, 0x00, 0x00,
+ 0x00, 0xff, 0xff, 0x16, 0xf6, 0xee, 0xe7, 0x31, 0x09, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -505,6 +756,8 @@ 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)
+ UpdateContractBytecode(ctx context.Context, in *MsgUpdateContractBytecode, opts ...grpc.CallOption) (*MsgUpdateContractBytecodeResponse, error)
+ UpdateZRC20PausedStatus(ctx context.Context, in *MsgUpdateZRC20PausedStatus, opts ...grpc.CallOption) (*MsgUpdateZRC20PausedStatusResponse, error)
}
type msgClient struct {
@@ -551,12 +804,32 @@ func (c *msgClient) UpdateZRC20WithdrawFee(ctx context.Context, in *MsgUpdateZRC
return out, nil
}
+func (c *msgClient) UpdateContractBytecode(ctx context.Context, in *MsgUpdateContractBytecode, opts ...grpc.CallOption) (*MsgUpdateContractBytecodeResponse, error) {
+ out := new(MsgUpdateContractBytecodeResponse)
+ err := c.cc.Invoke(ctx, "/zetachain.zetacore.fungible.Msg/UpdateContractBytecode", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ 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)
+ UpdateContractBytecode(context.Context, *MsgUpdateContractBytecode) (*MsgUpdateContractBytecodeResponse, error)
+ UpdateZRC20PausedStatus(context.Context, *MsgUpdateZRC20PausedStatus) (*MsgUpdateZRC20PausedStatusResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
@@ -575,6 +848,12 @@ 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) UpdateContractBytecode(ctx context.Context, req *MsgUpdateContractBytecode) (*MsgUpdateContractBytecodeResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method UpdateContractBytecode 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 +931,42 @@ func _Msg_UpdateZRC20WithdrawFee_Handler(srv interface{}, ctx context.Context, d
return interceptor(ctx, in, info, handler)
}
+func _Msg_UpdateContractBytecode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(MsgUpdateContractBytecode)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(MsgServer).UpdateContractBytecode(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/zetachain.zetacore.fungible.Msg/UpdateContractBytecode",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(MsgServer).UpdateContractBytecode(ctx, req.(*MsgUpdateContractBytecode))
+ }
+ 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 +987,14 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
MethodName: "UpdateZRC20WithdrawFee",
Handler: _Msg_UpdateZRC20WithdrawFee_Handler,
},
+ {
+ MethodName: "UpdateContractBytecode",
+ Handler: _Msg_UpdateContractBytecode_Handler,
+ },
+ {
+ MethodName: "UpdateZRC20PausedStatus",
+ Handler: _Msg_UpdateZRC20PausedStatus_Handler,
+ },
},
Streams: []grpc.StreamDesc{},
Metadata: "fungible/tx.proto",
@@ -898,6 +1221,13 @@ func (m *MsgDeployFungibleCoinZRC20Response) MarshalToSizedBuffer(dAtA []byte) (
_ = i
var l int
_ = l
+ if len(m.Address) > 0 {
+ i -= len(m.Address)
+ copy(dAtA[i:], m.Address)
+ i = encodeVarintTx(dAtA, i, uint64(len(m.Address)))
+ i--
+ dAtA[i] = 0xa
+ }
return len(dAtA) - i, nil
}
@@ -961,55 +1291,196 @@ func (m *MsgRemoveForeignCoinResponse) MarshalToSizedBuffer(dAtA []byte) (int, e
return len(dAtA) - i, nil
}
-func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
- offset -= sovTx(v)
- base := offset
- for v >= 1<<7 {
- dAtA[offset] = uint8(v&0x7f | 0x80)
- v >>= 7
- offset++
+func (m *MsgUpdateContractBytecode) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
}
- dAtA[offset] = uint8(v)
- return base
+ return dAtA[:n], nil
}
-func (m *MsgUpdateZRC20WithdrawFee) Size() (n int) {
- if m == nil {
- return 0
- }
+
+func (m *MsgUpdateContractBytecode) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *MsgUpdateContractBytecode) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
var l int
_ = l
- l = len(m.Creator)
- if l > 0 {
- n += 1 + l + sovTx(uint64(l))
+ if len(m.NewBytecodeAddress) > 0 {
+ i -= len(m.NewBytecodeAddress)
+ copy(dAtA[i:], m.NewBytecodeAddress)
+ i = encodeVarintTx(dAtA, i, uint64(len(m.NewBytecodeAddress)))
+ i--
+ dAtA[i] = 0x1a
}
- l = len(m.Zrc20Address)
- if l > 0 {
- n += 1 + l + sovTx(uint64(l))
+ if len(m.ContractAddress) > 0 {
+ i -= len(m.ContractAddress)
+ copy(dAtA[i:], m.ContractAddress)
+ i = encodeVarintTx(dAtA, i, uint64(len(m.ContractAddress)))
+ i--
+ dAtA[i] = 0x12
}
- l = m.NewWithdrawFee.Size()
- n += 1 + l + sovTx(uint64(l))
- return n
+ 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 *MsgUpdateZRC20WithdrawFeeResponse) Size() (n int) {
- if m == nil {
- return 0
+func (m *MsgUpdateContractBytecodeResponse) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
}
- var l int
- _ = l
- return n
+ return dAtA[:n], nil
}
-func (m *MsgUpdateSystemContract) Size() (n int) {
- if m == nil {
- return 0
- }
+func (m *MsgUpdateContractBytecodeResponse) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *MsgUpdateContractBytecodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
var l int
_ = l
- l = len(m.Creator)
- if l > 0 {
- n += 1 + l + sovTx(uint64(l))
- }
+ if len(m.NewBytecodeHash) > 0 {
+ i -= len(m.NewBytecodeHash)
+ copy(dAtA[i:], m.NewBytecodeHash)
+ i = encodeVarintTx(dAtA, i, uint64(len(m.NewBytecodeHash)))
+ i--
+ dAtA[i] = 0xa
+ }
+ return len(dAtA) - i, nil
+}
+
+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
+ for v >= 1<<7 {
+ dAtA[offset] = uint8(v&0x7f | 0x80)
+ v >>= 7
+ offset++
+ }
+ dAtA[offset] = uint8(v)
+ return base
+}
+func (m *MsgUpdateZRC20WithdrawFee) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.Creator)
+ if l > 0 {
+ n += 1 + l + sovTx(uint64(l))
+ }
+ l = len(m.Zrc20Address)
+ if l > 0 {
+ n += 1 + l + sovTx(uint64(l))
+ }
+ l = m.NewWithdrawFee.Size()
+ n += 1 + l + sovTx(uint64(l))
+ return n
+}
+
+func (m *MsgUpdateZRC20WithdrawFeeResponse) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ return n
+}
+
+func (m *MsgUpdateSystemContract) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.Creator)
+ if l > 0 {
+ n += 1 + l + sovTx(uint64(l))
+ }
l = len(m.NewSystemContractAddress)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
@@ -1069,6 +1540,10 @@ func (m *MsgDeployFungibleCoinZRC20Response) Size() (n int) {
}
var l int
_ = l
+ l = len(m.Address)
+ if l > 0 {
+ n += 1 + l + sovTx(uint64(l))
+ }
return n
}
@@ -1098,6 +1573,71 @@ func (m *MsgRemoveForeignCoinResponse) Size() (n int) {
return n
}
+func (m *MsgUpdateContractBytecode) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.Creator)
+ if l > 0 {
+ n += 1 + l + sovTx(uint64(l))
+ }
+ l = len(m.ContractAddress)
+ if l > 0 {
+ n += 1 + l + sovTx(uint64(l))
+ }
+ l = len(m.NewBytecodeAddress)
+ if l > 0 {
+ n += 1 + l + sovTx(uint64(l))
+ }
+ return n
+}
+
+func (m *MsgUpdateContractBytecodeResponse) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.NewBytecodeHash)
+ if l > 0 {
+ n += 1 + l + sovTx(uint64(l))
+ }
+ 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
}
@@ -1749,6 +2289,38 @@ func (m *MsgDeployFungibleCoinZRC20Response) Unmarshal(dAtA []byte) error {
return fmt.Errorf("proto: MsgDeployFungibleCoinZRC20Response: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return 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.Address = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
@@ -1934,6 +2506,419 @@ func (m *MsgRemoveForeignCoinResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
+func (m *MsgUpdateContractBytecode) 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: MsgUpdateContractBytecode: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: MsgUpdateContractBytecode: 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 ContractAddress", 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.ContractAddress = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 3:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field NewBytecodeAddress", 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.NewBytecodeAddress = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipTx(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthTx
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func (m *MsgUpdateContractBytecodeResponse) 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: MsgUpdateContractBytecodeResponse: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: MsgUpdateContractBytecodeResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field NewBytecodeHash", wireType)
+ }
+ var byteLen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTx
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ byteLen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if byteLen < 0 {
+ return ErrInvalidLengthTx
+ }
+ postIndex := iNdEx + byteLen
+ if postIndex < 0 {
+ return ErrInvalidLengthTx
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.NewBytecodeHash = append(m.NewBytecodeHash[:0], dAtA[iNdEx:postIndex]...)
+ if m.NewBytecodeHash == nil {
+ m.NewBytecodeHash = []byte{}
+ }
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipTx(dAtA[iNdEx:])
+ 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 *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/abci.go b/x/observer/abci.go
index b69c4a9bec..f253819d6a 100644
--- a/x/observer/abci.go
+++ b/x/observer/abci.go
@@ -24,6 +24,7 @@ func BeginBlocker(ctx sdk.Context, k keeper.Keeper) {
ctx.Logger().Error("TotalObserverCount is negative at height", ctx.BlockHeight())
return
}
+ // #nosec G701 always in range
if totalObserverCountCurrentBlock == int(lastBlockObserverCount.Count) {
return
}
@@ -33,5 +34,6 @@ func BeginBlocker(ctx sdk.Context, k keeper.Keeper) {
}
k.DisableInboundOnly(ctx)
k.SetKeygen(ctx, types.Keygen{BlockNumber: math.MaxInt64})
+ // #nosec G701 always positive
k.SetLastObserverCount(ctx, &types.LastObserverCount{Count: uint64(totalObserverCountCurrentBlock), LastChangeHeight: ctx.BlockHeight()})
}
diff --git a/x/observer/client/cli/query.go b/x/observer/client/cli/query.go
index a6db31fc0d..1ea4d0d88b 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,
@@ -34,7 +34,7 @@ func GetQueryCmd(queryRoute string) *cobra.Command {
CmdGetCoreParams(),
CmdListNodeAccount(),
CmdShowNodeAccount(),
- CmdShowPermissionFlags(),
+ CmdShowCrosschainFlags(),
CmdShowKeygen(),
CmdShowObserverCount(),
CmdBlameByIdentifier(),
diff --git a/x/observer/client/cli/query_permission_flags.go b/x/observer/client/cli/query_permission_flags.go
index a1e27a6977..917b47897c 100644
--- a/x/observer/client/cli/query_permission_flags.go
+++ b/x/observer/client/cli/query_permission_flags.go
@@ -9,19 +9,19 @@ import (
"github.com/zeta-chain/zetacore/x/observer/types"
)
-func CmdShowPermissionFlags() *cobra.Command {
+func CmdShowCrosschainFlags() *cobra.Command {
cmd := &cobra.Command{
- Use: "show-permission-flags",
- Short: "shows PermissionFlags",
+ Use: "show-crosschain-flags",
+ Short: "shows the crosschain flags",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
queryClient := types.NewQueryClient(clientCtx)
- params := &types.QueryGetPermissionFlagsRequest{}
+ params := &types.QueryGetCrosschainFlagsRequest{}
- res, err := queryClient.PermissionFlags(context.Background(), params)
+ res, err := queryClient.CrosschainFlags(context.Background(), params)
if err != nil {
return err
}
diff --git a/x/observer/client/cli/tx.go b/x/observer/client/cli/tx.go
index 55d77e3379..5b94a365a7 100644
--- a/x/observer/client/cli/tx.go
+++ b/x/observer/client/cli/tx.go
@@ -21,10 +21,9 @@ func GetTxCmd() *cobra.Command {
}
cmd.AddCommand(
- //CmdSetSupportedChains(),
CmdAddObserver(),
CmdUpdateCoreParams(),
- CmdUpdatePermissionFlags(),
+ CmdUpdateCrosschainFlags(),
CmdUpdateKeygen(),
CmdAddBlameVote(),
CmdEncode(),
diff --git a/x/observer/client/cli/tx_permission_flags.go b/x/observer/client/cli/tx_permission_flags.go
index 1d38489ef7..bad44f32af 100644
--- a/x/observer/client/cli/tx_permission_flags.go
+++ b/x/observer/client/cli/tx_permission_flags.go
@@ -10,10 +10,10 @@ import (
"github.com/zeta-chain/zetacore/x/observer/types"
)
-func CmdUpdatePermissionFlags() *cobra.Command {
+func CmdUpdateCrosschainFlags() *cobra.Command {
cmd := &cobra.Command{
- Use: "update-permission-flags [is-inbound-enabled] [is-outbound-enabled]",
- Short: "Update PermissionFlags",
+ Use: "update-crosschain-flags [is-inbound-enabled] [is-outbound-enabled]",
+ Short: "Update crosschain flags",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) (err error) {
@@ -29,7 +29,7 @@ func CmdUpdatePermissionFlags() *cobra.Command {
if err != nil {
return err
}
- msg := types.NewMsgUpdatePermissionFlags(clientCtx.GetFromAddress().String(), argIsInboundEnabled, arsIsOutboundEnabled)
+ msg := types.NewMsgUpdateCrosschainFlags(clientCtx.GetFromAddress().String(), argIsInboundEnabled, arsIsOutboundEnabled)
if err := msg.ValidateBasic(); err != nil {
return err
}
diff --git a/x/observer/client/querytests/permission_flags.go b/x/observer/client/querytests/crosschain_flags.go
similarity index 74%
rename from x/observer/client/querytests/permission_flags.go
rename to x/observer/client/querytests/crosschain_flags.go
index 8d29273b0d..6fecb17899 100644
--- a/x/observer/client/querytests/permission_flags.go
+++ b/x/observer/client/querytests/crosschain_flags.go
@@ -11,9 +11,9 @@ import (
"google.golang.org/grpc/status"
)
-func (s *CliTestSuite) TestShowPermissionFlags() {
+func (s *CliTestSuite) TestShowCrosschainFlags() {
ctx := s.network.Validators[0].ClientCtx
- obj := s.observerState.PermissionFlags
+ obj := s.observerState.CrosschainFlags
common := []string{
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
}
@@ -21,7 +21,7 @@ func (s *CliTestSuite) TestShowPermissionFlags() {
desc string
args []string
err error
- obj *types.PermissionFlags
+ obj *types.CrosschainFlags
}{
{
desc: "get",
@@ -32,19 +32,19 @@ func (s *CliTestSuite) TestShowPermissionFlags() {
s.Run(tc.desc, func() {
var args []string
args = append(args, tc.args...)
- out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowPermissionFlags(), args)
+ out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowCrosschainFlags(), args)
if tc.err != nil {
stat, ok := status.FromError(tc.err)
s.Require().True(ok)
s.Require().ErrorIs(stat.Err(), tc.err)
} else {
s.Require().NoError(err)
- var resp types.QueryGetPermissionFlagsResponse
+ var resp types.QueryGetCrosschainFlagsResponse
s.Require().NoError(s.network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
- s.Require().NotNil(resp.PermissionFlags)
+ s.Require().NotNil(resp.CrosschainFlags)
tc := tc
s.Require().Equal(nullify.Fill(&tc.obj),
- nullify.Fill(&resp.PermissionFlags),
+ nullify.Fill(&resp.CrosschainFlags),
)
}
})
diff --git a/x/observer/genesis.go b/x/observer/genesis.go
index 92f0f63ab9..8c00a1bd4b 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 {
@@ -34,10 +39,10 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState)
k.SetParams(ctx, params)
// Set if defined
- if genState.PermissionFlags != nil {
- k.SetPermissionFlags(ctx, *genState.PermissionFlags)
+ if genState.CrosschainFlags != nil {
+ k.SetCrosschainFlags(ctx, *genState.CrosschainFlags)
} else {
- k.SetPermissionFlags(ctx, types.PermissionFlags{IsInboundEnabled: true, IsOutboundEnabled: true})
+ k.SetCrosschainFlags(ctx, *types.DefaultCrosschainFlags())
}
// Set if defined
@@ -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))
@@ -81,11 +91,11 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
nodeAccounts[i] = &elem
}
- // Get all permissionFlags
- pf := types.PermissionFlags{IsInboundEnabled: true}
- permissionFlags, found := k.GetPermissionFlags(ctx)
+ // Get all crosschain flags
+ cf := types.DefaultCrosschainFlags()
+ crosschainFlags, found := k.GetCrosschainFlags(ctx)
if found {
- pf = permissionFlags
+ cf = &crosschainFlags
}
kn := &types.Keygen{}
@@ -103,9 +113,10 @@ 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,
+ CrosschainFlags: cf,
Keygen: kn,
LastObserverCount: oc,
}
diff --git a/x/observer/genesis_test.go b/x/observer/genesis_test.go
index 4da10aac81..6919685a52 100644
--- a/x/observer/genesis_test.go
+++ b/x/observer/genesis_test.go
@@ -31,9 +31,10 @@ func TestGenesis(t *testing.T) {
sample.NodeAccount(),
sample.NodeAccount(),
},
- PermissionFlags: sample.PermissionFlags(),
+ CrosschainFlags: sample.CrosschainFlags(),
Keygen: sample.Keygen(t),
LastObserverCount: sample.LastObserverCount(1000),
+ CoreParamsList: sample.CoreParamsList(),
}
// Init and export
diff --git a/x/observer/keeper/block_header.go b/x/observer/keeper/block_header.go
new file mode 100644
index 0000000000..6bd64b34e4
--- /dev/null
+++ b/x/observer/keeper/block_header.go
@@ -0,0 +1,78 @@
+package keeper
+
+import (
+ "context"
+
+ "github.com/cosmos/cosmos-sdk/store/prefix"
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ "github.com/cosmos/cosmos-sdk/types/query"
+ "github.com/zeta-chain/zetacore/common"
+ "github.com/zeta-chain/zetacore/x/observer/types"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/status"
+)
+
+// SetBlockHeader set a specific block header in the store from its index
+func (k Keeper) SetBlockHeader(ctx sdk.Context, header common.BlockHeader) {
+ store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeaderKey))
+ b := k.cdc.MustMarshal(&header)
+ store.Set(header.Hash, b)
+}
+
+// GetBlockHeader returns a block header from its hash
+func (k Keeper) GetBlockHeader(ctx sdk.Context, hash []byte) (val common.BlockHeader, found bool) {
+ store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeaderKey))
+
+ b := store.Get(hash)
+ if b == nil {
+ return val, false
+ }
+
+ k.cdc.MustUnmarshal(b, &val)
+ return val, true
+}
+
+// RemoveBlockHeader removes a block header from the store
+func (k Keeper) RemoveBlockHeader(ctx sdk.Context, hash []byte) {
+ store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeaderKey))
+ store.Delete(hash)
+}
+
+// GetAllBlockHeaders queries all for block header
+func (k Keeper) GetAllBlockHeaders(c context.Context, req *types.QueryAllBlockHeaderRequest) (*types.QueryAllBlockHeaderResponse, error) {
+ if req == nil {
+ return nil, status.Error(codes.InvalidArgument, "invalid request")
+ }
+ ctx := sdk.UnwrapSDKContext(c)
+ store := ctx.KVStore(k.storeKey)
+ blockHeaderStore := prefix.NewStore(store, types.KeyPrefix(types.BlockHeaderKey))
+
+ var blockHeaders []*common.BlockHeader
+ pageRes, err := query.Paginate(blockHeaderStore, req.Pagination, func(key []byte, value []byte) error {
+ var blockHeader common.BlockHeader
+ if err := k.cdc.Unmarshal(value, &blockHeader); err != nil {
+ return err
+ }
+
+ blockHeaders = append(blockHeaders, &blockHeader)
+ return nil
+ })
+ if err != nil {
+ return nil, status.Error(codes.Internal, err.Error())
+ }
+ return &types.QueryAllBlockHeaderResponse{BlockHeaders: blockHeaders, Pagination: pageRes}, nil
+}
+
+// GetBlockHeaderByHash queries block header by hash
+func (k Keeper) GetBlockHeaderByHash(c context.Context, req *types.QueryGetBlockHeaderByHashRequest) (*types.QueryGetBlockHeaderByHashResponse, error) {
+ if req == nil {
+ return nil, status.Error(codes.InvalidArgument, "invalid request")
+ }
+
+ header, found := k.GetBlockHeader(sdk.UnwrapSDKContext(c), req.BlockHash)
+ if !found {
+ return nil, status.Error(codes.NotFound, "not found")
+ }
+
+ return &types.QueryGetBlockHeaderByHashResponse{BlockHeader: &header}, nil
+}
diff --git a/x/observer/keeper/permission_flags.go b/x/observer/keeper/crosschain_flags.go
similarity index 52%
rename from x/observer/keeper/permission_flags.go
rename to x/observer/keeper/crosschain_flags.go
index b007e76919..2a58604627 100644
--- a/x/observer/keeper/permission_flags.go
+++ b/x/observer/keeper/crosschain_flags.go
@@ -6,16 +6,16 @@ import (
"github.com/zeta-chain/zetacore/x/observer/types"
)
-// SetPermissionFlags set permissionFlags in the store
-func (k Keeper) SetPermissionFlags(ctx sdk.Context, permissionFlags types.PermissionFlags) {
- store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PermissionFlagsKey))
- b := k.cdc.MustMarshal(&permissionFlags)
+// SetCrosschainFlags set the crosschain flags in the store
+func (k Keeper) SetCrosschainFlags(ctx sdk.Context, crosschainFlags types.CrosschainFlags) {
+ store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CrosschainFlagsKey))
+ b := k.cdc.MustMarshal(&crosschainFlags)
store.Set([]byte{0}, b)
}
-// GetPermissionFlags returns permissionFlags
-func (k Keeper) GetPermissionFlags(ctx sdk.Context) (val types.PermissionFlags, found bool) {
- store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PermissionFlagsKey))
+// GetCrosschainFlags returns the crosschain flags
+func (k Keeper) GetCrosschainFlags(ctx sdk.Context) (val types.CrosschainFlags, found bool) {
+ store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CrosschainFlagsKey))
b := store.Get([]byte{0})
if b == nil {
@@ -27,32 +27,32 @@ func (k Keeper) GetPermissionFlags(ctx sdk.Context) (val types.PermissionFlags,
}
func (k Keeper) IsInboundEnabled(ctx sdk.Context) (found bool) {
- flags, found := k.GetPermissionFlags(ctx)
+ flags, found := k.GetCrosschainFlags(ctx)
if !found {
return false
}
return flags.IsInboundEnabled
}
-func (k Keeper) IsOutboundAllowed(ctx sdk.Context) (found bool) {
- flags, found := k.GetPermissionFlags(ctx)
+func (k Keeper) IsOutboundEnabled(ctx sdk.Context) (found bool) {
+ flags, found := k.GetCrosschainFlags(ctx)
if !found {
return false
}
return flags.IsOutboundEnabled
}
-// RemovePermissionFlags removes permissionFlags from the store
-func (k Keeper) RemovePermissionFlags(ctx sdk.Context) {
- store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PermissionFlagsKey))
+// RemoveCrosschainFlags removes crosschain flags from the store
+func (k Keeper) RemoveCrosschainFlags(ctx sdk.Context) {
+ store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CrosschainFlagsKey))
store.Delete([]byte{0})
}
func (k Keeper) DisableInboundOnly(ctx sdk.Context) {
- flags, found := k.GetPermissionFlags(ctx)
+ flags, found := k.GetCrosschainFlags(ctx)
if !found {
flags.IsOutboundEnabled = true
}
flags.IsInboundEnabled = false
- k.SetPermissionFlags(ctx, flags)
+ k.SetCrosschainFlags(ctx, flags)
}
diff --git a/x/observer/keeper/grpc_query_permission_flags.go b/x/observer/keeper/grpc_query_crosschain_flags.go
similarity index 64%
rename from x/observer/keeper/grpc_query_permission_flags.go
rename to x/observer/keeper/grpc_query_crosschain_flags.go
index c3d48a2905..9444ec6a3f 100644
--- a/x/observer/keeper/grpc_query_permission_flags.go
+++ b/x/observer/keeper/grpc_query_crosschain_flags.go
@@ -9,16 +9,16 @@ import (
"google.golang.org/grpc/status"
)
-func (k Keeper) PermissionFlags(c context.Context, req *types.QueryGetPermissionFlagsRequest) (*types.QueryGetPermissionFlagsResponse, error) {
+func (k Keeper) CrosschainFlags(c context.Context, req *types.QueryGetCrosschainFlagsRequest) (*types.QueryGetCrosschainFlagsResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(c)
- val, found := k.GetPermissionFlags(ctx)
+ val, found := k.GetCrosschainFlags(ctx)
if !found {
return nil, status.Error(codes.NotFound, "not found")
}
- return &types.QueryGetPermissionFlagsResponse{PermissionFlags: val}, nil
+ return &types.QueryGetCrosschainFlagsResponse{CrosschainFlags: val}, nil
}
diff --git a/x/observer/keeper/grpc_query_prove.go b/x/observer/keeper/grpc_query_prove.go
new file mode 100644
index 0000000000..e4880f4c2e
--- /dev/null
+++ b/x/observer/keeper/grpc_query_prove.go
@@ -0,0 +1,47 @@
+package keeper
+
+import (
+ "context"
+ "fmt"
+
+ "github.com/zeta-chain/zetacore/common"
+
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ eth "github.com/ethereum/go-ethereum/common"
+ ethtypes "github.com/ethereum/go-ethereum/core/types"
+ "github.com/zeta-chain/zetacore/x/observer/types"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/status"
+)
+
+func (k Keeper) Prove(c context.Context, req *types.QueryProveRequest) (*types.QueryProveResponse, error) {
+ if req == nil {
+ return nil, status.Error(codes.InvalidArgument, "invalid request")
+ }
+ ctx := sdk.UnwrapSDKContext(c)
+
+ blockHash := eth.HexToHash(req.BlockHash)
+ res, found := k.GetBlockHeader(ctx, blockHash.Bytes())
+ if !found {
+ return nil, status.Error(codes.NotFound, "block header not found")
+ }
+
+ proven := false
+
+ val, err := req.Proof.Verify(res.Header, int(req.TxIndex))
+ if err != nil && !common.IsErrorInvalidProof(err) {
+ return nil, status.Error(codes.Internal, err.Error())
+ }
+ if err == nil {
+ var txx ethtypes.Transaction
+ err = txx.UnmarshalBinary(val)
+ if err != nil {
+ return nil, status.Error(codes.Internal, fmt.Sprintf("failed to unmarshal transaction: %s", err))
+ }
+ proven = true
+ }
+
+ return &types.QueryProveResponse{
+ Valid: proven,
+ }, nil
+}
diff --git a/x/observer/keeper/keeper.go b/x/observer/keeper/keeper.go
index 67526ecbfc..10c8c9e21f 100644
--- a/x/observer/keeper/keeper.go
+++ b/x/observer/keeper/keeper.go
@@ -36,7 +36,6 @@ func NewKeeper(
}
return &Keeper{
-
cdc: cdc,
storeKey: storeKey,
memKey: memKey,
diff --git a/x/observer/keeper/keeper_utils.go b/x/observer/keeper/keeper_utils.go
index f654a97b33..e36cd8e934 100644
--- a/x/observer/keeper/keeper_utils.go
+++ b/x/observer/keeper/keeper_utils.go
@@ -89,7 +89,10 @@ func (k Keeper) IsValidator(ctx sdk.Context, creator string) error {
}
func (k Keeper) CheckObserverDelegation(ctx sdk.Context, accAddress string, chain *common.Chain) error {
- selfdelAddr, _ := sdk.AccAddressFromBech32(accAddress)
+ selfdelAddr, err := sdk.AccAddressFromBech32(accAddress)
+ if err != nil {
+ return err
+ }
valAddress, err := types.GetOperatorAddressFromAccAddress(accAddress)
if err != nil {
return err
diff --git a/x/observer/keeper/migrator.go b/x/observer/keeper/migrator.go
index 4af2f09020..daed1e08f8 100644
--- a/x/observer/keeper/migrator.go
+++ b/x/observer/keeper/migrator.go
@@ -3,6 +3,7 @@ package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
v2 "github.com/zeta-chain/zetacore/x/observer/migrations/v2"
+ v3 "github.com/zeta-chain/zetacore/x/observer/migrations/v3"
)
// Migrator is a struct for handling in-place store migrations.
@@ -21,3 +22,8 @@ func NewMigrator(keeper Keeper) Migrator {
func (m Migrator) Migrate1to2(ctx sdk.Context) error {
return v2.MigrateStore(ctx, m.observerKeeper.storeKey, m.observerKeeper.cdc)
}
+
+// Migrate2to3 migrates the store from consensus version 2 to 3
+func (m Migrator) Migrate2to3(ctx sdk.Context) error {
+ return v3.MigrateStore(ctx, m.observerKeeper)
+}
diff --git a/x/observer/keeper/msg_server_add_block_header.go b/x/observer/keeper/msg_server_add_block_header.go
new file mode 100644
index 0000000000..8ee4ffa5cd
--- /dev/null
+++ b/x/observer/keeper/msg_server_add_block_header.go
@@ -0,0 +1,65 @@
+package keeper
+
+import (
+ "context"
+ "encoding/hex"
+
+ cosmoserrors "cosmossdk.io/errors"
+
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ "github.com/zeta-chain/zetacore/common"
+ "github.com/zeta-chain/zetacore/x/observer/types"
+)
+
+// AddBlockHeader handles adding a block header to the store, through majority voting of observers
+func (k msgServer) AddBlockHeader(goCtx context.Context, msg *types.MsgAddBlockHeader) (*types.MsgAddBlockHeaderResponse, error) {
+ ctx := sdk.UnwrapSDKContext(goCtx)
+
+ // check authorization for this chain
+ chain := common.GetChainFromChainID(msg.ChainId)
+ ok, err := k.IsAuthorized(ctx, msg.Creator, chain)
+ if !ok {
+ return nil, cosmoserrors.Wrap(types.ErrNotAuthorizedPolicy, err.Error())
+ }
+
+ // add vote to ballot
+ ballot, _, err := k.FindBallot(ctx, msg.Digest(), chain, types.ObservationType_InBoundTx)
+ if err != nil {
+ return nil, cosmoserrors.Wrap(err, "failed to find ballot")
+ }
+ ballot, err = k.AddVoteToBallot(ctx, ballot, msg.Creator, types.VoteType_SuccessObservation)
+ if err != nil {
+ return nil, cosmoserrors.Wrap(err, "failed to add vote to ballot")
+ }
+ _, isFinalized := k.CheckIfFinalizingVote(ctx, ballot)
+ if !isFinalized {
+ return &types.MsgAddBlockHeaderResponse{}, nil
+ }
+
+ /**
+ * Vote finalized, add block header to store
+ */
+ _, found := k.GetBlockHeader(ctx, msg.BlockHash)
+ if found {
+ return nil, cosmoserrors.Wrap(types.ErrBlockAlreadyExist, hex.EncodeToString(msg.BlockHash))
+ }
+
+ // NOTE: error is checked in BasicValidation in msg; check again for extra caution
+ pHash, err := msg.Header.ParentHash()
+ if err != nil {
+ return nil, cosmoserrors.Wrap(types.ErrNoParentHash, err.Error())
+ }
+
+ // TODO: add check for parent block header's existence here https://github.com/zeta-chain/node/issues/1133
+
+ bh := common.BlockHeader{
+ Header: msg.Header,
+ Height: msg.Height,
+ Hash: msg.BlockHash,
+ ParentHash: pHash,
+ ChainId: msg.ChainId,
+ }
+ k.SetBlockHeader(ctx, bh)
+
+ return &types.MsgAddBlockHeaderResponse{}, nil
+}
diff --git a/x/observer/keeper/msg_server_permission_flags.go b/x/observer/keeper/msg_server_permission_flags.go
deleted file mode 100644
index 6c506ad955..0000000000
--- a/x/observer/keeper/msg_server_permission_flags.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package keeper
-
-import (
- "context"
-
- sdk "github.com/cosmos/cosmos-sdk/types"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
- "github.com/zeta-chain/zetacore/x/observer/types"
-)
-
-// Updates permissions. Currently, this is only used to enable/disable the
-// inbound transactions.
-//
-// Only the admin policy account is authorized to broadcast this message.
-func (k msgServer) UpdatePermissionFlags(goCtx context.Context, msg *types.MsgUpdatePermissionFlags) (*types.MsgUpdatePermissionFlagsResponse, error) {
- ctx := sdk.UnwrapSDKContext(goCtx)
- if msg.Creator != k.GetParams(ctx).GetAdminPolicyAccount(types.Policy_Type_stop_inbound_cctx) {
- return &types.MsgUpdatePermissionFlagsResponse{}, types.ErrNotAuthorizedPolicy
- }
- // Check if the value exists
- flags, isFound := k.GetPermissionFlags(ctx)
- if !isFound {
- return nil, sdkerrors.Wrap(sdkerrors.ErrKeyNotFound, "not set")
- }
- flags.IsInboundEnabled = msg.IsInboundEnabled
- flags.IsOutboundEnabled = msg.IsOutboundEnabled
- k.SetPermissionFlags(ctx, flags)
-
- return &types.MsgUpdatePermissionFlagsResponse{}, nil
-}
diff --git a/x/observer/keeper/msg_server_update_core_params.go b/x/observer/keeper/msg_server_update_core_params.go
index efece06a53..87fbbc9606 100644
--- a/x/observer/keeper/msg_server_update_core_params.go
+++ b/x/observer/keeper/msg_server_update_core_params.go
@@ -7,7 +7,7 @@ import (
"github.com/zeta-chain/zetacore/x/observer/types"
)
-// Updates core parameters for a specific chain. Core parameters include
+// UpdateCoreParams updates core parameters for a specific chain. Core parameters include
// confirmation count, outbound transaction schedule interval, ZETA token,
// connector and ERC20 custody contract addresses, etc.
//
@@ -16,7 +16,7 @@ import (
// Only the admin policy account is authorized to broadcast this message.
func (k msgServer) UpdateCoreParams(goCtx context.Context, msg *types.MsgUpdateCoreParams) (*types.MsgUpdateCoreParamsResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
- if msg.Creator != k.GetParams(ctx).GetAdminPolicyAccount(types.Policy_Type_update_client_params) {
+ if msg.Creator != k.GetParams(ctx).GetAdminPolicyAccount(types.Policy_Type_group2) {
return &types.MsgUpdateCoreParamsResponse{}, types.ErrNotAuthorizedPolicy
}
if !k.GetParams(ctx).IsChainIDSupported(msg.CoreParams.ChainId) {
diff --git a/x/observer/keeper/msg_server_update_crosschain_flags.go b/x/observer/keeper/msg_server_update_crosschain_flags.go
new file mode 100644
index 0000000000..57d4478163
--- /dev/null
+++ b/x/observer/keeper/msg_server_update_crosschain_flags.go
@@ -0,0 +1,53 @@
+package keeper
+
+import (
+ "context"
+
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ "github.com/zeta-chain/zetacore/x/observer/types"
+)
+
+// UpdateCrosschainFlags updates the crosschain related flags.
+// Only the admin policy account is authorized to broadcast this message.
+func (k msgServer) UpdateCrosschainFlags(goCtx context.Context, msg *types.MsgUpdateCrosschainFlags) (*types.MsgUpdateCrosschainFlagsResponse, error) {
+ ctx := sdk.UnwrapSDKContext(goCtx)
+
+ requiredGroup := types.Policy_Type_group1
+ if msg.IsInboundEnabled || msg.IsOutboundEnabled || msg.GasPriceIncreaseFlags != nil {
+ requiredGroup = types.Policy_Type_group2
+ }
+
+ // check permission
+ if msg.Creator != k.GetParams(ctx).GetAdminPolicyAccount(requiredGroup) {
+ return &types.MsgUpdateCrosschainFlagsResponse{}, types.ErrNotAuthorizedPolicy
+ }
+
+ // check if the value exists
+ flags, isFound := k.GetCrosschainFlags(ctx)
+ if !isFound {
+ flags = *types.DefaultCrosschainFlags()
+ }
+
+ // update values
+ flags.IsInboundEnabled = msg.IsInboundEnabled
+ flags.IsOutboundEnabled = msg.IsOutboundEnabled
+
+ if msg.GasPriceIncreaseFlags != nil {
+ flags.GasPriceIncreaseFlags = msg.GasPriceIncreaseFlags
+ }
+
+ k.SetCrosschainFlags(ctx, flags)
+
+ err := ctx.EventManager().EmitTypedEvents(&types.EventCrosschainFlagsUpdated{
+ MsgTypeUrl: sdk.MsgTypeURL(&types.MsgUpdateCrosschainFlags{}),
+ IsInboundEnabled: msg.IsInboundEnabled,
+ IsOutboundEnabled: msg.IsOutboundEnabled,
+ GasPriceIncreaseFlags: msg.GasPriceIncreaseFlags,
+ Signer: msg.Creator,
+ })
+ if err != nil {
+ ctx.Logger().Error("Error emitting EventCrosschainFlagsUpdated :", err)
+ }
+
+ return &types.MsgUpdateCrosschainFlagsResponse{}, nil
+}
diff --git a/x/observer/keeper/msg_server_update_crosschain_flags_test.go b/x/observer/keeper/msg_server_update_crosschain_flags_test.go
new file mode 100644
index 0000000000..73c8a4d9de
--- /dev/null
+++ b/x/observer/keeper/msg_server_update_crosschain_flags_test.go
@@ -0,0 +1,143 @@
+package keeper_test
+
+import (
+ "testing"
+ "time"
+
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ "github.com/stretchr/testify/require"
+ keepertest "github.com/zeta-chain/zetacore/testutil/keeper"
+ "github.com/zeta-chain/zetacore/testutil/sample"
+ "github.com/zeta-chain/zetacore/x/observer/keeper"
+ "github.com/zeta-chain/zetacore/x/observer/types"
+ observertypes "github.com/zeta-chain/zetacore/x/observer/types"
+)
+
+func setAdminCrossChainFlags(ctx sdk.Context, k *keeper.Keeper, admin string, group types.Policy_Type) {
+ k.SetParams(ctx, observertypes.Params{
+ AdminPolicy: []*observertypes.Admin_Policy{
+ {
+ PolicyType: group,
+ Address: admin,
+ },
+ },
+ })
+}
+
+func TestMsgServer_UpdateCrosschainFlags(t *testing.T) {
+ t.Run("can update crosschain flags", func(t *testing.T) {
+ k, ctx := keepertest.ObserverKeeper(t)
+ srv := keeper.NewMsgServerImpl(*k)
+ admin := sample.AccAddress()
+
+ setAdminCrossChainFlags(ctx, k, admin, types.Policy_Type_group2)
+
+ _, err := srv.UpdateCrosschainFlags(sdk.WrapSDKContext(ctx), &types.MsgUpdateCrosschainFlags{
+ Creator: admin,
+ IsInboundEnabled: false,
+ IsOutboundEnabled: false,
+ GasPriceIncreaseFlags: &types.GasPriceIncreaseFlags{
+ EpochLength: 42,
+ RetryInterval: time.Minute * 42,
+ GasPriceIncreasePercent: 42,
+ },
+ })
+ require.NoError(t, err)
+
+ flags, found := k.GetCrosschainFlags(ctx)
+ require.True(t, found)
+ require.False(t, flags.IsInboundEnabled)
+ require.False(t, flags.IsOutboundEnabled)
+ require.Equal(t, int64(42), flags.GasPriceIncreaseFlags.EpochLength)
+ require.Equal(t, time.Minute*42, flags.GasPriceIncreaseFlags.RetryInterval)
+ require.Equal(t, uint32(42), flags.GasPriceIncreaseFlags.GasPriceIncreasePercent)
+
+ setAdminCrossChainFlags(ctx, k, admin, types.Policy_Type_group2)
+
+ // can update flags again
+ _, err = srv.UpdateCrosschainFlags(sdk.WrapSDKContext(ctx), &types.MsgUpdateCrosschainFlags{
+ Creator: admin,
+ IsInboundEnabled: true,
+ IsOutboundEnabled: true,
+ GasPriceIncreaseFlags: &types.GasPriceIncreaseFlags{
+ EpochLength: 43,
+ RetryInterval: time.Minute * 43,
+ GasPriceIncreasePercent: 43,
+ },
+ })
+ require.NoError(t, err)
+
+ flags, found = k.GetCrosschainFlags(ctx)
+ require.True(t, found)
+ require.True(t, flags.IsInboundEnabled)
+ require.True(t, flags.IsOutboundEnabled)
+ require.Equal(t, int64(43), flags.GasPriceIncreaseFlags.EpochLength)
+ require.Equal(t, time.Minute*43, flags.GasPriceIncreaseFlags.RetryInterval)
+ require.Equal(t, uint32(43), flags.GasPriceIncreaseFlags.GasPriceIncreasePercent)
+
+ // group 1 should be able to disable inbound and outbound
+ setAdminCrossChainFlags(ctx, k, admin, types.Policy_Type_group1)
+
+ // if gas price increase flags is nil, it should not be updated
+ _, err = srv.UpdateCrosschainFlags(sdk.WrapSDKContext(ctx), &types.MsgUpdateCrosschainFlags{
+ Creator: admin,
+ IsInboundEnabled: false,
+ IsOutboundEnabled: false,
+ })
+ require.NoError(t, err)
+
+ flags, found = k.GetCrosschainFlags(ctx)
+ require.True(t, found)
+ require.False(t, flags.IsInboundEnabled)
+ require.False(t, flags.IsOutboundEnabled)
+ require.Equal(t, int64(43), flags.GasPriceIncreaseFlags.EpochLength)
+ require.Equal(t, time.Minute*43, flags.GasPriceIncreaseFlags.RetryInterval)
+ require.Equal(t, uint32(43), flags.GasPriceIncreaseFlags.GasPriceIncreasePercent)
+
+ // if flags are not defined, default should be used
+ k.RemoveCrosschainFlags(ctx)
+ _, found = k.GetCrosschainFlags(ctx)
+ require.False(t, found)
+
+ setAdminCrossChainFlags(ctx, k, admin, types.Policy_Type_group2)
+
+ _, err = srv.UpdateCrosschainFlags(sdk.WrapSDKContext(ctx), &types.MsgUpdateCrosschainFlags{
+ Creator: admin,
+ IsInboundEnabled: false,
+ IsOutboundEnabled: true,
+ })
+ require.NoError(t, err)
+
+ flags, found = k.GetCrosschainFlags(ctx)
+ require.True(t, found)
+ require.False(t, flags.IsInboundEnabled)
+ require.True(t, flags.IsOutboundEnabled)
+ require.Equal(t, types.DefaultGasPriceIncreaseFlags.EpochLength, flags.GasPriceIncreaseFlags.EpochLength)
+ require.Equal(t, types.DefaultGasPriceIncreaseFlags.RetryInterval, flags.GasPriceIncreaseFlags.RetryInterval)
+ require.Equal(t, types.DefaultGasPriceIncreaseFlags.GasPriceIncreasePercent, flags.GasPriceIncreaseFlags.GasPriceIncreasePercent)
+ })
+
+ t.Run("cannot update crosschain flags if not authorized", func(t *testing.T) {
+ k, ctx := keepertest.ObserverKeeper(t)
+ srv := keeper.NewMsgServerImpl(*k)
+
+ _, err := srv.UpdateCrosschainFlags(sdk.WrapSDKContext(ctx), &types.MsgUpdateCrosschainFlags{
+ Creator: sample.AccAddress(),
+ IsInboundEnabled: false,
+ IsOutboundEnabled: false,
+ })
+ require.Error(t, err)
+ require.Equal(t, types.ErrNotAuthorizedPolicy, err)
+
+ admin := sample.AccAddress()
+ setAdminCrossChainFlags(ctx, k, admin, types.Policy_Type_group1)
+
+ _, err = srv.UpdateCrosschainFlags(sdk.WrapSDKContext(ctx), &types.MsgUpdateCrosschainFlags{
+ Creator: admin,
+ IsInboundEnabled: false,
+ IsOutboundEnabled: true,
+ })
+ require.Error(t, err)
+ require.Equal(t, types.ErrNotAuthorizedPolicy, err)
+ })
+}
diff --git a/x/observer/keeper/msg_server_update_keygen.go b/x/observer/keeper/msg_server_update_keygen.go
index a4280a07cc..17c66e82c4 100644
--- a/x/observer/keeper/msg_server_update_keygen.go
+++ b/x/observer/keeper/msg_server_update_keygen.go
@@ -7,14 +7,13 @@ import (
"github.com/zeta-chain/zetacore/x/observer/types"
)
-// Updates the block height of the keygen and sets the status to "pending
-// keygen".
+// UpdateKeygen updates the block height of the keygen and sets the status to "pending keygen".
//
// Only the admin policy account is authorized to broadcast this message.
func (k msgServer) UpdateKeygen(goCtx context.Context, msg *types.MsgUpdateKeygen) (*types.MsgUpdateKeygenResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
- if msg.Creator != k.GetParams(ctx).GetAdminPolicyAccount(types.Policy_Type_update_keygen_block) {
+ if msg.Creator != k.GetParams(ctx).GetAdminPolicyAccount(types.Policy_Type_group1) {
return &types.MsgUpdateKeygenResponse{}, types.ErrNotAuthorizedPolicy
}
keygen, found := k.GetKeygen(ctx)
diff --git a/x/observer/keeper/observer_mapper.go b/x/observer/keeper/observer_mapper.go
index dcf63c11df..e3c2e58d06 100644
--- a/x/observer/keeper/observer_mapper.go
+++ b/x/observer/keeper/observer_mapper.go
@@ -5,8 +5,11 @@ import (
"fmt"
"math"
+ cosmoserrors "cosmossdk.io/errors"
+
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
+ sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/zeta-chain/zetacore/common"
"github.com/zeta-chain/zetacore/x/observer/types"
"google.golang.org/grpc/codes"
@@ -90,11 +93,17 @@ func (k Keeper) GetAllObserverMappersForAddress(ctx sdk.Context, address string)
// Once added, the function also resets keygen and pauses inbound so that a new TSS can be generated.
func (k msgServer) AddObserver(goCtx context.Context, msg *types.MsgAddObserver) (*types.MsgAddObserverResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
- if msg.Creator != k.GetParams(ctx).GetAdminPolicyAccount(types.Policy_Type_add_observer) {
+ if msg.Creator != k.GetParams(ctx).GetAdminPolicyAccount(types.Policy_Type_group2) {
return &types.MsgAddObserverResponse{}, types.ErrNotAuthorizedPolicy
}
- pubkey, _ := common.NewPubKey(msg.ZetaclientGranteePubkey)
- granteeAddress, _ := common.GetAddressFromPubkeyString(msg.ZetaclientGranteePubkey)
+ pubkey, err := common.NewPubKey(msg.ZetaclientGranteePubkey)
+ if err != nil {
+ return &types.MsgAddObserverResponse{}, cosmoserrors.Wrap(sdkerrors.ErrInvalidPubKey, err.Error())
+ }
+ granteeAddress, err := common.GetAddressFromPubkeyString(msg.ZetaclientGranteePubkey)
+ if err != nil {
+ return &types.MsgAddObserverResponse{}, cosmoserrors.Wrap(sdkerrors.ErrInvalidPubKey, err.Error())
+ }
k.DisableInboundOnly(ctx)
// AddNodeAccountOnly flag usage
// True: adds observer into the Node Account list but returns without adding to the observer list
diff --git a/x/observer/migrations/v2/migrate.go b/x/observer/migrations/v2/migrate.go
index c01d2e1f96..65027291d2 100644
--- a/x/observer/migrations/v2/migrate.go
+++ b/x/observer/migrations/v2/migrate.go
@@ -17,8 +17,8 @@ func MigrateStore(
observerStoreKey storetypes.StoreKey,
cdc codec.BinaryCodec,
) error {
- store := prefix.NewStore(ctx.KVStore(observerStoreKey), types.KeyPrefix(types.PermissionFlagsKey))
- b := cdc.MustMarshal(&types.PermissionFlags{
+ store := prefix.NewStore(ctx.KVStore(observerStoreKey), types.KeyPrefix(types.CrosschainFlagsKey))
+ b := cdc.MustMarshal(&types.CrosschainFlags{
IsInboundEnabled: true,
IsOutboundEnabled: true,
})
diff --git a/x/observer/migrations/v3/migrate.go b/x/observer/migrations/v3/migrate.go
new file mode 100644
index 0000000000..875ccc80fe
--- /dev/null
+++ b/x/observer/migrations/v3/migrate.go
@@ -0,0 +1,36 @@
+package v3
+
+import (
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ "github.com/zeta-chain/zetacore/x/observer/types"
+)
+
+type ObserverKeeper interface {
+ GetParamsIsExists(ctx sdk.Context) types.Params
+ SetParams(ctx sdk.Context, params types.Params)
+}
+
+// MigrateStore migrates the x/observer module state from the consensus version 2 to 3
+// This migration update the policy group
+func MigrateStore(ctx sdk.Context, k ObserverKeeper) error {
+ // Get first admin policy group
+ p := k.GetParamsIsExists(ctx)
+ if len(p.AdminPolicy) == 0 || p.AdminPolicy[0] == nil {
+ return nil
+ }
+
+ admin := p.AdminPolicy[0].Address
+ p.AdminPolicy = []*types.Admin_Policy{
+ {
+ Address: admin,
+ PolicyType: types.Policy_Type_group1,
+ },
+ {
+ Address: admin,
+ PolicyType: types.Policy_Type_group2,
+ },
+ }
+ k.SetParams(ctx, p)
+
+ return nil
+}
diff --git a/x/observer/migrations/v3/migrate_test.go b/x/observer/migrations/v3/migrate_test.go
new file mode 100644
index 0000000000..604fd0a9c7
--- /dev/null
+++ b/x/observer/migrations/v3/migrate_test.go
@@ -0,0 +1,51 @@
+package v3_test
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/require"
+ keepertest "github.com/zeta-chain/zetacore/testutil/keeper"
+ "github.com/zeta-chain/zetacore/testutil/sample"
+ v3 "github.com/zeta-chain/zetacore/x/observer/migrations/v3"
+ "github.com/zeta-chain/zetacore/x/observer/types"
+)
+
+func TestMigrateStore(t *testing.T) {
+ k, ctx := keepertest.ObserverKeeper(t)
+
+ // nothing if no admin policy
+ params := types.DefaultParams()
+ params.AdminPolicy = []*types.Admin_Policy{}
+ k.SetParams(ctx, params)
+ err := v3.MigrateStore(ctx, k)
+ require.NoError(t, err)
+ params = k.GetParams(ctx)
+ require.Len(t, params.AdminPolicy, 0)
+
+ // update admin policy
+ admin := sample.AccAddress()
+ params = types.DefaultParams()
+ params.AdminPolicy = []*types.Admin_Policy{
+ {
+ Address: admin,
+ PolicyType: 0,
+ },
+ {
+ Address: sample.AccAddress(),
+ PolicyType: 5,
+ },
+ {
+ Address: admin,
+ PolicyType: 10,
+ },
+ }
+ k.SetParams(ctx, params)
+ err = v3.MigrateStore(ctx, k)
+ require.NoError(t, err)
+ params = k.GetParams(ctx)
+ require.Len(t, params.AdminPolicy, 2)
+ require.Equal(t, params.AdminPolicy[0].PolicyType, types.Policy_Type_group1)
+ require.Equal(t, params.AdminPolicy[1].PolicyType, types.Policy_Type_group2)
+ require.Equal(t, params.AdminPolicy[0].Address, admin)
+ require.Equal(t, params.AdminPolicy[1].Address, admin)
+}
diff --git a/x/observer/module.go b/x/observer/module.go
index d46ae22f63..1f991b978c 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
}
@@ -147,6 +147,9 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {
if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil {
panic(err)
}
+ if err := cfg.RegisterMigration(types.ModuleName, 2, m.Migrate2to3); err != nil {
+ panic(err)
+ }
}
// RegisterInvariants registers the observer module's invariants.
@@ -171,7 +174,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
}
// ConsensusVersion implements ConsensusVersion.
-func (AppModule) ConsensusVersion() uint64 { return 2 }
+func (AppModule) ConsensusVersion() uint64 { return 3 }
// BeginBlock executes all ABCI BeginBlock logic respective to the observer module.
func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {
diff --git a/x/observer/types/codec.go b/x/observer/types/codec.go
index 30bb82b86b..76e51df8af 100644
--- a/x/observer/types/codec.go
+++ b/x/observer/types/codec.go
@@ -9,14 +9,14 @@ import (
func RegisterCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgUpdateCoreParams{}, "observer/UpdateClientParams", nil)
- cdc.RegisterConcrete(&MsgUpdatePermissionFlags{}, "crosschain/UpdatePermissionFlags", nil)
+ cdc.RegisterConcrete(&MsgUpdateCrosschainFlags{}, "crosschain/UpdateCrosschainFlags", nil)
cdc.RegisterConcrete(&MsgUpdateKeygen{}, "crosschain/UpdateKeygen", nil)
}
func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgUpdateCoreParams{},
- &MsgUpdatePermissionFlags{},
+ &MsgUpdateCrosschainFlags{},
&MsgUpdateKeygen{},
)
diff --git a/x/observer/types/core_params_mainnet.go b/x/observer/types/core_params_mainnet.go
index bc56eb388f..38ab439aab 100644
--- a/x/observer/types/core_params_mainnet.go
+++ b/x/observer/types/core_params_mainnet.go
@@ -1,11 +1,72 @@
-//go:build !PRIVNET && !TESTNET
-// +build !PRIVNET,!TESTNET
+//go:build !PRIVNET && !TESTNET && !MOCK_MAINNET
+// +build !PRIVNET,!TESTNET,!MOCK_MAINNET
package types
+import (
+ "fmt"
+
+ "github.com/coinbase/rosetta-sdk-go/types"
+ "github.com/zeta-chain/zetacore/common"
+)
+
func GetCoreParams() CoreParamsList {
params := CoreParamsList{
- CoreParams: []*CoreParams{},
+ CoreParams: []*CoreParams{
+ {
+ ChainId: common.EthChain().ChainId,
+ ConfirmationCount: 14,
+ ZetaTokenContractAddress: "",
+ ConnectorContractAddress: "",
+ Erc20CustodyContractAddress: "",
+ InTxTicker: 12,
+ OutTxTicker: 15,
+ WatchUtxoTicker: 0,
+ GasPriceTicker: 30,
+ OutboundTxScheduleInterval: 30,
+ OutboundTxScheduleLookahead: 60,
+ },
+ {
+ ChainId: common.BscMainnetChain().ChainId,
+ ConfirmationCount: 14,
+ ZetaTokenContractAddress: "",
+ ConnectorContractAddress: "",
+ Erc20CustodyContractAddress: "",
+ InTxTicker: 5,
+ OutTxTicker: 15,
+ WatchUtxoTicker: 0,
+ GasPriceTicker: 30,
+ OutboundTxScheduleInterval: 30,
+ OutboundTxScheduleLookahead: 60,
+ },
+ {
+ ChainId: common.BtcMainnetChain().ChainId,
+ ConfirmationCount: 2,
+ ZetaTokenContractAddress: "",
+ ConnectorContractAddress: "",
+ Erc20CustodyContractAddress: "",
+ WatchUtxoTicker: 30,
+ InTxTicker: 120,
+ OutTxTicker: 60,
+ GasPriceTicker: 30,
+ OutboundTxScheduleInterval: 30,
+ OutboundTxScheduleLookahead: 60,
+ },
+ },
+ }
+ chainList := common.ExternalChainList()
+ requiredParams := len(chainList)
+ availableParams := 0
+ for _, chain := range chainList {
+ for _, param := range params.CoreParams {
+ if chain.ChainId == param.ChainId {
+ availableParams++
+ }
+ }
+ }
+ if availableParams != requiredParams {
+ panic(fmt.Sprintf("Core params are not available for all chains , DefaultChains : %s , CoreParams : %s",
+ types.PrettyPrintStruct(chainList), params.String()))
}
return params
}
diff --git a/x/observer/types/core_params_mock_mainnet.go b/x/observer/types/core_params_mock_mainnet.go
new file mode 100644
index 0000000000..549edc5bf7
--- /dev/null
+++ b/x/observer/types/core_params_mock_mainnet.go
@@ -0,0 +1,72 @@
+//go:build MOCK_MAINNET
+// +build MOCK_MAINNET
+
+package types
+
+import (
+ "fmt"
+
+ "github.com/coinbase/rosetta-sdk-go/types"
+ "github.com/zeta-chain/zetacore/common"
+)
+
+func GetCoreParams() CoreParamsList {
+ params := CoreParamsList{
+ CoreParams: []*CoreParams{
+ {
+ ChainId: common.EthChain().ChainId,
+ ConfirmationCount: 6,
+ ZetaTokenContractAddress: "",
+ ConnectorContractAddress: "",
+ Erc20CustodyContractAddress: "",
+ InTxTicker: 12,
+ OutTxTicker: 15,
+ WatchUtxoTicker: 0,
+ GasPriceTicker: 30,
+ OutboundTxScheduleInterval: 30,
+ OutboundTxScheduleLookahead: 60,
+ },
+ {
+ ChainId: common.BscMainnetChain().ChainId,
+ ConfirmationCount: 6,
+ ZetaTokenContractAddress: "",
+ ConnectorContractAddress: "",
+ Erc20CustodyContractAddress: "",
+ InTxTicker: 5,
+ OutTxTicker: 15,
+ WatchUtxoTicker: 0,
+ GasPriceTicker: 30,
+ OutboundTxScheduleInterval: 30,
+ OutboundTxScheduleLookahead: 60,
+ },
+ {
+ ChainId: common.BtcMainnetChain().ChainId,
+ ConfirmationCount: 2,
+ ZetaTokenContractAddress: "",
+ ConnectorContractAddress: "",
+ Erc20CustodyContractAddress: "",
+ WatchUtxoTicker: 30,
+ InTxTicker: 120,
+ OutTxTicker: 60,
+ GasPriceTicker: 30,
+ OutboundTxScheduleInterval: 30,
+ OutboundTxScheduleLookahead: 60,
+ },
+ },
+ }
+ chainList := common.ExternalChainList()
+ requiredParams := len(chainList)
+ availableParams := 0
+ for _, chain := range chainList {
+ for _, param := range params.CoreParams {
+ if chain.ChainId == param.ChainId {
+ availableParams++
+ }
+ }
+ }
+ if availableParams != requiredParams {
+ panic(fmt.Sprintf("Core params are not available for all chains , DefaultChains : %s , CoreParams : %s",
+ types.PrettyPrintStruct(chainList), params.String()))
+ }
+ return params
+}
diff --git a/x/observer/types/core_params_privnet.go b/x/observer/types/core_params_privnet.go
index 71e9a0525a..832bf57475 100644
--- a/x/observer/types/core_params_privnet.go
+++ b/x/observer/types/core_params_privnet.go
@@ -26,15 +26,6 @@ func GetCoreParams() CoreParamsList {
OutboundTxScheduleInterval: 2,
OutboundTxScheduleLookahead: 5,
},
- {
-
- ChainId: common.ZetaChain().ChainId,
- ConfirmationCount: 1,
- GasPriceTicker: 5,
- ZetaTokenContractAddress: "0x2DD9830f8Ac0E421aFF9B7c8f7E9DF6F65DBF6Ea",
- ConnectorContractAddress: "",
- Erc20CustodyContractAddress: "",
- },
{
ChainId: common.BtcRegtestChain().ChainId,
ConfirmationCount: 2,
@@ -49,7 +40,7 @@ func GetCoreParams() CoreParamsList {
OutboundTxScheduleLookahead: 5,
}},
}
- chainList := common.DefaultChainsList()
+ chainList := common.ExternalChainList()
requiredParams := len(chainList)
availableParams := 0
for _, chain := range chainList {
diff --git a/x/observer/types/core_params_testnet.go b/x/observer/types/core_params_testnet.go
index 1505f1ca01..a2be9be7fc 100644
--- a/x/observer/types/core_params_testnet.go
+++ b/x/observer/types/core_params_testnet.go
@@ -14,9 +14,10 @@ func GetCoreParams() CoreParamsList {
params := CoreParamsList{
CoreParams: []*CoreParams{
{
- ChainId: common.GoerliChain().ChainId,
- ConfirmationCount: 6,
- ZetaTokenContractAddress: "",
+ ChainId: common.GoerliChain().ChainId,
+ ConfirmationCount: 6,
+ // This is the actual Zeta token Goerli testnet, we need to specify this address for the integration tests to pass
+ ZetaTokenContractAddress: "0x0000c304d2934c00db1d51995b9f6996affd17c0",
ConnectorContractAddress: "",
Erc20CustodyContractAddress: "",
InTxTicker: 12,
@@ -52,17 +53,6 @@ func GetCoreParams() CoreParamsList {
OutboundTxScheduleInterval: 30,
OutboundTxScheduleLookahead: 60,
},
- {
- ChainId: common.ZetaChain().ChainId,
- ConfirmationCount: 3,
- ZetaTokenContractAddress: "",
- ConnectorContractAddress: "",
- Erc20CustodyContractAddress: "",
- InTxTicker: 2,
- OutTxTicker: 3,
- WatchUtxoTicker: 0,
- GasPriceTicker: 5,
- },
{
ChainId: common.BtcTestNetChain().ChainId,
ConfirmationCount: 2,
@@ -71,14 +61,14 @@ func GetCoreParams() CoreParamsList {
Erc20CustodyContractAddress: "",
WatchUtxoTicker: 30,
InTxTicker: 120,
- OutTxTicker: 60,
+ OutTxTicker: 12,
GasPriceTicker: 30,
OutboundTxScheduleInterval: 30,
- OutboundTxScheduleLookahead: 60,
+ OutboundTxScheduleLookahead: 100,
},
},
}
- chainList := common.DefaultChainsList()
+ chainList := common.ExternalChainList()
requiredParams := len(chainList)
availableParams := 0
for _, chain := range chainList {
diff --git a/x/observer/types/crosschain_flags.go b/x/observer/types/crosschain_flags.go
new file mode 100644
index 0000000000..f85fce5130
--- /dev/null
+++ b/x/observer/types/crosschain_flags.go
@@ -0,0 +1,24 @@
+package types
+
+import "time"
+
+var DefaultGasPriceIncreaseFlags = GasPriceIncreaseFlags{
+ // EpochLength is the number of blocks in an epoch before triggering a gas price increase
+
+ EpochLength: 100,
+ // RetryInterval is the number of blocks to wait before incrementing the gas price again
+ 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
+ GasPriceIncreasePercent: 100,
+}
+
+// DefaultCrosschainFlags returns the default crosschain flags used when not defined
+func DefaultCrosschainFlags() *CrosschainFlags {
+ return &CrosschainFlags{
+ IsInboundEnabled: true,
+ IsOutboundEnabled: true,
+ GasPriceIncreaseFlags: &DefaultGasPriceIncreaseFlags,
+ }
+}
diff --git a/x/observer/types/crosschain_flags.pb.go b/x/observer/types/crosschain_flags.pb.go
new file mode 100644
index 0000000000..8bb7de6ad7
--- /dev/null
+++ b/x/observer/types/crosschain_flags.pb.go
@@ -0,0 +1,664 @@
+// Code generated by protoc-gen-gogo. DO NOT EDIT.
+// source: observer/crosschain_flags.proto
+
+package types
+
+import (
+ fmt "fmt"
+ io "io"
+ math "math"
+ math_bits "math/bits"
+ time "time"
+
+ _ "github.com/cosmos/gogoproto/gogoproto"
+ proto "github.com/gogo/protobuf/proto"
+ github_com_gogo_protobuf_types "github.com/gogo/protobuf/types"
+ _ "google.golang.org/protobuf/types/known/durationpb"
+)
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+var _ = time.Kitchen
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
+
+type GasPriceIncreaseFlags struct {
+ EpochLength int64 `protobuf:"varint,1,opt,name=epochLength,proto3" json:"epochLength,omitempty"`
+ RetryInterval time.Duration `protobuf:"bytes,2,opt,name=retryInterval,proto3,stdduration" json:"retryInterval"`
+ GasPriceIncreasePercent uint32 `protobuf:"varint,3,opt,name=gasPriceIncreasePercent,proto3" json:"gasPriceIncreasePercent,omitempty"`
+}
+
+func (m *GasPriceIncreaseFlags) Reset() { *m = GasPriceIncreaseFlags{} }
+func (m *GasPriceIncreaseFlags) String() string { return proto.CompactTextString(m) }
+func (*GasPriceIncreaseFlags) ProtoMessage() {}
+func (*GasPriceIncreaseFlags) Descriptor() ([]byte, []int) {
+ return fileDescriptor_b948b59e4d986f49, []int{0}
+}
+func (m *GasPriceIncreaseFlags) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *GasPriceIncreaseFlags) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_GasPriceIncreaseFlags.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 *GasPriceIncreaseFlags) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_GasPriceIncreaseFlags.Merge(m, src)
+}
+func (m *GasPriceIncreaseFlags) XXX_Size() int {
+ return m.Size()
+}
+func (m *GasPriceIncreaseFlags) XXX_DiscardUnknown() {
+ xxx_messageInfo_GasPriceIncreaseFlags.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_GasPriceIncreaseFlags proto.InternalMessageInfo
+
+func (m *GasPriceIncreaseFlags) GetEpochLength() int64 {
+ if m != nil {
+ return m.EpochLength
+ }
+ return 0
+}
+
+func (m *GasPriceIncreaseFlags) GetRetryInterval() time.Duration {
+ if m != nil {
+ return m.RetryInterval
+ }
+ return 0
+}
+
+func (m *GasPriceIncreaseFlags) GetGasPriceIncreasePercent() uint32 {
+ if m != nil {
+ return m.GasPriceIncreasePercent
+ }
+ return 0
+}
+
+type CrosschainFlags struct {
+ IsInboundEnabled bool `protobuf:"varint,1,opt,name=isInboundEnabled,proto3" json:"isInboundEnabled,omitempty"`
+ IsOutboundEnabled bool `protobuf:"varint,2,opt,name=isOutboundEnabled,proto3" json:"isOutboundEnabled,omitempty"`
+ GasPriceIncreaseFlags *GasPriceIncreaseFlags `protobuf:"bytes,3,opt,name=gasPriceIncreaseFlags,proto3" json:"gasPriceIncreaseFlags,omitempty"`
+}
+
+func (m *CrosschainFlags) Reset() { *m = CrosschainFlags{} }
+func (m *CrosschainFlags) String() string { return proto.CompactTextString(m) }
+func (*CrosschainFlags) ProtoMessage() {}
+func (*CrosschainFlags) Descriptor() ([]byte, []int) {
+ return fileDescriptor_b948b59e4d986f49, []int{1}
+}
+func (m *CrosschainFlags) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *CrosschainFlags) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_CrosschainFlags.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 *CrosschainFlags) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_CrosschainFlags.Merge(m, src)
+}
+func (m *CrosschainFlags) XXX_Size() int {
+ return m.Size()
+}
+func (m *CrosschainFlags) XXX_DiscardUnknown() {
+ xxx_messageInfo_CrosschainFlags.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_CrosschainFlags proto.InternalMessageInfo
+
+func (m *CrosschainFlags) GetIsInboundEnabled() bool {
+ if m != nil {
+ return m.IsInboundEnabled
+ }
+ return false
+}
+
+func (m *CrosschainFlags) GetIsOutboundEnabled() bool {
+ if m != nil {
+ return m.IsOutboundEnabled
+ }
+ return false
+}
+
+func (m *CrosschainFlags) GetGasPriceIncreaseFlags() *GasPriceIncreaseFlags {
+ if m != nil {
+ return m.GasPriceIncreaseFlags
+ }
+ return nil
+}
+
+func init() {
+ proto.RegisterType((*GasPriceIncreaseFlags)(nil), "zetachain.zetacore.observer.GasPriceIncreaseFlags")
+ proto.RegisterType((*CrosschainFlags)(nil), "zetachain.zetacore.observer.CrosschainFlags")
+}
+
+func init() { proto.RegisterFile("observer/crosschain_flags.proto", fileDescriptor_b948b59e4d986f49) }
+
+var fileDescriptor_b948b59e4d986f49 = []byte{
+ // 364 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xcf, 0x6b, 0xe2, 0x40,
+ 0x14, 0xc7, 0x33, 0x0a, 0x8b, 0x8c, 0xc8, 0xee, 0x86, 0x95, 0x75, 0x5d, 0x88, 0xc1, 0x93, 0x2c,
+ 0xdb, 0x19, 0xb0, 0x97, 0x9e, 0xed, 0x2f, 0x02, 0x85, 0x4a, 0x8e, 0xbd, 0x94, 0x49, 0x7c, 0x4e,
+ 0x02, 0xe9, 0x8c, 0xcc, 0x4c, 0xa4, 0xf6, 0xaf, 0xe8, 0xb1, 0x7f, 0x4d, 0xcf, 0x1e, 0xbd, 0x14,
+ 0x7a, 0x6a, 0x8b, 0xfe, 0x23, 0xc5, 0x49, 0x95, 0x5a, 0x6d, 0x6f, 0x2f, 0xef, 0xbd, 0x6f, 0x3e,
+ 0x5f, 0xbe, 0x6f, 0x70, 0x4b, 0x46, 0x1a, 0xd4, 0x18, 0x14, 0x8d, 0x95, 0xd4, 0x3a, 0x4e, 0x58,
+ 0x2a, 0x2e, 0x87, 0x19, 0xe3, 0x9a, 0x8c, 0x94, 0x34, 0xd2, 0xfd, 0x7b, 0x03, 0x86, 0xd9, 0x36,
+ 0xb1, 0x95, 0x54, 0x40, 0x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64, 0x67, 0xce, 0xe1, 0xee, 0x1f, 0xf6, 0x82, 0xe9, 0xdc,
+ 0x43, 0xb3, 0xb9, 0x87, 0x5e, 0xe6, 0x1e, 0xba, 0x5d, 0x78, 0xce, 0x6c, 0xe1, 0x39, 0x8f, 0x0b,
+ 0xcf, 0xb9, 0xa0, 0x3c, 0x35, 0x49, 0x1e, 0x91, 0x58, 0x5e, 0xd1, 0x25, 0x64, 0xcf, 0xf2, 0xe8,
+ 0x8a, 0x47, 0xaf, 0xe9, 0xfa, 0x1d, 0x99, 0xc9, 0x08, 0x74, 0xf4, 0xcd, 0x1e, 0x62, 0xff, 0x35,
+ 0x00, 0x00, 0xff, 0xff, 0xc1, 0xe4, 0x6d, 0x3a, 0x60, 0x02, 0x00, 0x00,
+}
+
+func (m *GasPriceIncreaseFlags) 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 *GasPriceIncreaseFlags) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *GasPriceIncreaseFlags) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.GasPriceIncreasePercent != 0 {
+ i = encodeVarintCrosschainFlags(dAtA, i, uint64(m.GasPriceIncreasePercent))
+ i--
+ dAtA[i] = 0x18
+ }
+ n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.RetryInterval, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.RetryInterval):])
+ if err1 != nil {
+ return 0, err1
+ }
+ i -= n1
+ i = encodeVarintCrosschainFlags(dAtA, i, uint64(n1))
+ i--
+ dAtA[i] = 0x12
+ if m.EpochLength != 0 {
+ i = encodeVarintCrosschainFlags(dAtA, i, uint64(m.EpochLength))
+ i--
+ dAtA[i] = 0x8
+ }
+ return len(dAtA) - i, nil
+}
+
+func (m *CrosschainFlags) 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 *CrosschainFlags) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *CrosschainFlags) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.GasPriceIncreaseFlags != nil {
+ {
+ size, err := m.GasPriceIncreaseFlags.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintCrosschainFlags(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x1a
+ }
+ if m.IsOutboundEnabled {
+ i--
+ if m.IsOutboundEnabled {
+ dAtA[i] = 1
+ } else {
+ dAtA[i] = 0
+ }
+ i--
+ dAtA[i] = 0x10
+ }
+ if m.IsInboundEnabled {
+ i--
+ if m.IsInboundEnabled {
+ dAtA[i] = 1
+ } else {
+ dAtA[i] = 0
+ }
+ i--
+ dAtA[i] = 0x8
+ }
+ return len(dAtA) - i, nil
+}
+
+func encodeVarintCrosschainFlags(dAtA []byte, offset int, v uint64) int {
+ offset -= sovCrosschainFlags(v)
+ base := offset
+ for v >= 1<<7 {
+ dAtA[offset] = uint8(v&0x7f | 0x80)
+ v >>= 7
+ offset++
+ }
+ dAtA[offset] = uint8(v)
+ return base
+}
+func (m *GasPriceIncreaseFlags) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.EpochLength != 0 {
+ n += 1 + sovCrosschainFlags(uint64(m.EpochLength))
+ }
+ l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.RetryInterval)
+ n += 1 + l + sovCrosschainFlags(uint64(l))
+ if m.GasPriceIncreasePercent != 0 {
+ n += 1 + sovCrosschainFlags(uint64(m.GasPriceIncreasePercent))
+ }
+ return n
+}
+
+func (m *CrosschainFlags) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.IsInboundEnabled {
+ n += 2
+ }
+ if m.IsOutboundEnabled {
+ n += 2
+ }
+ if m.GasPriceIncreaseFlags != nil {
+ l = m.GasPriceIncreaseFlags.Size()
+ n += 1 + l + sovCrosschainFlags(uint64(l))
+ }
+ return n
+}
+
+func sovCrosschainFlags(x uint64) (n int) {
+ return (math_bits.Len64(x|1) + 6) / 7
+}
+func sozCrosschainFlags(x uint64) (n int) {
+ return sovCrosschainFlags(uint64((x << 1) ^ uint64((int64(x) >> 63))))
+}
+func (m *GasPriceIncreaseFlags) 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 ErrIntOverflowCrosschainFlags
+ }
+ 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: GasPriceIncreaseFlags: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: GasPriceIncreaseFlags: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field EpochLength", wireType)
+ }
+ m.EpochLength = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowCrosschainFlags
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.EpochLength |= int64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field RetryInterval", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowCrosschainFlags
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthCrosschainFlags
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthCrosschainFlags
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.RetryInterval, dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ case 3:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field GasPriceIncreasePercent", wireType)
+ }
+ m.GasPriceIncreasePercent = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowCrosschainFlags
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.GasPriceIncreasePercent |= uint32(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ default:
+ iNdEx = preIndex
+ skippy, err := skipCrosschainFlags(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthCrosschainFlags
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func (m *CrosschainFlags) 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 ErrIntOverflowCrosschainFlags
+ }
+ 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: CrosschainFlags: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: CrosschainFlags: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field IsInboundEnabled", wireType)
+ }
+ var v int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowCrosschainFlags
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ v |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ m.IsInboundEnabled = bool(v != 0)
+ case 2:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field IsOutboundEnabled", wireType)
+ }
+ var v int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowCrosschainFlags
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ v |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ m.IsOutboundEnabled = bool(v != 0)
+ case 3:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field GasPriceIncreaseFlags", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowCrosschainFlags
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthCrosschainFlags
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthCrosschainFlags
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if m.GasPriceIncreaseFlags == nil {
+ m.GasPriceIncreaseFlags = &GasPriceIncreaseFlags{}
+ }
+ if err := m.GasPriceIncreaseFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipCrosschainFlags(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthCrosschainFlags
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func skipCrosschainFlags(dAtA []byte) (n int, err error) {
+ l := len(dAtA)
+ iNdEx := 0
+ depth := 0
+ for iNdEx < l {
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return 0, ErrIntOverflowCrosschainFlags
+ }
+ if iNdEx >= l {
+ return 0, io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= (uint64(b) & 0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ wireType := int(wire & 0x7)
+ switch wireType {
+ case 0:
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return 0, ErrIntOverflowCrosschainFlags
+ }
+ if iNdEx >= l {
+ return 0, io.ErrUnexpectedEOF
+ }
+ iNdEx++
+ if dAtA[iNdEx-1] < 0x80 {
+ break
+ }
+ }
+ case 1:
+ iNdEx += 8
+ case 2:
+ var length int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return 0, ErrIntOverflowCrosschainFlags
+ }
+ if iNdEx >= l {
+ return 0, io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ length |= (int(b) & 0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if length < 0 {
+ return 0, ErrInvalidLengthCrosschainFlags
+ }
+ iNdEx += length
+ case 3:
+ depth++
+ case 4:
+ if depth == 0 {
+ return 0, ErrUnexpectedEndOfGroupCrosschainFlags
+ }
+ depth--
+ case 5:
+ iNdEx += 4
+ default:
+ return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
+ }
+ if iNdEx < 0 {
+ return 0, ErrInvalidLengthCrosschainFlags
+ }
+ if depth == 0 {
+ return iNdEx, nil
+ }
+ }
+ return 0, io.ErrUnexpectedEOF
+}
+
+var (
+ ErrInvalidLengthCrosschainFlags = fmt.Errorf("proto: negative length found during unmarshaling")
+ ErrIntOverflowCrosschainFlags = fmt.Errorf("proto: integer overflow")
+ ErrUnexpectedEndOfGroupCrosschainFlags = fmt.Errorf("proto: unexpected end of group")
+)
diff --git a/x/observer/types/errors.go b/x/observer/types/errors.go
index 6823988c3b..afe8422699 100644
--- a/x/observer/types/errors.go
+++ b/x/observer/types/errors.go
@@ -7,24 +7,26 @@ import (
)
var (
- ErrUnableToAddVote = errorsmod.Register(ModuleName, 1100, "Unable to add vote ")
- ErrParamsThreshold = errorsmod.Register(ModuleName, 1101, "Threshold cannot be more than 1")
- ErrSupportedChains = errorsmod.Register(ModuleName, 1102, "Err chain not supported")
- ErrInvalidStatus = errorsmod.Register(ModuleName, 1103, "Invalid Voting Status")
+ ErrUnableToAddVote = errorsmod.Register(ModuleName, 1100, "unable to add vote ")
+ ErrParamsThreshold = errorsmod.Register(ModuleName, 1101, "threshold cannot be more than 1")
+ ErrSupportedChains = errorsmod.Register(ModuleName, 1102, "chain not supported")
+ ErrInvalidStatus = errorsmod.Register(ModuleName, 1103, "invalid Voting Status")
- ErrObserverNotPresent = errorsmod.Register(ModuleName, 1105, "Observer for type and observation does not exist")
- ErrNotValidator = errorsmod.Register(ModuleName, 1106, "User needs to be a validator before applying to become an observer")
- ErrValidatorStatus = errorsmod.Register(ModuleName, 1107, "Corresponding validator needs to be bonded and not jailerd")
- ErrInvalidAddress = errorsmod.Register(ModuleName, 1108, "Invalid Address")
- ErrSelfDelegation = errorsmod.Register(ModuleName, 1109, "Self Delegation for operator not found")
- ErrCheckObserverDelegation = errorsmod.Register(ModuleName, 1110, "Observer delegation not sufficient")
- ErrNotAuthorizedPolicy = errorsmod.Register(ModuleName, 1111, "Msg Sender is not the authorized policy")
- ErrCoreParamsNotSet = errorsmod.Register(ModuleName, 1112, "Core params has not been set")
- ErrKeygenNotFound = errorsmod.Register(ModuleName, 1113, "Err Keygen not found, Keygen block can only be updated,New keygen cannot be set")
- ErrKeygenBlockTooLow = errorsmod.Register(ModuleName, 1114, "Please set a block number at-least 10 blocks higher than the current block number")
- ErrKeygenCompleted = errorsmod.Register(ModuleName, 1115, "Keygen already completed")
- ErrNotAuthorized = errorsmod.Register(ModuleName, 1116, "Err not authorized")
- ErrInvalidCoinType = errorsmod.Register(ModuleName, 1117, "Invalid coin type")
- ErrObserverCountNegative = errorsmod.Register(ModuleName, 1118, "Observer count cannot be negative")
- ErrInvalidPubKey = errorsmod.Register(ModuleName, 1119, "Invalid PubKey")
+ ErrObserverNotPresent = errorsmod.Register(ModuleName, 1105, "observer for type and observation does not exist")
+ ErrNotValidator = errorsmod.Register(ModuleName, 1106, "user needs to be a validator before applying to become an observer")
+ ErrValidatorStatus = errorsmod.Register(ModuleName, 1107, "corresponding validator needs to be bonded and not jailerd")
+ ErrInvalidAddress = errorsmod.Register(ModuleName, 1108, "invalid Address")
+ ErrSelfDelegation = errorsmod.Register(ModuleName, 1109, "self Delegation for operator not found")
+ ErrCheckObserverDelegation = errorsmod.Register(ModuleName, 1110, "observer delegation not sufficient")
+ ErrNotAuthorizedPolicy = errorsmod.Register(ModuleName, 1111, "msg Sender is not the authorized policy")
+ ErrCoreParamsNotSet = errorsmod.Register(ModuleName, 1112, "core params has not been set")
+ ErrKeygenNotFound = errorsmod.Register(ModuleName, 1113, "Keygen not found, Keygen block can only be updated,New keygen cannot be set")
+ ErrKeygenBlockTooLow = errorsmod.Register(ModuleName, 1114, "please set a block number at-least 10 blocks higher than the current block number")
+ ErrKeygenCompleted = errorsmod.Register(ModuleName, 1115, "keygen already completed")
+ ErrNotAuthorized = errorsmod.Register(ModuleName, 1116, "not authorized")
+
+ ErrBlockHeaderNotFound = errorsmod.Register(ModuleName, 1117, "block header not found")
+ ErrUnrecognizedBlockHeader = errorsmod.Register(ModuleName, 1118, "unrecognized block header")
+ ErrBlockAlreadyExist = errorsmod.Register(ModuleName, 1119, "block already exists")
+ ErrNoParentHash = errorsmod.Register(ModuleName, 1120, "no parent hash")
)
diff --git a/x/observer/types/events.pb.go b/x/observer/types/events.pb.go
index 5c429373f4..14068f968d 100644
--- a/x/observer/types/events.pb.go
+++ b/x/observer/types/events.pb.go
@@ -236,45 +236,129 @@ func (m *EventNewObserverAdded) GetObserverLastBlockCount() uint64 {
return 0
}
+type EventCrosschainFlagsUpdated struct {
+ MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"`
+ IsInboundEnabled bool `protobuf:"varint,2,opt,name=isInboundEnabled,proto3" json:"isInboundEnabled,omitempty"`
+ IsOutboundEnabled bool `protobuf:"varint,3,opt,name=isOutboundEnabled,proto3" json:"isOutboundEnabled,omitempty"`
+ GasPriceIncreaseFlags *GasPriceIncreaseFlags `protobuf:"bytes,4,opt,name=gasPriceIncreaseFlags,proto3" json:"gasPriceIncreaseFlags,omitempty"`
+ Signer string `protobuf:"bytes,5,opt,name=signer,proto3" json:"signer,omitempty"`
+}
+
+func (m *EventCrosschainFlagsUpdated) Reset() { *m = EventCrosschainFlagsUpdated{} }
+func (m *EventCrosschainFlagsUpdated) String() string { return proto.CompactTextString(m) }
+func (*EventCrosschainFlagsUpdated) ProtoMessage() {}
+func (*EventCrosschainFlagsUpdated) Descriptor() ([]byte, []int) {
+ return fileDescriptor_1f1ca57368474456, []int{3}
+}
+func (m *EventCrosschainFlagsUpdated) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *EventCrosschainFlagsUpdated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_EventCrosschainFlagsUpdated.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 *EventCrosschainFlagsUpdated) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_EventCrosschainFlagsUpdated.Merge(m, src)
+}
+func (m *EventCrosschainFlagsUpdated) XXX_Size() int {
+ return m.Size()
+}
+func (m *EventCrosschainFlagsUpdated) XXX_DiscardUnknown() {
+ xxx_messageInfo_EventCrosschainFlagsUpdated.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_EventCrosschainFlagsUpdated proto.InternalMessageInfo
+
+func (m *EventCrosschainFlagsUpdated) GetMsgTypeUrl() string {
+ if m != nil {
+ return m.MsgTypeUrl
+ }
+ return ""
+}
+
+func (m *EventCrosschainFlagsUpdated) GetIsInboundEnabled() bool {
+ if m != nil {
+ return m.IsInboundEnabled
+ }
+ return false
+}
+
+func (m *EventCrosschainFlagsUpdated) GetIsOutboundEnabled() bool {
+ if m != nil {
+ return m.IsOutboundEnabled
+ }
+ return false
+}
+
+func (m *EventCrosschainFlagsUpdated) GetGasPriceIncreaseFlags() *GasPriceIncreaseFlags {
+ if m != nil {
+ return m.GasPriceIncreaseFlags
+ }
+ return nil
+}
+
+func (m *EventCrosschainFlagsUpdated) GetSigner() string {
+ if m != nil {
+ return m.Signer
+ }
+ return ""
+}
+
func init() {
proto.RegisterType((*EventBallotCreated)(nil), "zetachain.zetacore.observer.EventBallotCreated")
proto.RegisterType((*EventKeygenBlockUpdated)(nil), "zetachain.zetacore.observer.EventKeygenBlockUpdated")
proto.RegisterType((*EventNewObserverAdded)(nil), "zetachain.zetacore.observer.EventNewObserverAdded")
+ proto.RegisterType((*EventCrosschainFlagsUpdated)(nil), "zetachain.zetacore.observer.EventCrosschainFlagsUpdated")
}
func init() { proto.RegisterFile("observer/events.proto", fileDescriptor_1f1ca57368474456) }
var fileDescriptor_1f1ca57368474456 = []byte{
- // 454 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x31, 0x8f, 0xd3, 0x30,
- 0x14, 0x6e, 0x8e, 0x03, 0x09, 0xdf, 0xc1, 0x1d, 0x16, 0x47, 0xd3, 0x22, 0x85, 0x52, 0x09, 0x09,
- 0x84, 0x48, 0x06, 0x26, 0x10, 0x0b, 0xad, 0x10, 0x54, 0x20, 0x40, 0x15, 0x5d, 0x58, 0x2c, 0x27,
- 0x79, 0x24, 0x51, 0x52, 0x3b, 0xb2, 0x9d, 0x42, 0xd8, 0xd9, 0x59, 0xf9, 0x47, 0x8c, 0x1d, 0x19,
- 0x18, 0x50, 0xfb, 0x47, 0x90, 0xed, 0x24, 0xad, 0x04, 0x43, 0x37, 0xeb, 0x7b, 0xdf, 0xf7, 0xfc,
- 0x7d, 0xef, 0x3d, 0x74, 0xc1, 0x43, 0x09, 0x62, 0x05, 0x22, 0x80, 0x15, 0x30, 0x25, 0xfd, 0x52,
- 0x70, 0xc5, 0xf1, 0xed, 0xaf, 0xa0, 0x68, 0x94, 0xd2, 0x8c, 0xf9, 0xe6, 0xc5, 0x05, 0xf8, 0x2d,
- 0x73, 0x78, 0x33, 0xe1, 0x09, 0x37, 0xbc, 0x40, 0xbf, 0xac, 0x64, 0xd8, 0xef, 0x3a,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x45, 0x37, 0x3c, 0x10, 0x84, 0xc6, 0xb1, 0x00, 0x29, 0x1b, 0x27, 0x67, 0x7c, 0xd7,
- 0x4a, 0xc3, 0xf8, 0x19, 0x1a, 0x9a, 0x8b, 0x28, 0x32, 0x60, 0x8a, 0x24, 0x82, 0x32, 0x05, 0xd0,
- 0x89, 0xac, 0x33, 0x77, 0xc7, 0x78, 0x69, 0x09, 0xad, 0xfa, 0x29, 0x1a, 0xfc, 0x47, 0x6d, 0x73,
- 0x35, 0x2b, 0xe8, 0xff, 0x23, 0xb6, 0x09, 0xf1, 0x13, 0x34, 0xe8, 0x4c, 0x16, 0x54, 0x2a, 0x3b,
- 0x31, 0x12, 0xf1, 0x8a, 0x29, 0xb3, 0x97, 0xe3, 0xf9, 0xad, 0x96, 0xf0, 0x86, 0x4a, 0x65, 0xa6,
- 0x37, 0xd5, 0xd5, 0xc9, 0xec, 0xe7, 0xc6, 0x73, 0xd6, 0x1b, 0xcf, 0xf9, 0xb3, 0xf1, 0x9c, 0xef,
- 0x5b, 0xaf, 0xb7, 0xde, 0x7a, 0xbd, 0x5f, 0x5b, 0xaf, 0xf7, 0x31, 0x48, 0x32, 0x95, 0x56, 0xa1,
- 0x1f, 0xf1, 0x65, 0xa0, 0x3f, 0x7e, 0x64, 0xae, 0x21, 0x68, 0x8f, 0x3e, 0xf8, 0xd2, 0x5d, 0x73,
- 0xa0, 0xe7, 0x27, 0xc3, 0x2b, 0xe6, 0xa8, 0x1f, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x74, 0xce,
- 0xb9, 0xbf, 0x39, 0x03, 0x00, 0x00,
+ // 564 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xcf, 0x6f, 0xd3, 0x30,
+ 0x14, 0x6e, 0xba, 0x31, 0x81, 0x3b, 0x58, 0x67, 0xd1, 0x35, 0xeb, 0xa4, 0x6c, 0x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() (dAtA []byte, err error) {
@@ -435,6 +519,75 @@ func (m *EventNewObserverAdded) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
+func (m *EventCrosschainFlagsUpdated) 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 *EventCrosschainFlagsUpdated) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *EventCrosschainFlagsUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if len(m.Signer) > 0 {
+ i -= len(m.Signer)
+ copy(dAtA[i:], m.Signer)
+ i = encodeVarintEvents(dAtA, i, uint64(len(m.Signer)))
+ i--
+ dAtA[i] = 0x2a
+ }
+ if m.GasPriceIncreaseFlags != nil {
+ {
+ size, err := m.GasPriceIncreaseFlags.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintEvents(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x22
+ }
+ if m.IsOutboundEnabled {
+ i--
+ if m.IsOutboundEnabled {
+ dAtA[i] = 1
+ } else {
+ dAtA[i] = 0
+ }
+ i--
+ dAtA[i] = 0x18
+ }
+ if m.IsInboundEnabled {
+ i--
+ if m.IsInboundEnabled {
+ dAtA[i] = 1
+ } else {
+ dAtA[i] = 0
+ }
+ i--
+ dAtA[i] = 0x10
+ }
+ 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
@@ -524,6 +677,33 @@ func (m *EventNewObserverAdded) Size() (n int) {
return n
}
+func (m *EventCrosschainFlagsUpdated) 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 m.IsInboundEnabled {
+ n += 2
+ }
+ if m.IsOutboundEnabled {
+ n += 2
+ }
+ if m.GasPriceIncreaseFlags != nil {
+ l = m.GasPriceIncreaseFlags.Size()
+ n += 1 + l + sovEvents(uint64(l))
+ }
+ l = len(m.Signer)
+ if l > 0 {
+ n += 1 + l + sovEvents(uint64(l))
+ }
+ return n
+}
+
func sovEvents(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@@ -1083,6 +1263,196 @@ func (m *EventNewObserverAdded) Unmarshal(dAtA []byte) error {
}
return nil
}
+func (m *EventCrosschainFlagsUpdated) 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: EventCrosschainFlagsUpdated: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: EventCrosschainFlagsUpdated: 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 != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field IsInboundEnabled", wireType)
+ }
+ var v int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowEvents
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ v |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ m.IsInboundEnabled = bool(v != 0)
+ case 3:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field IsOutboundEnabled", wireType)
+ }
+ var v int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowEvents
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ v |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ m.IsOutboundEnabled = bool(v != 0)
+ case 4:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field GasPriceIncreaseFlags", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowEvents
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthEvents
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthEvents
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if m.GasPriceIncreaseFlags == nil {
+ m.GasPriceIncreaseFlags = &GasPriceIncreaseFlags{}
+ }
+ if err := m.GasPriceIncreaseFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ case 5:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowEvents
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthEvents
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthEvents
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Signer = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipEvents(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthEvents
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
func skipEvents(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
diff --git a/x/observer/types/genesis.go b/x/observer/types/genesis.go
index a9981b1d65..d43b42e89e 100644
--- a/x/observer/types/genesis.go
+++ b/x/observer/types/genesis.go
@@ -15,14 +15,13 @@ func DefaultGenesis() *GenesisState {
Ballots: nil,
Observers: nil,
NodeAccountList: []*NodeAccount{},
- PermissionFlags: &PermissionFlags{IsInboundEnabled: true, IsOutboundEnabled: true},
+ CrosschainFlags: &CrosschainFlags{IsInboundEnabled: true, IsOutboundEnabled: true},
Keygen: nil,
LastObserverCount: nil,
}
}
-// Validate performs basic genesis state validation returning an error upon any
-// failure.
+// Validate performs basic genesis state validation returning an error upon any failure.
func (gs GenesisState) Validate() error {
if gs.Params != nil {
err := gs.Params.Validate()
@@ -40,11 +39,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..da23bf6955 100644
--- a/x/observer/types/genesis.pb.go
+++ b/x/observer/types/genesis.pb.go
@@ -28,10 +28,11 @@ type GenesisState struct {
Ballots []*Ballot `protobuf:"bytes,1,rep,name=ballots,proto3" json:"ballots,omitempty"`
Observers []*ObserverMapper `protobuf:"bytes,2,rep,name=observers,proto3" json:"observers,omitempty"`
NodeAccountList []*NodeAccount `protobuf:"bytes,3,rep,name=nodeAccountList,proto3" json:"nodeAccountList,omitempty"`
- PermissionFlags *PermissionFlags `protobuf:"bytes,4,opt,name=permission_flags,json=permissionFlags,proto3" json:"permission_flags,omitempty"`
+ CrosschainFlags *CrosschainFlags `protobuf:"bytes,4,opt,name=crosschain_flags,json=crosschainFlags,proto3" json:"crosschain_flags,omitempty"`
Params *Params `protobuf:"bytes,5,opt,name=params,proto3" json:"params,omitempty"`
Keygen *Keygen `protobuf:"bytes,6,opt,name=keygen,proto3" json:"keygen,omitempty"`
LastObserverCount *LastObserverCount `protobuf:"bytes,7,opt,name=last_observer_count,json=lastObserverCount,proto3" json:"last_observer_count,omitempty"`
+ CoreParamsList CoreParamsList `protobuf:"bytes,8,opt,name=core_params_list,json=coreParamsList,proto3" json:"core_params_list"`
}
func (m *GenesisState) Reset() { *m = GenesisState{} }
@@ -88,9 +89,9 @@ func (m *GenesisState) GetNodeAccountList() []*NodeAccount {
return nil
}
-func (m *GenesisState) GetPermissionFlags() *PermissionFlags {
+func (m *GenesisState) GetCrosschainFlags() *CrosschainFlags {
if m != nil {
- return m.PermissionFlags
+ return m.CrosschainFlags
}
return nil
}
@@ -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,34 @@ 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, 0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1, 0x17, 0xd1, 0x85, 0x2f, 0xe1, 0x2f, 0xd4,
+ 0x3d, 0xbe, 0xb9, 0xc7, 0xff, 0x5b, 0x7e, 0x70, 0x5f, 0xac, 0x72, 0xc2, 0xc3, 0x86, 0xfa, 0xd0,
+ 0x2f, 0xaf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x9a, 0xb6, 0x15, 0x7a, 0xb9, 0x03, 0x00, 0x00,
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
@@ -171,6 +181,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])
@@ -207,9 +227,9 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x2a
}
- if m.PermissionFlags != nil {
+ if m.CrosschainFlags != nil {
{
- size, err := m.PermissionFlags.MarshalToSizedBuffer(dAtA[:i])
+ size, err := m.CrosschainFlags.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
@@ -299,8 +319,8 @@ func (m *GenesisState) Size() (n int) {
n += 1 + l + sovGenesis(uint64(l))
}
}
- if m.PermissionFlags != nil {
- l = m.PermissionFlags.Size()
+ if m.CrosschainFlags != nil {
+ l = m.CrosschainFlags.Size()
n += 1 + l + sovGenesis(uint64(l))
}
if m.Params != nil {
@@ -315,6 +335,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
}
@@ -457,7 +479,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error {
iNdEx = postIndex
case 4:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field PermissionFlags", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field CrosschainFlags", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
@@ -484,10 +506,10 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- if m.PermissionFlags == nil {
- m.PermissionFlags = &PermissionFlags{}
+ if m.CrosschainFlags == nil {
+ m.CrosschainFlags = &CrosschainFlags{}
}
- if err := m.PermissionFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ if err := m.CrosschainFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
@@ -599,6 +621,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/keys.go b/x/observer/types/keys.go
index 4dc482976f..4a28380ed9 100644
--- a/x/observer/types/keys.go
+++ b/x/observer/types/keys.go
@@ -39,10 +39,14 @@ const (
AdminPolicyParamsKey = "AdminParams"
BallotMaturityBlocksParamsKey = "BallotMaturityBlocksParams"
- PermissionFlagsKey = "PermissionFlags-value-"
+ // CrosschainFlagsKey is the key for the crosschain flags
+ // NOTE: PermissionFlags is old name for CrosschainFlags we keep it as key value for backward compatibility
+ CrosschainFlagsKey = "PermissionFlags-value-"
+
LastBlockObserverCountKey = "ObserverCount-value-"
NodeAccountKey = "NodeAccount-value-"
KeygenKey = "Keygen-value-"
+ BlockHeaderKey = "BlockHeader-value-"
BallotListKey = "BallotList-value-"
)
diff --git a/x/observer/types/messages_add_block_header.go b/x/observer/types/messages_add_block_header.go
new file mode 100644
index 0000000000..8db4410195
--- /dev/null
+++ b/x/observer/types/messages_add_block_header.go
@@ -0,0 +1,79 @@
+package types
+
+import (
+ cosmoserrors "cosmossdk.io/errors"
+
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
+ "github.com/ethereum/go-ethereum/crypto"
+ "github.com/zeta-chain/zetacore/common"
+)
+
+var _ sdk.Msg = &MsgAddBlockHeader{}
+
+const (
+ TypeMsgAddBlockHeader = "add_block_header"
+)
+
+func NewMsgAddBlockHeader(creator string, chainID int64, blockHash []byte, height int64, header common.HeaderData) *MsgAddBlockHeader {
+ return &MsgAddBlockHeader{
+ Creator: creator,
+ ChainId: chainID,
+ BlockHash: blockHash,
+ Height: height,
+ Header: header,
+ }
+}
+
+func (msg *MsgAddBlockHeader) Route() string {
+ return RouterKey
+}
+
+func (msg *MsgAddBlockHeader) Type() string {
+ return TypeMsgAddBlockHeader
+}
+
+func (msg *MsgAddBlockHeader) GetSigners() []sdk.AccAddress {
+ creator, err := sdk.AccAddressFromBech32(msg.Creator)
+ if err != nil {
+ panic(err)
+ }
+ return []sdk.AccAddress{creator}
+}
+
+func (msg *MsgAddBlockHeader) GetSignBytes() []byte {
+ bz := ModuleCdc.MustMarshalJSON(msg)
+ return sdk.MustSortJSON(bz)
+}
+
+func (msg *MsgAddBlockHeader) ValidateBasic() error {
+ _, err := sdk.AccAddressFromBech32(msg.Creator)
+ if err != nil {
+ return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, err.Error())
+ }
+
+ if common.IsEthereum(msg.ChainId) {
+ if len(msg.BlockHash) > 32 {
+ return cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid msg.txhash; too long (%d)", len(msg.BlockHash))
+ }
+ } else {
+ return cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid chain id (%d)", msg.ChainId)
+ }
+
+ if err := msg.Header.Validate(msg.BlockHash, msg.Height); err != nil {
+ return cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid block header (%s)", err)
+ }
+
+ if _, err := msg.Header.ParentHash(); err != nil {
+ return cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "can't get parent hash (%s)", err)
+ }
+
+ return nil
+}
+
+func (msg *MsgAddBlockHeader) Digest() string {
+ m := *msg
+ m.Creator = ""
+ hash := crypto.Keccak256Hash([]byte(m.String()))
+ return hash.Hex()
+}
diff --git a/x/observer/types/messages_crosschain_flags.go b/x/observer/types/messages_crosschain_flags.go
new file mode 100644
index 0000000000..cdca148a94
--- /dev/null
+++ b/x/observer/types/messages_crosschain_flags.go
@@ -0,0 +1,69 @@
+package types
+
+import (
+ "errors"
+
+ cosmoserrors "cosmossdk.io/errors"
+
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
+)
+
+const (
+ TypeMsgUpdateCrosschainFlags = "update_crosschain_flags"
+)
+
+var _ sdk.Msg = &MsgUpdateCrosschainFlags{}
+
+func NewMsgUpdateCrosschainFlags(creator string, isInboundEnabled, isOutboundEnabled bool) *MsgUpdateCrosschainFlags {
+ return &MsgUpdateCrosschainFlags{
+ Creator: creator,
+ IsInboundEnabled: isInboundEnabled,
+ IsOutboundEnabled: isOutboundEnabled,
+ }
+}
+
+func (msg *MsgUpdateCrosschainFlags) Route() string {
+ return RouterKey
+}
+
+func (msg *MsgUpdateCrosschainFlags) Type() string {
+ return TypeMsgUpdateCrosschainFlags
+}
+
+func (msg *MsgUpdateCrosschainFlags) GetSigners() []sdk.AccAddress {
+ creator, err := sdk.AccAddressFromBech32(msg.Creator)
+ if err != nil {
+ panic(err)
+ }
+ return []sdk.AccAddress{creator}
+}
+
+func (msg *MsgUpdateCrosschainFlags) GetSignBytes() []byte {
+ bz := ModuleCdc.MustMarshalJSON(msg)
+ return sdk.MustSortJSON(bz)
+}
+
+func (msg *MsgUpdateCrosschainFlags) ValidateBasic() error {
+ if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil {
+ return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
+ }
+
+ if msg.GasPriceIncreaseFlags != nil {
+ if err := msg.GasPriceIncreaseFlags.Validate(); err != nil {
+ return cosmoserrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
+ }
+ }
+
+ return nil
+}
+
+func (gpf GasPriceIncreaseFlags) Validate() error {
+ if gpf.EpochLength <= 0 {
+ return errors.New("epoch length must be positive")
+ }
+ if gpf.RetryInterval <= 0 {
+ return errors.New("retry interval must be positive")
+ }
+ return nil
+}
diff --git a/x/observer/types/messages_crosschain_flags_test.go b/x/observer/types/messages_crosschain_flags_test.go
new file mode 100644
index 0000000000..f01c33e6ef
--- /dev/null
+++ b/x/observer/types/messages_crosschain_flags_test.go
@@ -0,0 +1,118 @@
+package types_test
+
+import (
+ "testing"
+
+ sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
+ "github.com/stretchr/testify/require"
+ "github.com/zeta-chain/zetacore/testutil/sample"
+ "github.com/zeta-chain/zetacore/x/observer/types"
+)
+
+func TestMsgUpdateCrosschainFlags_ValidateBasic(t *testing.T) {
+ tests := []struct {
+ name string
+ msg types.MsgUpdateCrosschainFlags
+ err error
+ }{
+ {
+ name: "invalid address",
+ msg: types.MsgUpdateCrosschainFlags{
+ Creator: "invalid_address",
+ },
+ err: sdkerrors.ErrInvalidAddress,
+ },
+ {
+ name: "invalid gas price increase flags",
+ msg: types.MsgUpdateCrosschainFlags{
+ Creator: sample.AccAddress(),
+ GasPriceIncreaseFlags: &types.GasPriceIncreaseFlags{
+ EpochLength: -1,
+ RetryInterval: 1,
+ GasPriceIncreasePercent: 1,
+ },
+ },
+ err: sdkerrors.ErrInvalidRequest,
+ },
+ {
+ name: "valid address",
+ msg: types.MsgUpdateCrosschainFlags{
+ Creator: sample.AccAddress(),
+ GasPriceIncreaseFlags: &types.GasPriceIncreaseFlags{
+ EpochLength: 1,
+ RetryInterval: 1,
+ GasPriceIncreasePercent: 1,
+ },
+ },
+ },
+ {
+ name: "gas price increase flags can be nil",
+ msg: types.MsgUpdateCrosschainFlags{
+ Creator: sample.AccAddress(),
+ },
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ err := tt.msg.ValidateBasic()
+ if tt.err != nil {
+ require.ErrorIs(t, err, tt.err)
+ return
+ }
+ require.NoError(t, err)
+ })
+ }
+}
+
+func TestGasPriceIncreaseFlags_Validate(t *testing.T) {
+ tests := []struct {
+ name string
+ gpf types.GasPriceIncreaseFlags
+ errContains string
+ }{
+ {
+ name: "invalid epoch length",
+ gpf: types.GasPriceIncreaseFlags{
+ EpochLength: -1,
+ RetryInterval: 1,
+ GasPriceIncreasePercent: 1,
+ },
+ errContains: "epoch length must be positive",
+ },
+ {
+ name: "invalid retry interval",
+ gpf: types.GasPriceIncreaseFlags{
+ EpochLength: 1,
+ RetryInterval: -1,
+ GasPriceIncreasePercent: 1,
+ },
+ errContains: "retry interval must be positive",
+ },
+ {
+ name: "valid",
+ gpf: types.GasPriceIncreaseFlags{
+ EpochLength: 1,
+ RetryInterval: 1,
+ GasPriceIncreasePercent: 1,
+ },
+ },
+ {
+ name: "percent can be 0",
+ gpf: types.GasPriceIncreaseFlags{
+ EpochLength: 1,
+ RetryInterval: 1,
+ GasPriceIncreasePercent: 0,
+ },
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ err := tt.gpf.Validate()
+ if tt.errContains != "" {
+ require.ErrorContains(t, err, tt.errContains)
+ return
+ }
+ require.NoError(t, err)
+ })
+ }
+}
diff --git a/x/observer/types/messages_permission_flags.go b/x/observer/types/messages_permission_flags.go
deleted file mode 100644
index de6d9697ae..0000000000
--- a/x/observer/types/messages_permission_flags.go
+++ /dev/null
@@ -1,51 +0,0 @@
-package types
-
-import (
- sdk "github.com/cosmos/cosmos-sdk/types"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
-)
-
-const (
- TypeMsgCreatePermissionFlags = "create_permission_flags"
- TypeMsgUpdatePermissionFlags = "update_permission_flags"
- TypeMsgDeletePermissionFlags = "delete_permission_flags"
-)
-
-var _ sdk.Msg = &MsgUpdatePermissionFlags{}
-
-func NewMsgUpdatePermissionFlags(creator string, isInboundEnabled, isOutboundEnabled bool) *MsgUpdatePermissionFlags {
- return &MsgUpdatePermissionFlags{
- Creator: creator,
- IsInboundEnabled: isInboundEnabled,
- IsOutboundEnabled: isOutboundEnabled,
- }
-}
-
-func (msg *MsgUpdatePermissionFlags) Route() string {
- return RouterKey
-}
-
-func (msg *MsgUpdatePermissionFlags) Type() string {
- return TypeMsgUpdatePermissionFlags
-}
-
-func (msg *MsgUpdatePermissionFlags) GetSigners() []sdk.AccAddress {
- creator, err := sdk.AccAddressFromBech32(msg.Creator)
- if err != nil {
- panic(err)
- }
- return []sdk.AccAddress{creator}
-}
-
-func (msg *MsgUpdatePermissionFlags) GetSignBytes() []byte {
- bz := ModuleCdc.MustMarshalJSON(msg)
- return sdk.MustSortJSON(bz)
-}
-
-func (msg *MsgUpdatePermissionFlags) ValidateBasic() error {
- _, err := sdk.AccAddressFromBech32(msg.Creator)
- if err != nil {
- return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
- }
- return nil
-}
diff --git a/x/observer/types/messages_permission_flags_test.go b/x/observer/types/messages_permission_flags_test.go
deleted file mode 100644
index f50c41bd52..0000000000
--- a/x/observer/types/messages_permission_flags_test.go
+++ /dev/null
@@ -1,41 +0,0 @@
-package types_test
-
-import (
- "testing"
-
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
- "github.com/stretchr/testify/require"
- "github.com/zeta-chain/zetacore/testutil/sample"
- "github.com/zeta-chain/zetacore/x/observer/types"
-)
-
-func TestMsgUpdatePermissionFlags_ValidateBasic(t *testing.T) {
- tests := []struct {
- name string
- msg types.MsgUpdatePermissionFlags
- err error
- }{
- {
- name: "invalid address",
- msg: types.MsgUpdatePermissionFlags{
- Creator: "invalid_address",
- },
- err: sdkerrors.ErrInvalidAddress,
- }, {
- name: "valid address",
- msg: types.MsgUpdatePermissionFlags{
- Creator: sample.AccAddress(),
- },
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- err := tt.msg.ValidateBasic()
- if tt.err != nil {
- require.ErrorIs(t, err, tt.err)
- return
- }
- require.NoError(t, err)
- })
- }
-}
diff --git a/x/observer/types/params.go b/x/observer/types/params.go
index 65ce1824c0..bff524b297 100644
--- a/x/observer/types/params.go
+++ b/x/observer/types/params.go
@@ -28,7 +28,7 @@ func DefaultParams() Params {
IsSupported: true,
Chain: chain,
BallotThreshold: sdk.MustNewDecFromStr("0.66"),
- MinObserverDelegation: sdk.MustNewDecFromStr("10000000000"),
+ MinObserverDelegation: sdk.MustNewDecFromStr("1000000000000000000000"), // 1000 ZETA
}
}
return NewParams(observerParams, DefaultAdminPolicy(), 100)
@@ -37,27 +37,11 @@ func DefaultParams() Params {
func DefaultAdminPolicy() []*Admin_Policy {
return []*Admin_Policy{
{
- PolicyType: Policy_Type_out_tx_tracker,
+ PolicyType: Policy_Type_group1,
Address: GroupID1Address,
},
{
- PolicyType: Policy_Type_stop_inbound_cctx,
- Address: GroupID1Address,
- },
- {
- PolicyType: Policy_Type_deploy_fungible_coin,
- Address: GroupID1Address,
- },
- {
- PolicyType: Policy_Type_update_client_params,
- Address: GroupID1Address,
- },
- {
- PolicyType: Policy_Type_update_keygen_block,
- Address: GroupID1Address,
- },
- {
- PolicyType: Policy_Type_add_observer,
+ PolicyType: Policy_Type_group2,
Address: GroupID1Address,
},
}
@@ -79,7 +63,10 @@ func (p Params) Validate() error {
// String implements the Stringer interface.
func (p Params) String() string {
- out, _ := yaml.Marshal(p)
+ out, err := yaml.Marshal(p)
+ if err != nil {
+ return ""
+ }
return string(out)
}
diff --git a/x/observer/types/params.pb.go b/x/observer/types/params.pb.go
index cae7a895d9..609e56c5ca 100644
--- a/x/observer/types/params.pb.go
+++ b/x/observer/types/params.pb.go
@@ -29,30 +29,18 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type Policy_Type int32
const (
- Policy_Type_stop_inbound_cctx Policy_Type = 0
- Policy_Type_deploy_fungible_coin Policy_Type = 1
- Policy_Type_update_client_params Policy_Type = 2
- Policy_Type_update_keygen_block Policy_Type = 3
- Policy_Type_out_tx_tracker Policy_Type = 4
- Policy_Type_add_observer Policy_Type = 5
+ Policy_Type_group1 Policy_Type = 0
+ Policy_Type_group2 Policy_Type = 1
)
var Policy_Type_name = map[int32]string{
- 0: "stop_inbound_cctx",
- 1: "deploy_fungible_coin",
- 2: "update_client_params",
- 3: "update_keygen_block",
- 4: "out_tx_tracker",
- 5: "add_observer",
+ 0: "group1",
+ 1: "group2",
}
var Policy_Type_value = map[string]int32{
- "stop_inbound_cctx": 0,
- "deploy_fungible_coin": 1,
- "update_client_params": 2,
- "update_keygen_block": 3,
- "out_tx_tracker": 4,
- "add_observer": 5,
+ "group1": 0,
+ "group2": 1,
}
func (x Policy_Type) String() string {
@@ -327,7 +315,7 @@ func (m *Admin_Policy) GetPolicyType() Policy_Type {
if m != nil {
return m.PolicyType
}
- return Policy_Type_stop_inbound_cctx
+ return Policy_Type_group1
}
func (m *Admin_Policy) GetAddress() string {
@@ -409,61 +397,57 @@ func init() {
func init() { proto.RegisterFile("observer/params.proto", fileDescriptor_4542fa62877488a1) }
var fileDescriptor_4542fa62877488a1 = []byte{
- // 859 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0x41, 0x6f, 0x23, 0x35,
- 0x18, 0xcd, 0x24, 0xe9, 0x6e, 0xfb, 0x4d, 0x9a, 0x4e, 0xbd, 0x2d, 0x1d, 0x52, 0x91, 0x86, 0x20,
- 0x41, 0x58, 0xd4, 0x04, 0x15, 0x4e, 0x08, 0x0e, 0x6d, 0xf6, 0x40, 0xa5, 0x22, 0xaa, 0xd9, 0x70,
- 0x60, 0x2f, 0x96, 0xe3, 0x71, 0x13, 0x2b, 0x13, 0x7b, 0x64, 0x7b, 0x96, 0x84, 0x5f, 0xc1, 0x11,
- 0x09, 0x21, 0x71, 0xe0, 0xc0, 0x8f, 0xe0, 0x07, 0xec, 0x71, 0x8f, 0x88, 0xc3, 0x0a, 0xb5, 0x17,
- 0x7e, 0x06, 0xb2, 0x67, 0x26, 0x9b, 0x6e, 0x51, 0xa5, 0x3d, 0xe5, 0x1b, 0xbf, 0xf7, 0x3d, 0x7f,
- 0xf3, 0xfc, 0xe2, 0x81, 0x7d, 0x39, 0xd6, 0x4c, 0x3d, 0x67, 0x6a, 0x90, 0x12, 0x45, 0xe6, 0xba,
- 0x9f, 0x2a, 0x69, 0x24, 0x3a, 0xfc, 0x91, 0x19, 0x42, 0xa7, 0x84, 0x8b, 0xbe, 0xab, 0xa4, 0x62,
- 0xfd, 0x92, 0xd9, 0x7a, 0x44, 0xe5, 0x7c, 0x2e, 0xc5, 0x20, 0xff, 0xc9, 0x3b, 0x5a, 0x7b, 0x13,
- 0x39, 0x91, 0xae, 0x1c, 0xd8, 0xaa, 0x58, 0x3d, 0x58, 0xc9, 0x97, 0x45, 0x0e, 0x74, 0x9f, 0x41,
- 0x73, 0x28, 0x15, 0xbb, 0x74, 0x9b, 0x5e, 0x70, 0x6d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, 0xda, 0x87, 0x5d, 0x6d, 0x64, 0x8a, 0xb9, 0xc8,
- 0x63, 0x4d, 0xa9, 0x59, 0x04, 0x15, 0x14, 0xc2, 0x5e, 0xcc, 0xd2, 0x44, 0x2e, 0xf1, 0x55, 0x26,
- 0x26, 0x7c, 0x9c, 0x30, 0x4c, 0x25, 0x17, 0x81, 0x67, 0x91, 0x2c, 0x8d, 0x89, 0x61, 0x98, 0x26,
- 0x9c, 0x09, 0x53, 0xb8, 0x14, 0x54, 0xd1, 0x01, 0x3c, 0x2a, 0x90, 0x19, 0x5b, 0x4e, 0x98, 0xc8,
- 0x87, 0x0a, 0x6a, 0x08, 0x41, 0xb3, 0xbc, 0xa6, 0x14, 0xb1, 0x17, 0x4d, 0x50, 0x47, 0x81, 0x75,
- 0x24, 0x5e, 0x45, 0x2e, 0xd8, 0x68, 0xd5, 0xff, 0xf8, 0xbd, 0xed, 0x9d, 0x9d, 0xbf, 0xb8, 0x6e,
- 0x7b, 0x2f, 0xaf, 0xdb, 0xde, 0x3f, 0xd7, 0x6d, 0xef, 0xa7, 0x9b, 0x76, 0xe5, 0xe5, 0x4d, 0xbb,
- 0xf2, 0xd7, 0x4d, 0xbb, 0xf2, 0x6c, 0xb0, 0x96, 0x3d, 0xeb, 0xd6, 0xb1, 0x33, 0x6e, 0x50, 0x1a,
- 0x37, 0x58, 0xac, 0xbe, 0x01, 0x79, 0x10, 0xc7, 0x0f, 0xdc, 0xa7, 0xe0, 0xb3, 0xff, 0x02, 0x00,
- 0x00, 0xff, 0xff, 0x13, 0xbd, 0x55, 0x51, 0x84, 0x06, 0x00, 0x00,
+ // 792 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcf, 0x6f, 0x1b, 0x45,
+ 0x14, 0xc7, 0xbd, 0x89, 0x9b, 0x26, 0x6f, 0x1d, 0x27, 0x5d, 0x5a, 0xba, 0x38, 0xc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x9f, 0x2f, 0xdb, 0xb5, 0x57, 0x97, 0xed, 0xda, 0x5f, 0x97,
+ 0xed, 0xda, 0xb3, 0xc1, 0x9a, 0x11, 0xb2, 0xd6, 0x8f, 0xe8, 0x14, 0x83, 0xf2, 0x14, 0x83, 0x65,
+ 0xf5, 0x20, 0xe7, 0xae, 0x98, 0x6c, 0xd1, 0xbb, 0xfc, 0xf9, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff,
+ 0x7f, 0x57, 0xd8, 0xba, 0x11, 0x06, 0x00, 0x00,
}
func (m *CoreParamsList) Marshal() (dAtA []byte, err error) {
diff --git a/x/observer/types/permission_flags.pb.go b/x/observer/types/permission_flags.pb.go
deleted file mode 100644
index f4b2018b6b..0000000000
--- a/x/observer/types/permission_flags.pb.go
+++ /dev/null
@@ -1,349 +0,0 @@
-// Code generated by protoc-gen-gogo. DO NOT EDIT.
-// source: observer/permission_flags.proto
-
-package types
-
-import (
- fmt "fmt"
- io "io"
- math "math"
- math_bits "math/bits"
-
- proto "github.com/gogo/protobuf/proto"
-)
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
-
-type PermissionFlags struct {
- IsInboundEnabled bool `protobuf:"varint,1,opt,name=isInboundEnabled,proto3" json:"isInboundEnabled,omitempty"`
- IsOutboundEnabled bool `protobuf:"varint,2,opt,name=isOutboundEnabled,proto3" json:"isOutboundEnabled,omitempty"`
-}
-
-func (m *PermissionFlags) Reset() { *m = PermissionFlags{} }
-func (m *PermissionFlags) String() string { return proto.CompactTextString(m) }
-func (*PermissionFlags) ProtoMessage() {}
-func (*PermissionFlags) Descriptor() ([]byte, []int) {
- return fileDescriptor_8446525bc61c77b9, []int{0}
-}
-func (m *PermissionFlags) XXX_Unmarshal(b []byte) error {
- return m.Unmarshal(b)
-}
-func (m *PermissionFlags) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- if deterministic {
- return xxx_messageInfo_PermissionFlags.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 *PermissionFlags) XXX_Merge(src proto.Message) {
- xxx_messageInfo_PermissionFlags.Merge(m, src)
-}
-func (m *PermissionFlags) XXX_Size() int {
- return m.Size()
-}
-func (m *PermissionFlags) XXX_DiscardUnknown() {
- xxx_messageInfo_PermissionFlags.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_PermissionFlags proto.InternalMessageInfo
-
-func (m *PermissionFlags) GetIsInboundEnabled() bool {
- if m != nil {
- return m.IsInboundEnabled
- }
- return false
-}
-
-func (m *PermissionFlags) GetIsOutboundEnabled() bool {
- if m != nil {
- return m.IsOutboundEnabled
- }
- return false
-}
-
-func init() {
- proto.RegisterType((*PermissionFlags)(nil), "zetachain.zetacore.observer.PermissionFlags")
-}
-
-func init() { proto.RegisterFile("observer/permission_flags.proto", fileDescriptor_8446525bc61c77b9) }
-
-var fileDescriptor_8446525bc61c77b9 = []byte{
- // 197 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcf, 0x4f, 0x2a, 0x4e,
- 0x2d, 0x2a, 0x4b, 0x2d, 0xd2, 0x2f, 0x48, 0x2d, 0xca, 0xcd, 0x2c, 0x2e, 0xce, 0xcc, 0xcf, 0x8b,
- 0x4f, 0xcb, 0x49, 0x4c, 0x2f, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0xae, 0x4a, 0x2d,
- 0x49, 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x03, 0xb3, 0xf2, 0x8b, 0x52, 0xf5, 0x60, 0x7a, 0x94,
- 0xb2, 0xb9, 0xf8, 0x03, 0xe0, 0xda, 0xdc, 0x40, 0xba, 0x84, 0xb4, 0xb8, 0x04, 0x32, 0x8b, 0x3d,
- 0xf3, 0x92, 0xf2, 0x4b, 0xf3, 0x52, 0x5c, 0xf3, 0x12, 0x93, 0x72, 0x52, 0x53, 0x24, 0x18, 0x15,
- 0x18, 0x35, 0x38, 0x82, 0x30, 0xc4, 0x85, 0x74, 0xb8, 0x04, 0x33, 0x8b, 0xfd, 0x4b, 0x4b, 0x50,
- 0x14, 0x33, 0x81, 0x15, 0x63, 0x4a, 0x38, 0x79, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c,
- 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1,
- 0x1c, 0x43, 0x94, 0x7e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0xc8,
- 0x91, 0xba, 0x60, 0xf7, 0xea, 0xc3, 0xdc, 0xab, 0x5f, 0xa1, 0x0f, 0xf7, 0x65, 0x49, 0x65, 0x41,
- 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0x6f, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x62, 0x92, 0x8b,
- 0x22, 0xfe, 0x00, 0x00, 0x00,
-}
-
-func (m *PermissionFlags) 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 *PermissionFlags) MarshalTo(dAtA []byte) (int, error) {
- size := m.Size()
- return m.MarshalToSizedBuffer(dAtA[:size])
-}
-
-func (m *PermissionFlags) MarshalToSizedBuffer(dAtA []byte) (int, error) {
- i := len(dAtA)
- _ = i
- var l int
- _ = l
- if m.IsOutboundEnabled {
- i--
- if m.IsOutboundEnabled {
- dAtA[i] = 1
- } else {
- dAtA[i] = 0
- }
- i--
- dAtA[i] = 0x10
- }
- if m.IsInboundEnabled {
- i--
- if m.IsInboundEnabled {
- dAtA[i] = 1
- } else {
- dAtA[i] = 0
- }
- i--
- dAtA[i] = 0x8
- }
- return len(dAtA) - i, nil
-}
-
-func encodeVarintPermissionFlags(dAtA []byte, offset int, v uint64) int {
- offset -= sovPermissionFlags(v)
- base := offset
- for v >= 1<<7 {
- dAtA[offset] = uint8(v&0x7f | 0x80)
- v >>= 7
- offset++
- }
- dAtA[offset] = uint8(v)
- return base
-}
-func (m *PermissionFlags) Size() (n int) {
- if m == nil {
- return 0
- }
- var l int
- _ = l
- if m.IsInboundEnabled {
- n += 2
- }
- if m.IsOutboundEnabled {
- n += 2
- }
- return n
-}
-
-func sovPermissionFlags(x uint64) (n int) {
- return (math_bits.Len64(x|1) + 6) / 7
-}
-func sozPermissionFlags(x uint64) (n int) {
- return sovPermissionFlags(uint64((x << 1) ^ uint64((int64(x) >> 63))))
-}
-func (m *PermissionFlags) 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 ErrIntOverflowPermissionFlags
- }
- 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: PermissionFlags: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: PermissionFlags: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field IsInboundEnabled", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowPermissionFlags
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- v |= int(b&0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.IsInboundEnabled = bool(v != 0)
- case 2:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field IsOutboundEnabled", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowPermissionFlags
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- v |= int(b&0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.IsOutboundEnabled = bool(v != 0)
- default:
- iNdEx = preIndex
- skippy, err := skipPermissionFlags(dAtA[iNdEx:])
- if err != nil {
- return err
- }
- if (skippy < 0) || (iNdEx+skippy) < 0 {
- return ErrInvalidLengthPermissionFlags
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func skipPermissionFlags(dAtA []byte) (n int, err error) {
- l := len(dAtA)
- iNdEx := 0
- depth := 0
- for iNdEx < l {
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowPermissionFlags
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- wireType := int(wire & 0x7)
- switch wireType {
- case 0:
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowPermissionFlags
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- iNdEx++
- if dAtA[iNdEx-1] < 0x80 {
- break
- }
- }
- case 1:
- iNdEx += 8
- case 2:
- var length int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowPermissionFlags
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- length |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if length < 0 {
- return 0, ErrInvalidLengthPermissionFlags
- }
- iNdEx += length
- case 3:
- depth++
- case 4:
- if depth == 0 {
- return 0, ErrUnexpectedEndOfGroupPermissionFlags
- }
- depth--
- case 5:
- iNdEx += 4
- default:
- return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
- }
- if iNdEx < 0 {
- return 0, ErrInvalidLengthPermissionFlags
- }
- if depth == 0 {
- return iNdEx, nil
- }
- }
- return 0, io.ErrUnexpectedEOF
-}
-
-var (
- ErrInvalidLengthPermissionFlags = fmt.Errorf("proto: negative length found during unmarshaling")
- ErrIntOverflowPermissionFlags = fmt.Errorf("proto: integer overflow")
- ErrUnexpectedEndOfGroupPermissionFlags = fmt.Errorf("proto: unexpected end of group")
-)
diff --git a/x/observer/types/query.pb.go b/x/observer/types/query.pb.go
index 7bc6e87576..6917312022 100644
--- a/x/observer/types/query.pb.go
+++ b/x/observer/types/query.pb.go
@@ -32,6 +32,126 @@ var _ = math.Inf
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
+type QueryProveRequest struct {
+ ChainId uint64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
+ TxHash string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"`
+ Proof *common.Proof `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof,omitempty"`
+ BlockHash string `protobuf:"bytes,4,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`
+ TxIndex int64 `protobuf:"varint,5,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"`
+}
+
+func (m *QueryProveRequest) Reset() { *m = QueryProveRequest{} }
+func (m *QueryProveRequest) String() string { return proto.CompactTextString(m) }
+func (*QueryProveRequest) ProtoMessage() {}
+func (*QueryProveRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_dcb801e455adaee4, []int{0}
+}
+func (m *QueryProveRequest) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *QueryProveRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_QueryProveRequest.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 *QueryProveRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryProveRequest.Merge(m, src)
+}
+func (m *QueryProveRequest) XXX_Size() int {
+ return m.Size()
+}
+func (m *QueryProveRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryProveRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_QueryProveRequest proto.InternalMessageInfo
+
+func (m *QueryProveRequest) GetChainId() uint64 {
+ if m != nil {
+ return m.ChainId
+ }
+ return 0
+}
+
+func (m *QueryProveRequest) GetTxHash() string {
+ if m != nil {
+ return m.TxHash
+ }
+ return ""
+}
+
+func (m *QueryProveRequest) GetProof() *common.Proof {
+ if m != nil {
+ return m.Proof
+ }
+ return nil
+}
+
+func (m *QueryProveRequest) GetBlockHash() string {
+ if m != nil {
+ return m.BlockHash
+ }
+ return ""
+}
+
+func (m *QueryProveRequest) GetTxIndex() int64 {
+ if m != nil {
+ return m.TxIndex
+ }
+ return 0
+}
+
+type QueryProveResponse struct {
+ Valid bool `protobuf:"varint,1,opt,name=valid,proto3" json:"valid,omitempty"`
+}
+
+func (m *QueryProveResponse) Reset() { *m = QueryProveResponse{} }
+func (m *QueryProveResponse) String() string { return proto.CompactTextString(m) }
+func (*QueryProveResponse) ProtoMessage() {}
+func (*QueryProveResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor_dcb801e455adaee4, []int{1}
+}
+func (m *QueryProveResponse) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *QueryProveResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_QueryProveResponse.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 *QueryProveResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryProveResponse.Merge(m, src)
+}
+func (m *QueryProveResponse) XXX_Size() int {
+ return m.Size()
+}
+func (m *QueryProveResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryProveResponse.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_QueryProveResponse proto.InternalMessageInfo
+
+func (m *QueryProveResponse) GetValid() bool {
+ if m != nil {
+ return m.Valid
+ }
+ return false
+}
+
type QueryParamsRequest struct {
}
@@ -39,7 +159,7 @@ func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} }
func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryParamsRequest) ProtoMessage() {}
func (*QueryParamsRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{0}
+ return fileDescriptor_dcb801e455adaee4, []int{2}
}
func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -78,7 +198,7 @@ func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} }
func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryParamsResponse) ProtoMessage() {}
func (*QueryParamsResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{1}
+ return fileDescriptor_dcb801e455adaee4, []int{3}
}
func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -122,7 +242,7 @@ func (m *QueryBallotByIdentifierRequest) Reset() { *m = QueryBallotByIde
func (m *QueryBallotByIdentifierRequest) String() string { return proto.CompactTextString(m) }
func (*QueryBallotByIdentifierRequest) ProtoMessage() {}
func (*QueryBallotByIdentifierRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{2}
+ return fileDescriptor_dcb801e455adaee4, []int{4}
}
func (m *QueryBallotByIdentifierRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -167,7 +287,7 @@ func (m *VoterList) Reset() { *m = VoterList{} }
func (m *VoterList) String() string { return proto.CompactTextString(m) }
func (*VoterList) ProtoMessage() {}
func (*VoterList) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{3}
+ return fileDescriptor_dcb801e455adaee4, []int{5}
}
func (m *VoterList) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -221,7 +341,7 @@ func (m *QueryBallotByIdentifierResponse) Reset() { *m = QueryBallotById
func (m *QueryBallotByIdentifierResponse) String() string { return proto.CompactTextString(m) }
func (*QueryBallotByIdentifierResponse) ProtoMessage() {}
func (*QueryBallotByIdentifierResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{4}
+ return fileDescriptor_dcb801e455adaee4, []int{6}
}
func (m *QueryBallotByIdentifierResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -286,7 +406,7 @@ func (m *QueryObserversByChainRequest) Reset() { *m = QueryObserversByCh
func (m *QueryObserversByChainRequest) String() string { return proto.CompactTextString(m) }
func (*QueryObserversByChainRequest) ProtoMessage() {}
func (*QueryObserversByChainRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{5}
+ return fileDescriptor_dcb801e455adaee4, []int{7}
}
func (m *QueryObserversByChainRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -330,7 +450,7 @@ func (m *QueryObserversByChainResponse) Reset() { *m = QueryObserversByC
func (m *QueryObserversByChainResponse) String() string { return proto.CompactTextString(m) }
func (*QueryObserversByChainResponse) ProtoMessage() {}
func (*QueryObserversByChainResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{6}
+ return fileDescriptor_dcb801e455adaee4, []int{8}
}
func (m *QueryObserversByChainResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -373,7 +493,7 @@ func (m *QueryAllObserverMappersRequest) Reset() { *m = QueryAllObserver
func (m *QueryAllObserverMappersRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllObserverMappersRequest) ProtoMessage() {}
func (*QueryAllObserverMappersRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{7}
+ return fileDescriptor_dcb801e455adaee4, []int{9}
}
func (m *QueryAllObserverMappersRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -410,7 +530,7 @@ func (m *QueryAllObserverMappersResponse) Reset() { *m = QueryAllObserve
func (m *QueryAllObserverMappersResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllObserverMappersResponse) ProtoMessage() {}
func (*QueryAllObserverMappersResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{8}
+ return fileDescriptor_dcb801e455adaee4, []int{10}
}
func (m *QueryAllObserverMappersResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -453,7 +573,7 @@ func (m *QuerySupportedChains) Reset() { *m = QuerySupportedChains{} }
func (m *QuerySupportedChains) String() string { return proto.CompactTextString(m) }
func (*QuerySupportedChains) ProtoMessage() {}
func (*QuerySupportedChains) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{9}
+ return fileDescriptor_dcb801e455adaee4, []int{11}
}
func (m *QuerySupportedChains) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -490,7 +610,7 @@ func (m *QuerySupportedChainsResponse) Reset() { *m = QuerySupportedChai
func (m *QuerySupportedChainsResponse) String() string { return proto.CompactTextString(m) }
func (*QuerySupportedChainsResponse) ProtoMessage() {}
func (*QuerySupportedChainsResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{10}
+ return fileDescriptor_dcb801e455adaee4, []int{12}
}
func (m *QuerySupportedChainsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -534,7 +654,7 @@ func (m *QueryGetCoreParamsForChainRequest) Reset() { *m = QueryGetCoreP
func (m *QueryGetCoreParamsForChainRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetCoreParamsForChainRequest) ProtoMessage() {}
func (*QueryGetCoreParamsForChainRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{11}
+ return fileDescriptor_dcb801e455adaee4, []int{13}
}
func (m *QueryGetCoreParamsForChainRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -578,7 +698,7 @@ func (m *QueryGetCoreParamsForChainResponse) Reset() { *m = QueryGetCore
func (m *QueryGetCoreParamsForChainResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetCoreParamsForChainResponse) ProtoMessage() {}
func (*QueryGetCoreParamsForChainResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{12}
+ return fileDescriptor_dcb801e455adaee4, []int{14}
}
func (m *QueryGetCoreParamsForChainResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -621,7 +741,7 @@ func (m *QueryGetCoreParamsRequest) Reset() { *m = QueryGetCoreParamsReq
func (m *QueryGetCoreParamsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetCoreParamsRequest) ProtoMessage() {}
func (*QueryGetCoreParamsRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{13}
+ return fileDescriptor_dcb801e455adaee4, []int{15}
}
func (m *QueryGetCoreParamsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -658,7 +778,7 @@ func (m *QueryGetCoreParamsResponse) Reset() { *m = QueryGetCoreParamsRe
func (m *QueryGetCoreParamsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetCoreParamsResponse) ProtoMessage() {}
func (*QueryGetCoreParamsResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{14}
+ return fileDescriptor_dcb801e455adaee4, []int{16}
}
func (m *QueryGetCoreParamsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -702,7 +822,7 @@ func (m *QueryGetNodeAccountRequest) Reset() { *m = QueryGetNodeAccountR
func (m *QueryGetNodeAccountRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetNodeAccountRequest) ProtoMessage() {}
func (*QueryGetNodeAccountRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{15}
+ return fileDescriptor_dcb801e455adaee4, []int{17}
}
func (m *QueryGetNodeAccountRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -746,7 +866,7 @@ func (m *QueryGetNodeAccountResponse) Reset() { *m = QueryGetNodeAccount
func (m *QueryGetNodeAccountResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetNodeAccountResponse) ProtoMessage() {}
func (*QueryGetNodeAccountResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{16}
+ return fileDescriptor_dcb801e455adaee4, []int{18}
}
func (m *QueryGetNodeAccountResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -790,7 +910,7 @@ func (m *QueryAllNodeAccountRequest) Reset() { *m = QueryAllNodeAccountR
func (m *QueryAllNodeAccountRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllNodeAccountRequest) ProtoMessage() {}
func (*QueryAllNodeAccountRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{17}
+ return fileDescriptor_dcb801e455adaee4, []int{19}
}
func (m *QueryAllNodeAccountRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -835,7 +955,7 @@ func (m *QueryAllNodeAccountResponse) Reset() { *m = QueryAllNodeAccount
func (m *QueryAllNodeAccountResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllNodeAccountResponse) ProtoMessage() {}
func (*QueryAllNodeAccountResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{18}
+ return fileDescriptor_dcb801e455adaee4, []int{20}
}
func (m *QueryAllNodeAccountResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -878,21 +998,21 @@ func (m *QueryAllNodeAccountResponse) GetPagination() *query.PageResponse {
return nil
}
-type QueryGetPermissionFlagsRequest struct {
+type QueryGetCrosschainFlagsRequest struct {
}
-func (m *QueryGetPermissionFlagsRequest) Reset() { *m = QueryGetPermissionFlagsRequest{} }
-func (m *QueryGetPermissionFlagsRequest) String() string { return proto.CompactTextString(m) }
-func (*QueryGetPermissionFlagsRequest) ProtoMessage() {}
-func (*QueryGetPermissionFlagsRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{19}
+func (m *QueryGetCrosschainFlagsRequest) Reset() { *m = QueryGetCrosschainFlagsRequest{} }
+func (m *QueryGetCrosschainFlagsRequest) String() string { return proto.CompactTextString(m) }
+func (*QueryGetCrosschainFlagsRequest) ProtoMessage() {}
+func (*QueryGetCrosschainFlagsRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_dcb801e455adaee4, []int{21}
}
-func (m *QueryGetPermissionFlagsRequest) XXX_Unmarshal(b []byte) error {
+func (m *QueryGetCrosschainFlagsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
-func (m *QueryGetPermissionFlagsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+func (m *QueryGetCrosschainFlagsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
- return xxx_messageInfo_QueryGetPermissionFlagsRequest.Marshal(b, m, deterministic)
+ return xxx_messageInfo_QueryGetCrosschainFlagsRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
@@ -902,34 +1022,34 @@ func (m *QueryGetPermissionFlagsRequest) XXX_Marshal(b []byte, deterministic boo
return b[:n], nil
}
}
-func (m *QueryGetPermissionFlagsRequest) XXX_Merge(src proto.Message) {
- xxx_messageInfo_QueryGetPermissionFlagsRequest.Merge(m, src)
+func (m *QueryGetCrosschainFlagsRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryGetCrosschainFlagsRequest.Merge(m, src)
}
-func (m *QueryGetPermissionFlagsRequest) XXX_Size() int {
+func (m *QueryGetCrosschainFlagsRequest) XXX_Size() int {
return m.Size()
}
-func (m *QueryGetPermissionFlagsRequest) XXX_DiscardUnknown() {
- xxx_messageInfo_QueryGetPermissionFlagsRequest.DiscardUnknown(m)
+func (m *QueryGetCrosschainFlagsRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryGetCrosschainFlagsRequest.DiscardUnknown(m)
}
-var xxx_messageInfo_QueryGetPermissionFlagsRequest proto.InternalMessageInfo
+var xxx_messageInfo_QueryGetCrosschainFlagsRequest proto.InternalMessageInfo
-type QueryGetPermissionFlagsResponse struct {
- PermissionFlags PermissionFlags `protobuf:"bytes,1,opt,name=permission_flags,json=permissionFlags,proto3" json:"permission_flags"`
+type QueryGetCrosschainFlagsResponse struct {
+ CrosschainFlags CrosschainFlags `protobuf:"bytes,1,opt,name=crosschain_flags,json=crosschainFlags,proto3" json:"crosschain_flags"`
}
-func (m *QueryGetPermissionFlagsResponse) Reset() { *m = QueryGetPermissionFlagsResponse{} }
-func (m *QueryGetPermissionFlagsResponse) String() string { return proto.CompactTextString(m) }
-func (*QueryGetPermissionFlagsResponse) ProtoMessage() {}
-func (*QueryGetPermissionFlagsResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{20}
+func (m *QueryGetCrosschainFlagsResponse) Reset() { *m = QueryGetCrosschainFlagsResponse{} }
+func (m *QueryGetCrosschainFlagsResponse) String() string { return proto.CompactTextString(m) }
+func (*QueryGetCrosschainFlagsResponse) ProtoMessage() {}
+func (*QueryGetCrosschainFlagsResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor_dcb801e455adaee4, []int{22}
}
-func (m *QueryGetPermissionFlagsResponse) XXX_Unmarshal(b []byte) error {
+func (m *QueryGetCrosschainFlagsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
-func (m *QueryGetPermissionFlagsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+func (m *QueryGetCrosschainFlagsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
- return xxx_messageInfo_QueryGetPermissionFlagsResponse.Marshal(b, m, deterministic)
+ return xxx_messageInfo_QueryGetCrosschainFlagsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
@@ -939,23 +1059,23 @@ func (m *QueryGetPermissionFlagsResponse) XXX_Marshal(b []byte, deterministic bo
return b[:n], nil
}
}
-func (m *QueryGetPermissionFlagsResponse) XXX_Merge(src proto.Message) {
- xxx_messageInfo_QueryGetPermissionFlagsResponse.Merge(m, src)
+func (m *QueryGetCrosschainFlagsResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryGetCrosschainFlagsResponse.Merge(m, src)
}
-func (m *QueryGetPermissionFlagsResponse) XXX_Size() int {
+func (m *QueryGetCrosschainFlagsResponse) XXX_Size() int {
return m.Size()
}
-func (m *QueryGetPermissionFlagsResponse) XXX_DiscardUnknown() {
- xxx_messageInfo_QueryGetPermissionFlagsResponse.DiscardUnknown(m)
+func (m *QueryGetCrosschainFlagsResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryGetCrosschainFlagsResponse.DiscardUnknown(m)
}
-var xxx_messageInfo_QueryGetPermissionFlagsResponse proto.InternalMessageInfo
+var xxx_messageInfo_QueryGetCrosschainFlagsResponse proto.InternalMessageInfo
-func (m *QueryGetPermissionFlagsResponse) GetPermissionFlags() PermissionFlags {
+func (m *QueryGetCrosschainFlagsResponse) GetCrosschainFlags() CrosschainFlags {
if m != nil {
- return m.PermissionFlags
+ return m.CrosschainFlags
}
- return PermissionFlags{}
+ return CrosschainFlags{}
}
type QueryGetKeygenRequest struct {
@@ -965,7 +1085,7 @@ func (m *QueryGetKeygenRequest) Reset() { *m = QueryGetKeygenRequest{} }
func (m *QueryGetKeygenRequest) String() string { return proto.CompactTextString(m) }
func (*QueryGetKeygenRequest) ProtoMessage() {}
func (*QueryGetKeygenRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{21}
+ return fileDescriptor_dcb801e455adaee4, []int{23}
}
func (m *QueryGetKeygenRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1002,7 +1122,7 @@ func (m *QueryGetKeygenResponse) Reset() { *m = QueryGetKeygenResponse{}
func (m *QueryGetKeygenResponse) String() string { return proto.CompactTextString(m) }
func (*QueryGetKeygenResponse) ProtoMessage() {}
func (*QueryGetKeygenResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{22}
+ return fileDescriptor_dcb801e455adaee4, []int{24}
}
func (m *QueryGetKeygenResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1045,7 +1165,7 @@ func (m *QueryShowObserverCountRequest) Reset() { *m = QueryShowObserver
func (m *QueryShowObserverCountRequest) String() string { return proto.CompactTextString(m) }
func (*QueryShowObserverCountRequest) ProtoMessage() {}
func (*QueryShowObserverCountRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{23}
+ return fileDescriptor_dcb801e455adaee4, []int{25}
}
func (m *QueryShowObserverCountRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1082,7 +1202,7 @@ func (m *QueryShowObserverCountResponse) Reset() { *m = QueryShowObserve
func (m *QueryShowObserverCountResponse) String() string { return proto.CompactTextString(m) }
func (*QueryShowObserverCountResponse) ProtoMessage() {}
func (*QueryShowObserverCountResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{24}
+ return fileDescriptor_dcb801e455adaee4, []int{26}
}
func (m *QueryShowObserverCountResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1126,7 +1246,7 @@ func (m *QueryBlameByIdentifierRequest) Reset() { *m = QueryBlameByIdent
func (m *QueryBlameByIdentifierRequest) String() string { return proto.CompactTextString(m) }
func (*QueryBlameByIdentifierRequest) ProtoMessage() {}
func (*QueryBlameByIdentifierRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{25}
+ return fileDescriptor_dcb801e455adaee4, []int{27}
}
func (m *QueryBlameByIdentifierRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1170,7 +1290,7 @@ func (m *QueryBlameByIdentifierResponse) Reset() { *m = QueryBlameByIden
func (m *QueryBlameByIdentifierResponse) String() string { return proto.CompactTextString(m) }
func (*QueryBlameByIdentifierResponse) ProtoMessage() {}
func (*QueryBlameByIdentifierResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{26}
+ return fileDescriptor_dcb801e455adaee4, []int{28}
}
func (m *QueryBlameByIdentifierResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1213,7 +1333,7 @@ func (m *QueryAllBlameRecordsRequest) Reset() { *m = QueryAllBlameRecord
func (m *QueryAllBlameRecordsRequest) String() string { return proto.CompactTextString(m) }
func (*QueryAllBlameRecordsRequest) ProtoMessage() {}
func (*QueryAllBlameRecordsRequest) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{27}
+ return fileDescriptor_dcb801e455adaee4, []int{29}
}
func (m *QueryAllBlameRecordsRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1250,7 +1370,7 @@ func (m *QueryAllBlameRecordsResponse) Reset() { *m = QueryAllBlameRecor
func (m *QueryAllBlameRecordsResponse) String() string { return proto.CompactTextString(m) }
func (*QueryAllBlameRecordsResponse) ProtoMessage() {}
func (*QueryAllBlameRecordsResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_dcb801e455adaee4, []int{28}
+ return fileDescriptor_dcb801e455adaee4, []int{30}
}
func (m *QueryAllBlameRecordsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1286,7 +1406,193 @@ func (m *QueryAllBlameRecordsResponse) GetBlameInfo() []*Blame {
return nil
}
+type QueryAllBlockHeaderRequest struct {
+ Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"`
+}
+
+func (m *QueryAllBlockHeaderRequest) Reset() { *m = QueryAllBlockHeaderRequest{} }
+func (m *QueryAllBlockHeaderRequest) String() string { return proto.CompactTextString(m) }
+func (*QueryAllBlockHeaderRequest) ProtoMessage() {}
+func (*QueryAllBlockHeaderRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_dcb801e455adaee4, []int{31}
+}
+func (m *QueryAllBlockHeaderRequest) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *QueryAllBlockHeaderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_QueryAllBlockHeaderRequest.Marshal(b, m, deterministic)
+ } else {
+ b = b[:cap(b)]
+ n, err := m.MarshalToSizedBuffer(b)
+ if err != nil {
+ return nil, err
+ }
+ return b[:n], nil
+ }
+}
+func (m *QueryAllBlockHeaderRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryAllBlockHeaderRequest.Merge(m, src)
+}
+func (m *QueryAllBlockHeaderRequest) XXX_Size() int {
+ return m.Size()
+}
+func (m *QueryAllBlockHeaderRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryAllBlockHeaderRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_QueryAllBlockHeaderRequest proto.InternalMessageInfo
+
+func (m *QueryAllBlockHeaderRequest) GetPagination() *query.PageRequest {
+ if m != nil {
+ return m.Pagination
+ }
+ return nil
+}
+
+type QueryAllBlockHeaderResponse struct {
+ BlockHeaders []*common.BlockHeader `protobuf:"bytes,1,rep,name=block_headers,json=blockHeaders,proto3" json:"block_headers,omitempty"`
+ Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
+}
+
+func (m *QueryAllBlockHeaderResponse) Reset() { *m = QueryAllBlockHeaderResponse{} }
+func (m *QueryAllBlockHeaderResponse) String() string { return proto.CompactTextString(m) }
+func (*QueryAllBlockHeaderResponse) ProtoMessage() {}
+func (*QueryAllBlockHeaderResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor_dcb801e455adaee4, []int{32}
+}
+func (m *QueryAllBlockHeaderResponse) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *QueryAllBlockHeaderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_QueryAllBlockHeaderResponse.Marshal(b, m, deterministic)
+ } else {
+ b = b[:cap(b)]
+ n, err := m.MarshalToSizedBuffer(b)
+ if err != nil {
+ return nil, err
+ }
+ return b[:n], nil
+ }
+}
+func (m *QueryAllBlockHeaderResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryAllBlockHeaderResponse.Merge(m, src)
+}
+func (m *QueryAllBlockHeaderResponse) XXX_Size() int {
+ return m.Size()
+}
+func (m *QueryAllBlockHeaderResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryAllBlockHeaderResponse.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_QueryAllBlockHeaderResponse proto.InternalMessageInfo
+
+func (m *QueryAllBlockHeaderResponse) GetBlockHeaders() []*common.BlockHeader {
+ if m != nil {
+ return m.BlockHeaders
+ }
+ return nil
+}
+
+func (m *QueryAllBlockHeaderResponse) GetPagination() *query.PageResponse {
+ if m != nil {
+ return m.Pagination
+ }
+ return nil
+}
+
+type QueryGetBlockHeaderByHashRequest struct {
+ BlockHash []byte `protobuf:"bytes,1,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`
+}
+
+func (m *QueryGetBlockHeaderByHashRequest) Reset() { *m = QueryGetBlockHeaderByHashRequest{} }
+func (m *QueryGetBlockHeaderByHashRequest) String() string { return proto.CompactTextString(m) }
+func (*QueryGetBlockHeaderByHashRequest) ProtoMessage() {}
+func (*QueryGetBlockHeaderByHashRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_dcb801e455adaee4, []int{33}
+}
+func (m *QueryGetBlockHeaderByHashRequest) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *QueryGetBlockHeaderByHashRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_QueryGetBlockHeaderByHashRequest.Marshal(b, m, deterministic)
+ } else {
+ b = b[:cap(b)]
+ n, err := m.MarshalToSizedBuffer(b)
+ if err != nil {
+ return nil, err
+ }
+ return b[:n], nil
+ }
+}
+func (m *QueryGetBlockHeaderByHashRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryGetBlockHeaderByHashRequest.Merge(m, src)
+}
+func (m *QueryGetBlockHeaderByHashRequest) XXX_Size() int {
+ return m.Size()
+}
+func (m *QueryGetBlockHeaderByHashRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryGetBlockHeaderByHashRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_QueryGetBlockHeaderByHashRequest proto.InternalMessageInfo
+
+func (m *QueryGetBlockHeaderByHashRequest) GetBlockHash() []byte {
+ if m != nil {
+ return m.BlockHash
+ }
+ return nil
+}
+
+type QueryGetBlockHeaderByHashResponse struct {
+ BlockHeader *common.BlockHeader `protobuf:"bytes,1,opt,name=block_header,json=blockHeader,proto3" json:"block_header,omitempty"`
+}
+
+func (m *QueryGetBlockHeaderByHashResponse) Reset() { *m = QueryGetBlockHeaderByHashResponse{} }
+func (m *QueryGetBlockHeaderByHashResponse) String() string { return proto.CompactTextString(m) }
+func (*QueryGetBlockHeaderByHashResponse) ProtoMessage() {}
+func (*QueryGetBlockHeaderByHashResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor_dcb801e455adaee4, []int{34}
+}
+func (m *QueryGetBlockHeaderByHashResponse) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *QueryGetBlockHeaderByHashResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_QueryGetBlockHeaderByHashResponse.Marshal(b, m, deterministic)
+ } else {
+ b = b[:cap(b)]
+ n, err := m.MarshalToSizedBuffer(b)
+ if err != nil {
+ return nil, err
+ }
+ return b[:n], nil
+ }
+}
+func (m *QueryGetBlockHeaderByHashResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_QueryGetBlockHeaderByHashResponse.Merge(m, src)
+}
+func (m *QueryGetBlockHeaderByHashResponse) XXX_Size() int {
+ return m.Size()
+}
+func (m *QueryGetBlockHeaderByHashResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_QueryGetBlockHeaderByHashResponse.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_QueryGetBlockHeaderByHashResponse proto.InternalMessageInfo
+
+func (m *QueryGetBlockHeaderByHashResponse) GetBlockHeader() *common.BlockHeader {
+ if m != nil {
+ return m.BlockHeader
+ }
+ return nil
+}
+
func init() {
+ proto.RegisterType((*QueryProveRequest)(nil), "zetachain.zetacore.observer.QueryProveRequest")
+ proto.RegisterType((*QueryProveResponse)(nil), "zetachain.zetacore.observer.QueryProveResponse")
proto.RegisterType((*QueryParamsRequest)(nil), "zetachain.zetacore.observer.QueryParamsRequest")
proto.RegisterType((*QueryParamsResponse)(nil), "zetachain.zetacore.observer.QueryParamsResponse")
proto.RegisterType((*QueryBallotByIdentifierRequest)(nil), "zetachain.zetacore.observer.QueryBallotByIdentifierRequest")
@@ -1306,8 +1612,8 @@ func init() {
proto.RegisterType((*QueryGetNodeAccountResponse)(nil), "zetachain.zetacore.observer.QueryGetNodeAccountResponse")
proto.RegisterType((*QueryAllNodeAccountRequest)(nil), "zetachain.zetacore.observer.QueryAllNodeAccountRequest")
proto.RegisterType((*QueryAllNodeAccountResponse)(nil), "zetachain.zetacore.observer.QueryAllNodeAccountResponse")
- proto.RegisterType((*QueryGetPermissionFlagsRequest)(nil), "zetachain.zetacore.observer.QueryGetPermissionFlagsRequest")
- proto.RegisterType((*QueryGetPermissionFlagsResponse)(nil), "zetachain.zetacore.observer.QueryGetPermissionFlagsResponse")
+ proto.RegisterType((*QueryGetCrosschainFlagsRequest)(nil), "zetachain.zetacore.observer.QueryGetCrosschainFlagsRequest")
+ proto.RegisterType((*QueryGetCrosschainFlagsResponse)(nil), "zetachain.zetacore.observer.QueryGetCrosschainFlagsResponse")
proto.RegisterType((*QueryGetKeygenRequest)(nil), "zetachain.zetacore.observer.QueryGetKeygenRequest")
proto.RegisterType((*QueryGetKeygenResponse)(nil), "zetachain.zetacore.observer.QueryGetKeygenResponse")
proto.RegisterType((*QueryShowObserverCountRequest)(nil), "zetachain.zetacore.observer.QueryShowObserverCountRequest")
@@ -1316,107 +1622,129 @@ func init() {
proto.RegisterType((*QueryBlameByIdentifierResponse)(nil), "zetachain.zetacore.observer.QueryBlameByIdentifierResponse")
proto.RegisterType((*QueryAllBlameRecordsRequest)(nil), "zetachain.zetacore.observer.QueryAllBlameRecordsRequest")
proto.RegisterType((*QueryAllBlameRecordsResponse)(nil), "zetachain.zetacore.observer.QueryAllBlameRecordsResponse")
+ proto.RegisterType((*QueryAllBlockHeaderRequest)(nil), "zetachain.zetacore.observer.QueryAllBlockHeaderRequest")
+ proto.RegisterType((*QueryAllBlockHeaderResponse)(nil), "zetachain.zetacore.observer.QueryAllBlockHeaderResponse")
+ proto.RegisterType((*QueryGetBlockHeaderByHashRequest)(nil), "zetachain.zetacore.observer.QueryGetBlockHeaderByHashRequest")
+ proto.RegisterType((*QueryGetBlockHeaderByHashResponse)(nil), "zetachain.zetacore.observer.QueryGetBlockHeaderByHashResponse")
}
func init() { proto.RegisterFile("observer/query.proto", fileDescriptor_dcb801e455adaee4) }
var fileDescriptor_dcb801e455adaee4 = []byte{
- // 1507 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0x5f, 0x6f, 0x13, 0xc7,
- 0x16, 0xcf, 0x26, 0xe0, 0x4b, 0x4e, 0x08, 0x49, 0x86, 0x00, 0xc1, 0x01, 0x27, 0x77, 0xb8, 0x80,
- 0x21, 0xe0, 0x25, 0x46, 0xba, 0xf7, 0xd2, 0x14, 0x50, 0x1c, 0x41, 0xca, 0x7f, 0x6a, 0x5a, 0x5a,
- 0x55, 0x6a, 0xad, 0xb5, 0x3d, 0x71, 0x96, 0xae, 0x77, 0x96, 0xdd, 0x4d, 0xc0, 0x45, 0x91, 0xaa,
- 0x7e, 0x02, 0xa4, 0x4a, 0xfd, 0x16, 0xed, 0x03, 0x2f, 0x7d, 0xa8, 0xfa, 0xd2, 0x97, 0xf2, 0x54,
- 0x51, 0x55, 0xaa, 0xfa, 0xd2, 0xaa, 0x02, 0x3e, 0x48, 0xb5, 0x33, 0x67, 0xd7, 0xeb, 0xfd, 0x63,
- 0xaf, 0xf3, 0xe4, 0xdd, 0x99, 0xf9, 0x9d, 0xf3, 0x3b, 0x67, 0xce, 0x9e, 0xf3, 0x93, 0x61, 0x96,
- 0xd7, 0x1d, 0x66, 0x6f, 0x33, 0x5b, 0x7d, 0xbc, 0xc5, 0xec, 0x4e, 0xc9, 0xb2, 0xb9, 0xcb, 0xc9,
- 0x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x48,
- 0x52, 0x65, 0xe2, 0x80, 0x56, 0x28, 0xf5, 0x5b, 0x54, 0x31, 0x44, 0x34, 0xea, 0x0e, 0xf9, 0x51,
- 0x01, 0xb2, 0xce, 0xdc, 0x88, 0x10, 0x24, 0xd9, 0xbe, 0xb7, 0x04, 0x69, 0x99, 0x65, 0x48, 0xa5,
- 0xa8, 0x4e, 0x5a, 0x16, 0x01, 0x9d, 0x23, 0x67, 0x53, 0x7b, 0xa2, 0x37, 0x5d, 0x65, 0x0c, 0xb6,
- 0xc4, 0x56, 0x6e, 0xbc, 0x7c, 0x5d, 0x50, 0x5e, 0xbd, 0x2e, 0x28, 0x7f, 0xbf, 0x2e, 0x28, 0xcf,
- 0xdf, 0x14, 0x46, 0x5e, 0xbd, 0x29, 0x8c, 0xfc, 0xf1, 0xa6, 0x30, 0xf2, 0x89, 0xda, 0xd2, 0xdd,
- 0xcd, 0xad, 0x7a, 0xa9, 0xc1, 0xdb, 0x89, 0x57, 0xfd, 0xb4, 0x6b, 0xda, 0xed, 0x58, 0xcc, 0xa9,
- 0xe7, 0xc4, 0xff, 0x91, 0x17, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0x1f, 0xa0, 0x93, 0x43, 0xeb,
- 0x15, 0x00, 0x00,
+ // 1798 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x59, 0xcd, 0x4f, 0x1b, 0x49,
+ 0x16, 0xa7, 0x21, 0x38, 0xf0, 0x0c, 0x01, 0x0a, 0x92, 0x80, 0x01, 0xe3, 0x2d, 0x36, 0x89, 0x03,
+ 0x89, 0x1d, 0x1c, 0x29, 0x5f, 0x04, 0x22, 0x8c, 0xf2, 0x41, 0xbe, 0xd7, 0xd9, 0xcd, 0xae, 0x76,
+ 0xb5, 0x6b, 0xb5, 0xed, 0xc2, 0x38, 0x69, 0x5c, 0x4e, 0x77, 0x43, 0xf0, 0x46, 0x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 0xa9, 0x6f, 0xb4, 0x12, 0xea, 0x3a, 0x06, 0x09, 0xff, 0xd8, 0xea, 0x41,
+ 0xcd, 0x05, 0x97, 0x2c, 0xe3, 0x72, 0x15, 0x5d, 0x09, 0xe4, 0xa2, 0xf2, 0x70, 0x4e, 0x99, 0xf3,
+ 0xc2, 0x70, 0xce, 0x97, 0x7c, 0x6d, 0xec, 0xa3, 0x8f, 0x34, 0xe8, 0x67, 0xff, 0xa8, 0x47, 0xa9,
+ 0x10, 0x22, 0x5e, 0xf9, 0xe5, 0x21, 0x96, 0x0e, 0x3d, 0x5f, 0xc0, 0xc5, 0x0c, 0xee, 0x0c, 0x8a,
+ 0xf9, 0x6b, 0x7e, 0x67, 0x6e, 0x76, 0xe3, 0xcd, 0xbb, 0xb8, 0xf6, 0xf6, 0x5d, 0x5c, 0xfb, 0xed,
+ 0x5d, 0x5c, 0x7b, 0xf9, 0x3e, 0xde, 0xf3, 0xf6, 0x7d, 0xbc, 0xe7, 0xa7, 0xf7, 0xf1, 0x9e, 0x7f,
+ 0xa6, 0xcb, 0x15, 0x7b, 0x6b, 0xa7, 0xe0, 0xbc, 0x68, 0x7c, 0x73, 0xc2, 0x5e, 0xc3, 0x95, 0x5d,
+ 0xaf, 0x11, 0xab, 0x10, 0x61, 0x3f, 0x9b, 0x9c, 0xff, 0x23, 0x00, 0x00, 0xff, 0xff, 0x50, 0x87,
+ 0x71, 0x20, 0x92, 0x1a, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -1447,7 +1775,7 @@ type QueryClient interface {
NodeAccount(ctx context.Context, in *QueryGetNodeAccountRequest, opts ...grpc.CallOption) (*QueryGetNodeAccountResponse, error)
// Queries a list of nodeAccount items.
NodeAccountAll(ctx context.Context, in *QueryAllNodeAccountRequest, opts ...grpc.CallOption) (*QueryAllNodeAccountResponse, error)
- PermissionFlags(ctx context.Context, in *QueryGetPermissionFlagsRequest, opts ...grpc.CallOption) (*QueryGetPermissionFlagsResponse, error)
+ CrosschainFlags(ctx context.Context, in *QueryGetCrosschainFlagsRequest, opts ...grpc.CallOption) (*QueryGetCrosschainFlagsResponse, error)
// Queries a keygen by index.
Keygen(ctx context.Context, in *QueryGetKeygenRequest, opts ...grpc.CallOption) (*QueryGetKeygenResponse, error)
// Queries a list of ShowObserverCount items.
@@ -1456,6 +1784,10 @@ type QueryClient interface {
BlameByIdentifier(ctx context.Context, in *QueryBlameByIdentifierRequest, opts ...grpc.CallOption) (*QueryBlameByIdentifierResponse, error)
// Queries a list of VoterByIdentifier items.
GetAllBlameRecords(ctx context.Context, in *QueryAllBlameRecordsRequest, opts ...grpc.CallOption) (*QueryAllBlameRecordsResponse, error)
+ GetAllBlockHeaders(ctx context.Context, in *QueryAllBlockHeaderRequest, opts ...grpc.CallOption) (*QueryAllBlockHeaderResponse, error)
+ GetBlockHeaderByHash(ctx context.Context, in *QueryGetBlockHeaderByHashRequest, opts ...grpc.CallOption) (*QueryGetBlockHeaderByHashResponse, error)
+ // merkle proof verification
+ Prove(ctx context.Context, in *QueryProveRequest, opts ...grpc.CallOption) (*QueryProveResponse, error)
}
type queryClient struct {
@@ -1547,9 +1879,9 @@ func (c *queryClient) NodeAccountAll(ctx context.Context, in *QueryAllNodeAccoun
return out, nil
}
-func (c *queryClient) PermissionFlags(ctx context.Context, in *QueryGetPermissionFlagsRequest, opts ...grpc.CallOption) (*QueryGetPermissionFlagsResponse, error) {
- out := new(QueryGetPermissionFlagsResponse)
- err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/PermissionFlags", in, out, opts...)
+func (c *queryClient) CrosschainFlags(ctx context.Context, in *QueryGetCrosschainFlagsRequest, opts ...grpc.CallOption) (*QueryGetCrosschainFlagsResponse, error) {
+ out := new(QueryGetCrosschainFlagsResponse)
+ err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/CrosschainFlags", in, out, opts...)
if err != nil {
return nil, err
}
@@ -1592,25 +1924,52 @@ func (c *queryClient) GetAllBlameRecords(ctx context.Context, in *QueryAllBlameR
return out, nil
}
-// QueryServer is the server API for Query service.
-type QueryServer interface {
- // Parameters queries the parameters of the module.
- Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
- // Queries a list of VoterByIdentifier items.
- BallotByIdentifier(context.Context, *QueryBallotByIdentifierRequest) (*QueryBallotByIdentifierResponse, error)
- // Queries a list of ObserversByChainAndType items.
- ObserversByChain(context.Context, *QueryObserversByChainRequest) (*QueryObserversByChainResponse, error)
- AllObserverMappers(context.Context, *QueryAllObserverMappersRequest) (*QueryAllObserverMappersResponse, error)
- SupportedChains(context.Context, *QuerySupportedChains) (*QuerySupportedChainsResponse, error)
- // Queries a list of GetClientParamsForChain items.
- GetCoreParamsForChain(context.Context, *QueryGetCoreParamsForChainRequest) (*QueryGetCoreParamsForChainResponse, error)
- // Queries a list of GetCoreParams items.
- GetCoreParams(context.Context, *QueryGetCoreParamsRequest) (*QueryGetCoreParamsResponse, error)
- // Queries a nodeAccount by index.
- NodeAccount(context.Context, *QueryGetNodeAccountRequest) (*QueryGetNodeAccountResponse, error)
+func (c *queryClient) GetAllBlockHeaders(ctx context.Context, in *QueryAllBlockHeaderRequest, opts ...grpc.CallOption) (*QueryAllBlockHeaderResponse, error) {
+ out := new(QueryAllBlockHeaderResponse)
+ err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetAllBlockHeaders", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *queryClient) GetBlockHeaderByHash(ctx context.Context, in *QueryGetBlockHeaderByHashRequest, opts ...grpc.CallOption) (*QueryGetBlockHeaderByHashResponse, error) {
+ out := new(QueryGetBlockHeaderByHashResponse)
+ err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetBlockHeaderByHash", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *queryClient) Prove(ctx context.Context, in *QueryProveRequest, opts ...grpc.CallOption) (*QueryProveResponse, error) {
+ out := new(QueryProveResponse)
+ err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/Prove", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// QueryServer is the server API for Query service.
+type QueryServer interface {
+ // Parameters queries the parameters of the module.
+ Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
+ // Queries a list of VoterByIdentifier items.
+ BallotByIdentifier(context.Context, *QueryBallotByIdentifierRequest) (*QueryBallotByIdentifierResponse, error)
+ // Queries a list of ObserversByChainAndType items.
+ ObserversByChain(context.Context, *QueryObserversByChainRequest) (*QueryObserversByChainResponse, error)
+ AllObserverMappers(context.Context, *QueryAllObserverMappersRequest) (*QueryAllObserverMappersResponse, error)
+ SupportedChains(context.Context, *QuerySupportedChains) (*QuerySupportedChainsResponse, error)
+ // Queries a list of GetClientParamsForChain items.
+ GetCoreParamsForChain(context.Context, *QueryGetCoreParamsForChainRequest) (*QueryGetCoreParamsForChainResponse, error)
+ // Queries a list of GetCoreParams items.
+ GetCoreParams(context.Context, *QueryGetCoreParamsRequest) (*QueryGetCoreParamsResponse, error)
+ // Queries a nodeAccount by index.
+ NodeAccount(context.Context, *QueryGetNodeAccountRequest) (*QueryGetNodeAccountResponse, error)
// Queries a list of nodeAccount items.
NodeAccountAll(context.Context, *QueryAllNodeAccountRequest) (*QueryAllNodeAccountResponse, error)
- PermissionFlags(context.Context, *QueryGetPermissionFlagsRequest) (*QueryGetPermissionFlagsResponse, error)
+ CrosschainFlags(context.Context, *QueryGetCrosschainFlagsRequest) (*QueryGetCrosschainFlagsResponse, error)
// Queries a keygen by index.
Keygen(context.Context, *QueryGetKeygenRequest) (*QueryGetKeygenResponse, error)
// Queries a list of ShowObserverCount items.
@@ -1619,6 +1978,10 @@ type QueryServer interface {
BlameByIdentifier(context.Context, *QueryBlameByIdentifierRequest) (*QueryBlameByIdentifierResponse, error)
// Queries a list of VoterByIdentifier items.
GetAllBlameRecords(context.Context, *QueryAllBlameRecordsRequest) (*QueryAllBlameRecordsResponse, error)
+ GetAllBlockHeaders(context.Context, *QueryAllBlockHeaderRequest) (*QueryAllBlockHeaderResponse, error)
+ GetBlockHeaderByHash(context.Context, *QueryGetBlockHeaderByHashRequest) (*QueryGetBlockHeaderByHashResponse, error)
+ // merkle proof verification
+ Prove(context.Context, *QueryProveRequest) (*QueryProveResponse, error)
}
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
@@ -1652,8 +2015,8 @@ func (*UnimplementedQueryServer) NodeAccount(ctx context.Context, req *QueryGetN
func (*UnimplementedQueryServer) NodeAccountAll(ctx context.Context, req *QueryAllNodeAccountRequest) (*QueryAllNodeAccountResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method NodeAccountAll not implemented")
}
-func (*UnimplementedQueryServer) PermissionFlags(ctx context.Context, req *QueryGetPermissionFlagsRequest) (*QueryGetPermissionFlagsResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method PermissionFlags not implemented")
+func (*UnimplementedQueryServer) CrosschainFlags(ctx context.Context, req *QueryGetCrosschainFlagsRequest) (*QueryGetCrosschainFlagsResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method CrosschainFlags not implemented")
}
func (*UnimplementedQueryServer) Keygen(ctx context.Context, req *QueryGetKeygenRequest) (*QueryGetKeygenResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Keygen not implemented")
@@ -1667,6 +2030,15 @@ func (*UnimplementedQueryServer) BlameByIdentifier(ctx context.Context, req *Que
func (*UnimplementedQueryServer) GetAllBlameRecords(ctx context.Context, req *QueryAllBlameRecordsRequest) (*QueryAllBlameRecordsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetAllBlameRecords not implemented")
}
+func (*UnimplementedQueryServer) GetAllBlockHeaders(ctx context.Context, req *QueryAllBlockHeaderRequest) (*QueryAllBlockHeaderResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetAllBlockHeaders not implemented")
+}
+func (*UnimplementedQueryServer) GetBlockHeaderByHash(ctx context.Context, req *QueryGetBlockHeaderByHashRequest) (*QueryGetBlockHeaderByHashResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetBlockHeaderByHash not implemented")
+}
+func (*UnimplementedQueryServer) Prove(ctx context.Context, req *QueryProveRequest) (*QueryProveResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method Prove not implemented")
+}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv)
@@ -1834,20 +2206,20 @@ func _Query_NodeAccountAll_Handler(srv interface{}, ctx context.Context, dec fun
return interceptor(ctx, in, info, handler)
}
-func _Query_PermissionFlags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(QueryGetPermissionFlagsRequest)
+func _Query_CrosschainFlags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(QueryGetCrosschainFlagsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(QueryServer).PermissionFlags(ctx, in)
+ return srv.(QueryServer).CrosschainFlags(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/zetachain.zetacore.observer.Query/PermissionFlags",
+ FullMethod: "/zetachain.zetacore.observer.Query/CrosschainFlags",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(QueryServer).PermissionFlags(ctx, req.(*QueryGetPermissionFlagsRequest))
+ return srv.(QueryServer).CrosschainFlags(ctx, req.(*QueryGetCrosschainFlagsRequest))
}
return interceptor(ctx, in, info, handler)
}
@@ -1924,6 +2296,60 @@ func _Query_GetAllBlameRecords_Handler(srv interface{}, ctx context.Context, dec
return interceptor(ctx, in, info, handler)
}
+func _Query_GetAllBlockHeaders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(QueryAllBlockHeaderRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(QueryServer).GetAllBlockHeaders(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/zetachain.zetacore.observer.Query/GetAllBlockHeaders",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(QueryServer).GetAllBlockHeaders(ctx, req.(*QueryAllBlockHeaderRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Query_GetBlockHeaderByHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(QueryGetBlockHeaderByHashRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(QueryServer).GetBlockHeaderByHash(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/zetachain.zetacore.observer.Query/GetBlockHeaderByHash",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(QueryServer).GetBlockHeaderByHash(ctx, req.(*QueryGetBlockHeaderByHashRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Query_Prove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(QueryProveRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(QueryServer).Prove(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/zetachain.zetacore.observer.Query/Prove",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(QueryServer).Prove(ctx, req.(*QueryProveRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "zetachain.zetacore.observer.Query",
HandlerType: (*QueryServer)(nil),
@@ -1965,8 +2391,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{
Handler: _Query_NodeAccountAll_Handler,
},
{
- MethodName: "PermissionFlags",
- Handler: _Query_PermissionFlags_Handler,
+ MethodName: "CrosschainFlags",
+ Handler: _Query_CrosschainFlags_Handler,
},
{
MethodName: "Keygen",
@@ -1984,11 +2410,115 @@ var _Query_serviceDesc = grpc.ServiceDesc{
MethodName: "GetAllBlameRecords",
Handler: _Query_GetAllBlameRecords_Handler,
},
+ {
+ MethodName: "GetAllBlockHeaders",
+ Handler: _Query_GetAllBlockHeaders_Handler,
+ },
+ {
+ MethodName: "GetBlockHeaderByHash",
+ Handler: _Query_GetBlockHeaderByHash_Handler,
+ },
+ {
+ MethodName: "Prove",
+ Handler: _Query_Prove_Handler,
+ },
},
Streams: []grpc.StreamDesc{},
Metadata: "observer/query.proto",
}
+func (m *QueryProveRequest) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *QueryProveRequest) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *QueryProveRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.TxIndex != 0 {
+ i = encodeVarintQuery(dAtA, i, uint64(m.TxIndex))
+ i--
+ dAtA[i] = 0x28
+ }
+ if len(m.BlockHash) > 0 {
+ i -= len(m.BlockHash)
+ copy(dAtA[i:], m.BlockHash)
+ i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockHash)))
+ i--
+ dAtA[i] = 0x22
+ }
+ if m.Proof != nil {
+ {
+ size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintQuery(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x1a
+ }
+ if len(m.TxHash) > 0 {
+ i -= len(m.TxHash)
+ copy(dAtA[i:], m.TxHash)
+ i = encodeVarintQuery(dAtA, i, uint64(len(m.TxHash)))
+ i--
+ dAtA[i] = 0x12
+ }
+ if m.ChainId != 0 {
+ i = encodeVarintQuery(dAtA, i, uint64(m.ChainId))
+ i--
+ dAtA[i] = 0x8
+ }
+ return len(dAtA) - i, nil
+}
+
+func (m *QueryProveResponse) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *QueryProveResponse) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *QueryProveResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.Valid {
+ i--
+ if m.Valid {
+ dAtA[i] = 1
+ } else {
+ dAtA[i] = 0
+ }
+ i--
+ dAtA[i] = 0x8
+ }
+ return len(dAtA) - i, nil
+}
+
func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@@ -2616,7 +3146,7 @@ func (m *QueryAllNodeAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, er
return len(dAtA) - i, nil
}
-func (m *QueryGetPermissionFlagsRequest) Marshal() (dAtA []byte, err error) {
+func (m *QueryGetCrosschainFlagsRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
@@ -2626,12 +3156,12 @@ func (m *QueryGetPermissionFlagsRequest) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil
}
-func (m *QueryGetPermissionFlagsRequest) MarshalTo(dAtA []byte) (int, error) {
+func (m *QueryGetCrosschainFlagsRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
-func (m *QueryGetPermissionFlagsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+func (m *QueryGetCrosschainFlagsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
@@ -2639,7 +3169,7 @@ func (m *QueryGetPermissionFlagsRequest) MarshalToSizedBuffer(dAtA []byte) (int,
return len(dAtA) - i, nil
}
-func (m *QueryGetPermissionFlagsResponse) Marshal() (dAtA []byte, err error) {
+func (m *QueryGetCrosschainFlagsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
@@ -2649,18 +3179,18 @@ func (m *QueryGetPermissionFlagsResponse) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil
}
-func (m *QueryGetPermissionFlagsResponse) MarshalTo(dAtA []byte) (int, error) {
+func (m *QueryGetCrosschainFlagsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
-func (m *QueryGetPermissionFlagsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+func (m *QueryGetCrosschainFlagsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
- size, err := m.PermissionFlags.MarshalToSizedBuffer(dAtA[:i])
+ size, err := m.CrosschainFlags.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
@@ -2913,99 +3443,287 @@ func (m *QueryAllBlameRecordsResponse) MarshalToSizedBuffer(dAtA []byte) (int, e
return len(dAtA) - i, nil
}
-func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
- offset -= sovQuery(v)
- base := offset
- for v >= 1<<7 {
- dAtA[offset] = uint8(v&0x7f | 0x80)
- v >>= 7
- offset++
- }
- dAtA[offset] = uint8(v)
- return base
-}
-func (m *QueryParamsRequest) Size() (n int) {
- if m == nil {
- return 0
+func (m *QueryAllBlockHeaderRequest) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
}
- var l int
- _ = l
- return n
+ return dAtA[:n], nil
}
-func (m *QueryParamsResponse) Size() (n int) {
- if m == nil {
- return 0
- }
- var l int
- _ = l
- l = m.Params.Size()
- n += 1 + l + sovQuery(uint64(l))
- return n
+func (m *QueryAllBlockHeaderRequest) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
}
-func (m *QueryBallotByIdentifierRequest) Size() (n int) {
- if m == nil {
- return 0
- }
+func (m *QueryAllBlockHeaderRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
var l int
_ = l
- l = len(m.BallotIdentifier)
- if l > 0 {
- n += 1 + l + sovQuery(uint64(l))
+ if m.Pagination != nil {
+ {
+ size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintQuery(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0xa
}
- return n
+ return len(dAtA) - i, nil
}
-func (m *VoterList) Size() (n int) {
- if m == nil {
- return 0
- }
- var l int
- _ = l
- l = len(m.VoterAddress)
- if l > 0 {
- n += 1 + l + sovQuery(uint64(l))
- }
- if m.VoteType != 0 {
- n += 1 + sovQuery(uint64(m.VoteType))
+func (m *QueryAllBlockHeaderResponse) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
}
- return n
+ return dAtA[:n], nil
}
-func (m *QueryBallotByIdentifierResponse) Size() (n int) {
- if m == nil {
- return 0
- }
- var l int
- _ = l
- l = len(m.BallotIdentifier)
- if l > 0 {
- n += 1 + l + sovQuery(uint64(l))
- }
- if len(m.Voters) > 0 {
- for _, e := range m.Voters {
- l = e.Size()
- n += 1 + l + sovQuery(uint64(l))
- }
- }
- if m.ObservationType != 0 {
- n += 1 + sovQuery(uint64(m.ObservationType))
- }
- if m.BallotStatus != 0 {
- n += 1 + sovQuery(uint64(m.BallotStatus))
- }
- return n
+func (m *QueryAllBlockHeaderResponse) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
}
-func (m *QueryObserversByChainRequest) Size() (n int) {
- if m == nil {
- return 0
- }
+func (m *QueryAllBlockHeaderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
var l int
_ = l
- l = len(m.ObservationChain)
- if l > 0 {
+ if m.Pagination != nil {
+ {
+ size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintQuery(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x12
+ }
+ if len(m.BlockHeaders) > 0 {
+ for iNdEx := len(m.BlockHeaders) - 1; iNdEx >= 0; iNdEx-- {
+ {
+ size, err := m.BlockHeaders[iNdEx].MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintQuery(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0xa
+ }
+ }
+ return len(dAtA) - i, nil
+}
+
+func (m *QueryGetBlockHeaderByHashRequest) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *QueryGetBlockHeaderByHashRequest) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *QueryGetBlockHeaderByHashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if len(m.BlockHash) > 0 {
+ i -= len(m.BlockHash)
+ copy(dAtA[i:], m.BlockHash)
+ i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockHash)))
+ i--
+ dAtA[i] = 0xa
+ }
+ return len(dAtA) - i, nil
+}
+
+func (m *QueryGetBlockHeaderByHashResponse) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *QueryGetBlockHeaderByHashResponse) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *QueryGetBlockHeaderByHashResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.BlockHeader != nil {
+ {
+ size, err := m.BlockHeader.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintQuery(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0xa
+ }
+ return len(dAtA) - i, nil
+}
+
+func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
+ offset -= sovQuery(v)
+ base := offset
+ for v >= 1<<7 {
+ dAtA[offset] = uint8(v&0x7f | 0x80)
+ v >>= 7
+ offset++
+ }
+ dAtA[offset] = uint8(v)
+ return base
+}
+func (m *QueryProveRequest) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.ChainId != 0 {
+ n += 1 + sovQuery(uint64(m.ChainId))
+ }
+ l = len(m.TxHash)
+ if l > 0 {
+ n += 1 + l + sovQuery(uint64(l))
+ }
+ if m.Proof != nil {
+ l = m.Proof.Size()
+ n += 1 + l + sovQuery(uint64(l))
+ }
+ l = len(m.BlockHash)
+ if l > 0 {
+ n += 1 + l + sovQuery(uint64(l))
+ }
+ if m.TxIndex != 0 {
+ n += 1 + sovQuery(uint64(m.TxIndex))
+ }
+ return n
+}
+
+func (m *QueryProveResponse) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.Valid {
+ n += 2
+ }
+ return n
+}
+
+func (m *QueryParamsRequest) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ return n
+}
+
+func (m *QueryParamsResponse) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = m.Params.Size()
+ n += 1 + l + sovQuery(uint64(l))
+ return n
+}
+
+func (m *QueryBallotByIdentifierRequest) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.BallotIdentifier)
+ if l > 0 {
+ n += 1 + l + sovQuery(uint64(l))
+ }
+ return n
+}
+
+func (m *VoterList) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.VoterAddress)
+ if l > 0 {
+ n += 1 + l + sovQuery(uint64(l))
+ }
+ if m.VoteType != 0 {
+ n += 1 + sovQuery(uint64(m.VoteType))
+ }
+ return n
+}
+
+func (m *QueryBallotByIdentifierResponse) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.BallotIdentifier)
+ if l > 0 {
+ n += 1 + l + sovQuery(uint64(l))
+ }
+ if len(m.Voters) > 0 {
+ for _, e := range m.Voters {
+ l = e.Size()
+ n += 1 + l + sovQuery(uint64(l))
+ }
+ }
+ if m.ObservationType != 0 {
+ n += 1 + sovQuery(uint64(m.ObservationType))
+ }
+ if m.BallotStatus != 0 {
+ n += 1 + sovQuery(uint64(m.BallotStatus))
+ }
+ return n
+}
+
+func (m *QueryObserversByChainRequest) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.ObservationChain)
+ if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
@@ -3179,7 +3897,7 @@ func (m *QueryAllNodeAccountResponse) Size() (n int) {
return n
}
-func (m *QueryGetPermissionFlagsRequest) Size() (n int) {
+func (m *QueryGetCrosschainFlagsRequest) Size() (n int) {
if m == nil {
return 0
}
@@ -3188,13 +3906,13 @@ func (m *QueryGetPermissionFlagsRequest) Size() (n int) {
return n
}
-func (m *QueryGetPermissionFlagsResponse) Size() (n int) {
+func (m *QueryGetCrosschainFlagsResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
- l = m.PermissionFlags.Size()
+ l = m.CrosschainFlags.Size()
n += 1 + l + sovQuery(uint64(l))
return n
}
@@ -3293,13 +4011,71 @@ func (m *QueryAllBlameRecordsResponse) Size() (n int) {
return n
}
+func (m *QueryAllBlockHeaderRequest) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.Pagination != nil {
+ l = m.Pagination.Size()
+ n += 1 + l + sovQuery(uint64(l))
+ }
+ return n
+}
+
+func (m *QueryAllBlockHeaderResponse) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if len(m.BlockHeaders) > 0 {
+ for _, e := range m.BlockHeaders {
+ l = e.Size()
+ n += 1 + l + sovQuery(uint64(l))
+ }
+ }
+ if m.Pagination != nil {
+ l = m.Pagination.Size()
+ n += 1 + l + sovQuery(uint64(l))
+ }
+ return n
+}
+
+func (m *QueryGetBlockHeaderByHashRequest) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.BlockHash)
+ if l > 0 {
+ n += 1 + l + sovQuery(uint64(l))
+ }
+ return n
+}
+
+func (m *QueryGetBlockHeaderByHashResponse) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.BlockHeader != nil {
+ l = m.BlockHeader.Size()
+ n += 1 + l + sovQuery(uint64(l))
+ }
+ return n
+}
+
func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozQuery(x uint64) (n int) {
return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
-func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error {
+func (m *QueryProveRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -3322,15 +4098,273 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryProveRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryProveRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
- default:
- iNdEx = preIndex
- skippy, err := skipQuery(dAtA[iNdEx:])
+ case 1:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
+ }
+ m.ChainId = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.ChainId |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.TxHash = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 3:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if m.Proof == nil {
+ m.Proof = &common.Proof{}
+ }
+ if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ case 4:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.BlockHash = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 5:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field TxIndex", wireType)
+ }
+ m.TxIndex = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.TxIndex |= int64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ default:
+ iNdEx = preIndex
+ skippy, err := skipQuery(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func (m *QueryProveResponse) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: QueryProveResponse: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: QueryProveResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Valid", wireType)
+ }
+ var v int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ v |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ m.Valid = bool(v != 0)
+ default:
+ iNdEx = preIndex
+ skippy, err := skipQuery(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ default:
+ iNdEx = preIndex
+ skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
@@ -3372,17 +4406,437 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipQuery(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func (m *QueryBallotByIdentifierRequest) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: QueryBallotByIdentifierRequest: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: QueryBallotByIdentifierRequest: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field BallotIdentifier", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.BallotIdentifier = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipQuery(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func (m *VoterList) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: VoterList: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: VoterList: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field VoterAddress", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.VoterAddress = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 2:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field VoteType", wireType)
+ }
+ m.VoteType = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.VoteType |= VoteType(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ default:
+ iNdEx = preIndex
+ skippy, err := skipQuery(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func (m *QueryBallotByIdentifierResponse) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: QueryBallotByIdentifierResponse: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: QueryBallotByIdentifierResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field BallotIdentifier", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.BallotIdentifier = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Voters", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Voters = append(m.Voters, &VoterList{})
+ if err := m.Voters[len(m.Voters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ case 3:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field ObservationType", wireType)
+ }
+ m.ObservationType = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.ObservationType |= ObservationType(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ case 4:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field BallotStatus", wireType)
+ }
+ m.BallotStatus = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.BallotStatus |= BallotStatus(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ default:
+ iNdEx = preIndex
+ skippy, err := skipQuery(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func (m *QueryObserversByChainRequest) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: QueryObserversByChainRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryObserversByChainRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field ObservationChain", wireType)
}
- var msglen int
+ var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
@@ -3392,24 +4846,23 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
- msglen |= int(b&0x7F) << shift
+ stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
- if msglen < 0 {
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
return ErrInvalidLengthQuery
}
- postIndex := iNdEx + msglen
+ postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
- if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
- return err
- }
+ m.ObservationChain = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
@@ -3432,7 +4885,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryBallotByIdentifierRequest) Unmarshal(dAtA []byte) error {
+func (m *QueryObserversByChainResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -3455,15 +4908,15 @@ func (m *QueryBallotByIdentifierRequest) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryBallotByIdentifierRequest: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryObserversByChainResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryBallotByIdentifierRequest: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryObserversByChainResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field BallotIdentifier", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field Observers", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
@@ -3491,7 +4944,7 @@ func (m *QueryBallotByIdentifierRequest) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- m.BallotIdentifier = string(dAtA[iNdEx:postIndex])
+ m.Observers = append(m.Observers, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
default:
iNdEx = preIndex
@@ -3514,7 +4967,7 @@ func (m *QueryBallotByIdentifierRequest) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *VoterList) Unmarshal(dAtA []byte) error {
+func (m *QueryAllObserverMappersRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -3537,63 +4990,12 @@ func (m *VoterList) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: VoterList: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryAllObserverMappersRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: VoterList: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryAllObserverMappersRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field VoterAddress", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowQuery
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- stringLen |= uint64(b&0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthQuery
- }
- postIndex := iNdEx + intStringLen
- if postIndex < 0 {
- return ErrInvalidLengthQuery
- }
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.VoterAddress = string(dAtA[iNdEx:postIndex])
- iNdEx = postIndex
- case 2:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field VoteType", wireType)
- }
- m.VoteType = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowQuery
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- m.VoteType |= VoteType(b&0x7F) << shift
- if b < 0x80 {
- break
- }
- }
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
@@ -3615,7 +5017,7 @@ func (m *VoterList) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryBallotByIdentifierResponse) Unmarshal(dAtA []byte) error {
+func (m *QueryAllObserverMappersResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -3638,47 +5040,15 @@ func (m *QueryBallotByIdentifierResponse) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryBallotByIdentifierResponse: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryAllObserverMappersResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryBallotByIdentifierResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryAllObserverMappersResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field BallotIdentifier", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowQuery
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- stringLen |= uint64(b&0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthQuery
- }
- postIndex := iNdEx + intStringLen
- if postIndex < 0 {
- return ErrInvalidLengthQuery
- }
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.BallotIdentifier = string(dAtA[iNdEx:postIndex])
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Voters", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field ObserverMappers", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
@@ -3705,49 +5075,11 @@ func (m *QueryBallotByIdentifierResponse) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- m.Voters = append(m.Voters, &VoterList{})
- if err := m.Voters[len(m.Voters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ m.ObserverMappers = append(m.ObserverMappers, &ObserverMapper{})
+ if err := m.ObserverMappers[len(m.ObserverMappers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
- case 3:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ObservationType", wireType)
- }
- m.ObservationType = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowQuery
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- m.ObservationType |= ObservationType(b&0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- case 4:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field BallotStatus", wireType)
- }
- m.BallotStatus = 0
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowQuery
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- m.BallotStatus |= BallotStatus(b&0x7F) << shift
- if b < 0x80 {
- break
- }
- }
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
@@ -3769,7 +5101,7 @@ func (m *QueryBallotByIdentifierResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryObserversByChainRequest) Unmarshal(dAtA []byte) error {
+func (m *QuerySupportedChains) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -3792,44 +5124,12 @@ func (m *QueryObserversByChainRequest) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryObserversByChainRequest: wiretype end group for non-group")
+ return fmt.Errorf("proto: QuerySupportedChains: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryObserversByChainRequest: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QuerySupportedChains: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field ObservationChain", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowQuery
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- stringLen |= uint64(b&0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthQuery
- }
- postIndex := iNdEx + intStringLen
- if postIndex < 0 {
- return ErrInvalidLengthQuery
- }
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.ObservationChain = string(dAtA[iNdEx:postIndex])
- iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
@@ -3851,7 +5151,7 @@ func (m *QueryObserversByChainRequest) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryObserversByChainResponse) Unmarshal(dAtA []byte) error {
+func (m *QuerySupportedChainsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -3874,17 +5174,17 @@ func (m *QueryObserversByChainResponse) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryObserversByChainResponse: wiretype end group for non-group")
+ return fmt.Errorf("proto: QuerySupportedChainsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryObserversByChainResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QuerySupportedChainsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Observers", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field Chains", wireType)
}
- var stringLen uint64
+ var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
@@ -3894,23 +5194,25 @@ func (m *QueryObserversByChainResponse) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
- stringLen |= uint64(b&0x7F) << shift
+ msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
- intStringLen := int(stringLen)
- if intStringLen < 0 {
+ if msglen < 0 {
return ErrInvalidLengthQuery
}
- postIndex := iNdEx + intStringLen
+ postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
- m.Observers = append(m.Observers, string(dAtA[iNdEx:postIndex]))
+ m.Chains = append(m.Chains, &common.Chain{})
+ if err := m.Chains[len(m.Chains)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
iNdEx = postIndex
default:
iNdEx = preIndex
@@ -3933,7 +5235,7 @@ func (m *QueryObserversByChainResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryAllObserverMappersRequest) Unmarshal(dAtA []byte) error {
+func (m *QueryGetCoreParamsForChainRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -3956,12 +5258,31 @@ func (m *QueryAllObserverMappersRequest) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryAllObserverMappersRequest: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryGetCoreParamsForChainRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryAllObserverMappersRequest: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryGetCoreParamsForChainRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
+ case 1:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
+ }
+ m.ChainId = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.ChainId |= int64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
@@ -3983,7 +5304,7 @@ func (m *QueryAllObserverMappersRequest) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryAllObserverMappersResponse) Unmarshal(dAtA []byte) error {
+func (m *QueryGetCoreParamsForChainResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -4006,15 +5327,15 @@ func (m *QueryAllObserverMappersResponse) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryAllObserverMappersResponse: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryGetCoreParamsForChainResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryAllObserverMappersResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryGetCoreParamsForChainResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field ObserverMappers", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field CoreParams", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
@@ -4041,8 +5362,10 @@ func (m *QueryAllObserverMappersResponse) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- m.ObserverMappers = append(m.ObserverMappers, &ObserverMapper{})
- if err := m.ObserverMappers[len(m.ObserverMappers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ if m.CoreParams == nil {
+ m.CoreParams = &CoreParams{}
+ }
+ if err := m.CoreParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
@@ -4067,7 +5390,7 @@ func (m *QueryAllObserverMappersResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QuerySupportedChains) Unmarshal(dAtA []byte) error {
+func (m *QueryGetCoreParamsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -4090,10 +5413,10 @@ func (m *QuerySupportedChains) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QuerySupportedChains: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryGetCoreParamsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QuerySupportedChains: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryGetCoreParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
@@ -4117,7 +5440,7 @@ func (m *QuerySupportedChains) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QuerySupportedChainsResponse) Unmarshal(dAtA []byte) error {
+func (m *QueryGetCoreParamsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -4140,15 +5463,15 @@ func (m *QuerySupportedChainsResponse) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QuerySupportedChainsResponse: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryGetCoreParamsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QuerySupportedChainsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryGetCoreParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Chains", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field CoreParams", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
@@ -4175,8 +5498,10 @@ func (m *QuerySupportedChainsResponse) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- m.Chains = append(m.Chains, &common.Chain{})
- if err := m.Chains[len(m.Chains)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ if m.CoreParams == nil {
+ m.CoreParams = &CoreParamsList{}
+ }
+ if err := m.CoreParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
@@ -4201,7 +5526,7 @@ func (m *QuerySupportedChainsResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryGetCoreParamsForChainRequest) Unmarshal(dAtA []byte) error {
+func (m *QueryGetNodeAccountRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -4224,17 +5549,17 @@ func (m *QueryGetCoreParamsForChainRequest) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryGetCoreParamsForChainRequest: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryGetNodeAccountRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryGetCoreParamsForChainRequest: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryGetNodeAccountRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
}
- m.ChainId = 0
+ var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
@@ -4244,11 +5569,24 @@ func (m *QueryGetCoreParamsForChainRequest) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
- m.ChainId |= int64(b&0x7F) << shift
+ stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Index = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
@@ -4270,7 +5608,7 @@ func (m *QueryGetCoreParamsForChainRequest) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryGetCoreParamsForChainResponse) Unmarshal(dAtA []byte) error {
+func (m *QueryGetNodeAccountResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -4293,15 +5631,15 @@ func (m *QueryGetCoreParamsForChainResponse) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryGetCoreParamsForChainResponse: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryGetNodeAccountResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryGetCoreParamsForChainResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryGetNodeAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field CoreParams", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field NodeAccount", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
@@ -4328,10 +5666,10 @@ func (m *QueryGetCoreParamsForChainResponse) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- if m.CoreParams == nil {
- m.CoreParams = &CoreParams{}
+ if m.NodeAccount == nil {
+ m.NodeAccount = &NodeAccount{}
}
- if err := m.CoreParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ if err := m.NodeAccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
@@ -4356,7 +5694,7 @@ func (m *QueryGetCoreParamsForChainResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryGetCoreParamsRequest) Unmarshal(dAtA []byte) error {
+func (m *QueryAllNodeAccountRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -4379,12 +5717,48 @@ func (m *QueryGetCoreParamsRequest) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryGetCoreParamsRequest: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryAllNodeAccountRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryGetCoreParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryAllNodeAccountRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if m.Pagination == nil {
+ m.Pagination = &query.PageRequest{}
+ }
+ if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
@@ -4406,7 +5780,7 @@ func (m *QueryGetCoreParamsRequest) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryGetCoreParamsResponse) Unmarshal(dAtA []byte) error {
+func (m *QueryAllNodeAccountResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -4429,15 +5803,15 @@ func (m *QueryGetCoreParamsResponse) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryGetCoreParamsResponse: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryAllNodeAccountResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryGetCoreParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryAllNodeAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field CoreParams", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field NodeAccount", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
@@ -4464,10 +5838,44 @@ func (m *QueryGetCoreParamsResponse) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- if m.CoreParams == nil {
- m.CoreParams = &CoreParamsList{}
+ m.NodeAccount = append(m.NodeAccount, &NodeAccount{})
+ if err := m.NodeAccount[len(m.NodeAccount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
}
- if err := m.CoreParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ iNdEx = postIndex
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if m.Pagination == nil {
+ m.Pagination = &query.PageResponse{}
+ }
+ if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
@@ -4492,7 +5900,7 @@ func (m *QueryGetCoreParamsResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryGetNodeAccountRequest) Unmarshal(dAtA []byte) error {
+func (m *QueryGetCrosschainFlagsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -4515,44 +5923,12 @@ func (m *QueryGetNodeAccountRequest) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryGetNodeAccountRequest: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryGetCrosschainFlagsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryGetNodeAccountRequest: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryGetCrosschainFlagsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowQuery
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- stringLen |= uint64(b&0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthQuery
- }
- postIndex := iNdEx + intStringLen
- if postIndex < 0 {
- return ErrInvalidLengthQuery
- }
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Index = string(dAtA[iNdEx:postIndex])
- iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
@@ -4574,7 +5950,7 @@ func (m *QueryGetNodeAccountRequest) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryGetNodeAccountResponse) Unmarshal(dAtA []byte) error {
+func (m *QueryGetCrosschainFlagsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -4597,15 +5973,15 @@ func (m *QueryGetNodeAccountResponse) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryGetNodeAccountResponse: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryGetCrosschainFlagsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryGetNodeAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryGetCrosschainFlagsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field NodeAccount", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field CrosschainFlags", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
@@ -4632,10 +6008,7 @@ func (m *QueryGetNodeAccountResponse) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- if m.NodeAccount == nil {
- m.NodeAccount = &NodeAccount{}
- }
- if err := m.NodeAccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ if err := m.CrosschainFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
@@ -4660,71 +6033,35 @@ func (m *QueryGetNodeAccountResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryAllNodeAccountRequest) Unmarshal(dAtA []byte) error {
+func (m *QueryGetKeygenRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowQuery
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- wire |= uint64(b&0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: QueryAllNodeAccountRequest: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryAllNodeAccountRequest: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowQuery
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- msglen |= int(b&0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthQuery
- }
- postIndex := iNdEx + msglen
- if postIndex < 0 {
- return ErrInvalidLengthQuery
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
}
- if postIndex > l {
+ if iNdEx >= l {
return io.ErrUnexpectedEOF
}
- if m.Pagination == nil {
- m.Pagination = &query.PageRequest{}
- }
- if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
- return err
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
}
- iNdEx = postIndex
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: QueryGetKeygenRequest: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: QueryGetKeygenRequest: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
@@ -4746,7 +6083,7 @@ func (m *QueryAllNodeAccountRequest) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryAllNodeAccountResponse) Unmarshal(dAtA []byte) error {
+func (m *QueryGetKeygenResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -4769,49 +6106,15 @@ func (m *QueryAllNodeAccountResponse) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryAllNodeAccountResponse: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryGetKeygenResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryAllNodeAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryGetKeygenResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field NodeAccount", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowQuery
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- msglen |= int(b&0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthQuery
- }
- postIndex := iNdEx + msglen
- if postIndex < 0 {
- return ErrInvalidLengthQuery
- }
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.NodeAccount = append(m.NodeAccount, &NodeAccount{})
- if err := m.NodeAccount[len(m.NodeAccount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field Keygen", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
@@ -4838,10 +6141,10 @@ func (m *QueryAllNodeAccountResponse) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- if m.Pagination == nil {
- m.Pagination = &query.PageResponse{}
+ if m.Keygen == nil {
+ m.Keygen = &Keygen{}
}
- if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ if err := m.Keygen.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
@@ -4866,7 +6169,7 @@ func (m *QueryAllNodeAccountResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryGetPermissionFlagsRequest) Unmarshal(dAtA []byte) error {
+func (m *QueryShowObserverCountRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -4889,10 +6192,10 @@ func (m *QueryGetPermissionFlagsRequest) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryGetPermissionFlagsRequest: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryShowObserverCountRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryGetPermissionFlagsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryShowObserverCountRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
@@ -4916,7 +6219,7 @@ func (m *QueryGetPermissionFlagsRequest) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryGetPermissionFlagsResponse) Unmarshal(dAtA []byte) error {
+func (m *QueryShowObserverCountResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -4939,15 +6242,15 @@ func (m *QueryGetPermissionFlagsResponse) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryGetPermissionFlagsResponse: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryShowObserverCountResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryGetPermissionFlagsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryShowObserverCountResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field PermissionFlags", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field LastObserverCount", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
@@ -4974,7 +6277,10 @@ func (m *QueryGetPermissionFlagsResponse) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- if err := m.PermissionFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ if m.LastObserverCount == nil {
+ m.LastObserverCount = &LastObserverCount{}
+ }
+ if err := m.LastObserverCount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
@@ -4999,7 +6305,7 @@ func (m *QueryGetPermissionFlagsResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryGetKeygenRequest) Unmarshal(dAtA []byte) error {
+func (m *QueryBlameByIdentifierRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -5022,12 +6328,44 @@ func (m *QueryGetKeygenRequest) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryGetKeygenRequest: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryBlameByIdentifierRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryGetKeygenRequest: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryBlameByIdentifierRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field BlameIdentifier", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.BlameIdentifier = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
@@ -5049,7 +6387,7 @@ func (m *QueryGetKeygenRequest) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryGetKeygenResponse) Unmarshal(dAtA []byte) error {
+func (m *QueryBlameByIdentifierResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -5072,15 +6410,15 @@ func (m *QueryGetKeygenResponse) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryGetKeygenResponse: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryBlameByIdentifierResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryGetKeygenResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryBlameByIdentifierResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Keygen", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field BlameInfo", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
@@ -5107,10 +6445,10 @@ func (m *QueryGetKeygenResponse) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- if m.Keygen == nil {
- m.Keygen = &Keygen{}
+ if m.BlameInfo == nil {
+ m.BlameInfo = &Blame{}
}
- if err := m.Keygen.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ if err := m.BlameInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
@@ -5135,7 +6473,7 @@ func (m *QueryGetKeygenResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryShowObserverCountRequest) Unmarshal(dAtA []byte) error {
+func (m *QueryAllBlameRecordsRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -5158,10 +6496,10 @@ func (m *QueryShowObserverCountRequest) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryShowObserverCountRequest: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryAllBlameRecordsRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryShowObserverCountRequest: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryAllBlameRecordsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
@@ -5185,7 +6523,7 @@ func (m *QueryShowObserverCountRequest) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryShowObserverCountResponse) Unmarshal(dAtA []byte) error {
+func (m *QueryAllBlameRecordsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -5208,15 +6546,15 @@ func (m *QueryShowObserverCountResponse) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryShowObserverCountResponse: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryAllBlameRecordsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryShowObserverCountResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryAllBlameRecordsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field LastObserverCount", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field BlameInfo", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
@@ -5243,10 +6581,8 @@ func (m *QueryShowObserverCountResponse) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- if m.LastObserverCount == nil {
- m.LastObserverCount = &LastObserverCount{}
- }
- if err := m.LastObserverCount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ m.BlameInfo = append(m.BlameInfo, &Blame{})
+ if err := m.BlameInfo[len(m.BlameInfo)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
@@ -5271,7 +6607,7 @@ func (m *QueryShowObserverCountResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryBlameByIdentifierRequest) Unmarshal(dAtA []byte) error {
+func (m *QueryAllBlockHeaderRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -5294,17 +6630,17 @@ func (m *QueryBlameByIdentifierRequest) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryBlameByIdentifierRequest: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryAllBlockHeaderRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryBlameByIdentifierRequest: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryAllBlockHeaderRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field BlameIdentifier", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
}
- var stringLen uint64
+ var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
@@ -5314,23 +6650,27 @@ func (m *QueryBlameByIdentifierRequest) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
- stringLen |= uint64(b&0x7F) << shift
+ msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
- intStringLen := int(stringLen)
- if intStringLen < 0 {
+ if msglen < 0 {
return ErrInvalidLengthQuery
}
- postIndex := iNdEx + intStringLen
+ postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
- m.BlameIdentifier = string(dAtA[iNdEx:postIndex])
+ if m.Pagination == nil {
+ m.Pagination = &query.PageRequest{}
+ }
+ if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
iNdEx = postIndex
default:
iNdEx = preIndex
@@ -5353,7 +6693,7 @@ func (m *QueryBlameByIdentifierRequest) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryBlameByIdentifierResponse) Unmarshal(dAtA []byte) error {
+func (m *QueryAllBlockHeaderResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -5376,15 +6716,15 @@ func (m *QueryBlameByIdentifierResponse) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryBlameByIdentifierResponse: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryAllBlockHeaderResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryBlameByIdentifierResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryAllBlockHeaderResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field BlameInfo", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field BlockHeaders", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
@@ -5411,10 +6751,44 @@ func (m *QueryBlameByIdentifierResponse) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- if m.BlameInfo == nil {
- m.BlameInfo = &Blame{}
+ m.BlockHeaders = append(m.BlockHeaders, &common.BlockHeader{})
+ if err := m.BlockHeaders[len(m.BlockHeaders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
}
- if err := m.BlameInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ iNdEx = postIndex
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if m.Pagination == nil {
+ m.Pagination = &query.PageResponse{}
+ }
+ if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
@@ -5439,7 +6813,7 @@ func (m *QueryBlameByIdentifierResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryAllBlameRecordsRequest) Unmarshal(dAtA []byte) error {
+func (m *QueryGetBlockHeaderByHashRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -5462,12 +6836,46 @@ func (m *QueryAllBlameRecordsRequest) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryAllBlameRecordsRequest: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryGetBlockHeaderByHashRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryAllBlameRecordsRequest: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryGetBlockHeaderByHashRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType)
+ }
+ var byteLen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowQuery
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ byteLen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if byteLen < 0 {
+ return ErrInvalidLengthQuery
+ }
+ postIndex := iNdEx + byteLen
+ if postIndex < 0 {
+ return ErrInvalidLengthQuery
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.BlockHash = append(m.BlockHash[:0], dAtA[iNdEx:postIndex]...)
+ if m.BlockHash == nil {
+ m.BlockHash = []byte{}
+ }
+ iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
@@ -5489,7 +6897,7 @@ func (m *QueryAllBlameRecordsRequest) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *QueryAllBlameRecordsResponse) Unmarshal(dAtA []byte) error {
+func (m *QueryGetBlockHeaderByHashResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -5512,15 +6920,15 @@ func (m *QueryAllBlameRecordsResponse) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: QueryAllBlameRecordsResponse: wiretype end group for non-group")
+ return fmt.Errorf("proto: QueryGetBlockHeaderByHashResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: QueryAllBlameRecordsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: QueryGetBlockHeaderByHashResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field BlameInfo", wireType)
+ return fmt.Errorf("proto: wrong wireType = %d for field BlockHeader", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
@@ -5547,8 +6955,10 @@ func (m *QueryAllBlameRecordsResponse) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- m.BlameInfo = append(m.BlameInfo, &Blame{})
- if err := m.BlameInfo[len(m.BlameInfo)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ if m.BlockHeader == nil {
+ m.BlockHeader = &common.BlockHeader{}
+ }
+ if err := m.BlockHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
diff --git a/x/observer/types/query.pb.gw.go b/x/observer/types/query.pb.gw.go
index d7e061ea4c..ecc350cdf6 100644
--- a/x/observer/types/query.pb.gw.go
+++ b/x/observer/types/query.pb.gw.go
@@ -357,20 +357,20 @@ func local_request_Query_NodeAccountAll_0(ctx context.Context, marshaler runtime
}
-func request_Query_PermissionFlags_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq QueryGetPermissionFlagsRequest
+func request_Query_CrosschainFlags_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryGetCrosschainFlagsRequest
var metadata runtime.ServerMetadata
- msg, err := client.PermissionFlags(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ msg, err := client.CrosschainFlags(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
-func local_request_Query_PermissionFlags_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq QueryGetPermissionFlagsRequest
+func local_request_Query_CrosschainFlags_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryGetCrosschainFlagsRequest
var metadata runtime.ServerMetadata
- msg, err := server.PermissionFlags(ctx, &protoReq)
+ msg, err := server.CrosschainFlags(ctx, &protoReq)
return msg, metadata, err
}
@@ -483,6 +483,132 @@ func local_request_Query_GetAllBlameRecords_0(ctx context.Context, marshaler run
}
+var (
+ filter_Query_GetAllBlockHeaders_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
+)
+
+func request_Query_GetAllBlockHeaders_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryAllBlockHeaderRequest
+ var metadata runtime.ServerMetadata
+
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetAllBlockHeaders_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := client.GetAllBlockHeaders(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+
+}
+
+func local_request_Query_GetAllBlockHeaders_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryAllBlockHeaderRequest
+ var metadata runtime.ServerMetadata
+
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetAllBlockHeaders_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := server.GetAllBlockHeaders(ctx, &protoReq)
+ return msg, metadata, err
+
+}
+
+func request_Query_GetBlockHeaderByHash_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryGetBlockHeaderByHashRequest
+ var metadata runtime.ServerMetadata
+
+ var (
+ val string
+ ok bool
+ err error
+ _ = err
+ )
+
+ val, ok = pathParams["block_hash"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "block_hash")
+ }
+
+ protoReq.BlockHash, err = runtime.Bytes(val)
+
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "block_hash", err)
+ }
+
+ msg, err := client.GetBlockHeaderByHash(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+
+}
+
+func local_request_Query_GetBlockHeaderByHash_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryGetBlockHeaderByHashRequest
+ var metadata runtime.ServerMetadata
+
+ var (
+ val string
+ ok bool
+ err error
+ _ = err
+ )
+
+ val, ok = pathParams["block_hash"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "block_hash")
+ }
+
+ protoReq.BlockHash, err = runtime.Bytes(val)
+
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "block_hash", err)
+ }
+
+ msg, err := server.GetBlockHeaderByHash(ctx, &protoReq)
+ return msg, metadata, err
+
+}
+
+var (
+ filter_Query_Prove_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
+)
+
+func request_Query_Prove_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryProveRequest
+ var metadata runtime.ServerMetadata
+
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Prove_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := client.Prove(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+
+}
+
+func local_request_Query_Prove_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq QueryProveRequest
+ var metadata runtime.ServerMetadata
+
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Prove_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := server.Prove(ctx, &protoReq)
+ return msg, metadata, err
+
+}
+
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
// UnaryRPC :call QueryServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@@ -696,7 +822,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
})
- mux.Handle("GET", pattern_Query_PermissionFlags_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ mux.Handle("GET", pattern_Query_CrosschainFlags_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
@@ -707,7 +833,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
- resp, md, err := local_request_Query_PermissionFlags_0(rctx, inboundMarshaler, server, req, pathParams)
+ resp, md, err := local_request_Query_CrosschainFlags_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
@@ -715,7 +841,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
return
}
- forward_Query_PermissionFlags_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ forward_Query_CrosschainFlags_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
@@ -811,6 +937,75 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
})
+ mux.Handle("GET", pattern_Query_GetAllBlockHeaders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_Query_GetAllBlockHeaders_0(rctx, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ ctx = runtime.NewServerMetadataContext(ctx, md)
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_Query_GetAllBlockHeaders_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
+ mux.Handle("GET", pattern_Query_GetBlockHeaderByHash_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_Query_GetBlockHeaderByHash_0(rctx, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ ctx = runtime.NewServerMetadataContext(ctx, md)
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_Query_GetBlockHeaderByHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
+ mux.Handle("GET", pattern_Query_Prove_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_Query_Prove_0(rctx, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ ctx = runtime.NewServerMetadataContext(ctx, md)
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_Query_Prove_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
return nil
}
@@ -1032,7 +1227,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
})
- mux.Handle("GET", pattern_Query_PermissionFlags_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ mux.Handle("GET", pattern_Query_CrosschainFlags_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
@@ -1041,14 +1236,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
- resp, md, err := request_Query_PermissionFlags_0(rctx, inboundMarshaler, client, req, pathParams)
+ resp, md, err := request_Query_CrosschainFlags_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
- forward_Query_PermissionFlags_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ forward_Query_CrosschainFlags_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
@@ -1132,6 +1327,66 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
})
+ mux.Handle("GET", pattern_Query_GetAllBlockHeaders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ rctx, err := runtime.AnnotateContext(ctx, mux, req)
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_Query_GetAllBlockHeaders_0(rctx, inboundMarshaler, client, req, pathParams)
+ ctx = runtime.NewServerMetadataContext(ctx, md)
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_Query_GetAllBlockHeaders_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
+ mux.Handle("GET", pattern_Query_GetBlockHeaderByHash_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ rctx, err := runtime.AnnotateContext(ctx, mux, req)
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_Query_GetBlockHeaderByHash_0(rctx, inboundMarshaler, client, req, pathParams)
+ ctx = runtime.NewServerMetadataContext(ctx, md)
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_Query_GetBlockHeaderByHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
+ mux.Handle("GET", pattern_Query_Prove_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ rctx, err := runtime.AnnotateContext(ctx, mux, req)
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_Query_Prove_0(rctx, inboundMarshaler, client, req, pathParams)
+ ctx = runtime.NewServerMetadataContext(ctx, md)
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_Query_Prove_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
return nil
}
@@ -1154,7 +1409,7 @@ var (
pattern_Query_NodeAccountAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "nodeAccount"}, "", runtime.AssumeColonVerbOpt(false)))
- pattern_Query_PermissionFlags_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "permission_flags"}, "", runtime.AssumeColonVerbOpt(false)))
+ pattern_Query_CrosschainFlags_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "crosschain_flags"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Keygen_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "keygen"}, "", runtime.AssumeColonVerbOpt(false)))
@@ -1163,6 +1418,12 @@ var (
pattern_Query_BlameByIdentifier_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "observer", "blame_by_identifier", "blame_identifier"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_GetAllBlameRecords_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "get_all_blame_records"}, "", runtime.AssumeColonVerbOpt(false)))
+
+ pattern_Query_GetAllBlockHeaders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "get_all_block_headers"}, "", runtime.AssumeColonVerbOpt(false)))
+
+ pattern_Query_GetBlockHeaderByHash_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "observer", "get_block_header_by_hash", "block_hash"}, "", runtime.AssumeColonVerbOpt(false)))
+
+ pattern_Query_Prove_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "prove"}, "", runtime.AssumeColonVerbOpt(false)))
)
var (
@@ -1184,7 +1445,7 @@ var (
forward_Query_NodeAccountAll_0 = runtime.ForwardResponseMessage
- forward_Query_PermissionFlags_0 = runtime.ForwardResponseMessage
+ forward_Query_CrosschainFlags_0 = runtime.ForwardResponseMessage
forward_Query_Keygen_0 = runtime.ForwardResponseMessage
@@ -1193,4 +1454,10 @@ var (
forward_Query_BlameByIdentifier_0 = runtime.ForwardResponseMessage
forward_Query_GetAllBlameRecords_0 = runtime.ForwardResponseMessage
+
+ forward_Query_GetAllBlockHeaders_0 = runtime.ForwardResponseMessage
+
+ forward_Query_GetBlockHeaderByHash_0 = runtime.ForwardResponseMessage
+
+ forward_Query_Prove_0 = runtime.ForwardResponseMessage
)
diff --git a/x/observer/types/tx.pb.go b/x/observer/types/tx.pb.go
index d2e91155aa..e7cfe8f234 100644
--- a/x/observer/types/tx.pb.go
+++ b/x/observer/types/tx.pb.go
@@ -13,7 +13,7 @@ import (
_ "github.com/cosmos/gogoproto/gogoproto"
grpc1 "github.com/gogo/protobuf/grpc"
proto "github.com/gogo/protobuf/proto"
- _ "github.com/zeta-chain/zetacore/common"
+ common "github.com/zeta-chain/zetacore/common"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
@@ -30,6 +30,118 @@ var _ = math.Inf
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
+type MsgAddBlockHeader struct {
+ Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
+ ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
+ BlockHash []byte `protobuf:"bytes,3,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`
+ Height int64 `protobuf:"varint,4,opt,name=height,proto3" json:"height,omitempty"`
+ Header common.HeaderData `protobuf:"bytes,5,opt,name=header,proto3" json:"header"`
+}
+
+func (m *MsgAddBlockHeader) Reset() { *m = MsgAddBlockHeader{} }
+func (m *MsgAddBlockHeader) String() string { return proto.CompactTextString(m) }
+func (*MsgAddBlockHeader) ProtoMessage() {}
+func (*MsgAddBlockHeader) Descriptor() ([]byte, []int) {
+ return fileDescriptor_1bcd40fa296a2b1d, []int{0}
+}
+func (m *MsgAddBlockHeader) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *MsgAddBlockHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_MsgAddBlockHeader.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 *MsgAddBlockHeader) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_MsgAddBlockHeader.Merge(m, src)
+}
+func (m *MsgAddBlockHeader) XXX_Size() int {
+ return m.Size()
+}
+func (m *MsgAddBlockHeader) XXX_DiscardUnknown() {
+ xxx_messageInfo_MsgAddBlockHeader.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_MsgAddBlockHeader proto.InternalMessageInfo
+
+func (m *MsgAddBlockHeader) GetCreator() string {
+ if m != nil {
+ return m.Creator
+ }
+ return ""
+}
+
+func (m *MsgAddBlockHeader) GetChainId() int64 {
+ if m != nil {
+ return m.ChainId
+ }
+ return 0
+}
+
+func (m *MsgAddBlockHeader) GetBlockHash() []byte {
+ if m != nil {
+ return m.BlockHash
+ }
+ return nil
+}
+
+func (m *MsgAddBlockHeader) GetHeight() int64 {
+ if m != nil {
+ return m.Height
+ }
+ return 0
+}
+
+func (m *MsgAddBlockHeader) GetHeader() common.HeaderData {
+ if m != nil {
+ return m.Header
+ }
+ return common.HeaderData{}
+}
+
+type MsgAddBlockHeaderResponse struct {
+}
+
+func (m *MsgAddBlockHeaderResponse) Reset() { *m = MsgAddBlockHeaderResponse{} }
+func (m *MsgAddBlockHeaderResponse) String() string { return proto.CompactTextString(m) }
+func (*MsgAddBlockHeaderResponse) ProtoMessage() {}
+func (*MsgAddBlockHeaderResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor_1bcd40fa296a2b1d, []int{1}
+}
+func (m *MsgAddBlockHeaderResponse) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *MsgAddBlockHeaderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_MsgAddBlockHeaderResponse.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 *MsgAddBlockHeaderResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_MsgAddBlockHeaderResponse.Merge(m, src)
+}
+func (m *MsgAddBlockHeaderResponse) XXX_Size() int {
+ return m.Size()
+}
+func (m *MsgAddBlockHeaderResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_MsgAddBlockHeaderResponse.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_MsgAddBlockHeaderResponse proto.InternalMessageInfo
+
type MsgUpdateCoreParams struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
CoreParams *CoreParams `protobuf:"bytes,2,opt,name=coreParams,proto3" json:"coreParams,omitempty"`
@@ -39,7 +151,7 @@ func (m *MsgUpdateCoreParams) Reset() { *m = MsgUpdateCoreParams{} }
func (m *MsgUpdateCoreParams) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateCoreParams) ProtoMessage() {}
func (*MsgUpdateCoreParams) Descriptor() ([]byte, []int) {
- return fileDescriptor_1bcd40fa296a2b1d, []int{0}
+ return fileDescriptor_1bcd40fa296a2b1d, []int{2}
}
func (m *MsgUpdateCoreParams) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -89,7 +201,7 @@ func (m *MsgUpdateCoreParamsResponse) Reset() { *m = MsgUpdateCoreParams
func (m *MsgUpdateCoreParamsResponse) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateCoreParamsResponse) ProtoMessage() {}
func (*MsgUpdateCoreParamsResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_1bcd40fa296a2b1d, []int{1}
+ return fileDescriptor_1bcd40fa296a2b1d, []int{3}
}
func (m *MsgUpdateCoreParamsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -129,7 +241,7 @@ func (m *MsgAddObserver) Reset() { *m = MsgAddObserver{} }
func (m *MsgAddObserver) String() string { return proto.CompactTextString(m) }
func (*MsgAddObserver) ProtoMessage() {}
func (*MsgAddObserver) Descriptor() ([]byte, []int) {
- return fileDescriptor_1bcd40fa296a2b1d, []int{2}
+ return fileDescriptor_1bcd40fa296a2b1d, []int{4}
}
func (m *MsgAddObserver) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -193,7 +305,7 @@ func (m *MsgAddObserverResponse) Reset() { *m = MsgAddObserverResponse{}
func (m *MsgAddObserverResponse) String() string { return proto.CompactTextString(m) }
func (*MsgAddObserverResponse) ProtoMessage() {}
func (*MsgAddObserverResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_1bcd40fa296a2b1d, []int{3}
+ return fileDescriptor_1bcd40fa296a2b1d, []int{5}
}
func (m *MsgAddObserverResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -232,7 +344,7 @@ func (m *MsgAddBlameVote) Reset() { *m = MsgAddBlameVote{} }
func (m *MsgAddBlameVote) String() string { return proto.CompactTextString(m) }
func (*MsgAddBlameVote) ProtoMessage() {}
func (*MsgAddBlameVote) Descriptor() ([]byte, []int) {
- return fileDescriptor_1bcd40fa296a2b1d, []int{4}
+ return fileDescriptor_1bcd40fa296a2b1d, []int{6}
}
func (m *MsgAddBlameVote) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -289,7 +401,7 @@ func (m *MsgAddBlameVoteResponse) Reset() { *m = MsgAddBlameVoteResponse
func (m *MsgAddBlameVoteResponse) String() string { return proto.CompactTextString(m) }
func (*MsgAddBlameVoteResponse) ProtoMessage() {}
func (*MsgAddBlameVoteResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_1bcd40fa296a2b1d, []int{5}
+ return fileDescriptor_1bcd40fa296a2b1d, []int{7}
}
func (m *MsgAddBlameVoteResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -318,24 +430,25 @@ func (m *MsgAddBlameVoteResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgAddBlameVoteResponse proto.InternalMessageInfo
-type MsgUpdatePermissionFlags struct {
- Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
- IsInboundEnabled bool `protobuf:"varint,3,opt,name=isInboundEnabled,proto3" json:"isInboundEnabled,omitempty"`
- IsOutboundEnabled bool `protobuf:"varint,4,opt,name=isOutboundEnabled,proto3" json:"isOutboundEnabled,omitempty"`
+type MsgUpdateCrosschainFlags struct {
+ Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
+ IsInboundEnabled bool `protobuf:"varint,3,opt,name=isInboundEnabled,proto3" json:"isInboundEnabled,omitempty"`
+ IsOutboundEnabled bool `protobuf:"varint,4,opt,name=isOutboundEnabled,proto3" json:"isOutboundEnabled,omitempty"`
+ GasPriceIncreaseFlags *GasPriceIncreaseFlags `protobuf:"bytes,5,opt,name=gasPriceIncreaseFlags,proto3" json:"gasPriceIncreaseFlags,omitempty"`
}
-func (m *MsgUpdatePermissionFlags) Reset() { *m = MsgUpdatePermissionFlags{} }
-func (m *MsgUpdatePermissionFlags) String() string { return proto.CompactTextString(m) }
-func (*MsgUpdatePermissionFlags) ProtoMessage() {}
-func (*MsgUpdatePermissionFlags) Descriptor() ([]byte, []int) {
- return fileDescriptor_1bcd40fa296a2b1d, []int{6}
+func (m *MsgUpdateCrosschainFlags) Reset() { *m = MsgUpdateCrosschainFlags{} }
+func (m *MsgUpdateCrosschainFlags) String() string { return proto.CompactTextString(m) }
+func (*MsgUpdateCrosschainFlags) ProtoMessage() {}
+func (*MsgUpdateCrosschainFlags) Descriptor() ([]byte, []int) {
+ return fileDescriptor_1bcd40fa296a2b1d, []int{8}
}
-func (m *MsgUpdatePermissionFlags) XXX_Unmarshal(b []byte) error {
+func (m *MsgUpdateCrosschainFlags) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
-func (m *MsgUpdatePermissionFlags) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+func (m *MsgUpdateCrosschainFlags) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
- return xxx_messageInfo_MsgUpdatePermissionFlags.Marshal(b, m, deterministic)
+ return xxx_messageInfo_MsgUpdateCrosschainFlags.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
@@ -345,54 +458,61 @@ func (m *MsgUpdatePermissionFlags) XXX_Marshal(b []byte, deterministic bool) ([]
return b[:n], nil
}
}
-func (m *MsgUpdatePermissionFlags) XXX_Merge(src proto.Message) {
- xxx_messageInfo_MsgUpdatePermissionFlags.Merge(m, src)
+func (m *MsgUpdateCrosschainFlags) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_MsgUpdateCrosschainFlags.Merge(m, src)
}
-func (m *MsgUpdatePermissionFlags) XXX_Size() int {
+func (m *MsgUpdateCrosschainFlags) XXX_Size() int {
return m.Size()
}
-func (m *MsgUpdatePermissionFlags) XXX_DiscardUnknown() {
- xxx_messageInfo_MsgUpdatePermissionFlags.DiscardUnknown(m)
+func (m *MsgUpdateCrosschainFlags) XXX_DiscardUnknown() {
+ xxx_messageInfo_MsgUpdateCrosschainFlags.DiscardUnknown(m)
}
-var xxx_messageInfo_MsgUpdatePermissionFlags proto.InternalMessageInfo
+var xxx_messageInfo_MsgUpdateCrosschainFlags proto.InternalMessageInfo
-func (m *MsgUpdatePermissionFlags) GetCreator() string {
+func (m *MsgUpdateCrosschainFlags) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
-func (m *MsgUpdatePermissionFlags) GetIsInboundEnabled() bool {
+func (m *MsgUpdateCrosschainFlags) GetIsInboundEnabled() bool {
if m != nil {
return m.IsInboundEnabled
}
return false
}
-func (m *MsgUpdatePermissionFlags) GetIsOutboundEnabled() bool {
+func (m *MsgUpdateCrosschainFlags) GetIsOutboundEnabled() bool {
if m != nil {
return m.IsOutboundEnabled
}
return false
}
-type MsgUpdatePermissionFlagsResponse struct {
+func (m *MsgUpdateCrosschainFlags) GetGasPriceIncreaseFlags() *GasPriceIncreaseFlags {
+ if m != nil {
+ return m.GasPriceIncreaseFlags
+ }
+ return nil
+}
+
+type MsgUpdateCrosschainFlagsResponse struct {
}
-func (m *MsgUpdatePermissionFlagsResponse) Reset() { *m = MsgUpdatePermissionFlagsResponse{} }
-func (m *MsgUpdatePermissionFlagsResponse) String() string { return proto.CompactTextString(m) }
-func (*MsgUpdatePermissionFlagsResponse) ProtoMessage() {}
-func (*MsgUpdatePermissionFlagsResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_1bcd40fa296a2b1d, []int{7}
+func (m *MsgUpdateCrosschainFlagsResponse) Reset() { *m = MsgUpdateCrosschainFlagsResponse{} }
+func (m *MsgUpdateCrosschainFlagsResponse) String() string { return proto.CompactTextString(m) }
+func (*MsgUpdateCrosschainFlagsResponse) ProtoMessage() {}
+func (*MsgUpdateCrosschainFlagsResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor_1bcd40fa296a2b1d, []int{9}
}
-func (m *MsgUpdatePermissionFlagsResponse) XXX_Unmarshal(b []byte) error {
+func (m *MsgUpdateCrosschainFlagsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
-func (m *MsgUpdatePermissionFlagsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+func (m *MsgUpdateCrosschainFlagsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
- return xxx_messageInfo_MsgUpdatePermissionFlagsResponse.Marshal(b, m, deterministic)
+ return xxx_messageInfo_MsgUpdateCrosschainFlagsResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
@@ -402,17 +522,17 @@ func (m *MsgUpdatePermissionFlagsResponse) XXX_Marshal(b []byte, deterministic b
return b[:n], nil
}
}
-func (m *MsgUpdatePermissionFlagsResponse) XXX_Merge(src proto.Message) {
- xxx_messageInfo_MsgUpdatePermissionFlagsResponse.Merge(m, src)
+func (m *MsgUpdateCrosschainFlagsResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_MsgUpdateCrosschainFlagsResponse.Merge(m, src)
}
-func (m *MsgUpdatePermissionFlagsResponse) XXX_Size() int {
+func (m *MsgUpdateCrosschainFlagsResponse) XXX_Size() int {
return m.Size()
}
-func (m *MsgUpdatePermissionFlagsResponse) XXX_DiscardUnknown() {
- xxx_messageInfo_MsgUpdatePermissionFlagsResponse.DiscardUnknown(m)
+func (m *MsgUpdateCrosschainFlagsResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_MsgUpdateCrosschainFlagsResponse.DiscardUnknown(m)
}
-var xxx_messageInfo_MsgUpdatePermissionFlagsResponse proto.InternalMessageInfo
+var xxx_messageInfo_MsgUpdateCrosschainFlagsResponse proto.InternalMessageInfo
type MsgUpdateKeygen struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
@@ -423,7 +543,7 @@ func (m *MsgUpdateKeygen) Reset() { *m = MsgUpdateKeygen{} }
func (m *MsgUpdateKeygen) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateKeygen) ProtoMessage() {}
func (*MsgUpdateKeygen) Descriptor() ([]byte, []int) {
- return fileDescriptor_1bcd40fa296a2b1d, []int{8}
+ return fileDescriptor_1bcd40fa296a2b1d, []int{10}
}
func (m *MsgUpdateKeygen) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -473,7 +593,7 @@ func (m *MsgUpdateKeygenResponse) Reset() { *m = MsgUpdateKeygenResponse
func (m *MsgUpdateKeygenResponse) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateKeygenResponse) ProtoMessage() {}
func (*MsgUpdateKeygenResponse) Descriptor() ([]byte, []int) {
- return fileDescriptor_1bcd40fa296a2b1d, []int{9}
+ return fileDescriptor_1bcd40fa296a2b1d, []int{11}
}
func (m *MsgUpdateKeygenResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -503,14 +623,16 @@ func (m *MsgUpdateKeygenResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgUpdateKeygenResponse proto.InternalMessageInfo
func init() {
+ proto.RegisterType((*MsgAddBlockHeader)(nil), "zetachain.zetacore.observer.MsgAddBlockHeader")
+ proto.RegisterType((*MsgAddBlockHeaderResponse)(nil), "zetachain.zetacore.observer.MsgAddBlockHeaderResponse")
proto.RegisterType((*MsgUpdateCoreParams)(nil), "zetachain.zetacore.observer.MsgUpdateCoreParams")
proto.RegisterType((*MsgUpdateCoreParamsResponse)(nil), "zetachain.zetacore.observer.MsgUpdateCoreParamsResponse")
proto.RegisterType((*MsgAddObserver)(nil), "zetachain.zetacore.observer.MsgAddObserver")
proto.RegisterType((*MsgAddObserverResponse)(nil), "zetachain.zetacore.observer.MsgAddObserverResponse")
proto.RegisterType((*MsgAddBlameVote)(nil), "zetachain.zetacore.observer.MsgAddBlameVote")
proto.RegisterType((*MsgAddBlameVoteResponse)(nil), "zetachain.zetacore.observer.MsgAddBlameVoteResponse")
- proto.RegisterType((*MsgUpdatePermissionFlags)(nil), "zetachain.zetacore.observer.MsgUpdatePermissionFlags")
- proto.RegisterType((*MsgUpdatePermissionFlagsResponse)(nil), "zetachain.zetacore.observer.MsgUpdatePermissionFlagsResponse")
+ proto.RegisterType((*MsgUpdateCrosschainFlags)(nil), "zetachain.zetacore.observer.MsgUpdateCrosschainFlags")
+ proto.RegisterType((*MsgUpdateCrosschainFlagsResponse)(nil), "zetachain.zetacore.observer.MsgUpdateCrosschainFlagsResponse")
proto.RegisterType((*MsgUpdateKeygen)(nil), "zetachain.zetacore.observer.MsgUpdateKeygen")
proto.RegisterType((*MsgUpdateKeygenResponse)(nil), "zetachain.zetacore.observer.MsgUpdateKeygenResponse")
}
@@ -518,47 +640,56 @@ func init() {
func init() { proto.RegisterFile("observer/tx.proto", fileDescriptor_1bcd40fa296a2b1d) }
var fileDescriptor_1bcd40fa296a2b1d = []byte{
- // 627 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcf, 0x4f, 0xd4, 0x40,
- 0x14, 0xa6, 0x82, 0x02, 0x0f, 0x23, 0x50, 0x40, 0x4a, 0x89, 0xcd, 0xa6, 0x17, 0x51, 0xb1, 0x55,
- 0xd0, 0xc4, 0x98, 0x78, 0x58, 0x8c, 0x92, 0x8d, 0x41, 0x48, 0x13, 0x3d, 0x78, 0x69, 0xa6, 0x9d,
- 0xa1, 0x34, 0xb4, 0x33, 0xcd, 0x4c, 0xd7, 0xb0, 0x1e, 0xbc, 0x7b, 0xd0, 0xf8, 0x47, 0x79, 0xf0,
- 0xc8, 0xd1, 0xa3, 0x81, 0xbb, 0x7f, 0x83, 0xd9, 0x99, 0x6d, 0xf7, 0xa7, 0x65, 0xd7, 0xd3, 0xce,
- 0xbc, 0xf7, 0xbd, 0xef, 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 0xcb, 0xeb, 0x92, 0x74, 0x75, 0x5d, 0x92, 0xbe, 0x5d, 0x97, 0xa4, 0x8f, 0x37,
+ 0xa5, 0xcc, 0xd5, 0x4d, 0x29, 0xf3, 0xe5, 0xa6, 0x94, 0x79, 0xad, 0xd9, 0xae, 0xef, 0x74, 0xcc,
+ 0xe0, 0x3b, 0xa7, 0x05, 0x8c, 0x7f, 0x0b, 0x72, 0x2d, 0x26, 0xd7, 0xba, 0x5a, 0xff, 0x67, 0x45,
+ 0xaf, 0x4d, 0xb8, 0x39, 0x2f, 0xbe, 0xd5, 0x07, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xa1, 0x60,
+ 0xf7, 0xb4, 0x6f, 0x08, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -576,8 +707,9 @@ type MsgClient interface {
AddObserver(ctx context.Context, in *MsgAddObserver, opts ...grpc.CallOption) (*MsgAddObserverResponse, error)
UpdateCoreParams(ctx context.Context, in *MsgUpdateCoreParams, opts ...grpc.CallOption) (*MsgUpdateCoreParamsResponse, error)
AddBlameVote(ctx context.Context, in *MsgAddBlameVote, opts ...grpc.CallOption) (*MsgAddBlameVoteResponse, error)
- UpdatePermissionFlags(ctx context.Context, in *MsgUpdatePermissionFlags, opts ...grpc.CallOption) (*MsgUpdatePermissionFlagsResponse, error)
+ UpdateCrosschainFlags(ctx context.Context, in *MsgUpdateCrosschainFlags, opts ...grpc.CallOption) (*MsgUpdateCrosschainFlagsResponse, error)
UpdateKeygen(ctx context.Context, in *MsgUpdateKeygen, opts ...grpc.CallOption) (*MsgUpdateKeygenResponse, error)
+ AddBlockHeader(ctx context.Context, in *MsgAddBlockHeader, opts ...grpc.CallOption) (*MsgAddBlockHeaderResponse, error)
}
type msgClient struct {
@@ -615,9 +747,9 @@ func (c *msgClient) AddBlameVote(ctx context.Context, in *MsgAddBlameVote, opts
return out, nil
}
-func (c *msgClient) UpdatePermissionFlags(ctx context.Context, in *MsgUpdatePermissionFlags, opts ...grpc.CallOption) (*MsgUpdatePermissionFlagsResponse, error) {
- out := new(MsgUpdatePermissionFlagsResponse)
- err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Msg/UpdatePermissionFlags", in, out, opts...)
+func (c *msgClient) UpdateCrosschainFlags(ctx context.Context, in *MsgUpdateCrosschainFlags, opts ...grpc.CallOption) (*MsgUpdateCrosschainFlagsResponse, error) {
+ out := new(MsgUpdateCrosschainFlagsResponse)
+ err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Msg/UpdateCrosschainFlags", in, out, opts...)
if err != nil {
return nil, err
}
@@ -633,13 +765,23 @@ func (c *msgClient) UpdateKeygen(ctx context.Context, in *MsgUpdateKeygen, opts
return out, nil
}
+func (c *msgClient) AddBlockHeader(ctx context.Context, in *MsgAddBlockHeader, opts ...grpc.CallOption) (*MsgAddBlockHeaderResponse, error) {
+ out := new(MsgAddBlockHeaderResponse)
+ err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Msg/AddBlockHeader", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
// MsgServer is the server API for Msg service.
type MsgServer interface {
AddObserver(context.Context, *MsgAddObserver) (*MsgAddObserverResponse, error)
UpdateCoreParams(context.Context, *MsgUpdateCoreParams) (*MsgUpdateCoreParamsResponse, error)
AddBlameVote(context.Context, *MsgAddBlameVote) (*MsgAddBlameVoteResponse, error)
- UpdatePermissionFlags(context.Context, *MsgUpdatePermissionFlags) (*MsgUpdatePermissionFlagsResponse, error)
+ UpdateCrosschainFlags(context.Context, *MsgUpdateCrosschainFlags) (*MsgUpdateCrosschainFlagsResponse, error)
UpdateKeygen(context.Context, *MsgUpdateKeygen) (*MsgUpdateKeygenResponse, error)
+ AddBlockHeader(context.Context, *MsgAddBlockHeader) (*MsgAddBlockHeaderResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
@@ -655,12 +797,15 @@ func (*UnimplementedMsgServer) UpdateCoreParams(ctx context.Context, req *MsgUpd
func (*UnimplementedMsgServer) AddBlameVote(ctx context.Context, req *MsgAddBlameVote) (*MsgAddBlameVoteResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddBlameVote not implemented")
}
-func (*UnimplementedMsgServer) UpdatePermissionFlags(ctx context.Context, req *MsgUpdatePermissionFlags) (*MsgUpdatePermissionFlagsResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method UpdatePermissionFlags not implemented")
+func (*UnimplementedMsgServer) UpdateCrosschainFlags(ctx context.Context, req *MsgUpdateCrosschainFlags) (*MsgUpdateCrosschainFlagsResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method UpdateCrosschainFlags not implemented")
}
func (*UnimplementedMsgServer) UpdateKeygen(ctx context.Context, req *MsgUpdateKeygen) (*MsgUpdateKeygenResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateKeygen not implemented")
}
+func (*UnimplementedMsgServer) AddBlockHeader(ctx context.Context, req *MsgAddBlockHeader) (*MsgAddBlockHeaderResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method AddBlockHeader not implemented")
+}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv)
@@ -720,20 +865,20 @@ func _Msg_AddBlameVote_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler)
}
-func _Msg_UpdatePermissionFlags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(MsgUpdatePermissionFlags)
+func _Msg_UpdateCrosschainFlags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(MsgUpdateCrosschainFlags)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(MsgServer).UpdatePermissionFlags(ctx, in)
+ return srv.(MsgServer).UpdateCrosschainFlags(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/zetachain.zetacore.observer.Msg/UpdatePermissionFlags",
+ FullMethod: "/zetachain.zetacore.observer.Msg/UpdateCrosschainFlags",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(MsgServer).UpdatePermissionFlags(ctx, req.(*MsgUpdatePermissionFlags))
+ return srv.(MsgServer).UpdateCrosschainFlags(ctx, req.(*MsgUpdateCrosschainFlags))
}
return interceptor(ctx, in, info, handler)
}
@@ -756,6 +901,24 @@ func _Msg_UpdateKeygen_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler)
}
+func _Msg_AddBlockHeader_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(MsgAddBlockHeader)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(MsgServer).AddBlockHeader(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/zetachain.zetacore.observer.Msg/AddBlockHeader",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(MsgServer).AddBlockHeader(ctx, req.(*MsgAddBlockHeader))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "zetachain.zetacore.observer.Msg",
HandlerType: (*MsgServer)(nil),
@@ -773,18 +936,102 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
Handler: _Msg_AddBlameVote_Handler,
},
{
- MethodName: "UpdatePermissionFlags",
- Handler: _Msg_UpdatePermissionFlags_Handler,
+ MethodName: "UpdateCrosschainFlags",
+ Handler: _Msg_UpdateCrosschainFlags_Handler,
},
{
MethodName: "UpdateKeygen",
Handler: _Msg_UpdateKeygen_Handler,
},
+ {
+ MethodName: "AddBlockHeader",
+ Handler: _Msg_AddBlockHeader_Handler,
+ },
},
Streams: []grpc.StreamDesc{},
Metadata: "observer/tx.proto",
}
+func (m *MsgAddBlockHeader) 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 *MsgAddBlockHeader) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *MsgAddBlockHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ {
+ size, err := m.Header.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintTx(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x2a
+ if m.Height != 0 {
+ i = encodeVarintTx(dAtA, i, uint64(m.Height))
+ i--
+ dAtA[i] = 0x20
+ }
+ if len(m.BlockHash) > 0 {
+ i -= len(m.BlockHash)
+ copy(dAtA[i:], m.BlockHash)
+ i = encodeVarintTx(dAtA, i, uint64(len(m.BlockHash)))
+ i--
+ dAtA[i] = 0x1a
+ }
+ if m.ChainId != 0 {
+ i = encodeVarintTx(dAtA, i, uint64(m.ChainId))
+ i--
+ dAtA[i] = 0x10
+ }
+ if len(m.Creator) > 0 {
+ i -= len(m.Creator)
+ copy(dAtA[i:], m.Creator)
+ i = encodeVarintTx(dAtA, i, uint64(len(m.Creator)))
+ i--
+ dAtA[i] = 0xa
+ }
+ return len(dAtA) - i, nil
+}
+
+func (m *MsgAddBlockHeaderResponse) 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 *MsgAddBlockHeaderResponse) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *MsgAddBlockHeaderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ return len(dAtA) - i, nil
+}
+
func (m *MsgUpdateCoreParams) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@@ -997,7 +1244,7 @@ func (m *MsgAddBlameVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
return len(dAtA) - i, nil
}
-func (m *MsgUpdatePermissionFlags) Marshal() (dAtA []byte, err error) {
+func (m *MsgUpdateCrosschainFlags) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
@@ -1007,16 +1254,28 @@ func (m *MsgUpdatePermissionFlags) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil
}
-func (m *MsgUpdatePermissionFlags) MarshalTo(dAtA []byte) (int, error) {
+func (m *MsgUpdateCrosschainFlags) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
-func (m *MsgUpdatePermissionFlags) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+func (m *MsgUpdateCrosschainFlags) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
+ if m.GasPriceIncreaseFlags != nil {
+ {
+ size, err := m.GasPriceIncreaseFlags.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintTx(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x2a
+ }
if m.IsOutboundEnabled {
i--
if m.IsOutboundEnabled {
@@ -1047,7 +1306,7 @@ func (m *MsgUpdatePermissionFlags) MarshalToSizedBuffer(dAtA []byte) (int, error
return len(dAtA) - i, nil
}
-func (m *MsgUpdatePermissionFlagsResponse) Marshal() (dAtA []byte, err error) {
+func (m *MsgUpdateCrosschainFlagsResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
@@ -1057,12 +1316,12 @@ func (m *MsgUpdatePermissionFlagsResponse) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil
}
-func (m *MsgUpdatePermissionFlagsResponse) MarshalTo(dAtA []byte) (int, error) {
+func (m *MsgUpdateCrosschainFlagsResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
-func (m *MsgUpdatePermissionFlagsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+func (m *MsgUpdateCrosschainFlagsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
@@ -1139,6 +1398,40 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
return base
}
+func (m *MsgAddBlockHeader) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.Creator)
+ if l > 0 {
+ n += 1 + l + sovTx(uint64(l))
+ }
+ if m.ChainId != 0 {
+ n += 1 + sovTx(uint64(m.ChainId))
+ }
+ l = len(m.BlockHash)
+ if l > 0 {
+ n += 1 + l + sovTx(uint64(l))
+ }
+ if m.Height != 0 {
+ n += 1 + sovTx(uint64(m.Height))
+ }
+ l = m.Header.Size()
+ n += 1 + l + sovTx(uint64(l))
+ return n
+}
+
+func (m *MsgAddBlockHeaderResponse) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ return n
+}
+
func (m *MsgUpdateCoreParams) Size() (n int) {
if m == nil {
return 0
@@ -1227,7 +1520,7 @@ func (m *MsgAddBlameVoteResponse) Size() (n int) {
return n
}
-func (m *MsgUpdatePermissionFlags) Size() (n int) {
+func (m *MsgUpdateCrosschainFlags) Size() (n int) {
if m == nil {
return 0
}
@@ -1243,10 +1536,14 @@ func (m *MsgUpdatePermissionFlags) Size() (n int) {
if m.IsOutboundEnabled {
n += 2
}
+ if m.GasPriceIncreaseFlags != nil {
+ l = m.GasPriceIncreaseFlags.Size()
+ n += 1 + l + sovTx(uint64(l))
+ }
return n
}
-func (m *MsgUpdatePermissionFlagsResponse) Size() (n int) {
+func (m *MsgUpdateCrosschainFlagsResponse) Size() (n int) {
if m == nil {
return 0
}
@@ -1286,6 +1583,243 @@ func sovTx(x uint64) (n int) {
func sozTx(x uint64) (n int) {
return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
+func (m *MsgAddBlockHeader) 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: MsgAddBlockHeader: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: MsgAddBlockHeader: 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 != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType)
+ }
+ m.ChainId = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTx
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.ChainId |= int64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ case 3:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType)
+ }
+ var byteLen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTx
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ byteLen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if byteLen < 0 {
+ return ErrInvalidLengthTx
+ }
+ postIndex := iNdEx + byteLen
+ if postIndex < 0 {
+ return ErrInvalidLengthTx
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.BlockHash = append(m.BlockHash[:0], dAtA[iNdEx:postIndex]...)
+ if m.BlockHash == nil {
+ m.BlockHash = []byte{}
+ }
+ iNdEx = postIndex
+ case 4:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType)
+ }
+ m.Height = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTx
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.Height |= int64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ case 5:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTx
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthTx
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthTx
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipTx(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthTx
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+func (m *MsgAddBlockHeaderResponse) 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: MsgAddBlockHeaderResponse: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: MsgAddBlockHeaderResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ default:
+ iNdEx = preIndex
+ skippy, err := skipTx(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthTx
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
func (m *MsgUpdateCoreParams) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
@@ -1857,7 +2391,7 @@ func (m *MsgAddBlameVoteResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *MsgUpdatePermissionFlags) Unmarshal(dAtA []byte) error {
+func (m *MsgUpdateCrosschainFlags) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -1880,10 +2414,10 @@ func (m *MsgUpdatePermissionFlags) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: MsgUpdatePermissionFlags: wiretype end group for non-group")
+ return fmt.Errorf("proto: MsgUpdateCrosschainFlags: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: MsgUpdatePermissionFlags: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: MsgUpdateCrosschainFlags: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
@@ -1958,6 +2492,42 @@ func (m *MsgUpdatePermissionFlags) Unmarshal(dAtA []byte) error {
}
}
m.IsOutboundEnabled = bool(v != 0)
+ case 5:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field GasPriceIncreaseFlags", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTx
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthTx
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthTx
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if m.GasPriceIncreaseFlags == nil {
+ m.GasPriceIncreaseFlags = &GasPriceIncreaseFlags{}
+ }
+ if err := m.GasPriceIncreaseFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
@@ -1979,7 +2549,7 @@ func (m *MsgUpdatePermissionFlags) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *MsgUpdatePermissionFlagsResponse) Unmarshal(dAtA []byte) error {
+func (m *MsgUpdateCrosschainFlagsResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -2002,10 +2572,10 @@ func (m *MsgUpdatePermissionFlagsResponse) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: MsgUpdatePermissionFlagsResponse: wiretype end group for non-group")
+ return fmt.Errorf("proto: MsgUpdateCrosschainFlagsResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: MsgUpdatePermissionFlagsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: MsgUpdateCrosschainFlagsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
diff --git a/x/observer/types/types.go b/x/observer/types/types.go
deleted file mode 100644
index ab1254f4c2..0000000000
--- a/x/observer/types/types.go
+++ /dev/null
@@ -1 +0,0 @@
-package types
diff --git a/zetaclient/bitcoin_client.go b/zetaclient/bitcoin_client.go
index 3bac40f411..b41dd6fc70 100644
--- a/zetaclient/bitcoin_client.go
+++ b/zetaclient/bitcoin_client.go
@@ -56,10 +56,10 @@ type BitcoinChainClient struct {
BlockTime uint64 // block time in seconds
Mu *sync.Mutex // lock for all the maps, utxos and core params
- pendingCctx map[string]*types.CrossChainTx
+ pendingNonce uint64
includedTxHashes map[string]uint64 // key: tx hash
includedTxResults map[string]btcjson.GetTransactionResult // key: chain-tss-nonce
- broadcastedTx map[string]chainhash.Hash
+ broadcastedTx map[string]string // key: chain-tss-nonce, value: outTx hash
utxos []btcjson.ListUnspentResult
params observertypes.CoreParams
@@ -71,7 +71,6 @@ type BitcoinChainClient struct {
const (
minConfirmations = 0
- chunkSize = 1000
maxHeightDiff = 10000
dustOffset = 2000
)
@@ -137,10 +136,9 @@ func NewBitcoinClient(chain common.Chain, bridge *ZetaCoreBridge, tss TSSSigner,
ob.zetaClient = bridge
ob.Tss = tss
- ob.pendingCctx = make(map[string]*types.CrossChainTx)
ob.includedTxHashes = make(map[string]uint64)
ob.includedTxResults = make(map[string]btcjson.GetTransactionResult)
- ob.broadcastedTx = make(map[string]chainhash.Hash)
+ ob.broadcastedTx = make(map[string]string)
ob.params = btcCfg.CoreParams
// initialize the Client
@@ -235,6 +233,12 @@ func (ob *BitcoinChainClient) GetLastBlockHeightScanned() int64 {
return height
}
+func (ob *BitcoinChainClient) GetPendingNonce() uint64 {
+ ob.Mu.Lock()
+ defer ob.Mu.Unlock()
+ return ob.pendingNonce
+}
+
// GetBaseGasPrice ...
// TODO: implement
// https://github.com/zeta-chain/node/issues/868
@@ -271,17 +275,18 @@ func (ob *BitcoinChainClient) observeInTx() error {
}
// "confirmed" current block number
+ // #nosec G701 always in range
confirmedBlockNum := cnt - int64(ob.GetCoreParams().ConfirmationCount)
if confirmedBlockNum < 0 || confirmedBlockNum > math2.MaxInt64 {
return fmt.Errorf("skipping observer , confirmedBlockNum is negative or too large ")
}
ob.SetLastBlockHeight(confirmedBlockNum)
- permissions, err := ob.zetaClient.GetPermissionFlags()
+ flags, err := ob.zetaClient.GetCrosschainFlags()
if err != nil {
return err
}
- if !permissions.IsInboundEnabled {
+ if !flags.IsInboundEnabled {
return errors.New("inbound TXS / Send has been disabled by the protocol")
}
@@ -312,6 +317,7 @@ func (ob *BitcoinChainClient) observeInTx() error {
}
tssAddress := ob.Tss.BTCAddress()
+ // #nosec G701 always positive
inTxs := FilterAndParseIncomingTx(block.Tx, uint64(block.Height), tssAddress, &ob.logger.WatchInTx)
for _, inTx := range inTxs {
@@ -342,7 +348,7 @@ func (ob *BitcoinChainClient) ConfirmationsThreshold(amount *big.Int) int64 {
return 2
}
-// returns isIncluded, isConfirmed, Error
+// returns isIncluded(or inMempool), isConfirmed, Error
func (ob *BitcoinChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, _ common.CoinType, logger zerolog.Logger) (bool, bool, error) {
outTxID := ob.GetTxID(nonce)
logger.Info().Msgf("IsSendOutTxProcessed %s", outTxID)
@@ -363,16 +369,25 @@ func (ob *BitcoinChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64
return false, false, nil
}
- // Try including this outTx
- ob.logger.ObserveOutTx.Info().Msgf("IsSendOutTxProcessed: checking pending outTx %s", txnHash.String())
- err = ob.checkNSaveIncludedTx(txnHash.String(), params)
+ // Try including this outTx broadcasted by myself
+ inMempool, err := ob.checkNSaveIncludedTx(txnHash, params)
if err != nil {
ob.logger.ObserveOutTx.Error().Err(err).Msg("IsSendOutTxProcessed: checkNSaveIncludedTx failed")
return false, false, nil
}
+ if inMempool { // to avoid unnecessary Tss keysign
+ ob.logger.ObserveOutTx.Info().Msgf("IsSendOutTxProcessed: outTx %s is still in mempool", outTxID)
+ return true, false, nil
+ }
+
+ // Get tx result again in case it is just included
ob.Mu.Lock()
- res = ob.includedTxResults[outTxID] // refresh tx result
+ res, included = ob.includedTxResults[outTxID]
ob.Mu.Unlock()
+ if !included {
+ return false, false, nil
+ }
+ ob.logger.ObserveOutTx.Info().Msgf("IsSendOutTxProcessed: checkNSaveIncludedTx succeeded for outTx %s", outTxID)
}
var amount float64
@@ -395,9 +410,11 @@ func (ob *BitcoinChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64
zetaHash, err := ob.zetaClient.PostReceiveConfirmation(
sendHash,
res.TxID,
+ // #nosec G701 always positive
uint64(res.BlockIndex),
0, // gas used not used with Bitcoin
nil, // gas price not used with Bitcoin
+ 0, // gas limit not used with Bitcoin
amountInSat,
common.ReceiveStatus_Success,
ob.chain,
@@ -436,6 +453,7 @@ func (ob *BitcoinChainClient) PostGasPrice() error {
if err != nil {
return err
}
+ // #nosec G701 always in range
zetaHash, err := ob.zetaClient.PostGasPrice(ob.chain, 1000, "100", uint64(bn))
if err != nil {
ob.logger.WatchGasPrice.Err(err).Msg("PostGasPrice:")
@@ -459,6 +477,7 @@ func (ob *BitcoinChainClient) PostGasPrice() error {
if err != nil {
return err
}
+ // #nosec G701 always positive
zetaHash, err := ob.zetaClient.PostGasPrice(ob.chain, gasPriceU64, "100", uint64(bn))
if err != nil {
ob.logger.WatchGasPrice.Err(err).Msg("PostGasPrice:")
@@ -608,7 +627,7 @@ func (ob *BitcoinChainClient) WatchUTXOS() {
for {
select {
case <-ticker.C():
- err := ob.fetchUTXOS()
+ err := ob.FetchUTXOS()
if err != nil {
ob.logger.WatchUTXOS.Error().Err(err).Msg("error fetching btc utxos")
}
@@ -620,12 +639,16 @@ func (ob *BitcoinChainClient) WatchUTXOS() {
}
}
-func (ob *BitcoinChainClient) fetchUTXOS() error {
+func (ob *BitcoinChainClient) FetchUTXOS() error {
defer func() {
if err := recover(); err != nil {
ob.logger.WatchUTXOS.Error().Msgf("BTC fetchUTXOS: caught panic error: %v", err)
}
}()
+
+ // This is useful when a zetaclient's pending nonce lagged behind for whatever reason.
+ ob.refreshPendingNonce()
+
// get the current block height.
bh, err := ob.rpcClient.GetBlockCount()
if err != nil {
@@ -640,24 +663,13 @@ func (ob *BitcoinChainClient) fetchUTXOS() error {
return fmt.Errorf("btc: error decoding wallet address (%s) : %s", tssAddr, err.Error())
}
addresses := []btcutil.Address{address}
- var utxos []btcjson.ListUnspentResult
- // populate utxos array
- for i := minConfirmations; i < maxConfirmations; i += chunkSize {
- unspents, err := ob.rpcClient.ListUnspentMinMaxAddresses(i, i+chunkSize, addresses)
- if err != nil {
- return err
- }
- utxos = append(utxos, unspents...)
- //ob.logger.WatchUTXOS.Debug().Msgf("btc: fetched %d utxos", len(unspents))
- //for idx, utxo := range unspents {
- // fmt.Printf("utxo %d\n", idx)
- // fmt.Printf(" txid: %s\n", utxo.TxID)
- // fmt.Printf(" address: %s\n", utxo.Address)
- // fmt.Printf(" amount: %f\n", utxo.Amount)
- // fmt.Printf(" confirmations: %d\n", utxo.Confirmations)
- //}
+ // fetching all TSS utxos takes 160ms
+ utxos, err := ob.rpcClient.ListUnspentMinMaxAddresses(0, maxConfirmations, addresses)
+ if err != nil {
+ return err
}
+ //ob.logger.WatchUTXOS.Debug().Msgf("btc: fetched %d utxos in confirmation range [0, %d]", len(unspents), maxConfirmations)
// rigid sort to make utxo list deterministic
sort.SliceStable(utxos, func(i, j int) bool {
@@ -677,23 +689,71 @@ func (ob *BitcoinChainClient) fetchUTXOS() error {
return nil
}
-// Set `test` flag to true in unit test to bypass query to zetacore
-func (ob *BitcoinChainClient) findTxIDByNonce(nonce uint64, test bool) (string, error) {
+// refreshPendingNonce tries increasing the artificial pending nonce of outTx (if lagged behind).
+// There could be many (unpredictable) reasons for a pending nonce lagging behind, for example:
+// 1. The zetaclient gets restarted.
+// 2. The tracker is missing in zetacore.
+func (ob *BitcoinChainClient) refreshPendingNonce() {
+ // get pending nonces from zetacore
+ p, err := ob.zetaClient.GetPendingNoncesByChain(ob.chain.ChainId)
+ if err != nil {
+ ob.logger.ChainLogger.Error().Err(err).Msg("refreshPendingNonce: error getting pending nonces")
+ }
+
+ // increase pending nonce if lagged behind
+ ob.Mu.Lock()
+ pendingNonce := ob.pendingNonce
+ ob.Mu.Unlock()
+
+ // #nosec G701 always positive
+ nonceLow := uint64(p.NonceLow)
+
+ if nonceLow > 0 && nonceLow >= pendingNonce {
+ // get the last included outTx hash
+ txid, err := ob.getOutTxidByNonce(nonceLow-1, false)
+ if err != nil {
+ ob.logger.ChainLogger.Error().Err(err).Msg("refreshPendingNonce: error getting last outTx txid")
+ }
+
+ // set 'NonceLow' as the new pending nonce
+ ob.Mu.Lock()
+ defer ob.Mu.Unlock()
+ ob.pendingNonce = nonceLow
+ ob.logger.ChainLogger.Info().Msgf("refreshPendingNonce: increase pending nonce to %d with txid %s", ob.pendingNonce, txid)
+ }
+}
+
+func (ob *BitcoinChainClient) getOutTxidByNonce(nonce uint64, test bool) (string, error) {
ob.Mu.Lock()
res, included := ob.includedTxResults[ob.GetTxID(nonce)]
ob.Mu.Unlock()
+ // There are 2 types of txids an observer can trust
+ // 1. The ones had been verified and saved by observer self.
+ // 2. The ones had been finalized in zetacore based on majority vote.
if included {
return res.TxID, nil
}
if !test { // if not unit test, get cctx from zetacore
send, err := ob.zetaClient.GetCctxByNonce(ob.chain.ChainId, nonce)
if err != nil {
- return "", errors.Wrapf(err, "findTxIDByNonce: error getting cctx for nonce %d", nonce)
+ return "", errors.Wrapf(err, "getOutTxidByNonce: error getting cctx for nonce %d", nonce)
+ }
+ txid := send.GetCurrentOutTxParam().OutboundTxHash
+ if txid == "" {
+ return "", fmt.Errorf("getOutTxidByNonce: cannot find outTx txid for nonce %d", nonce)
+ }
+ // make sure it's a real Bitcoin txid
+ _, getTxResult, err := ob.GetTxResultByHash(txid)
+ if err != nil {
+ return "", errors.Wrapf(err, "getOutTxidByNonce: error getting outTx result for nonce %d hash %s", nonce, txid)
+ }
+ if getTxResult.Confirmations <= 0 { // just a double check
+ return "", fmt.Errorf("getOutTxidByNonce: outTx txid %s for nonce %d is not included", txid, nonce)
}
- return send.GetCurrentOutTxParam().OutboundTxHash, nil
+ return txid, nil
}
- return "", fmt.Errorf("findTxIDByNonce: error getting cctx for nonce %d", nonce)
+ return "", fmt.Errorf("getOutTxidByNonce: cannot find outTx txid for nonce %d", nonce)
}
func (ob *BitcoinChainClient) findNonceMarkUTXO(nonce uint64, txid string) (int, error) {
@@ -705,7 +765,7 @@ func (ob *BitcoinChainClient) findNonceMarkUTXO(nonce uint64, txid string) (int,
ob.logger.ObserveOutTx.Error().Err(err).Msgf("findNonceMarkUTXO: error getting satoshis for utxo %v", utxo)
}
if utxo.Address == tssAddress && sats == amount && utxo.TxID == txid {
- ob.logger.ObserveOutTx.Info().Msgf("findNonceMarkUTXO: found nonce-mark utxo with txid %s, amount %v", utxo.TxID, utxo.Amount)
+ ob.logger.ObserveOutTx.Info().Msgf("findNonceMarkUTXO: found nonce-mark utxo with txid %s, amount %d satoshi", utxo.TxID, sats)
return i, nil
}
}
@@ -729,7 +789,7 @@ func (ob *BitcoinChainClient) SelectUTXOs(amount float64, utxoCap uint8, nonce u
defer ob.Mu.Unlock()
} else {
// for nonce > 0; we proceed only when we see the nonce-mark utxo
- preTxid, err := ob.findTxIDByNonce(nonce-1, test)
+ preTxid, err := ob.getOutTxidByNonce(nonce-1, test)
if err != nil {
return nil, 0, err
}
@@ -777,14 +837,14 @@ func (ob *BitcoinChainClient) SelectUTXOs(amount float64, utxoCap uint8, nonce u
}
// Save successfully broadcasted transaction
-func (ob *BitcoinChainClient) SaveBroadcastedTx(txHash chainhash.Hash, nonce uint64) {
+func (ob *BitcoinChainClient) SaveBroadcastedTx(txHash string, nonce uint64) {
outTxID := ob.GetTxID(nonce)
ob.Mu.Lock()
ob.broadcastedTx[outTxID] = txHash
ob.Mu.Unlock()
- broadcastEntry := clienttypes.ToTransactionHashSQLType(txHash, outTxID)
- if err := ob.db.Create(&broadcastEntry).Error; err != nil {
+ broadcastEntry := clienttypes.ToOutTxHashSQLType(txHash, outTxID)
+ if err := ob.db.Save(&broadcastEntry).Error; err != nil {
ob.logger.ObserveOutTx.Error().Err(err).Msg("observeOutTx: error saving broadcasted tx")
}
}
@@ -831,7 +891,7 @@ func (ob *BitcoinChainClient) observeOutTx() {
}
// verify outTx hashes
for _, txHash := range tracker.HashList {
- err := ob.checkNSaveIncludedTx(txHash.TxHash, params)
+ _, err := ob.checkNSaveIncludedTx(txHash.TxHash, params)
if err != nil {
ob.logger.ObserveOutTx.Error().Err(err).Msg("observeOutTx: checkNSaveIncludedTx failed")
}
@@ -845,29 +905,36 @@ func (ob *BitcoinChainClient) observeOutTx() {
}
}
-// The func either includes a new outTx or update an existing outTx result.
-func (ob *BitcoinChainClient) checkNSaveIncludedTx(txHash string, params types.OutboundTxParams) error {
+// checkNSaveIncludedTx either includes a new outTx or update an existing outTx result.
+// Returns inMempool, error
+func (ob *BitcoinChainClient) checkNSaveIncludedTx(txHash string, params types.OutboundTxParams) (bool, error) {
outTxID := ob.GetTxID(params.OutboundTxTssNonce)
hash, getTxResult, err := ob.GetTxResultByHash(txHash)
if err != nil {
- return errors.Wrapf(err, "checkNSaveIncludedTx: error GetTxResultByHash: %s", txHash)
+ return false, errors.Wrapf(err, "checkNSaveIncludedTx: error GetTxResultByHash: %s", txHash)
}
if getTxResult.Confirmations >= 0 { // check included tx only
err = ob.checkTssOutTxResult(hash, getTxResult, params, params.OutboundTxTssNonce)
if err != nil {
- return errors.Wrapf(err, "checkNSaveIncludedTx: error verify bitcoin outTx %s outTxID %s", txHash, outTxID)
+ return false, errors.Wrapf(err, "checkNSaveIncludedTx: error verify bitcoin outTx %s outTxID %s", txHash, outTxID)
}
ob.Mu.Lock()
defer ob.Mu.Unlock()
nonce, foundHash := ob.includedTxHashes[txHash]
res, foundRes := ob.includedTxResults[outTxID]
- if !foundHash && !foundRes { // enforce rigid 1-to-1 mapping: outTxID(nonce) <===> txHash
+
+ // include new outTx and enforce rigid 1-to-1 mapping: outTxID(nonce) <===> txHash
+ if !foundHash && !foundRes {
ob.includedTxHashes[txHash] = params.OutboundTxTssNonce
ob.includedTxResults[outTxID] = *getTxResult
+ if params.OutboundTxTssNonce >= ob.pendingNonce { // try increasing pending nonce on every newly included outTx
+ ob.pendingNonce = params.OutboundTxTssNonce
+ }
ob.logger.ObserveOutTx.Info().Msgf("checkNSaveIncludedTx: included new bitcoin outTx %s outTxID %s", txHash, outTxID)
}
- if foundHash && foundRes { // update tx result
+ // update saved tx result as confirmations may increase
+ if foundHash && foundRes {
ob.includedTxResults[outTxID] = *getTxResult
if getTxResult.Confirmations > res.Confirmations {
ob.logger.ObserveOutTx.Info().Msgf("checkNSaveIncludedTx: bitcoin outTx %s got confirmations %d", txHash, getTxResult.Confirmations)
@@ -879,8 +946,9 @@ func (ob *BitcoinChainClient) checkNSaveIncludedTx(txHash string, params types.O
if foundHash && !foundRes {
ob.logger.ObserveOutTx.Error().Msgf("checkNSaveIncludedTx: unreachable code path! outTx %s outTxID %s, prior nonce %d, current nonce %d", txHash, outTxID, nonce, params.OutboundTxTssNonce)
}
+ return false, nil
}
- return nil
+ return true, nil // in mempool
}
// Basic TSS outTX checks:
@@ -962,14 +1030,14 @@ func (ob *BitcoinChainClient) checkTSSVin(vins []btcjson.Vin, nonce uint64) erro
}
// 1st vin: nonce-mark MUST come from prior TSS outTx
if nonce > 0 && i == 0 {
- _, err := ob.findTxIDByNonce(nonce-1, false)
+ preTxid, err := ob.getOutTxidByNonce(nonce-1, false)
if err != nil {
return fmt.Errorf("checkTSSVin: error findTxIDByNonce %d", nonce-1)
}
- // TODO: enable this check after bootstrap
- // if vin.Txid != preTxid || vin.Vout != 0 {
- // return fmt.Errorf("checkTSSVin: invalid nonce-mark txid %s vout %d, expected txid %s vout 0", vin.Txid, vin.Vout, preTxid)
- // }
+ // nonce-mark MUST the 1st output that comes from prior TSS outTx
+ if vin.Txid != preTxid || vin.Vout != 0 {
+ return fmt.Errorf("checkTSSVin: invalid nonce-mark txid %s vout %d, expected txid %s vout 0", vin.Txid, vin.Vout, preTxid)
+ }
}
}
return nil
@@ -1024,7 +1092,8 @@ func (ob *BitcoinChainClient) checkTSSVout(vouts []btcjson.Vout, params types.Ou
if recvAddress != params.Receiver {
return fmt.Errorf("checkTSSVout: output address %s not match params receiver %s", recvAddress, params.Receiver)
}
- if amount != int64(params.Amount.Uint64()) {
+ // #nosec G701 always positive
+ if uint64(amount) != params.Amount.Uint64() {
return fmt.Errorf("checkTSSVout: output amount %d not match params amount %d", amount, params.Amount)
}
}
@@ -1039,7 +1108,7 @@ func (ob *BitcoinChainClient) checkTSSVout(vouts []btcjson.Vout, params types.Ou
}
func (ob *BitcoinChainClient) BuildBroadcastedTxMap() error {
- var broadcastedTransactions []clienttypes.TransactionHashSQLType
+ var broadcastedTransactions []clienttypes.OutTxHashSQLType
if err := ob.db.Find(&broadcastedTransactions).Error; err != nil {
ob.logger.ChainLogger.Error().Err(err).Msg("error iterating over db")
return err
@@ -1094,7 +1163,7 @@ func (ob *BitcoinChainClient) loadDB(dbpath string) error {
ob.db = db
err = db.AutoMigrate(&clienttypes.TransactionResultSQLType{},
- &clienttypes.TransactionHashSQLType{},
+ &clienttypes.OutTxHashSQLType{},
&clienttypes.LastBlockSQLType{})
if err != nil {
return err
@@ -1119,5 +1188,6 @@ func (ob *BitcoinChainClient) GetTxID(nonce uint64) string {
// A very special value to mark current nonce in UTXO
func NonceMarkAmount(nonce uint64) int64 {
+ // #nosec G701 always in range
return int64(nonce) + dustOffset // +2000 to avoid being a dust rejection
}
diff --git a/zetaclient/broadcast.go b/zetaclient/broadcast.go
index a9c9c91b3c..c41333811e 100644
--- a/zetaclient/broadcast.go
+++ b/zetaclient/broadcast.go
@@ -13,7 +13,6 @@ import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
flag "github.com/spf13/pflag"
rpchttp "github.com/tendermint/tendermint/rpc/client/http"
- "github.com/zeta-chain/zetacore/app"
)
// Broadcast Broadcasts tx to metachain. Returns txHash and error
@@ -81,7 +80,7 @@ func (b *ZetaCoreBridge) Broadcast(gaslimit uint64, authzWrappedMsg sdktypes.Msg
if len(matches) != 3 {
return "", err
}
- expectedSeq, err := strconv.Atoi(matches[1])
+ expectedSeq, err := strconv.ParseUint(matches[1], 10, 64)
if err != nil {
b.logger.Warn().Msgf("cannot parse expected seq %s", matches[1])
return "", err
@@ -91,7 +90,7 @@ func (b *ZetaCoreBridge) Broadcast(gaslimit uint64, authzWrappedMsg sdktypes.Msg
b.logger.Warn().Msgf("cannot parse got seq %s", matches[2])
return "", err
}
- b.seqNumber[authzSigner.KeyType] = uint64(expectedSeq)
+ b.seqNumber[authzSigner.KeyType] = expectedSeq
b.logger.Warn().Msgf("Reset seq number to %d (from err msg) from %d", b.seqNumber[authzSigner.KeyType], gotSeq)
}
return commit.TxHash, fmt.Errorf("fail to broadcast to zetachain,code:%d, log:%s", commit.Code, commit.RawLog)
@@ -110,8 +109,11 @@ func (b *ZetaCoreBridge) Broadcast(gaslimit uint64, authzWrappedMsg sdktypes.Msg
// GetContext return a valid context with all relevant values set
func (b *ZetaCoreBridge) GetContext() client.Context {
ctx := client.Context{}
- addr, _ := b.keys.GetSignerInfo().GetAddress()
- // TODO : Handle error
+ addr, err := b.keys.GetSignerInfo().GetAddress()
+ if err != nil {
+ // TODO : Handle error
+ b.logger.Error().Err(err).Msg("fail to get address from key")
+ }
ctx = ctx.WithKeyring(b.keys.GetKeybase())
ctx = ctx.WithChainID(b.zetaChainID)
ctx = ctx.WithHomeDir(b.cfg.ChainHomeFolder)
@@ -119,11 +121,10 @@ func (b *ZetaCoreBridge) GetContext() client.Context {
ctx = ctx.WithFromAddress(addr)
ctx = ctx.WithBroadcastMode("sync")
- encodingConfig := app.MakeEncodingConfig()
- ctx = ctx.WithCodec(encodingConfig.Codec)
- ctx = ctx.WithInterfaceRegistry(encodingConfig.InterfaceRegistry)
- ctx = ctx.WithTxConfig(encodingConfig.TxConfig)
- ctx = ctx.WithLegacyAmino(encodingConfig.Amino)
+ ctx = ctx.WithCodec(b.encodingCfg.Codec)
+ ctx = ctx.WithInterfaceRegistry(b.encodingCfg.InterfaceRegistry)
+ ctx = ctx.WithTxConfig(b.encodingCfg.TxConfig)
+ ctx = ctx.WithLegacyAmino(b.encodingCfg.Amino)
ctx = ctx.WithAccountRetriever(authtypes.AccountRetriever{})
remote := b.cfg.ChainRPC
diff --git a/zetaclient/btc_signer.go b/zetaclient/btc_signer.go
index 4b0ab4cd94..a31f77bc85 100644
--- a/zetaclient/btc_signer.go
+++ b/zetaclient/btc_signer.go
@@ -64,6 +64,12 @@ func (signer *BTCSigner) SignWithdrawTx(to *btcutil.AddressWitnessPubKeyHash, am
minFee := 0.00005
nonceMark := NonceMarkAmount(nonce)
+ // refresh unspent UTXOs and continue with keysign regardless of error
+ err := btcClient.FetchUTXOS()
+ if err != nil {
+ signer.logger.Error().Err(err).Msgf("SignWithdrawTx: FetchUTXOS error: nonce %d chain %d", nonce, chain.ChainId)
+ }
+
// select N UTXOs to cover the total expense
prevOuts, total, err := btcClient.SelectUTXOs(amount+estimateFee+float64(nonceMark)*1e-8, maxNoOfInputsPerTx, nonce, false)
if err != nil {
@@ -90,8 +96,10 @@ func (signer *BTCSigner) SignWithdrawTx(to *btcutil.AddressWitnessPubKeyHash, am
// fee checking
fees := new(big.Int).Mul(big.NewInt(int64(tx.SerializeSize())), gasPrice)
fees.Div(fees, big.NewInt(1000)) //FIXME: feeRate KB is 1000B or 1024B?
+ // #nosec G701 always in range
if fees.Int64() < int64(minFee*1e8) {
fmt.Printf("fees %d is less than minFee %f; use minFee", fees, minFee*1e8)
+ // #nosec G701 always in range
fees = big.NewInt(int64(minFee * 1e8))
}
@@ -182,7 +190,10 @@ func (signer *BTCSigner) Broadcast(signedTx *wire.MsgTx) error {
fmt.Printf("BTCSigner: Broadcasting: %s\n", signedTx.TxHash().String())
var outBuff bytes.Buffer
- _ = signedTx.Serialize(&outBuff)
+ err := signedTx.Serialize(&outBuff)
+ if err != nil {
+ return err
+ }
str := hex.EncodeToString(outBuff.Bytes())
fmt.Printf("BTCSigner: Transaction Data: %s\n", str)
@@ -191,11 +202,12 @@ func (signer *BTCSigner) Broadcast(signedTx *wire.MsgTx) error {
return err
}
signer.logger.Info().Msgf("Broadcasting BTC tx , hash %s ", hash)
- return err
+ return nil
}
func (signer *BTCSigner) TryProcessOutTx(send *types.CrossChainTx, outTxMan *OutTxProcessorManager, outTxID string, chainclient ChainClient, zetaBridge *ZetaCoreBridge, height uint64) {
defer func() {
+ outTxMan.EndTryProcess(outTxID)
if err := recover(); err != nil {
signer.logger.Error().Msgf("BTC TryProcessOutTx: %s, caught panic error: %v", send.Index, err)
}
@@ -213,17 +225,14 @@ func (signer *BTCSigner) TryProcessOutTx(send *types.CrossChainTx, outTxMan *Out
}
logger.Info().Msgf("BTC TryProcessOutTx: %s, value %d to %s", send.Index, params.Amount.BigInt(), params.Receiver)
- defer func() {
- outTxMan.EndTryProcess(outTxID)
- }()
btcClient, ok := chainclient.(*BitcoinChainClient)
if !ok {
logger.Error().Msgf("chain client is not a bitcoin client")
return
}
- flags, err := zetaBridge.GetPermissionFlags()
+ flags, err := zetaBridge.GetCrosschainFlags()
if err != nil {
- logger.Error().Err(err).Msgf("cannot get permission flags")
+ logger.Error().Err(err).Msgf("cannot get crosschain flags")
return
}
if !flags.IsOutboundEnabled {
@@ -234,9 +243,13 @@ func (signer *BTCSigner) TryProcessOutTx(send *types.CrossChainTx, outTxMan *Out
// Early return if the send is already processed
// FIXME: handle revert case
outboundTxTssNonce := params.OutboundTxTssNonce
- included, confirmed, _ := btcClient.IsSendOutTxProcessed(send.Index, outboundTxTssNonce, common.CoinType_Gas, logger)
+ included, confirmed, err := btcClient.IsSendOutTxProcessed(send.Index, outboundTxTssNonce, common.CoinType_Gas, logger)
+ if err != nil {
+ logger.Error().Err(err).Msgf("cannot check if send %s is processed", send.Index)
+ return
+ }
if included || confirmed {
- logger.Info().Msgf("CCTX already processed; exit signer")
+ logger.Info().Msgf("CCTX %s already processed; exit signer", outTxID)
return
}
@@ -254,7 +267,7 @@ func (signer *BTCSigner) TryProcessOutTx(send *types.CrossChainTx, outTxMan *Out
}
to, ok := addr.(*btcutil.AddressWitnessPubKeyHash)
if err != nil || !ok {
- logger.Error().Err(err).Msgf("cannot decode address %s ", params.Receiver)
+ logger.Error().Err(err).Msgf("cannot convert address %s to P2WPKH address", params.Receiver)
return
}
@@ -287,14 +300,14 @@ func (signer *BTCSigner) TryProcessOutTx(send *types.CrossChainTx, outTxMan *Out
continue
}
logger.Info().Msgf("Broadcast success: nonce %d to chain %s outTxHash %s", outboundTxTssNonce, btcClient.chain.String(), outTxHash)
- zetaHash, err := zetaBridge.AddTxHashToOutTxTracker(btcClient.chain.ChainId, outboundTxTssNonce, outTxHash)
+ zetaHash, err := zetaBridge.AddTxHashToOutTxTracker(btcClient.chain.ChainId, outboundTxTssNonce, outTxHash, nil, "", -1)
if err != nil {
logger.Err(err).Msgf("Unable to add to tracker on ZetaCore: nonce %d chain %s outTxHash %s", outboundTxTssNonce, btcClient.chain.ChainName, outTxHash)
}
logger.Info().Msgf("Broadcast to core successful %s", zetaHash)
// Save successfully broadcasted transaction to btc chain client
- btcClient.SaveBroadcastedTx(tx.TxHash(), outboundTxTssNonce)
+ btcClient.SaveBroadcastedTx(outTxHash, outboundTxTssNonce)
break // successful broadcast; no need to retry
}
diff --git a/zetaclient/btc_signer_test.go b/zetaclient/btc_signer_test.go
index bbec9057e3..6f405684d0 100644
--- a/zetaclient/btc_signer_test.go
+++ b/zetaclient/btc_signer_test.go
@@ -261,7 +261,7 @@ func TestSelectUTXOs(t *testing.T) {
require.NotNil(t, err)
require.Nil(t, result)
require.Zero(t, amount)
- require.Equal(t, "findTxIDByNonce: error getting cctx for nonce 0", err.Error())
+ require.Equal(t, "getOutTxidByNonce: cannot find outTx txid for nonce 0", err.Error())
mineTxNSetNonceMark(ob, 0, dummyTxID, -1) // mine a transaction for nonce 0
// Case3: nonce = 1, must FAIL without nonce mark utxo
diff --git a/zetaclient/config/config.go b/zetaclient/config/config.go
index 3e57feae58..9c2b36790c 100644
--- a/zetaclient/config/config.go
+++ b/zetaclient/config/config.go
@@ -19,7 +19,10 @@ func Save(config *Config, path string) error {
file := filepath.Join(path, folder, filename)
file = filepath.Clean(file)
- jsonFile, _ := json.MarshalIndent(config, "", " ")
+ jsonFile, err := json.MarshalIndent(config, "", " ")
+ if err != nil {
+ return err
+ }
err = os.WriteFile(file, jsonFile, 0600)
if err != nil {
return err
@@ -55,7 +58,10 @@ func GetPath(inputPath string) string {
path := strings.Split(inputPath, "/")
if len(path) > 0 {
if path[0] == "~" {
- home, _ := os.UserHomeDir()
+ home, err := os.UserHomeDir()
+ if err != nil {
+ return ""
+ }
path[0] = home
}
}
diff --git a/zetaclient/config/config_mainnet.go b/zetaclient/config/config_mainnet.go
index 1622edf923..646b8b3460 100644
--- a/zetaclient/config/config_mainnet.go
+++ b/zetaclient/config/config_mainnet.go
@@ -1,10 +1,11 @@
-//go:build !PRIVNET && !TESTNET
-// +build !PRIVNET,!TESTNET
+//go:build !PRIVNET && !TESTNET && !MOCK_MAINNET
+// +build !PRIVNET,!TESTNET,!MOCK_MAINNET
package config
import (
"github.com/btcsuite/btcd/chaincfg"
+ "github.com/zeta-chain/zetacore/common"
)
const (
@@ -21,9 +22,6 @@ const (
// Constants
// #nosec G101
const (
- DevEthBlockTime = 2
-
- // to catch up:
MaxBlocksPerPeriod = 100
)
@@ -42,13 +40,24 @@ func GetERC20CustodyABI() string {
}
var (
- BitconNetParams = &chaincfg.RegressionNetParams
+ BitconNetParams = &chaincfg.MainNetParams
)
func New() Config {
return Config{
- EVMChainConfigs: nil,
- BitcoinConfig: nil,
- ChainsEnabled: nil,
+ EVMChainConfigs: evmChainConfigs,
+ BitcoinConfig: BitcoinConfig,
+ ChainsEnabled: []common.Chain{},
}
}
+
+var BitcoinConfig = &BTCConfig{}
+
+var evmChainConfigs = map[int64]*EVMConfig{
+ common.EthChain().ChainId: {
+ Chain: common.EthChain(),
+ },
+ common.BscMainnetChain().ChainId: {
+ Chain: common.BscMainnetChain(),
+ },
+}
diff --git a/zetaclient/config/config_mock_mainnet.go b/zetaclient/config/config_mock_mainnet.go
new file mode 100644
index 0000000000..fe7195d1cd
--- /dev/null
+++ b/zetaclient/config/config_mock_mainnet.go
@@ -0,0 +1,63 @@
+//go:build MOCK_MAINNET
+// +build MOCK_MAINNET
+
+package config
+
+import (
+ "github.com/btcsuite/btcd/chaincfg"
+ "github.com/zeta-chain/zetacore/common"
+)
+
+const (
+ BtcConfirmationCount = 1
+ DevEthConfirmationCount = 2
+)
+
+const (
+ // #nosec G101
+ TssTestPrivkey = "2082bc9775d6ee5a05ef221a9d1c00b3cc3ecb274a4317acc0a182bc1e05d1bb"
+ TssTestAddress = "0xE80B6467863EbF8865092544f441da8fD3cF6074"
+)
+
+// Constants
+// #nosec G101
+const (
+ MaxBlocksPerPeriod = 100
+)
+
+const (
+ ConnectorAbiString = `
+[{"inputs":[{"internalType":"address","name":"_zetaTokenAddress","type":"address"},{"internalType":"address","name":"_tssAddress","type":"address"},{"internalType":"address","name":"_tssAddressUpdater","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"originSenderAddress","type":"bytes"},{"indexed":true,"internalType":"uint256","name":"originChainId","type":"uint256"},{"indexed":true,"internalType":"address","name":"destinationAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"},{"indexed":true,"internalType":"bytes32","name":"internalSendHash","type":"bytes32"}],"name":"ZetaReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"originSenderAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"originChainId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"indexed":true,"internalType":"bytes","name":"destinationAddress","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"},{"indexed":true,"internalType":"bytes32","name":"internalSendHash","type":"bytes32"}],"name":"ZetaReverted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"originSenderAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"destinationAddress","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gasLimit","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"zetaParams","type":"bytes"}],"name":"ZetaSent","type":"event"},{"inputs":[],"name":"getLockedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"originSenderAddress","type":"bytes"},{"internalType":"uint256","name":"originChainId","type":"uint256"},{"internalType":"address","name":"destinationAddress","type":"address"},{"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"},{"internalType":"bytes32","name":"internalSendHash","type":"bytes32"}],"name":"onReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"originSenderAddress","type":"address"},{"internalType":"uint256","name":"originChainId","type":"uint256"},{"internalType":"bytes","name":"destinationAddress","type":"bytes"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"},{"internalType":"bytes32","name":"internalSendHash","type":"bytes32"}],"name":"onRevert","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceTssAddressUpdater","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"bytes","name":"destinationAddress","type":"bytes"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"},{"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"internalType":"bytes","name":"zetaParams","type":"bytes"}],"internalType":"struct ZetaInterfaces.SendInput","name":"input","type":"tuple"}],"name":"send","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tssAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tssAddressUpdater","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tssAddress","type":"address"}],"name":"updateTssAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"zetaToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]`
+ ERC20CustodyAbiString = `
+[{"inputs":[{"internalType":"address","name":"_TSSAddress","type":"address"},{"internalType":"address","name":"_TSSAddressUpdater","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidSender","type":"error"},{"inputs":[],"name":"InvalidTSSUpdater","type":"error"},{"inputs":[],"name":"IsPaused","type":"error"},{"inputs":[],"name":"NotPaused","type":"error"},{"inputs":[],"name":"NotWhitelisted","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"recipient","type":"bytes"},{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"}],"name":"Unwhitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"}],"name":"Whitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"TSSAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TSSAddressUpdater","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"recipient","type":"bytes"},{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceTSSAddressUpdater","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"unwhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"updateTSSAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"whitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]`
+)
+
+func GetConnectorABI() string {
+ return ConnectorAbiString
+}
+func GetERC20CustodyABI() string {
+ return ERC20CustodyAbiString
+}
+
+var (
+ BitconNetParams = &chaincfg.MainNetParams
+)
+
+func New() Config {
+ return Config{
+ EVMChainConfigs: evmChainConfigs,
+ BitcoinConfig: BitcoinConfig,
+ ChainsEnabled: []common.Chain{},
+ }
+}
+
+var BitcoinConfig = &BTCConfig{}
+
+var evmChainConfigs = map[int64]*EVMConfig{
+ common.EthChain().ChainId: {
+ Chain: common.EthChain(),
+ },
+ common.BscMainnetChain().ChainId: {
+ Chain: common.BscMainnetChain(),
+ },
+}
diff --git a/zetaclient/config/config_privnet.go b/zetaclient/config/config_privnet.go
index 90776a1561..d801c8dbd7 100644
--- a/zetaclient/config/config_privnet.go
+++ b/zetaclient/config/config_privnet.go
@@ -59,7 +59,4 @@ var evmChainConfigs = map[int64]*EVMConfig{
Chain: common.GoerliChain(),
Endpoint: "http://eth:8545",
},
- common.ZetaChain().ChainId: {
- Chain: common.ZetaChain(),
- },
}
diff --git a/zetaclient/config/config_testnet.go b/zetaclient/config/config_testnet.go
index 3524049268..5a3bf948e0 100644
--- a/zetaclient/config/config_testnet.go
+++ b/zetaclient/config/config_testnet.go
@@ -73,7 +73,4 @@ var evmChainsConfig = map[int64]*EVMConfig{
Chain: common.MumbaiChain(),
Endpoint: "",
},
- common.ZetaChain().ChainId: {
- Chain: common.ZetaChain(),
- },
}
diff --git a/zetaclient/config/types.go b/zetaclient/config/types.go
index 851acda22f..8b731d49b5 100644
--- a/zetaclient/config/types.go
+++ b/zetaclient/config/types.go
@@ -75,7 +75,10 @@ func NewConfig() *Config {
func (c *Config) String() string {
c.cfgLock.RLock()
defer c.cfgLock.RUnlock()
- s, _ := json.MarshalIndent(c, "", "\t")
+ s, err := json.MarshalIndent(c, "", "\t")
+ if err != nil {
+ return ""
+ }
return string(s)
}
diff --git a/zetaclient/evm_client.go b/zetaclient/evm_client.go
index 96984800b9..fecc2048a6 100644
--- a/zetaclient/evm_client.go
+++ b/zetaclient/evm_client.go
@@ -16,10 +16,11 @@ import (
"gorm.io/driver/sqlite"
"gorm.io/gorm"
- "github.com/pkg/errors"
-
"github.com/ethereum/go-ethereum/accounts/abi/bind"
ethtypes "github.com/ethereum/go-ethereum/core/types"
+ "github.com/ethereum/go-ethereum/rlp"
+ lru "github.com/hashicorp/golang-lru"
+ "github.com/pkg/errors"
erc20custody "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/erc20custody.sol"
"github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/zetaconnector.non-eth.sol"
@@ -86,6 +87,8 @@ type EVMChainClient struct {
cfg *config.Config
params observertypes.CoreParams
ts *TelemetryServer
+
+ BlockCache *lru.Cache
}
var _ ChainClient = (*EVMChainClient)(nil)
@@ -130,6 +133,12 @@ func NewEVMChainClient(bridge *ZetaCoreBridge, tss TSSSigner, dbpath string, met
}
ob.evmClient = client
+ ob.BlockCache, err = lru.New(1000)
+ if err != nil {
+ ob.logger.ChainLogger.Error().Err(err).Msg("failed to create block cache")
+ return nil, err
+ }
+
if ob.chain.IsKlaytnChain() {
kclient, err := Dial(evmCfg.Endpoint)
if err != nil {
@@ -281,6 +290,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co
receipt.BlockNumber.Uint64(),
receipt.GasUsed,
transaction.GasPrice(),
+ transaction.Gas(),
transaction.Value(),
recvStatus,
ob.chain,
@@ -301,6 +311,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,
@@ -320,6 +331,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,
@@ -348,6 +360,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co
receivedLog, err := connector.ZetaConnectorNonEthFilterer.ParseZetaReceived(*vLog)
if err == nil {
logger.Info().Msgf("Found (outTx) sendHash %s on chain %s txhash %s", sendHash, ob.chain.String(), vLog.TxHash.Hex())
+ // #nosec G701 checked in range
if int64(confHeight) < ob.GetLastBlockHeight() {
logger.Info().Msg("Confirmed! Sending PostConfirmation to zetacore...")
if len(vLog.Topics) != 4 {
@@ -363,6 +376,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co
vLog.BlockNumber,
receipt.GasUsed,
transaction.GasPrice(),
+ transaction.Gas(),
mMint,
common.ReceiveStatus_Success,
ob.chain,
@@ -376,12 +390,14 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co
logger.Info().Msgf("Zeta tx hash: %s\n", zetaHash)
return true, true, nil
}
+ // #nosec G701 always in range
logger.Info().Msgf("Included; %d blocks before confirmed! chain %s nonce %d", int(vLog.BlockNumber+params.ConfirmationCount)-int(ob.GetLastBlockHeight()), ob.chain.String(), nonce)
return true, false, nil
}
revertedLog, err := connector.ZetaConnectorNonEthFilterer.ParseZetaReverted(*vLog)
if err == nil {
logger.Info().Msgf("Found (revertTx) sendHash %s on chain %s txhash %s", sendHash, ob.chain.String(), vLog.TxHash.Hex())
+ // #nosec G701 checked in range
if int64(confHeight) < ob.GetLastBlockHeight() {
logger.Info().Msg("Confirmed! Sending PostConfirmation to zetacore...")
if len(vLog.Topics) != 3 {
@@ -396,6 +412,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co
vLog.BlockNumber,
receipt.GasUsed,
transaction.GasPrice(),
+ transaction.Gas(),
mMint,
common.ReceiveStatus_Success,
ob.chain,
@@ -409,6 +426,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co
logger.Info().Msgf("Zeta tx hash: %s", metaHash)
return true, true, nil
}
+ // #nosec G701 always in range
logger.Info().Msgf("Included; %d blocks before confirmed! chain %s nonce %d", int(vLog.BlockNumber+params.ConfirmationCount)-int(ob.GetLastBlockHeight()), ob.chain.String(), nonce)
return true, false, nil
}
@@ -422,6 +440,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,
@@ -449,6 +468,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co
}
if err == nil {
logger.Info().Msgf("Found (ERC20Custody.Withdrawn Event) sendHash %s on chain %s txhash %s", sendHash, ob.chain.String(), vLog.TxHash.Hex())
+ // #nosec G701 checked in range
if int64(confHeight) < ob.GetLastBlockHeight() {
logger.Info().Msg("Confirmed! Sending PostConfirmation to zetacore...")
@@ -458,6 +478,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,
@@ -471,6 +492,7 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co
logger.Info().Msgf("Zeta tx hash: %s\n", zetaHash)
return true, true, nil
}
+ // #nosec G701 always in range
logger.Info().Msgf("Included; %d blocks before confirmed! chain %s nonce %d", int(vLog.BlockNumber+params.ConfirmationCount)-int(ob.GetLastBlockHeight()), ob.chain.String(), nonce)
return true, false, nil
}
@@ -481,6 +503,13 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co
return false, false, nil
}
+// The lowest nonce we observe outTx for each chain
+var lowestOutTxNonceToObserve = map[int64]uint64{
+ 5: 70000, // Goerli
+ 97: 95000, // BSC testnet
+ 80001: 120000, // Mumbai
+}
+
// FIXME: there's a chance that a txhash in OutTxChan may not deliver when Stop() is called
// observeOutTx periodically checks all the txhash in potential outbound txs
func (ob *EVMChainClient) observeOutTx() {
@@ -509,8 +538,12 @@ func (ob *EVMChainClient) observeOutTx() {
})
outTimeout := time.After(time.Duration(timeoutNonce) * time.Second)
TRACKERLOOP:
+ // Skip old gabbage trackers as we spent too much time on querying them
for _, tracker := range trackers {
nonceInt := tracker.Nonce
+ if nonceInt < lowestOutTxNonceToObserve[ob.chain.ChainId] {
+ continue
+ }
TXHASHLOOP:
for _, txHash := range tracker.HashList {
//inTimeout := time.After(3000 * time.Millisecond)
@@ -582,6 +615,7 @@ func (ob *EVMChainClient) queryTxByHash(txHash string, nonce uint64) (*ethtypes.
return nil, nil, fmt.Errorf("confHeight is out of range")
}
+ // #nosec G701 checked in range
if int64(confHeight) > ob.GetLastBlockHeight() {
log.Warn().Msgf("included but not confirmed: receipt block %d, current block %d", receipt.BlockNumber, ob.GetLastBlockHeight())
return nil, nil, fmt.Errorf("included but not confirmed")
@@ -663,13 +697,14 @@ func (ob *EVMChainClient) observeInTX() error {
}
// "confirmed" current block number
confirmedBlockNum := header.Number.Uint64() - ob.GetCoreParams().ConfirmationCount
+ // #nosec G701 always in range
ob.SetLastBlockHeight(int64(confirmedBlockNum))
- permissions, err := ob.zetaClient.GetPermissionFlags()
+ crosschainFlags, err := ob.zetaClient.GetCrosschainFlags()
if err != nil {
return err
}
- if !permissions.IsInboundEnabled {
+ if !crosschainFlags.IsInboundEnabled {
return errors.New("inbound TXS / Send has been disabled by the protocol")
}
counter, err := ob.GetPromCounter("rpc_getBlockByNumber_count")
@@ -684,6 +719,7 @@ func (ob *EVMChainClient) observeInTX() error {
sampledLogger.Error().Msg("Skipping observer , confirmedBlockNum is negative or too large ")
return nil
}
+ // #nosec G701 checked in range
if confirmedBlockNum <= uint64(ob.GetLastBlockHeightScanned()) {
sampledLogger.Debug().Msg("Skipping observer , No new block is produced ")
return nil
@@ -691,7 +727,9 @@ func (ob *EVMChainClient) observeInTX() error {
lastBlock := ob.GetLastBlockHeightScanned()
startBlock := lastBlock + 1
toBlock := lastBlock + config.MaxBlocksPerPeriod // read at most 10 blocks in one go
+ // #nosec G701 always positive
if uint64(toBlock) >= confirmedBlockNum {
+ // #nosec G701 checked in range
toBlock = int64(confirmedBlockNum)
}
if startBlock < 0 || startBlock >= math2.MaxInt64 {
@@ -703,6 +741,7 @@ func (ob *EVMChainClient) observeInTX() error {
ob.logger.ExternalChainWatcher.Info().Msgf("Checking for all inTX : startBlock %d, toBlock %d", startBlock, toBlock)
//task 1: Query evm chain for zeta sent logs
func() {
+ // #nosec G701 always positive
tb := uint64(toBlock)
connector, err := ob.GetConnectorContract()
if err != nil {
@@ -716,6 +755,7 @@ func (ob *EVMChainClient) observeInTX() error {
cnt.Inc()
}
logs, err := connector.FilterZetaSent(&bind.FilterOpts{
+ // #nosec G701 always positive
Start: uint64(startBlock),
End: &tb,
Context: context.TODO(),
@@ -743,6 +783,7 @@ func (ob *EVMChainClient) observeInTX() error {
// task 2: Query evm chain for deposited logs
func() {
+ // #nosec G701 always positive
toB := uint64(toBlock)
erc20custody, err := ob.GetERC20CustodyContract()
if err != nil {
@@ -750,6 +791,7 @@ func (ob *EVMChainClient) observeInTX() error {
return
}
depositedLogs, err := erc20custody.FilterDeposited(&bind.FilterOpts{
+ // #nosec G701 always positive
Start: uint64(startBlock),
End: &toB,
Context: context.TODO(),
@@ -777,7 +819,7 @@ func (ob *EVMChainClient) observeInTX() error {
ob.logger.ExternalChainWatcher.Error().Err(err).Msg("error posting to zeta core")
return
}
- ob.logger.ExternalChainWatcher.Info().Msgf("ZetaSent event detected and reported: PostSend zeta tx: %s", zetaHash)
+ ob.logger.ExternalChainWatcher.Info().Msgf("ZRC20Custody Deposited event detected and reported: PostSend zeta tx: %s", zetaHash)
}
}()
@@ -793,12 +835,29 @@ func (ob *EVMChainClient) observeInTX() error {
if !ob.chain.IsKlaytnChain() {
for bn := startBlock; bn <= toBlock; bn++ {
//block, err := ob.EvmClient.BlockByNumber(context.Background(), big.NewInt(int64(bn)))
- block, err := ob.evmClient.BlockByNumber(context.Background(), big.NewInt(bn))
+ block, err := ob.GetBlockByNumberCached(bn)
if err != nil {
ob.logger.ExternalChainWatcher.Error().Err(err).Msgf("error getting block: %d", bn)
continue
}
- //ob.logger.ExternalChainWatcher.Debug().Msgf("block %d: num txs: %d", bn, len(block.Transactions()))
+ _ = ob.BlockCache.Add(block.Hash(), block)
+ headerRLP, err := rlp.EncodeToBytes(block.Header())
+ if err != nil {
+ ob.logger.ExternalChainWatcher.Error().Err(err).Msgf("error encoding block header: %d", bn)
+ continue
+ }
+
+ _, err = ob.zetaClient.PostAddBlockHeader(
+ ob.chain.ChainId,
+ block.Hash().Bytes(),
+ block.Number().Int64(),
+ common.NewEthereumHeader(headerRLP),
+ )
+ if err != nil {
+ ob.logger.ExternalChainWatcher.Error().Err(err).Msgf("error posting block header: %d", bn)
+ continue
+ }
+
for _, tx := range block.Transactions() {
if tx.To() == nil {
continue
@@ -807,6 +866,7 @@ func (ob *EVMChainClient) observeInTX() error {
ob.logger.ExternalChainWatcher.Info().Msgf("thank you rich folk for your donation!: %s", tx.Hash().Hex())
continue
}
+
if *tx.To() == tssAddress {
receipt, err := ob.evmClient.TransactionReceipt(context.Background(), tx.Hash())
if err != nil {
@@ -837,7 +897,7 @@ func (ob *EVMChainClient) observeInTX() error {
ob.logger.ExternalChainWatcher.Error().Err(err).Msg("error posting to zeta core")
continue
}
- ob.logger.ExternalChainWatcher.Info().Msgf("ZetaSent event detected and reported: PostSend zeta tx: %s", zetaHash)
+ ob.logger.ExternalChainWatcher.Info().Msgf("Gas Deposit detected and reported: PostSend zeta tx: %s", zetaHash)
}
}
}
@@ -893,8 +953,12 @@ func (ob *EVMChainClient) WatchGasPrice() {
err := ob.PostGasPrice()
if err != nil {
- height, _ := ob.zetaClient.GetBlockHeight()
- ob.logger.WatchGasPrice.Error().Err(err).Msgf("PostGasPrice error at zeta block : %d ", height)
+ height, err := ob.zetaClient.GetBlockHeight()
+ if err != nil {
+ ob.logger.WatchGasPrice.Error().Err(err).Msg("GetBlockHeight error")
+ } else {
+ ob.logger.WatchGasPrice.Error().Err(err).Msgf("PostGasPrice error at zeta block : %d ", height)
+ }
}
ticker := NewDynamicTicker(fmt.Sprintf("EVM_WatchGasPrice_%d", ob.chain.ChainId), ob.GetCoreParams().GasPriceTicker)
defer ticker.Stop()
@@ -903,10 +967,14 @@ func (ob *EVMChainClient) WatchGasPrice() {
case <-ticker.C():
err := ob.PostGasPrice()
if err != nil {
- height, _ := ob.zetaClient.GetBlockHeight()
- ob.logger.WatchGasPrice.Error().Err(err).Msgf("PostGasPrice error at zeta block : %d ", height)
+ height, err := ob.zetaClient.GetBlockHeight()
+ if err != nil {
+ ob.logger.WatchGasPrice.Error().Err(err).Msg("GetBlockHeight error")
+ } else {
+ ob.logger.WatchGasPrice.Error().Err(err).Msgf("PostGasPrice error at zeta block : %d ", height)
+ }
}
- ticker.UpdateInterval(ob.GetCoreParams().InTxTicker, ob.logger.WatchGasPrice)
+ ticker.UpdateInterval(ob.GetCoreParams().GasPriceTicker, ob.logger.WatchGasPrice)
case <-ob.stop:
ob.logger.WatchGasPrice.Info().Msg("WatchGasPrice stopped")
return
@@ -949,6 +1017,7 @@ func (ob *EVMChainClient) getLastHeight() (int64, error) {
if err != nil {
return 0, errors.Wrap(err, "getLastHeight")
}
+ // #nosec G701 always in range
return int64(lastheight.LastSendHeight), nil
}
@@ -1080,6 +1149,7 @@ func (ob *EVMChainClient) SetMinAndMaxNonce(trackers []types.OutTxTracker) error
minNonce, maxNonce := int64(-1), int64(0)
for _, tracker := range trackers {
conv := tracker.Nonce
+ // #nosec G701 always in range
intNonce := int64(conv)
if minNonce == -1 {
minNonce = intNonce
@@ -1104,3 +1174,15 @@ func (ob *EVMChainClient) GetTxID(nonce uint64) string {
tssAddr := ob.Tss.EVMAddress().String()
return fmt.Sprintf("%d-%s-%d", ob.chain.ChainId, tssAddr, nonce)
}
+
+func (ob *EVMChainClient) GetBlockByNumberCached(blockNumber int64) (*ethtypes.Block, error) {
+ if block, ok := ob.BlockCache.Get(blockNumber); ok {
+ return block.(*ethtypes.Block), nil
+ }
+ block, err := ob.evmClient.BlockByNumber(context.Background(), big.NewInt(blockNumber))
+ if err != nil {
+ return nil, err
+ }
+ ob.BlockCache.Add(blockNumber, block)
+ return block, nil
+}
diff --git a/zetaclient/evm_signer.go b/zetaclient/evm_signer.go
index 116bb42481..3622a61ffd 100644
--- a/zetaclient/evm_signer.go
+++ b/zetaclient/evm_signer.go
@@ -317,24 +317,45 @@ 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
}
- flags, err := zetaBridge.GetPermissionFlags()
+ //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.GetCrosschainFlags()
if err != nil {
- logger.Error().Err(err).Msgf("cannot get permission flags")
+ logger.Error().Err(err).Msgf("cannot get crosschain flags")
return
}
@@ -473,7 +494,7 @@ func (signer *EVMSigner) TryProcessOutTx(send *types.CrossChainTx, outTxMan *Out
log.Warn().Err(err).Msgf("OutTx Broadcast error")
retry, report := HandleBroadcastError(err, strconv.FormatUint(send.GetCurrentOutTxParam().OutboundTxTssNonce, 10), toChain.String(), outTxHash)
if report {
- zetaHash, err := zetaBridge.AddTxHashToOutTxTracker(toChain.ChainId, tx.Nonce(), outTxHash)
+ zetaHash, err := zetaBridge.AddTxHashToOutTxTracker(toChain.ChainId, tx.Nonce(), outTxHash, nil, "", -1)
if err != nil {
logger.Err(err).Msgf("Unable to add to tracker on ZetaCore: nonce %d chain %s outTxHash %s", send.GetCurrentOutTxParam().OutboundTxTssNonce, toChain, outTxHash)
}
@@ -486,7 +507,7 @@ func (signer *EVMSigner) TryProcessOutTx(send *types.CrossChainTx, outTxMan *Out
continue
}
logger.Info().Msgf("Broadcast success: nonce %d to chain %s outTxHash %s", send.GetCurrentOutTxParam().OutboundTxTssNonce, toChain, outTxHash)
- zetaHash, err := zetaBridge.AddTxHashToOutTxTracker(toChain.ChainId, tx.Nonce(), outTxHash)
+ zetaHash, err := zetaBridge.AddTxHashToOutTxTracker(toChain.ChainId, tx.Nonce(), outTxHash, nil, "", -1)
if err != nil {
logger.Err(err).Msgf("Unable to add to tracker on ZetaCore: nonce %d chain %s outTxHash %s", send.GetCurrentOutTxParam().OutboundTxTssNonce, toChain, outTxHash)
}
@@ -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/keys.go b/zetaclient/keys.go
index 3be8be0ef6..af45452275 100644
--- a/zetaclient/keys.go
+++ b/zetaclient/keys.go
@@ -115,7 +115,10 @@ func (k *Keys) GetAddress() sdk.AccAddress {
if err != nil {
panic(err)
}
- addr, _ := info.GetAddress()
+ addr, err := info.GetAddress()
+ if err != nil {
+ return nil
+ }
return addr
}
diff --git a/zetaclient/query.go b/zetaclient/query.go
index b7f13b9224..44a8a52fd2 100644
--- a/zetaclient/query.go
+++ b/zetaclient/query.go
@@ -25,13 +25,13 @@ const (
Descending Order = "DESC"
)
-func (b *ZetaCoreBridge) GetPermissionFlags() (zetaObserverTypes.PermissionFlags, error) {
+func (b *ZetaCoreBridge) GetCrosschainFlags() (zetaObserverTypes.CrosschainFlags, error) {
client := zetaObserverTypes.NewQueryClient(b.grpcConn)
- resp, err := client.PermissionFlags(context.Background(), &zetaObserverTypes.QueryGetPermissionFlagsRequest{})
+ resp, err := client.CrosschainFlags(context.Background(), &zetaObserverTypes.QueryGetCrosschainFlagsRequest{})
if err != nil {
- return zetaObserverTypes.PermissionFlags{}, err
+ return zetaObserverTypes.CrosschainFlags{}, err
}
- return resp.PermissionFlags, nil
+ return resp.CrosschainFlags, nil
}
func (b *ZetaCoreBridge) GetCoreParamsForChainID(externalChainID int64) (*zetaObserverTypes.CoreParams, error) {
@@ -45,7 +45,7 @@ func (b *ZetaCoreBridge) GetCoreParamsForChainID(externalChainID int64) (*zetaOb
func (b *ZetaCoreBridge) GetCoreParams() ([]*zetaObserverTypes.CoreParams, error) {
client := zetaObserverTypes.NewQueryClient(b.grpcConn)
- err := error(nil)
+ var err error
resp := &zetaObserverTypes.QueryGetCoreParamsResponse{}
for i := 0; i <= DefaultRetryCount; i++ {
resp, err = client.GetCoreParams(context.Background(), &zetaObserverTypes.QueryGetCoreParamsRequest{})
@@ -122,11 +122,11 @@ func (b *ZetaCoreBridge) GetCctxByNonce(chainID int64, nonce uint64) (*types.Cro
}
func (b *ZetaCoreBridge) GetObserverList(chain common.Chain) ([]string, error) {
+ var err error
+
client := zetaObserverTypes.NewQueryClient(b.grpcConn)
- resp, err := client.ObserversByChain(context.Background(), &zetaObserverTypes.QueryObserversByChainRequest{
- ObservationChain: chain.ChainName.String(),
- })
for i := 0; i <= DefaultRetryCount; i++ {
+ resp, err := client.ObserversByChain(context.Background(), &zetaObserverTypes.QueryObserversByChainRequest{ObservationChain: chain.ChainName.String()})
if err == nil {
return resp.Observers, nil
}
@@ -135,7 +135,7 @@ func (b *ZetaCoreBridge) GetObserverList(chain common.Chain) ([]string, error) {
return nil, err
}
-func (b *ZetaCoreBridge) GetAllPendingCctx(chainID uint64) ([]*types.CrossChainTx, error) {
+func (b *ZetaCoreBridge) GetAllPendingCctx(chainID int64) ([]*types.CrossChainTx, error) {
client := types.NewQueryClient(b.grpcConn)
maxSizeOption := grpc.MaxCallRecvMsgSize(32 * 1024 * 1024)
resp, err := client.CctxAllPending(context.Background(), &types.QueryAllCctxPendingRequest{ChainId: chainID}, maxSizeOption)
@@ -165,9 +165,11 @@ func (b *ZetaCoreBridge) GetLatestZetaBlock() (*tmtypes.Block, error) {
}
func (b *ZetaCoreBridge) GetNodeInfo() (*tmservice.GetNodeInfoResponse, error) {
+ var err error
+
client := tmservice.NewServiceClient(b.grpcConn)
- res, err := client.GetNodeInfo(context.Background(), &tmservice.GetNodeInfoRequest{})
for i := 0; i <= DefaultRetryCount; i++ {
+ res, err := client.GetNodeInfo(context.Background(), &tmservice.GetNodeInfoRequest{})
if err == nil {
return res, nil
}
@@ -214,12 +216,18 @@ func (b *ZetaCoreBridge) GetAllNodeAccounts() ([]*zetaObserverTypes.NodeAccount,
}
func (b *ZetaCoreBridge) GetKeyGen() (*zetaObserverTypes.Keygen, error) {
+ var err error
+
client := zetaObserverTypes.NewQueryClient(b.grpcConn)
- resp, err := client.Keygen(context.Background(), &zetaObserverTypes.QueryGetKeygenRequest{})
- if err != nil {
- return nil, err
+ for i := 0; i <= ExtendedRetryCount; i++ {
+ resp, err := client.Keygen(context.Background(), &zetaObserverTypes.QueryGetKeygenRequest{})
+ if err == nil {
+ return resp.Keygen, nil
+ }
+ time.Sleep(DefaultRetryInterval * time.Second)
}
- return resp.Keygen, nil
+ return nil, fmt.Errorf("failed to get keygen | err %s", err.Error())
+
}
func (b *ZetaCoreBridge) GetBallot(ballotIdentifier string) (*zetaObserverTypes.QueryBallotByIdentifierResponse, error) {
@@ -295,7 +303,7 @@ func (b *ZetaCoreBridge) GetAllOutTxTrackerByChain(chain common.Chain, order Ord
Pagination: &query.PageRequest{
Key: nil,
Offset: 0,
- Limit: 1000,
+ Limit: 2000,
CountTotal: false,
Reverse: false,
},
@@ -325,6 +333,24 @@ func (b *ZetaCoreBridge) GetClientParams(chainID int64) (zetaObserverTypes.Query
return *resp, nil
}
+func (b *ZetaCoreBridge) GetPendingNoncesByChain(chainID int64) (types.PendingNonces, error) {
+ client := types.NewQueryClient(b.grpcConn)
+ resp, err := client.PendingNoncesByChain(context.Background(), &types.QueryPendingNoncesByChainRequest{ChainId: chainID})
+ if err != nil {
+ return types.PendingNonces{}, err
+ }
+ return resp.PendingNonces, nil
+}
+
+func (b *ZetaCoreBridge) GetSupportedChains() ([]*common.Chain, error) {
+ client := zetaObserverTypes.NewQueryClient(b.grpcConn)
+ resp, err := client.SupportedChains(context.Background(), &zetaObserverTypes.QuerySupportedChains{})
+ if err != nil {
+ return nil, err
+ }
+ return resp.GetChains(), nil
+}
+
func (b *ZetaCoreBridge) GetPendingNonces() (*types.QueryAllPendingNoncesResponse, error) {
client := types.NewQueryClient(b.grpcConn)
resp, err := client.PendingNoncesAll(context.Background(), &types.QueryAllPendingNoncesRequest{})
@@ -333,3 +359,18 @@ func (b *ZetaCoreBridge) GetPendingNonces() (*types.QueryAllPendingNoncesRespons
}
return resp, nil
}
+
+func (b *ZetaCoreBridge) Prove(blockHash string, txHash string, txIndex int64, proof *common.Proof, chainID uint64) (bool, error) {
+ client := zetaObserverTypes.NewQueryClient(b.grpcConn)
+ resp, err := client.Prove(context.Background(), &zetaObserverTypes.QueryProveRequest{
+ BlockHash: blockHash,
+ TxIndex: txIndex,
+ Proof: proof,
+ ChainId: chainID,
+ TxHash: txHash,
+ })
+ if err != nil {
+ return false, err
+ }
+ return resp.Valid, nil
+}
diff --git a/zetaclient/telemetry.go b/zetaclient/telemetry.go
index baa51e4a50..7bd124dbc0 100644
--- a/zetaclient/telemetry.go
+++ b/zetaclient/telemetry.go
@@ -215,7 +215,10 @@ func (t *TelemetryServer) statusHandler(w http.ResponseWriter, _ *http.Request)
w.WriteHeader(http.StatusOK)
t.mu.Lock()
defer t.mu.Unlock()
- s, _ := json.MarshalIndent(t.status, "", "\t")
+ s, err := json.MarshalIndent(t.status, "", "\t")
+ if err != nil {
+ t.logger.Error().Err(err).Msg("Failed to marshal status")
+ }
fmt.Fprintf(w, "%s", s)
}
diff --git a/zetaclient/tss_signer.go b/zetaclient/tss_signer.go
index d0e540017d..a52ea4adad 100644
--- a/zetaclient/tss_signer.go
+++ b/zetaclient/tss_signer.go
@@ -102,6 +102,7 @@ func (tss *TSS) Sign(digest []byte, height uint64, chain *common.Chain, optional
if optionalPubKey != "" {
tssPubkey = optionalPubKey
}
+ // #nosec G701 always in range
keysignReq := keysign.NewRequest(tssPubkey, []string{base64.StdEncoding.EncodeToString(H)}, int64(height), nil, "0.14.0")
ksRes, err := tss.Server.KeySign(keysignReq)
if err != nil {
@@ -172,7 +173,9 @@ func (tss *TSS) SignBatch(digests [][]byte, height uint64, chain *common.Chain)
for i, digest := range digests {
digestBase64[i] = base64.StdEncoding.EncodeToString(digest)
}
+ // #nosec G701 always in range
keysignReq := keysign.NewRequest(tssPubkey, digestBase64, int64(height), nil, "0.14.0")
+
ksRes, err := tss.Server.KeySign(keysignReq)
if err != nil {
log.Warn().Err(err).Msg("keysign fail")
@@ -364,7 +367,7 @@ func getKeyAddrBTCWitnessPubkeyHash(tssPubkey string) (*btcutil.AddressWitnessPu
return addr, nil
}
-func NewTSS(peer p2p.AddrList, privkey tmcrypto.PrivKey, preParams *keygen.LocalPreParams, cfg *config.Config, bridge *ZetaCoreBridge, tssHistoricalList []types.TSS) (*TSS, error) {
+func NewTSS(peer p2p.AddrList, privkey tmcrypto.PrivKey, preParams *keygen.LocalPreParams, cfg *config.Config, bridge *ZetaCoreBridge, tssHistoricalList []types.TSS, metrics *metrics.Metrics) (*TSS, error) {
server, err := SetupTSSServer(peer, privkey, preParams, cfg)
if err != nil {
return nil, fmt.Errorf("SetupTSSServer error: %w", err)
@@ -389,6 +392,12 @@ func NewTSS(peer p2p.AddrList, privkey tmcrypto.PrivKey, preParams *keygen.Local
if err != nil {
bridge.logger.Error().Err(err).Msg("VerifyKeysharesForPubkeys fail")
}
+ err = newTss.RegisterMetrics(metrics)
+ if err != nil {
+ bridge.logger.Err(err).Msg("tss.RegisterMetrics")
+ return nil, err
+ }
+
return &newTss, nil
}
@@ -426,8 +435,14 @@ func (tss *TSS) LoadTssFilesFromDirectory(tssPath string) error {
}
if len(sharefiles) > 0 {
sort.SliceStable(sharefiles, func(i, j int) bool {
- fi, _ := sharefiles[i].Info()
- fj, _ := sharefiles[j].Info()
+ fi, err := sharefiles[i].Info()
+ if err != nil {
+ return false
+ }
+ fj, err := sharefiles[j].Info()
+ if err != nil {
+ return false
+ }
return fi.ModTime().After(fj.ModTime())
})
tss.logger.Info().Msgf("found %d localstate files", len(sharefiles))
@@ -548,9 +563,21 @@ func verifySignature(tssPubkey string, signature []keysign.Signature, H []byte)
}
// verify the signature of msg.
var sigbyte [65]byte
- _, _ = base64.StdEncoding.Decode(sigbyte[:32], []byte(signature[0].R))
- _, _ = base64.StdEncoding.Decode(sigbyte[32:64], []byte(signature[0].S))
- _, _ = base64.StdEncoding.Decode(sigbyte[64:65], []byte(signature[0].RecoveryID))
+ _, err = base64.StdEncoding.Decode(sigbyte[:32], []byte(signature[0].R))
+ if err != nil {
+ log.Error().Err(err).Msg("decoding signature R")
+ return false
+ }
+ _, err = base64.StdEncoding.Decode(sigbyte[32:64], []byte(signature[0].S))
+ if err != nil {
+ log.Error().Err(err).Msg("decoding signature S")
+ return false
+ }
+ _, err = base64.StdEncoding.Decode(sigbyte[64:65], []byte(signature[0].RecoveryID))
+ if err != nil {
+ log.Error().Err(err).Msg("decoding signature RecoveryID")
+ return false
+ }
sigPublicKey, err := crypto.SigToPub(H, sigbyte[:])
if err != nil {
log.Error().Err(err).Msg("SigToPub error in verify_signature")
diff --git a/zetaclient/tx.go b/zetaclient/tx.go
index 89df997f97..a31716de36 100644
--- a/zetaclient/tx.go
+++ b/zetaclient/tx.go
@@ -20,12 +20,14 @@ const (
PostGasPriceGasLimit = 1_500_000
AddTxHashToOutTxTrackerGasLimit = 200_000
PostNonceGasLimit = 200_000
- PostSendEVMGasLimit = 1_000_000 // likely emit a lot of logs, so costly
+ PostSendEVMGasLimit = 1_500_000 // likely emit a lot of logs, so costly
PostSendNonEVMGasLimit = 1_000_000
PostReceiveConfirmationGasLimit = 200_000
PostBlameDataGasLimit = 200_000
DefaultGasLimit = 200_000
+ PostProveOutboundTxGasLimit = 400_000
DefaultRetryCount = 5
+ ExtendedRetryCount = 15
DefaultRetryInterval = 5
)
@@ -58,9 +60,9 @@ func (b *ZetaCoreBridge) PostGasPrice(chain common.Chain, gasPrice uint64, suppl
return "", fmt.Errorf("post gasprice failed after %d retries", DefaultRetryInterval)
}
-func (b *ZetaCoreBridge) AddTxHashToOutTxTracker(chainID int64, nonce uint64, txHash string) (string, error) {
+func (b *ZetaCoreBridge) AddTxHashToOutTxTracker(chainID int64, nonce uint64, txHash string, proof *common.Proof, blockHash string, txIndex int64) (string, error) {
signerAddress := b.keys.GetOperatorAddress().String()
- msg := types.NewMsgAddToOutTxTracker(signerAddress, chainID, nonce, txHash)
+ msg := types.NewMsgAddToOutTxTracker(signerAddress, chainID, nonce, txHash, proof, blockHash, txIndex)
authzMsg, authzSigner := b.WrapMessageWithAuthz(msg)
zetaTxHash, err := b.Broadcast(AddTxHashToOutTxTrackerGasLimit, authzMsg, authzSigner)
if err != nil {
@@ -88,6 +90,7 @@ func (b *ZetaCoreBridge) PostReceiveConfirmation(
outBlockHeight uint64,
outTxGasUsed uint64,
outTxEffectiveGasPrice *big.Int,
+ outTxEffectiveGasLimit uint64,
amount *big.Int,
status common.ReceiveStatus,
chain common.Chain,
@@ -107,6 +110,7 @@ func (b *ZetaCoreBridge) PostReceiveConfirmation(
outBlockHeight,
outTxGasUsed,
math.NewIntFromBigInt(outTxEffectiveGasPrice),
+ outTxEffectiveGasLimit,
math.NewUintFromBigInt(amount),
status,
chain.ChainId,
@@ -136,7 +140,8 @@ func (b *ZetaCoreBridge) SetTSS(tssPubkey string, keyGenZetaHeight int64, status
signerAddress := b.keys.GetOperatorAddress().String()
msg := types.NewMsgCreateTSSVoter(signerAddress, tssPubkey, keyGenZetaHeight, status)
authzMsg, authzSigner := b.WrapMessageWithAuthz(msg)
- err := error(nil)
+
+ var err error
zetaTxHash := ""
for i := 0; i <= DefaultRetryCount; i++ {
zetaTxHash, err = b.Broadcast(DefaultGasLimit, authzMsg, authzSigner)
@@ -146,6 +151,7 @@ func (b *ZetaCoreBridge) SetTSS(tssPubkey string, keyGenZetaHeight int64, status
b.logger.Debug().Err(err).Msgf("SetTSS broadcast fail | Retry count : %d", i+1)
time.Sleep(DefaultRetryInterval * time.Second)
}
+
return "", fmt.Errorf("set tss failed | err %s", err.Error())
}
@@ -188,3 +194,20 @@ func (b *ZetaCoreBridge) PostBlameData(blame *blame.Blame, chainID int64, index
}
return "", fmt.Errorf("post blame data failed after %d retries", DefaultRetryCount)
}
+
+func (b *ZetaCoreBridge) PostAddBlockHeader(chainID int64, txhash []byte, height int64, header common.HeaderData) (string, error) {
+ signerAddress := b.keys.GetOperatorAddress().String()
+ msg := observerTypes.NewMsgAddBlockHeader(signerAddress, chainID, txhash, height, header)
+ authzMsg, authzSigner := b.WrapMessageWithAuthz(msg)
+
+ var gasLimit uint64 = DefaultGasLimit
+ for i := 0; i < DefaultRetryCount; i++ {
+ zetaTxHash, err := b.Broadcast(gasLimit, authzMsg, authzSigner)
+ if err == nil {
+ return zetaTxHash, nil
+ }
+ b.logger.Error().Err(err).Msgf("PostAddBlockHeader broadcast fail | Retry count : %d", i+1)
+ time.Sleep(DefaultRetryInterval * time.Second)
+ }
+ return "", fmt.Errorf("post add block header failed after %d retries", DefaultRetryCount)
+}
diff --git a/zetaclient/types/sql_btc.go b/zetaclient/types/sql_btc.go
index eccd5c78cd..5bdb97942c 100644
--- a/zetaclient/types/sql_btc.go
+++ b/zetaclient/types/sql_btc.go
@@ -4,7 +4,6 @@ import (
"encoding/json"
"github.com/btcsuite/btcd/btcjson"
- "github.com/btcsuite/btcd/chaincfg/chainhash"
"gorm.io/gorm"
)
@@ -29,10 +28,10 @@ type TransactionResultSQLType struct {
Tx TransactionResultDB `gorm:"embedded"`
}
-type TransactionHashSQLType struct {
+type OutTxHashSQLType struct {
gorm.Model
Key string
- Hash chainhash.Hash
+ Hash string
}
func ToTransactionResultDB(txResult btcjson.GetTransactionResult) (TransactionResultDB, error) {
@@ -98,8 +97,8 @@ func FromTransactionResultSQLType(txSQL TransactionResultSQLType) (btcjson.GetTr
return FromTransactionResultDB(txSQL.Tx)
}
-func ToTransactionHashSQLType(hash chainhash.Hash, key string) TransactionHashSQLType {
- return TransactionHashSQLType{
+func ToOutTxHashSQLType(hash string, key string) OutTxHashSQLType {
+ return OutTxHashSQLType{
Key: key,
Hash: hash,
}
diff --git a/zetaclient/utils.go b/zetaclient/utils.go
index 45e03b7699..fee3ef15f7 100644
--- a/zetaclient/utils.go
+++ b/zetaclient/utils.go
@@ -2,9 +2,9 @@ package zetaclient
import (
"bytes"
+ "context"
"encoding/base64"
"encoding/hex"
- "errors"
"fmt"
"math"
"math/big"
@@ -15,6 +15,7 @@ import (
"github.com/btcsuite/btcd/txscript"
ethcommon "github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
+ "github.com/pkg/errors"
"github.com/rs/zerolog"
"github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/erc20custody.sol"
"github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/zetaconnector.non-eth.sol"
@@ -30,7 +31,7 @@ const (
func getSatoshis(btc float64) (int64, error) {
// The amount is only considered invalid if it cannot be represented
// as an integer type. This may happen if f is NaN or +-Infinity.
- // BTC max amount is 21 mil and its at least 10^(-8) or one satoshi.
+ // BTC max amount is 21 mil and its at least 0 (Note: bitcoin allows creating 0-value outputs)
switch {
case math.IsNaN(btc):
fallthrough
@@ -40,16 +41,18 @@ func getSatoshis(btc float64) (int64, error) {
return 0, errors.New("invalid bitcoin amount")
case btc > 21000000.0:
return 0, errors.New("exceeded max bitcoin amount")
- case btc < 0.00000001:
- return 0, errors.New("cannot be less than 1 satoshi")
+ case btc < 0.0:
+ return 0, errors.New("cannot be less than zero")
}
return round(btc * satoshiPerBitcoin), nil
}
func round(f float64) int64 {
if f < 0 {
+ // #nosec G701 always in range
return int64(f - 0.5)
}
+ // #nosec G701 always in range
return int64(f + 0.5)
}
@@ -78,9 +81,10 @@ func (t *DynamicTicker) C() <-chan time.Time {
func (t *DynamicTicker) UpdateInterval(newInterval uint64, logger zerolog.Logger) {
if newInterval > 0 && t.interval != newInterval {
t.impl.Stop()
+ oldInterval := t.interval
t.interval = newInterval
t.impl = time.NewTicker(time.Duration(t.interval) * time.Second)
- logger.Info().Msgf("%s ticker interval changed from %d to %d", t.name, t.interval, newInterval)
+ logger.Info().Msgf("%s ticker interval changed from %d to %d", t.name, oldInterval, newInterval)
}
}
@@ -94,8 +98,21 @@ func (ob *EVMChainClient) GetInboundVoteMsgForDepositedEvent(event *erc20custody
ob.logger.ExternalChainWatcher.Info().Msgf("thank you rich folk for your donation!: %s", event.Raw.TxHash.Hex())
return types.MsgVoteOnObservedInboundTx{}, errors.New(fmt.Sprintf("thank you rich folk for your donation!: %s", event.Raw.TxHash.Hex()))
}
+ // get the sender of the event's transaction
+ tx, _, err := ob.evmClient.TransactionByHash(context.Background(), event.Raw.TxHash)
+ if err != nil {
+ ob.logger.ExternalChainWatcher.Error().Err(err).Msg(fmt.Sprintf("failed to get transaction by hash: %s", event.Raw.TxHash.Hex()))
+ return types.MsgVoteOnObservedInboundTx{}, errors.Wrap(err, fmt.Sprintf("failed to get transaction by hash: %s", event.Raw.TxHash.Hex()))
+ }
+ signer := ethtypes.NewLondonSigner(big.NewInt(ob.chain.ChainId))
+ sender, err := signer.Sender(tx)
+ if err != nil {
+ ob.logger.ExternalChainWatcher.Error().Err(err).Msg(fmt.Sprintf("can't recover the sender from the tx hash: %s", event.Raw.TxHash.Hex()))
+ return types.MsgVoteOnObservedInboundTx{}, errors.Wrap(err, fmt.Sprintf("can't recover the sender from the tx hash: %s", event.Raw.TxHash.Hex()))
+
+ }
return *GetInBoundVoteMessage(
- "",
+ sender.Hex(),
ob.chain.ChainId,
"",
clienttypes.BytesToEthHex(event.Recipient),
@@ -119,13 +136,15 @@ func (ob *EVMChainClient) GetInboundVoteMsgForZetaSentEvent(event *zetaconnector
return types.MsgVoteOnObservedInboundTx{}, errors.New(fmt.Sprintf("chain id not supported %d", event.DestinationChainId.Int64()))
}
destAddr := clienttypes.BytesToEthHex(event.DestinationAddress)
- cfgDest, found := ob.cfg.GetEVMConfig(destChain.ChainId)
- if !found {
- return types.MsgVoteOnObservedInboundTx{}, errors.New(fmt.Sprintf("chain id not present in EVMChainConfigs %d", event.DestinationChainId.Int64()))
- }
- if strings.EqualFold(destAddr, cfgDest.ZetaTokenContractAddress) {
- ob.logger.ExternalChainWatcher.Warn().Msgf("potential attack attempt: %s destination address is ZETA token contract address %s", destChain, destAddr)
- return types.MsgVoteOnObservedInboundTx{}, errors.New(fmt.Sprintf("potential attack attempt: %s destination address is ZETA token contract address %s", destChain, destAddr))
+ if *destChain != common.ZetaChain() {
+ cfgDest, found := ob.cfg.GetEVMConfig(destChain.ChainId)
+ if !found {
+ return types.MsgVoteOnObservedInboundTx{}, errors.New(fmt.Sprintf("chain id not present in EVMChainConfigs %d", event.DestinationChainId.Int64()))
+ }
+ if strings.EqualFold(destAddr, cfgDest.ZetaTokenContractAddress) {
+ ob.logger.ExternalChainWatcher.Warn().Msgf("potential attack attempt: %s destination address is ZETA token contract address %s", destChain, destAddr)
+ return types.MsgVoteOnObservedInboundTx{}, errors.New(fmt.Sprintf("potential attack attempt: %s destination address is ZETA token contract address %s", destChain, destAddr))
+ }
}
return *GetInBoundVoteMessage(
event.ZetaTxSenderAddress.Hex(),
diff --git a/zetaclient/zetabridge.go b/zetaclient/zetabridge.go
index 64a7a565bd..4e29e0d9cf 100644
--- a/zetaclient/zetabridge.go
+++ b/zetaclient/zetabridge.go
@@ -4,6 +4,8 @@ import (
"fmt"
"time"
+ "github.com/cosmos/cosmos-sdk/simapp/params"
+
"github.com/zeta-chain/zetacore/common"
"sync"
@@ -32,6 +34,7 @@ import (
//"strconv"
//"strings"
+ "github.com/zeta-chain/zetacore/app"
crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
"github.com/zeta-chain/zetacore/zetaclient/config"
@@ -46,6 +49,7 @@ type ZetaCoreBridge struct {
grpcConn *grpc.ClientConn
httpClient *retryablehttp.Client
cfg config.ClientConfiguration
+ encodingCfg params.EncodingConfig
keys *Keys
broadcastLock *sync.RWMutex
zetaChainID string
@@ -92,6 +96,7 @@ func NewZetaCoreBridge(k *Keys, chainIP string, signerName string, chainID strin
accountNumber: accountsMap,
seqNumber: seqMap,
cfg: cfg,
+ encodingCfg: app.MakeEncodingConfig(),
keys: k,
broadcastLock: &sync.RWMutex{},
lastOutTxReportTime: map[string]time.Time{},
@@ -111,6 +116,12 @@ func MakeLegacyCodec() *codec.LegacyAmino {
return cdc
}
+func (b *ZetaCoreBridge) UpdateChainID(chainID string) {
+ if b.zetaChainID != chainID {
+ b.zetaChainID = chainID
+ }
+}
+
func (b *ZetaCoreBridge) Stop() {
b.logger.Info().Msgf("ZetaBridge is stopping")
close(b.stop) // this notifies all configupdater to stop
@@ -126,7 +137,11 @@ func (b *ZetaCoreBridge) GetAccountNumberAndSequenceNumber(_ common.KeyType) (ui
func (b *ZetaCoreBridge) SetAccountNumber(keyType common.KeyType) {
ctx := b.GetContext()
address := b.keys.GetAddress()
- accN, seq, _ := ctx.AccountRetriever.GetAccountNumberSequence(ctx, address)
+ accN, seq, err := ctx.AccountRetriever.GetAccountNumberSequence(ctx, address)
+ if err != nil {
+ b.logger.Error().Err(err).Msg("fail to get account number and sequence number")
+ return
+ }
b.accountNumber[keyType] = accN
b.seqNumber[keyType] = seq
}
@@ -141,7 +156,7 @@ func (b *ZetaCoreBridge) WaitForCoreToCreateBlocks() {
}
retryCount++
b.logger.Debug().Msgf("Failed to get latest Block , Retry : %d/%d", retryCount, DefaultRetryCount)
- if retryCount > DefaultRetryCount {
+ if retryCount > ExtendedRetryCount {
panic(fmt.Sprintf("ZetaCore is not ready , Waited for %d seconds", DefaultRetryCount*DefaultRetryInterval))
}
time.Sleep(DefaultRetryInterval * time.Second)
@@ -171,33 +186,40 @@ func (b *ZetaCoreBridge) UpdateConfigFromCore(cfg *config.Config, init bool) err
if err != nil {
return err
}
- newChains := make([]common.Chain, len(coreParams))
+
newEVMParams := make(map[int64]*observertypes.CoreParams)
var newBTCParams *observertypes.CoreParams
// check and update core params for each chain
- for i, params := range coreParams {
+ for _, params := range coreParams {
err := config.ValidateCoreParams(params)
if err != nil {
- b.logger.Err(err).Msgf("Invalid core params for chain %s", common.GetChainFromChainID(params.ChainId).ChainName)
+ b.logger.Debug().Err(err).Msgf("Invalid core params for chain %s", common.GetChainFromChainID(params.ChainId).ChainName)
}
- newChains[i] = *common.GetChainFromChainID(params.ChainId)
if common.IsBitcoinChain(params.ChainId) {
newBTCParams = params
} else {
newEVMParams[params.ChainId] = params
}
}
+
+ chains, err := b.GetSupportedChains()
+ if err != nil {
+ return err
+ }
+ newChains := make([]common.Chain, len(chains))
+ for i, chain := range chains {
+ newChains[i] = *chain
+ }
keyGen, err := b.GetKeyGen()
if err != nil {
b.logger.Info().Msg("Unable to fetch keygen from zetacore")
}
cfg.UpdateCoreParams(keyGen, newChains, newEVMParams, newBTCParams, init, b.logger)
- cfg.Keygen = *keyGen
tss, err := b.GetCurrentTss()
if err != nil {
- b.logger.Error().Err(err).Msg("Unable to fetch TSS from zetacore")
+ b.logger.Debug().Err(err).Msg("Unable to fetch TSS from zetacore")
} else {
cfg.CurrentTssPubkey = tss.GetTssPubkey()
}
diff --git a/zetaclient/zetacore_observer.go b/zetaclient/zetacore_observer.go
index 83b0b5dcb3..343228004a 100644
--- a/zetaclient/zetacore_observer.go
+++ b/zetaclient/zetacore_observer.go
@@ -2,18 +2,17 @@ package zetaclient
import (
"fmt"
- "math"
"strings"
"time"
"github.com/pkg/errors"
+ prom "github.com/prometheus/client_golang/prometheus"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/zeta-chain/zetacore/common"
+ "github.com/zeta-chain/zetacore/x/crosschain/types"
"github.com/zeta-chain/zetacore/zetaclient/config"
"github.com/zeta-chain/zetacore/zetaclient/metrics"
-
- prom "github.com/prometheus/client_golang/prometheus"
)
const (
@@ -108,6 +107,10 @@ func (co *CoreObserver) startSendScheduler() {
co.logger.ZetaChainWatcher.Error().Msg("GetZetaBlockHeight fail in startSendScheduler")
continue
}
+ if bn < 0 {
+ co.logger.ZetaChainWatcher.Error().Msg("GetZetaBlockHeight returned negative height")
+ continue
+ }
if lastBlockNum == 0 {
lastBlockNum = bn - 1
}
@@ -124,8 +127,8 @@ func (co *CoreObserver) startSendScheduler() {
continue
}
signer := co.signerMap[*c]
- chainClient := co.clientMap[*c]
- sendList, err := co.bridge.GetAllPendingCctx(uint64(c.ChainId))
+
+ cctxList, err := co.bridge.GetAllPendingCctx(c.ChainId)
if err != nil {
co.logger.ZetaChainWatcher.Error().Err(err).Msgf("failed to GetAllPendingCctx for chain %s", c.ChainName.String())
continue
@@ -155,17 +158,30 @@ func (co *CoreObserver) startSendScheduler() {
co.logger.ZetaChainWatcher.Error().Err(err).Msgf("failed to get prometheus gauge: %s", metrics.PendingTxs)
continue
}
- gauge.Set(float64(len(sendList)))
+ gauge.Set(float64(len(cctxList)))
- for idx, send := range sendList {
- params := send.GetCurrentOutTxParam()
+ for idx, cctx := range cctxList {
+ params := cctx.GetCurrentOutTxParam()
if params.ReceiverChainId != c.ChainId {
- log.Warn().Msgf("mismatch chainid: want %d, got %d", c.ChainId, params.ReceiverChainId)
+ co.logger.ZetaChainWatcher.Error().Msgf("mismatch chainid: want %d, got %d", c.ChainId, params.ReceiverChainId)
+ continue
+ }
+ // #nosec G701 range is verified
+ currentHeight := uint64(bn)
+ nonce := params.OutboundTxTssNonce
+ outTxID := fmt.Sprintf("%s-%d-%d", cctx.Index, params.ReceiverChainId, nonce) // would outTxID a better ID?
+
+ // Process Bitcoin OutTx
+ if common.IsBitcoinChain(c.ChainId) && !outTxMan.IsOutTxActive(outTxID) {
+ // #nosec G701 positive
+ if stop := co.processBitcoinOutTx(outTxMan, uint64(idx), cctx, signer, ob, currentHeight); stop {
+ break
+ }
continue
}
// Monitor Core Logger for OutboundTxTssNonce
- included, _, err := ob.IsSendOutTxProcessed(send.Index, params.OutboundTxTssNonce, params.CoinType, co.logger.ZetaChainWatcher)
+ included, _, err := ob.IsSendOutTxProcessed(cctx.Index, params.OutboundTxTssNonce, params.CoinType, co.logger.ZetaChainWatcher)
if err != nil {
co.logger.ZetaChainWatcher.Error().Err(err).Msgf("IsSendOutTxProcessed fail, Chain ID: %s", c.ChainName)
continue
@@ -174,16 +190,10 @@ func (co *CoreObserver) startSendScheduler() {
co.logger.ZetaChainWatcher.Info().Msgf("send outTx already included; do not schedule")
continue
}
- nonce := params.OutboundTxTssNonce
- outTxID := fmt.Sprintf("%s-%d-%d", send.Index, params.ReceiverChainId, nonce) // should be the outTxID?
- // FIXME: config this schedule; this value is for localnet fast testing
- if bn >= math.MaxInt64 {
- continue
- }
- currentHeight := uint64(bn)
+ // #nosec G701 positive
interval := uint64(ob.GetCoreParams().OutboundTxScheduleInterval)
- lookahead := uint64(ob.GetCoreParams().OutboundTxScheduleLookahead)
+ lookahead := ob.GetCoreParams().OutboundTxScheduleLookahead
// determining critical outtx; if it satisfies following criteria
// 1. it's the first pending outtx for this chain
@@ -209,10 +219,12 @@ func (co *CoreObserver) startSendScheduler() {
// otherwise, the normal interval is used
if nonce%interval == currentHeight%interval && !outTxMan.IsOutTxActive(outTxID) {
outTxMan.StartTryProcess(outTxID)
- co.logger.ZetaChainWatcher.Debug().Msgf("chain %s: Sign outtx %s with value %d\n", chain, send.Index, send.GetCurrentOutTxParam().Amount)
- go signer.TryProcessOutTx(send, outTxMan, outTxID, chainClient, co.bridge, currentHeight)
+ co.logger.ZetaChainWatcher.Debug().Msgf("chain %s: Sign outtx %s with value %d\n", chain, outTxID, cctx.GetCurrentOutTxParam().Amount)
+ go signer.TryProcessOutTx(cctx, outTxMan, outTxID, ob, co.bridge, currentHeight)
}
- if idx > int(lookahead) { // only look at 50 sends per chain
+
+ // #nosec G701 always in range
+ if int64(idx) >= lookahead-1 { // only look at 30 sends per chain
break
}
}
@@ -227,6 +239,41 @@ func (co *CoreObserver) startSendScheduler() {
}
}
+// Bitcoin outtx is processed in a different way
+// 1. schedule one keysign on each ticker
+// 2. schedule keysign only when nonce-mark UTXO is available
+// 3. stop processing when pendingNonce/lookahead is reached
+//
+// Returns whether to stop processing
+func (co *CoreObserver) processBitcoinOutTx(outTxMan *OutTxProcessorManager, idx uint64, send *types.CrossChainTx, signer ChainSigner, ob ChainClient, currentHeight uint64) bool {
+ params := send.GetCurrentOutTxParam()
+ nonce := params.OutboundTxTssNonce
+ lookahead := ob.GetCoreParams().OutboundTxScheduleLookahead
+ outTxID := fmt.Sprintf("%s-%d-%d", send.Index, params.ReceiverChainId, nonce)
+
+ // start go routine to process outtx
+ outTxMan.StartTryProcess(outTxID)
+ co.logger.ZetaChainWatcher.Debug().Msgf("Sign bitcoin outtx %s with value %d\n", outTxID, params.Amount)
+ go signer.TryProcessOutTx(send, outTxMan, outTxID, ob, co.bridge, currentHeight)
+
+ // get bitcoin client
+ btcClient, ok := ob.(*BitcoinChainClient)
+ if !ok { // should never happen
+ co.logger.ZetaChainWatcher.Error().Msgf("chain client is not a bitcoin client")
+ return true
+ }
+ // stop if the nonce being processed reaches the artificial pending nonce
+ if nonce >= btcClient.GetPendingNonce() {
+ return true
+ }
+ // stop if lookahead is reached. 2 bitcoin confirmations span is 20 minutes on average. We look ahead up to 100 pending cctx to target TPM of 5.
+ // #nosec G701 always in range
+ if int64(idx) >= lookahead-1 {
+ return true
+ }
+ return false // otherwise, continue
+}
+
func (co *CoreObserver) getUpdatedChainOb(chainID int64) (ChainClient, error) {
chainOb, err := co.getTargetChainOb(chainID)
if err != nil {