-
Notifications
You must be signed in to change notification settings - Fork 214
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
fix(orchestration): remove cancelToken
+ rename createAccount
-> makeAccount
#9312
Conversation
Deploying agoric-sdk with Cloudflare Pages
|
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.
Thanks. This seems like the right renaming.
@@ -140,7 +140,7 @@ test.serial('stakeAtom - smart wallet', async t => { | |||
invitationSpec: { | |||
source: 'agoricContract', | |||
instancePath: ['stakeAtom'], | |||
callPipe: [['makeCreateAccountInvitation']], | |||
callPipe: [['makeAccountInvitation']], |
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.
If you hate makeMakeAccountInvitation
, how about makeNewAccountInvitation
?
I'm okey if you don't want to change this.
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.
yeah, makeAccountInvitation
seems misleading
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.
oh is it a function to make the maker? I did not parse that. makeMakeAccountInvitation
?
a3e4c25
to
cad3dcd
Compare
Dismissing since initial scope has increased
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 looks consistent with recent feedback from @dtribble
Brand, | ||
Payment, | ||
Purse, | ||
RemotableBrand, |
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.
RemotableBrand
comes from @endo/eventual-send
, right? Importing it from ERTP is sort of misleading, suggesting it has something to do with the ERTP Brand type.
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.
RemotableBrand
doesn't seem to be used. why add it?
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.
Artifact, removed. Thanks for surfacing
@@ -140,7 +140,7 @@ test.serial('stakeAtom - smart wallet', async t => { | |||
invitationSpec: { | |||
source: 'agoricContract', | |||
instancePath: ['stakeAtom'], | |||
callPipe: [['makeCreateAccountInvitation']], | |||
callPipe: [['makeAccountInvitation']], |
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.
yeah, makeAccountInvitation
seems misleading
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.
The comments are minor and straightforward. Consider it reviewed once you've addressed them. Making it "request changes" so it doesn't autosubmit....
@@ -140,7 +140,7 @@ test.serial('stakeAtom - smart wallet', async t => { | |||
invitationSpec: { | |||
source: 'agoricContract', | |||
instancePath: ['stakeAtom'], | |||
callPipe: [['makeCreateAccountInvitation']], | |||
callPipe: [['makeNewAccountInvitation']], |
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.
should be makeAccountInvitation
?
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 was discussed above - it's a function that makes an invitation to make an account, makeMakeAccountInvitation
.
I don't feel strongly either way - makeAccountInvitation
is potentially misleading, makeNewAccountInvitation
could be too since we don't use "new" anywhere here.
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 the historical pattern for this would be makeAcountInvitationMaker
, which then would produce something you would call makeAccountInvitation
const { | ||
runUtils: { EV }, | ||
} = t.context; | ||
|
||
const orchestration = await EV.vat('bootstrap').consumeItem('orchestration'); | ||
|
||
const account = await EV(orchestration).createAccount( | ||
const account = await EV(orchestration).makeAccount( |
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.
Why does this need EV?
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.
EV is a testing utility for bootstrap tests
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.
It's like E
but works through RunUtils.
agoric-sdk/packages/SwingSet/tools/run-utils.js
Lines 55 to 61 in 231416e
// IMPORTANT WARNING TO USERS OF `EV` | |
// | |
// `EV` presents an abstraction that can be used (within tests only!) to get | |
// much of the convenience with respect to messaging that `E` provides in | |
// normal code. However, this convenience comes with a huge caveat that all | |
// users of this convenience feature MUST keep in mind. | |
// |
hostConnectionId, | ||
controllerConnectionId, | ||
); | ||
const accountAddress = await E(account).getAccountAddress(); | ||
trace('account address', accountAddress); | ||
const address = await E(account).getAddress(); |
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.
btw feel free to name the variable accountAddress
if that seems more informative
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.
👍 going to keep it as . I might lobby to change address
for consistencygetRemoteAddress()
to getRemoteChannelAddress()
(and getLocalAddress()
-> getLocalChannelAddress()
) so no one gets confused by these.
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.
On second thought, since I am going to change things to use ChainAddress
, i will call the local variable chainAddress
. Was awkward typing this.state.address.address
to form a message.
}, | ||
makeCreateAccountInvitation() { | ||
makeNewAccountInvitation() { |
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.
-makeAccountInvitation
? (make implies new)-
Discussion above; this proposed name misses the usage. makeAcountInvitationMaker
would follow historical patterns for this, but it's not critical.
* account: ChainAccount; | ||
* chainAddress: string; | ||
* account: ChainAccountKit['account']; | ||
* address: ChainAddress['address']; |
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.
Why are we not including the chainID as well? If we have staking reports that are Eth, it should clear from the log?
I would love to have a standard simple format that encompasses all addresses, but we just aren't seeing it yet.
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.
We have #9162 for work around the ChainAddress
object. I will stub that out now in this PR so we can remove the ChainAccountKit['account']
references.
@@ -59,7 +59,7 @@ export const Proto3Shape = { | |||
}; | |||
|
|||
export const ChainAccountI = M.interface('ChainAccount', { | |||
getAccountAddress: M.call().returns(M.string()), | |||
getAddress: M.call().returns(M.string()), |
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 should also return a ChainAddress.
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.
otherwise it cannot be passed as an arg to the various "send" operations
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.
* }} | ||
*/ ( | ||
harden({ | ||
port, | ||
connection: undefined, | ||
requestedRemoteAddress, | ||
remoteAddress: undefined, | ||
accountAddress: undefined, | ||
address: undefined, |
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.
should this be "localAddress" in comparison to remote address? or is it "sourceAddress"?
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.
localAddress
means something different - it's the channel address on the local chain. Here is console output from a test:
ICA Account Addresses {
accountAddress: 'cosmos1test',
localAddress: '/ibc-port/icacontroller-1/ordered/{"version":"ics27-1","controllerConnectionId":"connection-0","hostConnectionId":"connection-0","address":"cosmos1test","encoding":"proto3","txType":"sdk_multi_msg"}/ibc-channel/channel-1',
remoteAddress: '/ibc-hop/connection-0/ibc-port/icahost/ordered/{"version":"ics27-1","controllerConnectionId":"connection-0","hostConnectionId":"connection-0","address":"cosmos1test","encoding":"proto3","txType":"sdk_multi_msg"}/ibc-channel/channel-NaN',
}
We need to extract address
from the negotiated remote channel address.
@@ -252,9 +252,9 @@ const prepareOrchestration = (zone, createChainAccount) => | |||
* the counterparty connection_id | |||
* @param {IBCConnectionID} controllerConnectionId | |||
* self connection_id | |||
* @returns {Promise<ChainAccount>} | |||
* @returns {Promise<ChainAccountKit['account']>} |
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 kind of type seems like a source of confusion rather than help. They well defined type that it should return is a ChainAccount?
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.
Added a6360a5 to remove the confusion
@@ -430,7 +421,7 @@ export type TransferMsg = { | |||
|
|||
// Example | |||
// await icaNoble.transferSteps(usdcAmt, | |||
// osmosisSwap(tiaBrand, { pool: 1224, slippage: 0.05 }, icaCel.getAddress())); | |||
// osmosisSwap(tiaBrand, { pool: 1224, slippage: 0.05 }, icaCel.getChainAddress())); |
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.
Shouldn't this be getAddress
?
2de7c5a
to
a6360a5
Compare
this.state.localAddress = localAddr; | ||
// XXX parseAddress currently throws, should it return '' instead? | ||
this.state.chainAddress = harden({ | ||
address: parseAddress(remoteAddr) || UNPARSABLE_CHAIN_ADDRESS, |
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.
The name parseAddress
suggests that it's taking something like agoric123lj23kj2...
and picking it apart. I had to read the source code -- well, the tests, actually -- to figure out what it's doing. How about changing its argument type to RemoteIbcAddress
? and maybe rename it to findAddressField
?
p.s. I sure wish we used tools that make it easier to re-use tests as documentation a la doctest.
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.
Good naming suggestion. Will tackle it here if there's add'l feedback, or tackle it as part of #9198.
Also planning to rename makeICAConnectionAddress
to makeICAChannelAddress
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.
seems like forward progress
*/ | ||
undelegate: (delegations: Delegation[]) => Promise<Undelegation[]>; | ||
undelegate: (delegations: Delegation[]) => Promise<void>; |
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.
why not return at least MsgUndelegateResponse
?
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 cosmjs types like that show up anywhere else in OrchestrationAccount
, do they?
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 was going to say that MsgUndelegateResponse
is empty anyway, but it's not; it has vital info: completion_time
.
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 this makes sense. Should we also include MsgUndelegateResponse
, MsgBeginRedelegateResponse
, and MsgTransferResponse
? MsgDelegateResponse
and MsgSend
are empty objects
ca624fd
to
182dd0f
Compare
Consider it reviewed once you've addressed them. Making it "request changes" so it doesn't autosubmit....
- to follow [Method Naming Structure](https://docs.agoric.com/guides/ertp/#method-naming-structure)
182dd0f
to
a3aeff0
Compare
a3aeff0
to
39a980a
Compare
closes: #XXXX
refs: #9207
Description
cancelToken
logic from.undelegate()
createAccount
tomakeAccount
fororchestration
andlocalchain
(Method Naming Structure)make<Foo>()
: Creates a new Foo object and returns only that object.create<Foo>()
: Creates a new Foo, but doesn't return it.getChainAddress
->getAddress
onorchestration
Security Considerations
Scaling Considerations
Documentation Considerations
Testing Considerations
Upgrade Considerations