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

Kien/merge picad to sdk 50 #25

Merged
merged 33 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
17ecf02
implement custom transfer method for keeper.
RustNinja Apr 2, 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
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
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
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
22f16ae
Merge branch 'develop2' into feat/sdk50
duvbell Apr 24, 2024
8ad05fb
chore: bech32 migration script to sdk 50
duvbell Apr 24, 2024
bb9d8e6
feat: sync sdk 50
duvbell Apr 24, 2024
16c0213
fix: scripts to deploy pica node
duvbell Apr 24, 2024
8b3ae44
feat: add todo
duvbell Apr 24, 2024
d123316
fix: running pica node
duvbell Apr 24, 2024
476c91a
chore: update
duvbell Apr 24, 2024
bf54e32
deps: correct version to psuh wasm code
duvbell Apr 24, 2024
da11b40
test: upgrade chain successfully
duvbell Apr 24, 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
10 changes: 7 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,11 @@ vendor
go.work
go.work.sum

_build/

_build
mytestnet/

screenlog.0
mytestnet
.idea
node_modules

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
5 changes: 2 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
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 @@ -153,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 @@ -814,4 +813,4 @@ func (app *ComposableApp) AutoCliOpts() autocli.AppOptions {
ValidatorAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()),
ConsensusAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()),
}
}
}
22 changes: 13 additions & 9 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package keepers

import (
"fmt"
"github.com/cosmos/cosmos-sdk/x/params"
"math"
"path/filepath"
"strings"

"github.com/cosmos/cosmos-sdk/x/params"

circuitkeeper "cosmossdk.io/x/circuit/keeper"
circuittypes "cosmossdk.io/x/circuit/types"
icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"
Expand Down Expand Up @@ -121,7 +122,7 @@ import (

const (
AccountAddressPrefix = "composable"
authorityAddress = "centauri10556m38z4x6pqalr9rl5ytf3cff8q46nk85k9m" // convert from: centauri10556m38z4x6pqalr9rl5ytf3cff8q46nk85k9m
authorityAddress = "pica10556m38z4x6pqalr9rl5ytf3cff8q46nf36090" // convert from: centauri10556m38z4x6pqalr9rl5ytf3cff8q46nk85k9m
)

type AppKeepers struct {
Expand Down Expand Up @@ -211,12 +212,11 @@ func (appKeepers *AppKeepers) InitNormalKeepers(

appKeepers.StakingMiddlewareKeeper = stakingmiddleware.NewKeeper(appCodec, appKeepers.keys[stakingmiddlewaretypes.StoreKey], govModAddress)
appKeepers.IbcTransferMiddlewareKeeper = ibctransfermiddleware.NewKeeper(appCodec, appKeepers.keys[ibctransfermiddlewaretypes.StoreKey], govModAddress,
[]string{"centauri1ay9y5uns9khw2kzaqr3r33v2pkuptfnnr93j5j",
"centauri14lz7gaw92valqjearnye4shex7zg2p05mlx9q0",
"centauri1r2zlh2xn85v8ljmwymnfrnsmdzjl7k6w6lytan",
"centauri10556m38z4x6pqalr9rl5ytf3cff8q46nk85k9m",
// "centauri1wkjvpgkuchq0r8425g4z4sf6n85zj5wtmqzjv9",
// "centauri1hj5fveer5cjtn4wd6wstzugjfdxzl0xpzxlwgs",
[]string{
"pica1ay9y5uns9khw2kzaqr3r33v2pkuptfnnunlt5x",
"pica14lz7gaw92valqjearnye4shex7zg2p05yfguqm",
"pica1r2zlh2xn85v8ljmwymnfrnsmdzjl7k6w9f2ja8",
"pica10556m38z4x6pqalr9rl5ytf3cff8q46nf36090",
})

appKeepers.StakingKeeper = customstaking.NewKeeper(
Expand Down Expand Up @@ -458,12 +458,16 @@ func (appKeepers *AppKeepers) InitNormalKeepers(

vm, err := wasmvm.NewVM(wasmDataDir, wasmSupportedFeatures, wasmMemoryLimitMb, wasmPrintDebug, wasmCacheSizeMb)

if err != nil {
panic(err)
}

// use same VM for wasm
appKeepers.Wasm08Keeper = wasm08Keeper.NewKeeperWithVM(
appCodec,
runtime.NewKVStoreService(appKeepers.keys[wasm08types.StoreKey]),
&appKeepers.IBCKeeper.ClientKeeper,
"centauri1hj5fveer5cjtn4wd6wstzugjfdxzl0xpzxlwgs",
authorityAddress,
vm,
bApp.GRPCQueryRouter(),
)
Expand Down
23 changes: 23 additions & 0 deletions app/mock.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package app

import (
"github.com/cometbft/cometbft/crypto"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
)

// PV implements PrivValidator without any safety or persistence.
// Only use it for testing.
type PV struct {
PrivKey cryptotypes.PrivKey
}

func NewPV() PV {
return PV{ed25519.GenPrivKey()}
}

// GetPubKey implements PrivValidator interface
func (pv PV) GetPubKey() (crypto.PubKey, error) {
return cryptocodec.ToTmPubKeyInterface(pv.PrivKey.PubKey())
}
Loading
Loading