Skip to content

Commit

Permalink
Merge branch 'master' into 10394-board
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Nov 27, 2024
2 parents 75899a8 + 419df4e commit babdddd
Show file tree
Hide file tree
Showing 382 changed files with 21,831 additions and 3,680 deletions.
5 changes: 4 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# also ignored in packages/cosmic-proto/.eslintignore, but IDE's pick up the root config
packages/cosmic-proto/dist
packages/cosmic-proto/node_modules/
packages/cosmic-proto/coverage/
packages/cosmic-proto/dist/
packages/cosmic-proto/proto/
packages/cosmic-proto/src/codegen/
22 changes: 17 additions & 5 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ module.exports = {
// CI has a separate format check but keep this warn to maintain that "eslint --fix" prettifies
// UNTIL https://github.com/Agoric/agoric-sdk/issues/4339
'prettier/prettier': 'warn',

// Not a risk with our coding style
'no-use-before-define': 'off',
},
settings: {
jsdoc: {
Expand Down Expand Up @@ -174,8 +177,8 @@ module.exports = {
{
files: [
'packages/**/demo/**/*.js',
'packages/*/test/**/*.js',
'packages/*/test/**/*.test.js',
'packages/*/test/**/*.*s',
'packages/*/test/**/*.test.*s',
'packages/wallet/api/test/**/*.js',
],
rules: {
Expand All @@ -185,12 +188,23 @@ module.exports = {
// NOTE: This rule is enabled for the repository in general. We turn it
// off for test code for now.
'@jessie.js/safe-await-separator': 'off',

// Like `'ava/no-only-test`, but works with @endo/ses-ava
'no-restricted-properties': [
'error',
{
object: 'test',
property: 'only',
message:
'Do not commit .only tests - they prevent other tests from running',
},
],
},
},
{
// These tests use EV() instead of E(), which are easy to confuse.
// Help by erroring when E() packages are imported.
files: ['packages/boot/test/**/*.test.*'],
files: ['packages/boot/test/**/*.test.*s'],
rules: {
'no-restricted-imports': [
'error',
Expand Down Expand Up @@ -226,8 +240,6 @@ module.exports = {
{
files: ['*.d.ts'],
rules: {
// Irrelevant in a typedef
'no-use-before-define': 'off',
// Linter confuses the type declaration with value declaration
'no-redeclare': 'off',
},
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ refs: #XXXX
<!-- Every PR should of course come with tests of its own functionality. What additional tests are still needed beyond those unit tests? How does this affect CI, other test automation, or the testnet? -->

### Upgrade Considerations
<!-- What aspects of this PR are relevant to upgrading live production systems, and how should they be addressed? -->
<!-- What aspects of this PR are relevant to upgrading live production systems, and how should they be addressed? What steps should be followed to verify that its changes have been included in a release (ollinet/emerynet/mainnet/etc.) and work successfully there? If the process is elaborate, consider adding a script to scripts/verification/. -->
6 changes: 2 additions & 4 deletions .github/workflows/after-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,8 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: generate coverage for all tests
run: 'yarn test:c8-all || :'
- name: generate coverage/html reports
run: mkdir -p coverage/tmp && yarn c8 report --reporter=html-spa --reports-dir=coverage/html --temp-directory=coverage/tmp
- name: generate test coverage report
run: ./scripts/ci/generate-test-coverage-report.sh
- uses: actions/upload-artifact@v4
with:
name: coverage
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dump-ci-stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'

Expand Down
26 changes: 11 additions & 15 deletions .github/workflows/test-all-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
# We split the package tests into two jobs because type linting
# is inefficient and slow https://github.com/typescript-eslint/typescript-eslint/issues/2094
lint-primary:
timeout-minutes: 15
timeout-minutes: 20
needs: build
runs-on: ubuntu-latest
steps:
Expand All @@ -91,22 +91,13 @@ jobs:
with:
node-version: '18.x'

# first job also does repo-level linting
- name: lint repo format
run: yarn lint:format
# eslint
- name: yarn lint primary
run: ./scripts/lint-with-types.sh primary
# build the API docs to verify it works
- name: build API docs
run: yarn docs
# build the API docs in markdown for agoric/documentation repo to verify it works
- name: build API docs in markdown
run: yarn docs:markdown-for-agoric-documentation-repo
# eslint and tsc
- run: yarn lint:packages

# A second job for what's not covered in primary
lint-rest:
timeout-minutes: 15
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -117,15 +108,20 @@ jobs:
# Check some of a3p-integration in this job that runs on PRs instead of
# waiting for the slow integration test that by default only runs in the
# master merge check
- name: yarn lint rest of packages/*
run: ./scripts/lint-with-types.sh rest
- name: Lint a3p-integration
run: yarn install && yarn lint && yarn doctor
working-directory: a3p-integration
- name: build A3P submissions
run: yarn run build:submissions
working-directory: a3p-integration

# Attempt the doc generation to catch build errors before
# landing on master
- name: build API docs
run: yarn docs
- name: build API docs in markdown
run: yarn docs:markdown-for-agoric-documentation-repo

##################
# Fast-running tests run as a group:
test-quick:
Expand Down
51 changes: 14 additions & 37 deletions COVERAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,36 @@

## Caveat

Until each module can be migrated to support Node.js's builtin ESM
implementation (`nesm`), the coverage line numbers will be out-of-sync with
reality.

In addition, we will have to implement source maps in all of our
Lines from bundled code cannot be detected until we implement source maps in all of our
source-to-source transforms (such as `@endo/bundle-source`,
`@agoric/transform-metering`, and `@agoric/static-module-record`).

## Reports

Coverage reports for the current main branch (whose packages support `nesm`) are
### Whole repo
Coverage reports for the current main branch are
published by CI to: https://agoric-sdk-coverage.netlify.app

You can create a report in any package (including the top-level directory):
See `scripts/ci/generate-test-coverage-report.sh`

## Per package
You can create a report in any package:

```sh
yarn test:c8
```

For more flexibility:
```sh
# Get options available for coverage:
yarn c8 --help
# Run ava under Node.js coverage and display a summary:
yarn c8 -a ava
# Run a particular test
yarn c8 -a ava test/foo.test.js
# Generate a nice, detailed HTML report:
yarn c8 report --reporter=html-spa
open coverage/html/index.html
```

## Node.js ESM Support

With the current `patches/esm+3.2.25.diff`, it is possible to migrate packages
to support both resm (`-r esm`) and nesm (Node.js ESM Support). If an
`agoric-sdk` package has dependencies that support nesm, you can attempt to make
it also support nesm by:

1. Create `ava-nesm.config.js` removing `"require": ["esm"]`:

```sh
../../scripts/ava-nesm.cjs > ava-nesm.config.js
```

2. Make the following changes to its `package.json` (omitting comments):

```js
{
// Enable nesm support.
"type": "module",
"scripts": {
// The following line enables coverage generation from the top.
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js"
}
}
```

3. Test that both `yarn test` and `yarn test:c8` run correctly.

## Planned Implementation

Our runtime source transforms can be conditional on the `$NODE_V8_COVERAGE`
Expand Down
2 changes: 1 addition & 1 deletion MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ For each set of changes to include after the base branch point:
- If encountering a commit with conflicts that do not have a straightforward resolution, check if picking any prior commit would help resolve the conflicts.
- Abort the rebase, update the authored `rebase-todo`, and restart the interactive rebase.
- Avoid authoring manual changes unless absolutely necessary. If authoring changes, keep them as separate commits and indicate them as such on the authored rebase todo (insert either a `pick` instruction with the id of the commit you just authored or an `exec` instruction that makes the modifications and ends with `git commit -m $message`, in either case prefixing with an explanatory `##` comment).
- For `exec`, make portable in-place edits with either `ed` or `alias sed-i="sed -i $(sed --help 2>&1 | sed 2q | grep -qe '-i ' && echo "''")"`, e.g. `printf 'H\n/\( *\)foo/ s##\\1// prettier-ignore\\\n&#\nw\n' | ed -s packages/path/to/file'` or `sed-i -E "$(printf 's#( *)foo#\\1// prettier-ignore\\\n&#')" packages/path/to/file`.
- For `exec`, make portable in-place edits with either `ed` or `alias sedi="sed -i $(sed --help 2>&1 | sed 2q | grep -qe '-i ' && echo "''")"`, e.g. `printf 'H\n/\( *\)foo/ s##\\1// prettier-ignore\\\n&#\nw\n' | ed -s packages/path/to/file'` or `sedi -E "$(printf 's#( *)foo#\\1// prettier-ignore\\\n&#')" packages/path/to/file`.
- If a commit is empty, skip it and comment it out in the rebase todo.
- [ ] Verify that tests pass. In particular:
- Linting locally can catch incompatibilities in the cherry-pick, often requiring some changes to be reverted or more commits from `master` to be included. In those cases, update the authored `rebase-todo`, and redo the interactive rebase as necessary.
Expand Down
1 change: 1 addition & 0 deletions a3p-integration/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
agoric-sdk/
37 changes: 21 additions & 16 deletions a3p-integration/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Overview
# a3p-integration overview

This directory contains an end-to-end integration test executed against a synthetic agoric-3 chain. The test performs a chain software upgrade to the software contained in the enclosing `agoric-sdk` repository, then executes a series of functional tests verifying the upgrade accomplished its goal.

# How to run
## Quick-Start: How to Get a Chain Running

To get a chain running with an existing proposal such as `f:fast-usdc`, run `yarn test -m fast-usdc --debug`; likewise `yarn test -m <proposal-name-substring> --debug` for any other proposal name.

## How to run

The synthetic chain testing infrastructure relies on Docker, Docker Buildx extended build capabilities, and the experimental Buildx Bake extension. Make sure you have a recent Docker engine installed for your system.

Expand Down Expand Up @@ -153,12 +157,12 @@ make -C ../packages/deployment docker-build-sdk

In a3p-integration, many core-eval proposals' `submission` content has to be
generated from the local `agoric-sdk`, and must be rebuilt every time there is a
change. The `scripts/build-all-submissions.sh` script contains commands to
generate the core-eval content and move it to the expected proposal package's
submission directory. The generation is executed as part of `a3p-integration`'s
`build:submissions` step. Each proposal that requires such a build step should
add an entry to the `sdk-generate` array in the `agoricProposal` section of
`package.json`.
change. This package's package.json `build:submissions` script runs
`scripts/build-all-submissions.sh` to generate that content and move it into
submission subdirectories under the corresponding [proposal
directories](#package-layering). Each proposal that requires such a build step
should have a corresponding entry in the `sdk-generate` array of its proposal
directory's package.json `agoricProposal` section.

Submissions that don't need to pass in options or generate references to source
bundles can be written directly in a `foo-submission` subdirectory of the
Expand All @@ -172,24 +176,25 @@ provided, it should be written as two parts: a core eval (in one of the
`.../proposals` directories) and a builder for it (under `.../builders/scripts`).

The `build-all-submissions.sh` script reads instructions from
`agoricProposal.sdk-generate` in `package.json`. That field contains a list of
strings, each of which describes a single submission. If there is only one
submission, it can use the default directory name `submission` by specifying
only the name of the script file in `builders/scripts/vars`:
`agoricProposal.sdk-generate` in package.json. That field contains a list of
strings, each of which describes a single submission as a list of
space-separated fields. If there is only one submission, it can use the default
directory name `submission` by specifying just one field, containing the path of
a builder script file relative to
[packages/builders/scripts](../packages/builders/scripts):
```json
"sdk-generate": ["test-localchain"],
```
If there are multiple submissions, each entry has to specify the script name and
a distinct directory name.
If there are multiple submissions, each entry has to specify a distinct
directory name in the second field:
```json
"sdk-generate": [
"probe-zcf-bundle probe-submission",
"updatePriceFeeds priceFeed-submission",
"add-auction newAuction-submission"
],
```
A third argument can be used to provide additional parameters to the
build script.
Any remaining fields provide additional arguments to the build script:
```json
"sdk-generate": [
"inter-protocol/updatePriceFeeds.js submission/main main",
Expand Down
10 changes: 7 additions & 3 deletions a3p-integration/debug-current.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#!/bin/sh
#!/bin/bash
set -ueo pipefail

# Convenience script to debug the current proposal being worked on.

scripts/build-submission.sh proposals/z:acceptance testing/start-valueVow.js start-valueVow
scripts/build-submission.sh proposals/z:acceptance testing/restart-valueVow.js restart-valueVow
(
cd 'proposals/z:acceptance'
../../scripts/build-submission.sh testing/start-valueVow.js start-valueVow
../../scripts/build-submission.sh testing/restart-valueVow.js restart-valueVow
)

yarn test -m acceptance --debug
9 changes: 6 additions & 3 deletions a3p-integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@
"build:sdk": "make -C ../packages/deployment docker-build-sdk",
"build:submissions": "scripts/build-all-submissions.sh",
"build:synthetic-chain": "yarn synthetic-chain build",
"lint": "../node_modules/.bin/eslint proposals",
"lint-fix": "yarn lint:eslint --fix",
"lint": "../node_modules/.bin/run-s --continue-on-error 'lint:*'",
"lint:types": "find proposals -maxdepth 2 -name package.json -type f -exec ../node_modules/.bin/tsc -p '{}'/.. ';'",
"lint:eslint": "../node_modules/.bin/eslint .",
"test": "yarn synthetic-chain test",
"doctor": "yarn synthetic-chain doctor"
},
"dependencies": {
"@agoric/synthetic-chain": "^0.4.0",
"@agoric/synthetic-chain": "^0.4.3",
"@types/better-sqlite3": "^7.6.11"
},
"packageManager": "[email protected].1",
"packageManager": "[email protected].3",
"license": "Apache-2.0"
}
1 change: 1 addition & 0 deletions a3p-integration/proposals/f:fast-usdc/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
18 changes: 18 additions & 0 deletions a3p-integration/proposals/f:fast-usdc/deploy.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// @ts-check
/* global globalThis */
import test from 'ava';
import '@endo/init/legacy.js'; // axios compat
import { makeVstorageKit } from '@agoric/client-utils';

const io = { fetch: globalThis.fetch };
const networkConfig = {
rpcAddrs: ['http://0.0.0.0:26657'],
chainName: 'agoriclocal',
};

test('fastUsdc is in agoricNames.instance', async t => {
const { agoricNames } = await makeVstorageKit(io, networkConfig);

t.log('agoricNames.instance keys', Object.keys(agoricNames.instance));
t.truthy(agoricNames.instance.fastUsdc);
});
30 changes: 30 additions & 0 deletions a3p-integration/proposals/f:fast-usdc/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"agoricProposal": {
"source": "subdir",
"$UNTIL": "write-chain-info to agoricNames until #10445 and chainHub setup",
"sdk-generate": [
"orchestration/write-chain-info.js",
"fast-usdc/init-fast-usdc.js submission --net A3P_INTEGRATION"
],
"type": "/agoric.swingset.CoreEvalProposal"
},
"type": "module",
"license": "Apache-2.0",
"dependencies": {
"@agoric/client-utils": "dev",
"@agoric/synthetic-chain": "^0.4.3",
"@endo/init": "^1.1.7",
"ava": "^5.3.1"
},
"ava": {
"concurrency": 1,
"timeout": "2m",
"files": [
"!submission"
]
},
"scripts": {
"agops": "yarn --cwd /usr/src/agoric-sdk/ --silent agops"
},
"packageManager": "[email protected]"
}
Loading

0 comments on commit babdddd

Please sign in to comment.