Skip to content

bug: failing tests on oft-upgradeable example #1724

@dreamt1m

Description

@dreamt1m

Describe the bug
Have issue when running tests on upgradable OFT

To Reproduce
Steps to reproduce the behavior:

  1. Clone repo (main branch)
  2. Copy examples/oft-upgradeable to separate folder
  3. Restore packages with pnpm i
  4. Run pnpm test:hardhat
  5. See error

Expected behavior
Tests finished successfully

Actual behavior

Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: <SPDX-License>" to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information.
--> @layerzerolabs/oft-evm-upgradeable/contracts/oft/FeeUpgradeable.sol


Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: <SPDX-License>" to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information.
--> @layerzerolabs/oft-evm/contracts/interfaces/IFee.sol


Compiled 57 Solidity files successfully (evm target: paris).


  MyOFTUpgradeable Test
Warning: Potentially unsafe deployment of contracts/MyOFTUpgradeable.sol:MyOFTUpgradeable

    You are using the `unsafeAllow.state-variable-immutable` flag.

Warning: Potentially unsafe deployment of contracts/MyOFTUpgradeable.sol:MyOFTUpgradeable

    You are using the `unsafeAllow.constructor` flag.

Warning: Potentially unsafe deployment of contracts/MyOFTUpgradeable.sol:MyOFTUpgradeable

    contracts\MyOFTUpgradeable.sol:12: Incorrect order of parent initializer calls.
    - Found initializer calls to parent contracts in the following order: ERC20Upgradeable, OAppCoreUpgradeable, OAppUpgradeable, OFTCoreUpgradeable, OFTUpgradeable, OwnableUpgradeable
    - Expected: OwnableUpgradeable, OAppSenderUpgradeable, OAppReceiverUpgradeable, OFTUpgradeable
        Call parent initializers in linearized order

Warning: Potentially unsafe deployment of contracts/MyOFTUpgradeable.sol:MyOFTUpgradeable

    contracts\MyOFTUpgradeable.sol:12: Incorrect order of parent initializer calls.
    - Found initializer calls to parent contracts in the following order: ERC20Upgradeable, OAppCoreUpgradeable, OAppUpgradeable, OFTCoreUpgradeable, OFTUpgradeable, OwnableUpgradeable
    - Expected: OwnableUpgradeable, OAppSenderUpgradeable, OAppReceiverUpgradeable, OFTUpgradeable
        Call parent initializers in linearized order

Warning: Potentially unsafe deployment of contracts/MyOFTUpgradeable.sol:MyOFTUpgradeable

    contracts\MyOFTUpgradeable.sol:12: Incorrect order of parent initializer calls.
    - Found initializer calls to parent contracts in the following order: ERC20Upgradeable, OAppCoreUpgradeable, OAppUpgradeable, OFTCoreUpgradeable, OFTUpgradeable, OwnableUpgradeable
    - Expected: OwnableUpgradeable, OAppSenderUpgradeable, OAppReceiverUpgradeable, OFTUpgradeable
        Call parent initializers in linearized order

Warning: Potentially unsafe deployment of contracts/MyOFTUpgradeable.sol:MyOFTUpgradeable

    contracts\MyOFTUpgradeable.sol:12: Incorrect order of parent initializer calls.
    - Found initializer calls to parent contracts in the following order: ERC20Upgradeable, OAppCoreUpgradeable, OAppUpgradeable, OFTCoreUpgradeable, OFTUpgradeable, OwnableUpgradeable
    - Expected: OwnableUpgradeable, OAppSenderUpgradeable, OAppReceiverUpgradeable, OFTUpgradeable
        Call parent initializers in linearized order

Warning: Potentially unsafe deployment of contracts/MyOFTUpgradeable.sol:MyOFTUpgradeable

    contracts\MyOFTUpgradeable.sol:12: Incorrect order of parent initializer calls.
    - Found initializer calls to parent contracts in the following order: ERC20Upgradeable, OAppCoreUpgradeable, OAppUpgradeable, OFTCoreUpgradeable, OFTUpgradeable, OwnableUpgradeable
    - Expected: OwnableUpgradeable, OAppSenderUpgradeable, OAppReceiverUpgradeable, OFTUpgradeable
        Call parent initializers in linearized order

    1) should upgrade


  0 passing (698ms)
  1 failing
  1) MyOFTUpgradeable Test
       should upgrade:
     Error: Contract `contracts/MyOFTUpgradeable.sol:MyOFTUpgradeable` is not upgrade safe

contracts\MyOFTUpgradeable.sol:11: Missing initializer calls for one or more parent contracts: `OAppSenderUpgradeable, OAppReceiverUpgradeable`
    Call the parent initializers in your initializer function
    https://zpl.in/upgrades/error-001
      at assertUpgradeSafe (node_modules\.pnpm\@[email protected]\node_modules\@openzeppelin\upgrades-core\src\validate\query.ts:20:11)
      at validateImpl (node_modules\.pnpm\@openzeppelin+hardhat-upgra_23acfe516f02566f034ed04c3677ea45\node_modules\@openzeppelin\hardhat-upgrades\src\utils\validate-impl.ts:42:20)
      at validateProxyImpl (node_modules\.pnpm\@openzeppelin+hardhat-upgra_23acfe516f02566f034ed04c3677ea45\node_modules\@openzeppelin\hardhat-upgrades\src\utils\validate-impl.ts:63:10)
      at async deployProxyImpl (node_modules\.pnpm\@openzeppelin+hardhat-upgra_23acfe516f02566f034ed04c3677ea45\node_modules\@openzeppelin\hardhat-upgrades\src\utils\deploy-impl.ts:73:3)
      at async Proxy.deployProxy (node_modules\.pnpm\@openzeppelin+hardhat-upgra_23acfe516f02566f034ed04c3677ea45\node_modules\@openzeppelin\hardhat-upgrades\src\deploy-proxy.ts:45:28)
      at async Context.<anonymous> (test\hardhat\MyOFTUpgradeable.test.ts:58:34)

Environment (please complete the following information):

  • OS: Windows
  • OS Version: 10
  • VM: node
  • VM Version: 24.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions