Skip to content

Commit

Permalink
chore: clean-up main (#22787)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt authored Dec 6, 2024
1 parent 467dc24 commit dda47b5
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 1,083 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ jobs:
###################
- name: Build
run: GOARCH=${{ matrix.go-arch }} make build
- name: Build Legacy
run: GOARCH=${{ matrix.go-arch }} COSMOS_BUILD_OPTIONS=legacy make build
- name: Build v2
run: GOARCH=${{ matrix.go-arch }} COSMOS_BUILD_OPTIONS=v2 make build
- name: Build with rocksdb backend
if: matrix.go-arch == 'amd64'
run: GOARCH=${{ matrix.go-arch }} COSMOS_BUILD_OPTIONS="rocksdb" make build
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -526,11 +526,6 @@ jobs:
run: |
cd simapp
go test -mod=readonly -timeout 30m -tags='norace ledger test_ledger_mock' ./...
- name: tests simapp v1
if: env.GIT_DIFF
run: |
cd simapp
go test -mod=readonly -timeout 30m -tags='app_v1 norace ledger test_ledger_mock' ./...
test-simapp-v2:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion math/dec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ func TestToSdkInt(t *testing.T) {
{src: "1E100000", expErr: true},
}
for _, tc := range tcs {
t.Run(fmt.Sprintf(tc.src), func(t *testing.T) {
t.Run(fmt.Sprint(tc.src), func(t *testing.T) {
a, err := NewDecFromString(tc.src)
require.NoError(t, err)
b, gotErr := a.SdkIntTrim()
Expand Down
2 changes: 1 addition & 1 deletion schema/indexer/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func StartIndexing(opts IndexingOptions) (IndexingTarget, error) {

targetCfg.Config, err = unmarshalIndexerCustomConfig(targetCfg.Config, init.ConfigType)
if err != nil {
return IndexingTarget{}, fmt.Errorf("failed to unmarshal indexer config for target %q: %v", targetName, err)
return IndexingTarget{}, fmt.Errorf("failed to unmarshal indexer config for target %q: %v", targetName, err) //nolint:errorlint // we support go 1.12, so no error wrapping
}

initRes, err := init.InitFunc(InitParams{
Expand Down
4 changes: 0 additions & 4 deletions scripts/build/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ ifeq (secp,$(findstring secp,$(COSMOS_BUILD_OPTIONS)))
build_tags += libsecp256k1_sdk
endif

ifeq (legacy,$(findstring legacy,$(COSMOS_BUILD_OPTIONS)))
build_tags += app_v1
endif

ifeq (v2,$(findstring v2,$(COSMOS_BUILD_OPTIONS)))
SIMAPP = simapp/v2
APPNAME = simdv2
Expand Down
5 changes: 0 additions & 5 deletions scripts/go-lint-all.bash
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ lint_module() {
fi
echo "linting $(grep "^module" go.mod) [$(date -Iseconds -u)]"
golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --build-tags=${LINT_TAGS}

# always lint simapp with app_v1 build tag, otherwise it never gets linted
if [[ "$(grep "^module" go.mod)" == "module cosmossdk.io/simapp" ]]; then
golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --build-tags=app_v1
fi
}
export -f lint_module

Expand Down
21 changes: 10 additions & 11 deletions server/v2/cometbft/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
abci "github.com/cometbft/cometbft/abci/types"
abciproto "github.com/cometbft/cometbft/api/cometbft/abci/v1"
v1 "github.com/cometbft/cometbft/api/cometbft/types/v1"
"github.com/cosmos/gogoproto/proto"
gogoproto "github.com/cosmos/gogoproto/proto"
gogotypes "github.com/cosmos/gogoproto/types"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -65,19 +64,19 @@ var (

func getQueryRouterBuilder[T any, PT interface {
*T
proto.Message
gogoproto.Message
},
U any, UT interface {
*U
proto.Message
gogoproto.Message
}](
t *testing.T,
handler func(ctx context.Context, msg PT) (UT, error),
) *stf.MsgRouterBuilder {
t.Helper()
queryRouterBuilder := stf.NewMsgRouterBuilder()
err := queryRouterBuilder.RegisterHandler(
proto.MessageName(PT(new(T))),
gogoproto.MessageName(PT(new(T))),
func(ctx context.Context, msg transaction.Msg) (msgResp transaction.Msg, err error) {
typedReq := msg.(PT)
typedResp, err := handler(ctx, typedReq)
Expand Down Expand Up @@ -107,7 +106,7 @@ func getMsgRouterBuilder[T any, PT interface {
t.Helper()
msgRouterBuilder := stf.NewMsgRouterBuilder()
err := msgRouterBuilder.RegisterHandler(
proto.MessageName(PT(new(T))),
gogoproto.MessageName(PT(new(T))),
func(ctx context.Context, msg transaction.Msg) (msgResp transaction.Msg, err error) {
typedReq := msg.(PT)
typedResp, err := handler(ctx, typedReq)
Expand Down Expand Up @@ -821,18 +820,18 @@ func setUpConsensus(t *testing.T, gasLimit uint64, mempool mempool.Mempool[mock.
return typedResp, nil
}

queryRouterBuilder.RegisterHandler(
proto.MessageName(&testdata.SayHelloRequest{}),
_ = queryRouterBuilder.RegisterHandler(
gogoproto.MessageName(&testdata.SayHelloRequest{}),
helloFooHandler,
)

queryHandler[proto.MessageName(&testdata.SayHelloRequest{})] = appmodulev2.Handler{
queryHandler[gogoproto.MessageName(&testdata.SayHelloRequest{})] = appmodulev2.Handler{
Func: helloFooHandler,
MakeMsg: func() transaction.Msg {
return reflect.New(gogoproto.MessageType(proto.MessageName(&testdata.SayHelloRequest{})).Elem()).Interface().(transaction.Msg)
return reflect.New(gogoproto.MessageType(gogoproto.MessageName(&testdata.SayHelloRequest{})).Elem()).Interface().(transaction.Msg)
},
MakeMsgResp: func() transaction.Msg {
return reflect.New(gogoproto.MessageType(proto.MessageName(&testdata.SayHelloResponse{})).Elem()).Interface().(transaction.Msg)
return reflect.New(gogoproto.MessageType(gogoproto.MessageName(&testdata.SayHelloResponse{})).Elem()).Interface().(transaction.Msg)
},
}

Expand Down Expand Up @@ -895,7 +894,7 @@ func setUpConsensus(t *testing.T, gasLimit uint64, mempool mempool.Mempool[mock.
cfg: Config{AppTomlConfig: DefaultAppTomlConfig()},
txCodec: mock.TxCodec{},
chainID: "test",
getProtoRegistry: sync.OnceValues(proto.MergedRegistry),
getProtoRegistry: sync.OnceValues(gogoproto.MergedRegistry),
queryHandlersMap: queryHandler,
addrPeerFilter: addrPeerFilter,
idPeerFilter: idPeerFilter,
Expand Down
2 changes: 1 addition & 1 deletion simapp/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Always refer to the [UPGRADING.md](https://github.com/cosmos/cosmos-sdk/blob/mai
* [#19726](https://github.com/cosmos/cosmos-sdk/pull/19726) Update APIs to match CometBFT v1.
* [#21466](https://github.com/cosmos/cosmos-sdk/pull/21466) Allow chains to plug in their own public key types in `base.Account`
* [#21508](https://github.com/cosmos/cosmos-sdk/pull/21508) Abstract the way we update the version of the app state in `app.go` using the interface `VersionModifier`.

<!-- TODO: move changelog.md elements to here -->

## v0.47 to v0.50
Expand Down
Loading

0 comments on commit dda47b5

Please sign in to comment.