0xpatrickdev / agoric-vault-collateral-proposal

CoreEval Proposal and Permits for Inter Vault Collateral Type
0 stars 3 forks source link

priceAggregator, scaledPriceAuthority contracts are already installed #7

Closed dckc closed 11 months ago

dckc commented 1 year ago

https://github.com/0xpatrickdev/agoric-vault-collateral-proposal/blob/1aa1b7036c3cf349ea9fb342f1474b53d1cf0a3f/add-stATOM-oracles.js#L41-L42

The installation is already available as { ... installation: { consume { priceAggregator } } }.

We should be able to take this part of price-feed-proposal.js out:

  installations: {
    // ??? will every eval of price-feed-proposal install priceAggregator ?
    priceAggregator: restoreRef(priceFeedOptions.priceAggregatorRef),
  },

likewise in addAssetToVault.js:

    installations: {
      scaledPriceAuthority: restoreRef(scaledPriceAuthorityRef),
    },
dckc commented 11 months ago

This has substantial impact on the cost (in IST) of deploying. Let's see if we can reduce that 10k IST estimate substantially.

I have a list of mainnet1B-bundle-ids.md that are already on chain. I guess you should have the same info in a devnet node.

When you have deployed recently, what's the size of the bundles that needed to go on chain? Do you have tx ids handy?

cc @otoole-brendan @rowgraus

dckc commented 11 months ago

revised estimate: 4761.172 IST (pending confirmation of bundle hashes)

since we can exclude scaledPriceAuthority and fluxAggregator

cost (IST) bundle entry tx hash
1924.306 {"compartment":"@agoric/inter-protocol-v0.16.1","module":"./src/proposals/price-feed-proposal.js"} 7E399842D6D84BF3AF2EE06B1123E3AFDD7BFCA57DC2F613D6CE8D02FA4D28D5
2676.186 {"compartment":"@agoric/inter-protocol-v0.16.1","module":"./src/price/fluxAggregatorContract.js"} 372516A73184B341BD50C7D31541942984841BCA8ECB6B102F47DF2962817109
2246.226 {"compartment":"@agoric/zoe-v0.26.2","module":"./src/contracts/scaledPriceAuthority.js"} 0FABE0DE0C0C11FAA449F479646F3887F997664D3AD699E894AA5743A0991FE7
2836.866 {"compartment":"@agoric/inter-protocol-v0.16.1","module":"./src/proposals/addAssetToVault.js"} B98BC6AB60644A179542C9CEC593A6900D4A7A801149FCB8A83AC10F8B65AAF2
dckc commented 11 months ago

fluxAggregator contract bundle changed between stATOM2 and stATOM3

perhaps due to...

cc @turadg

Neither is the same bundle as any on mainnet. mainnet1B-bundle-ids.md

We really should tweak the proposal so it uses the already-installed fluxAggregator contract installation (called priceAggregator in agoricNames.installation).

cost (IST) bundle entry bundle hash time tx hash
2677.362 {"compartment":"@agoric/inter-protocol-v0.16.1","module":"./src/price/fluxAggregatorContract.js"} a190115d105bd5d7041f2981a89e9a9294c57ecd5706772a75839a65d70a530ace7a3670234e486fed05a03d84749034e77bdafcbd6f357d2770788397fd7fc8 2023-10-12 16:35:57 EFC9A23E130775530A5DFC6A8D08CFF26F2DD0E4E65E161CA04508C2EE1F1016

stATOM3 bundles on an explorer

https://devnet.agoric.explorers.guru/account/agoric15xddzse9lq74cyt6ev9d7wywxerenxdgxsdc3m is handy:

image

dckc commented 11 months ago

agoricdev-23 contract bundles don't match mainnet

ugh... starting devnet on agoric-upgrade-11 (Sep 5) doesn't actually match mainnet. mainnet started on mainnet1B-rc3 (Jun 9) and upgraded to -11.

In particular, the fluxAggregator bundle is from 1B

priceAggregator contract hash on agoricdev-23 doesn't match any in mainnet1B-bundle-ids.md

From ps, we get b1-18d59 from v30:zcf-b1-18d59-ATOM-USD_price_feed, which we can match with the bundles table in the kernel swingstore:

root@validator-0:/state# ps ax | grep -e '-ATOM-USD_price_feed '
 353402 ?        S      0:01 /usr/src/agoric-sdk/packages/xsnap/xsnap-native/xsnap/build/bin/lin/release/xsnap-worker v30:zcf-b1-18d59-ATOM-USD_price_feed -r @8:v30-5660
root@validator-0:/state# sqlite3 agoricdev-23/data/agoric/swingstore.sqlite '.mode column' '.header on' "select bundleId from bundles where bundleId like 'b1-18d59%'"
bundleID                                                                                                                           
-----------------------------------------------------------------------------------------------------------------------------------
b1-18d599100b4a9f65827bc1a0bddbe3532e8061220074961587677d04a6f52abacb7c87a6b552102539b630af4184705cfb34b56e23de718e99d17591aeb87e40
dckc commented 11 months ago

Mainnet fluxAggregator: b1-4522b... scaledPriceAuthority: b1-0b217...

I was able to build bundles from mainnet1B-rc3 that matches a hash in mainnet1B-bundle-ids.md:

  bundle file bundle hash date   release git hash
  inter-protocol/bundles/bundle-fluxAggregatorKit.js 4522bd0b71b615b612235d321977a1e906cd289e0962b106e7ba5718d0e94e25bc2c9e4be589c513c05c337c25a0c89c527b91322415cc80337fb2b2b0ccb75a 2023-06-09   mainnet1B-rc3 ba3b77644
  inter-protocol/bundles/bundle-scaledPriceAuthority.js 0b2177975e88c7221b2fe635fdc75f518916ee42d959e9772dc77ef9775995f36cef50578a070708606e2c2431e66ee51d01147b10821aa5f1983e564697cccd 2023-06-09   mainnet1B-rc3 ba3b77644
dckc commented 11 months ago

We really should tweak the proposal so it uses the already-installed fluxAggregator contract installation (called priceAggregator in agoricNames.installation).

In particular, this permit to add/replace any entry in agoricNames.installation should not be granted:

https://github.com/0xpatrickdev/agoric-vault-collateral-proposal/blob/c94d3fd353e60382c2a18ae8e484c1ecdc53fbc6/add-stATOM-oracles-permit.json#L29-L31

likewise, nor this one:

https://github.com/0xpatrickdev/agoric-vault-collateral-proposal/blob/c94d3fd353e60382c2a18ae8e484c1ecdc53fbc6/add-stATOM-permit.json#L22-L28