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 all 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
5 changes: 5 additions & 0 deletions .changeset/thirty-olives-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

Change ChainReader Block primitive field from int to string. #internal
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 @@ import (
"fmt"
"math"
"math/big"
"strconv"
"testing"
"time"

Expand Down Expand Up @@ -642,7 +643,7 @@ func TestORM_IndexedLogs(t *testing.T) {
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),
Expand All @@ -658,39 +659,39 @@ func TestORM_IndexedLogs(t *testing.T) {
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 @@ func TestORM_SelectLogsWithSigsByBlockRangeFilter(t *testing.T) {
}
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 @@ func TestORM_SelectLogsWithSigsByBlockRangeFilter(t *testing.T) {
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),
query.Block(endBlock, primitives.Lte),
},
BoolOperator: query.AND,
},
Expand Down Expand Up @@ -1097,8 +1098,7 @@ func TestORM_SelectLogsWithSigsByBlockRangeFilter(t *testing.T) {
})

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,7 +1160,7 @@ func TestLogPoller_Logs(t *testing.T) {
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),
Expand All @@ -1181,7 +1181,7 @@ func TestLogPoller_Logs(t *testing.T) {
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 @@ func TestLogPoller_Logs(t *testing.T) {
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 @@ func TestDSLParser(t *testing.T) {
expressions := []query.Expression{
query.Timestamp(10, primitives.Eq),
query.TxHash(common.HexToHash("0x84").String()),
query.Block(99, primitives.Neq),
query.Block("99", primitives.Neq),
query.Confidence(primitives.Finalized),
}
limiter := query.NewLimitAndSort(query.CursorLimit("10-20-0x42", query.CursorPrevious, 20))
Expand Down
2 changes: 1 addition & 1 deletion core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
github.com/prometheus/client_golang v1.17.0
github.com/shopspring/decimal v1.4.0
github.com/smartcontractkit/chainlink-automation v1.0.4
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240805160614-501c4f40b98c
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240808143317-6b16fc28887d
github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000
github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7
github.com/spf13/cobra v1.8.0
Expand Down
4 changes: 2 additions & 2 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1186,8 +1186,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um
github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240806144315-04ac101e9c95 h1:LAgJTg9Yr/uCo2g7Krp88Dco2U45Y6sbJVl8uKoLkys=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240806144315-04ac101e9c95/go.mod h1:/ZWraCBaDDgaIN1prixYcbVvIk/6HeED9+8zbWQ+TMo=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240805160614-501c4f40b98c h1:3apUsez/6Pkp1ckXzSwIhzPRuWjDGjzMjKapEKi0Fcw=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240805160614-501c4f40b98c/go.mod h1:Jg1sCTsbxg76YByI8ifpFby3FvVqISStHT8ypy9ocmY=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240808143317-6b16fc28887d h1:ATGkySP4ATI2kZ+d9zzNi93iaH0KcDGB8AewI8TJkiI=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240808143317-6b16fc28887d/go.mod h1:Jg1sCTsbxg76YByI8ifpFby3FvVqISStHT8ypy9ocmY=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 h1:NBQLtqk8zsyY4qTJs+NElI3aDFTcAo83JHvqD04EvB0=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45/go.mod h1:LV0h7QBQUpoC2UUi6TcUvcIFm1xjP/DtEcqV8+qeLUs=
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240801131703-fd75761c982f h1:I9fTBJpHkeldFplXUy71eLIn6A6GxuR4xrABoUeD+CM=
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ require (
github.com/smartcontractkit/chain-selectors v1.0.10
github.com/smartcontractkit/chainlink-automation v1.0.4
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240806144315-04ac101e9c95
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240805160614-501c4f40b98c
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240808143317-6b16fc28887d
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240801131703-fd75761c982f
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240710170203-5b41615da827
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1141,8 +1141,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um
github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240806144315-04ac101e9c95 h1:LAgJTg9Yr/uCo2g7Krp88Dco2U45Y6sbJVl8uKoLkys=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240806144315-04ac101e9c95/go.mod h1:/ZWraCBaDDgaIN1prixYcbVvIk/6HeED9+8zbWQ+TMo=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240805160614-501c4f40b98c h1:3apUsez/6Pkp1ckXzSwIhzPRuWjDGjzMjKapEKi0Fcw=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240805160614-501c4f40b98c/go.mod h1:Jg1sCTsbxg76YByI8ifpFby3FvVqISStHT8ypy9ocmY=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240808143317-6b16fc28887d h1:ATGkySP4ATI2kZ+d9zzNi93iaH0KcDGB8AewI8TJkiI=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240808143317-6b16fc28887d/go.mod h1:Jg1sCTsbxg76YByI8ifpFby3FvVqISStHT8ypy9ocmY=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 h1:NBQLtqk8zsyY4qTJs+NElI3aDFTcAo83JHvqD04EvB0=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45/go.mod h1:LV0h7QBQUpoC2UUi6TcUvcIFm1xjP/DtEcqV8+qeLUs=
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240801131703-fd75761c982f h1:I9fTBJpHkeldFplXUy71eLIn6A6GxuR4xrABoUeD+CM=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ require (
github.com/shopspring/decimal v1.4.0
github.com/slack-go/slack v0.12.2
github.com/smartcontractkit/chainlink-automation v1.0.4
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240805160614-501c4f40b98c
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240808143317-6b16fc28887d
github.com/smartcontractkit/chainlink-testing-framework v1.34.2
github.com/smartcontractkit/chainlink-testing-framework/grafana v0.0.0-20240405215812-5a72bc9af239
github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1490,8 +1490,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um
github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240806144315-04ac101e9c95 h1:LAgJTg9Yr/uCo2g7Krp88Dco2U45Y6sbJVl8uKoLkys=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240806144315-04ac101e9c95/go.mod h1:/ZWraCBaDDgaIN1prixYcbVvIk/6HeED9+8zbWQ+TMo=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240805160614-501c4f40b98c h1:3apUsez/6Pkp1ckXzSwIhzPRuWjDGjzMjKapEKi0Fcw=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240805160614-501c4f40b98c/go.mod h1:Jg1sCTsbxg76YByI8ifpFby3FvVqISStHT8ypy9ocmY=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240808143317-6b16fc28887d h1:ATGkySP4ATI2kZ+d9zzNi93iaH0KcDGB8AewI8TJkiI=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240808143317-6b16fc28887d/go.mod h1:Jg1sCTsbxg76YByI8ifpFby3FvVqISStHT8ypy9ocmY=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 h1:NBQLtqk8zsyY4qTJs+NElI3aDFTcAo83JHvqD04EvB0=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45/go.mod h1:LV0h7QBQUpoC2UUi6TcUvcIFm1xjP/DtEcqV8+qeLUs=
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240801131703-fd75761c982f h1:I9fTBJpHkeldFplXUy71eLIn6A6GxuR4xrABoUeD+CM=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/load/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/rs/zerolog v1.31.0
github.com/slack-go/slack v0.12.2
github.com/smartcontractkit/chainlink-automation v1.0.4
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240805160614-501c4f40b98c
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240808143317-6b16fc28887d
github.com/smartcontractkit/chainlink-testing-framework v1.34.2
github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20240214231432-4ad5eb95178c
github.com/smartcontractkit/chainlink/v2 v2.9.0-beta0.0.20240216210048-da02459ddad8
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/load/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1472,8 +1472,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um
github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240806144315-04ac101e9c95 h1:LAgJTg9Yr/uCo2g7Krp88Dco2U45Y6sbJVl8uKoLkys=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240806144315-04ac101e9c95/go.mod h1:/ZWraCBaDDgaIN1prixYcbVvIk/6HeED9+8zbWQ+TMo=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240805160614-501c4f40b98c h1:3apUsez/6Pkp1ckXzSwIhzPRuWjDGjzMjKapEKi0Fcw=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240805160614-501c4f40b98c/go.mod h1:Jg1sCTsbxg76YByI8ifpFby3FvVqISStHT8ypy9ocmY=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240808143317-6b16fc28887d h1:ATGkySP4ATI2kZ+d9zzNi93iaH0KcDGB8AewI8TJkiI=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240808143317-6b16fc28887d/go.mod h1:Jg1sCTsbxg76YByI8ifpFby3FvVqISStHT8ypy9ocmY=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 h1:NBQLtqk8zsyY4qTJs+NElI3aDFTcAo83JHvqD04EvB0=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45/go.mod h1:LV0h7QBQUpoC2UUi6TcUvcIFm1xjP/DtEcqV8+qeLUs=
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240801131703-fd75761c982f h1:I9fTBJpHkeldFplXUy71eLIn6A6GxuR4xrABoUeD+CM=
Expand Down
Loading