Skip to content

Commit 2f3ca19

Browse files
authored
fix A3P test of fast-usdc (#10805)
_leftover_ ## Description A previous PR added an A3P test of fast-usdc CLI but didn't get it working. This fixes it by providing the proper dependencies and usage. It also documents why the `yarn link` approach doesn't work for this package. ### Security Considerations n/a ### Scaling Considerations n/a ### Documentation Considerations n/a ### Testing Considerations ### Upgrade Considerations
2 parents 4c2be7c + 6d1b1f2 commit 2f3ca19

File tree

6 files changed

+1644
-345
lines changed

6 files changed

+1644
-345
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# proposal for deploying fast-usdc
2+
3+
Note that this will run after upgrade-next but for iteration speed it runs before n:upgrade-next in the build sequence.
4+
5+
A consequence of this is that it can't use `yarn link` to get `@agoric/fast-usdc` because it's not in the base image. Instead it sources the packages from NPM using `dev` to get the latest master builds.
6+

a3p-integration/proposals/f:fast-usdc/deploy.test.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
// @ts-check
2-
/* global globalThis */
2+
/* eslint-env node */
33
import test from 'ava';
44
import '@endo/init/legacy.js'; // axios compat
5-
import { makeVstorageKit } from '@agoric/client-utils';
5+
import { makeSmartWalletKit } from '@agoric/client-utils';
66

7-
const io = { fetch: globalThis.fetch };
7+
const io = {
8+
delay: ms => new Promise(resolve => setTimeout(() => resolve(undefined), ms)),
9+
fetch: global.fetch,
10+
};
811
const networkConfig = {
912
rpcAddrs: ['http://0.0.0.0:26657'],
1013
chainName: 'agoriclocal',
1114
};
1215

1316
test('fastUsdc is in agoricNames.instance', async t => {
14-
const { agoricNames } = await makeVstorageKit(io, networkConfig);
17+
const { agoricNames } = await makeSmartWalletKit(io, networkConfig);
1518

1619
t.log('agoricNames.instance keys', Object.keys(agoricNames.instance));
1720
t.truthy(agoricNames.instance.fastUsdc);

a3p-integration/proposals/f:fast-usdc/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
"license": "Apache-2.0",
1111
"dependencies": {
1212
"@agoric/client-utils": "dev",
13+
"@agoric/fast-usdc": "dev",
1314
"@agoric/synthetic-chain": "^0.4.3",
1415
"@endo/init": "^1.1.7",
16+
"agoric": "dev",
1517
"ava": "^5.3.1"
1618
},
1719
"ava": {
Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
#!/bin/bash
2+
set -euo pipefail
23

3-
# FIXME these commands are run against the `@agoric/fast-usdc` pulled from NPM
4-
# but should be run against the local SDK. The `yarn link` command described in
5-
# a3p-integration/README.md is supposed to make that work but it's not working.
4+
# XXX the from address is gov1 but using that causes:
5+
# Error: gov1 is not a valid name or address: decoding bech32 failed: invalid bech32 string length 4
6+
# Usage:
7+
# agd keys show [name_or_address [name_or_address...]] [flags]
68

7-
yarn @agoric/fast-usdc operator accept >| accept.json
9+
yarn fast-usdc operator accept >| accept.json
810
cat accept.json
9-
yarn agoric wallet send --offer accept.json --from gov1 --keyring-backend="test"
11+
yarn agoric wallet send --offer accept.json --from agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q --keyring-backend test
1012
ACCEPT_OFFER_ID=$(agoric wallet extract-id --offer accept.json)
1113

12-
# FIXME attest something
13-
yarn @agoric/fast-usdc operator attest --previousOfferId "$ACCEPT_OFFER_ID" >| attest.json
14+
yarn fast-usdc operator attest --previousOfferId="$ACCEPT_OFFER_ID" --forwardingChannel=foo --recipientAddress=agoric1foo --blockHash=0xfoo --blockNumber=1 --chainId=3 --amount=123 --forwardingAddress=noble1foo --sender 0xfoo --txHash=0xtx >| attest.json
1415
cat attest.json
15-
yarn agoric wallet send --offer attest.json --from gov1 --keyring-backend="test"
16+
yarn agoric wallet send --offer attest.json --from agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q --keyring-backend test
17+
18+
# The data above are bogus and result in errors in the logs:
19+
# SwingSet: vat: v72: ----- TxFeed.11 8 publishing evidence { aux: { forwardingChannel: 'foo', recipientAddress: 'agoric1foo' }, blockHash: '0xfoo', blockNumber: 1n, chainId: 3, tx: { amount: 123n, forwardingAddress: 'noble1foo', sender: '0xfoo' }, txHash: '0xtx' } []
20+
# SwingSet: vat: v72: ----- Advancer.15 2 Advancer error: (Error#4)
21+
# SwingSet: vat: v72: Error#4: Data too short

a3p-integration/proposals/f:fast-usdc/test.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ set -euo pipefail
33

44
yarn ava
55

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

0 commit comments

Comments
 (0)