Skip to content

Commit 0ee7575

Browse files
authored
vms/platformvm: Remove standardBlockState struct (#2450)
1 parent 80fa254 commit 0ee7575

File tree

4 files changed

+14
-24
lines changed

4 files changed

+14
-24
lines changed

vms/platformvm/block/executor/acceptor_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,12 @@ func TestAcceptorVisitStandardBlock(t *testing.T) {
210210
atomicRequests := map[ids.ID]*atomic.Requests{ids.GenerateTestID(): nil}
211211
calledOnAcceptFunc := false
212212
acceptor.backend.blkIDToState[blk.ID()] = &blockState{
213-
onAcceptState: onAcceptState,
214-
atomicRequests: atomicRequests,
215-
standardBlockState: standardBlockState{
216-
onAcceptFunc: func() {
217-
calledOnAcceptFunc = true
218-
},
213+
onAcceptState: onAcceptState,
214+
onAcceptFunc: func() {
215+
calledOnAcceptFunc = true
219216
},
217+
218+
atomicRequests: atomicRequests,
220219
}
221220
// Give [blk] a child.
222221
childOnAcceptState := state.NewMockDiff(ctrl)

vms/platformvm/block/executor/block_state.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ import (
1313
"github.com/ava-labs/avalanchego/vms/platformvm/state"
1414
)
1515

16-
type standardBlockState struct {
17-
onAcceptFunc func()
18-
inputs set.Set[ids.ID]
19-
}
20-
2116
type proposalBlockState struct {
2217
initiallyPreferCommit bool
2318
onCommitState state.Diff
@@ -27,11 +22,13 @@ type proposalBlockState struct {
2722
// The state of a block.
2823
// Note that not all fields will be set for a given block.
2924
type blockState struct {
30-
standardBlockState
3125
proposalBlockState
3226
statelessBlock block.Block
33-
onAcceptState state.Diff
3427

28+
onAcceptState state.Diff
29+
onAcceptFunc func()
30+
31+
inputs set.Set[ids.ID]
3532
timestamp time.Time
3633
atomicRequests map[ids.ID]*atomic.Requests
3734
}

vms/platformvm/block/executor/verifier.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,11 @@ func (v *verifier) ApricotAtomicBlock(b *block.ApricotAtomicBlock) error {
207207

208208
blkID := b.ID()
209209
v.blkIDToState[blkID] = &blockState{
210-
standardBlockState: standardBlockState{
211-
inputs: atomicExecutor.Inputs,
212-
},
213210
statelessBlock: b,
214-
onAcceptState: atomicExecutor.OnAccept,
211+
212+
onAcceptState: atomicExecutor.OnAccept,
213+
214+
inputs: atomicExecutor.Inputs,
215215
timestamp: atomicExecutor.OnAccept.GetTimestamp(),
216216
atomicRequests: atomicExecutor.AtomicRequests,
217217
}

vms/platformvm/block/executor/verifier_test.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ func TestVerifierVisitCommitBlock(t *testing.T) {
322322
onCommitState: parentOnCommitState,
323323
onAbortState: parentOnAbortState,
324324
},
325-
standardBlockState: standardBlockState{},
326325
},
327326
},
328327
Mempool: mempool,
@@ -392,7 +391,6 @@ func TestVerifierVisitAbortBlock(t *testing.T) {
392391
onCommitState: parentOnCommitState,
393392
onAbortState: parentOnAbortState,
394393
},
395-
standardBlockState: standardBlockState{},
396394
},
397395
},
398396
Mempool: mempool,
@@ -686,11 +684,9 @@ func TestVerifierVisitStandardBlockWithDuplicateInputs(t *testing.T) {
686684
backend := &backend{
687685
blkIDToState: map[ids.ID]*blockState{
688686
grandParentID: {
689-
standardBlockState: standardBlockState{
690-
inputs: atomicInputs,
691-
},
692687
statelessBlock: grandParentStatelessBlk,
693688
onAcceptState: grandParentState,
689+
inputs: atomicInputs,
694690
},
695691
parentID: {
696692
statelessBlock: parentStatelessBlk,
@@ -784,7 +780,6 @@ func TestVerifierVisitApricotStandardBlockWithProposalBlockParent(t *testing.T)
784780
onCommitState: parentOnCommitState,
785781
onAbortState: parentOnAbortState,
786782
},
787-
standardBlockState: standardBlockState{},
788783
},
789784
},
790785
Mempool: mempool,
@@ -842,7 +837,6 @@ func TestVerifierVisitBanffStandardBlockWithProposalBlockParent(t *testing.T) {
842837
onCommitState: parentOnCommitState,
843838
onAbortState: parentOnAbortState,
844839
},
845-
standardBlockState: standardBlockState{},
846840
},
847841
},
848842
Mempool: mempool,

0 commit comments

Comments
 (0)