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: handle 0 as fixed gas fee #1099

Merged
merged 2 commits into from
Apr 17, 2024

Conversation

abhinavmsra
Copy link
Contributor

Issue

For Free gas networks like GoQuorum, we need fixed_wei_value to be set to zero. However, the serializer check doesnt handle 0 for fixed types & raises APIException exception.

postgres=# select * from chains_gasprice;
-[ RECORD 1 ]------------+------------
id                       | 1
oracle_uri               | 
oracle_parameter         | 
gwei_factor              | 1.000000000
fixed_wei_value          | 0
rank                     | 100
chain_id                 | 
max_fee_per_gas          | 
max_priority_fee_per_gas | 

/api/v1/chains/:chainId/

{ "detail":"The gas price oracle or a fixed gas price was not provided for chain" }

Fix

This PR modifies the check to is not None to allow for zero values

/api/v1/chains/:chainId/

{
    ...,
    "gasPrice": [
       {
             "type": "fixed",
             "weiValue": "0"
        }
    ],
}

@abhinavmsra abhinavmsra requested a review from a team as a code owner April 10, 2024 09:53
@coveralls
Copy link

coveralls commented Apr 10, 2024

Pull Request Test Coverage Report for Build 8715973662

Details

  • 9 of 9 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.3%) to 99.892%

Totals Coverage Status
Change from base Build 8634197591: 0.3%
Covered Lines: 4606
Relevant Lines: 4611

💛 - Coveralls

Copy link
Member

@iamacook iamacook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution, @abhinavmsra!

Other than missing a test case, all looks good to me. Can you add coverage in ChainGasPriceOracleTestCase? We can then get this merged and released.

@abhinavmsra
Copy link
Contributor Author

@iamacook added tests as requested

Copy link
Member

@iamacook iamacook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iamacook added tests as requested

Thanks again, @abhinavmsra!

@iamacook iamacook merged commit 023fb66 into safe-global:main Apr 17, 2024
8 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 17, 2024
@abhinavmsra abhinavmsra deleted the fix/free-gas-network branch April 17, 2024 07:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants