What version of Truffle are you using? Is this local or a global install?
What operating system are you using?
Can you share your networks configuration from truffle-config.js for your development network that you are deploying to? ( Please do not include any secrets such as private keys or API keys)
I tried to reproduce with the following example with a larger number of parameters but didn’t get any issues. I am using Windows Subsystem for Linux (WSL2) on Windows 10.
Box.sol
// contracts/Box.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
contract Box {
uint256 private value;
// Emitted when the stored value changes
event ValueChanged(uint256 newValue);
// Stores a new value in the contract
function store(uint256 newValue) public {
value = newValue;
emit ValueChanged(newValue);
}
// Stores a new value in the contract
function initialize(address a1, address a2, address a3, address a4, address a5, address a6, address a7) public {
value = 23;
emit ValueChanged(23);
}
// Reads the last stored value
function retrieve() public view returns (uint256) {
return value;
}
}
Can you try reproducing the bug with a minimal contract or project? I understand that you can’t share your actual contracts but a way to reproduce the error would be extremely helpful for us to debug and find out what’s going on. Thank you.
We have found an error in Upgrades Plugins for Truffle and Hardhat. Users of the flag unsafeAllowCustomTypes should update their dependencies to the latest version.
And the run truffle migrate twice.
The first time i see error: “Oracle” is an abstract contract or an interface and cannot be deployed.
The second time: TypeError: Cannot read property ‘evm’ of undefined
I can’t reproduce the issue. In your example there are two contracts with name Oracle, one of them an interface. That could be a source of non determinism and it could be related to the problem.
Okay I was able to identify what is causing the issue in this particular case. Thanks for providing the example!
It is indeed due to the duplicate contract/interface name, and in particular because one of the two duplicates is colocated in the same file with another contract. Since Truffle emits the artifact for only one of the duplicates, it turns out that we have the AST for one but not its bytecode. We need to account for this situation.
As a workaround, avoid having multiple contracts with the same name. I’m not aware of a situation where this is actually required.