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

Fix Single Provider in the FallbackProvider Array #3746

Closed
wants to merge 4 commits into from
Closed

Fix Single Provider in the FallbackProvider Array #3746

wants to merge 4 commits into from

Conversation

samuelexferri
Copy link

Fix the corner case where if only one provider was passed in the FallbackProvider array it would cause errors even simply on the provider.getBlockNumber().

Fix the issue #3745

@samuelexferri
Copy link
Author

@ricmoo

@ng-tony
Copy link

ng-tony commented Feb 14, 2023

I have a similar issue, but it fails whenever there is an odd number of providers.
I think the bug is from line 255

    const mid = values.length / 2; //When values.length is odd mid is a floating point

    // Odd-length; take the middle value
    if (values.length % 2) { return values[mid]; } //Indexing by a float

@ricmoo
Copy link
Member

ricmoo commented Feb 14, 2023

Please do not modify generated files, as it makes the diff to complicated. You should only need to modify files in the /src.ts/ folder.

@samuelexferri
Copy link
Author

Ok! Only one line has changed. I added Math.floor() function to the float variable "mid".

@ricmoo
Copy link
Member

ricmoo commented Feb 14, 2023

Lol! Awesome! Yes, that makes sense. I will get that change in for the next patch release. :)

@ricmoo ricmoo added bug Verified to be an issue. on-deck This Enhancement or Bug is currently being worked on. v6 Issues regarding v6 labels Feb 16, 2023
@ricmoo
Copy link
Member

ricmoo commented Feb 16, 2023

Merged into v6.0.4.

Thanks! :)

@ricmoo ricmoo closed this Feb 16, 2023
@samuelexferri samuelexferri deleted the fix-fallback-provider-single branch February 16, 2023 14:36
@samuelexferri samuelexferri restored the fix-fallback-provider-single branch February 16, 2023 14:38
@samuelexferri samuelexferri deleted the fix-fallback-provider-single branch February 16, 2023 14:42
@ricmoo ricmoo added fixed/complete This Bug is fixed or Enhancement is complete and published. and removed on-deck This Enhancement or Bug is currently being worked on. labels Feb 23, 2023
Woodpile37 pushed a commit to Woodpile37/ethers.js that referenced this pull request Jan 14, 2024
Woodpile37 pushed a commit to Woodpile37/ethers.js that referenced this pull request Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published. v6 Issues regarding v6
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants