Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/unstable' into nflaig/err-messag…
Browse files Browse the repository at this point in the history
…e-separator
  • Loading branch information
nflaig committed Sep 29, 2023
2 parents 4664e21 + 9cd65cc commit 6f1dc40
Show file tree
Hide file tree
Showing 32 changed files with 1,457 additions and 1,471 deletions.
38 changes: 27 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ jobs:
lib/
packages/*/lib
packages/*/.git-data.json
key: ${{ runner.os }}-${{ matrix.node }}-${{ github.event.pull_request.head.sha }}
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ github.sha }}
- name: Install & build
if: steps.cache-build-restore.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile && yarn build
- name: Build
run: yarn build
if: steps.cache-build-restore.outputs.cache-hit == 'true'
run: yarn build
- name: Check Build
run: yarn check-build
- name: Test root binary exists
Expand All @@ -70,17 +70,21 @@ jobs:
lib/
packages/*/lib
packages/*/.git-data.json
key: ${{ runner.os }}-${{ matrix.node }}-${{ github.event.pull_request.head.sha }}
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ github.sha }}

lint:
name: Lint
needs: build
runs-on: 'ubuntu-latest'
strategy:
fail-fast: false
matrix:
node: [20]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
node-version: ${{ matrix.node }}
check-latest: true
cache: yarn
- name: Restore build cache
Expand All @@ -93,7 +97,8 @@ jobs:
lib/
packages/*/lib
packages/*/.git-data.json
key: ${{ runner.os }}-20-${{ github.event.pull_request.head.sha }}
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ github.sha }}
fail-on-cache-miss: true
- name: Assert yarn prints no warnings
run: scripts/assert_no_yarn_warnings.sh
- name: Lint Code
Expand All @@ -109,11 +114,15 @@ jobs:
name: Type Checks
needs: build
runs-on: 'ubuntu-latest'
strategy:
fail-fast: false
matrix:
node: [20]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
node-version: ${{ matrix.node }}
check-latest: true
cache: yarn
- name: Restore build cache
Expand All @@ -126,7 +135,8 @@ jobs:
lib/
packages/*/lib
packages/*/.git-data.json
key: ${{ runner.os }}-20-${{ github.event.pull_request.head.sha }}
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ github.sha }}
fail-on-cache-miss: true

- name: Check Types
run: yarn check-types
Expand Down Expand Up @@ -159,7 +169,9 @@ jobs:
lib/
packages/*/lib
packages/*/.git-data.json
key: ${{ runner.os }}-${{ matrix.node }}-${{ github.event.pull_request.head.sha }}
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ github.sha }}
fail-on-cache-miss: true

# Cache validator slashing protection data tests
- name: Restore spec tests cache
uses: actions/cache@master
Expand Down Expand Up @@ -198,7 +210,8 @@ jobs:
lib/
packages/*/lib
packages/*/.git-data.json
key: ${{ runner.os }}-${{ matrix.node }}-${{ github.event.pull_request.head.sha }}
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ github.sha }}
fail-on-cache-miss: true

- name: Run the e2e test environment
run: scripts/run_e2e_env.sh start
Expand Down Expand Up @@ -244,7 +257,8 @@ jobs:
lib/
packages/*/lib
packages/*/.git-data.json
key: ${{ runner.os }}-${{ matrix.node }}-${{ github.event.pull_request.head.sha }}
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ github.sha }}
fail-on-cache-miss: true

- name: Browser tests
run: |
Expand Down Expand Up @@ -277,7 +291,9 @@ jobs:
lib/
packages/*/lib
packages/*/.git-data.json
key: ${{ runner.os }}-${{ matrix.node }}-${{ github.event.pull_request.head.sha }}
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ github.sha }}
fail-on-cache-miss: true

# Download spec tests with cache
- name: Restore spec tests cache
uses: actions/cache@master
Expand Down
11 changes: 4 additions & 7 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
{
"packages": [
"packages/*"
],
"packages": ["packages/*"],
"npmClient": "yarn",
"useWorkspaces": true,
"useNx": true,
"version": "1.11.1",
"stream": "true",
"stream": true,
"command": {
"version": {
"message": "chore(release): %s"
}
}
},
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
58 changes: 29 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
"lint-dashboards": "scripts/validate-grafana-dashboards.sh",
"check-build": "lerna run check-build",
"check-readme": "lerna run check-readme",
"check-types": "lerna run check-types --no-bail",
"coverage": "lerna run coverage --no-bail",
"test": "lerna run test --no-bail --concurrency 1",
"test:unit": "lerna run test:unit --no-bail --concurrency 1",
"check-types": "lerna run check-types",
"coverage": "lerna run coverage",
"test": "lerna run test --concurrency 1",
"test:unit": "lerna run test:unit --concurrency 1",
"test:browsers": "lerna run test:browsers",
"test:e2e": "lerna run test:e2e --no-bail --concurrency 1",
"test:e2e:sim": "lerna run test:e2e:sim --no-bail",
"test:spec": "lerna run test:spec --no-bail",
"test:e2e": "lerna run test:e2e --concurrency 1",
"test:e2e:sim": "lerna run test:e2e:sim",
"test:spec": "lerna run test:spec",
"test-coverage:unit": "c8 --config .c8rc.json --report-dir coverage/unit/ --all npm run test:unit",
"test-coverage:browsers": "c8 --config .c8rc.json --report-dir coverage/browsers/ --all npm run test:browsers",
"test-coverage:e2e": "c8 --config .c8rc.json --report-dir coverage/e2e/ --all npm run test:e2e",
Expand All @@ -44,57 +44,57 @@
"devDependencies": {
"@chainsafe/eslint-plugin-node": "^11.2.3",
"@dapplion/benchmark": "^0.2.4",
"@types/chai": "^4.3.4",
"@types/chai-as-promised": "^7.1.5",
"@types/chai": "^4.3.6",
"@types/chai-as-promised": "^7.1.6",
"@types/mocha": "^10.0.1",
"@types/node": "^20.4.2",
"@types/sinon": "^10.0.13",
"@types/node": "^20.6.5",
"@types/sinon": "^10.0.16",
"@types/sinon-chai": "^3.2.9",
"@typescript-eslint/eslint-plugin": "6.0.0",
"@typescript-eslint/parser": "6.0.0",
"c8": "^7.13.0",
"chai": "^4.3.7",
"@typescript-eslint/eslint-plugin": "6.7.2",
"@typescript-eslint/parser": "6.7.2",
"c8": "^8.0.1",
"chai": "^4.3.8",
"chai-as-promised": "^7.1.1",
"codecov": "^3.8.3",
"crypto-browserify": "^3.12.0",
"electron": "^22.3.24",
"eslint": "^8.44.0",
"eslint-plugin-import": "^2.27.5",
"electron": "^26.2.2",
"eslint": "^8.50.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-chai-expect": "^3.0.0",
"eslint-plugin-mocha": "^10.1.0",
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-mocha": "^10.2.0",
"eslint-import-resolver-typescript": "^3.6.1",
"https-browserify": "^1.0.0",
"karma": "^6.4.1",
"karma": "^6.4.2",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^3.1.1",
"karma-chrome-launcher": "^3.2.0",
"karma-cli": "^2.0.0",
"karma-electron": "^7.3.0",
"karma-firefox-launcher": "^2.1.2",
"karma-mocha": "^2.0.1",
"karma-spec-reporter": "^0.0.36",
"karma-webpack": "^5.0.0",
"lerna": "^6.6.1",
"lerna": "^7.3.0",
"libp2p": "0.46.3",
"mocha": "^10.2.0",
"node-gyp": "^9.3.1",
"node-gyp": "^9.4.0",
"npm-run-all": "^4.1.5",
"nyc": "^15.1.0",
"path-browserify": "^1.0.1",
"prettier": "^3.0.0",
"prettier": "^3.0.3",
"process": "^0.11.10",
"resolve-typescript-plugin": "^2.0.1",
"sinon": "^15.0.3",
"sinon": "^16.0.0",
"sinon-chai": "^3.7.0",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"supertest": "^6.3.3",
"ts-loader": "^9.4.4",
"ts-node": "^10.9.1",
"typescript": "^5.1.6",
"typescript": "^5.2.2",
"typescript-docs-verifier": "^2.5.0",
"webpack": "^5.88.1",
"wait-port": "^1.0.4"
"webpack": "^5.88.2",
"wait-port": "^1.1.0"
},
"resolutions": {
"dns-over-http-resolver": "^2.1.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/beacon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {Api} from "./routes/index.js";

export * as routes from "./routes/index.js";
export {getClient} from "./client/index.js";
export {Api};
export type {Api};

// Declare namespaces for CLI options
export type ApiNamespace = keyof Api;
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/builder/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import {Api, ReqTypes, routesData, getReturnTypes, getReqSerializers} from "../routes.js";

// Re-export for convenience
export {RouteConfig};
export type {RouteConfig};

export function getRoutes(config: ChainForkConfig, api: ServerApi<Api>): ServerRoutes<Api, ReqTypes> {
// All routes return JSON, use a server auto-generator
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/keymanager/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import {Api, ReqTypes, routesData, getReturnTypes, getReqSerializers} from "../routes.js";

// Re-export for convenience
export {RouteConfig};
export type {RouteConfig};

export function getRoutes(config: ChainForkConfig, api: ServerApi<Api>): ServerRoutes<Api, ReqTypes> {
// All routes return JSON, use a server auto-generator
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/utils/client/httpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export type HttpClientModules = {
metrics?: Metrics;
};

export {Metrics};
export type {Metrics};

export class HttpClient implements IHttpClient {
private readonly globalTimeoutMs: number;
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/src/chain/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ export class BeaconChain implements IBeaconChain {
sleep((1000 * this.config.SECONDS_PER_SLOT) / 2)
.then(() => metrics.onceEveryEndOfEpoch(this.getHeadState()))
.catch((e) => {
if (!isErrorAborted(e)) this.logger.error("error on validator monitor onceEveryEndOfEpoch", {slot}, e);
if (!isErrorAborted(e)) this.logger.error("Error on validator monitor onceEveryEndOfEpoch", {slot}, e);
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/src/metrics/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function createMetrics(
const lodestar = createLodestarMetrics(register, opts.metadata, anchorState);

const genesisTime = anchorState.genesisTime;
const validatorMonitor = createValidatorMonitor(lodestar, config, genesisTime, logger);
const validatorMonitor = createValidatorMonitor(lodestar, config, genesisTime, logger, opts);
// Register a single collect() function to run all validatorMonitor metrics
lodestar.validatorMonitor.validatorsConnected.addCollect(() => {
const clockSlot = getCurrentSlot(config, genesisTime);
Expand Down
12 changes: 7 additions & 5 deletions packages/beacon-node/src/metrics/options.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {HttpMetricsServerOpts} from "./server/index.js";
import {ValidatorMonitorOpts} from "./validatorMonitor.js";

export type LodestarMetadata = {
/** "v0.16.0/developer/feature-1/ac99f2b5" */
Expand All @@ -9,11 +10,12 @@ export type LodestarMetadata = {
network: string;
};

export type MetricsOptions = HttpMetricsServerOpts & {
enabled: boolean;
/** Optional metadata to send to Prometheus */
metadata?: LodestarMetadata;
};
export type MetricsOptions = ValidatorMonitorOpts &
HttpMetricsServerOpts & {
enabled: boolean;
/** Optional metadata to send to Prometheus */
metadata?: LodestarMetadata;
};

export const defaultMetricsOptions: MetricsOptions = {
enabled: false,
Expand Down
Loading

0 comments on commit 6f1dc40

Please sign in to comment.