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

vaultFactory contract not upgradable #8079

Closed
Tracked by #7954
turadg opened this issue Jul 21, 2023 · 3 comments · Fixed by #9283
Closed
Tracked by #7954

vaultFactory contract not upgradable #8079

turadg opened this issue Jul 21, 2023 · 3 comments · Fixed by #9283
Assignees
Labels
bug Something isn't working Vaults VaultFactor (née Treasury)

Comments

@turadg
Copy link
Member

turadg commented Jul 21, 2023

Describe the bug

The vaultFactory contract in master fails upgrading the vaultFactory contract deployed to mainnet (simulated in docker upgrade-test scripts). There are multiple hurdles. (TO INCLUDE)

To Reproduce

Steps to reproduce the behavior:

  1. check out 555b517 (from WIP: in VaultFactory, move auctioneer public facet from terms to private args #8049)
  2. in packages/deployment/upgrade-tests: make build run
  3. bundle the vault factory outside the container: bundle-source --cache-json /tmp packages/inter-protocol/src/vaultFactory/vaultFactory.js vaultFactory and then docker cp /tmp/bundle-vaultFactory.json $CONTAINERID:/tmp where $CONTAINERID is from docker ps.
  4. inside the container, use upgrade scripts from outside the container: mv upgrade-test-scripts xx-scripts; ln -s /workspace/upgrade-test-scripts
  5. mint some IST to cover the cost of installing the bundles on chain: . ./upgrade-test-scripts/agoric-upgrade-11/mint-ist.sh
  6. run the upgrade script from within docker at /usr/src/agoric-sdk: ./upgrade-test-scripts/agoric-upgrade-11/auctioneer-upgrade-driver.sh
  7. see various errors (details in comments below), though the kernel reports the contract vat is upgraded and the core eval script does report successful completion.

Expected behavior

vault factory upgrade does not produce errors; contract works after upgrade

Platform Environment

  • what OS are you using? linux, macos. what version of Node.js? whatever's in the upgrade-test docker stuff
  • is there anything special/unusual about your platform? upgrade-test docker stuff
  • what version of the Agoric-SDK are you using? 555b517

Additional context

work on upgrading vault factory to connect to a different auctioneer: #8049

Screenshots

We have a more complete log file internally.

@turadg turadg added bug Something isn't working Vaults VaultFactor (née Treasury) labels Jul 21, 2023
@turadg turadg self-assigned this Jul 21, 2023
@dckc
Copy link
Member

dckc commented Jul 21, 2023

problem: stabilityFeeSnapshot vs interestSnapshot (fix available)

  • symptoms: Error: durable Kind stateShape mismatch (body) (full stacktrace below)
  • diagnosis: while renaming interest rate to stability fee (IOU issue ref), we didn't account for migration. The migration code would include the term interestSnapshot anyway, so the benefit of doing the migration is small. And changing exo state shapes isn't supported yet (IOU issue ref).
  • treatment: rename stabilityFeeSnapshot back to interestSnapshot (2a447fc + 3f2fb04)
full stacktrace
2023-07-20T18:12:25.898Z SwingSet: xsnap: v48: Error#1: durable Kind stateShape mismatch (body)
2023-07-20T18:12:25.898Z SwingSet: xsnap: v48: Error: durable Kind stateShape mismatch (body)
 at construct ()
 at Error (/bundled-source/.../node_modules/ses/src/error/tame-error-constructor.js:56)
 at makeError (/bundled-source/.../node_modules/ses/src/error/assert.js:243)
 at fail (/bundled-source/.../node_modules/ses/src/error/assert.js:357)
 at insistSameCapData (/bundled-source/.../packages/swingset-liveslots/src/virtualObjectManager.js:287)
 at defineKindInternal (/bundled-source/.../packages/swingset-liveslots/src/virtualObjectManager.js:807)
 at defineDurableKindMulti (/bundled-source/.../packages/swingset-liveslots/src/virtualObjectManager.js:1186)
 at prepareVault (.../inter-protocol/src/vaultFactory/vault.js:870)
 at prepareVaultManagerKit (.../inter-protocol/src/vaultFactory/vaultManager.js:184)
 at prepareVaultDirector (.../inter-protocol/src/vaultFactory/vaultDirector.js:235)
 at provideDirector (.../inter-protocol/src/vaultFactory/vaultDirector.js:533)
 at prepare (.../inter-protocol/src/vaultFactory/vaultFactory.js:131)
 at ()
 at ()

@dckc
Copy link
Member

dckc commented Jul 21, 2023

problem(s): timestamp / oracle price, invitation (undiagnosed)

full timestamp / oracle price stacktraces
2023-07-20T19:35:16.818Z SwingSet: vat: v48: Error: timestamp: (an undefined) - Must be a copyRecord to match a copyRecord pattern: (an object)                                                          
 at construct ()                                                                                    
 at Error (/bundled-source/.../node_modules/ses/src/error/tame-error-constructor.js:56)                                                                                                                  
 at makeError (/bundled-source/.../node_modules/ses/src/error/assert.js:243)                        
 at throwLabeled (.../patterns/src/utils.js:132)                                                    
 at applyLabelingError (.../patterns/src/utils.js:154)                                              
 at mustMatch (.../patterns/src/patterns/patternMatchers.js:528)                                    
 at absValue (.../time/src/timeMath.js:110)                                                         
 at subtractAbsAbs (.../time/src/timeMath.js:164)                                                   
 at calculateReportingPeriod (.../inter-protocol/src/interest.js:98)                                
 at chargeInterest (.../inter-protocol/src/interest.js:181)                                         
 at chargeAllVaults (.../inter-protocol/src/vaultFactory/vaultManager.js:449)                       
 at chargeAllVaults (.../inter-protocol/src/vaultFactory/vaultManager.js:415)                       
 at apply ()                                      
 at apply ()                                      
 at In "chargeAllVaults" method of (VaultManagerKit helper) (/bundled-source/.../node_modules/@endo/exo/src/exo-tools.js:42)                                                                             
 at updateState (.../inter-protocol/src/vaultFactory/vaultManager.js:371)                           
 at (.../notifier/src/asyncIterableAdaptor.js:63)                                                   
 at ()

and

2023-07-20T19:35:17.227Z SwingSet: ls: v48: Error: lockOraclePrices called before a collateral quote was available                                                                                       
 at construct ()                                  
 at Error (/bundled-source/.../node_modules/ses/src/error/tame-error-constructor.js:56)                                                                                                                  
 at makeError (/bundled-source/.../node_modules/ses/src/error/assert.js:243)                        
 at fail (/bundled-source/.../node_modules/ses/src/error/assert.js:357)                             
 at lockOraclePrices (.../inter-protocol/src/vaultFactory/vaultManager.js:1037)                     
 at apply ()                                      
 at apply ()                                      
 at In "lockOraclePrices" method of (VaultManagerKit self) (/bundled-source/.../node_modules/@endo/exo/src/exo-tools.js:42)                                                                              
 at allManagersDo (.../inter-protocol/src/vaultFactory/vaultDirector.js:257)                        
 at (.../inter-protocol/src/vaultFactory/vaultDirector.js:440)                                      
 at apply ()                                      
 at apply ()                                      
 at dispatchToHandler (/bundled-source/.../node_modules/@endo/eventual-send/src/handled-promise.js:163)                                                                                                  
 at win (/bundled-source/.../node_modules/@endo/eventual-send/src/handled-promise.js:511)                                                                                                                
 at ()
invitation stacktrace
2023-07-20T19:35:16.253Z SwingSet: ls: v9: Logging sent error stack (Error#6)                                                                                                                            
2023-07-20T19:35:16.253Z SwingSet: ls: v9: Error#6: A Zoe invitation is required, not Object [Alleged: Zoe Invitation payment] {}                                                                        
2023-07-20T19:35:16.253Z SwingSet: ls: v9: Error: A Zoe invitation is required, not (an object)                                                                                                          
 at construct ()                                                                                                                                                                                         
 at Error (/bundled-source/.../node_modules/ses/src/error/tame-error-constructor.js:56)                                                                                                                  
 at makeError (/bundled-source/.../node_modules/ses/src/error/assert.js:243)                                                                                                                             
 at onRejected (.../zoe/src/zoeService/invitationQueries.js:11)                                                                                                                                          
 at ()

SHORTFALL_INVITATION_KEY is another suspect (in addition to electorate):

2023-07-20T21:55:58.022Z SwingSet: vat: v48: 🛠️ updateShortfallReporter failed during start(); repair by updating governance (RemoteError(error:liveSlots:v9#70017)#1)

this seems odd; it doesn't make a new invitation:

    const newInvitation = await directorParamManager.getInternalParamValue(
      SHORTFALL_INVITATION_KEY,
    );

@Chris-Hibbert
Copy link
Contributor

#9283 demonstrates that vaults are upgradeable.

mergify bot added a commit that referenced this issue May 6, 2024
closes: #8049
closes: #8740
closes: #8868
closes: #8918
closes: #8981
closes: #8079
refs: #8400
closes: #8735
closes: #7873
closes: #8726
closes: #7954
closes: #8757
closes: #8728 
closes: #8789

## Description

Upgrade **VaultFactory** in A3P, relying on the new PriceFeeds, and
auctions. The actual upgrade waits for the priceFeeds to start supplying
before doing the upgrade, so there won't be any gap in priceUpdates.

When the upgrade is finished, we also update the auctioneerKit and
Auction instance in the bootstrap environment.

This PR demonstrates that VaultFactory can be upgraded even though
governance is not persistent (#8123).

### Security Considerations

N/A

### Scaling Considerations

This is largely in service of #8400, which reports that priceFeed vats
are accumulating garbage. This PR switches to new priceFeeds, which
won't have that problem, though cleaning up the existing vats is a task
for the future.

### Documentation Considerations

No changes to user-visible behavior.

### Testing Considerations

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.

### Upgrade Considerations

Upgrade all the vats!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Vaults VaultFactor (née Treasury)
Projects
None yet
3 participants