Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/zeta-chain/node into fea…
Browse files Browse the repository at this point in the history
…t-bitcoin-Replace-By-Fee
  • Loading branch information
ws4charlie committed Jan 14, 2025
2 parents 24d12ae + 8559390 commit 86df3b0
Show file tree
Hide file tree
Showing 139 changed files with 5,504 additions and 1,362 deletions.
2 changes: 1 addition & 1 deletion .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sast-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ linters:
- misspell
- goimports
- govet
- gosec
- stylecheck
- typecheck
- misspell
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile-localnet
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 && \
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -409,7 +409,7 @@ test-sim-fullappsimulation:
$(call run-sim-test,"TestFullAppSimulation",TestFullAppSimulation,100,200,30m)

test-sim-import-export:
$(call run-sim-test,"test-import-export",TestAppImportExport,50,100,30m)
$(call run-sim-test,"test-import-export",TestAppImportExport,100,200,30m)

test-sim-after-import:
$(call run-sim-test,"test-sim-after-import",TestAppSimulationAfterImport,100,200,30m)
Expand All @@ -430,6 +430,12 @@ test-sim-after-import-long: runsim
@echo "Running application simulation-after-import. This may take several minute"
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 500 50 TestAppSimulationAfterImport

# Use to run all simulation tests quickly (for example, before a creating a PR)
test-sim-quick:
$(call run-sim-test,"test-full-app-sim",TestFullAppSimulation,10,20,30m)
$(call run-sim-test,"test-import-export",TestAppImportExport,10,20,30m)
$(call run-sim-test,"test-sim-after-import",TestAppSimulationAfterImport,10,20,30m)

.PHONY: \
test-sim-nondeterminism \
test-sim-fullappsimulation \
Expand Down
9 changes: 2 additions & 7 deletions app/ante/authz.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ante

import (
"fmt"
"slices"

errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -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)
}
8 changes: 4 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -784,15 +785,14 @@ 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,
EvmKeeper: app.EvmKeeper,
FeeMarketKeeper: app.FeeMarketKeeper,
SignModeHandler: encodingConfig.TxConfig.SignModeHandler(),
SigGasConsumer: evmante.DefaultSigVerificationGasConsumer,
MaxTxGasWanted: maxGasWanted,
MaxTxGasWanted: TransactionGasLimit,
DisabledAuthzMsgs: []string{
sdk.MsgTypeURL(
&evmtypes.MsgEthereumTx{},
Expand Down
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@
* [3254](https://github.com/zeta-chain/node/pull/3254) - rename v2 E2E tests as evm tests and rename old evm tests as legacy
* [3095](https://github.com/zeta-chain/node/pull/3095) - initialize simulation tests for custom zetachain modules
* [3276](https://github.com/zeta-chain/node/pull/3276) - add Solana E2E performance tests and improve Solana outbounds performance
* [3207](https://github.com/zeta-chain/node/pull/3207) - add simulation test operations for all messages in crosschain and observer module

### Refactor

* [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

Expand Down
36 changes: 28 additions & 8 deletions cmd/zetaclientd/inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ import (
"strconv"
"strings"

"cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/pkg/errors"
"github.com/rs/zerolog"
"github.com/spf13/cobra"

"github.com/zeta-chain/node/pkg/coin"
"github.com/zeta-chain/node/testutil/sample"
"github.com/zeta-chain/node/zetaclient/chains/base"
btcobserver "github.com/zeta-chain/node/zetaclient/chains/bitcoin/observer"
btcrpc "github.com/zeta-chain/node/zetaclient/chains/bitcoin/rpc"
evmobserver "github.com/zeta-chain/node/zetaclient/chains/evm/observer"
"github.com/zeta-chain/node/zetaclient/config"
zctx "github.com/zeta-chain/node/zetaclient/context"
Expand Down Expand Up @@ -156,17 +157,36 @@ func InboundGetBallot(_ *cobra.Command, args []string) error {
}
fmt.Println("CoinType : ", coinType)
} else if chain.IsBitcoin() {
observer, ok := observers[chainID]
if !ok {
return fmt.Errorf("observer not found for btc chain %d", chainID)
bitcoinConfig, found := appContext.Config().GetBTCConfig(chain.ID())
if !found {
return fmt.Errorf("unable to find btc config")
}

btcObserver, ok := observer.(*btcobserver.Observer)
if !ok {
return fmt.Errorf("observer is not btc observer for chain %d", chainID)
rpcClient, err := btcrpc.NewRPCClient(bitcoinConfig)
if err != nil {
return errors.Wrap(err, "unable to create rpc client")
}

database, err := db.NewFromSqliteInMemory(true)
if err != nil {
return errors.Wrap(err, "unable to open database")
}

observer, err := btcobserver.NewObserver(
*chain.RawChain(),
rpcClient,
*chain.Params(),
client,
nil,
database,
baseLogger,
nil,
)
if err != nil {
return errors.Wrap(err, "unable to create btc observer")
}

ballotIdentifier, err = btcObserver.CheckReceiptForBtcTxHash(ctx, inboundHash, false)
ballotIdentifier, err = observer.CheckReceiptForBtcTxHash(ctx, inboundHash, false)
if err != nil {
return err
}
Expand Down
21 changes: 21 additions & 0 deletions cmd/zetaclientd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/zeta-chain/node/pkg/constant"
"github.com/zeta-chain/node/pkg/graceful"
zetaos "github.com/zeta-chain/node/pkg/os"
"github.com/zeta-chain/node/pkg/scheduler"
"github.com/zeta-chain/node/zetaclient/chains/base"
"github.com/zeta-chain/node/zetaclient/config"
zctx "github.com/zeta-chain/node/zetaclient/context"
Expand Down Expand Up @@ -115,6 +116,8 @@ func Start(_ *cobra.Command, _ []string) error {
return errors.Wrap(err, "unable to setup TSS service")
}

graceful.AddStopper(tss.Stop)

// Starts various background TSS listeners.
// Shuts down zetaclientd if any is triggered.
maintenance.NewTSSListener(zetacoreClient, logger.Std).Listen(ctx, func() {
Expand Down Expand Up @@ -159,9 +162,27 @@ func Start(_ *cobra.Command, _ []string) error {
return errors.Wrap(err, "unable to create orchestrator")
}

taskScheduler := scheduler.New(logger.Std)
maestroV2Deps := &orchestrator.Dependencies{
Zetacore: zetacoreClient,
TSS: tss,
DBPath: dbPath,
Telemetry: telemetry,
}

maestroV2, err := orchestrator.NewV2(taskScheduler, maestroV2Deps, logger)
if err != nil {
return errors.Wrap(err, "unable to create orchestrator V2")
}

// Start orchestrator with all observers and signers
graceful.AddService(ctx, maestro)

// Start orchestrator V2
// V2 will co-exist with V1 until all types of chains will be refactored (BTC, EVM, SOL, TON).
// (currently it's only BTC)
graceful.AddService(ctx, maestroV2)

// Block current routine until a shutdown signal is received
graceful.WaitForShutdown()

Expand Down
2 changes: 1 addition & 1 deletion e2e/e2etests/test_bitcoin_deposit_and_call_revert.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/zeta-chain/node/e2e/runner"
"github.com/zeta-chain/node/e2e/utils"
"github.com/zeta-chain/node/testutil/sample"
zetabitcoin "github.com/zeta-chain/node/zetaclient/chains/bitcoin"
zetabitcoin "github.com/zeta-chain/node/zetaclient/chains/bitcoin/common"
)

func TestBitcoinDepositAndCallRevert(r *runner.E2ERunner, args []string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/zeta-chain/node/pkg/constant"
"github.com/zeta-chain/node/testutil/sample"
crosschaintypes "github.com/zeta-chain/node/x/crosschain/types"
zetabitcoin "github.com/zeta-chain/node/zetaclient/chains/bitcoin"
zetabitcoin "github.com/zeta-chain/node/zetaclient/chains/bitcoin/common"
)

// TestBitcoinDepositAndCallRevertWithDust sends a Bitcoin deposit that reverts with a dust amount in the revert outbound.
Expand Down
6 changes: 3 additions & 3 deletions e2e/e2etests/test_bitcoin_deposit_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/zeta-chain/node/e2e/utils"
testcontract "github.com/zeta-chain/node/testutil/contracts"
crosschaintypes "github.com/zeta-chain/node/x/crosschain/types"
zetabitcoin "github.com/zeta-chain/node/zetaclient/chains/bitcoin"
"github.com/zeta-chain/node/zetaclient/chains/bitcoin/common"
)

func TestBitcoinDepositAndCall(r *runner.E2ERunner, args []string) {
Expand All @@ -20,7 +20,7 @@ func TestBitcoinDepositAndCall(r *runner.E2ERunner, args []string) {
// Given amount to send
require.Len(r, args, 1)
amount := utils.ParseFloat(r, args[0])
amountTotal := amount + zetabitcoin.DefaultDepositorFee
amountTotal := amount + common.DefaultDepositorFee

// Given a list of UTXOs
utxos, err := r.ListDeployerUTXOs()
Expand All @@ -45,7 +45,7 @@ func TestBitcoinDepositAndCall(r *runner.E2ERunner, args []string) {
utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined)

// check if example contract has been called, 'bar' value should be set to amount
amountSats, err := zetabitcoin.GetSatoshis(amount)
amountSats, err := common.GetSatoshis(amount)
require.NoError(r, err)
utils.MustHaveCalledExampleContract(r, contract, big.NewInt(amountSats))
}
2 changes: 1 addition & 1 deletion e2e/e2etests/test_bitcoin_donation.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/zeta-chain/node/e2e/utils"
"github.com/zeta-chain/node/pkg/constant"
crosschaintypes "github.com/zeta-chain/node/x/crosschain/types"
zetabitcoin "github.com/zeta-chain/node/zetaclient/chains/bitcoin"
zetabitcoin "github.com/zeta-chain/node/zetaclient/chains/bitcoin/common"
)

func TestBitcoinDonation(r *runner.E2ERunner, args []string) {
Expand Down
4 changes: 2 additions & 2 deletions e2e/e2etests/test_bitcoin_std_deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/zeta-chain/node/e2e/utils"
"github.com/zeta-chain/node/pkg/memo"
crosschaintypes "github.com/zeta-chain/node/x/crosschain/types"
"github.com/zeta-chain/node/zetaclient/chains/bitcoin"
"github.com/zeta-chain/node/zetaclient/chains/bitcoin/common"
)

func TestBitcoinStdMemoDeposit(r *runner.E2ERunner, args []string) {
Expand Down Expand Up @@ -54,7 +54,7 @@ func TestBitcoinStdMemoDeposit(r *runner.E2ERunner, args []string) {

// the runner balance should be increased by the deposit amount
amountIncreased := new(big.Int).Sub(balanceAfter, balanceBefore)
amountSatoshis, err := bitcoin.GetSatoshis(amount)
amountSatoshis, err := common.GetSatoshis(amount)
require.NoError(r, err)
require.Positive(r, amountSatoshis)
// #nosec G115 always positive
Expand Down
2 changes: 1 addition & 1 deletion e2e/e2etests/test_bitcoin_std_deposit_and_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/zeta-chain/node/pkg/memo"
testcontract "github.com/zeta-chain/node/testutil/contracts"
crosschaintypes "github.com/zeta-chain/node/x/crosschain/types"
zetabitcoin "github.com/zeta-chain/node/zetaclient/chains/bitcoin"
zetabitcoin "github.com/zeta-chain/node/zetaclient/chains/bitcoin/common"
)

func TestBitcoinStdMemoDepositAndCall(r *runner.E2ERunner, args []string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/zeta-chain/node/pkg/memo"
testcontract "github.com/zeta-chain/node/testutil/contracts"
crosschaintypes "github.com/zeta-chain/node/x/crosschain/types"
zetabitcoin "github.com/zeta-chain/node/zetaclient/chains/bitcoin"
"github.com/zeta-chain/node/zetaclient/chains/bitcoin/common"
)

func TestBitcoinStdMemoInscribedDepositAndCall(r *runner.E2ERunner, args []string) {
Expand Down Expand Up @@ -53,7 +53,7 @@ func TestBitcoinStdMemoInscribedDepositAndCall(r *runner.E2ERunner, args []strin
utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined)

// check if example contract has been called, 'bar' value should be set to correct amount
depositFeeSats, err := zetabitcoin.GetSatoshis(zetabitcoin.DefaultDepositorFee)
depositFeeSats, err := common.GetSatoshis(common.DefaultDepositorFee)
require.NoError(r, err)
receiveAmount := depositAmount - depositFeeSats
utils.MustHaveCalledExampleContract(r, contract, big.NewInt(receiveAmount))
Expand Down
Loading

0 comments on commit 86df3b0

Please sign in to comment.