Skip to content

Commit 27c0f3a

Browse files
committed
review comments
1 parent 9bf550c commit 27c0f3a

File tree

1 file changed

+2
-49
lines changed

1 file changed

+2
-49
lines changed

fvm/evm/offchain/utils/collection_test.go

+2-49
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,7 @@ func TestTestnetBackwardCompatibility(t *testing.T) {
5353
)
5454
}
5555

56-
// BackwardCompatibilityTestSinceEVMGenesisBlock verifies that the offchain package
57-
// is able to read EVM events from the given file paths and replay blocks since the
58-
// EVM genesis block and derive a consistant state as the latest onchain EVM state.
59-
// the eventsFilePaths is a list of file paths that contain ordered EVM events in JSONL format.
60-
// The EVM events file can be queried by flow cli query, for instance:
61-
//
62-
// flow events get A.8c5303eaa26202d6.EVM.TransactionExecuted A.8c5303eaa26202d6.EVM.BlockExecuted
63-
// --start 211176670 --end 211176770 --network testnet --host access-001.devnet51.nodes.onflow.org:9000
64-
//
65-
// After replaying with each event json file, it will generate a values_<height>.gob and
66-
// allocators_<height>.gob files as checkpoint, such that when the checkpoint exists, it will loaded
67-
// and skil replaying the coresponding event json files.
68-
69-
// backwardCompatibilityTestSinceEVMGenesisBlock ensures that the offchain package
56+
// BackwardCompatibilityTestSinceEVMGenesisBlock ensures that the offchain package
7057
// can read EVM events from the provided file paths, replay blocks starting from
7158
// the EVM genesis block, and derive a consistent state matching the latest on-chain EVM state.
7259
//
@@ -87,7 +74,7 @@ func BackwardCompatibleSinceEVMGenesisBlock(
8774
checkpointDir string,
8875
checkpointEndHeight uint64, // EVM height of an EVM state that a checkpoint was created for
8976
) {
90-
// ensure that checkpoints are not more than the event files
77+
// ensure that event files is not an empty array
9178
require.True(t, len(eventsFilePaths) > 0)
9279

9380
log.Info().Msgf("replaying EVM events from %v to %v, with checkpoints in %s, and checkpointEndHeight: %v",
@@ -208,40 +195,6 @@ func dumpCheckpoint(t *testing.T, store *TestValueStore, dir string, checkpointE
208195
return valuesFileName, allocatorsFileName
209196
}
210197

211-
const resume_height = 6559268
212-
213-
func decodeFullKey(encoded string) ([]byte, []byte, error) {
214-
// Split the encoded string at the first occurrence of "~"
215-
parts := strings.SplitN(encoded, "~", 2)
216-
if len(parts) != 2 {
217-
return nil, nil, fmt.Errorf("invalid encoded key: no delimiter found")
218-
}
219-
220-
// Convert the split parts back to byte slices
221-
owner := []byte(parts[0])
222-
key := []byte(parts[1])
223-
return owner, key, nil
224-
}
225-
226-
type Subscription[T any] struct {
227-
ch chan T
228-
err error
229-
}
230-
231-
func NewSubscription[T any]() *Subscription[T] {
232-
return &Subscription[T]{
233-
ch: make(chan T),
234-
}
235-
}
236-
237-
func (s *Subscription[T]) Channel() <-chan T {
238-
return s.ch
239-
}
240-
241-
func (s *Subscription[T]) Err() error {
242-
return s.err
243-
}
244-
245198
// scanEventFilesAndRun
246199
func scanEventFilesAndRun(
247200
t *testing.T,

0 commit comments

Comments
 (0)