Allow switchable bls to detect the right implementation
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- api
Research direction
Start at the @chainsafe/bls/switchable entry point and trace the existing init logic that detects the implementation. Define how an automatic default should select the implementation without top-level await, then verify that the exported BLS object is usable after initialization across the affected environments.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem? Please describe.
Found out during the testing that on some environment top-level-await are not properly supported. Which are used to initialize the BLS object if the package is imported directly.
Describe the solution you'd like
The best approach to fit in all cases is to import the BLS from the switchable. And when is appropriate use the init to initialize the object.
import bls, {init} from "@chainsafe/bls/switchable";
That init does accept one parameter and it's redundant to identify and pass the parameter for the right implementation. This logic of detecting is already part of the package so we can reuse here. We can provide third option here auto which could be the default value as well. So user don't need to write custom logic and switchable will detect the right implementation.
Describe alternatives you've considered
The alternative safe approach is to use the await import. But that can't be done with correct user experience as code outside that block will not access to the bls object.
Additional context
https://github.com/ChainSafe/lodestar/issues/2723
- Dominant language
- TypeScript
- Stars
- 106
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ChainSafe/bls
-
good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
-
good first issue help wanted
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 30/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
danielmiessler/LifeOS#2218 ·