Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BCI-3862][chainlink] - Change DSL Block primitive to string instead of int #14033

Merged
merged 23 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f2b92fd
refactor after modifying block from int to string
Farber98 Aug 5, 2024
acc3635
Merge branch 'develop' into BCI-3862-change-dsl-block-primitive-to-st…
Farber98 Aug 6, 2024
ed28ecd
bump common version
Farber98 Aug 6, 2024
c430d43
Merge branch 'develop' into BCI-3862-change-dsl-block-primitive-to-st…
Farber98 Aug 6, 2024
b3aaab9
update avast that was failing
Farber98 Aug 6, 2024
764d3ea
add changeset
Farber98 Aug 6, 2024
e6fa62b
Merge branch 'develop' into BCI-3862-change-dsl-block-primitive-to-st…
Farber98 Aug 6, 2024
fbec265
Merge branch 'develop' into BCI-3862-change-dsl-block-primitive-to-st…
Farber98 Aug 6, 2024
bf98aab
fix common references
Farber98 Aug 6, 2024
56328c5
tidy
Farber98 Aug 6, 2024
cc0146d
Merge branch 'develop' into BCI-3862-change-dsl-block-primitive-to-st…
Farber98 Aug 6, 2024
0e2bca8
Merge branch 'develop' into BCI-3862-change-dsl-block-primitive-to-st…
Farber98 Aug 7, 2024
5dbbd03
update common commit hash
Farber98 Aug 7, 2024
3451d81
Revert "update common commit hash"
Farber98 Aug 7, 2024
ef3b11c
Merge branch 'develop' into BCI-3862-change-dsl-block-primitive-to-st…
Farber98 Aug 7, 2024
ed2567c
update common commit hash
Farber98 Aug 7, 2024
41794b9
Merge branch 'BCI-3862-change-dsl-block-primitive-to-string' of githu…
Farber98 Aug 7, 2024
f0d99da
Merge branch 'develop' into BCI-3862-change-dsl-block-primitive-to-st…
Farber98 Aug 7, 2024
7a9cef5
Merge branch 'develop' into BCI-3862-change-dsl-block-primitive-to-st…
Farber98 Aug 8, 2024
2fa9c8d
reference to changes in common
Farber98 Aug 8, 2024
9bf5f9f
Merge branch 'BCI-3862-change-dsl-block-primitive-to-string' of githu…
Farber98 Aug 8, 2024
949eca8
Merge branch 'develop' into BCI-3862-change-dsl-block-primitive-to-st…
Farber98 Aug 8, 2024
f5b077a
update common ref
Farber98 Aug 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions core/chains/evm/logpoller/orm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"fmt"
"math"
"math/big"
"strconv"
"testing"
"time"

Expand Down Expand Up @@ -642,14 +643,14 @@
require.NoError(t, err)
assert.Equal(t, 2, len(lgs))

blockRangeFilter := func(start, end uint64, topicIdx uint64, topicValues []uint64) query.KeyFilter {
blockRangeFilter := func(start, end string, topicIdx uint64, topicValues []uint64) query.KeyFilter {
return query.KeyFilter{
Expressions: []query.Expression{
logpoller.NewAddressFilter(addr),
logpoller.NewEventSigFilter(eventSig),
filtersForTopics(topicIdx, topicValues),
query.Block(start, primitives.Gte),

Check failure on line 652 in core/chains/evm/logpoller/orm_test.go

View workflow job for this annotation

GitHub Actions / lint

cannot use start (variable of type string) as uint64 value in argument to query.Block (typecheck)
query.Block(end, primitives.Lte),

Check failure on line 653 in core/chains/evm/logpoller/orm_test.go

View workflow job for this annotation

GitHub Actions / lint

cannot use end (variable of type string) as uint64 value in argument to query.Block (typecheck)
},
}
}
Expand All @@ -658,39 +659,39 @@
require.NoError(t, err)
assert.Equal(t, 1, len(lgs))

lgs, err = o1.FilteredLogs(ctx, blockRangeFilter(1, 1, 1, []uint64{1}), limiter, "")
lgs, err = o1.FilteredLogs(ctx, blockRangeFilter("1", "1", 1, []uint64{1}), limiter, "")
require.NoError(t, err)
assert.Equal(t, 1, len(lgs))

lgs, err = o1.SelectIndexedLogsByBlockRange(ctx, 1, 2, addr, eventSig, 1, []common.Hash{logpoller.EvmWord(2)})
require.NoError(t, err)
assert.Equal(t, 1, len(lgs))

lgs, err = o1.FilteredLogs(ctx, blockRangeFilter(1, 2, 1, []uint64{2}), limiter, "")
lgs, err = o1.FilteredLogs(ctx, blockRangeFilter("1", "2", 1, []uint64{2}), limiter, "")
require.NoError(t, err)
assert.Equal(t, 1, len(lgs))

lgs, err = o1.SelectIndexedLogsByBlockRange(ctx, 1, 2, addr, eventSig, 1, []common.Hash{logpoller.EvmWord(1)})
require.NoError(t, err)
assert.Equal(t, 1, len(lgs))

lgs, err = o1.FilteredLogs(ctx, blockRangeFilter(1, 2, 1, []uint64{1}), limiter, "")
lgs, err = o1.FilteredLogs(ctx, blockRangeFilter("1", "2", 1, []uint64{1}), limiter, "")
require.NoError(t, err)
assert.Equal(t, 1, len(lgs))

_, err = o1.SelectIndexedLogsByBlockRange(ctx, 1, 2, addr, eventSig, 0, []common.Hash{logpoller.EvmWord(1)})
require.Error(t, err)
assert.Contains(t, err.Error(), "invalid index for topic: 0")

_, err = o1.FilteredLogs(ctx, blockRangeFilter(1, 2, 0, []uint64{1}), limiter, "")
_, err = o1.FilteredLogs(ctx, blockRangeFilter("1", "2", 0, []uint64{1}), limiter, "")
require.Error(t, err)
assert.Contains(t, err.Error(), "invalid index for topic: 0")

_, err = o1.SelectIndexedLogsByBlockRange(ctx, 1, 2, addr, eventSig, 4, []common.Hash{logpoller.EvmWord(1)})
require.Error(t, err)
assert.Contains(t, err.Error(), "invalid index for topic: 4")

_, err = o1.FilteredLogs(ctx, blockRangeFilter(1, 2, 4, []uint64{1}), limiter, "")
_, err = o1.FilteredLogs(ctx, blockRangeFilter("1", "2", 4, []uint64{1}), limiter, "")
require.Error(t, err)
assert.Contains(t, err.Error(), "invalid index for topic: 4")

Expand Down Expand Up @@ -1042,7 +1043,7 @@
}
require.NoError(t, o1.InsertLogs(ctx, inputLogs))

filter := func(sigs []common.Hash, startBlock, endBlock int64) query.KeyFilter {
filter := func(sigs []common.Hash, startBlock, endBlock string) query.KeyFilter {
filters := []query.Expression{
logpoller.NewAddressFilter(sourceAddr),
}
Expand All @@ -1064,8 +1065,8 @@
filters = append(filters, query.Expression{
BoolExpression: query.BoolExpression{
Expressions: []query.Expression{
query.Block(uint64(startBlock), primitives.Gte),
query.Block(uint64(endBlock), primitives.Lte),
query.Block(startBlock, primitives.Gte),

Check failure on line 1068 in core/chains/evm/logpoller/orm_test.go

View workflow job for this annotation

GitHub Actions / lint

cannot use startBlock (variable of type string) as uint64 value in argument to query.Block (typecheck)
query.Block(endBlock, primitives.Lte),

Check failure on line 1069 in core/chains/evm/logpoller/orm_test.go

View workflow job for this annotation

GitHub Actions / lint

cannot use endBlock (variable of type string) as uint64 value in argument to query.Block (typecheck)
},
BoolOperator: query.AND,
},
Expand Down Expand Up @@ -1097,8 +1098,7 @@
})

assertion(t, logs, err, startBlock, endBlock)

logs, err = th.ORM.FilteredLogs(ctx, filter([]common.Hash{topic, topic2}, startBlock, endBlock), limiter, "")
logs, err = th.ORM.FilteredLogs(ctx, filter([]common.Hash{topic, topic2}, strconv.Itoa(int(startBlock)), strconv.Itoa(int(endBlock))), limiter, "")

assertion(t, logs, err, startBlock, endBlock)
}
Expand Down Expand Up @@ -1160,13 +1160,13 @@
assert.Equal(t, "0x0000000000000000000000000000000000000000000000000000000000000005", lgs[4].BlockHash.String())
assert.Equal(t, "0x0000000000000000000000000000000000000000000000000000000000000005", lgs[5].BlockHash.String())

logFilter := func(start, end uint64, address common.Address) query.KeyFilter {
logFilter := func(start, end string, address common.Address) query.KeyFilter {
return query.KeyFilter{
Expressions: []query.Expression{
logpoller.NewAddressFilter(address),
logpoller.NewEventSigFilter(event1),
query.Block(start, primitives.Gte),

Check failure on line 1168 in core/chains/evm/logpoller/orm_test.go

View workflow job for this annotation

GitHub Actions / lint

cannot use start (variable of type string) as uint64 value in argument to query.Block (typecheck)
query.Block(end, primitives.Lte),

Check failure on line 1169 in core/chains/evm/logpoller/orm_test.go

View workflow job for this annotation

GitHub Actions / lint

cannot use end (variable of type string) as uint64 value in argument to query.Block (typecheck)
},
}
}
Expand All @@ -1181,7 +1181,7 @@
assert.Equal(t, "0x0000000000000000000000000000000000000000000000000000000000000005", lgs[1].BlockHash.String())
assert.Equal(t, address1, lgs[1].Address)

lgs, err = th.ORM.FilteredLogs(ctx, logFilter(1, 3, address1), query.LimitAndSort{
lgs, err = th.ORM.FilteredLogs(ctx, logFilter("1", "3", address1), query.LimitAndSort{
SortBy: []query.SortBy{query.NewSortBySequence(query.Asc)},
}, "")
require.NoError(t, err)
Expand All @@ -1201,7 +1201,7 @@
assert.Equal(t, address2, lgs[0].Address)
assert.Equal(t, event1.Bytes(), lgs[0].Topics[0])

lgs, err = th.ORM.FilteredLogs(ctx, logFilter(2, 2, address2), query.LimitAndSort{
lgs, err = th.ORM.FilteredLogs(ctx, logFilter("2", "2", address2), query.LimitAndSort{
SortBy: []query.SortBy{query.NewSortBySequence(query.Asc)},
}, "")
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/logpoller/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
expressions := []query.Expression{
query.Timestamp(10, primitives.Eq),
query.TxHash(common.HexToHash("0x84").String()),
query.Block(99, primitives.Neq),
query.Block("99", primitives.Neq),

Check failure on line 144 in core/chains/evm/logpoller/parser_test.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests)

cannot use "99" (untyped string constant) as uint64 value in argument to query.Block

Check failure on line 144 in core/chains/evm/logpoller/parser_test.go

View workflow job for this annotation

GitHub Actions / lint

cannot use "99" (untyped string constant) as uint64 value in argument to query.Block (typecheck)

Check failure on line 144 in core/chains/evm/logpoller/parser_test.go

View workflow job for this annotation

GitHub Actions / lint

cannot use "99" (untyped string constant) as uint64 value in argument to query.Block) (typecheck)

Check failure on line 144 in core/chains/evm/logpoller/parser_test.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_race_tests)

cannot use "99" (untyped string constant) as uint64 value in argument to query.Block
query.Confidence(primitives.Finalized),
}
limiter := query.NewLimitAndSort(query.CursorLimit("10-20-0x42", query.CursorPrevious, 20))
Expand Down
Loading