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

Run a quick check through the constant integers to ensure that they honor a zero default value. #3263

Open
ebadiere opened this issue Nov 14, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ebadiere
Copy link
Contributor

Description

While working on an acceptance test I noticed that the zero value for the HBAR_RATE_LIMIT_TINYBAR was not getting picked up. Most likely because the logical OR operator || returns the first truthy value and 0 is falsy. The nullish coalescing operator ?? falls back to the default value when the left-hand operand is null or undefined, not when it's 0 or any other falsy value.

Steps to reproduce

Look for an environment variable that would take an integer number and set it to 0 for the default value. See if it gets picked up.

Go through all the environment variables of number type and see how they are mapped in the constants. Something like this could be problematic:

HBAR_RATE_LIMIT_TOTAL: BigNumber(ConfigService.get('HBAR_RATE_LIMIT_TINYBAR') || '800000000000'), // 8000 HBARs

Additional context

No response

Hedera network

other

Version

v0.59.3

Operating system

macOS

@ebadiere ebadiere added the bug Something isn't working label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant