Skip to content

Commit

Permalink
test: removing unneeded comments
Browse files Browse the repository at this point in the history
  • Loading branch information
afa7789 committed Nov 6, 2024
1 parent a5bab22 commit 6c7b35a
Showing 1 changed file with 20 additions and 25 deletions.
45 changes: 20 additions & 25 deletions zk/l1infotree/updater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ func TestNewUpdater(t *testing.T) {
l1InfoTreeSyncer := syncer.NewL1Syncer(
ctx,
nil, nil, nil,
cfg.L1BlockRange, // cfg.L1BlockRange,
cfg.L1QueryDelay, // cfg.L1QueryDelay,
cfg.L1HighestBlockType, // cfg.L1HighestBlockType,
cfg.L1BlockRange,
cfg.L1QueryDelay,
cfg.L1HighestBlockType,
)

updater := l1infotree.NewUpdater(cfg, l1InfoTreeSyncer)
Expand All @@ -78,9 +78,8 @@ func TestUpdater_WarmUp(t *testing.T) {
header := &types.Header{Number: big.NewInt(1), Difficulty: big.NewInt(100)}
expectedBlock := types.NewBlockWithHeader(header)

// Set up the mock expectation for BlockByNumber
EthermanMock.EXPECT().
BlockByNumber(gomock.Any(), (*big.Int)(nil)). // Matches any context and a nil blockNumber
BlockByNumber(gomock.Any(), (*big.Int)(nil)).
Return(expectedBlock, nil).
AnyTimes()

Expand All @@ -91,9 +90,9 @@ func TestUpdater_WarmUp(t *testing.T) {
[]syncer.IEtherman{EthermanMock},
[]common.Address{},
[][]common.Hash{},
cfg.L1BlockRange, // cfg.L1BlockRange,
cfg.L1QueryDelay, // cfg.L1QueryDelay,
cfg.L1HighestBlockType, // cfg.L1HighestBlockType,
cfg.L1BlockRange,
cfg.L1QueryDelay,
cfg.L1HighestBlockType,
)

updater := l1infotree.NewUpdater(cfg, l1InfoTreeSyncer)
Expand All @@ -116,9 +115,9 @@ func TestUpdater_GetProgress(t *testing.T) {
l1InfoTreeSyncer := syncer.NewL1Syncer(
ctx,
nil, nil, nil,
cfg.L1BlockRange, // cfg.L1BlockRange,
cfg.L1QueryDelay, // cfg.L1QueryDelay,
cfg.L1HighestBlockType, // cfg.L1HighestBlockType,
cfg.L1BlockRange,
cfg.L1QueryDelay,
cfg.L1HighestBlockType,
)

updater := l1infotree.NewUpdater(cfg, l1InfoTreeSyncer)
Expand All @@ -137,9 +136,9 @@ func TestUpdater_GetLatestUpdate(t *testing.T) {
l1InfoTreeSyncer := syncer.NewL1Syncer(
ctx,
nil, nil, nil,
cfg.L1BlockRange, // cfg.L1BlockRange,
cfg.L1QueryDelay, // cfg.L1QueryDelay,
cfg.L1HighestBlockType, // cfg.L1HighestBlockType,
cfg.L1BlockRange,
cfg.L1QueryDelay,
cfg.L1HighestBlockType,
)

updater := l1infotree.NewUpdater(cfg, l1InfoTreeSyncer)
Expand All @@ -157,7 +156,6 @@ func TestUpdater_CheckForInfoTreeUpdates(t *testing.T) {
defer mockCtrl.Finish()
EthermanMock := mocks.NewMockIEtherman(mockCtrl)

// Define a header to be returned by our mock Ethereum calls
mockHeader := &types.Header{
Number: big.NewInt(1),
Time: uint64(time.Now().Unix()),
Expand All @@ -166,19 +164,16 @@ func TestUpdater_CheckForInfoTreeUpdates(t *testing.T) {

expectedBlock := types.NewBlockWithHeader(mockHeader)

// Set up the mock expectation for BlockByNumber
EthermanMock.EXPECT().
BlockByNumber(gomock.Any(), (*big.Int)(nil)). // Matches any context and a nil blockNumber
BlockByNumber(gomock.Any(), (*big.Int)(nil)).
Return(expectedBlock, nil).
AnyTimes()

// Mock expectation: Whenever HeaderByNumber is called with any context and block number, return mockHeader
EthermanMock.EXPECT().
HeaderByNumber(gomock.Any(), gomock.Any()).
Return(mockHeader, nil).
AnyTimes() // Allow multiple calls to this method to always return our mock header
AnyTimes()

// Minimal configuration for the syncer (can be empty if config values are unused in this test)
cfg := &ethconfig.Zk{
L1BlockRange: 2,
}
Expand All @@ -188,9 +183,9 @@ func TestUpdater_CheckForInfoTreeUpdates(t *testing.T) {
[]syncer.IEtherman{EthermanMock},
[]common.Address{},
[][]common.Hash{},
cfg.L1BlockRange, // cfg.L1BlockRange,
cfg.L1QueryDelay, // cfg.L1QueryDelay,
cfg.L1HighestBlockType, // cfg.L1HighestBlockType,
cfg.L1BlockRange,
cfg.L1QueryDelay,
cfg.L1HighestBlockType,
)

updater := l1infotree.NewUpdater(cfg, l1InfoTreeSyncer)
Expand All @@ -201,11 +196,11 @@ func TestUpdater_CheckForInfoTreeUpdates(t *testing.T) {
err := updater.WarmUp(tx)
assert.NoError(t, err)

// func (u *Updater) CheckForInfoTreeUpdates(logPrefix string, tx kv.RwTx) (allLogs []types.Log, err error) {
allLogs, err := updater.CheckForInfoTreeUpdates(
"TestUpdater_CheckForInfoTreeUpdates",
tx,
)
assert.NoError(t, err)
assert.NotNil(t, allLogs)
// TODO: add more setup on mock/syncer to get a certain number of logs here.
// assert.NotNil(t, allLogs)
}

0 comments on commit 6c7b35a

Please sign in to comment.