-
Notifications
You must be signed in to change notification settings - Fork 229
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
Excise reallocate()
#10871
Excise reallocate()
#10871
Conversation
Deploying agoric-sdk with
|
Latest commit: |
c522d55
|
Status: | ✅ Deploy successful! |
Preview URL: | https://19e59eaf.agoric-sdk.pages.dev |
Branch Preview URL: | https://6679-excisereallocate.agoric-sdk.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks ok from a quick skim.
I should think it thru some more before approving
// Removed. See #6679 | ||
if (zcfBaggage.has('zcfSeatToStagedAllocations')) { | ||
zcfBaggage.delete('zcfSeatToStagedAllocations'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So all of the relevant state is in a side table? There's no exo state schema evolution monkey business?
That's awfully convenient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the deprecated form of reallocate()
was the second design, and so ended up ini baggage rather than state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a regular map, should we assert that the map is empty before throwing away state?
And to ensure we don't run into this case, have we checked that all collections are empty on known chains?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a regular map, should we assert that the map is empty before throwing away state?
The state is never valuable.
- it contains proposed allocations, so the contents are amounts and not assets
- Best practices is (and has been for a year) to use
atomicRearrange
rather thanreallocate
. If a contract we don't know about still has staged allocations, this update would make them unusable.
And to ensure we don't run into this case, have we checked that all collections are empty on known chains?
I've made sure that all contracts that we know about don't use reallocate
. Contracts that don't use reallocate
, can't make productive use of the collection.
There aren't any contracts that we don't know about running on durable chains. If third parties have code in draft that still follows the old approach, this will help them modernize before they get to a chain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding upgrade considerations, removing a deprecated API is I think safe if we've checked that no currently deployed contract uses it.
Technically we should be able to remove a ZCF API like this even if a contract were using it since a null upgrade of a vat doesn't currently bump the zcf bundle, and picking up the change would be an explicit upgrade / restart of the contract.
packages/zoe/docs/AttackGuide.md
Outdated
@@ -18,6 +18,8 @@ The main focus of most threats would be a breach of one of Zoe's core invariants | |||
|
|||
## Reallocation | |||
|
|||
THIS SECTION IS OBSOLETE. We've converted all code to use attomicRearrange |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THIS SECTION IS OBSOLETE. We've converted all code to use attomicRearrange | |
THIS SECTION IS OBSOLETE. We've converted all code to use atomicRearrange |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still applicable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose we have coverage of basic upgrade functionality through some other test (preferably something lighter than an integration test)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we don't.
In order to test upgrading a contract from one version of ZCF to another, we'd need to be able to do what I call time-travel testing, or maintain two different versions of ZCF to install within a single test. We can do that in agoric-3-proposals
to represent the change from a past version to the current version, or in a3p-integration
to represent the change from the current-on-chain version to this new one. But otherwise, any unit test or bootstrap test would be testing a move from the current version to itself, which is no change at all.
The test would be straightforward to add to a3p-integration
. It would call E(zoeConfigFacet).updateZcfBundleId(newBundleId)
, early in the upgrade process, and then any vat that gets upgraded later will use the new ZCF. The tests in p::upgrade-19
exercise ZCF enough to show that the upgrade will be successful.
I'll add that to the tests, and also add the update to the staged changes in upgrade.go
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we had the ability to do a fake livelsots test of a single contract? I suppose any interaction with Zoe is a problem for such a test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bootstrap tests (in packages/boot/test/bootstrapTests
) have the ability to test a contract running in a vat, and interacting with the standard set of vats started up using the whole bootstrap mechanism. It's hard to use these tests to do upgrade tests from one version of code to another because they get their code from agoric-sdk
directly. So using this to compare what happens when upgrading from one version of ZCF to another would also be problematic.
This PR has now been rebased on top of the repaired Upgrade 19 (#10947). On top of that, it now installs a new version of ZCF early in the cycle. From the logs, I can see that the contracts that get installed or upgraded after that get the new version of ZCF.
Since the U19 upgrade repairs also ensured that the acceptance tests are now running on the upgraded versions of the contracts, we can also be sure that everything that is tested in the acceptance tests is running against upgraded contracts.
// Removed. See #6679 | ||
if (zcfBaggage.has('zcfSeatToStagedAllocations')) { | ||
zcfBaggage.delete('zcfSeatToStagedAllocations'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a regular map, should we assert that the map is empty before throwing away state?
And to ensure we don't run into this case, have we checked that all collections are empty on known chains?
b6231b6
to
f36e8e7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but I'll defer approval to someone closer to this part of the system
golang/cosmos/app/upgrade.go
Outdated
// Register a new ZCF to be used for all future contract instances and upgrades | ||
vm.CoreProposalStepForModules( | ||
"@agoric/builders/scripts/vats/upgrade-zcf.js", | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not apply this before the wallet factory upgrade so that vat can pick up the new zcf too?
packages/zoe/docs/AttackGuide.md
Outdated
@@ -18,6 +18,8 @@ The main focus of most threats would be a breach of one of Zoe's core invariants | |||
|
|||
## Reallocation | |||
|
|||
THIS SECTION IS OBSOLETE. We've converted all code to use attomicRearrange |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still applicable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10f3624
to
c522d55
Compare
This pull request has been removed from the queue for the following reason: The merge conditions cannot be satisfied due to failing checks: You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. If you want to requeue this pull request, you need to post a comment with the text: |
closes: #6679
Description
Removes the last vestiges of
zcf.reallocate()
and staged allocations.Security Considerations
The deprecated code turned out to be a bug farm. We've had no problems with the replacement.
Scaling Considerations
None.
Documentation Considerations
A separate PR (Docs:#1266) will remove the documentation. It has been marked deprecated for quite some time.
Testing Considerations
Removed tests. All the new code (using
atomicRearrange
) has had tests all along.Upgrade Considerations
No known code uses the deprecated functionality. These changes are confined to ZCF. It won't matter when or if Zoe gets upgraded. The next time we bump the ZCF version, new and upgraded contracts will start using the new ZCF, but there's no hurry to make that happen.