Skip to content

Commit 52333e0

Browse files
committed
rm ExecutionStateSyncRequest/ExecutionStateDelta
It's dead code that only lives in tests
1 parent a5f683f commit 52333e0

File tree

8 files changed

+3
-289
lines changed

8 files changed

+3
-289
lines changed

cmd/execution/README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,6 @@ required to trigger this condition is put in place to prevent triggering it in c
6868
happen on unstable networks.
6969
EN keeps track of the highest block it has executed. This is not a Flow protocol feature, and only serves synchronisation needs.
7070

71-
### Execution State syncing
72-
Other execution node is queried for range of missing blocks and hold authority to decide if it's willing (and able) to answer this query.
73-
If so, it sends the `ExecutionStateDelta` which contains all the block data and results of execution.
74-
Currently, this is fully trusted operation, meaning data is applied as-is without any extra checks.
75-
7671
### Missing blocks
7772
If no other EN are available, the block-level synchronisation is started. This requests blocks from consensus nodes, and
7873
incoming blocks are processed as if they were received during normal mode of operation

engine/execution/execution_test.go

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -581,39 +581,3 @@ func TestBroadcastToMultipleVerificationNodes(t *testing.T) {
581581

582582
verificationEngine.AssertExpectations(t)
583583
}
584-
585-
// Test that when received the same state delta for the second time,
586-
// the delta will be saved again without causing any error.
587-
// func TestReceiveTheSameDeltaMultipleTimes(t *testing.T) {
588-
// hub := stub.NewNetworkHub()
589-
//
590-
// chainID := flow.Mainnet
591-
//
592-
// colID := unittest.IdentityFixture(unittest.WithRole(flow.RoleCollection))
593-
// exeID := unittest.IdentityFixture(unittest.WithRole(flow.RoleExecution))
594-
// ver1ID := unittest.IdentityFixture(unittest.WithRole(flow.RoleVerification))
595-
// ver2ID := unittest.IdentityFixture(unittest.WithRole(flow.RoleVerification))
596-
//
597-
// identities := unittest.CompleteIdentitySet(colID, exeID, ver1ID, ver2ID)
598-
//
599-
// exeNode := testutil.ExecutionNode(t, hub, exeID, identities, 21, chainID)
600-
// defer exeNode.Done()
601-
//
602-
// genesis, err := exeNode.State.AtHeight(0).Head()
603-
// require.NoError(t, err)
604-
//
605-
// delta := unittest.StateDeltaWithParentFixture(genesis)
606-
// delta.ExecutableBlock.StartState = unittest.GenesisStateCommitment
607-
// delta.EndState = unittest.GenesisStateCommitment
608-
//
609-
// fmt.Printf("block id: %v, delta for block (%v)'s parent id: %v\n", genesis.ID(), delta.Block.ID(), delta.ParentID())
610-
// exeNode.IngestionEngine.SubmitLocal(delta)
611-
// time.Sleep(time.Second)
612-
//
613-
// exeNode.IngestionEngine.SubmitLocal(delta)
614-
// // handling the same delta again to verify the DB calls in saveExecutionResults
615-
// // are idempotent, if they weren't, it will hit log.Fatal and crash before
616-
// // sleep is done
617-
// time.Sleep(time.Second)
618-
//
619-
// }

integration/tests/lib/msg_state.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,3 @@ func MsgIsResultApproval(msg interface{}) bool {
9191
_, ok := msg.(*flow.ResultApproval)
9292
return ok
9393
}
94-
95-
func MsgIsExecutionStateDelta(msg interface{}) bool {
96-
_, ok := msg.(*messages.ExecutionStateDelta)
97-
return ok
98-
}
99-
100-
func MsgIsExecutionStateDeltaWithChanges(msg interface{}) bool {
101-
delta, ok := msg.(*messages.ExecutionStateDelta)
102-
if !ok {
103-
return false
104-
}
105-
106-
return *delta.StartState != delta.EndState
107-
}

model/messages/execution.go

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package messages
22

33
import (
4-
"github.com/onflow/flow-go/engine/execution/state/delta"
54
"github.com/onflow/flow-go/model/flow"
6-
"github.com/onflow/flow-go/module/mempool/entity"
75
)
86

97
// ChunkDataRequest represents a request for the a chunk data pack
@@ -19,37 +17,3 @@ type ChunkDataResponse struct {
1917
ChunkDataPack flow.ChunkDataPack
2018
Nonce uint64 // so that we aren't deduplicated by the network layer
2119
}
22-
23-
// ExecutionStateSyncRequest represents a request for state deltas between
24-
// the block at the `FromHeight` and the block at the `ToHeight`
25-
// since the state sync request only requests for sealed blocks, heights
26-
// should be enough to specify the block deterministically.
27-
type ExecutionStateSyncRequest struct {
28-
FromHeight uint64
29-
ToHeight uint64
30-
}
31-
32-
type ExecutionStateDelta struct {
33-
entity.ExecutableBlock
34-
StateInteractions []*delta.Snapshot
35-
EndState flow.StateCommitment
36-
Events []flow.Event
37-
ServiceEvents []flow.Event
38-
TransactionResults []flow.TransactionResult
39-
}
40-
41-
func (b *ExecutionStateDelta) ID() flow.Identifier {
42-
return b.Block.ID()
43-
}
44-
45-
func (b *ExecutionStateDelta) Checksum() flow.Identifier {
46-
return b.Block.Checksum()
47-
}
48-
49-
func (b *ExecutionStateDelta) Height() uint64 {
50-
return b.Block.Header.Height
51-
}
52-
53-
func (b *ExecutionStateDelta) ParentID() flow.Identifier {
54-
return b.Block.Header.ParentID
55-
}

module/mempool/mock/deltas.go

Lines changed: 0 additions & 143 deletions
This file was deleted.

network/codec/codes.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ const (
4646
CodeExecutionReceipt
4747
CodeResultApproval
4848

49-
// execution state synchronization
50-
CodeExecutionStateSyncRequest
51-
CodeExecutionStateDelta
52-
5349
// data exchange for execution of blocks
5450
CodeChunkDataRequest
5551
CodeChunkDataResponse
@@ -119,12 +115,6 @@ func MessageCodeFromInterface(v interface{}) (MessageCode, string, error) {
119115
case *flow.ResultApproval:
120116
return CodeResultApproval, s, nil
121117

122-
// execution state synchronization
123-
case *messages.ExecutionStateSyncRequest:
124-
return CodeExecutionStateSyncRequest, s, nil
125-
case *messages.ExecutionStateDelta:
126-
return CodeExecutionStateDelta, s, nil
127-
128118
// data exchange for execution of blocks
129119
case *messages.ChunkDataRequest:
130120
return CodeChunkDataRequest, s, nil
@@ -206,12 +196,6 @@ func InterfaceFromMessageCode(code MessageCode) (interface{}, string, error) {
206196
case CodeResultApproval:
207197
return &flow.ResultApproval{}, what(&flow.ResultApproval{}), nil
208198

209-
// execution state synchronization
210-
case CodeExecutionStateSyncRequest:
211-
return &messages.ExecutionStateSyncRequest{}, what(&messages.ExecutionStateSyncRequest{}), nil
212-
case CodeExecutionStateDelta:
213-
return &messages.ExecutionStateDelta{}, what(&messages.ExecutionStateDelta{}), nil
214-
215199
// data exchange for execution of blocks
216200
case CodeChunkDataRequest:
217201
return &messages.ChunkDataRequest{}, what(&messages.ChunkDataRequest{}), nil

network/queue/eventPriority.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,6 @@ func getPriorityByType(message interface{}) Priority {
7979
case *flow.ResultApproval:
8080
return HighPriority
8181

82-
// execution state synchronization
83-
case *messages.ExecutionStateSyncRequest:
84-
return MediumPriority
85-
case *messages.ExecutionStateDelta:
86-
return HighPriority
87-
8882
// data exchange for execution of blocks
8983
case *messages.ChunkDataRequest:
9084
return HighPriority

utils/unittest/fixtures.go

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222

2323
hotstuff "github.com/onflow/flow-go/consensus/hotstuff/model"
2424
"github.com/onflow/flow-go/engine"
25-
"github.com/onflow/flow-go/engine/execution/state/delta"
25+
"github.com/onflow/flow-go/fvm/state"
2626
"github.com/onflow/flow-go/ledger/common/bitutils"
2727
"github.com/onflow/flow-go/model/bootstrap"
2828
"github.com/onflow/flow-go/model/chainsync"
@@ -239,16 +239,6 @@ func AsSlashable[T any](msg T) flow.Slashable[T] {
239239
return slashable
240240
}
241241

242-
func StateDeltaFixture() *messages.ExecutionStateDelta {
243-
header := BlockHeaderFixture()
244-
block := BlockWithParentFixture(header)
245-
return &messages.ExecutionStateDelta{
246-
ExecutableBlock: entity.ExecutableBlock{
247-
Block: block,
248-
},
249-
}
250-
}
251-
252242
func ReceiptAndSealForBlock(block *flow.Block) (*flow.ExecutionReceipt, *flow.Seal) {
253243
receipt := ReceiptForBlockFixture(block)
254244
seal := Seal.Fixture(Seal.WithBlock(block.Header), Seal.WithResult(&receipt.ExecutionResult))
@@ -341,8 +331,8 @@ func WithoutGuarantee(payload *flow.Payload) {
341331
payload.Guarantees = nil
342332
}
343333

344-
func StateInteractionsFixture() *delta.Snapshot {
345-
return &delta.NewDeltaView(nil).Interactions().Snapshot
334+
func StateInteractionsFixture() *state.ExecutionSnapshot {
335+
return &state.ExecutionSnapshot{}
346336
}
347337

348338
func BlockWithParentAndProposerFixture(t *testing.T, parent *flow.Header, proposer flow.Identifier) flow.Block {
@@ -381,26 +371,6 @@ func BlockWithParentAndSeals(parent *flow.Header, seals []*flow.Header) *flow.Bl
381371
return block
382372
}
383373

384-
func StateDeltaWithParentFixture(parent *flow.Header) *messages.ExecutionStateDelta {
385-
payload := PayloadFixture()
386-
header := BlockHeaderWithParentFixture(parent)
387-
header.PayloadHash = payload.Hash()
388-
block := flow.Block{
389-
Header: header,
390-
Payload: &payload,
391-
}
392-
393-
var stateInteractions []*delta.Snapshot
394-
stateInteractions = append(stateInteractions, StateInteractionsFixture())
395-
396-
return &messages.ExecutionStateDelta{
397-
ExecutableBlock: entity.ExecutableBlock{
398-
Block: &block,
399-
},
400-
StateInteractions: stateInteractions,
401-
}
402-
}
403-
404374
func GenesisFixture() *flow.Block {
405375
genesis := flow.Genesis(flow.Emulator)
406376
return genesis

0 commit comments

Comments
 (0)