Skip to content

Commit

Permalink
Revert "feat!: custom fee distribution (#485)" (#486)
Browse files Browse the repository at this point in the history
This reverts commit 8e5b6a2.
  • Loading branch information
Alex Johnson committed Oct 28, 2021
1 parent 8e5b6a2 commit 97f743d
Show file tree
Hide file tree
Showing 60 changed files with 371 additions and 4,129 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
- [#421](https://github.com/Pylons-tech/pylons/pull/421) Recipe execution validation and item matching logic fixed.

### Client Breaking Changes
- [#485](https://github.com/Pylons-tech/pylons/pull/485) Add fee distribution and the `x/epochs` module.
- [#476](https://github.com/Pylons-tech/pylons/pull/476) Remove `rate` field from `*Param` proto messages.
- [#476](https://github.com/Pylons-tech/pylons/pull/476) Removes `rate` field from `*Param` proto messages.

### Changes:
- [#467](https://github.com/Pylons-tech/pylons/pull/467) Remove the `/flutter/` directory. Code has been [moved](https://github.com/Pylons-tech/flutter_wallet).
Expand Down
31 changes: 0 additions & 31 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ import (

"github.com/Pylons-tech/pylons/docs"

epochsmodule "github.com/Pylons-tech/pylons/x/epochs"
epochsmodulekeeper "github.com/Pylons-tech/pylons/x/epochs/keeper"
epochsmoduletypes "github.com/Pylons-tech/pylons/x/epochs/types"

// this line is used by starport scaffolding # stargate/app/moduleImport
appparams "github.com/Pylons-tech/pylons/app/params"
pylonsmodule "github.com/Pylons-tech/pylons/x/pylons"
Expand Down Expand Up @@ -153,7 +149,6 @@ var (
evidence.AppModuleBasic{},
transfer.AppModuleBasic{},
vesting.AppModuleBasic{},
epochsmodule.AppModuleBasic{},
// this line is used by starport scaffolding # stargate/app/moduleBasic
pylonsmodule.AppModuleBasic{},
)
Expand Down Expand Up @@ -227,7 +222,6 @@ type App struct {
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper

EpochsKeeper epochsmodulekeeper.Keeper
// this line is used by starport scaffolding # stargate/app/keeperDeclaration

PylonsKeeper pylonsmodulekeeper.Keeper
Expand Down Expand Up @@ -274,7 +268,6 @@ func New(
evidencetypes.StoreKey,
ibctransfertypes.StoreKey,
capabilitytypes.StoreKey,
epochsmoduletypes.StoreKey,
// this line is used by starport scaffolding # stargate/app/storeKey
pylonsmoduletypes.StoreKey,
)
Expand Down Expand Up @@ -396,21 +389,6 @@ func New(
app.GetSubspace(pylonsmoduletypes.ModuleName),
)

epochsKeeper := epochsmodulekeeper.NewKeeper(
appCodec,
keys[epochsmoduletypes.StoreKey],
keys[epochsmoduletypes.MemStoreKey],
)

app.EpochsKeeper = *epochsKeeper.SetHooks(
epochsmoduletypes.NewMultiEpochHooks(
// insert epoch hook receivers here
app.PylonsKeeper.Hooks(app.StakingKeeper),
),
)

epochsModule := epochsmodule.NewAppModule(appCodec, app.EpochsKeeper)

// Set node version from build configuration
pylonsmoduletypes.SetNodeVersionString(version.Version)
pylonsModule := pylonsmodule.NewAppModule(appCodec, app.PylonsKeeper, app.BankKeeper)
Expand Down Expand Up @@ -444,7 +422,6 @@ func New(
ibc.NewAppModule(app.IBCKeeper),
params.NewAppModule(app.ParamsKeeper),
transferModule,
epochsModule,
// this line is used by starport scaffolding # stargate/app/appModule
pylonsModule,
)
Expand All @@ -454,8 +431,6 @@ func New(
// CanWithdrawInvariant invariant.
// NOTE: staking module is required if HistoricalEntries param > 0
app.mm.SetOrderBeginBlockers(
// Note: epochs' begin should be "real" start of epochs, we keep epochs beginblock at the beginning
epochsmoduletypes.ModuleName,
upgradetypes.ModuleName,
capabilitytypes.ModuleName,
minttypes.ModuleName,
Expand All @@ -475,8 +450,6 @@ func New(
ibchost.ModuleName,
ibctransfertypes.ModuleName,
pylonsmoduletypes.ModuleName,
// Note: epochs' endblock should be "real" end of epochs, we keep epochs endblock at the end
epochsmoduletypes.ModuleName,
)

// NOTE: The genutils module must occur after staking so that pools are
Expand All @@ -498,7 +471,6 @@ func New(
genutiltypes.ModuleName,
evidencetypes.ModuleName,
ibctransfertypes.ModuleName,
epochsmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/initGenesis
pylonsmoduletypes.ModuleName,
)
Expand All @@ -523,10 +495,8 @@ func New(
params.NewAppModule(app.ParamsKeeper),
evidence.NewAppModule(app.EvidenceKeeper),
ibc.NewAppModule(app.IBCKeeper),
epochsmodule.NewAppModule(appCodec, app.EpochsKeeper),

transferModule,
pylonsModule,
)

app.sm.RegisterStoreDecoders()
Expand Down Expand Up @@ -709,7 +679,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(crisistypes.ModuleName)
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibchost.ModuleName)
paramsKeeper.Subspace(epochsmoduletypes.ModuleName)
// this line is used by starport scaffolding # stargate/app/paramSubspace
paramsKeeper.Subspace(pylonsmoduletypes.ModuleName)

Expand Down
85 changes: 2 additions & 83 deletions app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,89 +25,6 @@ func init() {
simapp.GetSimulatorFlags()
}

func TestFullAppSimulation(t *testing.T) {
// -Enabled=true -NumBlocks=1000 -BlockSize=200 \
// -Period=1 -Commit=true -Seed=57 -v -timeout 24h
simapp.FlagEnabledValue = true
simapp.FlagNumBlocksValue = 20
simapp.FlagBlockSizeValue = 25
simapp.FlagCommitValue = true
simapp.FlagVerboseValue = true
simapp.FlagPeriodValue = 10
simapp.FlagSeedValue = 10
fullAppSimulation(t, true)
}

func fullAppSimulation(tb testing.TB, is_testing bool) {
config, db, dir, logger, _, err := simapp.SetupSimulation("goleveldb-app-sim", "Simulation")
if err != nil {
tb.Fatalf("simulation setup failed: %s", err.Error())
}

defer func() {
db.Close()
err = os.RemoveAll(dir)
if err != nil {
tb.Fatal(err)
}
}()

// fauxMerkleModeOpt returns a BaseApp option to use a dbStoreAdapter instead of
// an IAVLStore for faster simulation speed.
fauxMerkleModeOpt := func(bapp *baseapp.BaseApp) {
if is_testing {
bapp.SetFauxMerkleMode()
}
}

cmdApp := pylons.New(
logger,
db,
nil,
true, // load latest
map[int64]bool{},
pylons.DefaultNodeHome,
simapp.FlagPeriodValue,
cosmoscmd.MakeEncodingConfig(pylons.ModuleBasics),
simapp.EmptyAppOptions{},
interBlockCacheOpt(),
fauxMerkleModeOpt)

var app *pylons.App
switch cmdApp.(type) {
case *pylons.App:
app = cmdApp.(*pylons.App)
default:
panic("imported simApp incorrectly")
}

// Run randomized simulation:
_, simParams, simErr := simulation.SimulateFromSeed(
tb,
os.Stdout,
app.BaseApp,
simapp.AppStateFn(app.AppCodec(), app.SimulationManager()),
simulation2.RandomAccounts, // Replace with own random account function if using keys other than secp256k1
simapp.SimulationOperations(app, app.AppCodec(), config),
app.ModuleAccountAddrs(),
config,
app.AppCodec(),
)

// export state and simParams before the simulation error is checked
if err = simapp.CheckExportSimulation(app, config, simParams); err != nil {
tb.Fatal(err)
}

if simErr != nil {
tb.Fatal(simErr)
}

if config.Commit {
simapp.PrintStats(db)
}
}

// Profile with:
// /usr/local/go/bin/go test -benchmem -run=^$ github.com/cosmos/cosmos-sdk/GaiaApp -bench ^BenchmarkFullAppSimulation$ -Commit=true -cpuprofile cpu.out
func BenchmarkFullAppSimulation(b *testing.B) {
Expand Down Expand Up @@ -168,6 +85,8 @@ func interBlockCacheOpt() func(*baseapp.BaseApp) {
return baseapp.SetInterBlockCache(store.NewCommitKVStoreCacheManager())
}

//// TODO: Make another test for the fuzzer itself, which just has noOp txs
//// and doesn't depend on the application.
func TestAppStateDeterminism(t *testing.T) {
if !simapp.FlagEnabledValue {
t.Skip("skipping application simulation")
Expand Down
Loading

0 comments on commit 97f743d

Please sign in to comment.