Skip to content

Commit

Permalink
Merge pull request #263 from notional-labs/dang/exclude-prefix-change
Browse files Browse the repository at this point in the history
layer to centauri
  • Loading branch information
vuong177 authored Oct 30, 2023
2 parents cafd771 + 670a198 commit 9480c5e
Show file tree
Hide file tree
Showing 23 changed files with 99 additions and 131 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/interchaintest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
push: true
platforms: linux/amd64
tags: |
ghcr.io/notional-labs/layer-ictest:latest
ghcr.io/notional-labs/centauri-ictest:latest
test-start-cosmos-chain:
runs-on: ubuntu-latest
needs: build-and-push-image
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/push_docker_images.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# This workflow pushes new layer docker images on every new tag.
# This workflow pushes new centauri docker images on every new tag.
#
# On every new `vX.Y.Z` tag the following images are pushed:
#
# notional-labs/layer:X.Y.Z # is pushed
# notional-labs/layer:X.Y # is updated to X.Y.Z
# notional-labs/layer:X # is updated to X.Y.Z
# notional-labs/layer:latest # is updated to X.Y.Z
# notional-labs/centauri:X.Y.Z # is pushed
# notional-labs/centauri:X.Y # is updated to X.Y.Z
# notional-labs/centauri:X # is updated to X.Y.Z
# notional-labs/centauri:latest # is updated to X.Y.Z
#
# All the images above have support for linux/amd64 and linux/arm64.
#
Expand Down Expand Up @@ -66,6 +66,6 @@ jobs:
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/notional-labs/layer:${{ env.MAJOR_VERSION }}
ghcr.io/notional-labs/layer:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}
ghcr.io/notional-labs/layer:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }}
ghcr.io/notional-labs/centauri:${{ env.MAJOR_VERSION }}
ghcr.io/notional-labs/centauri:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}
ghcr.io/notional-labs/centauri:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }}
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@
run: docker-compose up -d

- name: Copy binary
run: docker cp composable-centauri_node_1:/bin/layerd ./layerd
run: docker cp composable-centauri_node_1:/bin/centaurid ./centaurid

- name: Save sha256 sum
run: sha256sum ./layerd > ./layerd_sha256.txt
run: sha256sum ./centaurid > ./centaurid_sha256.txt

- name: Release
uses: softprops/action-gh-release@v1
with:
token: ${{ github.token }}
files: |
layerd
layerd_sha256.txt
centaurid
centaurid_sha256.txt
- name: Dump docker logs on failure
if: failure()
Expand Down
16 changes: 8 additions & 8 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 /layer
WORKDIR /centauri
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/go/pkg/mod \
Expand All @@ -43,25 +43,25 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
-mod=readonly \
-tags "netgo,ledger,muslc" \
-ldflags \
"-X github.com/cosmos/cosmos-sdk/version.Name="layer" \
-X github.com/cosmos/cosmos-sdk/version.AppName="layerd" \
"-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=${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 /layer/build/layerd \
/layer/cmd/layerd
-o /centauri/build/centaurid \
/centauri/cmd/centaurid

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

FROM ${RUNNER_IMAGE}

COPY --from=builder /layer/build/layerd /bin/layerd
COPY --from=builder /centauri/build/centaurid /bin/centaurid

ENV HOME /layer
ENV HOME /centauri
WORKDIR $HOME

# rest server
Expand All @@ -72,4 +72,4 @@ EXPOSE 26656
EXPOSE 26657
# grpc
EXPOSE 9090
ENTRYPOINT ["layerd"]
ENTRYPOINT ["centaurid"]
16 changes: 8 additions & 8 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 /layer
WORKDIR /centauri
COPY go.mod go.sum ./

# Cosmwasm - Download correct libwasmvm version
Expand All @@ -38,29 +38,29 @@ RUN GOWORK=off go build \
-mod=readonly \
-tags "netgo,ledger,muslc" \
-ldflags \
"-X github.com/cosmos/cosmos-sdk/version.Name="layer" \
-X github.com/cosmos/cosmos-sdk/version.AppName="layerd" \
"-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=${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 /layer/build/layerd \
/layer/cmd/layerd
-o /centauri/build/centaurid \
/centauri/cmd/centaurid

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

FROM ${RUNNER_IMAGE}

COPY --from=builder /layer/build/layerd /bin/layerd
COPY --from=builder /centauri/build/centaurid /bin/centaurid

ENV HOME /layer
ENV HOME /centauri

WORKDIR $HOME

COPY scripts/* /layer/
COPY scripts/* /centauri/
# rest server
EXPOSE 1317
# tendermint p2p
Expand Down
18 changes: 9 additions & 9 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=layer \
-X github.com/cosmos/cosmos-sdk/version.AppName=layerd \
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)"
Expand All @@ -86,13 +86,13 @@ endif
all: install

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

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

docker-build-debug:
@DOCKER_BUILDKIT=1 docker build -t layer:debug -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 .
Expand Down Expand Up @@ -133,22 +133,22 @@ proto-check-breaking:

# Executes start chain tests via interchaintest
ictest-start-cosmos:
cd tests/interchaintest && go test -race -v -run TestStartLayer .
cd tests/interchaintest && go test -race -v -run TestStartCentauri .

ictest-validator:
cd tests/interchaintest && go test -race -v -run TestValidator .

# Executes start chain tests via interchaintest
ictest-start-polkadot:
cd tests/interchaintest && go test -timeout=25m -race -v -run TestPolkadotLayerChainStart .
cd tests/interchaintest && go test -timeout=25m -race -v -run TestPolkadotcentauriChainStart .

# Executes IBC tests via interchaintest
ictest-ibc:
cd tests/interchaintest && go test -timeout=25m -race -v -run TestLayerPicassoIBCTransfer .
cd tests/interchaintest && go test -timeout=25m -race -v -run TestCentauriPicassoIBCTransfer .

# Executes Basic Upgrade Chain tests via interchaintest
ictest-upgrade:
cd tests/interchaintest && go test -timeout=25m -race -v -run TestLayerUpgrade .
cd tests/interchaintest && go test -timeout=25m -race -v -run TestCentauriUpgrade .

# Executes all tests via interchaintest after compling a local image as juno:local
ictest-all: ictest-start-cosmos ictest-start-polkadot ictest-ibc
Expand Down
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ import (
)

const (
Name = "layer"
Name = "centauri"
dirName = "banksy"
ForkHeight = 244008
)
Expand Down
2 changes: 1 addition & 1 deletion app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ import (

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

type AppKeepers struct {
Expand Down
32 changes: 0 additions & 32 deletions app/upgrades/v6/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@ import (

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

bech32authmigration "github.com/notional-labs/composable/v6/bech32-migration/auth"
bech32govmigration "github.com/notional-labs/composable/v6/bech32-migration/gov"
bech32slashingmigration "github.com/notional-labs/composable/v6/bech32-migration/slashing"
bech32stakingmigration "github.com/notional-labs/composable/v6/bech32-migration/staking"

authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

"github.com/notional-labs/composable/v6/bech32-migration/utils"
)

func CreateUpgradeHandler(
Expand All @@ -31,26 +19,6 @@ func CreateUpgradeHandler(
keepers *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
// Migration prefix
ctx.Logger().Info("First step: Migrate addresses stored in bech32 form to use new prefix")
keys := keepers.GetKVStoreKey()
bech32stakingmigration.MigrateAddressBech32(ctx, keys[stakingtypes.StoreKey], cdc)
bech32slashingmigration.MigrateAddressBech32(ctx, keys[slashingtypes.StoreKey], cdc)
bech32govmigration.MigrateAddressBech32(ctx, keys[govtypes.StoreKey], cdc)
bech32authmigration.MigrateAddressBech32(ctx, keys[authtypes.StoreKey], cdc)

// allowed relayer address
tfmdk := keepers.TransferMiddlewareKeeper
tfmdk.IterateAllowRlyAddress(ctx, func(rlyAddress string) bool {
// Delete old address
tfmdk.DeleteAllowRlyAddress(ctx, rlyAddress)

// add new address
newRlyAddress := utils.ConvertAccAddr(rlyAddress)
tfmdk.SetAllowRlyAddress(ctx, newRlyAddress)
return false
})

return mm.RunMigrations(ctx, configurator, vm)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ var flagBech32Prefix = "prefix"
func AddBech32ConvertCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "bech32-convert [address]",
Short: "Convert any bech32 string to the composable prefix",
Long: `Convert any bech32 string to the composable prefix
Short: "Convert any bech32 string to the centauri prefix",
Long: `Convert any bech32 string to the centauri prefix
Example:
layerd debug bech32-convert akash1a6zlyvpnksx8wr6wz8wemur2xe8zyh0ytz6d88
centaurid debug bech32-convert akash1a6zlyvpnksx8wr6wz8wemur2xe8zyh0ytz6d88
layerd debug bech32-convert stride1673f0t8p893rqyqe420mgwwz92ac4qv6synvx2 --prefix osmo
centaurid debug bech32-convert stride1673f0t8p893rqyqe420mgwwz92ac4qv6synvx2 --prefix osmo
`,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
func CovertPrefixAddr() *cobra.Command {
cmd := &cobra.Command{
Use: "convert [address]",
Short: "Convert prefix from centauri to layer",
Short: "Convert prefix from layer to centauri",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
newAddr := utils.ConvertAccAddr(args[0])
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

const (
// Bech32Prefix defines the Bech32 prefix used for EthAccounts
Bech32Prefix = "layer"
Bech32Prefix = "centauri"

// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
Bech32PrefixAccAddr = Bech32Prefix
Expand Down Expand Up @@ -40,8 +40,8 @@ func SetupConfig() {
SetAddressPrefixes(config)
config.Seal()

version.AppName = "layer"
version.Name = "layerd"
version.AppName = "centauri"
version.Name = "centaurid"
}

// SetBech32Prefixes sets the global prefixes to be used when serializing addresses and public keys to Bech32 strings.
Expand Down
4 changes: 2 additions & 2 deletions cmd/layerd/main.go → cmd/centaurid/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"

"github.com/notional-labs/composable/v6/app"
cmd "github.com/notional-labs/composable/v6/cmd/layerd/cmd"
cmdcfg "github.com/notional-labs/composable/v6/cmd/layerd/config"
cmd "github.com/notional-labs/composable/v6/cmd/centaurid/cmd"
cmdcfg "github.com/notional-labs/composable/v6/cmd/centaurid/config"
)

func main() {
Expand Down
14 changes: 7 additions & 7 deletions tests/interchaintest/basic_cosmos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"go.uber.org/zap/zaptest"
)

// TestStartCentauri is a basic test to assert that spinning up a Layer network with 1 validator works properly.
func TestBasicLayer(t *testing.T) {
// TestStartCentauri 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 All @@ -21,14 +21,14 @@ func TestBasicLayer(t *testing.T) {

ctx := context.Background()

// Create chain factory with Layer
// Create chain factory with centauri
numVals := 3
numFullNodes := 3

cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{
{
Name: "layer",
ChainConfig: layerConfig,
Name: "centauri",
ChainConfig: centauriConfig,
NumValidators: &numVals,
NumFullNodes: &numFullNodes,
},
Expand All @@ -38,13 +38,13 @@ func TestBasicLayer(t *testing.T) {
chains, err := cf.Chains(t.Name())
require.NoError(t, err)

layer := chains[0].(*cosmos.CosmosChain)
centauri := chains[0].(*cosmos.CosmosChain)

// Relayer Factory
client, network := interchaintest.DockerSetup(t)

// Create a new Interchain object which describes the chains, relayers, and IBC connections we want to use
ic := interchaintest.NewInterchain().AddChain(layer)
ic := interchaintest.NewInterchain().AddChain(centauri)

rep := testreporter.NewNopReporter()
eRep := rep.RelayerExecReporter(t)
Expand Down
Loading

0 comments on commit 9480c5e

Please sign in to comment.