Skip to content

Conversation

@stubbsta
Copy link
Contributor

@stubbsta stubbsta commented Nov 6, 2025

Description

Casting from uint64 to int may cause overflow error.
The register proc in the on_chain groupmanager makes an rpc call to get the gas price (which is uint64), multiplies it by 2 and casts to int to be used in the web3 send method.

Changes

Check for overflow before casting and use max int value if there is an overflow.

relates to #3643

@github-actions
Copy link

github-actions bot commented Nov 6, 2025

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:3636

Built from 83dac2b

@stubbsta stubbsta changed the title Check for gasPrice overflow chore: Add gasprice overflow check Nov 26, 2025
@stubbsta
Copy link
Contributor Author

@Ivansete-status This PR is now ready for review, it is one part of resolving #3643

Copy link
Collaborator

@Ivansete-status Ivansete-status left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for it! 💯
Just added a couple of nitpicks :)

Comment on lines 236 to 237
trace "Gas price overflow detected, capping at maximum int value",
fetchedGasPrice = fetchedGasPrice, maxInt = high(int)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe :) ?

Suggested change
trace "Gas price overflow detected, capping at maximum int value",
fetchedGasPrice = fetchedGasPrice, maxInt = high(int)
warn "Gas price overflow detected, capping at maximum int value",
fetchedGasPrice = fetchedGasPrice, maxInt = high(int)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated in ac230ad

@stubbsta stubbsta force-pushed the fix/gasprice-variable-type branch from d47bbce to 5983c85 Compare December 4, 2025 07:26
@stubbsta stubbsta merged commit a8590a0 into master Dec 4, 2025
10 of 12 checks passed
@stubbsta stubbsta deleted the fix/gasprice-variable-type branch December 4, 2025 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants