Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Contract deploy fails in dev mode #10753

Closed
nbt-rezaem opened this issue Jun 14, 2019 · 2 comments · Fixed by #10809
Closed

Contract deploy fails in dev mode #10753

nbt-rezaem opened this issue Jun 14, 2019 · 2 comments · Fixed by #10809

Comments

@nbt-rezaem
Copy link
Contributor

  • Parity Ethereum version: Parity-Ethereum/v2.4.7-stable-d6c55469c-20190611/x86_64-linux-gnu/rustc1.35.0
  • Operating system: Linux
  • Installation: built from source
  • Fully synchronized: no, using dev network
  • Network: dev
  • Restarted: yes -- using dev network and for each test I rm -rf ~/.local/share/io.parity.ethereum

I'm trying to deploy a contract in dev mode (./target/release/parity --config dev -l debug), and it consumes all available gas, 6x as much as necessary and then fails. I've made the following minimal test case. The test case works on ganache and pantheon. All keys/accounts are test values and are not from any real wallet.

The test starts with a clean slate (removes the data), so be careful if you're running a real node.

Parity startup: rm -rf ~/.local/share/io.parity.ethereum; ./target/release/parity --config dev -l debug
ganache startup: ganache-cli --account '0x4d5db4107d237df6a3d58ee5f70ae63d73d7658d4026f2eefd2f204c81682cb7',10000000000000000000000 --networkId 17
pantheon startup: rm -rf database; pantheon --network=dev --rpc-http-enabled --miner-enabled --miner-coinbase=0xfe3b557e8fb62b89f4916b721be55ceb828dbd73
First, we fund a test account for ganache and parity:
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["0xf86c808504a817c800825208942740f3a3d3bc249e1bc812b8e1c315947933342d888ac7230489e80000801ba06d71401c9cb6f2cbe4cc4f0b1fa39a16121a44121c440b410acffa682598ae1aa058ea7ed0a3b0c6a129400b5c2eda7b6f681daf95112710430e0e5f7af879c126"],"id":4}' http://localhost:8545

Funding the test account for pantheon with:
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["0xf869808203e8825208942740f3a3d3bc249e1bc812b8e1c315947933342d888ac7230489e80000801ba0618f811e695a680fb315cbaab70af9fddea907077445590f97c66318bb4f8e85a01e326f3e5c90f4bfa85bd1c6097f5c62222b95c554e0200622b69562a2e3dd16"],"id":4}' http://localhost:8545

Then we deploy the contract for the funded account:
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["0xf9104f808504a817c800835b8d808080b90ffa60806040523480156200001157600080fd5b5060405162000efa38038062000efa833981018060405260808110156200003757600080fd5b8101908080516401000000008111156200005057600080fd5b820160208101848111156200006457600080fd5b81516401000000008111828201871017156200007f57600080fd5b505092919060200180516401000000008111156200009c57600080fd5b82016020810184811115620000b057600080fd5b8151640100000000811182820187101715620000cb57600080fd5b50506020808301516040909301518651929550929350859185918591620000f991600091908601906200030a565b5081516200010f9060019060208501906200030a565b506002805460ff191660ff92909216919091179055506200013990503362000155602090811b901c565b6200014b3382620001a760201b60201c565b50505050620003af565b620001708160066200026460201b62000a7b1790919060201c565b6040516001600160a01b038216907f6ae172837ea30b801fbfcdd4108aa1d5bf8ff775444fd70256b44e6bf3dfc3f690600090a250565b6001600160a01b038216620001bb57600080fd5b620001d781600554620002ba60201b620008051790919060201c565b6005556001600160a01b0382166000908152600360209081526040909120546200020c91839062000805620002ba821b17901c565b6001600160a01b03831660008181526003602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6001600160a01b0381166200027857600080fd5b6200028a8282620002d460201b60201c565b156200029557600080fd5b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b600082820183811015620002cd57600080fd5b9392505050565b60006001600160a01b038216620002ea57600080fd5b506001600160a01b03166000908152602091909152604090205460ff1690565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200034d57805160ff19168380011785556200037d565b828001600101855582156200037d579182015b828111156200037d57825182559160200191906001019062000360565b506200038b9291506200038f565b5090565b620003ac91905b808211156200038b576000815560010162000396565b90565b610b3b80620003bf6000396000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c806370a08231116100a257806398650275116100715780639865027514610332578063a457c2d71461033a578063a9059cbb14610366578063aa271e1a14610392578063dd62ed3e146103b85761010b565b806370a08231146102b257806379cc6790146102d857806395d89b4114610304578063983b2d561461030c5761010b565b8063313ce567116100de578063313ce5671461021d578063395093511461023b57806340c10f191461026757806342966c68146102935761010b565b806306fdde0314610110578063095ea7b31461018d57806318160ddd146101cd57806323b872dd146101e7575b600080fd5b6101186103e6565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015257818101518382015260200161013a565b50505050905090810190601f16801561017f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101b9600480360360408110156101a357600080fd5b506001600160a01b03813516906020013561047c565b604080519115158252519081900360200190f35b6101d5610492565b60408051918252519081900360200190f35b6101b9600480360360608110156101fd57600080fd5b506001600160a01b03813581169160208101359091169060400135610498565b6102256104ef565b6040805160ff9092168252519081900360200190f35b6101b96004803603604081101561025157600080fd5b506001600160a01b0381351690602001356104f8565b6101b96004803603604081101561027d57600080fd5b506001600160a01b038135169060200135610534565b6102b0600480360360208110156102a957600080fd5b5035610552565b005b6101d5600480360360208110156102c857600080fd5b50356001600160a01b031661055f565b6102b0600480360360408110156102ee57600080fd5b506001600160a01b03813516906020013561057a565b610118610588565b6102b06004803603602081101561032257600080fd5b50356001600160a01b03166105e8565b6102b0610603565b6101b96004803603604081101561035057600080fd5b506001600160a01b03813516906020013561060e565b6101b96004803603604081101561037c57600080fd5b506001600160a01b03813516906020013561064a565b6101b9600480360360208110156103a857600080fd5b50356001600160a01b0316610657565b6101d5600480360360408110156103ce57600080fd5b506001600160a01b0381358116916020013516610670565b60008054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104725780601f1061044757610100808354040283529160200191610472565b820191906000526020600020905b81548152906001019060200180831161045557829003601f168201915b5050505050905090565b600061048933848461069b565b50600192915050565b60055490565b60006104a5848484610723565b6001600160a01b0384166000908152600460209081526040808320338085529252909120546104e59186916104e0908663ffffffff6107f016565b61069b565b5060019392505050565b60025460ff1690565b3360008181526004602090815260408083206001600160a01b038716845290915281205490916104899185906104e0908663ffffffff61080516565b600061053f33610657565b61054857600080fd5b610489838361081e565b61055c33826108c8565b50565b6001600160a01b031660009081526003602052604090205490565b6105848282610971565b5050565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156104725780601f1061044757610100808354040283529160200191610472565b6105f133610657565b6105fa57600080fd5b61055c816109b6565b61060c336109fe565b565b3360008181526004602090815260408083206001600160a01b038716845290915281205490916104899185906104e0908663ffffffff6107f016565b6000610489338484610723565b600061066a60068363ffffffff610a4616565b92915050565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6001600160a01b0382166106ae57600080fd5b6001600160a01b0383166106c157600080fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b03821661073657600080fd5b6001600160a01b03831660009081526003602052604090205461075f908263ffffffff6107f016565b6001600160a01b038085166000908152600360205260408082209390935590841681522054610794908263ffffffff61080516565b6001600160a01b0380841660008181526003602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6000828211156107ff57600080fd5b50900390565b60008282018381101561081757600080fd5b9392505050565b6001600160a01b03821661083157600080fd5b600554610844908263ffffffff61080516565b6005556001600160a01b038216600090815260036020526040902054610870908263ffffffff61080516565b6001600160a01b03831660008181526003602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6001600160a01b0382166108db57600080fd5b6005546108ee908263ffffffff6107f016565b6005556001600160a01b03821660009081526003602052604090205461091a908263ffffffff6107f016565b6001600160a01b0383166000818152600360209081526040808320949094558351858152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35050565b61097b82826108c8565b6001600160a01b0382166000908152600460209081526040808320338085529252909120546105849184916104e0908563ffffffff6107f016565b6109c760068263ffffffff610a7b16565b6040516001600160a01b038216907f6ae172837ea30b801fbfcdd4108aa1d5bf8ff775444fd70256b44e6bf3dfc3f690600090a250565b610a0f60068263ffffffff610ac716565b6040516001600160a01b038216907fe94479a9f7e1952cc78f2d6baab678adc1b772d936c6583def489e524cb6669290600090a250565b60006001600160a01b038216610a5b57600080fd5b506001600160a01b03166000908152602091909152604090205460ff1690565b6001600160a01b038116610a8e57600080fd5b610a988282610a46565b15610aa257600080fd5b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b6001600160a01b038116610ada57600080fd5b610ae48282610a46565b610aed57600080fd5b6001600160a01b0316600090815260209190915260409020805460ff1916905556fea165627a7a72305820e8c403b9e18edec6d5a977a0c27a9409291b0e6b0170c5262b895a0d52e583db0029000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000003635c9adc5dea00000000000000000000000000000000000000000000000000000000000000000000a5465737420546f6b656e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000354544b0000000000000000000000000000000000000000000000000000000000820fe7a012c82e8a05778e3c1dfa1a54cad99e6d47ea9017dad8cda61156589e26cdc88aa02e5669ba466b7f01dbb4563eaedbbf2ca90a54d5c60b65f5ed3cb445c9ea18e0"],"id":13}' http://localhost:8545

A valid transaction hash is generated for the above call.

Then we ask for the receipt:
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0x2b3f88403b3fe88ae93cd8173dfbb24d542c950e46668d70b509db9608973569"],"id":14}' http://localhost:8545

ganache and pantheon both return status 0x1, "gasUsed":"0xf5f96". That's 1,007,510.
parity returns status 0x0,"gasUsed":"0x5b8d80", which is 6,000,000, set originally in the transaction.

Expected result: parity deploys the transaction at address 0xaf432c70f0ac4964a264981833d021094d419cee

@AC0DEM0NK3Y
Copy link

I seem to be encountering this issue also. I have tried v2.4.7 and subsequently also tried other releases all the way down to 2.1.11 and I have the same result as above, the creates tx always consumes max gas amount given to it.

@nbt-rezaem
Copy link
Contributor Author

I figured it out. --config dev is outdated, as is the wiki documentation at https://wiki.parity.io/Private-development-chain

--config dev does not have Constantinople EIPs activated. I passed this into the --chain config and it works:

{
    "name": "DevelopmentChain",
    "engine": {
        "instantSeal": null
    },
    "params": {
        "gasLimitBoundDivisor": "0x0400",
        "accountStartNonce": "0x0",
        "maximumExtraDataSize": "0x20",
        "minGasLimit": "0x1388",
        "networkID" : "0x11",
        "registrar" : "0x0000000000000000000000000000000000001337",
        "eip150Transition": "0x0",
        "eip160Transition": "0x0",
        "eip161abcTransition": "0x0",
        "eip161dTransition": "0x0",
        "eip155Transition": "0x0",
        "maxCodeSize": 24576,
        "maxCodeSizeTransition": "0x0",
        "eip140Transition": "0x0",
        "eip145Transition": "0x0",
        "eip1014Transition": "0x0",
        "eip1052Transition": "0x0",
        "eip211Transition": "0x0",
        "eip214Transition": "0x0",
        "eip658Transition": "0x0",

        "wasmActivationTransition": "0x0"
    },
    "genesis": {
        "seal": {
            "generic": "0x0"
        },
        "difficulty": "0x20000",
        "author": "0x0000000000000000000000000000000000000000",
        "timestamp": "0x00",
        "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "extraData": "0x",
        "gasLimit": "0x7A1200"
    },
    "accounts": {
        "0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
        "0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
        "0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
        "0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
        "0000000000000000000000000000000000000005": { "balance": "1", "builtin": { "name": "modexp", "activate_at": 0, "pricing": { "modexp": { "divisor": 20 } } } },
        "0000000000000000000000000000000000000006": { "balance": "1", "builtin": { "name": "alt_bn128_add", "activate_at": 0, "pricing": { "linear": { "base": 500, "word": 0 } } } },
        "0000000000000000000000000000000000000007": { "balance": "1", "builtin": { "name": "alt_bn128_mul", "activate_at": 0, "pricing": { "linear": { "base": 40000, "word": 0 } } } },
        "0000000000000000000000000000000000000008": { "balance": "1", "builtin": { "name": "alt_bn128_pairing", "activate_at": 0, "pricing": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 } } } },
        "00a329c0648769a73afac7f9381e08fb43dbea72": { "balance": "1606938044258990275541962092341162602522202993782792835301376" }
}
}

nbt-rezaem added a commit to nbt-rezaem/parity-ethereum that referenced this issue Jun 28, 2019
nbt-rezaem added a commit to nbt-rezaem/parity-ethereum that referenced this issue Jun 28, 2019
dvdplm pushed a commit that referenced this issue Jun 28, 2019
dvdplm pushed a commit that referenced this issue Oct 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants