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

Update import paths in .ts files #363

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion libs/typescript/cosmos-utils/cosmos-utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate';
import { DirectSecp256k1HdWallet } from '@cosmjs/proto-signing';
import { GasPrice } from '@cosmjs/stargate';
import { getRootDir } from '../ts-utils/common-utils';
import { getRootDir } from '@/ts-utils/common-utils';

export async function getCosmosContractArtifacts(contract: string) {
const rootDir = await getRootDir();
Expand Down
2 changes: 1 addition & 1 deletion libs/typescript/ts-utils/hex-utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { formatHex } from './bls';
import { formatHex } from '@/ts-utils/bls';

export function arrayToHex(arr: Uint8Array): string {
return '0x' + Buffer.from(arr).toString('hex');
Expand Down
2 changes: 1 addition & 1 deletion libs/typescript/ts-utils/prometheus-utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
import { getGenericLogger } from './logger';
import { getGenericLogger } from '@/ts-utils/logger';

import client, { Histogram, Summary } from 'prom-client';
import express from 'express';
Expand Down
2 changes: 1 addition & 1 deletion libs/typescript/ts-utils/ssz-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { sha256 } from 'ethers/lib/utils';

import { Type } from '@chainsafe/ssz';

import { formatHex, hexToBytes } from './bls';
import { formatHex, hexToBytes } from '@/ts-utils/bls';

import type { ssz } from '@lodestar/types';

Expand Down
9 changes: 9 additions & 0 deletions libs/typescript/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./*"]
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { concat } from 'ethers/lib/utils';
import { Scalar, buildBn128 } from 'ffjavascript';
import { unstringifyBigInts, bitTo2BigInts } from '../ts-utils/common-utils';
import { unstringifyBigInts, bitTo2BigInts } from '@/ts-utils/common-utils';
import * as fs from 'fs';

async function getCurveFromName(name) {
Expand Down
2 changes: 1 addition & 1 deletion relay/abstraction/beacon-api-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
ExecutionPayloadHeader,
SyncAggregate,
SyncCommittee,
} from '../types/types';
} from '@/types/types';

export interface IBeaconApi {
getBeaconRestApis(): string[];
Expand Down
2 changes: 1 addition & 1 deletion relay/abstraction/prover-interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Proof, ProofInputType } from '../types/types';
import { Proof, ProofInputType } from '@/types/types';

export interface IProver {
genProof(proofInput: ProofInputType): Promise<Proof>;
Expand Down
2 changes: 1 addition & 1 deletion relay/abstraction/redis-interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ProofResultType, WitnessGeneratorInput } from '../types/types';
import { ProofResultType, WitnessGeneratorInput } from '@/types/types';

export interface IRedis {
getNextProof(slot: number): Promise<ProofResultType | null>;
Expand Down
4 changes: 2 additions & 2 deletions relay/implementations/beacon-api.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { UintNumberType, ByteVectorType } from '@chainsafe/ssz';
import { ValueOfFields } from '@chainsafe/ssz/lib/view/container';
import { IBeaconApi } from '../abstraction/beacon-api-interface';
import { IBeaconApi } from '@/abstraction/beacon-api-interface';
import {
BeaconBlockHeader,
ExecutionPayloadHeader,
SyncAggregate,
SyncCommittee,
Validator,
} from '../types/types';
} from '@/types/types';
import { Tree } from '@chainsafe/persistent-merkle-tree';
import { bytesToHex } from '@dendreth/utils/ts-utils/bls';
import {
Expand Down
2 changes: 1 addition & 1 deletion relay/implementations/cosmos-contract.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ISmartContract } from '../abstraction/smart-contract-abstraction';
import { ISmartContract } from '@/abstraction/smart-contract-abstraction';
import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate';
import { DirectSecp256k1HdWallet } from '@cosmjs/proto-signing';
import { promisify } from 'node:util';
Expand Down
2 changes: 1 addition & 1 deletion relay/implementations/eos-contract.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ISmartContract } from '../abstraction/smart-contract-abstraction';
import { ISmartContract } from '@/abstraction/smart-contract-abstraction';
import { promisify } from 'node:util';
import { exec as exec_ } from 'node:child_process';
import { compileVerifierParseDataTool } from '../../tests/helpers/helpers';
Expand Down
4 changes: 2 additions & 2 deletions relay/implementations/prover.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IProver } from '../abstraction/prover-interface';
import { ProofInputType, Proof, WitnessGeneratorInput } from '../types/types';
import { IProver } from '@/abstraction/prover-interface';
import { ProofInputType, Proof, WitnessGeneratorInput } from '@/types/types';
import { getGenericLogger } from '@dendreth/utils/ts-utils/logger';

const logger = getGenericLogger();
Expand Down
6 changes: 3 additions & 3 deletions relay/implementations/redis.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IRedis } from '../abstraction/redis-interface';
import { IRedis } from '@/abstraction/redis-interface';
import {
BalanceProof,
ProofResultType,
Expand All @@ -7,7 +7,7 @@ import {
BlsDepositData,
BalancesAccumulatorInput,
CommitmentMapperInput,
} from '../types/types';
} from '@/types/types';
import { RedisClientType, createClient } from 'redis';
import CONSTANTS from '../../beacon-light-client/plonky2/kv_db_constants.json';
//
Expand All @@ -17,7 +17,7 @@ import {
getDepthByGindex,
splitIntoBatches,
} from '@dendreth/utils/ts-utils/common-utils';
import { validatorFromValidatorJSON } from '../utils/converters';
import { validatorFromValidatorJSON } from '@dendreth/relay/utils/converters';
import JSONbig from 'json-bigint';

declare module 'ioredis' {
Expand Down
4 changes: 2 additions & 2 deletions relay/implementations/solidity-contract.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Contract } from 'ethers';
import { ISmartContract } from '../abstraction/smart-contract-abstraction';
import { ISmartContract } from '@/abstraction/smart-contract-abstraction';
import Web3 from 'web3';
import {
TransactionSpeed,
getSolidityProof,
publishTransaction,
} from './publish_evm_transaction';
} from '@/implementations/publish_evm_transaction';

export class SolidityContract implements ISmartContract {
private lightClientContract: Contract;
Expand Down
16 changes: 8 additions & 8 deletions relay/on_chain_publisher.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { GetUpdate, ProofResultType } from './types/types';
import { IBeaconApi } from './abstraction/beacon-api-interface';
import { IRedis } from './abstraction/redis-interface';
import { ISmartContract } from './abstraction/smart-contract-abstraction';
import { GetUpdate, ProofResultType } from '@/types/types';
import { IBeaconApi } from '@/abstraction/beacon-api-interface';
import { IRedis } from '@/abstraction/redis-interface';
import { ISmartContract } from '@/abstraction/smart-contract-abstraction';
import { Contract } from 'ethers';
import {
TransactionSpeed,
getSolidityProof,
publishTransaction,
} from './implementations/publish_evm_transaction';
} from '@/implementations/publish_evm_transaction';
import Web3 from 'web3';
import { checkConfig, sleep } from '@dendreth/utils/ts-utils/common-utils';
import { Queue } from 'bullmq';
import { Config, UPDATE_POLING_QUEUE } from './constants/constants';
import { getSlotOnChain } from './utils/smart_contract_utils';
import { addUpdate } from './utils/orchestrator';
import { Config, UPDATE_POLING_QUEUE } from '@/constants/constants';
import { getSlotOnChain } from '@/utils/smart_contract_utils';
import { addUpdate } from '@/utils/orchestrator';
import { getGenericLogger } from '@dendreth/utils/ts-utils/logger';

const logger = getGenericLogger();
Expand Down
2 changes: 1 addition & 1 deletion relay/relayer_logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { checkConfig } from '@dendreth/utils/ts-utils/common-utils';
import {
PROOF_GENERATOR_QUEUE,
UPDATE_POLING_QUEUE,
} from './constants/constants';
} from '@/constants/constants';
import { getGenericLogger } from '@dendreth/utils/ts-utils/logger';

const logger = getGenericLogger();
Expand Down
2 changes: 1 addition & 1 deletion relay/save_proof_inputs_from_redis.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { writeFile, writeFileSync } from 'fs';
import { Redis } from './implementations/redis';
import { Redis } from '@/implementations/redis';

(async () => {
const redis = new Redis('localhost', 6379);
Expand Down
8 changes: 7 additions & 1 deletion relay/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{
"extends": "../tsconfig.json"
"extends": "../tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./*"]
}
}
}
2 changes: 1 addition & 1 deletion relay/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
UintBigintType,
} from '@chainsafe/ssz';
import { ValueOfFields } from '@chainsafe/ssz/lib/view/container';
import { Config } from '../constants/constants';
import { Config } from '@/constants/constants';

export type BeaconBlockHeader = ValueOfFields<{
slot: UintNumberType;
Expand Down
2 changes: 1 addition & 1 deletion relay/utils/converters.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { hexToBytes } from '@dendreth/utils/ts-utils/bls';
import { Validator } from '../types/types';
import { Validator } from '@/types/types';

function stringToNumber(str: string): number {
return str == BigInt(2n ** 64n - 1n).toString() ? Infinity : Number(str);
Expand Down
7 changes: 2 additions & 5 deletions relay/utils/discord_monitor.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { SolidityContract } from '@dendreth/relay/implementations/solidity-contract';
import {
getBeaconApi,
BeaconApi,
} from '@dendreth/relay/implementations/beacon-api';
import { SolidityContract } from '@/implementations/solidity-contract';
import { getBeaconApi, BeaconApi } from '@/implementations/beacon-api';
import { ethers } from 'ethers';
import { sleep } from '@dendreth/utils/ts-utils/common-utils';
import { GatewayIntentBits, Events, Partials } from 'discord.js';
Expand Down
4 changes: 2 additions & 2 deletions relay/utils/get_current_network_config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { checkConfig } from '@dendreth/utils/ts-utils/common-utils';
import { Config } from '../constants/constants';
import * as network_config from '../constants/network_config.json';
import { Config } from '@/constants/constants';
import * as network_config from '@/constants/network_config.json';

export function getNetworkConfig(network: 'pratter' | 'mainnet'): Config {
const config = {
Expand Down
6 changes: 3 additions & 3 deletions relay/utils/orchestrator.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Queue } from 'bullmq';
import { GetUpdate } from '../types/types';
import { Config } from '../constants/constants';
import { GetUpdate } from '@dendreth/relay/types/types';
import { Config } from '@/constants/constants';
import {
SLOTS_PER_PERIOD,
computeSyncCommitteePeriodAt,
} from '@dendreth/utils/ts-utils/ssz-utils';
import { IBeaconApi } from '../abstraction/beacon-api-interface';
import { IBeaconApi } from '@dendreth/relay/abstraction/beacon-api-interface';
import { findClosestValidBlock } from '../workers/poll-updates/get_light_client_input_from_to';
import { getGenericLogger } from '@dendreth/utils/ts-utils/logger';

Expand Down
4 changes: 2 additions & 2 deletions relay/utils/smart_contract_utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IBeaconApi } from '../abstraction/beacon-api-interface';
import { ISmartContract } from '../abstraction/smart-contract-abstraction';
import { IBeaconApi } from '@/abstraction/beacon-api-interface';
import { ISmartContract } from '@/abstraction/smart-contract-abstraction';
import { getGenericLogger } from '@dendreth/utils/ts-utils/logger';

const logger = getGenericLogger();
Expand Down
4 changes: 2 additions & 2 deletions relay/workers/cleaner.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Queue } from 'bullmq';
import { checkConfig, sleep } from '@dendreth/utils/ts-utils/common-utils';
import { getGenericLogger } from '@dendreth/utils/ts-utils/logger';
import { GetUpdate } from '../types/types';
import { UPDATE_POLING_QUEUE } from '../constants/constants';
import { GetUpdate } from '@/types/types';
import { UPDATE_POLING_QUEUE } from '@/constants/constants';

const logger = getGenericLogger();

Expand Down
8 changes: 4 additions & 4 deletions relay/workers/poll-updates/do_update.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Queue } from 'bullmq';
import { IBeaconApi } from '../../abstraction/beacon-api-interface';
import { getInputFromTo } from './get_light_client_input_from_to';
import { ProofInputType } from '../../types/types';
import { Config } from '../../constants/constants';
import { IBeaconApi } from '@/abstraction/beacon-api-interface';
import { getInputFromTo } from '@/workers/poll-updates/get_light_client_input_from_to';
import { ProofInputType } from '@/types/types';
import { Config } from '@/constants/constants';
import { getGenericLogger } from '@dendreth/utils/ts-utils/logger';

const logger = getGenericLogger();
Expand Down
8 changes: 4 additions & 4 deletions relay/workers/poll-updates/get_light_client_input_from_to.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Config } from '../../constants/constants';
import { getProofInput } from './get_ligth_client_input';
import { IBeaconApi } from '../../abstraction/beacon-api-interface';
import { BeaconBlockHeader, SyncAggregate } from '../../types/types';
import { Config } from '@/constants/constants';
import { getProofInput } from '@/workers/poll-updates/get_ligth_client_input';
import { IBeaconApi } from '@/abstraction/beacon-api-interface';
import { BeaconBlockHeader, SyncAggregate } from '@/types/types';
import { getGenericLogger } from '@dendreth/utils/ts-utils/logger';
import { prometheusTiming } from '@dendreth/utils/ts-utils/prometheus-utils';

Expand Down
4 changes: 2 additions & 2 deletions relay/workers/poll-updates/get_ligth_client_input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ import {
formatHex,
} from '@dendreth/utils/ts-utils/bls';
import { Tree } from '@chainsafe/persistent-merkle-tree';
import { Config } from '../../constants/constants';
import { Config } from '@/constants/constants';
import {
BeaconBlockHeader,
ExecutionPayloadHeader,
SyncAggregate,
SyncCommittee,
WitnessGeneratorInput,
} from '../../types/types';
} from '@/types/types';
import { computeSyncCommitteePeriodAt } from '@dendreth/utils/ts-utils/ssz-utils';

const ExecutionPayload = new ContainerType({
Expand Down
8 changes: 4 additions & 4 deletions relay/workers/poll-updates/poll-updates-worker.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Worker, Queue } from 'bullmq';
import { exec as _exec } from 'child_process';
import { GetUpdate, ProofInputType } from '../../types/types';
import { GetUpdate, ProofInputType } from '@/types/types';
import {
PROOF_GENERATOR_QUEUE,
UPDATE_POLING_QUEUE,
} from '../../constants/constants';
import doUpdate from './do_update';
import { getBeaconApi } from '@dendreth/relay/implementations/beacon-api';
} from '@/constants/constants';
import doUpdate from '@/workers/poll-updates/do_update';
import { getBeaconApi } from '@/implementations/beacon-api';
import { checkConfig } from '@dendreth/utils/ts-utils/common-utils';
import { getGenericLogger } from '@dendreth/utils/ts-utils/logger';
import { initPrometheusSetup } from '@dendreth/utils/ts-utils/prometheus-utils';
Expand Down
6 changes: 3 additions & 3 deletions relay/workers/prover/gen_proof.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IProver } from '../../abstraction/prover-interface';
import { IRedis } from '../../abstraction/redis-interface';
import { ProofInputType } from '../../types/types';
import { IProver } from '@/abstraction/prover-interface';
import { IRedis } from '@/abstraction/redis-interface';
import { ProofInputType } from '@/types/types';

export default async function genProof(
redis: IRedis,
Expand Down
10 changes: 5 additions & 5 deletions relay/workers/prover/prover-worker.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Worker } from 'bullmq';
import { exec as _exec } from 'child_process';
import { ProofInputType } from '../../types/types';
import genProof from './gen_proof';
import { Redis } from '@dendreth/relay/implementations/redis';
import { Prover } from '@dendreth/relay/implementations/prover';
import { PROOF_GENERATOR_QUEUE } from '../../constants/constants';
import { ProofInputType } from '@/types/types';
import genProof from '@/workers/prover/gen_proof';
import { Redis } from '@/implementations/redis';
import { Prover } from '@/implementations/prover';
import { PROOF_GENERATOR_QUEUE } from '@/constants/constants';
import { checkConfig } from '@dendreth/utils/ts-utils/common-utils';
import yargs from 'yargs';

Expand Down
Loading