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

Remove onboard/connect validation error logging #1526

Merged
merged 1 commit into from
May 16, 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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { getIpAddr } from '../../../../src/lib/utils';
import { sendRequest } from '../../../helpers/helpers';
import { RequestMethod } from '../../../../src/types';
import { logger, stats } from '@dydxprotocol-indexer/base';
import { stats } from '@dydxprotocol-indexer/base';
import { redis } from '@dydxprotocol-indexer/redis';
import { ratelimitRedis } from '../../../../src/caches/rate-limiters';
import { ComplianceControllerHelper } from '../../../../src/controllers/api/v4/compliance-controller';
Expand Down Expand Up @@ -447,7 +447,6 @@ describe('ComplianceV2Controller', () => {
});

it('should be a no-op for ONBOARD action with existing COMPLIANT status', async () => {
const loggerError = jest.spyOn(logger, 'error');
await ComplianceStatusTable.create({
address: testConstants.defaultAddress,
status: ComplianceStatus.COMPLIANT,
Expand All @@ -468,16 +467,10 @@ describe('ComplianceV2Controller', () => {
address: testConstants.defaultAddress,
status: ComplianceStatus.COMPLIANT,
}));

expect(loggerError).toHaveBeenCalledWith(expect.objectContaining({
at: 'ComplianceV2Controller POST /geoblock',
message: 'Invalid action for current compliance status',
}));
expect(response.body.status).toEqual(ComplianceStatus.COMPLIANT);
});

it('should be a no-op for ONBOARD action with existing FIRST_STRIKE_CLOSE_ONLY status', async () => {
const loggerError = jest.spyOn(logger, 'error');
await ComplianceStatusTable.create({
address: testConstants.defaultAddress,
status: ComplianceStatus.FIRST_STRIKE_CLOSE_ONLY,
Expand All @@ -501,10 +494,6 @@ describe('ComplianceV2Controller', () => {
reason: ComplianceReason.US_GEO,
}));

expect(loggerError).toHaveBeenCalledWith(expect.objectContaining({
at: 'ComplianceV2Controller POST /geoblock',
message: 'Invalid action for current compliance status',
}));
expect(response.body.status).toEqual(ComplianceStatus.FIRST_STRIKE_CLOSE_ONLY);
expect(response.body.reason).toEqual(ComplianceReason.US_GEO);
expect(response.body.updatedAt).toBeDefined();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,7 @@ router.post(
complianceStatus[0].status === ComplianceStatus.FIRST_STRIKE ||
complianceStatus[0].status === ComplianceStatus.COMPLIANT
) {
if (action === ComplianceAction.ONBOARD) {
logger.error({
at: 'ComplianceV2Controller POST /geoblock',
message: 'Invalid action for current compliance status',
address,
action,
complianceStatus: complianceStatus[0],
});
} else if (
if (
isRestrictedCountryHeaders(req.headers as CountryHeaders) &&
action === ComplianceAction.CONNECT
) {
Expand All @@ -320,15 +312,7 @@ router.post(
} else if (
complianceStatus[0].status === ComplianceStatus.FIRST_STRIKE_CLOSE_ONLY
) {
if (action === ComplianceAction.ONBOARD) {
logger.error({
at: 'ComplianceV2Controller POST /geoblock',
message: 'Invalid action for current compliance status',
address,
action,
complianceStatus: complianceStatus[0],
});
} else if (action === ComplianceAction.VALID_SURVEY) {
if (action === ComplianceAction.VALID_SURVEY) {
complianceStatusFromDatabase = await ComplianceStatusTable.update({
address,
status: ComplianceStatus.FIRST_STRIKE,
Expand Down
Loading