Skip to content

Commit

Permalink
merge conflict fix
Browse files Browse the repository at this point in the history
  • Loading branch information
davidterpay committed Dec 6, 2023
1 parent 3cb3b66 commit 5dbc627
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 107 deletions.
14 changes: 1 addition & 13 deletions abci/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
Expand Down
112 changes: 18 additions & 94 deletions abci/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
})
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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))
})
Expand Down Expand Up @@ -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])
Expand Down Expand Up @@ -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])
Expand Down Expand Up @@ -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])
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5dbc627

Please sign in to comment.