Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy / Clone pattern for core contracts #15

Open
0xjei opened this issue Jan 16, 2025 · 0 comments
Open

Proxy / Clone pattern for core contracts #15

0xjei opened this issue Jan 16, 2025 · 0 comments
Milestone

Comments

@0xjei
Copy link
Member

0xjei commented Jan 16, 2025

I’ve been experimenting with clones with immutable args (check out the Solady LibClone library)

Why am I looking into this?
Right now, Excubiae lets you deploy your specific Checker with specific parameters (like a set of external addresses for verifiers - used to verify the attributes / criteria). Same for Policy contracts—you tie them to one Checker. But here’s the thing: If you want different parameters for different contracts, you have to redeploy everything from scratch every time. Basically, the current setup works but locks us into using the same config across multiple contracts (in reality, is one contract keeping a mapping of mapping to guarantee separate state for different contracts).

Proposed solution
This is a simple yet non invasive gas efficient solution: Clones with immutable args. Why this specific proxy/clone pattern?

  • Gas savings compared to storage variables.
  • No issues with storage collision like other proxies.
  • No need for heavy redeployments—it’s lightweight.

The biggest changes are:

  • We use a factory to deploy clones/proxies.
  • The implementation pulls immutable args instead of relying on storage. In order to do this, you need to go byte per byte in order to rescue vars, not so bad for the dev ex.
@0xjei 0xjei added this to the [MVP-2] Arms milestone Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant