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

@trezor/connect stellar plugin #5358

Closed
mroz22 opened this issue May 9, 2022 · 15 comments
Closed

@trezor/connect stellar plugin #5358

mroz22 opened this issue May 9, 2022 · 15 comments
Assignees
Labels
code Code improvements connect Connect API related (ie. fee calculation)

Comments

@mroz22
Copy link
Contributor

mroz22 commented May 9, 2022

trezor-connect is being migrated from old repository to this place.

Asses the state of stellar 3rd party implementation. Are there some? Is @trezor/connect version 9 good enough for them to work?

We probably should create @trezor/connect-plugin-stellar see in the old codebase here but there are multiple versions of stellar-sdk. It would be great if we were sure that the newly created plugin works with the latest version and has some tests also.

cc: @overcat

related
#4876 #4890

@overcat
Copy link
Contributor

overcat commented May 10, 2022

Asses the state of stellar 3rd party implementation. Are there some? Is @trezor/connect version 9 good enough for them to work?

The latest trezor-connect version is 8.2.8, I'm not sure what you mean by @trezor/connect version 9.

There is a bug in the latest version that prevents pathPaymentStrictSend from working properly, I've submitted a PR to fix it, I know of the following services that use trezor-connect, only laboratory is currently affected by this bug

We probably should create @trezor/connect-plugin-stellar see in the old codebase here but there are multiple versions of stellar-sdk. It would be great if we were sure that the newly created plugin works with the latest version and has some tests also.

It's great to create a separate package, I added some unit tests in trezor/connect#1091, maybe we should add integration tests too

@sime
Copy link
Member

sime commented May 10, 2022

Asses the state of stellar 3rd party implementation. Are there some? Is @trezor/connect version 9 good enough for them to work?

The latest trezor-connect version is 8.2.8, I'm not sure what you mean by @trezor/connect version 9.

v9 is the integration https://github.com/trezor/connect into the trezor-suite repository, which includes efforts to convert the codebase to TypeScript. You are right that it is not released yet.

@hynek-jina hynek-jina added MEDIUM and removed HIGH labels May 11, 2022
@hynek-jina hynek-jina removed the MEDIUM label Jun 8, 2022
@overcat
Copy link
Contributor

overcat commented Jun 16, 2022

🎉 #5450 has been merged, I will be integrating the new code in Stellar Laboratory this week to see if it works as expected.

@mroz22
Copy link
Contributor Author

mroz22 commented Jun 16, 2022

tada #5450 has been merged, I will be integrating the new code in Stellar Laboratory this week to see if it works as expected.

I will let you know once this is released to npm

@mroz22
Copy link
Contributor Author

mroz22 commented Jun 17, 2022

@overcat please try
https://www.npmjs.com/package/@trezor/connect-plugin-stellar
https://www.npmjs.com/package/@trezor/connect
https://www.npmjs.com/package/@trezor/connect-web

we are going to focus on updating docs now, so please let us know if there is something uncleare.

@overcat
Copy link
Contributor

overcat commented Jun 17, 2022

Hi @mroz22, I got an error when I tried to upgrade, could you please take a look?

code change: https://github.com/overcat/laboratory/pull/1/files
build log: https://github.com/overcat/laboratory/runs/6932210774?check_suite_focus=true

error info:

Cannot find module '@trezor/transport/lib/types/messages' from 'node_modules/@trezor/connect/lib/constants/index.js'

@hynek-jina
Copy link
Contributor

Will be tested by 3rd party.. No requirements on QA.

@mroz22
Copy link
Contributor Author

mroz22 commented Jun 21, 2022

Hi @overcat
Your problem should be fixed now, try @trezor/connect-web version 9.0.0-beta.2
Just tried to build laboratory locally and it did work on my machine.

@overcat
Copy link
Contributor

overcat commented Jun 21, 2022

Hi @mroz22, got another error while running the test, which I think is caused by @trezor/connect.

log: https://github.com/overcat/laboratory/runs/6986247890?check_suite_focus=true

yarn test:jest

FAIL src/views/__tests__/EndpointExplorer.test.tsx
  ● Test suite failed to run
    Cannot find module '@trezor/connect-common/lib/storage' from 'node_modules/@trezor/connect/lib/core/AbstractMethod.js'
    Require stack:
      node_modules/@trezor/connect/lib/core/AbstractMethod.js
      node_modules/@trezor/connect/lib/api/applyFlags.js
      node_modules/@trezor/connect/lib/api/index.js
      node_modules/@trezor/connect/lib/core/method.js
      node_modules/@trezor/connect/lib/core/index.js
      node_modules/@trezor/connect/lib/index.js
      node_modules/@trezor/connect-web/lib/iframe/index.js
      node_modules/@trezor/connect-web/lib/index.js
      src/actions/transactionSigner.js
      src/reducers/transactionSigner.js
      src/config/store.ts
      src/helpers/testHelpers.tsx
      src/views/__tests__/EndpointExplorer.test.tsx
      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:306:11)
      at Object.<anonymous> (node_modules/@trezor/connect/lib/core/AbstractMethod.js:[5](https://github.com/overcat/laboratory/runs/6986247890?check_suite_focus=true#step:5:6):43)

@mroz22
Copy link
Contributor Author

mroz22 commented Jun 21, 2022

ouch, you are right, sorry, I will need to improve my checks to prevent this. Working on that.

@mroz22
Copy link
Contributor Author

mroz22 commented Jun 22, 2022

Sooo, 9.0.0-beta.4 installs and runs tests but I get some other error running tests . This might be something with stellar plugin maybe?

console.error
      RangeError [ERR_BUFFER_OUT_OF_BOUNDS]: Attempt to access memory outside buffer bounds
          at new NodeError (internal/errors.js:322:7)
          at boundsError (internal/buffer.js:83:11)
          at Buffer.readInt32BE (internal/buffer.js:481:5)
          at Cursor.read [as readInt32BE] (/home/mroz/repos/laboratory/node_modules/js-xdr/lib/cursor.js:169:38)
          at Object.read (/home/mroz/repos/laboratory/node_modules/js-xdr/lib/int.js:20:15)
          at Function.read (/home/mroz/repos/laboratory/node_modules/js-xdr/lib/enum.js:43:29)
          at Function.read (/home/mroz/repos/laboratory/node_modules/js-xdr/lib/union.js:111:36)
          at Function.fromXDR (/home/mroz/repos/laboratory/node_modules/js-xdr/lib/io-mixin.js:51:23)
          at new fromXDR (/home/mroz/repos/laboratory/node_modules/stellar-base/lib/transaction_builder.js:680:71)
          at /home/mroz/repos/laboratory/src/actions/xdrViewer.js:49:16 {
        code: 'ERR_BUFFER_OUT_OF_BOUNDS'

@overcat
Copy link
Contributor

overcat commented Jun 22, 2022

Sooo, 9.0.0-beta.4 installs and runs tests but I get some other error running tests . This might be something with stellar plugin maybe?

console.error
      RangeError [ERR_BUFFER_OUT_OF_BOUNDS]: Attempt to access memory outside buffer bounds
          at new NodeError (internal/errors.js:322:7)
          at boundsError (internal/buffer.js:83:11)
          at Buffer.readInt32BE (internal/buffer.js:481:5)
          at Cursor.read [as readInt32BE] (/home/mroz/repos/laboratory/node_modules/js-xdr/lib/cursor.js:169:38)
          at Object.read (/home/mroz/repos/laboratory/node_modules/js-xdr/lib/int.js:20:15)
          at Function.read (/home/mroz/repos/laboratory/node_modules/js-xdr/lib/enum.js:43:29)
          at Function.read (/home/mroz/repos/laboratory/node_modules/js-xdr/lib/union.js:111:36)
          at Function.fromXDR (/home/mroz/repos/laboratory/node_modules/js-xdr/lib/io-mixin.js:51:23)
          at new fromXDR (/home/mroz/repos/laboratory/node_modules/stellar-base/lib/transaction_builder.js:680:71)
          at /home/mroz/repos/laboratory/src/actions/xdrViewer.js:49:16 {
        code: 'ERR_BUFFER_OUT_OF_BOUNDS'

I think this error is not caused by upgrading trezor libraries.

@overcat
Copy link
Contributor

overcat commented Jun 24, 2022

✅ I ran some tests and all test cases pass.

Version:

"@trezor/connect-plugin-stellar": "9.0.0-beta.1",
"@trezor/connect-web": "9.0.0-beta.4",

Device: Model T and Model One with the latest firmware

Laboratory url: https://laboratory-mihyld7ic-overcat.vercel.app/#txsigner?network=test

test cases
  1. The XDR contains all Trezor supported operations:
    AAAAAgAAAACjaq9KQUVpnO9e09mXAoaUo/bORBjJRHz7oDqjowmeewAAD6ABb2zHAAAQKAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAtUcmV6b3IgVGVzdAAAAAAUAAAAAQAAAACjaq9KQUVpnO9e09mXAoaUo/bORBjJRHz7oDqjowmeewAAAAAAAAAAtGn4J8Joof5VAq9VhwERFiPjv/iBdLOwbVZIjMUu/rgAAAAC39wcNAAAAAEAAAAAo2qvSkFFaZzvXtPZlwKGlKP2zkQYyUR8+6A6o6MJnnsAAAAGAAAAAVVTRAAAAAAAm466+JY4VR3PnqT3QyBxEGuHqw4ts9abdaU4InL3Wdh//////////wAAAAEAAAAAo2qvSkFFaZzvXtPZlwKGlKP2zkQYyUR8+6A6o6MJnnsAAAAGAAAAAVVTRAAAAAAAm466+JY4VR3PnqT3QyBxEGuHqw4ts9abdaU4InL3WdgAAAA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KNqr0pBRWmc717T2ZcChpSj9s5EGMlEfPugOqOjCZ57AAAACAAAAAC0afgnwmih/lUCr1WHAREWI+O/+IF0s7BtVkiMxS7+uAAAAAEAAAAAo2qvSkFFaZzvXtPZlwKGlKP2zkQYyUR8+6A6o6MJnnsAAAAKAAAABWhlbGxvAAAAAAAAAQAAAAV3b3JsZAAAAAAAAAEAAAAAo2qvSkFFaZzvXtPZlwKGlKP2zkQYyUR8+6A6o6MJnnsAAAAKAAAACmJ5dGVzX2RhdGEAAAAAAAEAAAAUczinjy586kt+0QVo3/Jg11lamlYAAAABAAAAAKNqr0pBRWmc717T2ZcChpSj9s5EGMlEfPugOqOjCZ57AAAACgAAAAplbXB0eV9kYXRhAAAAAAAAAAAAAQAAAACjaq9KQUVpnO9e09mXAoaUo/bORBjJRHz7oDqjowmeewAAAAsBb2zHAAFvVAAAAAAAAAAA

  2. The XDR contains all Trezor supported operations, but the source of the operation is set to None:
    AAAAAgAAAACjaq9KQUVpnO9e09mXAoaUo/bORBjJRHz7oDqjowmeewAAD6ABb2zHAAAQKAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAtUcmV6b3IgVGVzdAAAAAAUAAAAAAAAAAAAAAAAtGn4J8Joof5VAq9VhwERFiPjv/iBdLOwbVZIjMUu/rgAAAAC39wcNAAAAAAAAAAGAAAAAVVTRAAAAAAAm466+JY4VR3PnqT3QyBxEGuHqw4ts9abdaU4InL3Wdh//////////wAAAAAAAAAGAAAAAVVTRAAAAAAAm466+JY4VR3PnqT3QyBxEGuHqw4ts9abdaU4InL3WdgAAAAAAAAAAAAAAAAAAAABAAAAALRp+CfCaKH+VQKvVYcBERYj47/4gXSzsG1WSIzFLv64AAAAAVVTRAAAAAAAm466+JY4VR3PnqT3QyBxEGuHqw4ts9abdaU4InL3WdgAAAAXSKs+cAAAAAAAAAACAAAAAAAAAAA7veJgAAAAALRp+CfCaKH+VQKvVYcBERYj47/4gXSzsG1WSIzFLv64AAAAAVVTRAAAAAAA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MgcRBrh6sOLbPWm3WlOCJy91nYAAAAF5h3vuwAqmW/AADDUAAAAAAAAeJAAAAAAAAAAAMAAAAAAAAAAVVTRAAAAAAAm466+JY4VR3PnqT3QyBxEGuHqw4ts9abdaU4InL3WdgAATdb/icAoAATduEAAAH0AAAAAAAAAAAAAAAAAAAABAAAAAAAAAABVVNEAAAAAACbjrr4ljhVHc+epPdDIHEQa4erDi2z1pt1pTgicvdZ2AAAAAAGGaaAAAEV/wAAw1AAAAAAAAAACAAAAAC0afgnwmih/lUCr1WHAREWI+O/+IF0s7BtVkiMxS7+uAAAAAAAAAAKAAAABWhlbGxvAAAAAAAAAQAAAAV3b3JsZAAAAAAAAAAAAAAKAAAACmJ5dGVzX2RhdGEAAAAAAAEAAAAUczinjy586kt+0QVo3/Jg11lamlYAAAAAAAAACgAAAAplbXB0eV9kYXRhAAAAAAAAAAAAAAAAAAsBb2zHAAFvVAAAAAAAAAAA

  3. The XDR contains specific Timebounds:
    AAAAAgAAAACjaq9KQUVpnO9e09mXAoaUo/bORBjJRHz7oDqjowmeewAAAMgBb2zHAAAQKAAAAAEAAAAAYrUiFwAAAABitSIXAAAAAQAAAAtUcmV6b3IgVGVzdAAAAAABAAAAAQAAAACjaq9KQUVpnO9e09mXAoaUo/bORBjJRHz7oDqjowmeewAAAAsBb2zHAAFvVAAAAAAAAAAA

  4. The XDR contains ID Memo:
    AAAAAgAAAACjaq9KQUVpnO9e09mXAoaUo/bORBjJRHz7oDqjowmeewAAAMgBb2zHAAAQKAAAAAEAAAAAYrUiFwAAAABitSIXAAAAAgAAAAAAEtaHAAAAAQAAAAEAAAAAo2qvSkFFaZzvXtPZlwKGlKP2zkQYyUR8+6A6o6MJnnsAAAALAW9sxwABb1QAAAAAAAAAAA==

  5. The XDR contains Hash Memo:
    AAAAAgAAAACjaq9KQUVpnO9e09mXAoaUo/bORBjJRHz7oDqjowmeewAAAMgBb2zHAAAQKAAAAAEAAAAAYrUiFwAAAABitSIXAAAAAzOJ6fDxpl8Zc2ys9UTC6CUxPoRH9WkjO7jbOapgfIiJAAAAAQAAAAEAAAAAo2qvSkFFaZzvXtPZlwKGlKP2zkQYyUR8+6A6o6MJnnsAAAALAW9sxwABb1QAAAAAAAAAAA==

  6. The XDR contains Return Hash Memo:
    AAAAAgAAAACjaq9KQUVpnO9e09mXAoaUo/bORBjJRHz7oDqjowmeewAAAMgBb2zHAAAQKAAAAAEAAAAAYrUiFwAAAABitSIXAAAABDOJ6fDxpl8Zc2ys9UTC6CUxPoRH9WkjO7jbOapgfIiJAAAAAQAAAAEAAAAAo2qvSkFFaZzvXtPZlwKGlKP2zkQYyUR8+6A6o6MJnnsAAAALAW9sxwABb1QAAAAAAAAAAA==

  7. The XDR contains None Memo:
    AAAAAgAAAACjaq9KQUVpnO9e09mXAoaUo/bORBjJRHz7oDqjowmeewAAAMgBb2zHAAAQKAAAAAEAAAAAYrUiFwAAAABitSIXAAAAAAAAAAEAAAABAAAAAKNqr0pBRWmc717T2ZcChpSj9s5EGMlEfPugOqOjCZ57AAAACwFvbMcAAW9UAAAAAAAAAAA=

  8. The source of the operation in this XDR is not equal to the source of the transaction:
    AAAAAgAAAACjaq9KQUVpnO9e09mXAoaUo/bORBjJRHz7oDqjowmeewAAAMgBb2zHAAAQKAAAAAEAAAAAYrUiFwAAAABitSIXAAAAAQAAAAtUcmV6b3IgVGVzdAAAAAABAAAAAQAAAAC0afgnwmih/lUCr1WHAREWI+O/+IF0s7BtVkiMxS7+uAAAAAsBb2zHAAFvVAAAAAAAAAAA

@hynek-jina
Copy link
Contributor

@mroz22 Can we close the issue?

@mroz22
Copy link
Contributor Author

mroz22 commented Jun 30, 2022

I think we can close it for now. If there are still problems, @overcat can always reopen. So far thaks for collaboration!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code Code improvements connect Connect API related (ie. fee calculation)
Projects
Archived in project
Development

No branches or pull requests

4 participants