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

Simplify Pegasus for POLA #3986

Merged
merged 14 commits into from
Feb 4, 2022
Merged

Simplify Pegasus for POLA #3986

merged 14 commits into from
Feb 4, 2022

Conversation

michaelfig
Copy link
Member

@michaelfig michaelfig commented Oct 19, 2021

Description

Rather than exposing publicFacet information about the current pegs, use local actions objects to get things done. These are exposed to the connection owner, and return information about the connection via Subscriptions.

Security Considerations

Should improve auditability via POLA.

Documentation Considerations

The bootstrap Pegasus now puts its powerful authorities in agoricNames.lookup('pegasusConnections'), which is only given out to powerful provisioned solos.

Nobody was relying on this information before, so there should be no loss of functionality.

Testing Considerations

More tests are done in packages/pegasus.

@michaelfig michaelfig self-assigned this Oct 19, 2021
@michaelfig michaelfig added notifier pegasus Core Economy OBSOLETE in favor of INTER-protocol labels Oct 19, 2021
@katelynsills
Copy link
Contributor

This looks like a great simplification. For me to fully understand, I could probably use a walk through on Zoom.

Also, if you have time, could you point me to the latest IBC docs that would be helpful for me to review to understand the requirements? I can also try to take a look myself for the latest and just start at the beginning.

@michaelfig
Copy link
Member Author

For me to fully understand, I could probably use a walk through on Zoom.

Yeah, let's find some time next week.

Also, if you have time, could you point me to the latest IBC docs that would be helpful for me to review to understand the requirements?

The ICS20 transfer protocol we're trying to implement is something like: https://github.com/cosmos/ibc/blob/master/spec/app/ics-020-fungible-token-transfer/README.md

We use the Agoric network API as our interface to IBC (and potentially other transports), so it abstracts most of the details.

@erights
Copy link
Member

erights commented Nov 15, 2021

For me to fully understand, I could probably use a walk through on Zoom.

Yeah, let's find some time next week.

Did this meeting happen? Was it recorded? If it did not happen, might it happen this week? If so, I'd like to be there.

What's the status of this PR? The notifier type reform at least seems to have been taken care of in other PRs.

Copy link
Member

@erights erights left a comment

Choose a reason for hiding this comment

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

Just shallow comments so far. Still getting my feet wet.

packages/pegasus/src/once-promise-kit.js Outdated Show resolved Hide resolved
packages/pegasus/src/courier.js Outdated Show resolved Hide resolved
packages/pegasus/src/once-promise-kit.js Outdated Show resolved Hide resolved
packages/pegasus/src/once-promise-kit.js Outdated Show resolved Hide resolved
packages/pegasus/src/pegasus.js Show resolved Hide resolved
localDenomState,
transferProtocol,
}) => {
let checkAbort = () => {};
Copy link
Member

Choose a reason for hiding this comment

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

Nice little pattern

packages/pegasus/src/pegasus.js Outdated Show resolved Hide resolved
packages/pegasus/src/pegasus.js Outdated Show resolved Hide resolved
packages/pegasus/src/pegasus.js Outdated Show resolved Hide resolved
packages/pegasus/src/pegasus.js Outdated Show resolved Hide resolved
@erights erights self-requested a review December 16, 2021 19:09
@michaelfig michaelfig mentioned this pull request Jan 16, 2022
6 tasks
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.

I can't say that I understand this code well enough to maintain it now, but I can see that this PR is a clear improvement. I have a few non-critical comments / suggestions.

At least the happy paths are covered in the unit test, and I expect this will get considerable integration testing shortly.

Let's go for it.

import { assert, details as X } from '@agoric/assert';

/**
* @typedef {Object} ICS20TransferPacket
Copy link
Member

Choose a reason for hiding this comment

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

cite the (relevant part of the) ICS-20 spec here, pls?

* @returns {Promise<PacketParts>}
*/
export const parseICS20TransferPacket = async packet => {
/** @type {ICS20TransferPacket} */
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we've established this type just by doing a JSON.parse.

Suggested change
/** @type {ICS20TransferPacket} */
/** @type {unknown} */

}) => {
// We're using Nat as a dynamic check in a way that tsc doesn't grok.
// Should Nat's parameter type be `unknown`?
// @ts-ignore
Copy link
Member

Choose a reason for hiding this comment

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

@ts-expect-error?

Copy link
Member

Choose a reason for hiding this comment

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

Document limitation of value to fungible tokens?

depositAddress,
}) => {
// We're using Nat as a dynamic check in a way that tsc doesn't grok.
// Should Nat's parameter type be `unknown`?
Copy link
Member

Choose a reason for hiding this comment

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

yes, it should. Bonus points for raising an issue.

* @returns {Promise<void>}
*/
export const assertICS20TransferPacketAck = async ack => {
const { success, error } = JSON.parse(ack);
Copy link
Member

Choose a reason for hiding this comment

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

This could crash (bad JSON, not an object). As discussed, we accept stack traces as a diagnostic here.

winnerKeyword,
winner,
) => {
// Transfer the amount to our backing seat.
Copy link
Member

Choose a reason for hiding this comment

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

our backing seat... that's poolSeat, right? I don't see any reference to it in this function. Is poolSeat is always the winner? If so, why pass it in?

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 I see what's going on now...

Suggested change
// Transfer the amount to our backing seat.
// Transfer the amount to / from our backing seat.

*/
const denomUriToCourier = makeStore('Denomination');
// Legacy because the value contains a JS Set
Copy link
Member

Choose a reason for hiding this comment

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

Bonus points for citing an issue that represents plans to clean this up.

@michaelfig michaelfig added the automerge:no-update (expert!) Automatically merge without updates label Feb 4, 2022
@mergify mergify bot merged commit 529bf23 into master Feb 4, 2022
@mergify mergify bot deleted the mfig-pegasus-simplify branch February 4, 2022 22:30
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 Core Economy OBSOLETE in favor of INTER-protocol notifier pegasus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants