Skip to content

Commit 8d8b0c8

Browse files
committed
fix: removed fallback to prod everclear config
1 parent f7289cd commit 8d8b0c8

File tree

3 files changed

+8
-34
lines changed

3 files changed

+8
-34
lines changed

packages/agents/relayer/src/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22
import * as fs from 'fs';
3-
import { getEverclearConfig, ajv, EVERCLEAR_CONFIG_URL, getDefaultABIConfig } from '@chimera-monorepo/utils';
3+
import { getEverclearConfig, ajv, getDefaultABIConfig } from '@chimera-monorepo/utils';
44
import { RelayerConfig, RelayerConfigSchema } from './lib/entities';
55
import { ChainConfig } from './lib/entities';
66

@@ -29,7 +29,7 @@ export const getEnvConfig = async (): Promise<RelayerConfig> => {
2929
}
3030

3131
const everclearConfigUrl =
32-
process.env.EVERCLEAR_CONFIG || configJson.everclearConfig || configFile.everclearConfig || EVERCLEAR_CONFIG_URL;
32+
process.env.EVERCLEAR_CONFIG || configJson.everclearConfig || configFile.everclearConfig || undefined;
3333

3434
const everclearConfig = await getEverclearConfig(everclearConfigUrl);
3535
const everclearChains = everclearConfig?.chains ?? {};

packages/utils/src/helpers/config.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import { axiosGet } from './axios';
44
import { Static, Type } from '@sinclair/typebox';
55
import { Logger } from '../logging';
66

7-
export const EVERCLEAR_CONFIG_URL = 'https://raw.githubusercontent.com/connext/chaindata/main/everclear.json';
8-
97
export const parseEverclearConfig = (data: object): EverclearConfig => {
108
const everclearConfig = data as EverclearConfig;
119

@@ -20,21 +18,12 @@ export const parseEverclearConfig = (data: object): EverclearConfig => {
2018
return everclearConfig;
2119
};
2220

23-
export const getEverclearConfig = async (_configUrl?: string): Promise<EverclearConfig | undefined> => {
24-
const configUrl = _configUrl ?? EVERCLEAR_CONFIG_URL;
25-
21+
export const getEverclearConfig = async (configUrl: string): Promise<EverclearConfig | undefined> => {
2622
try {
2723
const res = await axiosGet(configUrl);
28-
const everclearConfig = parseEverclearConfig(res.data);
29-
return everclearConfig;
24+
return parseEverclearConfig(res.data);
3025
} catch (err: unknown) {
31-
try {
32-
const res = await axiosGet(EVERCLEAR_CONFIG_URL);
33-
if (res.data) return parseEverclearConfig(res.data);
34-
} catch (err: unknown) {
35-
return undefined;
36-
}
37-
26+
console.error(`Failed to fetch everclear config from ${configUrl}:`, err);
3827
return undefined;
3928
}
4029
};

packages/utils/test/helpers/config.spec.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { SinonStub, stub, restore } from 'sinon';
22
import Axios from 'axios';
33

4-
import { EVERCLEAR_CONFIG_URL, expect, getEverclearConfig, mock, parseEverclearConfig } from '../../src';
4+
import { expect, getEverclearConfig, mock, parseEverclearConfig } from '../../src';
55

66
describe('Helpers:Config', () => {
77
describe('#parseEverclearConfig', () => {
@@ -31,26 +31,11 @@ describe('Helpers:Config', () => {
3131
restore();
3232
});
3333

34-
it('should return undefined if it axios.get fails and fallback fails', async () => {
34+
it('should return undefined if url fails', async () => {
3535
getMock.resolves({});
3636
const config = await getEverclearConfig('http://foo.com');
3737
expect(config).to.be.undefined;
38-
expect(getMock.firstCall.firstArg).to.be.eq('http://foo.com');
39-
expect(getMock.secondCall.firstArg).to.be.eq(EVERCLEAR_CONFIG_URL);
40-
});
41-
42-
it('should query fallback if url fails', async () => {
43-
getMock.onFirstCall().resolves({});
44-
const config = await getEverclearConfig('http://foo.com');
45-
expect(config).to.be.deep.eq(mock.config());
46-
expect(getMock.firstCall.firstArg).to.be.eq('http://foo.com');
47-
expect(getMock.secondCall.firstArg).to.be.eq(EVERCLEAR_CONFIG_URL);
48-
});
49-
50-
it('should work with no url', async () => {
51-
const config = await getEverclearConfig();
52-
expect(config).to.be.deep.eq(mock.config());
53-
expect(getMock.calledOnceWith(EVERCLEAR_CONFIG_URL)).to.be.true;
38+
expect(getMock.calledOnceWith('http://foo.com')).to.be.true;
5439
});
5540

5641
it('should work with url', async () => {

0 commit comments

Comments
 (0)