feat: x/blocksdk module integration (#201)

* module proto

* lane proto

* proto-gen

* proto-format

* regenerate

* genesis

* stub

* test

* comment

* new keeper functions

* finalize

* lint fix

* proto format

* encounteredLanes

* make protos

* generate

* generate

* msgs

* msgs test

* msg service

* grpc query

* add module

* add module assertions

* add client

* config

* app

* clean

* wip

* mocks

* integrate into mempool

* lane utils

* wip

* fix and test

* format

* debug logs

* add

* integrate

* format

* fix

* rm

* add

* fmt imports

* better error

* simplify

* simplify

* simplify

* format

* deep copy

* Update block/lane.go

Co-authored-by: Keefer Taylor | Tessellated <keefer@tessellated.io>

---------

Co-authored-by: aljo242 <alex@ingenuity.build>
Co-authored-by: Keefer Taylor | Tessellated <keefer@tessellated.io>
This commit is contained in:
Alex Johnson
2023-11-07 16:22:17 -05:00
committed by GitHub
co-authored by Keefer Taylor | Tessellated aljo242
parent f5457e3e54
commit 41e85e9cfe
16 changed files with 804 additions and 104 deletions
+9 -48
View File
@@ -12,11 +12,9 @@ import (
"cosmossdk.io/depinject"
storetypes "cosmossdk.io/store/types"
circuitkeeper "cosmossdk.io/x/circuit/keeper"
"cosmossdk.io/x/upgrade"
upgradekeeper "cosmossdk.io/x/upgrade/keeper"
feegrantkeeper "cosmossdk.io/x/feegrant/keeper"
feegrantmodule "cosmossdk.io/x/feegrant/module"
cometabci "github.com/cometbft/cometbft/abci/types"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
@@ -29,36 +27,19 @@ import (
servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module"
"github.com/cosmos/cosmos-sdk/x/bank"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
"github.com/cosmos/cosmos-sdk/x/consensus"
consensuskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
"github.com/cosmos/cosmos-sdk/x/crisis"
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
distr "github.com/cosmos/cosmos-sdk/x/distribution"
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
"github.com/cosmos/cosmos-sdk/x/gov"
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper"
groupmodule "github.com/cosmos/cosmos-sdk/x/group/module"
"github.com/cosmos/cosmos-sdk/x/mint"
mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
"github.com/cosmos/cosmos-sdk/x/params"
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/cosmos/cosmos-sdk/x/slashing"
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
"github.com/skip-mev/block-sdk/abci"
@@ -68,8 +49,8 @@ import (
defaultlane "github.com/skip-mev/block-sdk/lanes/base"
"github.com/skip-mev/block-sdk/lanes/free"
"github.com/skip-mev/block-sdk/lanes/mev"
auctionmodule "github.com/skip-mev/block-sdk/x/auction"
auctionkeeper "github.com/skip-mev/block-sdk/x/auction/keeper"
blocksdkkeeper "github.com/skip-mev/block-sdk/x/blocksdk/keeper"
)
const (
@@ -81,33 +62,6 @@ var (
// DefaultNodeHome default home directories for the application daemon
DefaultNodeHome string
// ModuleBasics defines the module BasicManager is in charge of setting up basic,
// non-dependant module elements, such as codec registration
// and genesis verification.
ModuleBasics = module.NewBasicManager(
auth.AppModuleBasic{},
genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator),
bank.AppModuleBasic{},
staking.AppModuleBasic{},
mint.AppModuleBasic{},
distr.AppModuleBasic{},
gov.NewAppModuleBasic(
[]govclient.ProposalHandler{
paramsclient.ProposalHandler,
},
),
params.AppModuleBasic{},
crisis.AppModuleBasic{},
slashing.AppModuleBasic{},
upgrade.AppModuleBasic{},
authzmodule.AppModuleBasic{},
groupmodule.AppModuleBasic{},
vesting.AppModuleBasic{},
consensus.AppModuleBasic{},
auctionmodule.AppModuleBasic{},
feegrantmodule.AppModuleBasic{},
)
)
var (
@@ -138,6 +92,7 @@ type TestApp struct {
ConsensusParamsKeeper consensuskeeper.Keeper
CircuitBreakerKeeper circuitkeeper.Keeper
auctionkeeper auctionkeeper.Keeper
blocksdkKeeper blocksdkkeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
// custom checkTx handler
@@ -219,6 +174,7 @@ func New(
&app.AuthzKeeper,
&app.GroupKeeper,
&app.auctionkeeper,
&app.blocksdkKeeper,
&app.ConsensusParamsKeeper,
&app.FeeGrantKeeper,
&app.CircuitBreakerKeeper,
@@ -309,7 +265,12 @@ func New(
freeLane,
defaultLane,
}
mempool := block.NewLanedMempool(app.Logger(), true, lanes...)
mempool := block.NewLanedMempool(
app.Logger(),
true,
&app.blocksdkKeeper,
lanes...,
)
app.App.SetMempool(mempool)
// Create a global ante handler that will be called on each transaction when
+9
View File
@@ -49,6 +49,7 @@ import (
"google.golang.org/protobuf/types/known/durationpb"
_ "cosmossdk.io/x/circuit" // import for side-effects
_ "cosmossdk.io/x/feegrant/module" // import for side-effects
_ "cosmossdk.io/x/upgrade" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import for side-effects
_ "github.com/cosmos/cosmos-sdk/x/auth/vesting" // import for side-effects
@@ -66,8 +67,11 @@ import (
_ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects
auctionmodulev1 "github.com/skip-mev/block-sdk/api/sdk/auction/module/v1"
blocksdkmodulev1 "github.com/skip-mev/block-sdk/api/sdk/blocksdk/module/v1"
_ "github.com/skip-mev/block-sdk/x/auction" // import for side-effects
auctiontypes "github.com/skip-mev/block-sdk/x/auction/types"
_ "github.com/skip-mev/block-sdk/x/blocksdk" // import for side-effects
blocksdktypes "github.com/skip-mev/block-sdk/x/blocksdk/types"
)
var (
@@ -151,6 +155,7 @@ var (
consensustypes.ModuleName,
circuittypes.ModuleName,
auctiontypes.ModuleName,
blocksdktypes.ModuleName,
feegrant.ModuleName,
},
// When ExportGenesis is not specified, the export genesis module order
@@ -247,6 +252,10 @@ var (
Name: auctiontypes.ModuleName,
Config: appconfig.WrapAny(&auctionmodulev1.Module{}),
},
{
Name: blocksdktypes.ModuleName,
Config: appconfig.WrapAny(&blocksdkmodulev1.Module{}),
},
},
}),
depinject.Supply(