Skip to content

Commit

Permalink
Merge branch 'develop' into e2e/spl-liquidity-add
Browse files Browse the repository at this point in the history
  • Loading branch information
julianrubino authored Jan 24, 2025
2 parents 6ac734d + 367e4aa commit 89cc1fc
Show file tree
Hide file tree
Showing 405 changed files with 28,736 additions and 10,630 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/generate-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ jobs:

- name: Check for changes
run: |
if git diff --exit-code --ignore-space-change --ignore-all-space --ignore-cr-at-eol; then
echo "Generated Go files are up-to-date."
else
if [[ -n $(git status --porcelain) ]]; then
echo "::error::Generated files are not up-to-date. Please run 'make generate' locally and commit any changes."
git status --porcelain
git diff
exit 1
fi
37 changes: 37 additions & 0 deletions .github/workflows/reusable-sim.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Reusable Sim Workflow
on:
workflow_call:
inputs:
make-target:
description: 'Makefile target to execute'
required: true
type: string
run:
description: 'Whether to run the job or not'
required: true
type: boolean
runs-on:
description: 'The runner to use for the job'
type: string
default: 'ubuntu-22.04'
jobs:
sim:
if: ${{ inputs.run }}
runs-on: ${{ inputs.runs-on }}
strategy:
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'

- name: Install dependencies
run: make runsim

- name: Run ${{ inputs.make-target }}
run: |
make ${{ inputs.make-target }}
73 changes: 37 additions & 36 deletions .github/workflows/sim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- develop
- release/*
pull_request:
types: [opened, synchronize, labeled]
schedule:
Expand All @@ -23,20 +24,19 @@ jobs:
changed-files:
runs-on: ubuntu-latest
outputs:
modified_files: ${{ steps.changes.outputs.modified_files }}
x_changed: ${{ steps.x-changes.outputs.any_changed }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Get changed files in x directory
id: changes
run: |
echo "::set-output name=modified_files::$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '^x/' | xargs)"
id: x-changes
uses: tj-actions/changed-files@v45
with:
files: x/**

matrix-conditionals:
needs: changed-files
if: |
contains(github.event.pull_request.labels.*.name, 'SIM_TESTS') || needs.changed-files.outputs.modified_files
runs-on: ubuntu-22.04
outputs:
SIM_TEST_NOND: ${{ steps.matrix-conditionals.outputs.SIM_TEST_NOND }}
Expand All @@ -48,11 +48,29 @@ jobs:
uses: actions/github-script@v7
with:
script: |
const makeTargetsInput = context.payload.inputs ? context.payload.inputs['make-targets'] : null;
const defaultTargets = ['test-sim-nondeterminism', 'test-sim-fullappsimulation', 'test-sim-import-export', 'test-sim-after-import'];
let makeTargets = [];
if (context.eventName === 'pull_request') {
const changedFiles = ${{ needs.changed-files.outputs.x_changed }};
const pull_number = context.payload.pull_request.number;
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pull_number,
});
const labels = pr.labels.map(label => label.name);
console.log(`labels for ${pull_number}:`, labels);
console.log(`changedFiles for ${pull_number}:`, changedFiles);
const makeTargets = makeTargetsInput ? makeTargetsInput.split(',') : defaultTargets;
if (changedFiles || labels.includes('SIM_TESTS')) {
makeTargets = defaultTargets;
}
} else {
const makeTargetsInput = context.payload.inputs ? context.payload.inputs['make-targets'] : null;
makeTargets = makeTargetsInput ? makeTargetsInput.split(',') : defaultTargets;
}
console.log('makeTargets: ', makeTargets);
core.setOutput('SIM_TEST_NOND', makeTargets.includes('test-sim-nondeterminism'));
core.setOutput('SIM_TEST_FULL', makeTargets.includes('test-sim-fullappsimulation'));
core.setOutput('SIM_TEST_IMPORT_EXPORT', makeTargets.includes('test-sim-import-export'));
Expand All @@ -61,45 +79,28 @@ jobs:
simulation-tests:
needs:
- matrix-conditionals
if: |
contains(github.event.pull_request.labels.*.name, 'SIM_TESTS') || needs.changed-files.outputs.modified_files
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- make-target: "test-sim-nondeterminism"
condition: ${{ needs.matrix-conditionals.outputs.SIM_TEST_NOND == 'true' }}
run: ${{ needs.matrix-conditionals.outputs.SIM_TEST_NOND == 'true' }}
- make-target: "test-sim-fullappsimulation"
condition: ${{ needs.matrix-conditionals.outputs.SIM_TEST_FULL == 'true' }}
run: ${{ needs.matrix-conditionals.outputs.SIM_TEST_FULL == 'true' }}
- make-target: "test-sim-import-export"
condition: ${{ needs.matrix-conditionals.outputs.SIM_TEST_IMPORT_EXPORT == 'true' }}
run: ${{ needs.matrix-conditionals.outputs.SIM_TEST_IMPORT_EXPORT == 'true' }}
- make-target: "test-sim-after-import"
condition: ${{ needs.matrix-conditionals.outputs.SIM_TEST_AFTER_IMPORT == 'true' }}
run: ${{ needs.matrix-conditionals.outputs.SIM_TEST_AFTER_IMPORT == 'true' }}
name: ${{ matrix.make-target }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'

- name: Install dependencies
run: make runsim

- name: Run ${{ matrix.make-target }}
if: ${{ matrix.condition }}
run: |
make ${{ matrix.make-target }}
uses: ./.github/workflows/reusable-sim.yml
with:
make-target: ${{ matrix.make-target }}
run: ${{ matrix.run }}
sim-ok:
runs-on: ubuntu-22.04
needs:
- simulation-tests
if: |
contains(github.event.pull_request.labels.*.name, 'SIM_TESTS') || needs.changed-files.outputs.modified_files
runs-on: ubuntu-22.04
if: ${{ !cancelled() }}
steps:
- name: Aggregate Results
run: |
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ fmt:
### Generation commands ###
###############################################################################

protoVer=0.13.0
protoVer=0.14.0
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace --user $(shell id -u):$(shell id -g) $(protoImageName)

Expand Down Expand Up @@ -327,7 +327,7 @@ ifdef UPGRADE_TEST_FROM_SOURCE
zetanode-upgrade: e2e-images
@echo "Building zetanode-upgrade from source"
$(DOCKER) build -t zetanode:old -f Dockerfile-localnet --target old-runtime-source \
--build-arg OLD_VERSION='release/v24' \
--build-arg OLD_VERSION='release/v26' \
--build-arg NODE_VERSION=$(NODE_VERSION) \
--build-arg NODE_COMMIT=$(NODE_COMMIT)
.
Expand All @@ -336,7 +336,7 @@ else
zetanode-upgrade: e2e-images
@echo "Building zetanode-upgrade from binaries"
$(DOCKER) build -t zetanode:old -f Dockerfile-localnet --target old-runtime \
--build-arg OLD_VERSION='https://github.com/zeta-chain/node/releases/download/v24.0.0' \
--build-arg OLD_VERSION='https://github.com/zeta-chain/node/releases/download/v26.0.0' \
--build-arg NODE_VERSION=$(NODE_VERSION) \
--build-arg NODE_COMMIT=$(NODE_COMMIT) \
.
Expand Down
4 changes: 2 additions & 2 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"runtime/debug"

errorsmod "cosmossdk.io/errors"
tmlog "github.com/cometbft/cometbft/libs/log"
tmlog "cosmossdk.io/log"
sdk "github.com/cosmos/cosmos-sdk/types"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
Expand Down Expand Up @@ -177,7 +177,7 @@ func IsSystemTx(tx sdk.Tx, isAuthorizedSigner func(string) bool) bool {
*observertypes.MsgVoteBlockHeader,
*observertypes.MsgVoteTSS,
*observertypes.MsgVoteBlame:
signers := innerMsg.GetSigners()
signers := innerMsg.(sdk.LegacyMsg).GetSigners()
if len(signers) == 1 {
return isAuthorizedSigner(signers[0].String())
}
Expand Down
13 changes: 7 additions & 6 deletions app/ante/fees.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"math/big"

errorsmod "cosmossdk.io/errors"
sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
Expand Down Expand Up @@ -108,7 +109,7 @@ func (mpd MinGasPriceDecorator) AnteHandle(
}
}

reductionRate := sdk.MustNewDecFromStr(GasPriceReductionRate)
reductionRate := sdkmath.LegacyMustNewDecFromStr(GasPriceReductionRate)
minGasPrice = minGasPrice.Mul(reductionRate) // discounts min gas price for system tx

evmParams := mpd.evmKeeper.GetParams(ctx)
Expand All @@ -127,7 +128,7 @@ func (mpd MinGasPriceDecorator) AnteHandle(

// Determine the required fees by multiplying each required minimum gas
// price by the gas limit, where fee = ceil(minGasPrice * gasLimit).
gasLimit := sdk.NewDecFromBigInt(new(big.Int).SetUint64(gas))
gasLimit := sdkmath.LegacyNewDecFromBigInt(new(big.Int).SetUint64(gas))

for _, gp := range minGasPrices {
fee := gp.Amount.Mul(gasLimit).Ceil().RoundInt()
Expand Down Expand Up @@ -196,10 +197,10 @@ func (empd EthMinGasPriceDecorator) AnteHandle(
feeAmt = ethMsg.GetEffectiveFee(baseFee)
}

gasLimit := sdk.NewDecFromBigInt(new(big.Int).SetUint64(ethMsg.GetGas()))
gasLimit := sdkmath.LegacyNewDecFromBigInt(new(big.Int).SetUint64(ethMsg.GetGas()))

requiredFee := minGasPrice.Mul(gasLimit)
fee := sdk.NewDecFromBigInt(feeAmt)
fee := sdkmath.LegacyNewDecFromBigInt(feeAmt)

if fee.LT(requiredFee) {
return ctx, errorsmod.Wrapf(
Expand Down Expand Up @@ -250,8 +251,8 @@ func (mfd EthMempoolFeeDecorator) AnteHandle(
)
}

fee := sdk.NewDecFromBigInt(ethMsg.GetFee())
gasLimit := sdk.NewDecFromBigInt(new(big.Int).SetUint64(ethMsg.GetGas()))
fee := sdkmath.LegacyNewDecFromBigInt(ethMsg.GetFee())
gasLimit := sdkmath.LegacyNewDecFromBigInt(new(big.Int).SetUint64(ethMsg.GetGas()))
requiredFee := minGasPrice.Mul(gasLimit)

if fee.LT(requiredFee) {
Expand Down
16 changes: 7 additions & 9 deletions app/ante/handler_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ import (
"fmt"

cosmoserrors "cosmossdk.io/errors"
storetypes "cosmossdk.io/store/types"
txsigning "cosmossdk.io/x/tx/signing"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
ethante "github.com/zeta-chain/ethermint/app/ante"
ethermint "github.com/zeta-chain/ethermint/types"
evmtypes "github.com/zeta-chain/ethermint/x/evm/types"
Expand All @@ -43,8 +43,8 @@ type HandlerOptions struct {
FeeMarketKeeper FeeMarketKeeper
EvmKeeper EVMKeeper
FeegrantKeeper ante.FeegrantKeeper
SignModeHandler authsigning.SignModeHandler
SigGasConsumer func(meter sdk.GasMeter, sig signing.SignatureV2, params authtypes.Params) error
SignModeHandler *txsigning.HandlerMap
SigGasConsumer func(meter storetypes.GasMeter, sig signing.SignatureV2, params authtypes.Params) error
MaxTxGasWanted uint64
ExtensionOptionChecker ante.ExtensionOptionChecker
TxFeeChecker ante.TxFeeChecker
Expand Down Expand Up @@ -165,8 +165,6 @@ func newCosmosAnteHandlerForSystemTx(options HandlerOptions) sdk.AnteHandler {
)
}

var _ GasTx = (*legacytx.StdTx)(nil) // assert StdTx implements GasTx

// GasTx defines a Tx with a GetGas() method which is needed to use SetUpContextDecorator
type GasTx interface {
sdk.Tx
Expand Down Expand Up @@ -209,7 +207,7 @@ func (sud SetUpContextDecorator) AnteHandle(
defer func() {
if r := recover(); r != nil {
switch rType := r.(type) {
case sdk.ErrorOutOfGas:
case storetypes.ErrorOutOfGas:
log := fmt.Sprintf(
"out of gas in location: %v; gasWanted: %d, gasUsed: %d",
rType.Descriptor, gasTx.GetGas(), newCtx.GasMeter().GasConsumed())
Expand Down
Loading

0 comments on commit 89cc1fc

Please sign in to comment.