Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(fast-usdc): update, test chain policies vs. spreadsheet #11055

Merged
merged 8 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.1",
"@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": "yarn@4.6.0"
}
10 changes: 10 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,10 @@
#!/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

yarn ava

./test-cli.sh
45 changes: 45 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,45 @@
// @ts-check
/* eslint-env node */
import '@endo/init/legacy.js'; // axios compat

import { LOCAL_CONFIG, makeSmartWalletKit } from '@agoric/client-utils';
import test from 'ava';
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);
const { poolAccount, settlementAccount } = JSON.parse(values[0]);

// exact addresses are not available at design time
t.true(poolAccount.startsWith('agoric1'));
t.true(settlementAccount.startsWith('agoric1'));
});

test(`fastUsdc incarnation reflects Noble ICA upgrade`, async t => {
const history = { beta: 0, nobleICA: 1 };
// XXX getIncarnation doesn't support IO injection
t.is(await getIncarnation('fastUsdc'), history.nobleICA);
});

test('feedPolicy updated for GTM', async t => {
const swk = await makeSmartWalletKit(io, LOCAL_CONFIG);

const policy = await swk.readPublished('fastUsdc.feedPolicy');
t.log('policy', policy);
t.like(policy, {
chainPolicies: {
Arbitrum: {
confirmations: 96, // was 2 in Beta
},
},
});
});
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
Loading