From 5dbc627c1e85fbebe108491b40f9b5949309c9c8 Mon Sep 17 00:00:00 2001 From: David Terpay Date: Wed, 6 Dec 2023 14:49:18 -0500 Subject: [PATCH] merge conflict fix --- abci/abci.go | 14 +----- abci/abci_test.go | 112 ++++++++-------------------------------------- 2 files changed, 19 insertions(+), 107 deletions(-) diff --git a/abci/abci.go b/abci/abci.go index 91ed3c46..d8dd199b 100644 --- a/abci/abci.go +++ b/abci/abci.go @@ -67,24 +67,12 @@ func (h *ProposalHandler) PrepareProposalHandler() sdk.PrepareProposalHandler { "height", req.Height, ) -<<<<<<< HEAD - // Fill the proposal with transactions from each lane. - finalProposal, err := h.prepareLanesHandler(ctx, proposals.NewProposalWithContext(ctx, h.logger)) -======= - registry, err := h.mempool.Registry(ctx) - if err != nil { - h.logger.Error("failed to get lane registry", "err", err) - return &abci.ResponsePrepareProposal{Txs: make([][]byte, 0)}, err - } - // Get the max gas limit and max block size for the proposal. _, maxGasLimit := proposals.GetBlockLimits(ctx) proposal := proposals.NewProposal(h.logger, req.MaxTxBytes, maxGasLimit) // Fill the proposal with transactions from each lane. - prepareLanesHandler := ChainPrepareLanes(registry) - finalProposal, err := prepareLanesHandler(ctx, proposal) ->>>>>>> 43d6b04 (req size check (#269)) + finalProposal, err := h.prepareLanesHandler(ctx, proposal) if err != nil { h.logger.Error("failed to prepare proposal", "err", err) return abci.ResponsePrepareProposal{Txs: make([][]byte, 0)} diff --git a/abci/abci_test.go b/abci/abci_test.go index 51f075c1..634d4071 100644 --- a/abci/abci_test.go +++ b/abci/abci_test.go @@ -61,13 +61,8 @@ func (s *ProposalsTestSuite) TestPrepareProposal() { proposalHandler := s.setUpProposalHandlers([]block.Lane{defaultLane}).PrepareProposalHandler() -<<<<<<< HEAD - resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2}) -======= maxTxBytes := s.ctx.ConsensusParams().Block.MaxBytes - resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) - s.Require().NoError(err) ->>>>>>> 43d6b04 (req size check (#269)) + resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) s.Require().NotNil(resp) s.Require().Equal(0, len(resp.Txs)) }) @@ -90,13 +85,9 @@ func (s *ProposalsTestSuite) TestPrepareProposal() { s.Require().NoError(defaultLane.Insert(sdk.Context{}, tx)) proposalHandler := s.setUpProposalHandlers([]block.Lane{defaultLane}).PrepareProposalHandler() -<<<<<<< HEAD - resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2}) -======= maxTxBytes := s.ctx.ConsensusParams().Block.MaxBytes - resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) ->>>>>>> 43d6b04 (req size check (#269)) + resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) s.Require().NotNil(resp) proposal := s.getTxBytes(tx) @@ -135,13 +126,9 @@ func (s *ProposalsTestSuite) TestPrepareProposal() { s.Require().NoError(defaultLane.Insert(sdk.Context{}, tx2)) proposalHandler := s.setUpProposalHandlers([]block.Lane{defaultLane}).PrepareProposalHandler() -<<<<<<< HEAD - resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2}) -======= maxTxBytes := s.ctx.ConsensusParams().Block.MaxBytes - resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) ->>>>>>> 43d6b04 (req size check (#269)) + resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) s.Require().NotNil(resp) proposal := s.getTxBytes(tx2, tx1) @@ -180,13 +167,9 @@ func (s *ProposalsTestSuite) TestPrepareProposal() { s.Require().NoError(defaultLane.Insert(sdk.Context{}, tx2)) proposalHandler := s.setUpProposalHandlers([]block.Lane{defaultLane}).PrepareProposalHandler() -<<<<<<< HEAD - resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2}) -======= maxTxBytes := s.ctx.ConsensusParams().Block.MaxBytes - resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) ->>>>>>> 43d6b04 (req size check (#269)) + resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) s.Require().NotNil(resp) proposal := s.getTxBytes(tx1) @@ -200,13 +183,8 @@ func (s *ProposalsTestSuite) TestPrepareProposal() { proposalHandler := s.setUpProposalHandlers([]block.Lane{mevLane, defaultLane}).PrepareProposalHandler() -<<<<<<< HEAD - resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2}) -======= maxTxBytes := s.ctx.ConsensusParams().Block.MaxBytes - resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) - s.Require().NoError(err) ->>>>>>> 43d6b04 (req size check (#269)) + resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) s.Require().NotNil(resp) s.Require().Equal(0, len(resp.Txs)) }) @@ -235,13 +213,8 @@ func (s *ProposalsTestSuite) TestPrepareProposal() { proposalHandler := s.setUpProposalHandlers([]block.Lane{mevLane, defaultLane}).PrepareProposalHandler() -<<<<<<< HEAD - resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2}) -======= maxTxBytes := s.ctx.ConsensusParams().Block.MaxBytes - resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) - s.Require().NoError(err) ->>>>>>> 43d6b04 (req size check (#269)) + resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) s.Require().NotNil(resp) proposal := s.getTxBytes(tx, bundleTxs[0]) @@ -279,13 +252,8 @@ func (s *ProposalsTestSuite) TestPrepareProposal() { proposalHandler := s.setUpProposalHandlers([]block.Lane{mevLane, defaultLane}).PrepareProposalHandler() -<<<<<<< HEAD - resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2}) -======= maxTxBytes := s.ctx.ConsensusParams().Block.MaxBytes - resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) - s.Require().NoError(err) ->>>>>>> 43d6b04 (req size check (#269)) + resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) s.Require().NotNil(resp) proposal := s.getTxBytes(tx, bundleTxs[0]) @@ -324,13 +292,8 @@ func (s *ProposalsTestSuite) TestPrepareProposal() { proposalHandler := s.setUpProposalHandlers([]block.Lane{mevLane, defaultLane}).PrepareProposalHandler() -<<<<<<< HEAD - resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2}) -======= maxTxBytes := s.ctx.ConsensusParams().Block.MaxBytes - resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) - s.Require().NoError(err) ->>>>>>> 43d6b04 (req size check (#269)) + resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) s.Require().NotNil(resp) proposal := s.getTxBytes(bundleTxs[0]) @@ -372,7 +335,8 @@ func (s *ProposalsTestSuite) TestPrepareProposal() { size := int64(len(proposal[0]) - 1) s.setBlockParams(10000000, size) - resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2}) + maxTxBytes := s.ctx.ConsensusParams().Block.MaxBytes + resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) s.Require().NotNil(resp) s.Require().Equal(1, len(resp.Txs)) @@ -407,13 +371,8 @@ func (s *ProposalsTestSuite) TestPrepareProposal() { proposal := s.getTxBytes(freeTx) -<<<<<<< HEAD - resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2}) -======= maxTxBytes := s.ctx.ConsensusParams().Block.MaxBytes - resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) - s.Require().NoError(err) ->>>>>>> 43d6b04 (req size check (#269)) + resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) s.Require().NotNil(resp) s.Require().Equal(1, len(resp.Txs)) @@ -479,13 +438,8 @@ func (s *ProposalsTestSuite) TestPrepareProposal() { proposalHandler := s.setUpProposalHandlers([]block.Lane{mevLane, freeLane, defaultLane}).PrepareProposalHandler() proposal := s.getTxBytes(tx, bundleTxs[0], bundleTxs[1], bundleTxs[2], bundleTxs[3], freeTx, normalTx) -<<<<<<< HEAD - resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2}) -======= maxTxBytes := s.ctx.ConsensusParams().Block.MaxBytes - resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) - s.Require().NoError(err) ->>>>>>> 43d6b04 (req size check (#269)) + resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) s.Require().NotNil(resp) s.Require().Equal(7, len(resp.Txs)) @@ -536,13 +490,8 @@ func (s *ProposalsTestSuite) TestPrepareProposal() { proposal := s.getTxBytes(tx, bundleTxs[0], normalTx) // Should be theoretically sufficient to fit the bid tx and the bundled tx + normal tx -<<<<<<< HEAD - resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2}) -======= maxTxBytes := s.ctx.ConsensusParams().Block.MaxBytes - resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) - s.Require().NoError(err) ->>>>>>> 43d6b04 (req size check (#269)) + resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) s.Require().NotNil(resp) s.Require().Equal(1, len(resp.Txs)) @@ -588,13 +537,8 @@ func (s *ProposalsTestSuite) TestPrepareProposalEdgeCases() { mempool, ).PrepareProposalHandler() -<<<<<<< HEAD - resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2}) -======= maxTxBytes := s.ctx.ConsensusParams().Block.MaxBytes - resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) - s.Require().NoError(err) ->>>>>>> 43d6b04 (req size check (#269)) + resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) s.Require().NotNil(resp) proposal := s.getTxBytes(tx) @@ -639,13 +583,8 @@ func (s *ProposalsTestSuite) TestPrepareProposalEdgeCases() { mempool, ).PrepareProposalHandler() -<<<<<<< HEAD - resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2}) -======= maxTxBytes := s.ctx.ConsensusParams().Block.MaxBytes - resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) - s.Require().NoError(err) ->>>>>>> 43d6b04 (req size check (#269)) + resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) s.Require().NotNil(resp) proposal := s.getTxBytes(tx) @@ -692,13 +631,8 @@ func (s *ProposalsTestSuite) TestPrepareProposalEdgeCases() { mempool, ).PrepareProposalHandler() -<<<<<<< HEAD - resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2}) -======= maxTxBytes := s.ctx.ConsensusParams().Block.MaxBytes - resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) - s.Require().NoError(err) ->>>>>>> 43d6b04 (req size check (#269)) + resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) s.Require().NotNil(resp) proposal := s.getTxBytes(tx) @@ -745,13 +679,8 @@ func (s *ProposalsTestSuite) TestPrepareProposalEdgeCases() { mempool, ).PrepareProposalHandler() -<<<<<<< HEAD - resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2}) -======= maxTxBytes := s.ctx.ConsensusParams().Block.MaxBytes - resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) - s.Require().NoError(err) ->>>>>>> 43d6b04 (req size check (#269)) + resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) s.Require().NotNil(resp) proposal := s.getTxBytes(tx) @@ -1398,14 +1327,9 @@ func (s *ProposalsTestSuite) TestPrepareProcessParity() { // Create a proposal with the retrieved transactions // Set up the default lane with no transactions proposalHandler := s.setUpProposalHandlers([]block.Lane{freelane, defaultLane}).PrepareProposalHandler() -<<<<<<< HEAD - resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2}) -======= maxTxBytes := s.ctx.ConsensusParams().Block.MaxBytes - resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) - s.Require().NoError(err) ->>>>>>> 43d6b04 (req size check (#269)) + resp := proposalHandler(s.ctx, cometabci.RequestPrepareProposal{Height: 2, MaxTxBytes: maxTxBytes}) s.Require().NotNil(resp) // Ensure the transactions are in the correct order for the free lane