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-common] - Change DSL Block primitive to string instead of int #688

Merged
merged 3 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions pkg/loop/internal/pb/chain_reader.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/loop/internal/pb/chain_reader.proto
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ message Comparator {
}

message Block{
uint64 block_number = 1;
string block_number = 1;
ComparisonOperator operator = 2;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func generateQueryFilterTestCases(t *testing.T) []query.KeyFilter {

primitiveExpressions := []query.Expression{query.TxHash("txHash")}
for _, op := range operatorValues {
primitiveExpressions = append(primitiveExpressions, query.Block(123, op))
primitiveExpressions = append(primitiveExpressions, query.Block("123", op))
primitiveExpressions = append(primitiveExpressions, query.Timestamp(123, op))

var valueComparators []primitives.ValueComparator
Expand Down
2 changes: 1 addition & 1 deletion pkg/types/query/primitives/primitives.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (f *Comparator) Accept(visitor Visitor) {

// Block is a primitive of KeyFilter that filters search in comparison to block number.
type Block struct {
Block uint64
Block string
Operator ComparisonOperator
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/types/query/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func Comparator(name string, valueComparators ...primitives.ValueComparator) Exp
return Expression{Primitive: &primitives.Comparator{Name: name, ValueComparators: valueComparators}}
}

func Block(block uint64, operator primitives.ComparisonOperator) Expression {
func Block(block string, operator primitives.ComparisonOperator) Expression {
return Expression{
Primitive: &primitives.Block{Block: block, Operator: operator},
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/types/query/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,20 @@ func Test_AndOrEdgeCases(t *testing.T) {
},
{
name: "And with multiple expressions",
expressions: []Expression{TxHash("txHash"), Block(123, primitives.Eq)},
expressions: []Expression{TxHash("txHash"), Block("123", primitives.Eq)},
constructor: And,
expected: And(
TxHash("txHash"),
Block(123, primitives.Eq),
Block("123", primitives.Eq),
),
},
{
name: "Or with multiple expressions",
expressions: []Expression{TxHash("txHash"), Block(123, primitives.Eq)},
expressions: []Expression{TxHash("txHash"), Block("123", primitives.Eq)},
constructor: Or,
expected: Or(
TxHash("txHash"),
Block(123, primitives.Eq),
Block("123", primitives.Eq),
),
},
}
Expand Down
Loading