Skip to content

Commit

Permalink
Assigned EIP number
Browse files Browse the repository at this point in the history
  • Loading branch information
theethernaut committed Sep 20, 2024
1 parent 790abef commit 16336ea
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions ERCS/erc-9999.md → ERCS/erc-7771.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Title: Router Proxy

Check failure on line 1 in ERCS/erc-7771.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

first line must be `---` exactly

error: first line must be `---` exactly --> ERCS/erc-7771.md | 1 | Title: Router Proxy |

Check failure on line 1 in ERCS/erc-7771.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

first line must be `---` exactly

error: first line must be `---` exactly --> ERCS/erc-7771.md | 1 | Title: Router Proxy |
Description: A Simple Standard for Proxies with Multiple Hardcoded Implementations
Author: Alejandro Santander (@theethernaut), Noah Litvin (@noahlitvin)
Discussions: https://ethereum-magicians.org/t/erc-xxxx-router-proxy/21137
Discussions: https://ethereum-magicians.org/t/erc-7771-router-proxy/21137
Status: Draft
Type: Standards Track
Category: ERC
Expand All @@ -26,7 +26,7 @@ The Router Proxy Standard we propose retains the advantages of the Diamond Proxy
## Specification

The router proxy is a smart contract with no declared interface other than a fallback function, which maps dynamic incoming function calls to one of its many implementation modules, without the use of `SLOAD`.
![1](../assets/erc-9999/1.avif)
![1](../assets/erc-7771/1.avif)

The router MUST revert with `UnknownSelector(bytes4 sig)` if the incoming function selector is not implemented by any of its modules.

Expand Down Expand Up @@ -150,11 +150,11 @@ Interfaces can be automatically generated to interact with protocols employing t
### Overview

In a regular proxy, an incoming call to function `b()` is forwarded using `DELEGATECALL` to the proxy’s current implementation.
![2](../assets/erc-9999/2.avif)
![2](../assets/erc-7771/2.avif)

The router proxy is similar to a regular proxy, in that it receives incoming calls and forwards them to an implementation, the only difference being that a router may forward the call one of many —simultaneous— implementation contracts. It decides which implementation to forward to using a hardcoded lookup table that maps function selectors to their corresponding implementation contracts, without the need of using storage.

![3](../assets/erc-9999/1.avif)
![3](../assets/erc-7771/1.avif)

In the example above, the lookup table is used to determine that the selector for the function `b()` is implemented in the address of `ModuleB`.

Expand Down Expand Up @@ -319,7 +319,7 @@ An important thing to point out, is that router proxies are not necessarily upgr

However, this doesn’t mean that upgradeability cannot be used with router proxies. In fact, it is very easy to do so by setting a router as the implementation of an upgradeable proxy, and forwarding the call twice.

![4](../assets/erc-9999/4.avif)
![4](../assets/erc-7771/4.avif)

The apparent inefficiency of forwarding the call twice is compensated by the router’s hardcoded lookup table efficiency and the use of UUPS proxies ([Universal Upgradeable Proxy Standard](https://eips.ethereum.org/EIPS/eip-1822)).

Expand Down Expand Up @@ -351,13 +351,13 @@ Since the execution context is the router contract (or a proxy contract if the r

To illustrate, if modules `ModuleA` and `ModuleB` both declare a variable at `slot 0` of storage, a collision occurs.

![5](../assets/erc-9999/5.avif)
![5](../assets/erc-7771/5.avif)

To resolve this issue, we propose developers to use unstructured storage everywhere. The diamond standard presents a very elegant solution to solve this problem called “storage namespaces”, which we here adhere to.

Storage namespaces are actually very simple, consisting of picking a “random” slot in storage to store a particular data structure of the application.

![6](../assets/erc-9999/6.avif)
![6](../assets/erc-7771/6.avif)

The following contract implements a storage namespace for storing information about the owner of the system, using such unstructured storage.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 16336ea

Please sign in to comment.