-
Notifications
You must be signed in to change notification settings - Fork 209
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
a3p proposal to create new priceFeeds #9044
Conversation
770a721
to
91f3a7a
Compare
310d6b2
to
3da4b8c
Compare
|
||
const inLookup = JSON.parse(IN_BRAND_LOOKUP); |
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 this is a regression w.r.t. CLI usage.
@michaelfig I wonder if we have any tests for that.
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.
Reverting....
if (!brandIn) { | ||
if (brandIn) { |
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.
changing this file means putting another version of it (in a bundle) on the chain. Is that essential to do?
There are other clients... they probably won't be confused, because they refer to the code by bundleID. But I think we already have 2 versions of this on chain, and keeping them straight is hard enough.
I've been exploring a new contract to do this sort of thing.
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 reverted these changes.
// 'agoric1dxe9dqu4ejpctnp2un7s4l7l8hny6dzr8juur3', | ||
// 'agoric1y750klm8sh8yh4h4mcssx5m7rmvuu8mhk89t0c', | ||
|
||
// XXX These are the GOV1ADDR, etc addresses. What should this file specify? |
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.
scripts/inter-protocol/price-feed-core.js
gets them from the environment and arranges for them to be passed to defaultProposalBuilder
. or something.
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.
@turadg pointed out that the proposals get built before the environment that would generate addresses exists, so they have to be hard-coded or substituted or something. This relevant issue (Agoric/agoric-3-proposals#5) is apparently coming soon.
if (priceAggregatorRef) { | ||
const bundleID = await E.get(priceAggregatorRef).bundleID; | ||
if (bundleID) { | ||
installationP = E(zoe).installBundleID(bundleID); |
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.
do we want to update agoricNames.installation.priceAggregator
in this case?
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 so, but i'm going to hold off until I see how we entrain the upgrades to auctions and vaults. If those are planned to follow shortly, then yes, but if not, it depends on the reasoning.
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 mis-read your question. The answer to your actual question is yes, and we do so on line 141 now.
The answer to the question I thought you asked is "yes, we want to update the instances, and we were already doing so on line 222.
|
||
const ORACLE_ADDRESSES = [GOV1ADDR, GOV2ADDR, GOV3ADDR]; | ||
|
||
test('update all priceFeed vats', async t => { |
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 don't see where this test updates anything.
Is it testing that something was updated?
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.
line 22 evals priceFeed-submission
@Chris-Hibbert is updatePriceFeeds.js
meant to be its own proposal or part of an upgrade? If it's a CORE_EVAL proposal then make the proposal package type be like,
"agoricProposal": {
"type": "/agoric.swingset.CoreEvalProposal",
"source": "subdir",
b:localchain
is a good example.
If it will be part of an Software Upgrade, then put it in a:upgrade-next
and its Go app handler like the other proposals there. 'upgrade-next' has a mix of u14 and u15 so we'll already be removing the u14 proposals once that hits Mainnet.
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.
Moving to a:upgrade-next
"sdkImageTag": "unreleased", | ||
"planName": "UNRELEASED_UPGRADE", | ||
"upgradeInfo": { | ||
"coreProposals": [] |
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.
if coreProposals
is empty, what exactly is happening in this Software Upgrade?
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.
It runs the upgrade handlers in the sdkImageTag
. But that will have run by a:upgrade-next
, so its's not doing anything.
It looks like this proposal package is just a holder for priceFeed.test.js
(and its submission).
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.
moved to a:upgrade-next
"sdkImageTag": "unreleased", | ||
"planName": "UNRELEASED_UPGRADE", | ||
"upgradeInfo": { | ||
"coreProposals": [] |
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.
It runs the upgrade handlers in the sdkImageTag
. But that will have run by a:upgrade-next
, so its's not doing anything.
It looks like this proposal package is just a holder for priceFeed.test.js
(and its submission).
|
||
const ORACLE_ADDRESSES = [GOV1ADDR, GOV2ADDR, GOV3ADDR]; | ||
|
||
test('update all priceFeed vats', async t => { |
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.
line 22 evals priceFeed-submission
@Chris-Hibbert is updatePriceFeeds.js
meant to be its own proposal or part of an upgrade? If it's a CORE_EVAL proposal then make the proposal package type be like,
"agoricProposal": {
"type": "/agoric.swingset.CoreEvalProposal",
"source": "subdir",
b:localchain
is a good example.
If it will be part of an Software Upgrade, then put it in a:upgrade-next
and its Go app handler like the other proposals there. 'upgrade-next' has a mix of u14 and u15 so we'll already be removing the u14 proposals once that hits Mainnet.
I moved it to |
6245165
to
f57210e
Compare
f57210e
to
841c9c9
Compare
I split the generation of the priceFeed proposals into 4 separate invocations that work both with |
841c9c9
to
c3c8034
Compare
@@ -6,6 +6,7 @@ | |||
"upgradeInfo": { | |||
"coreProposals": [] | |||
}, | |||
"comment": "all the priceFeed submissions go in the same directory", |
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.
we've been using $comment
to make clear it's not part of the data
"$comment": "This SwingSet config file (see loadSwingsetConfigFile) is minimal; it has no proposals. It is used by ../cosmic-swingset/Makefile and `agoric start`, which add proposals to it.", |
however I'm not sure what this comment serves. What's the misunderstanding it's meant to remedy?
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 dropped this line because the stuff it explained went away. Sorry I didn't get it before you noticed it.
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 file name looks like it's going to "update price feeds" but it just exports some values and a function. please rename to disambiguate. e.g. priceFeedSupport.js
.
Though for the code, why not keep it in inter-protocol/price-feed-core.js
? It's a variation but belongs there just as much as the original yeah?
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 @dckc said that we already had two versions of that file on chain. My interpretation was that he preferred starting afresh. I'll rename the file. It has gone through some evolutions, and is now just a support for the actual proposals.
// XXX I don't know why value.values[-1] doesn't work. | ||
const body = JSON.parse(value.values[value.values.length - 1]); |
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.
because JS arrays are also dicts and -1
is a valid key
// XXX I don't know why value.values[-1] doesn't work. | |
const body = JSON.parse(value.values[value.values.length - 1]); | |
const body = JSON.parse(value.values.at(-1)); |
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.
thanks.
const bodyTruncated = JSON.parse(body.body.substring(1)); | ||
const slots = body.slots; | ||
|
||
for (const [k, v] of bodyTruncated.entries()) { | ||
if (v[0] === `${price}-USD price feed`) { | ||
// console.log(`PFt `, price, slots[k]); | ||
return slots[k]; | ||
} | ||
} |
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 is a little opaque. consider,
const bodyTruncated = JSON.parse(body.body.substring(1)); | |
const slots = body.slots; | |
for (const [k, v] of bodyTruncated.entries()) { | |
if (v[0] === `${price}-USD price feed`) { | |
// console.log(`PFt `, price, slots[k]); | |
return slots[k]; | |
} | |
} | |
const feeds = JSON.parse(body.body.substring(1)); | |
const feedName = `${price}-USD price feed`; | |
const key = Object.keys(feeds).find(k => feeds[k][0] === feedName); | |
if (key) { | |
return feeds.slots[key]; | |
} |
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.
Thanks, that's much clearer.
|
||
test.serial('check all priceFeed vats updated', async t => { | ||
await null; | ||
process.env.ORACLE_ADDRESSES = JSON.stringify(ORACLE_ADDRESSES); |
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.
usually we treat env
has readonly. would that be feasible?
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 don't think I'm using this anymore. I'll drop it.
I'm more worried about the addresses at the top of priceFeedSupport.js
, and how we're going to get usable values for upgrading on-chain.
c3c8034
to
8296522
Compare
refs: #8400
refs: #8740
Description
Add an a3p proposal to upgrade the price feed vats to lay out an approach to replace the existing price feed vats with new ones that won't accumulate uncollectible garbage.
The next steps are feeding prices to these oracles (to demonstrate that we can name them and retrieve them from
agoricNames
) and updating vaults and auctions to rely on the new feeds.Security Considerations
Not a security issue.
Scaling Considerations
This is in service of reducing an existing scaling issue.
Documentation Considerations
None
Testing/Upgrade Considerations
This is an a3p test to validate plans to upgrade on-chain contracts to address sustainability concerns.