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

Upgrade to Cosmos SDK 0.47 #560

Merged
merged 28 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
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/automated-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: setup-go
uses: actions/setup-go@v2
with:
go-version: 1.19
go-version: 1.22
# Setup Rust Environment
- name: setup-rust
uses: actions-rs/toolchain@v1
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.19
go-version: 1.22
- name: Checkout Branch
uses: actions/checkout@v2
- name: Create Go cache
Expand All @@ -28,8 +28,8 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('module/go.sum') }}
- name: Run Go tests
run: cd module && make test-cov
- uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./module/coverage.txt
fail_ci_if_error: true
# - uses: codecov/codecov-action@v2
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# file: ./module/coverage.txt
# fail_ci_if_error: true
8 changes: 4 additions & 4 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ jobs:
packages: write
runs-on: ubuntu-20.04
steps:
- name: Set up Go 1.19
- name: Set up Go 1.22
uses: actions/setup-go@v2
with:
go-version: 1.19
go-version: 1.22
- name: checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
Expand Down Expand Up @@ -234,10 +234,10 @@ jobs:
]

steps:
- name: Set up Go 1.19
- name: Set up Go 1.22
uses: actions/setup-go@v2
with:
go-version: 1.19
go-version: 1.22
- name: checkout
uses: actions/checkout@v2
- name: go-cache
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ fail:
@false

e2e_happy_path: e2e_clean_slate
integration_tests/integration-tests.test -test.failfast -test.v -test.run IntegrationTestSuite -testify.m TestHappyPath || make -s fail
E2E_SKIP_CLEANUP=true integration_tests/integration_tests.test -test.failfast -test.v -test.run IntegrationTestSuite -testify.m TestHappyPath || make -s fail

e2e_valset_update: e2e_clean_slate
integration_tests/integration-tests.test -test.failfast -test.v -test.run IntegrationTestSuite -testify.m TestValsetUpdate || make -s fail
integration_tests/integration_tests.test -test.failfast -test.v -test.run IntegrationTestSuite -testify.m TestValsetUpdate || make -s fail


e2e_validator_out: e2e_clean_slate
integration_tests/integration-tests.test -test.failfast -test.v -test.run IntegrationTestSuite -testify.m TestValidatorOut || make -s fail
integration_tests/integration_tests.test -test.failfast -test.v -test.run IntegrationTestSuite -testify.m TestValidatorOut || make -s fail
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate target e2e_validator_out found. This could lead to confusion or errors in the build process. Consider removing or renaming one of the duplicates.


e2e_transaction_stress: e2e_clean_slate
integration_tests/integration-tests.test -test.failfast -test.v -test.run IntegrationTestSuite -testify.m TestTransactionStress || make -s fail
integration_tests/integration_tests.test -test.failfast -test.v -test.run IntegrationTestSuite -testify.m TestTransactionStress || make -s fail

6 changes: 6 additions & 0 deletions go.work
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
go 1.22.1

use (
./integration_tests
./module
)
1,089 changes: 1,089 additions & 0 deletions go.work.sum

Large diffs are not rendered by default.

76 changes: 53 additions & 23 deletions integration_tests/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,45 @@ import (
"fmt"
"os"

tmrand "github.com/cometbft/cometbft/libs/rand"
rpchttp "github.com/cometbft/cometbft/rpc/client/http"
"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"
sdkTypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
sdkTx "github.com/cosmos/cosmos-sdk/x/auth/tx"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
"github.com/cosmos/cosmos-sdk/x/bank"
"github.com/cosmos/cosmos-sdk/x/capability"
"github.com/cosmos/cosmos-sdk/x/consensus"
"github.com/cosmos/cosmos-sdk/x/crisis"
"github.com/cosmos/cosmos-sdk/x/distribution"
"github.com/cosmos/cosmos-sdk/x/evidence"
"github.com/cosmos/cosmos-sdk/x/genutil"
"github.com/cosmos/cosmos-sdk/x/gov"
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
"github.com/cosmos/cosmos-sdk/x/mint"
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
"github.com/cosmos/cosmos-sdk/x/slashing"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
ibctransfer "github.com/cosmos/ibc-go/v7/modules/apps/transfer"
ibc "github.com/cosmos/ibc-go/v7/modules/core"
"github.com/peggyjv/gravity-bridge/module/v4/app"
"github.com/peggyjv/gravity-bridge/module/v4/app/params"
gravityclient "github.com/peggyjv/gravity-bridge/module/v4/x/gravity/client"
gravitytypes "github.com/peggyjv/gravity-bridge/module/v4/x/gravity/types"
tmrand "github.com/tendermint/tendermint/libs/rand"
rpchttp "github.com/tendermint/tendermint/rpc/client/http"
)

const (
Expand Down Expand Up @@ -191,25 +209,37 @@ func (c *chain) createOrchestrator(index int) *orchestrator {
}

func (c *chain) clientContext(nodeURI string, kb *keyring.Keyring, fromName string, fromAddr sdk.AccAddress) (*client.Context, error) {
amino := codec.NewLegacyAmino()
interfaceRegistry := sdkTypes.NewInterfaceRegistry()
interfaceRegistry.RegisterImplementations((*sdk.Msg)(nil),
encodingConfig := moduletestutil.MakeTestEncodingConfig(
auth.AppModuleBasic{},
genutil.AppModuleBasic{},
bank.AppModuleBasic{},
capability.AppModuleBasic{},
consensus.AppModuleBasic{},
staking.AppModuleBasic{},
mint.AppModuleBasic{},
distribution.AppModuleBasic{},
gov.NewAppModuleBasic(
[]govclient.ProposalHandler{
paramsclient.ProposalHandler,
upgradeclient.LegacyProposalHandler,
upgradeclient.LegacyCancelProposalHandler,
gravityclient.ProposalHandler,
},
),
//params.AppModuleBasic{},
crisis.AppModuleBasic{},
slashing.AppModuleBasic{},
ibc.AppModuleBasic{},
upgrade.AppModuleBasic{},
evidence.AppModuleBasic{},
ibctransfer.AppModuleBasic{},
vesting.AppModuleBasic{},
)
encodingConfig.InterfaceRegistry.RegisterImplementations((*sdk.Msg)(nil),
&stakingtypes.MsgCreateValidator{},
&gravitytypes.MsgDelegateKeys{},
)
interfaceRegistry.RegisterImplementations((*cryptotypes.PubKey)(nil), &secp256k1.PubKey{}, &ed25519.PubKey{})

protoCodec := codec.NewProtoCodec(interfaceRegistry)
txCfg := sdkTx.NewTxConfig(protoCodec, sdkTx.DefaultSignModes)

encodingConfig := params.EncodingConfig{
InterfaceRegistry: interfaceRegistry,
Marshaler: protoCodec,
TxConfig: txCfg,
Amino: amino,
}
simapp.ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino)
simapp.ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry)
encodingConfig.InterfaceRegistry.RegisterImplementations((*cryptotypes.PubKey)(nil), &secp256k1.PubKey{}, &ed25519.PubKey{})

rpcClient, err := rpchttp.New(nodeURI, "/websocket")
if err != nil {
Expand All @@ -218,14 +248,14 @@ func (c *chain) clientContext(nodeURI string, kb *keyring.Keyring, fromName stri

clientContext := client.Context{}.
WithChainID(c.id).
WithCodec(protoCodec).
WithCodec(encodingConfig.Codec).
WithInterfaceRegistry(encodingConfig.InterfaceRegistry).
WithTxConfig(encodingConfig.TxConfig).
WithLegacyAmino(encodingConfig.Amino).
WithInput(os.Stdin).
WithNodeURI(nodeURI).
WithClient(rpcClient).
WithBroadcastMode(flags.BroadcastBlock).
WithBroadcastMode(flags.BroadcastSync).
WithKeyring(*kb).
WithAccountRetriever(authtypes.AccountRetriever{}).
WithOutputFormat("json").
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"fmt"
"os"

tmtypes "github.com/cometbft/cometbft/types"
"github.com/cosmos/cosmos-sdk/server"
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/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
tmtypes "github.com/tendermint/tendermint/types"
)

func getGenDoc(path string) (*tmtypes.GenesisDoc, error) {
Expand Down
Loading
Loading