-
Notifications
You must be signed in to change notification settings - Fork 78
Open
Description
Background
There are scenarios where the calculated value of the gas price to send with the RLN registration function call may become very large and possibly cause an overflow exception. We need to add a check for this and review our expectations of what the maximum gas price could potentially be (and how we simulate it in our tests).
Details
- GasPrice Calculation: https://github.com/waku-org/nwaku/blob/master/waku/waku_rln_relay/group_manager/on_chain/group_manager.nim#L230
var gasPrice: int
g.retryWrapper(gasPrice, "Failed to get gas price"):
int(await ethRpc.provider.eth_gasPrice()) * 2
- RLN Register Function call: https://github.com/waku-org/nwaku/blob/master/waku/waku_rln_relay/group_manager/on_chain/group_manager.nim#L242
g.retryWrapper(txHash, "Failed to register the member"):
await wakuRlnContract
.register(idCommitment, userMessageLimit.stuint(32), idCommitmentsToErase)
.send(gasPrice = gasPrice)
There are 2 factors contributing to this issue:
- The calculated value is assigned to an
int64, but the type returned by the gasPrice call (ethRpc.provider.eth_gasPrice()) isuint64
Gas prices are not expected to ever be so large to cause an overflow. - The gas prices from our test environment is much larger than expected and we need to understand why.
Acceptance criteria
- check for overflow when casting from uint64 to int64
- configure test environment to be as close to realistic as possible