Rename gaia{d,cli} to wasm{d,cli}, GaiaApp->WasmApp
This commit is contained in:
18
Makefile
18
Makefile
@@ -48,9 +48,9 @@ build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags))
|
|||||||
|
|
||||||
# process linker flags
|
# process linker flags
|
||||||
|
|
||||||
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=gaia \
|
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=wasm \
|
||||||
-X github.com/cosmos/cosmos-sdk/version.ServerName=gaiad \
|
-X github.com/cosmos/cosmos-sdk/version.ServerName=wasmd \
|
||||||
-X github.com/cosmos/cosmos-sdk/version.ClientName=gaiacli \
|
-X github.com/cosmos/cosmos-sdk/version.ClientName=wasmcli \
|
||||||
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
|
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
|
||||||
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
|
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
|
||||||
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)"
|
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)"
|
||||||
@@ -70,11 +70,11 @@ all: install lint test
|
|||||||
|
|
||||||
build: go.sum
|
build: go.sum
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
go build -mod=readonly $(BUILD_FLAGS) -o build/gaiad.exe ./cmd/gaiad
|
go build -mod=readonly $(BUILD_FLAGS) -o build/wasmd.exe ./cmd/wasmd
|
||||||
go build -mod=readonly $(BUILD_FLAGS) -o build/gaiacli.exe ./cmd/gaiacli
|
go build -mod=readonly $(BUILD_FLAGS) -o build/wasmcli.exe ./cmd/wasmcli
|
||||||
else
|
else
|
||||||
go build -mod=readonly $(BUILD_FLAGS) -o build/gaiad ./cmd/gaiad
|
go build -mod=readonly $(BUILD_FLAGS) -o build/wasmd ./cmd/wasmd
|
||||||
go build -mod=readonly $(BUILD_FLAGS) -o build/gaiacli ./cmd/gaiacli
|
go build -mod=readonly $(BUILD_FLAGS) -o build/wasmcli ./cmd/wasmcli
|
||||||
endif
|
endif
|
||||||
|
|
||||||
build-linux: go.sum
|
build-linux: go.sum
|
||||||
@@ -88,8 +88,8 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
install: go.sum
|
install: go.sum
|
||||||
go install -mod=readonly $(BUILD_FLAGS) ./cmd/gaiad
|
go install -mod=readonly $(BUILD_FLAGS) ./cmd/wasmd
|
||||||
go install -mod=readonly $(BUILD_FLAGS) ./cmd/gaiacli
|
go install -mod=readonly $(BUILD_FLAGS) ./cmd/wasmcli
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
### Tools & dependencies
|
### Tools & dependencies
|
||||||
|
|||||||
34
app/app.go
34
app/app.go
@@ -31,14 +31,14 @@ import (
|
|||||||
"github.com/cosmos/cosmos-sdk/x/supply"
|
"github.com/cosmos/cosmos-sdk/x/supply"
|
||||||
)
|
)
|
||||||
|
|
||||||
const appName = "GaiaApp"
|
const appName = "WasmApp"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// DefaultCLIHome default home directories for gaiacli
|
// DefaultCLIHome default home directories for wasmcli
|
||||||
DefaultCLIHome = os.ExpandEnv("$HOME/.gaiacli")
|
DefaultCLIHome = os.ExpandEnv("$HOME/.wasmcli")
|
||||||
|
|
||||||
// DefaultNodeHome default home directories for gaiad
|
// DefaultNodeHome default home directories for wasmd
|
||||||
DefaultNodeHome = os.ExpandEnv("$HOME/.gaiad")
|
DefaultNodeHome = os.ExpandEnv("$HOME/.wasmd")
|
||||||
|
|
||||||
// ModuleBasics The module BasicManager is in charge of setting up basic,
|
// ModuleBasics The module BasicManager is in charge of setting up basic,
|
||||||
// non-dependant module elements, such as codec registration
|
// non-dependant module elements, such as codec registration
|
||||||
@@ -83,8 +83,8 @@ func MakeCodec() *codec.Codec {
|
|||||||
return cdc.Seal()
|
return cdc.Seal()
|
||||||
}
|
}
|
||||||
|
|
||||||
// GaiaApp extended ABCI application
|
// WasmApp extended ABCI application
|
||||||
type GaiaApp struct {
|
type WasmApp struct {
|
||||||
*bam.BaseApp
|
*bam.BaseApp
|
||||||
cdc *codec.Codec
|
cdc *codec.Codec
|
||||||
|
|
||||||
@@ -114,11 +114,11 @@ type GaiaApp struct {
|
|||||||
sm *module.SimulationManager
|
sm *module.SimulationManager
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewGaiaApp returns a reference to an initialized GaiaApp.
|
// NewWasmApp returns a reference to an initialized WasmApp.
|
||||||
func NewGaiaApp(
|
func NewWasmApp(
|
||||||
logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool,
|
logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool,
|
||||||
invCheckPeriod uint, baseAppOptions ...func(*bam.BaseApp),
|
invCheckPeriod uint, baseAppOptions ...func(*bam.BaseApp),
|
||||||
) *GaiaApp {
|
) *WasmApp {
|
||||||
|
|
||||||
cdc := MakeCodec()
|
cdc := MakeCodec()
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ func NewGaiaApp(
|
|||||||
)
|
)
|
||||||
tKeys := sdk.NewTransientStoreKeys(staking.TStoreKey, params.TStoreKey)
|
tKeys := sdk.NewTransientStoreKeys(staking.TStoreKey, params.TStoreKey)
|
||||||
|
|
||||||
app := &GaiaApp{
|
app := &WasmApp{
|
||||||
BaseApp: bApp,
|
BaseApp: bApp,
|
||||||
cdc: cdc,
|
cdc: cdc,
|
||||||
invCheckPeriod: invCheckPeriod,
|
invCheckPeriod: invCheckPeriod,
|
||||||
@@ -264,17 +264,17 @@ func NewGaiaApp(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// application updates every begin block
|
// application updates every begin block
|
||||||
func (app *GaiaApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock {
|
func (app *WasmApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock {
|
||||||
return app.mm.BeginBlock(ctx, req)
|
return app.mm.BeginBlock(ctx, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
// application updates every end block
|
// application updates every end block
|
||||||
func (app *GaiaApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {
|
func (app *WasmApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {
|
||||||
return app.mm.EndBlock(ctx, req)
|
return app.mm.EndBlock(ctx, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
// application update at chain initialization
|
// application update at chain initialization
|
||||||
func (app *GaiaApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain {
|
func (app *WasmApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain {
|
||||||
var genesisState simapp.GenesisState
|
var genesisState simapp.GenesisState
|
||||||
app.cdc.MustUnmarshalJSON(req.AppStateBytes, &genesisState)
|
app.cdc.MustUnmarshalJSON(req.AppStateBytes, &genesisState)
|
||||||
|
|
||||||
@@ -282,12 +282,12 @@ func (app *GaiaApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load a particular height
|
// load a particular height
|
||||||
func (app *GaiaApp) LoadHeight(height int64) error {
|
func (app *WasmApp) LoadHeight(height int64) error {
|
||||||
return app.LoadVersion(height, app.keys[bam.MainStoreKey])
|
return app.LoadVersion(height, app.keys[bam.MainStoreKey])
|
||||||
}
|
}
|
||||||
|
|
||||||
// ModuleAccountAddrs returns all the app's module account addresses.
|
// ModuleAccountAddrs returns all the app's module account addresses.
|
||||||
func (app *GaiaApp) ModuleAccountAddrs() map[string]bool {
|
func (app *WasmApp) ModuleAccountAddrs() map[string]bool {
|
||||||
modAccAddrs := make(map[string]bool)
|
modAccAddrs := make(map[string]bool)
|
||||||
for acc := range maccPerms {
|
for acc := range maccPerms {
|
||||||
modAccAddrs[supply.NewModuleAddress(acc).String()] = true
|
modAccAddrs[supply.NewModuleAddress(acc).String()] = true
|
||||||
@@ -297,7 +297,7 @@ func (app *GaiaApp) ModuleAccountAddrs() map[string]bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Codec returns the application's sealed codec.
|
// Codec returns the application's sealed codec.
|
||||||
func (app *GaiaApp) Codec() *codec.Codec {
|
func (app *WasmApp) Codec() *codec.Codec {
|
||||||
return app.cdc
|
return app.cdc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,14 +14,14 @@ import (
|
|||||||
abci "github.com/tendermint/tendermint/abci/types"
|
abci "github.com/tendermint/tendermint/abci/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGaiadExport(t *testing.T) {
|
func TestWasmddExport(t *testing.T) {
|
||||||
db := db.NewMemDB()
|
db := db.NewMemDB()
|
||||||
gapp := NewGaiaApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0)
|
gapp := NewWasmdApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0)
|
||||||
err := setGenesis(gapp)
|
err := setGenesis(gapp)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Making a new app object with the db, so that initchain hasn't been called
|
// Making a new app object with the db, so that initchain hasn't been called
|
||||||
newGapp := NewGaiaApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0)
|
newGapp := NewWasmdApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0)
|
||||||
_, _, err = newGapp.ExportAppStateAndValidators(false, []string{})
|
_, _, err = newGapp.ExportAppStateAndValidators(false, []string{})
|
||||||
require.NoError(t, err, "ExportAppStateAndValidators should not have an error")
|
require.NoError(t, err, "ExportAppStateAndValidators should not have an error")
|
||||||
}
|
}
|
||||||
@@ -29,14 +29,14 @@ func TestGaiadExport(t *testing.T) {
|
|||||||
// ensure that black listed addresses are properly set in bank keeper
|
// ensure that black listed addresses are properly set in bank keeper
|
||||||
func TestBlackListedAddrs(t *testing.T) {
|
func TestBlackListedAddrs(t *testing.T) {
|
||||||
db := db.NewMemDB()
|
db := db.NewMemDB()
|
||||||
gapp := NewGaiaApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0)
|
gapp := NewWasmdApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0)
|
||||||
|
|
||||||
for acc := range maccPerms {
|
for acc := range maccPerms {
|
||||||
require.True(t, gapp.bankKeeper.BlacklistedAddr(gapp.supplyKeeper.GetModuleAddress(acc)))
|
require.True(t, gapp.bankKeeper.BlacklistedAddr(gapp.supplyKeeper.GetModuleAddress(acc)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func setGenesis(gapp *GaiaApp) error {
|
func setGenesis(gapp *WasmApp) error {
|
||||||
genesisState := simapp.NewDefaultGenesisState()
|
genesisState := simapp.NewDefaultGenesisState()
|
||||||
stateBytes, err := codec.MarshalJSONIndent(gapp.cdc, genesisState)
|
stateBytes, err := codec.MarshalJSONIndent(gapp.cdc, genesisState)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// ExportAppStateAndValidators export the state of gaia for a genesis file
|
// ExportAppStateAndValidators export the state of gaia for a genesis file
|
||||||
func (app *GaiaApp) ExportAppStateAndValidators(forZeroHeight bool, jailWhiteList []string,
|
func (app *WasmApp) ExportAppStateAndValidators(forZeroHeight bool, jailWhiteList []string,
|
||||||
) (appState json.RawMessage, validators []tmtypes.GenesisValidator, err error) {
|
) (appState json.RawMessage, validators []tmtypes.GenesisValidator, err error) {
|
||||||
// as if they could withdraw from the start of the next block
|
// as if they could withdraw from the start of the next block
|
||||||
ctx := app.NewContext(true, abci.Header{Height: app.LastBlockHeight()})
|
ctx := app.NewContext(true, abci.Header{Height: app.LastBlockHeight()})
|
||||||
@@ -35,7 +35,7 @@ func (app *GaiaApp) ExportAppStateAndValidators(forZeroHeight bool, jailWhiteLis
|
|||||||
// prepare for fresh start at zero height
|
// prepare for fresh start at zero height
|
||||||
// NOTE zero height genesis is a temporary feature which will be deprecated
|
// NOTE zero height genesis is a temporary feature which will be deprecated
|
||||||
// in favour of export at a block height
|
// in favour of export at a block height
|
||||||
func (app *GaiaApp) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []string) {
|
func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []string) {
|
||||||
applyWhiteList := false
|
applyWhiteList := false
|
||||||
|
|
||||||
//Check if there is a whitelist
|
//Check if there is a whitelist
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ func init() {
|
|||||||
simapp.GetSimulatorFlags()
|
simapp.GetSimulatorFlags()
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAndRunTxs(app *GaiaApp, config simulation.Config) []simulation.WeightedOperation {
|
func testAndRunTxs(app *WasmApp, config simulation.Config) []simulation.WeightedOperation {
|
||||||
ap := make(simulation.AppParams)
|
ap := make(simulation.AppParams)
|
||||||
|
|
||||||
paramChanges := app.sm.GenerateParamChanges(config.Seed)
|
paramChanges := app.sm.GenerateParamChanges(config.Seed)
|
||||||
@@ -246,7 +246,7 @@ func interBlockCacheOpt() func(*baseapp.BaseApp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Profile with:
|
// Profile with:
|
||||||
// /usr/local/go/bin/go test -benchmem -run=^$ github.com/cosmos/cosmos-sdk/GaiaApp -bench ^BenchmarkFullAppSimulation$ -Commit=true -cpuprofile cpu.out
|
// /usr/local/go/bin/go test -benchmem -run=^$ github.com/cosmos/cosmos-sdk/WasmApp -bench ^BenchmarkFullAppSimulation$ -Commit=true -cpuprofile cpu.out
|
||||||
func BenchmarkFullAppSimulation(b *testing.B) {
|
func BenchmarkFullAppSimulation(b *testing.B) {
|
||||||
logger := log.NewNopLogger()
|
logger := log.NewNopLogger()
|
||||||
config := simapp.NewConfigFromFlags()
|
config := simapp.NewConfigFromFlags()
|
||||||
@@ -267,7 +267,7 @@ func BenchmarkFullAppSimulation(b *testing.B) {
|
|||||||
_ = os.RemoveAll(dir)
|
_ = os.RemoveAll(dir)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
gapp := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt())
|
gapp := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt())
|
||||||
|
|
||||||
// Run randomized simulation
|
// Run randomized simulation
|
||||||
// TODO: parameterize numbers, save for a later PR
|
// TODO: parameterize numbers, save for a later PR
|
||||||
@@ -328,8 +328,8 @@ func TestFullAppSimulation(t *testing.T) {
|
|||||||
_ = os.RemoveAll(dir)
|
_ = os.RemoveAll(dir)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
gapp := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt)
|
gapp := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt)
|
||||||
require.Equal(t, "GaiaApp", gapp.Name())
|
require.Equal(t, "WasmApp", gapp.Name())
|
||||||
|
|
||||||
// Run randomized simulation
|
// Run randomized simulation
|
||||||
_, simParams, simErr := simulation.SimulateFromSeed(
|
_, simParams, simErr := simulation.SimulateFromSeed(
|
||||||
@@ -384,7 +384,7 @@ func TestAppImportExport(t *testing.T) {
|
|||||||
_ = os.RemoveAll(dir)
|
_ = os.RemoveAll(dir)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
app := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt)
|
app := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt)
|
||||||
require.Equal(t, "SimApp", app.Name())
|
require.Equal(t, "SimApp", app.Name())
|
||||||
|
|
||||||
// Run randomized simulation
|
// Run randomized simulation
|
||||||
@@ -430,7 +430,7 @@ func TestAppImportExport(t *testing.T) {
|
|||||||
_ = os.RemoveAll(newDir)
|
_ = os.RemoveAll(newDir)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
newApp := NewGaiaApp(log.NewNopLogger(), newDB, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt)
|
newApp := NewWasmApp(log.NewNopLogger(), newDB, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt)
|
||||||
require.Equal(t, "SimApp", newApp.Name())
|
require.Equal(t, "SimApp", newApp.Name())
|
||||||
|
|
||||||
var genesisState simapp.GenesisState
|
var genesisState simapp.GenesisState
|
||||||
@@ -504,8 +504,8 @@ func TestAppSimulationAfterImport(t *testing.T) {
|
|||||||
_ = os.RemoveAll(dir)
|
_ = os.RemoveAll(dir)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
gapp := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt)
|
gapp := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt)
|
||||||
require.Equal(t, "GaiaApp", gapp.Name())
|
require.Equal(t, "WasmApp", gapp.Name())
|
||||||
|
|
||||||
// Run randomized simulation
|
// Run randomized simulation
|
||||||
// Run randomized simulation
|
// Run randomized simulation
|
||||||
@@ -560,8 +560,8 @@ func TestAppSimulationAfterImport(t *testing.T) {
|
|||||||
_ = os.RemoveAll(newDir)
|
_ = os.RemoveAll(newDir)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
newApp := NewGaiaApp(log.NewNopLogger(), newDB, nil, true, 0, fauxMerkleModeOpt)
|
newApp := NewWasmApp(log.NewNopLogger(), newDB, nil, true, 0, fauxMerkleModeOpt)
|
||||||
require.Equal(t, "GaiaApp", newApp.Name())
|
require.Equal(t, "WasmApp", newApp.Name())
|
||||||
|
|
||||||
newApp.InitChain(abci.RequestInitChain{
|
newApp.InitChain(abci.RequestInitChain{
|
||||||
AppStateBytes: appState,
|
AppStateBytes: appState,
|
||||||
@@ -599,7 +599,7 @@ func TestAppStateDeterminism(t *testing.T) {
|
|||||||
for j := 0; j < numTimesToRunPerSeed; j++ {
|
for j := 0; j < numTimesToRunPerSeed; j++ {
|
||||||
logger := log.NewNopLogger()
|
logger := log.NewNopLogger()
|
||||||
db := dbm.NewMemDB()
|
db := dbm.NewMemDB()
|
||||||
app := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt())
|
app := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt())
|
||||||
|
|
||||||
fmt.Printf(
|
fmt.Printf(
|
||||||
"running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n",
|
"running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n",
|
||||||
@@ -647,7 +647,7 @@ func BenchmarkInvariants(b *testing.B) {
|
|||||||
os.RemoveAll(dir)
|
os.RemoveAll(dir)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
gapp := NewGaiaApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt())
|
gapp := NewWasmApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt())
|
||||||
|
|
||||||
// 2. Run parameterized simulation (w/o invariants)
|
// 2. Run parameterized simulation (w/o invariants)
|
||||||
_, simParams, simErr := simulation.SimulateFromSeed(
|
_, simParams, simErr := simulation.SimulateFromSeed(
|
||||||
|
|||||||
10
app/utils.go
10
app/utils.go
@@ -16,7 +16,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// ExportStateToJSON util function to export the app state to JSON
|
// ExportStateToJSON util function to export the app state to JSON
|
||||||
func ExportStateToJSON(app *GaiaApp, path string) error {
|
func ExportStateToJSON(app *WasmApp, path string) error {
|
||||||
fmt.Println("exporting app state...")
|
fmt.Println("exporting app state...")
|
||||||
appState, _, err := app.ExportAppStateAndValidators(false, nil)
|
appState, _, err := app.ExportAppStateAndValidators(false, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -26,13 +26,13 @@ func ExportStateToJSON(app *GaiaApp, path string) error {
|
|||||||
return ioutil.WriteFile(path, []byte(appState), 0644)
|
return ioutil.WriteFile(path, []byte(appState), 0644)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewGaiaAppUNSAFE is used for debugging purposes only.
|
// NewWasmAppUNSAFE is used for debugging purposes only.
|
||||||
//
|
//
|
||||||
// NOTE: to not use this function with non-test code
|
// NOTE: to not use this function with non-test code
|
||||||
func NewGaiaAppUNSAFE(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool,
|
func NewWasmAppUNSAFE(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool,
|
||||||
invCheckPeriod uint, baseAppOptions ...func(*baseapp.BaseApp),
|
invCheckPeriod uint, baseAppOptions ...func(*baseapp.BaseApp),
|
||||||
) (gapp *GaiaApp, keyMain, keyStaking *sdk.KVStoreKey, stakingKeeper staking.Keeper) {
|
) (gapp *WasmApp, keyMain, keyStaking *sdk.KVStoreKey, stakingKeeper staking.Keeper) {
|
||||||
|
|
||||||
gapp = NewGaiaApp(logger, db, traceStore, loadLatest, invCheckPeriod, baseAppOptions...)
|
gapp = NewWasmApp(logger, db, traceStore, loadLatest, invCheckPeriod, baseAppOptions...)
|
||||||
return gapp, gapp.keys[bam.MainStoreKey], gapp.keys[staking.StoreKey], gapp.stakingKeeper
|
return gapp, gapp.keys[bam.MainStoreKey], gapp.keys[staking.StoreKey], gapp.stakingKeeper
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import (
|
|||||||
"github.com/tendermint/go-amino"
|
"github.com/tendermint/go-amino"
|
||||||
"github.com/tendermint/tendermint/libs/cli"
|
"github.com/tendermint/tendermint/libs/cli"
|
||||||
|
|
||||||
"github.com/cosmos/gaia/app"
|
"github.com/cosmwasm/wasmd/app"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -38,7 +38,7 @@ func main() {
|
|||||||
config.SetBech32PrefixForAccount(sdk.Bech32PrefixAccAddr, sdk.Bech32PrefixAccPub)
|
config.SetBech32PrefixForAccount(sdk.Bech32PrefixAccAddr, sdk.Bech32PrefixAccPub)
|
||||||
config.SetBech32PrefixForValidator(sdk.Bech32PrefixValAddr, sdk.Bech32PrefixValPub)
|
config.SetBech32PrefixForValidator(sdk.Bech32PrefixValAddr, sdk.Bech32PrefixValPub)
|
||||||
config.SetBech32PrefixForConsensusNode(sdk.Bech32PrefixConsAddr, sdk.Bech32PrefixConsPub)
|
config.SetBech32PrefixForConsensusNode(sdk.Bech32PrefixConsAddr, sdk.Bech32PrefixConsPub)
|
||||||
config.SetKeyringServiceName("gaia")
|
config.SetKeyringServiceName("wasmd")
|
||||||
config.Seal()
|
config.Seal()
|
||||||
|
|
||||||
// TODO: setup keybase, viper object, etc. to be passed into
|
// TODO: setup keybase, viper object, etc. to be passed into
|
||||||
@@ -46,8 +46,8 @@ func main() {
|
|||||||
// with the cdc
|
// with the cdc
|
||||||
|
|
||||||
rootCmd := &cobra.Command{
|
rootCmd := &cobra.Command{
|
||||||
Use: "gaiacli",
|
Use: "wasmcli",
|
||||||
Short: "Command line interface for interacting with gaiad",
|
Short: "Command line interface for interacting with wasmd",
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add --chain-id to persistent flags and mark it required
|
// Add --chain-id to persistent flags and mark it required
|
||||||
@@ -71,8 +71,8 @@ func main() {
|
|||||||
client.NewCompletionCmd(rootCmd, true),
|
client.NewCompletionCmd(rootCmd, true),
|
||||||
)
|
)
|
||||||
|
|
||||||
// Add flags and prefix all env exposed with GA
|
// Add flags and prefix all env exposed with WM
|
||||||
executor := cli.PrepareMainCmd(rootCmd, "GA", app.DefaultCLIHome)
|
executor := cli.PrepareMainCmd(rootCmd, "WM", app.DefaultCLIHome)
|
||||||
|
|
||||||
err := executor.Execute()
|
err := executor.Execute()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
tmtypes "github.com/tendermint/tendermint/types"
|
tmtypes "github.com/tendermint/tendermint/types"
|
||||||
dbm "github.com/tendermint/tm-db"
|
dbm "github.com/tendermint/tm-db"
|
||||||
|
|
||||||
"github.com/cosmos/gaia/app"
|
"github.com/cosmwasm/wasmd/app"
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/baseapp"
|
"github.com/cosmos/cosmos-sdk/baseapp"
|
||||||
"github.com/cosmos/cosmos-sdk/client"
|
"github.com/cosmos/cosmos-sdk/client"
|
||||||
@@ -37,14 +37,14 @@ func main() {
|
|||||||
config.SetBech32PrefixForAccount(sdk.Bech32PrefixAccAddr, sdk.Bech32PrefixAccPub)
|
config.SetBech32PrefixForAccount(sdk.Bech32PrefixAccAddr, sdk.Bech32PrefixAccPub)
|
||||||
config.SetBech32PrefixForValidator(sdk.Bech32PrefixValAddr, sdk.Bech32PrefixValPub)
|
config.SetBech32PrefixForValidator(sdk.Bech32PrefixValAddr, sdk.Bech32PrefixValPub)
|
||||||
config.SetBech32PrefixForConsensusNode(sdk.Bech32PrefixConsAddr, sdk.Bech32PrefixConsPub)
|
config.SetBech32PrefixForConsensusNode(sdk.Bech32PrefixConsAddr, sdk.Bech32PrefixConsPub)
|
||||||
config.SetKeyringServiceName("gaia")
|
config.SetKeyringServiceName("wasmd")
|
||||||
config.Seal()
|
config.Seal()
|
||||||
|
|
||||||
ctx := server.NewDefaultContext()
|
ctx := server.NewDefaultContext()
|
||||||
cobra.EnableCommandSorting = false
|
cobra.EnableCommandSorting = false
|
||||||
rootCmd := &cobra.Command{
|
rootCmd := &cobra.Command{
|
||||||
Use: "gaiad",
|
Use: "wasmd",
|
||||||
Short: "Gaia Daemon (server)",
|
Short: "Wasm Daemon (server)",
|
||||||
PersistentPreRunE: server.PersistentPreRunEFn(ctx),
|
PersistentPreRunE: server.PersistentPreRunEFn(ctx),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ func main() {
|
|||||||
server.AddCommands(ctx, cdc, rootCmd, newApp, exportAppStateAndTMValidators)
|
server.AddCommands(ctx, cdc, rootCmd, newApp, exportAppStateAndTMValidators)
|
||||||
|
|
||||||
// prepare and add flags
|
// prepare and add flags
|
||||||
executor := cli.PrepareBaseCmd(rootCmd, "GA", app.DefaultNodeHome)
|
executor := cli.PrepareBaseCmd(rootCmd, "WM", app.DefaultNodeHome)
|
||||||
rootCmd.PersistentFlags().UintVar(&invCheckPeriod, flagInvCheckPeriod,
|
rootCmd.PersistentFlags().UintVar(&invCheckPeriod, flagInvCheckPeriod,
|
||||||
0, "Assert registered invariants every N blocks")
|
0, "Assert registered invariants every N blocks")
|
||||||
err := executor.Execute()
|
err := executor.Execute()
|
||||||
@@ -83,7 +83,7 @@ func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer) abci.Application
|
|||||||
cache = store.NewCommitKVStoreCacheManager()
|
cache = store.NewCommitKVStoreCacheManager()
|
||||||
}
|
}
|
||||||
|
|
||||||
return app.NewGaiaApp(
|
return app.NewWasmApp(
|
||||||
logger, db, traceStore, true, invCheckPeriod,
|
logger, db, traceStore, true, invCheckPeriod,
|
||||||
baseapp.SetPruning(store.NewPruningOptionsFromString(viper.GetString("pruning"))),
|
baseapp.SetPruning(store.NewPruningOptionsFromString(viper.GetString("pruning"))),
|
||||||
baseapp.SetMinGasPrices(viper.GetString(server.FlagMinGasPrices)),
|
baseapp.SetMinGasPrices(viper.GetString(server.FlagMinGasPrices)),
|
||||||
@@ -98,7 +98,7 @@ func exportAppStateAndTMValidators(
|
|||||||
) (json.RawMessage, []tmtypes.GenesisValidator, error) {
|
) (json.RawMessage, []tmtypes.GenesisValidator, error) {
|
||||||
|
|
||||||
if height != -1 {
|
if height != -1 {
|
||||||
gapp := app.NewGaiaApp(logger, db, traceStore, false, uint(1))
|
gapp := app.NewWasmApp(logger, db, traceStore, false, uint(1))
|
||||||
err := gapp.LoadHeight(height)
|
err := gapp.LoadHeight(height)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
@@ -106,6 +106,6 @@ func exportAppStateAndTMValidators(
|
|||||||
return gapp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList)
|
return gapp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList)
|
||||||
}
|
}
|
||||||
|
|
||||||
gapp := app.NewGaiaApp(logger, db, traceStore, true, uint(1))
|
gapp := app.NewWasmApp(logger, db, traceStore, true, uint(1))
|
||||||
return gapp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList)
|
return gapp.ExportAppStateAndValidators(forZeroHeight, jailWhiteList)
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,7 @@ import (
|
|||||||
tmstore "github.com/tendermint/tendermint/store"
|
tmstore "github.com/tendermint/tendermint/store"
|
||||||
tm "github.com/tendermint/tendermint/types"
|
tm "github.com/tendermint/tendermint/types"
|
||||||
|
|
||||||
"github.com/cosmos/gaia/app"
|
"github.com/cosmwasm/wasmd/app"
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/baseapp"
|
"github.com/cosmos/cosmos-sdk/baseapp"
|
||||||
"github.com/cosmos/cosmos-sdk/server"
|
"github.com/cosmos/cosmos-sdk/server"
|
||||||
@@ -92,7 +92,7 @@ func replayTxs(rootDir string) error {
|
|||||||
|
|
||||||
// Application
|
// Application
|
||||||
fmt.Fprintln(os.Stderr, "Creating application")
|
fmt.Fprintln(os.Stderr, "Creating application")
|
||||||
gapp := app.NewGaiaApp(
|
gapp := app.NewWasmApp(
|
||||||
ctx.Logger, appDB, traceStoreWriter, true, uint(1),
|
ctx.Logger, appDB, traceStoreWriter, true, uint(1),
|
||||||
baseapp.SetPruning(store.PruneEverything), // nothing
|
baseapp.SetPruning(store.PruneEverything), // nothing
|
||||||
)
|
)
|
||||||
@@ -48,7 +48,7 @@ func testnetCmd(ctx *server.Context, cdc *codec.Codec,
|
|||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "testnet",
|
Use: "testnet",
|
||||||
Short: "Initialize files for a Gaiad testnet",
|
Short: "Initialize files for a Wasmd testnet",
|
||||||
Long: `testnet will create "v" number of directories and populate each with
|
Long: `testnet will create "v" number of directories and populate each with
|
||||||
necessary files (private validator, genesis, config, etc.).
|
necessary files (private validator, genesis, config, etc.).
|
||||||
|
|
||||||
@@ -80,9 +80,9 @@ Example:
|
|||||||
"Directory to store initialization data for the testnet")
|
"Directory to store initialization data for the testnet")
|
||||||
cmd.Flags().String(flagNodeDirPrefix, "node",
|
cmd.Flags().String(flagNodeDirPrefix, "node",
|
||||||
"Prefix the directory name for each node with (node results in node0, node1, ...)")
|
"Prefix the directory name for each node with (node results in node0, node1, ...)")
|
||||||
cmd.Flags().String(flagNodeDaemonHome, "gaiad",
|
cmd.Flags().String(flagNodeDaemonHome, "wasmd",
|
||||||
"Home directory of the node's daemon configuration")
|
"Home directory of the node's daemon configuration")
|
||||||
cmd.Flags().String(flagNodeCLIHome, "gaiacli",
|
cmd.Flags().String(flagNodeCLIHome, "wasmcli",
|
||||||
"Home directory of the node's cli configuration")
|
"Home directory of the node's cli configuration")
|
||||||
cmd.Flags().String(flagStartingIPAddress, "192.168.0.1",
|
cmd.Flags().String(flagStartingIPAddress, "192.168.0.1",
|
||||||
"Starting IP address (192.168.0.1 results in persistent peers list ID0@192.168.0.1:46656, ID1@192.168.0.2:46656, ...)")
|
"Starting IP address (192.168.0.1 results in persistent peers list ID0@192.168.0.1:46656, ID1@192.168.0.2:46656, ...)")
|
||||||
@@ -110,8 +110,8 @@ func InitTestnet(cmd *cobra.Command, config *tmconfig.Config, cdc *codec.Codec,
|
|||||||
nodeIDs := make([]string, numValidators)
|
nodeIDs := make([]string, numValidators)
|
||||||
valPubKeys := make([]crypto.PubKey, numValidators)
|
valPubKeys := make([]crypto.PubKey, numValidators)
|
||||||
|
|
||||||
gaiaConfig := srvconfig.DefaultConfig()
|
wasmConfig := srvconfig.DefaultConfig()
|
||||||
gaiaConfig.MinGasPrices = minGasPrices
|
wasmConfig.MinGasPrices = minGasPrices
|
||||||
|
|
||||||
//nolint:prealloc
|
//nolint:prealloc
|
||||||
var (
|
var (
|
||||||
@@ -223,8 +223,8 @@ func InitTestnet(cmd *cobra.Command, config *tmconfig.Config, cdc *codec.Codec,
|
|||||||
|
|
||||||
// TODO: Rename config file to server.toml as it's not particular to Gaia
|
// TODO: Rename config file to server.toml as it's not particular to Gaia
|
||||||
// (REF: https://github.com/cosmos/cosmos-sdk/issues/4125).
|
// (REF: https://github.com/cosmos/cosmos-sdk/issues/4125).
|
||||||
gaiaConfigFilePath := filepath.Join(nodeDir, "config/gaiad.toml")
|
wasmConfigFilePath := filepath.Join(nodeDir, "config/gaiad.toml")
|
||||||
srvconfig.WriteConfigFile(gaiaConfigFilePath, gaiaConfig)
|
srvconfig.WriteConfigFile(wasmConfigFilePath, wasmConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := initGenFiles(cdc, mbm, chainID, genAccounts, genFiles, numValidators); err != nil {
|
if err := initGenFiles(cdc, mbm, chainID, genAccounts, genFiles, numValidators); err != nil {
|
||||||
Reference in New Issue
Block a user