Skip to content

Optimize BeaconProxy deployment costs avoiding storage writes #4954

Open
@lastperson

Description

@lastperson

🧐 Motivation
Currently BeaconProxy design while correctly using an immutable variable to store the beacon address, still writes the same address to storage with an explanation: "so that it can be accessed externally"
Lets avoid storage modification to reduce deployment costs.

📝 Details
Proxies are meant to be deployed as cheap as possible. Paying extra 24000 gas per deployment just to simplify the external access to the beacon address, which is also prone to become out of sync with the actual immutable value sounds like a bad deal.
Immutable variable could also be read from the proxy directly, just need to know the location in code.
Deployment gas with storage write: 167k
Deployment gas without storage write: 143k

This commit introduces the necessary changes: lastperson@3eb97b4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions