Skip to content

Commit

Permalink
fix A3P test of fast-usdc (#10805)
Browse files Browse the repository at this point in the history
_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
  • Loading branch information
mergify[bot] authored Jan 7, 2025
2 parents 4c2be7c + 6d1b1f2 commit 2f3ca19
Show file tree
Hide file tree
Showing 6 changed files with 1,644 additions and 345 deletions.
6 changes: 6 additions & 0 deletions a3p-integration/proposals/f:fast-usdc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# proposal for deploying fast-usdc

Note that this will run after upgrade-next but for iteration speed it runs before n:upgrade-next in the build sequence.

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.

11 changes: 7 additions & 4 deletions a3p-integration/proposals/f:fast-usdc/deploy.test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
// @ts-check
/* global globalThis */
/* eslint-env node */
import test from 'ava';
import '@endo/init/legacy.js'; // axios compat
import { makeVstorageKit } from '@agoric/client-utils';
import { makeSmartWalletKit } from '@agoric/client-utils';

const io = { fetch: globalThis.fetch };
const io = {
delay: ms => new Promise(resolve => setTimeout(() => resolve(undefined), ms)),
fetch: global.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);
const { agoricNames } = await makeSmartWalletKit(io, networkConfig);

t.log('agoricNames.instance keys', Object.keys(agoricNames.instance));
t.truthy(agoricNames.instance.fastUsdc);
Expand Down
2 changes: 2 additions & 0 deletions a3p-integration/proposals/f:fast-usdc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
"license": "Apache-2.0",
"dependencies": {
"@agoric/client-utils": "dev",
"@agoric/fast-usdc": "dev",
"@agoric/synthetic-chain": "^0.4.3",
"@endo/init": "^1.1.7",
"agoric": "dev",
"ava": "^5.3.1"
},
"ava": {
Expand Down
22 changes: 14 additions & 8 deletions a3p-integration/proposals/f:fast-usdc/test-cli.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
#!/bin/bash
set -euo pipefail

# 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.
# XXX the from address is gov1 but using that causes:
# Error: gov1 is not a valid name or address: decoding bech32 failed: invalid bech32 string length 4
# Usage:
# agd keys show [name_or_address [name_or_address...]] [flags]

yarn @agoric/fast-usdc operator accept >| accept.json
yarn fast-usdc operator accept >| accept.json
cat accept.json
yarn agoric wallet send --offer accept.json --from gov1 --keyring-backend="test"
yarn agoric wallet send --offer accept.json --from agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q --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
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
cat attest.json
yarn agoric wallet send --offer attest.json --from gov1 --keyring-backend="test"
yarn agoric wallet send --offer attest.json --from agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q --keyring-backend test

# The data above are bogus and result in errors in the logs:
# 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' } []
# SwingSet: vat: v72: ----- Advancer.15 2 Advancer error: (Error#4)
# SwingSet: vat: v72: Error#4: Data too short
3 changes: 1 addition & 2 deletions a3p-integration/proposals/f:fast-usdc/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ set -euo pipefail

yarn ava

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

0 comments on commit 2f3ca19

Please sign in to comment.