diff --git a/packages/core/contracts/test/cli/excludes/AbstractUUPS.sol b/packages/core/contracts/test/cli/excludes/AbstractUUPS.sol index 85005b80b..8e4a3e554 100644 --- a/packages/core/contracts/test/cli/excludes/AbstractUUPS.sol +++ b/packages/core/contracts/test/cli/excludes/AbstractUUPS.sol @@ -11,4 +11,8 @@ abstract contract AbstractUUPS is UUPSUpgradeable, Abstract1, Abstract2 { constructor(uint256 _x, uint256 _y, uint256 _z) Abstract1(_x) Abstract2(_y) { z = _z; } + + function initialize() initializer public { + __UUPSUpgradeable_init(); + } } \ No newline at end of file diff --git a/packages/core/contracts/test/cli/excludes/UsesAbstractUUPS.sol b/packages/core/contracts/test/cli/excludes/UsesAbstractUUPS.sol index 4a6f7f76b..426a330d6 100644 --- a/packages/core/contracts/test/cli/excludes/UsesAbstractUUPS.sol +++ b/packages/core/contracts/test/cli/excludes/UsesAbstractUUPS.sol @@ -12,4 +12,8 @@ contract UsesAbstractUUPS is AbstractUUPS { function _authorizeUpgrade(address newImplementation) internal pure override { revert("Upgrade disabled"); } + + function initializeChild() initializer public { + super.initialize(); + } } \ No newline at end of file diff --git a/packages/core/src/validate/run.ts b/packages/core/src/validate/run.ts index 6099bb06c..662b2e85e 100644 --- a/packages/core/src/validate/run.ts +++ b/packages/core/src/validate/run.ts @@ -734,8 +734,6 @@ function* getInitializerErrors( !skipCheck('missing-initializer-call', contractDef) && !skipCheck('missing-initializer-call', contractInitializer) ) { - console.log('contractDef', contractDef.name); - console.log('uninitializedBaseContracts', uninitializedBaseContracts); yield { kind: 'missing-initializer-call', name: contractDef.name, @@ -756,9 +754,11 @@ function getPossibleInitializers(contractDef: ContractDefinition) { const fns = [...findAll('FunctionDefinition', contractDef)]; return fns.filter( fnDef => - fnDef.modifiers.some(modifier => + (fnDef.modifiers.some(modifier => ['initializer', 'reinitializer', 'onlyInitializing'].includes(modifier.modifierName.name), - ) || ['initialize', 'initializer', 'reinitialize', 'reinitializer'].includes(fnDef.name), + ) || ['initialize', 'initializer', 'reinitialize', 'reinitializer'].includes(fnDef.name)) + && + !(fnDef.virtual && !fnDef.body) // Skip virtual functions without a body, since that indicates an abstract function and is not itself an initializer ); }