Skip to content

Commit

Permalink
Revert "fix: prevent query syntax error if allowlist is empty (#12912)"
Browse files Browse the repository at this point in the history
This reverts commit b1c8d74.
  • Loading branch information
HenryNguyen5 committed Apr 27, 2024
1 parent ee9ea07 commit ae7884d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
5 changes: 0 additions & 5 deletions core/services/gateway/handlers/functions/allowlist/orm.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ func (o *orm) GetAllowedSenders(ctx context.Context, offset, limit uint) ([]comm
}

func (o *orm) CreateAllowedSenders(ctx context.Context, allowedSenders []common.Address) error {
if len(allowedSenders) == 0 {
o.lggr.Debugf("empty allowed senders list: %v for routerContractAddress: %s. skipping...", allowedSenders, o.routerContractAddress)
return nil
}

var valuesPlaceholder []string
for i := 1; i <= len(allowedSenders)*2; i += 2 {
valuesPlaceholder = append(valuesPlaceholder, fmt.Sprintf("($%d, $%d)", i, i+1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,6 @@ func TestORM_CreateAllowedSenders(t *testing.T) {
require.Equal(t, expected[0], results[0])
require.Equal(t, expected[1], results[1])
})

// this scenario can happen if the allowlist is empty but we call CreateAllowedSenders
t.Run("OK-empty_list", func(t *testing.T) {
ctx := testutils.Context(t)
orm, err := setupORM(t)
require.NoError(t, err)
err = orm.CreateAllowedSenders(ctx, []common.Address{})
require.NoError(t, err)
})
}

func TestORM_DeleteAllowedSenders(t *testing.T) {
Expand Down

0 comments on commit ae7884d

Please sign in to comment.