Skip to content

Commit

Permalink
misc Fast USDC improvements (#11049)
Browse files Browse the repository at this point in the history
_incidental_

## Description
Mostly extracted from #11025

- revert removing redundant `encoding` from ChainAddress because it broke contract upgrade,
  - #11025
- fixes the ChainHub caching to be less durable
- misc code cleanup

### Security Considerations
none

### Scaling Considerations
none

### Documentation Considerations
none

### Testing Considerations
CI suffices

### Upgrade Considerations
No upgrade test yet. #11025 has that and is in flight.
  • Loading branch information
mergify[bot] authored Feb 27, 2025
2 parents f83e5a9 + 1477c17 commit 214eb2a
Show file tree
Hide file tree
Showing 54 changed files with 214 additions and 235 deletions.
1 change: 1 addition & 0 deletions multichain-testing/test/auto-stake-it.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ const autoStakeItScenario = test.macro({
chainName,
validator: {
value: validatorAddress,
encoding: 'bech32',
chainId: remoteChainInfo.chainId,
},
},
Expand Down
1 change: 1 addition & 0 deletions multichain-testing/test/send-anywhere.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ const sendAnywhereScenario = test.macro({
const receiver = {
chainId: chain.chain_id,
value: (await wallet.getAccounts())[0].address,
encoding: 'bech32',
};
t.log('Will send payment to:', receiver);
t.log(`${destChainName} offer`);
Expand Down
1 change: 1 addition & 0 deletions multichain-testing/test/stake-ica.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const stakeScenario = test.macro(async (t, scenario: StakeIcaScenario) => {
const validatorChainAddress = {
value: validatorAddress,
chainId: scenario.chainId,
encoding: 'bech32',
};
await doOffer({
id: delegateOfferId,
Expand Down
3 changes: 3 additions & 0 deletions packages/boot/test/bootstrapTests/lca.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ test.serial('stakeBld', async t => {
toAccount: {
value: 'agoric1EOAAccAddress',
chainId: 'agoriclocal',
encoding: 'bech32',
},
amount: { denom: 'ibc/1234', value: 10n },
},
Expand All @@ -150,6 +151,7 @@ test.serial('stakeBld', async t => {
toAccount: {
value: 'agoric1EOAAccAddress',
chainId: 'agoriclocal',
encoding: 'bech32',
},
amounts: [
{ denom: 'uatom', value: 10n },
Expand All @@ -174,6 +176,7 @@ test.serial('stakeBld', async t => {
toAccount: {
value: 'agoric1EOAAccAddress',
chainId: 'agoriclocal',
encoding: 'bech32',
},
amount: {
denom: 'ibc/1234',
Expand Down
2 changes: 2 additions & 0 deletions packages/boot/test/bootstrapTests/orchestration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const test: TestFn<
const validatorAddress: CosmosValidatorAddress = {
value: 'cosmosvaloper1test',
chainId: 'gaiatest',
encoding: 'bech32',
};

const ATOM_DENOM = 'uatom';
Expand Down Expand Up @@ -235,6 +236,7 @@ test.serial('stakeAtom - smart wallet', async t => {
const validatorAddressFail: CosmosValidatorAddress = {
value: 'cosmosvaloper1fail',
chainId: 'gaiatest',
encoding: 'bech32',
};

// This will trigger the immediate ack of the mock bridge
Expand Down
8 changes: 4 additions & 4 deletions packages/boot/test/fast-usdc/fast-usdc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ test.after.always(t => t.context.shutdown?.());

test.serial('oracles provision before contract deployment', async t => {
const { walletFactoryDriver: wfd } = t.context;
const watcherWallet = await wfd.provideSmartWallet('agoric1watcher1');
const [watcherWallet] = await Promise.all(
oracleAddrs.map(addr => wfd.provideSmartWallet(addr)),
);
t.truthy(watcherWallet);
});

Expand All @@ -75,9 +77,7 @@ test.serial(
walletFactoryDriver: wfd,
} = t.context;

const [watcherWallet] = await Promise.all(
oracleAddrs.map(addr => wfd.provideSmartWallet(addr)),
);
const watcherWallet = await wfd.provideSmartWallet(oracleAddrs[0]);

// inbound `startChannelOpenInit` responses immediately.
// needed since the Fusdc StartFn relies on an ICA being created
Expand Down
1 change: 1 addition & 0 deletions packages/boot/test/orchestration/restart-contracts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ test.serial('send-anywhere', async t => {
const validatorAddress: CosmosValidatorAddress = {
value: 'cosmosvaloper1test',
chainId: 'gaiatest',
encoding: 'bech32',
};
const ATOM_DENOM = 'uatom';

Expand Down
168 changes: 70 additions & 98 deletions packages/builders/test/snapshots/orchestration-imports.test.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,16 @@ Generated by [AVA](https://avajs.dev).
Object @match:string {
payload: [],
},
Object @match:splitRecord {
payload: [
{
chainId: Object @match:string {
payload: [],
},
value: Object @match:string {
payload: [],
},
},
{
encoding: 'bech32',
},
],
{
chainId: Object @match:string {
payload: [],
},
encoding: Object @match:string {
payload: [],
},
value: Object @match:string {
payload: [],
},
},
],
},
Expand Down Expand Up @@ -87,20 +83,16 @@ Generated by [AVA](https://avajs.dev).
},
],
},
ChainAddressShape: Object @match:splitRecord {
payload: [
{
chainId: Object @match:string {
payload: [],
},
value: Object @match:string {
payload: [],
},
},
{
encoding: 'bech32',
},
],
ChainAddressShape: {
chainId: Object @match:string {
payload: [],
},
encoding: Object @match:string {
payload: [],
},
value: Object @match:string {
payload: [],
},
},
ChainInfoShape: Object @match:splitRecord {
payload: [
Expand Down Expand Up @@ -153,20 +145,16 @@ Generated by [AVA](https://avajs.dev).
},
],
},
CosmosChainAddressShape: Object @match:splitRecord {
payload: [
{
chainId: Object @match:string {
payload: [],
},
value: Object @match:string {
payload: [],
},
},
{
encoding: 'bech32',
},
],
CosmosChainAddressShape: {
chainId: Object @match:string {
payload: [],
},
encoding: Object @match:string {
payload: [],
},
value: Object @match:string {
payload: [],
},
},
CosmosChainInfoShape: Object @match:splitRecord {
payload: [
Expand Down Expand Up @@ -232,37 +220,29 @@ Generated by [AVA](https://avajs.dev).
},
],
},
validator: Object @match:splitRecord {
payload: [
{
chainId: Object @match:string {
payload: [],
},
value: Object @match:string {
payload: [],
},
},
{
encoding: 'bech32',
},
],
validator: {
chainId: Object @match:string {
payload: [],
},
encoding: Object @match:string {
payload: [],
},
value: Object @match:string {
payload: [],
},
},
},
{
delegator: Object @match:splitRecord {
payload: [
{
chainId: Object @match:string {
payload: [],
},
value: Object @match:string {
payload: [],
},
},
{
encoding: 'bech32',
},
],
delegator: {
chainId: Object @match:string {
payload: [],
},
encoding: Object @match:string {
payload: [],
},
value: Object @match:string {
payload: [],
},
},
},
],
Expand Down Expand Up @@ -371,20 +351,16 @@ Generated by [AVA](https://avajs.dev).
payload: [
{},
{
intermediateRecipient: Object @match:splitRecord {
payload: [
{
chainId: Object @match:string {
payload: [],
},
value: Object @match:string {
payload: [],
},
},
{
encoding: 'bech32',
},
],
intermediateRecipient: {
chainId: Object @match:string {
payload: [],
},
encoding: Object @match:string {
payload: [],
},
value: Object @match:string {
payload: [],
},
},
retries: Object @match:kind {
payload: 'number',
Expand Down Expand Up @@ -487,20 +463,16 @@ Generated by [AVA](https://avajs.dev).
payload: [
{},
{
intermediateRecipient: Object @match:splitRecord {
payload: [
{
chainId: Object @match:string {
payload: [],
},
value: Object @match:string {
payload: [],
},
},
{
encoding: 'bech32',
},
],
intermediateRecipient: {
chainId: Object @match:string {
payload: [],
},
encoding: Object @match:string {
payload: [],
},
value: Object @match:string {
payload: [],
},
},
retries: Object @match:kind {
payload: 'number',
Expand Down
Binary file not shown.
27 changes: 13 additions & 14 deletions packages/fast-usdc/src/exos/transaction-feed.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,20 +209,19 @@ export const prepareTransactionFeedKit = (zone, zcf) => {
let lastEvidence;
for (const store of found) {
const next = store.get(txHash);
if (lastEvidence) {
if (keyEQ(lastEvidence, next)) {
lastEvidence = next;
} else {
trace(
'🚨 conflicting evidence for',
txHash,
':',
lastEvidence,
'!=',
next,
);
Fail`conflicting evidence for ${quote(txHash)}`;
}
if (lastEvidence && !keyEQ(lastEvidence, next)) {
// Ignore conflicting evidence, but treat it as an error
// because it should never happen and needs to be prevented
// from happening again.
trace(
'🚨 conflicting evidence for',
txHash,
':',
lastEvidence,
'!=',
next,
);
Fail`conflicting evidence for ${quote(txHash)}`;
}
lastEvidence = next;
}
Expand Down
1 change: 1 addition & 0 deletions packages/fast-usdc/src/start-fast-usdc.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const POOL_METRICS = 'poolMetrics';
* }} FastUSDCCorePowers
*
* @typedef {StartedInstanceKitWithLabel & {
* publicFacet: StartedInstanceKit<FastUsdcSF>['publicFacet'];
* creatorFacet: StartedInstanceKit<FastUsdcSF>['creatorFacet'];
* privateArgs: StartParams<FastUsdcSF>['privateArgs'];
* }} FastUSDCKit
Expand Down
3 changes: 3 additions & 0 deletions packages/fast-usdc/test/exos/advancer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ test('updates status to ADVANCING in happy path', async t => {
},
destination: {
chainId: 'osmosis-1',
encoding: 'bech32',
value: 'osmo183dejcnmkka5dzcu9xw6mywq0p2m5peks28men',
},
},
Expand Down Expand Up @@ -659,6 +660,7 @@ test('will not advance same txHash:chainId evidence twice', async t => {
advanceAmount: { brand: usdc.brand, value: 146999999n },
destination: {
chainId: 'osmosis-1',
encoding: 'bech32',
value: 'osmo183dejcnmkka5dzcu9xw6mywq0p2m5peks28men',
},
},
Expand Down Expand Up @@ -911,6 +913,7 @@ test('uses bank send for agoric1 EUD', async t => {
},
destination: {
chainId: 'agoric-3',
encoding: 'bech32',
value: 'agoric13rj0cc0hm5ac2nt0sdup2l7gvkx4v9tyvgq3h2',
},
},
Expand Down
2 changes: 2 additions & 0 deletions packages/fast-usdc/test/exos/settler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ test('slow path: forward to EUD; remove pending tx', async t => {
forwardOpts: {
intermediateRecipient: {
chainId: 'noble-1',
encoding: 'bech32',
value: 'noble1test',
},
},
Expand Down Expand Up @@ -445,6 +446,7 @@ test('skip advance: forward to EUD; remove pending tx', async t => {
forwardOpts: {
intermediateRecipient: {
chainId: 'noble-1',
encoding: 'bech32',
value: 'noble1test',
},
},
Expand Down
Loading

0 comments on commit 214eb2a

Please sign in to comment.