From 91693b1340c3658c3bc4fd0af80713d0905af1cf Mon Sep 17 00:00:00 2001 From: Afri <58883403+q9f@users.noreply.github.com> Date: Sun, 23 Jun 2024 20:27:10 +0200 Subject: [PATCH] eth/api: remove coinbase as default account (#269) * eth/api: remove coinbase as default account * solidity canary * solidity canary * fix codecov --- .github/workflows/spec.yml | 6 +++++- lib/eth/api.rb | 1 - lib/eth/client.rb | 16 ++++++++-------- spec/eth/solidity_spec.rb | 3 ++- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/spec.yml b/.github/workflows/spec.yml index 1b54754c..c0764932 100644 --- a/.github/workflows/spec.yml +++ b/.github/workflows/spec.yml @@ -49,5 +49,9 @@ jobs: run: | bundle exec rspec env: - COVERAGE: true INFURA_TOKEN: ${{ secrets.INFURA_TOKEN }} + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: false + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/lib/eth/api.rb b/lib/eth/api.rb index 2b6488b9..fe650154 100644 --- a/lib/eth/api.rb +++ b/lib/eth/api.rb @@ -115,7 +115,6 @@ module Api "eth_blockNumber", "eth_call", "eth_chainId", - "eth_coinbase", "eth_compileLLL", "eth_compileSerpent", "eth_compileSolidity", diff --git a/lib/eth/client.rb b/lib/eth/client.rb index b75bccad..ecd9dff6 100644 --- a/lib/eth/client.rb +++ b/lib/eth/client.rb @@ -25,7 +25,7 @@ class Client # The connected network's chain ID. attr_reader :chain_id - # The connected network's client coinbase. + # The connected network's client default account. attr_accessor :default_account # The default transaction max priority fee per gas in Wei, defaults to {Tx::DEFAULT_PRIORITY_FEE}. @@ -62,15 +62,15 @@ def initialize(_) @max_fee_per_gas = Tx::DEFAULT_GAS_PRICE end - # Gets the default account (coinbase) of the connected client. + # Gets the default account (first account) of the connected client. # # **Note**, that many remote providers (e.g., Infura) do not provide # any accounts. # - # @return [Eth::Address] the coinbase account address. + # @return [Eth::Address] the default account address. def default_account raise ArgumentError, "The default account is not available on remote connections!" unless local? || @default_account - @default_account ||= Address.new eth_coinbase["result"] + @default_account ||= Address.new eth_accounts["result"].first end # Gets the chain ID of the connected network. @@ -108,7 +108,7 @@ def resolve_ens(ens_name, registry = Ens::DEFAULT_ADDRESS, coin_type = Ens::Coin end # Simply transfer Ether to an account and waits for it to be mined. - # Uses `eth_coinbase` and external signer if no sender key is + # Uses `eth_accounts` and external signer if no sender key is # provided. # # See {#transfer} for params and overloads. @@ -119,7 +119,7 @@ def transfer_and_wait(destination, amount, **kwargs) end # Simply transfer Ether to an account without any call data or - # access lists attached. Uses `eth_coinbase` and external signer + # access lists attached. Uses `eth_accounts` and external signer # if no sender key is provided. # # **Note**, that many remote providers (e.g., Infura) do not provide @@ -179,7 +179,7 @@ def transfer_erc20(erc20_contract, destination, amount, **kwargs) end # Deploys a contract and waits for it to be mined. Uses - # `eth_coinbase` or external signer if no sender key is provided. + # `eth_accounts` or external signer if no sender key is provided. # # See {#deploy} for params and overloads. # @@ -190,7 +190,7 @@ def deploy_and_wait(contract, *args, **kwargs) contract.address = Address.new(addr).to_s end - # Deploys a contract. Uses `eth_coinbase` or external signer + # Deploys a contract. Uses `eth_accounts` or external signer # if no sender key is provided. # # **Note**, that many remote providers (e.g., Infura) do not provide diff --git a/spec/eth/solidity_spec.rb b/spec/eth/solidity_spec.rb index 4663f737..106eb2b3 100644 --- a/spec/eth/solidity_spec.rb +++ b/spec/eth/solidity_spec.rb @@ -34,7 +34,8 @@ result = solc.compile contract expect(result["DepositContract"]).to be payload = result["DepositContract"]["bin"] - expect(payload).to start_with "604060808152" + expect(payload).to start_with "60" + expect(payload).to end_with "33" params = { from: geth.default_account, priority_fee: 0,