Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Attempting to run transaction which calls a contract function, but recipient address 0x0... is not a contract address #878

Closed
emurmotol opened this issue Aug 21, 2018 · 2 comments

Comments

@emurmotol
Copy link

emurmotol commented Aug 21, 2018

Expected Behavior

No errors.

Current Behavior

Having an error:

Attempting to run transaction which calls a contract function, but recipient address 0x063a2b4d4084d2b18989cf8da9c84b501f337136 is not a contract address

Steps to Reproduce (for bugs)

Code:

func (as *ActionSuite) TestGanache() {
        ctx := context.Background()
        client, err = ethclient.Dial("http://127.0.0.1:7545")
        as.Nil(err)

        // Account addresses came from ganache
	sender := accounts.Account{Address: common.HexToAddress("0xBadaC482bE74E1925029C4260c35D8D5A6895F58")}
	receiver := accounts.Account{Address: common.HexToAddress("0x063a2b4D4084D2B18989cf8Da9C84B501f337136")}

	gasPrice, err := client.SuggestGasPrice(ctx)
	as.Nil(err)

	msg := ethereum.CallMsg{
		From:     sender.Address,
		To:       &receiver.Address,
		GasPrice: gasPrice,
		Value:    big.NewInt(1000000000000000000),
		Data:     []byte("Lorem ipsum amet"),
	}
	gasLimit, err := client.EstimateGas(ctx, msg)
	as.Nil(err) // Error triggered here
        logrus.Debugln(gasLimit)
}

Context

Trying to test ganache. Code works fine when using geth private network.

Your Environment

  • Ganache version 1.2.1
  • go-ethereum version 1.8.13-stable
  • Go version go1.10.3 linux/amd64
  • Ubuntu 18.04 LTS

Error Trace

&rpc.jsonError{Code:-32000, Message:"Attempting to run transaction which calls a contract function, but recipient address 0x063a2b4d4084d2b18989cf8da9c84b501f337136 is not a contract address", Data:map[string]interface {}{"stack":"Error\n    at /tmp/.mount_ganachPd0w3R/app/resources/app.asar/node_modules/ganache-cli/build/webpack:/ganache/node_modules/ganache-core/lib/statemanager.js:840:1\n    at /tmp/.mount_ganachPd0w3R/app/resources/app.asar/node_modules/ganache-cli/build/webpack:/ganache/node_modules/ganache-core/lib/statemanager.js:254:1\n    at /tmp/.mount_ganachPd0w3R/app/resources/app.asar/node_modules/ganache-cli/build/webpack:/ganache/node_modules/ganache-core/lib/blockchain_double.js:996:1\n    at e.exports.i.getCode (/tmp/.mount_ganachPd0w3R/app/resources/app.asar/node_modules/ganache-cli/build/webpack:/ganache/node_modules/ethereumjs-account/index.js:48:1)\n    at /tmp/.mount_ganachPd0w3R/app/resources/app.asar/node_modules/ganache-cli/build/webpack:/ganache/node_modules/ganache-core/lib/blockchain_double.js:990:1\n    at /tmp/.mount_ganachPd0w3R/app/resources/app.asar/node_modules/ganache-cli/build/webpack:/ganache/node_modules/merkle-patricia-tree/baseTrie.js:77:1\n    at /tmp/.mount_ganachPd0w3R/app/resources/app.asar/node_modules/ganache-cli/build/webpack:/ganache/node_modules/merkle-patricia-tree/baseTrie.js:461:1\n    at Object.return (/tmp/.mount_ganachPd0w3R/app/resources/app.asar/node_modules/ganache-cli/build/webpack:/ganache/node_modules/merkle-patricia-tree/baseTrie.js:485:1)\n    at /tmp/.mount_ganachPd0w3R/app/resources/app.asar/node_modules/ganache-cli/build/webpack:/ganache/node_modules/merkle-patricia-tree/baseTrie.js:285:1\n    at e (/tmp/.mount_ganachPd0w3R/app/resources/app.asar/node_modules/ganache-cli/build/webpack:/ganache/node_modules/merkle-patricia-tree/baseTrie.js:521:1)\n    at /tmp/.mount_ganachPd0w3R/app/resources/app.asar/node_modules/ganache-cli/build/webpack:/ganache/node_modules/merkle-patricia-tree/baseTrie.js:516:1\n    at /tmp/.mount_ganachPd0w3R/app/resources/app.asar/node_modules/ganache-cli/build/webpack:/ganache/node_modules/merkle-patricia-tree/baseTrie.js:180:1\n    at _combinedTickCallback (internal/process/next_tick.js:131:7)\n    at process._tickCallback (internal/process/next_tick.js:180:9)", "name":"r"}}
@emurmotol emurmotol changed the title "Attempting to run transaction which calls a contract function, but recipient address 0x0... is not a contract address Attempting to run transaction which calls a contract function, but recipient address 0x0... is not a contract address Aug 21, 2018
@davidmurdoch
Copy link
Member

Thanks for reporting this, @emurmotol. This is a known issue and is being tracked here: trufflesuite/ganache#117

@mikeseese
Copy link
Contributor

Closing in favor of the ganache-core issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants