You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
When a parent contract imports and dynamically creates a child contract in code and the child contract gets incrementally changed, Truffle is not rebuilding the parent contract.
Steps to Reproduce
Ignoring obvious leaks in the following test code, create two simple contracts and the following migration:
Parent.sol
pragma solidity ^0.4.4;
import "./Child.sol";
contract Parent {
address public child;
function newChild(uint a, uint b) {
child = new Child(a, b);
}
function doChildAction() constant returns (uint) {
return Child(child).doAction();
}
}
Child.sol
pragma solidity ^0.4.4;
contract Child {
uint public a;
uint public b;
function Child(uint _a, uint _b) {
a = _a;
b = _b;
}
function doAction() constant returns (uint) {
return a + b;
}
}
2_deploy_contracts.js
var Parent = artifacts.require("./Parent.sol");
var Child = artifacts.require("./Child.sol");
module.exports = function(deployer) {
deployer.deploy(Parent);
deployer.deploy(Child);
};
From the console, compile and migrate the contracts and create a child by calling Parent.newChild(10, 2). Verify that Parent.doChildAction() returns 12.
In the source file Child.sol, change the doAction() code from 'return a+b' to 'return a-b'.
Recompile from the console: "compile". Notice that only Child.sol gets rebuilt.
'migrate --reset' and repeat step 1. Verify that Parent.doChildAction() still returns 12.
Expected Behavior
Step 3 should have recompiled Parent.sol since it needs the modified Child binary code for new.
Step 4 should have returned 8, not 12.
Environment
Operating System: Linux Mint 17.2 (Ubuntu / Debian compatible)
Truffle version: v3.2.1
Ethereum client: EthereumJS TestRPC v3.0.3
npm version: 3.10.8
The text was updated successfully, but these errors were encountered:
Issue
When a parent contract imports and dynamically creates a child contract in code and the child contract gets incrementally changed, Truffle is not rebuilding the parent contract.
Steps to Reproduce
Ignoring obvious leaks in the following test code, create two simple contracts and the following migration:
Parent.sol
Child.sol
2_deploy_contracts.js
From the console, compile and migrate the contracts and create a child by calling Parent.newChild(10, 2). Verify that Parent.doChildAction() returns 12.
In the source file Child.sol, change the doAction() code from 'return a+b' to 'return a-b'.
Recompile from the console: "compile". Notice that only Child.sol gets rebuilt.
'migrate --reset' and repeat step 1. Verify that Parent.doChildAction() still returns 12.
Expected Behavior
Step 3 should have recompiled Parent.sol since it needs the modified Child binary code for new.
Step 4 should have returned 8, not 12.
Environment
The text was updated successfully, but these errors were encountered: