-
Notifications
You must be signed in to change notification settings - Fork 69
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
LIT-3995 - (wrapped-keys) - Add signTransaction functionality to supported actions for batchGeneratePrivateKeys
#702
base: master
Are you sure you want to change the base?
Conversation
batchGeneratePrivateKeys
batchGeneratePrivateKeys
…ility to `actions` array processed by `batchGenerateEncryptedKeys` LIT action
…tchGeneratePrivateKeys` api
250aff5
to
2c075d6
Compare
…h batchGeneratePrivateKeys - This doesn't work for Solana yet, because our test requires the keyPair from the generated key to serialize the TX
batchGeneratePrivateKeys
batchGeneratePrivateKeys
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 reason it works for Ethereum tx is because internally in the signTransactionEthereumKey()
we add the from address:
js-sdk/packages/wrapped-keys-lit-actions/src/lib/internal/ethereum/signTransaction.ts
Line 169 in 1e074af
validatedTx.from = wallet.address; |
We always need to provide the
from
address (and feePayer
as well in Solana tx). Since we're generating the wallet and signing right after that the user can just provide the params that we can use to craft a tx object inside the LA itself.Note: The user should always provide the gas and anything else that currently requires an RPC call as we should no longer support making RPC calls from within the LA as it causes arbitrary delay due to the blockchain. Therefore, we shouldn't even support tx broadcast or at least not in the
batchGenerate()
. Since we're just creating the wallet the nonce will be 0. @MaximusHaximus lemme know if you have any questions
if (!ethers.utils.isHexString(signedEthTx)) { | ||
throw new Error(`signedTx isn't hex: ${signedEthTx}`); | ||
} |
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.
Can we verify that the signed tx is from the the generated wallet?
unsignedTransaction | ||
? signTransactionEthereumKey({ | ||
unsignedTransaction, | ||
broadcast: action.signTransactionParams?.broadcast || false, |
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 shouldn't allow broadcast in the batchGenerate function as it uses RPC which can take arbitrary amounts of time?
: Promise.resolve(), | ||
unsignedTransaction | ||
? signTransactionSolanaKey({ | ||
broadcast: action.signTransactionParams?.broadcast || false, |
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 shouldn't allow broadcast?
network: Extract<Network, 'solana'>; | ||
signTransactionParams?: { | ||
unsignedTransaction: SerializedTransaction; | ||
broadcast?: boolean; |
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.
Let's not include the broadcast field it should always be false?
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.
@MaximusHaximus we don't wanna allow fetching nonce, gas, etc or anything from the RPC. It should all be provided by the user either as a serialized tx or as params and we could construct the transaction inside the LA but we should not fetch anything from the RPC we can remove this fetching altogether
Description
fromPubkey
andfeePayer
in the serialized TX to match the pubKey of the generated key that is doing the signer -- but obviously that can't happen since we generate the key in the LIT action runtime. 🤔Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
local-tests/tests/wrapped-keys/testBatchGeneratePrivateKeys.ts
to sign an ethereum tx and verify the signature returned is hex (same logic as our existing signTransactionEthereum test)Checklist: