From dde01b4fa14564066752e972cd0737b9bfb177fc Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Mon, 13 Jan 2025 11:06:07 -0800 Subject: [PATCH 1/4] fix!: set per transaction gas limit to 10M (#3342) (#3344) --- app/app.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/app.go b/app/app.go index 1132e89cb3..a66e2b7ef8 100644 --- a/app/app.go +++ b/app/app.go @@ -143,8 +143,9 @@ func init() { } var ( - NodeDir = ".zetacored" - DefaultNodeHome = os.ExpandEnv("$HOME/") + NodeDir + NodeDir = ".zetacored" + DefaultNodeHome = os.ExpandEnv("$HOME/") + NodeDir + TransactionGasLimit uint64 = 10_000_000 ) func getGovProposalHandlers() []govclient.ProposalHandler { @@ -784,7 +785,6 @@ func New( app.SetInitChainer(app.InitChainer) app.SetBeginBlocker(app.BeginBlocker) - maxGasWanted := cast.ToUint64(appOpts.Get(srvflags.EVMMaxTxGasWanted)) options := ante.HandlerOptions{ AccountKeeper: app.AccountKeeper, BankKeeper: app.BankKeeper, @@ -792,7 +792,7 @@ func New( FeeMarketKeeper: app.FeeMarketKeeper, SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), SigGasConsumer: evmante.DefaultSigVerificationGasConsumer, - MaxTxGasWanted: maxGasWanted, + MaxTxGasWanted: TransactionGasLimit, DisabledAuthzMsgs: []string{ sdk.MsgTypeURL( &evmtypes.MsgEthereumTx{}, From bddce4e3186a6c0e5224258355a4e2387b0287e2 Mon Sep 17 00:00:00 2001 From: dashangcun <907225865@qq.com> Date: Mon, 13 Jan 2025 20:36:35 +0100 Subject: [PATCH 2/4] refactor: using slices.Contains to simplify the code (#3347) Signed-off-by: dashangcun <907225865@qq.com> --- app/ante/authz.go | 9 ++------- x/crosschain/types/status.go | 8 ++------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/app/ante/authz.go b/app/ante/authz.go index d310943771..f6c8f1a857 100644 --- a/app/ante/authz.go +++ b/app/ante/authz.go @@ -2,6 +2,7 @@ package ante import ( "fmt" + "slices" errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" @@ -94,11 +95,5 @@ func (ald AuthzLimiterDecorator) checkDisabledMsgs(msgs []sdk.Msg, isAuthzInnerM // isDisabledMsg returns true if the given message is in the list of restricted // messages from the AnteHandler. func (ald AuthzLimiterDecorator) isDisabledMsg(msgTypeURL string) bool { - for _, disabledType := range ald.disabledMsgTypes { - if msgTypeURL == disabledType { - return true - } - } - - return false + return slices.Contains(ald.disabledMsgTypes, msgTypeURL) } diff --git a/x/crosschain/types/status.go b/x/crosschain/types/status.go index 5ebdf5391c..fc91b8c28b 100644 --- a/x/crosschain/types/status.go +++ b/x/crosschain/types/status.go @@ -2,6 +2,7 @@ package types import ( "fmt" + "slices" ) func (m *Status) AbortRefunded() { @@ -56,12 +57,7 @@ func (m *Status) ValidateTransition(newStatus CctxStatus) bool { if !isOldStatusValid { return false } - for _, status := range nextStatusList { - if status == newStatus { - return true - } - } - return false + return slices.Contains(nextStatusList, newStatus) } func stateTransitionMap() map[CctxStatus][]CctxStatus { From 85593909e9099bc6b8d326d5dbf0a0a19b649a5f Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Mon, 13 Jan 2025 13:39:17 -0800 Subject: [PATCH 3/4] chore: upgrade cosmovisor and go (#3345) * chore: upgrade cosmovisor * upgrade to go 1.23 * go mod tidy * upgrade golangci-lint * fix lint failures and disable golangci-lint gosec for now --- .github/actions/install-dependencies/action.yml | 2 +- .github/workflows/ci.yml | 2 +- .github/workflows/sast-linters.yml | 4 ++-- .github/workflows/sim.yaml | 2 +- .golangci.yml | 1 - Dockerfile-localnet | 8 ++++---- Makefile | 2 +- pkg/graceful/graceful.go | 6 +++--- rpc/types/utils.go | 8 ++++---- scripts/fmt.sh | 2 +- x/observer/types/ballot.go | 4 ++-- 11 files changed, 20 insertions(+), 21 deletions(-) diff --git a/.github/actions/install-dependencies/action.yml b/.github/actions/install-dependencies/action.yml index 3cac451e88..6c9213a902 100644 --- a/.github/actions/install-dependencies/action.yml +++ b/.github/actions/install-dependencies/action.yml @@ -33,7 +33,7 @@ runs: - uses: actions/setup-go@v5 if: ${{ inputs.skip_go == 'false' }} with: - go-version: '1.22' + go-version: '1.23' cache: false - uses: actions/setup-python@v4 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a44e995a6..e46446dd7c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -104,7 +104,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.22' + go-version: '1.23' - name: go get node working-directory: contrib/rpcimportable run: go get github.com/zeta-chain/node@${{github.event.pull_request.head.sha || github.sha}} diff --git a/.github/workflows/sast-linters.yml b/.github/workflows/sast-linters.yml index 7b09472298..5005d552f3 100644 --- a/.github/workflows/sast-linters.yml +++ b/.github/workflows/sast-linters.yml @@ -43,12 +43,12 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.22' + go-version: '1.23' - name: Run golangci-lint uses: golangci/golangci-lint-action@v6 with: - version: v1.59 + version: v1.63.4 skip-cache: true nosec_alert: diff --git a/.github/workflows/sim.yaml b/.github/workflows/sim.yaml index 11e6858a81..963a1ca6f9 100644 --- a/.github/workflows/sim.yaml +++ b/.github/workflows/sim.yaml @@ -84,7 +84,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.22' + go-version: '1.23' - name: Install dependencies run: make runsim diff --git a/.golangci.yml b/.golangci.yml index 8fb8a0084a..8ed83e2f52 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -13,7 +13,6 @@ linters: - misspell - goimports - govet - - gosec - stylecheck - typecheck - misspell diff --git a/Dockerfile-localnet b/Dockerfile-localnet index 09e8c15a10..dd329a712d 100644 --- a/Dockerfile-localnet +++ b/Dockerfile-localnet @@ -1,6 +1,6 @@ # syntax=ghcr.io/zeta-chain/docker-dockerfile:1.9-labs # check=error=true -FROM ghcr.io/zeta-chain/golang:1.22.7-bookworm AS base-build +FROM ghcr.io/zeta-chain/golang:1.23.3-bookworm AS base-build ENV GOPATH=/go ENV GOOS=linux @@ -27,10 +27,10 @@ RUN --mount=type=cache,target="/root/.cache/go-build" \ NODE_COMMIT=${NODE_COMMIT} \ make install install-zetae2e -FROM ghcr.io/zeta-chain/golang:1.22.7-bookworm AS cosmovisor-build -RUN go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@v1.6.0 +FROM ghcr.io/zeta-chain/golang:1.23.3-bookworm AS cosmovisor-build +RUN go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@v1.7.0 -FROM ghcr.io/zeta-chain/golang:1.22.7-bookworm AS base-runtime +FROM ghcr.io/zeta-chain/golang:1.23.3-bookworm AS base-runtime RUN apt update && \ apt install -yq jq yq curl tmux python3 openssh-server iputils-ping iproute2 bind9-host && \ diff --git a/Makefile b/Makefile index 89a42ab4e9..910791e5c7 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ GOFLAGS := "" GOPATH ?= '$(HOME)/go' # common goreaser command definition -GOLANG_CROSS_VERSION ?= v1.22.7@sha256:24b2d75007f0ec8e35d01f3a8efa40c197235b200a1a91422d78b851f67ecce4 +GOLANG_CROSS_VERSION ?= v1.23.3@sha256:380420abb74844aaebca5bf9e2d00b1d7c78f59ce9e6d47cdb3276281702ca23 GORELEASER := $(DOCKER) run \ --rm \ --privileged \ diff --git a/pkg/graceful/graceful.go b/pkg/graceful/graceful.go index 6f9ffe4cf4..3cfdc3e602 100644 --- a/pkg/graceful/graceful.go +++ b/pkg/graceful/graceful.go @@ -147,9 +147,9 @@ func (p *Process) ShutdownNow() { } } -// panicToErr converts panic to error WITH exact line of panic. +// panicToErr converts recoverVal to error WITH exact line of panic. // Note the offset should be determined empirically. -func panicToErr(panic any, offset int) error { +func panicToErr(recoverVal any, offset int) error { stack := string(debug.Stack()) lines := strings.Split(stack, "\n") line := "" @@ -158,7 +158,7 @@ func panicToErr(panic any, offset int) error { line = strings.TrimSpace(lines[offset]) } - return fmt.Errorf("panic: %v at %s", panic, line) + return fmt.Errorf("panic: %v at %s", recoverVal, line) } // NewSigChan creates a new signal channel. diff --git a/rpc/types/utils.go b/rpc/types/utils.go index a17f3af2a2..b7195478d1 100644 --- a/rpc/types/utils.go +++ b/rpc/types/utils.go @@ -303,9 +303,9 @@ func BaseFeeFromEvents(events []abci.Event) *big.Int { // CheckTxFee is an internal function used to check whether the fee of // the given transaction is _reasonable_(under the cap). -func CheckTxFee(gasPrice *big.Int, gas uint64, cap float64) error { +func CheckTxFee(gasPrice *big.Int, gas uint64, feeCap float64) error { // Short circuit if there is no cap for transaction fee at all. - if cap == 0 { + if feeCap == 0 { return nil } totalfee := new(big.Float).SetInt(new(big.Int).Mul(gasPrice, new(big.Int).SetUint64(gas))) @@ -315,8 +315,8 @@ func CheckTxFee(gasPrice *big.Int, gas uint64, cap float64) error { feeEth := new(big.Float).Quo(totalfee, oneToken) // no need to check error from parsing feeFloat, _ := feeEth.Float64() - if feeFloat > cap { - return fmt.Errorf("tx fee (%.2f ether) exceeds the configured cap (%.2f ether)", feeFloat, cap) + if feeFloat > feeCap { + return fmt.Errorf("tx fee (%.2f ether) exceeds the configured cap (%.2f ether)", feeFloat, feeCap) } return nil } diff --git a/scripts/fmt.sh b/scripts/fmt.sh index 7d6ef5eb9f..bffad41ab1 100755 --- a/scripts/fmt.sh +++ b/scripts/fmt.sh @@ -6,7 +6,7 @@ set -e if ! command -v golangci-lint &> /dev/null then echo "golangci-lint is not found, installing..." - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.1 + go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.63.4 fi if ! command -v golines &> /dev/null diff --git a/x/observer/types/ballot.go b/x/observer/types/ballot.go index 6c04963cf9..2d217c0952 100644 --- a/x/observer/types/ballot.go +++ b/x/observer/types/ballot.go @@ -79,8 +79,8 @@ func (m Ballot) IsFinalizingVote() (Ballot, bool) { return m, false } -func CreateVotes(len int) []VoteType { - voterList := make([]VoteType, len) +func CreateVotes(listSize int) []VoteType { + voterList := make([]VoteType, listSize) for i := range voterList { voterList[i] = VoteType_NotYetVoted } From 7eea20e2a09e7c3faaea8984a6366a1100c7b70f Mon Sep 17 00:00:00 2001 From: Lucas Bertrand Date: Tue, 14 Jan 2025 19:07:54 +0100 Subject: [PATCH 4/4] chore: fix changelogs with unreleased changes (#3351) * chore: fix changelog with unreleased changes * Update changelog.md * Update changelog.md --- changelog.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 1128fda716..4cc4454097 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # CHANGELOG +## unreleased + +### Refactor + +* [3332](https://github.com/zeta-chain/node/pull/3332) - implement orchestrator V2. Move BTC observer-signer to V2 + ## v25.0.0 ### Features @@ -21,7 +27,6 @@ * [3170](https://github.com/zeta-chain/node/pull/3170) - revamp TSS package in zetaclient * [3291](https://github.com/zeta-chain/node/pull/3291) - revamp zetaclient initialization (+ graceful shutdown) * [3319](https://github.com/zeta-chain/node/pull/3319) - implement scheduler for zetaclient -* [3332](https://github.com/zeta-chain/node/pull/3332) - implement orchestrator V2. Move BTC observer-signer to V2 ### Fixes