Skip to content

Commit

Permalink
feat: network upgrade v0.38.0
Browse files Browse the repository at this point in the history
refs akash-network/AEP#4

Signed-off-by: Artur Troian <troian.ap@gmail.com>
  • Loading branch information
troian committed Feb 19, 2025
1 parent 42debb1 commit 65aec89
Show file tree
Hide file tree
Showing 65 changed files with 3,758 additions and 1,354 deletions.
1 change: 1 addition & 0 deletions .github/.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github.com/akash-network/node
8 changes: 8 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ jobs:
network-upgrade-names:
runs-on: upgrade-tester
steps:
- name: Cleanup build folder
run: |
sudo rm -rf ./* || true
sudo rm -rf ./.??* || true
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow
- name: Detect required Go version
Expand Down Expand Up @@ -209,6 +213,10 @@ jobs:
network-upgrade:
runs-on: upgrade-tester
steps:
- name: Cleanup build folder
run: |
sudo rm -rf ./* || true
sudo rm -rf ./.??* || true
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow
- name: Detect required Go version
Expand Down
1 change: 1 addition & 0 deletions .goreleaser-docker.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
version: 2
project_name: node
dist: ./.cache/goreleaser/docker
env:
- GO111MODULE=on
- CGO_ENABLED=1
Expand Down
102 changes: 102 additions & 0 deletions .goreleaser-test-bins.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
project_name: node
version: 2
dist: ./.cache/goreleaser/test-bins
env:
- GO111MODULE=on
- CGO_ENABLED=1
builds:
- id: akash-darwin-amd64
binary: akash
main: ./cmd/akash
goarch:
- amd64
goos:
- darwin
env:
- CC=o64-clang
- CXX=o64-clang++
flags:
- "-mod={{ .Env.MOD }}"
- "-tags={{ .Env.BUILD_TAGS }}"
- -trimpath
ldflags:
- "{{ .Env.BUILD_VARS }}"
- "{{ .Env.STRIP_FLAGS }}"
- "-linkmode={{ .Env.LINKMODE }}"
- id: akash-darwin-arm64
binary: akash
main: ./cmd/akash
goarch:
- arm64
goos:
- darwin
env:
- CC=oa64-clang
- CXX=oa64-clang++
flags:
- "-mod={{ .Env.MOD }}"
- "-tags={{ .Env.BUILD_TAGS }}"
- -trimpath
ldflags:
- "{{ .Env.BUILD_VARS }}"
- "{{ .Env.STRIP_FLAGS }}"
- "-linkmode={{ .Env.LINKMODE }}"
- id: akash-linux-amd64
binary: akash
main: ./cmd/akash
env:
- CC=x86_64-linux-gnu-gcc
- CXX=x86_64-linux-gnu-g++
goarch:
- amd64
goos:
- linux
flags:
- "-mod={{ .Env.MOD }}"
- "-tags={{ .Env.BUILD_TAGS }}"
- -trimpath
ldflags:
- "{{ .Env.BUILD_VARS }}"
- "{{ .Env.STRIP_FLAGS }}"
- "-linkmode={{ .Env.LINKMODE }}"
- -extldflags "-lc -lrt -lpthread --static"
- id: akash-linux-arm64
binary: akash
main: ./cmd/akash
goarch:
- arm64
goos:
- linux
env:
- CC=aarch64-linux-gnu-gcc
- CXX=aarch64-linux-gnu-g++
flags:
- "-mod={{ .Env.MOD }}"
- "-tags={{ .Env.BUILD_TAGS }}"
- -trimpath
ldflags:
- "{{ .Env.BUILD_VARS }}"
- "{{ .Env.STRIP_FLAGS }}"
- "-linkmode={{ .Env.LINKMODE }}"
- -extldflags "-lc -lrt -lpthread --static"
universal_binaries:
- id: akash-darwin-universal
ids:
- akash-darwin-amd64
- akash-darwin-arm64
replace: true
name_template: "akash"

archives:
- id: wo/version
builds:
- akash-darwin-universal
- akash-linux-amd64
- akash-linux-arm64
name_template: "akash_{{ .Os }}_{{ .Arch }}"
wrap_in_directory: false
formats:
- zip
files:
- none*
6 changes: 4 additions & 2 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ archives:
- akash-windows-amd64
name_template: "akash_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
wrap_in_directory: false
format: zip
formats:
- zip
files:
- none*
- id: wo/version
Expand All @@ -126,7 +127,8 @@ archives:
- akash-windows-amd64
name_template: "akash_{{ .Os }}_{{ .Arch }}"
wrap_in_directory: false
format: zip
formats:
- zip
files:
- none*

Expand Down
71 changes: 40 additions & 31 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"path/filepath"
"time"

"github.com/cosmos/cosmos-sdk/x/authz"
"github.com/cosmos/cosmos-sdk/x/feegrant"
feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper"
feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module"
Expand Down Expand Up @@ -113,6 +114,10 @@ var (
allowedReceivingModAcc = map[string]bool{}
)

type ModulesStoreKeys map[string]*sdk.KVStoreKey
type ModulesTransientKeys map[string]*sdk.TransientStoreKey
type ModulesMemoryKeys map[string]*sdk.MemoryStoreKey

// AkashApp extends ABCI application
type AkashApp struct {
*bam.BaseApp
Expand All @@ -123,9 +128,9 @@ type AkashApp struct {

invCheckPeriod uint

keys map[string]*sdk.KVStoreKey
tkeys map[string]*sdk.TransientStoreKey
memkeys map[string]*sdk.MemoryStoreKey
skeys ModulesStoreKeys
tkeys ModulesTransientKeys
memkeys ModulesMemoryKeys

// simulation manager
sm *module.SimulationManager
Expand All @@ -145,9 +150,6 @@ func NewApp(
appOpts servertypes.AppOptions,
options ...func(*bam.BaseApp),
) *AkashApp {
// find out the genesis time, to be used later in inflation calculation
// genesisTime := getGenesisTime(appOpts, homePath)

// TODO: Remove cdc in favor of appCodec once all modules are migrated.
encodingConfig := MakeEncodingConfig()
appCodec := encodingConfig.Marshaler
Expand All @@ -159,32 +161,32 @@ func NewApp(
bapp.SetVersion(version.Version)
bapp.SetInterfaceRegistry(interfaceRegistry)

keys := kvStoreKeys()
tkeys := transientStoreKeys()
memkeys := memStoreKeys()
skeys := modulesStoreKeys()
tkeys := modulesTransientKeys()
memkeys := modulesMemoryKeys()

app := &AkashApp{
BaseApp: bapp,
cdc: cdc,
appCodec: appCodec,
interfaceRegistry: interfaceRegistry,
invCheckPeriod: invCheckPeriod,
keys: keys,
skeys: skeys,
tkeys: tkeys,
memkeys: memkeys,
}
app.Configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter())

app.Keepers.Cosmos.Params = initParamsKeeper(appCodec, cdc, app.keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey])
app.Keepers.Cosmos.Params = initParamsKeeper(appCodec, cdc, app.skeys[paramstypes.ModuleName], tkeys[paramstypes.ModuleName])

// set the BaseApp's parameter store
bapp.SetParamStore(app.Keepers.Cosmos.Params.Subspace(bam.Paramspace).WithKeyTable(paramskeeper.ConsensusParamsKeyTable()))

// add capability keeper and ScopeToModule for ibc module
app.Keepers.Cosmos.Cap = capabilitykeeper.NewKeeper(
appCodec,
app.keys[capabilitytypes.StoreKey],
app.memkeys[capabilitytypes.MemStoreKey],
app.skeys[capabilitytypes.ModuleName],
app.memkeys[capabilitytypes.ModuleName],
)

scopedIBCKeeper := app.Keepers.Cosmos.Cap.ScopeToModule(ibchost.ModuleName)
Expand All @@ -196,24 +198,24 @@ func NewApp(

app.Keepers.Cosmos.Acct = authkeeper.NewAccountKeeper(
appCodec,
app.keys[authtypes.StoreKey],
app.skeys[authtypes.ModuleName],
app.GetSubspace(authtypes.ModuleName),
authtypes.ProtoBaseAccount,
MacPerms(),
)

// add authz keeper
app.Keepers.Cosmos.Authz = authzkeeper.NewKeeper(app.keys[authzkeeper.StoreKey], appCodec, app.MsgServiceRouter())
app.Keepers.Cosmos.Authz = authzkeeper.NewKeeper(app.skeys[authz.ModuleName], appCodec, app.MsgServiceRouter())

app.Keepers.Cosmos.FeeGrant = feegrantkeeper.NewKeeper(
appCodec,
keys[feegrant.StoreKey],
skeys[feegrant.ModuleName],
app.Keepers.Cosmos.Acct,
)

app.Keepers.Cosmos.Bank = bankkeeper.NewBaseKeeper(
appCodec,
app.keys[banktypes.StoreKey],
app.skeys[banktypes.ModuleName],
app.Keepers.Cosmos.Acct,
app.GetSubspace(banktypes.ModuleName),
app.BlockedAddrs(),
Expand All @@ -224,7 +226,7 @@ func NewApp(
{
skeeper := stakingkeeper.NewKeeper(
appCodec,
app.keys[stakingtypes.StoreKey],
app.skeys[stakingtypes.ModuleName],
app.Keepers.Cosmos.Acct,
app.Keepers.Cosmos.Bank,
app.GetSubspace(stakingtypes.ModuleName),
Expand All @@ -234,7 +236,7 @@ func NewApp(

app.Keepers.Cosmos.Mint = mintkeeper.NewKeeper(
appCodec,
app.keys[minttypes.StoreKey],
app.skeys[minttypes.ModuleName],
app.GetSubspace(minttypes.ModuleName),
app.Keepers.Cosmos.Staking,
app.Keepers.Cosmos.Acct,
Expand All @@ -244,7 +246,7 @@ func NewApp(

app.Keepers.Cosmos.Distr = distrkeeper.NewKeeper(
appCodec,
app.keys[distrtypes.StoreKey],
app.skeys[distrtypes.ModuleName],
app.GetSubspace(distrtypes.ModuleName),
app.Keepers.Cosmos.Acct,
app.Keepers.Cosmos.Bank,
Expand All @@ -255,7 +257,7 @@ func NewApp(

app.Keepers.Cosmos.Slashing = slashingkeeper.NewKeeper(
appCodec,
app.keys[slashingtypes.StoreKey],
app.skeys[slashingtypes.ModuleName],
app.Keepers.Cosmos.Staking,
app.GetSubspace(slashingtypes.ModuleName),
)
Expand All @@ -278,7 +280,7 @@ func NewApp(

app.Keepers.Cosmos.Upgrade = upgradekeeper.NewKeeper(
skipUpgradeHeights,
app.keys[upgradetypes.StoreKey],
app.skeys[upgradetypes.ModuleName],
appCodec,
homePath,
app.BaseApp,
Expand All @@ -287,7 +289,7 @@ func NewApp(
// register IBC Keeper
app.Keepers.Cosmos.IBC = ibckeeper.NewKeeper(
appCodec,
app.keys[ibchost.StoreKey],
app.skeys[ibchost.ModuleName],
app.GetSubspace(ibchost.ModuleName),
app.Keepers.Cosmos.Staking,
app.Keepers.Cosmos.Upgrade,
Expand Down Expand Up @@ -316,7 +318,7 @@ func NewApp(

app.Keepers.Cosmos.Gov = govkeeper.NewKeeper(
appCodec,
app.keys[govtypes.StoreKey],
app.skeys[govtypes.ModuleName],
app.GetSubspace(govtypes.ModuleName),
app.Keepers.Cosmos.Acct,
app.Keepers.Cosmos.Bank,
Expand All @@ -327,7 +329,7 @@ func NewApp(
// register Transfer Keepers
app.Keepers.Cosmos.Transfer = ibctransferkeeper.NewKeeper(
appCodec,
app.keys[ibctransfertypes.StoreKey],
app.skeys[ibctransfertypes.ModuleName],
app.GetSubspace(ibctransfertypes.ModuleName),
app.Keepers.Cosmos.IBC.ChannelKeeper,
app.Keepers.Cosmos.IBC.ChannelKeeper,
Expand All @@ -349,7 +351,7 @@ func NewApp(
// create evidence keeper with evidence router
evidenceKeeper := evidencekeeper.NewKeeper(
appCodec,
app.keys[evidencetypes.StoreKey],
app.skeys[evidencetypes.ModuleName],
app.Keepers.Cosmos.Staking,
app.Keepers.Cosmos.Slashing,
)
Expand Down Expand Up @@ -411,6 +413,13 @@ func NewApp(
app.MM.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino)
app.MM.RegisterServices(app.Configurator)

utypes.IterateMigrations(func(module string, version uint64, initfn utypes.NewMigrationFn) {
migrator := initfn(utypes.NewMigrator(app.appCodec, app.skeys[module]))
if err := app.Configurator.RegisterMigration(module, version, migrator.GetHandler()); err != nil {
panic(err)
}
})

// add test gRPC service for testing gRPC queries in isolation
testdata.RegisterQueryServer(app.GRPCQueryRouter(), testdata.QueryImpl{})

Expand Down Expand Up @@ -440,7 +449,7 @@ func NewApp(
app.sm.RegisterStoreDecoders()

// initialize stores
app.MountKVStores(keys)
app.MountKVStores(app.skeys.Keys())
app.MountTransientStores(tkeys)
app.MountMemoryStores(memkeys)

Expand Down Expand Up @@ -577,13 +586,13 @@ func (app *AkashApp) InterfaceRegistry() codectypes.InterfaceRegistry {
}

// GetKey returns the KVStoreKey for the provided store key.
func (app *AkashApp) GetKey(storeKey string) *sdk.KVStoreKey {
return app.keys[storeKey]
func (app *AkashApp) GetKey(module string) *sdk.KVStoreKey {
return app.skeys[module]
}

// GetTKey returns the TransientStoreKey for the provided store key.
func (app *AkashApp) GetTKey(storeKey string) *sdk.TransientStoreKey {
return app.tkeys[storeKey]
func (app *AkashApp) GetTKey(module string) *sdk.TransientStoreKey {
return app.tkeys[module]
}

// GetSubspace returns a param subspace for a given module name.
Expand Down
Loading

0 comments on commit 65aec89

Please sign in to comment.