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

Changes since latest mainnet release #62

Closed
wants to merge 54 commits into from
Closed
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
e4ea78b
add stars airdrop command
go7066 Oct 24, 2022
e84c4d6
resolve double airdrop allocation
go7066 Oct 24, 2022
c0c2a8b
add airdrop module account query
go7066 Oct 24, 2022
caa8970
update script for further stars allocation
go7066 Nov 7, 2022
855b3e8
Cosmwasm state sync support
effofxprime Nov 12, 2022
e10a2ea
Merge pull request #56 from effofxprime/cosmwasm-statesync
go7066 Nov 17, 2022
f6d991c
in progress codebase for intertx
go7066 Nov 18, 2022
a2b7774
Merge branch 'main' of github.com:NXTPOP/teritori-chain into ica_cont…
go7066 Nov 22, 2022
9729c30
- Resolve intertx package import issue
go7066 Nov 22, 2022
e4f7274
- Resolve interface for teritori app to be compatible with IBC test app
go7066 Nov 23, 2022
d00ac4c
Write upgrade handler for v140 for ica controller params
go7066 Nov 24, 2022
b80c07a
update upgrade test script
go7066 Nov 30, 2022
f3d921f
add test configuration for relayers and network setup
go7066 Dec 1, 2022
035d6d2
add ibc test result
go7066 Dec 2, 2022
09c8603
Merge pull request #57 from TERITORI/ica_controller
go7066 Dec 2, 2022
14bc8ba
add prune command
go7066 Dec 8, 2022
54af981
Merge branch 'main' of github.com:NXTPOP/teritori-chain
go7066 Dec 8, 2022
54c32c6
Update README.md
omniwired Dec 21, 2022
d20bb5d
Merge pull request #63 from omniwired/patch-1
zdeadex Dec 22, 2022
d4e2027
remove vesting delegation preventor
go7066 Feb 6, 2023
13752ae
add upgrade handler for v1.3.1
go7066 Feb 6, 2023
0801739
add richest snapshot script
go7066 May 22, 2023
adf8b2b
Create msg endpoint for burn message
go7066 May 22, 2023
4dbf138
implement changes for burn tokens endpoint
go7066 May 22, 2023
b5be794
register mint module msg interface & test burn token feature with cli
go7066 May 23, 2023
d4707da
Merge branch 'enable_vesting_delegation' of github.com:NXTPOP/teritor…
go7066 May 23, 2023
d0c6505
v140 upgrade test
go7066 May 24, 2023
e08216d
Merge pull request #69 from TERITORI/v140_upgrade
go7066 May 29, 2023
01f60ec
resolve build error on v131 upgrade handler
go7066 May 29, 2023
34d6252
update for go mod
go7066 Nov 20, 2023
da85689
update on build issue fix
go7066 Nov 21, 2023
dac7aa2
Resolve AccountKeeper, BankKeeper, AuthzKeeper, StakingKeeper, Slashi…
go7066 Nov 22, 2023
d5a0d98
Add IBCFeeKeeper and use it on IBC keepers & Update ExportAppStateAnd…
go7066 Nov 22, 2023
18db455
update on fixing build issues
go7066 Nov 24, 2023
677b86c
Resolve undefined: types.Pallas issue
go7066 Nov 28, 2023
8d7e925
protobuf update and panic fixes
go7066 Nov 30, 2023
d1ccfb4
unit test fixes
go7066 Dec 5, 2023
6c5cdf6
resolve node start issue
go7066 Dec 6, 2023
dab0f48
Upgrade Cosmos sdk version from v0.47.5 to v0.47.6
go7066 Dec 6, 2023
3f7f8e9
add groups module
go7066 Dec 6, 2023
fba9666
Add TotalBurntAmount calculator on BurnTokens tx
go7066 Dec 11, 2023
59f2134
add more queries and basic upgrade handler
go7066 Dec 15, 2023
6290191
add one more item to check
go7066 Dec 15, 2023
056de35
resolve issues in upgrade test
go7066 Dec 29, 2023
6234488
feat: teritori-test-4
n0izn0iz Jan 3, 2024
f9e7734
chore: CI
n0izn0iz Jan 4, 2024
b72093d
fix: add wasm module account (#75)
go7066 Jan 5, 2024
f0a774e
feat: teritori-test-5 (#77)
n0izn0iz Jan 5, 2024
1c560ae
Merge branch 'main' of github.com:NXTPOP/teritori-chain into sdk_upgrade
go7066 Jan 10, 2024
182d8d7
upgrade wasmvm version to v1.3.1 for patch
go7066 Jan 10, 2024
959eaad
resolve unit tests
go7066 Jan 11, 2024
41d398c
update total burnt amount to correct amount
go7066 Jan 11, 2024
d7e89c5
Merge pull request #72 from TERITORI/sdk_upgrade
go7066 Jan 11, 2024
401e458
fix: docker build (#78)
n0izn0iz Jan 11, 2024
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
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,34 @@ proto-gen:
@echo "Generating Protobuf files"
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGen}$$"; then docker start -a $(containerProtoGen); else docker run --name $(containerProtoGen) -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) \
sh ./scripts/protocgen.sh; fi

init-hermes: kill-dev install
@echo "Initializing both blockchains..."
./network/init.sh
./network/start.sh
@echo "Initializing relayer..."
./network/hermes/restore-keys.sh
./network/hermes/create-conn.sh

init-golang-rly: kill-dev install
@echo "Initializing both blockchains..."
./network/init.sh
./network/start.sh
@echo "Initializing relayer..."
./network/relayer/interchain-acc-config/rly.sh

start:
@echo "Starting up test network"
./network/start.sh

start-hermes:
./network/hermes/start.sh

start-rly:
./network/hermes/start.sh

kill-dev:
@echo "Killing icad and removing previous data"
-@rm -rf ./data
-@killall icad 2>/dev/null
-@killall teritorid 2>/dev/null
149 changes: 106 additions & 43 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import (
"path/filepath"
"strings"

"github.com/TERITORI/teritori-chain/app/keepers"
"github.com/TERITORI/teritori-chain/app/upgrades"
v130 "github.com/TERITORI/teritori-chain/app/upgrades/v130"
v140 "github.com/TERITORI/teritori-chain/app/upgrades/v140"
airdrop "github.com/TERITORI/teritori-chain/x/airdrop"
airdropkeeper "github.com/TERITORI/teritori-chain/x/airdrop/keeper"
airdroptypes "github.com/TERITORI/teritori-chain/x/airdrop/types"
Expand Down Expand Up @@ -83,6 +85,9 @@ import (
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
ica "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts"
icacontroller "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller"
icacontrollerkeeper "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller/keeper"
icacontrollertypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller/types"
icahost "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host"
icahostkeeper "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/keeper"
icahosttypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/types"
Expand All @@ -106,6 +111,10 @@ import (
tmos "github.com/tendermint/tendermint/libs/os"
dbm "github.com/tendermint/tm-db"

intertx "github.com/TERITORI/teritori-chain/x/intertx"
intertxkeeper "github.com/TERITORI/teritori-chain/x/intertx/keeper"
intertxtypes "github.com/TERITORI/teritori-chain/x/intertx/types"

teritoriappparams "github.com/TERITORI/teritori-chain/app/params"
"github.com/strangelove-ventures/packet-forward-middleware/v2/router"
routerkeeper "github.com/strangelove-ventures/packet-forward-middleware/v2/router/keeper"
Expand Down Expand Up @@ -180,7 +189,7 @@ var (
// DefaultNodeHome default home directories for the application daemon
DefaultNodeHome string

Upgrades = []upgrades.Upgrade{v130.Upgrade}
Upgrades = []upgrades.Upgrade{v130.Upgrade, v140.Upgrade}

// ModuleBasics defines the module BasicManager is in charge of setting up basic,
// non-dependant module elements, such as codec registration
Expand Down Expand Up @@ -215,6 +224,7 @@ var (
router.AppModuleBasic{},
wasm.AppModuleBasic{},
ica.AppModuleBasic{},
intertx.AppModule{},
)

// module account permissions
Expand All @@ -241,6 +251,8 @@ var (
// capabilities aren't needed for testing.
type TeritoriApp struct { // nolint: golint
*baseapp.BaseApp
keepers.AppKeepers

legacyAmino *codec.LegacyAmino
appCodec codec.Codec
interfaceRegistry types.InterfaceRegistry
Expand All @@ -252,35 +264,6 @@ type TeritoriApp struct { // nolint: golint
tkeys map[string]*sdk.TransientStoreKey
memKeys map[string]*sdk.MemoryStoreKey

// keepers
AccountKeeper authkeeper.AccountKeeper
BankKeeper bankkeeper.Keeper
CapabilityKeeper *capabilitykeeper.Keeper
StakingKeeper stakingkeeper.Keeper
SlashingKeeper slashingkeeper.Keeper
MintKeeper mintkeeper.Keeper
DistrKeeper distrkeeper.Keeper
GovKeeper govkeeper.Keeper
CrisisKeeper crisiskeeper.Keeper
UpgradeKeeper upgradekeeper.Keeper
ParamsKeeper paramskeeper.Keeper
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
ICAHostKeeper icahostkeeper.Keeper
EvidenceKeeper evidencekeeper.Keeper
TransferKeeper ibctransferkeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
AuthzKeeper authzkeeper.Keeper
RouterKeeper routerkeeper.Keeper
AirdropKeeper airdropkeeper.Keeper

// make scoped keepers public for test purposes
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
ScopedICAHostKeeper capabilitykeeper.ScopedKeeper

WasmKeeper wasm.Keeper
scopedWasmKeeper capabilitykeeper.ScopedKeeper

// the module manager
mm *module.Manager

Expand Down Expand Up @@ -326,9 +309,11 @@ func NewTeritoriApp(
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey,
evidencetypes.StoreKey, ibctransfertypes.StoreKey,
capabilitytypes.StoreKey, feegrant.StoreKey, authzkeeper.StoreKey, routertypes.StoreKey,
icacontrollertypes.StoreKey,
icahosttypes.StoreKey,
airdroptypes.StoreKey,
wasm.StoreKey,
intertxtypes.StoreKey,
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
Expand Down Expand Up @@ -360,9 +345,11 @@ func NewTeritoriApp(
app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey])
scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibchost.ModuleName)
scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
scopedInterTxKeeper := app.CapabilityKeeper.ScopeToModule(intertxtypes.ModuleName)
scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName)
scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName)

scopedWasmKeeper := app.CapabilityKeeper.ScopeToModule(wasm.ModuleName)
scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName)

// add keepers
app.AccountKeeper = authkeeper.NewAccountKeeper(
Expand Down Expand Up @@ -475,16 +462,24 @@ func NewTeritoriApp(
transferModule := transfer.NewAppModule(app.TransferKeeper)
transferIBCModule := transfer.NewIBCModule(app.TransferKeeper)

app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper(
appCodec, keys[icacontrollertypes.StoreKey], app.GetSubspace(icacontrollertypes.SubModuleName),
app.IBCKeeper.ChannelKeeper, // may be replaced with middleware such as ics29 fee
app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper,
scopedICAControllerKeeper, app.MsgServiceRouter(),
)
app.ICAHostKeeper = icahostkeeper.NewKeeper(
appCodec, keys[icahosttypes.StoreKey],
app.GetSubspace(icahosttypes.SubModuleName),
app.IBCKeeper.ChannelKeeper,
&app.IBCKeeper.PortKeeper,
app.AccountKeeper,
scopedICAHostKeeper,
app.MsgServiceRouter(),
appCodec, keys[icahosttypes.StoreKey], app.GetSubspace(icahosttypes.SubModuleName),
app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper,
app.AccountKeeper, scopedICAHostKeeper, app.MsgServiceRouter(),
)
icaModule := ica.NewAppModule(nil, &app.ICAHostKeeper)
icaModule := ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper)

app.InterTxKeeper = intertxkeeper.NewKeeper(appCodec, keys[intertxtypes.StoreKey], app.ICAControllerKeeper, scopedInterTxKeeper)
interTxModule := intertx.NewAppModule(appCodec, app.InterTxKeeper)
interTxIBCModule := intertx.NewIBCModule(app.InterTxKeeper)

icaControllerIBCModule := icacontroller.NewIBCModule(app.ICAControllerKeeper, interTxIBCModule)
icaHostIBCModule := icahost.NewIBCModule(app.ICAHostKeeper)

app.RouterKeeper = routerkeeper.NewKeeper(appCodec, keys[routertypes.StoreKey], app.GetSubspace(routertypes.ModuleName), app.TransferKeeper, app.DistrKeeper)
Expand All @@ -508,6 +503,8 @@ func NewTeritoriApp(
panic("error while reading wasm config: " + err.Error())
}

app.setupUpgradeStoreLoaders()

// The last arguments can contain custom message handlers, and custom query handlers,
// if we want to allow any custom callbacks
supportedFeatures := "iterator,staking,stargate"
Expand Down Expand Up @@ -538,10 +535,13 @@ func NewTeritoriApp(
govRouter.AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.WasmKeeper, enabledProposals))
}

// create static IBC router, add transfer route, then set and seal it
// Create static IBC router, add transfer route, then set and seal it
ibcRouter := porttypes.NewRouter()
ibcRouter.AddRoute(icahosttypes.SubModuleName, icaHostIBCModule).
AddRoute(ibctransfertypes.ModuleName, transferIBCModule)
ibcRouter.AddRoute(icacontrollertypes.SubModuleName, icaControllerIBCModule).
AddRoute(icahosttypes.SubModuleName, icaHostIBCModule).
AddRoute(ibctransfertypes.ModuleName, transferIBCModule).
AddRoute(intertxtypes.ModuleName, icaControllerIBCModule)

ibcRouter.AddRoute(wasm.ModuleName, wasm.NewIBCHandler(app.WasmKeeper, app.IBCKeeper.ChannelKeeper))
app.IBCKeeper.SetRouter(ibcRouter)

Expand Down Expand Up @@ -587,6 +587,7 @@ func NewTeritoriApp(
icaModule,
wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
routerModule,
interTxModule,
)

// During begin block slashing happens after distr.BeginBlocker so that
Expand Down Expand Up @@ -616,6 +617,7 @@ func NewTeritoriApp(
routertypes.ModuleName,
airdroptypes.ModuleName,
wasm.ModuleName,
intertxtypes.ModuleName,
)
app.mm.SetOrderEndBlockers(
distrtypes.ModuleName,
Expand All @@ -640,6 +642,7 @@ func NewTeritoriApp(
authz.ModuleName,
airdroptypes.ModuleName,
wasm.ModuleName,
intertxtypes.ModuleName,
)

// NOTE: The genutils module must occur after staking so that pools are
Expand Down Expand Up @@ -670,6 +673,7 @@ func NewTeritoriApp(
routertypes.ModuleName,
airdroptypes.ModuleName,
wasm.ModuleName,
intertxtypes.ModuleName,
)

app.mm.RegisterInvariants(&app.CrisisKeeper)
Expand Down Expand Up @@ -736,6 +740,17 @@ func NewTeritoriApp(
app.SetBeginBlocker(app.BeginBlocker)
app.SetEndBlocker(app.EndBlocker)

// Ensure that state sync delivers the cosmwasm directory as well

if manager := app.SnapshotManager(); manager != nil {
err = manager.RegisterExtensions(
wasmkeeper.NewWasmSnapshotter(app.CommitMultiStore(), &app.WasmKeeper),
)
if err != nil {
panic("failed to register snapshot extension: " + err.Error())
}
}

if loadLatest {
if err := app.LoadLatestVersion(); err != nil {
tmos.Exit(fmt.Sprintf("failed to load latest version: %s", err))
Expand All @@ -753,7 +768,10 @@ func NewTeritoriApp(

app.ScopedIBCKeeper = scopedIBCKeeper
app.ScopedTransferKeeper = scopedTransferKeeper
app.scopedWasmKeeper = scopedWasmKeeper
app.ScopedICAControllerKeeper = scopedICAControllerKeeper
app.ScopedICAHostKeeper = scopedICAHostKeeper
app.ScopedInterTxKeeper = scopedInterTxKeeper
app.ScopedWasmKeeper = scopedWasmKeeper

return app
}
Expand Down Expand Up @@ -885,6 +903,31 @@ func (app *TeritoriApp) RegisterTendermintService(clientCtx client.Context) {
tmservice.RegisterTendermintService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.interfaceRegistry)
}

// GetBaseApp implements the BaseApp
func (app *TeritoriApp) GetBaseApp() *baseapp.BaseApp {
return app.BaseApp
}

// GetBaseApp implements the StakingKeeper
func (app *TeritoriApp) GetStakingKeeper() stakingkeeper.Keeper {
return app.StakingKeeper
}

// GetBaseApp implements the StakingKeeper
func (app *TeritoriApp) GetIBCKeeper() *ibckeeper.Keeper {
return app.IBCKeeper
}

// GetBaseApp implements the StakingKeeper
func (app *TeritoriApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper {
return app.ScopedIBCKeeper
}

// GetBaseApp implements the StakingKeeper
func (app *TeritoriApp) GetTxConfig() client.TxConfig {
return MakeEncodingConfig().TxConfig
}

// RegisterSwaggerAPI registers swagger route with API Server
func RegisterSwaggerAPI(rtr *mux.Router) {
statikFS, err := fs.New()
Expand Down Expand Up @@ -922,18 +965,38 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(wasm.ModuleName)
paramsKeeper.Subspace(routertypes.ModuleName).WithKeyTable(routertypes.ParamKeyTable())
paramsKeeper.Subspace(icahosttypes.SubModuleName)
paramsKeeper.Subspace(icacontrollertypes.SubModuleName)
paramsKeeper.Subspace(airdroptypes.ModuleName)

return paramsKeeper
}

// configure store loader that checks if version == upgradeHeight and applies store upgrades
func (app *TeritoriApp) setupUpgradeStoreLoaders() {
upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(fmt.Sprintf("failed to read upgrade info from disk %s", err))
}

if app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
return
}

for _, upgrade := range Upgrades {
if upgradeInfo.Name == upgrade.UpgradeName {
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &upgrade.StoreUpgrades))
}
}
}

func (app *TeritoriApp) setupUpgradeHandlers() {
for _, upgrade := range Upgrades {
app.UpgradeKeeper.SetUpgradeHandler(
upgrade.UpgradeName,
upgrade.CreateUpgradeHandler(
app.mm,
app.configurator,
app.AppKeepers,
),
)
}
Expand Down
Loading