Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suicides to non-existant address create a contract in the state. #119

Closed
davidjaenson opened this issue May 29, 2017 · 0 comments
Closed
Assignees

Comments

@davidjaenson
Copy link
Contributor

davidjaenson commented May 29, 2017

Description

A suicide with an argument to a non-existant address creates a new account at that address in the state. This seems like unintended behaviour according to our model.

Steps to reproduce

  1. Start qtumd in regtest mode: ./qtumd -regtest
  2. Mine some blocks: ./qtum-cli -regtest generate 20
  3. Create a new contract that suicides and refunds the contract's balance to the address at 0xe0e on calling the fallback function, store the contract's address for later use CONTRACT=$(./qtum-cli -regtest createcontract "60606040523415600b57fe5b5b603d8060196000396000f30060606040525b600f5b610e0eff5b565b0000a165627a7a723058209e90cd77b49430d225c3ebd97a7eabf1282254a9d0260e71448f338a40207fa10029" | python3 -c "import json; import sys; print(json.loads(sys.stdin.read())['address'])")
  4. Mine this tx: ./qtum-cli -regtest generate 1
  5. Send a tx that calls the fallback function: ./qtum-cli -regtest sendtocontract $CONTRACT "00"
  6. Mine this tx: ./qtum-cli -regtest generate 1
  7. List the contracts that currently exists: ./qtum-cli -regtest listcontracts

Expected results:

  1. No contracts should exists.

Actual results:

  1. A contract exists

Suicide contract:

pragma solidity ^0.4.11;

contract Test {
    function () payable {
        suicide(0xe0e);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants