Skip to content

Commit

Permalink
Merge branch 'iomekam-asset-reserve-a3p' into iomekam-ar-upgrade-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
iomekam committed Dec 6, 2024
2 parents c0fd937 + ebbfa73 commit 3d92f6b
Show file tree
Hide file tree
Showing 295 changed files with 16,958 additions and 5,346 deletions.
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: 4 additions & 0 deletions .github/workflows/multichain-e2e-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ jobs:
run: make override-chain-registry
working-directory: ./agoric-sdk/multichain-testing

- name: Register Interchain Bank Assets
run: make register-bank-assets
working-directory: ./agoric-sdk/multichain-testing

- name: Run @agoric/multichain-testing E2E Tests
run: yarn ${{ inputs.test_command }}
working-directory: ./agoric-sdk/multichain-testing
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
8 changes: 6 additions & 2 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
2 changes: 1 addition & 1 deletion a3p-integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"@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);
});
28 changes: 28 additions & 0 deletions a3p-integration/proposals/f:fast-usdc/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"agoricProposal": {
"source": "subdir",
"sdk-generate": [
"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]"
}
15 changes: 15 additions & 0 deletions a3p-integration/proposals/f:fast-usdc/test-cli.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# FIXME these commands are run against the `@agoric/fast-usdc` pulled from NPM
# but should be run against the local SDK. The `yarn link` command described in
# a3p-integration/README.md is supposed to make that work but it's not working.

yarn @agoric/fast-usdc operator accept >| accept.json
cat accept.json
yarn agoric wallet send --offer accept.json --from gov1 --keyring-backend="test"
ACCEPT_OFFER_ID=$(agoric wallet extract-id --offer accept.json)

# FIXME attest something
yarn @agoric/fast-usdc operator attest --previousOfferId "$ACCEPT_OFFER_ID" >| attest.json
cat attest.json
yarn agoric wallet send --offer attest.json --from gov1 --keyring-backend="test"
5 changes: 5 additions & 0 deletions a3p-integration/proposals/f:fast-usdc/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
yarn ava

# TODO get CLI test passing and part of CI
./test-cli.sh || echo "CLI test failed"
Loading

0 comments on commit 3d92f6b

Please sign in to comment.