Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNM: tia #375

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
if: env.GIT_DIFF
uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: '1.21.1'
cache: true
env:
GOOS: ${{ matrix.targetos }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code-ql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: '1.21.1'
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: '1.21.1'
cache: true

- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: '1.21.1'
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.53
version: latest
args: --timeout 5m

super-linter:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: '1.21.1'
cache: true

- name: Set Env
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/simulations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: '1.21.1'

- name: Install runsim
run: export GO111MODULE="on" && go install github.com/cosmos/tools/cmd/[email protected]
Expand All @@ -38,7 +38,7 @@ jobs:
- uses: actions/setup-go@v5
if: env.GIT_DIFF
with:
go-version: '1.20'
go-version: '1.21.1'
cache: true
- name: Test application non-determinism
if: env.GIT_DIFF
Expand All @@ -60,7 +60,7 @@ jobs:
- uses: actions/setup-go@v5
if: env.GIT_DIFF
with:
go-version: '1.20'
go-version: '1.21.1'
cache: true
- uses: actions/cache@v4
if: env.GIT_DIFF
Expand All @@ -87,7 +87,7 @@ jobs:
- uses: actions/setup-go@v5
if: env.GIT_DIFF
with:
go-version: '1.20'
go-version: '1.21.1'
cache: true
- uses: actions/cache@v4
if: env.GIT_DIFF
Expand All @@ -113,7 +113,7 @@ jobs:
- uses: actions/setup-go@v5
if: env.GIT_DIFF
with:
go-version: '1.20'
go-version: '1.21.1'
cache: true
- uses: actions/cache@v4
if: env.GIT_DIFF
Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: '1.21.1'
- name: Display Go Version
run: go version
- uses: actions/cache@v4
Expand All @@ -38,7 +38,7 @@ jobs:
- uses: actions/setup-go@v5
if: env.GIT_DIFF
with:
go-version: '1.20'
go-version: '1.21.1'
cache: true
- name: Test and Create Coverage Report
if: env.GIT_DIFF
Expand Down Expand Up @@ -74,16 +74,24 @@ jobs:
name: ojod-linux-amd64
path: ./build

- name: Start single node chain
- name: Start celestia devnet
if: env.GIT_DIFF
run: |
chmod +x ./build/ojod
./scripts/single-node.sh
chmod +x ./scripts/celestia_devnet.sh
./scripts/celestia_devnet.sh &
- name: Start ojod rollup
if: env.GIT_DIFF
run: |
sleep 30s
chmod +x ./build/ojod
chmod +x ./scripts/init-local.sh
./scripts/init-local.sh &
- name: Test Local Network Liveness
if: env.GIT_DIFF
run: |
sleep 1m
./scripts/localnet-liveness.sh 50 5 50 localhost:26657
./scripts/localnet-liveness.sh 50 5 50 localhost:36657

test-e2e:
runs-on: ubuntu-latest
Expand All @@ -100,7 +108,7 @@ jobs:
- uses: actions/setup-go@v5
if: env.GIT_DIFF
with:
go-version: '1.20'
go-version: '1.21.1'
cache: true

- name: Test E2E
Expand Down
6 changes: 6 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ issues:
- linters:
- lll
source: "https://"
- text: "SA1019: codec.NewAminoCodec is deprecated" # TODO remove once migration path is set out
linters:
- staticcheck
- text: "SA1019: \"github.com/cosmos/ibc-go/v8/modules/core/02-client/types\" is deprecated"
linters:
- staticcheck
max-same-issues: 50

linters-settings:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Builder
FROM golang:1.20-alpine AS builder
FROM golang:1.21.1-alpine AS builder

RUN apk add --no-cache \
ca-certificates \
Expand Down
10 changes: 5 additions & 5 deletions ante/ante.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package ante

import (
storetypes "github.com/cosmos/cosmos-sdk/store/types"
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"
cosmosante "github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/cosmos/cosmos-sdk/x/auth/signing"
"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"
)

type HandlerOptions struct {
Expand All @@ -17,7 +17,7 @@ type HandlerOptions struct {
FeegrantKeeper cosmosante.FeegrantKeeper
OracleKeeper OracleKeeper
IBCKeeper *ibckeeper.Keeper
SignModeHandler signing.SignModeHandler
SignModeHandler *txsigning.HandlerMap
SigGasConsumer cosmosante.SignatureVerificationGasConsumer
TXCounterStoreKey storetypes.StoreKey
}
Expand Down
29 changes: 21 additions & 8 deletions ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"testing"

tmrand "github.com/cometbft/cometbft/libs/rand"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
cmtrand "github.com/cometbft/cometbft/libs/rand"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/tx"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
Expand All @@ -29,15 +29,20 @@ type IntegrationTestSuite struct {

func (s *IntegrationTestSuite) SetupTest() {
app := ojoapp.Setup(s.T())
ctx := app.BaseApp.NewContext(false, tmproto.Header{
ChainID: fmt.Sprintf("test-chain-%s", tmrand.Str(4)),
ctx := app.BaseApp.NewContextLegacy(false, cmtproto.Header{
ChainID: fmt.Sprintf("test-chain-%s", cmtrand.Str(4)),
Height: 1,
})

s.app = app
s.ctx = ctx

encodingConfig := testutil.MakeTestEncodingConfig()
encodingConfig := testutil.TestEncodingConfig{
InterfaceRegistry: app.InterfaceRegistry(),
Codec: app.AppCodec(),
TxConfig: app.GetTxConfig(),
Amino: app.LegacyAmino(),
}
encodingConfig.Amino.RegisterConcrete(&testdata.TestMsg{}, "testdata.TestMsg", nil)
testdata.RegisterInterfaces(encodingConfig.InterfaceRegistry)
s.clientCtx = client.Context{}.
Expand All @@ -51,7 +56,7 @@ func (suite *IntegrationTestSuite) CreateTestTx(privs []cryptotypes.PrivKey, acc
sigV2 := signing.SignatureV2{
PubKey: priv.PubKey(),
Data: &signing.SingleSignatureData{
SignMode: suite.clientCtx.TxConfig.SignModeHandler().DefaultMode(),
SignMode: signing.SignMode(*suite.clientCtx.TxConfig.SignModeHandler().DefaultMode().Enum()),
Signature: nil,
},
Sequence: accSeqs[i],
Expand All @@ -67,13 +72,21 @@ func (suite *IntegrationTestSuite) CreateTestTx(privs []cryptotypes.PrivKey, acc
sigsV2 = []signing.SignatureV2{}
for i, priv := range privs {
signerData := xauthsigning.SignerData{
Address: sdk.AccAddress(priv.PubKey().Bytes()).String(),
ChainID: chainID,
AccountNumber: accNums[i],
Sequence: accSeqs[i],
PubKey: priv.PubKey(),
}
sigV2, err := tx.SignWithPrivKey(
suite.clientCtx.TxConfig.SignModeHandler().DefaultMode(), signerData,
suite.txBuilder, priv, suite.clientCtx.TxConfig, accSeqs[i])
suite.ctx,
signing.SignMode(*suite.clientCtx.TxConfig.SignModeHandler().DefaultMode().Enum()),
signerData,
suite.txBuilder,
priv,
suite.clientCtx.TxConfig,
accSeqs[i],
)
if err != nil {
return nil, err
}
Expand Down
5 changes: 3 additions & 2 deletions ante/fee.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package ante

import (
"cosmossdk.io/math"
evidencetypes "cosmossdk.io/x/evidence/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"

appparams "github.com/ojo-network/ojo/app/params"
oracletypes "github.com/ojo-network/ojo/x/oracle/types"
Expand Down Expand Up @@ -56,7 +57,7 @@ func checkFees(minGasPrices sdk.DecCoins, fees sdk.Coins, gasLimit uint64) error
// Determine the required fees by multiplying each required minimum gas
// price by the gas limit, where fee = ceil(minGasPrice * gasLimit).
// Zero fees are removed.
glDec := sdk.NewDec(int64(gasLimit))
glDec := math.LegacyNewDec(int64(gasLimit))
for _, gp := range minGasPrices {
if gasLimit == 0 || gp.IsZero() {
continue
Expand Down
5 changes: 3 additions & 2 deletions ante/fee_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ante_test

import (
"cosmossdk.io/math"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -29,7 +30,7 @@ func (suite *IntegrationTestSuite) TestFeeAndPriority() {
if denom == "" {
denom = minGas.Denom
}
f := sdk.MustNewDecFromStr(factor)
f := math.LegacyMustNewDecFromStr(factor)
return sdk.DecCoins{sdk.NewDecCoinFromDec(denom, minGas.Amount.Mul(f))}
}
mkTx := func(fee sdk.Coins) signing.Tx {
Expand Down Expand Up @@ -103,6 +104,6 @@ func (suite *IntegrationTestSuite) checkFeeAnte(tx sdk.Tx, feeExpected sdk.Coins
if len(feeExpected) == 0 {
require.True(fee.IsZero(), "fee should be zero, got: %s", fee)
} else {
require.True(fee.IsEqual(feeExpected), "Fee expected %s, got: %s", feeExpected, fee)
require.True(fee.Equal(feeExpected), "Fee expected %s, got: %s", feeExpected, fee)
}
}
2 changes: 1 addition & 1 deletion ante/fee_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package ante
import (
"testing"

evidence "cosmossdk.io/x/evidence/types"
sdk "github.com/cosmos/cosmos-sdk/types"
evidence "github.com/cosmos/cosmos-sdk/x/evidence/types"
"github.com/stretchr/testify/assert"
)

Expand Down
3 changes: 2 additions & 1 deletion ante/spam_prevention_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ante_test

import (
"cosmossdk.io/errors"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -70,5 +71,5 @@ func (ok dummyOracleKeeper) ValidateFeeder(ctx sdk.Context, feederAddr sdk.AccAd
return nil
}

return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "feeder is not authorized")
return errors.Wrap(sdkerrors.ErrUnauthorized, "feeder is not authorized")
}
Loading
Loading