Skip to content

Commit

Permalink
Revert "improvments for GG (#662)" for assesing index 24h (#690)
Browse files Browse the repository at this point in the history
Revert "improvments for GG (#662)"

This reverts commit 311400f.
  • Loading branch information
hussedev authored Oct 23, 2024
1 parent 43ff8de commit 23d0281
Show file tree
Hide file tree
Showing 12 changed files with 88 additions and 638 deletions.
3 changes: 1 addition & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ DD_ENV=development
#GNOSIS_RPC_URL

#COINGECKO_API_KEY=
#IPFS_GATEWAYs=[]
#WHITELISTED_ADDRESSES=["0x123..","0x456.."]
#IPFS_GATEWAY=

# optional, enable the Postgraphile Pro plugin: https://www.npmjs.com/package/@graphile/pro
#GRAPHILE_LICENSE
10 changes: 2 additions & 8 deletions docs/reindexing.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,9 @@ When deploying changes to the indexer, it's important to clarify the results you
- The indexer will create a new schema in Postgres named `chain_data_${version}`. If this schema does not exist, it will be created, all necessary tables will be set up, and indexing will start from scratch.
- If the schema already exists, the indexer will resume indexing from the last indexed block unless the `--drop-db` flag is specified via the CLI. This will drop the existing database and start fresh.

### Dropping Schemas in Development
### Using `--drop-db` in Development

- During development, you can use the `--drop-db` flag to ensure the indexer always deletes all existing schema and migrates from scratch. This can be useful for testing schema changes and event handler modifications without retaining old data.

- During development, you can use the `--drop-chain-db` flag to ensure the indexer always deletes chain schema and migrates from scratch.

- During development, you can use the `--drop-ipfs-db` flag to ensure the indexer always deletes ipfs schema and migrates from scratch.

- During development, you can use the `--drop-price-db` flag to ensure the indexer always deletes price schema and migrates from scratch.
- During development, you can use the `--drop-db` flag to ensure the indexer always deletes the existing schema and migrates from scratch. This can be useful for testing schema changes and event handler modifications without retaining old data.

### Important Notes

Expand Down
4 changes: 2 additions & 2 deletions indexer-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
ENABLE_RESOURCE_MONITOR: ${ENABLE_RESOURCE_MONITOR}
ESTIMATES_LINEARQF_WORKER_POOL_SIZE: ${ESTIMATES_LINEARQF_WORKER_POOL_SIZE}
PINO_PRETTY: ${PINO_PRETTY}
IPFS_GATEWAYS: ${IPFS_GATEWAYS}
IPFS_GATEWAY: ${IPFS_GATEWAY}
COINGECKO_API_KEY: ${COINGECKO_API_KEY}
GRAPHILE_LICENSE: ${GRAPHILE_LICENSE}
SEPOLIA_RPC_URL: ${SEPOLIA_RPC_URL}
Expand Down Expand Up @@ -62,7 +62,7 @@ services:
ENABLE_RESOURCE_MONITOR: ${ENABLE_RESOURCE_MONITOR}
ESTIMATES_LINEARQF_WORKER_POOL_SIZE: ${ESTIMATES_LINEARQF_WORKER_POOL_SIZE}
PINO_PRETTY: ${PINO_PRETTY}
IPFS_GATEWAYS: ${IPFS_GATEWAYS}
IPFS_GATEWAY: ${IPFS_GATEWAY}
COINGECKO_API_KEY: ${COINGECKO_API_KEY}
GRAPHILE_LICENSE: ${GRAPHILE_LICENSE}
SEPOLIA_RPC_URL: ${SEPOLIA_RPC_URL}
Expand Down
47 changes: 6 additions & 41 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ type CoingeckoSupportedChainId =
| 42220
| 1088;

const CHAIN_DATA_VERSION = "86";
const IPFS_DATA_VERSION = "1";
const PRICE_DATA_VERSION = "1";
const CHAIN_DATA_VERSION = "000999";

export type Token = {
code: string;
Expand Down Expand Up @@ -1883,7 +1881,7 @@ export type Config = {
httpServerWaitForSync: boolean;
httpServerEnabled: boolean;
indexerEnabled: boolean;
ipfsGateways: string[];
ipfsGateway: string;
coingeckoApiKey: string | null;
coingeckoApiUrl: string;
chains: Chain[];
Expand All @@ -1894,18 +1892,11 @@ export type Config = {
readOnlyDatabaseUrl: string;
dataVersion: string;
databaseSchemaName: string;
ipfsDataVersion: string;
ipfsDatabaseSchemaName: string;
priceDataVersion: string;
priceDatabaseSchemaName: string;
hostname: string;
pinoPretty: boolean;
deploymentEnvironment: "local" | "development" | "staging" | "production";
enableResourceMonitor: boolean;
dropDb: boolean;
dropChainDb: boolean;
dropIpfsDb: boolean;
dropPriceDb: boolean;
removeCache: boolean;
estimatesLinearQfWorkerPoolSize: number | null;
};
Expand All @@ -1919,18 +1910,9 @@ export function getConfig(): Config {
"from-block": {
type: "string",
},
"drop-chain-db": {
type: "boolean",
},
"drop-ipfs-db": {
type: "boolean",
},
"drop-db": {
type: "boolean",
},
"drop-price-db": {
type: "boolean",
},
"rm-cache": {
type: "boolean",
},
Expand Down Expand Up @@ -2062,11 +2044,10 @@ export function getConfig(): Config {

const runOnce = z.boolean().default(false).parse(args["run-once"]);

const ipfsGateways = z
const ipfsGateway = z
.string()
.array()
.default(["https://ipfs.io"])
.parse(JSON.parse(process.env.IPFS_GATEWAYS!));
.default("https://ipfs.io")
.parse(process.env.IPFS_GATEWAY);

const sentryDsn = z
.union([z.string(), z.null()])
Expand All @@ -2083,16 +2064,7 @@ export function getConfig(): Config {
const dataVersion = CHAIN_DATA_VERSION;
const databaseSchemaName = `chain_data_${dataVersion}`;

const ipfsDataVersion = IPFS_DATA_VERSION;
const ipfsDatabaseSchemaName = `ipfs_data_${ipfsDataVersion}`;

const priceDataVersion = PRICE_DATA_VERSION;
const priceDatabaseSchemaName = `price_data_${priceDataVersion}`;

const dropDb = z.boolean().default(false).parse(args["drop-db"]);
const dropChainDb = z.boolean().default(false).parse(args["drop-chain-db"]);
const dropIpfsDb = z.boolean().default(false).parse(args["drop-ipfs-db"]);
const dropPriceDb = z.boolean().default(false).parse(args["drop-price-db"]);

const removeCache = z.boolean().default(false).parse(args["rm-cache"]);

Expand Down Expand Up @@ -2132,7 +2104,7 @@ export function getConfig(): Config {
cacheDir,
logLevel,
runOnce,
ipfsGateways,
ipfsGateway,
passportScorerId,
apiHttpPort,
pinoPretty,
Expand All @@ -2141,16 +2113,9 @@ export function getConfig(): Config {
databaseUrl,
readOnlyDatabaseUrl,
dropDb,
dropChainDb,
dropIpfsDb,
dropPriceDb,
removeCache,
dataVersion,
databaseSchemaName,
ipfsDataVersion,
ipfsDatabaseSchemaName,
priceDataVersion,
priceDatabaseSchemaName,
httpServerWaitForSync,
httpServerEnabled,
indexerEnabled,
Expand Down
5 changes: 0 additions & 5 deletions src/database/changeset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
NewPrice,
NewLegacyProject,
NewApplicationPayout,
NewIpfsData,
NewAttestationData,
} from "./schema.js";

Expand Down Expand Up @@ -143,10 +142,6 @@ export type DataChange =
type: "InsertApplicationPayout";
payout: NewApplicationPayout;
}
| {
type: "InsertIpfsData";
ipfs: NewIpfsData;
}
| {
type: "InsertAttestation";
attestation: NewAttestationData;
Expand Down
Loading

0 comments on commit 23d0281

Please sign in to comment.