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

It is necessary? #1225

Closed
chenjiaweiprimeledger opened this issue Nov 1, 2018 · 1 comment
Closed

It is necessary? #1225

chenjiaweiprimeledger opened this issue Nov 1, 2018 · 1 comment
Labels
Projects

Comments

@chenjiaweiprimeledger
Copy link

chenjiaweiprimeledger commented Nov 1, 2018

  1. org.ethereum.core.TransactionExecutor#create
    AccountState existingAddr = cacheTrack.getAccountState(newContractAddress);
    if (existingAddr != null && existingAddr.isContractExist(blockchainConfig)) {
    execError("Trying to create a contract with existing contract address: 0x" + toHexString(newContractAddress));
    m_endGas = BigInteger.ZERO;
    return;
    }

existingAddr will not exists, because the nonce of the sender has been checked in org.ethereum.core.TransactionExecutor#init

  1. org.ethereum.core.TransactionExecutor#create
    //In case of hashing collisions (for TCK tests only), check for any balance before createAccount()
    BigInteger oldBalance = track.getBalance(newContractAddress);
    cacheTrack.createAccount(tx.getContractAddress());
    cacheTrack.addBalance(newContractAddress, oldBalance);

It is rude to transfer balance of same-address contract to the new contract ?

@mkalinin mkalinin added this to Backlog in Core via automation Nov 7, 2018
@mkalinin
Copy link
Contributor

mkalinin commented Nov 7, 2018

  1. Relates to Prevent overwriting contracts EIPs#684
  2. Relates only to tests from #ethereum/tests repository, it hardly could happen on main or any other network.

@mkalinin mkalinin closed this as completed Nov 7, 2018
Core automation moved this from Backlog to Done Nov 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Core
  
Done
Development

No branches or pull requests

2 participants