Skip to content

Commit

Permalink
feat: integrate aura
Browse files Browse the repository at this point in the history
  • Loading branch information
johnletey committed Jun 24, 2024
1 parent fad3a7d commit 8c90953
Show file tree
Hide file tree
Showing 15 changed files with 404 additions and 31 deletions.
1 change: 0 additions & 1 deletion .changelog/unreleased/dependencies/259-bump-cctp.md

This file was deleted.

1 change: 0 additions & 1 deletion .changelog/unreleased/dependencies/357-bump-forwarding.md

This file was deleted.

1 change: 0 additions & 1 deletion .changelog/unreleased/improvements/249-module-path-v4.md

This file was deleted.

1 change: 0 additions & 1 deletion .changelog/unreleased/improvements/259-migrate-ftf.md

This file was deleted.

1 change: 1 addition & 0 deletions .changelog/unreleased/improvements/271-module-path.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Update module path for v5 release line. ([#271](https://github.com/noble-assets/noble/pull/271))
1 change: 0 additions & 1 deletion .changelog/unreleased/improvements/283-module-path.md

This file was deleted.

This file was deleted.

39 changes: 20 additions & 19 deletions .github/workflows/e2e-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@ concurrency:
cancel-in-progress: true

jobs:
build-docker:
build:
runs-on: ubuntu-latest
steps:
- name: Build Docker image
uses: strangelove-ventures/heighliner-build-action@v1.0.2
- name: Build Docker Image
uses: noble-assets/heighliner-build-action@d409c7b0dc2acc05a8218caad581bffae654c953
with:
registry: "" # empty registry, image only shared for e2e testing
tag: local # emulate local environment for consistency in interchaintest cases
tar-export-path: ${{ env.TAR_PATH }} # export a tarball that can be uploaded as an artifact for the e2e jobs
platform: linux/amd64 # test runner architecture only
git-ref: ${{ github.head_ref }} # source code ref
clone-key: ${{ secrets.AURA_SSH_KEY }}

# Heighliner chains.yaml config
chain: noble
Expand All @@ -36,45 +37,45 @@ jobs:
name: noble-docker-image
path: ${{ env.TAR_PATH }}

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

- name: Set up Go 1.21
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '>=1.21'
go-version: '1.21'

- name: Generate matrix
- 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:
test:
needs:
- build-docker
- prepare-e2e-tests
- build
- prepare
runs-on: ubuntu-latest
strategy:
matrix:
# names of `make` commands to run tests
test: ${{fromJson(needs.prepare-e2e-tests.outputs.matrix)}}
test: ${{fromJson(needs.prepare.outputs.matrix)}}
fail-fast: false

steps:
- name: Set up Go 1.21
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '>=1.21'

- name: checkout chain
uses: actions/checkout@v4
go-version: '1.21'

- name: Download Tarball Artifact
uses: actions/download-artifact@v4
Expand All @@ -84,5 +85,5 @@ jobs:
- name: Load Docker Image
run: docker image load -i ${{ env.TAR_PATH }}

- name: run test
- name: Run Tests
run: cd interchaintest && go test -race -v -timeout 30m -run ^${{ matrix.test }}$ .
33 changes: 31 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/staking"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/noble-assets/noble/v5/app/upgrades/krypton"
"github.com/noble-assets/noble/v5/cmd"
"github.com/noble-assets/noble/v5/docs"
"github.com/noble-assets/noble/v5/x/globalfee"
Expand All @@ -111,6 +112,10 @@ import (
"github.com/noble-assets/forwarding/x/forwarding"
forwardingkeeper "github.com/noble-assets/forwarding/x/forwarding/keeper"
forwardingtypes "github.com/noble-assets/forwarding/x/forwarding/types"

"github.com/noble-assets/aura/x/aura"

Check failure on line 116 in app/app.go

View workflow job for this annotation

GitHub Actions / unit-tests

github.com/noble-assets/aura@v0.0.0-20240618110530-44c811a1f60e: invalid version: git ls-remote -q origin in /home/runner/go/pkg/mod/cache/vcs/bf3169fa2d559e7c21b491b6a152e0dd14da633790c18211ce2614cdac699870: exit status 128:
aurakeeper "github.com/noble-assets/aura/x/aura/keeper"

Check failure on line 117 in app/app.go

View workflow job for this annotation

GitHub Actions / unit-tests

github.com/noble-assets/aura@v0.0.0-20240618110530-44c811a1f60e: invalid version: git ls-remote -q origin in /home/runner/go/pkg/mod/cache/vcs/bf3169fa2d559e7c21b491b6a152e0dd14da633790c18211ce2614cdac699870: exit status 128:
auratypes "github.com/noble-assets/aura/x/aura/types"

Check failure on line 118 in app/app.go

View workflow job for this annotation

GitHub Actions / unit-tests

github.com/noble-assets/aura@v0.0.0-20240618110530-44c811a1f60e: invalid version: git ls-remote -q origin in /home/runner/go/pkg/mod/cache/vcs/bf3169fa2d559e7c21b491b6a152e0dd14da633790c18211ce2614cdac699870: exit status 128:
)

const (
Expand Down Expand Up @@ -154,6 +159,7 @@ var (
cctp.AppModuleBasic{},
paramauthorityibc.AppModuleBasic{},
forwarding.AppModuleBasic{},
aura.AppModuleBasic{},
)

// module account permissions
Expand All @@ -167,6 +173,7 @@ var (
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
cctptypes.ModuleName: nil,
auratypes.ModuleName: {authtypes.Burner, authtypes.Minter},
}
)

Expand Down Expand Up @@ -231,6 +238,7 @@ type App struct {
TariffKeeper tariffkeeper.Keeper
CCTPKeeper *cctpkeeper.Keeper
ForwardingKeeper *forwardingkeeper.Keeper
AuraKeeper *aurakeeper.Keeper

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

Expand Down Expand Up @@ -269,7 +277,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, forwardingtypes.StoreKey,
cctptypes.StoreKey, forwardingtypes.StoreKey, auratypes.ModuleName,
)
tkeys := sdk.NewTransientStoreKeys(
paramstypes.TStoreKey,
Expand Down Expand Up @@ -326,13 +334,20 @@ func New(
app.MsgServiceRouter(),
)

app.AuraKeeper = aurakeeper.NewKeeper(
appCodec,
keys[auratypes.ModuleName],
"ausdy",
nil,
)
app.BankKeeper = bankkeeper.NewBaseKeeper(
appCodec,
keys[banktypes.StoreKey],
app.AccountKeeper,
app.GetSubspace(banktypes.ModuleName),
app.BlockedModuleAccountAddrs(),
)
).WithSendCoinsRestriction(app.AuraKeeper.SendRestrictionFn)
app.AuraKeeper.SetBankKeeper(app.BankKeeper)

app.StakingKeeper = stakingkeeper.NewKeeper(
appCodec,
Expand Down Expand Up @@ -548,6 +563,7 @@ func New(
tariff.NewAppModule(appCodec, app.TariffKeeper, app.AccountKeeper, app.BankKeeper),
cctp.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.CCTPKeeper),
forwarding.NewAppModule(app.ForwardingKeeper),
aura.NewAppModule(app.AuraKeeper),
)

// During begin block slashing happens after distr.BeginBlocker so that
Expand Down Expand Up @@ -580,6 +596,7 @@ func New(
globalfee.ModuleName,
cctptypes.ModuleName,
forwardingtypes.ModuleName,
auratypes.ModuleName,
)

app.mm.SetOrderEndBlockers(
Expand Down Expand Up @@ -607,6 +624,7 @@ func New(
tarifftypes.ModuleName,
cctptypes.ModuleName,
forwardingtypes.ModuleName,
auratypes.ModuleName,
)

// NOTE: The genutils module must occur after staking so that pools are
Expand Down Expand Up @@ -639,6 +657,7 @@ func New(
globalfee.ModuleName,
cctptypes.ModuleName,
forwardingtypes.ModuleName,
auratypes.ModuleName,

// this line is used by starport scaffolding # stargate/app/initGenesis
)
Expand Down Expand Up @@ -876,6 +895,14 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
}

func (app *App) setupUpgradeHandlers() {
app.UpgradeKeeper.SetUpgradeHandler(
krypton.UpgradeName,
krypton.CreateUpgradeHandler(
app.mm,
app.configurator,
),
)

upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(fmt.Errorf("failed to read upgrade info from disk: %w", err))
Expand All @@ -887,6 +914,8 @@ func (app *App) setupUpgradeHandlers() {
var storeLoader baseapp.StoreLoader

switch upgradeInfo.Name {
case krypton.UpgradeName:
storeLoader = krypton.CreateStoreLoader(upgradeInfo.Height)
}

if storeLoader != nil {
Expand Down
4 changes: 4 additions & 0 deletions app/upgrades/krypton/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package krypton

// UpgradeName is the name of this specific software upgrade used on-chain.
const UpgradeName = "krypton"
16 changes: 16 additions & 0 deletions app/upgrades/krypton/store.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package krypton

import (
"github.com/cosmos/cosmos-sdk/baseapp"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
auratypes "github.com/noble-assets/aura/x/aura/types"
)

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

return upgradetypes.UpgradeStoreLoader(upgradeHeight, &storeUpgrades)
}
16 changes: 16 additions & 0 deletions app/upgrades/krypton/upgrade.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package krypton

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

func CreateUpgradeHandler(
mm *module.Manager,
cfg module.Configurator,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
return mm.RunMigrations(ctx, cfg, vm)
}
}
8 changes: 6 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ require (
github.com/golang/protobuf v1.5.3
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/noble-assets/aura v0.0.0-20240618110530-44c811a1f60e
github.com/noble-assets/forwarding v1.1.0
github.com/rs/zerolog v1.27.0
github.com/spf13/cast v1.5.1
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.15.0
github.com/strangelove-ventures/paramauthority v1.1.0
github.com/stretchr/testify v1.8.4
github.com/tendermint/tendermint v0.34.27
Expand Down Expand Up @@ -123,11 +126,9 @@ require (
github.com/regen-network/cosmos-proto v0.3.1 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/rs/cors v1.8.3 // indirect
github.com/rs/zerolog v1.27.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/viper v1.15.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect
Expand All @@ -154,6 +155,9 @@ replace (
// use cosmos compatible ChainSafe/go-schnorrkel
github.com/ChainSafe/go-schnorrkel => github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d

// use send restriction compatible cosmos/cosmos-sdk
github.com/cosmos/cosmos-sdk => github.com/noble-assets/cosmos-sdk v0.45.17-0.20240525075530-8fac7fa77ac6

// use macos sonoma compatible cosmos/ledger-cosmos-go
github.com/cosmos/ledger-cosmos-go => github.com/cosmos/ledger-cosmos-go v0.12.4

Expand Down
Loading

0 comments on commit 8c90953

Please sign in to comment.