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

7300 remove pipeTopicToStorage #7389

Merged
merged 11 commits into from
Apr 13, 2023
Merged

7300 remove pipeTopicToStorage #7389

merged 11 commits into from
Apr 13, 2023

Conversation

turadg
Copy link
Member

@turadg turadg commented Apr 12, 2023

closes: #7300

Description

Fully removes pipeTopicToStorage. To do so required updating these contracts:

  • auctioneer
  • fluxAggregator
  • smartWallet

chain-main.js also imported it and I didn't want to touch that too much so moved the definition within the module. (removed separately)

That freed up removing it from @agoric/notifer.

This also moves the remaining exports of stored-topics.js to Zoe contract support, since they were to support "PublicTopic" and that's a contract level convention.

There are also testing and types improvements along the way.

Security Considerations

--

Scaling Considerations

Eliminiates use of non-scalable pipeTopicToStorage in contracts.

Documentation Considerations

Breaking changes, indicated with ! commits.

Testing Considerations

CI

@turadg turadg requested review from dckc and Chris-Hibbert April 12, 2023 02:04
@turadg turadg changed the title 7300 complete 7300 remove pipeTopicToStorage Apr 12, 2023
@@ -425,6 +424,7 @@ export const prepareVaultManagerKit = (
// about the installation and terms of the liqudation contract. We could
// have another notifier for state downstream of governance changes, but
// that doesn't seem to be cost-effective.
// @ts-expect-error FIXME never defined
Copy link
Member Author

Choose a reason for hiding this comment

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

@Chris-Hibbert this seems like a genuine bug, but I can't tell the impact

Copy link
Member

Choose a reason for hiding this comment

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

I think replaceable liquidator contracts wasn't preserved in the move to auctions. If I'm right, the impact is just some vestigial code and a little bit of unused storage. Orthogonal to this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Dan's right. The comment above and variable should go away. There doesn't appear to be any code that touches 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.

ok removing

@@ -189,7 +201,9 @@ export const prepareRecorderKit = (baggage, marshaller) => {
};

/**
* To be called at most once per baggage.
* Convenience wrapper for DurablePublishKit and Recorder kinds.
Copy link
Member Author

Choose a reason for hiding this comment

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

@gibson042 I thought I had taken this out per our thread but maybe it reappeared in rebase.

In any case, it has proven handy for tests and I think it's okay in contracts with the caveat. WDYT?

*/

/**
* @param {Baggage} baggage
* @param {ZCF} zcf
* @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit
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 not happy about these deep imports but I think the real solution is to have a new package for contract support. such that this would be,

Suggested change
* @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit
* @param {import('@agoric/contracts').MakeRecorderKit} makeRecorderKit

Copy link
Member

Choose a reason for hiding this comment

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

concur.

Copy link
Member Author

Choose a reason for hiding this comment

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

queued up: #7392

Copy link
Member

@dckc dckc left a comment

Choose a reason for hiding this comment

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

looks good. I'm not entirely confident I could maintain this code, so this might be more of an "I don't see any critical problems" review and you might want other eyes.

The notion of a breaking refactor hurts my head... but whatever... the breaking change is signaled.

* updatePublishKit: PublishKit<UpdateRecord>,
* currentPublishKit: PublishKit<CurrentWalletRecord>,
* updateRecorderKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<UpdateRecord>,
* currentRecorderKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit<CurrentWalletRecord>,
Copy link
Member

Choose a reason for hiding this comment

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

recorder.js is a zoe concern? hm.

(I see later your comment about an @agoric/contracts package. makes sense)

return harden({
current: {
description: 'Current state of wallet',
subscriber: currentPublishKit.subscriber,
storagePath: memoizedPath(currentStorageNode),
Copy link
Member

Choose a reason for hiding this comment

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

👏 getting rid of memoizedPat seems like a nice simplification

Comment on lines 254 to 255
// XXX how to handle errors here?
E(latestRoundPublisher).write({
Copy link
Member

Choose a reason for hiding this comment

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

void seems reasonable.

That is: rely on whatever unhandled rejection policy is used throughout the platform. Current state of the art seems to make them reasonably visible to node operators: #4939 / #4471. See also logging issues.

As to RPC clients: if writing latest round info fails, is writing an error message likely to succeed?

And if it's a transient problem, we can expect it to self-heal, since rounds happen on a regular cadence.

@@ -177,6 +177,7 @@ test.serial('invitations', async t => {
* @returns {Promise<[{description: string, instance: Instance}]>}
*/
const getInvitationFor = async (desc, len, balances) => {
await eventLoopIteration();
Copy link
Member

Choose a reason for hiding this comment

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

I often feel obliged to say why I'm adding await eventLoopIteration(). I wonder about an alias such as await vstorageWritesVisible().

*
* @param {import('@agoric/vat-data').Baggage} baggage
*/
export const makeStorageNodePathProvider = baggage => {
Copy link
Member

Choose a reason for hiding this comment

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

a breaking chore seems a little funky. I wonder if this is really a fix... if makeStorageNodePathProvider broke some rule(s) and hence was buggy. not critical

Copy link
Member

Choose a reason for hiding this comment

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

looking at "closes #7300", I think #7300 makes more sense as a performance / scalability bug. So this is indeed a fix.

*/

/**
* @param {Baggage} baggage
* @param {ZCF} zcf
* @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit
Copy link
Member

Choose a reason for hiding this comment

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

concur.

import { setup } from '@agoric/zoe/test/unitTests/setupBasicMints.js';
import { makePublishKit } from '@agoric/notifier';
import { makeBoard } from '@agoric/vats/src/lib-board.js';
Copy link
Member

Choose a reason for hiding this comment

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

makeBoard is no longer used? Oh... I see it moved up. I wonder what's missing in our toolkit that results in these spurious diffs.

Copy link
Member Author

Choose a reason for hiding this comment

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

what's missing in our toolkit

Linting for import ordering. When some import is no longer used there is a lint error, and I fix it up with TypeScript's "Organize imports" function. If we can agree on import ordering rule I'd use that instead (by doing Organize imports and then running the linter with --fix.)

Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -232,7 +232,7 @@ export const subscriptionKey = subscription => {

/**
*
* @param {ERef<{getPublicTopics: () => import('@agoric/notifier').TopicsRecord}>} hasTopics
* @param {ERef<{getPublicTopics: () => import('@agoric/zoe/src/contractSupport').TopicsRecord}>} hasTopics
Copy link
Member

Choose a reason for hiding this comment

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

you're leaving off /index.js on purpose, I trust.

Copy link
Member Author

@turadg turadg Apr 12, 2023

Choose a reason for hiding this comment

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

yes b/c TS still automatically resolves /index.js (Node style)

@@ -425,6 +424,7 @@ export const prepareVaultManagerKit = (
// about the installation and terms of the liqudation contract. We could
// have another notifier for state downstream of governance changes, but
// that doesn't seem to be cost-effective.
// @ts-expect-error FIXME never defined
Copy link
Member

Choose a reason for hiding this comment

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

I think replaceable liquidator contracts wasn't preserved in the move to auctions. If I'm right, the impact is just some vestigial code and a little bit of unused storage. Orthogonal to this PR.

/**
* For use in tests
*/
export const prepareMockRecorderKitMakers = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

test-only code doesn't usually belong under .../src. Can this be a helper published from @agoric/zoe/tools?

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'll move it in #7392

@@ -425,6 +424,7 @@ export const prepareVaultManagerKit = (
// about the installation and terms of the liqudation contract. We could
// have another notifier for state downstream of governance changes, but
// that doesn't seem to be cost-effective.
// @ts-expect-error FIXME never defined
Copy link
Contributor

Choose a reason for hiding this comment

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

Dan's right. The comment above and variable should go away. There doesn't appear to be any code that touches it.

@mergify mergify bot merged commit 0e49c36 into master Apr 13, 2023
@mergify mergify bot deleted the 7300-complete branch April 13, 2023 01:56
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.

replace pipeTopicToStorage with new utilities
4 participants