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

feat(cosmos-orch-account): expose .executeEncodedTx #10341

Merged
merged 3 commits into from
Nov 13, 2024

Conversation

0xpatrickdev
Copy link
Member

@0xpatrickdev 0xpatrickdev commented Oct 26, 2024

closes: #10345

Description

  • exposes .executeEncodedTx on CosmosOrchestrationAccount so developers can send custom messages
  • improve OrchestrationAccount type

Security Considerations

N/A

Scaling Considerations

N/A

Documentation Considerations

Tests show how to use it and make sense of the response.

Testing Considerations

Includes unit tests and type tests

Upgrade Considerations

Library code for an NPM release

Copy link

cloudflare-workers-and-pages bot commented Oct 26, 2024

Deploying agoric-sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3262f6c
Status: ✅  Deploy successful!
Preview URL: https://0b598281.agoric-sdk.pages.dev
Branch Preview URL: https://pc-expose-execute-encoded-tx.agoric-sdk.pages.dev

View logs

@@ -317,17 +328,15 @@ export interface IBCMsgTransferOptions {
*
* @see {OrchestrationAccountI}
*/
export type CosmosChainAccountMethods<CCI extends CosmosChainInfo> =
export type CosmosChainAccountMethods<CCI extends CosmosChainInfo> = Pick<
Copy link
Member

Choose a reason for hiding this comment

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

this Pick looks arbitrary. I thought maybe it was IcaAccount without the getters, but it also omits executeTx. Is that because it's not yet implemented? Not a good reason when defining types.

Whatever the criteria are for this set of methods, please name it as a type and document it there. Alternately define it as an interface that IcaAccount extends.

Copy link
Member Author

Choose a reason for hiding this comment

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

An interface that IcaAccount extends makes sense to me. Do you have a suggestion for the name of the type? IcaAccountBase(Methods) is the best I've come up with so far.

Regarding executeTx - I suggest we remove this from IcaAccount until there's a story that requires it. The original idea was to keep it to support Proto3Json messages, but it doesn't seem any chain has adopted this yet for ICAs. Having executeTx show up in typeahead in a flow for a non-agoric account seems like something we should avoid. cc @dtribble

RE the other methods omitted -

  • getAddress already appears on OrchestrationAccountI
  • getRemoteAddress, getLocalAddress, and getPort seem like lower level things an orchestration developer shouldn't be concerned with. However, if we feel these should be lifted to the CosmosOrchAccount exo, I wouldn't be opposed

Copy link
Member

Choose a reason for hiding this comment

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

"Base" is a smell to me. How about IcaActions? I agree the getters shouldn't be available in an Orchestration flow.

+1 to removing executeTx until we have a story that requires it.

Copy link
Member Author

Choose a reason for hiding this comment

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

+1 to removing executeTx until we have a story that requires it.

It turns out this is a breaking change for IcaAccountKit which was deployed as part of vat-orchestration in u17. The upgrade considerations seem low since consumers do not depend on it, but I'll layer it in a separate PR.

@@ -143,6 +145,9 @@ export const IcaAccountHolderI = M.interface('IcaAccountHolder', {
...stakingAccountQueriesMethods,
deactivate: M.call().returns(VowShape),
reactivate: M.call().returns(VowShape),
executeEncodedTx: M.call(M.arrayOf(Proto3Shape))
Copy link
Member

Choose a reason for hiding this comment

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

Changing the Orch account interfaces requires @dtribble approval.

(CCI extends {
icaEnabled: true;
Copy link
Member

Choose a reason for hiding this comment

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

CosmosChainAccountMethods now assumes that ICA methods are available for every value in CosmoChainInfo, regardless of of whether they have ICA enabled. Why is this legitimate?

Copy link
Member Author

Choose a reason for hiding this comment

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

ICA seems to be enabled for all chains we currently have in ChainHub. When we add chains that do not have ICA enabled, we can add icaEnabled to the CosmosChainInfo type (it’s not currently there so this evaluates to false for every chain).

I also think it’d be better to leverage this generic parameter in the makeAccount function versus here:

makeAccount: () => CI extends
    | { icaEnabled: true }
    | { chainId: `agoric${string}` }
    ? Promise<OrchestrationAccount<CI>>
    : never;

@dckc dckc removed their request for review November 7, 2024 15:39
@0xpatrickdev 0xpatrickdev force-pushed the pc/expose-execute-encoded-tx branch 3 times, most recently from e3038f5 to d683f60 Compare November 11, 2024 16:49
@0xpatrickdev 0xpatrickdev requested a review from turadg November 11, 2024 17:15
@0xpatrickdev 0xpatrickdev added the automerge:rebase Automatically rebase updates, then merge label Nov 13, 2024
- fixes `CosmosChainAccountMethods` that depended on non-existent `icaEnabled` parameter
- only expose `IcaAccount` methods available on `OrchestrationAccount<CosmosChainInfo>`
- removes `IcaAccount` and `StakingAccountQueries` methods from `OrchestrationAccount<agoric>`
- improve `monitorTransfers` doc string
@0xpatrickdev 0xpatrickdev force-pushed the pc/expose-execute-encoded-tx branch from d683f60 to 3262f6c Compare November 13, 2024 18:20
@mergify mergify bot merged commit 9b34be9 into master Nov 13, 2024
81 checks passed
@mergify mergify bot deleted the pc/expose-execute-encoded-tx branch November 13, 2024 18:59
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.

Orchestration: allow developers to send custom tx messages
2 participants