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

10387 simple transaction feed for Fast USDC #10452

Merged
merged 2 commits into from
Nov 13, 2024
Merged

10387 simple transaction feed for Fast USDC #10452

merged 2 commits into from
Nov 13, 2024

Conversation

turadg
Copy link
Member

@turadg turadg commented Nov 12, 2024

closes: #10387

Description

A basic transaction feed component. It has a public invitation maker that isn't for production but will work for contract tests as Advancer and Settle are built.

Security Considerations

Scaling Considerations

Documentation Considerations

Testing Considerations

Upgrade Considerations

Copy link

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

Deploying agoric-sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1de9a54
Status: ✅  Deploy successful!
Preview URL: https://bdc96dde.agoric-sdk.pages.dev
Branch Preview URL: https://10387-simple-feed.agoric-sdk.pages.dev

View logs

packages/fast-usdc/src/exos/transaction-feed.js Outdated Show resolved Hide resolved
* @param {CctpTxEvidence} evidence
*/
makeTestPushInvitation(evidence) {
return zcf.makeInvitation(
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can try without an actual invitation, just a method call?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's how Patrick's PR already works. The point of this PR is so the CLI can push evidence. That can only be done through an offer through the smart wallet

Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking more about the workaround we discussed where the smart wallet would invoke the invitation maker, but the invitation maker itself would just throw without returning an invitation. To avoid the perf overhead of zoe. We'd still want this exo for managing oracle members and aggregating submissions

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 was thinking more about the workaround we discussed where the smart wallet would invoke the invitation maker,

I see. I'll give that a try.

@turadg turadg force-pushed the 10387-simple-feed branch 2 times, most recently from 2727135 to c5b5932 Compare November 12, 2024 20:20
return zone.exoClassKit('Fast USDC Feed', undefined, () => ({}), {
admin: {
/** @param {CctpTxEvidence } evidence */
addEvidence: evidence => {
Copy link
Member

Choose a reason for hiding this comment

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

Is submitEvidence or reportEvidence more fitting? Or maybe adopt the push verb from pushPrice and call this pushEvidence?

Copy link
Member Author

Choose a reason for hiding this comment

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

"submit" sgtm, like submit for evaluation. push was ambiguous about how it would be aggregated.

/** @type {PublishKit<CctpTxEvidence>} */
const { publisher, subscriber } = makePublishKit();

return zone.exoClassKit('Fast USDC Feed', undefined, () => ({}), {
Copy link
Member

@0xpatrickdev 0xpatrickdev Nov 12, 2024

Choose a reason for hiding this comment

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

consider a guard that uses CctpTxEvidenceShape

/** @param {CctpTxEvidence } evidence */
addEvidence: evidence => {
trace('TEMPORARY: Add evidence:', evidence);
// TODO decentralize
Copy link
Member

Choose a reason for hiding this comment

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

Consider:

  • basic validation checks for things that can't be verified by the guard, like address parameter
  • and/or, a TODO explaining what validation checks will be performed

Comment on lines +66 to +73
void observeIteration(subscribeEach(feedKit.public.getEvidenceStream()), {
updateState(evidence) {
try {
advancer.handleTransactionEvent(evidence);
} catch (err) {
trace('🚨 Error handling transaction event', err);
}
},
});
Copy link
Member

Choose a reason for hiding this comment

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

Nice, first time seeing this API. Surprised the second argument doesn't need to be a remotable, but that's convenient here.

Are there scenarios where we'd hid the fail or finish handlers and need to resubscribe?

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 questions. It may need to be durable but that's for Milestone 2.

If the stream dies, I don't think resubscribing would be safe. It's an unhandled rejection that will need a Core Eval to repair.

* @param {CctpTxEvidence} evidence
*/
async makeTestPushInvitation(evidence) {
await feedKit.admin.addEvidence(evidence);
Copy link
Member

Choose a reason for hiding this comment

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

Recognize this is a test method, but why change state in the invitationMaker instead of the offerHandler? If addEvidence were to throw, will smart-wallet get the error message?

Copy link
Member Author

Choose a reason for hiding this comment

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

why change state in the invitationMaker instead of the offerHandler

#10452 (comment)

If addEvidence were to throw, will smart-wallet get the error message?

Good question. The throw would happen on this line so it would be an IMMEDIATE_OFFER_ERROR and show up as an error in the wallet status.

I added a todo to test that when we integrate with smart-wallet in bootstrap tests

Copy link
Member

Choose a reason for hiding this comment

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

Ok cool, I see now.

I added a todo to test that when we integrate with smart-wallet in bootstrap tests

🙏

Comment on lines +22 to +24
setJig: jig => {
jig.chainHub.registerChain('osmosis', fetchedChainInfo.osmosis);
},
Copy link
Member

Choose a reason for hiding this comment

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

Nice, great approach for now. We'll need to revisit in a future milestone when we do bootstrap and multichain testing.

return zcf.makeInvitation(async cSeat => {
trace('Offer made on noop invitation');
cSeat.exit();
return 'noop; evidence was pushed in the invitation maker call';
Copy link
Member

Choose a reason for hiding this comment

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

Consider using undefined, as we've adopted this as the return value for many offers. This might help keep muscle-memory fresh for recognizing result: undefined as a happy path offer result.

Copy link
Member Author

Choose a reason for hiding this comment

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

as the return value for many offers

That makes sense for offers that get used, but this one is not supposed to be used. So it should be conspicuously different.

@turadg turadg marked this pull request as ready for review November 12, 2024 23:57
@turadg turadg requested a review from a team as a code owner November 12, 2024 23:57
*/

const trace = makeTracer('TxFeed', true);

export const INVITATION_MAKERS_DESC = 'transaction oracle invitation';
Copy link
Member

@0xpatrickdev 0xpatrickdev Nov 13, 2024

Choose a reason for hiding this comment

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

consider a more global name (wrt fusdc) since we're exporting

@turadg turadg added the automerge:rebase Automatically rebase updates, then merge label Nov 13, 2024
@mergify mergify bot merged commit 596ebab into master Nov 13, 2024
91 checks passed
@mergify mergify bot deleted the 10387-simple-feed branch November 13, 2024 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:rebase Automatically rebase updates, then merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transaction Feed without aggregation or access controls
3 participants