Skip to content

chore: Review gas fee calculation and Anvil testnet config #3643

@stubbsta

Description

@stubbsta

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

  var gasPrice: int
  g.retryWrapper(gasPrice, "Failed to get gas price"):
    int(await ethRpc.provider.eth_gasPrice()) * 2
  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:

  1. The calculated value is assigned to an int64, but the type returned by the gasPrice call ( ethRpc.provider.eth_gasPrice()) is uint64
    Gas prices are not expected to ever be so large to cause an overflow.
  2. 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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions