Skip to content

Commit

Permalink
address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
EasterTheBunny committed Dec 18, 2024
1 parent 761b738 commit 23a782c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions pkg/solana/logpoller/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (v *pgDSLParser) TxHash(prim primitives.TxHash) {
v.expression = fmt.Sprintf(
"%s = :%s",
txHashFieldName,
v.args.withIndexedField(txHashFieldName, txHash),
v.args.withIndexedField(txHashFieldName, PublicKey(txHash)),
)
}

Expand Down Expand Up @@ -174,7 +174,7 @@ func (v *pgDSLParser) buildQuery(
}

func (v *pgDSLParser) whereClause(expressions []query.Expression, limiter query.LimitAndSort) (string, error) {
segment := fmt.Sprintf("WHERE %s = :solana_chain_id", chainIDFieldName)
segment := fmt.Sprintf("WHERE %s = :chain_id", chainIDFieldName)

if len(expressions) > 0 {
exp, err := v.combineExpressions(expressions, query.AND)
Expand Down
20 changes: 10 additions & 10 deletions pkg/solana/logpoller/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestDSLParser(t *testing.T) {
result, args, err := parser.buildQuery(chainID, expressions, limiter)

require.NoError(t, err)
assert.Equal(t, logsQuery(" WHERE chain_id = :solana_chain_id ORDER BY "+defaultSort), result)
assert.Equal(t, logsQuery(" WHERE chain_id = :chain_id ORDER BY "+defaultSort), result)

assertArgs(t, args, 1)
})
Expand All @@ -60,7 +60,7 @@ func TestDSLParser(t *testing.T) {

result, args, err := parser.buildQuery(chainID, expressions, limiter)
expected := logsQuery(
" WHERE chain_id = :solana_chain_id " +
" WHERE chain_id = :chain_id " +
"AND (address = :address_0 AND event_sig = :event_sig_0) " +
"AND (block_number > :cursor_block_number OR (block_number = :cursor_block_number " +
"AND log_index > :cursor_log_index)) " +
Expand Down Expand Up @@ -88,7 +88,7 @@ func TestDSLParser(t *testing.T) {

result, args, err := parser.buildQuery(chainID, expressions, limiter)
expected := logsQuery(
" WHERE chain_id = :solana_chain_id " +
" WHERE chain_id = :chain_id " +
"AND (address = :address_0 AND event_sig = :event_sig_0) " +
"ORDER BY " + defaultSort + " " +
"LIMIT 20")
Expand All @@ -108,7 +108,7 @@ func TestDSLParser(t *testing.T) {

result, args, err := parser.buildQuery(chainID, expressions, limiter)
expected := logsQuery(
" WHERE chain_id = :solana_chain_id " +
" WHERE chain_id = :chain_id " +
"ORDER BY block_number DESC, log_index DESC, tx_hash DESC")

require.NoError(t, err)
Expand All @@ -126,7 +126,7 @@ func TestDSLParser(t *testing.T) {

result, args, err := parser.buildQuery(chainID, expressions, limiter)
expected := logsQuery(
" WHERE chain_id = :solana_chain_id " +
" WHERE chain_id = :chain_id " +
"ORDER BY block_number ASC, block_timestamp DESC")

require.NoError(t, err)
Expand All @@ -149,7 +149,7 @@ func TestDSLParser(t *testing.T) {

result, args, err := parser.buildQuery(chainID, expressions, limiter)
expected := logsQuery(
" WHERE chain_id = :solana_chain_id " +
" WHERE chain_id = :chain_id " +
"AND (block_timestamp = :block_timestamp_0 AND tx_hash = :tx_hash_0 " +
"AND block_number != :block_number_0) " +
"AND (block_number < :cursor_block_number OR (block_number = :cursor_block_number " +
Expand All @@ -172,7 +172,7 @@ func TestDSLParser(t *testing.T) {

result, args, err := parser.buildQuery(chainID, expressions, limiter)
expected := logsQuery(
" WHERE chain_id = :solana_chain_id " +
" WHERE chain_id = :chain_id " +
"ORDER BY " + defaultSort)

require.NoError(t, err)
Expand All @@ -188,7 +188,7 @@ func TestDSLParser(t *testing.T) {

result, args, err := parser.buildQuery(chainID, expressions, limiter)
expected := logsQuery(
" WHERE chain_id = :solana_chain_id " +
" WHERE chain_id = :chain_id " +
"ORDER BY " + defaultSort)

require.NoError(t, err)
Expand Down Expand Up @@ -223,7 +223,7 @@ func TestDSLParser(t *testing.T) {

result, args, err := parser.buildQuery(chainID, expressions, limiter)
expected := logsQuery(
" WHERE chain_id = :solana_chain_id " +
" WHERE chain_id = :chain_id " +
"AND (block_timestamp >= :block_timestamp_0 AND tx_hash = :tx_hash_0) " +
"ORDER BY " + defaultSort)

Expand Down Expand Up @@ -265,7 +265,7 @@ func TestDSLParser(t *testing.T) {

result, args, err := parser.buildQuery(chainID, expressions, limiter)
expected := logsQuery(
" WHERE chain_id = :solana_chain_id " +
" WHERE chain_id = :chain_id " +
"AND (block_timestamp = :block_timestamp_0 " +
"AND (tx_hash = :tx_hash_0 OR event_sig = :event_sig_0)) " +
"ORDER BY " + defaultSort)
Expand Down

0 comments on commit 23a782c

Please sign in to comment.