Skip to content

Commit 214eb2a

Browse files
authored
misc Fast USDC improvements (#11049)
_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.
2 parents f83e5a9 + 1477c17 commit 214eb2a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+214
-235
lines changed

multichain-testing/test/auto-stake-it.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ const autoStakeItScenario = test.macro({
8989
chainName,
9090
validator: {
9191
value: validatorAddress,
92+
encoding: 'bech32',
9293
chainId: remoteChainInfo.chainId,
9394
},
9495
},

multichain-testing/test/send-anywhere.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ const sendAnywhereScenario = test.macro({
8484
const receiver = {
8585
chainId: chain.chain_id,
8686
value: (await wallet.getAccounts())[0].address,
87+
encoding: 'bech32',
8788
};
8889
t.log('Will send payment to:', receiver);
8990
t.log(`${destChainName} offer`);

multichain-testing/test/stake-ica.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ const stakeScenario = test.macro(async (t, scenario: StakeIcaScenario) => {
126126
const validatorChainAddress = {
127127
value: validatorAddress,
128128
chainId: scenario.chainId,
129+
encoding: 'bech32',
129130
};
130131
await doOffer({
131132
id: delegateOfferId,

packages/boot/test/bootstrapTests/lca.test.ts

+3
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ test.serial('stakeBld', async t => {
130130
toAccount: {
131131
value: 'agoric1EOAAccAddress',
132132
chainId: 'agoriclocal',
133+
encoding: 'bech32',
133134
},
134135
amount: { denom: 'ibc/1234', value: 10n },
135136
},
@@ -150,6 +151,7 @@ test.serial('stakeBld', async t => {
150151
toAccount: {
151152
value: 'agoric1EOAAccAddress',
152153
chainId: 'agoriclocal',
154+
encoding: 'bech32',
153155
},
154156
amounts: [
155157
{ denom: 'uatom', value: 10n },
@@ -174,6 +176,7 @@ test.serial('stakeBld', async t => {
174176
toAccount: {
175177
value: 'agoric1EOAAccAddress',
176178
chainId: 'agoriclocal',
179+
encoding: 'bech32',
177180
},
178181
amount: {
179182
denom: 'ibc/1234',

packages/boot/test/bootstrapTests/orchestration.test.ts

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const test: TestFn<
3535
const validatorAddress: CosmosValidatorAddress = {
3636
value: 'cosmosvaloper1test',
3737
chainId: 'gaiatest',
38+
encoding: 'bech32',
3839
};
3940

4041
const ATOM_DENOM = 'uatom';
@@ -235,6 +236,7 @@ test.serial('stakeAtom - smart wallet', async t => {
235236
const validatorAddressFail: CosmosValidatorAddress = {
236237
value: 'cosmosvaloper1fail',
237238
chainId: 'gaiatest',
239+
encoding: 'bech32',
238240
};
239241

240242
// This will trigger the immediate ack of the mock bridge

packages/boot/test/fast-usdc/fast-usdc.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ test.after.always(t => t.context.shutdown?.());
5858

5959
test.serial('oracles provision before contract deployment', async t => {
6060
const { walletFactoryDriver: wfd } = t.context;
61-
const watcherWallet = await wfd.provideSmartWallet('agoric1watcher1');
61+
const [watcherWallet] = await Promise.all(
62+
oracleAddrs.map(addr => wfd.provideSmartWallet(addr)),
63+
);
6264
t.truthy(watcherWallet);
6365
});
6466

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

78-
const [watcherWallet] = await Promise.all(
79-
oracleAddrs.map(addr => wfd.provideSmartWallet(addr)),
80-
);
80+
const watcherWallet = await wfd.provideSmartWallet(oracleAddrs[0]);
8181

8282
// inbound `startChannelOpenInit` responses immediately.
8383
// needed since the Fusdc StartFn relies on an ICA being created

packages/boot/test/orchestration/restart-contracts.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ test.serial('send-anywhere', async t => {
127127
const validatorAddress: CosmosValidatorAddress = {
128128
value: 'cosmosvaloper1test',
129129
chainId: 'gaiatest',
130+
encoding: 'bech32',
130131
};
131132
const ATOM_DENOM = 'uatom';
132133

packages/builders/test/snapshots/orchestration-imports.test.js.md

+70-98
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,16 @@ Generated by [AVA](https://avajs.dev).
1414
Object @match:string {
1515
payload: [],
1616
},
17-
Object @match:splitRecord {
18-
payload: [
19-
{
20-
chainId: Object @match:string {
21-
payload: [],
22-
},
23-
value: Object @match:string {
24-
payload: [],
25-
},
26-
},
27-
{
28-
encoding: 'bech32',
29-
},
30-
],
17+
{
18+
chainId: Object @match:string {
19+
payload: [],
20+
},
21+
encoding: Object @match:string {
22+
payload: [],
23+
},
24+
value: Object @match:string {
25+
payload: [],
26+
},
3127
},
3228
],
3329
},
@@ -87,20 +83,16 @@ Generated by [AVA](https://avajs.dev).
8783
},
8884
],
8985
},
90-
ChainAddressShape: Object @match:splitRecord {
91-
payload: [
92-
{
93-
chainId: Object @match:string {
94-
payload: [],
95-
},
96-
value: Object @match:string {
97-
payload: [],
98-
},
99-
},
100-
{
101-
encoding: 'bech32',
102-
},
103-
],
86+
ChainAddressShape: {
87+
chainId: Object @match:string {
88+
payload: [],
89+
},
90+
encoding: Object @match:string {
91+
payload: [],
92+
},
93+
value: Object @match:string {
94+
payload: [],
95+
},
10496
},
10597
ChainInfoShape: Object @match:splitRecord {
10698
payload: [
@@ -153,20 +145,16 @@ Generated by [AVA](https://avajs.dev).
153145
},
154146
],
155147
},
156-
CosmosChainAddressShape: Object @match:splitRecord {
157-
payload: [
158-
{
159-
chainId: Object @match:string {
160-
payload: [],
161-
},
162-
value: Object @match:string {
163-
payload: [],
164-
},
165-
},
166-
{
167-
encoding: 'bech32',
168-
},
169-
],
148+
CosmosChainAddressShape: {
149+
chainId: Object @match:string {
150+
payload: [],
151+
},
152+
encoding: Object @match:string {
153+
payload: [],
154+
},
155+
value: Object @match:string {
156+
payload: [],
157+
},
170158
},
171159
CosmosChainInfoShape: Object @match:splitRecord {
172160
payload: [
@@ -232,37 +220,29 @@ Generated by [AVA](https://avajs.dev).
232220
},
233221
],
234222
},
235-
validator: Object @match:splitRecord {
236-
payload: [
237-
{
238-
chainId: Object @match:string {
239-
payload: [],
240-
},
241-
value: Object @match:string {
242-
payload: [],
243-
},
244-
},
245-
{
246-
encoding: 'bech32',
247-
},
248-
],
223+
validator: {
224+
chainId: Object @match:string {
225+
payload: [],
226+
},
227+
encoding: Object @match:string {
228+
payload: [],
229+
},
230+
value: Object @match:string {
231+
payload: [],
232+
},
249233
},
250234
},
251235
{
252-
delegator: Object @match:splitRecord {
253-
payload: [
254-
{
255-
chainId: Object @match:string {
256-
payload: [],
257-
},
258-
value: Object @match:string {
259-
payload: [],
260-
},
261-
},
262-
{
263-
encoding: 'bech32',
264-
},
265-
],
236+
delegator: {
237+
chainId: Object @match:string {
238+
payload: [],
239+
},
240+
encoding: Object @match:string {
241+
payload: [],
242+
},
243+
value: Object @match:string {
244+
payload: [],
245+
},
266246
},
267247
},
268248
],
@@ -371,20 +351,16 @@ Generated by [AVA](https://avajs.dev).
371351
payload: [
372352
{},
373353
{
374-
intermediateRecipient: Object @match:splitRecord {
375-
payload: [
376-
{
377-
chainId: Object @match:string {
378-
payload: [],
379-
},
380-
value: Object @match:string {
381-
payload: [],
382-
},
383-
},
384-
{
385-
encoding: 'bech32',
386-
},
387-
],
354+
intermediateRecipient: {
355+
chainId: Object @match:string {
356+
payload: [],
357+
},
358+
encoding: Object @match:string {
359+
payload: [],
360+
},
361+
value: Object @match:string {
362+
payload: [],
363+
},
388364
},
389365
retries: Object @match:kind {
390366
payload: 'number',
@@ -487,20 +463,16 @@ Generated by [AVA](https://avajs.dev).
487463
payload: [
488464
{},
489465
{
490-
intermediateRecipient: Object @match:splitRecord {
491-
payload: [
492-
{
493-
chainId: Object @match:string {
494-
payload: [],
495-
},
496-
value: Object @match:string {
497-
payload: [],
498-
},
499-
},
500-
{
501-
encoding: 'bech32',
502-
},
503-
],
466+
intermediateRecipient: {
467+
chainId: Object @match:string {
468+
payload: [],
469+
},
470+
encoding: Object @match:string {
471+
payload: [],
472+
},
473+
value: Object @match:string {
474+
payload: [],
475+
},
504476
},
505477
retries: Object @match:kind {
506478
payload: 'number',
Binary file not shown.

packages/fast-usdc/src/exos/transaction-feed.js

+13-14
Original file line numberDiff line numberDiff line change
@@ -209,20 +209,19 @@ export const prepareTransactionFeedKit = (zone, zcf) => {
209209
let lastEvidence;
210210
for (const store of found) {
211211
const next = store.get(txHash);
212-
if (lastEvidence) {
213-
if (keyEQ(lastEvidence, next)) {
214-
lastEvidence = next;
215-
} else {
216-
trace(
217-
'🚨 conflicting evidence for',
218-
txHash,
219-
':',
220-
lastEvidence,
221-
'!=',
222-
next,
223-
);
224-
Fail`conflicting evidence for ${quote(txHash)}`;
225-
}
212+
if (lastEvidence && !keyEQ(lastEvidence, next)) {
213+
// Ignore conflicting evidence, but treat it as an error
214+
// because it should never happen and needs to be prevented
215+
// from happening again.
216+
trace(
217+
'🚨 conflicting evidence for',
218+
txHash,
219+
':',
220+
lastEvidence,
221+
'!=',
222+
next,
223+
);
224+
Fail`conflicting evidence for ${quote(txHash)}`;
226225
}
227226
lastEvidence = next;
228227
}

packages/fast-usdc/src/start-fast-usdc.core.js

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const POOL_METRICS = 'poolMetrics';
5959
* }} FastUSDCCorePowers
6060
*
6161
* @typedef {StartedInstanceKitWithLabel & {
62+
* publicFacet: StartedInstanceKit<FastUsdcSF>['publicFacet'];
6263
* creatorFacet: StartedInstanceKit<FastUsdcSF>['creatorFacet'];
6364
* privateArgs: StartParams<FastUsdcSF>['privateArgs'];
6465
* }} FastUSDCKit

packages/fast-usdc/test/exos/advancer.test.ts

+3
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ test('updates status to ADVANCING in happy path', async t => {
251251
},
252252
destination: {
253253
chainId: 'osmosis-1',
254+
encoding: 'bech32',
254255
value: 'osmo183dejcnmkka5dzcu9xw6mywq0p2m5peks28men',
255256
},
256257
},
@@ -659,6 +660,7 @@ test('will not advance same txHash:chainId evidence twice', async t => {
659660
advanceAmount: { brand: usdc.brand, value: 146999999n },
660661
destination: {
661662
chainId: 'osmosis-1',
663+
encoding: 'bech32',
662664
value: 'osmo183dejcnmkka5dzcu9xw6mywq0p2m5peks28men',
663665
},
664666
},
@@ -911,6 +913,7 @@ test('uses bank send for agoric1 EUD', async t => {
911913
},
912914
destination: {
913915
chainId: 'agoric-3',
916+
encoding: 'bech32',
914917
value: 'agoric13rj0cc0hm5ac2nt0sdup2l7gvkx4v9tyvgq3h2',
915918
},
916919
},

packages/fast-usdc/test/exos/settler.test.ts

+2
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ test('slow path: forward to EUD; remove pending tx', async t => {
371371
forwardOpts: {
372372
intermediateRecipient: {
373373
chainId: 'noble-1',
374+
encoding: 'bech32',
374375
value: 'noble1test',
375376
},
376377
},
@@ -445,6 +446,7 @@ test('skip advance: forward to EUD; remove pending tx', async t => {
445446
forwardOpts: {
446447
intermediateRecipient: {
447448
chainId: 'noble-1',
449+
encoding: 'bech32',
448450
value: 'noble1test',
449451
},
450452
},

0 commit comments

Comments
 (0)