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

Add special parsing logic to handle typed array in payload #275

Merged

Conversation

Ethella
Copy link
Member

@Ethella Ethella commented Jan 28, 2022

πŸ“¦ Pull Request

  • Adds parsing logic to handle Buffer / TypedArray

βœ… Fixed Issues

Fixes #269

🚨 Test instructions

[Describe any additional context required to test the PR/feature/bug fix.]

⚠️ Don't forget to add a semver label!

  • patch: Bug Fix?
  • minor: New Feature?
  • major: Breaking Change?
  • skip-release: It's unnecessary to publish this change.

@Ethella Ethella added the minor Increment the minor version when merged label Jan 28, 2022
@Ethella Ethella requested a review from smithki January 28, 2022 05:19
@Ethella Ethella self-assigned this Jan 28, 2022
@shortcut-integration
Copy link

@Ethella Ethella requested a review from harryEth January 28, 2022 05:22
harryEth
harryEth previously approved these changes Jan 28, 2022
@Ethella Ethella requested review from Dizigen and dgerrellsMagic and removed request for Dizigen January 28, 2022 20:10
},
} as any);

setTimeout(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hopefully we are using https://jestjs.io/docs/timer-mocks here. Can you confirm?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure. I was just imitating the other test cases as this is my first unit test in this project.

Based on the context here, this setTimeout is only used in the unit test, so I don't think we should mock it.

Copy link
Contributor

Choose a reason for hiding this comment

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

The issue is that unless mocked, each test of this form adds a 100ms to the test run. Not alot but adds up over time. If we mock the setTimeout correctly, then it only adds the time it takes to run the test. Eg, 20 tests would take 10-20ms to run instead of 2000.

For now, lets just leave it but may be worth creating a cooldown ticket for.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sg

smithki
smithki previously approved these changes Jan 28, 2022

// silently handles exception and return the original copy
} catch (e) {
console.log(e);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we logging this error with enough context that it's obvious to the developer where it originates from? If not, we may want to make use of the MagicSDKWarning class and log it that way.

Copy link
Member Author

Choose a reason for hiding this comment

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

I had it removed and left empty. The message wasn't quite useful at all to developers as the code block has the original value returned whenever there's an exception.

If anyone encounters an un-recognizable payload in the future, we may ask the developers to submit their function calls to reproduce the payload.

dgerrellsMagic
dgerrellsMagic previously approved these changes Jan 28, 2022
@Ethella Ethella merged commit c60e205 into master Jan 31, 2022
@Ethella Ethella deleted the jerryliu-sc-48746-react-native-solana-magic-rpc-error-32603 branch January 31, 2022 19:16
@smithki
Copy link
Contributor

smithki commented Jan 31, 2022

πŸš€ PR was released in @magic-ext/[email protected], @magic-sdk/[email protected] πŸš€

@smithki smithki added the released This issue/pull request has been released. label Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Increment the minor version when merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

React Native Solana Magic RPC Error: [-32603] Internal error: Expected Buffer
4 participants