Skip to content

Commit

Permalink
Merge in test for multichain issue hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
reductionista committed Oct 1, 2024
1 parent 1ed7ab3 commit b7f8797
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions core/chains/evm/logpoller/orm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,22 @@ func TestORM(t *testing.T) {
Data: []byte("hello short retention"),
BlockTimestamp: time.Now(),
},
{
EvmChainId: ubig.New(th.ChainID),
LogIndex: 7,
BlockHash: common.HexToHash("0x1239"),
BlockNumber: int64(17),
EventSig: topic,
Topics: [][]byte{topic[:]},
Address: common.HexToAddress("0x1236"),
TxHash: common.HexToHash("0x1888"),
Data: []byte("hello2 short retention"),
BlockTimestamp: time.Now(),
},
{
EvmChainId: ubig.New(th.ChainID),
LogIndex: 8,
BlockHash: common.HexToHash("0x1238"),
BlockHash: common.HexToHash("0x1239"),
BlockNumber: int64(17),
EventSig: topic2,
Topics: [][]byte{topic2[:]},
Expand Down Expand Up @@ -368,10 +380,9 @@ func TestORM(t *testing.T) {
},
}))

t.Log(latest.BlockNumber)
logs, err := o1.SelectLogsByBlockRange(ctx, 1, 17)
require.NoError(t, err)
require.Len(t, logs, 8)
require.Len(t, logs, 9)

logs, err = o1.SelectLogsByBlockRange(ctx, 10, 10)
require.NoError(t, err)
Expand Down Expand Up @@ -486,13 +497,13 @@ func TestORM(t *testing.T) {
require.Equal(t, int64(17), latest.BlockNumber)
logs, err = o1.SelectLogsByBlockRange(ctx, 1, latest.BlockNumber)
require.NoError(t, err)
require.Len(t, logs, 8)
require.Len(t, logs, 9)

// Delete expired logs with page limit
time.Sleep(2 * time.Millisecond) // just in case we haven't reached the end of the 1ms retention period
deleted, err := o1.DeleteExpiredLogs(ctx, 2)
deleted, err := o1.DeleteExpiredLogs(ctx, 1)
require.NoError(t, err)
assert.Equal(t, int64(2), deleted)
assert.Equal(t, int64(1), deleted)

// Delete expired logs without page limit
deleted, err = o1.DeleteExpiredLogs(ctx, 0)
Expand Down Expand Up @@ -934,7 +945,7 @@ func TestORM_DataWords(t *testing.T) {
},
}))

wordFilter := func(wordIdx uint8, word1, word2 uint64) []query.Expression {
wordFilter := func(wordIdx int, word1, word2 uint64) []query.Expression {
return []query.Expression{
logpoller.NewAddressFilter(addr),
logpoller.NewEventSigFilter(eventSig),
Expand Down

0 comments on commit b7f8797

Please sign in to comment.