Skip to content

Commit

Permalink
Merge branch 'main' into feat/async-pruning
Browse files Browse the repository at this point in the history
  • Loading branch information
pr0n00gler committed Aug 23, 2024
2 parents f1d6e99 + 8a7c285 commit 9194fb1
Show file tree
Hide file tree
Showing 31 changed files with 629 additions and 805 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ on:

jobs:
docker:
runs-on: self-hosted
runs-on:
group: Neutron-Core
env:
DOCKER_BUILDKIT: 1

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ permissions:
jobs:
golangci:
name: lint
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: [push, pull_request]
jobs:
tests:
name: Test
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.22
uses: actions/setup-go@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
jobs:
dispatch:
name: Dispatch Tests Workflow
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- name: Evaluate PR Merged Status and Labels
run: |
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile.builder
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ ARG GIT_COMMIT
ARG BUILD_TAGS
ARG ENABLED_PROPOSALS

ENV GOTOOLCHAIN go1.22.6

RUN apk add --no-cache \
ca-certificates \
build-base \
Expand Down
5 changes: 5 additions & 0 deletions app/ante_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
consumerante "github.com/cosmos/interchain-security/v5/app/consumer/ante"
Expand All @@ -24,6 +25,7 @@ import (
type HandlerOptions struct {
ante.HandlerOptions

BankKeeper bankkeeper.Keeper
AccountKeeper feemarketante.AccountKeeper
IBCKeeper *ibckeeper.Keeper
ConsumerKeeper ibcconsumerkeeper.Keeper
Expand Down Expand Up @@ -70,6 +72,9 @@ func NewAnteHandler(options HandlerOptions, logger log.Logger) (sdk.AnteHandler,
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
feemarketante.NewFeeMarketCheckDecorator(
options.AccountKeeper,
options.BankKeeper,
options.FeegrantKeeper,
options.FeeMarketKeeper,
NewFeeDecoratorWithSwitch(options),
),
Expand Down
27 changes: 5 additions & 22 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ import (
oraclekeeper "github.com/skip-mev/slinky/x/oracle/keeper"
oracletypes "github.com/skip-mev/slinky/x/oracle/types"

"github.com/cosmos/cosmos-sdk/crypto/keyring"
runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services"
)

Expand Down Expand Up @@ -413,7 +412,7 @@ type App struct {

// AutoCLIOpts returns options based upon the modules in the neutron v4 app.
func (app *App) AutoCLIOpts(initClientCtx client.Context) autocli.AppOptions {
modules := make(map[string]appmodule.AppModule, 0)
modules := make(map[string]appmodule.AppModule)
for _, m := range app.mm.Modules {
if moduleWithName, ok := m.(module.HasName); ok {
moduleName := moduleWithName.Name()
Expand All @@ -423,18 +422,12 @@ func (app *App) AutoCLIOpts(initClientCtx client.Context) autocli.AppOptions {
}
}

cliKR, err := keyring.NewAutoCLIKeyring(initClientCtx.Keyring)
if err != nil {
panic(err)
}

return autocli.AppOptions{
Modules: modules,
ModuleOptions: runtimeservices.ExtractAutoCLIOptions(app.mm.Modules),
AddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()),
ValidatorAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()),
ConsensusAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()),
Keyring: cliKR,
ClientCtx: initClientCtx,
}
}
Expand Down Expand Up @@ -615,6 +608,7 @@ func New(
app.AccountKeeper, scopedICAHostKeeper, app.MsgServiceRouter(),
authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(),
)
app.ICAHostKeeper.WithQueryRouter(app.GRPCQueryRouter())

app.ContractManagerKeeper = *contractmanagermodulekeeper.NewKeeper(
appCodec,
Expand Down Expand Up @@ -1141,7 +1135,6 @@ func New(

// initialize BaseApp
app.SetInitChainer(app.InitChainer)
app.SetPreBlocker(app.PreBlocker)
app.SetBeginBlocker(app.BeginBlocker)
app.SetEndBlocker(app.EndBlocker)

Expand All @@ -1159,11 +1152,11 @@ func New(
anteHandler, err := NewAnteHandler(
HandlerOptions{
HandlerOptions: ante.HandlerOptions{
BankKeeper: app.BankKeeper,
FeegrantKeeper: app.FeeGrantKeeper,
SignModeHandler: encodingConfig.TxConfig.SignModeHandler(),
SigGasConsumer: ante.DefaultSigVerificationGasConsumer,
},
BankKeeper: app.BankKeeper,
AccountKeeper: app.AccountKeeper,
IBCKeeper: app.IBCKeeper,
GlobalFeeKeeper: app.GlobalFeeKeeper,
Expand All @@ -1182,7 +1175,6 @@ func New(
postHandlerOptions := PostHandlerOptions{
AccountKeeper: app.AccountKeeper,
BankKeeper: app.BankKeeper,
FeeGrantKeeper: app.FeeGrantKeeper,
FeeMarketKeeper: app.FeeMarkerKeeper,
}
postHandler, err := NewPostHandler(postHandlerOptions)
Expand Down Expand Up @@ -1296,6 +1288,8 @@ func New(
),
)

app.SetPreBlocker(app.oraclePreBlockHandler.WrappedPreBlocker(app.mm))

// Create the vote extensions handler that will be used to extend and verify
// vote extensions (i.e. oracle data).
veCodec := compression.NewCompressionVoteExtensionCodec(
Expand Down Expand Up @@ -1460,17 +1454,6 @@ func (app *App) Name() string { return app.BaseApp.Name() }
// GetBaseApp returns the base app of the application
func (app *App) GetBaseApp() *baseapp.BaseApp { return app.BaseApp }

// PreBlocker application updates every pre block
func (app *App) PreBlocker(ctx sdk.Context, req *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error) {
rsp, err := app.mm.PreBlock(ctx)
if err != nil {
return nil, err
}

_, err = app.oraclePreBlockHandler.PreBlocker()(ctx, req)
return rsp, err
}

// BeginBlocker application updates every begin block
func (app *App) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error) {
return app.mm.BeginBlock(ctx)
Expand Down
2 changes: 0 additions & 2 deletions app/post_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ type PostHandlerOptions struct {
AccountKeeper feemarketpost.AccountKeeper
BankKeeper feemarketpost.BankKeeper
FeeMarketKeeper feemarketpost.FeeMarketKeeper
FeeGrantKeeper feemarketpost.FeeGrantKeeper
}

// NewPostHandler returns a PostHandler chain with the fee deduct decorator.
Expand All @@ -34,7 +33,6 @@ func NewPostHandler(options PostHandlerOptions) (sdk.PostHandler, error) {
feemarketpost.NewFeeMarketDeductDecorator(
options.AccountKeeper,
options.BankKeeper,
options.FeeGrantKeeper,
options.FeeMarketKeeper,
),
}
Expand Down
6 changes: 3 additions & 3 deletions app/upgrades/v4.0.1/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"fmt"
"sort"

"github.com/skip-mev/slinky/cmd/constants/marketmaps"

appparams "github.com/neutron-org/neutron/v4/app/params"

"cosmossdk.io/errors"
Expand All @@ -28,8 +30,6 @@ import (
marketmapkeeper "github.com/skip-mev/slinky/x/marketmap/keeper"
marketmaptypes "github.com/skip-mev/slinky/x/marketmap/types"

slinkyconstants "github.com/skip-mev/slinky/cmd/constants"

"github.com/neutron-org/neutron/v4/app/upgrades"
)

Expand Down Expand Up @@ -204,7 +204,7 @@ func setFeeMarketParams(ctx sdk.Context, feemarketKeeper *feemarketkeeper.Keeper
}

func setMarketState(ctx sdk.Context, mmKeeper *marketmapkeeper.Keeper) error {
markets := marketMapToDeterministicallyOrderedMarkets(slinkyconstants.CoreMarketMap)
markets := marketMapToDeterministicallyOrderedMarkets(marketmaps.CoreMarketMap)
for _, market := range markets {
if err := mmKeeper.CreateMarket(ctx, market); err != nil {
return err
Expand Down
6 changes: 3 additions & 3 deletions app/upgrades/v4.0.1/upgrades_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"sort"
"testing"

"github.com/skip-mev/slinky/cmd/constants/marketmaps"
marketmaptypes "github.com/skip-mev/slinky/x/marketmap/types"

slinkyconstants "github.com/skip-mev/slinky/cmd/constants"
slinkytypes "github.com/skip-mev/slinky/pkg/types"

upgradetypes "cosmossdk.io/x/upgrade/types"
Expand Down Expand Up @@ -44,7 +44,7 @@ func (suite *UpgradeTestSuite) TestOracleUpgrade() {
// we need to properly set consensus params for tests or we get a panic
suite.Require().NoError(app.ConsensusParamsKeeper.ParamsStore.Set(ctx, *oldParams.Params))

markets := slinkyconstants.CoreMarketMap.Markets
markets := marketmaps.CoreMarketMap.Markets
suite.Require().NoError(err)

upgrade := upgradetypes.Plan{
Expand All @@ -64,7 +64,7 @@ func (suite *UpgradeTestSuite) TestOracleUpgrade() {
mm, err := app.MarketMapKeeper.GetAllMarkets(ctx)
gotMM := marketmaptypes.MarketMap{Markets: mm}
suite.Require().NoError(err)
suite.Require().True(slinkyconstants.CoreMarketMap.Equal(gotMM))
suite.Require().True(marketmaps.CoreMarketMap.Equal(gotMM))

numCps, err := app.OracleKeeper.GetNumCurrencyPairs(ctx)
suite.Require().NoError(err)
Expand Down
2 changes: 0 additions & 2 deletions cmd/neutrond/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/keys"
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/server"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/version"
Expand Down Expand Up @@ -126,7 +125,6 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {

autoCliOpts := tempApplication.AutoCliOpts()
initClientCtx, _ = config.ReadFromClientConfig(initClientCtx)
autoCliOpts.Keyring, _ = keyring.NewAutoCLIKeyring(initClientCtx.Keyring)
autoCliOpts.ClientCtx = initClientCtx

if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil {
Expand Down
35 changes: 6 additions & 29 deletions docs/static/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15075,16 +15075,8 @@ definitions:
type: array
soft_opt_out_threshold:
title: >-
The threshold for the percentage of validators at the bottom of
the set who

can opt out of running the consumer chain without being punished.
For

example, a value of 0.05 means that the validators in the bottom
5% of the

set can opt out
!!! DEPRECATED !!! soft_opt_out_threshold is deprecated. see
docs/docs/adrs/adr-015-partial-set-security.md
type: string
transfer_timeout_period:
title: Sent transfer related IBC packets will timeout after this duration
Expand Down Expand Up @@ -15396,15 +15388,8 @@ definitions:
type: array
soft_opt_out_threshold:
title: >-
The threshold for the percentage of validators at the bottom of the
set who

can opt out of running the consumer chain without being punished. For

example, a value of 0.05 means that the validators in the bottom 5% of
the

set can opt out
!!! DEPRECATED !!! soft_opt_out_threshold is deprecated. see
docs/docs/adrs/adr-015-partial-set-security.md
type: string
transfer_timeout_period:
title: Sent transfer related IBC packets will timeout after this duration
Expand Down Expand Up @@ -38821,16 +38806,8 @@ paths:
type: array
soft_opt_out_threshold:
title: >-
The threshold for the percentage of validators at the
bottom of the set who

can opt out of running the consumer chain without being
punished. For

example, a value of 0.05 means that the validators in the
bottom 5% of the

set can opt out
!!! DEPRECATED !!! soft_opt_out_threshold is deprecated.
see docs/docs/adrs/adr-015-partial-set-security.md
type: string
transfer_timeout_period:
title: >-
Expand Down
Loading

0 comments on commit 9194fb1

Please sign in to comment.