Skip to content

CBOR data should be included into the bytecode #219

@KitHat

Description

@KitHat

Problem
The OpenZeppelin Upgrades plugin uses contract bytecode to distinguish between artifacts and locate storage layouts. Currently, resolc generates identical bytecode for contracts that differ only in their storage layout (e.g., different __gap sizes), causing the plugin to fail to differentiate between contract versions.
Example
These two contracts produce identical bytecode:

contract GapV1 {
    string greeting;
    uint256[49] private __gap;
    uint256 end;
}

contract GapV2 {
    string greeting;
    uint256 new1;
    uint256 new2;
    uint256[47] private __gap;
    uint256 end;
}

Root Cause
resolc does not append CBOR metadata to the bytecode, which would normally differentiate contracts with identical runtime logic but different source code or storage layouts.
Related Issues

Depends on: #379 (should be tested after this issue is resolved)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions