feat(ABCI): New Proposal Struct with Associated Metadata (#126)

* new proto types for proposal info

* new proposal type

* nits

* lane input

* lint

* feat(ABCI): Deprecating `CheckOrderHandler` with new Proposal MetaData (#127)

* refactor without checkorder

* nits

* more nits

* lint

* nits

* feat(ABCI): Updating MEV lane to have no `CheckOrder` handler + testing (#128)

* updating mev lane

* nits

* preventing adding multiple bid txs in prepare

* update
This commit is contained in:
David Terpay
2023-09-28 11:10:13 -04:00
committed by GitHub
parent 3abfde4f34
commit b9d6761776
38 changed files with 3702 additions and 1096 deletions
+5 -5
View File
@@ -5,12 +5,11 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/skip-mev/block-sdk/block"
"github.com/skip-mev/block-sdk/block/utils"
auctionante "github.com/skip-mev/block-sdk/x/auction/ante"
auctionkeeper "github.com/skip-mev/block-sdk/x/auction/keeper"
)
type POBHandlerOptions struct {
type BSDKHandlerOptions struct {
BaseOptions ante.HandlerOptions
Mempool block.Mempool
MEVLane auctionante.MEVLane
@@ -20,8 +19,9 @@ type POBHandlerOptions struct {
FreeLane block.Lane
}
// NewPOBAnteHandler wraps all of the default Cosmos SDK AnteDecorators with the POB AnteHandler.
func NewPOBAnteHandler(options POBHandlerOptions) sdk.AnteHandler {
// NewBSDKAnteHandler wraps all of the default Cosmos SDK AnteDecorators with the custom
// block-sdk AnteHandlers.
func NewBSDKAnteHandler(options BSDKHandlerOptions) sdk.AnteHandler {
if options.BaseOptions.AccountKeeper == nil {
panic("account keeper is required for ante builder")
}
@@ -41,7 +41,7 @@ func NewPOBAnteHandler(options POBHandlerOptions) sdk.AnteHandler {
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.BaseOptions.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.BaseOptions.AccountKeeper),
utils.NewIgnoreDecorator(
block.NewIgnoreDecorator(
ante.NewDeductFeeDecorator(
options.BaseOptions.AccountKeeper,
options.BaseOptions.BankKeeper,
+3 -2
View File
@@ -321,7 +321,7 @@ func New(
SigGasConsumer: ante.DefaultSigVerificationGasConsumer,
SignModeHandler: app.txConfig.SignModeHandler(),
}
options := POBHandlerOptions{
options := BSDKHandlerOptions{
BaseOptions: handlerOptions,
auctionkeeper: app.auctionkeeper,
TxDecoder: app.txConfig.TxDecoder(),
@@ -330,7 +330,7 @@ func New(
MEVLane: mevLane,
Mempool: mempool,
}
anteHandler := NewPOBAnteHandler(options)
anteHandler := NewBSDKAnteHandler(options)
// Set the lane config on the lanes.
for _, lane := range lanes {
@@ -342,6 +342,7 @@ func New(
proposalHandler := abci.NewProposalHandler(
app.Logger(),
app.TxConfig().TxDecoder(),
app.TxConfig().TxEncoder(),
mempool,
)
app.App.SetPrepareProposal(proposalHandler.PrepareProposalHandler())
+1 -1
View File
@@ -54,7 +54,7 @@ func (s *IntegrationTestSuite) WithDenom(denom string) *IntegrationTestSuite {
s.denom = denom
// update the bech32 prefixes
sdk.GetConfig().SetBech32PrefixForAccount(s.denom, s.denom+ sdk.PrefixPublic)
sdk.GetConfig().SetBech32PrefixForAccount(s.denom, s.denom+sdk.PrefixPublic)
sdk.GetConfig().SetBech32PrefixForValidator(s.denom+sdk.PrefixValidator, s.denom+sdk.PrefixValidator+sdk.PrefixPublic)
sdk.GetConfig().Seal()
return s
+18 -12
View File
@@ -1,17 +1,18 @@
package integration
import (
"archive/tar"
"bytes"
"context"
"encoding/hex"
"encoding/json"
"io"
"os"
"path"
"strings"
"testing"
"time"
"os"
"io"
"path"
"archive/tar"
"bytes"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
@@ -39,7 +40,7 @@ import (
type KeyringOverride struct {
keyringOptions keyring.Option
cdc codec.Codec
cdc codec.Codec
}
// ChainBuilderFromChainSpec creates an interchaintest chain builder factory given a ChainSpec
@@ -189,8 +190,8 @@ func (s *IntegrationTestSuite) BroadcastTxs(ctx context.Context, chain *cosmos.C
// will not block on the tx's inclusion in a block, otherwise this method will block on the tx's inclusion. The callback
// function is called for each tx that is included in a block.
func (s *IntegrationTestSuite) BroadcastTxsWithCallback(
ctx context.Context,
chain *cosmos.CosmosChain,
ctx context.Context,
chain *cosmos.CosmosChain,
msgsPerUser []Tx,
cb func(tx []byte, resp *rpctypes.ResultTx),
) [][]byte {
@@ -204,6 +205,11 @@ func (s *IntegrationTestSuite) BroadcastTxsWithCallback(
s.Require().True(len(chain.Nodes()) > 0)
client := chain.Nodes()[0].Client
statusResp, err := client.Status(context.Background())
s.Require().NoError(err)
s.T().Logf("broadcasting transactions at latest height of %d", statusResp.SyncInfo.LatestBlockHeight)
for i, tx := range txs {
// broadcast tx
resp, err := client.BroadcastTxSync(ctx, tx)
@@ -343,7 +349,7 @@ func Block(t *testing.T, chain *cosmos.CosmosChain, height int64) *rpctypes.Resu
// WaitForHeight waits for the chain to reach the given height
func WaitForHeight(t *testing.T, chain *cosmos.CosmosChain, height uint64) {
// wait for next height
err := testutil.WaitForCondition(30*time.Second, 100 * time.Millisecond, func() (bool, error) {
err := testutil.WaitForCondition(30*time.Second, 100*time.Millisecond, func() (bool, error) {
pollHeight, err := chain.Height(context.Background())
if err != nil {
return false, err
@@ -357,13 +363,13 @@ func WaitForHeight(t *testing.T, chain *cosmos.CosmosChain, height uint64) {
func VerifyBlock(t *testing.T, block *rpctypes.ResultBlock, offset int, bidTxHash string, txs [][]byte) {
// verify the block
if bidTxHash != "" {
require.Equal(t, bidTxHash, TxHash(block.Block.Data.Txs[offset]))
require.Equal(t, bidTxHash, TxHash(block.Block.Data.Txs[offset+1]))
offset += 1
}
// verify the txs in sequence
for i, tx := range txs {
require.Equal(t, TxHash(tx), TxHash(block.Block.Data.Txs[i+offset]))
require.Equal(t, TxHash(tx), TxHash(block.Block.Data.Txs[i+offset+1]))
}
}
@@ -403,7 +409,7 @@ func (s *IntegrationTestSuite) setupBroadcaster() {
}
// sniped from here: https://github.com/strangelove-ventures/interchaintest ref: 9341b001214d26be420f1ca1ab0f15bad17faee6
func (s *IntegrationTestSuite) keyringDirFromNode() (string) {
func (s *IntegrationTestSuite) keyringDirFromNode() string {
node := s.chain.(*cosmos.CosmosChain).Nodes()[0]
// create a temp-dir