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

feat: integrate aura #383

Merged
merged 6 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion .changelog/unreleased/dependencies/259-bump-cctp.md

This file was deleted.

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 @@
"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 @@
"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/[email protected]: 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/[email protected]: 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/[email protected]: invalid version: git ls-remote -q origin in /home/runner/go/pkg/mod/cache/vcs/bf3169fa2d559e7c21b491b6a152e0dd14da633790c18211ce2614cdac699870: exit status 128:
johnletey marked this conversation as resolved.
Show resolved Hide resolved
)

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

// module account permissions
Expand All @@ -167,6 +173,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
globalfee.ModuleName,
cctptypes.ModuleName,
forwardingtypes.ModuleName,
auratypes.ModuleName,
)

app.mm.SetOrderEndBlockers(
Expand Down Expand Up @@ -607,6 +624,7 @@
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 @@
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 (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 @@
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
johnletey marked this conversation as resolved.
Show resolved Hide resolved

// 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
Loading