Skip to content

Commit

Permalink
Merge pull request #257 from notional-labs/ducnt/changeprefix
Browse files Browse the repository at this point in the history
Change prefix from Composable to Layer for IC-Test and Docker
  • Loading branch information
anhductn2001 authored Oct 24, 2023
2 parents 806065b + 716a8d1 commit e21200c
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 71 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/composable-ictest:latest
ghcr.io/notional-labs/layer-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 composable docker images on every new tag.
# This workflow pushes new layer docker images on every new tag.
#
# On every new `vX.Y.Z` tag the following images are pushed:
#
# notional-labs/composable:X.Y.Z # is pushed
# notional-labs/composable:X.Y # is updated to X.Y.Z
# notional-labs/composable:X # is updated to X.Y.Z
# notional-labs/composable:latest # is updated to X.Y.Z
# 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
#
# 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/composable:${{ env.MAJOR_VERSION }}
ghcr.io/notional-labs/composable:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}
ghcr.io/notional-labs/composable:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }}
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 }}
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/centaurid ./centaurid
run: docker cp composable-centauri_node_1:/bin/layerd ./layerd

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

- name: Release
uses: softprops/action-gh-release@v1
with:
token: ${{ github.token }}
files: |
centaurid
centaurid_sha256.txt
layerd
layerd_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 /composable
WORKDIR /layer
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="composable" \
-X github.com/cosmos/cosmos-sdk/version.AppName="composabled" \
"-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.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 /composable/build/composabled \
/composable/cmd/composabled
-o /layer/build/layerd \
/layer/cmd/layerd

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

FROM ${RUNNER_IMAGE}

COPY --from=builder /composable/build/composabled /bin/composabled
COPY --from=builder /layer/build/layerd /bin/layerd

ENV HOME /composable
ENV HOME /layer
WORKDIR $HOME

# rest server
Expand All @@ -72,4 +72,4 @@ EXPOSE 26656
EXPOSE 26657
# grpc
EXPOSE 9090
ENTRYPOINT ["composabled"]
ENTRYPOINT ["layerd"]
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 /composable
WORKDIR /layer
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="composable" \
-X github.com/cosmos/cosmos-sdk/version.AppName="composabled" \
"-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.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 /composable/build/composabled \
/composable/cmd/composabled
-o /layer/build/layerd \
/layer/cmd/layerd

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

FROM ${RUNNER_IMAGE}

COPY --from=builder /composable/build/composabled /bin/composabled
COPY --from=builder /layer/build/layerd /bin/layerd

ENV HOME /composable
ENV HOME /layer

WORKDIR $HOME

COPY scripts/* /composable/
COPY scripts/* /layer/
# rest server
EXPOSE 1317
# tendermint p2p
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g')
DOCKER := $(shell which docker)
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf:1.0.0-rc8
BUILDDIR ?= $(CURDIR)/build
HTTPS_GIT := https://github.com/notional-labs/composable-testnet/.git
HTTPS_GIT := https://github.com/notional-labs/composable-centauri.git

export GO111MODULE = on

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 TestStartComposable .
cd tests/interchaintest && go test -race -v -run TestStartLayer .

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 TestPolkadotComposableChainStart .
cd tests/interchaintest && go test -timeout=25m -race -v -run TestPolkadotLayerChainStart .

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

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

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

ctx := context.Background()

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

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

composable := chains[0].(*cosmos.CosmosChain)
layer := 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(composable)
ic := interchaintest.NewInterchain().AddChain(layer)

rep := testreporter.NewNopReporter()
eRep := rep.RelayerExecReporter(t)
Expand Down
12 changes: 6 additions & 6 deletions tests/interchaintest/chain_start_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 composable network with 1 validator works properly.
func TestStartComposable(t *testing.T) {
// TestStartcentauri is a basic test to assert that spinning up a layer network with 1 validator works properly.
func TestStartLayer(t *testing.T) {
if testing.Short() {
t.Skip()
}
Expand All @@ -27,8 +27,8 @@ func TestStartComposable(t *testing.T) {

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

composable := chains[0].(*cosmos.CosmosChain)
layer := 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(composable)
ic := interchaintest.NewInterchain().AddChain(layer)

rep := testreporter.NewNopReporter()
eRep := rep.RelayerExecReporter(t)
Expand Down
2 changes: 1 addition & 1 deletion tests/interchaintest/ibc_transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
// * create client, connection, and channel in relayer
// * start relayer
// * send transfer over ibc
func TestCentauriPicassoIBCTransfer(t *testing.T) {
func TestLayerPicassoIBCTransfer(t *testing.T) {
if testing.Short() {
t.Skip()
}
Expand Down
2 changes: 1 addition & 1 deletion tests/interchaintest/polkadot_chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"go.uber.org/zap/zaptest"
)

func TestPolkadotComposableChainStart(t *testing.T) {
func TestPolkadotLayerChainStart(t *testing.T) {
if testing.Short() {
t.Skip("skipping in short mode")
}
Expand Down
32 changes: 16 additions & 16 deletions tests/interchaintest/push_wasm_client_code_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ func TestPushWasmClientCode(t *testing.T) {
{
ChainConfig: ibc.ChainConfig{
Type: "cosmos",
Name: "composable",
ChainID: "centaurid",
Name: "layer",
ChainID: "layerd",
Images: []ibc.DockerImage{CentauriImage},
Bin: "layerd",
Bech32Prefix: "layer",
Expand All @@ -87,11 +87,11 @@ func TestPushWasmClientCode(t *testing.T) {
chains, err := cf.Chains(t.Name())
require.NoError(t, err)

composabled := chains[0]
layerd := chains[0]

t.Logf("NewInterchain")
ic := interchaintest.NewInterchain().
AddChain(composabled)
AddChain(layerd)

t.Logf("Interchain build options")
require.NoError(t, ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{
Expand All @@ -108,46 +108,46 @@ func TestPushWasmClientCode(t *testing.T) {

// Create and Fund User Wallets
fundAmount := int64(10_000_000_000)
users := interchaintest.GetAndFundTestUsers(t, ctx, "default", int64(fundAmount), composabled)
users := interchaintest.GetAndFundTestUsers(t, ctx, "default", int64(fundAmount), layerd)
centaurid1User := users[0]

err = testutil.WaitForBlocks(ctx, 10, composabled)
err = testutil.WaitForBlocks(ctx, 10, layerd)
require.NoError(t, err)

centaurid1UserBalInitial, err := composabled.GetBalance(ctx, centaurid1User.FormattedAddress(), composabled.Config().Denom)
centaurid1UserBalInitial, err := layerd.GetBalance(ctx, centaurid1User.FormattedAddress(), layerd.Config().Denom)
require.NoError(t, err)
require.Equal(t, fundAmount, centaurid1UserBalInitial)

composabledChain := composabled.(*cosmos.CosmosChain)
layerdChain := layerd.(*cosmos.CosmosChain)

// Verify a normal user cannot push a wasm light client contract
_, err = composabledChain.StoreClientContract(ctx, centaurid1User.KeyName(), "ics10_grandpa_cw.wasm")
_, err = layerdChain.StoreClientContract(ctx, centaurid1User.KeyName(), "ics10_grandpa_cw.wasm")
require.ErrorContains(t, err, "invalid authority")

proposal := cosmos.TxProposalv1{
Metadata: "none",
Deposit: "500000000" + composabledChain.Config().Denom, // greater than min deposit
Deposit: "500000000" + layerdChain.Config().Denom, // greater than min deposit
Title: "Grandpa Contract",
Summary: "new grandpa contract",
}

proposalTx, codeHash, err := composabledChain.PushNewWasmClientProposal(ctx, centaurid1User.KeyName(), "ics10_grandpa_cw.wasm", proposal)
proposalTx, codeHash, err := layerdChain.PushNewWasmClientProposal(ctx, centaurid1User.KeyName(), "ics10_grandpa_cw.wasm", proposal)
require.NoError(t, err, "error submitting new wasm contract proposal tx")

height, err := composabledChain.Height(ctx)
height, err := layerdChain.Height(ctx)
require.NoError(t, err, "error fetching height before submit upgrade proposal")

err = composabledChain.VoteOnProposalAllValidators(ctx, proposalTx.ProposalID, cosmos.ProposalVoteYes)
err = layerdChain.VoteOnProposalAllValidators(ctx, proposalTx.ProposalID, cosmos.ProposalVoteYes)
require.NoError(t, err, "failed to submit votes")

_, err = cosmos.PollForProposalStatus(ctx, composabledChain, height, height+heightDelta, proposalTx.ProposalID, cosmos.ProposalStatusPassed)
_, err = cosmos.PollForProposalStatus(ctx, layerdChain, height, height+heightDelta, proposalTx.ProposalID, cosmos.ProposalStatusPassed)
require.NoError(t, err, "proposal status did not change to passed in expected number of blocks")

err = testutil.WaitForBlocks(ctx, 2, composabledChain)
err = testutil.WaitForBlocks(ctx, 2, layerdChain)
require.NoError(t, err)

var getCodeQueryMsgRsp GetCodeQueryMsgResponse
err = composabledChain.QueryClientContractCode(ctx, codeHash, &getCodeQueryMsgRsp)
err = layerdChain.QueryClientContractCode(ctx, codeHash, &getCodeQueryMsgRsp)
codeHashByte32 := sha256.Sum256(getCodeQueryMsgRsp.Code)
codeHash2 := hex.EncodeToString(codeHashByte32[:])
t.Logf("Contract codeHash from code: %s", codeHash2)
Expand Down
6 changes: 3 additions & 3 deletions tests/interchaintest/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ var (
UidGid: "1025:1025",
}

composableConfig = ibc.ChainConfig{
layerConfig = ibc.ChainConfig{
Type: "cosmos",
Name: "composable",
ChainID: "composable-2",
Name: "layer",
ChainID: "layer-2",
Images: []ibc.DockerImage{CentauriImage},
Bin: "layerd",
Bech32Prefix: "layer",
Expand Down
2 changes: 1 addition & 1 deletion tests/interchaintest/upgrade_chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const (
blocksAfterUpgrade = uint64(10)
)

func TestComposableUpgrade(t *testing.T) {
func TestLayerUpgrade(t *testing.T) {
repo, version := GetDockerImageInfo()
CosmosChainUpgradeTest(t, repo, version, "v6")
}
Expand Down
Loading

0 comments on commit e21200c

Please sign in to comment.