Skip to content

Commit

Permalink
test(a3p): gtm-fast-usdc
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg authored and dckc committed Feb 27, 2025
1 parent 415b6d8 commit 0328ba4
Show file tree
Hide file tree
Showing 7 changed files with 5,744 additions and 0 deletions.
1 change: 1 addition & 0 deletions a3p-integration/proposals/g:gtm-fast-usdc/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
3 changes: 3 additions & 0 deletions a3p-integration/proposals/g:gtm-fast-usdc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# proposal for deploying the GTM release of Fast USDC

Because this runs before `n:upgrade-next` its base image isn't a build of the local agoric-sdk. So it can't use `yarn link` to get `@agoric/fast-usdc` from the source tree. Instead it sources the packages from NPM using `dev` to get the latest master builds.
31 changes: 31 additions & 0 deletions a3p-integration/proposals/g:gtm-fast-usdc/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"agoricProposal": {
"source": "subdir",
"sdk-generate": [
"fast-usdc/fast-usdc-reconfigure.build.js submission"
],
"type": "/agoric.swingset.CoreEvalProposal"
},
"type": "module",
"license": "Apache-2.0",
"dependencies": {
"@agoric/client-utils": "dev",
"@agoric/fast-usdc": "dev",
"@agoric/synthetic-chain": "^0.5.2",
"@endo/init": "^1.1.8",
"agoric": "dev",
"ava": "^5.3.1"
},
"ava": {
"concurrency": 1,
"timeout": "2m",
"files": [
"test/**/*.test.*",
"!submission"
]
},
"scripts": {
"agops": "yarn --cwd /usr/src/agoric-sdk/ --silent agops"
},
"packageManager": "[email protected]"
}
13 changes: 13 additions & 0 deletions a3p-integration/proposals/g:gtm-fast-usdc/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -euo pipefail

# segregate so changing these does not invalidate the proposal image
# à la https://github.com/Agoric/agoric-3-proposals/pull/213
cd test

echo AVAILABLE WALLETs
agd query vstorage children published.wallet

yarn ava

./test-cli.sh
31 changes: 31 additions & 0 deletions a3p-integration/proposals/g:gtm-fast-usdc/test/deploy.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// @ts-check
/* eslint-env node */
import test from 'ava';
import '@endo/init/legacy.js'; // axios compat
import { LOCAL_CONFIG, makeSmartWalletKit } from '@agoric/client-utils';
import { getIncarnation } from '@agoric/synthetic-chain';

const io = {
delay: ms => new Promise(resolve => setTimeout(() => resolve(undefined), ms)),
fetch: global.fetch,
};

test('accounts', async t => {
const swk = await makeSmartWalletKit(io, LOCAL_CONFIG);

// XXX readPublished once it can handle plain JSON
const nodeStr = await swk.vstorage.readLatest('published.fastUsdc');
const { values } = JSON.parse(JSON.parse(nodeStr).value);
t.deepEqual(JSON.parse(values[0]), {
// XXX A3P can't do ICA because it has no connections
// nobleICA: 'noble1test1',
poolAccount:
'agoric1hp6dwm4c820nwhq4hdpxjx5h9nac2gcy7fe0slp6lwnfzm76vnwqv3gf59',
settlementAccount:
'agoric12rqzc0976vhxajjwqj76l7x6m0jpvpjf4mk54wyjfyemn09l6xuq7mvvpj',
});
});

test.failing(`incarnation number`, async t => {
t.is(await getIncarnation('fastUsdc'), 2);
});
24 changes: 24 additions & 0 deletions a3p-integration/proposals/g:gtm-fast-usdc/test/test-cli.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
set -euo pipefail

# 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]

echo CLI test accepting operator invitation
ACCEPT_OFFER_ID=fastUsdcTestAccept
yarn fast-usdc operator accept --offerId $ACCEPT_OFFER_ID >| accept.json
cat accept.json
yarn agoric wallet send --offer accept.json --from agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q --keyring-backend test
# UNTIL https://github.com/Agoric/agoric-sdk/issues/10891
# ACCEPT_OFFER_ID=$(agoric wallet extract-id --offer accept.json)

yarn fast-usdc operator attest --previousOfferId="$ACCEPT_OFFER_ID" --forwardingChannel=foo --recipientAddress=agoric1foo --blockHash=0xfoo --blockNumber=1 --blockTimestamp=1632340000 --chainId=3 --amount=123 --forwardingAddress=noble1foo --sender 0xfoo --txHash=0xtx >| attest.json
cat attest.json
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
Loading

0 comments on commit 0328ba4

Please sign in to comment.