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

wire up private cctp repo and router repo #241

Merged
merged 22 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions .github/workflows/docker-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,14 @@ jobs:
chain: noble
dockerfile: cosmos
build-target: make install
build-env: |
- GOPRIVATE=github.com/circlefin/noble-cctp
pre-build: |
mkdir -p ~/.ssh
echo "${{ secrets.GITAUTH }}" | base64 -d > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
apk add openssh
git config --global --add url."git@github.com:circlefin/noble-cctp.git".insteadOf "https://github.com/circlefin/noble-cctp"
ssh-keyscan github.com >> ~/.ssh/known_hosts
binaries: |
- /go/bin/nobled
63 changes: 56 additions & 7 deletions .github/workflows/e2e-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ jobs:
chain: noble
dockerfile: cosmos
build-target: make install
build-env: |
- GOPRIVATE=github.com/circlefin/noble-cctp
pre-build: |
mkdir -p ~/.ssh
echo "${{ secrets.GITAUTH }}" | base64 -d > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
apk add openssh
git config --global --add url."git@github.com:circlefin/noble-cctp.git".insteadOf "https://github.com/circlefin/noble-cctp"
ssh-keyscan github.com >> ~/.ssh/known_hosts
binaries: |
- /go/bin/nobled

Expand All @@ -36,23 +45,63 @@ jobs:
name: noble-docker-image
path: ${{ env.TAR_PATH }}

prepare-e2e-tests:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go 1.21
uses: actions/setup-go@v4
with:
go-version: '^1.21'

- name: CCTP private repo auth
run: |
mkdir -p ~/.ssh
echo "${{ secrets.GITAUTH }}" | base64 -d > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan github.com >> ~/.ssh/known_hosts
export GOPRIVATE=github.com/circlefin/noble-cctp
git config --global --add url."git@github.com:circlefin/noble-cctp.git".insteadOf "https://github.com/circlefin/noble-cctp"

- name: Generate matrix
id: set-matrix
run: |
# Run the command and convert its output to a JSON array
TESTS=$(cd interchaintest && go test -list . | grep -v "^ok " | jq -R -s -c 'split("\n")[:-1]')
echo "matrix=${TESTS}" >> $GITHUB_OUTPUT

e2e-tests:
needs: build-docker
needs:
- build-docker
- prepare-e2e-tests
runs-on: ubuntu-latest
strategy:
matrix:
# names of `make` commands to run tests
test: ["ictest-tkn-factory", "ictest-packet-forward", "ictest-paramauthority", "ictest-chain-upgrade-noble-1", "ictest-chain-upgrade-grand-1", "ictest-globalFee", "ictest-ics20-bps-fees", "ictest-client-substitution"]
test: ${{fromJson(needs.prepare-e2e-tests.outputs.matrix)}}
fail-fast: false

steps:
- name: Set up Go 1.19
uses: actions/setup-go@v3
- name: Set up Go 1.21
uses: actions/setup-go@v4
with:
go-version: 1.19
go-version: '^1.21'

- name: checkout chain
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: CCTP private repo auth
run: |
mkdir -p ~/.ssh
echo "${{ secrets.GITAUTH }}" | base64 -d > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan github.com >> ~/.ssh/known_hosts
export GOPRIVATE=github.com/circlefin/noble-cctp
git config --global --add url."git@github.com:circlefin/noble-cctp.git".insteadOf "https://github.com/circlefin/noble-cctp"

- name: Download Tarball Artifact
uses: actions/download-artifact@v3
Expand All @@ -63,4 +112,4 @@ jobs:
run: docker image load -i ${{ env.TAR_PATH }}

- name: run test
run: make ${{ matrix.test }}
run: cd interchaintest && go test -race -v -timeout 30m -run ^${{ matrix.test }}$ .
15 changes: 12 additions & 3 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@ jobs:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.19
go-version: ^1.21

- name: CCTP private repo auth
run: |
mkdir -p ~/.ssh
echo "${{ secrets.GITAUTH }}" | base64 -d > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan github.com >> ~/.ssh/known_hosts
export GOPRIVATE=github.com/circlefin/noble-cctp
git config --global --add url."git@github.com:circlefin/noble-cctp.git".insteadOf "https://github.com/circlefin/noble-cctp"

- name: Run Unit Tests
run: go test -v ./...
24 changes: 0 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,30 +102,6 @@ lint:
test:
go test -v -race ./...

ictest-tkn-factory:
cd interchaintest && go test -race -v -run ^TestNobleChain$$ .

ictest-packet-forward:
cd interchaintest && go test -race -v -run ^TestPacketForwardMiddleware$$ .

ictest-paramauthority:
cd interchaintest && go test -race -v -run ^TestNobleParamAuthority$$ .

ictest-chain-upgrade-grand-1:
cd interchaintest && go test -race -v -timeout 15m -run ^TestGrand1ChainUpgrade$$ .

ictest-chain-upgrade-noble-1:
cd interchaintest && go test -race -v -timeout 15m -run ^TestNoble1ChainUpgrade$$ .

ictest-globalFee:
cd interchaintest && go test -race -v -run ^TestGlobalFee$$ .

ictest-ics20-bps-fees:
cd interchaintest && go test -race -v -run ^TestICS20BPSFees$$ .

ictest-client-substitution:
cd interchaintest && go test -race -v -run ^TestClientSubstitution$$ .

###############################################################################
### Build Image ###
###############################################################################
Expand Down
64 changes: 60 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ import (
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/strangelove-ventures/noble/app/upgrades/argon"
"github.com/strangelove-ventures/noble/app/upgrades/argon4"
"github.com/strangelove-ventures/noble/app/upgrades/neon"
"github.com/strangelove-ventures/noble/app/upgrades/radon"
"github.com/strangelove-ventures/noble/cmd"
Expand All @@ -106,6 +107,13 @@ import (
tokenfactorymodule "github.com/strangelove-ventures/noble/x/tokenfactory"
tokenfactorymodulekeeper "github.com/strangelove-ventures/noble/x/tokenfactory/keeper"
tokenfactorymoduletypes "github.com/strangelove-ventures/noble/x/tokenfactory/types"

cctp "github.com/circlefin/noble-cctp/x/cctp"
cctpkeeper "github.com/circlefin/noble-cctp/x/cctp/keeper"
cctptypes "github.com/circlefin/noble-cctp/x/cctp/types"
router "github.com/strangelove-ventures/noble-router/x/router"
routerkeeper "github.com/strangelove-ventures/noble-router/x/router/keeper"
routertypes "github.com/strangelove-ventures/noble-router/x/router/types"
)

const (
Expand Down Expand Up @@ -146,6 +154,9 @@ var (
packetforward.AppModuleBasic{},
globalfee.AppModuleBasic{},
tariff.AppModuleBasic{},
cctp.AppModuleBasic{},
router.AppModuleBasic{},
paramauthorityibc.AppModuleBasic{},
)

// module account permissions
Expand All @@ -158,7 +169,7 @@ var (
fiattokenfactorymoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
// this line is used by starport scaffolding # stargate/app/maccPerms
cctptypes.ModuleName: nil,
}
)

Expand Down Expand Up @@ -221,6 +232,8 @@ type App struct {
TokenFactoryKeeper *tokenfactorymodulekeeper.Keeper
FiatTokenFactoryKeeper *fiattokenfactorymodulekeeper.Keeper
TariffKeeper tariffkeeper.Keeper
CCTPKeeper *cctpkeeper.Keeper
RouterKeeper *routerkeeper.Keeper

// this line is used by starport scaffolding # stargate/app/keeperDeclaration

Expand Down Expand Up @@ -259,6 +272,7 @@ func New(
paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, evidencetypes.StoreKey,
ibctransfertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey,
tokenfactorymoduletypes.StoreKey, fiattokenfactorymoduletypes.StoreKey, packetforwardtypes.StoreKey, stakingtypes.StoreKey,
cctptypes.StoreKey, routertypes.StoreKey,
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
Expand Down Expand Up @@ -459,6 +473,25 @@ func New(
)
fiattokenfactorymodule := fiattokenfactorymodule.NewAppModule(appCodec, app.FiatTokenFactoryKeeper, app.AccountKeeper, app.BankKeeper)

app.RouterKeeper = routerkeeper.NewKeeper(
appCodec,
keys[routertypes.StoreKey],
app.GetSubspace(routertypes.ModuleName),
app.CCTPKeeper,
app.TransferKeeper,
)

app.CCTPKeeper = cctpkeeper.NewKeeper(
appCodec,
keys[cctptypes.StoreKey],
app.GetSubspace(cctptypes.ModuleName),
app.BankKeeper,
app.FiatTokenFactoryKeeper,
app.RouterKeeper,
)

app.RouterKeeper.SetCctpKeeper(app.CCTPKeeper)

var transferStack ibcporttypes.IBCModule
transferStack = transfer.NewIBCModule(app.TransferKeeper)
transferStack = packetforward.NewIBCMiddleware(
Expand All @@ -468,6 +501,7 @@ func New(
packetforwardkeeper.DefaultForwardTransferPacketTimeoutTimestamp,
packetforwardkeeper.DefaultRefundTransferPacketTimeoutTimestamp,
)
transferStack = router.NewIBCMiddleware(transferStack, app.RouterKeeper)
transferStack = blockibc.NewIBCMiddleware(transferStack, app.TokenFactoryKeeper, app.FiatTokenFactoryKeeper)

// Create static IBC router, add transfer route, then set and seal it
Expand Down Expand Up @@ -513,6 +547,8 @@ func New(
staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
globalfee.NewAppModule(app.GetSubspace(globalfee.ModuleName)),
tariff.NewAppModule(appCodec, app.TariffKeeper, app.AccountKeeper, app.BankKeeper),
cctp.NewAppModule(appCodec, app.CCTPKeeper),
router.NewAppModule(appCodec, app.RouterKeeper),
)

// During begin block slashing happens after distr.BeginBlocker so that
Expand Down Expand Up @@ -543,6 +579,8 @@ func New(
tokenfactorymoduletypes.ModuleName,
fiattokenfactorymoduletypes.ModuleName,
globalfee.ModuleName,
cctptypes.ModuleName,
routertypes.ModuleName,
)

app.mm.SetOrderEndBlockers(
Expand All @@ -568,6 +606,8 @@ func New(
fiattokenfactorymoduletypes.ModuleName,
globalfee.ModuleName,
tarifftypes.ModuleName,
cctptypes.ModuleName,
routertypes.ModuleName,
)

// NOTE: The genutils module must occur after staking so that pools are
Expand Down Expand Up @@ -598,16 +638,15 @@ func New(
tokenfactorymoduletypes.ModuleName,
fiattokenfactorymoduletypes.ModuleName,
globalfee.ModuleName,
cctptypes.ModuleName,
routertypes.ModuleName,

// this line is used by starport scaffolding # stargate/app/initGenesis
)

// Uncomment if you want to set a custom migration order here.
// app.mm.SetOrderMigrations(custom order)

// Register interfaces for paramauthority ibc proposal shim
paramauthorityibctypes.RegisterInterfaces(interfaceRegistry)

app.mm.RegisterInvariants(&app.CrisisKeeper)
app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino)

Expand Down Expand Up @@ -840,6 +879,8 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(fiattokenfactorymoduletypes.ModuleName)
paramsKeeper.Subspace(upgradetypes.ModuleName)
paramsKeeper.Subspace(globalfee.ModuleName)
paramsKeeper.Subspace(cctptypes.ModuleName)
paramsKeeper.Subspace(routertypes.ModuleName)
// this line is used by starport scaffolding # stargate/app/paramSubspace

return paramsKeeper
Expand Down Expand Up @@ -872,6 +913,19 @@ func (app *App) setupUpgradeHandlers() {
argon.CreateUpgradeHandler(
app.mm,
app.configurator,
app.FiatTokenFactoryKeeper,
app.ParamsKeeper,
app.CCTPKeeper,
app.RouterKeeper,
),
)

// argon4 upgrade
app.UpgradeKeeper.SetUpgradeHandler(
argon4.UpgradeName,
argon4.CreateUpgradeHandler(
app.mm,
app.configurator,
),
)

Expand All @@ -892,6 +946,8 @@ func (app *App) setupUpgradeHandlers() {
storeLoader = radon.CreateStoreLoader(upgradeInfo.Height)
case argon.UpgradeName:
storeLoader = argon.CreateStoreLoader(upgradeInfo.Height)
case argon4.UpgradeName:
storeLoader = argon4.CreateStoreLoader(upgradeInfo.Height)
}

if storeLoader != nil {
Expand Down
8 changes: 7 additions & 1 deletion app/upgrades/argon/store.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
package argon

import (
cctptypes "github.com/circlefin/noble-cctp/x/cctp/types"
"github.com/cosmos/cosmos-sdk/baseapp"
storeTypes "github.com/cosmos/cosmos-sdk/store/types"
upgradeTypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
routertypes "github.com/strangelove-ventures/noble-router/x/router/types"
)

func CreateStoreLoader(upgradeHeight int64) baseapp.StoreLoader {
storeUpgrades := storeTypes.StoreUpgrades{}
storeUpgrades := storeTypes.StoreUpgrades{
Added: []string{
cctptypes.ModuleName, routertypes.ModuleName,
},
}

return upgradeTypes.UpgradeStoreLoader(upgradeHeight, &storeUpgrades)
}
Loading
Loading