From 91cc550cb171f97e11a1deee210854443b21672b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Dec 2023 07:31:27 -0500 Subject: [PATCH 1/2] chore(deps): bump golang.org/x/tools from 0.15.0 to 0.16.0 (#257) Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.15.0 to 0.16.0. - [Release notes](https://github.com/golang/tools/releases) - [Commits](https://github.com/golang/tools/compare/v0.15.0...v0.16.0) --- updated-dependencies: - dependency-name: golang.org/x/tools dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 10 +++++----- go.sum | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index 84b9f9fa..81cf18f6 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( github.com/spf13/cobra v1.8.0 github.com/spf13/viper v1.16.0 github.com/stretchr/testify v1.8.4 - golang.org/x/tools v0.15.0 + golang.org/x/tools v0.16.0 google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 google.golang.org/grpc v1.59.0 google.golang.org/protobuf v1.31.0 @@ -291,15 +291,15 @@ require ( go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.10.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.15.0 // indirect + golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect golang.org/x/mod v0.14.0 // indirect - golang.org/x/net v0.18.0 // indirect + golang.org/x/net v0.19.0 // indirect golang.org/x/oauth2 v0.12.0 // indirect golang.org/x/sync v0.5.0 // indirect - golang.org/x/sys v0.14.0 // indirect - golang.org/x/term v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.143.0 // indirect diff --git a/go.sum b/go.sum index 87d7aee3..908324b4 100644 --- a/go.sum +++ b/go.sum @@ -1326,8 +1326,8 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= -golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= +golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us= golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= @@ -1428,8 +1428,8 @@ golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= -golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1585,16 +1585,16 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.14.0 h1:LGK9IlZ8T9jvdy6cTdfKUCltatMFOehAQo9SRC46UQ8= -golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww= +golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1689,8 +1689,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8= -golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk= +golang.org/x/tools v0.16.0 h1:GO788SKMRunPIBCXiQyo2AaexLstOrVhuAL5YwsckQM= +golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From d2a7f21514911603d2bb0c107f28f0c0818505cd Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 4 Dec 2023 10:14:21 -0500 Subject: [PATCH 2/2] chore: Update Lane Specific Readmes (backport #254) (#255) * chore: Update Lane Specific Readmes (#254) * nits * e2e shorter testing time (cherry picked from commit 4bfb7ce5252582dd7c8f7b763088bb2bc8754cb0) # Conflicts: # abci/abci.go # block/proposals/proposals_test.go # lanes/base/abci_test.go # lanes/build-your-own/README.md # lanes/mev/abci_test.go # lanes/terminator/lane.go * lint fix * read me fix --------- Co-authored-by: David Terpay <35130517+davidterpay@users.noreply.github.com> Co-authored-by: David Terpay --- abci/abci.go | 4 +- block/proposals/proposals.go | 15 +++--- block/proposals/proposals_test.go | 20 ++++---- lanes/base/README.md | 11 ++-- lanes/base/abci_test.go | 76 +++++++++------------------- lanes/build-your-own/README.md | 83 +++++++++++++++++-------------- lanes/free/README.md | 9 ++-- lanes/mev/README.md | 6 ++- lanes/mev/abci_test.go | 44 ++++++++-------- lanes/terminator/lane.go | 3 -- 10 files changed, 122 insertions(+), 149 deletions(-) diff --git a/abci/abci.go b/abci/abci.go index 96c80de0..7e0cf256 100644 --- a/abci/abci.go +++ b/abci/abci.go @@ -68,7 +68,7 @@ func (h *ProposalHandler) PrepareProposalHandler() sdk.PrepareProposalHandler { ) // Fill the proposal with transactions from each lane. - finalProposal, err := h.prepareLanesHandler(ctx, proposals.NewProposalWithContext(h.logger, ctx, h.txEncoder)) + finalProposal, err := h.prepareLanesHandler(ctx, proposals.NewProposalWithContext(ctx, h.logger)) if err != nil { h.logger.Error("failed to prepare proposal", "err", err) return abci.ResponsePrepareProposal{Txs: make([][]byte, 0)} @@ -126,7 +126,7 @@ func (h *ProposalHandler) ProcessProposalHandler() sdk.ProcessProposalHandler { // Build handler that will verify the partial proposals according to each lane's verification logic. processLanesHandler := ChainProcessLanes(h.mempool.Registry()) - finalProposal, err := processLanesHandler(ctx, proposals.NewProposalWithContext(h.logger, ctx, h.txEncoder), decodedTxs) + finalProposal, err := processLanesHandler(ctx, proposals.NewProposalWithContext(ctx, h.logger), decodedTxs) if err != nil { h.logger.Error("failed to validate the proposal", "err", err) return abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_REJECT} diff --git a/block/proposals/proposals.go b/block/proposals/proposals.go index d3a00a06..162f6d38 100644 --- a/block/proposals/proposals.go +++ b/block/proposals/proposals.go @@ -17,27 +17,24 @@ type ( Txs [][]byte // Cache is a cache of the selected transactions in the proposal. Cache map[string]struct{} - // TxEncoder is the transaction encoder. - TxEncoder sdk.TxEncoder // Info contains information about the state of the proposal. Info types.ProposalInfo } ) // NewProposalWithContext returns a new empty proposal. -func NewProposalWithContext(logger log.Logger, ctx sdk.Context, txEncoder sdk.TxEncoder) Proposal { +func NewProposalWithContext(ctx sdk.Context, logger log.Logger) Proposal { maxBlockSize, maxGasLimit := GetBlockLimits(ctx) - return NewProposal(logger, txEncoder, maxBlockSize, maxGasLimit) + return NewProposal(logger, maxBlockSize, maxGasLimit) } // NewProposal returns a new empty proposal. Any transactions added to the proposal // will be subject to the given max block size and max gas limit. -func NewProposal(logger log.Logger, txEncoder sdk.TxEncoder, maxBlockSize int64, maxGasLimit uint64) Proposal { +func NewProposal(logger log.Logger, maxBlockSize int64, maxGasLimit uint64) Proposal { return Proposal{ - Logger: logger, - TxEncoder: txEncoder, - Txs: make([][]byte, 0), - Cache: make(map[string]struct{}), + Logger: logger, + Txs: make([][]byte, 0), + Cache: make(map[string]struct{}), Info: types.ProposalInfo{ TxsByLane: make(map[string]uint64), MaxBlockSize: maxBlockSize, diff --git a/block/proposals/proposals_test.go b/block/proposals/proposals_test.go index 5404721e..0e38cad1 100644 --- a/block/proposals/proposals_test.go +++ b/block/proposals/proposals_test.go @@ -32,7 +32,7 @@ func TestUpdateProposal(t *testing.T) { lane.On("GetMaxBlockSpace").Return(math.LegacyNewDec(1)).Maybe() t.Run("can update with no transactions", func(t *testing.T) { - proposal := proposals.NewProposal(log.NewNopLogger(), nil, 100, 100) + proposal := proposals.NewProposal(log.NewNopLogger(), 100, 100) err := proposal.UpdateProposal(lane, nil) require.NoError(t, err) @@ -64,7 +64,7 @@ func TestUpdateProposal(t *testing.T) { size := len(txBzs[0]) gasLimit := 100 - proposal := proposals.NewProposal(log.NewNopLogger(), encodingConfig.TxConfig.TxEncoder(), int64(size), uint64(gasLimit)) + proposal := proposals.NewProposal(log.NewNopLogger(), int64(size), uint64(gasLimit)) txsWithInfo, err := getTxsWithInfo([]sdk.Tx{tx}) require.NoError(t, err) @@ -113,7 +113,7 @@ func TestUpdateProposal(t *testing.T) { gasLimit += 100 } - proposal := proposals.NewProposal(log.NewNopLogger(), encodingConfig.TxConfig.TxEncoder(), int64(size), gasLimit) + proposal := proposals.NewProposal(log.NewNopLogger(), int64(size), gasLimit) txsWithInfo, err := getTxsWithInfo(txs) require.NoError(t, err) @@ -153,7 +153,7 @@ func TestUpdateProposal(t *testing.T) { size := int64(len(txBzs[0])) gasLimit := uint64(100) - proposal := proposals.NewProposal(log.NewNopLogger(), encodingConfig.TxConfig.TxEncoder(), size, gasLimit) + proposal := proposals.NewProposal(log.NewNopLogger(), size, gasLimit) txsWithInfo, err := getTxsWithInfo([]sdk.Tx{tx}) require.NoError(t, err) @@ -219,7 +219,7 @@ func TestUpdateProposal(t *testing.T) { size := len(txBzs[0]) + len(txBzs[1]) gasLimit := 200 - proposal := proposals.NewProposal(log.NewNopLogger(), encodingConfig.TxConfig.TxEncoder(), int64(size), uint64(gasLimit)) + proposal := proposals.NewProposal(log.NewNopLogger(), int64(size), uint64(gasLimit)) txsWithInfo, err := getTxsWithInfo([]sdk.Tx{tx}) require.NoError(t, err) @@ -263,7 +263,7 @@ func TestUpdateProposal(t *testing.T) { size := len(txBzs[0]) gasLimit := 100 - proposal := proposals.NewProposal(log.NewNopLogger(), encodingConfig.TxConfig.TxEncoder(), int64(size), uint64(gasLimit)) + proposal := proposals.NewProposal(log.NewNopLogger(), int64(size), uint64(gasLimit)) lane := mocks.NewLane(t) @@ -304,7 +304,7 @@ func TestUpdateProposal(t *testing.T) { size := len(txBzs[0]) gasLimit := 100 - proposal := proposals.NewProposal(log.NewNopLogger(), encodingConfig.TxConfig.TxEncoder(), int64(size), uint64(gasLimit)) + proposal := proposals.NewProposal(log.NewNopLogger(), int64(size), uint64(gasLimit)) lane := mocks.NewLane(t) @@ -345,7 +345,7 @@ func TestUpdateProposal(t *testing.T) { size := len(txBzs[0]) gasLimit := 100 - proposal := proposals.NewProposal(log.NewNopLogger(), encodingConfig.TxConfig.TxEncoder(), int64(size)-1, uint64(gasLimit)) + proposal := proposals.NewProposal(log.NewNopLogger(), int64(size)-1, uint64(gasLimit)) txsWithInfo, err := getTxsWithInfo([]sdk.Tx{tx}) require.NoError(t, err) @@ -381,7 +381,7 @@ func TestUpdateProposal(t *testing.T) { size := len(txBzs[0]) gasLimit := 100 - proposal := proposals.NewProposal(log.NewNopLogger(), encodingConfig.TxConfig.TxEncoder(), int64(size), uint64(gasLimit)-1) + proposal := proposals.NewProposal(log.NewNopLogger(), int64(size), uint64(gasLimit)-1) txsWithInfo, err := getTxsWithInfo([]sdk.Tx{tx}) require.NoError(t, err) @@ -425,7 +425,7 @@ func TestUpdateProposal(t *testing.T) { txBzs, err := utils.GetEncodedTxs(encodingConfig.TxConfig.TxEncoder(), []sdk.Tx{tx, tx2}) require.NoError(t, err) - proposal := proposals.NewProposal(log.NewNopLogger(), encodingConfig.TxConfig.TxEncoder(), 10000, 10000) + proposal := proposals.NewProposal(log.NewNopLogger(), 10000, 10000) txsWithInfo, err := getTxsWithInfo([]sdk.Tx{tx}) require.NoError(t, err) diff --git a/lanes/base/README.md b/lanes/base/README.md index 451a4d92..4f0b52c3 100644 --- a/lanes/base/README.md +++ b/lanes/base/README.md @@ -15,6 +15,8 @@ $ go install github.com/skip-mev/block-sdk ## 📚 Usage +> Note: Please visit [app.go](../../tests/app/lanes.go) to see a sample base app set up. + 1. First determine the set of lanes that you want to use in your application. The available lanes can be found in our [Lane App Store](https://docs.skip.money/chains/lanes/existing-lanes/default). @@ -45,8 +47,7 @@ func NewApp() { // 1. Create the lanes. // // NOTE: The lanes are ordered by priority. The first lane is the highest priority - // lane and the last lane is the lowest priority lane. Top of block lane allows - // transactions to bid for inclusion at the top of the next block. + // lane and the last lane is the lowest priority lane. // // For more information on how to utilize the LaneConfig please // visit the README in docs.skip.money/chains/lanes/build-your-own-lane#-lane-config. @@ -57,15 +58,15 @@ func NewApp() { TxEncoder: app.txConfig.TxEncoder(), TxDecoder: app.txConfig.TxDecoder(), MaxBlockSpace: math.LegacyZeroDec(), - MaxTxs: 0, + MaxTxs: 5000, } - defaultLane := defaultlane.NewDefaultLane(defaultConfig) + defaultLane := defaultlane.NewDefaultLane(defaultConfig, base.DefaultMatchHandler()) // 2. Set up the relative priority of lanes lanes := []block.Lane{ defaultLane, } - mempool := block.NewLanedMempool(app.Logger(), true, lanes...) + mempool := block.NewLanedMempool(app.Logger(), lanes) app.App.SetMempool(mempool) ... diff --git a/lanes/base/abci_test.go b/lanes/base/abci_test.go index e715ebb0..d1610408 100644 --- a/lanes/base/abci_test.go +++ b/lanes/base/abci_test.go @@ -46,8 +46,7 @@ func (s *BaseTestSuite) TestPrepareLane() { s.Require().NoError(err) emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), int64(len(txBz)), 1, ) @@ -90,8 +89,7 @@ func (s *BaseTestSuite) TestPrepareLane() { MaxGasLimit: 10, } emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), limit.MaxTxBytes, limit.MaxGasLimit, ) @@ -135,8 +133,7 @@ func (s *BaseTestSuite) TestPrepareLane() { MaxGasLimit: 10, } emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), limit.MaxTxBytes, limit.MaxGasLimit, ) @@ -179,8 +176,7 @@ func (s *BaseTestSuite) TestPrepareLane() { MaxGasLimit: 10, } emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), limit.MaxTxBytes, limit.MaxGasLimit, ) @@ -220,8 +216,7 @@ func (s *BaseTestSuite) TestPrepareLane() { s.Require().NoError(err) emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), int64(len(txBz)), 10, ) @@ -280,8 +275,7 @@ func (s *BaseTestSuite) TestPrepareLane() { size := int64(len(txBz1)) + int64(len(txBz2)) gasLimit := uint64(20) emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), size, gasLimit, ) @@ -337,8 +331,7 @@ func (s *BaseTestSuite) TestPrepareLane() { size := int64(len(txBz1)) + int64(len(txBz2)) gasLimit := uint64(2) emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), size, gasLimit, ) @@ -397,8 +390,7 @@ func (s *BaseTestSuite) TestPrepareLane() { size := int64(len(txBz1)) + int64(len(txBz2)) - 1 gasLimit := uint64(3) emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), size, gasLimit, ) @@ -457,8 +449,7 @@ func (s *BaseTestSuite) TestPrepareLane() { size := int64(len(txBz1)) + int64(len(txBz2)) - 1 gasLimit := uint64(1) emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), size, gasLimit, ) @@ -499,8 +490,7 @@ func (s *BaseTestSuite) TestPrepareLane() { s.Require().NoError(err) emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), int64(len(txBz))*10, 1000000, ) @@ -557,7 +547,6 @@ func (s *BaseTestSuite) TestPrepareLane() { emptyProposal := proposals.NewProposal( log.NewNopLogger(), - s.encodingConfig.TxConfig.TxEncoder(), int64(len(txBz))*10, 1000000, ) @@ -611,8 +600,7 @@ func (s *BaseTestSuite) TestProcessLane() { s.Require().Len(remainingTxs, 0) emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), 100000, 100000, ) @@ -682,8 +670,7 @@ func (s *BaseTestSuite) TestProcessLane() { s.Require().Len(remainingTxs, 0) emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), 100000, 100000, ) @@ -765,8 +752,7 @@ func (s *BaseTestSuite) TestProcessLane() { s.Require().Len(remainingTxs, 0) emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), 100000, 100000, ) @@ -808,8 +794,7 @@ func (s *BaseTestSuite) TestProcessLane() { s.Require().Len(remainingTxs, 0) emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), 100000, 100000, ) @@ -851,8 +836,7 @@ func (s *BaseTestSuite) TestProcessLane() { s.Require().Len(remainingTxs, 0) emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), 100000, 100000, ) @@ -913,8 +897,7 @@ func (s *BaseTestSuite) TestProcessLane() { s.Require().Len(remainingTxs, 0) emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), 100000, 100000, ) @@ -965,8 +948,7 @@ func (s *BaseTestSuite) TestProcessLane() { s.Require().Len(remainingTxs, 0) emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), 100000, 100000, ) @@ -1022,8 +1004,7 @@ func (s *BaseTestSuite) TestProcessLane() { s.Require().Len(remainingTxs, 0) emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), 100000, 100000, ) @@ -1080,8 +1061,7 @@ func (s *BaseTestSuite) TestProcessLane() { s.Require().Len(remainingTxs, 0) emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), 100000, 100000, ) @@ -1120,8 +1100,7 @@ func (s *BaseTestSuite) TestProcessLane() { // Set the size to be 1 less than the size of the transaction maxSize := s.getTxSize(tx1) - 1 emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), maxSize, 1000000, ) @@ -1159,8 +1138,7 @@ func (s *BaseTestSuite) TestProcessLane() { maxSize := s.getTxSize(tx1) emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), maxSize, 9, ) @@ -1210,8 +1188,7 @@ func (s *BaseTestSuite) TestProcessLane() { maxSize := s.getTxSize(tx1) + s.getTxSize(tx2) emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), maxSize, 19, ) @@ -1261,8 +1238,7 @@ func (s *BaseTestSuite) TestProcessLane() { maxSize := s.getTxSize(tx1) + s.getTxSize(tx2) - 1 emptyProposal := proposals.NewProposal( - log.NewTMLogger(os.Stdout), - s.encodingConfig.TxConfig.TxEncoder(), + log.NewNopLogger(), maxSize, 20, ) @@ -1344,7 +1320,6 @@ func (s *BaseTestSuite) TestProcessLane() { emptyProposal := proposals.NewProposal( log.NewNopLogger(), - s.encodingConfig.TxConfig.TxEncoder(), 1000, 1000, ) @@ -1424,7 +1399,6 @@ func (s *BaseTestSuite) TestProcessLane() { emptyProposal := proposals.NewProposal( log.NewNopLogger(), - s.encodingConfig.TxConfig.TxEncoder(), 1000, 1000, ) @@ -1508,7 +1482,6 @@ func (s *BaseTestSuite) TestProcessLane() { emptyProposal := proposals.NewProposal( log.NewNopLogger(), - s.encodingConfig.TxConfig.TxEncoder(), 1000, 1000, ) @@ -1560,7 +1533,6 @@ func (s *BaseTestSuite) TestPrepareProcessParity() { // Construct a block proposal with the transactions in the mempool emptyProposal := proposals.NewProposal( log.NewNopLogger(), - s.encodingConfig.TxConfig.TxEncoder(), 1000000000000000, 1000000000000000, ) @@ -1581,7 +1553,6 @@ func (s *BaseTestSuite) TestPrepareProcessParity() { // Verify the same proposal with the process lanes handler emptyProposal = proposals.NewProposal( log.NewNopLogger(), - s.encodingConfig.TxConfig.TxEncoder(), 1000000000000000, 1000000000000000, ) @@ -1640,7 +1611,6 @@ func (s *BaseTestSuite) TestIterateMempoolAndProcessProposalParity() { emptyProposal := proposals.NewProposal( log.NewNopLogger(), - s.encodingConfig.TxConfig.TxEncoder(), 1000000000000000, 1000000000000000, ) diff --git a/lanes/build-your-own/README.md b/lanes/build-your-own/README.md index d5ecc61c..0718b0cc 100644 --- a/lanes/build-your-own/README.md +++ b/lanes/build-your-own/README.md @@ -19,7 +19,7 @@ The Block SDK is designed to be modular and extensible. This means that developers can build their own lanes and customize the block building/verification logic to fit their needs. This guide will walk through the process of building a custom lane and configuring it in the application. Developers should -extend the base lane (`block/base/lane.go`) to build their own lanes. +extend the base lane [`block/base/lane.go`](../../block/base/README.md) to build their own lanes. There are **five** components to building a custom lane using the base lane: @@ -38,7 +38,7 @@ handler for processing transactions that are included in block proposals. This is the data structure that is responsible for storing transactions as they are being verified and are waiting to be included in proposals. -`block/base/mempool.go` provides an out-of-the-box implementation that should be +[`block/base/mempool.go`](../../block/base/mempool.go) provides an out-of-the-box implementation that should be used as a starting point for building out the mempool and should cover most use cases. To utilize the mempool, you must implement a `TxPriority[C]` struct that does the following: @@ -52,7 +52,7 @@ does the following: * Implements a `MinValue` method that returns the minimum priority value that a transaction can have. -The default implementation can be found in `block/base/mempool.go` - see `DefaultTxPriority`. +The default implementation can be found in [`block/base/mempool.go`](../../block/base/mempool.go) - see `DefaultTxPriority`. > Scenario What if we wanted to prioritize transactions by the amount they have staked on @@ -153,11 +153,10 @@ lane := base.NewBaseLane( ### 2. 🤝 MatchHandler `MatchHandler` is utilized to determine if a transaction should be included in -the lane. **This function can be a stateless or stateful check on the -transaction!** The default implementation can be found in `block/base/handlers.go`. +the lane. The default implementation can be found in `block/base/handlers.go`. The match handler can be as custom as desired. Following the example above, if -we wanted to make a lane that only accepts transactions if they have a large +we wanted to make a lane that only accepts staking transactions if they have a large amount staked, we could do the following: ```golang @@ -220,11 +219,24 @@ lane := base.NewBaseLane( ) ``` -### [OPTIONAL] Steps 3-5 +#### Considerations + +The default lane's match handler is a simple implementation that matches +any transaction. As such, it is important to note that the order in which +lanes are added to the `LanedMempool` matters. Transactions are only +considered for inclusion in the first lane that matches them. If no lanes +match the transaction, it will be rejected. + +To that, if you want to configure a lane that should come after the default +lane, we recommend you utilize the `NewMatchHandler` defined in +[`block/base/handlers.go`](../../block/base/handlers.go). This will allow you to +create a match handler that matches transactions that the default match handler does not match. + +### [OPTIONAL] Steps 3-4 The remaining steps walk through the process of creating custom block building/verification logic. The default implementation found in -`block/base/handlers.go` should fit most use cases. Please reference that file +[`block/base/handlers.go`](../../block/base/handlers.go) should fit most use cases. Please reference that file for more details on the default implementation and whether it fits your use case. Implementing custom block building/verification logic is a bit more involved @@ -235,19 +247,19 @@ you implement any of the handlers, you must implement all of them in most cases. ### 3. 🛠️ PrepareLaneHandler The `PrepareLaneHandler` is an optional field you can set on the base lane. -This handler is responsible for the transaction selection logic when a new proposal +This handler is responsible for the transaction selection and verification logic when a new proposal is requested. The handler should return the following for a given lane: 1. The transactions to be included in the block proposal. 2. The transactions to be removed from the lane's mempool. -3. An error if the lane is unable to prepare a block proposal. +3. An error if the lane is unable to prepare a block proposal. An error should only be returned if the lane is unable to prepare a block proposal due to an internal error. When collecting transactions to include in the block proposal, the handler must respect the lane limits - i.e. the maximum number of bytes and units of gas that the lane can use in the block proposal. This is defined in the -`limit proposals.LaneLimits` struct. +`proposals.LaneLimits` struct. ```golang type ( @@ -297,35 +309,41 @@ customLane := NewCustomLane( customLane.SetPrepareLaneHandler(customlane.PrepareLaneHandler()) ``` -See `lanes/mev/abci.go` for an example of how to set up a custom `PrepareLaneHandler`. +See [`lanes/mev/abci.go`](../mev/abci.go) for an example of how to set up a custom `PrepareLaneHandler`. ### 4. 🆗 ProcessLaneHandler The `ProcessLaneHandler` is an optional field you can set on the base lane. This handler is responsible for verifying the transactions in the block proposal -that belong to the lane. +that belong to the lane and returning transactions that do not belong to the lane. ```golang -// ProcessLaneHandler is responsible for processing transactions that are -// included in a block and belong to a given lane. This handler must return an -// error if the transactions are not correctly ordered, do not belong to this -// lane, or any other relevant error. -ProcessLaneHandler func(ctx sdk.Context, partialProposal []sdk.Tx) error +// ProcessLaneHandler is responsible for processing transactions that are included in a block and +// belong to a given lane. The handler must return the transactions that were successfully processed +// and the transactions that it cannot process because they belong to a different lane. +type ProcessLaneHandler func(ctx sdk.Context, partialProposal []sdk.Tx) ( + txsFromLane []sdk.Tx, + remainingTxs []sdk.Tx, + err error, +) ``` -The `partialProposal` is a slice of transactions that belong to the lane and -are included in the block proposal. The handler should return an error if the -transactions are not correctly ordered, do not belong to this lane, or any -other relevant error. +The `partialProposal` is a slice of transactions that may or may not belong to the lane and +are included in the block proposal. Transactions that belong to your lane _must_ be contiguous +from the start of the slice. All transactions that do not belong to your lane _must_ be contiguous +from the end of the slice. Given the description above, the default implementation is simple. It will continue to verify transactions in the block proposal under the following criteria: -1. All of the transactions included in `partialProposal` must belong to this -lane i.e. they must match the lane's `MatchHandler`. +1. All of the transactions included in `partialProposal` that _match_ the lane +must be continuous from the start of the slice. If they are interleaved with +transactions that do not match the lane, the handler will return an error. 2. All of the transactions must be ordered respecting the ordering rules of the mempool i.e. the transactions must be ordered by their priority which is defined -by the `TxPriority[C]` struct. +by the `TxPriority[C]` struct. Since the mempool is responsible for ordering +transactions, you can utilize the `Compare` method defined be the mempool to +verify the ordering of the transactions. 3. All of the transactions must be valid and pass the AnteHandler check. Similar to the setup of handlers above, if a more involved verification process @@ -346,7 +364,7 @@ customLane := NewCustomLane( customLane.SetProcessLaneHandler(customlane.ProcessLaneHandler()) ``` -See `lanes/mev/abci.go` for an example of how to set up a custom `ProcessLaneHandler`. +See [`lanes/mev/abci.go`](../mev/abci.go) for an example of how to set up a custom `ProcessLaneHandler`. ### 5. 📝 Lane Configuration @@ -365,7 +383,6 @@ config := base.LaneConfig{ AnteHandler: app.AnteHandler(), MaxTxs: 0, MaxBlockSpace: math.LegacyZeroDec(), - IgnoreList: []block.Lane{}, } ``` @@ -378,7 +395,7 @@ transactions as they are being considered for a new proposal or are being processed in a proposed block. We recommend user's utilize the same antehandler chain that is used in the base app. If developers want a certain `AnteDecorator` to be ignored if it qualifies for a given lane, they can do so by using the -`NewIgnoreDecorator` defined in `block/ante.go`. +`NewIgnoreDecorator` defined in [`block/ante.go`](../../block/ante.go). For example, a free lane might want to ignore the `DeductFeeDecorator` so that its transactions are not charged any fees. Where ever the `AnteHandler` is @@ -425,16 +442,6 @@ transactions as possible. If a block proposal request has a `MaxTxBytes` of 1000 and the lane has a `MaxBlockSpace` of 0.5, the lane will attempt to fill the block with 500 bytes. -#### **[OPTIONAL] IgnoreList** - -`IgnoreList` defines the list of lanes to ignore when processing transactions. -For example, say there are two lanes: default and free. The free lane is -processed after the default lane. In this case, the free lane should be added -to the ignore list of the default lane. Otherwise, the transactions that belong -to the free lane will be processed by the default lane (which accepts all -transactions by default). - - ### Set up Once you have created your custom lane, you can configure it in the application diff --git a/lanes/free/README.md b/lanes/free/README.md index 090a7655..3b5dbcd0 100644 --- a/lanes/free/README.md +++ b/lanes/free/README.md @@ -15,6 +15,8 @@ $ go install github.com/skip-mev/block-sdk ## 📚 Usage +> Note: Please visit [app.go](../../tests/app/lanes.go) to see a sample base app set up. + 1. First determine the set of lanes that you want to use in your application. The available lanes can be found in our [Lane App Store](https://docs.skip.money/chains/lanes/existing-lanes/default). @@ -49,8 +51,7 @@ func NewApp() { // 1. Create the lanes. // // NOTE: The lanes are ordered by priority. The first lane is the highest priority - // lane and the last lane is the lowest priority lane. Top of block lane allows - // transactions to bid for inclusion at the top of the next block. + // lane and the last lane is the lowest priority lane. // // For more information on how to utilize the LaneConfig please // visit the README in docs.skip.money/chains/lanes/build-your-own-lane#-lane-config. @@ -73,14 +74,14 @@ func NewApp() { MaxBlockSpace: math.LegacyZeroDec(), MaxTxs: 0, } - defaultLane := defaultlane.NewDefaultLane(defaultConfig) + defaultLane := defaultlane.NewDefaultLane(defaultConfig, base.DefaultMatchHandler()) // 2. Set up the relative priority of lanes lanes := []block.Lane{ freeLane, defaultLane, } - mempool := block.NewLanedMempool(app.Logger(), true, lanes...) + mempool := block.NewLanedMempool(app.Logger(), lanes) app.App.SetMempool(mempool) ... diff --git a/lanes/mev/README.md b/lanes/mev/README.md index 2e959d49..0ffb1996 100644 --- a/lanes/mev/README.md +++ b/lanes/mev/README.md @@ -15,11 +15,13 @@ $ go install github.com/skip-mev/block-sdk ## 📚 Usage +> Note: Please visit [app.go](../../tests/app/lanes.go) to see a sample base app set up. + 1. This guide assumes you have already set up the [Block SDK (and the default lane)](https://docs.skip.money/chains/overview) 2. You will need to instantiate the `x/auction` module into your application. This module is responsible for processing auction transactions and distributing revenue to the auction house. The `x/auction` module is also responsible for ensuring the -validity of auction transactions. *The `x/auction` module should not exist on its +validity of auction transactions. The `x/auction` module should not exist on its own. **This is the most intensive part of the set up process.** 3. Next, add the MEV lane into the `lane` object on your `app.go`. The first lane is the highest priority lane and the last lane is the lowest priority lane. @@ -137,7 +139,7 @@ NOTE: This example walks through setting up the MEV and Default lanes. MaxBlockSpace: math.LegacyZeroDec(), MaxTxs: 0, } - defaultLane := base.NewStandardLane(defaultConfig) + defaultLane := base.NewStandardLane(defaultConfig, base.DefaultMatchHandler()) // 2. Set up the relative priority of lanes lanes := []block.Lane{ diff --git a/lanes/mev/abci_test.go b/lanes/mev/abci_test.go index a9f02e26..29463314 100644 --- a/lanes/mev/abci_test.go +++ b/lanes/mev/abci_test.go @@ -1,8 +1,6 @@ package mev_test import ( - "os" - "cosmossdk.io/math" "github.com/cometbft/cometbft/libs/log" sdk "github.com/cosmos/cosmos-sdk/types" @@ -16,7 +14,7 @@ import ( func (s *MEVTestSuite) TestPrepareLane() { s.Run("can prepare a lane with no txs in mempool", func() { lane := s.initLane(math.LegacyOneDec(), nil) - proposal := proposals.NewProposal(log.NewTMLogger(os.Stdout), s.encCfg.TxConfig.TxEncoder(), 200, 100) + proposal := proposals.NewProposal(log.NewNopLogger(), 200, 100) proposal, err := lane.PrepareLane(s.ctx, proposal, block.NoOpPrepareLanesHandler()) s.Require().NoError(err) @@ -42,7 +40,7 @@ func (s *MEVTestSuite) TestPrepareLane() { lane := s.initLane(math.LegacyOneDec(), map[sdk.Tx]bool{bidTx: true}) s.Require().NoError(lane.Insert(s.ctx, bidTx)) - proposal := proposals.NewProposal(log.NewTMLogger(os.Stdout), s.encCfg.TxConfig.TxEncoder(), 200, 100) + proposal := proposals.NewProposal(log.NewNopLogger(), 200, 100) proposal, err = lane.PrepareLane(s.ctx, proposal, block.NoOpPrepareLanesHandler()) s.Require().NoError(err) @@ -84,7 +82,7 @@ func (s *MEVTestSuite) TestPrepareLane() { s.Require().NoError(lane.Insert(s.ctx, bidTx1)) s.Require().NoError(lane.Insert(s.ctx, bidTx2)) - proposal := proposals.NewProposal(log.NewTMLogger(os.Stdout), s.encCfg.TxConfig.TxEncoder(), 20000, 100000) + proposal := proposals.NewProposal(log.NewNopLogger(), 20000, 100000) proposal, err = lane.PrepareLane(s.ctx, proposal, block.NoOpPrepareLanesHandler()) s.Require().NoError(err) @@ -126,7 +124,7 @@ func (s *MEVTestSuite) TestPrepareLane() { s.Require().NoError(lane.Insert(s.ctx, bidTx1)) s.Require().NoError(lane.Insert(s.ctx, bidTx2)) - proposal := proposals.NewProposal(log.NewTMLogger(os.Stdout), s.encCfg.TxConfig.TxEncoder(), 20000, 100000) + proposal := proposals.NewProposal(log.NewNopLogger(), 20000, 100000) proposal, err = lane.PrepareLane(s.ctx, proposal, block.NoOpPrepareLanesHandler()) s.Require().NoError(err) @@ -156,7 +154,7 @@ func (s *MEVTestSuite) TestPrepareLane() { lane := s.initLane(math.LegacyOneDec(), map[sdk.Tx]bool{bidTx: true, bundle[0]: true, bundle[1]: true}) s.Require().NoError(lane.Insert(s.ctx, bidTx)) - proposal := proposals.NewProposal(log.NewTMLogger(os.Stdout), s.encCfg.TxConfig.TxEncoder(), 20000, 100000) + proposal := proposals.NewProposal(log.NewNopLogger(), 20000, 100000) proposal, err = lane.PrepareLane(s.ctx, proposal, block.NoOpPrepareLanesHandler()) s.Require().NoError(err) @@ -187,7 +185,7 @@ func (s *MEVTestSuite) TestPrepareLane() { lane := s.initLane(math.LegacyOneDec(), map[sdk.Tx]bool{bidTx: true, bundle[0]: true, bundle[1]: true}) s.Require().NoError(lane.Insert(s.ctx, bidTx)) - proposal := proposals.NewProposal(log.NewTMLogger(os.Stdout), s.encCfg.TxConfig.TxEncoder(), s.getTxSize(bidTx), 100000) + proposal := proposals.NewProposal(log.NewNopLogger(), s.getTxSize(bidTx), 100000) proposal, err = lane.PrepareLane(s.ctx, proposal, block.NoOpPrepareLanesHandler()) s.Require().NoError(err) @@ -212,7 +210,7 @@ func (s *MEVTestSuite) TestPrepareLane() { lane := s.initLane(math.LegacyOneDec(), map[sdk.Tx]bool{bidTx: true}) s.Require().NoError(lane.Insert(s.ctx, bidTx)) - proposal := proposals.NewProposal(log.NewTMLogger(os.Stdout), s.encCfg.TxConfig.TxEncoder(), s.getTxSize(bidTx), 99) + proposal := proposals.NewProposal(log.NewNopLogger(), s.getTxSize(bidTx), 99) proposal, err = lane.PrepareLane(s.ctx, proposal, block.NoOpPrepareLanesHandler()) s.Require().NoError(err) @@ -226,7 +224,7 @@ func (s *MEVTestSuite) TestPrepareLane() { func (s *MEVTestSuite) TestProcessLane() { s.Run("can process an empty proposal", func() { lane := s.initLane(math.LegacyOneDec(), nil) - proposal := proposals.NewProposal(log.NewTMLogger(os.Stdout), s.encCfg.TxConfig.TxEncoder(), 200, 100) + proposal := proposals.NewProposal(log.NewNopLogger(), 200, 100) txsFromLane, remainingTxs, err := lane.ProcessLaneHandler()(s.ctx, nil) s.Require().NoError(err) @@ -243,7 +241,7 @@ func (s *MEVTestSuite) TestProcessLane() { s.Require().NoError(err) lane := s.initLane(math.LegacyOneDec(), nil) - proposal := proposals.NewProposal(log.NewTMLogger(os.Stdout), s.encCfg.TxConfig.TxEncoder(), 200, 100) + proposal := proposals.NewProposal(log.NewNopLogger(), 200, 100) txsFromLane, remainingTxs, err := lane.ProcessLaneHandler()(s.ctx, []sdk.Tx{tx}) s.Require().NoError(err) @@ -276,7 +274,7 @@ func (s *MEVTestSuite) TestProcessLane() { s.Require().Equal(0, len(txsFromLane)) s.Require().Equal(0, len(remainingTxs)) - proposal := proposals.NewProposal(log.NewNopLogger(), s.encCfg.TxConfig.TxEncoder(), 200000, 1000000) + proposal := proposals.NewProposal(log.NewNopLogger(), 200000, 1000000) _, err = lane.ProcessLane(s.ctx, proposal, partialProposal, block.NoOpProcessLanesHandler()) s.Require().Error(err) }) @@ -302,7 +300,7 @@ func (s *MEVTestSuite) TestProcessLane() { s.Require().Equal(0, len(txsFromLane)) s.Require().Equal(0, len(remainingTxs)) - proposal := proposals.NewProposal(log.NewNopLogger(), s.encCfg.TxConfig.TxEncoder(), 200000, 1000000) + proposal := proposals.NewProposal(log.NewNopLogger(), 200000, 1000000) _, err = lane.ProcessLane(s.ctx, proposal, partialProposal, block.NoOpProcessLanesHandler()) s.Require().Error(err) }) @@ -328,7 +326,7 @@ func (s *MEVTestSuite) TestProcessLane() { s.Require().Equal(0, len(txsFromLane)) s.Require().Equal(0, len(remainingTxs)) - proposal := proposals.NewProposal(log.NewNopLogger(), s.encCfg.TxConfig.TxEncoder(), 200000, 1000000) + proposal := proposals.NewProposal(log.NewNopLogger(), 200000, 1000000) _, err = lane.ProcessLane(s.ctx, proposal, partialProposal, block.NoOpProcessLanesHandler()) s.Require().Error(err) }) @@ -354,7 +352,7 @@ func (s *MEVTestSuite) TestProcessLane() { s.Require().Equal(0, len(txsFromLane)) s.Require().Equal(0, len(remainingTxs)) - proposal := proposals.NewProposal(log.NewNopLogger(), s.encCfg.TxConfig.TxEncoder(), 200000, 1000000) + proposal := proposals.NewProposal(log.NewNopLogger(), 200000, 1000000) _, err = lane.ProcessLane(s.ctx, proposal, partialProposal, block.NoOpProcessLanesHandler()) s.Require().Error(err) }) @@ -380,7 +378,7 @@ func (s *MEVTestSuite) TestProcessLane() { s.Require().Equal(3, len(txsFromLane)) s.Require().Equal(0, len(remainingTxs)) - proposal := proposals.NewProposal(log.NewNopLogger(), s.encCfg.TxConfig.TxEncoder(), 200000, 1000000) + proposal := proposals.NewProposal(log.NewNopLogger(), 200000, 1000000) _, err = lane.ProcessLane(s.ctx, proposal, partialProposal, block.NoOpProcessLanesHandler()) s.Require().NoError(err) }) @@ -406,7 +404,7 @@ func (s *MEVTestSuite) TestProcessLane() { s.Require().Equal(1, len(txsFromLane)) s.Require().Equal(0, len(remainingTxs)) - proposal := proposals.NewProposal(log.NewNopLogger(), s.encCfg.TxConfig.TxEncoder(), 200000, 1000000) + proposal := proposals.NewProposal(log.NewNopLogger(), 200000, 1000000) _, err = lane.ProcessLane(s.ctx, proposal, partialProposal, block.NoOpProcessLanesHandler()) s.Require().NoError(err) }) @@ -432,7 +430,7 @@ func (s *MEVTestSuite) TestProcessLane() { s.Require().Equal(3, len(txsFromLane)) s.Require().Equal(0, len(remainingTxs)) - proposal := proposals.NewProposal(log.NewNopLogger(), s.encCfg.TxConfig.TxEncoder(), 20000, 99) + proposal := proposals.NewProposal(log.NewNopLogger(), 20000, 99) _, err = lane.ProcessLane(s.ctx, proposal, partialProposal, block.NoOpProcessLanesHandler()) s.Require().Error(err) }) @@ -458,7 +456,7 @@ func (s *MEVTestSuite) TestProcessLane() { s.Require().Equal(3, len(txsFromLane)) s.Require().Equal(0, len(remainingTxs)) - proposal := proposals.NewProposal(log.NewNopLogger(), s.encCfg.TxConfig.TxEncoder(), 200, 100) + proposal := proposals.NewProposal(log.NewNopLogger(), 200, 100) _, err = lane.ProcessLane(s.ctx, proposal, partialProposal, block.NoOpProcessLanesHandler()) s.Require().Error(err) }) @@ -488,7 +486,7 @@ func (s *MEVTestSuite) TestProcessLane() { s.Require().Equal(1, len(remainingTxs)) s.Require().Equal(otherTx, remainingTxs[0]) - proposal := proposals.NewProposal(log.NewNopLogger(), s.encCfg.TxConfig.TxEncoder(), 200000, 1000000) + proposal := proposals.NewProposal(log.NewNopLogger(), 200000, 1000000) proposal, err = lane.ProcessLane(s.ctx, proposal, partialProposal, block.NoOpProcessLanesHandler()) s.Require().NoError(err) s.Require().Len(proposal.Txs, 3) @@ -522,7 +520,7 @@ func (s *MEVTestSuite) TestProcessLane() { s.Require().Equal(0, len(txsFromLane)) s.Require().Equal(0, len(remainingTxs)) - proposal := proposals.NewProposal(log.NewNopLogger(), s.encCfg.TxConfig.TxEncoder(), 200000, 1000000) + proposal := proposals.NewProposal(log.NewNopLogger(), 200000, 1000000) _, err = lane.ProcessLane(s.ctx, proposal, partialProposal, block.NoOpProcessLanesHandler()) s.Require().Error(err) }) @@ -530,7 +528,7 @@ func (s *MEVTestSuite) TestProcessLane() { func (s *MEVTestSuite) TestVerifyBidBasic() { lane := s.initLane(math.LegacyOneDec(), nil) - proposal := proposals.NewProposal(log.NewTMLogger(os.Stdout), s.encCfg.TxConfig.TxEncoder(), 200, 100) + proposal := proposals.NewProposal(log.NewNopLogger(), 200, 100) limits := proposal.GetLaneLimits(lane.GetMaxBlockSpace()) s.Run("can verify a bid with no bundled txs", func() { @@ -594,7 +592,7 @@ func (s *MEVTestSuite) TestVerifyBidBasic() { s.Require().NoError(err) size := s.getTxSize(bidTx) - proposal := proposals.NewProposal(log.NewTMLogger(os.Stdout), s.encCfg.TxConfig.TxEncoder(), size-1, 100) + proposal := proposals.NewProposal(log.NewNopLogger(), size-1, 100) limits := proposal.GetLaneLimits(lane.GetMaxBlockSpace()) _, err = lane.VerifyBidBasic(s.ctx, bidTx, proposal, limits) diff --git a/lanes/terminator/lane.go b/lanes/terminator/lane.go index 826b43f0..1d930e33 100644 --- a/lanes/terminator/lane.go +++ b/lanes/terminator/lane.go @@ -79,9 +79,6 @@ func (t Terminator) GetTxInfo(_ sdk.Context, _ sdk.Tx) (utils.TxWithInfo, error) // SetAnteHandler is a no-op func (t Terminator) SetAnteHandler(sdk.AnteHandler) {} -// SetIgnoreList is a no-op -func (t Terminator) SetIgnoreList([]block.Lane) {} - // Match is a no-op func (t Terminator) Match(sdk.Context, sdk.Tx) bool { return false