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

refactor: merge from develop and add test script #502

Merged
merged 53 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
4e51b63
remove the upgrade handler code that tried remove proposal..
RustNinja Mar 27, 2024
c3f8008
Merge pull request #475 from ComposableFi/release/v6.5.x
RustNinja Mar 28, 2024
ab921d5
bump ibc-go
hoank101 Apr 2, 2024
23cfc5e
SetTransferKeeper for PFM to replace original ibc transfer to wrapper
RustNinja Apr 2, 2024
afddb40
added UpgradeName = "v6_5_1"
RustNinja Apr 2, 2024
74d2c7f
Merge pull request #479 from ComposableFi/rustdev/cosmos-fee-pfm
RustNinja Apr 2, 2024
b2e0660
Merge pull request #480 from ComposableFi/rustdev/pfm-cosmos-fee-upgrade
RustNinja Apr 2, 2024
17ecf02
implement custom transfer method for keeper.
RustNinja Apr 2, 2024
6fbcfeb
Merge branch 'develop2' of https://github.com/ComposableFi/composable…
hoank101 Apr 3, 2024
1307015
merge from develop2
hoank101 Apr 3, 2024
9c1f221
refactor pfm
hoank101 Apr 3, 2024
b2cbf98
Merge pull request #21 from notional-labs/hoa/merge
hoank101 Apr 3, 2024
b7c08b4
bump: update cosmos-sdk and cometbft dependency
hoank101 Apr 3, 2024
e566a4b
bump: update pfm
hoank101 Apr 3, 2024
e368076
bump: update pfm
hoank101 Apr 3, 2024
4cbbf01
add param to new keeper call.
RustNinja Apr 3, 2024
0187884
call the default keeper Transfer instead of recursion.
RustNinja Apr 3, 2024
fd055bc
fix lint
RustNinja Apr 3, 2024
91ee942
introduced v6_5_2 upgrade channel
RustNinja Apr 3, 2024
43239c4
Merge pull request #482 from ComposableFi/rustdev/cosmos-fee
RustNinja Apr 3, 2024
de6016c
Merge pull request #485 from ComposableFi/rustdev/upgrade-v6-5-2
RustNinja Apr 3, 2024
6b0aad6
update testnet code
hoank101 Apr 4, 2024
4b2496b
update datatype for min cosmos fee in tx to sdk.Coin
RustNinja Apr 4, 2024
5a27295
introduce v6_5_3
RustNinja Apr 4, 2024
b20e356
add InitializePinnedCodes
hoank101 Apr 8, 2024
ecf3f7a
updating ibc-go
kkast Apr 10, 2024
a806d66
fixes
kkast Apr 10, 2024
2fb2d3e
rename uprgade
kkast Apr 11, 2024
4886c32
Merge pull request #490 from ComposableFi/mint_mod_fix
kkast Apr 11, 2024
3e6da50
revert
kkast Apr 11, 2024
866ca17
Merge pull request #491 from ComposableFi/merge-v6.5.3
kkast Apr 11, 2024
04548a3
Change prefix to pica (#447)
hoank101 Apr 12, 2024
362a1cc
add scripts (#492)
hoank101 Apr 15, 2024
6f99a96
update gitignore
hoank101 Apr 15, 2024
2b89eb8
update gitignore (#493)
hoank101 Apr 15, 2024
1a3c5c2
refactor: remove before release testnet
hoank101 Apr 15, 2024
28623d9
Merge branch 'feat/sdk50' of https://github.com/ComposableFi/composab…
hoank101 Apr 18, 2024
2950b9b
refactor: update denom
hoank101 Apr 18, 2024
34343f5
refactor: hardcode checksum
hoank101 Apr 18, 2024
13f953e
refactor: change name convention
hoank101 Apr 18, 2024
a78e14c
update ibc-go version update ibc-go version
kkast Apr 22, 2024
2bc614e
Merge pull request #494 from ComposableFi/clients-states-query-fix
kkast Apr 22, 2024
8c8e311
fix releaser
kkast Apr 22, 2024
dbe5621
Merge pull request #497 from ComposableFi/clients-states-query-fix
kkast Apr 22, 2024
48b6b88
introduce refund logic for ibc transfer if tx failed by timeout.
RustNinja Apr 23, 2024
a6c6a10
add migration pfm (#499)
hoank101 Apr 24, 2024
f7d9311
fix lint
RustNinja Apr 24, 2024
36d003c
disallow to device by zero in ibc tx flow
RustNinja Apr 24, 2024
b67db99
Merge pull request #498 from ComposableFi/rustdev/cosmos-ibc-fee-time…
kkast Apr 24, 2024
ef93f95
Kien/merge picad to sdk 50 (#25)
kienn6034 Apr 25, 2024
e9df7de
Merge branch 'develop2' of https://github.com/ComposableFi/composable…
hoank101 Apr 25, 2024
1d9686b
merge from develop2
hoank101 Apr 25, 2024
3ad4f45
feat: add prescript add rly account
kienn6034 Apr 25, 2024
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/interchaintest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
password: ${{ secrets.GHCR_PAT }}
- name: Build and push
id: build_push_image
uses: docker/build-push-action@v3
Expand Down
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ dist/

# Test binary, built with `go test -c`
*.test

# Test data
data/*
# Output of the go coverage tool, specifically when used with LiteIDE
*.out

Expand All @@ -48,8 +49,9 @@ vendor
go.work
go.work.sum

_build/

_build
mytestnet/

screenlog.0
mytestnet
.idea
10 changes: 5 additions & 5 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# .goreleaser.yml

project_name: centaurid
project_name: picad

env:
- CGO_ENABLED=1

builds:
- id: linux
main: ./cmd/centaurid
binary: centaurid
main: ./cmd/picad
binary: picad
hooks:
pre:
- cmd: bash scripts/release_pre_linux.sh
Expand All @@ -28,8 +28,8 @@ builds:
- -mod=readonly
- -trimpath
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.Name=pica
- -X github.com/cosmos/cosmos-sdk/version.AppName=picad
- -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=netgo,ledger,muslc"
Expand Down
24 changes: 12 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN apk add --no-cache \
linux-headers

# Download go dependencies
WORKDIR /centauri
WORKDIR /pica
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/go/pkg/mod \
Expand All @@ -36,30 +36,30 @@ RUN set -eux; \
# Copy the remaining files
COPY . .

# Build centaurid binary
# Build picad binary
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/go/pkg/mod \
GOWORK=off go build \
-mod=readonly \
-tags "netgo,ledger,muslc" \
-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.Name="pica" \
-X github.com/cosmos/cosmos-sdk/version.AppName="picad" \
-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 /centauri/build/centaurid \
/centauri/cmd/centaurid
-o /pica/build/picad \
/pica/cmd/picad


# --------------------------------------------------------
# toolkit
# --------------------------------------------------------

FROM busybox:1.35.0-uclibc as busybox
RUN addgroup --gid 1025 -S composable && adduser --uid 1025 -S composable -G composable
RUN addgroup --gid 1025 -S pica && adduser --uid 1025 -S pica -G pica


# --------------------------------------------------------
Expand All @@ -69,14 +69,14 @@ FROM ${RUNNER_IMAGE}

COPY --from=busybox:1.35.0-uclibc /bin/sh /bin/sh

COPY --from=builder /centauri/build/centaurid /bin/centaurid
COPY --from=builder /pica/build/picad /bin/picad

# Install composable user
COPY --from=busybox /etc/passwd /etc/passwd
COPY --from=busybox --chown=1025:1025 /home/composable /home/composable
COPY --from=busybox --chown=1025:1025 /home/pica /home/pica

WORKDIR /home/composable
USER composable
WORKDIR /home/pica
USER pica

# rest server
EXPOSE 1317
Expand All @@ -87,4 +87,4 @@ EXPOSE 26657
# grpc
EXPOSE 9090

ENTRYPOINT ["centaurid"]
ENTRYPOINT ["picad"]
18 changes: 9 additions & 9 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN apk add --no-cache \
linux-headers

# Download go dependencies
WORKDIR /centauri
WORKDIR /pica
COPY go.mod go.sum ./

# Cosmwasm - Download correct libwasmvm version
Expand All @@ -33,34 +33,34 @@ RUN set -eux; \
# Copy the remaining files
COPY . .

# Build centaurid binary
# Build picad binary
RUN GOWORK=off go build \
-mod=readonly \
-tags "netgo,ledger,muslc" \
-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.Name="pica" \
-X github.com/cosmos/cosmos-sdk/version.AppName="picad" \
-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 /centauri/build/centaurid \
/centauri/cmd/centaurid
-o /pica/build/picad \
/pica/cmd/picad

# --------------------------------------------------------
# Runner
# --------------------------------------------------------

FROM ${RUNNER_IMAGE}

COPY --from=builder /centauri/build/centaurid /bin/centaurid
COPY --from=builder /pica/build/picad /bin/picad

ENV HOME /centauri
ENV HOME /pica

WORKDIR $HOME

COPY scripts/* /centauri/
COPY scripts/* /pica/
# rest server
EXPOSE 1317
# tendermint p2p
Expand Down
50 changes: 44 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ comma := ,
build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags))

# process linker flags
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=centauri \
-X github.com/cosmos/cosmos-sdk/version.AppName=centaurid \
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=pica \
-X github.com/cosmos/cosmos-sdk/version.AppName=picad \
-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 All @@ -86,18 +86,18 @@ endif
all: install

install: go.sum
go install -mod=readonly $(BUILD_FLAGS) ./cmd/centaurid
go install -mod=readonly $(BUILD_FLAGS) ./cmd/picad

build:
go build $(BUILD_FLAGS) -o bin/centaurid ./cmd/centaurid
go build $(BUILD_FLAGS) -o bin/picad ./cmd/picad

docker-build-debug:
@DOCKER_BUILDKIT=1 docker build -t centauri:local -f Dockerfile .
@DOCKER_BUILDKIT=1 docker build -t centauri:debug -f Dockerfile .

lint:
@find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' -not -name '*.gw.go' | xargs go run mvdan.cc/gofumpt -w .
@find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' -not -name '*.gw.go' | xargs go run github.com/client9/misspell/cmd/misspell -w
@find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' -not -name '*.gw.go' | xargs go run golang.org/x/tools/cmd/goimports -w -local github.com/notional-labs/centauri
@find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' -not -name '*.gw.go' | xargs go run golang.org/x/tools/cmd/goimports -w -local github.com/notional-labs/pica
.PHONY: lint

###############################################################################
Expand Down Expand Up @@ -156,6 +156,21 @@ ictest-all: ictest-start-cosmos ictest-start-polkadot ictest-ibc
ictest-push-wasm:
cd tests/interchaintest && go test -race -v -run TestPushWasmClientCode .

# Init 2 cosmos chains and setup ibc between them
init-test-interchain: clean-testing-data install
./scripts/test-upgrade-cosmos-chains.sh

### Upgrade Test ###
test-upgrade: clean-testing-data
@echo "Starting upgrade test"
./scripts/test-upgrade.sh

clean-testing-data:
@echo "Killing binary and removing previous data"
-@pkill picad 2>/dev/null
-@pkill rly 2>/dev/null
-@rm -rf ./mytestnet

.PHONY: ictest-start-cosmos ictest-start-polkadot ictest-ibc ictest-push-wasm ictest-all

include contrib/make/release.mk
Expand All @@ -169,5 +184,28 @@ test-upgrade: clean-testing-data
clean-testing-data:
@echo "Killing binary and removing previous data"
-@pkill centaurid 2>/dev/null
-@pkill picad 2>/dev/null
-@rm -rf ./screenlog.0
-@rm -rf ./mytestnet

## Scripts for testing sdk 50
init-deps:
@echo "Installing dependencies"
bash ./scripts/upgrade/init-deps.sh

localnet-pica: clean-testing-data
@echo "Starting localnet"
bash ./scripts/upgrade/setup-old-picad-node.sh

localnet-picasso:
@echo "Starting localnet"
bash ./scripts/upgrade/setup-polkadot-node.sh

relayer-start:
@echo "Starting relayer"
bash ./scripts/upgrade/setup-relayer.sh

pica-upgrade:
@echo "Starting upgrade"
bash ./scripts/upgrade/upgrade.sh

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Centauri
# Pica
Cosmos blockchain with IBC-v7 and wasm client enable.

## Hardware Recommendation
Expand All @@ -13,7 +13,7 @@ Requires [Go 1.20](https://go.dev/doc/install) or higher.

```bash
make install
centaurid version
picad version
```
Then you can run a node with a single command.

Expand Down
31 changes: 20 additions & 11 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"cosmossdk.io/client/v2/autocli"
"cosmossdk.io/core/appmodule"
"fmt"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services"
authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec"
"github.com/notional-labs/composable/v6/app/upgrades/v6_5_1"
"io"
"os"
"path/filepath"
Expand Down Expand Up @@ -101,8 +101,8 @@ import (
customstaking "github.com/notional-labs/composable/v6/custom/staking"
"github.com/spf13/cast"

router "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward"
routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types"
pfm "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward"
pfmtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types"

custombankmodule "github.com/notional-labs/composable/v6/custom/bank"

Expand Down Expand Up @@ -138,7 +138,7 @@ import (
)

const (
Name = "centauri"
Name = "picasso"
dirName = "banksy"
ForkHeight = 244008
)
Expand All @@ -152,7 +152,7 @@ var (
// https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34
EnableSpecificProposals = ""

Upgrades = []upgrades.Upgrade{v6_5_1.Upgrade, v7_0_1.Upgrade}
Upgrades = []upgrades.Upgrade{v7_0_1.Upgrade}
Forks = []upgrades.Fork{}
)

Expand Down Expand Up @@ -200,7 +200,7 @@ var (
tendermint.AppModuleBasic{},
mint.AppModuleBasic{},
wasm.AppModuleBasic{},
router.AppModuleBasic{},
pfm.AppModuleBasic{},
ica.AppModuleBasic{},
ibc_hooks.AppModuleBasic{},
transfermiddleware.AppModuleBasic{},
Expand Down Expand Up @@ -341,7 +341,7 @@ func NewComposableApp(

// transferModule := transfer.NewAppModule(app.TransferKeeper)
transferModule := customibctransfer.NewAppModule(appCodec, app.TransferKeeper, app.BankKeeper)
routerModule := router.NewAppModule(app.RouterKeeper, app.GetSubspace(routertypes.ModuleName))
pfmModule := pfm.NewAppModule(app.PfmKeeper, app.GetSubspace(pfmtypes.ModuleName))
transfermiddlewareModule := transfermiddleware.NewAppModule(&app.TransferMiddlewareKeeper)
txBoundaryModule := txBoundary.NewAppModule(appCodec, app.TxBoundaryKeepper)
ratelimitModule := ratelimitmodule.NewAppModule(&app.RatelimitKeeper)
Expand Down Expand Up @@ -388,7 +388,7 @@ func NewComposableApp(
consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper),
wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)),
wasm08.NewAppModule(app.Wasm08Keeper),
routerModule,
pfmModule,
transfermiddlewareModule,
txBoundaryModule,
icaModule,
Expand Down Expand Up @@ -420,7 +420,7 @@ func NewComposableApp(
vestingtypes.ModuleName,
ibcexported.ModuleName,
ibctransfertypes.ModuleName,
routertypes.ModuleName,
pfmtypes.ModuleName,
transfermiddlewaretypes.ModuleName,
txBoundaryTypes.ModuleName,
ratelimitmoduletypes.ModuleName,
Expand Down Expand Up @@ -464,7 +464,7 @@ func NewComposableApp(
group.ModuleName,
paramstypes.ModuleName,
upgradetypes.ModuleName,
routertypes.ModuleName,
pfmtypes.ModuleName,
transfermiddlewaretypes.ModuleName,
txBoundaryTypes.ModuleName,
ratelimitmoduletypes.ModuleName,
Expand Down Expand Up @@ -504,7 +504,7 @@ func NewComposableApp(
upgradetypes.ModuleName,
ibctransfertypes.ModuleName,
icqtypes.ModuleName,
routertypes.ModuleName,
pfmtypes.ModuleName,
transfermiddlewaretypes.ModuleName,
txBoundaryTypes.ModuleName,
ratelimitmoduletypes.ModuleName,
Expand Down Expand Up @@ -596,6 +596,15 @@ func NewComposableApp(
if err := app.LoadLatestVersion(); err != nil {
tmos.Exit(err.Error())
}
ctx := app.BaseApp.NewUncachedContext(true, tmproto.Header{})
// Initialize pinned codes in wasmvm as they are not persisted there
if err := app.WasmKeeper.InitializePinnedCodes(ctx); err != nil {
tmos.Exit(fmt.Sprintf("failed initialize pinned codes %s", err))
}

//if err := wasm08keeper.InitializePinnedCodes(ctx); err != nil {
// tmos.Exit(fmt.Sprintf("failed initialize pinned codes %s", err))
//}
}

return app
Expand Down
Loading
Loading