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

feat: add the ability to override param values #9829

Merged
merged 2 commits into from
Aug 13, 2024
Merged

Conversation

Chris-Hibbert
Copy link
Contributor

closes: #9596
refs: #9748

Description

When upgrading VaultFactory, restore the VaultDirector's parameters to the values that exist on chain.

Security Considerations

No particular security implications.

Scaling Considerations

Run only on upgrade. No impact.

Documentation Considerations

No user visible impact.

Testing Considerations

being tested manually thoroughly. The change to typeParamManager.js has a unit test.

Upgrade Considerations

Make it possible to preserve values that have been updated on chain. It would have been bad to lose the updated value of ReferencedUI.

@Chris-Hibbert Chris-Hibbert added Governance Governance contract-upgrade Vaults VaultFactor (née Treasury) labels Aug 2, 2024
@Chris-Hibbert Chris-Hibbert self-assigned this Aug 2, 2024
Copy link

cloudflare-workers-and-pages bot commented Aug 2, 2024

Deploying agoric-sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: ef2963a
Status: ✅  Deploy successful!
Preview URL: https://99b9e963.agoric-sdk.pages.dev
Branch Preview URL: https://9596-vaultdirparams.agoric-sdk.pages.dev

View logs

@Chris-Hibbert Chris-Hibbert requested a review from dckc August 5, 2024 17:05
Copy link
Member

@dckc dckc left a comment

Choose a reason for hiding this comment

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

This says "closes: #9596"; the test plan there says "Test if a3p-integration. Verify that the values are restored." I don't see that here. Did that turn out to be prohibitively expensive?

Also, I need to know more about (what looks like) busy-waiting before approving.

Comment on lines +97 to +103
while (AmountMath.isEmpty(value.current.MinInitialDebt.value)) {
({ value, updateCount } = await notifier.getUpdateSince(updateCount));
trace(
`minInitialDebt was empty, retried`,
value.current.MinInitialDebt.value,
);
}
Copy link
Member

Choose a reason for hiding this comment

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

this looks busy-waiting. it that on purpose? add a comment about why that's ok?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not quite busy waiting. Each time through, it asks for the next update (getUpdateSince(updateCount)). The expectation is that the zero'th might be empty, but the successive update should have a value. It might be better to back off just once and then give up, rather than waiting in a loop.

@@ -85,6 +85,32 @@ export const upgradeVaults = async (powers, { options }) => {
}
}

const restoreDirectorParams = async () => {
Copy link
Member

Choose a reason for hiding this comment

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

This seems to get/query the params, not restore them. Or am I mis-reading it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are correct. I'll rename this to readCurrentDirectorParams. Restoring them happens because they're included in newPrivateArgs, which is passed to upgradeContract.

@Chris-Hibbert
Copy link
Contributor Author

This says "closes: #9596"; the test plan there says "Test if a3p-integration. Verify that the values are restored." I don't see that here. Did that turn out to be prohibitively expensive?

I did test manually once by changing the ReferencedUI to something visibly different and seeing that the value was passed through. I didn't leave a regression test behind for vaultDirector, since the only way to exercise upgrades for vaultDirector is in a3p, which is expensive. (perhaps also runUtils?) I also added a test in governance that makeParamManagerFromTerms() supports overrides, and this is how the director passes it through.

@Chris-Hibbert Chris-Hibbert added the automerge:rebase Automatically rebase updates, then merge label Aug 12, 2024
@Chris-Hibbert Chris-Hibbert changed the base branch from 9584-upgradeVaults to master August 12, 2024 20:23
@Chris-Hibbert
Copy link
Contributor Author

@Mergifyio refresh

Copy link
Contributor

mergify bot commented Aug 12, 2024

refresh

✅ Pull request refreshed

@frazarshad frazarshad added automerge:rebase Automatically rebase updates, then merge and removed automerge:rebase Automatically rebase updates, then merge labels Aug 13, 2024
When upgrading a contract, some parameter values originally defined
based on terms must be overridden by values supplied via
privateArgs. This provides a path to supply those overrides when
creating the new paramManager.

The vaultFactory uses this new feature to pass values through.

The proposal to upgrade vaultFactory gets the current values as
updated by governance and passes them in when upgrading.
@frazarshad frazarshad removed the automerge:rebase Automatically rebase updates, then merge label Aug 13, 2024
@Chris-Hibbert Chris-Hibbert added the automerge:rebase Automatically rebase updates, then merge label Aug 13, 2024
@Chris-Hibbert
Copy link
Contributor Author

@Mergifyio refresh

Copy link
Contributor

mergify bot commented Aug 13, 2024

refresh

✅ Pull request refreshed

@mergify mergify bot merged commit b9f5667 into master Aug 13, 2024
99 of 103 checks passed
@mergify mergify bot deleted the 9596-vaultDirParams branch August 13, 2024 17:03
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 Governance Governance Vaults VaultFactor (née Treasury)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When upgrading vaultFactory, retain old values of vaultDirector governed params
3 participants