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

6701 EC addOracles to a governed fluxAggregator #6975

Merged
merged 11 commits into from
Feb 13, 2023
Merged

Conversation

turadg
Copy link
Member

@turadg turadg commented Feb 11, 2023

part of: #6701
split from #6963 and cleaned up for easier review
Next will be removeOracles which requires the caretaker pattern

Description

Grants EC the power to addOracles to a price feed.

  • feat(price): addOracles by EC

Do that required giving the EC the ability to VoteOnApiCall:

  • feat(ec-charter): VoteOnApiCall

Supporting changes:

  • refactor(fluxAggregator): split singleton / contract
  • feat: puppetGovernance setup tools
  • fix(governApi): harden returns
  • test(smartWallet): extract helpers from psm integration

PR also includes some incidental cleanup:

  • BREAKING CHANGE: remove 'aggregators' from space (I don't think it worked anymore. cc @michaelfig )
  • refactor: DRY WalletName.depositFacet
  • test(price): rename test-fluxAggregator
  • test(price): simplify fluxAggregator test

Security Considerations

Makes the fluxAggregator subject to changes by governance. This is granted only to the EC.

Scaling Considerations

--

Documentation Considerations

removing aggregators from the space might impact REPL usage. Users are better off doing a lookup imo.

Testing Considerations

New integration test of FA governance with wallet.

@turadg turadg requested review from dckc and Chris-Hibbert February 11, 2023 20:15
@turadg turadg force-pushed the 6701-ec-addOracles branch from 3f54923 to 91d6594 Compare February 11, 2023 21:04
@turadg turadg mentioned this pull request Feb 11, 2023
@turadg turadg force-pushed the 6701-ec-addOracles branch from 91d6594 to e972759 Compare February 11, 2023 23:56
@michaelfig
Copy link
Member

BREAKING CHANGE: remove 'aggregators' from space (I don't think it worked anymore. cc @michaelfig )

I'm okay with this. Its intention was to provide control over the oracles to the BLDer DAO. I presume there's enough machinery added to the bootstrap promise spaces so that BLDer DAO proposals can do the same sorts of things that the EC can do?

This was referenced Feb 12, 2023
quoteMintP,
zcf.saveIssuer(E(quoteMintP).getIssuer(), 'Quote'),
]);
const quoteKit = {
Copy link
Contributor

Choose a reason for hiding this comment

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

If the fluxAggregator has a quoteMint, it seems like that should be publicly visible. I see that it eventually makes it way to the priceAuthorities, which presumably share it, but shouldn't it be available from the fluxAggregator as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

If the fluxAggregator has a quoteMint, it seems like that should be publicly visible.

Why?

I see that it eventually makes it way to the priceAuthorities, which presumably share it

Not sure where you're seeing that. Here the PA gets just quoteKit.issuer,

  const { priceAuthority } = makeOnewayPriceAuthorityKit({
    createQuote: roundsManagerKit.contract.makeCreateQuote(),
    notifier: makeNotifierFromSubscriber(answerSubscriber),
    quoteIssuer: quoteKit.issuer,
    timer: timerPresence,
    actualBrandIn: brandIn,
    actualBrandOut: brandOut,
  });

The other read of quoteKit in this module is to pass it to makeRoundsManagerKit, which uses it only for,

        const quoteAmount = AmountMath.make(quoteKit.brand, harden(quote));
        const quotePayment = await E(quoteKit.mint).mintPayment(quoteAmount);

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I meant that the issuer should be public. The priceAuthorities provide access to their quoteIssuer (I think). Shouldn't the aggregator do the same? Are there parties to the conversation that know the aggregator and don't talk to individual PAs? If not, then I guess it's not necessary, but it feels like the Aggregator should be the main authority on the Issuer if it's the one that makes it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Are there parties to the conversation that know the aggregator and don't talk to individual PAs?

Not on the consumption side, TMK.

const { timer: timerP } = zcf.getTerms();

const quoteMintP =
privateArgs.quoteMint || makeIssuerKit('quote', AssetKind.SET).mint;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want this to be durable/recoverable, even if it didn't come from privateArgs?

Copy link
Member Author

@turadg turadg Feb 12, 2023

Choose a reason for hiding this comment

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

Out of scope. Those are concerns for #6853

@@ -52,6 +50,12 @@ export const reserveThenGetNames = async (nameAdmin, names) =>
names.map(name => [name]),
);

/**
* @param {string} debugName
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe displayName? debugName seems pejorative.

Copy link
Member Author

Choose a reason for hiding this comment

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

these are just jsdocs for params that were already there. The type annotation serves this PR. Changing the param name doesn't. It doesn't seem worth a drive-by either. Since you said "maybe" I take it that's not an approval requirement.

* @param {string[]} methodArgs
* @param {import('@agoric/time').TimestampValue} deadline
*/
const makeApiInvocationInvitation = (
Copy link
Contributor

Choose a reason for hiding this comment

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

There's no test for the charter? Hmm. Seems like an oversight.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm okay with it since we need to test uses of the charter to govern and we do in the smartWallet integration tests.

* @param {Awaited<ReturnType<typeof coalesceUpdates>>} state
* @param {Brand<'nat'>} brand
*/
export const purseBalance = (state, brand) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

passing state to a helper seems like an anti-pattern, since state is mutable. Can this be done by passing state.balances since the operation is supposed to be read-only?

Copy link
Member Author

Choose a reason for hiding this comment

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

it could be but since this is a test I've opted for ease of writing and reading.

Is this a blocking request?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not if it's a lot of work. How much work does it save?

Copy link
Member Author

Choose a reason for hiding this comment

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

My objection wasn't on amount of work to make the change. It was that it made calling require more typing.

In this case the function was no longer used so I've removed it.

import { reserveThenDeposit } from '../proposals/utils.js';
import { provideFluxAggregator } from './fluxAggregator.js';

const trace = makeTracer('FluxAgg');
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const trace = makeTracer('FluxAgg');
const trace = makeTracer('FluxAgg, false');

creatorFacet: fa.creatorFacet,
publicFacet: fa.publicFacet,
creatorFacet: governorFacet,
// XXX this is a lot of API to put on every public facet
Copy link
Contributor

Choose a reason for hiding this comment

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

You can pick and choose if it shouldn't all be there.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh good. I think this came when I ran into some type problems in #6963 . Removed now.

await oracleTimer.tick();
await oracleTimer.tick();
await oracleTimer.tick();
await oracleTimer.tick(); // --- should time out here
Copy link
Contributor

Choose a reason for hiding this comment

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

tickN(6) would be better and is supposed to do the same thing. I recently noticed that it doesn't seem to be equivalent. Can you see why it makes a difference?

Copy link
Member Author

Choose a reason for hiding this comment

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

This file was redundant with test-fluxAggregator and I removed it in a subsequent PR. I've rebased to remove it here.

Copy link
Contributor

@Chris-Hibbert Chris-Hibbert left a comment

Choose a reason for hiding this comment

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

I don't have a strong objection to .contract.js, but it's a change/addition to our naming scheme. I'd prefer to stick to our existing pattern until we have a decision to switch.

// Create the price feed.
const aggregator = await E(zoe).startInstance(
priceAggregator,
/** @type {{ creatorFacet: import('@agoric/governance/src/contractGovernor.js').GovernedContractFnFacetAccess<import('@agoric/inter-protocol/src/price/fluxAggregator.contract.js').start>, publicFacet: GovernorPublic, instance: Instance, adminFacet: AdminFacet }} */
Copy link
Contributor

Choose a reason for hiding this comment

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

s/fluxAggregator.contract.js/fluxAggregatorContract.js

Copy link
Member Author

Choose a reason for hiding this comment

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

Good eyes. it’s passing CI because it’s wrapping type is not resolved and thus any. (Unfortunately JSDoc TS doesn't complain about that.) I'll get to fixing this in #6987

@turadg turadg added the automerge:no-update (expert!) Automatically merge without updates label Feb 12, 2023
@mergify mergify bot merged commit bdb08a7 into master Feb 13, 2023
@mergify mergify bot deleted the 6701-ec-addOracles branch February 13, 2023 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:no-update (expert!) Automatically merge without updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants