soroban-cli icon indicating copy to clipboard operation
soroban-cli copied to clipboard

`TypeError: accountId not set` when trying to `signAuthEntries`

Open kalepail opened this issue 1 year ago • 5 comments
trafficstars

What version are you using?

CLI

% stellar --version
stellar 21.2.0 (41a1e0dd0e3e8e34f94b4e78fc7f71d7f15420c7)
soroban-env 21.2.0 (8809852dcf8489f99407a5ceac12625ee3d14693)
soroban-env interface version 90194313216
stellar-xdr 21.2.0 (9bea881f2057e412fdbb98875841626bf77b4b88)
xdr curr (70180d5e8d9caee9e8645ed8a38c36a8cf403cd9)

TS bindings and base js-sdk library are both using:

"@stellar/stellar-sdk": "12.2.0"

What did you do?

Attempting to sign auth entries using the signAuthEntries method of the TS bindings.

What did you expect to see?

No errors.

What did you see instead?

1725 |     this._arm = arm;
1726 |     this._armType = arm === _void__WEBPACK_IMPORTED_MODULE_0__.Void ? _void__WEBPACK_IMPORTED_MODULE_0__.Void : this.constructor._arms[arm];
1727 |     this._value = value;
1728 |   }
1729 |   get(armName = this._arm) {
1730 |     if (this._arm !== _void__WEBPACK_IMPORTED_MODULE_0__.Void && this._arm !== armName) throw new TypeError(`${armName} not set`);
                                                                                                     ^
TypeError: accountId not set
      at get (/Users/tylervanderhoeven/Desktop/check-auth-puzzle/bun_tests/puzzle-sdk/node_modules/@stellar/js-xdr/lib/xdr.js:1730:95)
      at /Users/tylervanderhoeven/Desktop/check-auth-puzzle/bun_tests/puzzle-sdk/node_modules/@stellar/stellar-sdk/lib/contract/assembled_transaction.js:248:59
      at map (:1:21)
      at /Users/tylervanderhoeven/Desktop/check-auth-puzzle/bun_tests/puzzle-sdk/node_modules/@stellar/stellar-sdk/lib/contract/assembled_transaction.js:247:31
      at _callee6$ (/Users/tylervanderhoeven/Desktop/check-auth-puzzle/bun_tests/puzzle-sdk/node_modules/@stellar/stellar-sdk/lib/contract/assembled_transaction.js:280:40)
      at tryCatch (/Users/tylervanderhoeven/Desktop/check-auth-puzzle/bun_tests/puzzle-sdk/node_modules/@stellar/stellar-sdk/lib/contract/assembled_transaction.js:33:911)
      at /Users/tylervanderhoeven/Desktop/check-auth-puzzle/bun_tests/puzzle-sdk/node_modules/@stellar/stellar-sdk/lib/contract/assembled_transaction.js:33:2859
      at /Users/tylervanderhoeven/Desktop/check-auth-puzzle/bun_tests/puzzle-sdk/node_modules/@stellar/stellar-sdk/lib/contract/assembled_transaction.js:33:1545
      at asyncGeneratorStep (/Users/tylervanderhoeven/Desktop/check-auth-puzzle/bun_tests/puzzle-sdk/node_modules/@stellar/stellar-sdk/lib/contract/assembled_transaction.js:40:66)
      at _next (/Users/tylervanderhoeven/Desktop/check-auth-puzzle/bun_tests/puzzle-sdk/node_modules/@stellar/stellar-sdk/lib/contract/assembled_transaction.js:41:163)

Bun v1.1.8 (macOS arm64)

Here's a Bun JS TS file for the error.

import { SorobanRpc, Networks, Keypair, xdr, hash, Address, Operation } from '@stellar/stellar-sdk'
import { basicNodeSigner, DEFAULT_TIMEOUT } from '@stellar/stellar-sdk/contract';
import { Client, networks } from 'puzzle-sdk'

const keypair = Keypair.fromSecret('SDNS3C4YQ5BDBXBZ56MEB754VLY352VSWGJZNW3W5CIUXEI3MEBTWKFT'); // GDT3KJMJIQWDOZWERC3K5SSGQGYALT2VSUAQP2YEGDK7YDPSQWUCIHYZ
const publicKey = keypair.publicKey()

const nativeSAC = 'CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC'
const contractId = 'CDLOZN6IK55ANUCMERGWIDBITVKSJE452B6VN37ZMRJGBGELSWXSUANG'

const rpcUrl = 'https://soroban-testnet.stellar.org'
const rpc = new SorobanRpc.Server(rpcUrl)

const networkPassphrase = Networks.TESTNET

const contract = new Client({
    ...networks.testnet,
    ...basicNodeSigner(keypair, networkPassphrase),
    networkPassphrase,
    contractId,
    publicKey,
    rpcUrl,
})

const { built, simulationData, ...rest } = await contract.call({
    sac: nativeSAC
})

rest.signAuthEntries()

console.log(built?.toXDR());

kalepail avatar Jul 24 '24 00:07 kalepail

cc @Shaptic @chadoh

leighmcculloch avatar Jul 24 '24 03:07 leighmcculloch

@kalepail do you have a test repository I can clone to experience this error? I'll try to reproduce with my own signAuthEntries use-case but it would help to see the original.

chadoh avatar Jul 29 '24 17:07 chadoh

I believe this is the same root cause as https://github.com/stellar/js-stellar-sdk/issues/1030

chadoh avatar Sep 10 '24 19:09 chadoh

Working on test cases

janewang avatar Sep 24 '24 20:09 janewang

@kalepail do you have a test repository I can clone to experience this error? I'll try to reproduce with my own signAuthEntries use-case but it would help to see the original.

It's not a simple example but I do have a branch on the smart wallet repo that surfaces this issue. https://github.com/kalepail/passkey-kit/tree/broken

Getting to it is a little tricky as you'll need to setup the smart wallet with some additional signing keys. However if you use the ./demo repo this should be pretty straight forward.

Please reach out on Discord and I'll get you setup.

Here's the specific line where things go wrong https://github.com/kalepail/passkey-kit/blob/broken/src/kit.ts#L355-L360

kalepail avatar Sep 25 '24 20:09 kalepail

This issue is stale because it has been assigned for 30 days with no activity. It will be closed in 30 days unless the stale label is removed, and the assignee is removed or updated.

github-actions[bot] avatar Dec 04 '24 18:12 github-actions[bot]

@chadoh this was technically fixed with a workaround, right?

ifropc avatar Dec 04 '24 21:12 ifropc

I believe this was fixed along with https://github.com/stellar/js-stellar-sdk/issues/1030 by https://github.com/stellar/js-stellar-sdk/pull/1044

chadoh avatar Dec 17 '24 21:12 chadoh