Remove custom Buffer.subarray polyfill#795
Conversation
Shaptic
left a comment
There was a problem hiding this comment.
Nice, a robust package you can just install is way better than a package-specific monkeypatch. Since this is breaking I'll have to merge it as part of Protocol 23 but I'll approve it. I'll also have to remember to add this caveat to the RN instructions.
|
Update: Let me see what kind of feedback the Trezor team will provide. |
|
Hi @Shaptic, I'm a bit lost. If we remove this polyfill and patch it directly where it's used, like in Trezor Suite, will it affect the Stellar SDK internally? It seems not? Is this related to our webpack configuration? Update: They do not use the same Buffer. |
|
I created a repository to reproduce the current SDK's strange behavior. https://github.com/overcat/StellarSDKBufferDebugApp/blob/main/app/(tabs)/index.tsx#L7-L60 If you want to run it, you need to configure the environment according to RN's instructions: https://reactnative.dev/docs/set-up-your-environment This is the output on my end: |
|
It seems that polyfill in |
|
🤦♂️ The stellar-sdk does not use the compiled stellar-base, so the Buffer used by stellar-base is the unpatched version provided by stellar-sdk, which leads to this strange behavior. Why doesn't stellar-sdk use the compiled stellar-base? I don't know. Patching Buffer in the stellar-sdk package can fix this issue, but it's still quite strange. It would be great if Facebook could fix the bug in the engine 😭 |
|
#798 should be able to solve the above problem |
|
Hi @Shaptic, I think we can merge it. |
In the latest version of React Native, the current patch implementation seems to not work smoothly, so let's remove it and instead use
@exodus/patch-broken-hermes-typed-arraysto fix this issue. The@exodus/patch-broken-hermes-typed-arraysis used by well-known applications like Rabby Wallet and Exodus, so I believe it should be trustworthy.P.S. Without removing this patch, using @exodus/patch-broken-hermes-typed-arrays can also make everything work smoothly, so there is no rush to release a new version.
stellar/js-xdr#128