caliper icon indicating copy to clipboard operation
caliper copied to clipboard

The ethereum adapter doesn't sign transactions when fromAddress and fromAddressPrivateKey are used in the networkConfig

Open benjamincburns opened this issue 5 years ago • 7 comments

Context

A user came to me asking for help. In his network config he was using fromAddress and fromAddressPrivateKey. This was causing failures on creating the contracts for his benchmarks, because Besu was reporting that eth_sendTransaction is not supported.

This only happens when web3.js isn't signing transactions on behalf of the user, and that only happens when the wallet for the sending account isn't set up correctly.

Expected Behavior

Transactions would be signed by web3.js for network configs that make use of the fields fromAddress and fromAddressPrivateKey.

Actual Behavior

Caliper doesn't sign transactions, and attempts to send transactions using the eth_sendTransaction RPC call. Besu responds to these calls with errors, and the benchmark fails.

Possible Fix

Likely the web3.js wallet isn't being set up properly.

Steps to Reproduce

  1. Run a benchmark using fromAddress and fromAddressPrivateKey instead of fromAddressSeed.

Should reproduce with any benchmark.

Your Environment

  • Version used: v0.3.0 and current master branch at time of writing
  • Environment name and version (e.g. Chrome 39, node.js 5.4): Uncertain - I wasn't the one who was running Caliper
  • Operating System and version (desktop or mobile): Uncertain

benjamincburns avatar Apr 16 '20 06:04 benjamincburns

@shemnon Any insights?

aklenik avatar Apr 16 '20 07:04 aklenik

@shemnon and I are working fairly closely these days. We haven't discussed this issue directly, but I'm fairly confident it's something to do with how the web3 wallet is initialized in this codepath here.

The user in question shared his networkConfig with me. Given what's happening I'd have thought that maybe he'd also specified a fromAddressSeed, but as you can see below, that's not the case.

{
    "caliper": {
        "blockchain": "ethereum"

    },
    "ethereum": {
        "url": "http://localhost:8545",
        "contractDeployerAddress": "0x627306090abaB3A6e1400e9345bC60c78a8BEf57",
        "contractDeployerAddressPrivateKey": "c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3",
        "fromAddress": "0x627306090abaB3A6e1400e9345bC60c78a8BEf57",
        "fromAddressPrivateKey": "c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3",
        "transactionConfirmationBlocks": 2,
        "contracts": {
            "simple": {
                "path": "build/test.json"
            }
        }
    }
}

benjamincburns avatar Apr 16 '20 21:04 benjamincburns

Also worth noting that switching to fromAddressSeed did in fact solve his problem.

benjamincburns avatar Apr 16 '20 21:04 benjamincburns

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 16 '20 22:05 stale[bot]

I don't think this issue should be closed yet. Go away stalebot! ;-)

benjamincburns avatar May 17 '20 18:05 benjamincburns

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 17 '20 03:06 stale[bot]

Labeled as a bug, so no stalebot from now on.

aklenik avatar Jun 17 '20 12:06 aklenik