Skip to content

Commit

Permalink
Change prefix to pica (#447)
Browse files Browse the repository at this point in the history
* delete proposal #6

* use develop branch for ci

* use another image

* test

* removing more broken proposals

* introduce goreleaser

* remove separate gha for building docker images

* rename registry owner

* clean comments

* use version with v

* add additional tags

* fix org

* update docker image

* added jq

* introduce ibc transfer custom module

* custom ibc transfer module ready to replace for testing.

* activate custom ibc module for cosmos chain. chain works.

* added ibc transfer module that is going to store all params for eth fees

* resolve conflict with a same name for MsgUpdateEpochParams from staking.

* add dependency to transfer keeper from ibc transfer middleware/params

* added repeated FeeItem into Params + MVP logic in transfer msg server

* finalized the Transfer method. send fee to fee. build. chain works.

* only useful params in genesis for ibc transfer module. Works

* golangci-lint run

* slashing fixes

* remove unused types in proto

* add docs and fix all requested changes by reviewers

* review fixes

* fix tests

* local setup

* allow devnet with custom key gov

* relay from master

* porting fix from v7

* refactoring.

* add runtime upgrade handler. for ibc fee feature.

* upgrade merged. BankKeeper + GovKeeper + IbcTransferMiddlewareKeeper

* Revert "Merge pull request #451 from ComposableFi/slashing_fix"

This reverts commit 1ad4293, reversing
changes made to 85e2bf9.

* revert banksy changes to resolve halted chain.

* Revert "allow devnet with custom key gov"

This reverts commit 2457d87.

* create a new chain upgrade handler for chain upgrade.

* chore: change centaurid -> picad and prefix name to pica

* chore: update name prefix

* refactor: remove old upgrade

* refactor: update prefix

* refactor: update prefix

* test: change govAuthorityAddress

* ci: rollback

* wip

* feat: add script upgrade_test

* chore: update script

* wip

* refactor: remove set prefix

* refactor: update test

* chore: rollback

* chore: ignore build folder

* perf: make blocktime run faster

* fix: use key with balances

* chore: ignore screen log

* refactor: using default flag for test

* test: increment and assert counter value to be equal 1

* chore: rollback

* chore: rollback script

* test: add script upgrade

* fix: correct upgrade height

* feat: add post scripts

* test: assertion for post scripts

* chore: stream unnecessary output to null

* feat: add test for the new address

* wip

* chore: log for test upgrade

* test: completed ibc transfer

* verify affection of alliance module

* test/ica_migration

* add migration test for mint, ratelimit, ibc-hooks, transfermiddleware module

* finalize script upgrade test

* pick denom for testing as stake

* remove unused fnc

* modify testup

* fix unused fnc

* merge variable

* chore: remove release.yml

* refactor: change v6.4.6 -> v6.4.7

* feaT: migrate contract info

* test: assert contract info && code info

* fix: change repo secret name

* refactor: change v6.4.7 -> v6.4.8

* revert change version

* rebase and change conflict version

* merge from develop2

* feat: add v6_6_0 handler

* remove old upgrade

* fix lint

* fix lint

* fix test

* update script

* update address and ibc-go

* fix lint

* fix lint

---------

Co-authored-by: kkast <kkastsevich@gmail.com>
Co-authored-by: Kanstantsin Kastsevich <kkast@users.noreply.github.com>
Co-authored-by: rjonczy <robert.jonczy@gmail.com>
Co-authored-by: rustdev <placex.com@gmail.com>
Co-authored-by: rust.dev <102041955+RustNinja@users.noreply.github.com>
Co-authored-by: dzmitry-lahoda <dzmitry@lahoda.pro>
Co-authored-by: tungle <anhletung@notional.ventures>
Co-authored-by: kienn6034 <kien@notional.ventures>
  • Loading branch information
9 people committed Apr 12, 2024
1 parent 866ca17 commit 04548a3
Show file tree
Hide file tree
Showing 87 changed files with 2,007 additions and 1,400 deletions.
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
11 changes: 9 additions & 2 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 @@ -46,4 +47,10 @@ dist/
.vendor
vendor
go.work
go.work.sum
go.work.sum

_build/

mytestnet/

screenlog.0
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
28 changes: 22 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 @@ -157,6 +157,22 @@ 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 centaurid 2>/dev/null
-@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
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
6 changes: 4 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"path/filepath"
"strings"

"github.com/notional-labs/composable/v6/app/upgrades/v6_6_0"

nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
Expand Down Expand Up @@ -133,7 +135,7 @@ import (
)

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

Upgrades = []upgrades.Upgrade{v6_5_4.Upgrade}
Upgrades = []upgrades.Upgrade{v6_5_4.Upgrade, v6_6_0.Upgrade}
Forks = []upgrades.Fork{}
)

Expand Down
19 changes: 8 additions & 11 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ import (
)

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

type AppKeepers struct {
Expand Down Expand Up @@ -180,7 +179,8 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
) {
// add keepers
appKeepers.AccountKeeper = authkeeper.NewAccountKeeper(
appCodec, appKeepers.keys[authtypes.StoreKey], authtypes.ProtoBaseAccount, maccPerms, AccountAddressPrefix, authtypes.NewModuleAddress(govtypes.ModuleName).String(),
appCodec, appKeepers.keys[authtypes.StoreKey], authtypes.ProtoBaseAccount, maccPerms,
sdk.GetConfig().GetBech32AccountAddrPrefix(), authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

appKeepers.BankKeeper = custombankkeeper.NewBaseKeeper(
Expand All @@ -196,14 +196,11 @@ func (appKeepers *AppKeepers) InitNormalKeepers(

appKeepers.StakingMiddlewareKeeper = stakingmiddleware.NewKeeper(appCodec, appKeepers.keys[stakingmiddlewaretypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String())
appKeepers.IbcTransferMiddlewareKeeper = ibctransfermiddleware.NewKeeper(appCodec, appKeepers.keys[ibctransfermiddlewaretypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String(),
[]string{"centauri1ay9y5uns9khw2kzaqr3r33v2pkuptfnnr93j5j",
"centauri14lz7gaw92valqjearnye4shex7zg2p05mlx9q0",
"centauri1r2zlh2xn85v8ljmwymnfrnsmdzjl7k6w6lytan",
"centauri10556m38z4x6pqalr9rl5ytf3cff8q46nk85k9m",

// "centauri1wkjvpgkuchq0r8425g4z4sf6n85zj5wtmqzjv9",

// "centauri1hj5fveer5cjtn4wd6wstzugjfdxzl0xpzxlwgs",
[]string{
"pica1ay9y5uns9khw2kzaqr3r33v2pkuptfnnunlt5x",
"pica14lz7gaw92valqjearnye4shex7zg2p05yfguqm",
"pica1r2zlh2xn85v8ljmwymnfrnsmdzjl7k6w9f2ja8",
"pica10556m38z4x6pqalr9rl5ytf3cff8q46nf36090",
})

appKeepers.StakingKeeper = customstaking.NewKeeper(
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

0 comments on commit 04548a3

Please sign in to comment.