Skip to content

Commit

Permalink
chore: v1.15.0 release (#6347)
Browse files Browse the repository at this point in the history
  • Loading branch information
philknows authored Jan 29, 2024
2 parents 5ac2fae + 92ed347 commit 5d93a62
Show file tree
Hide file tree
Showing 378 changed files with 5,059 additions and 6,319 deletions.
21 changes: 0 additions & 21 deletions .c8rc.json

This file was deleted.

35 changes: 17 additions & 18 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
browser: true,
es6: true,
node: true,
// Performance tests still use mocha
mocha: true,
},
globals: {
Expand Down Expand Up @@ -110,7 +111,11 @@ module.exports = {
"error",
{
groups: ["builtin", "external", "internal", "parent", "sibling", "index"],
pathGroups: [{pattern: "@lodestar/**", group: "internal"}],
pathGroups: [
{pattern: "@lodestar/**", group: "internal"},
// We want mocks to be imported before any internal code
{pattern: "**/mocks/**", group: "internal"},
],
pathGroupsExcludedImportTypes: ["builtin"],
},
],
Expand Down Expand Up @@ -201,24 +206,18 @@ module.exports = {
},
{
files: ["**/test/**/*.test.ts"],
plugins: ["mocha", "chai-expect"],
extends: ["plugin:mocha/recommended", "plugin:chai-expect/recommended"],
plugins: ["vitest"],
extends: ["plugin:vitest/recommended"],
rules: {
// We observed that having multiple top level "describe" save valuable indentation
// https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/docs/rules/max-top-level-suites.md
"mocha/max-top-level-suites": "off",
// We need to disable because we disabled "mocha/no-setup-in-describe" rule
// TODO: Move all setup code to before/beforeEach and then disable async describe
// https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/docs/rules/no-async-describe.md
"mocha/no-async-describe": "off",
// Use of arrow functions are very common
"mocha/no-mocha-arrows": "off",
// It's common to call function inside describe block
// https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/docs/rules/no-setup-in-describe.md
"mocha/no-setup-in-describe": "off",
// We use to split before in small isolated tasks
// https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/docs/rules/no-sibling-hooks.md
"mocha/no-sibling-hooks": "off",
"vitest/consistent-test-it": ["error", {fn: "it", withinDescribe: "it"}],
// We use a lot dynamic assertions so tests may not have usage of expect
"vitest/expect-expect": "off",
"vitest/no-disabled-tests": "warn",
"vitest/no-focused-tests": "error",
"vitest/prefer-called-with": "error",
"vitest/prefer-spy-on": "error",
// Our usage contains dynamic test title, this rule enforce static string value
"vitest/valid-title": "off",
},
},
{
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ jobs:
run: scripts/wordlist_sort_check.sh

- name: Build and collect docs
run: yarn build:docs
run: yarn docs:build

# Run prettier check with fix after generating the docs. The CLI reference is formatted with prettier for
# deployed version so this will fail if not "fixable"
- name: Check docs format
run: yarn lint-docs:fix
run: yarn docs:lint:fix

# Run spellcheck AFTER building docs, in case the CLI reference has issues
- name: Spellcheck
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ jobs:
if: steps.cache-deps.outputs.cache-hit == 'true'

- name: Build and collect docs
run: yarn build:docs
run: yarn docs:build

- name: Lint built docs
run: yarn lint-docs:fix
run: yarn docs:lint:fix

- name: Set up Python
uses: actions/setup-python@v1
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/test-sim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ on:
description: Runtime DEBUG value
required: false
default: ""
genesisDelaySlots:
description: 'Number of slots delay before genesis'
required: true
type: number
default: 40

env:
GETH_DOCKER_IMAGE: ethereum/client-go:v1.11.6
Expand Down Expand Up @@ -56,6 +61,8 @@ jobs:
- name: Sim tests multifork
run: DEBUG='${{github.event.inputs.debug}}' yarn test:sim:multifork
working-directory: packages/cli
env:
GENESIS_DELAY_SLOTS: ${{github.event.inputs.genesisDelaySlots}}

- name: Sim tests endpoints
run: yarn test:sim:endpoints
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -321,12 +321,15 @@ jobs:
# Run them in different steps to quickly identifying which command failed
# Otherwise just doing `yarn test:spec` you can't tell which specific suite failed
# many of the suites have identical names for minimal and mainnet
- name: Spec tests bls-general
run: yarn test:spec-bls-general
- name: Spec tests general
run: yarn test:spec:general
working-directory: packages/beacon-node
- name: Spec tests bls
run: yarn test:spec:bls
working-directory: packages/beacon-node
- name: Spec tests minimal
run: yarn test:spec-minimal
run: yarn test:spec:minimal
working-directory: packages/beacon-node
- name: Spec tests mainnet
run: NODE_OPTIONS='--max-old-space-size=4096' yarn test:spec-mainnet
run: NODE_OPTIONS='--max-old-space-size=4096' yarn test:spec:mainnet
working-directory: packages/beacon-node
4 changes: 0 additions & 4 deletions .mocharc.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions .nycrc.json

This file was deleted.

5 changes: 5 additions & 0 deletions .wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Chai
ChainSafe
Customizations
DPoS
DVs
Discv
DockerHub
Dockerized
Expand Down Expand Up @@ -83,6 +84,7 @@ UPnP
UTF
VM
Vitalik
Vitest
Wagyu
api
async
Expand Down Expand Up @@ -122,6 +124,7 @@ envs
ephemery
flamegraph
flamegraphs
getNetworkIdentity
gnosis
goerli
heapdump
Expand Down Expand Up @@ -172,6 +175,7 @@ scalability
secp
sepolia
sharding
src
ssz
stakers
subnet
Expand All @@ -186,6 +190,7 @@ util
utils
validator
validators
vitest
wip
xcode
yaml
Expand Down
32 changes: 28 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,25 @@ Contributing to tests:
- Do not pull unpinned versions from DockerHub (use deterministic tag) or Github (checkout commit not branch).
- Carefully design tests that depend on timing sensitive events like p2p network e2e tests. Consider that Github runners are significantly less powerful than your development environment.

### Common Issues

**Error: [vitest] Cannot mock "../../src/db/repositories/index.js" because it is already loaded by "src/db/beacon.ts"**

If you observe any error in tests with matching to above error message, that implies you are loading the mocks in the wrong order. The correct order is to import the mocks first and then the actual module. We suggest to import the mocks on very top before any local modules.

**✖ Error: Cannot find package 'async_hooks' imported from**

If you observe following error running any of the test files that means you are running a file which itself or any dependency of that file imports `vitest`, but you are not running that file with `vitest` runner. Try running it with `yarn vitest` command, not with `node` command.

### Debugging Spec Tests

- To fix errors always focus on passing all minimal tests first without running mainnet tests.
- Spec tests often compare full expected vs actual states in JSON format. To better understand the diff it's convenient to use mocha's option `--inline-diffs`.
- A single logical error can cause many spec tests to fail. To focus on a single test at a time you can use mocha's option `--bail` to stop at the first failed test
- To then run only that failed test you can run against a specific file as use mocha's option `--grep` to run only one case
- Spec tests often compare full expected vs actual states in JSON format.
- A single logical error can cause many spec tests to fail. To focus on a single test at a time you can use vitest's option `--bail` to stop at the first failed test
- To then run only that failed test you can run against a specific file as use vitest's filters to run only one case

```sh
LODESTAR_PRESET=minimal ../../node_modules/.bin/mocha --config .mocharc.spec.yml test/spec/phase0/sanity.test.ts --inline-diffs --bail --grep "attestation"
LODESTAR_PRESET=minimal yarn vitest --run --config vitest.config.spec.ts test/spec/phase0/sanity.test.ts
```

## Docker
Expand Down Expand Up @@ -229,6 +239,20 @@ Run script to download dashboards to `./dashboards` folder
node scripts/download_dashboards.mjs
```

## Contributing to Documentation

When submitting PRs for documentation updates, build and run the documentation locally to ensure functionality before submission. For first time documentation contributors, install the python dependencies with `yarn docs:install`. Build the documentation locally with `yarn docs:build` and serve with `yarn docs:serve`

Your locally served documentation will then be accessible at http://localhost:8000.

If you run into build issues due to circular dependencies, branch switching or other incompatibilities, try cleaning your modules and rebuild your dependencies with:

```sh
yarn clean && yarn clean:nm && yarn && yarn build
```

We also use a spelling [word list](https://github.com/ChainSafe/lodestar/blob/unstable/.wordlist.txt) as part of our documentation checks. If using unrecognized words or abbreviations, please extend the word list to pass checks. Make sure the list is sorted with `./scripts/wordlist_sort.sh` and checked with `./scripts/wordlist_sort_check.sh` for sorting and duplicates.

## Label Guide

Issues and pull requests are subject to the following labeling guidelines.
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ FROM node:20-alpine
WORKDIR /usr/app
COPY --from=build_deps /usr/app .

# NodeJS applications have a default memory limit of 2.5GB.
# This limit is bit tight for a Prater node, it is recommended to raise the limit
# NodeJS applications have a default memory limit of 4GB on most machines.
# This limit is bit tight for a Mainnet node, it is recommended to raise the limit
# since memory may spike during certain network conditions.
ENV NODE_OPTIONS=--max-old-space-size=4096
ENV NODE_OPTIONS=--max-old-space-size=8192

ENTRYPOINT ["node", "./packages/cli/bin/lodestar"]
Loading

0 comments on commit 5d93a62

Please sign in to comment.