Skip to content

Eth::Client#transact_and_wait expects gas_limit *kwargs method param and does not respect :gas_limit attr_accessor #221

@zackisaacs

Description

@zackisaacs

I'm using this gem in my project to create tokens, sign transactions, etc. It's been super helpful -- thank you!

I was struggling to understand why the :gas_limit attr_accessor I set after creating a new Eth::Client wasn't being respected, i.e.

      infura = Eth::Client.create('https://polygon-mainnet.infura.io/v3/xxx')
      infura.max_priority_fee_per_gas = 50 * Eth::Unit::GWEI
      infura.max_fee_per_gas = 150 * Eth::Unit::GWEI
      infura.gas_limit = 70000

I would submit transactions, they'd fail, I'd view them on polygonscan, and then see that the gas limit used for the transaction was 51000, which was much lower than the gas_limit attr_accessor I'd just set. I realize now this is because transact_and_wait and the underlying transact methods look for a gas_limit kwarg and fall back to Tx.estimate_intrinsic_gas(contract.bin) + Tx::CREATE_GAS instead of using the gas_limit attr_accessor.

Assuming this is the interface you want to keep, as opposed to making transactions respect the attr_accessor, I might suggest noting this behavior in the method docs and wiki. If you agree this would be useful, I'd be happy to submit a PR to this end.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions