-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
web3.js: Deprecate async methods “recently” made sync #25648
Comments
I think the only person in the world who cares about these optimizations is me, but it's a bit irritating to watch thousands of hours of engineering work get forgotten and be replaced with a simpler abstraction that works. I am fine with deprecating it. Shipping speed is more important than my bikeshedding |
I care. It's hard to know where the global maximum is here, while all of these things are true:
All of the asymmetry here either makes things malperformant, confusing, or complex. It's like an iron triangle but where each point is only bad things. |
Woah, are we really importing the entire Ethers lib just to use that one utility function? (asking because Ethers ships with small modular packages that we should very much use if possible) Edit: this was apparently changed to only import the needed hash function: Line 60 in 56d38e4
|
Plus here, another reason to make them sync - imagine writing synchronous JS code and here you need to somehow include promise resolving. Strange thing. Personally, I created simple replacement in my projects - just got sources and a bit rewrote them. Saved me a lot of possible rewritings :) |
Yeah, the question is whether the ethers library is tree-shakable or not. I almost certainly investigated this in #25014, but I investigated a lot of library dependencies in that PR that I don't remember. I'll get back to it, and get these dependencies under control. |
As originally imported, it was grabbing |
Yeah, that's never the whole story with tree-shaking though. For instance, the
|
Problem
createProgramAddress
andfindProgramAddress
are async methods, despite having no awaitables in their implementation. A developer using these methods will incorrectly presume that their code needs to be made async. This leads to a proliferation of async/await in the ecosystem which reduces the overall reliability and performance of apps.Proposed Solution
Discourage people from using them by marking their method signatures as
@deprecated
.Alternate solution
The only reason that these methods were made sync was because the last bit of async code was removed from
createProgramAddress
. That code was replaced with a sync version because it was incompatible in some way with React Native. cc/ @dr497Instead, we might consider doubling down on restoring the former glory of the async version, by using an async hash method, then adding a React Native compatible hashing algorithm using the
__forks__
directory. Last step would be to build a React Native bundle.The text was updated successfully, but these errors were encountered: