-
Notifications
You must be signed in to change notification settings - Fork 212
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
feat: implement .transfer
on CosmosOrchestrationAccount
#9882
Conversation
packages/boot/tools/ibc/mocks.js
Outdated
@@ -1,4 +1,5 @@ | |||
// @ts-check | |||
import { createMockAckMap } from '@agoric/orchestration/tools/ibc-mocks.ts'; |
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
doesn't seem right here. Is the correct way to address this a build step in the orchestration package.json?
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 change it to .js
. TS will resolve the module.
import { createMockAckMap } from '@agoric/orchestration/tools/ibc-mocks.ts'; | |
import { createMockAckMap } from '@agoric/orchestration/tools/ibc-mocks.js'; |
I don't recall why boot has allowImportingTsExtensions: true
. I'll see about disabling it to avoid this problem.
a build step in the orchestration package.json?
Aside from cosmic-proto which uses code gen, we avoid build steps for dependencies between packages in the repo. @agoric/orchestration
does transpile in its NPM publishing.
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.
After rebasing on #9884 and changing to .js
I see 🤔 :
$ ava test/orchestration/restart-contracts.test.ts
Uncaught exception in test/orchestration/restart-contracts.test.ts
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/0xpatrick/repos/agoric-sdk/node_modules/@agoric/orchestration/tools/ibc-mocks.js' imported from /Users/0xpatrick/repos/agoric-sdk/packages/boot/tools/ibc/mocks.js
› h (file:///Users/0xpatrick/repos/agoric-sdk/node_modules/@esbuild-kit/esm-loader/dist/index.js:12:1164)
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.
pushed a fix in c4d45bf
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. Still seeing https://github.com/Agoric/agoric-sdk/actions/runs/10419531180/job/28857889091?pr=9882#step:5:115. The problem goes away if we rename mocks.js
and mocks.test.js
to .ts
, but I'll hold that fixup as I suspect a different solution might be preferred.
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.
shoot, I tested locally but missed that one I guess.
more .ts
seems like the best solution to me
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 branch is behind master now. when you make that change feel free to rebase on master and force push with fixups squashed
} | ||
// An error that would be triggered before reception on another chain | ||
return ackImmediately(obj, protoMsgMocks.error.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.
// An error that would be triggered before reception on another chain
Thinking on this more, I suspect the relayer could also be delayed. Any harm in making this ackLater
?
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 a trade-off. IIRC:
- a
sendPacket
message could have an immediate failure before leaving the local node (i.e. just over the bridge) or after a reply from a relayer. - we can't reliably distinguish between those cases here
If (2) is false, then let's distinguish.
If (2) is true then we have to pick the better way to handle both. The pro of ackLater is that it let's us test doing other work before the ack arrives. The con is that it's something someone could forget in a test, and even when they don't it's more work.
The other immediate con is that it may break some tests and need fixing.
I don't have a strong stance on which is better. Whatever infidelity you choose, please leave a comment explaining the decision.
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.
Thinking on this more, I also don't have a strong stance. It seems the main benefit of ackLater
is to allow us to control timing in the test context. ackImmediately
seems like a sensible default, as someone can always choose to supply a mock to the bridge that will use ackLater
.
Nonetheless, sharing some thoughts/findings to your question -
- a sendPacket message could have an immediate failure before leaving the local node (i.e. just over the bridge) or after a reply from a relayer.
Correct, the sendPacket handler can fail via ReceiveSendPacket before leaving agoric golang and going out to a relayer.
It seems this might only fail if an invalid sourcePort
and sourceChannel
are provided. I'm not sure when ibc.js
or network.js
would allow this since .downcall()
is heavily guarded with ocaps + closures - the only thing coming to mind is bad state where a channel is closed but ibc/network are unaware.
f8370b2
to
1ba74b7
Compare
Deploying agoric-sdk with Cloudflare Pages
|
1ba74b7
to
d5cb94b
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.
Good stuff! Thanks for the clean commits for reviewing. Happy to see the code improvements along the way.
? 0n | ||
: E(timestampHelper).getTimeoutTimestampNS()); | ||
|
||
// Resolves when host chain successfully submits, but not when |
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 commit message made me think the feature was implemented. I see it just says it's adding the method, and I suppose there will be another feat
commit that it works as expected.
makeRecorderKit, | ||
vowTools, | ||
zcf, | ||
{ chainHub, makeRecorderKit, timerService, vowTools, zcf }, |
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 refactor. I suppose this should be the habit from the outset. powers tend to expand
_incidental_ ## Description A couple packages had `allowImportingTsExtensions: true`. It recently caused [some confusion](#9882 (comment)). The reason we had it is so tests written in `.js` could import `.ts` modules. (Without this `.ts` import, the Ava transpiler config wouldn't try to resolve `.js` as a `.ts` module in a `.js` file.) But most of our tests in `boot` are `.ts` now and I think it would be best for them all to be. This removes that allowance and brings the imports into conformity. It also converts the one test that was using `.ts` in `.js` to be a `.ts` test. ### Security Considerations n/a ### Scaling Considerations n/a ### Documentation Considerations n/a ### Testing Considerations CI ### Upgrade Considerations n/a
d5cb94b
to
b79a25d
Compare
- remove an unnecessary vat roundtrip
- to address: Error: Target 'agoric1mockVlocalchainAddress' already registered
must be .ts for .ts modules to find it by its .js module name
c4d45bf
to
e3ce160
Compare
refs: #9193
refs: #9784
Description
These changes primarily implement the
.transfer
method onCosmosOrchestrationAccount
. The changes require providing the exo with aChainHub
for looking up transferChannel info andTimerService
for building a default timeout parameter. Notably, the.transfer()
Promise resolves when the host chain submits the transfer to other remote chain. ThesendThenWaitForAck
logic thatLocalOrchestrationAccount
has is not yet implemented but tracked via #9784.Other changes include:
transferChannel
lookup logic inLocalOrchestrationAccount
/boot/tools/support.ts
changes to simplifysendPacket
ack mocks for dibc bridgeLocalOrchAccount.transfer()
usingTransfer
invitationMaker/boot/tools/support.ts
changes to ensure mock localChain addresses are uniquepacketUtils
interface guard change for an observed, but seemingly benign, errorSecurity Considerations
n/a
Scaling Considerations
n/a
Documentation Considerations
Testing Considerations
Includes unit and boot tests.
Upgrade Considerations
n/a, unreleased code