Skip to content

Commit

Permalink
chore: remove Ctx field from FinalizeBlockRequest
Browse files Browse the repository at this point in the history
The context fields on other request types make sense because we may need
to interrupt, say, a prevote decision due to falling behind. But there
are no circumstances, other than process shutdown, where we would want
to interrupt a block finalization.
  • Loading branch information
mark-rushakoff committed Apr 22, 2024
1 parent fc40c8c commit 4627a1b
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 9 deletions.
6 changes: 0 additions & 6 deletions tm/tmapp/requests.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package tmapp

import (
"context"

"github.com/rollchains/gordian/tm/tmconsensus"
)

Expand Down Expand Up @@ -37,10 +35,6 @@ type InitChainResponse struct {
//
// Consumers of this value may assume that Resp is buffered and sends will not block.
type FinalizeBlockRequest struct {
// TODO: Ctx should probably be removed.
// The only time a finalize request would be interrupted would be a root context cancellation.
Ctx context.Context

Block tmconsensus.Block
Round uint32

Expand Down
1 change: 0 additions & 1 deletion tm/tmengine/internal/tmstate/statemachine.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,6 @@ func (m *StateMachine) sendInitialActionSet(ctx context.Context) (

// This is a replay, so we can just tell the app to finalize it.
finReq := tmapp.FinalizeBlockRequest{
Ctx: ctx, // Is this the right context? Do we even still need context?
Block: update.CB.Block,
Round: update.CB.Proof.Round,

Expand Down
2 changes: 0 additions & 2 deletions tm/tmengine/internal/tmstate/statemachine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,6 @@ func TestStateMachine_initialization(t *testing.T) {
// Now the state machine should make a finalize block request.
req := gtest.ReceiveSoon(t, sfx.FinalizeBlockRequests)

require.NotNil(t, req.Ctx)
require.NoError(t, req.Ctx.Err())
require.Equal(t, pb1.Block, req.Block)
require.Zero(t, req.Round)

Expand Down

0 comments on commit 4627a1b

Please sign in to comment.