Skip to content

Commit

Permalink
keep ReplayBlock unchanged
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangchiqing committed Nov 27, 2024
1 parent b82fc5e commit 556d903
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
11 changes: 10 additions & 1 deletion fvm/evm/offchain/sync/replayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ func NewReplayer(
}

// ReplayBlock replays the execution of the transactions of an EVM block
func (cr *Replayer) ReplayBlock(
transactionEvents []events.TransactionEventPayload,
blockEvent *events.BlockEventPayload,
) (types.ReplayResultCollector, error) {
res, _, err := cr.ReplayBlockEvents(transactionEvents, blockEvent)
return res, err
}

// ReplayBlockEvents replays the execution of the transactions of an EVM block
// using the provided transactionEvents and blockEvents,
// which include all the context data for re-executing the transactions, and returns
// the replay result and the result of each transaction.
Expand All @@ -57,7 +66,7 @@ func NewReplayer(
// Warning! the list of transaction events has to be sorted based on their
// execution, sometimes the access node might return events out of order
// it needs to be sorted by txIndex and eventIndex respectively.
func (cr *Replayer) ReplayBlock(
func (cr *Replayer) ReplayBlockEvents(
transactionEvents []events.TransactionEventPayload,
blockEvent *events.BlockEventPayload,
) (types.ReplayResultCollector, []*types.Result, error) {
Expand Down
8 changes: 1 addition & 7 deletions fvm/evm/offchain/sync/replayer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func TestChainReplay(t *testing.T) {

sp := NewTestStorageProvider(snapshot, 1)
cr := sync.NewReplayer(chainID, rootAddr, sp, bp, zerolog.Logger{}, nil, true)
res, results, err := cr.ReplayBlock(txEventPayloads, blockEventPayload)
res, results, err := cr.ReplayBlockEvents(txEventPayloads, blockEventPayload)
require.NoError(t, err)

require.Len(t, results, totalTxCount)
Expand All @@ -173,12 +173,6 @@ func TestChainReplay(t *testing.T) {

err = bp.OnBlockExecuted(blockEventPayload.Height, res, proposal)
require.NoError(t, err)

// for k, v := range bpStorage.StorageRegisterUpdates() {
// ret, err := backend.GetValue([]byte(k.Owner), []byte(k.Key))
// require.NoError(t, err)
// require.Equal(t, ret[:], v[:])
// }
})
})
})
Expand Down
2 changes: 1 addition & 1 deletion fvm/evm/offchain/utils/replay.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func ReplayEVMEventsToStore(

sp := testutils.NewTestStorageProvider(store, evmBlockEvent.Height)
cr := sync.NewReplayer(chainID, rootAddr, sp, bp, log, nil, true)
res, results, err := cr.ReplayBlock(evmTxEvents, evmBlockEvent)
res, results, err := cr.ReplayBlockEvents(evmTxEvents, evmBlockEvent)
if err != nil {
return nil, nil, err
}
Expand Down

0 comments on commit 556d903

Please sign in to comment.