Skip to content

Commit

Permalink
Merge branch 'feat/sdk-50' into feat/slinky-bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
quasisamurai committed May 17, 2024
2 parents 3d4ac05 + 65d3ebb commit 305573b
Show file tree
Hide file tree
Showing 25 changed files with 6,537 additions and 115 deletions.
4 changes: 2 additions & 2 deletions Dockerfile.builder
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
go mod download

# Cosmwasm - Download correct libwasmvm version
RUN WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | cut -d ' ' -f 2) && \
RUN WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm/v2 | cut -d ' ' -f 2) && \
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$(uname -m).a \
-O /lib/libwasmvm_muslc.$(uname -m).a && \
# verify checksum
Expand All @@ -42,7 +42,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/go/pkg/mod \
go build \
-mod=readonly \
-tags "netgo,ledger,muslc" \
-tags ${BUILD_TAGS} \
-ldflags "-X github.com/cosmos/cosmos-sdk/version.Name="neutron" \
-X github.com/cosmos/cosmos-sdk/version.AppName="neutrond" \
-X github.com/cosmos/cosmos-sdk/version.Version=${GIT_VERSION} \
Expand Down
20 changes: 18 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ endif
ifeq ($(WITH_CLEVELDB),yes)
build_tags += gcc
endif
build_tags += $(BUILD_TAGS)
build_tags += $(BUILD_TAGS),muslc
build_tags := $(strip $(build_tags))

build_tags_test_binary = $(build_tags)
Expand Down Expand Up @@ -112,7 +112,6 @@ build-static-linux-amd64: go.sum $(BUILDDIR)/
--build-arg GIT_VERSION=$(VERSION) \
--build-arg GIT_COMMIT=$(COMMIT) \
--build-arg BUILD_TAGS=$(build_tags_comma_sep) \
--platform linux/amd64 \
-t neutron-amd64 \
--load \
-f Dockerfile.builder .
Expand All @@ -121,6 +120,23 @@ build-static-linux-amd64: go.sum $(BUILDDIR)/
$(DOCKER) cp neutronbinary:/bin/neutrond $(BUILDDIR)/neutrond-linux-amd64
$(DOCKER) rm -f neutronbinary

build-slinky-e2e-docker-image: go.sum $(BUILDDIR)/
$(DOCKER) buildx create --name neutronbuilder || true
$(DOCKER) buildx use neutronbuilder
$(DOCKER) buildx build \
--build-arg GO_VERSION=$(GO_VERSION) \
--build-arg GIT_VERSION=$(VERSION) \
--build-arg GIT_COMMIT=$(COMMIT) \
--build-arg BUILD_TAGS=$(build_tags_comma_sep),skip_ccv_msg_filter \
--build-arg RUNNER_IMAGE="alpine:3.18" \
--platform linux/amd64 \
-t neutron-e2e \
--load \
-f Dockerfile.builder .

slinky-e2e-test: build-slinky-e2e-docker-image
cd ./tests/slinky && go mod tidy && go test -v -race -timeout 20m ./...

install-test-binary: check_version go.sum
go install -mod=readonly $(BUILD_FLAGS_TEST_BINARY) ./cmd/neutrond

Expand Down
42 changes: 35 additions & 7 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (

"cosmossdk.io/client/v2/autocli"
"cosmossdk.io/core/appmodule"
"github.com/cosmos/cosmos-sdk/runtime/services"
authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec"

appconfig "github.com/neutron-org/neutron/v4/app/config"
Expand Down Expand Up @@ -121,8 +120,8 @@ import (
icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types"
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v8/modules/core"
ibcclient "github.com/cosmos/ibc-go/v8/modules/core/02-client"
ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck

//nolint:staticcheck
ibcporttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v8/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
Expand Down Expand Up @@ -205,6 +204,9 @@ import (
marketmaptypes "github.com/skip-mev/slinky/x/marketmap/types"
oraclekeeper "github.com/skip-mev/slinky/x/oracle/keeper"
oracletypes "github.com/skip-mev/slinky/x/oracle/types"

"github.com/cosmos/cosmos-sdk/crypto/keyring"
runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services"
)

const (
Expand Down Expand Up @@ -392,6 +394,34 @@ type App struct {
checkTxHandler checktx.CheckTx
}

// AutoCLIOpts returns options based upon the modules in the neutron v4 app.
func (app *App) AutoCLIOpts(initClientCtx client.Context) autocli.AppOptions {
modules := make(map[string]appmodule.AppModule, 0)
for _, m := range app.mm.Modules {
if moduleWithName, ok := m.(module.HasName); ok {
moduleName := moduleWithName.Name()
if appModule, ok := moduleWithName.(appmodule.AppModule); ok {
modules[moduleName] = appModule
}
}
}

cliKR, err := keyring.NewAutoCLIKeyring(initClientCtx.Keyring)
if err != nil {
panic(err)
}

return autocli.AppOptions{
Modules: modules,
ModuleOptions: runtimeservices.ExtractAutoCLIOptions(app.mm.Modules),
AddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()),
ValidatorAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()),
ConsensusAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()),
Keyring: cliKR,
ClientCtx: initClientCtx,
}
}

func (app *App) GetTestBankKeeper() integration.TestBankKeeper {
return app.BankKeeper
}
Expand Down Expand Up @@ -719,9 +749,7 @@ func New(
// register the proposal types
adminRouterLegacy := govv1beta1.NewRouter()
adminRouterLegacy.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler).
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).
// AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(&app.UpgradeKeeper)).
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)) //nolint:staticcheck
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)) //nolint:staticcheck

app.AdminmoduleKeeper = *adminmodulekeeper.NewKeeper(
appCodec,
Expand Down Expand Up @@ -1350,7 +1378,7 @@ func (app *App) AutoCliOpts() autocli.AppOptions {

return autocli.AppOptions{
Modules: modules,
ModuleOptions: services.ExtractAutoCLIOptions(app.mm.Modules),
ModuleOptions: runtimeservices.ExtractAutoCLIOptions(app.mm.Modules),
AddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()),
ValidatorAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()),
ConsensusAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()),
Expand Down
2 changes: 2 additions & 0 deletions app/proposals_allowlisting.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ func isSdkMessageWhitelisted(msg sdk.Msg) bool {
*wasmtypes.MsgUnpinCodes,
*upgradetypes.MsgSoftwareUpgrade,
*upgradetypes.MsgCancelUpgrade,
*ibcclienttypes.MsgRecoverClient,
*ibcclienttypes.MsgIBCSoftwareUpgrade,
*tokenfactorytypes.MsgUpdateParams,
*interchainqueriestypes.MsgUpdateParams,
*interchaintxstypes.MsgUpdateParams,
Expand Down
Loading

0 comments on commit 305573b

Please sign in to comment.