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

upgrade scaledPriceAuthorities #9382

Merged
merged 3 commits into from
May 24, 2024
Merged

upgrade scaledPriceAuthorities #9382

merged 3 commits into from
May 24, 2024

Conversation

Chris-Hibbert
Copy link
Contributor

refs: #8400
refs: #8498
closes: #9371

Description

#8400 reported that the priceFeed vats hold onto old quotes in their recoverySet, preventing them from being collected. #9283 applied the fixes to master. These fixes address the growth in priceFeed vats and Zoe, but scaledPriceAuthorities were still growing. This resolves that problem by upgrading scaledPriceAuthority contracts to not use their recoverySets.

Expand for performance graphs image

Kernel allocation is in blue, and the scale is on the left. It varies from 48862 to 49743, with a small amount of long-term growth.The other active vats (v9=Zoe, v29=ATOM-USD_priceFeed, v43=wallet, 72=ATOM-USD_priceFeed, 74=auctioneer) use the scale on the right, with Zoe varying tightly around 3600, and the others low and stable.

scaledPriceAuthority-ATOM doesn't have enough variation to be worth graphing.

Security Considerations

Upgrade existing contracts. No new vulnerabilities.

Scaling Considerations

This addresses the largest known category of growth on the chain.

Documentation Considerations

Add some documentation on creating proposals.

Testing Considerations

Tested in A3P. We should exercise all the clients of priceFeeds in our test environments.

Upgrade Considerations

This PR includes a proposal that will upgrade all vats with scaledPriceAuthority in their label. That should work on or test chains as well as MainNet. These changes should be included in the next release.

@Chris-Hibbert Chris-Hibbert added ERTP package: ERTP contract-upgrade oracle Related to on-chain oracles. next-release about next agoric-sdk or endo release labels May 18, 2024
@Chris-Hibbert Chris-Hibbert self-assigned this May 18, 2024
Comment on lines 125 to 127
// if the existing state was 'hasRecoverySets' and recoverySetsOption is
// 'noRecoverySets', then we'll leave the old recoverySet in place, but not
// add to it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had some difficulty making sense of this. It's not really about the option matrix, because oldRecoverySetsState is ignored if recoverySetsOption == noRecoverySets`.

Suggested change
// if the existing state was 'hasRecoverySets' and recoverySetsOption is
// 'noRecoverySets', then we'll leave the old recoverySet in place, but not
// add to it.
// Extant sets are never deleted. If the new option is 'noRecoverySets', they won't
// be used but extant ones will remain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Never" is too strong. The expectation is that we will find a way to delete the old objects in a controlled fashion, but we have to preserve the membership in the set in order to do so.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for the record, #8498 did such incremental deletion. Its deletion logic could be revived. If it is, the 'noRecoverySets' option should be adequate to engage it, rather than requiring yet another options setting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I last discussed this with @warner, he pointed out that those deletions and their consequences that cascade through the kernel to other vats are gated by GC passes, and bring-out-your-dead phases. The effects of that buffering is that a deletions every so often in Zoe or some other vat might be saved up by the kernel and passed en masse to some other vat which might be overwhelmed. Until there's better support for regulating the flow of such updates between the kernel and downstream vats, he prefers that we not do mass deletions even at a slow rate.

@@ -1,7 +1,24 @@
# Proposals

These are code snippets that go into propoals to the BLDer DAO to start the Inter Protocol.
These scripts are referenced by proposals to the BLDer DAO to run on the chain.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This documentation is good. It strikes me as not specific to inter-protocol.

Consider putting it in deploy-script-support and referencing that here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea.

Copy link

cloudflare-workers-and-pages bot commented May 20, 2024

Deploying agoric-sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: 04ba2b5
Status: ✅  Deploy successful!
Preview URL: https://ff4bbe76.agoric-sdk.pages.dev
Branch Preview URL: https://8400-upgradescaledpas.agoric-sdk.pages.dev

View logs

@Chris-Hibbert
Copy link
Contributor Author

@erights, when you return, I'd appreciate a quick glance to approve the ERTP change.

Copy link
Member

@erights erights left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erights, when you return, I'd appreciate a quick glance to approve the ERTP change.

Thanks for checking.

ERTP changes LGTM. I did not look at the rest, so my approval is only scoped to that. But I see you already have a general approval, so you're clear to merge.

@Chris-Hibbert Chris-Hibbert added the automerge:rebase Automatically rebase updates, then merge label May 24, 2024
@mergify mergify bot merged commit 0270908 into master May 24, 2024
63 checks passed
@mergify mergify bot deleted the 8400-upgradeScaledPAs branch May 24, 2024 21:54
mergify bot added a commit that referenced this pull request Jun 26, 2024
refs: #9382
refs: #9584

## Description

Add a test that was supposed to be in #9283, where it says 

> A3P tests that verify that vaultFactory has been upgraded, that a new Auctioneer is running and is receiving prices. Verify that when prices drop, assets are sold via the auction, the bidder gets the proceeds, and the vaults are liquidated or reconstituted appropriately.

It was too hard to verify the results of the auction, because of the timing of vault liquidations and auction runs, so the actual check was dropped. 

The subsequent PR (#9371) that upgraded scaledPriceAuthorities seems to have broken the upgrade, and the missing test failed to warn us.

Here we test that vaultFactory was actually upgraded by verifying that it's getting prices from the new price feeds, and drop the upgrade of scaledPriceAuthority until we can figure out how to make that upgrade compatible.

### Security Considerations

Not relevant

### Scaling Considerations

Drops the upgrade of scaledPriceAuthority, which fixed part of the memory growth. This was the smaller portion of the growth, so it's more important to get the rest of the fixes in than to also include this.

### Documentation Considerations

None.

### Testing Considerations

Replaces a missing test.

### Upgrade Considerations

Repairs upgrade.
mhofman pushed a commit that referenced this pull request Jun 26, 2024
refs: #9382
refs: #9584

## Description

Add a test that was supposed to be in #9283, where it says 

> A3P tests that verify that vaultFactory has been upgraded, that a new Auctioneer is running and is receiving prices. Verify that when prices drop, assets are sold via the auction, the bidder gets the proceeds, and the vaults are liquidated or reconstituted appropriately.

It was too hard to verify the results of the auction, because of the timing of vault liquidations and auction runs, so the actual check was dropped. 

The subsequent PR (#9371) that upgraded scaledPriceAuthorities seems to have broken the upgrade, and the missing test failed to warn us.

Here we test that vaultFactory was actually upgraded by verifying that it's getting prices from the new price feeds, and drop the upgrade of scaledPriceAuthority until we can figure out how to make that upgrade compatible.

### Security Considerations

Not relevant

### Scaling Considerations

Drops the upgrade of scaledPriceAuthority, which fixed part of the memory growth. This was the smaller portion of the growth, so it's more important to get the rest of the fixes in than to also include this.

### Documentation Considerations

None.

### Testing Considerations

Replaces a missing test.

### Upgrade Considerations

Repairs upgrade.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:rebase Automatically rebase updates, then merge contract-upgrade ERTP package: ERTP next-release about next agoric-sdk or endo release oracle Related to on-chain oracles.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

upgrade scaledPriceAuthorities; measure impact
3 participants