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

Connector Aware Estimation #3736

Open
danielbate opened this issue Feb 24, 2025 · 7 comments · May be fixed by #3769
Open

Connector Aware Estimation #3736

danielbate opened this issue Feb 24, 2025 · 7 comments · May be fixed by #3769
Assignees
Labels
feat Issue is a feature

Comments

@danielbate
Copy link
Contributor

danielbate commented Feb 24, 2025

TLDR

Connector Aware Estimation is the process of giving the SDK more awareness of the account level semantics earlier in the transaction flow to reduce round trips to the network.

Problem

Let's imagine the following transaction flow for non-native wallets:

Image

In the first stage, the SDK estimates the transaction as normal.

Once it hands off to the connector, and we introduce the non-native account, we must add the predicate to the transaction. Therefore meaning the transaction must be re-prepared.

This is obvious redundancy that could be mitigated by giving the SDK the context earlier in the flow:

Potential Solution

  1. Introduce a prepareTransaction function to the connector interface, that can alter a transaction request with any of it's own specifics, such as adding the non-native predicate.
  /**
   * Modifies a transaction request with anything connector specific.
   * 
   * @param transaction - The tx to prepare.
   *
   * @returns The prepared tx request
   */
  async prepareTransaction(transaction: TransactionRequestLike): Promise<TransactionRequest>;
  1. Introduce connector.prepareTransaction() at the estimation and funding SDK entry points.
  2. Remove connector level estimation and funding from within the connector.sendTransaction() calls.

Notes

@danielbate danielbate added the feat Issue is a feature label Feb 24, 2025
@danielbate
Copy link
Contributor Author

I have not done a proof of concept here yet, so this may evolve.

@danielbate
Copy link
Contributor Author

@petertonysmith94 I think I was overdoing it in our previous discussion, something simple like this would work by moving the connector level logic from submission -> preparation.

But have a look and see what you think, I will pick up any progress made next week :)

@danielbate
Copy link
Contributor Author

Blocked until #3669 and #3737 are complete.

@danielbate danielbate linked a pull request Mar 12, 2025 that will close this issue
4 tasks
@danielbate
Copy link
Contributor Author

We will now be working on this in tandem with #3669.

@danielbate
Copy link
Contributor Author

danielbate commented Mar 19, 2025

Okay, I'm now blocked on this until 0.42.0 is available on testnet.

The WIP PR is looking pretty solid and includes e2e tests using an associated predicate account that requires an external signer (very similar to the EVM/SVM predicates).

I'm having trouble testing solana locally with the connectors repo (phantom doesn't support localnet + the predicate bytecode I'm deploying locally doesn't seem to be matching up). My preference is to wait for [email protected] (so we have assembleTx) to be deployed to testnet where I know I have a working associated account, and I'll have greater confidence testing the feature there.

I've asked the fuel-core guys to expedite deploying it to testnet, I expect it'll be delivered within the day.

@arboleya
Copy link
Member

Testnet only? Devnet is already there.

Image

@danielbate
Copy link
Contributor Author

When I wrote that message both of them were on 0.41.9, I'll try devnet. Phantom does only support eth sepolia testnet but I should still be able to sign, somethings might not just appear as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Issue is a feature
Projects
None yet
3 participants