Skip to content

Commit

Permalink
Feat/pre v50 cleanup (#712)
Browse files Browse the repository at this point in the history
## 1. Overview

This PR aims to cleanup code for v50 upgrade.

## 2. Implementation details

Cleanup of code contains the following changes : 
1. Complete removal of qoracle, qtransfer and qvesting modules.
2. Removal of 3rd party proto directory.
3. Testutil cleanup.
4. Wasmbinding cleanup.
5. Lint checks.
6. Renaming quasarnoded to quasard.


## 3. How to test/use

Lint test can be done by running `make lint-all` 
Tests can be run by `make test-all`

## 4. Future Work (optional)

@ajansari95 needs to do the api changes in the later PRs

---------

Co-authored-by: ajansari95 <[email protected]>
  • Loading branch information
arhamchordia and ajansari95 authored Jul 29, 2024
1 parent 657c7d6 commit 40cd118
Show file tree
Hide file tree
Showing 338 changed files with 916 additions and 26,634 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ v Please also ensure that this is not a duplicate issue :)

## Version

<!-- git commit hash, output of `quasarnoded version` -->
<!-- git commit hash, output of `quasard version` -->

## Steps to Reproduce

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build_go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ jobs:
- name: Display go version
if: env.GIT_DIFF
run: go version
- name: Build quasarnoded
- name: Build quasard
if: env.GIT_DIFF
run: make build-reproducible-${{ matrix.arch }}
- uses: actions/upload-artifact@v3
if: env.GIT_DIFF
with:
name: quasarnoded-${{ matrix.targetos }}-${{ matrix.arch }}
path: build/quasarnoded-${{ matrix.targetos }}-${{ matrix.arch }}
name: quasard-${{ matrix.targetos }}-${{ matrix.arch }}
path: build/quasard-${{ matrix.targetos }}-${{ matrix.arch }}
18 changes: 9 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ RUN ARCH=$(uname -m) && WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm |
# Copy the remaining files
COPY . .

# Build quasarnoded binary
# Build quasard binary
# force it to use static lib (from above) not standard libgo_cosmwasm.so file
# then log output of file /quasar/build/quasarnoded
# then log output of file /quasar/build/quasard
# then ensure static linking
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/go/pkg/mod \
Expand All @@ -46,14 +46,14 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
-tags "netgo,ledger,muslc" \
-ldflags \
"-X github.com/cosmos/cosmos-sdk/version.Name="quasar" \
-X github.com/cosmos/cosmos-sdk/version.AppName="quasarnoded" \
-X github.com/cosmos/cosmos-sdk/version.AppName="quasard" \
-X github.com/cosmos/cosmos-sdk/version.Version=${GIT_VERSION} \
-X github.com/cosmos/cosmos-sdk/version.Commit=${GIT_COMMIT} \
-X github.com/cosmos/cosmos-sdk/version.BuildTags='netgo,ledger,muslc' \
-w -s -linkmode=external -extldflags '-Wl,-z,muldefs -static'" \
-trimpath \
-o build/quasarnoded \
/quasar/cmd/quasarnoded/main.go
-o build/quasard \
/quasar/cmd/quasard/main.go


# --------------------------------------------------------
Expand All @@ -62,7 +62,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \

FROM ${RUNNER_IMAGE} as runner

COPY --from=builder /quasar/build/quasarnoded /bin/quasarnoded
COPY --from=builder /quasar/build/quasard /bin/quasard

ENV HOME /quasar
WORKDIR $HOME
Expand All @@ -71,7 +71,7 @@ EXPOSE 26656
EXPOSE 26657
EXPOSE 1317

CMD ["quasarnoded"]
CMD ["quasard"]

# --------------------------------------------------------
# Development
Expand All @@ -86,7 +86,7 @@ RUN --mount=type=cache,target=/var/cache/apt \
apt-get update && apt-get install -y $PACKAGES


COPY --from=builder /quasar/build/quasarnoded /bin/quasarnoded
COPY --from=builder /quasar/build/quasard /bin/quasard


ENV HOME /quasar
Expand All @@ -100,5 +100,5 @@ EXPOSE 26656
EXPOSE 26657
EXPOSE 1317

CMD ["quasarnoded"]
CMD ["quasard"]
ENTRYPOINT ["./entrypoint.sh"]
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ help:
@echo "Usage:"
@echo " make [command]"
@echo ""
@echo " make build Build quasarnoded binary"
@echo " make build Build quasard binary"
@echo " make build-help Show available build commands"
@echo " make docker Show available docker commands"
@echo " make e2e Show available e2e commands"
@echo " make install Install quasarnoded binary"
@echo " make install Install quasard binary"
@echo " make lint Show available lint commands"
@echo " make test Show available test commands"
@echo ""
Expand Down Expand Up @@ -86,7 +86,7 @@ build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags))
# process linker flags

ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=quasar \
-X github.com/cosmos/cosmos-sdk/version.AppName=quasarnoded \
-X github.com/cosmos/cosmos-sdk/version.AppName=quasard \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)"
Expand Down Expand Up @@ -134,7 +134,7 @@ build: build-check-version go.sum
@go mod tidy

mkdir -p $(BUILDDIR)/
GOWORK=off go build -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR)/ $(GO_MODULE)/cmd/quasarnoded
GOWORK=off go build -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR)/ $(GO_MODULE)/cmd/quasard

# clean up before install
@mv go.mod.backup go.mod
Expand All @@ -148,7 +148,7 @@ install: build-check-version go.sum
@cp go.sum go.sum.backup
@go mod tidy

GOWORK=off go install -mod=readonly $(BUILD_FLAGS) $(GO_MODULE)/cmd/quasarnoded
GOWORK=off go install -mod=readonly $(BUILD_FLAGS) $(GO_MODULE)/cmd/quasard

# clean up before install
@mv go.mod.backup go.mod
Expand Down
49 changes: 5 additions & 44 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,23 @@ import (
"github.com/cosmos/cosmos-sdk/x/crisis"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
ibcwasmkeeper "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/keeper"
ibcwasmtypes "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
ibctestingtypes "github.com/cosmos/ibc-go/v7/testing/types"
"github.com/spf13/cast"

// Quasar imports
quasarante "github.com/quasarlabs/quasarnode/ante"
"github.com/quasarlabs/quasarnode/app/keepers"
"github.com/quasarlabs/quasarnode/app/openapiconsole"
appParams "github.com/quasarlabs/quasarnode/app/params"
"github.com/quasarlabs/quasarnode/app/upgrades"
v0 "github.com/quasarlabs/quasarnode/app/upgrades/v0"
v2 "github.com/quasarlabs/quasarnode/app/upgrades/v2"
"github.com/quasarlabs/quasarnode/docs"
"github.com/spf13/cast"
)

const (
AccountAddressPrefix = "quasar"
Name = "quasarnode"
Name = "quasar"
DirName = "quasarnode"
)

var (
Expand All @@ -75,8 +71,6 @@ var (

// module account permissions
maccPerms = ModuleAccountPermissions

Upgrades = []upgrades.Upgrade{v0.Upgrade, v2.Upgrade}
)

// overrideWasmVariables overrides the wasm variables to:
Expand All @@ -97,7 +91,7 @@ func init() {
panic(err)
}

DefaultNodeHome = filepath.Join(userHomeDir, "."+Name)
DefaultNodeHome = filepath.Join(userHomeDir, "."+DirName)
}

// QuasarApp extends an ABCI application, but with most of its parameters exported.
Expand Down Expand Up @@ -290,7 +284,7 @@ func New(
app.SetEndBlocker(app.EndBlocker)

app.setupUpgradeHandlers()
app.setupUpgradeStoreLoaders()
app.setUpgradeStoreLoaders()

// Register snapshot extensions to enable state-sync for wasm.
if manager := app.SnapshotManager(); manager != nil {
Expand Down Expand Up @@ -329,39 +323,6 @@ func New(
return app
}

func (app *QuasarApp) setupUpgradeStoreLoaders() {
upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(fmt.Sprintf("failed to read upgrade info from disk %s", err))
}

if app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
return
}

for _, upgrade := range Upgrades {
upgrade := upgrade
if upgradeInfo.Name == upgrade.UpgradeName {
storeUpgrades := upgrade.StoreUpgrades
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}
}
}

func (app *QuasarApp) setupUpgradeHandlers() {
for _, upgrade := range Upgrades {
app.UpgradeKeeper.SetUpgradeHandler(
upgrade.UpgradeName,
upgrade.CreateUpgradeHandler(
app.mm,
app.configurator,
app.BaseApp,
app.AppKeepers,
),
)
}
}

// Name returns the name of the QuasarApp
func (app *QuasarApp) Name() string { return app.BaseApp.Name() }

Expand Down
Loading

0 comments on commit 40cd118

Please sign in to comment.