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

fusdc: status manager fixups #10544

Closed
wants to merge 6 commits into from
Closed

Conversation

0xpatrickdev
Copy link
Member

refs: #10389

Description

Minor bug fixes and improvements for status manager.

Security Considerations

N/A

Scaling Considerations

Ensures mapStore entries with empty values are removed

Documentation Considerations

Makes Status Manager state diagrams more accessible (top level README.md)

Testing Considerations

Includes test for bug fixed

Upgrade Considerations

None, unreleased code

@0xpatrickdev 0xpatrickdev force-pushed the pc/status-manager-fixups branch from b4499ef to 8a09c77 Compare November 20, 2024 23:33
Copy link

cloudflare-workers-and-pages bot commented Nov 20, 2024

Deploying agoric-sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2ba8051
Status: ✅  Deploy successful!
Preview URL: https://67f80d13.agoric-sdk.pages.dev
Branch Preview URL: https://pc-status-manager-fixups.agoric-sdk.pages.dev

View logs

@0xpatrickdev 0xpatrickdev marked this pull request as ready for review November 20, 2024 23:34
@0xpatrickdev 0xpatrickdev requested a review from a team as a code owner November 20, 2024 23:34
Copy link
Member

@turadg turadg left a comment

Choose a reason for hiding this comment

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

Good consolidating the docs

@@ -14,8 +14,8 @@ import { PendingTxStatus } from '../constants.js';
/**
* Create the key for the pendingTxs MapStore.
*
* The key is a composite of `txHash` and `chainId` and not meant to be
* parsable.
* The key is a composite of `NobleAddress` and transaction `amount` and not
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* The key is a composite of `NobleAddress` and transaction `amount` and not
* The key is a composite of Noble address `addr` and transaction `amount` and not

}
return pendingTxs.get(key);
},
},
);
return statusManager;
Copy link
Member

Choose a reason for hiding this comment

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

nit: i found the direct return a little clearer. This way I was looking for how statusManager is used

@@ -111,7 +111,6 @@ export const contract = async (zcf, privateArgs, zone, tools) => {
const creatorFacet = zone.exo('Fast USDC Creator', undefined, {
/** @type {(operatorId: string) => Promise<Invitation<OperatorKit>>} */
async makeOperatorInvitation(operatorId) {
// eslint-disable-next-line no-use-before-define
Copy link
Member

Choose a reason for hiding this comment

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

is this based on master? those lines shouldn't be there anymore

@0xpatrickdev 0xpatrickdev force-pushed the pc/status-manager-fixups branch from 8a09c77 to 657bc34 Compare November 20, 2024 23:39
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.

minor comments

const { txHash, chainId } = evidence;
return `seenTx:${JSON.stringify([txHash, chainId])}`;
const { txHash } = evidence;
return `seenTx:${JSON.stringify([txHash])}`;
Copy link
Member

Choose a reason for hiding this comment

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

any reason not to just return txHash;?

'"[Error: Transaction already seen: \\"seenTx:[\\\\\\"0xc81bc6105b60a234c7c50ac17816ebcd5561d366df8bf3be59ff387552761702\\\\\\",1]\\"]"',
'"[Error: Transaction already seen: \\"seenTx:[\\\\\\"0xc81bc6105b60a234c7c50ac17816ebcd5561d366df8bf3be59ff387552761702\\\\\\"]\\"]"',
Copy link
Member

Choose a reason for hiding this comment

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

In my book, if you can see a difference from a test using an external API, it's not a refactor.
But we don't seem to have a shared definition across the team. Oh 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.

I chose refactor since this part of the implementation is invisible to contract consumers and other exos in the contract. I can amend both of the refactors to feat, though.

Copy link
Member

Choose a reason for hiding this comment

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

ah. so it's an internal API. fair enough.

Copy link
Contributor

@samsiegart samsiegart left a comment

Choose a reason for hiding this comment

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

Approve with one optional suggestion

const { txHash, chainId } = evidence;
return `seenTx:${JSON.stringify([txHash, chainId])}`;
const { txHash } = evidence;
return `seenTx:${JSON.stringify([txHash])}`;
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 need the seenTx: part? At the least, we probably don't need to stringify [txHash], just append txHash right?

- no need to support legacy ethereum txs that do not include chain id in the tx evelope
- aligns implementation with vstorage plans
- if we settle and there's no additional entries for a key, delete it instead
  of setting to an empty array
- ensure  always return 'No unsettled entry' error instead of sometimes 'key not found'
@0xpatrickdev 0xpatrickdev force-pushed the pc/status-manager-fixups branch from 657bc34 to 2ba8051 Compare November 21, 2024 00:09
@turadg turadg added this to the FU1: package integration milestone Nov 25, 2024
@0xpatrickdev 0xpatrickdev removed this from the FU1: package integration milestone Nov 27, 2024
@0xpatrickdev 0xpatrickdev marked this pull request as draft December 4, 2024 17:31
@0xpatrickdev
Copy link
Member Author

0xpatrickdev commented Dec 12, 2024

6dc438e is still worth landing. I'll pul in those changes in course of #10625

Edit: + 6569572

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants