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

feat: upgrade pfm v7.1.2 #408

Closed
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ bin/*
vendor

# Go workspaces - don't commit go.work.sum but do commit go.work
go.work.sum
go.work.sum
coverage.txt
52 changes: 48 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=centauri \
-X github.com/cosmos/cosmos-sdk/version.AppName=centaurid \
-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)"
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)"

ifeq (cleveldb,$(findstring cleveldb,$(COSMOS_BUILD_OPTIONS)))
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=cleveldb
Expand Down Expand Up @@ -109,12 +109,14 @@ protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
containerProtoGen=proto-gen-$(protoVer)
containerProtoFmt=proto-fmt-$(protoVer)

# SDK
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)

proto-all: proto-format proto-gen

proto-gen:
@echo "Generating Protobuf files"
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGen}$$"; then docker start -a $(containerProtoGen); else docker run --name $(containerProtoGen) -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) \
sh ./scripts/protocgen.sh; fi
@$(protoImage) sh ./scripts/protocgen.sh

proto-format:
@echo "Formatting Protobuf files"
Expand All @@ -127,7 +129,49 @@ proto-lint:
proto-check-breaking:
@$(DOCKER_BUF) breaking --against $(HTTPS_GIT)#branch=main

.PHONY: proto-all proto-gen proto-format proto-lint proto-check-breaking
.PHONY: proto-all proto-gen proto-format proto-lint proto-check-breaking


###############################################################################
### Tests ###
###############################################################################

test-unit:
PACKAGES_UNIT=$(shell go list ./... )
TEST_PACKAGES=$(PACKAGES_UNIT)
TEST_TARGETS := test-unit test-unit-cover test-race
TEST_COVERAGE_PROFILE=coverage.txt
TMP_COVERAGE=$(TEST_COVERAGE_PROFILE).tmp
BASE_FLAGS=-mod=readonly -timeout=5m

test-unit: ARGS=-tags=norace
test-unit-cover: ARGS=-tags='norace' -coverprofile=$(TEST_COVERAGE_PROFILE) -covermode=atomic
test-race: ARGS=-race
$(TEST_TARGETS): run-tests

run-tests:
@echo "--> Running tests $(BASE_FLAGS) $(ARGS)"
ifneq (,$(shell which tparse 2>/dev/null))
@go test $(BASE_FLAGS) -json $(ARGS) $(TEST_PACKAGES) | tparse
else
@go test $(BASE_FLAGS) $(ARGS) $(TEST_PACKAGES)
endif

test-unit-cover:
@echo "--> Removing .pb from $(TEST_COVERAGE_PROFILE)"
ifneq ("$(wildcard $(TEST_COVERAGE_PROFILE))","") # checks of file exists
@grep -vE .pb $(TEST_COVERAGE_PROFILE) > $(TMP_COVERAGE)
@cp $(TMP_COVERAGE) $(TEST_COVERAGE_PROFILE)
@rm -f $(TMP_COVERAGE)
endif

cover-html: test-unit-cover
@echo "--> Opening in the browser"
@go tool cover -html=$(TEST_COVERAGE_PROFILE)

.PHONY: conver-html test-unit test-unit-cover $(TEST_TARGETS)

###############################################################################
### Interchain test ###
###############################################################################

Expand Down
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ func NewComposableApp(
)

transferModule := transfer.NewAppModule(app.TransferKeeper)
routerModule := router.NewAppModule(app.RouterKeeper)
routerModule := router.NewAppModule(app.RouterKeeper, app.GetSubspace(routertypes.ModuleName))
transfermiddlewareModule := transfermiddleware.NewAppModule(&app.TransferMiddlewareKeeper)
txBoundaryModule := txBoundary.NewAppModule(appCodec, app.TxBoundaryKeepper)
ratelimitModule := ratelimitmodule.NewAppModule(&app.RatelimitKeeper)
Expand Down
4 changes: 2 additions & 2 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,13 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
appKeepers.RouterKeeper = routerkeeper.NewKeeper(
appCodec,
appKeepers.keys[routertypes.StoreKey],
appKeepers.GetSubspace(routertypes.ModuleName),
appKeepers.TransferKeeper,
appKeepers.IBCKeeper.ChannelKeeper,
&appKeepers.DistrKeeper,
appKeepers.BankKeeper,
appKeepers.TransferMiddlewareKeeper,
appKeepers.IBCKeeper.ChannelKeeper,
appKeepers.TransferMiddlewareKeeper,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

appKeepers.RatelimitKeeper = *ratelimitmodulekeeper.NewKeeper(
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ replace (
// lock wasmvm so we do not break the grandpa contract
github.com/CosmWasm/wasmvm => github.com/CosmWasm/wasmvm v1.2.1

github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 => github.com/notional-labs/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20231027045618-f659894b12d9
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 => github.com/ComposableFi/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20240117005429-4da24b6c388a

// ibc-go with wasm client
github.com/cosmos/ibc-go/v7 => github.com/notional-labs/ibc-go/v7 v7.2.1-0.20231010040541-6cf43006971f

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbi
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg=
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4=
github.com/ComposableFi/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20240117005429-4da24b6c388a h1:LLy0n53MFNIr4sdCKAnyXbV8s1LGmfKCR+60szD+6ic=
github.com/ComposableFi/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20240117005429-4da24b6c388a/go.mod h1:UvDmcGIWJPIytq+Q78/ff5NTOsuX/7IrNgEugTW5i0s=
github.com/CosmWasm/wasmd v0.40.1 h1:LxbO78t/6S8TkeQlUrJ0m5O87HtAwLx4RGHq3rdrOEU=
github.com/CosmWasm/wasmd v0.40.1/go.mod h1:6EOwnv7MpuFaEqxcUOdFV9i4yvrdOciaY6VQ1o7A3yg=
github.com/CosmWasm/wasmvm v1.2.1 h1:si0tRsRDdUShV0k51Wn6zRKlmj3/WWP9Yr4cLmDTf+8=
Expand Down Expand Up @@ -1012,8 +1014,6 @@ github.com/nishanths/exhaustive v0.11.0 h1:T3I8nUGhl/Cwu5Z2hfc92l0e04D2GEW6e0l8p
github.com/nishanths/exhaustive v0.11.0/go.mod h1:RqwDsZ1xY0dNdqHho2z6X+bgzizwbLYOWnZbbl2wLB4=
github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk=
github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c=
github.com/notional-labs/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20231027045618-f659894b12d9 h1:4rte3LTbrQnlu0Gnw6gouj2voGwgjweORA1dcgnQxlU=
github.com/notional-labs/ibc-apps/middleware/packet-forward-middleware/v7 v7.0.0-20231027045618-f659894b12d9/go.mod h1:3PHOr4UiPNtnZJutT22fm5+pjIefTlDEgtWGoOJg3A0=
github.com/notional-labs/ibc-go/v7 v7.2.1-0.20231010040541-6cf43006971f h1:Uw35VHCdLTsQf8B4UGTjHCR6HqcYFF6dwPW8uJzS0f4=
github.com/notional-labs/ibc-go/v7 v7.2.1-0.20231010040541-6cf43006971f/go.mod h1:hjcl3RPLSDf0LSXrFyk2iTQCCFs5pfLbJb8h/5gJ2Vg=
github.com/nunnatsa/ginkgolinter v0.14.1 h1:khx0CqR5U4ghsscjJ+lZVthp3zjIFytRXPTaQ/TMiyA=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";

option go_package = "x/transfermiddleware/types";
option (gogoproto.goproto_getters_all) = false;
RafilxTenfen marked this conversation as resolved.
Show resolved Hide resolved

// ParachainIBCTokenInfo represents information about transferable IBC tokens
// from Parachain.
Expand All @@ -23,6 +24,7 @@ message ParachainIBCTokenInfo {
string asset_id = 4 [ (gogoproto.moretags) = "yaml:\"asset_id\"" ];
}

// RemoveParachainIBCTokenInfo removes parachain IBC token info.
message RemoveParachainIBCTokenInfo {
// native denom is new native minted denom in centauri chain.
string native_denom = 1 [ (gogoproto.moretags) = "yaml:\"native_denom\"" ];
Expand Down
7 changes: 0 additions & 7 deletions scripts/protocgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

set -eo pipefail

# get protoc executions
go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos 2>/dev/null

# get cosmos sdk from github
# go get github.com/cosmos/cosmos-sdk 2>/dev/null

echo "Generating gogo proto code"
cd proto
proto_dirs=$(find ./centauri -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
Expand All @@ -26,4 +20,3 @@ cd ..
# Note: Proto files are suffixed with the current binary version.
rm -rf github.com

go mod tidy -compat=1.19
2 changes: 1 addition & 1 deletion tests/interchaintest/basic_cosmos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"go.uber.org/zap/zaptest"
)

// TestStartCentauri is a basic test to assert that spinning up a Centauri network with 1 validator works properly.
// TestBasicCentauri is a basic test to assert that spinning up a Centauri network with 1 validator works properly.
func TestBasicCentauri(t *testing.T) {
if testing.Short() {
t.Skip()
Expand Down
16 changes: 15 additions & 1 deletion x/transfermiddleware/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ import (
porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types"
"github.com/cosmos/ibc-go/v7/modules/core/exported"

pcktfrwdtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types"
"github.com/notional-labs/composable/v6/x/transfermiddleware/types"
)

var _ pcktfrwdtypes.TransferMiddlewareKeeper = Keeper{}

type Keeper struct {
cdc codec.BinaryCodec
storeKey storetypes.StoreKey
Expand Down Expand Up @@ -204,8 +207,13 @@ func (keeper Keeper) HasParachainIBCTokenInfoByAssetID(ctx sdk.Context, assetID
return store.Has(key)
}

// ParachainIBCTokenInfoByNativeDenom implements types.TransferMiddlewareKeeper.
func (keeper Keeper) ParachainIBCTokenInfoByNativeDenom(ctx sdk.Context, nativeDenom string) pcktfrwdtypes.ParaChainIBCTokenInfo {
return keeper.GetParachainIBCTokenInfoByNativeDenom(ctx, nativeDenom)
}

// TODO: testing
// GetParachainIBCTokenInfo add new information about parachain token to chain state.
// GetParachainIBCTokenInfoByNativeDenom returns the ParachainIBCTokenInfo based on the native denom.
func (keeper Keeper) GetParachainIBCTokenInfoByNativeDenom(ctx sdk.Context, nativeDenom string) (info types.ParachainIBCTokenInfo) {
store := ctx.KVStore(keeper.storeKey)
bz := store.Get(types.GetKeyParachainIBCTokenInfoByNativeDenom(nativeDenom))
Expand All @@ -215,6 +223,12 @@ func (keeper Keeper) GetParachainIBCTokenInfoByNativeDenom(ctx sdk.Context, nati
return info
}

// ParachainIBCTokenInfoByAssetID implements types.TransferMiddlewareKeeper.
func (keeper Keeper) ParachainIBCTokenInfoByAssetID(ctx sdk.Context, assetID string) pcktfrwdtypes.ParaChainIBCTokenInfo {
return keeper.GetParachainIBCTokenInfoByAssetID(ctx, assetID)
}

// GetParachainIBCTokenInfoByAssetID returns the ParachainIBCTokenInfo based on the AssetID.
func (keeper Keeper) GetParachainIBCTokenInfoByAssetID(ctx sdk.Context, assetID string) (info types.ParachainIBCTokenInfo) {
store := ctx.KVStore(keeper.storeKey)
bz := store.Get(types.GetKeyParachainIBCTokenInfoByAssetID(assetID))
Expand Down
19 changes: 19 additions & 0 deletions x/transfermiddleware/types/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ package types
import (
fmt "fmt"
"strconv"

pcktfrwdtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types"
)

var _ pcktfrwdtypes.ParaChainIBCTokenInfo = ParachainIBCTokenInfo{}

func (p ParachainIBCTokenInfo) ValidateBasic() error {
_, err := strconv.Atoi(p.AssetId)
if err != nil {
Expand All @@ -13,3 +17,18 @@ func (p ParachainIBCTokenInfo) ValidateBasic() error {

return nil
}

// GetNativeDenom implements interface.
func (p ParachainIBCTokenInfo) GetNativeDenom() string {
return p.NativeDenom
}

// GetIbcDenom implements interface.
func (p ParachainIBCTokenInfo) GetIbcDenom() string {
return p.IbcDenom
}

// GetChannelID implements interface.
func (p ParachainIBCTokenInfo) GetChannelID() string {
return p.ChannelID
}
94 changes: 27 additions & 67 deletions x/transfermiddleware/types/parachain_token_info.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading