Skip to content

Commit

Permalink
eth/client: remove default gas limit attribute (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
q9f committed May 10, 2023
1 parent 5013702 commit 041aa92
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
14 changes: 4 additions & 10 deletions lib/eth/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,15 @@ class Client
# The default transaction max fee per gas in Wei, defaults to {Tx::DEFAULT_GAS_PRICE}.
attr_accessor :max_fee_per_gas

# The default gas limit for the transaction, defaults to {Tx::DEFAULT_GAS_LIMIT}.
attr_accessor :gas_limit

# A custom error type if a contract interaction fails.
class ContractExecutionError < StandardError; end

# Creates a new RPC-Client, either by providing an HTTP/S host or
# an IPC path. Supports basic authentication with username and password.
#
# **Note**, this sets the folling gas defaults: {Tx::DEFAULT_PRIORITY_FEE},
# {Tx::DEFAULT_GAS_PRICE}, and {Tx::DEFAULT_GAS_LIMIT}. Use
# {#max_priority_fee_per_gas}, {#max_fee_per_gas}, and {#gas_limit} to set
# custom values prior to submitting transactions.
# **Note**, this sets the folling gas defaults: {Tx::DEFAULT_PRIORITY_FEE}
# and {Tx::DEFAULT_GAS_PRICE. Use {#max_priority_fee_per_gas} and
# {#max_fee_per_gas} to set custom values prior to submitting transactions.
#
# @param host [String] either an HTTP/S host or an IPC path.
# @return [Eth::Client::Ipc] an IPC client.
Expand All @@ -64,7 +60,6 @@ def initialize(_)
@id = 0
@max_priority_fee_per_gas = Tx::DEFAULT_PRIORITY_FEE
@max_fee_per_gas = Tx::DEFAULT_GAS_PRICE
@gas_limit = Tx::DEFAULT_GAS_LIMIT
end

# Gets the default account (coinbase) of the connected client.
Expand Down Expand Up @@ -144,7 +139,7 @@ def transfer(destination, amount, **kwargs)
params = {
value: amount,
to: destination,
gas_limit: gas_limit,
gas_limit: Tx::DEFAULT_GAS_LIMIT,
chain_id: chain_id,
}
send_transaction(params, kwargs[:legacy], kwargs[:sender_key], kwargs[:nonce])
Expand Down Expand Up @@ -252,7 +247,6 @@ def deploy(contract, *args, **kwargs)
# @param *args optional function arguments.
# @param **sender_key [Eth::Key] the sender private key.
# @param **legacy [Boolean] enables legacy transactions (pre-EIP-1559).
# @param **gas_limit [Integer] optional gas limit override for calling the contract.
# @return [Object] returns the result of the call.
def call(contract, function, *args, **kwargs)
func = contract.functions.select { |func| func.name == function }
Expand Down
1 change: 0 additions & 1 deletion spec/eth/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
expect(geth_ipc.default_account).to be_instance_of Address
expect(geth_ipc.max_priority_fee_per_gas).to eq Tx::DEFAULT_PRIORITY_FEE
expect(geth_ipc.max_fee_per_gas).to eq Tx::DEFAULT_GAS_PRICE
expect(geth_ipc.gas_limit).to eq Tx::DEFAULT_GAS_LIMIT
end

it "http can query basic methods" do
Expand Down

0 comments on commit 041aa92

Please sign in to comment.