Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
df3c257
x/tracking module added which is a split version of x/gastracker with…
iTiky Jul 27, 2022
57ba42b
Gas consumption tests added
iTiky Jul 27, 2022
ac15fdd
x/tracking refactoring; x/rewards added (WIP)
iTiky Jul 27, 2022
fc2d41e
test tracking module genesis imports & exports
edjroz Jul 28, 2022
f212370
x/tracking refactoring; x/rewards added with WASM bindings refactored
iTiky Jul 29, 2022
29d207d
x/rewards: bugfixes; inflation rewards distribution rollback to block…
iTiky Jul 29, 2022
7ff10c4
x/rewards: distribution refactoring; distribution test added
iTiky Jul 30, 2022
464fb1c
x/tracking, x/rewards: tracking data prune added
iTiky Jul 30, 2022
a3da7bf
x/rewards: mintBankKeeper test added; max inflationRewardsRation is l…
iTiky Jul 31, 2022
88d55bf
Frojdi feedback changes: reading x/rewards ratio params twice removed…
iTiky Aug 1, 2022
13e9a52
x/rewards: Ante handler tests added
iTiky Aug 1, 2022
f3f3e6f
x/rewards: SetMetadata tests added
iTiky Aug 1, 2022
57d14a7
x/rewards, x/tracking: basic validation tests added
iTiky Aug 1, 2022
903f3ae
Merge branch 'main' into split_gastracker
edjroz Aug 1, 2022
eeb4ff6
fix go dependencies
edjroz Aug 1, 2022
7f9cf68
dontcover.sh added to prepend DONTCOVER for proto-gen files.
iTiky Aug 2, 2022
e849565
add codecov config
edjroz Aug 2, 2022
a525728
Big integration test added
iTiky Aug 2, 2022
89ef378
Test chain fix
iTiky Aug 2, 2022
db607bb
Parth PR feedback changes
iTiky Aug 2, 2022
fcb015b
Coins split logic changed: doesn't return invalid sdk.Coins if one of…
iTiky Aug 2, 2022
cdc40f6
Tx fees vs rewards demo test added
iTiky Aug 2, 2022
63dbcd3
Minimum consensus fee added
iTiky Aug 3, 2022
60be045
x/rewards: estimate tx fees query added
iTiky Aug 3, 2022
51784e8
Apply suggestions from code review
iTiky Aug 3, 2022
ad68719
remove legacy gastracker integration test
edjroz Aug 9, 2022
6c1e3cd
add legacy gastracker to code coverage ignore
edjroz Aug 9, 2022
b1fc078
add pg.gw.go files to ignroe coverage
edjroz Aug 9, 2022
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
9 changes: 5 additions & 4 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import (
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types"

gastrackerante "github.com/archway-network/archway/x/gastracker/ante"
trackingAnte "github.com/archway-network/archway/x/tracking/ante"
trackingKeeper "github.com/archway-network/archway/x/tracking/keeper"
)

// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC
Expand All @@ -24,7 +25,7 @@ type HandlerOptions struct {

TXCounterStoreKey sdk.StoreKey

GasTrackingKeeper gastrackerante.GasTrackingKeeper
TrackingKeeper trackingKeeper.Keeper
}

func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
Expand Down Expand Up @@ -60,15 +61,15 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
// custom archway fee deduction, which splits fees between gastracker and auths fee collector
gastrackerante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.GasTrackingKeeper),
//gastrackerante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.GasTrackingKeeper),
// SetPubKeyDecorator must be called before all signature verification decorators
ante.NewSetPubKeyDecorator(options.AccountKeeper),
ante.NewValidateSigCountDecorator(options.AccountKeeper),
ante.NewSigGasConsumeDecorator(options.AccountKeeper, sigGasConsumer),
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
ibcante.NewAnteDecorator(options.IBCChannelkeeper),
gastrackerante.NewTxGasTrackingDecorator(options.GasTrackingKeeper),
trackingAnte.NewTxGasTrackingDecorator(options.TrackingKeeper),
}

return sdk.ChainAnteDecorators(anteDecorators...), nil
Expand Down
51 changes: 49 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package app

import (
"fmt"
"github.com/archway-network/archway/x/tracking"
trackingKeeper "github.com/archway-network/archway/x/tracking/keeper"
trackingTypes "github.com/archway-network/archway/x/tracking/types"
"io"
"net/http"
"os"
Expand Down Expand Up @@ -202,6 +205,7 @@ var (
vesting.AppModuleBasic{},
wasm.AppModuleBasic{},
gastrackermodule.AppModuleBasic{},
tracking.AppModuleBasic{},
)

// module account permissions
Expand Down Expand Up @@ -256,6 +260,7 @@ type ArchwayApp struct {
AuthzKeeper authzkeeper.Keeper
WASMKeeper wasm.Keeper
GasTrackingKeeper gastrackerkeeper.Keeper
TrackingKeeper trackingKeeper.Keeper

ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
Expand Down Expand Up @@ -301,6 +306,7 @@ func NewArchwayApp(
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey,
evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey,
feegrant.StoreKey, authzkeeper.StoreKey, wasm.StoreKey, gastracker.StoreKey,
trackingTypes.StoreKey,
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
Expand Down Expand Up @@ -459,6 +465,13 @@ func NewArchwayApp(
defaultGasRegister,
)

app.TrackingKeeper = trackingKeeper.NewKeeper(
appCodec,
keys[trackingTypes.StoreKey],
defaultGasRegister,
app.getSubspace(trackingTypes.ModuleName),
)

wasmDir := filepath.Join(homePath, "wasm")
wasmConfig, err := wasm.ReadWasmConfig(appOpts)
if err != nil {
Expand Down Expand Up @@ -511,7 +524,7 @@ func NewArchwayApp(
)

// Setting gas recorder here to avoid cyclic loop
trackingWasmVm.SetGasRecorder(app.GasTrackingKeeper)
trackingWasmVm.SetGasRecorder(app.TrackingKeeper)

// The gov proposal types can be individually enabled
if len(enabledProposals) != 0 {
Expand Down Expand Up @@ -562,6 +575,7 @@ func NewArchwayApp(
params.NewAppModule(app.ParamsKeeper),
transferModule,
gastrackermodule.NewAppModule(app.appCodec, app.GasTrackingKeeper, app.BankKeeper),
tracking.NewAppModule(app.appCodec, app.TrackingKeeper),
crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants), // always be last to make sure that it checks for all invariants and not only part of them
)

Expand Down Expand Up @@ -590,7 +604,37 @@ func NewArchwayApp(
// additional non simd modules
ibchost.ModuleName,
ibctransfertypes.ModuleName,
// wasm
wasm.ModuleName,
// wasm gas tracking
trackingTypes.ModuleName,
)

app.mm.SetOrderEndBlockers(
// we have to specify all modules here (Cosmos's order is taken as a reference)
crisistypes.ModuleName,
govtypes.ModuleName,
stakingtypes.ModuleName,
ibctransfertypes.ModuleName,
ibchost.ModuleName,
feegrant.ModuleName,
authz.ModuleName,
capabilitytypes.ModuleName,
authtypes.ModuleName,
banktypes.ModuleName,
distrtypes.ModuleName,
slashingtypes.ModuleName,
minttypes.ModuleName,
genutiltypes.ModuleName,
evidencetypes.ModuleName,
paramstypes.ModuleName,
upgradetypes.ModuleName,
vestingtypes.ModuleName,
// wasm
wasm.ModuleName,
// wasm gas tracking
gastracker.ModuleName,
trackingTypes.ModuleName,
)

// NOTE: The genutils module must occur after staking so that pools are
Expand Down Expand Up @@ -623,6 +667,8 @@ func NewArchwayApp(
ibctransfertypes.ModuleName,
// wasm after ibc transfer
wasm.ModuleName,
// wasm gas tracking
trackingTypes.ModuleName,
)

// Uncomment if you want to set a custom migration order here.
Expand Down Expand Up @@ -676,7 +722,7 @@ func NewArchwayApp(
IBCChannelkeeper: app.IBCKeeper.ChannelKeeper,
WasmConfig: &wasmConfig,
TXCounterStoreKey: keys[wasm.StoreKey],
GasTrackingKeeper: app.GasTrackingKeeper,
TrackingKeeper: app.TrackingKeeper,
},
)
if err != nil {
Expand Down Expand Up @@ -839,6 +885,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(ibchost.ModuleName)
paramsKeeper.Subspace(wasm.ModuleName)
paramsKeeper.Subspace(gastracker.DefaultParamSpace)
paramsKeeper.Subspace(trackingTypes.ModuleName)

return paramsKeeper
}
Loading