We're updating the issue view to help you get more done. 

Reverting transactions on contract instance created inside a contract

Description

When trying to create a new contract instance within a transaction function the created contract is not always reachable.

When trying to call the following set of functions:

1 2 3 4 function setContract() public { SimpleStorage2 sscontract = new SimpleStorage2(); ss2addr = address(sscontract); }

To create a new contract instance and store the address within the contract.

1 2 3 4 5 function setValues(bytes32 x, bytes32 y) public { SimpleStorage2 instance = SimpleStorage2(ss2addr); instance.set(x, y); }

To manipulate the new contract instance by calling a function within it

The transaction reverts when calling the second functio.

Subsequentially using the below function does return the contract address, but returns empty values for the storeddata points.

1 2 3 4 function get1() public view returns (address retVal3,bytes32 retVal, bytes32 retVal2) { SimpleStorage2 instance = SimpleStorage2(ss2addr); return (ss2addr, instance.storedData(), instance.storedData2()); }

This functionality should work on the EVM and shows to be working using a Parity Client.

It is impossible to create a new contract instance in a transaction and later use this created instance in a new function. It is however possible to create the contract instance on the initial deployment of the contract that creates the instance, this is however not sufficient for my solution.

Setup:
Using the latest pantheon version running inside a docker container
Running a dev chain setup, using the chain-spec file in the github (dev config), only adding a new account to the chain spec.
The following TOML was used:

1 2 3 4 5 6 7 8 9 10 11 12 genesis-file = "/home/pantheon/chain-spec.json" data-path = "/tmp/pantheondata" min-gas-price=0 miner-enabled=true miner-coinbase="0xa841fea0ad4564a1f02507fbe1f844b5312f9897" host-whitelist=["*"] rpc-http-enabled=true rpc-http-api=["ETH","NET","WEB3"] rpc-http-cors-origins=["*"] rpc-http-port = 8545 rpc-ws-port = 8546

Environment

None

Status

Assignee

Danno Ferrin

Reporter

Wietze Slagman

Labels

Scrum Team

Chupacabra

Refinement State

Not Started

Priority

P3