Trouble deploying UUPS contract with Remix in non-shanghai

Hello. I'm having some trouble deploying an UUPS upgradable smartcontract after the v5 release in the paris evm version. My smartcontract is the simplest one that can be auto generated by simply checking the UUPS upgradeability feature in the contract wizard, but I changed ^0.8.20 to ^0.8.19.

The deployment is a two step process. The first smart contract is deployed with success, but the second one (which should be the proxy, as far as I know) fails with this message:

Error occured: invalid opcode.

invalid opcode

The execution might have thrown.

And the transaction status ends up being:

status false Transaction mined but execution failed

What is the correct way to deploy this smart contract? Do I need to still use a v4 release? Which one should I use and how do I select it using remix?

Thanks in advance!

:1234: Code to reproduce

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";

contract MyContract is Initializable, OwnableUpgradeable, UUPSUpgradeable {
    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        _disableInitializers();
    }

    function initialize(address initialOwner) initializer public {
        __Ownable_init(initialOwner);
        __UUPSUpgradeable_init();
    }

    function _authorizeUpgrade(address newImplementation)
        internal
        onlyOwner
        override
    {}
}

:computer: Environment

I'm using remix. In advanced configurations, I chose evm version: paris. The compiler is 0.8.21, and the environment is Remix VM (Merge).

Check my answer at Hardhat Deploy ProviderError: stack-underflow - #2 by barakman.

Remix deploys the UUPS proxy contract using precompiled bytecode. I've opened https://github.com/ethereum/remix-project/issues/4135 for Remix to compile the UUPS proxy for older EVM versions.

Thank you for the answers.

I imagined something like that was happening. It's a two step deploy process, and it seemed that the advanced configurations was being applied only to the first step, but not the second one.

In the end, I ended up learning how to manually deploy the proxy smart contract and make it point to my implementation. This way I managed to compile the proxy code using an older EVM version and everything worked fine. I think this is the only solution for now.

The topic can be closed if the moderators want to do so. Thank you, again.

1 Like