-
Notifications
You must be signed in to change notification settings - Fork 206
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
Conversation
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. |
Yeah, let's find some time next week.
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. |
b8b783d
to
7a96db5
Compare
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. |
7a96db5
to
36b5c84
Compare
36b5c84
to
03d4cc5
Compare
03d4cc5
to
b84c30d
Compare
c915758
to
0ebb7be
Compare
There was a problem hiding this 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.
localDenomState, | ||
transferProtocol, | ||
}) => { | ||
let checkAbort = () => {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice little pattern
0ebb7be
to
16f6b17
Compare
16f6b17
to
9b072fe
Compare
There was a problem hiding this 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.
packages/pegasus/src/ics20.js
Outdated
import { assert, details as X } from '@agoric/assert'; | ||
|
||
/** | ||
* @typedef {Object} ICS20TransferPacket |
There was a problem hiding this comment.
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?
packages/pegasus/src/ics20.js
Outdated
* @returns {Promise<PacketParts>} | ||
*/ | ||
export const parseICS20TransferPacket = async packet => { | ||
/** @type {ICS20TransferPacket} */ |
There was a problem hiding this comment.
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.
/** @type {ICS20TransferPacket} */ | |
/** @type {unknown} */ |
packages/pegasus/src/ics20.js
Outdated
}) => { | ||
// 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ts-expect-error
?
There was a problem hiding this comment.
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?
packages/pegasus/src/ics20.js
Outdated
depositAddress, | ||
}) => { | ||
// We're using Nat as a dynamic check in a way that tsc doesn't grok. | ||
// Should Nat's parameter type be `unknown`? |
There was a problem hiding this comment.
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.
packages/pegasus/src/ics20.js
Outdated
* @returns {Promise<void>} | ||
*/ | ||
export const assertICS20TransferPacketAck = async ack => { | ||
const { success, error } = JSON.parse(ack); |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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...
// 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 |
There was a problem hiding this comment.
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.
23df041
to
77ebadb
Compare
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
.