Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/snapshot-labs/pret…
Browse files Browse the repository at this point in the history
…tier-config-0.1.0-beta.18
  • Loading branch information
ChaituVR authored Aug 1, 2024
2 parents 25e6ce7 + ade18c2 commit f79481d
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 44 deletions.
4 changes: 2 additions & 2 deletions src/aws.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as AWS from '@aws-sdk/client-s3';
import { Readable } from 'stream';
import * as AWS from '@aws-sdk/client-s3';
import { capture } from '@snapshot-labs/snapshot-sentry';
import { AWS_CACHE_KEY, APP_NAME } from './constants';
import { APP_NAME, AWS_CACHE_KEY } from './constants';

let client;
const bucket = process.env.AWS_BUCKET_NAME;
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/keycard.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Keycard } from '@snapshot-labs/keycard';
import { rpcError } from '../utils';
import { APP_NAME } from '../constants';
import { rpcError } from '../utils';

const keycard = new Keycard({
app: APP_NAME,
Expand Down
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'dotenv/config';
import express from 'express';
import { fallbackLogger, initLogger } from '@snapshot-labs/snapshot-sentry';
import cors from 'cors';
import { initLogger, fallbackLogger } from '@snapshot-labs/snapshot-sentry';
import express from 'express';
import { checkKeycard } from './helpers/keycard';
import rpc from './rpc';
import { rpcError } from './utils';
import rateLimit from './helpers/rateLimit';
import initMetrics from './metrics';
import rpc from './rpc';
import { rpcError } from './utils';

const app = express();
const PORT = process.env.PORT ?? 3003;
Expand Down
4 changes: 2 additions & 2 deletions src/methods.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getVp, validate } from './methods';
import snapshot from '@snapshot-labs/strategies';
import { getCurrentBlockNum, sha256 } from './utils';
import { getVp, validate } from './methods';
import * as redisModule from './redis';
import { getCurrentBlockNum, sha256 } from './utils';

jest.mock('@snapshot-labs/strategies');
jest.mock('./utils');
Expand Down
4 changes: 2 additions & 2 deletions src/methods.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import snapshot from '@snapshot-labs/strategies';
import redis from './redis';
import { sha256, getCurrentBlockNum } from './utils';
import disabled from './disabled.json';
import redis from './redis';
import { getCurrentBlockNum, sha256 } from './utils';

interface GetVpRequestParams {
address: string;
Expand Down
2 changes: 1 addition & 1 deletion src/requestDeduplicator.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import serve from './requestDeduplicator';
import { requestDeduplicatorSize } from './metrics';
import serve from './requestDeduplicator';

jest.mock('./utils', () => ({
sha256: jest.fn(id => `hashed_${id}`)
Expand Down
2 changes: 1 addition & 1 deletion src/requestDeduplicator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { sha256 } from './utils';
import { requestDeduplicatorSize } from './metrics';
import { sha256 } from './utils';

const ongoingRequests = new Map();

Expand Down
9 changes: 4 additions & 5 deletions src/rpc.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import request from 'supertest';

import express from 'express';
import router from './rpc';
import serve from './requestDeduplicator';
import request from 'supertest';
import getStrategies from './helpers/strategies';
import getValidations from './helpers/validations';
import { getVp, validate } from './methods';
import serve from './requestDeduplicator';
import router from './rpc';
import scores from './scores';
import { validate, getVp } from './methods';
import * as utils from './utils';

jest.mock('./methods', () => ({
Expand Down
22 changes: 11 additions & 11 deletions src/rpc.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import express from 'express';
import { getAddress } from '@ethersproject/address';
import { capture } from '@snapshot-labs/snapshot-sentry';
import express from 'express';
import { EMPTY_ADDRESS, MAX_STRATEGIES } from './constants';
import disabled from './disabled.json';
import getStrategies from './helpers/strategies';
import getValidations from './helpers/validations';
import { getVp, validate } from './methods';
import serve from './requestDeduplicator';
import scores from './scores';
import {
blockNumByNetwork,
checkInvalidStrategies,
formatStrategies,
rpcSuccess,
rpcError,
blockNumByNetwork,
checkInvalidStrategies
rpcSuccess
} from './utils';
import { version } from '../package.json';
import { getVp, validate } from './methods';
import getStrategies from './helpers/strategies';
import getValidations from './helpers/validations';
import disabled from './disabled.json';
import serve from './requestDeduplicator';
import { capture } from '@snapshot-labs/snapshot-sentry';
import { EMPTY_ADDRESS, MAX_STRATEGIES } from './constants';

const router = express.Router();

Expand Down
4 changes: 2 additions & 2 deletions src/scores.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import scores from './scores';
import snapshot from '@snapshot-labs/strategies';
import { get, set } from './aws';
import scores from './scores';
import { getCurrentBlockNum, sha256 } from './utils';
import snapshot from '@snapshot-labs/strategies';

jest.mock('./utils');
jest.mock('./aws');
Expand Down
2 changes: 1 addition & 1 deletion src/scores.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import snapshot from '@snapshot-labs/strategies';
import { get, set } from './aws';
import { getCurrentBlockNum, sha256 } from './utils';
import serve from './requestDeduplicator';
import { getCurrentBlockNum, sha256 } from './utils';

const broviderUrl = process.env.BROVIDER_URL || 'https://rpc.snapshot.org';

Expand Down
16 changes: 8 additions & 8 deletions src/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
const originalBroviderUrl = process.env.BROVIDER_URL;
process.env.BROVIDER_URL = 'test.brovider.url';

import { createHash } from 'crypto';
import snapshot from '@snapshot-labs/strategies';
import { MAX_STRATEGIES } from './constants';
import {
getCurrentBlockNum,
blockNumByNetwork,
getIp,
rpcError,
clone,
sha256,
formatStrategies,
rpcSuccess
getCurrentBlockNum,
getIp,
rpcError,
rpcSuccess,
sha256
} from './utils';
import snapshot from '@snapshot-labs/strategies';
import { createHash } from 'crypto';
import { MAX_STRATEGIES } from './constants';

jest.mock('@snapshot-labs/strategies');
jest.mock('crypto', () => ({
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import snapshot from '@snapshot-labs/strategies';
import { createHash } from 'crypto';
import snapshot from '@snapshot-labs/strategies';
import { MAX_STRATEGIES } from './constants';
import getStrategies from './helpers/strategies';

Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2099,9 +2099,9 @@
"@sinonjs/commons" "^1.7.0"

"@snapshot-labs/eslint-config-base@^0.1.0-beta.15":
version "0.1.0-beta.15"
resolved "https://registry.yarnpkg.com/@snapshot-labs/eslint-config-base/-/eslint-config-base-0.1.0-beta.15.tgz#2f64a21a0590d0ffea8a82852ab4bd5742495daa"
integrity sha512-uqOqCDTsl92e1k3edaGweQCSlDo9mU8I1ejqXCJHHDr/ZZyBldd8R73qOjhEVdYBtbdHd97QRdKh3JhMjzhrtg==
version "0.1.0-beta.18"
resolved "https://registry.yarnpkg.com/@snapshot-labs/eslint-config-base/-/eslint-config-base-0.1.0-beta.18.tgz#b39a1e6f14e7cdccbc02a70ae52e8a49459a41c3"
integrity sha512-OLB5Lcw+SUkjVhz6lo4oTCFthEkQrczh6t73dW4wmlug+OSAUPa8Uk9mh//b1Dsc4kQuh63CRVwRChJQlsuUHg==
dependencies:
"@typescript-eslint/eslint-plugin" "^6.7.3"
"@typescript-eslint/parser" "^6.7.3"
Expand Down

0 comments on commit f79481d

Please sign in to comment.