-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
8722 provisionPool re-register notifiers (#9481)
fixes: #8722 fixes: #8724 fixes: #8238 ## Description Upgrade provisionPool so its notifiers are robust to upgrades. ### Security Considerations This is about soundness of the chain and its services. ### Scaling Considerations N/A ### Documentation Considerations No change to functionality. ### Testing Considerations Includes a test in `a3p-integration` that demonstrates that provisionPool will survive its own or vat-bank's upgrade. ### Upgrade Considerations See above.
- Loading branch information
Showing
16 changed files
with
412 additions
and
305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
a3p-integration/proposals/a:upgrade-next/localchain.test.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
a3p-integration/proposals/a:upgrade-next/priceFeed-follower-auction.test.js
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
a3p-integration/proposals/a:upgrade-next/probeZcfBundleCap.test.js
This file was deleted.
Oops, something went wrong.
102 changes: 102 additions & 0 deletions
102
a3p-integration/proposals/a:upgrade-next/provisionPool.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
// @ts-check | ||
|
||
import test from 'ava'; | ||
|
||
import { | ||
evalBundles, | ||
getIncarnation, | ||
waitForBlock, | ||
} from '@agoric/synthetic-chain'; | ||
|
||
import { bankSend, getProvisionPoolMetrics } from './agd-tools.js'; | ||
|
||
const NULL_UPGRADE_BANK_DIR = 'upgrade-bank'; | ||
const UPGRADE_PP_DIR = 'upgrade-provisionPool'; | ||
const ADD_LEMONS_DIR = 'add-LEMONS'; | ||
const ADD_OLIVES_DIR = 'add-OLIVES'; | ||
|
||
const USDC_DENOM = | ||
'ibc/295548A78785A1007F232DE286149A6FF512F180AF5657780FC89C009E2C348F'; | ||
const PROVISIONING_POOL_ADDR = 'agoric1megzytg65cyrgzs6fvzxgrcqvwwl7ugpt62346'; | ||
|
||
/** | ||
* @file | ||
* The problem to be addressed is that provisionPool won't correctly handle | ||
* (#8722) deposit of assets after it (provisionPool) is upgraded or (#8724) | ||
* new asset kinds after vat-bank is upgraded. | ||
* | ||
* To test this, we will | ||
* | ||
* 1. See that we can add USDC. | ||
* | ||
* 2. Null upgrade vat-bank, and see that we can add a new collateal. | ||
* | ||
* 2a. Not null upgrade provisionPool, since it would fail. If it had succeeded, | ||
* we would have been able to observe the effect of #8724, which would have | ||
* caused addition of new currencies to be ignored. | ||
* | ||
* 3. Do a full upgrade of provisionPool; then deposit USDC, and see IST | ||
* incremented in totalMintedConverted. | ||
* | ||
* 4. Null upgrade vat-bank again, and then see (in logs) that adding a new | ||
* asset type gives the ability to make deposits. We don't actually add it | ||
* because it would be too much work to add a faucet or other ability to mint | ||
* the new collateral. | ||
*/ | ||
|
||
const contributeToPool = async (t, asset, expectedToGrow) => { | ||
const metricsBefore = await getProvisionPoolMetrics(); | ||
console.log('PPT pre', metricsBefore); | ||
|
||
await bankSend(PROVISIONING_POOL_ADDR, asset); | ||
|
||
const metricsAfter = await getProvisionPoolMetrics(); | ||
console.log('PPT post', metricsAfter); | ||
t.is( | ||
metricsAfter.totalMintedConverted.brand, | ||
metricsBefore.totalMintedConverted.brand, | ||
'brands match', | ||
); | ||
if (expectedToGrow) { | ||
// I couldn't import AmountMath. dunno why. | ||
t.true( | ||
metricsAfter.totalMintedConverted.value > | ||
metricsBefore.totalMintedConverted.value, | ||
'brands match', | ||
); | ||
} else { | ||
t.equal( | ||
metricsAfter.totalMintedConverted.value, | ||
metricsBefore.totalMintedConverted.value, | ||
); | ||
} | ||
}; | ||
|
||
test('upgrading provisionPool and vat-bank', async t => { | ||
t.log('add assets before'); | ||
await contributeToPool(t, `10000${USDC_DENOM}`, true); | ||
|
||
t.log(`upgrade Bank`); | ||
await evalBundles(NULL_UPGRADE_BANK_DIR); | ||
|
||
const firstIncarnation = await getIncarnation('bank'); | ||
t.is(firstIncarnation, 1); | ||
|
||
await evalBundles(ADD_LEMONS_DIR); | ||
|
||
t.log('full upgrade ProvisionPool'); | ||
await evalBundles(UPGRADE_PP_DIR); | ||
const ppIncarnation = await getIncarnation('db93f-provisionPool'); | ||
t.is(ppIncarnation, 1); | ||
|
||
await contributeToPool(t, `30000${USDC_DENOM}`, true); | ||
|
||
t.log(`Add assets after bank upgrade`); | ||
await evalBundles(NULL_UPGRADE_BANK_DIR); | ||
await waitForBlock(2); | ||
|
||
const secondIncarnation = await getIncarnation('bank'); | ||
t.is(secondIncarnation, 2); | ||
|
||
await evalBundles(ADD_OLIVES_DIR); | ||
}); |
51 changes: 0 additions & 51 deletions
51
a3p-integration/proposals/a:upgrade-next/provisioning.test.js
This file was deleted.
Oops, something went wrong.
134 changes: 0 additions & 134 deletions
134
a3p-integration/proposals/a:upgrade-next/upgradeVaults.test.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.